in src/beanmachine/graph/graph.cpp [150:211]
std::string NodeValue::to_string() const {
std::ostringstream os;
std::string type_str = type.to_string() + " ";
if (type.variable_type == VariableType::SCALAR) {
switch (type.atomic_type) {
case AtomicType::UNKNOWN:
os << type_str;
break;
case AtomicType::BOOLEAN:
os << type_str << _bool;
break;
case AtomicType::NATURAL:
os << type_str << _natural;
break;
case AtomicType::REAL:
case AtomicType::POS_REAL:
case AtomicType::NEG_REAL:
case AtomicType::PROBABILITY:
os << type_str << _double;
break;
default:
os << "Unsupported SCALAR value";
break;
}
} else if (type.variable_type == VariableType::BROADCAST_MATRIX) {
switch (type.atomic_type) {
case AtomicType::UNKNOWN:
os << type_str;
break;
case AtomicType::REAL:
case AtomicType::POS_REAL:
case AtomicType::NEG_REAL:
case AtomicType::PROBABILITY:
os << type_str << _matrix;
break;
case AtomicType::BOOLEAN:
os << type_str << _bmatrix;
break;
case AtomicType::NATURAL:
os << type_str << _nmatrix;
break;
break;
default:
os << "Unsupported BROADCAST_MATRIX value";
}
} else if (type.variable_type == VariableType::COL_SIMPLEX_MATRIX) {
switch (type.atomic_type) {
case AtomicType::UNKNOWN:
os << type_str;
break;
case AtomicType::PROBABILITY:
os << type_str << _matrix;
break;
default:
os << "Unsupported COL_SIMPLEX_MATRIX value";
}
} else {
os << "Unsupported NodeValue";
}
return os.str();
}