# 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.

Defining new linear operators required _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.

## Basic image processing operations

 mirtorch.linear.basics.Diffnd A multidimensional finite difference operator, with the periodic boundary condition. mirtorch.linear.basics.Diff2dframe A little more efficient way to implement the frame operator for the Gram of finite difference. mirtorch.linear.basics.Diff3dframe A little more efficient way to implement the frame 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 mirtorch.linear.mri.Sense Cartesian sense operator, following "SENSE: Sensitivity encoding for fast MRI" mirtorch.linear.mri.NuSenseFrame Gram operator 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 mirtorch.linear.mri.Gmri B0-informed mri reconstruction