Scippy

SoPlex

Sequential object-oriented simPlex

CLUFactorRational Class Reference

Implementation of sparse LU factorization with Rational precision. More...

#include <clufactor_rational.h>

Classes

struct  Dring
 
struct  L
 Data structures for saving the working matrix and L factor. More...
 
struct  Perm
 Data structures for saving the row and column permutations. More...
 
class  Pring
 Pivot Ring. More...
 
class  Temp
 Temporary data structures. More...
 
struct  U
 Data structures for saving the working matrix and U factor. More...
 

Protected Member Functions

Solver methods
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)
 
Debugging
void dump () const
 
bool isConsistent () const
 

Protected Attributes

Protected data
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

Solving

These helper methods are used during the factorization process. The solve*-methods solve lower and upper triangular systems from the left or from the right, respectively The methods with '2' in the end solve two systems at the same time. The methods with "Eps" in the end consider elements smaller then the passed epsilon as zero.

void solveUright (Rational *wrk, Rational *vec)
 
int solveUrightEps (Rational *vec, int *nonz, Rational *rhs)
 
void solveUright2 (Rational *work1, Rational *vec1, Rational *work2, Rational *vec2)
 
int solveUright2eps (Rational *work1, Rational *vec1, Rational *work2, Rational *vec2, int *nonz)
 
void solveLright2 (Rational *vec1, Rational *vec2)
 
void solveUpdateRight (Rational *vec)
 
void solveUpdateRight2 (Rational *vec1, Rational *vec2)
 
void solveUleft (Rational *work, Rational *vec)
 
void solveUleft2 (Rational *work1, Rational *vec1, Rational *work2, Rational *vec2)
 
int solveLleft2forest (Rational *vec1, int *, Rational *vec2)
 
void solveLleft2 (Rational *vec1, int *, Rational *vec2)
 
int solveLleftForest (Rational *vec, int *)
 
void solveLleft (Rational *vec)
 
int solveLleftEps (Rational *vec, int *nonz)
 
void solveUpdateLeft (Rational *vec)
 
void solveUpdateLeft2 (Rational *vec1, Rational *vec2)
 
int vSolveLright (Rational *vec, int *ridx, int rn)
 
void vSolveLright2 (Rational *vec, int *ridx, int *rnptr, Rational *vec2, int *ridx2, int *rn2ptr)
 
void vSolveLright3 (Rational *vec, int *ridx, int *rnptr, Rational *vec2, int *ridx2, int *rn2ptr, Rational *vec3, int *ridx3, int *rn3ptr)
 
int vSolveUright (Rational *vec, int *vidx, Rational *rhs, int *ridx, int rn)
 
void vSolveUrightNoNZ (Rational *vec, Rational *rhs, int *ridx, int rn)
 
int vSolveUright2 (Rational *vec, int *vidx, Rational *rhs, int *ridx, int rn, Rational *vec2, Rational *rhs2, int *ridx2, int rn2)
 
int vSolveUpdateRight (Rational *vec, int *ridx, int n)
 
void vSolveUpdateRightNoNZ (Rational *vec)
 
int solveUleft (Rational *vec, int *vecidx, Rational *rhs, int *rhsidx, int rhsn)
 
void solveUleftNoNZ (Rational *vec, Rational *rhs, int *rhsidx, int rhsn)
 
int solveLleftForest (Rational *vec, int *nonz, int n)
 
void solveLleftForestNoNZ (Rational *vec)
 
int solveLleft (Rational *vec, int *nonz, int rn)
 
void solveLleftNoNZ (Rational *vec)
 
int solveUpdateLeft (Rational *vec, int *nonz, int n)
 
void forestPackColumns ()
 
void forestMinColMem (int size)
 
void forestReMaxCol (int col, int len)
 
void initPerm ()
 
void initFactorMatrix (const SVectorRational **vec)
 
void minLMem (int size)
 
void setPivot (const int p_stage, const int p_col, const int p_row, const Rational &val)
 
void colSingletons ()
 
void rowSingletons ()
 
void initFactorRings ()
 
void freeFactorRings ()
 
int setupColVals ()
 
void setupRowVals ()
 
void eliminateRowSingletons ()
 
void eliminateColSingletons ()
 
void selectPivots (const Rational &threshold)
 
