mrpro.operators.LinearOperatorMatrix

class mrpro.operators.LinearOperatorMatrix(operators: Sequence[Sequence[LinearOperator]])[source]

Bases: Operator[Unpack[tuple[Tensor, …]], tuple[Tensor, …]]

Matrix of Linear Operators.

A matrix of Linear Operators, where each element is a Linear Operator.

This matrix can be applied to a sequence of tensors, where the number of tensors should match the number of columns of the matrix. The output will be a sequence of tensors, where the number of tensors will match the number of rows of the matrix. The i-th output tensor is calculated as \(\sum_j \text{operators}[i][j](x[j])\) where \(\text{operators}[i][j]\) is the linear operator in the i-th row and j-th column and \(x[j]\) is the j-th input tensor.

The matrix can be indexed and sliced like a regular matrix to get submatrices. If indexing returns a single element, it is returned as a Linear Operator.

Basic arithmetic operations are supported with Linear Operators and Tensors.

__init__(operators: Sequence[Sequence[LinearOperator]])[source]

Initialize Linear Operator Matrix.

Create a matrix of LinearOperators from a sequence of rows, where each row is a sequence of LinearOperators that represent the columns of the matrix.

Parameters:

operators – A sequence of rows, which are sequences of Linear Operators.

adjoint(*x: Tensor) tuple[Tensor, ...][source]

Apply the adjoint of the operator to the input.

Parameters:

x – Input tensors. Requires the same number of tensors as the operator has rows.

Return type:

Output tensors. The same number of tensors as the operator has columns.

forward(*x: Tensor) tuple[Tensor, ...][source]

Apply the operator to the input.

Parameters:

x – Input tensors. Requires the same number of tensors as the operator has columns.

Return type:

Output tensors. The same number of tensors as the operator has rows.

classmethod from_diagonal(*operators: LinearOperator)[source]

Create a diagonal LinearOperatorMatrix.

Create a square LinearOperatorMatrix with the given Linear Operators on the diagonal, resulting in a block-diagonal linear operator.

Parameters:

operators – Sequence of Linear Operators to be placed on the diagonal.

operator_norm(*initial_value: Tensor, dim: Sequence[int] | None = None, max_iterations: int = 20, relative_tolerance: float = 0.0001, absolute_tolerance: float = 1e-05, callback: Callable[[Tensor], None] | None = None) Tensor[source]

Upper bound of operator norm of the Matrix.

Uses the bounds \(||[A, B]^T|||<=sqrt(||A||^2 + ||B||^2)\) and \(||[A, B]|||<=max(||A||,||B||)\) to estimate the operator norm of the matrix. First, operator_norm is called on each element of the matrix. Next, the norm is estimated for each column using the first bound. Finally, the norm of the full matrix of linear operators is calculated using the second bound.

Parameters:
  • initial_value – Initial value(s) for the power iteration, length should match the number of columns of the operator matrix.

  • dim – Dimensions to calculate the operator norm over. Other dimensions are assumed to be batch dimensions. None means all dimensions.

  • max_iterations – Maximum number of iterations used in the power iteration.

  • relative_tolerance – Relative tolerance for convergence.

  • absolute_tolerance – Absolute tolerance for convergence.

  • callback – Callback function to be called with the current estimate of the operator norm.

Return type:

Estimated operator norm upper bound.

property H: Self

Adjoints of the operators.

property shape: tuple[int, int]

Shape of the Operator Matrix (rows, columns).