Re: [Rd] avoid copying big object passed into optimize()

2011-03-17 Thread Zepu Zhang
Thanks! I found, say, exp(x) causes 2 duplications whereas sum(x) 0 duplication. Is there any document to learn from about this? (first time list user. sorry if anything about the posting procedure is wrong) On Wed, Mar 9, 2011 at 6:16 PM, Matt Shotwell wrote: > On Wed, 2011-03-09 at 17:15 -090

Re: [Rd] avoid copying big object passed into optimize()

2011-03-09 Thread Matt Shotwell
On Wed, 2011-03-09 at 17:15 -0900, Zepu Zhang wrote: > Hello list, > > I have the following scenario: > > f1 <- function(a) > { > # doing things; may need 'a', but does not change 'a'. > > g <- function(x) > { > sum(x + a)# Say. Use 'a'; does not change 'a'. Th