[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cond(zeros(4))
From: |
John W. Eaton |
Subject: |
cond(zeros(4)) |
Date: |
Fri, 9 Jul 1999 10:35:31 -0500 (CDT) |
On 29-Jun-1999, address@hidden <address@hidden> wrote:
| I type in
|
| cond(zeros(4))
|
| and get NaN. I know this is the IEEE analogue of the strict
| mathematical definition, but since I'm using this quantity to
| test how close a matrix is to singular, it would have been nicer
| to get Inf.
OK, I've fixed this in my sources using the following logic:
if (any (any (isinf (a) | isnan (a))))
error ("cond: argument must not contain Inf or NaN values");
else
sigma = svd (a);
sigma_1 = sigma(1);
sigma_n = sigma(length (sigma));
if (sigma_1 == 0 || sigma_n == 0)
retval = Inf;
else
retval = sigma_1 / sigma_n;
endif
endif
Does anyone see a problem with that?
BTW, please report bugs to the bug-octave mailing list.
Thanks,
jwe
---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL. To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- cond(zeros(4)),
John W. Eaton <=