- Timestamp:
- 11/11/13 22:41:09 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/DistanceMatrixToPointsTest.cs
r10118 r10127 212 212 } 213 213 214 [TestMethod] 215 public void TestMetricMDSForSmallDistances() { 216 int nrOfPoints = 4; 217 int dim = 2; 218 double[][] orgPoints = new double[nrOfPoints][]; 219 double[][] orgDm = new double[nrOfPoints][]; 220 double[][] newDm = new double[nrOfPoints][]; 221 double[][] newPoints = null; 222 223 AllocArray(orgPoints, dim); 224 AllocArray(orgDm, nrOfPoints); 225 AllocArray(newDm, nrOfPoints); 226 SmallDiffStaticPoints(orgPoints); 227 CalculateDistanceMatrix(orgDm, orgPoints); 228 229 Console.WriteLine("orgDm:"); 230 PrintDM(orgDm); 231 232 newPoints = DistanceMatrixToPoints.MetricMDS(orgDm, dim, true); 233 234 CalculateDistanceMatrix(newDm, newPoints); 235 Console.WriteLine("newDm:"); 236 PrintDM(newDm); 237 238 for (int i = 0; i < orgDm.Length; i++) { 239 for (int j = 0; j < orgDm.Length; j++) { 240 double diff = orgDm[i][j] - newDm[i][j]; 241 Assert.IsTrue(diff.IsAlmost(0.0)); 242 } 243 } 244 } 245 246 private static void SmallDiffStaticPoints(double[][] points) { 247 points[0][0] = 1; 248 points[0][1] = 1; 249 250 points[1][0] = 1.03; 251 points[1][1] = 1.2; 252 253 points[2][0] = 1.05; 254 points[2][1] = 1.01; 255 256 points[3][0] = 1.5; 257 points[3][1] = 1.1; 258 } 259 214 260 private static double[][] StaticPermutationDM() { 215 261 double[][] dm = new double[15][];
Note: See TracChangeset
for help on using the changeset viewer.