10template<
typename ValueType>
15template<
typename ValueType>
20template<
typename ValueType>
25template<
typename ValueType>
32template<
typename ValueType>
34 localA = std::make_unique<storm::storage::SparseMatrix<ValueType>>(std::move(A));
35 this->A = localA.get();
39template<
typename ValueType>
40uint64_t AcyclicLinearEquationSolver<ValueType>::getMatrixRowCount()
const {
41 return this->A->getRowCount();
44template<
typename ValueType>
45uint64_t AcyclicLinearEquationSolver<ValueType>::getMatrixColumnCount()
const {
46 return this->A->getColumnCount();
49template<
typename ValueType>
51 STORM_LOG_ASSERT(x.size() == this->A->getRowGroupCount(),
"Provided x-vector has invalid size.");
52 STORM_LOG_ASSERT(b.size() == this->A->getRowCount(),
"Provided b-vector has invalid size.");
65 auxiliaryRowVector = std::vector<ValueType>(this->A->getRowCount());
66 auxiliaryRowVector2 = std::vector<ValueType>(this->A->getRowCount());
69 std::vector<ValueType>* xPtr = &x;
70 std::vector<ValueType>
const* bPtr = &b;
72 STORM_LOG_ASSERT(rowOrdering->size() == b.size(),
"b-vector has unexpected size.");
73 auxiliaryRowVector->resize(b.size());
75 for (
auto const& bFactor : bFactors) {
76 (*auxiliaryRowVector)[bFactor.first] *= bFactor.second;
78 bPtr = &auxiliaryRowVector.get();
79 xPtr = &auxiliaryRowVector2.get();
82 this->multiplier->multiplyGaussSeidel(env, *xPtr, bPtr,
true);
85 for (uint64_t newRow = 0; newRow < x.size(); ++newRow) {
86 x[(*rowOrdering)[newRow]] = (*xPtr)[newRow];
96template<
typename ValueType>
101template<
typename ValueType>
109template<
typename ValueType>
112 orderedMatrix = boost::none;
113 rowOrdering = boost::none;
114 auxiliaryRowVector = boost::none;
115 auxiliaryRowVector2 = boost::none;
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 void clearCache() const override
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.
AcyclicLinearEquationSolver()
bool isCachingEnabled() const
Retrieves whether some of the generated data during solver calls should be cached.
LinearEquationSolverRequirements & requireAcyclic(bool critical=true)
std::unique_ptr< Multiplier< ValueType, SolutionType > > create(Environment const &env, storm::storage::SparseMatrix< ValueType > const &matrix)
A class that holds a possibly non-square matrix in the compressed row storage format.
#define STORM_LOG_ASSERT(cond, message)
storm::storage::SparseMatrix< ValueType > createReorderedMatrix(storm::storage::SparseMatrix< ValueType > const &matrix, std::vector< uint64_t > const &newToOrigIndexMap, std::vector< std::pair< uint64_t, ValueType > > &bFactors)
reorders the row group such that the i'th row of the new matrix corresponds to the order[i]'th row of...
boost::optional< std::vector< uint64_t > > computeTopologicalGroupOrdering(storm::storage::SparseMatrix< ValueType > const &matrix)
Returns a reordering of the matrix row(groups) and columns such that we can solve the (minmax or line...
LinearEquationSolverProblemFormat
void selectVectorValues(std::vector< T > &vector, storm::storage::BitVector const &positions, std::vector< T > const &values)
Selects the elements from a vector at the specified positions and writes them consecutively into anot...