19 model_ (model.model_->clone()),
20 stateMap_ (model.stateMap_),
21 nbStates_ (model.nbStates_),
22 nbRates_ (model.nbRates_),
23 rates_ (model.rates_),
24 ratesExchangeability_(model.ratesExchangeability_),
25 ratesFreq_ (model.ratesFreq_),
26 ratesGenerator_ (model.ratesGenerator_),
27 generator_ (model.generator_),
28 exchangeability_ (model.exchangeability_),
29 leftEigenVectors_ (model.leftEigenVectors_),
30 rightEigenVectors_ (model.rightEigenVectors_),
31 eigenValues_ (model.eigenValues_),
32 iEigenValues_ (model.iEigenValues_),
33 eigenDecompose_ (model.eigenDecompose_),
34 compFreq_ (model.compFreq_),
36 dpijt_ (model.dpijt_),
37 d2pijt_ (model.d2pijt_),
39 normalizeRateChanges_(model.normalizeRateChanges_),
40 nestedPrefix_ (model.nestedPrefix_)
46 AbstractParametrizable::operator=(model);
84 MatrixTools::MatrixTools::getId< RowMatrix<double>>(
nbStates_, Tmp1);
115 vector<double> modelEigenValues =
model_->getEigenValues();
117 for (
unsigned int i = 0; i <
nbStates_; i++)
125 for (
size_t j = 0; j <
nbRates_; j++)
130 for (
unsigned int ii = 0; ii <
nbRates_; ii++)
132 double vii = vectors(ii, j);
133 for (
unsigned int jj = 0; jj <
nbStates_; jj++)
189 if (state < 0 || !model_->
getAlphabet()->isIntInAlphabet(state))
190 throw BadIntException(state,
"MarkovModulatedSubstitutionModel::getInitValue. Character " +
model_->getAlphabet()->intToChar(state) +
" is not allowed in model.",
getAlphabet().get());
191 vector<int> states =
model_->getAlphabet()->getAlias(state);
192 for (
size_t j = 0; j < states.size(); j++)
void setNamespace(const std::string &prefix)
const RowMatrix< Real > & getV() const
const std::vector< Real > & getRealEigenValues() const
Partial implementation of the Markov-modulated class of substitution models.
RowMatrix< double > d2pijt_
virtual void updateMatrices_()
bool compFreq_
Tell if the equilibrium frequencies should be computed from the generator.
RowMatrix< double > rightEigenVectors_
The matrix made of right eigen vectors (by column).
double getInitValue(size_t i, int state) const override
bool isScalable() const override
returns if model is scalable
std::shared_ptr< const MarkovModulatedStateMap > stateMap_
std::unique_ptr< ReversibleSubstitutionModelInterface > model_
void setScale(double scale) override
Multiplies the current generator by the given scale.
const Matrix< double > & getdPij_dt(double t) const override
RowMatrix< double > dpijt_
MarkovModulatedSubstitutionModel & operator=(const MarkovModulatedSubstitutionModel &model)
const Matrix< double > & getPij_t(double t) const override
bool normalizeRateChanges_
int getAlphabetStateAsInt(size_t index) const override
Vdouble iEigenValues_
The vector of imaginary parts of the eigen values (zero in case of reversible pmodel).
std::shared_ptr< const Alphabet > getAlphabet() const override
MarkovModulatedSubstitutionModel(std::unique_ptr< ReversibleSubstitutionModelInterface > model, unsigned int nbRates, bool normalizeRateChanges, const std::string &prefix)
Build a new MarkovModulatedSubstitutionModel object.
RowMatrix< double > ratesExchangeability_
RowMatrix< double > pijt_
These ones are for bookkeeping:
const Matrix< double > & getd2Pij_dt2(double t) const override
std::string nestedPrefix_
RowMatrix< double > ratesGenerator_
double getScale() const override
Get the scalar product of diagonal elements of the generator and the frequencies vector....
RowMatrix< double > exchangeability_
The exchangeability matrix of the model.
Vdouble freq_
The vector of equilibrium frequencies.
RowMatrix< double > generator_
The generator matrix of the model.
void setDiagonal() override
set the diagonal of the generator such that sum on each line equals 0.
bool eigenDecompose_
Tell if the eigen decomposition should be performed.
Vdouble eigenValues_
The vector of real parts of eigen values.
RowMatrix< double > rates_
RowMatrix< double > leftEigenVectors_
The matrix made of left eigen vectors (by row).
void setNamespace(const std::string &prefix) override
size_t getNumberOfStates() const override
Get the number of states.
size_t getNumberOfColumns() const
const std::vector< double > & getRow(size_t i) const
void resize(size_t nRows, size_t nCols)
Defines the basic types of data flow nodes.
std::vector< double > Vdouble