User Guide

This guide covers the core concepts and features of Moreau.

Contents

Overview

Moreau solves convex conic optimization problems:

minimize    (1/2)x'Px + q'x
subject to  Ax + s = b
            s in K

Where 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