Migration Guide¶
Migrating to 0.4¶
- CPU and CUDA have independent implementations behind shared device interfaces. All interfaces use the same native device selection; see Devices.
eps_infeas_detecthas been removed. Useeps_infeasiblein C and the CLI, orInfeasibleTolin Python.- Recompile C clients against the updated structures, and initialize parameters
with
set_default_parameters.
Migrating to 0.3¶
Version 0.3 adds quadratic conic models and changes the C and Python model construction APIs. This page covers the source changes needed by existing 0.2 callers.
C API¶
create_qp_problem has six new trailing
arguments for variable and affine cones. Append neutral values for a plain QP:
qp_problem_t *problem = create_qp_problem(
c, Q, R, D, A, con_lb, con_ub, var_lb, var_ub, objective_constant,
0, NULL, NULL, NULL, 0, NULL);
For conic inputs and coordinate conventions, see
cone_spec_t.
pdhcg_postsolve now returns nonzero after a complete primal-dual recovery and
zero when postsolve fails or full dual recovery is unavailable:
qp_problem_t and pdhg_parameters_t gained conic fields. Do not depend on
their old binary layout. Recompile downstream code and initialize parameters
through set_default_parameters before overriding individual fields.
Python API¶
Cone metadata is now columnar. Replace a list of dictionaries with one
ConeSpec:
import numpy as np
from pdhcg import ConeSpec, ConeType
cones = ConeSpec(
types=np.array([ConeType.SOC, ConeType.POWER], dtype=np.int32),
starts=np.array([0, 4], dtype=np.int32),
v_dims=np.array([2, 1], dtype=np.int32),
power_alphas=np.array([0.0, 0.4]),
)
Pass this object as variable_cones or affine_cones when constructing a
Model. Legacy list[dict] inputs intentionally raise TypeError.
CVXPY is an optional integration; see the CVXPY quick start.
Executable Location¶
A source build places the command-line executable at build/pdhcg. Installed
packages place it in the installation prefix's bin directory.