Created
December 7, 2021 01:19
-
-
Save thistleknot/d8ea9064bb90564f3028d3f742973570 to your computer and use it in GitHub Desktop.
ZCA SVD in R
This file contains 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
ZCA_svd <- function(x) | |
{ | |
internal <- svd(x) | |
U = internal$u | |
#print(U) | |
#Vt = internal$v | |
Vt = t(internal$v) | |
#print(Vt) | |
s = internal$d | |
#U, s, Vt = np.linalg.svd(X, full_matrices=False) | |
# U and Vt are the singular matrices, and s contains the singular values. | |
# Since the rows of both U and Vt are orthonormal vectors, then U * Vt | |
# will be white | |
#dot(U,Vt) | |
X_white = U%*%Vt | |
#np$dot(U,Vt) | |
# | |
return(X_white) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment