Coverage for src/cvxcla/operators/__init__.py: 100%
5 statements
« prev ^ index » next coverage.py v7.14.3, created at 2026-06-27 06:45 +0000
« prev ^ index » next coverage.py v7.14.3, created at 2026-06-27 06:45 +0000
1"""Covariance backend abstraction for the Critical Line Algorithm.
3The turning-point loop of the CLA touches the covariance matrix through a
4small number of operations: full matrix-vector products, solves against the
5free-asset block, and cross-products between free and blocked assets. This
6package defines that contract as the ``CovarianceOperator`` protocol (see
7:mod:`cvxcla.operators._core`), together with several implementations:
9- ``DenseCovariance`` / ``IncrementalDenseCovariance`` (:mod:`cvxcla.operators.dense`):
10 adapters that reproduce the behaviour of a plain ``numpy`` covariance matrix,
11 the latter maintaining the free-block inverse across turning points.
12- ``FactorCovariance`` (:mod:`cvxcla.operators.factor`): a diagonal-plus-low-rank
13 covariance ``Sigma = diag(d) + U @ Delta @ U.T`` whose solves go through the
14 Woodbury identity, so no ``n x n`` matrix is ever materialised. Memory and
15 per-solve cost are ``O(n * k)`` instead of ``O(n^2)``.
16- ``GramCovariance`` (:mod:`cvxcla.operators.gram`): a sample covariance backed by
17 the ``(T, n)`` data matrix, never forming ``Sigma``.
19See https://github.com/cvxgrp/cvxcla/issues/646 for the roadmap.
20"""
22from ._core import CovarianceOperator, QuadraticForm, bordered_solve
23from .dense import DenseCovariance, IncrementalDenseCovariance
24from .factor import FactorCovariance
25from .gram import GramCovariance
27__all__ = [
28 "CovarianceOperator",
29 "DenseCovariance",
30 "FactorCovariance",
31 "GramCovariance",
32 "IncrementalDenseCovariance",
33 "QuadraticForm",
34 "bordered_solve",
35]