@@ -247,6 +247,7 @@ cdef class alm_info:
247247 sharp_destroy_alm_info(self .ainfo)
248248 self .ainfo = NULL
249249
250+ @ cython.boundscheck (False )
250251 def almxfl (self , np.ndarray[double , ndim = 3 , mode = ' c' ] alm, np.ndarray[double , ndim = 2 , mode = ' c' ] fl):
251252 """ Multiply Alm by a Ell based array
252253
@@ -263,22 +264,29 @@ cdef class alm_info:
263264 None, it modifies alms in-place
264265
265266 """
266- mvstart = 0
267- has_multiple_beams = alm.shape[2 ] > 1 and fl.shape[1 ] > 1
268- for m in self .mval():
267+ cdef int mvstart = 0
268+ cdef bint has_multiple_beams = alm.shape[2 ] > 1 and fl.shape[1 ] > 1
269+ cdef int f, i_m, m, num_ells, i_l, i_signal, i_pol, i_mv
270+
271+ for i_m in range (self .ainfo.nm):
272+ m = self .ainfo.mval[i_m]
269273 f = 1 if (m== 0 ) else 2
270274 num_ells = self .ainfo.lmax + 1 - m
271275
272276 if not has_multiple_beams:
273- for i_l in range (num_ells):
274- l = m + i_l
275- alm[:,:,mvstart + f* i_l:mvstart + f* i_l + f] *= fl[l]
277+ for i_signal in range (alm.shape[0 ]):
278+ for i_pol in range (alm.shape[1 ]):
279+ for i_l in range (num_ells):
280+ l = m + i_l
281+ for i_mv in range (mvstart + f* i_l, mvstart + f* i_l + f):
282+ alm[i_signal, i_pol, i_mv] *= fl[l, 0 ]
276283 else :
277284 for i_signal in range (alm.shape[0 ]):
278285 for i_pol in range (alm.shape[1 ]):
279286 for i_l in range (num_ells):
280287 l = m + i_l
281- alm[i_signal, i_pol, mvstart + f* i_l:mvstart + f* i_l + f] *= fl[l, i_pol]
288+ for i_mv in range (mvstart + f* i_l, mvstart + f* i_l + f):
289+ alm[i_signal, i_pol, i_mv] *= fl[l, i_pol]
282290 mvstart += f * num_ells
283291
284292cdef class triangular_order(alm_info):
0 commit comments