Skip to content

Instantly share code, notes, and snippets.

@0x0L
Last active June 19, 2017 23:55
Show Gist options
  • Save 0x0L/0f05873911b3d764f5194b6797cd6fd3 to your computer and use it in GitHub Desktop.
Save 0x0L/0f05873911b3d764f5194b6797cd6fd3 to your computer and use it in GitHub Desktop.
Projection on hyperplanes
A = np.array([
[1, 1, 1],
[0.8, 0.7, 0.5]
])
assert np.linalg.matrix_rank(A) == len(A)
Q, _ = np.linalg.qr(A.T)
P = np.eye(len(Q)) - Q @ Q.T
np.allclose(P @ P, P)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment