spyrit.core.meas.DynamicLinear.pinv

DynamicLinear.pinv(x: tensor, reg: str = 'L1', eta: float = 0.001) tensor

Computes the pseudo inverse solution \(y = H^\dagger x\).

This method will compute the pseudo inverse solution using the measurement matrix pseudo-inverse \(H^\dagger\) if it has been calculated and stored in the attribute H_pinv. If not, the pseudo inverse will be not be explicitly computed and the torch function torch.linalg.lstsq() will be used to solve the linear system.

Args:

x (torch.tensor): batch of measurement vectors. If x has more than 1 dimension, the pseudo inverse is applied to each image in the batch.

reg (str, optional): Regularization method to use. Available options are ‘L1’ and ‘L2’. This parameter must be specified if the pseudo inverse has not been computed. Defaults to None.

eta (float, optional): Regularization parameter. Only relevant when reg is specified. Defaults to None.

Shape:

\(x\): \((*, M)\) where * denotes the batch size and M the number of measurements.

Output: \((*, N)\) where * denotes the batch size and N the number of pixels in the image.

Example:
>>> H = torch.randn([400, 1600])
>>> meas_op = Linear(H, True)
>>> x = torch.randn([10, 400])
>>> y = meas_op.pinv(x)
>>> print(y.shape)
torch.Size([10, 1600])