From 2f03fc58b49ef6930aa2b84a8d8a7bed138800e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Thu, 23 Jan 2020 17:01:31 +0200 Subject: [PATCH] Expose qpms_trans_calculator_get_AB_arrays_precalcbuf() Former-commit-id: 151d3f7bf615366cad3da5589f3165f452c00474 --- qpms/translations.c | 10 ++++++---- qpms/translations_inlines.h | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/qpms/translations.c b/qpms/translations.c index 4564976..231767a 100644 --- a/qpms/translations.c +++ b/qpms/translations.c @@ -610,12 +610,14 @@ int qpms_trans_calculator_get_AB_buf_p(const qpms_trans_calculator *c, } int qpms_trans_calculator_get_AB_arrays_precalcbuf(const qpms_trans_calculator *c, - complex double *Adest, complex double *Bdest, + qpms_y_t lMax, complex double *Adest, complex double *Bdest, size_t deststride, size_t srcstride, double kdlj_phi, const complex double *bessel_buf, const double *legendre_buf) { + if(lMax == 0) lMax = c->lMax; + QPMS_ASSERT(lMax <= c->lMax); size_t desti = 0, srci = 0; - for (int n = 1; n <= c->lMax; ++n) for (int m = -n; m <= n; ++m) { - for (int nu = 1; nu <= c->lMax; ++nu) for (int mu = -nu; mu <= nu; ++mu) { + for (int n = 1; n <= lMax; ++n) for (int m = -n; m <= n; ++m) { + for (int nu = 1; nu <= lMax; ++nu) for (int mu = -nu; mu <= nu; ++mu) { #ifndef NDEBUG size_t assertindex = qpms_trans_calculator_index_mnmunu(c,m,n,mu,nu); #endif @@ -655,7 +657,7 @@ int qpms_trans_calculator_get_AB_arrays_buf(const qpms_trans_calculator *c, costheta,-1,legendre_buf)); QPMS_ENSURE_SUCCESS(qpms_sph_bessel_fill(J, 2*c->lMax+1, kdlj.r, bessel_buf)); } - return qpms_trans_calculator_get_AB_arrays_precalcbuf(c, Adest, Bdest, + return qpms_trans_calculator_get_AB_arrays_precalcbuf(c, c->lMax, Adest, Bdest, deststride, srcstride, kdlj.phi, bessel_buf, legendre_buf); } diff --git a/qpms/translations_inlines.h b/qpms/translations_inlines.h index 854bdc3..5509f70 100644 --- a/qpms/translations_inlines.h +++ b/qpms/translations_inlines.h @@ -34,5 +34,9 @@ static inline void qpms_trans_array_from_AB( } } - +int qpms_trans_calculator_get_AB_arrays_precalcbuf(const qpms_trans_calculator *c, + qpms_y_t lMax, complex double *Adest, complex double *Bdest, + size_t deststride, size_t srcstride, double kdlj_phi, + const complex double *bessel_buf, const double *legendre_buf); + #endif