Non-Contradiction / autodiffr

Automatic Differentiation for R
https://non-contradiction.github.io/autodiffr/
Other
23 stars 2 forks source link

Test for `forward.grad` on functions using `for (i in x)` where `x` is the input vector fails. #10

Closed Non-Contradiction closed 6 years ago

Non-Contradiction commented 6 years ago

If we use for (i in x) where x is some input vector, we will get errors like invalid for loop sequence.

The related test is currently commented out. Currently have no idea about how to fix this issue. Doing experimentation about this.

Non-Contradiction commented 6 years ago

There seems little we can do about this issue.....

Non-Contradiction commented 6 years ago

After investigation, we can get around the issue by using for (i in as.list(x)) instead of for (i in x) in the function that we want to apply automatic differentiation. Although there is some performance issue with the approach and is a little inconvenience, it should work with all native R functions.