Browse Source

Fixed some compilation errors.

Former-commit-id: dc626450b8
tempestpy_adaptions
dehnert 10 years ago
parent
commit
c3c83fbe4f
  1. 2
      src/builder/ExplicitPrismModelBuilder.h
  2. 2
      src/modelchecker/AbstractModelChecker.cpp
  3. 2
      src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.cpp
  4. 2
      src/modelchecker/prctl/SparseMdpPrctlModelChecker.cpp
  5. 2
      src/modelchecker/reachability/SparseDtmcEliminationModelChecker.h
  6. 2
      src/models/AbstractModel.h
  7. 11
      src/models/Dtmc.h
  8. 3
      src/models/MarkovAutomaton.h
  9. 2
      src/models/Mdp.h
  10. 10
      src/parser/DeterministicSparseTransitionParser.cpp
  11. 2
      src/solver/GmmxxLinearEquationSolver.cpp
  12. 2
      src/solver/NativeLinearEquationSolver.cpp
  13. 3
      src/storage/DeterministicModelBisimulationDecomposition.cpp
  14. 2
      src/storage/DeterministicModelBisimulationDecomposition.h
  15. 2
      src/storage/SparseMatrix.h
  16. 124
      src/utility/ConstantsComparator.h
  17. 2
      src/utility/constants.cpp
  18. 276
      src/utility/constants.h
  19. 10
      src/utility/graph.h
  20. 2
      src/utility/vector.h
  21. 6
      test/performance/storage/SparseMatrixTest.cpp

2
src/builder/ExplicitPrismModelBuilder.h

