Coverage for src/nncg/__init__.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.15.0, created at 2026-07-03 19:07 +0000

1"""Non-negative conjugate gradients. 

2 

3Solves the strictly convex non-negative quadratic program 

4``min_{x >= 0} 1/2 x^T A x - b^T x`` (and its equality-augmented variant 

5``B x = c``) by wrapping matrix-free conjugate gradients in a primal-dual 

6active-set loop with an unconditional finite-termination guarantee — no 

7non-degeneracy assumption. 

8 

9Reference implementation of the paper "Non-Negative Conjugate Gradients" 

10(Schmelzer & Stoll), whose numerical study doubles as this package's test 

11suite: https://github.com/Jebel-Quant/mean_variance_solvers. 

12""" 

13 

14import importlib.metadata 

15 

16from .solver import Result, kkt_violation, solve_nnqp, solve_nnqp_eq 

17 

18__all__ = [ 

19 "Result", 

20 "kkt_violation", 

21 "solve_nnqp", 

22 "solve_nnqp_eq", 

23] 

24 

25try: 

26 __version__ = importlib.metadata.version("nncg") 

27except importlib.metadata.PackageNotFoundError: 

28 # Package metadata not available (development/editable install) 

29 __version__ = "0.0.0"