Skip to content

Commit d1dd066

Browse files
committed
type
1 parent 4844cee commit d1dd066

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/MathOptChordalDecomposition.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,14 @@ function MOI.add_constraint(
271271

272272
i = MOI.add_constraint(model.inner, MOI.VectorAffineFunction(terms, constants), MOI.Zeros(n * (n + 1) ÷ 2)).value
273273
model.outer_to_inner[i] = Decomposition(n, value, label, tree)
274-
return MOI.ConstraintIndex{MOI.VectorAffineFunction{Float64}, MOI.PositiveSemidefiniteConeTriangle}(i)
274+
return MOI.ConstraintIndex{MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle}(i)
275275
end
276276

277277
function MOI.get(
278278
model::Optimizer,
279279
::MOI.NumberOfConstraints{F, S},
280280
) where {
281-
F <: MOI.VectorAffineFunction{Float64},
281+
F <: MOI.VectorAffineFunction,
282282
S <: MOI.PositiveSemidefiniteConeTriangle,
283283
}
284284
return length(model.outer_to_inner)
@@ -288,7 +288,7 @@ function MOI.get(
288288
model::Optimizer,
289289
::MOI.ListOfConstraintIndices{F, S},
290290
) where {
291-
F <: MOI.VectorAffineFunction{Float64},
291+
F <: MOI.VectorAffineFunction,
292292
S <: MOI.PositiveSemidefiniteConeTriangle,
293293
}
294294

@@ -302,7 +302,8 @@ function MOI.get(
302302
attribute::MOI.ConstraintPrimal,
303303
index::MOI.ConstraintIndex{F, S},
304304
) where {
305-
F <: MOI.VectorAffineFunction{Float64},
305+
T,
306+
F <: MOI.VectorAffineFunction{T},
306307
S <: MOI.PositiveSemidefiniteConeTriangle,
307308
}
308309

@@ -311,7 +312,7 @@ function MOI.get(
311312
value = decomposition.value
312313
label = decomposition.label
313314
tree = decomposition.tree
314-
result = zeros(Float64, neqns * (neqns + 1) ÷ 2)
315+
result = zeros(T, neqns * (neqns + 1) ÷ 2)
315316

316317
for (k, bag) in zip(value, tree)
317318
m = length(bag)
@@ -337,7 +338,8 @@ function MOI.get(
337338
attribute::MOI.ConstraintDual,
338339
index::MOI.ConstraintIndex{F, S},
339340
) where {
340-
F <: MOI.VectorAffineFunction{Float64},
341+
T,
342+
F <: MOI.VectorAffineFunction{T},
341343
S <: MOI.PositiveSemidefiniteConeTriangle,
342344
}
343345

@@ -346,8 +348,8 @@ function MOI.get(
346348
value = decomposition.value
347349
label = decomposition.label
348350
tree = decomposition.tree
349-
result = zeros(Float64, neqns * (neqns + 1) ÷ 2)
350-
W = zeros(Float64, neqns, neqns)
351+
result = zeros(T, neqns * (neqns + 1) ÷ 2)
352+
W = zeros(T, neqns, neqns)
351353

352354
for (k, bag) in zip(value, tree)
353355
m = length(bag)
@@ -372,7 +374,7 @@ function MOI.get(
372374
jj = label[j]
373375
result[idx(ii, jj)] = W[i, j]
374376
end
375-
377+
376378
return result
377379
end
378380

@@ -446,7 +448,7 @@ function complete!(W::Matrix, tree::CliqueTree)
446448
ν = residual(tree, bag)
447449
marker[α] .= bag
448450

449-
for i in last(ν) + 1:n
451+
for i in (last(ν) + 1):n
450452
marker[i] == bag || push!(η, i)
451453
end
452454

@@ -476,7 +478,7 @@ end
476478
function idx(i::Int, j::Int)
477479
if i > j
478480
i, j = j, i
479-
end
481+
end
480482

481483
x = i + j * (j - 1) ÷ 2
482484
return x

0 commit comments

Comments
 (0)