18 std::shared_ptr<PhyloLikelihoodContainer> pC,
19 const std::string& formula,
25 likCal_(make_shared<LikelihoodCalculation>(context))
27 readFormula(formula, inCollection);
28 likCal_->setLikelihoodNode(makeLikelihoods());
38 map<string, shared_ptr<FunctionInterface>> functionNames;
40 const vector<size_t>& nPhyl =
getPhyloContainer()->getNumbersOfPhyloLikelihoods();
42 for (
size_t i = 0; i < nPhyl.size(); i++)
47 compTree_ = make_unique<ComputationTree>(formula, functionNames);
56 vector<size_t> phyldep;
61 size_t np = (size_t)(atoi(ex.c_str()));
74 auto cst = dynamic_pointer_cast<ConstantOperator>(op);
78 auto neg = dynamic_pointer_cast<NegativeOperator>(op);
85 auto bin = dynamic_pointer_cast<BinaryOperator>(op);
91 switch (bin->getSymbol())
109 auto mat = dynamic_pointer_cast<MathOperator>(op);
113 auto name = mat->getName();
116 else if (name ==
"log")
119 throw Exception(
"PhyloLikelihoodFormula::Makelikelihoodsfromoperator : unknown function " + name +
". Ask developers.");
123 auto func = dynamic_pointer_cast<FunctionOperator<SecondOrderDerivable>>(op);
126 auto name = func->getName();
127 if (name.substr(0, 5) ==
"phylo")
132 return phyl->getLikelihoodNode();
136 throw Exception(
"PhyloLikelihoodFormula::makeLikelihoodsFromOperator : Unknown operator: " + op->output());
virtual void shareParameters_(const ParameterList ¶meters)
The PhyloLikelihoodSet class, to manage a subset of PhyloLikelihoods from a given PhyloLikelihoodCont...
bool hasPhyloLikelihood(size_t nPhyl) override
std::shared_ptr< const PhyloLikelihoodInterface > getPhyloLikelihood(size_t nPhyl) const override
std::shared_ptr< PhyloLikelihoodContainer > getPhyloContainer() override
virtual bool addPhyloLikelihood(size_t nPhyl, const std::string &suff="") override
adds a PhyloLikelihood already stored in the PhyloLikelihoodContainer, iff it is an AbstractPhyloLike...
static ValueRef< T > create(Context &c, NodeRefVec &&deps, const Dimension< T > &dim)
Build a new CWiseExp node with the given output dimensions.
static ValueRef< T > create(Context &c, NodeRefVec &&deps, const Dimension< T > &dim)
Build a new CWiseInverse node with the given output dimensions.
static ValueRef< T > create(Context &c, NodeRefVec &&deps, const Dimension< T > &dim)
Build a new CWiseLog node with the given output dimensions.
static ValueRef< T > create(Context &c, NodeRefVec &&deps, const Dimension< T > &dim)
Build a new CWiseNegate node with the given output dimensions.
Context for dataflow node construction.
static std::shared_ptr< Self > create(Context &c, Args &&... args)
Build a new NumericConstant node with T(args...) value.
const std::string & nextToken()
bool hasMoreToken() const
std::string toString(T t)
Defines the basic types of data flow nodes.
std::shared_ptr< Value< T > > ValueRef
Shared pointer alias for Value<T>.
Store a dimension for type T.