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.
Documentaion
https://pchanial.github.io/pyoperators
Installation
pip install pyoperators[fft,wavelets]
On some platforms, it might be more convenient to install pyfftw through Conda beforehand to use the FFTOperator:
conda install pyfftw
For MPI communication, an MPI library needs to be installed, for example on Ubuntu:
sudo apt install libopenmpi-dev
pip install pyoperators[fft,wavelets,mpi]
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 flags, Operator
... @flags.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(np.ones(5))
array([ 2., 2., 2., 2., 2.])
>>> A(np.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
For non-explicit shape operators, we get the corresponding dense matrix by specifying the input shape:
>>> A.todense(shapein=2)
array([[2, 0],
[0, 2]])
Operators do not have to be linear. Many operators are already predefined, such as the DiagonalOperator, the FFTOperator or the nonlinear ClipOperator.
The previous A matrix could be defined more easily like this:
>>> from pyoperators import I
>>> A = 2 * 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 operator * stands for matrix multiplication if the two operators are linear, or for element-wise multiplication otherwise:
>>> from pyoperators import I, DiagonalOperator
>>> B = 2 * I + DiagonalOperator(range(3))
>>> B.todense()
array([[2, 0, 0],
[0, 3, 0],
[0, 0, 4]])
Algebraic rules can easily be attached to operators. They are used to simplify expressions to speed up their execution. The B Operator has been reduced to:
>>> B
DiagonalOperator(array([2, ..., 4], dtype=int64), broadcast='disabled', dtype=int64, shapein=3, shapeout=3)
Many simplifications are available. For instance:
>>> from pyoperators import Operator
>>> C = Operator(flags='idempotent,linear')
>>> C * C is C
True
>>> D = Operator(flags='involutary')
>>> D(D)
IdentityOperator()
Requirements
- python 3.8
Optional requirements:
- PyWavelets: wavelet transforms
- pyfftw: Fast Fourier transforms
- mpi4py: For MPI communication
Metadata
Release files for pyoperators 0.16.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyoperators-0.16.2.tar.gz | 210.8 kB | Details |
Built distributions (wheels)
Total release size: 2.5 MB
Release files / pyoperators-0.16.2.tar.gz
| Download URL | pyoperators-0.16.2.tar.gz |
|---|---|
| Size | 210.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
091f541e138cbb933969c2040d972a65ba381e057072bd74772fceadf8515eff
|
|
BLAKE2b-256 checksum How to use checksums |
135fc2f4b8680eeeb18bba6a16a1f446987a1013255e8e8aba57f3a93c5f5ae9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyoperators-0.16.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 257.8 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
3c978bc03a1412ae98cd9c026d771b084992eee4df92831482a61b7ce2a3653d
|
|
BLAKE2b-256 checksum How to use checksums |
8eb87c70dc89b601863a352fedaa2903d92af0b06699d48579d9f7d0de6f007d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pyoperators-0.16.2-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 154.5 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ecff1094df49c6cf5906835dc6b91861c714947f5225c0a67e7769bf1113e514
|
|
BLAKE2b-256 checksum How to use checksums |
f6df16940943cc73de11343b09edb054baa23c692d04a590b6225a6ff973f551
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | pyoperators-0.16.2-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 159.3 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
63fe48bdf44839c44ffb4507367e1dbd4736ee71856bb08019589636a5e5d850
|
|
BLAKE2b-256 checksum How to use checksums |
2219efd5e835787aa48f042b60d858be52fa3a59532226b6a51656250cb1af3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyoperators-0.16.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 253.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
e692354d64f003efe0319a9a5c8932071366e36366d88db7124c2cd5789e30ae
|
|
BLAKE2b-256 checksum How to use checksums |
be6609382f27a0fd201364e48336399552cdec39d765c15c113a9a9c7fb923af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | pyoperators-0.16.2-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 154.0 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4a5b1cb2d8ea028ef07c47a7a5a5b55397dc4a6c7926e541fc27b0fd1e518fff
|
|
BLAKE2b-256 checksum How to use checksums |
2efe499e7f6d0cc078805503fa9b42671ef78bf2484b6eb9f38473e9b72ac3d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | pyoperators-0.16.2-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 158.3 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
7768be7e79b4f7373eaade907baf29b091659f65b073a3dcb7bf3c7b9c8f3d27
|
|
BLAKE2b-256 checksum How to use checksums |
e74e1f1fdba75bdc463c8f5041cde6124d5c79896e3dfb636d2db294719a257c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyoperators-0.16.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 252.9 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
7c79a3b0e4565f5edc766a32cbd8e1bb189f6bcab5e930bef5363c8da5cb1548
|
|
BLAKE2b-256 checksum How to use checksums |
573260016855848f4829eaea862c3588211c6976cccd4e3e383d1c79341443b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | pyoperators-0.16.2-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 153.6 kB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4e0ecc07068bf5d6496b4a7087c044e949373fb4f3947d157a34c8aff5cfddf5
|
|
BLAKE2b-256 checksum How to use checksums |
fde731a43ebbe44c7ea23ab5191acdb8935d3905a4ff62ad7acf335f9a917111
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | pyoperators-0.16.2-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 157.8 kB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
b24c7ef984aebc32738f2c837d60bb5a69e10043f3b556f5f30bf632343e9f65
|
|
BLAKE2b-256 checksum How to use checksums |
8243cf93aeb8b3424d9890acb4441b6479eb9d1fa90a3fdd5c340d70f9b0ea0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyoperators-0.16.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 255.9 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
8b7462af25d328743fa9a897df2d2577f41b5a0113825edc2d10b2fff3771df6
|
|
BLAKE2b-256 checksum How to use checksums |
d24cfdb87724e3564d885db8571dbf15ed2871a6964ed62ca4a2807c712e9428
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp38-cp38-macosx_11_0_arm64.whl
| Download URL | pyoperators-0.16.2-cp38-cp38-macosx_11_0_arm64.whl |
|---|---|
| Size | 154.1 kB |
| Tags | CPython 3.8 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ee895fb3486d90f3354e22610226f4d916d5ffab0b6bf8dd92a6c277b8c8cadc
|
|
BLAKE2b-256 checksum How to use checksums |
28f909fbb6eaecce2ff63b93cb20efa6dd8c7d6316a26f28d8ffd753ee83cab9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / pyoperators-0.16.2-cp38-cp38-macosx_10_9_x86_64.whl
| Download URL | pyoperators-0.16.2-cp38-cp38-macosx_10_9_x86_64.whl |
|---|---|
| Size | 158.5 kB |
| Tags | CPython 3.8 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
16fdec247bb12088a6eecea3610db9bd4e22fd81d0ebe056125cf487f09f1d29
|
|
BLAKE2b-256 checksum How to use checksums |
3bf710f32b1020bcd076f7c92532f369345b0d9948521c533d1acdcb9bcf0763
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|