Skip to main content

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyoperators-0.16.2.tar.gz (210.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyoperators-0.16.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (257.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

pyoperators-0.16.2-cp311-cp311-macosx_11_0_arm64.whl (154.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyoperators-0.16.2-cp311-cp311-macosx_10_9_x86_64.whl (159.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyoperators-0.16.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (253.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

pyoperators-0.16.2-cp310-cp310-macosx_11_0_arm64.whl (154.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyoperators-0.16.2-cp310-cp310-macosx_10_9_x86_64.whl (158.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyoperators-0.16.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (252.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

pyoperators-0.16.2-cp39-cp39-macosx_11_0_arm64.whl (153.6 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyoperators-0.16.2-cp39-cp39-macosx_10_9_x86_64.whl (157.8 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pyoperators-0.16.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (255.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

pyoperators-0.16.2-cp38-cp38-macosx_11_0_arm64.whl (154.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

pyoperators-0.16.2-cp38-cp38-macosx_10_9_x86_64.whl (158.5 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file pyoperators-0.16.2.tar.gz.

File metadata

  • Download URL: pyoperators-0.16.2.tar.gz
  • Upload date:
  • Size: 210.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pyoperators-0.16.2.tar.gz
Algorithm Hash digest
SHA256 091f541e138cbb933969c2040d972a65ba381e057072bd74772fceadf8515eff
MD5 755241e4d0afd8d0e51bab8b1f134486
BLAKE2b-256 135fc2f4b8680eeeb18bba6a16a1f446987a1013255e8e8aba57f3a93c5f5ae9

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c978bc03a1412ae98cd9c026d771b084992eee4df92831482a61b7ce2a3653d
MD5 58d32af6f286cfe42f206b862dd9fde2
BLAKE2b-256 8eb87c70dc89b601863a352fedaa2903d92af0b06699d48579d9f7d0de6f007d

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ecff1094df49c6cf5906835dc6b91861c714947f5225c0a67e7769bf1113e514
MD5 9137612a202f3c35e14580c0378d6480
BLAKE2b-256 f6df16940943cc73de11343b09edb054baa23c692d04a590b6225a6ff973f551

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 63fe48bdf44839c44ffb4507367e1dbd4736ee71856bb08019589636a5e5d850
MD5 cfa8752f8d4fa7f40f2e31afa34d3775
BLAKE2b-256 2219efd5e835787aa48f042b60d858be52fa3a59532226b6a51656250cb1af3c

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e692354d64f003efe0319a9a5c8932071366e36366d88db7124c2cd5789e30ae
MD5 735bf6dc6da52deda54790cb4951b4c4
BLAKE2b-256 be6609382f27a0fd201364e48336399552cdec39d765c15c113a9a9c7fb923af

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4a5b1cb2d8ea028ef07c47a7a5a5b55397dc4a6c7926e541fc27b0fd1e518fff
MD5 873770724dda207c9398e9c4d7c77d93
BLAKE2b-256 2efe499e7f6d0cc078805503fa9b42671ef78bf2484b6eb9f38473e9b72ac3d9

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7768be7e79b4f7373eaade907baf29b091659f65b073a3dcb7bf3c7b9c8f3d27
MD5 0d14156a5c913eb86dd9c37b78e782c6
BLAKE2b-256 e74e1f1fdba75bdc463c8f5041cde6124d5c79896e3dfb636d2db294719a257c

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c79a3b0e4565f5edc766a32cbd8e1bb189f6bcab5e930bef5363c8da5cb1548
MD5 3993ab253ae2bd87cfaa72fb83ff2f89
BLAKE2b-256 573260016855848f4829eaea862c3588211c6976cccd4e3e383d1c79341443b7

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e0ecc07068bf5d6496b4a7087c044e949373fb4f3947d157a34c8aff5cfddf5
MD5 db4b3ba2961964687257a714485c1e89
BLAKE2b-256 fde731a43ebbe44c7ea23ab5191acdb8935d3905a4ff62ad7acf335f9a917111

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b24c7ef984aebc32738f2c837d60bb5a69e10043f3b556f5f30bf632343e9f65
MD5 ef4168068aaabd6b6b76413cec30c161
BLAKE2b-256 8243cf93aeb8b3424d9890acb4441b6479eb9d1fa90a3fdd5c340d70f9b0ea0a

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b7462af25d328743fa9a897df2d2577f41b5a0113825edc2d10b2fff3771df6
MD5 b6bd8734305e434127a74b1bf8b04974
BLAKE2b-256 d24cfdb87724e3564d885db8571dbf15ed2871a6964ed62ca4a2807c712e9428

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee895fb3486d90f3354e22610226f4d916d5ffab0b6bf8dd92a6c277b8c8cadc
MD5 df7bb3145675ee55f4235eac94c0c914
BLAKE2b-256 28f909fbb6eaecce2ff63b93cb20efa6dd8c7d6316a26f28d8ffd753ee83cab9

See more details on using hashes here.

File details

Details for the file pyoperators-0.16.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyoperators-0.16.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 16fdec247bb12088a6eecea3610db9bd4e22fd81d0ebe056125cf487f09f1d29
MD5 4a96c29a20d78ac465b408149157ec24
BLAKE2b-256 3bf710f32b1020bcd076f7c92532f369345b0d9948521c533d1acdcb9bcf0763

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.16.2 This release

13 files

0.16.1

13 files

0.15.0

10 files

0.14.4

10 files

0.14.2

6 files

0.14.1

4 files

0.14.0

6 files

0.13.18

4 files

0.13.17

4 files

0.13.16

1 file

0.13.15

1 file

0.13.14

1 file

0.13.13.post04

1 file

0.13.13

1 file

0.13.12

1 file

0.13.11

1 file

0.13.10

1 file

0.13.9

1 file

0.13.8

1 file

0.13.7

1 file

0.13.6.post06

1 file

0.13.6.post05

1 file

0.13.6.post04

1 file

0.13.6

1 file

0.13.5

1 file

0.13.4.post01

1 file

0.13.4

1 file

0.13.3

1 file

0.13.2

1 file

0.13.1

1 file

0.13

1 file

0.12.14

1 file

0.12.13

1 file

0.12.12

1 file

0.12.11

1 file

0.12.9

1 file

0.12.8

1 file

0.12.7

1 file

0.12.6

1 file

0.12.5

1 file

0.12.4

1 file

0.12.3

1 file

0.12.2

1 file

0.12.1

1 file

0.12

1 file

0.11.1

1 file

0.11

1 file

0.10.2

1 file

0.10.1

1 file

0.10

1 file

0.9

1 file

0.8.2

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6

1 file

0.5

1 file

0.4

1 file

0.3

1 file

0.2

1 file

0.1

1 file

0.12.8-dirty

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page