Ejemplo n.º 1
0
 /// <summary>
 /// Compare the object based on their distances
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int CompareTo(object obj)
 {
     if (obj is PairDistance)
     {
         PairDistance tempDistance = (PairDistance)obj;
         return(m_distance.CompareTo(tempDistance.m_distance));
     }
     throw new ArgumentException("object is not a PairDistance");
 }
Ejemplo n.º 2
0
        /// <summary>
        /// From a distance matrix, generate a list of paired distances
        /// </summary>
        /// <param name="distanceMatrix"></param>
        /// <param name="listPairDistance"></param>
        private void PairedDistances(double[,] distanceMatrix, out List <PairDistance> listPairDistance)
        {
            listPairDistance = new List <PairDistance>();
            PairDistance pairDistance = null;

            for (int i = 0; i < distanceMatrix.GetLength(0); i++)
            {
                for (int j = 0; j < i; j++)
                {
                    pairDistance = new PairDistance(i, j, distanceMatrix[i, j]);
                    listPairDistance.Add(pairDistance);
                }
            }
        }