The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Matrix dimensions must agree.
Replies: 13   Last Post: Mar 24, 2014 5:34 PM

Advanced Search

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

Posts: 9,850
Registered: 6/7/07
Re: Matrix dimensions must agree.
Posted: Mar 21, 2014 2:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 3/21/2014 10:40 AM, dpb wrote:
> On 3/21/2014 8:46 AM, Steven Lord wrote:

>> I wouldn't use this approach; I'd instead select the elements to keep.
>> It avoids the IF and ELSEIF statements at the expense of a call to MIN:
>> minRows = min(x, y);
>> a = a(1:minRows, :);
>> b = b(1:minRows, :);

> ...
> It then also has the cost of the selection on both where one is already
> ok that the if...elseif avoids which is why I went that route.


I'm presuming the ML JIT optimization can't tell the above copy doesn't
need to happen, of course. Is the runtime code generation that smart,


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.