public GetMatrix Sum(GetMatrix matrix, int factor) { GetMatrix copyMatrix = new GetMatrix(matrix); for (int i = 0; i < copyMatrix.rows; i++) { for (int j = 0; j < copyMatrix.columns; j++) { //factor *= copyMatrix.Get(i, j); copyMatrix.Set(i, j, copyMatrix.Get(i, j) + factor); } } return(copyMatrix); }
static void Main(string[] args) { GetMatrix matrix = new GetMatrix(6, 6); matrix.printMatrix(); Console.WriteLine(); //GetMatrix matrix1 = new GetMatrix(matrix, 3, GetMatrix.Operation.MULTIPLY); //matrix1.printMatrix(); //Console.WriteLine(); //GetMatrix matrix2 = new GetMatrix(matrix, 3, GetMatrix.Operation.SUM); //matrix2.printMatrix(); //Console.WriteLine(); }
public int MaxElement(GetMatrix matrix) { int max = int.MinValue; for (int i = 0; i < matrix.rows; i++) { for (int j = 0; j < matrix.columns; j++) { if (matrix.Get(i, j) > max) { max = matrix.Get(i, j); } } } return(max); }
public int MinElement(GetMatrix matrix) { int min = int.MaxValue; for (int i = 0; i < matrix.rows; i++) { for (int j = 0; j < matrix.columns; j++) { if (matrix.Get(i, j) < min) { min = matrix.Get(i, j); } } } return(min); }
public GetMatrix(GetMatrix matrix, int factor, Operation operation) { switch (operation) { case Operation.MULTIPLY: GetMatrix matrix1 = Multiply(matrix, factor); this.matrix = matrix1.matrix.Select(arr => arr.ToArray()).ToArray(); this.rows = matrix1.rows; this.columns = matrix1.columns; break; case Operation.SUM: GetMatrix matrix2 = Sum(matrix, factor); this.matrix = matrix2.matrix.Select(arr => arr.ToArray()).ToArray(); this.rows = matrix2.rows; this.columns = matrix2.columns; break; default: break; } }
public GetMatrix(GetMatrix matrix) { this.matrix = matrix.matrix.Select(arr => arr.ToArray()).ToArray(); this.rows = matrix.rows; this.columns = matrix.columns; }