# Internal functions

These functions may or may not be exported. They are used internally.

`NLPModels.@default_counters`

— Macro`@default_counters Model inner`

Define functions relating counters of `Model`

to counters of `Model.inner`

.

`NLPModels.@default_nlscounters`

— Macro`@default_nlscounters Model inner`

Define functions relating NLS counters of `Model`

to NLS counters of `Model.inner`

.

`NLPModels.@lencheck`

— Macro`@lencheck n x y z …`

Check that arrays `x`

, `y`

, `z`

, etc. have a prescribed length `n`

.

`NLPModels.@rangecheck`

— Macro`@rangecheck ℓ u i j k …`

Check that values `i`

, `j`

, `k`

, etc. are in the range `[ℓ,u]`

.

`NLPModels.coo_prod!`

— Function`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`

.

`NLPModels.coo_sym_prod!`

— Function`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.

`NLPModels.decrement!`

— Function`decrement!(nlp, s)`

Decrement counter `s`

of problem `nlp`

.

`NLPModels.DimensionError`

— Type```
DimensionError <: Exception
DimensionError(name, dim_expected, dim_found)
```

Error for unexpected dimension. Output: "DimensionError: Input `name`

should have length `dim_expected`

not `dim_found`

"

`NLPModels.histline`

— Function`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.

`NLPModels.increment!`

— Function`increment!(nlp, s)`

Increment counter `s`

of problem `nlp`

.

`NLPModels.lines_of_description`

— Function`lines_of_description(meta)`

Describe `meta`

for the `show`

function.

`lines_of_description(nls_meta)`

Describe `nls_meta`

for the `show`

function.

`NLPModels.lines_of_hist`

— Function`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`

.

`NLPModels.show_counters`

— Function`show_counters(io, counters, fields)`

Show the `fields`

of the struct `counters`

.

`NLPModels.show_header`

— Function`show_header(io, nlp)`

Show a header for the specific `nlp`

type. Should be imported and defined for every model implementing the NLPModels API.

`NLPModels.sparsityline`

— Function`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.