int updateRow (int r, int lv, int prow, int pcol, const Rational &pval)
 
void eliminatePivot (int prow, int pos)
 
void eliminateNucleus (const Rational &threshold)
 
void minRowMem (int size)
 
void minColMem (int size)
 
void remaxCol (int p_col, int len)
 
void packRows ()
 
void packColumns ()
 
void remaxRow (int p_row, int len)
 
int makeLvec (int p_len, int p_row)
 
bool timeLimitReached ()
 

Private Attributes

Private data
Temp temp
 Temporary storage. More...
 

Detailed Description

Implementation of sparse LU factorization with Rational precision.

This class implements a sparse LU factorization with either FOREST-TOMLIN or ETA updates, using dynamic Markowitz pivoting.

Definition at line 48 of file clufactor_rational.h.

Member Function Documentation

◆ colSingletons()

void colSingletons ( )
private

◆ dump()

void dump ( ) const
protected

◆ eliminateColSingletons()

void eliminateColSingletons ( )
private

◆ eliminateNucleus()

void eliminateNucleus ( const Rational threshold)
private

◆ eliminatePivot()

void eliminatePivot ( int  prow,
int  pos 
)
private

◆ eliminateRowSingletons()

void eliminateRowSingletons ( )
private

◆ factor()

void factor ( const SVectorRational **  vec,
const Rational threshold 
)
protected
Parameters
vecArray of column vector pointers
thresholdpivoting threshold

◆ forestMinColMem()

void forestMinColMem ( int  size)
private

◆ forestPackColumns()

void forestPackColumns ( )
private

◆ forestReMaxCol()

void forestReMaxCol ( int  col,
int  len 
)
private

◆ forestUpdate()

void forestUpdate ( int  col,
Rational work,
int  num,
int *  nonz 
)
protected

◆ freeFactorRings()

void freeFactorRings ( )
private

◆ initFactorMatrix()

void initFactorMatrix ( const SVectorRational **  vec)
private

◆ initFactorRings()

void initFactorRings ( )
private

◆ initPerm()

void initPerm ( )
private

◆ isConsistent()

bool isConsistent ( ) const
protected

◆ makeLvec()

int makeLvec ( int  p_len,
int  p_row 
)
private

◆ minColMem()

void minColMem ( int  size)
private

◆ minLMem()

void minLMem ( int  size)
private

◆ minRowMem()

void minRowMem ( int  size)
private

◆ packColumns()

void packColumns ( )
private

◆ packRows()

void packRows ( )
private

◆ remaxCol()

void remaxCol ( int  p_col,
int  len 
)
private

◆ remaxRow()

void remaxRow ( int  p_row,
int  len 
)
private

◆ rowSingletons()

void rowSingletons ( )
private

◆ selectPivots()

void selectPivots ( const Rational threshold)
private

◆ setPivot()

void setPivot ( const int  p_stage,
const int  p_col,
const int  p_row,
const Rational val 
)
private

◆ setupColVals()

int setupColVals ( )
private

◆ setupRowVals()

void setupRowVals ( )
private

◆ solveLeft()

void solveLeft ( Rational vec,
Rational rhs 
)
protected

◆ solveLeft2()

int solveLeft2 ( Rational vec1,
int *  nonz,
Rational vec2,
Rational rhs1,
Rational rhs2 
)
protected

◆ solveLeftEps()

int solveLeftEps ( Rational vec,
Rational rhs,
int *  nonz 
)
protected

◆ solveLleft() [1/2]

void solveLleft ( Rational vec)
private

◆ solveLleft() [2/2]

int solveLleft ( Rational vec,
int *  nonz,
int  rn 
)
private

◆ solveLleft2()

void solveLleft2 ( Rational vec1,
int *  ,
Rational vec2 
)
private

◆ solveLleft2forest()

int solveLleft2forest ( Rational vec1,
int *  ,
Rational vec2 
)
private

◆ solveLleftEps()

int solveLleftEps ( Rational vec,
int *  nonz 
)
private

◆ solveLleftForest() [1/2]

int solveLleftForest ( Rational vec,
int *   
)
private

◆ solveLleftForest() [2/2]

int solveLleftForest ( Rational vec,
int *  nonz,
int  n 
)
private

