C#,数值计算——分类与推理Phylo_upgma的计算方法与源程序

C#,数值计算——分类与推理Phylo_upgma的计算方法与源程序_第1张图片

1 文本格式

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);
        }
    }
}
 

2 代码格式

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);
        }
    }
}

你可能感兴趣的:(C#数值计算,Numerical,Recipes,c#,开发语言,分类,算法,数值计算)