Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
AcyclicLinearEquationSolver.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4
5#include <memory>
8
9namespace storm {
10
11class Environment;
12
13namespace solver {
14
19template<typename ValueType>
21 public:
25
26 virtual void setMatrix(storm::storage::SparseMatrix<ValueType> const& A) override;
27 virtual void setMatrix(storm::storage::SparseMatrix<ValueType>&& A) override;
28
30
31 virtual void clearCache() const override;
32
34 virtual LinearEquationSolverRequirements getRequirements(Environment const& env) const override;
35
36 protected:
37 virtual bool internalSolveEquations(storm::Environment const& env, std::vector<ValueType>& x, std::vector<ValueType> const& b) const override;
38
39 private:
40 virtual uint64_t getMatrixRowCount() const override;
41 virtual uint64_t getMatrixColumnCount() const override;
42
43 // If the solver takes posession of the matrix, we store the moved matrix in this member, so it gets deleted
44 // when the solver is destructed.
45 std::unique_ptr<storm::storage::SparseMatrix<ValueType>> localA;
46 // A pointer to the original sparse matrix given to this solver. If the solver takes posession of the matrix
47 // the pointer refers to orderedMatrix.
49
50 // cached multiplier either with original matrix or ordered matrix
51 mutable std::unique_ptr<storm::solver::Multiplier<ValueType>> multiplier;
52 // cached matrix for the multiplier (only if different from original matrix)
53 mutable boost::optional<storm::storage::SparseMatrix<ValueType>> orderedMatrix;
54 // cached row group ordering (only if not identity)
55 mutable boost::optional<std::vector<uint64_t>> rowOrdering; // A.rowGroupCount() entries
56 // can be used if the entries in 'b' need to be reordered
57 mutable boost::optional<std::vector<ValueType>> auxiliaryRowVector; // A.rowCount() entries
58 // can be used if the entries in 'x' need to be reordered
59 mutable boost::optional<std::vector<ValueType>> auxiliaryRowVector2; // A.rowCount() entries
60 // contains factors applied to scale the entries of the 'b' vector
61 mutable std::vector<std::pair<uint64_t, std::optional<ValueType>>> bFactors;
62};
63} // namespace solver
64} // namespace storm
virtual LinearEquationSolverProblemFormat getEquationProblemFormat(storm::Environment const &env) const override
Retrieves the format in which this solver expects to solve equations.
virtual bool internalSolveEquations(storm::Environment const &env, std::vector< ValueType > &x, std::vector< ValueType > const &b) const override
virtual void setMatrix(storm::storage::SparseMatrix< ValueType > const &A) override
virtual LinearEquationSolverRequirements getRequirements(Environment const &env) const override
Retrieves the requirements of the solver under the current settings.
A class that holds a possibly non-square matrix in the compressed row storage format.