31 template <
typename Real,
int... Dimensions>
35 template <
typename Real>
53 inline void SetMaxIterations(
int maxIterations);
54 inline int GetMaxIterations()
const;
57 inline int GetNumIterations()
const;
97 bool Solve(Real
const*
q, Real
const* M, Real*
w, Real*
z,
Result*
result);
100 inline Real
const& Augmented(
int row,
int col)
const;
101 inline Real& Augmented(
int row,
int col);
105 void MakeZero(Real* poly);
106 void Copy(Real
const* poly0, Real* poly1);
107 bool LessThan(Real
const* poly0, Real
const* poly1);
108 bool LessThanZero(Real
const* poly);
109 void Multiply(Real
const* poly, Real scalar, Real* product);
132 template <
typename Real,
int n>
142 bool Solve(std::array<Real, n>
const&
q,
std::array<std::array<Real, n>,
n>
const& M,
143 std::array<Real, n>&
w, std::array<Real, n>&
z,
157 template <
typename Real>
169 bool Solve(std::vector<Real>
const&
q, std::vector<Real>
const& M,
170 std::vector<Real>&
w, std::vector<Real>&
z,
184 template <
typename Real>
189 mVarNonbasic(nullptr),
209 template <
typename Real>
215 template <
typename Real>
221 template <
typename Real>
227 template <
typename Real>
239 mPoly[
r][r + 1] = (Real)1;
339 if (index < mDimension)
353 driving = nextDriving;
359 Real factor = (Real)-1 /
Augmented(
r, driving);
389 Real invDenom = (Real)1 /
Augmented(basic, driving);
392 if (
r != basic &&
Augmented(
r, driving) != (Real)0)
394 Real multiplier =
Augmented(
r, driving) * invDenom;
446 #if defined(GTE_REPORT_FAILED_TO_CONVERGE) 457 template <
typename Real>
463 template <
typename Real>
470 template <
typename Real>
479 template <
typename Real>
488 template <
typename Real>
493 if (poly0[i] < poly1[i])
498 if (poly0[i] > poly1[i])
507 template <
typename Real>
512 if (poly[i] < (Real)0)
517 if (poly[i] > (Real)0)
526 template <
typename Real>
531 product[i] = poly[i] * scalar;
536 template <
typename Real,
int n>
541 this->mVarBasic = mArrayVarBasic.data();
542 this->mVarNonbasic = mArrayVarNonbasic.data();
543 this->mNumCols = 2 * (
n + 1);
544 this->mAugmented = mArrayAugmented.data();
545 this->mQMin = mArrayQMin.data();
546 this->mMinRatio = mArrayMinRatio.data();
547 this->mRatio = mArrayRatio.data();
548 this->mPoly = mArrayPoly.data();
551 template <
typename Real,
int n>
553 std::array<Real, n>
const&
q,
std::array<std::array<Real, n>,
n>
const& M,
554 std::array<Real, n>&
w, std::array<Real, n>&
z,
561 template <
typename Real>
568 mVectorVarBasic.resize(n + 1);
569 mVectorVarNonbasic.resize(n + 1);
570 mVectorAugmented.resize(2 * (n + 1) * n);
571 mVectorQMin.resize(n + 1);
572 mVectorMinRatio.resize(n + 1);
573 mVectorRatio.resize(n + 1);
574 mVectorPoly.resize(n);
576 this->mVarBasic = mVectorVarBasic.data();
577 this->mVarNonbasic = mVectorVarNonbasic.data();
578 this->mNumCols = 2 * (n + 1);
579 this->mAugmented = mVectorAugmented.data();
580 this->mQMin = mVectorQMin.data();
581 this->mMinRatio = mVectorMinRatio.data();
582 this->mRatio = mVectorRatio.data();
583 this->mPoly = mVectorPoly.data();
587 template <
typename Real>
589 std::vector<Real>
const&
q, std::vector<Real>
const& M,
590 std::vector<Real>&
w, std::vector<Real>&
z,
593 if (this->mDimension > static_cast<int>(q.size())
594 || this->mDimension * this->mDimension > static_cast<int>(M.size()))
598 *result = this->INVALID_INPUT;
603 if (this->mDimension > static_cast<int>(w.size()))
605 w.resize(this->mDimension);
608 if (this->mDimension > static_cast<int>(z.size()))
610 z.resize(this->mDimension);
void SetMaxIterations(int maxIterations)
std::vector< Real * > mVectorPoly
void Multiply(Real const *poly, Real scalar, Real *product)
std::array< Real, n+1 > mArrayRatio
int GetMaxIterations() const
#define LogInformation(message)
std::array< Real, 2 *(n+1)*n > mArrayAugmented
GLubyte GLubyte GLubyte GLubyte w
std::array< Real, n+1 > mArrayQMin
std::vector< typename LCPSolverShared< Real >::Variable > mVectorVarBasic
std::array< Real *, n > mArrayPoly
GLenum GLenum GLsizei void * row
bool Solve(Real const *q, Real const *M, Real *w, Real *z, Result *result)
int GetNumIterations() const
Real const & Augmented(int row, int col) const
std::array< Real, n+1 > mArrayMinRatio
std::array< typename LCPSolverShared< Real >::Variable, n+1 > mArrayVarNonbasic
void Copy(Real const *poly0, Real *poly1)
std::vector< Real > mVectorMinRatio
std::array< typename LCPSolverShared< Real >::Variable, n+1 > mArrayVarBasic
GLdouble GLdouble GLdouble z
void MakeZero(Real *poly)
std::vector< Real > mVectorRatio
std::vector< Real > mVectorQMin
std::vector< Real > mVectorAugmented
GLdouble GLdouble GLdouble GLdouble q
bool LessThanZero(Real const *poly)
std::vector< typename LCPSolverShared< Real >::Variable > mVectorVarNonbasic
bool LessThan(Real const *poly0, Real const *poly1)