This class acts as the wrapper for all SVD factorizers which are incompatible with CF module. More...
Public Member Functions | |
SVDWrapper (const Factorizer &factorizer=Factorizer()) | |
double | Apply (const arma::mat &V, arma::mat &W, arma::mat &sigma, arma::mat &H) const |
Factorizer function which takes SVD of the given matrix and returns the frobenius norm of error. More... | |
double | Apply (const arma::mat &V, size_t r, arma::mat &W, arma::mat &H) const |
Factorizer function which computes SVD and returns matrices as required by CF module. More... | |
This class acts as the wrapper for all SVD factorizers which are incompatible with CF module.
Normally SVD factrorizers implement Apply method which takes matrix V and factorizes it into P, sigma and Q where V = P * sigma * trans(Q). But CF module requires factrorization to be V = W * H. This class multiplies P and sigma and takes the first 'r' eigenvectors out where 'r' is the rank of factorization. Q matrix is transposed and trimmed to support the rank of factorization. The Factroizer class should implement Apply which takes matrices P, sigma, Q and V as their parameter respectively.
Definition at line 40 of file svd_wrapper.hpp.
|
inline |
Definition at line 44 of file svd_wrapper.hpp.
double Apply | ( | const arma::mat & | V, |
arma::mat & | W, | ||
arma::mat & | sigma, | ||
arma::mat & | H | ||
) | const |
Factorizer function which takes SVD of the given matrix and returns the frobenius norm of error.
V | input matrix |
W | first unitary matrix |
sigma | eigenvalue matrix |
H | second unitary matrix |
double Apply | ( | const arma::mat & | V, |
size_t | r, | ||
arma::mat & | W, | ||
arma::mat & | H | ||
) | const |
Factorizer function which computes SVD and returns matrices as required by CF module.
V | input matrix |
r | rank |
W | first unitary matrix |
H | second unitary matrix |