orthogonalizeTraceNorm {zinbwave} | R Documentation |
Given two matrices U and V that can be multiplied, this function finds two new matrices U2 and V2 such that their product is conserved (U*V = U2*V2) and such that a||U||^2 + b||V||^2 is minimized.
orthogonalizeTraceNorm(U, V, a = 1, b = 1)
U |
left matrix |
V |
right matrix |
a |
weight of the norm of U (default=1) |
b |
weight of the norm of V (default=1) |
A list with the two matrices that solve the problem in the slots U and V.
U <- matrix(rnorm(15),5,3) V <- matrix(rnorm(12),3,4) o <- orthogonalizeTraceNorm(U,V) norm( U%*%V - o$U%*%o$V) # should be zero sum(U^2)+sum(V^2) sum(o$U^2)+sum(o$V^2) # should be smaller