[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Octave and Freemat
From: |
Bateman David-ADB014 |
Subject: |
RE: Octave and Freemat |
Date: |
Wed, 5 Mar 2008 13:30:39 -0000 |
There is no error with the code I sent. You get a warning of a divide by zero and a 0-by-0 matrix is returned correctly with roots(0). matalbR2007b returns a 0-by-1 empty matrix, but that is the only difference..
D.
-----Original Message-----
Regarding this part,
> + if (isempty (v))
> + f = v;
> + else
> + f = find (v ./ max (abs (v)));
> + endif
> + m = numel (f);
It appears an error will result if v = 0. Which should return [].
Perhaps something like that below?
f = find (v);
if (any (f))
v = v ./ max (abs (v));
f = find (v);
endif
m = numel (f);
The first test below tests this concern, and the second tests for a
"special" features of Matlab's implementation, which apparently is
consistent with the above since the check for Inf is done prior to
"v ./ max (abs (v))".
%!assert(isempty (roots (0)));
%!assert(roots([realmin, realmax, realmax]), -1)
Ben
- Re: Octave and Freemat, (continued)
- Re: Octave and Freemat, David Bateman, 2008/03/04
- Re: Octave and Freemat, David Bateman, 2008/03/04
- Re: Octave and Freemat, Sebastien Loisel, 2008/03/04
- Re: Octave and Freemat, Ben Abbott, 2008/03/04
- Re: Octave and Freemat, Ben Abbott, 2008/03/04
- Re: Octave and Freemat, Ben Abbott, 2008/03/05
- Re: Octave and Freemat, David Bateman, 2008/03/05
- Re: Octave and Freemat, David Bateman, 2008/03/05
- Re: Octave and Freemat, John W. Eaton, 2008/03/05
- Re: Octave and Freemat, Ben Abbott, 2008/03/05
- RE: Octave and Freemat,
Bateman David-ADB014 <=
- Re: Octave and Freemat, Ben Abbott, 2008/03/05
- Re: Octave and Freemat, David Bateman, 2008/03/05