Convert a matrix to a vector of arrays
matrix_to_tuples(x) tuples_to_matrix(x)
x | object to be converted |
---|
The algorithms in kdtools can accept either matrices or an arrayvec object. When a matrix is passed, it is converted to an arrayvec object internally and the results are converted back to a matrix. For optimal performance, pre-convert matrices.
#> int [1:5, 1:2] 1 2 3 4 5 6 7 8 9 10str(y)#> List of 3 #> $ xptr: num 1 #> $ nrow: num 2 #> $ ncol: num 3 #> - attr(*, "class")= chr "arrayvec"y[1:2, ]#> [,1] [,2] #> [1,] 1 6 #> [2,] 2 7