Exemple #1
0
        public void SetInputsForMatrixOperation(BaseOperation operation)
        {
            var M2 = new MatrixCl();
            var M1 = new MatrixCl();

            if (UseLastValue)
            {
                operation.Matrix1 = LastResultMatrix;
            }
            else
            {
                M1.row    = GetOperandInt(" row matrix 1 ");
                M1.column = GetOperandInt(" column matrix 1  ");

                M1.matrix         = new int[M1.row, M1.column];
                M1.matrix         = FillMatrix(M1.row, M1.column);
                operation.Matrix1 = M1.matrix;
            }
            M2.row = GetOperandInt(" row matrix 2 ");
            while (operation.Matrix1.GetLength(1) != M2.row)
            {
                Console.WriteLine("collumns 1Matrix must be = rows 2Matrix");
                M2.row = GetOperandInt(" row matrix 2 ");
            }
            M2.column = GetOperandInt(" column matrix 2  ");

            M2.matrix         = new int[M2.row, M2.column];
            M2.matrix         = FillMatrix(M2.row, M2.column);
            operation.Matrix2 = M2.matrix;
        }
Exemple #2
0
        public int[,] SetLengthM1(int[,] input = null)
        {
            var M1 = new MatrixCl();

            if (input == null)
            {
                M1.row    = GetOperandInt(rowMsg);
                M1.column = GetOperandInt(columnMsg);
                M1.matrix = new int[M1.row, M1.column];
                M1.matrix = FillMatrix(M1.row, M1.column);
            }
            return(M1.matrix);
        }
Exemple #3
0
        public int[,] SetLengthM2(int[,] input1, int[,] input2 = null)
        {
            var M2 = new MatrixCl();

            if (input2 == null)
            {
                M2.row = GetOperandInt(rowMsg);
                while (input1.GetLength(1) != M2.row)
                {
                    Console.WriteLine("collumns 1Matrix must be = rows 2Matrix");
                    M2.row = GetOperandInt(rowMsg);
                }
                M2.column = GetOperandInt(columnMsg);
                M2.matrix = new int[M2.row, M2.column];
                M2.matrix = FillMatrix(M2.row, M2.column);
            }
            return(M2.matrix);
        }