Last active
September 24, 2020 01:15
-
-
Save oisincar/f25fdc738efbd67af5204e10c3016ae7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# A simple, no-frills gram schmidt implementation | |
def gram_schmidt(A): | |
for k in range(0, A.shape[1]): | |
# Normalize | |
A[:, k] /= np.linalg.norm(A[:, k]) | |
# Subtract from vecs below | |
for j in range(k+1, A.shape[1]): | |
r = np.dot(A[:, k], A[:, j]) | |
A[:, j] -= r*A[:, k] | |
return A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment