Misunderstanding if trying to add matrix with a vector
library(gpuR) A <- vclMatrix(rnorm(4), ncol = 2, nrow = 2) B <- vclVector(rnorm(2)) as.matrix(A+B) as.matrix(A)
We get same value.
as.matrix(A+B) [,1] [,2] [1,] 1.3868894 -0.3154218 [2,] -0.9026289 -1.1150675 as.matrix(A) [,1] [,2] [1,] 1.3868894 -0.3154218 [2,] -0.9026289 -1.1150675
I think it may cause hidden trouble if it doesn't behave like normal matrix without an error or warning.
Thanks for the report, I can confirm this is a bug. I will address it as quickly as I am able.
@shan0629 this is actually because I don't have 'recycling' currently implemented when the size of the matrix and vector do not match. That is part of issue #62. If the sizes of the two objects match, then the functions continue to behave correctly.