Skip to contents

with_autodiff_variants(setups, ad_backends) returns the setups tagged <tag_prefix>_default, each followed (for algorithms with an autodiff option) by one variant per backend: the algorithm with that backend, named "<name> (<Backend>)" and tagged <tag_prefix>_<backend> (such as autodiff_finitediff).

Usage

with_autodiff_variants(setups, ad_backends, tag_prefix = "autodiff")

Arguments

setups

List of setups.

ad_backends

List of backends such as AutoFiniteDiff().

tag_prefix

Prefix of the tags.

Value

A list of setups.

Examples

v <- with_autodiff_variants(list(list(alg = Rodas5P()), list(alg = Tsit5())),
  ad_backends = list(AutoFiniteDiff(), AutoForwardDiff()))
vapply(v, function(s) if (is.null(s$name)) "" else s$name, "")
#> [1] ""                      "Rodas5P (FiniteDiff)"  "Rodas5P (ForwardDiff)"
#> [4] ""