27 int LCP::SolveEx(
fVec& _g,
fVec& _a,
const fVec& _g_init,
double _max_error,
int _max_iteration,
double _speed,
int* n_iteration)
32 int failed =
true, count = 0;;
33 while(_max_iteration < 0 || count < _max_iteration)
42 double z = _g(
i) - _speed*(
r(
i)+a)/
N(
i,
i);
43 _g(
i) = (z >= 0.0 ? z : 0.0);
56 if(n_iteration) *n_iteration = count;
double min_value()
Returns the minimum value.
int SolveEx(fVec &g, fVec &a, const fVec &g_init, double _max_error=1e-8, int _max_iteration=100, double _speed=0.5, int *n_iteration=0)
Solve using iterative method.
void set(double *_d)
Sets all elements.
void mul(const fVec &vec, double d)
def j(str, encoding="cp932")
Solves a Linear Complementarity Problem (LCP)
int Solve(fVec &g, fVec &a)
Solve using iterative method.
void resize(int i)
Change the size.
void zero()
Creates a zero vector.