◆ solveLleftForestNoNZ()

void solveLleftForestNoNZ ( Rational vec)
private

◆ solveLleftNoNZ()

void solveLleftNoNZ ( Rational vec)
private

◆ solveLright()

void solveLright ( Rational vec)
protected

◆ solveLright2()

void solveLright2 ( Rational vec1,
Rational vec2 
)
private

◆ solveRight()

void solveRight ( Rational vec,
Rational rhs 
)
protected

◆ solveRight2()

void solveRight2 ( Rational vec1,
Rational vec2,
Rational rhs1,
Rational rhs2 
)
protected

◆ solveRight2update()

int solveRight2update ( Rational vec1,
Rational vec2,
Rational rhs1,
Rational rhs2,
int *  nonz,
Rational forest,
int *  forestNum,
int *  forestIdx 
)
protected

◆ solveRight4update()

int solveRight4update ( Rational vec,
int *  nonz,
Rational rhs,
Rational forest,
int *  forestNum,
int *  forestIdx 
)
protected

◆ solveUleft() [1/2]

int solveUleft ( Rational vec,
int *  vecidx,
Rational rhs,
int *  rhsidx,
int  rhsn 
)
private

◆ solveUleft() [2/2]

void solveUleft ( Rational work,
Rational vec 
)
private

◆ solveUleft2()

void solveUleft2 ( Rational work1,
Rational vec1,
Rational work2,
Rational vec2 
)
private

◆ solveUleftNoNZ()

void solveUleftNoNZ ( Rational vec,
Rational rhs,
int *  rhsidx,
int  rhsn 
)
private

◆ solveUpdateLeft() [1/2]

void solveUpdateLeft ( Rational vec)
private

◆ solveUpdateLeft() [2/2]

int solveUpdateLeft ( Rational vec,
int *  nonz,
int  n 
)
private

◆ solveUpdateLeft2()

void solveUpdateLeft2 ( Rational vec1,
Rational vec2 
)
private

◆ solveUpdateRight()

void solveUpdateRight ( Rational vec)
private

◆ solveUpdateRight2()

void solveUpdateRight2 ( Rational vec1,
Rational vec2 
)
private

◆ solveUright()

void solveUright ( Rational wrk,
Rational vec 
)
private

◆ solveUright2()

void solveUright2 ( Rational work1,
Rational vec1,
Rational work2,
Rational vec2 
)
private

◆ solveUright2eps()

int solveUright2eps ( Rational work1,
Rational vec1,
Rational work2,
Rational vec2,
int *  nonz 
)
private

◆ solveUrightEps()

int solveUrightEps ( Rational vec,
int *  nonz,
Rational rhs 
)
private

◆ timeLimitReached()

◆ update()

void update ( int  p_col,
Rational p_work,
const int *  p_idx,
int  num 
)
protected

◆ updateNoClear()

void updateNoClear ( int  p_col,
const Rational p_work,
const int *  p_idx,
int  num 
)
protected

◆ updateRow()

int updateRow ( int  r,
int  lv,
int  prow,
int  pcol,
const Rational pval 
)
private

◆ vSolveLeft()

int vSolveLeft ( Rational vec,
int *  idx,
Rational rhs,
int *  ridx,
int  rn 
)
protected

◆ vSolveLeft2()

int vSolveLeft2 ( Rational vec,
int *  idx,
Rational rhs,
int *  ridx,
int  rn,
Rational vec2,
Rational rhs2,
int *  ridx2,
int  rn2 
)
protected

◆ vSolveLeft3()

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 
)
protected

◆ vSolveLeftNoNZ()

void vSolveLeftNoNZ ( Rational vec,
Rational rhs,
int *  ridx,
int  rn 
)
protected

◆ vSolveLright()

int vSolveLright ( Rational vec,
int *  ridx,
int  rn 
)
private

◆ vSolveLright2()

void vSolveLright2 ( Rational vec,
int *  ridx,
int *  rnptr,
Rational vec2,
int *  ridx2,
int *  rn2ptr 
)
private

◆ vSolveLright3()

void vSolveLright3 ( Rational vec,
int *  ridx,
int *  rnptr,
Rational vec2,
int *  ridx2,
int *  rn2ptr,
Rational vec3,
int *  ridx3,
int *  rn3ptr 
)
private

