Module Contents

class Operator(function, codomain, Output=None)

Class for deffered (lazy) evaluation of matrix-valued functions between parameterised vector spaces.

Over a set of possible vector spaces D = {domains},

A: domain in D –> codomain(A)(domain) in D B: domain in D –> codomain(B)(domain) in D

A @ B : domain –> codomain(B)(domain) –> codomain(AB)(domain).

Operator strings are lazily evaluated on a given domin,

(A @ B)(domain) = A(codomain(B)(domain)) @ B(domain).

The codomains have a composition rule:

codomain(A) + codomain(B) = codomain(AB).

The composition rule need not be commutative, but it often is.

Operators with compatible codomains form a linear vector space.

For scalar multiplication:

codomain(a*A) = codomain(A)

For addition:

A + B : domain in D –> codomain(A+B)(domain) in D,

where codomain(A+B) = codomain(A) or codomain(B), provided they are compatible.

For a given operator, we can define the inverse codomain such that,

codomain(A)(domain) + (-codomain(A)(domain)) = domain.

This leads to the notion of a transpose operator,

A.T : domain –> -codomain(A)(domain).

and A @ A.T , A.T @ A : domain –> domain.

The specific form of the transpose is given by A(domain).T for each domain.

  • codomain (an arrow between any given domain and codomain(domain).) –

  • identity (The identity operator with the same type as self.) –

  • Output (class to cast output into. It should be a subclass of Operator.) –*args):

view of the matrix for given domain args.


evaluation of an operator object on domain args.


returns transpose operator.


operator composition.


compatible operator addition.


if self and other are both operators, retrurn the commutator A@B - B@A. Otherwise returns scalar multiplication.

self**n: repeated composition.
property function
property codomain
property Output
property T
property identity
class Codomain(*arrow, Output=None)

Base class for Codomain objects.

property arrow
property Output
class infinite_csr(*args, **kwargs)

Base class for extendable addition with csr_matrix types.

If A.shape = (j,n), and B.shape = (k,n) we can add A+B by only summing rows i <= min(j,k). This is equivalent to padding the small array with rows of zeros.

The class inherits from csr_matrix.

  • self.square (s) – returns square array given by number of columns.

  • self.T (transpose.) – because csr_matrix.T returns csc_matrix.

  • self.identity – returns square identity matrix with the number of columns of self.

self[item]: item = int(s), or slice(s).

row-extendable slicing. Returns zero-padded array if sliced beyond self.shape[0]

self + other:

row-extendable addition.

property T
property identity
property square