Comments (9)
Sure, it still doesn't work. But, I will post on Rcpp Gallery when I figure it out.
from rcppeigen.
Some starters:
- https://gallery.rcpp.org/articles/custom-templated-wrap-and-as-for-seamingless-interfaces/
- https://gallery.rcpp.org/articles/custom-as-and-wrap-example/
- https://gallery.rcpp.org/articles/as-and-wrap-for-sparse-matrices/
Plus a vignette from Rcpp that is also a chapter in the Rcpp book:
It is still fairly daunting material. Maybe start small and try a simple case working to not get carried away.
from rcppeigen.
Hi Gang:
As I was thinking more about this, a question occurred to me. Is it the case that there is no multi-dimensional RcppArray in Rcpp itself? If so, then I think that might be an avenue or alternative to what I proposed above. If not (something like RcppArray does exist), then maybe I could look at those details and that would assist me here. I hope that this questions makes sense ;o)
Thanks
from rcppeigen.
Well, as I recall, arrays are really just standard vectors with a dim
attribute:
R> a <- array(1:8, dim=c(2,2,2))
R> a
, , 1
[,1] [,2]
[1,] 1 3
[2,] 2 4
, , 2
[,1] [,2]
[1,] 5 7
[2,] 6 8
R> class(a)
[1] "array"
R> str(a)
int [1:2, 1:2, 1:2] 1 2 3 4 5 6 7 8
R>
The above can be done easily (see Rcpp Gallery on setting dim
easily). And there is more
as e.g. https://gallery.rcpp.org/articles/simple-array-class/ plus some add-on packages on CRAN.
So if you specify the problem you want to solve more clearly, maybe we can help you. Here it looks like you just redefined one question into another, loosely related one. But maybe I am missing something...
from rcppeigen.
You are right that doesn't really help here. Just have to find some time to work on this issue.
from rcppeigen.
Ok, I see where I was going with my previous question above. The simple array class is ok, but that uses RcppArmadillo. I hesitate to add yet another dependency when I already have an RcppEigen dependency. But, instead of RcppEiegen tensors, I tried a different attack. I'm creating Rcpp 3D arrays on the C++ side which works seemlessly as you suggest. However, how do you access the memory locations? For example, I tried something like...
Rcpp::NumericVector impute_draw(Rcpp::Dimension(nkeeptrain, n, K));
impute_draw(0, 0, 0)=0.;
The first line is fine, but the second generates an error. So, this is what I am trying to do. I realize that this is not an RcppEigen tensor issue per se. Although that could be an avenue taken, I think just figuring this out for Rcpp core would mean that tensors are not really needed (unless of course you have already invested in an Eigen tensor code base which I have not). Am I making more sense now? Thanks
from rcppeigen.
I guess the (...,)
accessor is simply not implemented for three dimensions for a NumericVector
type.
Here you create a vector --- a 1-D object. You can play games with N dimensions but you need to map those down to the 1-D case that that class understand.
As for multiple dependencies: up to you. A number of packages on CRAN do just that and depends on RcppArmadillo and RcppEigen. There is no rule against that.
from rcppeigen.
True. But, I'm thinking that if I want this, then many others want it too and the best place is Rcpp itself. I have played around with the 1-D idea, i.e., impute_draw[i]. But, something is wrong with my math. Not sure what I am doing wrong. The simple array class should help here, but I'm not exacly following it. If I can figure this out, then it shows us how to create the (...,...,...) accessor for Rcpp, right? Or is that trouble because it is variadic?
from rcppeigen.
I do not think this belongs in Rcpp proper as this can be handled just fine in a user-written package such as yours.
Can we close this here too as there is actually no demonstrated issue against RcppEigen...
from rcppeigen.
Related Issues (20)
- Warning messages: 1: partial match of 'df' to 'df.residual' HOT 6
- Unable to install v0.3.3.9.3 (zero exis status, warning: ignoring attributes on template argument ‘__m128) HOT 4
- Can't install on arm64 (MacOS) HOT 1
- EIGEN_DEFAULT_TO_ROW_MAJOR and other flags HOT 3
- Runtime error causing R session to crash HOT 6
- Undefined symbol: RcppEigen_Eigen_SSE HOT 3
- Error while trying to create shinyproxy image HOT 1
- no member named 'Rlog1p' in namespace 'std' HOT 11
- (Rcpp)Eigen 3.4.0 would help with C++17 HOT 2
- Small DESCRIPTION issue HOT 1
- Why macros for GCC in DisableStupidWarnings.h are commented HOT 2
- Small inconsistency in the `lmBenchmark.R` file? HOT 4
- Lots of warnings During Compilation HOT 1
- Can not install RcppEigen, RcppEigen.h: No such file or directory HOT 7
- make fastLm use mutliple threads HOT 3
- Error installing RcppEigen HOT 4
- Map dgCmatrix as integer sparse matrix HOT 6
- RcppEigen Submatrix Views HOT 2
- setFromTriplets function gets segfault error HOT 5
- Installation issues in a conda environment HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rcppeigen.