18 K80::K80(shared_ptr<const NucleicAlphabet> alpha,
double kappa) :
21 kappa_(kappa), r_(), l_(), k_(), exp1_(), exp2_(), p_(size_, size_)
120 case 0:
return 0.25 * (1. +
exp1_) + 0.5 *
exp2_;
121 case 1:
return 0.25 * (1. -
exp1_);
122 case 2:
return 0.25 * (1. +
exp1_) - 0.5 *
exp2_;
123 case 3:
return 0.25 * (1. -
exp1_);
129 case 0:
return 0.25 * (1. -
exp1_);
130 case 1:
return 0.25 * (1. +
exp1_) + 0.5 *
exp2_;
131 case 2:
return 0.25 * (1. -
exp1_);
132 case 3:
return 0.25 * (1. +
exp1_) - 0.5 *
exp2_;
138 case 0:
return 0.25 * (1. +
exp1_) - 0.5 *
exp2_;
139 case 1:
return 0.25 * (1. -
exp1_);
140 case 2:
return 0.25 * (1. +
exp1_) + 0.5 *
exp2_;
141 case 3:
return 0.25 * (1. -
exp1_);
147 case 0:
return 0.25 * (1. -
exp1_);
148 case 1:
return 0.25 * (1. +
exp1_) - 0.5 *
exp2_;
149 case 2:
return 0.25 * (1. -
exp1_);
150 case 3:
return 0.25 * (1. +
exp1_) + 0.5 *
exp2_;
211 double k_2 =
k_ *
k_;
222 case 0:
return r_2 / 4. * (
exp1_ + 2. * k_2 *
exp2_);
223 case 1:
return r_2 / 4. * (-
exp1_);
224 case 2:
return r_2 / 4. * (
exp1_ - 2. * k_2 *
exp2_);
225 case 3:
return r_2 / 4. * (-
exp1_);
231 case 0:
return r_2 / 4. * (-
exp1_);
232 case 1:
return r_2 / 4. * (
exp1_ + 2. * k_2 *
exp2_);
233 case 2:
return r_2 / 4. * (-
exp1_);
234 case 3:
return r_2 / 4. * (
exp1_ - 2. * k_2 *
exp2_);
240 case 0:
return r_2 / 4. * (
exp1_ - 2. * k_2 *
exp2_);
241 case 1:
return r_2 / 4. * (-
exp1_);
242 case 2:
return r_2 / 4. * (
exp1_ + 2. * k_2 *
exp2_);
243 case 3:
return r_2 / 4. * (-
exp1_);
249 case 0:
return r_2 / 4. * (-
exp1_);
250 case 1:
return r_2 / 4. * (
exp1_ - 2. * k_2 *
exp2_);
251 case 2:
return r_2 / 4. * (-
exp1_);
252 case 3:
return r_2 / 4. * (
exp1_ + 2. * k_2 *
exp2_);
270 p_(0, 1) = 0.25 * (1. -
exp1_);
272 p_(0, 3) = 0.25 * (1. -
exp1_);
275 p_(1, 0) = 0.25 * (1. -
exp1_);
277 p_(1, 2) = 0.25 * (1. -
exp1_);
282 p_(2, 1) = 0.25 * (1. -
exp1_);
284 p_(2, 3) = 0.25 * (1. -
exp1_);
287 p_(3, 0) = 0.25 * (1. -
exp1_);
289 p_(3, 2) = 0.25 * (1. -
exp1_);
329 double k_2 =
k_ *
k_;
336 p_(0, 1) = r_2 / 4. * (-
exp1_);
338 p_(0, 3) = r_2 / 4. * (-
exp1_);
341 p_(1, 0) = r_2 / 4. * (-
exp1_);
343 p_(1, 2) = r_2 / 4. * (-
exp1_);
348 p_(2, 1) = r_2 / 4. * (-
exp1_);
350 p_(2, 3) = r_2 / 4. * (-
exp1_);
353 p_(3, 0) = r_2 / 4. * (-
exp1_);
355 p_(3, 2) = r_2 / 4. * (-
exp1_);
void addParameter_(Parameter *parameter)
double getParameterValue(const std::string &name) const override
Specialisation abstract class for reversible nucleotide substitution model.
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 bool isScalable() const
returns if model is scalable
RowMatrix< double > rightEigenVectors_
The matrix made of right eigen vectors (by column).
void setScale(double scale)
Multiplies the current generator by the given scale.
Vdouble freq_
The vector of equilibrium frequencies.
double rate_
The rate of the model (default: 1). The generator (and all its vectorial components) is independent o...
This class implements a state map where all resolved states are modeled.
const Matrix< double > & getd2Pij_dt2(double d) const override
K80(std::shared_ptr< const NucleicAlphabet > alpha, double kappa=1.)
double d2Pij_dt2(size_t i, size_t j, double d) const override
double dPij_dt(size_t i, size_t j, double d) const override
double Pij_t(size_t i, size_t j, double d) const override
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 > & getdPij_dt(double d) const override
static const std::shared_ptr< IntervalConstraint > R_PLUS_STAR
Defines the basic types of data flow nodes.
ExtendedFloat exp(const ExtendedFloat &ef)