Skip to content

Commit c6f3838

Browse files
blegatmlubin
authored andcommitted
Add the PSD cone (#194)
1 parent 7643636 commit c6f3838

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

‎docs/src/apireference.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ NonPositive
6868
Zero
6969
Interval
7070
SecondOrderCone
71+
PositiveSemidefiniteConeTriangle
72+
PositiveSemidefiniteConeScaled
7173
Integers
7274
Binaries
7375
SOS1

‎src/SolverInterface/sets.jl‎

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,56 @@ struct SecondOrderCone <: AbstractSet
6060
end
6161

6262
#ExponentialCone
63-
#PositiveSemidefiniteCone
63+
64+
"""
65+
PositiveSemidefiniteConeTriangle(n)
66+
67+
The cone of symmetric ``n \\times n`` matrices that are positive semidefinite.
68+
The dimension of the cone is ``n(n+1)/2`` since the matrices are symmetric.
69+
The entries of the upper triangular part of the matrix are given row by row (or equivalently, the entries of the lower triangular part are given column by column).
70+
The scalar product is the sum of the pairwise product of the diagonal entries plus twice the sum of the pairwise product of the upper diagonal entries.
71+
72+
### Examples
73+
74+
The matrix
75+
```math
76+
\\begin{bmatrix}
77+
1 & 2 & 3\\\\
78+
2 & 4 & 5\\\\
79+
3 & 5 & 6
80+
\\end{bmatrix}
81+
```
82+
corresponds to ``(1, 2, 3, 4, 5, 6)`` for `PositiveSemidefiniteConeTriangle`
83+
"""
84+
struct PositiveSemidefiniteConeTriangle <: AbstractSet
85+
dim::Int
86+
end
87+
88+
"""
89+
PositiveSemidefiniteConeScaled(n)
90+
91+
The cone of symmetric ``n \\times n`` matrices that are positive semidefinite.
92+
The dimension of the cone is ``n(n+1)/2`` since the matrices are symmetric.
93+
The entries of the upper triangular part of the matrix are given row by row (or equivalently, the entries of the lower triangular part are given column by column).
94+
The off-diagonal entries of the matrices of both the cone and its dual are scaled by ``\\sqrt{2}`` and the scalar product is simply the sum of the pairwise product of the entries.
95+
96+
### Examples
97+
98+
The matrix
99+
```math
100+
\\begin{bmatrix}
101+
1 & 2 & 3\\\\
102+
2 & 4 & 5\\\\
103+
3 & 5 & 6
104+
\\end{bmatrix}
105+
```
106+
and to ``(1, 2\\sqrt{2}, 3\\sqrt{2}, 4, 5\\sqrt{2}, 6)`` for `PositiveSemidefiniteConeScaled`.
107+
"""
108+
struct PositiveSemidefiniteConeScaled <: AbstractSet
109+
dim::Int
110+
end
111+
112+
dimension(s::Union{PositiveSemidefiniteConeScaled, PositiveSemidefiniteConeTriangle}) = (s.dim * (s.dim + 1)) / 2
64113

65114
"""
66115
Integers(n)

0 commit comments

Comments
 (0)