SDPLab documentation#
SDPLab is a Python library for constructing, regularizing, and solving
semidefinite programs. It builds on spacecore spaces and linear operators, so the
mathematical objects in an SDP are represented directly in code, and delegates
every first-order optimization loop to spacecore.optimize.
Tutorials explains the main ideas with worked examples.
API reference provides object-level reference pages, generated from each package’s public exports.
Release notes records user-visible changes.
Core model#
SDPLab represents an SDP in trace form:
Here \(C, X \in \mathrm{dom}\), \(\mathcal{A}: \mathrm{dom} \to
\mathrm{cod}\) is a linear constraint operator, and \(b \in \mathrm{cod}\)
is the right-hand side. dom may be any Euclidean Jordan algebra space, so
\(X \succeq 0\) means a nonnegative Jordan spectrum – positive
semidefiniteness for a Hermitian matrix, nonnegativity for a vector.
Quick example#
import numpy as np
from sdplab import EntropyReg, RegularizedSDPDualFunctional, run_regularized_solver
from sdplab.examples import generate_max_cut
from sdplab.solvers import run_cvxpy_solver
problem = generate_max_cut(8, seed=0, unit_trace=True)
# Reference solve through CVXPY.
X, y = run_cvxpy_solver(problem, solver="CLARABEL")
# Or smooth it and optimize the dual.
dual = RegularizedSDPDualFunctional(problem, EntropyReg(problem.dom))
result = run_regularized_solver(dual.bind(0.1), verbose=0)
X_eps = dual.primal_from_dual(result.dual, 0.1)
See Building a problem to assemble a problem from your own cost and constraint operator.