[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch for trace.m
From: |
Thomas Weber |
Subject: |
Re: Patch for trace.m |
Date: |
Thu, 24 Jan 2008 12:34:18 +0100 |
Am Donnerstag, den 24.01.2008, 02:41 -0500 schrieb John W. Eaton:
> 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.
>
Test cases for Alois' changes attached.
2008-01-24 Thomas Weber <address@hidden>
* linear-algebra/trace.m: Test cases for non 2-d args.
Thomas
trace.diff
Description: Text Data