Add native ComplexPSD cone for Hermitian PSD constraints#3128
Add native ComplexPSD cone for Hermitian PSD constraints#3128
Conversation
Instead of expanding complex PSD constraints into 2n×2n real block matrices during Complex2Real, introduce a dedicated ComplexPSD cone that preserves the n×n Hermitian structure. SCS handles this natively via its 'cs' (Hermitian PSD) cone key with cvec format. For solvers without native support (e.g. Clarabel), ExactCone2Cone converts ComplexPSD to the equivalent 2n×2n real PSD formulation. Co-Authored-By: Claude Opus 4.6 <[email protected]>
PR Review: Add native ComplexPSD cone for Hermitian PSD constraintsSummaryThis PR introduces a dedicated ✅ Strengths1. Architecture & Design
2. Code Quality
3. Test Coverage
4. SCS Integration
🔍 Issues & Recommendations1. Critical: Hermitian Symmetry Not Enforced (cvxpy/constraints/complex_psd.py:40-54)The # Current code accepts any real_part and imag_part
# Should validate:
# - real_part == real_part.T (symmetric)
# - imag_part == -imag_part.T (skew-symmetric)Impact: Users could create invalid Hermitian matrices, leading to incorrect solver behavior or confusing errors. Recommendation: Add validation in 2. Potential Issue:
|
|
Benchmarks that have stayed the same: |
…sertion - Clarify docstring to explain implicit Hermitianization (like PSD's symmetrization) - Use lambda_min/neg for residual instead of raw eigvalsh, with Hermitianization - Add assertion that Clarabel doesn't natively support ComplexPSD - Add test_complex_psd_validation for dimension checking - Move imports to top of test file Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
How does this change interact with DPP? Adding complex numbers to DPP is not worth it IMO if SCS is the only solver that can consume them. |
|
This should work perfectly fine with DPP! We still canonicalize to real matrices in complex2real, and so post #3032 everything should work transperantly. There's one DPP test, but it isn't very comprehensive. |
The detailed explanation of how Hermitian PSD dual variables are recovered from the 2n x 2n real block matrix was deleted from complex2real.py (where the recovery no longer happens) and belongs here where recover_dual actually extracts the blocks. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Description
Add a native
ComplexPSDcone type to CVXPY, leveraging SCS's native Hermitian PSD cone ('cs'key). For solvers without native support,ExactCone2ConeconvertsComplexPSDto the 2n×2n real block matrixPSDformulation.Instead of expanding complex PSD constraints into 2n×2n real block matrices during
Complex2Real, this introduces a dedicatedComplexPSDcone that preserves the n×n Hermitian structure through the reduction chain. SCS handles it natively via the'cs'cone key with cvec format; Clarabel and other solvers fall back throughExactCone2Cone.Closes #3045
Type of change
Contribution checklist