Exemplo n.º 1
0
        public RowVector MultiplyLeftWithRowVector(RowVector row)
        {
            if (row.Count != this.RowsCount)
            {
                throw new NotSupportedException("Can not multiply RowVector * Matrix because Rowvector's count is not equal with Matrix's ColumnCount.");
            }
            RowVector newRow = new RowVector();

            foreach (ColumnVector column in this.GetColumnVectors())
            {
                newRow.Append(row * column);
            }
            return(newRow);
        }
Exemplo n.º 2
0
        public Matrix GetInverseMatrix()
        {
            List <RowVector> newRows = new List <RowVector>();

            for (int i = 0; i < this.RowsCount; i++)
            {
                RowVector row = new RowVector();
                for (int j = 0; j < this.ColumnsCount; j++)
                {
                    row.Append(this.GetAlgeraicComplement(i, j));
                }
                newRows.Add(row);
            }
            Matrix  newMatrix = new Matrix(newRows);
            double  module    = this.GetModule();
            decimal temp      = (decimal)1.0 / (decimal)module;

            newMatrix = newMatrix * temp;
            return(newMatrix.GetTransposeMatrix());
        }
Exemplo n.º 3
0
        public RowVector MultiplyRightWithMatrix(Matrix matrix)
        {
            if (this.Count == 0)
            {
                throw new NotSupportedException("The count of row vector is zero when row vector is multiplied with matrix.");
            }
            if (matrix.RowsCount == 0)
            {
                throw new NotSupportedException("The row count of matrix is zero when row vector is multiplied with matrix.");
            }
            if (this.Count != matrix.RowsCount)
            {
                throw new NotSupportedException("The count of row vector is not equal to matrix's row count when row vector is multiplied with matrix.");
            }

            RowVector result = new RowVector();

            foreach (ColumnVector column in matrix.GetColumnVectors())
            {
                result.Append(this * column);
            }
            return(result);
        }