-
-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
Both the lower_tri
and upper_tri
sugar functions are non-functional for two reasons:
- Neither function returns a
Matrix
as CTRP's base isVectorBase
instead ofMatrixBase
. - Attempting to store the result in a
LogicalVector
leads the R process to hang.
After glancing at the source, it appears as if both of functions were DOA and should not have been pushed back with Rcpp 0.8.3. Though, this remark is made in light of the fact that there are no unit tests governing these functions.
The following will hang your R session
Rcpp::cppFunction('
LogicalVector test(NumericMatrix x){
return upper_tri(x);
}')
x <- matrix(1:4, 4, 5)
test(x)
Example of desired output:
(x <- matrix(1:4, 4, 5))
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1 1 1 1 1
#> [2,] 2 2 2 2 2
#> [3,] 3 3 3 3 3
#> [4,] 4 4 4 4 4
lower.tri(x)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] FALSE FALSE FALSE FALSE FALSE
#> [2,] TRUE FALSE FALSE FALSE FALSE
#> [3,] TRUE TRUE FALSE FALSE FALSE
#> [4,] TRUE TRUE TRUE FALSE FALSE
Metadata
Metadata
Assignees
Labels
No labels