# Linear operators

Abstraction of linear operators as matrices $$y = A*x$$. The implementation follow the SigPy and LinearmapAA.

Common operators, including +, -, *, are overloaded. One may freely compose operators as long as the size matches.

New linear operators require to implement _apply (forward, $$A$$) and _adjoint (conjugate adjoint, $$A'$$) functions, as well as size. Recommendation for efficient backpropagation (but you do not have to do this if the AD is efficient enough):

class forward(torch.autograd.Function):
@staticmethod
def forward(ctx, data_in):
return forward_func(data_in)
@staticmethod
forward_op = forward.apply

@staticmethod
def forward(ctx, data_in):
return forward_func(data_in)
@staticmethod

mirtorch.linear.LinearMap.size_in

the size of the input of the linear map (a list)

mirtorch.linear.LinearMap.size_out

the size of the output of the linear map (a list)

## Attributes of LinearMap

 mirtorch.linear.Add Addition of linear operators. mirtorch.linear.Multiply Scaling linear operators. mirtorch.linear.Matmul Matrix multiplication of linear operators. mirtorch.linear.ConjTranspose Hermitian transpose of linear operators. mirtorch.linear.Kron Create a LinearMap corresponding to the Kronecker product of a linear map with the identity matrix, i.e., kron(I_n, A), where A is a LinearMap. mirtorch.linear.BlockDiagonal Create a block-diagonal linear map from a list of linear maps.

## Basic image processing operations

 mirtorch.linear.basics.Diffnd A multidimensional finite difference operator, with the periodic boundary condition. mirtorch.linear.basics.Diff2dgram A little more efficient way to implement the gram operator for the Gram (A'A) of finite difference. mirtorch.linear.basics.Diff3dgram A little more efficient way to implement the gram operator for the Gram of finite difference, with the reflexive boundary condition. mirtorch.linear.basics.Diag Expand an input vector into a diagonal matrix. mirtorch.linear.basics.Identity Identity mapping. mirtorch.linear.basics.Convolve1d 1D cross-correlation linear map. mirtorch.linear.basics.Convolve2d 2D cross-correlation linear map. mirtorch.linear.basics.Convolve3d 3D cross-correlation linear map. mirtorch.linear.basics.Patch2D Patch operator to decompose image into blocks mirtorch.linear.basics.Patch3D Patch operator to decompose 3D image into patches. mirtorch.linear.wavelets.Wavelet2D A very preliminary implementation of 2D DWT.

## MRI system models

 mirtorch.linear.mri.FFTCn FFT operators with FFTshift and iFFTshift for multidimensional data. mirtorch.linear.mri.NuSense Non-Cartesian sense operator: "SENSE: Sensitivity encoding for fast MRI" The implementation calls Matthew Muckley's Torchkbnufft toolbox: https://github.com/mmuckley/torchkbnufft The input/ourput size depends on the sensitivity maps. mirtorch.linear.mri.Sense Cartesian sense operator, following "SENSE: Sensitivity encoding for fast MRI". mirtorch.linear.mri.NuSenseGram Gram operator (A'A) of the Non-Cartesian sense operator: "SENSE: Sensitivity encoding for fast MRI" The implementation calls Matthew Muckley's Torchkbnufft toolbox: https://github.com/mmuckley/torchkbnufft The input/ourput size depends on the sensitivity maps. mirtorch.linear.mri.Gmri B0-informed mri reconstruction, the name follows MIRT.

## SPECT system models

 mirtorch.linear.spect.SPECT Forward and back-projection methods for SPECT image reconstruction.

## CT system models

 mirtorch.linear.ct.Bdd Forward and back-projection methods for CT image reconstruction.