34 int id = rhs[0].toInt();
35 string method(rhs[1].toString());
38 if (method ==
"new") {
45 else if (method ==
"backSubst_static") {
52 SVD::backSubst(w, u, vt, src, dst);
56 else if (method ==
"solveZ_static") {
60 SVD::solveZ(src, dst);
64 else if (method ==
"compute_static") {
65 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=3);
67 for (
int i=3; i<nrhs; i+=2) {
68 string key(rhs[i].toString());
70 flags = rhs[i+1].toInt();
71 else if (key ==
"ModifyA")
72 UPDATE_FLAG(flags, rhs[i+1].toBool(), SVD::MODIFY_A);
73 else if (key ==
"NoUV")
75 else if (key ==
"FullUV")
76 UPDATE_FLAG(flags, rhs[i+1].toBool(), SVD::FULL_UV);
79 "Unrecognized option %s", key.
c_str());
83 SVD::compute(src, w, u, vt, flags);
96 if (method ==
"delete") {
101 else if (method ==
"compute") {
102 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
104 for (
int i=3; i<nrhs; i+=2) {
105 string key(rhs[i].toString());
107 flags = rhs[i+1].toInt();
108 else if (key ==
"ModifyA")
109 UPDATE_FLAG(flags, rhs[i+1].toBool(), SVD::MODIFY_A);
110 else if (key ==
"NoUV")
112 else if (key ==
"FullUV")
113 UPDATE_FLAG(flags, rhs[i+1].toBool(), SVD::FULL_UV);
116 "Unrecognized option %s", key.
c_str());
119 obj->operator()(src, flags);
121 else if (method ==
"backSubst") {
128 else if (method ==
"get") {
130 string prop(rhs[2].toString());
133 else if (prop ==
"vt")
135 else if (prop ==
"w")
139 "Unrecognized property %s", prop.
c_str());
141 else if (method ==
"set") {
143 string prop(rhs[2].toString());
146 else if (prop ==
"vt")
148 else if (prop ==
"w")
152 "Unrecognized property %s", prop.
c_str());
156 "Unrecognized operation %s", method.
c_str());
int last_id
Last object id to allocate.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
void backSubst(InputArray rhs, OutputArray dst) const
map< int, Ptr< SVD > > obj_
Object container.
struct mxArray_tag mxArray
Forward declaration for mxArray.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
#define UPDATE_FLAG(NUM, TF, BIT)
set or clear a bit in flag depending on bool value
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.