Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No variants for R matrix slicing #20

Open
mynanshan opened this issue Apr 9, 2022 · 0 comments
Open

No variants for R matrix slicing #20

mynanshan opened this issue Apr 9, 2022 · 0 comments

Comments

@mynanshan
Copy link

I found that one has to manually complete all the indexes for matrix slicing. Example:

library(autodiffr)

f <- function(x){
  y <- array(c(x,x), dim = c(length(x), 2))
  return(sum(y[,1]))
}

ad_grad(f, c(1,1))
#> Julia version 1.7.0 at location D:\Software\Julia-1.7.0\bin will be used.
#> Loading setup script for JuliaCall...
#> Finish loading setup script for JuliaCall.
#> Loading ReverseDiff...
#> Loading ForwardDiff...
#> Finish autodiffr setup.
#> Error: Error happens in Julia.
#> REvalError:

f <- function(x){
  y <- array(c(x,x), dim = c(length(x), 2))
  return(sum(y[1:2,1]))
}

ad_grad(f, c(1,1))
#> [1] 1 1

Created on 2022-04-09 by the reprex package (v2.0.1)

My environment and package versions:

R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

other attached packages:
[1] autodiffr_0.1.0.9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant