spyrit.core.meas.LinearSplit.forward

LinearSplit.forward(x: tensor)[source]

Simulate noisy measurements from matrix A.

It computes

\[y =\mathcal{N}\left(Ax\right),\]

where \(\mathcal{N} \colon\, \mathbb{R}^{2M} \to \mathbb{R}^{2M}\) represents a noise operator (e.g., Gaussian), where \(A \in \mathbb{R}_+^{2M\times N}\) is the acquisition matrix that contains positive DMD patterns, \(x \in \mathbb{R}^N\) is the signal of interest., \(2M\) is the number of DMD patterns, and \(N\) is the dimension of the signal.

Given a matrix \(H \in \mathbb{R}^{M\times N}\), we define the positive DMD patterns \(A\) from the positive and negative components of \(H\).

Note

The acquisition matrix \(A\) is given by self.A.

Args:

x (torch.tensor): Signal \(x\) whose dimensions self.meas_dims must have shape shape self.meas_shape.

Returns:

torch.tensor: Measurement vector \(y\) of length 2*self.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 20.

>>> 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(x)
>>> print(y.shape)
torch.Size([3, 4, 20])

Example 2: 3 signals of length (15, 4) are measured with an acquisition matrix of shape (10, 60). This produces 3 measurements of length 20. 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(x)
>>> print(y.shape)
torch.Size([3, 20])
>>> print(meas_op.meas_dims)
torch.Size([-2, -1])