16 std::shared_ptr<HmmStateAlphabet> hiddenAlphabet,
17 std::shared_ptr<HmmTransitionMatrix> transitionMatrix,
18 std::shared_ptr<HmmPhyloEmissionProbabilities> emissionProbabilities,
19 const std::string& prefix) :
22 hiddenAlphabet_(hiddenAlphabet),
23 emissionProbabilities_(emissionProbabilities),
35 throw Exception(
"HmmLikelihood_DF: null pointer passed for HmmStateAlphabet.");
36 if (!transitionMatrix)
37 throw Exception(
"HmmLikelihood_DF: null pointer passed for HmmTransitionMatrix.");
38 if (!emissionProbabilities)
39 throw Exception(
"HmmLikelihood_DF: null pointer passed for HmmEmissionProbabilities.");
47 if (transitionMatrix->getNumberOfStates() !=
size_t(
nbStates_))
48 throw BadSizeException(
"HmmLikelihood_DF: HmmStateAlphabet and HmmTransitionMatrix do not have the same number of states.", transitionMatrix->getNumberOfStates(),
size_t(
nbStates_));
55 const auto& param = transitionMatrix->getParameters();
58 for (
size_t i = 0; i < param.size(); i++)
66 matrix_ = ConfiguredParametrizable::createConfigured<HmmTransitionMatrix, ConfiguredTransitionMatrix>(
context_, *transitionMatrix, paramList,
"");
72 matrix_->config.delta = deltaNode;
79 hmmEq_ = ConfiguredParametrizable::createVector<ConfiguredTransitionMatrix, EquilibriumFrequenciesFromTransitionMatrix, Eigen::VectorXd>(
context_, {
matrix_}, eqdim);
84 hmmTrans_ = ConfiguredParametrizable::createMatrix<ConfiguredTransitionMatrix, TransitionMatrixFromTransitionMatrix, Eigen::MatrixXd>(
context_, {
matrix_}, transdim);
105 auto forwardNode = dynamic_pointer_cast<ForwardHmmLikelihood_DF>(
forwardLik_);
121 matrix_->setNamespace(nameSpace);
void addParameters_(const ParameterList ¶meters)
void shareParameters_(const ParameterList ¶meters)
void setNamespace(const std::string &prefix) override
void setSiteLikelihoods(SiteLikelihoodsRef ll, bool shrunk=false)
static ValueRef< Eigen::MatrixXd > create(Context &c, NodeRefVec &&deps, const Dimension< Eigen::MatrixXd > &dim)
Context for dataflow node construction.
static ValueRef< RowLik > create(Context &c, NodeRefVec &&deps, const Dimension< Eigen::MatrixXd > &dim)
ValueRef< Eigen::MatrixXd > hmmTrans_
void setNamespace(const std::string &nameSpace)
HmmLikelihood_DF(Context &context, std::shared_ptr< HmmStateAlphabet > hiddenAlphabet, std::shared_ptr< HmmTransitionMatrix > transitionMatrix, std::shared_ptr< HmmPhyloEmissionProbabilities > emissionProbabilities, const std::string &prefix="")
Build a new HmmLikelihood_DF object.
ValueRef< RowLik > forwardLik_
std::shared_ptr< HmmStateAlphabet > hiddenAlphabet_
The alphabet describing the hidden states.
std::shared_ptr< HmmPhyloEmissionProbabilities > emissionProbabilities_
ValueRef< MatrixLik > hmmEmis_
ValueRef< Eigen::MatrixXd > hiddenPostProb_
ValueRef< Eigen::MatrixXd > backwardLik_
std::shared_ptr< ConfiguredTransitionMatrix > matrix_
ValueRef< Eigen::VectorXd > hmmEq_
void setLikelihoodNode(ValueRef< DataLik > ll)
static std::shared_ptr< Self > create(Context &, Args &&... args)
Build a new NumericMutable node with T(args...) value.
virtual void shareParameter(const std::shared_ptr< Parameter > ¶m)
Defines the basic types of data flow nodes.
Basic matrix dimension type.