Mentions légales du service

Skip to content
Snippets Groups Projects
Commit d634ebf9 authored by hhakim's avatar hhakim
Browse files

Fix mexsvdtj (template) compiling error (issue #217).

parent 77e4d815
Branches
Tags
No related merge requests found
......@@ -51,13 +51,14 @@
#include <stdexcept>
typedef @FAUST_SCALAR@ SCALAR;
typedef @FACT_FPP@ FPP2;
//typedef complex<SCALAR> CPLX_SCALAR; // re-enable if one day complex<float> is supported
typedef complex<double> CPLX_SCALAR;
using namespace Faust;
//void svdtj_cplx(const mxArray* matlab_matrix, int J, int t, double tol, unsigned int verbosity, bool relErr, int order, const bool enable_large_Faust mxArray **plhs);
void svdtj(const mxArray* matlab_matrix, int J, int t, double tol, unsigned int verbosity, bool relErr, int order, const bool enable_large_Faust, mxArray **plhs);
void svdtj(const mxArray* matlab_matrix, int J, int t, Real<SCALAR> tol, unsigned int verbosity, bool relErr, int order, const bool enable_large_Faust, mxArray **plhs);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
......@@ -65,7 +66,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
int J;
int t = 1; // default value for non-parallel Givens FGFT
unsigned int verbosity = 0; //default verbosity (no info. displayed)
double tol = 0;
Real<SCALAR> tol = 0;
bool relErr = true;
int order = -1;
bool enable_large_Faust = false;
......@@ -79,7 +80,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if(nrhs >= 4)
verbosity = (int) mxGetScalar(prhs[3]);
if(nrhs >= 5)
tol = (double) mxGetScalar(prhs[4]);
tol = (Real<SCALAR>) mxGetScalar(prhs[4]);
if(nrhs >= 6)
relErr = (bool) mxGetScalar(prhs[5]);
if(nrhs >= 7)
......@@ -97,16 +98,16 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
}
void svdtj(const mxArray* matlab_matrix, int J, int t, double tol, unsigned int verbosity, bool relErr, int order, const bool enable_large_Faust, mxArray **plhs)
void svdtj(const mxArray* matlab_matrix, int J, int t, Real<SCALAR> tol, unsigned int verbosity, bool relErr, int order, const bool enable_large_Faust, mxArray **plhs)
{
Faust::MatDense<SCALAR,Cpu> dM;
Faust::MatSparse<SCALAR,Cpu> sM;
TransformHelper<SCALAR,Cpu> *U = nullptr, *V = nullptr;
Faust::Vect<SCALAR,Cpu>* S;
Faust::MatDense<complex<SCALAR>,Cpu> dM_cplx;
Faust::MatSparse<complex<SCALAR>,Cpu> sM_cplx;
TransformHelper<complex<SCALAR>,Cpu> *U_cplx = nullptr, *V_cplx = nullptr;
Faust::Vect<complex<SCALAR>,Cpu>* S_cplx;
Faust::MatDense<CPLX_SCALAR,Cpu> dM_cplx;
Faust::MatSparse<CPLX_SCALAR,Cpu> sM_cplx;
TransformHelper<CPLX_SCALAR,Cpu> *U_cplx = nullptr, *V_cplx = nullptr;
Faust::Vect<CPLX_SCALAR,Cpu>* S_cplx;
Faust::BlasHandle<Cpu> blas_handle;
Faust::SpBlasHandle<Cpu> spblas_handle;
......@@ -120,17 +121,17 @@ void svdtj(const mxArray* matlab_matrix, int J, int t, double tol, unsigned int
if (mxIsSparse(matlab_matrix))
{
mxArray2FaustspMat(matlab_matrix,sM_cplx);
svdtj_cplx<complex<SCALAR>,Cpu,FPP2>(sM_cplx, J, t, tol, verbosity, relErr, order, enable_large_Faust, &U_cplx, &V_cplx, &S_cplx);
svdtj_cplx<CPLX_SCALAR,Cpu,Real<CPLX_SCALAR>>(sM_cplx, J, t, tol, verbosity, relErr, order, enable_large_Faust, &U_cplx, &V_cplx, &S_cplx);
}else
{
mxArray2FaustMat(matlab_matrix, dM_cplx);
svdtj_cplx<complex<SCALAR>,Cpu,FPP2>(dM_cplx, J, t, tol, verbosity, relErr, order, enable_large_Faust, &U_cplx, &V_cplx, &S_cplx);
svdtj_cplx<CPLX_SCALAR,Cpu,Real<CPLX_SCALAR>>(dM_cplx, J, t, tol, verbosity, relErr, order, enable_large_Faust, &U_cplx, &V_cplx, &S_cplx);
}
if(U_cplx != nullptr)
{
plhs[0] = convertPtr2Mat<Faust::TransformHelper<complex<SCALAR>, Cpu>>(U_cplx);
plhs[0] = convertPtr2Mat<Faust::TransformHelper<CPLX_SCALAR, Cpu>>(U_cplx);
plhs[1] = FaustVec2mxArray(*S_cplx);
plhs[2] = convertPtr2Mat<Faust::TransformHelper<complex<SCALAR>, Cpu>>(V_cplx);
plhs[2] = convertPtr2Mat<Faust::TransformHelper<CPLX_SCALAR, Cpu>>(V_cplx);
delete S_cplx; //allocated internally by Faust::svdtj
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment