Commit 989eb9ed authored by Denis Arrivault's avatar Denis Arrivault
Browse files

Resolve memory leaks in pyx files - Issue #1

parent 61702e88
Pipeline #332 skipped
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,8 +8,6 @@ versions of dct calculations.
from __future__ import print_function, division
import cython
from cython.view cimport array as cvarray
from libc.stdlib cimport malloc, free
import numpy as np
from ltfat cimport ltfatInt, dct_kind, dct_cd, dct_d
......@@ -20,28 +18,19 @@ from ltfatpy.comp.ltfat cimport DCTI, DCTII, DCTIII, DCTIV
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_dct_cd(const double complex[:] f, const ltfatInt L,
const ltfatInt W, const dct_kind kind):
cdef comp_dct_cd(const double complex[:] f, const ltfatInt L,
const ltfatInt W, const dct_kind kind, double complex[:] out):
""" Internal function, do not use it """
cdef ltfatInt size_cd = L * W
cdef double complex * res_long_cd
res_cd = < double complex * > malloc(sizeof(double complex) * size_cd)
dct_cd(&f[0], L, W, res_cd, kind)
return < double complex[:size_cd] > res_cd
dct_cd(& f[0], L, W, & out[0], kind)
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double[:] comp_dct_d(const double[:] f, const ltfatInt L,
const ltfatInt W, const dct_kind kind):
cdef comp_dct_d(const double[:] f, const ltfatInt L,
const ltfatInt W, const dct_kind kind, double[:] out):
""" Internal function, do not use it """
cdef ltfatInt size_d = L * W
cdef double * res_d
res_d = < double * > malloc(sizeof(double) * size_d)
dct_d(&f[0], L, W, res_d, kind)
return < double[:size_d] > res_d
dct_d(&f[0], L, W, & out[0], kind)
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
......@@ -75,9 +64,11 @@ cpdef comp_dct(f, type):
f_combined = f
if f.dtype.type == np.float64:
res = np.asarray(comp_dct_d(f_combined, L, W, dct_type[type]))
res = np.ndarray((L * W), dtype=np.float64)
comp_dct_d(f_combined, L, W, dct_type[type], res)
else:
res = np.asarray(comp_dct_cd(f_combined, L, W, dct_type[type]))
res = np.ndarray((L * W), dtype=np.complex128)
comp_dct_cd(f_combined, L, W, dct_type[type], res)
if W > 1:
res = np.reshape(res, (L, W), order='F')
return res
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9,8 +9,6 @@ versions of dst calculations.
from __future__ import print_function, division
import cython
from cython.view cimport array as cvarray
from libc.stdlib cimport malloc, free
import numpy as np
from ltfat cimport ltfatInt, dst_kind, dst_cd, dst_d
......@@ -21,28 +19,19 @@ from ltfatpy.comp.ltfat cimport DSTI, DSTII, DSTIII, DSTIV
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_dst_cd(const double complex[:] f, const ltfatInt L,
const ltfatInt W, const dst_kind kind):
cdef comp_dst_cd(const double complex[:] f, const ltfatInt L,
const ltfatInt W, const dst_kind kind, double complex[:] out):
""" Internal function, do not use it """
cdef ltfatInt size_cd = L * W
cdef double complex * res_long_cd
res_cd = < double complex * > malloc(sizeof(double complex) * size_cd)
dst_cd(&f[0], L, W, res_cd, kind)
return < double complex[:size_cd] > res_cd
dst_cd(&f[0], L, W, &out[0], kind)
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double[:] comp_dst_d(const double[:] f, const ltfatInt L,
const ltfatInt W, const dst_kind kind):
cdef comp_dst_d(const double[:] f, const ltfatInt L,
const ltfatInt W, const dst_kind kind, double[:] out):
""" Internal function, do not use it """
cdef ltfatInt size_d = L * W
cdef double * res_d
res_d = < double * > malloc(sizeof(double) * size_d)
dst_d(&f[0], L, W, res_d, kind)
return < double[:size_d] > res_d
dst_d(&f[0], L, W, &out[0], kind)
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
......@@ -76,9 +65,11 @@ cpdef comp_dst(f, type):
f_combined = f
if f.dtype.type == np.float64:
res = np.asarray(comp_dst_d(f_combined, L, W, dst_type[type]))
res = np.ndarray((L * W), dtype=np.float64)
comp_dst_d(f_combined, L, W, dst_type[type], res)
else:
res = np.asarray(comp_dst_cd(f_combined, L, W, dst_type[type]))
res = np.ndarray((L * W), dtype=np.complex128)
comp_dst_cd(f_combined, L, W, dst_type[type], res)
if W > 1:
res = np.reshape(res, (L, W), order='F')
return res
This diff is collapsed.
......@@ -9,8 +9,6 @@ versions of gabor dual windows calculations.
from __future__ import print_function, division
import cython
from cython.view cimport array as cvarray
from libc.stdlib cimport malloc, free
import numpy as np
from ltfat cimport ltfatInt, gabdual_long_d, gabdual_long_cd
......@@ -19,30 +17,20 @@ from ltfat cimport ltfatInt, gabdual_long_d, gabdual_long_cd
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double[:] comp_gabdual_long_d(const double[:] g, const ltfatInt L,
const ltfatInt R, const ltfatInt a,
const ltfatInt M):
cdef comp_gabdual_long_d(const double[:] g, const ltfatInt L, const ltfatInt R,
const ltfatInt a, const ltfatInt M, double[:] out):
""" Internal function, do not use it """
cdef int gd_size = L * R
cdef double * gd = <double * > malloc(sizeof(double) * gd_size)
gabdual_long_d(&g[0], L, R, a, M, gd)
return <double [:gd_size]> gd
gabdual_long_d(&g[0], L, R, a, M, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_gabdual_long_cd(const double complex[:] g,
const ltfatInt L,
const ltfatInt R,
const ltfatInt a,
const ltfatInt M):
cdef comp_gabdual_long_cd(const double complex[:] g, const ltfatInt L,
const ltfatInt R, const ltfatInt a, const ltfatInt M,
double complex[:] out):
""" Internal function, do not use it """
cdef int gd_size = L * R
cdef double complex * gd
gd = <double complex *> malloc(sizeof(double complex) * gd_size)
gabdual_long_cd(&g[0], L, R, a, M, gd)
return <double complex [:gd_size]> gd
gabdual_long_cd(&g[0], L, R, a, M, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
......@@ -70,9 +58,11 @@ cpdef comp_gabdual_long(g, a, M):
g_combined = g
if np.issubdtype(g.dtype, np.float64):
res = np.asarray(comp_gabdual_long_d(g_combined, L, R, a, M))
res = np.ndarray((L * R), dtype=np.float64)
comp_gabdual_long_d(g_combined, L, R, a, M, res)
else:
res = np.asarray(comp_gabdual_long_cd(g_combined, L, R, a, M))
res = np.ndarray((L * R), dtype=np.complex128)
comp_gabdual_long_cd(g_combined, L, R, a, M, res)
if R == 1:
return res
......
This diff is collapsed.
......@@ -9,8 +9,6 @@ versions of tight gabor windows calculation.
from __future__ import print_function, division
import cython
from cython.view cimport array as cvarray
from libc.stdlib cimport malloc, free
import numpy as np
from ltfat cimport ltfatInt, gabtight_long_d, gabtight_long_cd
......@@ -21,30 +19,21 @@ from ltfat cimport ltfatInt, gabtight_long_d, gabtight_long_cd
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double[:] comp_gabtight_long_real(const double[:] g,
const ltfatInt L, const ltfatInt R,
const ltfatInt a, const ltfatInt M):
cdef comp_gabtight_long_real(const double[:] g, const ltfatInt L,
const ltfatInt R, const ltfatInt a,
const ltfatInt M, double[:] out):
""" Internal function, do not use it """
cdef int gd_size = L * R
cdef double * gd = < double * > malloc(sizeof(double) * gd_size)
gabtight_long_d(&g[0], L, R, a, M, gd);
return < double[:gd_size] > gd
gabtight_long_d(&g[0], L, R, a, M, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_gabtight_long_cmplx(const double complex[:] g,
const ltfatInt L,
const ltfatInt R,
const ltfatInt a,
const ltfatInt M):
cdef comp_gabtight_long_cmplx(const double complex[:] g, const ltfatInt L,
const ltfatInt R, const ltfatInt a,
const ltfatInt M, double complex[:] out):
""" Internal function, do not use it """
cdef int gd_size = L * R
cdef double complex * gd
gd = < double complex * > malloc(sizeof(double complex) * gd_size)
gabtight_long_cd(&g[0], L, R, a, M, gd);
return < double complex [:gd_size] > gd
gabtight_long_cd(&g[0], L, R, a, M, &out[0])
cpdef comp_gabtight_long(g, a, M):
"""Compute tight window
......@@ -65,9 +54,11 @@ cpdef comp_gabtight_long(g, a, M):
g_combined = g
if np.issubdtype(g.dtype, np.float64):
gd = np.asarray(comp_gabtight_long_real(g_combined, L, R, a, M))
gd = np.ndarray((L * R), dtype=np.float64)
comp_gabtight_long_real(g_combined, L, R, a, M, gd)
elif np.issubdtype(g.dtype, np.complex128):
gd = np.asarray(comp_gabtight_long_cmplx(g_combined, L, R, a, M))
gd = np.ndarray((L * R), dtype=np.complex128)
comp_gabtight_long_cmplx(g_combined, L, R, a, M, gd)
else:
raise TypeError("g data should be numpy.float64 or numpy.complex128")
......
This diff is collapsed.
......@@ -9,8 +9,6 @@ versions of isepdgt calculations.
from __future__ import print_function, division
import cython
from cython.view cimport array as cvarray
from libc.stdlib cimport malloc, free
import numpy as np
from ltfat cimport ltfatInt, dgt_phasetype, idgt_fb_d, idgt_long_d
......@@ -20,37 +18,22 @@ from ltfatpy.comp.ltfat cimport TIMEINV, FREQINV
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_idgt_long_d(const double complex[:] coef,
const double complex[:] g,
const int L, const int W,
const int a, const int M,
const dgt_phasetype ptype):
cdef comp_idgt_long_d(const double complex[:] coef, const double complex[:] g,
const int L, const int W, const int a, const int M,
const dgt_phasetype ptype, double complex[:] out):
""" Internal function, do not use it """
cdef double complex * res_long_d
cdef ltfatInt size_f = L * W
res_long_d = < double complex * > malloc(sizeof(double complex) * size_f)
idgt_long_d(& coef[0], & g[0], L, W, a, M, ptype, res_long_d)
return < double complex[:size_f] > res_long_d
idgt_long_d(& coef[0], & g[0], L, W, a, M, ptype, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_idgt_fb_d(const double complex[:] coef,
const double complex[:] g,
const int L, const int gl,
const int W, const int a,
const int M,
const dgt_phasetype ptype):
cdef comp_idgt_fb_d(const double complex[:] coef, const double complex[:] g,
const int L, const int gl, const int W, const int a,
const int M, const dgt_phasetype ptype,
double complex[:] out):
""" Internal function, do not use it """
cdef double complex * res_fb_d
cdef ltfatInt size_sig = L * W
res_fb_d = < double complex * > malloc(sizeof(double complex) *
size_sig)
idgt_fb_d(& coef[0], & g[0], L, gl, W, a, M, ptype, res_fb_d)
return < double complex[:size_sig] > res_fb_d
idgt_fb_d(& coef[0], & g[0], L, gl, W, a, M, ptype, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
......@@ -92,14 +75,13 @@ cpdef comp_isepdgt(coef, g, a, pt):
if g.ndim == 2:
gl = gl * g.shape[1]
g = g(gl, order='F')
res = np.ndarray((L * W), dtype=np.complex128)
if gl < L:
res = np.asarray(comp_idgt_fb_d(coef, g, L, gl, W, a, M, pt))
comp_idgt_fb_d(coef, g, L, gl, W, a, M, pt, res)
if W > 1:
return np.reshape(res, (L, W), order='F')
return res
res = np.asarray(comp_idgt_long_d(coef, g, L, W, a, M, pt))
comp_idgt_long_d(coef, g, L, W, a, M, pt, res)
if W > 1:
return np.reshape(res, (L, W), order='F')
return res
This diff is collapsed.
......@@ -9,8 +9,6 @@ versions of isepdgtreal calculations.
from __future__ import print_function, division
import cython
from cython.view cimport array as cvarray
from libc.stdlib cimport malloc, free
import numpy as np
from ltfat cimport ltfatInt, dgt_phasetype, idgtreal_fb_d, idgtreal_long_d
......@@ -20,33 +18,21 @@ from ltfatpy.comp.ltfat cimport TIMEINV, FREQINV
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double[:] comp_idgtreal_long_d(const double complex[:] coef,
const double[:] g,
const int L, const int W,
const int a, const int M,
const dgt_phasetype ptype):
cdef comp_idgtreal_long_d(const double complex[:] coef, const double[:] g,
const int L, const int W, const int a, const int M,
const dgt_phasetype ptype, double[:] out):
""" Internal function, do not use it """
cdef double * res
cdef ltfatInt size_f = L * W
res = < double * > malloc(sizeof(double) * size_f)
idgtreal_long_d(& coef[0], & g[0], L, W, a, M, ptype, res)
return < double[:size_f] > res
idgtreal_long_d(&coef[0], &g[0], L, W, a, M, ptype, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double[:] comp_idgtreal_fb_d(const double complex[:] coef,
const double[:] g, const int L, const int gl,
const int W, const int a, const int M,
const dgt_phasetype ptype):
cdef comp_idgtreal_fb_d(const double complex[:] coef, const double[:] g,
const int L, const int gl, const int W, const int a,
const int M, const dgt_phasetype ptype, double[:] out):
""" Internal function, do not use it """
cdef double * res
cdef ltfatInt size_sig = L * W
res = < double* > malloc(sizeof(double) * size_sig)
idgtreal_fb_d(& coef[0], & g[0], L, gl, W, a, M, ptype, res)
return < double[:size_sig] > res
idgtreal_fb_d(&coef[0], &g[0], L, gl, W, a, M, ptype, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
......@@ -57,7 +43,7 @@ cpdef comp_isepdgtreal(coef, g, a, M, pt):
This is a computational subroutine, do not call it directly, use
:func:`~ltfatpy.gabor.idgtreal.idgtreal` instead.
.. seealso:: :func:`~ltfatpy.gabor.idgt.idgt`
"""
......@@ -93,16 +79,13 @@ cpdef comp_isepdgtreal(coef, g, a, M, pt):
g_combined = g.reshape(gl, order='F')
else:
g_combined = g
res = np.ndarray((L * W), dtype=np.float64)
if gl < L:
res = np.asarray(comp_idgtreal_fb_d(coef_combined, g_combined, L, gl,
W, a, M, pt))
if W > 1:
return np.reshape(res, (L, W), order='F')
return res
else:
res = np.asarray(comp_idgtreal_long_d(coef_combined, g_combined, L, W,
a, M, pt))
comp_idgtreal_fb_d(coef_combined, g_combined, L, gl, W, a, M, pt, res)
if W > 1:
return np.reshape(res, (L, W), order='F')
return res
comp_idgtreal_long_d(coef_combined, g_combined, L, W, a, M, pt, res)
if W > 1:
return np.reshape(res, (L, W), order='F')
return res
This diff is collapsed.
......@@ -18,24 +18,19 @@ from ltfat cimport ltfatInt, pgauss_d, pgauss_cmplx_d
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double[:] comp_pgauss_real(ltfatInt L, double w, double c_t):
cdef comp_pgauss_real(ltfatInt L, double w, double c_t,
double[:] out):
""" Internal function, do not use it """
cdef double * c_array = < double * > malloc(sizeof(double) * L)
pgauss_d(L, w, c_t, c_array)
return < double[:L] > c_array
pgauss_d(L, w, c_t, & out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_pgauss_cplx(ltfatInt L, double w, double c_t,
double c_f):
cdef comp_pgauss_cplx(ltfatInt L, double w, double c_t,
double c_f, double complex[:] out):
""" Internal function, do not use it """
cdef double complex * c_array = < double complex * > malloc(sizeof(double
complex) * L)
pgauss_cmplx_d(L, w, c_t, c_f, c_array)
return < double complex[:L] > c_array
pgauss_cmplx_d(L, w, c_t, c_f, & out[0])
cpdef comp_pgauss(L, w=1.0, c_t=0, c_f=0):
"""Return the computed sampled, periodized Gaussian.
......@@ -44,5 +39,9 @@ cpdef comp_pgauss(L, w=1.0, c_t=0, c_f=0):
:func:`~ltfatpy.fourier.pgauss.pgauss` instead.
"""
if c_f == 0:
return np.asarray(comp_pgauss_real(L, w, c_t))
return np.asarray(comp_pgauss_cplx(L, w, c_t, c_f))
out = np.ndarray((L), dtype=np.float64)
comp_pgauss_real(L, w, c_t, out)
return out
out = np.ndarray((L), dtype=np.complex128)
comp_pgauss_cplx(L, w, c_t, c_f, out)
return out
This diff is collapsed.
......@@ -8,8 +8,6 @@ versions of sepdgt calculations.
from __future__ import print_function, division
import cython
from cython.view cimport array as cvarray
from libc.stdlib cimport malloc, free
import numpy as np
from ltfat cimport ltfatInt, dgt_phasetype, dgt_long_cd, dgt_long_d
......@@ -21,71 +19,46 @@ from ltfatpy.comp.ltfat cimport TIMEINV, FREQINV
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_dgt_long_cd(const double complex[:] f,
const double complex[:] g,
const ltfatInt L, const int W,
const ltfatInt a, const ltfatInt M,
const dgt_phasetype ptype):
cdef comp_dgt_long_cd(const double complex[:] f, const double complex[:] g,
const ltfatInt L, const int W, const ltfatInt a,
const ltfatInt M, const dgt_phasetype ptype,
double complex[:] out):
""" Internal function, do not use it """
cdef ltfatInt size_long_cd = M * W * (L // a)
cdef double complex * res_long_cd
res_long_cd = < double complex * > malloc(sizeof(double complex) *
size_long_cd)
dgt_long_cd(&f[0], &g[0], L, W, a, M, ptype, res_long_cd)
return < double complex[:size_long_cd] > res_long_cd
dgt_long_cd(&f[0], &g[0], L, W, a, M, ptype, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_dgt_long_d(const double[:] f, const double[:] g,
const ltfatInt L, const ltfatInt W,
const ltfatInt a, const ltfatInt M,
const dgt_phasetype ptype):
cdef comp_dgt_long_d(const double[:] f, const double[:] g, const ltfatInt L,
const ltfatInt W, const ltfatInt a, const ltfatInt M,
const dgt_phasetype ptype, double complex[:] out):
""" Internal function, do not use it """
cdef ltfatInt size_long_d = M * W * (L // a)
cdef double complex * res_long_d
res_long_d = < double complex * > malloc(sizeof(double complex) *
size_long_d)
dgt_long_d(&f[0], &g[0], L, W, a, M, ptype, res_long_d)
return < double complex[:size_long_d] > res_long_d
dgt_long_d(&f[0], &g[0], L, W, a, M, ptype, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_dgt_fb_d(const double[:] f, const double[:] g,
const ltfatInt L, const ltfatInt gl,
const ltfatInt W, const ltfatInt a,
const ltfatInt M,
const dgt_phasetype ptype):
cdef comp_dgt_fb_d(const double[:] f, const double[:] g, const ltfatInt L,
const ltfatInt gl, const ltfatInt W, const ltfatInt a,
const ltfatInt M, const dgt_phasetype ptype,
double complex[:] out):
""" Internal function, do not use it """
cdef ltfatInt size_fb_d = M * W * (L // a)
cdef double complex * res_fb_d
res_fb_d = < double complex * > malloc(sizeof(double complex) * size_fb_d)
dgt_fb_d(&f[0], &g[0], L, gl, W, a, M, ptype, res_fb_d)
return < double complex[:size_fb_d] > res_fb_d
dgt_fb_d(&f[0], &g[0], L, gl, W, a, M, ptype, &out[0])
# don’t check for out-of-bounds indexing.
@cython.boundscheck(False)
# assume no negative indexing.
@cython.wraparound(False)
cdef double complex[:] comp_dgt_fb_cd(const double complex[:] f,
const double complex[:] g,
const ltfatInt L, const ltfatInt gl,
const ltfatInt W, const ltfatInt a,
const ltfatInt M, const dgt_phasetype
ptype):
cdef comp_dgt_fb_cd(const double complex[:] f, const double complex[:] g,
const ltfatInt L, const ltfatInt gl, const ltfatInt W,
const ltfatInt a, const ltfatInt M,
const dgt_phasetype ptype, double complex[:] out):
""" Internal function, do not use it """
cdef ltfatInt size_fb_cd = M * W * (L // a)
cdef double complex * res_fb_cd
res_fb_cd = < double complex * > malloc(sizeof(double complex) *
size_fb_cd)
dgt_fb_cd(&f[0], &g[0], L, gl, W, a, M, ptype, res_fb_cd)
return < double complex[:size_fb_cd] > res_fb_cd
dgt_fb_cd(&f[0], &g[0], L, gl, W, a, M, ptype, &out[0])
# don’t check for out-of-bounds indexing.
......@@ -134,21 +107,17 @@ cpdef comp_sepdgt(f, g, a, M, pt):
g_combined = g
cdef ltfatInt N = L//a
res = np.ndarray((M * W * (L // a)), dtype=np.complex128)
if gl < L:
if f.dtype.type == np.float64:
res = np.asarray(comp_dgt_fb_d(f_combined, g_combined, L, gl, W, a,
M, pt))
comp_dgt_fb_d(f_combined, g_combined, L, gl, W, a, M, pt, res)
else:
res = np.asarray(comp_dgt_fb_cd(f_combined, g_combined, L, gl, W,
a, M, pt))
comp_dgt_fb_cd(f_combined, g_combined, L, gl, W, a, M, pt, res)
else:
if f.dtype.type == np.float64:
res = np.asarray(comp_dgt_long_d(f_combined, g_combined, L, W, a,
M, pt))
comp_dgt_long_d(f_combined, g_combined, L, W, a, M, pt, res)
else:
res = np.asarray(comp_dgt_long_cd(f_combined, g_combined, L, W, a,
M, pt))
comp_dgt_long_cd(f_combined, g_combined, L, W, a, M, pt, res)
if W > 1:
res = np.reshape(res, (M, N, W), order='F')
else:
......