13template<
typename ValueType>
18template<
typename ValueType>
20 std::vector<ValueType>& result)
const {
21 std::vector<ValueType>* target = &result;
23 target = &this->provideCachedVector(x.size());
25 multAdd(x, b, *target);
27 std::swap(result, *target);
31template<
typename ValueType>
33 bool backwards)
const {
35 this->matrix.multiplyWithVectorBackward(x, x, b);
37 this->matrix.multiplyWithVectorForward(x, x, b);
41template<
typename ValueType>
43 std::vector<ValueType>
const& x, std::vector<ValueType>
const* b, std::vector<ValueType>& result,
44 std::vector<uint_fast64_t>* choices)
const {
45 std::vector<ValueType>* target = &result;
47 target = &this->provideCachedVector(x.size());
49 multAddReduce(dir, rowGroupIndices, x, b, *target, choices);
51 std::swap(result, *target);
55template<
typename ValueType>
57 std::vector<uint64_t>
const& rowGroupIndices, std::vector<ValueType>& x,
58 std::vector<ValueType>
const* b, std::vector<uint_fast64_t>* choices,
bool backwards)
const {
60 this->matrix.multiplyAndReduceBackward(dir, rowGroupIndices, x, b, x, choices);
62 this->matrix.multiplyAndReduceForward(dir, rowGroupIndices, x, b, x, choices);
66template<
typename ValueType>
68 for (
auto const& entry : this->matrix.getRow(rowIndex)) {
69 value += entry.getValue() * x[entry.getColumn()];
73template<
typename ValueType>
75 ValueType& val2)
const {
76 for (
auto const& entry : this->matrix.getRow(rowIndex)) {
77 val1 += entry.getValue() * x1[entry.getColumn()];
78 val2 += entry.getValue() * x2[entry.getColumn()];
82template<
typename ValueType>
84 this->matrix.multiplyWithVector(x, result, b);
87template<
typename ValueType>
89 std::vector<ValueType>
const& x, std::vector<ValueType>
const* b, std::vector<ValueType>& result,
90 std::vector<uint64_t>* choices)
const {
94template class NativeMultiplier<double>;
95template class NativeMultiplier<storm::RationalNumber>;
96template class NativeMultiplier<storm::RationalFunction>;
97template class NativeMultiplier<storm::Interval>;
virtual void multiplyAndReduceGaussSeidel(Environment const &env, 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, bool backwards=true) const override
void multiplyRow(uint64_t const &rowIndex, std::vector< ValueType > const &x, ValueType &value) const
Multiplies the row with the given index with x and adds the result to the provided value.
NativeMultiplier(storm::storage::SparseMatrix< ValueType > const &matrix)
void multiplyRow2(uint64_t const &rowIndex, std::vector< ValueType > const &x1, ValueType &val1, std::vector< ValueType > const &x2, ValueType &val2) const
Multiplies the row with the given index with x1 and x2 and adds the given offset o1 and o2,...
virtual void multiplyAndReduce(Environment const &env, OptimizationDirection const &dir, std::vector< uint64_t > const &rowGroupIndices, std::vector< ValueType > const &x, std::vector< ValueType > const *b, std::vector< ValueType > &result, std::vector< uint_fast64_t > *choices=nullptr) const override
virtual void multiplyGaussSeidel(Environment const &env, std::vector< ValueType > &x, std::vector< ValueType > const *b, bool backwards=true) const override
Performs a matrix-vector multiplication in gauss-seidel style.
virtual void multiply(Environment const &env, std::vector< ValueType > const &x, std::vector< ValueType > const *b, std::vector< ValueType > &result) const override
Performs a matrix-vector multiplication x' = A*x + b.
A class that holds a possibly non-square matrix in the compressed row storage format.