coposit

Exact copositivity testing for symmetric matrices

coposit decides whether a real symmetric matrix is copositive, strictly copositive, or both. Every final classification and certificate is verified with exact arithmetic. It provides standalone command-line programs, a Python package, and a C++ API.

coposit logo

Mathematical problem

Let \(A\in\mathbb{R}^{n\times n}\) be symmetric. The two properties are:

Property

Definition

Copositive (CP)

\(x^\mathsf{T}Ax\geq 0\) for every componentwise nonnegative vector \(x\).

Strictly copositive (SCP)

\(x^\mathsf{T}Ax>0\) for every nonzero componentwise nonnegative vector \(x\).

Strict copositivity is stronger. A matrix can therefore be copositive without being strictly copositive.

Numerical contract

Integer, fractional, finite-decimal, and scientific-notation inputs are converted to one exact integer-scaled matrix. Floating-point work may nominate optional pruning opportunities, but it never establishes a classification or certificate. A timeout or resource limit remains unresolved; it is never reported as false.

The public interfaces select the current production solver internally. Its identity is not part of the public contract and may change between releases. The repository also retains literature baselines and experimental models for reproducible research.

Quick start

Install the Python package:

python -m pip install pycoposit

Then check a matrix:

from pycoposit import check

result = check("2#1,-1,1")
print(result["is_copositive"])           # True
print(result["is_strictly_copositive"])  # False

The compact input stores the upper triangle of

\[\begin{split}A=\begin{pmatrix}1&-1\\-1&1\end{pmatrix}.\end{split}\]

Prebuilt command-line packages are available from the GitHub releases page. Continue with Getting Started for installation, matrix formats, result interpretation, timeouts, and batch execution.

Documentation