octave-maintainers
[Top][All Lists]
Advanced

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

Re: Multiplication of empty matrices?


From: Olaf Till
Subject: Re: Multiplication of empty matrices?
Date: Tue, 9 Jun 2015 21:49:45 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Jun 09, 2015 at 10:59:18AM -0700, Rik wrote:
> 6/9/15
> 
> All,
> 
> I came across this odd behavior for the multiplication of empty matrices:
> 
> octave:1> x = zeros (0,1)
> x = [](0x1)
> octave:2> y = zeros (1,0)
> y = [](1x0)
> octave:3> x * y
> ans = [](0x0)
> octave:4> x .* y
> error: product: nonconformant arguments (op1 is 0x1, op2 is 1x0)
> octave:4> x * y'
> error: operator *: nonconformant arguments (op1 is 0x1, op2 is 0x1)
> magic(3) * x
> error: operator *: nonconformant arguments (op1 is 3x3, op2 is 0x1)

Imagine the dimensions which are zero in each of your examples
actually vary between zero and some positive integer. Then I would not
expect that the outcome (failure or allowed) changes only because the
dimension gets zero. So the results of your examples seem reasonable
to me (since the same rules are applied for zero or any other positive
integer).

> <snip>  I would think that an empty matrix multiplying
> anything would return the empty matrix.

I can see no reason for this ...

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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