Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
AcyclicLinearEquationSolver.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
6
7namespace storm {
8
9class Environment;
10
11namespace solver {
12
17template<typename ValueType>
19 public:
23
24 virtual void setMatrix(storm::storage::SparseMatrix<ValueType> const& A) override;
25 virtual void setMatrix(storm::storage::SparseMatrix<ValueType>&& A) override;
26
28
29 virtual void clearCache() const override;
30
32 virtual LinearEquationSolverRequirements getRequirements(Environment const& env) const override;
33
34 protected:
35 virtual bool internalSolveEquations(storm::Environment const& env, std::vector<ValueType>& x, std::vector<ValueType> const& b) const override;
36
37 private:
38 virtual uint64_t getMatrixRowCount() const override;
39 virtual uint64_t getMatrixColumnCount() const override;
40
41 // If the solver takes posession of the matrix, we store the moved matrix in this member, so it gets deleted
42 // when the solver is destructed.
43 std::unique_ptr<storm::storage::SparseMatrix<ValueType>> localA;
44 // A pointer to the original sparse matrix given to this solver. If the solver takes posession of the matrix
45 // the pointer refers to orderedMatrix.
47
48 // cached multiplier either with original matrix or ordered matrix
49 mutable std::unique_ptr<storm::solver::Multiplier<ValueType>> multiplier;
50 // cached matrix for the multiplier (only if different from original matrix)
51 mutable boost::optional<storm::storage::SparseMatrix<ValueType>> orderedMatrix;
52 // cached row group ordering (only if not identity)
53 mutable boost::optional<std::vector<uint64_t>> rowOrdering; // A.rowGroupCount() entries
54 // can be used if the entries in 'b' need to be reordered
55 mutable boost::optional<std::vector<ValueType>> auxiliaryRowVector; // A.rowCount() entries
56 // can be used if the entries in 'x' need to be reordered
57 mutable boost::optional<std::vector<ValueType>> auxiliaryRowVector2; // A.rowCount() entries
58 // contains factors applied to scale the entries of the 'b' vector
59 mutable std::vector<std::pair<uint64_t, ValueType>> bFactors;
60};
61} // namespace solver
62} // namespace storm
This solver can be used on equation systems that are known to be acyclic.
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.
An interface that represents an abstract linear equation solver.
A class that holds a possibly non-square matrix in the compressed row storage format.
LabParser.cpp.
Definition cli.cpp:18