/** * Checks to see if the rows of the provided matrix are linearly independent. * * @param A Matrix whose rows are being tested for linear independence. * @return true if linearly independent and false otherwise. */ public static boolean isRowsLinearIndependent( DenseMatrix64F A ) { // LU decomposition LUDecomposition<DenseMatrix64F> lu = DecompositionFactory.lu(A.numRows,A.numCols); if( lu.inputModified() ) A = A.copy(); if( !lu.decompose(A)) throw new RuntimeException("Decompositon failed?"); // if they are linearly independent it should not be singular return !lu.isSingular(); }
/** * Checks to see if the rows of the provided matrix are linearly independent. * * @param A Matrix whose rows are being tested for linear independence. * @return true if linearly independent and false otherwise. */ public static boolean isRowsLinearIndependent( DenseMatrix64F A ) { // LU decomposition LUDecomposition<DenseMatrix64F> lu = DecompositionFactory.lu(A.numRows,A.numCols); if( lu.inputModified() ) A = A.copy(); if( !lu.decompose(A)) throw new RuntimeException("Decompositon failed?"); // if they are linearly independent it should not be singular return !lu.isSingular(); }
/** * Checks to see if the rows of the provided matrix are linearly independent. * * @param A Matrix whose rows are being tested for linear independence. * @return true if linearly independent and false otherwise. */ public static boolean isRowsLinearIndependent( DenseMatrix64F A ) { // LU decomposition LUDecomposition<DenseMatrix64F> lu = DecompositionFactory.lu(A.numRows,A.numCols); if( lu.inputModified() ) A = A.copy(); if( !lu.decompose(A)) throw new RuntimeException("Decompositon failed?"); // if they are linearly independent it should not be singular return !lu.isSingular(); }
public Matrix[] lu() { if (isSquare()) { LUDecomposition<DenseMatrix64F> lu = DecompositionFactory.lu(matrix.numRows, matrix.numCols); lu.decompose(matrix); DenseMatrix64F lm = new DenseMatrix64F(matrix.numRows, matrix.numCols); DenseMatrix64F um = new DenseMatrix64F(matrix.numRows, matrix.numCols); lu.getLower(lm); lu.getUpper(um); Matrix l = new EJMLDenseDoubleMatrix2D(lm); Matrix u = new EJMLDenseDoubleMatrix2D(um); Matrix p = new EJMLDenseDoubleMatrix2D(lu.getPivot(null)); return new Matrix[] { l, u, p }; } else { return super.lu(); } }