40 #ifndef _NAIVESUBSTITUTIONCOUNT_H_ 41 #define _NAIVESUBSTITUTIONCOUNT_H_ 45 #include <Bpp/Numeric/Matrix/Matrix.h> 101 return (
register_->getType(initialState, finalState) == type ? (
weights_ ?
weights_->getIndex(alphabetState1, alphabetState2) : 1.) : 0.);
151 return label_(initialState, finalState);
156 return dynamic_cast<Matrix<double>*
>(
label_.clone());
161 std::vector<double> v(1);
162 v[0] =
label_(initialState, finalState);
172 throw Exception(
"OneJumpSubstitutionCount::setSubstitutionRegister. This SubstitutionsCount only works with a TotalSubstitutionRegister.");
182 #endif // _SIMPLESUBSTITUTIONCOUNT_H_
Interface for all substitution models.
void setSubstitutionModel(const SubstitutionModel *model)
Set the substitution model associated with this count, if relevent.
std::auto_ptr< SubstitutionRegister > register_
LabelSubstitutionCount(const SubstitutionModel *model)
virtual const std::vector< int > & getAlphabetStates() const =0
std::vector< double > getNumberOfSubstitutionsForEachType(size_t initialState, size_t finalState, double length) const
Get the numbers of susbstitutions on a branch for all types, for an initial and final states...
Basic implementation of the the SubstitutionCount interface.
void substitutionRegisterHasChanged()
The SubstitutionRegister interface.
Matrix< double > * getAllNumbersOfSubstitutions(double length, size_t type=1) const
Get the numbers of susbstitutions on a branch, for each initial and final states, and given the branc...
std::vector< double > getNumberOfSubstitutionsForEachType(size_t initialState, size_t finalState, double length) const
Get the numbers of susbstitutions on a branch for all types, for an initial and final states...
void setSubstitutionModel(const SubstitutionModel *model)
Set the substitution model associated with this count, if relevent.
const AlphabetIndex2 * weights_
NaiveSubstitutionCount * clone() const
virtual size_t getNumberOfSubstitutionTypes() const
Short cut function, equivalent to getSubstitutionRegister().getNumberOfSubstitutionTypes().
LabelSubstitutionCount * clone() const
double getNumberOfSubstitutions(size_t initialState, size_t finalState, double length, size_t type=1) const
Get the number of susbstitutions on a branch, given the initial and final states, and the branch leng...
std::vector< int > supportedChars_
LinearMatrix< double > label_
Labelling substitution count.
NaiveSubstitutionCount(const SubstitutionModel *model, SubstitutionRegister *reg, bool allowSelf=false, const AlphabetIndex2 *weights=0)
Build a new simple substitution count.
void weightsHaveChanged()
std::vector< int > supportedChars_
virtual ~NaiveSubstitutionCount()
virtual ~LabelSubstitutionCount()
Naive substitution count.
double getNumberOfSubstitutions(size_t initialState, size_t finalState, double length, size_t type=1) const
Get the number of susbstitutions on a branch, given the initial and final states, and the branch leng...
void setSubstitutionRegister(SubstitutionRegister *reg)
Partial implementation of the WeightedSubstitutionCount interface.
Matrix< double > * getAllNumbersOfSubstitutions(double length, size_t type=1) const
Get the numbers of susbstitutions on a branch, for each initial and final states, and given the branc...
void substitutionRegisterHasChanged()