- Timestamp:
- 08/14/12 17:10:08 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs
r8463 r8491 38 38 } 39 39 40 public static double SqrDist(double[,] x, int i, int j, double scale = 1.0) { 41 return SqrDist(x, i, x, j, scale); 42 } 43 44 public static double SqrDist(double[,] x, int i, double[,] xt, int j, double scale = 1.0) { 45 double ss = 0.0; 46 for (int k = 0; k < x.GetLength(1); k++) { 47 double d = x[i, k] - xt[j, k]; 48 ss += d * d; 49 } 50 return scale * scale * ss; 51 } 52 public static double SqrDist(double[,] x, int i, int j, double[] scale) { 53 return SqrDist(x, i, x, j, scale); 54 } 55 56 public static double SqrDist(double[,] x, int i, double[,] xt, int j, double[] scale) { 57 double ss = 0.0; 58 for (int k = 0; k < x.GetLength(1); k++) { 59 double d = x[i, k] - xt[j, k]; 60 ss += d * d * scale[k] * scale[k]; 61 } 62 return ss; 63 } 64 40 65 public static IEnumerable<double> GetRow(double[,] x, int r) { 41 66 int cols = x.GetLength(1);
Note: See TracChangeset
for help on using the changeset viewer.