spyrit.core.meas.HadamSmatrix2d.fast_adjoint

HadamSmatrix2d.fast_adjoint(m: tensor, unvectorize: bool = False) → tensor[source]

Apply the adjoint of the measurement matrix using the separability of the 2D S-transform.

The forward map is \(A = (J - H_h\otimes H_h)/2\), and \(J\) and (elementwise) division are self-adjoint, so \(A^T = (J - H_h^T\otimes H_h^T)/2\): the same “sum trick” as fast_measure() applies, using \(H_h^T\) (not \(H_h\)) on both axes. When scramble is False, \(H_h\) is symmetric and this is equivalent to applying \(H_h\) directly.

Note

As in fast_measure(), \(\mathrm{sum}(m)\) is read off the transform \(H_h^Tm H_h^T\) itself rather than computed independently, to avoid floating-point cancellation noise. Since scramble only ever permutes columns \(1,\dots,h-1\) of \(H_h\) (column 0 is always left fixed, see the class docstring), row 0 of \(H_h^T\) (= column 0 of \(H_h\)) is all-ones regardless of scramble, so the relevant entry always sits at index 0. Reading \(\mathrm{sum}(m)\) off that entry also guarantees, by construction (not merely numerically), that the adjoint’s output is exactly 0 at \((0,0)\) – unlike fast_pinv(), no manual zeroing is needed here.