Skip to contents

An objective list holds an objective value with gradient and Hessian, as objective functions such as normL2(), constraintL2() and datapointL2() return them. Further numeric attributes are added along when two objective lists are added with +, see sumobjlist.

Usage

objlist(value, gradient, hessian)

Arguments

value

Numeric of length 1.

gradient

Named numeric vector, or NULL.

hessian

Matrix with row and column names those of gradient, or NULL.

Value

An object of class objlist.

Details

Asked for hessian = "sparse", an objective may return part of the Hessian in an entry lowrank, a list of a matrix U with parameter rows and a vector d: the Hessian is then hessian + U diag(d) U'.

Asked for hessian = "structured", a data term such as normL2() returns the Gauss-Newton Hessian and an entry structure, a list of the matrix jacobian, one row per data point with the derivatives of the prediction, and one more for a sigma that depends on parameters, the vector seeds of the derivatives of the value in these predictions and sigmas, and the Gauss-Newton Hessian hessian of the data term. + stacks the rows and adds the Hessians; a term without data rows has none. The structured methods of trust() read it.

See also

Examples

a <- objlist(1, c(a = 1, b = 2),
             matrix(2, nrow = 2, ncol = 2,
                    dimnames = list(c("a", "b"), c("a", "b"))))
a + a
#> value
#> ==================
#> 2
#> gradient[1:2] (full length = 2)
#> ==================
#> a b 
#> 2 4 
#> 
#> hessian[1:2,1:2]
#> ==================
#>   a b
#> a 4 4
#> b 4 4
#> 
#> 
#> attributes
#> ==================