Scippy

SoPlex

Sequential object-oriented simPlex

SLUFactorRational Class Reference

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...
 
SLUFactorRationaloperator= (const SLUFactorRational &old)
 assignment operator. More...
 
 SLUFactorRational (const SLUFactorRational &old)
 copy constructor. More...
 
virtual ~SLUFactorRational ()
 destructor. More...
 
virtual SLinSolverRationalclone () 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)
 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...
 
TimersolveTime
 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...
 
Rationalwork
 Working array: must always be left as 0! More...
 
TimerfactorTime
 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...
 

Detailed Description

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.

Member Typedef Documentation

◆ Status

for convenience

Definition at line 64 of file slufactor_rational.h.

Member Enumeration Documentation

◆ UpdateType

enum UpdateType

Specifies how to perform change method.

Enumerator
ETA 
FOREST_TOMLIN 

Definition at line 58 of file slufactor_rational.h.

Constructor & Destructor Documentation

◆ SLUFactorRational() [1/2]

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(), 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, 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() [2/2]

◆ ~SLUFactorRational()

virtual ~SLUFactorRational ( )
virtual

destructor.

Referenced by SLUFactorRational::SLUFactorRational().

Member Function Documentation

◆ assign()

void assign ( const SLUFactorRational old)
private

used to implement the assignment operator

Referenced by SLUFactorRational::clone(), SLUFactorRational::operator=(), and SLUFactorRational::SLUFactorRational().

◆ change()

Status change ( int  idx,
const SVectorRational subst,
const SSVectorRational eta = 0 
)
virtual

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ changeEta()

void changeEta ( int  idx,
SSVectorRational eta 
)
protected

◆ clear()

void clear ( )
virtual

◆ clone()

virtual SLinSolverRational* clone ( ) const
virtual

clone function for polymorphism

Implements SLinSolverRational.

Definition at line 498 of file slufactor_rational.h.

References SLUFactorRational::assign(), and SLUFactorRational::SLUFactorRational().

◆ dim()

int dim ( ) const
virtual

Implements SLinSolverRational.

Definition at line 173 of file slufactor_rational.h.

References CLUFactorRational::thedim.

Referenced by SLUFactorRational::status().

◆ dump()

void dump ( ) const

prints the LU factorization to stdout.

Referenced by SLUFactorRational::resetCounters().

◆ freeAll()

void freeAll ( )
protected

◆ getFactorCount()

int getFactorCount ( ) const
virtual

number of factorizations performed

Implements SLinSolverRational.

Definition at line 250 of file slufactor_rational.h.

References CLUFactorRational::factorCount.

◆ getFactorTime()

Real getFactorTime ( ) const

time spent in factorizations

Definition at line 235 of file slufactor_rational.h.

References CLUFactorRational::factorTime, and Timer::time().

◆ getName()

const char* getName ( ) const
virtual

Implements SLinSolverRational.

Definition at line 183 of file slufactor_rational.h.

References SLUFactorRational::ETA.

◆ getSolveCount()

int getSolveCount ( ) const

number of solves performed

Definition at line 265 of file slufactor_rational.h.

References SLUFactorRational::solveCount.

◆ getSolveTime()

Real getSolveTime ( ) const

time spent in solves

Definition at line 255 of file slufactor_rational.h.

References Timer::time().

◆ init()

void init ( )
protected

◆ isConsistent()

bool isConsistent ( ) const
virtual

◆ load()

Status load ( const SVectorRational vec[],
int  dim 
)
virtual

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ markowitz()

Rational markowitz ( )

returns Markowitz threshold.

Definition at line 158 of file slufactor_rational.h.

References SLUFactorRational::clear(), and SLUFactorRational::lastThreshold.

◆ memory()

◆ operator=()

◆ resetCounters()

void resetCounters ( )

◆ resetFactorTime()

void resetFactorTime ( )

reset FactorTime

Definition at line 245 of file slufactor_rational.h.

References CLUFactorRational::factorTime, and Timer::reset().

◆ resetSolveTime()

void resetSolveTime ( )

reset SolveTime

Definition at line 260 of file slufactor_rational.h.

References Timer::reset().

◆ setMarkowitz()

void setMarkowitz ( const Rational m)

sets minimum Markowitz threshold.

Definition at line 138 of file slufactor_rational.h.

