spyrit.core.meas.FreeformSmatrix.measure

FreeformSmatrix.measure(x: tensor) tensor[source]

Simulate noiseless measurements using the S-matrix.

The mask is first applied to the input tensor, selecting the \(N\) masked pixels; the result is then transformed by the (subsampled) S measurement matrix \(S_M\), either as a dense matrix-vector product or via the fast Walsh-Hadamard-based transform, depending on self.computation (see the class docstring note for the tradeoff).

\[m = S_M x, \quad \text{where }x = \text{mask}(\tilde{x})\]

Note

This method does not include the noise model. See forward() for noisy measurements.

Args:

x (torch.tensor): A tensor where the dimensions indexed by self.meas_dims match the measurement shape self.meas_shape.

Returns:

torch.tensor: A tensor of shape (*, self.M) where * denotes all the dimensions of the input tensor not included in self.meas_dims.