X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fmvr.c;h=829a839c1706efcdb0322c2e0b35543a12a65cd6;hb=06e83c6878153f8e7999c0470263c40aad4db258;hp=5f9fc0cd7e5b795758e2344a7b9b846275dea5fa;hpb=ef34642fe85694df0a80ef534137b8f6b427b67e;p=ape.git diff --git a/src/mvr.c b/src/mvr.c index 5f9fc0c..829a839 100644 --- a/src/mvr.c +++ b/src/mvr.c @@ -1,6 +1,6 @@ -/* mvr.c 2011-10-11 */ +/* mvr.c 2012-02-17 */ -/* 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. */ @@ -142,7 +142,7 @@ void mvr(double *D, double* v,int *N, int *edge1, int *edge2, double *edge_lengt 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++; }