16 unique_ptr<ReversibleSubstitutionModelInterface> simpleModel,
21 simpleModel_(std::move(simpleModel)),
23 simpleExchangeabilities_(),
24 exp_(), p_(), lambda_(lambda), mu_(mu),
25 nestedPrefix_(
"model_" + simpleModel->getNamespace())
51 for (
size_t i = 0; i <
size_ - 1; ++i)
62 for (
size_t i = 0; i <
size_ - 1; ++i)
64 for (
size_t j = 0; j <
size_ - 1; ++j)
187 for (
size_t i = 0; i <
size_ - 1; i++)
189 for (
size_t j = 0; j <
size_ - 1; j++)
195 for (
size_t j = 0; j <
size_ - 1; j++)
200 for (
size_t i = 0; i <
size_ - 1; i++)
214 for (
size_t i = 0; i <
size_ - 1; i++)
216 for (
size_t j = 0; j <
size_ - 1; j++)
218 p_(i, j) = simpleDP(i, j) *
exp(-
mu_ * d)
223 for (
size_t j = 0; j <
size_ - 1; j++)
228 for (
size_t i = 0; i <
size_ - 1; i++)
243 for (
size_t i = 0; i <
size_ - 1; i++)
245 for (
size_t j = 0; j <
size_ - 1; j++)
247 p_(i, j) = simpleD2P(i, j) *
exp(-
mu_ * d)
248 - 2 *
mu_ * simpleDP(i, j) *
exp(-
mu_ * d)
253 for (
size_t j = 0; j <
size_ - 1; j++)
258 for (
size_t i = 0; i <
size_ - 1; i++)
271 if (state < -1 || !
getAlphabet()->isIntInAlphabet(state))
273 if (i ==
size_ - 1 && state == -1)
275 vector<int> states =
alphabet_->getAlias(state);
276 for (
size_t j = 0; j < states.size(); j++)
278 if ((
int)i == states[j])
void addParameters_(const ParameterList ¶meters)
void addParameter_(Parameter *parameter)
void setNamespace(const std::string &prefix)
Partial implementation of the ReversibleSubstitutionModel interface.
RowMatrix< double > generator_
The generator matrix of the model.
Vdouble eigenValues_
The vector of eigen values.
RowMatrix< double > exchangeability_
The exchangeability matrix of the model, defined as . When the model is reversible,...
RowMatrix< double > leftEigenVectors_
The matrix made of left eigen vectors (by row) if rightEigenVectors_ is non-singular.
virtual void updateMatrices_()
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
RowMatrix< double > rightEigenVectors_
The matrix made of right eigen vectors (by column).
std::shared_ptr< const Alphabet > getAlphabet() const override
size_t size_
The number of states.
Vdouble freq_
The vector of equilibrium frequencies.
std::shared_ptr< const Alphabet > alphabet_
The alphabet relevant to this model.
This class implements a state map where all resolved states are modeled.
static const std::shared_ptr< IntervalConstraint > R_PLUS
std::unique_ptr< ReversibleSubstitutionModelInterface > simpleModel_
const Matrix< double > & getdPij_dt(double d) const override
RowMatrix< double > simpleExchangeabilities_
double getInitValue(size_t i, int state) const override
double Pij_t(size_t i, size_t j, double d) const override
void setNamespace(const std::string &prefix) override
double d2Pij_dt2(size_t i, size_t j, double d) const override
std::string nestedPrefix_
const Matrix< double > & getPij_t(double d) const override
void updateMatrices_() override
Compute and diagonalize the matrix, and fill the eigenValues_, leftEigenVectors_ and rightEigenVecto...
const Matrix< double > & getd2Pij_dt2(double d) const override
RowMatrix< double > simpleGenerator_
RE08(std::unique_ptr< ReversibleSubstitutionModelInterface > simpleModel, double lambda=0.1, double mu=0.1)
Build a new Rivas & Eddy model from a standard substitution model.
double dPij_dt(size_t i, size_t j, double d) const override
void resize(size_t nRows, size_t nCols)
Defines the basic types of data flow nodes.
ExtendedFloat exp(const ExtendedFloat &ef)