mirror of
https://github.com/Relintai/pmlpp.git
synced 2025-03-12 22:38:51 +01:00
Renamed the SDVResult struct.
This commit is contained in:
parent
34cf810bd7
commit
3a297ae5d4
@ -938,7 +938,7 @@ std::vector<std::vector<real_t>> MLPPData::LSA(std::vector<std::string> sentence
|
||||
MLPPLinAlg alg;
|
||||
std::vector<std::vector<real_t>> docWordData = BOW(sentences, "Binary");
|
||||
|
||||
MLPPLinAlg::SDVResult svr_res = alg.SVD(docWordData);
|
||||
MLPPLinAlg::SDVResultOld svr_res = alg.SVD(docWordData);
|
||||
std::vector<std::vector<real_t>> S_trunc = alg.zeromat(dim, dim);
|
||||
std::vector<std::vector<real_t>> Vt_trunc;
|
||||
for (int i = 0; i < dim; i++) {
|
||||
|
@ -1198,7 +1198,7 @@ MLPPLinAlg::EigenResult MLPPLinAlg::eigen(std::vector<std::vector<real_t>> A) {
|
||||
return res;
|
||||
}
|
||||
|
||||
MLPPLinAlg::SDVResult MLPPLinAlg::SVD(std::vector<std::vector<real_t>> A) {
|
||||
MLPPLinAlg::SDVResultOld MLPPLinAlg::SVD(std::vector<std::vector<real_t>> A) {
|
||||
EigenResult left_eigen = eigen(matmult(A, transpose(A)));
|
||||
EigenResult right_eigen = eigen(matmult(transpose(A), A));
|
||||
|
||||
@ -1210,7 +1210,7 @@ MLPPLinAlg::SDVResult MLPPLinAlg::SVD(std::vector<std::vector<real_t>> A) {
|
||||
}
|
||||
}
|
||||
|
||||
SDVResult res;
|
||||
SDVResultOld res;
|
||||
res.U = left_eigen.eigen_vectors;
|
||||
res.S = sigma;
|
||||
res.Vt = right_eigen.eigen_vectors;
|
||||
@ -1218,7 +1218,7 @@ MLPPLinAlg::SDVResult MLPPLinAlg::SVD(std::vector<std::vector<real_t>> A) {
|
||||
return res;
|
||||
}
|
||||
|
||||
MLPPLinAlg::SDVResult MLPPLinAlg::svd(std::vector<std::vector<real_t>> A) {
|
||||
MLPPLinAlg::SDVResultOld MLPPLinAlg::svd(std::vector<std::vector<real_t>> A) {
|
||||
EigenResult left_eigen = eigen(matmult(A, transpose(A)));
|
||||
EigenResult right_eigen = eigen(matmult(transpose(A), A));
|
||||
|
||||
@ -1230,7 +1230,7 @@ MLPPLinAlg::SDVResult MLPPLinAlg::svd(std::vector<std::vector<real_t>> A) {
|
||||
}
|
||||
}
|
||||
|
||||
SDVResult res;
|
||||
SDVResultOld res;
|
||||
res.U = left_eigen.eigen_vectors;
|
||||
res.S = sigma;
|
||||
res.Vt = right_eigen.eigen_vectors;
|
||||
|
@ -121,15 +121,15 @@ public:
|
||||
|
||||
EigenResult eigen(std::vector<std::vector<real_t>> A);
|
||||
|
||||
struct SDVResult {
|
||||
struct SDVResultOld {
|
||||
std::vector<std::vector<real_t>> U;
|
||||
std::vector<std::vector<real_t>> S;
|
||||
std::vector<std::vector<real_t>> Vt;
|
||||
};
|
||||
|
||||
SDVResult SVD(std::vector<std::vector<real_t>> A);
|
||||
SDVResultOld SVD(std::vector<std::vector<real_t>> A);
|
||||
|
||||
SDVResult svd(std::vector<std::vector<real_t>> A);
|
||||
SDVResultOld svd(std::vector<std::vector<real_t>> A);
|
||||
|
||||
std::vector<real_t> vectorProjection(std::vector<real_t> a, std::vector<real_t> b);
|
||||
|
||||
|
@ -21,7 +21,7 @@ std::vector<std::vector<real_t>> MLPPPCA::principalComponents() {
|
||||
MLPPLinAlg alg;
|
||||
MLPPData data;
|
||||
|
||||
MLPPLinAlg::SDVResult svr_res = alg.SVD(alg.cov(inputSet));
|
||||
MLPPLinAlg::SDVResultOld svr_res = alg.SVD(alg.cov(inputSet));
|
||||
X_normalized = data.meanCentering(inputSet);
|
||||
U_reduce.resize(svr_res.U.size());
|
||||
for (int i = 0; i < k; i++) {
|
||||
|
@ -21,7 +21,7 @@ std::vector<std::vector<real_t>> MLPPPCAOld::principalComponents() {
|
||||
MLPPLinAlg alg;
|
||||
MLPPData data;
|
||||
|
||||
MLPPLinAlg::SDVResult svr_res = alg.SVD(alg.cov(inputSet));
|
||||
MLPPLinAlg::SDVResultOld svr_res = alg.SVD(alg.cov(inputSet));
|
||||
X_normalized = data.meanCentering(inputSet);
|
||||
U_reduce.resize(svr_res.U.size());
|
||||
for (int i = 0; i < k; i++) {
|
||||
|
@ -721,7 +721,7 @@ void MLPPTests::test_pca_svd_eigenvalues_eigenvectors(bool ui) {
|
||||
|
||||
std::cout << "SVD" << std::endl;
|
||||
|
||||
MLPPLinAlg::SDVResult svd = alg.SVD(inputSet);
|
||||
MLPPLinAlg::SDVResultOld svd = alg.SVD(inputSet);
|
||||
|
||||
std::cout << "U:" << std::endl;
|
||||
alg.printMatrix(svd.U);
|
||||
|
Loading…
Reference in New Issue
Block a user