◆ setTimeLimit()

void setTimeLimit ( const Real  limit)

set time limit on factorization

Definition at line 240 of file slufactor_rational.h.

References CLUFactorRational::timeLimit.

◆ setUtype()

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.

◆ solve2right4update()

void solve2right4update ( SSVectorRational x,
VectorRational y,
const SVectorRational b,
SSVectorRational d 
)
virtual

Solves \(Ax=b\) and \(Ay=d\).

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ solve3right4update()

void solve3right4update ( SSVectorRational x,
VectorRational y,
VectorRational z,
const SVectorRational b,
SSVectorRational d,
SSVectorRational e 
)
virtual

Solves \(Ax=b\), \(Ay=d\) and \(Az=e\).

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ solveLeft() [1/4]

void solveLeft ( VectorRational x,
const VectorRational b 
)
virtual

Solves \(Ax=b\).

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ solveLeft() [2/4]

void solveLeft ( SSVectorRational x,
const SVectorRational b 
)
virtual

Solves \(Ax=b\).

Implements SLinSolverRational.

◆ solveLeft() [3/4]

void solveLeft ( SSVectorRational x,
VectorRational y,
const SVectorRational b,
SSVectorRational d 
)
virtual

Solves \(Ax=b\) and \(Ay=d\).

Implements SLinSolverRational.

◆ solveLeft() [4/4]

void solveLeft ( SSVectorRational x,
VectorRational y,
VectorRational z,
const SVectorRational b,
SSVectorRational d,
SSVectorRational e 
)
virtual

Solves \(Ax=b\), \(Ay=d\) and \(Az=e\).

Implements SLinSolverRational.

◆ solveRight() [1/2]

void solveRight ( VectorRational x,
const VectorRational b 
)
virtual

Solves \(Ax=b\).

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ solveRight() [2/2]

void solveRight ( SSVectorRational x,
const SVectorRational b 
)
virtual

Solves \(Ax=b\).

Implements SLinSolverRational.

◆ solveRight4update()

void solveRight4update ( SSVectorRational x,
const SVectorRational b 
)
virtual

Solves \(Ax=b\).

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ stability()

Rational stability ( ) const
virtual

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ statistics()

std::string statistics ( ) const
virtual

Implements SLinSolverRational.

Referenced by SLUFactorRational::status().

◆ status()

◆ utype()

UpdateType utype ( ) const

returns the current update type uptype.

Definition at line 123 of file slufactor_rational.h.

References SLUFactorRational::uptype.

Member Data Documentation

◆ eta

SSVectorRational eta
protected

Definition at line 83 of file slufactor_rational.h.

Referenced by SLUFactorRational::operator=().

◆ forest

SSVectorRational forest
protected

? Update vector set up by solveRight4update() and solve2right4update()

Definition at line 85 of file slufactor_rational.h.

Referenced by SLUFactorRational::operator=().

◆ lastThreshold

Rational lastThreshold
protected

pivoting threshold of last factorization

Definition at line 86 of file slufactor_rational.h.

Referenced by SLUFactorRational::markowitz().

◆ minStability

Rational minStability
protected

minimum stability to achieve by setting threshold.

Definition at line 95 of file slufactor_rational.h.

◆ minThreshold

Rational minThreshold
protected

minimum threshold to use.

Definition at line 93 of file slufactor_rational.h.

◆ solveCount

int solveCount
protected

Number of solves.

Definition at line 100 of file slufactor_rational.h.

Referenced by SLUFactorRational::getSolveCount().

◆ solveTime

Timer* solveTime
protected

Time spent in solves.

Definition at line 97 of file slufactor_rational.h.

◆ ssvec

SSVectorRational ssvec
private

Temporary semi-sparse vector.

Definition at line 73 of file slufactor_rational.h.

◆ timerType

Timer::TYPE timerType
protected

Definition at line 98 of file slufactor_rational.h.

◆ uptype

UpdateType uptype
protected

the current UpdateType.

Definition at line 82 of file slufactor_rational.h.

Referenced by SLUFactorRational::utype().

◆ usetup

bool usetup
protected

TRUE iff update vector has been setup.

Definition at line 81 of file slufactor_rational.h.

◆ vec

VectorRational vec
private

Temporary vector.

Definition at line 72 of file slufactor_rational.h.