/** * Returns the determinant of matrix <tt>A</tt>. * * @param A * sparse matrix * @return the determinant of matrix <tt>A</tt> */ public double det(DoubleMatrix2D A) { return lu(A, 0).det(); }
/** * Solves A*x = b. * * @param A * sparse matrix * @param b * right hand side * @return x; a new independent matrix; solution if A is square, least * squares solution if A.rows() > A.columns(), underdetermined * system solution if A.rows() < A.columns(). */ public DoubleMatrix1D solve(DoubleMatrix2D A, DoubleMatrix1D b) { DoubleMatrix1D x = new DenseDoubleMatrix1D(Math.max(A.rows(), A.columns())); x.viewPart(0, (int) b.size()).assign(b); if (A.rows() == A.columns()) { lu(A, 0).solve(x); return x; } else { qr(A, 0).solve(x); return x.viewPart(0, A.columns()).copy(); } } }
/** * Solves A*x = b. * * @param A * sparse matrix * @param b * right hand side * @return x; a new independent matrix; solution if A is square, least * squares solution if A.rows() > A.columns(), underdetermined * system solution if A.rows() < A.columns(). */ public DoubleMatrix1D solve(DoubleMatrix2D A, DoubleMatrix1D b) { DoubleMatrix1D x = new DenseDoubleMatrix1D(Math.max(A.rows(), A.columns())); x.viewPart(0, (int) b.size()).assign(b); if (A.rows() == A.columns()) { lu(A, 0).solve(x); return x; } else { qr(A, 0).solve(x); return x.viewPart(0, A.columns()).copy(); } } }
/** * Returns the determinant of matrix <tt>A</tt>. * * @param A * sparse matrix * @return the determinant of matrix <tt>A</tt> */ public double det(DoubleMatrix2D A) { return lu(A, 0).det(); }