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: Olaf Till
Subject: Re: Passing Large Arrays to Function
Date: Mon, 4 Jul 2016 21:39:53 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, Jun 28, 2016 at 10:21:46AM +0200, Max Görner wrote:
> The behaviour is described at
> 
>    http://blogs.mathworks.com/loren/2007/03/22/in-place-operations-on-data/

To revisit this, partially repeating myself: I believe it's inevitable
that at least one (deep) copy of the array is made if an arbitrary
interpreted function is executed. Otherwise, the array can't be
reliably left unchanged if an error occurs in the function.

At the link you've given it is stated (if I understood it correctly)
that for the 'behaviour' to work the function must have been called by
another function. This would _not_ suffice in Octave to generate an
'outer' (deep) copy of the array, but maybe they have some mechanism
in Matlab to do this in this way.

Since (as I think) one copy must be generated anyway, I think you
could achieve equivalent behavior in Octave for operations (algebraic
operations or basic function calls) which change only certain
(indexed) elements of an array: Perform all such operations within one
function -- then a copy of the whole array should only be generated at
the first of these operations.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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