Browse Source

Use operator<< from carl

Former-commit-id: 733c029ebe
main
Mavo 9 years ago
parent
commit
ee4b6c96a8
  1. 8
      src/builder/ExplicitDFTModelBuilderApprox.cpp
  2. 10
      src/utility/logging.h
  3. 43
      src/utility/vector.cpp
  4. 6
      src/utility/vector.h

8
src/builder/ExplicitDFTModelBuilderApprox.cpp

@ -167,10 +167,10 @@ namespace storm {
// Fix the entries in the transition matrix according to the mapping of ids to row group indices // Fix the entries in the transition matrix according to the mapping of ids to row group indices
STORM_LOG_ASSERT(matrixBuilder.stateRemapping[initialStateIndex] == initialStateIndex, "Initial state should not be remapped."); STORM_LOG_ASSERT(matrixBuilder.stateRemapping[initialStateIndex] == initialStateIndex, "Initial state should not be remapped.");
// TODO Matthias: do not consider all rows? // TODO Matthias: do not consider all rows?
//STORM_LOG_TRACE("Remap matrix: " << matrixBuilder.stateRemapping << ", offset: " << matrixBuilder.mappingOffset);
STORM_LOG_TRACE("Remap matrix: " << matrixBuilder.stateRemapping << ", offset: " << matrixBuilder.mappingOffset);
matrixBuilder.remap(); matrixBuilder.remap();
//STORM_LOG_TRACE("State remapping: " << matrixBuilder.stateRemapping);
STORM_LOG_TRACE("State remapping: " << matrixBuilder.stateRemapping);
STORM_LOG_TRACE("Markovian states: " << modelComponents.markovianStates); STORM_LOG_TRACE("Markovian states: " << modelComponents.markovianStates);
STORM_LOG_DEBUG("Model has " << stateSize << " states"); STORM_LOG_DEBUG("Model has " << stateSize << " states");
STORM_LOG_DEBUG("Model is " << (generator.isDeterministicModel() ? "deterministic" : "non-deterministic")); STORM_LOG_DEBUG("Model is " << (generator.isDeterministicModel() ? "deterministic" : "non-deterministic"));
@ -239,7 +239,7 @@ namespace storm {
matrixBuilder.stateRemapping[id] = indexRemapping[index]; matrixBuilder.stateRemapping[id] = indexRemapping[index];
} }
} }
//STORM_LOG_TRACE("New state remapping: " << matrixBuilder.stateRemapping);
STORM_LOG_TRACE("New state remapping: " << matrixBuilder.stateRemapping);
std::stringstream ss; std::stringstream ss;
ss << "Index remapping:" << std::endl; ss << "Index remapping:" << std::endl;
for (auto tmp : indexRemapping) { for (auto tmp : indexRemapping) {
@ -477,7 +477,7 @@ namespace storm {
modelComponents.exitRates[stateIndex] = storm::utility::zero<ValueType>(); modelComponents.exitRates[stateIndex] = storm::utility::zero<ValueType>();
} }
} }
//STORM_LOG_TRACE("Exit rates: " << modelComponents.exitRates);
STORM_LOG_TRACE("Exit rates: " << modelComponents.exitRates);
std::shared_ptr<storm::models::sparse::MarkovAutomaton<ValueType>> ma; std::shared_ptr<storm::models::sparse::MarkovAutomaton<ValueType>> ma;
if (copy) { if (copy) {

10
src/utility/logging.h

@ -1,6 +1,16 @@
#ifndef STORM_UTILITY_LOGGING_H_ #ifndef STORM_UTILITY_LOGGING_H_
#define STORM_UTILITY_LOGGING_H_ #define STORM_UTILITY_LOGGING_H_
// Include config to know whether CARL is available or not.
#include "storm-config.h"
#ifdef STORM_HAVE_CARL
// Load streaming operator from CARL
#include <carl/io/streamingOperators.h>
namespace l3pp {
using carl::operator<<;
}
#endif
#include <l3pp.h> #include <l3pp.h>
#if !defined(STORM_LOG_DISABLE_DEBUG) && !defined(STORM_LOG_DISABLE_TRACE) #if !defined(STORM_LOG_DISABLE_DEBUG) && !defined(STORM_LOG_DISABLE_TRACE)

43
src/utility/vector.cpp

@ -1,43 +0,0 @@
#include "src/utility/vector.h"
// Template was causing problems as Carl has the same function
/*
template<typename ValueType>
std::ostream& operator<<(std::ostream& out, std::vector<ValueType> const& vector) {
out << "vector (" << vector.size() << ") [ ";
for (uint_fast64_t i = 0; i < vector.size() - 1; ++i) {
out << vector[i] << ", ";
}
out << vector.back();
out << " ]";
return out;
}
// 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);
*/
std::ostream& operator<<(std::ostream& out, std::vector<double> const& vector) {
out << "vector (" << vector.size() << ") [ ";
for (size_t i = 0; i + 1 < vector.size(); ++i) {
out << vector[i] << ", ";
}
if (!vector.empty()) {
out << vector.back();
}
out << " ]";
return out;
}
std::ostream& operator<<(std::ostream& out, std::vector<uint_fast64_t> const& vector) {
out << "vector (" << vector.size() << ") [ ";
for (size_t i = 0; i + 1 < vector.size(); ++i) {
out << vector[i] << ", ";
}
if (!vector.empty()) {
out << vector.back();
}
out << " ]";
return out;
}

6
src/utility/vector.h

@ -16,12 +16,6 @@
#include "src/utility/macros.h" #include "src/utility/macros.h"
#include "src/solver/OptimizationDirection.h" #include "src/solver/OptimizationDirection.h"
// 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);
std::ostream& operator<<(std::ostream& out, std::vector<uint_fast64_t> const& vector);
namespace storm { namespace storm {
namespace utility { namespace utility {
namespace vector { namespace vector {

Loading…
Cancel
Save