//------------------------------------------------------------------------------------------ //Обратная матрица public RealMatrix GetInverseMatrix() { double determinant = this.GetDeterminant(); if (determinant == 0) { throw new MatrixException(); } RealMatrix algebraicalComplementsMatrix = new RealMatrix(this.RowCount, this.ColumnCount); for (int row = 0; row < this.RowCount; row++) { for (int column = 0; column < this.ColumnCount; column++) { double algebraicalComplement = this.GetAlgebraicalComplement(row, column); algebraicalComplementsMatrix[row, column] = algebraicalComplement; } } RealMatrix transposedMatrix = algebraicalComplementsMatrix.GetTransposedMatrix(); RealMatrix inverseMatrix = transposedMatrix * (1 / determinant); return(inverseMatrix); }
//----------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------ //Транспонированные матрицы public static RealMatrix[] GetTransposedMatrices(params RealMatrix[] matrices) { RealMatrix[] transposedMatrices = new RealMatrix[matrices.Length]; for (int index = 0; index < matrices.Length; index++) { RealMatrix matrix = matrices[index]; RealMatrix transposedMatrix = matrix.GetTransposedMatrix(); transposedMatrices[index] = transposedMatrix; } return(transposedMatrices); }