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
No related branches found
No related tags found
No related merge requests found
...@@ -51,13 +51,14 @@ ...@@ -51,13 +51,14 @@
#include <stdexcept> #include <stdexcept>
typedef @FAUST_SCALAR@ SCALAR; 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; 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_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[]) 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[]) ...@@ -65,7 +66,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
int J; int J;
int t = 1; // default value for non-parallel Givens FGFT int t = 1; // default value for non-parallel Givens FGFT
unsigned int verbosity = 0; //default verbosity (no info. displayed) unsigned int verbosity = 0; //default verbosity (no info. displayed)
double tol = 0; Real<SCALAR> tol = 0;
bool relErr = true; bool relErr = true;
int order = -1; int order = -1;
bool enable_large_Faust = false; bool enable_large_Faust = false;
...@@ -79,7 +80,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) ...@@ -79,7 +80,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
if(nrhs >= 4) if(nrhs >= 4)
verbosity = (int) mxGetScalar(prhs[3]); verbosity = (int) mxGetScalar(prhs[3]);
if(nrhs >= 5) if(nrhs >= 5)
tol = (double) mxGetScalar(prhs[4]); tol = (Real<SCALAR>) mxGetScalar(prhs[4]);
if(nrhs >= 6) if(nrhs >= 6)
relErr = (bool) mxGetScalar(prhs[5]); relErr = (bool) mxGetScalar(prhs[5]);
if(nrhs >= 7) if(nrhs >= 7)
...@@ -97,16 +98,16 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) ...@@ -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::MatDense<SCALAR,Cpu> dM;
Faust::MatSparse<SCALAR,Cpu> sM; Faust::MatSparse<SCALAR,Cpu> sM;
TransformHelper<SCALAR,Cpu> *U = nullptr, *V = nullptr; TransformHelper<SCALAR,Cpu> *U = nullptr, *V = nullptr;
Faust::Vect<SCALAR,Cpu>* S; Faust::Vect<SCALAR,Cpu>* S;
Faust::MatDense<complex<SCALAR>,Cpu> dM_cplx; Faust::MatDense<CPLX_SCALAR,Cpu> dM_cplx;
Faust::MatSparse<complex<SCALAR>,Cpu> sM_cplx; Faust::MatSparse<CPLX_SCALAR,Cpu> sM_cplx;
TransformHelper<complex<SCALAR>,Cpu> *U_cplx = nullptr, *V_cplx = nullptr; TransformHelper<CPLX_SCALAR,Cpu> *U_cplx = nullptr, *V_cplx = nullptr;
Faust::Vect<complex<SCALAR>,Cpu>* S_cplx; Faust::Vect<CPLX_SCALAR,Cpu>* S_cplx;
Faust::BlasHandle<Cpu> blas_handle; Faust::BlasHandle<Cpu> blas_handle;
Faust::SpBlasHandle<Cpu> spblas_handle; Faust::SpBlasHandle<Cpu> spblas_handle;
...@@ -120,17 +121,17 @@ void svdtj(const mxArray* matlab_matrix, int J, int t, double tol, unsigned int ...@@ -120,17 +121,17 @@ void svdtj(const mxArray* matlab_matrix, int J, int t, double tol, unsigned int
if (mxIsSparse(matlab_matrix)) if (mxIsSparse(matlab_matrix))
{ {
mxArray2FaustspMat(matlab_matrix,sM_cplx); 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 }else
{ {
mxArray2FaustMat(matlab_matrix, dM_cplx); 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) 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[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 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