Skip to main content

Operators and solvers for high-performance computing.

Project description

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))
Info: Allocating (5,) float64 = 40 bytes in Operator.
array([ 2.,  2.,  2.,  2.,  2.])
>>> A(ones((2,3)))
Info: Allocating (2,3) float64 = 48 bytes in Operator.
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

Project details


Release history Release notifications

History Node

0.13.16

History Node

0.13.15

History Node

0.13.14

History Node

0.13.13.post04

History Node

0.13.13

History Node

0.13.12

History Node

0.13.11

History Node

0.13.10

History Node

0.13.9

History Node

0.13.8

History Node

0.13.7

History Node

0.13.6.post06

History Node

0.13.6.post05

History Node

0.13.6.post04

History Node

0.13.6

History Node

0.13.5

History Node

0.13.4.post01

History Node

0.13.4

History Node

0.13.3

History Node

0.13.2

History Node

0.13.1

History Node

0.13

History Node

0.12.14

History Node

0.12.13

History Node

0.12.12

History Node

0.12.11

History Node

0.12.9

History Node

0.12.8

History Node

0.12.7

History Node

0.12.6

History Node

0.12.5

History Node

0.12.4

History Node

0.12.3

History Node

0.12.2

History Node

0.12.1

History Node

0.12

History Node

0.11.1

History Node

0.11

History Node

0.10.2

This version
History Node

0.10.1

History Node

0.10

History Node

0.9

History Node

0.8.2

History Node

0.7.3

History Node

0.7.2

History Node

0.7.1

History Node

0.7

History Node

0.6.3

History Node

0.6.2

History Node

0.6.1

History Node

0.6

History Node

0.5

History Node

0.4

History Node

0.3

History Node

0.2

History Node

0.1

History Node

0.12.8-dirty

History Node

0.11.dev11-g64ac6

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pyoperators-0.10.1.tar.gz (152.3 kB) Copy SHA256 hash SHA256 Source None Jan 16, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page