12 size_t n = supportedChars_.size();
13 auto mat = make_unique<RowMatrix<double>>(n, n);
14 for (
size_t i = 0; i < n; ++i)
16 for (
size_t j = 0; j < n; ++j)
18 (*mat)(i, j) = (register_->getType(i, j) == type ? (weights_ ? weights_->getIndex(supportedChars_[i], supportedChars_[j]) : 1.) : 0.);
26 auto n = Eigen::Index(supportedChars_.size());
29 for (
auto i = 0; i < n; ++i)
31 for (
auto j = 0; j < n; ++j)
33 mat(i, j) = (register_->getType(
size_t(i),
size_t(j)) == type ? (weights_ ? weights_->getIndex(supportedChars_[
size_t(i)], supportedChars_[
size_t(j)]) : 1.) : 0.);
40 std::shared_ptr<const SubstitutionModelInterface> model) :
43 label_(model->getNumberOfStates(), model->getNumberOfStates()),
44 supportedChars_(model->getAlphabetStates())
48 for (
size_t i = 0; i < n; ++i)
50 for (
size_t j = 0; j < n; ++j)
61 std::shared_ptr<const StateMapInterface> stateMap) :
64 label_(stateMap->getNumberOfModelStates(), stateMap->getNumberOfModelStates()),
65 supportedChars_(stateMap->getAlphabetStates())
69 for (
size_t i = 0; i < n; ++i)
71 for (
size_t j = 0; j < n; ++j)
Partial implementation of the SubstitutionCount interface.
LabelSubstitutionCount(std::shared_ptr< const SubstitutionModelInterface > model)
LinearMatrix< double > label_
std::vector< int > supportedChars_
std::unique_ptr< Matrix< double > > getAllNumbersOfSubstitutions(double length, size_t type=1) const override
Get the numbers of susbstitutions on a branch, for each initial and final states, and given the branc...
void storeAllNumbersOfSubstitutions(double length, size_t type, Eigen::MatrixXd &mat) const override
Stores the numbers of susbstitutions on a branch, for each initial and final states,...
std::size_t count(const std::string &s, const std::string &pattern)
Defines the basic types of data flow nodes.