spyrit.core.meas.DynamicLinear.adjoint

DynamicLinear.adjoint(m: tensor, unvectorize=False) tensor[source]

Apply adjoint of matrix \(H_{\rm{dyn}}\).

It computes

\[x = H_{\rm{dyn}}^\top m,\]

where \(H_{\rm{dyn}}^\top \in\mathbb{R}^{L \times M}\) is the adjoint of the dynamic acquisition matrix, \(m \in \mathbb{R}^M\) is the measurement vector.

Warning

This supposes the dynamic measurement matrix \(H_{\rm{dyn}}\) has been set using the build_dynamic_forward() method. An error will be raised otherwise.

Args:

m (torch.tensor): A batch of measurement \(m\) of shape \((*, M)\) where \(*\) denotes all the dimensions that are not included in self.meas_dims

Returns:

torch.tensor: A batch of signals \(x\). If unvectorize is False, \(x\) has shape \((*, N)\) where \(*\) is the same as for m. If unvectorize is True, \(x\) is reshaped such that the dimensions self.meas_dims match the measurement shape self.meas_shape.

Example:
>>> import torch
>>> from spyrit.core.noise import Poisson
>>> from spyrit.core.warp import DeformationField
>>> from spyrit.core.meas import DynamicLinear
>>>
>>> def_field = DeformationField(torch.rand([400, 50, 50, 2]) * 2 - 1)  # dummy deformation field with 400 frames
>>> x = torch.rand([1, 3, 50, 50])  # dummy RGB reference image of size 50x50
>>> x_motion = def_field(x)  # dummy video obtained by warping x with def_field
>>> H = torch.rand([400, 40*40])  # dummy static measurement matrix
>>>
>>> alpha = 5  # noise level
>>> noise_op = Poisson(alpha=alpha, g=1/alpha)
>>> meas_op = DynamicLinear(H, time_dim=1, meas_shape=(40, 40), img_shape=(50, 50), noise_model=noise_op)
>>> print(meas_op)
DynamicLinear(
  (noise_model): Poisson()
)
>>>
>>> meas_op.build_dynamic_forward(def_field)
>>> m = meas_op(x_motion)  # simulate noisy dynamic measurements
>>> H_dyn_adj_x = meas_op.adjoint(m)  # apply adjoint of dynamic measurement matrix
>>> print(H_dyn_adj_x.shape)
torch.Size([1, 3, 2500])