8template<
typename ValueType>
17 size_t sizeA = ctmcA->getNumberOfStates();
18 size_t sizeB = ctmcB->getNumberOfStates();
19 size_t size = sizeA * sizeB;
25 for (
size_t stateA = 0; stateA < sizeA; ++stateA) {
26 for (
size_t stateB = 0; stateB < sizeB; ++stateB) {
27 STORM_LOG_ASSERT(rowIndex == stateA * sizeB + stateB,
"Row " << rowIndex <<
" is not correct");
29 auto rowA = matrixA.
getRow(stateA);
30 auto itA = rowA.
begin();
31 auto rowB = matrixB.
getRow(stateB);
32 auto itB = rowB.
begin();
35 while (itA != rowA.end() && itA->getColumn() < stateA) {
36 builder.
addNextValue(rowIndex, itA->getColumn() * sizeB + stateB, itA->getValue());
41 while (itB != rowB.end()) {
42 builder.
addNextValue(rowIndex, stateA * sizeB + itB->getColumn(), itB->getValue());
47 while (itA != rowA.end()) {
48 builder.
addNextValue(rowIndex, itA->getColumn() * sizeB + stateB, itA->getValue());
64 for (std::string
const& label : labelingA.
getLabels()) {
68 for (
auto entryA : labelingA.
getStates(label)) {
69 for (
auto entryB : labelingB.
getStates(label)) {
70 labelStates.
set(entryA * sizeB + entryB);
73 labeling.
addLabel(label, labelStates);
78 for (std::string
const& label : labelingA.
getLabels()) {
79 if (label ==
"init") {
83 for (
auto entryA : labelingA.
getStates(label)) {
84 for (
auto entryB : labelingB.
getStates(label)) {
85 labelStates.
set(entryA * sizeB + entryB);
88 labeling.
addLabel(label, labelStates);
91 for (
auto entry : labelingA.
getStates(label)) {
92 for (
size_t index = entry * sizeB; index < entry * sizeB + sizeB; ++index) {
93 labelStates.
set(index,
true);
96 labeling.
addLabel(label, labelStates);
100 for (std::string
const& label : labelingB.
getLabels()) {
101 if (label ==
"init") {
106 for (
auto entry : labelingB.
getStates(label)) {
107 for (
size_t index = 0; index < sizeA; ++index) {
113 for (
auto entry : labelingB.
getStates(label)) {
114 for (
size_t index = 0; index < sizeA; ++index) {
115 labelStates.
set(index * sizeB + entry,
true);
118 labeling.
addLabel(label, labelStates);
124 std::shared_ptr<storm::models::sparse::Ctmc<ValueType>> composedCtmc = std::make_shared<storm::models::sparse::Ctmc<ValueType>>(matrixComposed, labeling);
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(uint64_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)