# Reference

## Index

NLPModels.CountersType
Counters

Struct for storing the number of function evaluations.

Counters()

Creates an empty Counters struct.

source
NLPModels.coo_prod!Method
coo_prod!(rows, cols, vals, v, Av)

Compute the product of a matrix A given by (rows, cols, vals) and the vector v. The result is stored in Av, which should have length equals to the number of rows of A.

source
NLPModels.coo_sym_prod!Method
coo_sym_prod!(rows, cols, vals, v, Av)

Compute the product of a symmetric matrix A given by (rows, cols, vals) and the vector v. The result is stored in Av, which should have length equals to the number of rows of A. Only one triangle of A should be passed.

source
NLPModels.has_equalitiesMethod
has_equalities(nlp)

Returns whether the problem has constraints and at least one of them is an equality. Unconstrained problems return false.

source
NLPModels.hessMethod
Hx = hess(nlp, x, y; obj_weight=1.0)

Evaluate the Lagrangian Hessian at (x,y) as a sparse matrix, with objective function scaled by obj_weight, i.e.,

$$$∇²L(x,y) = σ ∇²f(x) + \sum_i yᵢ ∇²cᵢ(x),$$$

with σ = obj_weight . A Symmetric object wrapping the lower triangle is returned.

source
NLPModels.hessMethod
Hx = hess(nlp, x; obj_weight=1.0)

Evaluate the objective Hessian at x as a sparse matrix, with objective function scaled by obj_weight, i.e.,

$$$σ ∇²f(x),$$$

with σ = obj_weight . A Symmetric object wrapping the lower triangle is returned.

source
NLPModels.hess_coord!Method
vals = hess_coord!(nlp, x, vals; obj_weight=1.0)

Evaluate the objective Hessian at x in sparse coordinate format, with objective function scaled by obj_weight, i.e.,

$$$σ ∇²f(x),$$$

with σ = obj_weight , overwriting vals. Only the lower triangle is returned.

source
NLPModels.hess_coordMethod
vals = hess_coord(nlp, x, y; obj_weight=1.0)

Evaluate the Lagrangian Hessian at (x,y) in sparse coordinate format, with objective function scaled by obj_weight, i.e.,

$$$∇²L(x,y) = σ ∇²f(x) + \sum_i yᵢ ∇²cᵢ(x),$$$

with σ = obj_weight . Only the lower triangle is returned.

source
NLPModels.hess_coordMethod
vals = hess_coord(nlp, x; obj_weight=1.0)

Evaluate the objective Hessian at x in sparse coordinate format, with objective function scaled by obj_weight, i.e.,

$$$σ ∇²f(x),$$$

with σ = obj_weight . Only the lower triangle is returned.

source
NLPModels.hess_coord_residualMethod
vals = hess_coord_residual(nls, x, v)

Computes the linear combination of the Hessians of the residuals at x with coefficients v in sparse coordinate format.

source
NLPModels.hess_op!Method
H = hess_op!(nlp, x, y, Hv; obj_weight=1.0)

Return the Lagrangian Hessian at (x,y) with objective function scaled by obj_weight as a linear operator, and storing the result on Hv. The resulting object may be used as if it were a matrix, e.g., w = H * v. The vector Hv is used as preallocated storage for the operation. The linear operator H represents

$$$∇²L(x,y) = σ ∇²f(x) + \sum_i yᵢ ∇²cᵢ(x),$$$

with σ = obj_weight .

source
NLPModels.hess_op!Method
H = hess_op!(nlp, x, Hv; obj_weight=1.0)

Return the objective Hessian at x with objective function scaled by obj_weight as a linear operator, and storing the result on Hv. The resulting object may be used as if it were a matrix, e.g., w = H * v. The vector Hv is used as preallocated storage for the operation. The linear operator H represents

$$$σ ∇²f(x),$$$

with σ = obj_weight .

source
NLPModels.hess_op!Method
H = hess_op!(nlp, rows, cols, vals, Hv)

Return the Hessian given by (rows, cols, vals) as a linear operator, and storing the result on Hv. The resulting object may be used as if it were a matrix, e.g., w = H * v. The vector Hv is used as preallocated storage for the operation. The linear operator H represents

$$$σ ∇²f(x),$$$

with σ = obj_weight .

source
NLPModels.hess_opMethod
H = hess_op(nlp, x, y; obj_weight=1.0)

Return the Lagrangian Hessian at (x,y) with objective function scaled by obj_weight as a linear operator. The resulting object may be used as if it were a matrix, e.g., H * v. The linear operator H represents

$$$∇²L(x,y) = σ ∇²f(x) + \sum_i yᵢ ∇²cᵢ(x),$$$

with σ = obj_weight .

source
NLPModels.hess_opMethod
H = hess_op(nlp, x; obj_weight=1.0)

Return the objective Hessian at x with objective function scaled by obj_weight as a linear operator. The resulting object may be used as if it were a matrix, e.g., H * v. The linear operator H represents

$$$σ ∇²f(x),$$$

with σ = obj_weight .

