@ -22,8 +22,7 @@ namespace storm {
namespace solver {
/*!
* An interface that represents an abstract linear equation solver . In addition to solving a system of linear
* equations , the functionality to repeatedly multiply a matrix with a given vector is provided .
* An interface that represents an abstract linear equation solver .
*/
template < class ValueType >
class LinearEquationSolver : public AbstractEquationSolver < ValueType > {
@ -50,86 +49,6 @@ namespace storm {
*/
bool solveEquations ( Environment const & env , std : : vector < ValueType > & x , std : : vector < ValueType > const & b ) const ;
/*!
* Performs on matrix - vector multiplication x ' = A * x + b .
*
* @ param x The input vector with which to multiply the matrix . Its length must be equal
* to the number of columns of A .
* @ param b If non - null , this vector is added after the multiplication . If given , its length must be equal
* to the number of rows of A .
* @ param result The target vector into which to write the multiplication result . Its length must be equal
* to the number of rows of A .
*/
virtual void multiply ( std : : vector < ValueType > & x , std : : vector < ValueType > const * b , std : : vector < ValueType > & result ) const = 0 ;
/*!
* Performs on matrix - vector multiplication x ' = A * x + b and then minimizes / maximizes over the row groups
* so that the resulting vector has the size of number of row groups of A .
*
* @ param dir The direction for the reduction step .
* @ param rowGroupIndices A vector storing the row groups over which to reduce .
* @ param x The input vector with which to multiply the matrix . Its length must be equal
* to the number of columns of A .
* @ param b If non - null , this vector is added after the multiplication . If given , its length must be equal
* to the number of rows of A .
* @ param result The target vector into which to write the multiplication result . Its length must be equal
* to the number of rows of A .
* @ param choices If given , the choices made in the reduction process are written to this vector .
*/
virtual void multiplyAndReduce ( OptimizationDirection const & dir , std : : vector < uint64_t > const & rowGroupIndices , std : : vector < ValueType > & x , std : : vector < ValueType > const * b , std : : vector < ValueType > & result , std : : vector < uint_fast64_t > * choices = nullptr ) const ;
/*!
* Retrieves whether this solver offers the gauss - seidel style multiplications .
*/
virtual bool supportsGaussSeidelMultiplication ( ) const ;
/*!
* Performs on matrix - vector multiplication x ' = A * x + b . It does so in a gauss - seidel style , i . e . reusing
* the new x ' components in the further multiplication .
*
* @ param x The input vector with which to multiply the matrix . Its length must be equal
* to the number of columns of A .
* @ param b If non - null , this vector is added after the multiplication . If given , its length must be equal
* to the number of rows of A .
*/
virtual void multiplyGaussSeidel ( std : : vector < ValueType > & x , std : : vector < ValueType > const * b ) const ;
/*!
* Performs on matrix - vector multiplication x ' = A * x + b and then minimizes / maximizes over the row groups
* so that the resulting vector has the size of number of row groups of A . It does so in a gauss - seidel
* style , i . e . reusing the new x ' components in the further multiplication .
*
* @ param dir The direction for the reduction step .
* @ param rowGroupIndices A vector storing the row groups over which to reduce .
* @ param x The input vector with which to multiply the matrix . Its length must be equal
* to the number of columns of A .
* @ param b If non - null , this vector is added after the multiplication . If given , its length must be equal
* to the number of rows of A .
* @ param choices If given , the choices made in the reduction process are written to this vector .
*/
virtual void multiplyAndReduceGaussSeidel ( OptimizationDirection const & dir , std : : vector < uint64_t > const & rowGroupIndices , std : : vector < ValueType > & x , std : : vector < ValueType > const * b , std : : vector < uint_fast64_t > * choices = nullptr ) const ;
/*!
* Multiplies the row with the given index with x and adds the given offset
* @ param rowIndex The index of the considered row
* @ param x The input vector with which the row is multiplied
* @ param offset A value that is added to the matrix - vector multiplication result
*/
virtual ValueType multiplyRow ( uint64_t const & rowIndex , std : : vector < ValueType > const & x ) const = 0 ;
/*!
* Performs repeated matrix - vector multiplication , using x [ 0 ] = x and x [ i + 1 ] = A * x [ i ] + b . After
* performing the necessary multiplications , the result is written to the input vector x . Note that the
* matrix A has to be given upon construction time of the solver object .
*
* @ param x The initial vector with which to perform matrix - vector multiplication . Its length must be equal
* to the number of columns of A .
* @ param b If non - null , this vector is added after each multiplication . If given , its length must be equal
* to the number of rows of A .
* @ param n The number of times to perform the multiplication .
*/
void repeatedMultiply ( std : : vector < ValueType > & x , std : : vector < ValueType > const * b , uint_fast64_t n ) const ;
/*!
* Retrieves the format in which this solver expects to solve equations . If the solver expects the equation
* system format , it solves Ax = b . If it it expects a fixed point format , it solves Ax + b = x .
@ -140,7 +59,7 @@ namespace storm {
* Retrieves the requirements of the solver under the current settings . Note that these requirements only
* apply to solving linear equations and not to the matrix vector multiplications .
*/
virtual LinearEquationSolverRequirements getRequirements ( Environment const & env , LinearEquationSolverTask const & task = LinearEquationSolverTask : : Unspecified ) const ;
virtual LinearEquationSolverRequirements getRequirements ( Environment const & env ) const ;
/*!
* Sets whether some of the generated data during solver calls should be cached .
@ -195,7 +114,7 @@ namespace storm {
* @ param matrix The matrix that defines the equation system .
* @ return A pointer to the newly created solver .
*/
std : : unique_ptr < LinearEquationSolver < ValueType > > create ( Environment const & env , storm : : storage : : SparseMatrix < ValueType > const & matrix , LinearEquationSolverTask const & task = LinearEquationSolverTask : : Unspecified ) const ;
std : : unique_ptr < LinearEquationSolver < ValueType > > create ( Environment const & env , storm : : storage : : SparseMatrix < ValueType > const & matrix ) const ;
/*!
* Creates a new linear equation solver instance with the given matrix . The caller gives up posession of the
@ -204,12 +123,12 @@ namespace storm {
* @ param matrix The matrix that defines the equation system .
* @ return A pointer to the newly created solver .
*/
std : : unique_ptr < LinearEquationSolver < ValueType > > create ( Environment const & env , storm : : storage : : SparseMatrix < ValueType > & & matrix , LinearEquationSolverTask const & task = LinearEquationSolverTask : : Unspecified ) const ;
std : : unique_ptr < LinearEquationSolver < ValueType > > create ( Environment const & env , storm : : storage : : SparseMatrix < ValueType > & & matrix ) const ;
/*!
* Creates an equation solver with the current settings , but without a matrix .
*/
virtual std : : unique_ptr < LinearEquationSolver < ValueType > > create ( Environment const & env , LinearEquationSolverTask const & task = LinearEquationSolverTask : : Unspecified ) const = 0 ;
virtual std : : unique_ptr < LinearEquationSolver < ValueType > > create ( Environment const & env ) const = 0 ;
/*!
* Creates a copy of this factory .
@ -225,7 +144,7 @@ namespace storm {
* Retrieves the requirements of the solver if it was created with the current settings . Note that these
* requirements only apply to solving linear equations and not to the matrix vector multiplications .
*/
LinearEquationSolverRequirements getRequirements ( Environment const & env , LinearEquationSolverTask const & task = LinearEquationSolverTask : : Unspecified ) const ;
LinearEquationSolverRequirements getRequirements ( Environment const & env ) const ;
} ;
template < typename ValueType >
@ -235,7 +154,7 @@ namespace storm {
using LinearEquationSolverFactory < ValueType > : : create ;
virtual std : : unique_ptr < LinearEquationSolver < ValueType > > create ( Environment const & env , LinearEquationSolverTask const & task = LinearEquationSolverTask : : Unspecified ) const override ;
virtual std : : unique_ptr < LinearEquationSolver < ValueType > > create ( Environment const & env ) const override ;
virtual std : : unique_ptr < LinearEquationSolverFactory < ValueType > > clone ( ) const override ;
} ;