pykeops.numpy.Genred and pykeops.torch.Genred do not handle cases where
the reduction and the axis are given directly in the formula, such as
formula = "Sum_Reduction(SqNorm2(x-y), 0)". Instead we need to pass
arguments as
Genred(formula="SqNorm2(x-y)", aliases=..., reduction_op="Sum", axis=0, ...)
The function get_pykeops_formula() breaks RKeOps formula into relevant
parts for pykeops Genred function.
get_pykeops_formula(
formula,
grad = FALSE,
var_to_diff = NULL,
input_grad = NULL
)list with items:
reduction_op: character string, name of the reduction that will be
applied.
main_formula: formula defining the symbolic matrix on which the
reduction will be applied.
axis: integer, axis along which the reduction will be applied (see
details).
opt_arg: integer, optional additional argument for the reduction.
character string, RKeOps formula defining an operator
boolean, used for recursive call involving Grad. Default is
FALSE.
character string, used for recursive call
involving Grad. Default is NULL.
character string, used for recursive call
involving Grad. Default is NULL.
Ghislain Durif
axis=0 means a reduction over i (meaning that the result is a Vj
variable).
axis=1 means a reduction over j (meaning that the result is a Vi
variable).