Dimension swap from cube to matrix
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- C++
- Star
- 211
- Fork
- 54
- Merge trung bình
- 5 phút
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của RcppCore/RcppArmadillo
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
RcppCore/RcppArmadillo#454 · 3 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
RcppCore/RcppArmadillo#364 · 10 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
RcppCore/RcppArmadillo#268 · 3 reaction ·
-
enhancement help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
RcppCore/RcppArmadillo#263 · 3 bình luận · 2 reaction ·
-
enhancement help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
RcppCore/RcppArmadillo#250 · 1 bình luận ·
Tất cả issue của RcppCore/RcppArmadillo
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
objectionary/eo-graphs#74 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
QuantStack/git2cpp#187 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100