50 double wf(
double lambda,
double D_LR,
double D_LU,
double D_LD,
51 double D_RU,
double D_RD,
double D_DU);
59 if (
T->root ==
f->tail)
71 (
g->bottomsize*
A[
f->head->index][
g->head->index]
78 g =
f->tail->parentEdge;
95 A = (
double **)
malloc(
T->size*
sizeof(
double *));
96 for(
i = 0;
i <
T->size;
i++)
98 A[
i] = (
double *)
malloc(
T->size*
sizeof(
double));
99 for(j=0;j<
T->size;j++)
106 double wf2(
double lambda,
double D_AD,
double D_BC,
double D_AC,
double D_BD,
107 double D_AB,
double D_CD)
120 double D_LR, D_LU, D_LD, D_RD, D_RU, D_DU;
132 lambda[0] = ((double)
b*c +
a*d)/((
a +
b)*(c+d));
133 lambda[1] = ((double)
b*c +
a*d)/((
a + c)*(
b+d));
134 lambda[2] = ((double) c*d +
a*
b)/((
a + d)*(
b+c));
143 w0 =
wf2(
lambda[0],D_RU,D_LD,D_LU,D_RD,D_DU,D_LR);
144 w1 =
wf2(
lambda[1],D_RU,D_LD,D_DU,D_LR,D_LU,D_RD);
145 w2 =
wf2(
lambda[2],D_DU,D_LR,D_LU,D_RD,D_RU,D_LD);
159 printf(
"Swap across %s. ",e->
label);
160 printf(
"Weight dropping by %lf.\n",w0 - w2);
161 printf(
"New weight should be %lf.\n",
T->weight + w2 - w0);
171 printf(
"Swap across %s. ",e->
label);
172 printf(
"Weight dropping by %lf.\n",w0 - w2);
173 printf(
"New weight should be %lf.\n",
T->weight + w2 - w0);
182 printf(
"Swap across %s. ",e->
label);
183 printf(
"Weight dropping by %lf.\n",w0 - w1);
184 printf(
"New weight should be %lf.\n",
T->weight + w1 - w0);
224 while (
swap != elooper)
242 elooper =
T->root->leftEdge;
243 while ((elooper !=
swap) && (elooper != e))
256 while (
NULL != elooper)
275 printf(
"Branch swap across meEdge %s.\n",e->
label);
277 if (
LEFT == direction)
287 printf(
"Branch swap: switching edges %s and %s.\n",skew->
label,
swap->label);
295 if (
LEFT == direction)
313 void pushHeap(
int *p,
int *q,
double *v,
int length,
int i);
314 void popHeap(
int *p,
int *q,
double *v,
int length,
int i);
318 double *weights,
int *
location,
int *possibleSwaps)
340 int makeThreshHeap(
int *p,
int *q,
double *v,
int arraySize,
double thresh);
355 weights = (
double *)
malloc((
T->size+1)*
sizeof(double));
357 for (
i=0;
i<
T->size+1;
i++)
383 while (weights[p[1]] < -1e-8)
385 centerEdge = edgeArray[p[1]];
387 T->weight =
T->weight + weights[p[1]];
392 popHeap(p,q,weights,possibleSwaps--,1);
411 double **avgDistArray;
413 NNI(
T,avgDistArray,count);
meEdge * findBottomLeft(meEdge *e)
meEdge * siblingEdge(meEdge *e)
void NNItopSwitch(meTree *T, meEdge *e, int direction, double **A)
double ** buildAveragesTable(meTree *T, double **D)
void NNI(meTree *T, double **avgDistArray, int *count)
void pushHeap(int *p, int *q, double *v, int length, int i)
void NNIwithoutMatrix(meTree *T, double **D, int *count)
void reHeapElement(int *p, int *q, double *v, int length, int i)
int NNIEdgeTest(meEdge *e, meTree *T, double **A, double *weight)
int makeThreshHeap(int *p, int *q, double *v, int arraySize, double thresh)
meEdge * moveUpRight(meEdge *e)
double wf2(double lambda, double D_AD, double D_BC, double D_AC, double D_BD, double D_AB, double D_CD)
void NNIRetestEdge(int *p, int *q, meEdge *e, meTree *T, double **avgDistArray, double *weights, int *location, int *possibleSwaps)
double wf(double lambda, double D_LR, double D_LU, double D_LD, double D_RU, double D_RD, double D_DU)
void popHeap(int *p, int *q, double *v, int length, int i)
meEdge * depthFirstTraverse(meTree *T, meEdge *e)
meEdge * topFirstTraverse(meTree *T, meEdge *e)
void makeOLSAveragesTable(meTree *T, double **D, double **A)
void permInverse(int *p, int *q, int length)
void NNIWithPartialMatrix(meTree *T, double **D, double **A, int *count)
void fillTableUp(meEdge *e, meEdge *f, double **A, double **D, meTree *T)
void NNIupdateAverages(double **A, meEdge *e, meEdge *par, meEdge *skew, meEdge *swap, meEdge *fixed, meTree *T)
static const char location[]
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
unsigned int
A callback function used to compare two keys in a database.
while(yy_chk[yy_base[yy_current_state]+yy_c] !=yy_current_state)
const struct ncbi::grid::netcache::search::fields::SIZE size
double lambda(size_t dimMatrix_, const Int4 *const *scoreMatrix_, const double *q_)
double f(double x_, const double &y_)
struct meEdge * rightEdge
struct meEdge * parentEdge
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)