From c6232d977fe230043b21a04387163cb2b6127d60 Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Mon, 30 Dec 2024 15:18:40 +0100 Subject: [PATCH] address comments --- include/finufft/finufft_core.h | 6 +++--- src/finufft_core.cpp | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/finufft/finufft_core.h b/include/finufft/finufft_core.h index f3cb14146..a20106dc3 100644 --- a/include/finufft/finufft_core.h +++ b/include/finufft/finufft_core.h @@ -160,10 +160,10 @@ template struct FINUFFT_PLAN_T { // the main plan class, fully C++ std::array mstu; // number of modes in x/y/z dir (historical CMCL name) = // N1/N2/N3 - UBIGINT N; // total # modes (prod of above three) + inline UBIGINT N() { return mstu[0]*mstu[1]*mstu[2]; } // total # modes (prod of above three) - std::array nf123 = {1, 1, 1}; // size of internal fine grid in x/y/z - // direction + std::array nf123{1, 1, 1}; // size of internal fine grid in x/y/z + // direction UBIGINT nf = 1; // total # fine grid points (product of the above three) int fftSign; // sign in exponential for NUFFT defn, guaranteed to be +-1 diff --git a/src/finufft_core.cpp b/src/finufft_core.cpp index d6522a974..823972203 100644 --- a/src/finufft_core.cpp +++ b/src/finufft_core.cpp @@ -476,7 +476,7 @@ static int deconvolveBatch(int batchSize, FINUFFT_PLAN_T *p, std::complex for (int i = 0; i < batchSize; i++) { std::complex *fwi = p->fwBatch.data() + i * p->nf; // start of i'th fw array in // wkspace - std::complex *fki = fkBatch + i * p->N; // start of i'th fk array in fkBatch + std::complex *fki = fkBatch + i * p->N(); // start of i'th fk array in fkBatch // Call routine from common.cpp for the dim; prefactors hardcoded to 1.0... if (p->dim == 1) @@ -625,10 +625,8 @@ FINUFFT_PLAN_T::FINUFFT_PLAN_T(int type_, int dim_, const BIGINT *n_modes, i } if (type != 3) { // read in user Fourier mode array sizes... - N = 1; for (int idim = 0; idim < 3; ++idim) { mstu[idim] = (idim < dim) ? n_modes[idim] : 1; - N *= mstu[idim]; } } @@ -638,8 +636,8 @@ FINUFFT_PLAN_T::FINUFFT_PLAN_T(int type_, int dim_, const BIGINT *n_modes, i if (tol >= (TF)1E-9) { // the tol sigma=5/4 can reach if (type == 3) // could move to setpts, more known? opts.upsampfac = 1.25; // faster b/c smaller RAM & FFT - else if ((dim == 1 && N > 10000000) || (dim == 2 && N > 300000) || - (dim == 3 && N > 3000000)) // type 1,2 heuristic cutoffs, double, + else if ((dim == 1 && N() > 10000000) || (dim == 2 && N() > 300000) || + (dim == 3 && N() > 3000000)) // type 1,2 heuristic cutoffs, double, // typ tol, 12-core xeon opts.upsampfac = 1.25; } @@ -993,7 +991,7 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { int thisBatchSize = std::min(ntrans - b * batchSize, batchSize); int bB = b * batchSize; // index of vector, since batchsizes same std::complex *cjb = cj + bB * nj; // point to batch of weights - std::complex *fkb = fk + bB * N; // point to batch of mode coeffs + std::complex *fkb = fk + bB * N(); // point to batch of mode coeffs if (opts.debug > 1) printf("[%s] start batch %d (size %d):\n", __func__, b, thisBatchSize);