inverse_truncated_modal

hcipy.util.inverse_truncated_modal(M, num_modes, svd=None)

Invert M with num_modes modes.

Modes are given by a singular value decomposition of the input matrix. If svd is given, it is used instead. Modes are ordered in descending order by their singular values.

Parameters
Mndarray

The matrix to invert. This matrix must be two-dimensional.

num_modesinteger

The number of modes to use for the inversion. Higher-order modes are ignored.

svdSVD object

A precalculated singular value decomposition object. This will be used if supplied, to avoid recalculation of an SVD.

Returns
ndarray

The inverted matrix.