The Gram–Schmidt process is a method for orthonormalising a set of vectors in an inner product space( to a new set that spans the same k-dimensional subspace as it’s original set of vectors).
When the matrix is full column rank it yields the QR decomposition which is composed of a triangular matrix and an orthogonal matrix.
The process is:
Copy First column of the matrix to a new matrix and then copy each next column after orthogonalizing it to the new matrix columns before, and then divide each column by it’s magnitude to normalize itself. (This is done by dividing each element in the column by the entire column magnitude which sums them all up to 1, which is unit length).