11 using namespace numeric;
15 MixtureProcessPhyloLikelihood::MixtureProcessPhyloLikelihood(
16 std::shared_ptr<const AlignmentDataInterface> data,
17 std::shared_ptr<MixtureSequenceEvolution> processSeqEvol,
18 std::shared_ptr<CollectionNodes> collNodes,
25 data->getNumberOfSites(),
26 (processSeqEvol->getSubstitutionProcessNumbers().size() != 0)
27 ? processSeqEvol->substitutionProcess(processSeqEvol->getSubstitutionProcessNumbers()[0]).getNumberOfStates()
33 mSeqEvol_(processSeqEvol),
37 throw Exception(
"MixtureProcessPhyloLikelihood::MixtureProcessPhyloLikelihood : empty singleprocesslikelihoods set.");
42 const auto& param = simplex.getParameters();
45 for (
size_t i = 0; i < param.size(); i++)
53 simplex_ = ConfiguredParametrizable::createConfigured<Simplex, ConfiguredSimplex>(
context(), simplex, paramList,
"");
62 auto fsf = ConfiguredParametrizable::createRowVector<ConfiguredSimplex, FrequenciesFromSimplex, Eigen::RowVectorXd>(
context(), {
simplex_},
RowVectorDimension (Eigen::Index(simplex.dimension())));
65 std::vector<std::shared_ptr<Node_DF>> vSL;
69 vSL.push_back(lik->getSiteLikelihoods(
true));
76 auto nbSite = single0->getNumberOfDistinctSites();
80 likCal_->setSiteLikelihoods(sL,
true);
83 likCal_->setSiteLikelihoods(single0->expandVector(sL),
false);
100 const auto& freq =
simplex_->targetValue()->getFrequencies();
102 for (
size_t i = 0; i <
nbSites_; ++i)
104 for (
size_t j = 0; j < nbProcess; ++j)
106 pb[i][j] = pb[i][j] * freq[j] /
convert(l[i]);
VDataLik getLikelihoodPerSite() const
Get the likelihood for each site.
virtual void shareParameters_(const ParameterList ¶meters)
const Context & context() const override
std::shared_ptr< AlignedLikelihoodCalculation > likCal_
std::shared_ptr< ConfiguredSimplex > simplex_
std::shared_ptr< MixtureSequenceEvolution > mSeqEvol_
to avoid the dynamic casts
VVdouble getPosteriorProbabilitiesPerSitePerProcess() const override
return the posterior probabilities of subprocess on each site.
Partial implementation of the Likelihood interface for multiple processes.
std::vector< std::shared_ptr< LikelihoodCalculationSingleProcess > > vLikCal_
size_t getNumberOfSubstitutionProcess() const
Return the number of process used for computation.
VVdouble getLikelihoodPerSitePerProcess() const
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)
static ValueRef< DataLik > create(Context &c, NodeRefVec &&deps, const Dimension< F > &mDim)
Build a new SumOfLogarithms node with the given input matrix dimensions.
Defines the basic types of data flow nodes.
double convert(const bpp::ExtendedFloat &ef)
std::vector< Vdouble > VVdouble