File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -398,7 +398,7 @@ function NLPModels.jac_coord!(
398
398
vals:: AbstractVector
399
399
) where {T, S, M1, M2 <: SparseMatrixCSC }
400
400
NLPModels. increment! (qp, :neval_jac )
401
- fill_coord! (qp. data. H , vals, one (T))
401
+ fill_coord! (qp. data. A , vals, one (T))
402
402
return vals
403
403
end
404
404
Original file line number Diff line number Diff line change 205
205
@test objgrad (SMLO, x)[2 ] ≈ objgrad (SM, x)[2 ]
206
206
end
207
207
208
+ @testset " struct and coord CSC" begin
209
+ H = [
210
+ 6.0 2.0 1.0
211
+ 2.0 5.0 2.0
212
+ 1.0 2.0 4.0
213
+ ]
214
+ c = [- 8.0 ; - 3 ; - 3 ]
215
+ A = [
216
+ 1.0 0.0 1.0
217
+ 0.0 2.0 1.0
218
+ ]
219
+ b = [0.0 ; 3 ]
220
+ l = [0.0 ; 0 ; 0 ]
221
+ u = [Inf ; Inf ; Inf ]
222
+ T = eltype (c)
223
+ qp = QuadraticModel (
224
+ c,
225
+ tril (sparse (H)),
226
+ A = sparse (A),
227
+ lcon = b,
228
+ ucon = b,
229
+ lvar = l,
230
+ uvar = u,
231
+ c0 = 0.0 ,
232
+ name = " QM" ,
233
+ )
234
+
235
+ x = zeros (3 )
236
+ rowsH, colsH = hess_structure (qp)
237
+ valsH = hess_coord (qp, x)
238
+ rowsHtrue, colsHtrue, valsHtrue = findnz (tril (sparse (H)))
239
+ @test rowsH == rowsHtrue
240
+ @test colsH == colsHtrue
241
+ @test valsH == valsHtrue
242
+ rowsA, colsA = jac_structure (qp)
243
+ valsA = jac_coord (qp, x)
244
+ rowsAtrue, colsAtrue, valsAtrue = findnz (sparse (A))
245
+ @test rowsA == rowsAtrue
246
+ @test colsA == colsAtrue
247
+ @test valsA == valsAtrue
248
+ end
249
+
208
250
include (" test_presolve.jl" )
You can’t perform that action at this time.
0 commit comments