コード例 #1
0
        //=====================================================================
        internal static Matrix Compose(Matrix input_1, Matrix input_2)
        {
            if (input_1.Cols != input_2.Rows)
            {
                throw new Exception("Error Input Matrix. Diferent column size in first Matrix and row size in second Matrix");
            }

            Matrix result = new Matrix(input_1.Rows, input_2.Cols);

            for (int i = 0; i < result.Rows; i++)
            {
                for (int j = 0; j < result.Cols; j++)
                {
                    double sum = 0;
                    for (int k = 0; k < input_1.Cols; k++)
                    {
                        sum = sum + input_1[i, k] + input_2[k, j];
                    }

                    result[i, j] = new ValueMatrix(sum);
                }
            }

            return(result);
        }
コード例 #2
0
        public static Matrix NewEmptyMatrix(int row, int col)
        {
            Matrix result = new Matrix(row, col);

            for (int i = 0; i < result.Rows; i++)
            {
                for (int j = 0; i < result.Cols; j++)
                {
                    result[i, j] = new ValueMatrix(0);
                }
            }

            return(result);
        }
コード例 #3
0
        public static Matrix NewMatrix(double[][] input)
        {
            Matrix result = new Matrix(input.GetLength(0), input.GetLength(1));

            for (int i = 0; i < result.Rows; i++)
            {
                for (int j = 0; i < result.Cols; j++)
                {
                    result[i, j] = new ValueMatrix(input[i][j]);
                }
            }

            return(result);
        }
コード例 #4
0
 internal Matrix(int row, int col)
 {
     m_matrix = new ValueMatrix[row, col];
 }