octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for trace.m


From: John W. Eaton
Subject: Patch for trace.m
Date: Thu, 24 Jan 2008 02:41:07 -0500

On 23-Jan-2008, Alois Schloegl wrote:

| Two special cases are not properly handled by trace.m
| 
| 1) NDarrays can cause misleading results, if the size along any of the 
| first two dimensions is one. Here is an example:
| 
| x=reshape(1:9,[1,3,3]);
| trace(x)
| 
| ans =
|     1
| 
| Obviously, this is not a desirable result, but one would expect an error 
| message similar to the case of NDarrays with no singleton dimension.
| 
| 
| 2) Furthermore, empty variables of size 1x0 or 0x1 do not return 0 but 
| cause an error.
| 
| x = randn(1,0);
| y = trace(x)
| error: invalid vector index = 1
| error: evaluating assignment expression near line 36, column 7
| error: evaluating if command near line 33, column 3
| error: called from `trace' in file 
| `/home/neuro/schalo/cvs/octave/scripts/linear-algebra/trace.m'
| 
| The patch below adds support for these cases.

I applied it and checked it in to cvs head and the 3.0 branch.

Thanks,

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]