Dimension swap from cube to matrix
還沒有人認領這個 Issue。
評估
研究方向
Start by reproducing the R examples with RcppArmadillo, especially the arma::cube::row() case where one remaining dimension is 1. Compare the returned dimensions for Rarray1 and Rarray2, then inspect the cube-to-matrix conversion used by arma::mat. Done means row extraction preserves the intended dimensions without regressing the column and slice examples.
由索引模型根據 Issue 內容生成。
描述
I encountered a bug in RcppArmadillo when saving a row of a cube to a matrix. If one of the remaining dimensions is just of dimension 1, then dimensions are swapped. I'll illustrate the bug with an example
cppFunction("arma::mat test_row(arma::cube Rarray) {
arma::mat test = Rarray.row(0);
return test;
}", depends="RcppArmadillo")
Rarray1 <- array(NA, dim=c(100,1,2))
dim(test_row(Rarray1))
> 1 2
Rarray2 <- array(NA, dim=c(100,2,1))
dim(test_row(Rarray2))
> 1 2
When pulling out the first row and saving it to a matrix, dimensions are not kept in the second example, but swapped. I'll tested also whether this happens also when pulling out the first column or slice, but there everything seems fine. I'll just attach the code
cppFunction("arma::mat test_col(arma::cube Rarray) {
arma::mat test = Rarray.col(0);
return test;
}", depends="RcppArmadillo")
Rarray3 <- array(NA, dim=c(1,100,2))
dim(test_col(Rarray3))
> 1 2
Rarray4 <- array(NA, dim=c(2,100,1))
dim(test_col(Rarray4))
> 2 1
cppFunction("arma::mat test_slice(arma::cube Rarray) {
arma::mat test = Rarray.slice(0);
return test;
}", depends="RcppArmadillo")
Rarray5 <- array(NA, dim=c(1,2,100))
dim(test_slice(Rarray5))
> 1 2
Rarray6 <- array(NA, dim=c(2,1,100))
dim(test_slice(Rarray6))
> 2 1
- 主要語言
- C++
- 星號
- 211
- 分支
- 54
- 平均合併
- 5 分鐘
- 30 天內合併 PR
- 1
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
RcppCore/RcppArmadillo 的其他 Issue
-
難度 5/5 一週以上 新手友好度 25/100
RcppCore/RcppArmadillo#454 · 3 則留言 ·
-
難度 5/5 一週以上 新手友好度 25/100
RcppCore/RcppArmadillo#364 · 10 則留言 ·
-
難度 4/5 3-5 天 新手友好度 20/100
RcppCore/RcppArmadillo#268 · 3 個 reaction ·
-
enhancement help wanted
難度 4/5 3-5 天 新手友好度 35/100
RcppCore/RcppArmadillo#263 · 3 則留言 · 2 個 reaction ·
-
enhancement help wanted
難度 4/5 3-5 天 新手友好度 35/100
RcppCore/RcppArmadillo#250 · 1 則留言 ·
查看 RcppCore/RcppArmadillo 的全部 Issue
相似的 Issue
-
Website Doc Typo 未關閉
難度 1/5 1 小時以內 新手友好度 92/100
-
難度 1/5 1-3 小時 新手友好度 92/100
autowarefoundation/autoware_universe#13413 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
-
automated-analysis bug memory-safety
難度 2/5 1-3 小時 新手友好度 68/100
-
難度 2/5 1-3 小時 新手友好度 88/100