@ -20,7 +20,7 @@
#include "src/storage/SparseMatrix.h"
#include "src/settings/SettingsManager.h"
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/utility/PrismUtility.h"
namespace storm {

2
src/modelchecker/AbstractModelChecker.cpp

@ -1,6 +1,6 @@
#include "src/modelchecker/AbstractModelChecker.h"
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/utility/macros.h"
#include "src/exceptions/NotImplementedException.h"
#include "src/exceptions/InvalidOperationException.h"

2
src/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.cpp

@ -3,7 +3,7 @@
#include <utility>
#include <vector>
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/utility/macros.h"
#include "src/utility/vector.h"
#include "src/utility/graph.h"

2
src/modelchecker/prctl/SparseMdpPrctlModelChecker.cpp

@ -2,7 +2,7 @@
#include <vector>
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/utility/macros.h"
#include "src/utility/vector.h"
#include "src/utility/graph.h"

2
src/modelchecker/reachability/SparseDtmcEliminationModelChecker.h

@ -4,7 +4,7 @@
#include "src/storage/sparse/StateType.h"
#include "src/models/Dtmc.h"
#include "src/modelchecker/AbstractModelChecker.h"
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
namespace storm {
namespace modelchecker {

2
src/models/AbstractModel.h

@ -11,7 +11,7 @@
#include "src/storage/SparseMatrix.h"
#include "src/storage/Scheduler.h"
#include "src/storage/StronglyConnectedComponentDecomposition.h"
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/utility/macros.h"
#include "src/utility/Hash.h"
#include "src/utility/vector.h"

11
src/models/Dtmc.h

@ -18,9 +18,10 @@
#include "src/storage/SparseMatrix.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/settings/SettingsManager.h"
#include "src/utility/constants.h"
#include "src/utility/vector.h"
#include "src/utility/matrix.h"
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
namespace storm {
@ -202,7 +203,7 @@ public:
// Now fill the matrix.
newRow = 0;
T rest = utility::constantZero<T>();
T rest = storm::utility::zero<T>();
for(uint_fast64_t row = 0; row < origMat.getRowCount(); ++row) {
if(subSysStates.get(row)){
// Transfer transitions
@ -216,14 +217,14 @@ public:
// Insert the transition taking care of the remaining outgoing probability.
newMatBuilder.addNextValue(newRow, newStateCount - 1, rest);
rest = storm::utility::constantZero<T>();
rest = storm::utility::zero<T>();
newRow++;
}
}
// Insert last transition: self loop on s_b
newMatBuilder.addNextValue(newStateCount - 1, newStateCount - 1, storm::utility::constantOne<T>());
newMatBuilder.addNextValue(newStateCount - 1, newStateCount - 1, storm::utility::one<T>());
// 3. Take care of the labeling.
storm::models::AtomicPropositionsLabeling newLabeling = storm::models::AtomicPropositionsLabeling(this->getStateLabeling(), subSysStates);
@ -266,7 +267,7 @@ public:
}
// Insert the reward (e.g. 0) for the transition taking care of the remaining outgoing probability.
newTransRewardsBuilder.addNextValue(newRow, newStateCount - 1, storm::utility::constantZero<T>());
newTransRewardsBuilder.addNextValue(newRow, newStateCount - 1, storm::utility::zero<T>());
newRow++;
}

3
src/models/MarkovAutomaton.h

@ -13,6 +13,7 @@
#include "src/storage/SparseMatrix.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/settings/SettingsManager.h"
#include "src/utility/constants.h"
#include "src/utility/vector.h"
#include "src/utility/matrix.h"
@ -100,7 +101,7 @@ namespace storm {
}
T getMaximalExitRate() const {
T result = storm::utility::constantZero<T>();
T result = storm::utility::zero<T>();
for (auto markovianState : this->markovianStates) {
result = std::max(result, this->exitRates[markovianState]);
}

2
src/models/Mdp.h

@ -18,7 +18,7 @@
#include "src/storage/SparseMatrix.h"
#include "src/settings/SettingsManager.h"
#include "src/models/AbstractNondeterministicModel.h"
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/utility/matrix.h"
namespace storm {

10
src/parser/DeterministicSparseTransitionParser.cpp

@ -123,7 +123,7 @@ namespace storm {
for (uint_fast64_t skippedRow = 0; skippedRow < row; ++skippedRow) {
hadDeadlocks = true;
if (!dontFixDeadlocks) {
resultMatrix.addNextValue(skippedRow, skippedRow, storm::utility::constantOne<double>());
resultMatrix.addNextValue(skippedRow, skippedRow, storm::utility::one<double>());
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions. A self-loop was inserted.");
} else {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions.");
@ -144,7 +144,7 @@ namespace storm {
if (lastRow != row) {
if (!rowHadDiagonalEntry) {
if (insertDiagonalEntriesIfMissing) {
resultMatrix.addNextValue(lastRow, lastRow, storm::utility::constantZero<double>());
resultMatrix.addNextValue(lastRow, lastRow, storm::utility::zero<double>());
LOG4CPLUS_DEBUG(logger, "While parsing " << filename << ": state " << lastRow << " has no transition to itself. Inserted a 0-transition. (1)");
} else {
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << lastRow << " has no transition to itself.");
@ -155,7 +155,7 @@ namespace storm {
for (uint_fast64_t skippedRow = lastRow + 1; skippedRow < row; ++skippedRow) {
hadDeadlocks = true;
if (!dontFixDeadlocks) {
resultMatrix.addNextValue(skippedRow, skippedRow, storm::utility::constantOne<double>());
resultMatrix.addNextValue(skippedRow, skippedRow, storm::utility::one<double>());
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions. A self-loop was inserted.");
} else {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": state " << skippedRow << " has no outgoing transitions.");
@ -172,7 +172,7 @@ namespace storm {
if (col > row && !rowHadDiagonalEntry) {
if (insertDiagonalEntriesIfMissing) {
resultMatrix.addNextValue(row, row, storm::utility::constantZero<double>());
resultMatrix.addNextValue(row, row, storm::utility::zero<double>());
LOG4CPLUS_DEBUG(logger, "While parsing " << filename << ": state " << row << " has no transition to itself. Inserted a 0-transition. (2)");
} else {
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << row << " has no transition to itself.");
@ -186,7 +186,7 @@ namespace storm {
if (!rowHadDiagonalEntry) {
if (insertDiagonalEntriesIfMissing) {
resultMatrix.addNextValue(lastRow, lastRow, storm::utility::constantZero<double>());
resultMatrix.addNextValue(lastRow, lastRow, storm::utility::zero<double>());
LOG4CPLUS_DEBUG(logger, "While parsing " << filename << ": state " << lastRow << " has no transition to itself. Inserted a 0-transition. (3)");
} else {
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": state " << lastRow << " has no transition to itself.");

2
src/solver/GmmxxLinearEquationSolver.cpp

@ -186,7 +186,7 @@ namespace storm {
while (!converged && iterationCount < maximalNumberOfIterations) {
// Compute D^-1 * (b - LU * x) and store result in nextX.
gmm::mult(*gmmLU, *currentX, tmpX);
gmm::add(b, gmm::scaled(tmpX, -storm::utility::constantOne<ValueType>()), tmpX);
gmm::add(b, gmm::scaled(tmpX, -storm::utility::one<ValueType>()), tmpX);
gmm::mult(*gmmDinv, tmpX, *nextX);
// Now check if the process already converged within our precision.

2
src/solver/NativeLinearEquationSolver.cpp

@ -61,7 +61,7 @@ namespace storm {
while (!converged && iterationCount < maximalNumberOfIterations) {
// Compute D^-1 * (b - LU * x) and store result in nextX.
jacobiDecomposition.first.multiplyWithVector(*currentX, tmpX);
storm::utility::vector::scaleVectorInPlace(tmpX, -storm::utility::constantOne<ValueType>());
storm::utility::vector::scaleVectorInPlace(tmpX, -storm::utility::one<ValueType>());
storm::utility::vector::addVectorsInPlace(tmpX, b);
jacobiDecomposition.second.multiplyWithVector(tmpX, *nextX);

3
src/storage/DeterministicModelBisimulationDecomposition.cpp

@ -11,6 +11,7 @@
#include "src/modelchecker/results/ExplicitQualitativeCheckResult.h"
#include "src/utility/graph.h"
#include "src/utility/constants.h"
#include "src/exceptions/IllegalFunctionCallException.h"
#include "src/exceptions/InvalidOptionException.h"
@ -770,7 +771,7 @@ namespace storm {
// If the block is absorbing, we simply add a self-loop.
if (oldBlock.isAbsorbing()) {
builder.addNextValue(blockIndex, blockIndex, storm::utility::constantOne<ValueType>());
builder.addNextValue(blockIndex, blockIndex, storm::utility::one<ValueType>());
// If the block has a special representative state, we retrieve it now.
if (oldBlock.hasRepresentativeState()) {

2
src/storage/DeterministicModelBisimulationDecomposition.h

@ -10,7 +10,7 @@
#include "src/models/Dtmc.h"
#include "src/models/Ctmc.h"
#include "src/storage/Distribution.h"
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/utility/OsDetection.h"
namespace storm {

2
src/storage/SparseMatrix.h

@ -7,7 +7,7 @@
#include <iterator>
#include "src/storage/BitVector.h"
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/utility/OsDetection.h"
#include "src/exceptions/InvalidArgumentException.h"

124
src/utility/ConstantsComparator.h

@ -1,124 +0,0 @@
#ifndef STORM_UTILITY_CONSTANTSCOMPARATOR_H_
#define STORM_UTILITY_CONSTANTSCOMPARATOR_H_
#ifdef max
# undef max
#endif
#ifdef min
# undef min
#endif
#include <limits>
#include <cstdint>
#include "src/settings/SettingsManager.h"
#include "src/adapters/CarlAdapter.h"
namespace storm {
// Forward-declare MatrixEntry class.
namespace storage {
template<typename IndexType, typename ValueType> class MatrixEntry;
}
namespace utility {
template<typename ValueType>
ValueType one();
template<typename ValueType>
ValueType zero();
template<typename ValueType>
ValueType infinity();
#ifdef STORM_HAVE_CARL
template<>
storm::RationalFunction infinity();
#endif
template<typename ValueType>
ValueType pow(ValueType const& value, uint_fast64_t exponent);
#ifdef STORM_HAVE_CARL
template<>
RationalFunction pow(RationalFunction const& value, uint_fast64_t exponent);
#endif
template<typename ValueType>
ValueType simplify(ValueType value);
// A class that can be used for comparing constants.
template<typename ValueType>
class ConstantsComparator {
public:
bool isOne(ValueType const& value) const;
bool isZero(ValueType const& value) const;
bool isEqual(ValueType const& value1, ValueType const& value2) const;
};
// For doubles we specialize this class and consider the comparison modulo some predefined precision.
template<>
class ConstantsComparator<double> {
public:
ConstantsComparator();
ConstantsComparator(double precision);
bool isOne(double const& value) const;
bool isZero(double const& value) const;
bool isEqual(double const& value1, double const& value2) const;
bool isConstant(double const& value) const;
private:
// The precision used for comparisons.
double precision;
};
#ifdef STORM_HAVE_CARL
template<>
RationalFunction& simplify(RationalFunction& value);
template<>
RationalFunction&& simplify(RationalFunction&& value);
template<>
class ConstantsComparator<storm::RationalFunction> {
public:
bool isOne(storm::RationalFunction const& value) const;
bool isZero(storm::RationalFunction const& value) const;
bool isEqual(storm::RationalFunction const& value1, storm::RationalFunction const& value2) const;
bool isConstant(storm::RationalFunction const& value) const;
};
template<>
class ConstantsComparator<storm::Polynomial> {
public:
bool isOne(storm::Polynomial const& value) const;
bool isZero(storm::Polynomial const& value) const;
bool isEqual(storm::Polynomial const& value1, storm::Polynomial const& value2) const;
bool isConstant(storm::Polynomial const& value) const;
};
#endif
template<typename IndexType, typename ValueType>
storm::storage::MatrixEntry<IndexType, ValueType>& simplify(storm::storage::MatrixEntry<IndexType, ValueType>& matrixEntry);
template<typename IndexType, typename ValueType>
storm::storage::MatrixEntry<IndexType, ValueType>&& simplify(storm::storage::MatrixEntry<IndexType, ValueType>&& matrixEntry);
}
}
#endif /* STORM_UTILITY_CONSTANTSCOMPARATOR_H_ */

2
src/utility/ConstantsComparator.cpp → src/utility/constants.cpp

@ -1,4 +1,4 @@
#include "src/utility/ConstantsComparator.h"
#include "src/utility/constants.h"
#include "src/storage/SparseMatrix.h"
#include "src/storage/sparse/StateType.h"

276
src/utility/constants.h

@ -1,12 +1,5 @@
/*
* constants.h
*
* Created on: 11.10.2012
* Author: Thomas Heinemann
*/
#ifndef STORM_UTILITY_CONSTTEMPLATES_H_
#define STORM_UTILITY_CONSTTEMPLATES_H_
#ifndef STORM_UTILITY_CONSTANTSCOMPARATOR_H_
#define STORM_UTILITY_CONSTANTSCOMPARATOR_H_
#ifdef max
# undef max
@ -17,172 +10,115 @@
#endif
#include <limits>
#include "src/exceptions/InvalidArgumentException.h"
#include <cstdint>
#include "src/settings/SettingsManager.h"
#include "src/adapters/CarlAdapter.h"
namespace storm {
namespace utility {
/*!
* Returns a constant value of 0 that is fit to the type it is being written to.
* As (at least) gcc has problems to use the correct template by the return value
* only, the function gets a pointer as a parameter to infer the return type.
*
* @note
* The template parameter is just inferred by the return type; GCC is not able to infer this
* automatically, hence the type should always be stated explicitly (e.g. @c constantZero<int>();)
*
* @return Value 0, fit to the return type
*/
template<typename _Scalar>
static inline _Scalar constantZero() {
return _Scalar(0);
}
/*! @cond TEMPLATE_SPECIALIZATION
* (By default, the template specifications are not included in the documentation)
*/
/*!
* Template specialization for int_fast32_t
* @return Value 0, fit to the type int_fast32_t
*/
template <>
inline int_fast32_t constantZero() {
return 0;
}
/*!
* Template specialization for uint_fast64_t
* @return Value 0, fit to the type uint_fast64_t
*/
template <>
inline uint_fast64_t constantZero() {
return 0;
}
/*!
* Template specialization for double
* @return Value 0.0, fit to the type double
*/
template <>
inline double constantZero() {
return 0.0;
}
/*! @endcond */
/*!
* Returns a constant value of 1 that is fit to the type it is being written to.
* As (at least) gcc has problems to use the correct template by the return value
* only, the function gets a pointer as a parameter to infer the return type.
*
* @note
* The template parameter is just inferred by the return type; GCC is not able to infer this
* automatically, hence the type should always be stated explicitly (e.g. @c constantOne<int>();)
*
* @return Value 1, fit to the return type
*/
template<typename _Scalar>
static inline _Scalar constantOne() {
return _Scalar(1);
}
/*! @cond TEMPLATE_SPECIALIZATION
* (By default, the template specializations are not included in the documentation)
*/
/*!
* Template specialization for int_fast32_t
* @return Value 1, fit to the type int_fast32_t
*/
template<>
inline int_fast32_t constantOne() {
return 1;
}
/*!
* Template specialization for uint_fast64_t
* @return Value 1, fit to the type uint_fast61_t
*/
template<>
inline uint_fast64_t constantOne() {
return 1;
}
/*!
* Template specialization for double
* @return Value 1.0, fit to the type double
*/
template<>
inline double constantOne() {
return 1.0;
}
/*! @endcond */
/*!
* Returns a constant value of infinity that is fit to the type it is being written to.
* As (at least) gcc has problems to use the correct template by the return value
* only, the function gets a pointer as a parameter to infer the return type.
*
* @note
* The template parameter is just inferred by the return type; GCC is not able to infer this
* automatically, hence the type should always be stated explicitly (e.g. @c constantOne<int>();)
*
* @return Value Infinity, fit to the return type
*/
template<typename _Scalar>
static inline _Scalar constantInfinity() {
return std::numeric_limits<_Scalar>::infinity();
}
/*! @cond TEMPLATE_SPECIALIZATION
* (By default, the template specializations are not included in the documentation)
*/
/*!
* Template specialization for int_fast32_t
* @return Value Infinity, fit to the type uint_fast32_t
*/
template<>
inline int_fast32_t constantInfinity() {
throw storm::exceptions::InvalidArgumentException() << "Integer has no infinity.";
return std::numeric_limits<int_fast32_t>::max();
}
/*!
* Template specialization for uint_fast64_t
* @return Value Infinity, fit to the type uint_fast64_t
*/
template<>
inline uint_fast64_t constantInfinity() {
throw storm::exceptions::InvalidArgumentException() << "Integer has no infinity.";
return std::numeric_limits<uint_fast64_t>::max();
}
/*!
* Template specialization for double
* @return Value Infinity, fit to the type double
*/
template<>
inline double constantInfinity() {
return std::numeric_limits<double>::infinity();
}
/*! @endcond */
// Forward-declare MatrixEntry class.
namespace storage {
template<typename IndexType, typename ValueType> class MatrixEntry;
}
namespace utility {
template<typename ValueType>
ValueType one();
template<typename ValueType>
ValueType zero();
template<typename ValueType>
ValueType infinity();
#ifdef STORM_HAVE_CARL
template<>
storm::RationalFunction infinity();
#endif
template<typename ValueType>
ValueType pow(ValueType const& value, uint_fast64_t exponent);
#ifdef STORM_HAVE_CARL
template<>
RationalFunction pow(RationalFunction const& value, uint_fast64_t exponent);
#endif
template<typename ValueType>
ValueType simplify(ValueType value);
// A class that can be used for comparing constants.
template<typename ValueType>
class ConstantsComparator {
public:
bool isOne(ValueType const& value) const;
bool isZero(ValueType const& value) const;
bool isEqual(ValueType const& value1, ValueType const& value2) const;
};
// For doubles we specialize this class and consider the comparison modulo some predefined precision.
template<>
class ConstantsComparator<double> {
public:
ConstantsComparator();
ConstantsComparator(double precision);
bool isOne(double const& value) const;
bool isZero(double const& value) const;
bool isEqual(double const& value1, double const& value2) const;
bool isConstant(double const& value) const;
private:
// The precision used for comparisons.
double precision;
};
#ifdef STORM_HAVE_CARL
template<>
RationalFunction& simplify(RationalFunction& value);
template<>
RationalFunction&& simplify(RationalFunction&& value);
template<>
class ConstantsComparator<storm::RationalFunction> {
public:
bool isOne(storm::RationalFunction const& value) const;
bool isZero(storm::RationalFunction const& value) const;
bool isEqual(storm::RationalFunction const& value1, storm::RationalFunction const& value2) const;
bool isConstant(storm::RationalFunction const& value) const;
};
template<>
class ConstantsComparator<storm::Polynomial> {
public:
bool isOne(storm::Polynomial const& value) const;
bool isZero(storm::Polynomial const& value) const;
bool isEqual(storm::Polynomial const& value1, storm::Polynomial const& value2) const;
bool isConstant(storm::Polynomial const& value) const;
};
#endif
template<typename IndexType, typename ValueType>
storm::storage::MatrixEntry<IndexType, ValueType>& simplify(storm::storage::MatrixEntry<IndexType, ValueType>& matrixEntry);
template<typename T>
inline bool isConstant(T const& v)
{
return true;
template<typename IndexType, typename ValueType>
storm::storage::MatrixEntry<IndexType, ValueType>&& simplify(storm::storage::MatrixEntry<IndexType, ValueType>&& matrixEntry);
}
}
} //namespace utility
} //namespace storm
#endif /* STORM_UTILITY_CONSTTEMPLATES_H_ */
#endif /* STORM_UTILITY_CONSTANTSCOMPARATOR_H_ */

10
src/utility/graph.h

@ -54,7 +54,7 @@ namespace storm {
for (auto const& successor : transitionMatrix.getRow(currentState)) {
// Only explore the state if the transition was actually there and the successor has not yet
// been visited.
if (successor.getValue() != storm::utility::constantZero<T>() && !reachableStates.get(successor.getColumn())) {
if (successor.getValue() != storm::utility::zero<T>() && !reachableStates.get(successor.getColumn())) {
// If the successor is one of the target states, we need to include it, but must not explore
// it further.
if (targetStates.get(successor.getColumn())) {
@ -757,16 +757,16 @@ namespace storm {
LOG4CPLUS_INFO(logger, "Performing Dijkstra search.");
const uint_fast64_t noPredecessorValue = storm::utility::constantZero<uint_fast64_t>();
std::vector<T> probabilities(model.getNumberOfStates(), storm::utility::constantZero<T>());
const uint_fast64_t noPredecessorValue = storm::utility::zero<uint_fast64_t>();
std::vector<T> probabilities(model.getNumberOfStates(), storm::utility::zero<T>());
std::vector<uint_fast64_t> predecessors(model.getNumberOfStates(), noPredecessorValue);
// Set the probability to 1 for all starting states.
std::set<std::pair<T, uint_fast64_t>, DistanceCompare<T>> probabilityStateSet;
for (auto state : startingStates) {
probabilityStateSet.emplace(storm::utility::constantOne<T>(), state);
probabilities[state] = storm::utility::constantOne<T>();
probabilityStateSet.emplace(storm::utility::one<T>(), state);
probabilities[state] = storm::utility::one<T>();
}
// As long as there is one reachable state, we need to consider it.

2
src/utility/vector.h

@ -125,7 +125,7 @@ namespace storm {
template<class T>
void subtractFromConstantOneVector(std::vector<T>& vector) {
for (auto& element : vector) {
element = storm::utility::constantOne<T>() - element;
element = storm::utility::one<T>() - element;
}
}

6
test/performance/storage/SparseMatrixTest.cpp

@ -25,8 +25,8 @@ TEST(SparseMatrix, Iteration) {
TEST(SparseMatrix, SparseMultiplication) {
storm::storage::SparseMatrixBuilder<double> matrixBuilder;
for (uint_fast64_t row = 0; row < 100000; ++row) {
ASSERT_NO_THROW(matrixBuilder.addNextValue(row, 0, storm::utility::constantOne<double>()));
ASSERT_NO_THROW(matrixBuilder.addNextValue(row, 1, storm::utility::constantOne<double>()));
ASSERT_NO_THROW(matrixBuilder.addNextValue(row, 0, storm::utility::one<double>()));
ASSERT_NO_THROW(matrixBuilder.addNextValue(row, 1, storm::utility::one<double>()));
}
storm::storage::SparseMatrix<double> matrix;
@ -74,7 +74,7 @@ TEST(SparseMatrix, DenseMultiplication) {
uint_fast64_t const size = 2000;
for (uint_fast64_t row = 0; row < size; ++row) {
for (uint_fast64_t column = 0; column < size; ++column) {
ASSERT_NO_THROW(matrixBuilder.addNextValue(row, column, storm::utility::constantOne<double>()));
ASSERT_NO_THROW(matrixBuilder.addNextValue(row, column, storm::utility::one<double>()));
}
}

Loading…
Cancel
Save