@@ -36,20 +36,20 @@ mutable struct QuadraticModel{T, S} <: AbstractQuadraticModel{T, S}
36
36
end
37
37
38
38
function QuadraticModel (
39
- c:: AbstractVector{T} ,
39
+ c:: S ,
40
40
Hrows:: AbstractVector{<:Integer} ,
41
41
Hcols:: AbstractVector{<:Integer} ,
42
- Hvals:: AbstractVector ;
42
+ Hvals:: S ;
43
43
Arows:: AbstractVector{<:Integer} = Int[],
44
44
Acols:: AbstractVector{<:Integer} = Int[],
45
- Avals:: AbstractVector = similar (c , 0 ),
46
- lcon:: AbstractVector = similar (c , 0 ),
47
- ucon:: AbstractVector = similar (c , 0 ),
48
- lvar:: AbstractVector = fill! (similar (c , length (c)), T (- Inf )),
49
- uvar:: AbstractVector = fill! (similar (c , length (c)), T (Inf )),
50
- c0:: T = zero (T ),
45
+ Avals:: S = S (undef , 0 ),
46
+ lcon:: S = S (undef , 0 ),
47
+ ucon:: S = S (undef , 0 ),
48
+ lvar:: S = fill! (S (undef , length (c)), eltype (c) (- Inf )),
49
+ uvar:: S = fill! (S (undef , length (c)), eltype (c) (Inf )),
50
+ c0:: T = zero (eltype (c) ),
51
51
kwargs... ,
52
- ) where {T}
52
+ ) where {T, S }
53
53
nnzh = length (Hvals)
54
54
if ! (nnzh == length (Hrows) == length (Hcols))
55
55
error (" The length of Hrows, Hcols and Hvals must be the same" )
@@ -87,16 +87,16 @@ function QuadraticModel(
87
87
end
88
88
89
89
function QuadraticModel (
90
- c:: AbstractVector{T} ,
90
+ c:: S ,
91
91
H:: SparseMatrixCSC{T, Int} ;
92
92
A:: AbstractMatrix = similar (c, 0 , length (c)),
93
- lcon:: AbstractVector = similar (c , 0 ),
94
- ucon:: AbstractVector = similar (c , 0 ),
95
- lvar:: AbstractVector = fill! (similar (c , length (c)), T (- Inf )),
96
- uvar:: AbstractVector = fill! (similar (c , length (c)), T (Inf )),
93
+ lcon:: S = S (undef , 0 ),
94
+ ucon:: S = S (undef , 0 ),
95
+ lvar:: S = fill! (S (undef , length (c)), T (- Inf )),
96
+ uvar:: S = fill! (S (undef , length (c)), T (Inf )),
97
97
c0:: T = zero (T),
98
98
kwargs... ,
99
- ) where {T}
99
+ ) where {T, S }
100
100
ncon, nvar = size (A)
101
101
tril! (H)
102
102
nnzh, Hrows, Hcols, Hvals = nnz (H), findnz (H)...
@@ -128,7 +128,7 @@ function QuadraticModel(
128
128
)
129
129
end
130
130
131
- QuadraticModel (c:: AbstractVector{T} , H:: AbstractMatrix ; args... ) where {T } =
131
+ QuadraticModel (c:: S , H:: AbstractMatrix ; args... ) where {S } =
132
132
QuadraticModel (c, sparse (H); args... )
133
133
134
134
"""
0 commit comments