src/main/java/com/osiris/maths/human/Matrix.java
/**
     * Copies the current matrix and performs inversion by Gauss/Jordan on it.
     * @return the matrix copy.
     */
Copies the current matrix and performs inversion by Gauss/Jordan on it.
@return the matrix copy.
Copies the current matrix and performs inversion by Gauss / Jordan on it . @return the matrix copy .
public Matrix copyInvertedByGaussJordan(boolean printSteps) throws NotQuadratic, UnsupportedMatrix {
        if(!isQuadratic()) throw new NotQuadratic(this);
        if(determinantByGaussianElimination() == 0.0)
            throw new UnsupportedMatrix("The determinant of this matrix is == 0.0, which means that there is no inverted matrix.");
        Matrix onesMatrix = new Matrix(rowsCount, columnsCount);
        for (int i = 0; i < rowsCount; i++) {
            onesMatrix.set(i, i, 1.0);
        }
        if(printSteps) {
            System.out.println("PERFORM INVERSION BY GAUSS/JORDAN ON: ");
            System.out.println(this);
            System.out.println("Ones matrix:");
            System.out.println(onesMatrix.asString());
        }
        Matrix copy = this.copy();
        for (int i = 0; i < copy.rowsCount; i++) {
            if(at(i,i) != 1){
            }
        }
        for (List<Double> l: copy.rows) {
            for (Double num: l) {
                if(num != 0.0 && num != 1.0){
                }
            }
        }
        return copy;
    }
public Matrix copyInvertedByGaussJordan ( boolean printSteps ) throws NotQuadratic , UnsupportedMatrix { if ( ! isQuadratic ( ) ) throw new NotQuadratic ( this ) ; if ( determinantByGaussianElimination ( ) == 0.0 ) throw new UnsupportedMatrix ( "The determinant of this matrix is == 0.0, which means that there is no inverted matrix." ) ; Matrix onesMatrix = new Matrix ( rowsCount , columnsCount ) ; for ( int i = 0 ; i < rowsCount ; i ++ ) { onesMatrix . set ( i , i , 1.0 ) ; } if ( printSteps ) { System . out . println ( "PERFORM INVERSION BY GAUSS/JORDAN ON: " ) ; System . out . println ( this ) ; System . out . println ( "Ones matrix:" ) ; System . out . println ( onesMatrix . asString ( ) ) ; } Matrix copy = this . copy ( ) ; for ( int i = 0 ; i < copy . rowsCount ; i ++ ) { if ( at ( i , i ) != 1 ) { } } for ( List < Double > l : copy . rows ) { for ( Double num : l ) { if ( num != 0.0 && num != 1.0 ) { } } } return copy ; }
Copies the current matrix and performs inversion by Gauss/Jordan on it.
Copies the current matrix and performs inversion by Gauss / Jordan on it .
// TODO // Make sure diagonals are all 1