Scippy

SoPlex

Sequential object-oriented simPlex

SLinSolver Class Referenceabstract

Sparse Linear Solver virtual base class.Class SLinSolver provides a class for solving sparse linear systems with a matrix \(A\) and arbitrary right-hand side vectors. For doing so, the matrix must be first loaded to an SLinSolver object as an array of pointers to the column SVectors of this matrix. More...

#include <slinsolver.h>

Public Types

Types
enum  Status {
  OK = 0, INSTABLE = 1, SINGULAR = 2, UNLOADED = 4,
  ERROR = 8
}
 status flags of the SLinSolver class. More...
 

Public Member Functions

Miscellaneous
virtual const char * getName () const =0
 returns the name of the SLinSolver. More...
 
virtual Status status () const =0
 returns the Status of the SLinSolver. More...
 
virtual void clear ()=0
 unloads any matrix. More...
 
virtual int memory () const =0
 returns current memory consumption. More...
 
virtual int dim () const =0
 returns dimension of loaded matrix. More...
 
virtual Status load (const SVector *vec[], int dim)=0
 loads dim column vectors vec into the solver. More...
 
virtual Real stability () const =0
 returns a stability number (0: singularity, 1: perfect stability). More...
 
virtual Real conditionEstimate (int type=0) const =0
 return estimate for the condition number based on the diagonal of U More...
 
virtual std::string statistics () const =0
 returns statistical information in form of a string. More...
 
virtual Status change (int idx, const SVector &subst, const SSVector *eta=0)=0
 Substitute column idx with subst. More...
 
virtual bool isConsistent () const =0
 consistency check. More...
 
virtual int getFactorCount () const =0
 get number of factorizations More...
 
Solving linear systems

For solving linear systems with an SLinSolver object, it must have previously been loaded with the matrix to use.

Two types of systems can be solved \(A x = b\) and \(x^T A = b^T\). Method names related to the first and second type are solveRight() and solveLeft(), respectively.

The methods receive their right hand-side vector \(b\) as a const parameter, that will hence be unchanged after termination.

Some methods are available with two parameters for right hand-side vectors. Then two system are solved in one method invocation. This should generally be faster than solving two systems seperately.

The result vector(s) are allways given as the first parameter(s). Two types of result vectors are supported, Vector and SSVector.

virtual void solveRight (Vector &x, const Vector &b)=0
 Solves \(Ax=b\). More...
 
virtual void solveRight (SSVector &x, const SSVector &b)=0
 Solves \(Ax=b\). More...
 
virtual void solveRight (SSVector &x, const SVector &b)=0
 
virtual void solveRight4update (SSVector &x, const SVector &b)=0
 Solves \(Ax=b\). Possibly sets up internal data structures suitable for an optimized subsequent change() call with \(b\) as entering column. More...
 
virtual void solve2right4update (SSVector &x, Vector &y, const SVector &b, SSVector &d)=0
 Solves \(Ax=b\) and \(Ay=d\). More...
 
virtual void solve2right4update (SSVector &x, SSVector &y, const SVector &b, SSVector &d)=0
 sparse version of solving two systems of equations More...
 
virtual void solve3right4update (SSVector &x, Vector &y, Vector &z, const SVector &b, SSVector &d, SSVector &e)=0
 Solves \(Ax=b\), \(Ay=d\) and \(Az=e\). More...
 
virtual void solve3right4update (SSVector &x, SSVector &y, SSVector &z, const SVector &b, SSVector &d, SSVector &e)=0
 sparse version of solving three systems of equations More...
 
virtual void solveLeft (Vector &x, const Vector &b)=0
 solves \(x^TA=b^T\). More...
 
virtual void solveLeft (SSVector &x, const SSVector &b)=0
 
virtual void solveLeft (SSVector &x, const SVector &b)=0
 sparse version of solving one system of equations with transposed basis matrix More...
 
virtual void solveLeft (SSVector &x, Vector &two, const SVector &b, SSVector &rhs2)=0
 solves \(x^TA=b^T\) and \(x^TA=rhs2^T\) internally using \(rhs2\). More...
 
virtual void solveLeft (SSVector &x, SSVector &two, const SVector &b, SSVector &rhs2)=0
 sparse version of solving two systems of equations with transposed basis matrix More...
 
