Implementation of Sparse Linear Solver with Rational precision. 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=nullptr) |
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) |
void | init () |
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) |
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 50 of file slufactor_rational.h.
typedef SLinSolverRational::Status Status |
for convenience
Definition at line 64 of file slufactor_rational.h.
enum UpdateType |
Specifies how to perform change method.
Enumerator | |
---|---|
ETA | |
FOREST_TOMLIN |
Definition at line 58 of file slufactor_rational.h.
default constructor.
Definition at line 288 of file slufactor_rational.h.
References 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(), VectorBase< R >::get_ptr(), CLUFactorRational::Dring::idx, CLUFactorRational::U::Row::idx, CLUFactorRational::U::Col::idx, CLUFactorRational::L::idx, SLUFactorRational::init(), 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, SLUFactorRational::solveCount, SLUFactorRational::solveTime, soplex::spx_alloc(), CLUFactorRational::U::Row::start, CLUFactorRational::U::Col::start, CLUFactorRational::L::start, CLUFactorRational::L::startSize, CLUFactorRational::thedim, CLUFactorRational::timeLimit, SLUFactorRational::timerType, CLUFactorRational::u, CLUFactorRational::U::Row::used, CLUFactorRational::U::Col::used, CLUFactorRational::U::Row::val, CLUFactorRational::U::Col::val, CLUFactorRational::L::val, SLUFactorRational::vec, and CLUFactorRational::work.
Referenced by SLUFactorRational::clone().
SLUFactorRational | ( | const SLUFactorRational & | old | ) |
copy constructor.
Definition at line 446 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, SLUFactorRational::solveCount, SLUFactorRational::solveTime, CLUFactorRational::U::Row::start, CLUFactorRational::U::Col::start, CLUFactorRational::L::start, SLUFactorRational::timerType, and CLUFactorRational::u.
|
virtual |
destructor.
|
private |
used to implement the assignment operator
Referenced by SLUFactorRational::operator=(), and SLUFactorRational::SLUFactorRational().
|
virtual |
Implements SLinSolverRational.
|
protected |
|
virtual |
Implements SLinSolverRational.
|
virtual |
clone function for polymorphism
Implements SLinSolverRational.
Definition at line 498 of file slufactor_rational.h.
References SLUFactorRational::SLUFactorRational().
|
virtual |
Implements SLinSolverRational.
Definition at line 173 of file slufactor_rational.h.
References CLUFactorRational::thedim.
void dump | ( | ) | const |
prints the LU factorization to stdout.
|
protected |
Referenced by SLUFactorRational::operator=(), and SLUFactorRational::SLUFactorRational().
|
virtual |
number of factorizations performed
Implements SLinSolverRational.
Definition at line 250 of file slufactor_rational.h.
References CLUFactorRational::factorCount.
Real getFactorTime | ( | ) | const |
time spent in factorizations
Definition at line 235 of file slufactor_rational.h.
References CLUFactorRational::factorTime, and Timer::time().
|
virtual |
Implements SLinSolverRational.
Definition at line 183 of file slufactor_rational.h.
References SLUFactorRational::ETA, and SLUFactorRational::uptype.
int getSolveCount | ( | ) | const |
number of solves performed
Definition at line 265 of file slufactor_rational.h.
References SLUFactorRational::solveCount.
Real getSolveTime | ( | ) | const |
time spent in solves
Definition at line 255 of file slufactor_rational.h.
References SLUFactorRational::solveTime, and Timer::time().
|
protected |
Referenced by SLUFactorRational::SLUFactorRational().
|
virtual |
consistency check.
Implements SLinSolverRational.
Referenced by SLUFactorRational::operator=(), and SLUFactorRational::SLUFactorRational().
|
virtual |
Implements SLinSolverRational.
Rational markowitz | ( | ) |
returns Markowitz threshold.
Definition at line 158 of file slufactor_rational.h.
References SLUFactorRational::lastThreshold.
|
virtual |
Implements SLinSolverRational.
Definition at line 178 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 415 of file slufactor_rational.h.
References SLUFactorRational::assign(), SSVectorBase< R >::clear(), VectorBase< R >::clear(), SLUFactorRational::eta, SLUFactorRational::forest, SLUFactorRational::freeAll(), SLUFactorRational::isConsistent(), SLUFactorRational::ssvec, and SLUFactorRational::vec.
void resetCounters | ( | ) |
reset timers and counters
Definition at line 270 of file slufactor_rational.h.
References CLUFactorRational::factorCount, CLUFactorRational::factorTime, Timer::reset(), SLUFactorRational::solveCount, and SLUFactorRational::solveTime.
void resetFactorTime | ( | ) |
reset FactorTime
Definition at line 245 of file slufactor_rational.h.
References CLUFactorRational::factorTime, and Timer::reset().
void resetSolveTime | ( | ) |
reset SolveTime
Definition at line 260 of file slufactor_rational.h.
References Timer::reset(), and SLUFactorRational::solveTime.
void setMarkowitz | ( | const Rational & | m | ) |
sets minimum Markowitz threshold.
Definition at line 138 of file slufactor_rational.h.
References SLUFactorRational::lastThreshold, and SLUFactorRational::minThreshold.
void setTimeLimit | ( | const Real | limit | ) |
set time limit on factorization
Definition at line 240 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 132 of file slufactor_rational.h.
References SLUFactorRational::uptype.
|
virtual |
Solves \(Ax=b\) and \(Ay=d\).
Implements SLinSolverRational.
|
virtual |
Solves \(Ax=b\), \(Ay=d\) and \(Az=e\).
Implements SLinSolverRational.
|
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 |
Solves \(Ax=b\).
Implements SLinSolverRational.
|
virtual |
Solves \(Ax=b\).
Implements SLinSolverRational.
|
virtual |
Solves \(Ax=b\).
Implements SLinSolverRational.
|
virtual |
Solves \(Ax=b\).
Implements SLinSolverRational.
|
virtual |
Implements SLinSolverRational.
|
virtual |
Implements SLinSolverRational.
|
virtual |
Implements SLinSolverRational.
Definition at line 188 of file slufactor_rational.h.
References CLUFactorRational::stat.
UpdateType utype | ( | ) | const |
returns the current update type uptype.
Definition at line 123 of file slufactor_rational.h.
References SLUFactorRational::uptype.
|
protected |
Definition at line 83 of file slufactor_rational.h.
Referenced by SLUFactorRational::operator=().
|
protected |
? Update vector set up by solveRight4update() and solve2right4update()
Definition at line 85 of file slufactor_rational.h.
Referenced by SLUFactorRational::operator=().
|
protected |
pivoting threshold of last factorization
Definition at line 86 of file slufactor_rational.h.
Referenced by SLUFactorRational::markowitz(), and SLUFactorRational::setMarkowitz().
|
protected |
minimum stability to achieve by setting threshold.
Definition at line 95 of file slufactor_rational.h.
|
protected |
minimum threshold to use.
Definition at line 93 of file slufactor_rational.h.
Referenced by SLUFactorRational::setMarkowitz().
|
protected |
Number of solves.
Definition at line 100 of file slufactor_rational.h.
Referenced by SLUFactorRational::getSolveCount(), SLUFactorRational::resetCounters(), and SLUFactorRational::SLUFactorRational().
|
protected |
Time spent in solves.
Definition at line 97 of file slufactor_rational.h.
Referenced by SLUFactorRational::getSolveTime(), SLUFactorRational::resetCounters(), SLUFactorRational::resetSolveTime(), and SLUFactorRational::SLUFactorRational().
|
private |
Temporary semi-sparse vector.
Definition at line 73 of file slufactor_rational.h.
Referenced by SLUFactorRational::operator=().
|
protected |
Definition at line 98 of file slufactor_rational.h.
Referenced by SLUFactorRational::SLUFactorRational().
|
protected |
the current UpdateType.
Definition at line 82 of file slufactor_rational.h.
Referenced by SLUFactorRational::getName(), SLUFactorRational::setUtype(), and SLUFactorRational::utype().
|
protected |
TRUE iff update vector has been setup.
Definition at line 81 of file slufactor_rational.h.
|
private |
Temporary vector.
Definition at line 72 of file slufactor_rational.h.
Referenced by SLUFactorRational::operator=(), and SLUFactorRational::SLUFactorRational().