This class represents a parameter whose value is obtained by evaluating a function.

CallbackParam(callback, dim = NULL, ...)

# S4 method for CallbackParam
value(object)

Arguments

callback

A callback function that generates the parameter value.

dim

The dimensions of the parameter.

...

Additional attribute arguments. See Leaf for details.

object

A CallbackParam object.

Slots

callback

A callback function that generates the parameter value.

dim

The dimensions of the parameter.

Examples

x <- Variable(2)
fun <- function() { value(x) }
y <- CallbackParam(fun, dim(x), nonneg = TRUE)
get_data(y)
#> $dim
#> [1] 2 1
#> 
#> $name
#> [1] "paramNA"
#> 
#> $value
#> [1] NA
#> 
#> $attributes
#> $attributes$dim
#> [1] 2 1
#> 
#> $attributes$callback
#> function() { value(x) }
#> <environment: 0x7fa56ea88128>
#> 
#> $attributes$name
#> [1] "paramNA"
#> 
#> $attributes$venv
#> <environment: 0x7fa57a637a00>
#> 
#> $attributes$.is_vector
#> [1] FALSE
#> 
#> $attributes$value
#> [1] NA
#> 
#> $attributes$nonneg
#> [1] FALSE
#> 
#> $attributes$nonpos
#> [1] FALSE
#> 
#> $attributes$complex
#> [1] FALSE
#> 
#> $attributes$imag
#> [1] FALSE
#> 
#> $attributes$symmetric
#> [1] FALSE
#> 
#> $attributes$diag
#> [1] FALSE
#> 
#> $attributes$PSD
#> [1] FALSE
#> 
#> $attributes$NSD
#> [1] FALSE
#> 
#> $attributes$hermitian
#> [1] FALSE
#> 
#> $attributes$boolean
#> [1] FALSE
#> 
#> $attributes$integer
#> [1] FALSE
#> 
#> $attributes$sparsity
#>      [,1]
#> 
#> $attributes$pos
#> [1] FALSE
#> 
#> $attributes$neg
#> [1] FALSE
#> 
#> $attributes$attributes
#> $attributes$attributes$nonneg
#> [1] TRUE
#> 
#> $attributes$attributes$nonpos
#> [1] FALSE
#> 
#> $attributes$attributes$pos
#> [1] FALSE
#> 
#> $attributes$attributes$neg
#> [1] FALSE
#> 
#> $attributes$attributes$complex
#> [1] FALSE
#> 
#> $attributes$attributes$imag
#> [1] FALSE
#> 
#> $attributes$attributes$symmetric
#> [1] FALSE
#> 
#> $attributes$attributes$diag
#> [1] FALSE
#> 
#> $attributes$attributes$PSD
#> [1] FALSE
#> 
#> $attributes$attributes$NSD
#> [1] FALSE
#> 
#> $attributes$attributes$hermitian
#> [1] FALSE
#> 
#> $attributes$attributes$boolean
#> [1] FALSE
#> 
#> $attributes$attributes$integer
#> [1] FALSE
#> 
#> $attributes$attributes$sparsity
#>      [,1]
#> 
#> 
#> $attributes$boolean_idx
#>      [,1] [,2]
#> 
#> $attributes$integer_idx
#>      [,1] [,2]
#> 
#> $attributes$id
#> [1] 17
#> 
#> $attributes$args
#> list()
#> 
#> $attributes$validate
#> [1] TRUE
#> 
#> $attributes$class
#> [1] "CallbackParam"
#> attr(,"package")
#> [1] "CVXR"
#> 
#>