Skip to content

Commit 88e19bb

Browse files
authored
Define generic neval_hprod for QuasiNewtonModels (#144)
* Define generic neval_hprod for QuasiNewtonModels supsersedes #102
1 parent 7bca80e commit 88e19bb

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1414
FastClosures = "0.3.0"
1515
LinearAlgebra = "1.10"
1616
LinearOperators = "^2.7"
17-
NLPModels = "0.21.6"
17+
NLPModels = "0.21"
1818
Printf = "1.10"
1919
SparseArrays = "1.10"
2020
julia = "1.10"

src/quasi-newton.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ function get_op(nlp::QuasiNewtonModel)
2929
error("get_op is not implemented for $(typeof(nlp)).")
3030
end
3131

32+
# Redefine neval_hprod for all QuasiNewtonModels.
33+
NLPModels.neval_hprod(nlp::QuasiNewtonModel) = get_op(nlp).nprod
34+
3235
mutable struct LBFGSModel{
3336
T,
3437
S,
@@ -45,7 +48,6 @@ end
4548
get_model(nlp::LBFGSModel) = nlp.model
4649
get_op(nlp::LBFGSModel) = nlp.op
4750
@default_counters LBFGSModel model (neval_hprod,)
48-
NLPModels.neval_hprod(nlp::LBFGSModel) = get_op(nlp).nprod
4951

5052
mutable struct LSR1Model{
5153
T,
@@ -63,7 +65,6 @@ end
6365
get_model(nlp::LSR1Model) = nlp.model
6466
get_op(nlp::LSR1Model) = nlp.op
6567
@default_counters LSR1Model model (neval_hprod,)
66-
NLPModels.neval_hprod(nlp::LSR1Model) = get_op(nlp).nprod
6768

6869
mutable struct DiagonalQNModel{
6970
T,
@@ -80,7 +81,6 @@ end
8081
get_model(nlp::DiagonalQNModel) = nlp.model
8182
get_op(nlp::DiagonalQNModel) = nlp.op
8283
@default_counters DiagonalQNModel model (neval_hprod,)
83-
NLPModels.neval_hprod(nlp::DiagonalQNModel) = get_op(nlp).nprod
8484

8585
"Construct a `LBFGSModel` from another type of model."
8686
function LBFGSModel(nlp::AbstractNLPModel{T, S}; kwargs...) where {T, S}

0 commit comments

Comments
 (0)