We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f63761a commit b023165Copy full SHA for b023165
lectures/orth_proj.md
@@ -790,7 +790,7 @@ def gram_schmidt(X):
790
791
# The first col of U is just the normalized first col of X
792
v1 = X[:,0]
793
- U[:, 0] = v1 / np.sqrt(np.sum(v1 * v1))
+ U[:, 0] = v1 / np.sqrt(v1 @ v1)
794
795
for i in range(1, k):
796
# Set up
@@ -802,7 +802,7 @@ def gram_schmidt(X):
802
u = M @ b
803
804
# Normalize
805
- U[:, i] = u / np.sqrt(np.sum(u * u))
+ U[:, i] = u / np.sqrt(u @ u)
806
807
return U
808
```
0 commit comments