MCPcopy Create free account
hub / github.com/Singular/Singular / relativeInteriorPoint

Method relativeInteriorPoint

gfanlib/gfanlib_zcone.cpp:451–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449 assert(!"Cddlib reported error when called by Gfanlib.");
450 }
451 ZVector relativeInteriorPoint(const ZMatrix &inequalities, const ZMatrix &equations)
452 {
453 QVector retUnscaled(inequalities.getWidth());
454 ensureCddInitialisation();
455 int numberOfEqualities=equations.getHeight();
456 int numberOfInequalities=inequalities.getHeight();
457 int numberOfRows=numberOfEqualities+numberOfInequalities;
458
459 // dd_rowset r=NULL;
460 ZMatrix g=inequalities;
461 g.append(equations);
462
463 dd_LPSolverType solver=dd_DualSimplex;
464 dd_MatrixPtr A=NULL;
465 dd_ErrorType err=dd_NoError;
466
467 A=ZMatrix2MatrixGmp(g,&err);
468 if (err!=dd_NoError) goto _L99;
469 {
470 dd_LPSolutionPtr lps1;
471 dd_LPPtr lp,lp1;
472
473 for(int i=0;i<numberOfInequalities;i++)
474 dd_set_si(A->matrix[i][0],-1);
475 for(int i=numberOfInequalities;i<numberOfRows;i++)
476 set_addelem(A->linset,i+1);
477
478 A->objective=dd_LPmax;
479 lp=dd_Matrix2LP(A, &err);
480 if (err!=dd_NoError) goto _L99;
481
482 lp1=dd_MakeLPforInteriorFinding(lp);
483 dd_LPSolve(lp1,solver,&err);
484 if (err!=dd_NoError) goto _L99;
485
486 lps1=dd_CopyLPSolution(lp1);
487
488 assert(!dd_Negative(lps1->optvalue));
489
490 for (int j=1; j <(lps1->d)-1; j++)
491 retUnscaled[j-1]=Rational(lps1->sol[j]);
492
493 dd_FreeLPData(lp);
494 dd_FreeLPSolution(lps1);
495 dd_FreeLPData(lp1);
496 dd_FreeMatrix(A);
497 return QToZVectorPrimitive(retUnscaled);
498 }
499_L99:
500 assert(0);
501 return QToZVectorPrimitive(retUnscaled);
502 }
503 void dual(ZMatrix const &inequalities, ZMatrix const &equations, ZMatrix &dualInequalities, ZMatrix &dualEquations)
504 {
505 int result;

Callers 1

Calls 7

ensureCddInitialisationFunction · 0.85
assertFunction · 0.85
QToZVectorPrimitiveFunction · 0.85
getWidthMethod · 0.80
getHeightMethod · 0.80
RationalClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected