Browse Source

Vector output without template seems to work

Former-commit-id: 3627729e25
tempestpy_adaptions
Mavo 9 years ago
parent
commit
24cd1ec597
  1. 9
      src/builder/ExplicitDFTModelBuilder.cpp
  2. 9
      src/utility/vector.cpp
  3. 6
      src/utility/vector.h

9
src/builder/ExplicitDFTModelBuilder.cpp

@ -2,6 +2,7 @@
#include <src/models/sparse/MarkovAutomaton.h>
#include <src/models/sparse/CTMC.h>
#include <src/utility/constants.h>
#include <src/utility/vector.h>
#include <src/exceptions/UnexpectedException.h>
#include <map>
@ -37,13 +38,7 @@ namespace storm {
// Build transition matrix
modelComponents.transitionMatrix = transitionMatrixBuilder.build();
STORM_LOG_DEBUG("Transition matrix: " << std::endl << modelComponents.transitionMatrix);
// TODO: easier output for vectors
std::stringstream stream;
for (uint_fast64_t i = 0; i < modelComponents.exitRates.size() - 1; ++i) {
stream << modelComponents.exitRates[i] << ", ";
}
stream << modelComponents.exitRates.back();
STORM_LOG_DEBUG("Exit rates: " << stream.str());
STORM_LOG_DEBUG("Exit rates: " << modelComponents.exitRates);
STORM_LOG_DEBUG("Markovian states: " << modelComponents.markovianStates);
assert(modelComponents.transitionMatrix.getRowCount() == modelComponents.transitionMatrix.getColumnCount());

9
src/utility/vector.cpp

@ -1,7 +1,8 @@
#include "src/utility/vector.h"
template<typename ValueType>
std::ostream& operator<<(std::ostream& out, std::vector<ValueType> const& vector) {
//template<typename ValueType>
//std::ostream& operator<<(std::ostream& out, std::vector<ValueType> const& vector) {
std::ostream& operator<<(std::ostream& out, std::vector<double> const& vector) {
out << "vector (" << vector.size() << ") [ ";
for (uint_fast64_t i = 0; i < vector.size() - 1; ++i) {
out << vector[i] << ", ";
@ -12,5 +13,5 @@ std::ostream& operator<<(std::ostream& out, std::vector<ValueType> const& vector
}
// Explicitly instantiate functions.
template std::ostream& operator<<(std::ostream& out, std::vector<double> const& vector);
template std::ostream& operator<<(std::ostream& out, std::vector<uint_fast64_t> const& vector);
//template std::ostream& operator<<(std::ostream& out, std::vector<double> const& vector);
//template std::ostream& operator<<(std::ostream& out, std::vector<uint_fast64_t> const& vector);

6
src/utility/vector.h

@ -15,8 +15,10 @@
#include "src/utility/macros.h"
#include "src/solver/OptimizationDirection.h"
template<typename ValueType>
std::ostream& operator<<(std::ostream& out, std::vector<ValueType> const& vector);
// Template was causing problems as Carl has the same function
//template<typename ValueType>
//std::ostream& operator<<(std::ostream& out, std::vector<ValueType> const& vector);
std::ostream& operator<<(std::ostream& out, std::vector<double> const& vector);
namespace storm {
namespace utility {

Loading…
Cancel
Save