We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
xt::diagonal()
I think xt::diagonal() (and the rest of the builders, like xt::eye()), need a layout argument somehow.
xt::eye()
Consider this example:
// [[Rcpp::depends(xtensor)]] // [[Rcpp::plugins(cpp14)]] #include <xtensor-r/rarray.hpp> #include <xtensor/xbuilder.hpp> // [[Rcpp::export]] xt::rarray<int> diagonal_test(const xt::rarray<int>& x) { return xt::diagonal(x); }
Rcpp::sourceCpp("~/Desktop/test.cpp") x <- matrix(1:9, 3) x #> [,1] [,2] [,3] #> [1,] 1 4 7 #> [2,] 2 5 8 #> [3,] 3 6 9 # all good diagonal_test(x) #> [1] 1 5 9 y <- array(1:12, c(2, 2, 3)) y #> , , 1 #> #> [,1] [,2] #> [1,] 1 3 #> [2,] 2 4 #> #> , , 2 #> #> [,1] [,2] #> [1,] 5 7 #> [2,] 6 8 #> #> , , 3 #> #> [,1] [,2] #> [1,] 9 11 #> [2,] 10 12 # Wrong! diagonal_test(y) #> [,1] [,2] #> [1,] 1 4 #> [2,] 5 8 #> [3,] 9 12 # I expect matrix(c(1, 4, 5, 8, 9, 12), nrow = 2) #> [,1] [,2] [,3] #> [1,] 1 5 9 #> [2,] 4 8 12
Hopefully you can see here that with the 3D array, two things are wrong:
I think that xtensor-stack/xtensor-r#90 might be a similar issue.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I think
xt::diagonal()
(and the rest of the builders, likext::eye()
), need a layout argument somehow.Consider this example:
Hopefully you can see here that with the 3D array, two things are wrong:
I think that xtensor-stack/xtensor-r#90 might be a similar issue.
The text was updated successfully, but these errors were encountered: