Comments (8)
Pull requests would be welcome.
from rcpparmadillo.
Hi Dirk, that's fair. I'm far from being an expert programmer but found the following code that solves the problem. However, I don't know how easy would be integrating it in your package:
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export]]
arma::cube array2cube( SEXP myArray ) {
Rcpp::NumericVector vecArray(myArray);
Rcpp::IntegerVector arrayDims = vecArray.attr("dim");
arma::cube cubeArray(vecArray.begin(), arrayDims[0], arrayDims[1], arrayDims[2], false);
return(cubeArray);
}
Many thanks in any case for providing the Rcpp package.
from rcpparmadillo.
This has been added in #64.
from rcpparmadillo.
Great!
George G. Vega Yon (from mobile)
+1 626 381 8171
http://www.its.caltech.edu/~gvegayon
On Dec 1, 2015 4:10 AM, "Dirk Eddelbuettel" [email protected]
wrote:
This has been added in #64
#64.โ
Reply to this email directly or view it on GitHub
#42 (comment)
.
from rcpparmadillo.
Our thanks to @nathan-russell ๐
from rcpparmadillo.
Thanks a lot.
El 1 dic. 2015 1:10 p. m., "Dirk Eddelbuettel" [email protected]
escribiรณ:
This has been added in #64
#64.โ
Reply to this email directly or view it on GitHub
#42 (comment)
.
from rcpparmadillo.
For completeness:
R> library(Rcpp)
R> cppFunction("arma::cube doubleCube(arma::cube cb) { return 2*cb; }",
+ depends="RcppArmadillo")
R> doubleCube(array(1:8, dim=c(2,2,2)))
, , 1
[,1] [,2]
[1,] 2 6
[2,] 4 8
, , 2
[,1] [,2]
[1,] 10 14
[2,] 12 16
R>
Thanks again @nathan-russell !
from rcpparmadillo.
@eddelbuettel More than happy to help where I'm able to ๐
from rcpparmadillo.
Related Issues (20)
- warning: chol(): given matrix is not symmetric HOT 7
- Possible bug in configure.ac HOT 18
- Problems in installing RcppArmadillo on macOS Monterey HOT 3
- Missing distr_param argument in randu HOT 8
- no matching function for call to โarma::Cube<double>::insert_slices(arma::uword&, arma::mat&) HOT 2
- Deprecating old initialization code in packages using RcppArmadillo HOT 17
- Is `ARMA_64BIT_WORD` supported in RcppArmadillo? HOT 4
- NaN output from arma::uvec compared to arma::vec HOT 4
- Planning to potentially (re)move some legacy internal header files
- Deprecating old stderr stream setting code in packages using RcppArmadillo HOT 12
- Fails to compile vs HOT 3
- Question about SIMD Optimization HOT 3
- package compilation failure HOT 20
- Two failures in test_cube.R on PowerPC HOT 33
- Armadillo 12.0.0 regressions HOT 2
- `RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR` in an R package? HOT 2
- using namespace arma; HOT 1
- Issue on call by reference with a NA matrix HOT 1
- Update indMatrix->arma::SpMat and pMatrix->arma::SpMat for Matrix 1.5-5 HOT 2
- install issue HOT 3
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 rcpparmadillo.