/// <summary> /// Print the means of a 2-D array of Gaussians to the console /// </summary> /// <param name="matrix"></param> private static void printMatrixToConsole(IArray2D <Gaussian> matrix) { for (int i = 0; i < matrix.GetLength(0); i++) { for (int j = 0; j < matrix.GetLength(1); j++) { Console.Write("{0,5:0.00}\t", matrix[i, j].GetMean()); } Console.WriteLine(""); } }
/// <summary> /// Mean absolute row means /// </summary> /// <param name="matrix"></param> /// <returns></returns> private static double[] meanAbsoluteRowMeans(IArray2D <Gaussian> matrix) { double[] mam = new double[matrix.GetLength(0)]; double mult = 1.0 / ((double)matrix.GetLength(1)); for (int i = 0; i < matrix.GetLength(0); i++) { double sum = 0.0; for (int j = 0; j < matrix.GetLength(1); j++) { sum += System.Math.Abs(matrix[i, j].GetMean()); } mam[i] = mult * sum; } return(mam); }
private static bool InBounds(int x, int y) { return(Map.Bounds || x >= 0 && y >= 0 && x < Map.GetLength(0) && y < Map.GetLength(1)); }