Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Aug 29, 2023
1 parent 2393c02 commit fa036af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions docs/src/manual/nonlinear.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,8 @@ op_square_2 = model[:op_square]

### Add an operator without macros

The [`@operator`](@ref) macro is syntactic sugar for the
[`add_nonlinear_operator`](@ref) method. Thus, the non-macro version of the
preceding example is:
The [`@operator`](@ref) macro is syntactic sugar for [`add_nonlinear_operator`](@ref).
Thus, the non-macro version of the preceding example is:

```@repl
using JuMP
Expand Down Expand Up @@ -534,15 +533,15 @@ your function which are `Float64`.
```julia
function bad_f(x...)
y = zeros(length(x)) # This constructs an array of `Float64`!
for i = 1:length(x)
for i in 1:length(x)
y[i] = x[i]^i
end
return sum(y)
end

function good_f(x::T...) where {T<:Real}
y = zeros(T, length(x)) # Construct an array of type `T` instead!
for i = 1:length(x)
for i in 1:length(x)
y[i] = x[i]^i
end
return sum(y)
Expand Down
8 changes: 4 additions & 4 deletions src/nlp_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,8 @@ If `dim > 1`, then the method signatures of each function must be:
* `∇²f(H::AbstractMatrix{T}, x::T...)::Nothing where {T<:Real}`
Where the gradient vector `g` and Hessian matrix `H` are filled in-place. For
the Hessian, you must fill in the non-zero upper-triangular entries only.
Setting an off-diagonal lower-triangular element may error.
the Hessian, you must fill in the non-zero lower-triangular entries only.
Setting an off-diagonal upper-triangular element may error.
## Example
Expand Down Expand Up @@ -1001,8 +1001,8 @@ If `dim > 1`, then the method signatures of each function must be:
* `∇²f(H::AbstractMatrix{T}, x::T...)::Nothing where {T<:Real}`
Where the gradient vector `g` and Hessian matrix `H` are filled in-place. For
the Hessian, you must fill in the non-zero upper-triangular entries only.
Setting an off-diagonal lower-triangular element may error.
the Hessian, you must fill in the non-zero lower-triangular entries only.
Setting an off-diagonal upper-triangular element may error.
## Example
Expand Down

0 comments on commit fa036af

Please sign in to comment.