本文整理汇总了C++中SequenceTree::distance方法的典型用法代码示例。如果您正苦于以下问题:C++ SequenceTree::distance方法的具体用法?C++ SequenceTree::distance怎么用?C++ SequenceTree::distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SequenceTree
的用法示例。
在下文中一共展示了SequenceTree::distance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
void count_pair_distances::operator()(const SequenceTree& T)
{
if (not initialized) {
N = T.n_leaves();
names = T.get_leaf_labels();
m1.resize(N*(N-1)/2);
m2.resize(N*(N-1)/2);
m1 = 0;
m2 = 0;
initialized = true;
}
n_samples++;
// Theoretically, we could do this much faster, I think.
// vector<vector<int> > leaf_sets = partition_sets(T);
int k=0;
for(int i=0;i<N;i++)
for(int j=0;j<i;j++,k++)
{
double D = 0;
if (RF)
D = T.edges_distance(i,j);
else
D = T.distance(i,j);
m1[k] += D;
m2[k] += D*D;
}
}
示例2: getSimilarity
Matrix getSimilarity(const SequenceTree& T,substitution::MultiModel& SM) {
int n = T.n_leaves();
Matrix S(n,n);
for(int i=0;i<n;i++)
for(int j=0;j<i;j++)
S(i,j) = S(j,i) = getSimilarity(T.distance(i,j),SM);
return S;
}