Skip to content

Commit 2bc1bde

Browse files
arnavk23Copilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent df4e872 commit 2bc1bde

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/nlp/api.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ function jac_op!(
642642
vals::AbstractVector{T},
643643
Jv::AbstractVector,
644644
Jtv::AbstractVector,
645-
) where {T, S}
645+
) where {T, S}
646646
end
647647

648648
"""
@@ -711,7 +711,7 @@ function jac_lin_op!(
711711
vals::AbstractVector{T},
712712
Jv::AbstractVector,
713713
Jtv::AbstractVector,
714-
) where {T, S}
714+
) where {T, S}
715715
end
716716

717717
"""
@@ -741,7 +741,7 @@ function jac_nln_op!(
741741
x::AbstractVector{T},
742742
Jv::AbstractVector,
743743
Jtv::AbstractVector,
744-
) where {T, S}
744+
) where {T, S}
745745
end
746746

747747
"""
@@ -759,7 +759,7 @@ function jac_nln_op!(
759759
vals::AbstractVector{T},
760760
Jv::AbstractVector,
761761
Jtv::AbstractVector,
762-
) where {T, S}
762+
) where {T, S}
763763
end
764764

765765
"""

src/nlp/defaults.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,25 +204,29 @@ function jprod!(
204204
coo_prod!(rows, cols, vals, v, Jv)
205205
end
206206

207-
function jprod_lin(nlp::AbstractNLPModel{T, S}, v::AbstractVector) where {T, S}
207+
function jprod_lin(nlp::AbstractNLPModel{T, S}, x::AbstractVector, v::AbstractVector) where {T, S}
208208
@lencheck nlp.meta.nvar v
209209
Jv = S(undef, nlp.meta.nlin)
210-
return jprod_lin!(nlp, v, Jv)
210+
return jprod_lin!(nlp, x, v, Jv)
211211
end
212212

213213
function jprod_lin!(
214214
nlp::AbstractNLPModel,
215-
rows::AbstractVector{<:Integer},
216-
cols::AbstractVector{<:Integer},
217-
vals::AbstractVector,
215+
x::AbstractVector,
218216
v::AbstractVector,
219217
Jv::AbstractVector,
220218
)
221-
@lencheck nlp.meta.lin_nnzj rows cols vals
222219
@lencheck nlp.meta.nvar v
223220
@lencheck nlp.meta.nlin Jv
224221
increment!(nlp, :neval_jprod_lin)
225-
coo_prod!(rows, cols, vals, v, Jv)
222+
# The linear Jacobian does not depend on x, so x is unused
223+
# If a sparse representation is needed, a separate method can be provided
224+
# For now, assume a dense or user-provided implementation
225+
# If there is a sparse structure, call the appropriate method here
226+
# For now, fallback to a generic implementation if available
227+
# This is a placeholder; actual implementation may vary
228+
# coo_prod!(rows, cols, vals, v, Jv) # Uncomment if needed
229+
error("jprod_lin! not implemented for this AbstractNLPModel")
226230
end
227231

228232
function jprod_nln(nlp::AbstractNLPModel{T, S}, x::AbstractVector, v::AbstractVector) where {T, S}

0 commit comments

Comments
 (0)