Skip to content

Commit

Permalink
Fix type errors for #135 (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
goulart-paul authored Aug 30, 2023
1 parent ba58118 commit 719dfae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cones/coneops_nncone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function margins(
# we treat this as an n-times composition of R_+
β = zero(T)
for i in eachindex(z)
β += z[i] > 0 ? z[i] : 0.;
β += z[i] > 0 ? z[i] : zero(T);
end
return (α,β)
end
Expand Down
2 changes: 1 addition & 1 deletion src/cones/coneops_psdtrianglecone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function margins(
e = eigvals!(Hermitian(Z)) #NB: GenericLinearAlgebra doesn't support eigvals!(::Symmetric(...))
α = minimum(e) #minimum eigenvalue.
end
β = reduce((x,y) -> y > 0 ? x + y : x, e, init = 0.) # = sum(e[e.>0]) (no alloc)
β = reduce((x,y) -> y > 0 ? x + y : x, e, init = zero(T)) # = sum(e[e.>0]) (no alloc)
(α,β)

end
Expand Down
2 changes: 1 addition & 1 deletion src/variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function _shift_to_cone_interior!(
) where {T}

(min_margin, pos_margin) = margins(cones,z,pd)
target = max(1.,0.1 * pos_margin / degree(cones))
target = max(one(T),T(0.1) * pos_margin / degree(cones))

if min_margin <= 0 #at least some component is outside its cone
#done in two stages since otherwise (1-α) = -α for
Expand Down

0 comments on commit 719dfae

Please sign in to comment.