source
NLPModels.hess_op_residual!Method
Hop = hess_op_residual!(nls, x, i, Hiv)

Computes the Hessian of the i-th residual at x, in linear operator form. The vector Hiv is used as preallocated storage for the operation.

source
NLPModels.hess_residualMethod
H = hess_residual(nls, x, v)

Computes the linear combination of the Hessians of the residuals at x with coefficients v. A Symmetric object wrapping the lower triangle is returned.

source
NLPModels.histlineMethod
histline(s, v, maxv)

Return a string of the form

______NAME______: ████⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 5

where:

• ______NAME______ is s with padding to the left and length 16.
• And the symbols █ and ⋅ fill 20 characters in the proportion of v / maxv to █ and the rest to ⋅.
• The number 5 is v.
source
NLPModels.hprod!Method
Hv = hprod!(nlp, rows, cols, vals, v, Hv)

Evaluate the product of the objective or Lagrangian Hessian given by (rows, cols, vals) in triplet format with the vector v in place. Only one triangle of the Hessian should be given.

source
NLPModels.hprod!Method
Hv = hprod!(nlp, x, v, Hv; obj_weight=1.0)

Evaluate the product of the objective Hessian at x with the vector v in place, with objective function scaled by obj_weight, where the objective Hessian is

$$$σ ∇²f(x),$$$

with σ = obj_weight .

source
NLPModels.hprodMethod
Hv = hprod(nlp, x, y, v; obj_weight=1.0)

Evaluate the product of the Lagrangian Hessian at (x,y) with the vector v, with objective function scaled by obj_weight, where the Lagrangian Hessian is

$$$∇²L(x,y) = σ ∇²f(x) + \sum_i yᵢ ∇²cᵢ(x),$$$

with σ = obj_weight .

source
NLPModels.hprodMethod
Hv = hprod(nlp, x, v; obj_weight=1.0)

Evaluate the product of the objective Hessian at x with the vector v, with objective function scaled by obj_weight, where the objective Hessian is

$$$σ ∇²f(x),$$$

with σ = obj_weight .

source
NLPModels.jacMethod
Jx = jac(nlp, x)

Evaluate $J(x)$, the constraints Jacobian at x as a sparse matrix.

source
NLPModels.jac_coord!Method
vals = jac_coord!(nlp, x, vals)

Evaluate $J(x)$, the constraints Jacobian at x in sparse coordinate format, rewriting vals.

source
NLPModels.jac_lin_op!Method
J = jac_lin_op!(nlp, rows, cols, vals, Jv, Jtv)

Return the linear Jacobian given by (rows, cols, vals) as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v. The values Jv and Jtv are used as preallocated storage for the operations.

source
NLPModels.jac_lin_op!Method
J = jac_lin_op!(nlp, x, Jv, Jtv)

Return the linear Jacobian at x as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v. The values Jv and Jtv are used as preallocated storage for the operations.

source
NLPModels.jac_lin_opMethod
J = jac_lin_op(nlp, x)

Return the linear Jacobian at x as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v.

source
NLPModels.jac_nlnMethod
Jx = jac_nln(nlp, x)

Evaluate $J(x)$, the nonlinear constraints Jacobian at x as a sparse matrix.

source
NLPModels.jac_nln_op!Method
J = jac_nln_op!(nlp, rows, cols, vals, Jv, Jtv)

Return the nonlinear Jacobian given by (rows, cols, vals) as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v. The values Jv and Jtv are used as preallocated storage for the operations.

source
NLPModels.jac_nln_op!Method
J = jac_nln_op!(nlp, x, Jv, Jtv)

Return the nonlinear Jacobian at x as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v. The values Jv and Jtv are used as preallocated storage for the operations.

source
NLPModels.jac_nln_opMethod
J = jac_nln_op(nlp, x)

Return the nonlinear Jacobian at x as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v.

source
NLPModels.jac_op!Method
J = jac_op!(nlp, rows, cols, vals, Jv, Jtv)

Return the Jacobian given by (rows, cols, vals) as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v. The values Jv and Jtv are used as preallocated storage for the operations.

source
NLPModels.jac_op!Method
J = jac_op!(nlp, x, Jv, Jtv)

Return the Jacobian at x as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v. The values Jv and Jtv are used as preallocated storage for the operations.

source
NLPModels.jac_opMethod
J = jac_op(nlp, x)

Return the Jacobian at x as a linear operator. The resulting object may be used as if it were a matrix, e.g., J * v or J' * v.

source
NLPModels.jac_op_residual!Method
Jx = jac_op_residual!(nls, x, Jv, Jtv)

Computes $J(x)$, the Jacobian of the residual at x, in linear operator form. The vectors Jv and Jtv are used as preallocated storage for the operations.

source
NLPModels.jac_op_residual!Method
Jx = jac_op_residual!(nls, rows, cols, vals, Jv, Jtv)

Computes $J(x)$, the Jacobian of the residual given by (rows, cols, vals), in linear operator form. The vectors Jv and Jtv are used as preallocated storage for the operations.

