本文整理汇总了C++中InternalNode::getLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ InternalNode::getLeft方法的具体用法?C++ InternalNode::getLeft怎么用?C++ InternalNode::getLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InternalNode
的用法示例。
在下文中一共展示了InternalNode::getLeft方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
bool DendrogramTest::run()
{
context("triangle.pairs");
Graph *graph = new Graph("data/triangle.pairs");
Dendrogram *dendro = new Dendrogram(graph);
testcase(dendro != NULL, "Initialized Dendrogram is NULL!");
testcase(dendro->getRoot() != NULL, "Dendrogram has NULL root");
testcase(((InternalNode *)(dendro->getRoot()))->getLeft() != NULL, "Dendrogram root has NULL left child");
testcase(((InternalNode *)(dendro->getRoot()))->getRight() != NULL, "Dendrogram root has NULL right child");
for (NodeList::iterator iterator=dendro->nodes.begin(); iterator!=dendro->nodes.end(); iterator++) {
DendrogramNode *node = *iterator;
if (node != dendro->getRoot()) {
test_not_equal(node->parent,NULL,"Non-root node has NULL parent");
}
if (node->type == NODE_INTERNAL) {
InternalNode *internal = (InternalNode *)node;
if (internal->getLeft() != NULL) {
test_equal(internal, internal->getLeft()->parent, "Left child of X does not have X as parent");
}
if (internal->getRight() != NULL) {
test_equal(internal, internal->getRight()->parent, "Right child of X does not have X as parent");
}
}
}
delete dendro;
delete graph;
context("triangle.weights");
graph = new Graph("data/triangle.weights");
testcase(graph->isValid(), "failed to load valid graph from data/triangle.weights");
dendro = new Dendrogram(graph);
testcase(dendro != NULL, "Initialized Dendrogram is NULL!");
testcase(dendro->getRoot() != NULL, "Dendrogram has NULL root");
for (int i=0; i<100; i++) {
dendro->sample();
}
testcase(dendro->likelihood() < 0.0f, "Invalid likelihood for post-sampled dendrogram");
graph->addNode(99);
graph->addEdge(99,1,0.9);
std::set<Node> nodes_ab, nodes_z;
nodes_ab.insert(1);
nodes_ab.insert(2);
nodes_z.insert(99);
testcase(graph->linksBetween(nodes_ab,nodes_z) == 0.9, "Incorrect link weight between [A,B] , [Z]");
dendro->addLeaf(99,1);
testcase(graph->linksBetween(nodes_ab,nodes_z) == 0.9, "Incorrect link weight between [A,B] , [Z]");
return this->didPass();
}
示例2: processNode
virtual void processNode(InternalNode &u) {
int id=u.getID();
PhylogenyNode *left=u.getLeft(), *right=u.getRight();
NthOrdSubstMatrix &leftPt=*u.getLeftSubstMatrix();
NthOrdSubstMatrix &rightPt=*u.getRightSubstMatrix();
Array2D<double>::RowIn2DArray<double> row=L[id];
for(Symbol a=0 ; a<numAlpha ; ++a) {
row[a]=
processInternalChild(a,left,leftPt,&u)+
processInternalChild(a,right,rightPt,&u);
}
}
示例3: processNode
virtual void processNode(InternalNode &u)
{
int id=u.getID();
Array2D<double>::RowIn2DArray<double> row=L[id];
Taxon *taxon=static_cast<Taxon*>(u.getDecoration());
SubstitutionMatrix &leftPt=getMatrix(*taxon,LEFT);
SubstitutionMatrix &rightPt=getMatrix(*taxon,RIGHT);
int left=u.getLeft()->getID(), right=u.getRight()->getID();
for(Symbol a=0 ; a<numAlpha ; ++a)
if(a!=gap) row[a]=
processInternalChild(a,left,leftPt)+
processInternalChild(a,right,rightPt);
}
示例4: processNode
virtual void processNode(InternalNode &u) {
int id=u.getID();
int left=u.getLeft()->getID(), right=u.getRight()->getID();
NthOrdSubstMatrix &leftPt=*u.getLeftSubstMatrix();
NthOrdSubstMatrix &rightPt=*u.getRightSubstMatrix();
Array2D<double>::RowIn2DArray<double> row=L[id];
for(Symbol a=0 ; a<numAlpha ; ++a) {
if(gapSymbols.isMember(a)) continue;
row[a]=
processInternalChild(a,left,leftPt,0,0)+
processInternalChild(a,right,rightPt,0,0);
}
}
示例5: processNode
virtual void processNode(InternalNode &u) {
int id=u.getID();
Array2D<double>::RowIn2DArray<double> row=L[id];
int left=u.getLeft()->getID(), right=u.getRight()->getID();
NthOrdSubstMatrix &leftPt=*u.getLeftSubstMatrix();
NthOrdSubstMatrix &rightPt=*u.getRightSubstMatrix();
Sequence nmer;
for(int i=0 ; i<numNmers ; ++i) {
nmer.fromInt(i,numCols,alphabetMap);
row[i]=
processInternalChild(nmer,left,leftPt)+
processInternalChild(nmer,right,rightPt);
}
}
示例6: processNode
virtual void processNode(InternalNode &u) {
int id=u.getID();
NthOrdSubstMatrix &leftPt=*u.getLeftSubstMatrix();
NthOrdSubstMatrix &rightPt=*u.getRightSubstMatrix();
int left=u.getLeft()->getID(), right=u.getRight()->getID();
Array2D<double>::RowIn2DArray<double> row=L[id];
Symbol a=A.getIthTrack(id)[column];
if(gapSymbols.isMember(a))
for(a=0 ; a<numAlpha ; ++a) {
if(gapSymbols.isMember(a)) continue;
row[a]=
processInternalChild(a,id,left,leftPt)+
processInternalChild(a,id,right,rightPt);
}
else {
for(Symbol b=0 ; b<numAlpha ; ++b) row[b]=NEGATIVE_INFINITY;
double l=processInternalChild(a,id,left,leftPt);
double r=processInternalChild(a,id,right,rightPt);
row[a]=l+r;
}
}