rray_dot() works exactly like the base R function, %*%, but preserves the rray class where applicable. For the exact details of how 1D objects are promoted to 2D objects, see %*%.

rray_dot(x, y)


x, y

Arrays or rrays that are either 1D or 2D.


The result of the matrix multiplication of x and y. See %*% for the exact details. The common type of x and y will be preserved.


Due to some peculiarities with how %*% dispatches with S3 objects, calling %*% directly with an rray will compute the matrix multiplication correctly, but the class will be lost. rray_dot() ensures that the rray class is maintained.


rray_dot(1:5, 1:5)
#> [,1] #> [1,] 55
rray_dot(rray(1:5), 1:5)
#> <rray<dbl>[,1][1]> #> [,1] #> [1,] 55