Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <RcppArmadillo.h>
- // [[Rcpp::depends(RcppArmadillo)]]
- // [[Rcpp::export]]
- arma::mat foo(arma::mat A, arma::uword block_start, arma::uword block_length) {
- arma::uword rows = A.n_rows;
- arma::mat B = arma::mat(A.begin_col(block_start), rows, block_length, false);
- B.fill(1.0);
- return A;
- }
- /*** R
- A <- matrix(0, 4, 4)
- foo(A, 0, 2)
- > A <- matrix(0, 4, 4)
- > foo(A, 0, 2)
- [,1] [,2] [,3] [,4]
- [1,] 1 1 0 0
- [2,] 1 1 0 0
- [3,] 1 1 0 0
- [4,] 1 1 0 0
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement