/** * Computes the reciprocal condition number, using either the infinity norm * of the 1 norm. * * @param A * The matrix this is a decomposition of * @param norm * Either <code>Norm.One</code> or <code>Norm.Infinity</code> * @return The reciprocal condition number. Values close to unity indicate a * well-conditioned system, while numbers close to zero do not. */ public double rcond(Matrix A, Norm norm) { if (norm != Norm.One && norm != Norm.Infinity) throw new IllegalArgumentException( "Only the 1 or the Infinity norms are supported"); double anorm = A.norm(norm); int n = A.numRows(); intW info = new intW(0); doubleW rcond = new doubleW(0); LAPACK.getInstance().dgecon(norm.netlib(), n, LU.getData(), Matrices.ld(n), anorm, rcond, new double[4 * n], new int[n], info); if (info.val < 0) throw new IllegalArgumentException(); return rcond.val; }
/** * Computes the reciprocal condition number, using either the infinity norm * of the 1 norm. * * @param A * The matrix this is a decomposition of * @param norm * Either <code>Norm.One</code> or <code>Norm.Infinity</code> * @return The reciprocal condition number. Values close to unity indicate a * well-conditioned system, while numbers close to zero do not. */ public double rcond(Matrix A, Norm norm) { if (norm != Norm.One && norm != Norm.Infinity) throw new IllegalArgumentException( "Only the 1 or the Infinity norms are supported"); double anorm = A.norm(norm); int n = A.numRows(); intW info = new intW(0); doubleW rcond = new doubleW(0); LAPACK.getInstance().dgecon(norm.netlib(), n, LU.getData(), Matrices.ld(n), anorm, rcond, new double[4 * n], new int[n], info); if (info.val < 0) throw new IllegalArgumentException(); return rcond.val; }