Let $xx = (I - u uT / (uT u)) x$, where I is the identity matrix, x is a vector, u is a vector, uT is the transposed u, and xx is the resulting vector.
I want to implement this equation in python, so I tried the following but I am not sure if my code corresponds to what the equation is expressing:
# given u and x, example:
u = np.array([ 0.7231519 -0.36004635 -0.82970352 1.1832742 ])
x = np.array([ 1.10667023 -1.13105657 -0.77213626 1.14220917])
uuT = np.array([u]) * np.array([u]).T
uTu = np.dot(u, u)
xx = (I - uuT / uTu).dot(x)
Is my code above correct ?