Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyOperators

The PyOperators package defines operators and solvers for high-performance computing. These operators are multi-dimensional functions with optimised and controlled memory management. If linear, they behave like matrices with a sparse storage footprint.

Getting started

To define an operator, one needs to define a direct function which will replace the usual matrix-vector operation:

>>> def f(x, out):
...     out[...] = 2 * x

Then, you can instantiate an Operator:

>>> A = pyoperators.Operator(direct=f, flags='symmetric')

An alternative way to define an operator is to define a subclass:

>>> from pyoperators import decorators, Operator
... @decorators.symmetric
... class MyOperator(Operator):
...     def direct(x, out):
...         out[...] = 2 * x
...
... A = MyOperator()

This operator does not have an explicit shape, it can handle inputs of any shape:

>>> A(ones(5))
array([ 2.,  2.,  2.,  2.,  2.])
>>> A(ones((2,3)))
array([[ 2.,  2.,  2.],
       [ 2.,  2.,  2.]])

By setting the ‘symmetric’ flag, we ensure that A’s transpose is A:

>>> A.T is A
True

To output a corresponding dense matrix, one needs to specify the input shape:

>>> A.todense(shapein=2)
array([[2, 0],
       [0, 2]])

Operators do not have to be linear, but if they are not, they cannot be seen as matrices. Some operators are already predefined, such as the IdentityOperator, the DiagonalOperator or the nonlinear ClippingOperator.

The previous A matrix could be defined more easily like this :

>>> A = 2 * pyoperators.I

where I is the identity operator with no explicit shape.

Operators can be combined together by addition, element-wise multiplication or composition (note that the * sign stands for composition):

>>> B = 2 * pyoperators.I + pyoperators.DiagonalOperator(range(3))
>>> B.todense()
array([[2, 0, 0],
       [0, 3, 0],
       [0, 0, 4]])

Algebraic rules are used to simplify an expression involving operators, so to speed up its execution:

>>> B
DiagonalOperator(array([2, ..., 4], dtype=int64), broadcast='disabled', dtype=int64, shapein=3, shapeout=3)
>>> C = pyoperators.Operator(flags='idempotent')
>>> C * C is C
True
>>> D = pyoperators.Operator(flags='involutary')
>>> D * D
IdentityOperator()

Requirements

List of requirements:

  • python 2.6

  • numpy >= 1.6

  • scipy >= 0.9

Optional requirements:

  • numexpr (>= 2.0 is better)

  • PyWavelets : wavelet transforms

Metadata

Release files for pyoperators 0.11.dev11-g64ac6

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

Source distribution (sdist)

Source distribution for pyoperators 0.11.dev11-g64ac6
File Size Uploaded Provenance Actions
pyoperators-0.11.dev11-g64ac6.tar.gz 154.8 kB Without provenance Details for pyoperators-0.11.dev11-g64ac6.tar.gz

Release files / pyoperators-0.11.dev11-g64ac6.tar.gz

Download URL pyoperators-0.11.dev11-g64ac6.tar.gz
Size 154.8 kB
Tags Source
SHA-256 checksum
How to use checksums
58580fa2e37ae8eccebfd1ab93310b7eb821da58fd5855551433173486171744
BLAKE2b-256 checksum
How to use checksums
6cdd047b49441510528a29058d8d1314af5cee4e998bb47c956e7da0047bf2c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyoperators 0.11.dev11-g64ac6

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.

Release history Release notifications | RSS feed

This release
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