help-octave
[Top][All Lists]
Advanced

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

efficient function parameter copying?


From: Michael Pronath
Subject: efficient function parameter copying?
Date: Fri, 10 Sep 1999 11:03:29 +0200

If I declare a function in octave

   function v = f(v)
      ...
   endfunction

and then call it by

   ...
   X = f(X);
   ...

the octave interpreter could exploit that the variable X need not
be copied into v, but could be changed directly.
I'm using a construct like the one for iterations, i.e. calling
f quite often, with X being a matrix.  Using global variables could
do it as well, but are not as beautiful.  So my question is, 
does the octave interpreter detect this case and optimize parameter
copying, or is the matrix X copied twice unnecessarily here?

  Michael




---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

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