Skip to main content

SumOfSquares.py

Documentation Build Status
Build Status

Sum of squares optimization built on top of picos. Easy access to pseudoexpectation operators for both formulating problems and extracting solutions via rounding algorithms.

Installation

To install from pypi:

pip install SumOfSquares

Examples

To compute the sum of squares decomposition of a polynomial:

>>> import sympy as sp
>>> x, y = sp.symbols('x y')
>>> p = 2*x**4 + 2*x**3*y - x**2*y**2 + 5*y**4
>>> prob = SOSProblem()
>>> c = prob.add_sos_constraint(p, [x, y])
>>> prob.solve()
>>> c.get_sos_decomp()
Matrix([
[5.0*(-0.306*x**2 + y**2)**2],
[2.057*(0.486*x**2 + x*y)**2],
[                 1.047*x**4]])

More Examples

Citation

If you use this library in your work, please consider citing:

@software{Yuan_SumOfSquares_py,
author = {Yuan, Chenyang},
license = {MIT},
title = {{SumOfSquares.py}},
url = {https://github.com/yuanchenyang/SumOfSquares.py}
}

Metadata

Release files for SumOfSquares 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SumOfSquares 1.3.1
File Size Uploaded Provenance Actions
sumofsquares-1.3.1.tar.gz 13.5 kB Without provenance Details for sumofsquares-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for SumOfSquares 1.3.1
File Interpreter ABI Platform Actions
SumOfSquares-1.3.1-py3-none-any.whl Python 3 none any Details for SumOfSquares-1.3.1-py3-none-any.whl

Total release size: 24.7 kB

Release files / sumofsquares-1.3.1.tar.gz

Download URL sumofsquares-1.3.1.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
92dfe91e558dbf475bd045c6634d22e2d9ab3527e6ea2b959830f6b9b8d6c509
BLAKE2b-256 checksum
How to use checksums
cbffe23a2fff37720c68bd23f2a0cc4ab29e264d44264384ebabab198fe30e74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / SumOfSquares-1.3.1-py3-none-any.whl

Download URL SumOfSquares-1.3.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99275abe5a3226113d80b595b70576f59926006cbd516568707050eafb43b301
BLAKE2b-256 checksum
How to use checksums
c1fb6969c171fbaf245c01755efac7eb0516c5d3c8b540a85ef559b8ec9255d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Security for SumOfSquares 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page