38 #include <qpOASES/QProblemB.hpp> 84 if ( globalQPB_H != 0 )
107 int nOutputs, mxArray* plhs[]
119 returnvalue = globalQPB->
init( H,g,lb,ub, nWSR,0 );
123 returnvalue = globalQPB->
init( H,g,lb,ub, nWSR,0, x0,0,0 );
140 int nOutputs, mxArray* plhs[]
158 void mexFunction(
int nlhs, mxArray* plhs[],
int nrhs,
const mxArray* prhs[] )
162 real_t *H_for=0, *H_mem=0, *
g=0, *
lb=0, *
ub=0, *x0=0;
169 #ifdef __SUPPRESSANYOUTPUT__ 179 if ( ( nrhs < 4 ) || ( nrhs > 7 ) )
181 mexErrMsgTxt(
"ERROR (qpOASES): Invalid number of input arguments!\nType 'help qpOASES_sequenceSB' for further information." );
184 if ( mxIsChar( prhs[0] ) != 1 )
185 mexErrMsgTxt(
"ERROR (qpOASES): First input argument must be a string!" );
187 typeString = (
char*) mxGetPr( prhs[0] );
192 if ( ( strcmp( typeString,
"i" ) == 0 ) || ( strcmp( typeString,
"I" ) == 0 ) )
195 if ( ( nlhs < 1 ) || ( nlhs > 5 ) )
196 mexErrMsgTxt(
"ERROR (qpOASES): Invalid number of output arguments!\nType 'help qpOASES_sequenceSB' for further information." );
198 if ( ( nrhs < 5 ) || ( nrhs > 7 ) )
199 mexErrMsgTxt(
"ERROR (qpOASES): Invalid number of input arguments!\nType 'help qpOASES_sequenceSB' for further information." );
202 if ( ( mxIsDouble( prhs[1] ) == 0 ) ||
203 ( mxIsDouble( prhs[2] ) == 0 ) )
204 mexErrMsgTxt(
"ERROR (qpOASES): All data has to be provided in real_t precision!" );
212 nV = mxGetM( prhs[1] );
214 if ( mxGetN( prhs[1] ) != nV )
215 mexErrMsgTxt(
"ERROR (qpOASES): Input dimension mismatch!" );
236 if ( ( !mxIsEmpty( prhs[6] ) ) && ( mxIsStruct( prhs[6] ) ) )
244 if ( mxIsSparse( prhs[1] ) != 0 )
246 long *ir = (
long *)mxGetIr(prhs[1]);
247 long *jc = (
long *)mxGetJc(prhs[1]);
256 H_for = (
real_t*) mxGetPr( prhs[1] );
257 H_mem =
new real_t[nV*nV];
258 for(
int i=0; i<nV*nV; ++i )
260 globalQPB_H =
new SymDenseMat( nV, nV, nV, H_mem );
279 if ( ( strcmp( typeString,
"h" ) == 0 ) || ( strcmp( typeString,
"H" ) == 0 ) )
282 if ( ( nlhs < 1 ) || ( nlhs > 5 ) )
283 mexErrMsgTxt(
"ERROR (qpOASES): Invalid number of output arguments!\nType 'help qpOASES_sequenceSB' for further information." );
285 if ( ( nrhs < 4 ) || ( nrhs > 5 ) )
286 mexErrMsgTxt(
"ERROR (qpOASES): Invalid number of input arguments!\nType 'help qpOASES_sequenceSB' for further information." );
289 if ( globalQPB == 0 )
290 mexErrMsgTxt(
"ERROR (qpOASES): QP sequence needs to be initialised first!" );
293 nV = globalQPB->
getNV( );
309 if ( ( !mxIsEmpty( prhs[4] ) ) && ( mxIsStruct( prhs[4] ) ) )
326 if ( ( strcmp( typeString,
"c" ) == 0 ) || ( strcmp( typeString,
"C" ) == 0 ) )
330 mexErrMsgTxt(
"ERROR (qpOASES): Invalid number of output arguments!\nType 'help qpOASES_sequenceSB' for further information." );
333 mexErrMsgTxt(
"ERROR (qpOASES): Invalid number of input arguments!\nType 'help qpOASES_sequenceSB' for further information." );
void hotstartSB(const real_t *const g, const real_t *const lb, const real_t *const ub, int nWSR, Options *options, int nOutputs, mxArray *plhs[])
Interfaces matrix-vector operations tailored to symmetric sparse matrices.
void deleteGlobalQProblemBMatrices()
Implements the online active set strategy for box-constrained QPs.
void initSB(int nV, SymmetricMatrix *H, real_t *g, const real_t *const lb, const real_t *const ub, int nWSR, const real_t *const x0, Options *options, int nOutputs, mxArray *plhs[])
returnValue setupOptions(Options *options, const mxArray *optionsPtr, int &nWSRin)
Allows to pass back messages to the calling function.
Interfaces matrix-vector operations tailored to symmetric dense matrices.
void deleteGlobalQProblemBInstance()
returnValue smartDimensionCheck(real_t **input, unsigned int m, unsigned int n, BooleanType emptyAllowed, const mxArray *prhs[], int idx)
returnValue init(const real_t *const _H, const real_t *const _g, const real_t *const _lb, const real_t *const _ub, int &nWSR, const real_t *const yOpt=0, real_t *const cputime=0)
void allocateGlobalQProblemBInstance(int nV, Options *options)
static QProblemB * globalQPB
returnValue setOptions(const Options &_options)
returnValue hotstart(const real_t *const g_new, const real_t *const lb_new, const real_t *const ub_new, int &nWSR, real_t *const cputime)
void allocateOutputs(int nlhs, mxArray *plhs[], int nV, int nC=0, int nP=1)
Provides a generic way to set and pass user-specified options.
void obtainOutputs(int k, QProblemB *qp, returnValue returnvalue, int nWSRin, int nlhs, mxArray *plhs[], int nV, int nC=0)
static long * globalQPB_Hdiag
static SymmetricMatrix * globalQPB_H
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Abstract base class for interfacing matrix-vector operations tailored to symmetric matrices...