source
NLPModels.jprod!Method
Jv = jprod!(nlp, rows, cols, vals, v, Jv)

Evaluate $J(x)v$, the Jacobian-vector product, where the Jacobian is given by (rows, cols, vals) in triplet format.

source
NLPModels.jprod_lin!Method
Jv = jprod_lin!(nlp, rows, cols, vals, v, Jv)

Evaluate $J(x)v$, the linear Jacobian-vector product, where the Jacobian is given by (rows, cols, vals) in triplet format.

source
NLPModels.jprod_nln!Method
Jv = jprod_nln!(nlp, rows, cols, vals, v, Jv)

Evaluate $J(x)v$, the nonlinear Jacobian-vector product, where the Jacobian is given by (rows, cols, vals) in triplet format.

source
NLPModels.jprod_residual!Method
Jv = jprod_residual!(nls, rows, cols, vals, v, Jv)

Computes the product of the Jacobian of the residual given by (rows, cols, vals) and a vector, i.e., $J(x)v$, storing it in Jv.

source
NLPModels.jth_hessMethod

Hx = jth_hess(nlp, x, j)

Evaluate the Hessian of j-th constraint at x as a sparse matrix with the same sparsity pattern as the Lagrangian Hessian. A Symmetric object wrapping the lower triangle is returned.

source
NLPModels.jth_hess_coordMethod
vals = jth_hess_coord(nlp, x, j)

Evaluate the Hessian of j-th constraint at x in sparse coordinate format. Only the lower triangle is returned.

source
NLPModels.jth_hprodMethod
Hv = jth_hprod(nlp, x, v, j)

Evaluate the product of the Hessian of j-th constraint at x with the vector v.

source
NLPModels.jtprod!Method
Jtv = jtprod!(nlp, x, v, Jtv)

Evaluate $J(x)^Tv$, the transposed-Jacobian-vector product at x in place. If the problem has linear and nonlinear constraints, this function allocates.

source
NLPModels.jtprod!Method
Jtv = jtprod!(nlp, rows, cols, vals, v, Jtv)

Evaluate $J(x)^Tv$, the transposed-Jacobian-vector product, where the Jacobian is given by (rows, cols, vals) in triplet format.

source
NLPModels.jtprodMethod
Jtv = jtprod(nlp, x, v, Jtv)

Evaluate $J(x)^Tv$, the transposed-Jacobian-vector product at x.

source
NLPModels.jtprod_lin!Method
Jtv = jtprod_lin!(nlp, rows, cols, vals, v, Jtv)

Evaluate $J(x)^Tv$, the linear transposed-Jacobian-vector product, where the Jacobian is given by (rows, cols, vals) in triplet format.

source
NLPModels.jtprod_nln!Method
Jtv = jtprod_nln!(nlp, rows, cols, vals, v, Jtv)

Evaluate $J(x)^Tv$, the nonlinear transposed-Jacobian-vector product, where the Jacobian is given by (rows, cols, vals) in triplet format.

source
NLPModels.jtprod_residual!Method
Jtv = jtprod_residual!(nls, rows, cols, vals, v, Jtv)

Computes the product of the transpose of the Jacobian of the residual given by (rows, cols, vals) and a vector, i.e., $J(x)^Tv$, storing it in Jv.

source
NLPModels.lines_of_histMethod
lines_of_hist(S, V)

Return a vector of histline(s, v, maxv)s using pairs of s in S and v in V. maxv is given by the maximum of V.

source
NLPModels.nls_metaMethod
nls_meta(nls)

Returns the nls_meta structure of nls. Use this instead of nls.nls_meta to handle models that have internal models.

For basic models nls_meta(nls) is defined as nls.nls_meta, but composite models might not keep nls_meta themselves, so they might specialize it to something like nls.internal.nls_meta.

source
NLPModels.objcons!Method
f = objcons!(nlp, x, c)

Evaluate $f(x)$ and $c(x)$ at x. c is overwritten with the value of $c(x)$.

source
NLPModels.objgrad!Method
f, g = objgrad!(nlp, x, g)

Evaluate $f(x)$ and $∇f(x)$ at x. g is overwritten with the value of $∇f(x)$.

source
NLPModels.reset_data!Method
reset_data!(nlp)

Reset model data if appropriate. This method should be overloaded if a subtype of AbstractNLPModel contains data that should be reset, such as a quasi-Newton linear operator.

source
NLPModels.show_headerMethod
show_header(io, nlp)

Show a header for the specific nlp type. Should be imported and defined for every model implementing the NLPModels API.

source
NLPModels.sparsitylineMethod
sparsityline(s, v, maxv)

Return a string of the form

______NAME______: ( 80.00% sparsity)   5

where:

• ______NAME______ is s with padding to the left and length 16.
• The sparsity value is given by v / maxv.
• The number 5 is v.
source
NLPModels.@lencheckMacro
@lencheck n x y z …

Check that arrays x, y, z, etc. have a prescribed length n.

source
NLPModels.@rangecheckMacro
@rangecheck ℓ u i j k …

Check that values i, j, k, etc. are in the range [ℓ,u].

source