virtual void solveLeft (SSVector &x, Vector &y, Vector &z, const SVector &b, SSVector &d, SSVector &e)=0
 solves \(x^TA=b^T\), \(y^TA=d^T\) and \(z^TA=e^T\) More...
 
virtual void solveLeft (SSVector &x, SSVector &y, SSVector &z, const SVector &b, SSVector &d, SSVector &e)=0
 sparse version of solving three systems of equations with transposed basis matrix More...
 
Constructors / Destructors
 SLinSolver ()
 default constructor More...
 
virtual ~SLinSolver ()
 destructor More...
 
virtual SLinSolverclone () const =0
 clone function for polymorphism More...
 

Public Attributes

SPxOutspxout
 message handler More...
 

Detailed Description

Sparse Linear Solver virtual base class.

Class SLinSolver provides a class for solving sparse linear systems with a matrix \(A\) and arbitrary right-hand side vectors. For doing so, the matrix must be first loaded to an SLinSolver object as an array of pointers to the column SVectors of this matrix.

Definition at line 43 of file slinsolver.h.

Member Enumeration Documentation

◆ Status

enum Status

status flags of the SLinSolver class.

Enumerator
OK 

The SLinSolver is ready for solving linear systems with the loaded matrix

INSTABLE 

The loaded matrix allows only for instable solutions to be computed

SINGULAR 

The loaded matrix is singular.

UNLOADED 

No matrix has yet been loaded.

ERROR 

An error has occurred.

Definition at line 51 of file slinsolver.h.

Constructor & Destructor Documentation

◆ SLinSolver()

default constructor

Definition at line 203 of file slinsolver.h.

◆ ~SLinSolver()

virtual ~SLinSolver ( )
virtual

destructor

Definition at line 207 of file slinsolver.h.

References SLinSolver::clone().

Member Function Documentation

◆ change()

virtual Status change ( int  idx,
const SVector subst,
const SSVector eta = 0 
)
pure virtual

Substitute column idx with subst.

The change method is used to modify the loaded matrix by substituting column idx with the new vector subst. One may also pass the optional parameter eta to the solution of solveRight() if readily availabble. This may improve on the performance of the update.

Implemented in SLUFactor.

Referenced by SPxBasis::change().

◆ clear()

virtual void clear ( )
pure virtual

unloads any matrix.

Implemented in SLUFactor.

Referenced by SPxBasis::loadBasisSolver(), SPxBasis::loadDesc(), and SPxBasis::loadMatrixVecs().

◆ clone()

virtual SLinSolver* clone ( ) const
pure virtual

clone function for polymorphism

Implemented in SLUFactor.

Referenced by SPxBasis::operator=(), SPxBasis::SPxBasis(), and SLinSolver::~SLinSolver().

◆ conditionEstimate()

virtual Real conditionEstimate ( int  type = 0) const
pure virtual

return estimate for the condition number based on the diagonal of U

Implemented in SLUFactor.

Referenced by SPxBasis::getFastCondition().

◆ dim()

virtual int dim ( ) const
pure virtual

returns dimension of loaded matrix.

Implemented in SLUFactor.

Referenced by SPxBasis::change().

◆ getFactorCount()

virtual int getFactorCount ( ) const
pure virtual

get number of factorizations

Implemented in SLUFactor.

Referenced by SPxSolver::printDisplayLine().

◆ getName()

virtual const char* getName ( ) const
pure virtual

returns the name of the SLinSolver.

Implemented in SLUFactor.

◆ isConsistent()

virtual bool isConsistent ( ) const
pure virtual

consistency check.

Implemented in SLUFactor.

Referenced by SPxBasis::isConsistent().

◆ load()

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

loads dim column vectors vec into the solver.

Initializes SLinSolver for the solution of linear systems with the matrix consisting of dim column vectors given in vec.

Implemented in SLUFactor.

Referenced by SPxBasis::factorize().

◆ memory()

virtual int memory ( ) const
pure virtual

returns current memory consumption.

Implemented in SLUFactor.

Referenced by SPxBasis::change(), and SPxBasis::factorize().

◆ solve2right4update() [1/2]

virtual void solve2right4update ( SSVector x,
Vector y,
const SVector b,
SSVector d 
)
pure virtual

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

Implemented in SLUFactor.

Referenced by SPxBasis::solve4update().

◆ solve2right4update() [2/2]

