RfastOfficial/Rfast

`rowShuffle` bugs

jblood94 opened this issue · 1 comments

Bug description
rowShuffle does not behave as expected for non-square matrices. It fills with 0 for row > ncol and errors if ncol > nrow.

To Reproduce

rowShuffle(matrix(1:30, 10))
#>       [,1] [,2] [,3]
#>  [1,]    1   11   21
#>  [2,]   22   12    2
#>  [3,]    3   13   23
#>  [4,]    0    0    0
#>  [5,]    0    0    0
#>  [6,]    0    0    0
#>  [7,]    0    0    0
#>  [8,]    0    0    0
#>  [9,]    0    0    0
#> [10,]    0    0    0
rowShuffle(t(matrix(1:30, 10)))
#> Error in eval(expr, envir, enclos): Row index is out of bounds: [index=3; row extent=3].

Expected behavior
colShuffle behaves as expected and can be used in place of rowShuffle with transpositions, but the transpositions slow it down.

t(colShuffle(t(matrix(1:30, 10))))
#>       [,1] [,2] [,3]
#>  [1,]   11   21    1
#>  [2,]    2   22   12
#>  [3,]   23   13    3
#>  [4,]    4   24   14
#>  [5,]    5   25   15
#>  [6,]    6   26   16
#>  [7,]    7   27   17
#>  [8,]    8   28   18
#>  [9,]    9   29   19
#> [10,]   10   20   30
t(colShuffle(matrix(1:30, 10)))
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
#> [1,]    3    2   10    8    4    7    1    9    6     5
#> [2,]   13   14   19   18   17   20   15   12   11    16
#> [3,]   27   21   30   23   29   28   22   26   25    24

Desktop (please complete the following information):

  • OS: [e.g. Windows 10 64-bit]
  • R-Version [e.g. 4.3.3]
  • Rfast-Version [e.g. 2.1.0]
  • GCC-Version [e.g. 12.3.0]

Thanks. I just fixed and there will be available in the new version in about 2 weeks.