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.

106 lines
6.8 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_Export.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 T>
  13. class MatrixEntry {
  14. public:
  15. /*!
  16. * Constructs a matrix entry with the given column and value.
  17. *
  18. * @param column The column of the matrix entry.
  19. * @param value The value of the matrix entry.
  20. */
  21. MatrixEntry(uint_fast64_t column, T value);
  22. /*!
  23. * Move-constructs the matrix entry fro the given column-value pair.
  24. *
  25. * @param pair The column-value pair from which to move-construct the matrix entry.
  26. */
  27. MatrixEntry(std::pair<uint_fast64_t, T>&& pair);
  28. //MatrixEntry() = default;
  29. //MatrixEntry(MatrixEntry const& other) = default;
  30. //MatrixEntry& operator=(MatrixEntry const& other) = default;
  31. #ifndef WINDOWS
  32. //MatrixEntry(MatrixEntry&& other) = default;
  33. //MatrixEntry& operator=(MatrixEntry&& other) = default;
  34. #endif
  35. /*!
  36. * Retrieves the column of the matrix entry.
  37. *
  38. * @return The column of the matrix entry.
  39. */
  40. uint_fast64_t const& getColumn() const;
  41. /*!
  42. * Retrieves the column of the matrix entry.
  43. *
  44. * @return The column of the matrix entry.
  45. */
  46. uint_fast64_t& getColumn();
  47. /*!
  48. * Retrieves the value of the matrix entry.
  49. *
  50. * @return The value of the matrix entry.
  51. */
  52. T const& getValue() const;
  53. /*!
  54. * Retrieves the value of the matrix entry.
  55. *
  56. * @return The value of the matrix entry.
  57. */
  58. T& getValue();
  59. /*!
  60. * Retrieves a pair of column and value that characterizes this entry.
  61. *
  62. * @return A column-value pair that characterizes this entry.
  63. */
  64. std::pair<uint_fast64_t, T> const& getColumnValuePair() const;
  65. private:
  66. // The actual matrix entry.
  67. std::pair<uint_fast64_t, T> entry;
  68. };
  69. }
  70. }
  71. #endif
  72. cudaForStorm_EXPORT size_t basicValueIteration_mvReduce_uint64_double_calculateMemorySize(size_t const rowCount, size_t const rowGroupCount, size_t const nnzCount);
  73. cudaForStorm_EXPORT 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<double>> const& columnIndicesAndValues, std::vector<double>& x, std::vector<double> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, size_t& iterationCount);
  74. cudaForStorm_EXPORT 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<double>> const& columnIndicesAndValues, std::vector<double>& x, std::vector<double> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, size_t& iterationCount);
  75. cudaForStorm_EXPORT size_t basicValueIteration_mvReduce_uint64_float_calculateMemorySize(size_t const rowCount, size_t const rowGroupCount, size_t const nnzCount);
  76. cudaForStorm_EXPORT 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<float>> const& columnIndicesAndValues, std::vector<float>& x, std::vector<float> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, size_t& iterationCount);
  77. cudaForStorm_EXPORT 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<float>> const& columnIndicesAndValues, std::vector<float>& x, std::vector<float> const& b, std::vector<uint_fast64_t> const& nondeterministicChoiceIndices, size_t& iterationCount);
  78. cudaForStorm_EXPORT void basicValueIteration_spmv_uint64_double(uint_fast64_t const matrixColCount, std::vector<uint_fast64_t> const& matrixRowIndices, std::vector<storm::storage::MatrixEntry<double>> const& columnIndicesAndValues, std::vector<double> const& x, std::vector<double>& b);
  79. cudaForStorm_EXPORT void basicValueIteration_addVectorsInplace_double(std::vector<double>& a, std::vector<double> const& b);
  80. cudaForStorm_EXPORT void basicValueIteration_reduceGroupedVector_uint64_double_minimize(std::vector<double> const& groupedVector, std::vector<uint_fast64_t> const& grouping, std::vector<double>& targetVector);
  81. cudaForStorm_EXPORT void basicValueIteration_reduceGroupedVector_uint64_double_maximize(std::vector<double> const& groupedVector, std::vector<uint_fast64_t> const& grouping, std::vector<double>& targetVector);
  82. cudaForStorm_EXPORT void basicValueIteration_equalModuloPrecision_double_Relative(std::vector<double> const& x, std::vector<double> const& y, double& maxElement);
  83. cudaForStorm_EXPORT void basicValueIteration_equalModuloPrecision_double_NonRelative(std::vector<double> const& x, std::vector<double> const& y, double& maxElement);
  84. cudaForStorm_EXPORT void basicValueIteration_spmv_uint64_float(uint_fast64_t const matrixColCount, std::vector<uint_fast64_t> const& matrixRowIndices, std::vector<storm::storage::MatrixEntry<float>> const& columnIndicesAndValues, std::vector<float> const& x, std::vector<float>& b);
  85. cudaForStorm_EXPORT void basicValueIteration_addVectorsInplace_float(std::vector<float>& a, std::vector<float> const& b);
  86. cudaForStorm_EXPORT void basicValueIteration_reduceGroupedVector_uint64_float_minimize(std::vector<float> const& groupedVector, std::vector<uint_fast64_t> const& grouping, std::vector<float>& targetVector);
  87. cudaForStorm_EXPORT void basicValueIteration_reduceGroupedVector_uint64_float_maximize(std::vector<float> const& groupedVector, std::vector<uint_fast64_t> const& grouping, std::vector<float>& targetVector);
  88. cudaForStorm_EXPORT void basicValueIteration_equalModuloPrecision_float_Relative(std::vector<float> const& x, std::vector<float> const& y, float& maxElement);
  89. cudaForStorm_EXPORT void basicValueIteration_equalModuloPrecision_float_NonRelative(std::vector<float> const& x, std::vector<float> const& y, float& maxElement);
  90. #endif // STORM_CUDAFORSTORM_BASICVALUEITERATION_H_