Cones module
See the Cone interface and predefined cones section.
Hypatia.Cones — Module
Proper cone definitions, oracles, and utilities.
Hypatia.Cones.Cone — Type
abstract type Cone{T<:Real}A proper cone.
Array utilities
Hypatia.Cones.vec_length — Function
vec_length(_, len)
The dimension of the real vectorization of a real or complex vector of length len::Int.
Hypatia.Cones.vec_copyto! — Function
vec_copyto!(v1, v2)
Copy a vector in-place.
vec_copyto!(rvec, cvec)
Copy a complex vector to a real vector in-place.
vec_copyto!(cvec, rvec)
Copy a real vector to a complex vector in-place.
Hypatia.Cones.svec_length — Function
svec_length(side)
The dimension of the vectorized triangle of a real symmetric matrix with side dimension side::Int.
svec_length(_, side)
The dimension of the real vectorized triangle of a real symmetric or complex Hermitian matrix with side dimension side::Int.
Hypatia.Cones.svec_side — Function
svec_side(len)
The side dimension of a real symmetric matrix with vectorized triangle length len::Int.
svec_side(_, len)
The side dimension of a real symmetric or complex Hermitian matrix with real vectorized triangle length len::Int.
Hypatia.Cones.svec_idx — Function
svec_idx(row, col)
The index in the vectorized triangle of a symmetric matrix for element (row::Int, col::Int).
Hypatia.Cones.block_idxs — Function
block_idxs(incr, block)
The indices corresponding to block block::Int in a vector of blocks with equal length incr::Int.
Hypatia.Cones.scale_svec! — Function
scale_svec!(arr, scal)
Rescale the elements corresponding to off-diagonals in arr::AbstractVecOrMat, with scaling scal::Real, for real symmetric matrices.
Hypatia.Cones.scale_svec_incr! — Function
scale_svec_incr!(arr, scal, incr)
Rescale the elements corresponding to off-diagonals in arr::AbstractVecOrMat, with scaling scal::Real and block increment incr::Int, for real symmetric matrices.
Hypatia.Cones.smat_to_svec! — Function
smat_to_svec!(vec, mat, rt2)
Copy a real symmetric matrix upper triangle to a svec-scaled vector in-place.
smat_to_svec!(vec, mat, rt2)
Copy a complex Hermitian matrix upper triangle to a svec-scaled real vector in-place.
Hypatia.Cones.svec_to_smat! — Function
svec_to_smat!(mat, vec, rt2)
Copy a svec-scaled vector to a real symmetric matrix upper triangle in-place.
svec_to_smat!(mat, vec, rt2)
Copy a svec-scaled real vector to a complex Hermitian matrix upper triangle in-place.
Cone oracles
Hypatia.Cones.dimension — Function
dimension(cone)
The real vector dimension of the cone.
Hypatia.Cones.get_nu — Function
get_nu(cone)
The barrier parameter $\nu$ of the cone.
Hypatia.Cones.set_initial_point! — Function
set_initial_point!(arr, cone)
Set the array equal to the initial interior point for the cone.
Hypatia.Cones.is_feas — Function
is_feas(cone)
Returns true if and only if the currently-loaded primal point is strictly feasible for the cone.
Hypatia.Cones.is_dual_feas — Function
is_dual_feas(cone)
Returns false only if the currently-loaded dual point is outside the interior of the cone's dual cone.
Hypatia.Cones.grad — Function
grad(cone)
The gradient of the cone's barrier function at the currently-loaded primal point.
Hypatia.Cones.hess — Function
hess(cone)
The Hessian (symmetric positive definite) of the cone's barrier function at the currently-loaded primal point.
Hypatia.Cones.inv_hess — Function
inv_hess(cone)
The inverse Hessian (symmetric positive definite) of the cone's barrier function at the currently-loaded primal point.
Hypatia.Cones.hess_prod! — Function
hess_prod!(prod, arr, cone)
Compute the product of the Hessian of the cone's barrier function at the currently-loaded primal point with a vector or array, in-place.
Hypatia.Cones.inv_hess_prod! — Function
inv_hess_prod!(prod, arr, cone)
Compute the product of the inverse Hessian of the cone's barrier function at the currently-loaded primal point with a vector or array, in-place.
Hypatia.Cones.use_dder3 — Function
use_dder3(_)
Returns true if and only if the oracle for the third-order directional derivative oracle dder3 can be computed.
Hypatia.Cones.dder3 — Function
dder3(cone, dir)
Compute the third-order directional derivative, in the direction dir, the cone's barrier function at the currently-loaded primal point.
Predefined cone types
Hypatia.Cones.Nonnegative — Type
mutable struct Nonnegative{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Nonnegative cone of dimension dim.
Nonnegative{T}(dim::Int)Hypatia.Cones.PosSemidefTri — Type
mutable struct PosSemidefTri{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Real symmetric or complex Hermitian positive semidefinite cone of dimension dim in svec (scaled upper triangle) format.
PosSemidefTri{T, R}(dim::Int)Hypatia.Cones.DoublyNonnegativeTri — Type
mutable struct DoublyNonnegativeTri{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Real symmetric doubly nonnegative cone (intersection of nonnegative and positive semidefinite cones) of dimension dim in svec format.
DoublyNonnegativeTri{T}(dim::Int, use_dual::Bool = false)Hypatia.Cones.PosSemidefTriSparse — Type
mutable struct PosSemidefTriSparse{I<:Hypatia.Cones.PSDSparseImpl, T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Real symmetric or complex Hermitian sparse positive semidefinite cone of side dimension side and sparse lower triangle row and column indices rows, cols in svec format. Note all diagonal elements must be present.
PosSemidefTriSparse{T, R}(side::Int, rows::Vector{Int}, cols::Vector{Int}, use_dual::Bool = false)Hypatia.Cones.LinMatrixIneq — Type
mutable struct LinMatrixIneq{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Linear matrix inequality cone parametrized by list of real symmetric or complex Hermitian matrices mats of equal dimension.
LinMatrixIneq{T}(mats::Vector, use_dual::Bool = false)Hypatia.Cones.EpiNormInf — Type
mutable struct EpiNormInf{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Epigraph of real or complex infinity norm cone of dimension dim.
EpiNormInf{T, R}(dim::Int, use_dual::Bool = false)Hypatia.Cones.EpiNormEucl — Type
mutable struct EpiNormEucl{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Epigraph of Euclidean norm (AKA second-order) cone of dimension dim.
EpiNormEucl{T}(dim::Int)Hypatia.Cones.EpiPerSquare — Type
mutable struct EpiPerSquare{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Epigraph of perspective function of halved squared Euclidean norm (AKA rotated second-order) cone of dimension dim.
EpiPerSquare{T}(dim::Int)Hypatia.Cones.EpiNormSpectralTri — Type
mutable struct EpiNormSpectralTri{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Epigraph of real symmetric or complex Hermitian matrix spectral norm (i.e. maximum absolute value of eigenvalues) cone of dimension dim in svec format.
EpiNormSpectralTri{T, R}(dim::Int, use_dual::Bool = false)Hypatia.Cones.EpiNormSpectral — Type
mutable struct EpiNormSpectral{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Epigraph of real or complex matrix spectral norm (i.e. maximum singular value) for a matrix (stacked column-wise) of nrows rows and ncols columns with nrows ≤ ncols.
EpiNormSpectral{T, R}(nrows::Int, ncols::Int, use_dual::Bool = false)Hypatia.Cones.MatrixEpiPerSquare — Type
mutable struct MatrixEpiPerSquare{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Matrix epigraph of perspective function of real or complex matrix outer product for a matrix (stacked column-wise) of nrows rows and ncols columns with nrows ≤ ncols.
MatrixEpiPerSquare{T, R}(nrows::Int, ncols::Int, use_dual::Bool = false)Hypatia.Cones.GeneralizedPower — Type
mutable struct GeneralizedPower{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Generalized power cone parametrized by powers α in the unit simplex and dimension d of the normed variables.
GeneralizedPower{T}(α::Vector{T}, d::Int, use_dual::Bool = false)Hypatia.Cones.HypoPowerMean — Type
mutable struct HypoPowerMean{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Hypograph of weighted power mean cone parametrized by powers α in the unit simplex.
HypoPowerMean{T}(α::Vector{T}, use_dual::Bool = false)Hypatia.Cones.HypoGeoMean — Type
mutable struct HypoGeoMean{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Hypograph of geometric mean cone of dimension dim.
HypoGeoMean{T}(dim::Int, use_dual::Bool = false)Hypatia.Cones.HypoRootdetTri — Type
mutable struct HypoRootdetTri{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Hypograph of real symmetric or complex Hermitian root-determinant cone of dimension dim in svec format.
HypoRootdetTri{T, R}(dim::Int, use_dual::Bool = false)Hypatia.Cones.HypoPerLog — Type
mutable struct HypoPerLog{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Hypograph of perspective function of sum-log cone of dimension dim.
HypoPerLog{T}(dim::Int, use_dual::Bool = false)Hypatia.Cones.HypoPerLogdetTri — Type
mutable struct HypoPerLogdetTri{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Hypograph of perspective function of real symmetric or complex Hermitian log-determinant cone of dimension dim in svec format.
HypoPerLogdetTri{T, R}(dim::Int, use_dual::Bool = false)Hypatia.Cones.EpiPerSepSpectral — Type
mutable struct EpiPerSepSpectral{Q<:Hypatia.Cones.ConeOfSquares, T<:Real} <: Hypatia.Cones.Cone{T<:Real}Epigraph of perspective function of a convex separable spectral function h over a cone of squares Q on a Jordan algebra with rank d.
EpiPerSepSpectral{Q, T}(h::Hypatia.Cones.SepSpectralFun, d::Int, use_dual::Bool = false)Hypatia.Cones.EpiRelEntropy — Type
mutable struct EpiRelEntropy{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Epigraph of vector relative entropy cone of dimension dim.
EpiRelEntropy{T}(dim::Int, use_dual::Bool = false)Hypatia.Cones.EpiTrRelEntropyTri — Type
mutable struct EpiTrRelEntropyTri{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Epigraph of matrix relative entropy cone of dimension dim in svec format.
EpiTrRelEntropyTri{T}(dim::Int, use_dual::Bool = false)Hypatia.Cones.WSOSInterpNonnegative — Type
mutable struct WSOSInterpNonnegative{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.Cone{T<:Real}Interpolant-basis weighted sum-of-squares polynomial cone of dimension U, for real or real-valued complex polynomials, parametrized by vector of matrices Ps derived from interpolant basis and polynomial domain constraints.
WSOSInterpNonnegative{T, R}(U::Int, Ps::Vector{Matrix{R}}, use_dual::Bool = false)Hypatia.Cones.WSOSInterpPosSemidefTri — Type
mutable struct WSOSInterpPosSemidefTri{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Interpolant-basis weighted sum-of-squares polynomial (of dimension U) positive semidefinite matrix (of side dimension R) cone, parametrized by vector of matrices Ps derived from interpolant basis and polynomial domain constraints.
WSOSInterpPosSemidefTri{T}(R::Int, U::Int, Ps::Vector{Matrix{T}}, use_dual::Bool = false)Hypatia.Cones.WSOSInterpEpiNormEucl — Type
mutable struct WSOSInterpEpiNormEucl{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Interpolant-basis weighted sum-of-squares polynomial (of dimension U) epigraph of ℓ₂ norm (of dimension R) cone, parametrized by vector of matrices Ps derived from interpolant basis and polynomial domain constraints.
WSOSInterpEpiNormEucl{T}(R::Int, U::Int, Ps::Vector{Matrix{T}}, use_dual::Bool = false)Hypatia.Cones.WSOSInterpEpiNormOne — Type
mutable struct WSOSInterpEpiNormOne{T<:Real} <: Hypatia.Cones.Cone{T<:Real}Interpolant-basis weighted sum-of-squares polynomial (of dimension U) epigraph of ℓ₁ norm (of dimension R) cone, parametrized by vector of matrices Ps derived from interpolant basis and polynomial domain constraints.
WSOSInterpEpiNormOne{T}(R::Int, U::Int, Ps::Vector{Matrix{T}}, use_dual::Bool = false)Helpers for PosSemidefTriSparse
Hypatia.Cones.PSDSparseImpl — Type
abstract type PSDSparseImplAn implementation type for the sparse positive semidefinite cone PosSemidefTriSparse.
Hypatia.Cones.PSDSparseDense — Type
struct PSDSparseDense <: Hypatia.Cones.PSDSparseImplDense Cholesky-based implementation for the sparse positive semidefinite cone PosSemidefTriSparse.
Hypatia.Cones.PSDSparseCholmod — Type
struct PSDSparseCholmod <: Hypatia.Cones.PSDSparseImplCHOLMOD sparse Cholesky-based implementation for the sparse positive semidefinite cone PosSemidefTriSparse. Note only BLAS floating point types are supported.
EpiPerSepSpectral helpers
Hypatia.Cones.ConeOfSquares — Type
abstract type ConeOfSquares{T<:Real}A cone of squares on a Jordan algebra.
Hypatia.Cones.VectorCSqr — Type
struct VectorCSqr{T<:Real} <: Hypatia.Cones.ConeOfSquares{T<:Real}Real vector cone of squares.
Hypatia.Cones.MatrixCSqr — Type
struct MatrixCSqr{T<:Real, R<:Union{Complex{T<:Real}, T<:Real}} <: Hypatia.Cones.ConeOfSquares{T<:Real}Real symmetric or complex Hermitian positive semidefinite cone of squares.
Hypatia.Cones.vector_dim — Function
vector_dim(
_::Type{<:Hypatia.Cones.VectorCSqr},
d::Int64
) -> Int64
The rank of the vector cone of squares, equal to the vector length.
vector_dim(
_::Type{<:Hypatia.Cones.MatrixCSqr{<:Real, R}},
d::Int64
) -> Int64
The rank of the matrix cone of squares, equal to the side dimension of the matrix.
Hypatia.Cones.SepSpectralFun — Type
abstract type SepSpectralFunA univariate convex function defined on positive reals.
Hypatia.Cones.NegLogSSF — Type
struct NegLogSSF <: Hypatia.Cones.SepSpectralFunThe negative logarithm function $x \to - \log(x)$.
Hypatia.Cones.NegEntropySSF — Type
struct NegEntropySSF <: Hypatia.Cones.SepSpectralFunThe negative entropy function $x \to x \log(x)$.
Hypatia.Cones.NegSqrtSSF — Type
struct NegSqrtSSF <: Hypatia.Cones.SepSpectralFunThe negative square root function $x \to -x^{1/2}$. Note this is a special case of the negative power: NegPower01SSF(0.5).
Hypatia.Cones.NegPower01SSF — Type
struct NegPower01SSF <: Hypatia.Cones.SepSpectralFunThe negative power function $x \to -x^p$ parametrized by $p \in (0, 1)$
Hypatia.Cones.Power12SSF — Type
struct Power12SSF <: Hypatia.Cones.SepSpectralFunThe power function $x \to x^p$ parametrized by $p \in (1, 2]$. Note for $p = 2$, it is more efficient to use EpiPerSquare.