Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: matrix multiplication with zero dimensions
Replies: 11   Last Post: Jan 7, 2013 10:20 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Roger Stafford

Posts: 5,888
Registered: 12/7/04
Re: matrix multiplication with zero dimensions
Posted: Jan 6, 2013 10:41 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.