Skip to content

Commit 07da503

Browse files
committed
[bugfix] wrong ntrans passed to libsharp
1 parent e29ffc1 commit 07da503

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

python/libsharp/libsharp.pyx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def sht(jobtype, geom_info ginfo, alm_info ainfo, double[:, :, ::1] input,
6363
cdef int r
6464
cdef sharp_jobtype jobtype_i
6565
cdef double[:, :, ::1] output_buf
66-
cdef int ntrans = input.shape[0] * input.shape[1]
66+
cdef int ntrans = input.shape[0]
67+
cdef int ntotcomp = ntrans * input.shape[1]
6768
cdef int i, j
6869

6970
if spin == 0 and input.shape[1] != 1:
@@ -72,9 +73,9 @@ def sht(jobtype, geom_info ginfo, alm_info ainfo, double[:, :, ::1] input,
7273
raise ValueError('For spin != 0, we need input.shape[1] == 2')
7374

7475

75-
cdef size_t[::1] ptrbuf = np.empty(2 * ntrans, dtype=np.uintp)
76+
cdef size_t[::1] ptrbuf = np.empty(2 * ntotcomp, dtype=np.uintp)
7677
cdef double **alm_ptrs = <double**>&ptrbuf[0]
77-
cdef double **map_ptrs = <double**>&ptrbuf[ntrans]
78+
cdef double **map_ptrs = <double**>&ptrbuf[ntotcomp]
7879

7980
try:
8081
jobtype_i = JOBTYPE_TO_CONST[jobtype]

0 commit comments

Comments
 (0)