operators

class MatrixOperatorCompatibility[source]

Bases: object

Compatibility check for objects of MatrixOperator

static compatible_for_addition(first_operator, second_operator)
Parameters
static compatible_for_composition(first_operator, second_operator)
Parameters
class MatrixOperator(flattened_operator, input_shape, output_shape, order, representing_matrix=None)[source]

Bases: object

Parameters
class IndexingOrder(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum for order argument for numpy.reshape() and numpy.flatten()

ROW_MAJOR = 'C'
COLUMN_MAJOR = 'F'
__init__(flattened_operator, input_shape, output_shape, order, representing_matrix=None)

Represents an operator

\[\Phi: \mathbb{C}^{d_1 \times d_2} \rightarrow \mathbb{C}^{m_1 \times m_2}.\]

Takes care on flattening and reshaping. Wraps a scipy linear operator or numpy array.

Parameters
  • flattened_operator (Union[LinearOperator, ndarray, csr_matrix]) –

    Represents the flattened map

    \[\varphi: \mathbb{C}^{d_1 \cdot d_2} \rightarrow \mathbb{C}^{m_1 \cdot m_2},\]

    such that \(\varphi(\operatorname{vec}(x)) = \operatorname{vec}(\Phi(x))\).

  • input_shape (Tuple[int, int]) – \((d_1,d_2)\)

  • output_shape (Tuple[int, int]) – \((m_1,m_2)\)

  • order (IndexingOrder) – order for vectorization \(\operatorname{vec}\)

  • representing_matrix (Optional[Union[ndarray, csr_matrix]]) – matrix representation of flattened operator

dot(x)

Matrix-matrix multiplication (operator application) or operator composition.

Parameters

x (array_like of shape \((d_1, d_2)\) or MatrixOperator compatible for composition or scalar) –

Returns

  • :math:`Phi(x)` (array or MatrixOperator that represents)

  • the result of applying this linear operator on x.

property shape
property output_shape
property input_shape
property order
property flattened_operator
property representing_matrix
adjoint()

Hermitian adjoint.

Returns a MatrixOperator that represents the Hermitian adjoint of this one

Can be abbreviated self.H instead of self.adjoint().

Returns

:math:`Phi^{star}` – Hermitian adjoint of self.

Return type

MatrixOperator

property H

Hermitian adjoint.

Returns a MatrixOperator that represents the Hermitian adjoint of this one

Can be abbreviated self.H instead of self.adjoint().

Returns

:math:`Phi^{star}` – Hermitian adjoint of self.

Return type

MatrixOperator

transpose()

Transpose this linear operator.

Returns a MatrixOperator that represents the transpose of this one. Can be abbreviated self.T instead of self.transpose().

Returns

:math:`Phi^{star}` – adjoint of self.

Return type

MatrixOperator

property T

Transpose this linear operator.

Returns a MatrixOperator that represents the transpose of this one. Can be abbreviated self.T instead of self.transpose().

Returns

:math:`Phi^{star}` – adjoint of self.

Return type

MatrixOperator

class SamplingOperator(*args, **kwargs)[source]

Bases: LinearOperator

Parameters
  • indices (Union[List[int], ndarray]) –

  • input_dimension (int) –

__init__(indices, input_dimension)
Parameters
  • indices (linear indices) –

  • input_dimension

property indices
property input_dimension
property sampling_matrix
classmethod from_matrix_indices(row_indices, column_indices, shape, order=IndexingOrder.COLUMN_MAJOR)
Parameters
  • row_indices (List[int]) –

  • column_indices (List[int]) –

  • shape (Tuple[int, int]) –

  • order (IndexingOrder) –

class SamplingMatrixOperator(row_indices, column_indices, shape, order=IndexingOrder.COLUMN_MAJOR)[source]

Bases: MatrixOperator

Parameters
  • row_indices (List[int]) –

  • column_indices (List[int]) –

  • shape (Tuple[int, int]) –

  • order (IndexingOrder) –

__init__(row_indices, column_indices, shape, order=IndexingOrder.COLUMN_MAJOR)

Represents an operator

\[\Phi: \mathbb{C}^{d_1 \times d_2} \rightarrow \mathbb{C}^{m_1 \times m_2}.\]

Takes care on flattening and reshaping. Wraps a scipy linear operator or numpy array.

Parameters
  • flattened_operator

    Represents the flattened map

    \[\varphi: \mathbb{C}^{d_1 \cdot d_2} \rightarrow \mathbb{C}^{m_1 \cdot m_2},\]

    such that \(\varphi(\operatorname{vec}(x)) = \operatorname{vec}(\Phi(x))\).

  • input_shape\((d_1,d_2)\)

  • output_shape\((m_1,m_2)\)

  • order (IndexingOrder) – order for vectorization \(\operatorname{vec}\)

  • representing_matrix – matrix representation of flattened operator

  • row_indices (List[int]) –

  • column_indices (List[int]) –

  • shape (Tuple[int, int]) –

classmethod from_index_tuples(indices, shape)
Parameters
  • indices (List[int]) –

  • shape (Tuple[int, int]) –

class InverseWeightOperator(left_inverse_weight, right_inverse_weight, order)[source]

Bases: MatrixOperator

Parameters
  • left_inverse_weight (ndarray) –

  • right_inverse_weight (ndarray) –

__init__(left_inverse_weight, right_inverse_weight, order)

Constructs inverse weight operator from one-sided inverse weights.

Parameters
  • left_inverse_weight (ndarray) –

  • right_inverse_weight (ndarray) –

  • order