You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
6.6 KiB

  1. #ifndef STORM_CUDAFORSTORM_BASICVALUEITERATION_H_
  2. #define STORM_CUDAFORSTORM_BASICVALUEITERATION_H_
  3. #include <cstdint>
  4. #include <vector>
  5. #include <utility>
  6. // Library exports
  7. #include "cudaForStorm.h"
  8. /* Helper declaration to cope with new internal format */
  9. #ifndef STORM_STORAGE_SPARSEMATRIX_H_
  10. namespace storm {
  11. namespace storage {
  12. template<typename IndexType, typename ValueType>
  13. class MatrixEntry {
  14. public:
  15. typedef IndexType index_type;
  16. typedef ValueType value_type;
  17. /*!
  18. * Constructs a matrix entry with the given column and value.
  19. *
  20. * @param column The column of the matrix entry.
  21. * @param value The value of the matrix entry.
  22. */
  23. MatrixEntry(index_type column, value_type value);
  24. /*!
  25. * Move-constructs the matrix entry fro the given column-value pair.
  26. *
  27. * @param pair The column-value pair from which to move-construct the matrix entry.
  28. */
  29. MatrixEntry(std::pair<index_type, value_type>&& pair);
  30. MatrixEntry();
  31. MatrixEntry(MatrixEntry const& other);
  32. MatrixEntry& operator=(MatrixEntry const& other);
  33. #ifndef WINDOWS
  34. MatrixEntry(MatrixEntry&& other);
  35. MatrixEntry& operator=(MatrixEntry&& other);
  36. #endif
  37. /*!
  38. * Retrieves the column of the matrix entry.
  39. *
  40. * @return The column of the matrix entry.
  41. */
  42. index_type const& getColumn() const;
  43. /*!
  44. * Sets the column of the current entry.
  45. *
  46. * @param column The column to set for this entry.
  47. */
  48. void setColumn(index_type const& column);
  49. /*!
  50. * Retrieves the value of the matrix entry.
  51. *
  52. * @return The value of the matrix entry.
  53. */
  54. value_type const& getValue() const;
  55. /*!
  56. * Sets the value of the entry in the matrix.
  57. *
  58. * @param value The value that is to be set for this entry.
  59. */
  60. void setValue(value_type const& value);
  61. /*!
  62. * Retrieves a pair of column and value that characterizes this entry.
  63. *
  64. * @return A column-value pair that characterizes this entry.
  65. */
  66. std::pair<index_type, value_type> const& getColumnValuePair() const;
  67. /*!
  68. * Multiplies the entry with the given factor and returns the result.
  69. *
  70. * @param factor The factor with which to multiply the entry.
  71. */
  72. MatrixEntry operator*(value_type factor) const;
  73. template<typename IndexTypePrime, typename ValueTypePrime>
  74. friend std::ostream& operator<<(std::ostream& out, MatrixEntry<IndexTypePrime, ValueTypePrime> const& entry);
  75. private:
  76. // The actual matrix entry.
  77. std::pair<index_type, value_type> entry;
  78. };
  79. }
  80. }
  81. #endif
  82. size_t basicValueIteration_mvReduce_uint64_double_calculateMemorySize(size_t const rowCount, size_t const rowGroupCount, size_t const nnzCount);
  83. bool basicValueIteration_mvReduce_uint64_double_minimize(uint_fast64_t const maxIterationCount, double const precision, bool const relativePrecisionCheck, std::vector<uint_fast64_t> const& matrixRowIndices, std::vector<storm::storage::MatrixEntry<uint_fast64_t, double>> const& columnIndicesAndValues, std::vector<double>& x, std::vector<double> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, size_t& iterationCount);
  84. bool basicValueIteration_mvReduce_uint64_double_maximize(uint_fast64_t const maxIterationCount, double const precision, bool const relativePrecisionCheck, std::vector<uint_fast64_t> const& matrixRowIndices, std::vector<storm::storage::MatrixEntry<uint_fast64_t, double>> const& columnIndicesAndValues, std::vector<double>& x, std::vector<double> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, size_t& iterationCount);
  85. size_t basicValueIteration_mvReduce_uint64_float_calculateMemorySize(size_t const rowCount, size_t const rowGroupCount, size_t const nnzCount);
  86. bool basicValueIteration_mvReduce_uint64_float_minimize(uint_fast64_t const maxIterationCount, double const precision, bool const relativePrecisionCheck, std::vector<uint_fast64_t> const& matrixRowIndices, std::vector<storm::storage::MatrixEntry<uint_fast64_t, float>> const& columnIndicesAndValues, std::vector<float>& x, std::vector<float> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, size_t& iterationCount);
  87. bool basicValueIteration_mvReduce_uint64_float_maximize(uint_fast64_t const maxIterationCount, double const precision, bool const relativePrecisionCheck, std::vector<uint_fast64_t> const& matrixRowIndices, std::vector<storm::storage::MatrixEntry<uint_fast64_t, float>> const& columnIndicesAndValues, std::vector<float>& x, std::vector<float> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, size_t& iterationCount);
  88. void basicValueIteration_spmv_uint64_double(uint_fast64_t const matrixColCount, std::vector<uint_fast64_t> const& matrixRowIndices, std::vector<storm::storage::MatrixEntry<uint_fast64_t, double>> const& columnIndicesAndValues, std::vector<double> const& x, std::vector<double>& b);
  89. void basicValueIteration_addVectorsInplace_double(std::vector<double>& a, std::vector<double> const& b);
  90. void basicValueIteration_reduceGroupedVector_uint64_double_minimize(std::vector<double> const& groupedVector, std::vector<uint_fast64_t> const& grouping, std::vector<double>& targetVector);
  91. void basicValueIteration_reduceGroupedVector_uint64_double_maximize(std::vector<double> const& groupedVector, std::vector<uint_fast64_t> const& grouping, std::vector<double>& targetVector);
  92. void basicValueIteration_equalModuloPrecision_double_Relative(std::vector<double> const& x, std::vector<double> const& y, double& maxElement);
  93. void basicValueIteration_equalModuloPrecision_double_NonRelative(std::vector<double> const& x, std::vector<double> const& y, double& maxElement);
  94. void basicValueIteration_spmv_uint64_float(uint_fast64_t const matrixColCount, std::vector<uint_fast64_t> const& matrixRowIndices, std::vector<storm::storage::MatrixEntry<uint_fast64_t, float>> const& columnIndicesAndValues, std::vector<float> const& x, std::vector<float>& b);
  95. void basicValueIteration_addVectorsInplace_float(std::vector<float>& a, std::vector<float> const& b);
  96. void basicValueIteration_reduceGroupedVector_uint64_float_minimize(std::vector<float> const& groupedVector, std::vector<uint_fast64_t> const& grouping, std::vector<float>& targetVector);
  97. void basicValueIteration_reduceGroupedVector_uint64_float_maximize(std::vector<float> const& groupedVector, std::vector<uint_fast64_t> const& grouping, std::vector<float>& targetVector);
  98. void basicValueIteration_equalModuloPrecision_float_Relative(std::vector<float> const& x, std::vector<float> const& y, float& maxElement);
  99. void basicValueIteration_equalModuloPrecision_float_NonRelative(std::vector<float> const& x, std::vector<float> const& y, float& maxElement);
  100. #endif // STORM_CUDAFORSTORM_BASICVALUEITERATION_H_