Fix missing import in finiterectlat-scatter.py
[qpms.git] / qpms / translations_inlines.h
blob854bdc3f20f118991320c29634a95b22b6c949fc
1 #ifndef TRANSLATIONS_INLINES_H
2 #define TRANSLATIONS_INLINES_H
3 #include "translations.h"
4 #include "indexing.h"
6 /// Rearranges the default-ordered "A,B" array elements into "bspec"-defined matrix.
7 // TODO DOC
8 static inline void qpms_trans_array_from_AB(
9 complex double *t,
10 const qpms_vswf_set_spec_t *const t_destspec,
11 const size_t t_deststride,
12 const qpms_vswf_set_spec_t *const t_srcspec,
13 const size_t t_srcstride,
14 const complex double *const A, const complex double *const B,
15 /// A and B matrices' lMax.
16 /** This also determines their size and stride: they are assumed to
17 * be square matrices of size `nelem * nelem` where
18 * `nelem = qpms_lMax2nelem(lMax_AB)`
20 const qpms_l_t lMax_AB
21 ) {
22 QPMS_PARANOID_ASSERT(lMax_AB >= t_srcspec->lMax && lMax_AB >= t_destspec->lMax);
23 const qpms_y_t nelem_AB = qpms_lMax2nelem(lMax_AB);
24 for (size_t desti = 0; desti < t_destspec->n; ++desti) {
25 qpms_y_t desty; qpms_vswf_type_t destt;
26 QPMS_ENSURE_SUCCESS_M(qpms_uvswfi2ty(t_destspec->ilist[desti], &destt, &desty),
27 "Invalid u. vswf index %llx.", t_destspec->ilist[desti]);
28 for (size_t srci = 0; srci < t_srcspec->n; ++srci){
29 qpms_y_t srcy; qpms_vswf_type_t srct;
30 QPMS_ENSURE_SUCCESS_M(qpms_uvswfi2ty(t_srcspec->ilist[srci], &srct, &srcy),
31 "Invalid u. vswf index %llx.", t_srcspec->ilist[srci]); t[srci * t_srcstride + desti * t_deststride]
32 = (srct == destt) ? A[desty*nelem_AB + srcy] : B[desty*nelem_AB + srcy];
38 #endif