public static void InsertValue(double[,] arr, int xOffset, int yOffset, int xSize, int ySize, double value) { xSize = xSize - Convert.ToInt32(NeuroMaths.RelU(xOffset + xSize - arr.GetLength(0))); ySize = ySize - Convert.ToInt32(NeuroMaths.RelU(yOffset + ySize - arr.GetLength(1))); for (int x = 0; x < xSize; ++x) { for (int y = 0; y < ySize; ++y) { arr[xOffset + x, yOffset + y] = value; } } }
public static void AddMatrixInMatrix(double[,] arr0, double[,] arr1, int xOffset, int yOffset) { int xLength = arr1.GetLength(0) - Convert.ToInt32(NeuroMaths.RelU(xOffset + arr1.GetLength(0) - arr0.GetLength(0))); int yLength = arr1.GetLength(1) - Convert.ToInt32(NeuroMaths.RelU(yOffset + arr1.GetLength(1) - arr0.GetLength(1))); for (int i0 = 0; i0 < xLength; ++i0) { for (int i1 = 0; i1 < yLength; ++i1) { arr0[i0 + xOffset, i1 + yOffset] += arr1[i0, i1]; } } }
public static double[,] GetPice(double[,] input, int xOffset, int yOffset, int xSize, int ySize) { int xLength = xSize - Convert.ToInt32(NeuroMaths.RelU(xOffset + xSize - input.GetLength(0))); int yLength = ySize - Convert.ToInt32(NeuroMaths.RelU(yOffset + ySize - input.GetLength(1))); double[,] output = new double[xLength, yLength]; for (int i0 = 0; i0 < xLength; ++i0) { for (int i1 = 0; i1 < yLength; ++i1) { output[i0, i1] = input[xOffset + i0, yOffset + i1]; } } return(output); }