Implementation of Sparse Linear Solver with Rational precision.This class implements a SLinSolverRational interface by using the sparse LU factorization implemented in CLUFactorRational. More...
#include <slufactor_rational.h>
Public Types | |
Types | |
enum | UpdateType { ETA = 0, FOREST_TOMLIN } |
Specifies how to perform change method. More... | |
typedef SLinSolverRational::Status | Status |
for convenience More... | |
Public Types inherited from SLinSolverRational | |
enum | Status { OK = 0, INSTABLE = 1, SINGULAR = 2, UNLOADED = 4, ERROR = 8, TIME = 16 } |
status flags of the SLinSolverRational class. More... | |
Public Member Functions | |
Update type | |
UpdateType | utype () const |
returns the current update type uptype. More... | |
void | setUtype (UpdateType tp) |
sets update type. More... | |
void | setMarkowitz (const Rational &m) |
sets minimum Markowitz threshold. More... | |
Rational | markowitz () |
returns Markowitz threshold. More... | |
Derived from SLinSolverRational | |
See documentation of SLinSolverRational for a documentation of these methods. | |
void | clear () |
int | dim () const |
int | memory () const |
const char * | getName () const |
Status | status () const |
Rational | stability () const |
std::string | statistics () const |
Status | load (const SVectorRational *vec[], int dim) |
Solve | |
void | solveRight (VectorRational &x, const VectorRational &b) |
Solves \(Ax=b\). More... | |
void | solveRight (SSVectorRational &x, const SVectorRational &b) |
Solves \(Ax=b\). More... | |
void | solveRight4update (SSVectorRational &x, const SVectorRational &b) |
Solves \(Ax=b\). More... | |
void | solve2right4update (SSVectorRational &x, VectorRational &y, const SVectorRational &b, SSVectorRational &d) |
Solves \(Ax=b\) and \(Ay=d\). More... | |
void | solve3right4update (SSVectorRational &x, VectorRational &y, VectorRational &z, const SVectorRational &b, SSVectorRational &d, SSVectorRational &e) |
Solves \(Ax=b\), \(Ay=d\) and \(Az=e\). More... | |
void | solveLeft (VectorRational &x, const VectorRational &b) |
Solves \(Ax=b\). More... | |
void | solveLeft (SSVectorRational &x, const SVectorRational &b) |
Solves \(Ax=b\). More... | |
void | solveLeft (SSVectorRational &x, VectorRational &y, const SVectorRational &b, SSVectorRational &d) |
Solves \(Ax=b\) and \(Ay=d\). More... | |
void | solveLeft (SSVectorRational &x, VectorRational &y, VectorRational &z, const SVectorRational &b, SSVectorRational &d, SSVectorRational &e) |
Solves \(Ax=b\), \(Ay=d\) and \(Az=e\). More... | |
Status | change (int idx, const SVectorRational &subst, const SSVectorRational *eta=0) |
Miscellaneous | |
Real | getFactorTime () const |
time spent in factorizations More... | |
void | setTimeLimit (const Real limit) |
set time limit on factorization More... | |
void | resetFactorTime () |
reset FactorTime More... | |
int | getFactorCount () const |
number of factorizations performed More... | |
Real | getSolveTime () const |
time spent in solves More... | |
void | resetSolveTime () |
reset SolveTime More... | |
int | getSolveCount () const |
number of solves performed More... | |
void | resetCounters () |
reset timers and counters More... | |
void | dump () const |
prints the LU factorization to stdout. More... | |
bool | isConsistent () const |
consistency check. More... | |
Constructors / Destructors | |
SLUFactorRational () | |
default constructor. More... | |
SLUFactorRational & | operator= (const SLUFactorRational &old) |
assignment operator. More... | |
SLUFactorRational (const SLUFactorRational &old) | |
copy constructor. More... | |
virtual | ~SLUFactorRational () |
destructor. More... | |
virtual SLinSolverRational * | clone () const |
clone function for polymorphism More... | |
Public Member Functions inherited from SLinSolverRational | |
SLinSolverRational () | |
default constructor More... | |
virtual | ~SLinSolverRational () |
destructor More... | |
Protected Member Functions | |
Protected helpers | |
void | freeAll () |
void | changeEta (int idx, SSVectorRational &eta) |
Protected Member Functions inherited from CLUFactorRational | |
void | solveLright (Rational *vec) |
int | solveRight4update (Rational *vec, int *nonz, Rational *rhs, Rational *forest, int *forestNum, int *forestIdx) |
void | solveRight (Rational *vec, Rational *rhs) |
int | solveRight2update (Rational *vec1, Rational *vec2, Rational *rhs1, Rational *rhs2, int *nonz, Rational *forest, int *forestNum, int *forestIdx) |
void | solveRight2 (Rational *vec1, Rational *vec2, Rational *rhs1, Rational *rhs2) |
void | solveLeft (Rational *vec, Rational *rhs) |
int | solveLeftEps (Rational *vec, Rational *rhs, int *nonz) |
int | solveLeft2 (Rational *vec1, int *nonz, Rational *vec2, Rational *rhs1, Rational *rhs2) |
int | vSolveRight4update (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *forest, int *forestNum, int *forestIdx) |
int | vSolveRight4update2 (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2, Rational *forest, int *forestNum, int *forestIdx) |
int | vSolveRight4update3 (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2, Rational *vec3, Rational *rhs3, int *ridx3, int rn3, Rational *forest, int *forestNum, int *forestIdx) |
void | vSolveRightNoNZ (Rational *vec2, Rational *rhs2, int *ridx2, int rn2) |
int | vSolveLeft (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn) |
void | vSolveLeftNoNZ (Rational *vec, Rational *rhs, int *ridx, int rn) |
int | vSolveLeft2 (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2) |
int | vSolveLeft3 (Rational *vec, int *idx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2, Rational *vec3, Rational *rhs3, int *ridx3, int rn3) |
void | forestUpdate (int col, Rational *work, int num, int *nonz) |
void | update (int p_col, Rational *p_work, const int *p_idx, int num) |
void | updateNoClear (int p_col, const Rational *p_work, const int *p_idx, int num) |
void | factor (const SVectorRational **vec, const Rational &threshold) |
pivoting threshold More... | |
void | dump () const |
bool | isConsistent () const |
Protected Attributes | |
Protected data | |
bool | usetup |
TRUE iff update vector has been setup. More... | |
UpdateType | uptype |
the current UpdateType. More... | |
SSVectorRational | eta |
SSVectorRational | forest |
? Update vector set up by solveRight4update() and solve2right4update() More... | |
Rational | lastThreshold |
pivoting threshold of last factorization More... | |
Control Parameters | |
Rational | minThreshold |
minimum threshold to use. More... | |
Rational | minStability |
minimum stability to achieve by setting threshold. More... | |
Timer * | solveTime |
Time spent in solves. More... | |
Timer::TYPE | timerType |
int | solveCount |
Number of solves. More... | |
Protected Attributes inherited from CLUFactorRational | |
SLinSolverRational::Status | stat |
Status indicator. More... | |
int | thedim |
dimension of factorized matrix More... | |
int | nzCnt |
number of nonzeros in U More... | |
Rational | initMaxabs |
maximum abs number in initail Matrix More... | |
Rational | maxabs |
maximum abs number in L and U More... | |
Real | rowMemMult |
factor of minimum Memory * number of nonzeros More... | |
Real | colMemMult |
factor of minimum Memory * number of nonzeros More... | |
Real | lMemMult |
factor of minimum Memory * number of nonzeros More... | |
Perm | row |
row permutation matrices More... | |
Perm | col |
column permutation matrices More... | |
L | l |
L matrix. More... | |
VectorRational | diag |
Array of pivot elements. More... | |
U | u |
U matrix. More... | |
Rational * | work |
Working array: must always be left as 0! More... | |
Timer * | factorTime |
Time spent in factorizations. More... | |
int | factorCount |
Number of factorizations. More... | |
Real | timeLimit |
Time limit on factorization or solves. More... | |
Private Member Functions | |
Private helpers | |
void | assign (const SLUFactorRational &old) |
used to implement the assignment operator More... | |
Private Attributes | |
Private data | |
VectorRational | vec |
Temporary vector. More... | |
SSVectorRational | ssvec |
Temporary semi-sparse vector. More... | |
Implementation of Sparse Linear Solver with Rational precision.
This class implements a SLinSolverRational interface by using the sparse LU factorization implemented in CLUFactorRational.
Definition at line 41 of file slufactor_rational.h.
typedef SLinSolverRational::Status Status |
for convenience
Definition at line 55 of file slufactor_rational.h.
enum UpdateType |
Specifies how to perform change method.
Enumerator | |
---|---|
ETA | |
FOREST_TOMLIN |
Definition at line 49 of file slufactor_rational.h.
default constructor.
Definition at line 277 of file slufactor_rational.h.
References SLUFactorRational::clear(), CLUFactorRational::U::col, CLUFactorRational::col, TimerFactory::createTimer(), CLUFactorRational::diag, VectorBase< R >::dim(), CLUFactorRational::U::Row::elem, CLUFactorRational::U::Col::elem, CLUFactorRational::factorCount, CLUFactorRational::factorTime, CLUFactorRational::L::firstUnused, CLUFactorRational::L::firstUpdate, SLUFactorRational::freeAll(), CLUFactorRational::Dring::idx, CLUFactorRational::U::Row::idx, CLUFactorRational::U::Col::idx, CLUFactorRational::L::idx, SLUFactorRational::isConsistent(), CLUFactorRational::l, CLUFactorRational::U::Row::len, CLUFactorRational::U::Col::len, CLUFactorRational::U::Row::list, CLUFactorRational::U::Col::list, CLUFactorRational::U::Row::max, CLUFactorRational::U::Col::max, CLUFactorRational::nzCnt, CLUFactorRational::Perm::orig, CLUFactorRational::Perm::perm, CLUFactorRational::L::rbeg, VectorBase< R >::reDim(), CLUFactorRational::L::ridx, CLUFactorRational::L::rorig, CLUFactorRational::U::row, CLUFactorRational::L::row, CLUFactorRational::row, CLUFactorRational::L::rperm, CLUFactorRational::L::rval, CLUFactorRational::U::Col::size, soplex::spx_alloc(), CLUFactorRational::U::Row::start, CLUFactorRational::U::Col::start, CLUFactorRational::L::start, CLUFactorRational::L::startSize, CLUFactorRational::thedim, CLUFactorRational::timeLimit, CLUFactorRational::u, CLUFactorRational::U::Row::used, CLUFactorRational::U::Col::used, CLUFactorRational::U::Row::val, CLUFactorRational::U::Col::val, CLUFactorRational::L::val, and CLUFactorRational::work.
Referenced by SLUFactorRational::clone().
SLUFactorRational | ( | const SLUFactorRational & | old | ) |
copy constructor.
Definition at line 435 of file slufactor_rational.h.
References SLUFactorRational::assign(), CLUFactorRational::U::col, CLUFactorRational::col, TimerFactory::createTimer(), CLUFactorRational::U::Row::elem, CLUFactorRational::U::Col::elem, CLUFactorRational::factorTime, SLUFactorRational::freeAll(), CLUFactorRational::U::Row::idx, CLUFactorRational::U::Col::idx, CLUFactorRational::L::idx, SLUFactorRational::isConsistent(), CLUFactorRational::l, CLUFactorRational::U::Row::len, CLUFactorRational::U::Col::len, CLUFactorRational::U::Row::max, CLUFactorRational::U::Col::max, CLUFactorRational::Perm::orig, CLUFactorRational::Perm::perm, CLUFactorRational::L::rbeg, CLUFactorRational::L::ridx, CLUFactorRational::L::rorig, CLUFactorRational::U::row, CLUFactorRational::L::row, CLUFactorRational::row, CLUFactorRational::L::rperm, CLUFactorRational::U::Row::start, CLUFactorRational::U::Col::start, CLUFactorRational::L::start, CLUFactorRational::u, and SLUFactorRational::~SLUFactorRational().
|
virtual |
destructor.
Referenced by SLUFactorRational::SLUFactorRational().
|
private |
used to implement the assignment operator
Referenced by SLUFactorRational::clone(), SLUFactorRational::operator=(), and SLUFactorRational::SLUFactorRational().
|
virtual |
Implements SLinSolverRational.
Referenced by SLUFactorRational::status().
|
protected |
|
virtual |
Implements SLinSolverRational.
Referenced by SLUFactorRational::markowitz(), and SLUFactorRational::SLUFactorRational().
|
virtual |
clone function for polymorphism
Implements SLinSolverRational.
Definition at line 487 of file slufactor_rational.h.
References SLUFactorRational::assign(), and SLUFactorRational::SLUFactorRational().
|
virtual |
Implements SLinSolverRational.
Definition at line 162 of file slufactor_rational.h.
References CLUFactorRational::thedim.
Referenced by SLUFactorRational::status().
void dump | ( | ) | const |
prints the LU factorization to stdout.
Referenced by SLUFactorRational::resetCounters().
|
protected |
Referenced by SLUFactorRational::operator=(), and SLUFactorRational::SLUFactorRational().
|
virtual |
number of factorizations performed
Implements SLinSolverRational.
Definition at line 239 of file slufactor_rational.h.
References CLUFactorRational::factorCount.
Real getFactorTime | ( | ) | const |
time spent in factorizations
Definition at line 224 of file slufactor_rational.h.
References CLUFactorRational::factorTime, and Timer::time().
|
virtual |
Implements SLinSolverRational.
Definition at line 172 of file slufactor_rational.h.
References SLUFactorRational::ETA.
int getSolveCount | ( | ) | const |
number of solves performed
Definition at line 254 of file slufactor_rational.h.
References SLUFactorRational::solveCount.
Real getSolveTime | ( | ) | const |
|
virtual |
consistency check.
Implements SLinSolverRational.
Referenced by SLUFactorRational::operator=(), SLUFactorRational::resetCounters(), and SLUFactorRational::SLUFactorRational().
|
virtual |
Implements SLinSolverRational.
Referenced by SLUFactorRational::status().
Rational markowitz | ( | ) |
returns Markowitz threshold.
Definition at line 147 of file slufactor_rational.h.
References SLUFactorRational::clear(), and SLUFactorRational::lastThreshold.
|
virtual |
Implements SLinSolverRational.
Definition at line 167 of file slufactor_rational.h.
References CLUFactorRational::L::firstUnused, CLUFactorRational::l, CLUFactorRational::nzCnt, and CLUFactorRational::L::start.
SLUFactorRational& operator= | ( | const SLUFactorRational & | old | ) |
assignment operator.
Definition at line 404 of file slufactor_rational.h.
References SLUFactorRational::assign(), SVectorBase< R >::clear(), SSVectorBase< R >::clear(), SLUFactorRational::eta, SLUFactorRational::forest, SLUFactorRational::freeAll(), and SLUFactorRational::isConsistent().
void resetCounters | ( | ) |
reset timers and counters
Definition at line 259 of file slufactor_rational.h.
References SLUFactorRational::dump(), CLUFactorRational::factorCount, CLUFactorRational::factorTime, SLUFactorRational::isConsistent(), and Timer::reset().
void resetFactorTime | ( | ) |
reset FactorTime
Definition at line 234 of file slufactor_rational.h.
References CLUFactorRational::factorTime, and Timer::reset().
void resetSolveTime | ( | ) |
void setMarkowitz | ( | const Rational & | m | ) |
sets minimum Markowitz threshold.
Definition at line 127 of file slufactor_rational.h.
void setTimeLimit | ( | const Real | limit | ) |
set time limit on factorization
Definition at line 229 of file slufactor_rational.h.
References CLUFactorRational::timeLimit.
void setUtype | ( | UpdateType | tp | ) |
sets update type.
The new UpdateType becomes valid only after the next call to method load().
Definition at line 121 of file slufactor_rational.h.
|
virtual |
Solves \(Ax=b\) and \(Ay=d\).
Implements SLinSolverRational.
Referenced by SLUFactorRational::status().
|
virtual |
Solves \(Ax=b\), \(Ay=d\) and \(Az=e\).
Implements SLinSolverRational.
Referenced by SLUFactorRational::status().
|
virtual |
|
virtual |
Solves \(Ax=b\).
Implements SLinSolverRational.
|
virtual |
Solves \(Ax=b\) and \(Ay=d\).
Implements SLinSolverRational.
|
virtual |
Solves \(Ax=b\), \(Ay=d\) and \(Az=e\).
Implements SLinSolverRational.
|
virtual |
|
virtual |
Solves \(Ax=b\).
Implements SLinSolverRational.
|
virtual |
|
virtual |
Implements SLinSolverRational.
Referenced by SLUFactorRational::status().
|
virtual |
Implements SLinSolverRational.
Referenced by SLUFactorRational::status().
|
virtual |
Implements SLinSolverRational.
Definition at line 177 of file slufactor_rational.h.
References SLUFactorRational::change(), SLUFactorRational::dim(), SLUFactorRational::load(), SLUFactorRational::solve2right4update(), SLUFactorRational::solve3right4update(), SLUFactorRational::solveLeft(), SLUFactorRational::solveRight(), SLUFactorRational::solveRight4update(), SLUFactorRational::stability(), CLUFactorRational::stat, and SLUFactorRational::statistics().
UpdateType utype | ( | ) | const |
returns the current update type uptype.
Definition at line 112 of file slufactor_rational.h.
References SLUFactorRational::uptype.
|
protected |
Definition at line 74 of file slufactor_rational.h.
Referenced by SLUFactorRational::operator=().
|
protected |
? Update vector set up by solveRight4update() and solve2right4update()
Definition at line 76 of file slufactor_rational.h.
Referenced by SLUFactorRational::operator=().
|
protected |
pivoting threshold of last factorization
Definition at line 77 of file slufactor_rational.h.
Referenced by SLUFactorRational::markowitz().
|
protected |
minimum stability to achieve by setting threshold.
Definition at line 86 of file slufactor_rational.h.
|
protected |
minimum threshold to use.
Definition at line 84 of file slufactor_rational.h.
|
protected |
Number of solves.
Definition at line 91 of file slufactor_rational.h.
Referenced by SLUFactorRational::getSolveCount().
|
protected |
Time spent in solves.
Definition at line 88 of file slufactor_rational.h.
|
private |
Temporary semi-sparse vector.
Definition at line 64 of file slufactor_rational.h.
|
protected |
Definition at line 89 of file slufactor_rational.h.
|
protected |
the current UpdateType.
Definition at line 73 of file slufactor_rational.h.
Referenced by SLUFactorRational::utype().
|
protected |
TRUE iff update vector has been setup.
Definition at line 72 of file slufactor_rational.h.
|
private |
Temporary vector.
Definition at line 63 of file slufactor_rational.h.