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
sumofsquares-1.3.1.tar.gz 13.5 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2

2 release files

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