format_var_aliases: Format formula argument list in triplet (type, dimension,...

Description Usage Arguments Details Value Author(s)

View source: R/generic-format_var_aliase.R

Description

The function format_var_aliases formats KeOps formula arguments to be understood by the C++ code.

Usage

1

Arguments

args

vector of text string, formula input arguments (see Details).

Details

Mathematical formula: sum_i e^(lambda*||x_i - y_j||^2) where x_i, y_j are 3d vectors, and lambda is a scaler parameter.

Corresponding KeOps formula and input parameters:

1
2
formula = "Sum_Reduction(Exp(lambda * SqNorm2(x-y)), 0)"
args = c("x=Vi(3)", "y=Vj(3)", "lambda=Pm(1)")

Input arguments can be of different types:

|———|————————-|———–| | keyword | meaning | type | |———|————————-|———–| | Vi | variable indexed by i | 0 | | Vj | variable indexed by j | 1 | | Pm | parameter | 2 | |———|————————-|———–|

An input parameters should be defined as follows "x=YY(dim)" or "x=YY(pos, dim)" where YY can be Vi, Vj or Pm:

For the formula "Sum_Reduction(Exp(lambda * SqNorm2(x-y)), 0)", both args = c("x=Vi(3)", "y=Vj(3)", "lambda=Pm(1)") and args <- c("x=Vi(0,3)", "y=Vj(1,3)", "beta=Vj(2,3)", "lambda=Pm(3,1)") are equivalent. When specifying the pos parameter, the natural order in the vector args may not correspond to the order of the formula input arguments.

Note: we recommand to use the Vi(dim) notation and let the position be determined by the argument order.

Value

a list with different information about formula input arguments:

args

vector of text string, input parameter args

var_name

vector of text string, corresponding name of formula arguments

var_type

vector of text string, corresponding type of formula arguments (among Vi, Vj, Pm).

var_pos

vector of integer, corresponding arguments positions.

var_aliases

text string, declaration of formula input arguments for the C++ KeOps API.

Author(s)

Ghislain Durif


rkeops documentation built on Feb. 17, 2021, 5:08 p.m.