void QPReconstructLambda(Vector vLambda, Vector vLambdaScale) { int n=vi_QP.sz()-1, nc=vLambda.sz(); int *ii=vi_QP; double *l=vLambda, *s=vLambdaScale; if (n>=0) while (nc--) { if (ii[n]==nc) { // l[nc]=mmax(0.0,l[n]/s[n]); l[nc]=l[n]/s[n]; n--; if (n<0) break; } else l[nc]=0.0; } if (nc) memset(l,0,nc*sizeof(double)); }
void restartSimpleQPSolve(Vector vBO, // in Vector vP) // out { if (bQRFailed_QP) { vP.zero(); return; } int i,k=0, *ii=vi_QP, nc2=vi_QP.sz(); double *lambda=vLastLambda_QP, *b=vBO; Vector vTmp(nc2); for (i=0; i<nc2; i++) { if (lambda[i]!=0.0) { b[k]=b[ii[i]]; k++; } } vBO.setSize(k); vBO.permutIn(vTmp,viPermut_QP); mR_QP.solveInPlace(vTmp); mQ_QP.multiply(vP,vTmp); }