diff --git a/wrapper/python/src/_FaustCorePy.pyx b/wrapper/python/src/_FaustCorePy.pyx index 2b62efb8a49f94690ff48a4a325ad9de2adadd1c..24b1d1bfe8309a4bb65c246cfa04f635ce9721a3 100644 --- a/wrapper/python/src/_FaustCorePy.pyx +++ b/wrapper/python/src/_FaustCorePy.pyx @@ -832,8 +832,8 @@ cdef check_matrix(isReal, M, message=""): ' float)') else: # M=M.astype(complex,'F') - if(M.dtype not in ['complex', 'complex128', 'complex64'] ): #could fail if complex128 etc. - raise ValueError('input array must be complex array') + if(M.dtype not in ['complex', 'complex128'] ): #could fail if complex128 etc. + raise ValueError('input array must be complex(128) array') #TODO: raise exception if not real nor complex if not M.flags['F_CONTIGUOUS']: raise ValueError(message+'input array must be Fortran contiguous (Colmajor)') @@ -1482,7 +1482,7 @@ cdef class FaustFact: cdef FaustCoreCy.FaustCoreCpp[double]* core_faust_dbl_init_facts Mview = M - _out_buf = np.array([0], dtype=M.dtype) + _out_buf = np.array([0], dtype=np.double) _out_buf[0] = p.init_lambda; outbufview = _out_buf @@ -1582,7 +1582,7 @@ cdef class FaustFact: if(core.core_faust_dbl == NULL): raise Exception("palm4msa2020" " has failed."); - return core, np.real(_out_buf[0]) + return core, _out_buf[0] @staticmethod def hierarchical2020(M, p, full_gpu=False): @@ -1639,7 +1639,7 @@ cdef class FaustFact: constraints = p.constraints # store only lambda as a return from Palm4MSA algo - _out_buf = np.array([0], dtype=M.dtype) + _out_buf = np.array([0], dtype=np.double) _out_buf[0] = p.init_lambda; Mview=M @@ -1714,7 +1714,7 @@ cdef class FaustFact: if(core.core_faust_dbl == NULL): raise Exception("hierarchical2020" " has failed."); - return core, np.real(_out_buf[0]) + return core, _out_buf[0] @staticmethod def butterfly_hierarchical(M, dir): diff --git a/wrapper/python/src/_FaustCorePyCplx.pyx b/wrapper/python/src/_FaustCorePyCplx.pyx index a6c0fdbb205eaa4bf54b074dc316b089b5e58927..c982be552f14bb2c447671394506f3abef8b998c 100644 --- a/wrapper/python/src/_FaustCorePyCplx.pyx +++ b/wrapper/python/src/_FaustCorePyCplx.pyx @@ -842,7 +842,7 @@ cdef class FaustFactCplx(FaustFact): for i in range(0,p.num_facts): check_matrix(False, p.init_facts[i], message="while checking" " palm4msa init facts: ") - tmp_mat_cplx = p.init_facts[i].astype('complex') + tmp_mat_cplx = p.init_facts[i] cpp_params_cplx.init_facts[i] = &tmp_mat_cplx[0,0] cpp_params_cplx.init_fact_sizes[i*2+0] = p.init_facts[i].shape[0] cpp_params_cplx.init_fact_sizes[i*2+1] = p.init_facts[i].shape[1] @@ -1039,7 +1039,7 @@ cdef class FaustFactCplx(FaustFact): Mview = M - _out_buf = np.array([0], dtype=M.dtype) + _out_buf = np.array([0], dtype=np.double) _out_buf[0] = p.init_lambda; outbufview = _out_buf @@ -1101,7 +1101,7 @@ cdef class FaustFactCplx(FaustFact): if p.init_facts: # facts have been initialized from the wrapper # create a Faust - F_facts = FaustCore(p.init_facts) + F_facts = FaustCoreCplx(p.init_facts) # palm4msa2020_gen in FaustFact.hpp # is responsible to delete the object in case the # algorithm runs on GPU (hence the transform objects F_facts and @@ -1140,7 +1140,7 @@ cdef class FaustFactCplx(FaustFact): if(core.core_faust_cplx == NULL): raise Exception("palm4msa2020" " has failed."); - return core, np.real(_out_buf[0]) + return core, _out_buf[0] @staticmethod def hierarchical2020(M, p, full_gpu=False): @@ -1272,7 +1272,7 @@ cdef class FaustFactCplx(FaustFact): if(core.core_faust_cplx == NULL): raise Exception("hierarchical2020" " has failed."); - return core, np.real(_out_buf[0]) + return core, _out_buf[0] @staticmethod def fact_givens_fgft(Lap, J, t, verbosity=0, stoppingError = 0.0,