Skip to content

Commit 2dee220

Browse files
authored
Improve code coverage (#332)
1 parent 333120f commit 2dee220

File tree

3 files changed

+27
-48
lines changed

3 files changed

+27
-48
lines changed

src/MOI_wrapper/MOI_wrapper.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ function MOI.Utilities.load_constants(
6363
return
6464
end
6565

66-
function MOI.Utilities.function_constants(x::_SetConstants, rows)
67-
return MOI.Utilities.function_constants(x.b, rows)
68-
end
69-
7066
function MOI.Utilities.set_from_constants(x::_SetConstants, S, rows)
7167
return MOI.Utilities.set_from_constants(x.b, S, rows)
7268
end

src/MOI_wrapper/sets/ComplexPositiveSemidefiniteConeTriangle.jl

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,6 @@ function MOI.dimension(x::ComplexPositiveSemidefiniteConeTriangle)
3030
return x.side_dimension^2
3131
end
3232

33-
function MOI.Utilities.set_dot(
34-
x::AbstractVector{S},
35-
y::AbstractVector{T},
36-
set::ComplexPositiveSemidefiniteConeTriangle,
37-
) where {S,T}
38-
U = promote_type(S, T)
39-
result = zero(U)
40-
d = set.side_dimension
41-
k = 0
42-
for j in 1:d
43-
for i in 1:j-1
44-
k += 1
45-
result += 2 * x[k] * y[k]
46-
k += 1
47-
result += 2 * x[k] * y[k]
48-
end
49-
k += 1
50-
result += x[k] * y[k]
51-
end
52-
return result
53-
end
54-
5533
function MOI.Utilities.set_dot(
5634
x::MOI.Utilities.CanonicalVector{T},
5735
y::MOI.Utilities.CanonicalVector{T},
@@ -66,28 +44,7 @@ function MOI.Utilities.set_dot(
6644
end
6745
end
6846

69-
function MOI.Utilities.dot_coefficients(
70-
a::AbstractVector,
71-
set::ComplexPositiveSemidefiniteConeTriangle,
72-
)
73-
d = set.side_dimension
74-
b = copy(a)
75-
k = 0
76-
for j in 1:d
77-
for i in 1:j-1
78-
k += 1
79-
b[k] /= 2
80-
k += 1
81-
b[k] /= 2
82-
end
83-
k += 1
84-
end
85-
return b
86-
end
87-
88-
function MOI.is_set_dot_scaled(::Type{ComplexPositiveSemidefiniteConeTriangle})
89-
return true
90-
end
47+
MOI.is_set_dot_scaled(::Type{ComplexPositiveSemidefiniteConeTriangle}) = true
9148

9249
struct HermitianComplexPSDConeBridge{T,F} <:
9350
MOI.Bridges.Constraint.SetMapBridge{

test/MOI_wrapper.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,32 @@ function test_NormNuclearConeBridge()
523523
return
524524
end
525525

526+
function test_HermitianComplexPSDConeBridge()
527+
MOI.Bridges.runtests(
528+
SCS.HermitianComplexPSDConeBridge,
529+
"""
530+
variables: x1, x2, x3, x4
531+
[x1, x2, x3, x4] in MOI.HermitianPositiveSemidefiniteConeTriangle(2)
532+
""",
533+
"""
534+
variables: x1, x2, x3, x4
535+
[x1, x2, x4, x3] in SCS.ComplexPositiveSemidefiniteConeTriangle(2)
536+
""",
537+
)
538+
MOI.Bridges.runtests(
539+
SCS.HermitianComplexPSDConeBridge,
540+
"""
541+
variables: x1, x2, x3, x4, x5, x6, x7, x8, x9
542+
[x1, x2, x3, x4, x5, x6, x7, x8, x9] in MOI.HermitianPositiveSemidefiniteConeTriangle(3)
543+
""",
544+
"""
545+
variables: x1, x2, x3, x4, x5, x6, x7, x8, x9
546+
[x1, x2, x7, x3, x4, x8, x5, x9, x6] in SCS.ComplexPositiveSemidefiniteConeTriangle(3)
547+
""",
548+
)
549+
return
550+
end
551+
526552
end # module
527553

528554
TestSCS.runtests()

0 commit comments

Comments
 (0)