help-octave
[Top][All Lists]

## chol() couldn't return an error status?

 From: Joao Cardoso Subject: chol() couldn't return an error status? Date: Thu, 19 Aug 1999 05:05:22 +0100

```Hi,

Matlab's 4.0 chol() has the capability of returning an error status,
instead of aborting with an error when the matrix is not positive
definite:

%CHOL   Cholesky factorization.

%       CHOL(X) uses only the diagonal and upper triangle of X.
%       The lower triangular is assumed to be the (complex conjugate)
%       transpose of the upper.  If X is positive definite, then
%       R = CHOL(X) produces an upper triangular R so that R'*R = X.
%       If X is not positive definite, an error message is printed.
%
%       With two output arguments, [R,p] = CHOL(X) never produces an
%       error message.  If X is positive definite, then p is 0 and R
%       is the same as above.   But if X is not positive definite, then
%       p is a positive integer and R is an upper triangular matrix of
%       order q = p-1 so that R'*R = X(1:q,1:q).

The libcruft/dassl/dpotrf.f, called by liboctave/dbleCHOL.cc, already
has that capability, at least in part ( I haven't checked the complex
implementation):

*  INFO    (output) INTEGER
*          = 0: successful exit
*          < 0: if INFO = -k, the k-th argument had an illegal value
*          > 0: if INFO = k, the leading minor of order k is not
*               positive definite, and the factorization could not be
*               completed.

could't chol() accept two output arguments, being INFO one of them? Of
course one could use a try/catch, but in name of speed/compatibility...
I'm using octave 2.1.14.

Thanks,

Joao

--
Joao Cardoso, INESC  |  e-mail:
R. Jose Falcao 110   |  tel:    + 351 2 2094345
4050 Porto, Portugal |  fax:    + 351 2 2008487

---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure