Skip to content

Commit 77714b1

Browse files
committed
Update NLSMeta
1 parent 734bd93 commit 77714b1

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/nls/meta.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ The following keyword arguments are accepted:
1515
- `nnzj`: number of elements needed to store the nonzeros of the Jacobian of the residual
1616
- `nnzh`: number of elements needed to store the nonzeros of the sum of Hessians of the residuals
1717
- `lin`: indices of linear residuals
18+
- `jacobian_residual_available`: indicates whether the sparse Jacobian of the residuals is available
19+
- `hessian_residual_available`: indicates whether the sum of the sparse Hessians of the residuals is available
20+
- `Jv_residual_available`: indicates whether the Jacobian-vector product for the residuals is available
21+
- `Jtv_residual_available`: indicates whether the transpose Jacobian-vector product for the residuals is available
22+
- `Hv_residual_available`: indicates whether the sum of Hessian-vector product for the residuals is available
1823
1924
`NLSMeta` also contains the following attributes, which are computed from the variables above:
2025
- `nequ`: size of the residual
@@ -35,13 +40,24 @@ struct NLSMeta{T, S}
3540
lin::Vector{Int} # List of linear residuals
3641
nlin::Int # = length(lin)
3742

43+
jacobian_residual_available::Bool
44+
hessian_residual_available::Bool
45+
Jv_residual_available::Bool
46+
Jtv_residual_available::Bool
47+
Hv_residual_available::Bool
48+
3849
function NLSMeta{T, S}(
3950
nequ::Int,
4051
nvar::Int;
4152
x0::S = fill!(S(undef, nvar), zero(T)),
4253
nnzj = nequ * nvar,
4354
nnzh = div(nvar * (nvar + 1), 2),
4455
lin = Int[],
56+
jacobian_residual_available::Bool = true
57+
hessian_residual_available::Bool = true
58+
Jv_residual_available::Bool = true
59+
Jtv_residual_available::Bool = true
60+
Hv_residual_available::Bool = true
4561
) where {T, S}
4662
nnzj = max(0, nnzj)
4763
nnzh = max(0, nnzh)
@@ -50,7 +66,9 @@ struct NLSMeta{T, S}
5066
nlin = length(lin)
5167
nnln = length(nln)
5268

53-
return new{T, S}(nequ, nvar, x0, nnzj, nnzh, nln, nnln, lin, nlin)
69+
return new{T, S}(nequ, nvar, x0, nnzj, nnzh, nln, nnln, lin, nlin,
70+
jacobian_residual_available, hessian_residual_available, Jv_residual_available,
71+
Jtv_residual_available, Hv_residual_available)
5472
end
5573
end
5674

0 commit comments

Comments
 (0)