virtual void solve2right4update ( SSVector x,
SSVector y,
const SVector b,
SSVector d 
)
pure virtual

sparse version of solving two systems of equations

Implemented in SLUFactor.

◆ solve3right4update() [1/2]

virtual void solve3right4update ( SSVector x,
Vector y,
Vector z,
const SVector b,
SSVector d,
SSVector e 
)
pure virtual

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

Implemented in SLUFactor.

Referenced by SPxBasis::solve4update().

◆ solve3right4update() [2/2]

virtual void solve3right4update ( SSVector x,
SSVector y,
SSVector z,
const SVector b,
SSVector d,
SSVector e 
)
pure virtual

sparse version of solving three systems of equations

Implemented in SLUFactor.

◆ solveLeft() [1/7]

virtual void solveLeft ( Vector x,
const Vector b 
)
pure virtual

solves \(x^TA=b^T\).

Implemented in SLUFactor.

Referenced by SPxBasis::condition(), and SPxBasis::coSolve().

◆ solveLeft() [2/7]

virtual void solveLeft ( SSVector x,
const SSVector b 
)
pure virtual

Implemented in SLUFactor.

◆ solveLeft() [3/7]

virtual void solveLeft ( SSVector x,
const SVector b 
)
pure virtual

sparse version of solving one system of equations with transposed basis matrix

Implemented in SLUFactor.

◆ solveLeft() [4/7]

virtual void solveLeft ( SSVector x,
Vector two,
const SVector b,
SSVector rhs2 
)
pure virtual

solves \(x^TA=b^T\) and \(x^TA=rhs2^T\) internally using \(rhs2\).

Implemented in SLUFactor.

◆ solveLeft() [5/7]

virtual void solveLeft ( SSVector x,
SSVector two,
const SVector b,
SSVector rhs2 
)
pure virtual

sparse version of solving two systems of equations with transposed basis matrix

Implemented in SLUFactor.

◆ solveLeft() [6/7]

virtual void solveLeft ( SSVector x,
Vector y,
Vector z,
const SVector b,
SSVector d,
SSVector e 
)
pure virtual

solves \(x^TA=b^T\), \(y^TA=d^T\) and \(z^TA=e^T\)

Implemented in SLUFactor.

◆ solveLeft() [7/7]

virtual void solveLeft ( SSVector x,
SSVector y,
SSVector z,
const SVector b,
SSVector d,
SSVector e 
)
pure virtual

sparse version of solving three systems of equations with transposed basis matrix

Implemented in SLUFactor.

◆ solveRight() [1/3]

virtual void solveRight ( Vector x,
const Vector b 
)
pure virtual

Solves \(Ax=b\).

Implemented in SLUFactor.

Referenced by SPxBasis::condition(), and SPxBasis::solve().

◆ solveRight() [2/3]

virtual void solveRight ( SSVector x,
const SSVector b 
)
pure virtual

Solves \(Ax=b\).

Implemented in SLUFactor.

◆ solveRight() [3/3]

virtual void solveRight ( SSVector x,
const SVector b 
)
pure virtual

Implemented in SLUFactor.

◆ solveRight4update()

virtual void solveRight4update ( SSVector x,
const SVector b 
)
pure virtual

Solves \(Ax=b\). Possibly sets up internal data structures suitable for an optimized subsequent change() call with \(b\) as entering column.

Implemented in SLUFactor.

Referenced by SPxBasis::solve4update().

◆ stability()

virtual Real stability ( ) const
pure virtual

returns a stability number (0: singularity, 1: perfect stability).

Returns a stability parameter between 0 and 1, where 0 indicates singularity, while 1 indicates perfect stability.

Implemented in SLUFactor.

Referenced by SPxBasis::change(), SPxBasis::factorize(), and SPxBasis::stability().

◆ statistics()

virtual std::string statistics ( ) const
pure virtual

returns statistical information in form of a string.

Implemented in SLUFactor.

Referenced by SPxBasis::statistics().

◆ status()

virtual Status status ( ) const
pure virtual

returns the Status of the SLinSolver.

Implemented in SLUFactor.

Referenced by SPxBasis::change().

Member Data Documentation

◆ spxout

SPxOut* spxout

message handler

Definition at line 214 of file slinsolver.h.

Referenced by SLUFactor::assign(), SLUFactor::load(), SPxBasis::loadBasisSolver(), and SPxSolver::setBasisSolver().