◆ vSolveRight4update()

int vSolveRight4update ( Rational vec,
int *  idx,
Rational rhs,
int *  ridx,
int  rn,
Rational forest,
int *  forestNum,
int *  forestIdx 
)
protected

◆ vSolveRight4update2()

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 
)
protected

◆ vSolveRight4update3()

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 
)
protected

◆ vSolveRightNoNZ()

void vSolveRightNoNZ ( Rational vec2,
Rational rhs2,
int *  ridx2,
int  rn2 
)
protected

◆ vSolveUpdateRight()

int vSolveUpdateRight ( Rational vec,
int *  ridx,
int  n 
)
private

◆ vSolveUpdateRightNoNZ()

void vSolveUpdateRightNoNZ ( Rational vec)
private

◆ vSolveUright()

int vSolveUright ( Rational vec,
int *  vidx,
Rational rhs,
int *  ridx,
int  rn 
)
private

◆ vSolveUright2()

int vSolveUright2 ( Rational vec,
int *  vidx,
Rational rhs,
int *  ridx,
int  rn,
Rational vec2,
Rational rhs2,
int *  ridx2,
int  rn2 
)
private

◆ vSolveUrightNoNZ()

void vSolveUrightNoNZ ( Rational vec,
Rational rhs,
int *  ridx,
int  rn 
)
private

Member Data Documentation

◆ col

Perm col
protected

column permutation matrices

Definition at line 206 of file clufactor_rational.h.

Referenced by SLUFactorRational::SLUFactorRational().

◆ colMemMult

Real colMemMult
protected

factor of minimum Memory * number of nonzeros

Definition at line 202 of file clufactor_rational.h.

◆ diag

VectorRational diag
protected

Array of pivot elements.

Definition at line 209 of file clufactor_rational.h.

Referenced by SLUFactorRational::SLUFactorRational().

◆ factorCount

int factorCount
protected

◆ factorTime

◆ initMaxabs

Rational initMaxabs
protected

maximum abs number in initail Matrix

Definition at line 198 of file clufactor_rational.h.

◆ l

L l
protected

L matrix.

Definition at line 208 of file clufactor_rational.h.

Referenced by SLUFactorRational::memory(), and SLUFactorRational::SLUFactorRational().

◆ lMemMult

Real lMemMult
protected

factor of minimum Memory * number of nonzeros

Definition at line 203 of file clufactor_rational.h.

◆ maxabs

Rational maxabs
protected

maximum abs number in L and U

Definition at line 199 of file clufactor_rational.h.

◆ nzCnt

int nzCnt
protected

number of nonzeros in U

Definition at line 197 of file clufactor_rational.h.

Referenced by SLUFactorRational::memory(), and SLUFactorRational::SLUFactorRational().

◆ row

Perm row
protected

row permutation matrices

Definition at line 205 of file clufactor_rational.h.

Referenced by SLUFactorRational::SLUFactorRational().

◆ rowMemMult

Real rowMemMult
protected

factor of minimum Memory * number of nonzeros

Definition at line 201 of file clufactor_rational.h.

◆ stat

Status indicator.

Definition at line 194 of file clufactor_rational.h.

Referenced by SLUFactorRational::status(), and CLUFactorRational::timeLimitReached().

◆ temp

Temp temp
private

Temporary storage.

Definition at line 224 of file clufactor_rational.h.

◆ thedim

int thedim
protected

dimension of factorized matrix

Definition at line 196 of file clufactor_rational.h.

Referenced by SLUFactorRational::dim(), and SLUFactorRational::SLUFactorRational().

◆ timeLimit

Real timeLimit
protected

Time limit on factorization or solves.

Definition at line 216 of file clufactor_rational.h.

Referenced by SLUFactorRational::setTimeLimit(), SLUFactorRational::SLUFactorRational(), and CLUFactorRational::timeLimitReached().

◆ u

U u
protected

U matrix.

Definition at line 210 of file clufactor_rational.h.

Referenced by SLUFactorRational::SLUFactorRational().

◆ work

Rational* work
protected

Working array: must always be left as 0!

Definition at line 212 of file clufactor_rational.h.

Referenced by SLUFactorRational::SLUFactorRational().