5 #ifndef BPP_PHYL_MAPPING_NAIVESUBSTITUTIONCOUNT_H
6 #define BPP_PHYL_MAPPING_NAIVESUBSTITUTIONCOUNT_H
48 std::shared_ptr<const SubstitutionModelInterface> model,
49 std::shared_ptr<const SubstitutionRegisterInterface> reg,
50 bool allowSelf =
false,
51 std::shared_ptr<const AlphabetIndex2> weights =
nullptr) :
58 std::shared_ptr<const StateMapInterface> stateMap,
59 std::shared_ptr<const SubstitutionRegisterInterface> reg,
60 bool allowSelf =
false,
61 std::shared_ptr<const AlphabetIndex2> weights =
nullptr) :
83 return register_->getType(initialState, finalState) == type ? (
weights_ ?
weights_->getIndex(alphabetState1, alphabetState2) : 1.) : 0.;
138 return label_(initialState, finalState);
143 return std::unique_ptr< Matrix<double>>(
label_.
clone());
150 mat.resize(Eigen::Index(nbStates), Eigen::Index(nbStates));
152 for (
size_t i = 0; i < nbStates; i++)
154 for (
size_t j = 0; j < nbStates; j++)
156 mat(Eigen::Index(i), Eigen::Index(j)) =
label_(i, j);
164 std::vector<double> v(1);
165 v[0] =
label_(initialState, finalState);
177 throw Exception(
"OneJumpSubstitutionCount::setSubstitutionRegister. This SubstitutionsCount only works with a TotalSubstitutionRegister.");
Partial implementation of the SubstitutionCount interface.
std::shared_ptr< const SubstitutionRegisterInterface > register_
Partial implementation of the WeightedSubstitutionCount interface.
std::shared_ptr< const AlphabetIndex2 > weights_
Labelling substitution count.
void setSubstitutionRegister(std::shared_ptr< const SubstitutionRegisterInterface > reg) override
std::vector< double > getNumberOfSubstitutionsPerType(size_t initialState, size_t finalState, double length) const override
Get the numbers of susbstitutions on a branch for all types, for an initial and final states,...
void setSubstitutionModel(std::shared_ptr< const SubstitutionModelInterface > model) override
Set the substitution model associated with this count, if relevant.
double getNumberOfSubstitutions(size_t initialState, size_t finalState, double length, size_t type=1) const override
Get the number of susbstitutions on a branch, given the initial and final states, and the branch leng...
LabelSubstitutionCount(std::shared_ptr< const SubstitutionModelInterface > model)
LinearMatrix< double > label_
std::vector< int > supportedChars_
void substitutionRegisterHasChanged() override
virtual ~LabelSubstitutionCount()
LabelSubstitutionCount * clone() const override
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::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...
LinearMatrix * clone() const
Naive substitution count.
NaiveSubstitutionCount * clone() const override
void setSubstitutionModel(std::shared_ptr< const SubstitutionModelInterface > model) override
Set the substitution model associated with this count, if relevant.
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 substitutionRegisterHasChanged() override
virtual ~NaiveSubstitutionCount()
double getNumberOfSubstitutions(size_t initialState, size_t finalState, double length, size_t type=1) const override
Get the number of susbstitutions on a branch, given the initial and final states, and the branch leng...
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::vector< int > supportedChars_
std::vector< double > getNumberOfSubstitutionsPerType(size_t initialState, size_t finalState, double length) const override
Get the numbers of susbstitutions on a branch for all types, for an initial and final states,...
NaiveSubstitutionCount(std::shared_ptr< const StateMapInterface > stateMap, std::shared_ptr< const SubstitutionRegisterInterface > reg, bool allowSelf=false, std::shared_ptr< const AlphabetIndex2 > weights=nullptr)
NaiveSubstitutionCount(std::shared_ptr< const SubstitutionModelInterface > model, std::shared_ptr< const SubstitutionRegisterInterface > reg, bool allowSelf=false, std::shared_ptr< const AlphabetIndex2 > weights=nullptr)
Build a new simple substitution count.
void weightsHaveChanged() override
virtual size_t getNumberOfSubstitutionTypes() const
Short cut function, equivalent to getSubstitutionRegister().getNumberOfSubstitutionTypes().
Defines the basic types of data flow nodes.