46 #include <Bpp/Numeric/Matrix/MatrixTools.h> 47 #include <Bpp/Numeric/VectorTools.h> 48 #include <Bpp/Numeric/Matrix/EigenValue.h> 53 AbstractParameterAliasable(
"gBGC."),
56 nestedPrefix_(pm->getNamespace()),
60 model_->enableEigenDecomposition(0);
61 addParameters_(
model_->getParameters());
62 addParameter_(
new Parameter(
"gBGC.gamma",
gamma_,
new IntervalConstraint(-999, 10,
true,
true),
true));
68 AbstractParameterAliasable(gbgc),
70 model_(gbgc.model_->clone()),
71 nestedPrefix_(gbgc.nestedPrefix_),
78 AbstractParameterAliasable::operator=(gbgc);
80 model_ = auto_ptr<NucleotideSubstitutionModel>(gbgc.
model_.get());
89 model_->matchParametersValues(parameters);
95 gamma_=getParameterValue(
"gamma");
100 for ( i = 0; i < 4; i++)
101 for ( j = 0; j < 4; j++)
141 size_t nulleigen = 0;
145 while (nulleigen < 4){
173 for (i = 0; i < 4; i++)
177 for (i = 0; i < 4; i++)
180 for (i = 0; i < 4; i++)
185 ApplicationTools::displayMessage(
"Unable to find eigenvector for eigenvalue 1 in gBGC. Taylor series used instead.");
190 catch (ZeroDivisionException& e)
192 ApplicationTools::displayMessage(
"Singularity during diagonalization of gBGC in gBGC. Taylor series used instead.");
200 for (i = 1; i < 4; i++)
211 MatrixTools::getId(4,
tmpMat_);
215 for (i = 0; i < 4; i++)
224 for (i = 0; i < 4; i++)
228 for (i = 0; i < 4; i++)
243 AbstractSubstitutionModel::setNamespace(prefix);
void updateMatrices()
Diagonalize the matrix, and fill the eigenValues_, iEigenValues_, leftEigenVectors_ and rightEigenVe...
bool enableEigenDecomposition()
Tell if eigenValues and Vectors must be computed.
virtual void fireParameterChanged(const ParameterList ¶meters)
Tells the model that a parameter value has changed.
void fireParameterChanged(const ParameterList &)
Tells the model that a parameter value has changed.
bool isNonSingular_
boolean value for non-singularity of rightEigenVectors_
This class implements a state map where all resolved states are modeled.
RowMatrix< double > rightEigenVectors_
The matrix made of right eigen vectors (by column).
Vdouble eigenValues_
The vector of eigen values.
std::auto_ptr< NucleotideSubstitutionModel > model_
Vdouble freq_
The vector of equilibrium frequencies.
AbstractSubstitutionModel & operator=(const AbstractSubstitutionModel &model)
Partial implementation of the SubstitutionModel interface.
gBGC & operator=(const gBGC &gbgc)
RowMatrix< double > leftEigenVectors_
The matrix made of left eigen vectors (by row) if rightEigenVectors_ is non-singular.
RowMatrix< double > generator_
The generator matrix of the model.
std::vector< RowMatrix< double > > vPowGen_
vector of the powers of generator_ for Taylor development (if rightEigenVectors_ is singular)...
Specialisation interface for nucleotide substitution model.
std::string nestedPrefix_
std::string getName() const
Get the name of the model.
RowMatrix< double > tmpMat_
For computational issues.
gBGC(const NucleicAlphabet *, NucleotideSubstitutionModel *const, double gamma=0)
bool isDiagonalizable_
boolean value for diagonalizability in R of the generator_
Vdouble iEigenValues_
The vector of the imaginary part of the eigen values.
void setNamespace(const std::string &)