Skip to content

A Solver for Large-Scale Quadratic Conic Programming

An open-source first-order solver with hardware acceleration, including GPU and multi-GPU support.

pip install pdhcg
Illustrative convex-concave saddle for the primal-dual min-max formulation, with primal x and dual y cross sections.

Problem formulation

\[ \begin{aligned} \min_x\quad &\tfrac12x^\top Hx+c^\top x\\[8pt] \text{s.t.}\quad &\mathcal A x\in\mathcal C. \end{aligned} \]

Start Now

Use Python, CVXPY, or the command line.

Installation & quick start →

import numpy as np
from scipy import sparse
from pdhcg import Model

# min ½ xᵀQx + cᵀx, subject to x ≥ 0
model = Model(
    objective_matrix=sparse.eye(2, format="csc"),
    objective_vector=np.array([-1.0, -2.0]),
    variable_lower_bound=np.zeros(2),
)
model.optimize()

print(model.Status, model.X)

Install the CVXPY extra.

import cvxpy as cp
import pdhcg.cvxpy_backend

x = cp.Variable(2)
problem = cp.Problem(
    cp.Minimize(
        0.5 * cp.sum_squares(x) - x[0] - 2 * x[1]
    ),
    [x >= 0],
)
problem.solve(solver="PDHCG", eps=1e-6)

print(problem.status, x.value)

Build the native solver, then run:

mkdir -p output
./build/pdhcg problem.qps ./output

PDHCG keeps quadratic objectives and conic constraints in a primal–dual formulation. Each update combines a quadratic proximal solve with cone projections.