help-octave
[Top][All Lists]
Advanced

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

Re: Passing Large Arrays to Function


From: Max Görner
Subject: Re: Passing Large Arrays to Function
Date: Tue, 28 Jun 2016 08:59:44 +0200
User-agent: Mutt/1.5.24 (2015-08-30)

Octave does copy on write. So passing variables anywhere does not
duplicate it, be it an assignment or a passing to a function. Only right
before the first change the variable gets duplicated.

So you can pass that big value as often as you want to if you don't
change it. This might not be as good as having references, but it's
quite decent anyway. You could try that using a very simple recursion.

BTW: Does Octave notice that it can operate on the passed arguments
directly? Matlab states to notice that in

   var = foo(var)

the variable 'var' can be manipulated directly, thus saving speed and
memory.

sincerly

Max Görner

--
PGP: https://wwwpub.zih.tu-dresden.de/~maxgoern/2FE6023F.asc

Attachment: signature.asc
Description: PGP signature


reply via email to

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