From bug-octave-request at bevo dot che dot wisc dot edu Mon Aug 9 14:09:37 1999 Subject: Re: empty matrices in aritmetical operations From: "John W. Eaton" To: Mirek Kwasniak Cc: bug-octave at bevo dot che dot wisc dot edu Date: Mon, 9 Aug 1999 14:08:50 -0500 (CDT) On 9-Aug-1999, Mirek Kwasniak wrote: | On Mon, Aug 09, 1999 at 09:53:23AM -0500, John W. Eaton wrote: | > On 9-Aug-1999, Kwasniak Miroslaw wrote: | [...] | > | octave:17> []+[1 1] | > | error: operator +: nonconformant arguments (op1 is 0x0, op2 is 1x2) | > | error: operator +: nonconformant arguments (op1 is 0x0, op2 is 1x2) | > | error: evaluating assignment expression near line 17, column 3 | > | | > | Matlab gives always [] as result. | > | > Sorry, I don't think this is a bug in Octave, except that to be | > consistent with what happens for | | I see some code from net and mathworks that use statemets like | | for i=.. | ... | c=[ c a*b ]; | ... | end | | where a is empty (and b not) for first iteration. :( Well, Octave tries to do the right thing mathematically for these kinds of operations (check the references in the Octave manual). To allow A * B to work when the dimensions of A and B do not conform and neither is a scalar does not make a lot of sense to me. It should be an error. My advice is to fix the buggy code instead of trying to `fix' the behavior of Octave, which I think seems quite reasonable. 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 ---------------------------------------------------------------------