-/* mvr.c 2011-10-11 */
+/* mvr.c 2012-05-02 */
-/* Copyright 2011 Andrei-Alin Popescu */
+/* Copyright 2011-2012 Andrei-Alin Popescu */
/* This file is part of the R-package `ape'. */
/* See the file ../COPYING for licensing issues. */
}
}
- /*Rprintf("agglomerating %i and %i, Q=%f \n",OTU1,OTU2,smallest_S);
+ //Rprintf("agglomerating %i and %i, Q=%f \n",OTU1,OTU2,smallest_S);
- for(i=1;i<n;i++)
+ /*for(i=1;i<n;i++)
{
for(j=i+1;j<=n;j++)
{
edge_length[k]=D[give_index(OTU1,OTU2,n)]/2 + eLenSum;
eLenSum=0;
- for(i=1;i<=n;i++)
+ /*for(i=1;i<=n;i++)
{
if(i == OTU1 || i==OTU2)continue;
double wi=miu/(v[give_index(i,OTU1,n)]+v[give_index(i,OTU2,n)]);
eLenSum+=wi*(D[give_index(i,OTU2,n)]-D[give_index(i,OTU1,n)]);
- }
+ }*/
- edge_length[k+1]=D[give_index(OTU1,OTU2,n)]/2 + eLenSum;
+ edge_length[k+1]=D[give_index(OTU1,OTU2,n)] - edge_length[k];
A = D[smallest];
ij = 0;
double xi = D[give_index(i, OTU1, n)]; /* dist between OTU1 and i */
double yi = D[give_index(i, OTU2, n)]; /* dist between OTU2 and i */
double lamb=v[give_index(i,OTU2,n)]/(v[give_index(i,OTU2,n)]+v[give_index(i,OTU1,n)]);
- new_dist[ij] = lamb*(xi-edge_length[k])+(1-lamb)*(yi-edge_length[k]);
+ new_dist[ij] = lamb*(xi-edge_length[k])+(1-lamb)*(yi-edge_length[k+1]);
new_v[ij]=(v[give_index(i,OTU2,n)]*v[give_index(i,OTU1,n)])/(v[give_index(i,OTU2,n)]+v[give_index(i,OTU1,n)]);
ij++;
}
edge_length[*N*2 - 5] = (D[0] + D[2] - D[1])/2;
edge_length[*N*2 - 6] = (D[2] + D[1] - D[0])/2;
}
-