Bug 15849 - numericDeriv still not duplicating enough?
Summary: numericDeriv still not duplicating enough?
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Low-level (show other bugs)
Version: R 3.1.0
Hardware: Other Other
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-07-02 22:38 UTC by Duncan Murdoch
Modified: 2014-07-03 01:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Murdoch 2014-07-02 22:38:39 UTC
Bug 15352 fixed a problem with numericDeriv not doing enough duplication.  It appears there are still problems:  the gradient depends on whether values are copies or originals:

>    x <- 10; y <- 10
>    numericDeriv(quote(x+y),c("x","y"))
[1] 20
attr(,"gradient")
     [,1] [,2]
[1,]    1    1
>    
>    x <- y <- 10
>    numericDeriv(quote(x+y),c("x","y"))
[1] 20
attr(,"gradient")
     [,1] [,2]
[1,]    2    2
Comment 1 Duncan Murdoch 2014-07-03 01:00:32 UTC
The code modified x and y to see what was happening, but both ended up modified each time.  Now fixed in R-devel and R-patched.