9template<
typename ValueType>
18 size_t sizeA = ctmcA->getNumberOfStates();
19 size_t sizeB = ctmcB->getNumberOfStates();
20 size_t size = sizeA * sizeB;
26 for (
size_t stateA = 0; stateA < sizeA; ++stateA) {
27 for (
size_t stateB = 0; stateB < sizeB; ++stateB) {
28 STORM_LOG_ASSERT(rowIndex == stateA * sizeB + stateB,
"Row " << rowIndex <<
" is not correct");
30 auto rowA = matrixA.
getRow(stateA);
31 auto itA = rowA.
begin();
32 auto rowB = matrixB.
getRow(stateB);
33 auto itB = rowB.
begin();
36 while (itA != rowA.end() && itA->getColumn() < stateA) {
37 builder.
addNextValue(rowIndex, itA->getColumn() * sizeB + stateB, itA->getValue());
42 while (itB != rowB.end()) {
43 builder.
addNextValue(rowIndex, stateA * sizeB + itB->getColumn(), itB->getValue());
48 while (itA != rowA.end()) {
49 builder.
addNextValue(rowIndex, itA->getColumn() * sizeB + stateB, itA->getValue());
65 for (std::string
const& label : labelingA.
getLabels()) {
69 for (
auto entryA : labelingA.
getStates(label)) {
70 for (
auto entryB : labelingB.
getStates(label)) {
71 labelStates.
set(entryA * sizeB + entryB);
74 labeling.
addLabel(label, labelStates);
79 for (std::string
const& label : labelingA.
getLabels()) {
80 if (label ==
"init") {
84 for (
auto entryA : labelingA.
getStates(label)) {
85 for (
auto entryB : labelingB.
getStates(label)) {
86 labelStates.
set(entryA * sizeB + entryB);
89 labeling.
addLabel(label, labelStates);
92 for (
auto entry : labelingA.
getStates(label)) {
93 for (
size_t index = entry * sizeB; index < entry * sizeB + sizeB; ++index) {
94 labelStates.
set(index,
true);
97 labeling.
addLabel(label, labelStates);
101 for (std::string
const& label : labelingB.
getLabels()) {
102 if (label ==
"init") {
107 for (
auto entry : labelingB.
getStates(label)) {
108 for (
size_t index = 0; index < sizeA; ++index) {
114 for (
auto entry : labelingB.
getStates(label)) {
115 for (
size_t index = 0; index < sizeA; ++index) {
116 labelStates.
set(index * sizeB + entry,
true);
119 labeling.
addLabel(label, labelStates);
125 std::shared_ptr<storm::models::sparse::Ctmc<ValueType>> composedCtmc = std::make_shared<storm::models::sparse::Ctmc<ValueType>>(matrixComposed, labeling);
167#ifdef STORM_HAVE_CARL
Build a parallel composition of Markov chains.
static std::shared_ptr< storm::models::sparse::Ctmc< ValueType > > compose(std::shared_ptr< storm::models::sparse::Ctmc< ValueType > > const &ctmcA, std::shared_ptr< storm::models::sparse::Ctmc< ValueType > > const &ctmcB, bool labelAnd)
This class represents a continuous-time Markov chain.
std::set< std::string > getLabels() const
Retrieves the set of labels contained in this labeling.
void addLabel(std::string const &label)
Adds a new label to the labelings.
bool containsLabel(std::string const &label) const
Checks whether a label is registered within this labeling.
This class manages the labeling of the state space with a number of (atomic) labels.
storm::storage::BitVector const & getStates(std::string const &label) const
Returns the labeling of states associated with the given label.
void addLabelToState(std::string const &label, storm::storage::sparse::state_type state)
Adds a label to a given state.
A bit vector that is internally represented as a vector of 64-bit values.
void set(uint_fast64_t index, bool value=true)
Sets the given truth value at the given index.
const_iterator begin() const
Retrieves an iterator that points to the beginning of the rows.
A class that can be used to build a sparse matrix by adding value by value.
void addNextValue(index_type row, index_type column, value_type const &value)
Sets the matrix entry at the given row and column to the given value.
SparseMatrix< value_type > build(index_type overriddenRowCount=0, index_type overriddenColumnCount=0, index_type overriddenRowGroupCount=0)
A class that holds a possibly non-square matrix in the compressed row storage format.
const_rows getRow(index_type row) const
Returns an object representing the given row.
index_type getColumnCount() const
Returns the number of columns of the matrix.
index_type getRowCount() const
Returns the number of rows of the matrix.
#define STORM_LOG_TRACE(message)
#define STORM_LOG_ASSERT(cond, message)