本文整理汇总了C++中revbayescore::TypedDagNode类的典型用法代码示例。如果您正苦于以下问题:C++ TypedDagNode类的具体用法?C++ TypedDagNode怎么用?C++ TypedDagNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TypedDagNode类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: createDistribution
RevBayesCore::InverseWishartDistribution* Dist_inverseWishart::createDistribution( void ) const {
// get the parameters
RevBayesCore::TypedDagNode<RevBayesCore::MatrixRealSymmetric>* sg = static_cast<const RealSymmetricMatrix &>( sigma->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<std::vector<double> >* dv = static_cast<const ModelVector<RealPos> &>( diagonal->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<double>* ka = static_cast<const RealPos&>( kappa->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<int>* deg = static_cast<const Natural &>( df->getRevObject()).getDagNode();
RevBayesCore::TypedDagNode<int>* dm = static_cast<const Natural &>( dim->getRevObject()).getDagNode();
RevBayesCore::InverseWishartDistribution* w = 0;
if (! sg->getValue().isNull()) {
// parameter is sigma
w = new RevBayesCore::InverseWishartDistribution( sg, deg );
}
else if (dm->getValue() == 0) {
// parameter is Diagonal(kappaVector))
w = new RevBayesCore::InverseWishartDistribution( dv, deg );
}
else {
// parameter is kappa * Id
w = new RevBayesCore::InverseWishartDistribution( dm, ka, deg );
}
return w;
}
开发者ID:vivianaayus,项目名称:revbayes,代码行数:25,代码来源:Dist_inverseWishart.cpp
示例2: constructInternalObject
void Move_ElementSlide::constructInternalObject( void ) {
// we free the memory first
delete value;
// now allocate a new vector-slide move
double l = static_cast<const RealPos &>( delta->getRevObject() ).getValue();
double w = static_cast<const RealPos &>( weight->getRevObject() ).getValue();
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* tmp = static_cast<const ModelVector<RealPos> &>( x->getRevObject() ).getDagNode();
std::set<const RevBayesCore::DagNode*> p = tmp->getParents();
std::vector< RevBayesCore::StochasticNode<double> *> n;
for (std::set<const RevBayesCore::DagNode*>::const_iterator it = p.begin(); it != p.end(); ++it)
{
const RevBayesCore::StochasticNode<double> *theNode = dynamic_cast< const RevBayesCore::StochasticNode<double>* >( *it );
if ( theNode != NULL )
{
n.push_back( const_cast< RevBayesCore::StochasticNode<double>* >( theNode ) );
}
else
{
throw RbException("Could not create a mvElementSlide because the node isn't a vector of stochastic nodes.");
}
}
bool t = static_cast<const RlBoolean &>( tune->getRevObject() ).getValue();
RevBayesCore::Proposal *prop = new RevBayesCore::ElementSlideProposal(n,l);
value = new RevBayesCore::MetropolisHastingsMove(prop,w,t);
}
开发者ID:wrightaprilm,项目名称:revbayes,代码行数:28,代码来源:Move_ElementSlide.cpp
示例3: RevVariable
/* Map calls to member methods */
RevLanguage::RevPtr<RevVariable> MultivariateRealNodeValTree::executeMethod(std::string const &name, const std::vector<Argument> &args, bool &found)
{
if (name == "newick")
{
found = true;
RevBayesCore::TypedDagNode< int >* k = static_cast<const Integer &>( args[0].getVariable()->getRevObject() ).getDagNode();
std::string newick = this->dagNode->getValue().getNewick(k->getValue());
return new RevVariable( new RlString( newick ) );
}
else if ( name == "clampAt" )
{
found = true;
RevBayesCore::TypedDagNode< RevBayesCore::ContinuousCharacterData >* data = static_cast<const ContinuousCharacterData &>( args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode< int >* k = static_cast<const Integer &>( args[1].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode< int >* l = static_cast<const Integer &>( args[2].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::ContinuousCharacterData* c = & data->getValue();
this->dagNode->getValue().clampAt(c, k->getValue(), l->getValue());
return new RevVariable( new Real( 0 ) );
}
return ModelObject<RevBayesCore::MultivariateRealNodeContainer>::executeMethod( name, args, found );
}
开发者ID:hscarter,项目名称:revbayes,代码行数:27,代码来源:RlMultivariateRealNodeValTree.cpp
示例4: Variable
/* Map calls to member methods */
RevLanguage::RevPtr<Variable> RealNodeValTree::executeMethod(std::string const &name, const std::vector<Argument> &args) {
if ( name == "clampAt" )
{
RevBayesCore::TypedDagNode< RevBayesCore::AbstractCharacterData >* data = static_cast<const AbstractCharacterData &>( args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode< int >* k = static_cast<const Integer &>( args[1].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::AbstractCharacterData* d = & data->getValue();
RevBayesCore::ContinuousCharacterData* c = static_cast<RevBayesCore::ContinuousCharacterData*>(d);
this->dagNode->getValue().clampAt(c, k->getValue());
return new Variable( new Real( 0 ) );
}
return ModelObject<RevBayesCore::RealNodeContainer>::executeMethod( name, args );
}
开发者ID:SylerWang,项目名称:RevBayes,代码行数:16,代码来源:RlRealNodeValTree.cpp
示例5: RbException
RevBayesCore::TypedFunction< RevBayesCore::RateGenerator >* Func_gtr::createFunction( void ) const
{
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* er = static_cast<const Simplex &>( this->args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* bf = static_cast<const Simplex &>( this->args[1].getVariable()->getRevObject() ).getDagNode();
if ( er->getValue().size() != (bf->getValue().size() * (bf->getValue().size()-1) / 2.0) )
{
throw RbException("The dimension betwee the base frequencies and the substitution rates does not match.");
}
RevBayesCore::GtrRateMatrixFunction* f = new RevBayesCore::GtrRateMatrixFunction( er, bf );
return f;
}
开发者ID:wrightaprilm,项目名称:revbayes,代码行数:15,代码来源:Func_gtr.cpp
示例6: RbException
RevBayesCore::TypedFunction< RevBayesCore::RateGenerator >* Func_epoch::createFunction( void ) const
{
RevBayesCore::TypedDagNode< RevBayesCore::RbVector<RevBayesCore::RateGenerator> >* rm = static_cast<const ModelVector<RateGenerator> &>( this->args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* t = static_cast<const ModelVector<RealPos> &>( this->args[1].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* r = static_cast<const ModelVector<RealPos> &>( this->args[2].getVariable()->getRevObject() ).getDagNode();
// sanity check
if ( t->getValue().size() != rm->getValue().size() )
{
throw RbException( "The number of rate matrices and epochs do not match" );
}
RevBayesCore::EpochRateMatrixFunction* f = new RevBayesCore::EpochRateMatrixFunction( rm, t, r );
return f;
}
开发者ID:wrightaprilm,项目名称:revbayes,代码行数:17,代码来源:Func_epoch.cpp
示例7:
RevBayesCore::TypedFunction< double >* Func_WattersonTheta::createFunction( void ) const
{
RevBayesCore::TypedDagNode<RevBayesCore::AbstractHomologousDiscreteCharacterData >* d = static_cast<const AbstractHomologousDiscreteCharacterData &>( this->args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<RevBayesCore::Boolean >* ps = static_cast<const RlBoolean &>( this->args[1].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::WattersonThetaFunction* f = new RevBayesCore::WattersonThetaFunction( d, ps->getValue() );
return f;
}
开发者ID:hscarter,项目名称:revbayes,代码行数:9,代码来源:Func_WattersonTheta.cpp
示例8:
RevBayesCore::TypedFunction< RevBayesCore::RbVector<double> >* Func_DECRoot::createFunction( void ) const
{
RevBayesCore::TypedDagNode< RevBayesCore::RbVector<double> >* rf = static_cast<const ModelVector<RealPos> &>( this->args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* rs = NULL;
if ( this->args[1].getVariable() != NULL && this->args[1].getVariable()->getRevObject() != RevNullObject::getInstance()) {
rs = static_cast<const Simplex&>( this->args[1].getVariable()->getRevObject() ).getDagNode();
}
else {
size_t n = log2(rf->getValue().size()) + 1;
double p = 1.0 / n;
rs = new RevBayesCore::ConstantNode<RevBayesCore::RbVector<double> >("", new RevBayesCore::RbVector<double>(n,p));
}
// RevBayesCore::TypedDagNode<int>* mrs = static_cast<const Natural&>( this->args[2].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::DispersalExtinctionRootStructureFunction* f = new RevBayesCore::DispersalExtinctionRootStructureFunction( rf,rs );
return f;
}
开发者ID:wrightaprilm,项目名称:revbayes,代码行数:21,代码来源:Func_DECRoot.cpp
示例9: RevVariable
RevPtr<RevVariable> Func_pomoStateConverter::execute() {
const RevBayesCore::TypedDagNode<RevBayesCore::AbstractDiscreteCharacterData>* aln = static_cast<const AbstractDiscreteCharacterData&>( this->args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode< int >* n = static_cast<const Natural &>( this->args[1].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::PomoStateConverter* c = new RevBayesCore::PomoStateConverter( );
RevBayesCore::TypedDagNode< RevBayesCore::RbVector<RevBayesCore::Taxon> >* taxa = static_cast< const ModelVector<Taxon> &>( this->args[2].getVariable()->getRevObject() ).getDagNode();
std::map <std::string, std::string > gene2species;
for (RevBayesCore::RbIterator<RevBayesCore::Taxon> it=taxa->getValue().begin(); it!=taxa->getValue().end(); ++it)
{
gene2species[it->getName()] = it->getSpeciesName();
}
AbstractDiscreteCharacterData PomoAln = c->convertData( aln->getValue(), n->getValue(), gene2species ) ;
return new RevVariable( new AbstractDiscreteCharacterData( PomoAln ) );
}
开发者ID:wrightaprilm,项目名称:revbayes,代码行数:22,代码来源:Func_pomoStateConverter.cpp
示例10: RbException
RevBayesCore::TypedFunction< RevBayesCore::MatrixReal >* Func_varianceCovarianceMatrix::createFunction(void) const {
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* sd = static_cast<const ModelVector<RealPos>& >( this->args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* ce = static_cast<const ModelVector<Real>& >( this->args[1].getVariable()->getRevObject() ).getDagNode();
if ( sd->getValue().size() != (ce->getValue().size() * (ce->getValue().size()-1) / 2.0) )
{
throw RbException("The dimension between the standard deviations and the correlation coefficients does not match.");
}
for (int i=0; i<ce->getValue().size(); i++)
{
if ( ce->getValue()[i] < -1.0 || ce->getValue()[i] > 1.0)
{
throw RbException("A correlation coefficient is out-of-bounds (-1,+1).");
}
}
RevBayesCore::VarianceCovarianceFunction* f = new RevBayesCore::VarianceCovarianceFunction( sd, ce );
return f;
}
开发者ID:wrightaprilm,项目名称:revbayes,代码行数:18,代码来源:Func_varianceCovarianceMatrix.cpp
示例11: RbException
RevBayesCore::TypedFunction< RevBayesCore::RateGenerator >* Func_DECRateMatrix::createFunction( void ) const
{
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<RevBayesCore::RbVector<double> > >* dr;
dr = static_cast<const ModelVector<ModelVector<RealPos> > &>( this->args[0].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* er;
er = static_cast<const ModelVector<RealPos> &>( this->args[1].getVariable()->getRevObject() ).getDagNode();
size_t numStatesEr = er->getValue().size();
std::vector<size_t> numStatesDr;
for (size_t i = 0; i < dr->getValue().size(); i++)
{
numStatesDr.push_back( dr->getValue()[i].size() );
if (numStatesDr[i] != numStatesEr)
{
throw RbException("The dimension between dispersal and extirpation rates does not match.");
}
for (size_t j = 0; j < i; j++)
{
if (numStatesDr[i] != numStatesDr[j])
{
throw RbException("The dispersal matrix is not square.");
}
}
}
if (dr->getValue().size() != numStatesEr)
{
throw RbException("The dimension between dispersal and extirpation rates does not match.");
}
RevBayesCore::TypedDagNode<RevBayesCore::RbVector<double> >* rs = NULL;
if ( this->args[2].getVariable() != NULL && this->args[2].getVariable()->getRevObject() != RevNullObject::getInstance()) {
rs = static_cast<const Simplex&>( this->args[2].getVariable()->getRevObject() ).getDagNode();
}
else {
size_t n = numStatesEr+1;
double p = 1.0 / n;
rs = new RevBayesCore::ConstantNode<RevBayesCore::RbVector<double> >("", new RevBayesCore::RbVector<double>(n,p));
}
// RevBayesCore::TypedDagNode<int>* mrs = static_cast<const Natural&>( this->args[3].getVariable()->getRevObject() ).getDagNode();
RevBayesCore::DECRateMatrixFunction* f = new RevBayesCore::DECRateMatrixFunction( dr, er, rs );
return f;
}
开发者ID:wrightaprilm,项目名称:revbayes,代码行数:45,代码来源:Func_DECRateMatrix.cpp
注:本文中的revbayescore::TypedDagNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论