spyrit.core.meas.LinearSplit.forward_H
- LinearSplit.forward_H(x: tensor)[source]
Simulate noisy measurements from matrix H.
It computes
\[m =\mathcal{N}\left(Hx\right),\]where \(\mathcal{N} \colon\, \mathbb{R}^M \to \mathbb{R}^M\) represents a noise operator (e.g., Gaussian), \(H \in \mathbb{R}^{M\times N}\) is the acquisition matrix (that may contain negative values), \(x \in \mathbb{R}^N\) is the signal of interest, \(M\) is the number of DMD patterns, and \(N\) is the dimension of the signal.
Note
The acquisition matrix \(H\) is given by
self.H.- Args:
x(torch.tensor): Signal \(x\) whose dimensionsself.meas_dimsmust have shape shapeself.meas_shape.- Returns:
torch.tensor: Measurement vector \(m\) of lengthself.M.- Examples:
Example 1: (3, 4) signals of length 15 are measured with an acquisition matrix of shape (10, 15). This produces (3, 4) measurements of length 10.
>>> import spyrit.core.meas as meas >>> H = torch.randn(10, 15) >>> meas_op = meas.LinearSplit(H) >>> x = torch.randn(3, 4, 15) >>> y = meas_op.forward_H(x) >>> print(y.shape) torch.Size([3, 4, 10])
Example 2: 3 signals of length (15, 4) are measured with an acquisition matrix of shape (10, 60). This produces 3 measurements of length 10. The acquisition matrix applies to both dimensions -2 and -1.
>>> import spyrit.core.meas as meas >>> H = torch.randn(10, 60) >>> meas_op = meas.LinearSplit(H, meas_shape=(15, 4)) >>> x = torch.randn(3, 15, 4) >>> y = meas_op.forward_H(x) >>> print(y.shape) torch.Size([3, 10]) >>> print(meas_op.meas_dims) torch.Size([-2, -1])