According to Wikipedia,
the Gram–Schmidt process is a method for orthonormalising a set of vectors in an inner product space,
Gram–Schmidt process, Wikipedia
Orthonormalising?
Not only is it “right,” it also makes your life a whole lot easier. If you don’t believe me, just watch the video on Coursera or have a go at it with our best friend, Salman Khan on Khan Academy.
We had to automate the process by writing a Python application. I”m not sure what I like best, learning about it, or coding about it. Me thinks I’ll take the latter.
Here’s a snippet:
def gsBasis(A) : B = np.array(A, dtype=np.float_) for i in range(B.shape[1]) : for j in range(i) : B[:, i] = B[:,i] - B[:,i] @ B[:,j] * B[:,j] if la.norm(B[:, i]) > verySmallNumber : B[:, i] = B[:, i] / la.norm(B[:, i]) else : B[:, i] = np.zeros_like(B[:, i]) return B
You can view the full code on Github.