Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/22/13 00:05:02 (11 years ago)
Author:
ascheibe
Message:

#1886 another bugfix in the point calculation from distance matrices

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/DistanceMatrixToPointsTest.cs

    r10060 r10078  
    2929    [TestMethod]
    3030    public void TestDistanceMatrixConversion() {
    31       int nrOfPoints = 5;
     31      int nrOfPoints = 4;
    3232      int dim = 2;
    3333      double[][] orgPoints = new double[nrOfPoints][];
     
    4444
    4545      newPoints = DistanceMatrixToPoints.ConvertDistanceMatrixToPoints(orgDm);
     46
    4647      CalculateDistanceMatrix(newDm, newPoints);
    4748      //TODO
     
    6869
    6970    private static double CalcEuclideanDistance(double[] p1, double[] p2) {
    70       return Math.Sqrt(Math.Pow(p1[0] - p2[0], 2) + Math.Pow(p1[1] - p2[1], 2));
     71      double result = 0.0;
     72      for (int i = 0; i < p1.Length; i++) {
     73        result += Math.Pow(p1[i] - p2[i], 2);
     74      }
     75      return Math.Sqrt(result);
    7176    }
    7277
Note: See TracChangeset for help on using the changeset viewer.