getkeops / keops

KErnel OPerationS, on CPUs and GPUs, with autodiff and without memory overflows
https://www.kernel-operations.io
MIT License
1.04k stars 64 forks source link

vector of parameter badly converted to matrix in RKeOps #182

Closed AmelieVernay closed 3 years ago

AmelieVernay commented 3 years ago
D <- 2
M <- 3
xl <- c(1, 2, 3)
x <- matrix(xl, 3, 2)
vect <- c(1, 2)

formula = "Sum_Reduction(x+y, 1)"
args = c("x=Vj(2)", "y=Pm(2)")
op1 <- keops_kernel(formula, args)

op1(list(x, vect))

Outputs

 Error in r_genred(input, param) : 
  [KeOps] Wrong value of the 'vector size' dimension 0 for arg at position 1 : is 1 but should be 2 
gdurif commented 3 years ago

Origin of the problem: non-matrix input data (in function generated by keops_kernel) are converted to matrix-type with as.matrix, however vectors (here vect) are converted to n x 1 matrix (or column-vector) instead of 1 x d matrix (or row-vector).

gdurif commented 3 years ago