Skip to content

Commit 3cddad4

Browse files
authored
Merge pull request #442 from metab0t/la_functions
Use dot and tr from LinearAlgebra instead of JuMP.
2 parents 417915a + 4d4a4d9 commit 3cddad4

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Cones/Cones.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function dot_expr(
4646
vars::AbstractVecOrMat{<:Union{VR,AE}},
4747
opt::Optimizer,
4848
)
49-
return JuMP.@expression(opt.oa_model, JuMP.dot(z, vars))
49+
return JuMP.@expression(opt.oa_model, LinearAlgebra.dot(z, vars))
5050
end
5151

5252
function clean_array!(z::AbstractArray)

src/Cones/secondordercone.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function _get_cuts(
8888
p = LinearAlgebra.norm(r)
8989
u = cache.oa_s[1]
9090
@views w = cache.oa_s[2:end]
91-
cut = JuMP.@expression(opt.oa_model, p * u + JuMP.dot(r, w))
91+
cut = JuMP.@expression(opt.oa_model, p * u + LinearAlgebra.dot(r, w))
9292
return [cut]
9393
end
9494

src/models.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ function setup_models(opt::Optimizer)
1212
# mixed-integer OA model, add discrete constraints later
1313
oa_model = opt.oa_model = JuMP.Model(() -> opt.oa_opt)
1414
oa_x = opt.oa_x = JuMP.@variable(oa_model, [1:length(opt.c)])
15-
JuMP.@objective(oa_model, Min, JuMP.dot(opt.c, oa_x))
15+
JuMP.@objective(oa_model, Min, LinearAlgebra.dot(opt.c, oa_x))
1616
JuMP.@constraint(oa_model, opt.A * oa_x .== opt.b)
1717
oa_aff = JuMP.@expression(oa_model, opt.h - opt.G * oa_x)
1818

1919
if opt.solve_relaxation
2020
# continuous relaxation model
2121
relax_model = opt.relax_model = JuMP.Model(() -> opt.conic_opt)
2222
relax_x = opt.relax_x = JuMP.@variable(relax_model, [1:length(opt.c)])
23-
JuMP.@objective(relax_model, Min, JuMP.dot(opt.c, relax_x))
23+
JuMP.@objective(relax_model, Min, LinearAlgebra.dot(opt.c, relax_x))
2424
JuMP.@constraint(
2525
relax_model,
2626
opt.b - opt.A * relax_x in MOI.Zeros(length(opt.b))
@@ -48,7 +48,7 @@ function setup_models(opt::Optimizer)
4848
# continuous subproblem model
4949
subp_model = opt.subp_model = JuMP.Model(() -> opt.conic_opt)
5050
subp_x = opt.subp_x = JuMP.@variable(subp_model, [1:num_cont_vars])
51-
JuMP.@objective(subp_model, Min, JuMP.dot(c_cont, subp_x))
51+
JuMP.@objective(subp_model, Min, LinearAlgebra.dot(c_cont, subp_x))
5252
K0 = MOI.Zeros(length(opt.b_cont))
5353
opt.subp_eq = JuMP.@constraint(subp_model, -A_cont * subp_x in K0)
5454
subp_aff = JuMP.@expression(subp_model, -G_cont * subp_x)

test/JuMP_tests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ function _psd2(opt)
343343
m = JuMP.Model(opt)
344344

345345
X = JuMP.@variable(m, [1:d, 1:d], PSD)
346-
JuMP.@objective(m, Max, JuMP.dot(mat, X))
347-
JuMP.@constraint(m, JuMP.tr(X) == 1)
346+
JuMP.@objective(m, Max, LinearAlgebra.dot(mat, X))
347+
JuMP.@constraint(m, LinearAlgebra.tr(X) == 1)
348348
JuMP.optimize!(m)
349349
@test JuMP.termination_status(m) == MOI.OPTIMAL
350350
@test JuMP.primal_status(m) == MOI.FEASIBLE_POINT

0 commit comments

Comments
 (0)