User Guide

This guide covers the core concepts and features of Moreau.

Contents

Overview

Moreau solves convex conic optimization problems:

\[\begin{split} \begin{aligned} \text{minimize} \quad & \tfrac{1}{2} x^\top P x + q^\top x \\ \text{subject to} \quad & Ax + s = b \\ & s \in \mathcal{K} \end{aligned} \end{split}\]

Where \(\mathcal{K}\) is a Cartesian product of convex cones.

Key Concepts

  1. Single vs Batched: Use Solver for one problem, CompiledSolver for many with shared structure

  2. Two APIs: NumPy-based core API, plus PyTorch/JAX integrations with autograd

  3. Device Selection: Automatic CPU/GPU selection, or manual override

  4. Cone Specification: Define constraint types via the Cones class

Data Flow

Problem Data (P, q, A, b, cones)
    |
    v
+-------------------+
| Solver/           |  Validates dimensions, converts to CSR
| CompiledSolver    |
+-------------------+
    |
    v
+-------------------+
| Backend           |  CPU (Rust) or CUDA (C++)
+-------------------+
    |
    v
+-------------------+
| Solution          |  x, z, s arrays + metadata
+-------------------+

Solver vs CompiledSolver

Feature

Solver

CompiledSolver

Use case

Single problem

Batched problems

Input format

Dense or sparse matrices (NumPy/SciPy)

CSR structure

Batching

No

Yes

Setup

Implicit

Explicit setup() call

Best for

Prototyping

Production