Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matrix multiplication with zero dimensions
Date: Mon, 7 Jan 2013 03:41:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <kcdg4j$n70$1@newscl01ah.mathworks.com>
References: <kcd0g0$34t$1@newscl01ah.mathworks.com> <kcd1lg$6u4$1@newscl01ah.mathworks.com> <kcd527$hou$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1357530067 23776 172.30.248.35 (7 Jan 2013 03:41:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 7 Jan 2013 03:41:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:786050

"Matt J" wrote in message <kcd527$hou$1@newscl01ah.mathworks.com>...
> ....... I can see perhaps that
> 
>  ones(3,0)*ones(0,3)
> 
> should end up being 3x3 because of the outer dimensions, but why should it end up containing zeros.
- - - - - - - - - -
  Think of it this way, Matt.  Consider the four multiplications:

 M3 = ones(3,3)*ones(3,3);
 M2 = ones(3,2)*ones(2,3);
 M1 = ones(3,1)*ones(1,3);
 M0 = ones(3,0)*ones(0,3);

Each of the elements of 3 x 3 M3 is 3.  Each of the elements of 3 x 3 M2 is 2.  Each of the elements of 3 x 3 M1 is 1.  Therefore by extension of this trend M0 should have 3 x 3 elements and each of them should be 0.  As Bruno states, it is consistent with the philosophy behind having the sum of an empty vector be 0 and its product be 1.

  Another line of reasoning:

 M2 = M3 - M1 = 2*ones(3)
 M1 = M2 - M1 = 1*ones(3)
 M0 = M1 - M1 = 0*ones(3)

Roger Stafford