spyrit.core.meas.DynamicHadamSplit.pinv
- DynamicHadamSplit.pinv(x: tensor, reg: str = 'rcond', eta: float = 0.001, diff=False) 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 functiontorch.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 ‘rcond’, ‘L2’ and ‘H1’. ‘rcond’ uses thercondparameter found intorch.linalg.lstsq(). This parameter must be specified if the pseudo inverse has not been computed. Defaults to None.eta(float, optional): Regularization parameter. Only relevant whenregis specified. Defaults to None.diff(bool, optional): Use only if a split operator is used and if the pseudo inverse has not been computed. Whether to use the difference of positive and negative patterns. The difference is applied to the measurements and to the dynamic measurement matrix. Defaults to False.- 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])