gftool.linalg.orth_compl

gftool.linalg.orth_compl(mat)[source]

Calculate the orthogonal complement of a rectangular matrix using QR.

For a tall N×M, N>M, matrix mat the complete QR-decomposition gives

\[A = QR = (Q_1, Q_2) {(R_1, 0)}^2.\]

The N×(N-M) matrix Q_2 gives the orthogonal complement A_⟂ = Q_2.T.conj() with the property

\[A_⟂ A = 0.\]
Parameters:
mat(N, M) complex array_like

Tall input matrix.

Returns:
(N-M, N) complex np.ndarray

Orthogonal complement of mat, such that mat_perp@mat==0.

Examples

>>> RNG = np.random.default_rng()
>>> mat = RNG.random((10, 5))
>>> mat_perp = gt.linalg.orth_compl(mat)
>>> np.allclose(mat_perp@mat, 0)
True