Skip to content

Commit d166fe4

Browse files
committed
Fix typo in cones
1 parent 3c91bb5 commit d166fe4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/cones.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ projection(::PositiveOrthant, x) = max.(0, x)
4646

4747
@generated function projection(::SecondOrderCone, x::V) where V <: AbstractVector
4848
# assumes x is stacked [v; s] such that ||v||₂ ≤ s
49-
v = V isa StaticVector ? :(v = pop(x)) : :(v = view(x, 1:n-1))
49+
v = V <: StaticVector ? :(v = pop(x)) : :(v = view(x, 1:n-1))
5050
quote
5151
n = length(x)
5252
s = x[end]
@@ -64,6 +64,8 @@ projection(::PositiveOrthant, x) = max.(0, x)
6464
end
6565
end
6666

67+
projection!(::Equality, px, x) = px .= 0
68+
6769
function projection!(::NegativeOrthant, px, x)
6870
@assert length(px) == length(x)
6971
for i in eachindex(x)
@@ -101,7 +103,7 @@ function ∇projection!(::NegativeOrthant, J, x)
101103
end
102104

103105
@generated function ∇projection!(::SecondOrderCone, J, x::V) where V <: AbstractVector
104-
v = V isa StaticVector ? :(v = pop(x)) : :(v = view(x, 1:n-1))
106+
v = V <: StaticVector ? :(v = pop(x)) : :(v = view(x, 1:n-1))
105107
return quote
106108
n = length(x)
107109
s = x[end]
@@ -159,8 +161,8 @@ end
159161
@generated function ∇²projection!(
160162
::SecondOrderCone, hess, x::V1, b::V2
161163
) where {V1<:AbstractVecOrMat,V2<:AbstractVector}
162-
v = V1 isa StaticVector ? :(v = pop(x)) : :(v = view(x, 1:n))
163-
bv = V2 isa StaticVector ? :(bv = pop(b)) : :(bv = view(b, 1:n))
164+
v = V1 <: StaticVector ? :(v = pop(x)) : :(v = view(x, 1:n))
165+
bv = V2 <: StaticVector ? :(bv = pop(b)) : :(bv = view(b, 1:n))
164166
quote
165167
n = length(x)-1
166168
@assert size(hess) == (n+1,n+1)

0 commit comments

Comments
 (0)