Learn R Programming

rkeops (version 2.2.2)

get_pykeops_formula: Format RKeOps formula for PyKeOps

Description

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.

Usage

get_pykeops_formula(
  formula,
  grad = FALSE,
  var_to_diff = NULL,
  input_grad = NULL
)

Value

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.

Arguments

formula

character string, RKeOps formula defining an operator

grad

boolean, used for recursive call involving Grad. Default is FALSE.

var_to_diff

character string, used for recursive call involving Grad. Default is NULL.

input_grad

character string, used for recursive call involving Grad. Default is NULL.

Author

Ghislain Durif

Details

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).