Wraps a list of dual objects in a container that supports [] indexing and length(), so that user functions can use natural theta[1] notation.

dual_vector(...)

Arguments

...

Dual objects, or a single list of dual objects.

Value

A dual_vector.

Examples

dv <- dual_vector(dual(1, 0), dual(2, 1))
length(dv)  # 2
#> [1] 2
value(dv[1])  # 1
#> [1] 1