@@ -364,17 +364,29 @@ function unsafe_add(t1::VT, t2::VT) where VT <: Union{MOI.VectorAffineTerm,
364
364
end
365
365
366
366
"""
367
- is_canonical(f::Union{ScalarAffineFunction, ScalarQuadraticFunction
368
- VectorAffineFunction, VectorQuadraticTerm})
367
+ is_canonical(f::Union{ScalarAffineFunction, VectorAffineFunction})
369
368
370
369
Returns a Bool indicating whether the function is in canonical form.
371
370
See [`canonical`](@ref).
372
371
"""
373
- function is_canonical (f:: Union{SAF, VAF, SQF, VQF } )
372
+ function is_canonical (f:: Union{SAF, VAF} )
374
373
is_strictly_sorted (f. terms, MOI. term_indices,
375
374
t -> ! iszero (MOI. coefficient (t)))
376
375
end
377
376
377
+ """
378
+ is_canonical(f::Union{ScalarQuadraticFunction, VectorQuadraticFunction})
379
+
380
+ Returns a Bool indicating whether the function is in canonical form.
381
+ See [`canonical`](@ref).
382
+ """
383
+ function is_canonical (f:: Union{SQF, VQF} )
384
+ v = is_strictly_sorted (f. affine_terms, MOI. term_indices,
385
+ t -> ! iszero (MOI. coefficient (t)))
386
+ v &= is_strictly_sorted (f. quadratic_terms, MOI. term_indices,
387
+ t -> ! iszero (MOI. coefficient (t)))
388
+ end
389
+
378
390
"""
379
391
is_strictly_sorted(x::AbstractVector, by, filter)
380
392
0 commit comments