using System;
using System.Collections.Generic;
namespace Legalsoft.Truffer
{
public class Phylo_upgma : Phylagglom
{
public override void premin(double[,] d, int[] nextp)
{
}
public override double dminfn(double[,] d, int i, int j)
{
return d[i, j];
}
public override double dbranchfn(double[,] d, int i, int j)
{
return 0.5 * d[i, j];
}
public override double dnewfn(double[,] d, int k, int i, int j, int ni, int nj)
{
return (ni * d[i, k] + nj * d[j, k]) / (ni + nj);
}
public override void drootbranchfn(double[,] d, int i, int j, int ni, int nj, ref double bi, ref double bj)
{
bi = bj = 0.5 * d[i, j];
}
public Phylo_upgma(double[,] dist) : base(dist)
{
makethetree(dist);
}
}
}
using System;
using System.Collections.Generic;
namespace Legalsoft.Truffer
{
public class Phylo_upgma : Phylagglom
{
public override void premin(double[,] d, int[] nextp)
{
}
public override double dminfn(double[,] d, int i, int j)
{
return d[i, j];
}
public override double dbranchfn(double[,] d, int i, int j)
{
return 0.5 * d[i, j];
}
public override double dnewfn(double[,] d, int k, int i, int j, int ni, int nj)
{
return (ni * d[i, k] + nj * d[j, k]) / (ni + nj);
}
public override void drootbranchfn(double[,] d, int i, int j, int ni, int nj, ref double bi, ref double bj)
{
bi = bj = 0.5 * d[i, j];
}
public Phylo_upgma(double[,] dist) : base(dist)
{
makethetree(dist);
}
}
}