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: Temporary output when assigning into slices?
Replies: 10   Last Post: Jan 27, 2013 3:53 AM

Advanced Search

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

Posts: 4,994
Registered: 11/28/09
Temporary output when assigning into slices?
Posted: Jan 23, 2013 1:49 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I've been curious, after various recent observations, about if/when matrix multiplication allocates fresh memory for its output. For example, suppose I do something like

A(:,1)=B*x;

Is this equivalent to

z=B*x; %memory allocated here
A(:,1)=z;

Or, does the output of B*x get directly generated in the memory locations occupied by A(:,1)? Obviously, the latter would be more efficient, but I wasn't sure how it worked. I know for example that this

A(1,:)=B(1,:)*x;

is equivalent to

z=B(1,:); %memory allocated here
A(1,:)=z*x;

so obviously not everything is as well optimized as it could be.



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.