converted quic svd to .hpp
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# Anything not in this list will not be compiled into mlpack.
|
||||
set(SOURCES
|
||||
quic_svd.hpp
|
||||
quic_svd.cpp
|
||||
quic_svd_impl.hpp
|
||||
)
|
||||
|
||||
# Add directory name to sources.
|
||||
|
||||
@@ -94,4 +94,7 @@ class QUIC_SVD
|
||||
} // namespace svd
|
||||
} // namespace mlpack
|
||||
|
||||
// Include implementation.
|
||||
#include "quic_svd_impl.hpp"
|
||||
|
||||
#endif
|
||||
|
||||
+18
-15
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file methods/quic_svd/quic_svd.cpp
|
||||
* @file methods/quic_svd/quic_svd_impl.hpp
|
||||
* @author Siddharth Agrawal
|
||||
*
|
||||
* An implementation of QUIC-SVD.
|
||||
@@ -9,30 +9,31 @@
|
||||
* 3-clause BSD license along with mlpack. If not, see
|
||||
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
|
||||
*/
|
||||
#ifndef MLPACK_METHODS_QUIC_SVD_QUIC_SVD_IMPL_HPP
|
||||
#define MLPACK_METHODS_QUIC_SVD_QUIC_SVD_IMPL_HPP
|
||||
|
||||
// In case it hasn't been included yet.
|
||||
#include "quic_svd.hpp"
|
||||
|
||||
using namespace mlpack::tree;
|
||||
|
||||
namespace mlpack {
|
||||
namespace svd {
|
||||
|
||||
QUIC_SVD::QUIC_SVD(const arma::mat& dataset,
|
||||
arma::mat& u,
|
||||
arma::mat& v,
|
||||
arma::mat& sigma,
|
||||
const double epsilon,
|
||||
const double delta) :
|
||||
inline QUIC_SVD::QUIC_SVD(
|
||||
const arma::mat& dataset,
|
||||
arma::mat& u,
|
||||
arma::mat& v,
|
||||
arma::mat& sigma,
|
||||
const double epsilon,
|
||||
const double delta) :
|
||||
dataset(dataset)
|
||||
{
|
||||
// Since columns are sample in the implementation, the matrix is transposed if
|
||||
// necessary for maximum speedup.
|
||||
CosineTree* ctree;
|
||||
tree::CosineTree* ctree;
|
||||
if (dataset.n_cols > dataset.n_rows)
|
||||
ctree = new CosineTree(dataset, epsilon, delta);
|
||||
ctree = new tree::CosineTree(dataset, epsilon, delta);
|
||||
else
|
||||
ctree = new CosineTree(dataset.t(), epsilon, delta);
|
||||
ctree = new tree::CosineTree(dataset.t(), epsilon, delta);
|
||||
|
||||
// Get subspace basis by creating the cosine tree.
|
||||
ctree->GetFinalBasis(basis);
|
||||
@@ -45,9 +46,9 @@ QUIC_SVD::QUIC_SVD(const arma::mat& dataset,
|
||||
ExtractSVD(u, v, sigma);
|
||||
}
|
||||
|
||||
void QUIC_SVD::ExtractSVD(arma::mat& u,
|
||||
arma::mat& v,
|
||||
arma::mat& sigma)
|
||||
inline void QUIC_SVD::ExtractSVD(arma::mat& u,
|
||||
arma::mat& v,
|
||||
arma::mat& sigma)
|
||||
{
|
||||
// Calculate A * V_hat, necessary for further calculations.
|
||||
arma::mat projectedMat;
|
||||
@@ -82,3 +83,5 @@ void QUIC_SVD::ExtractSVD(arma::mat& u,
|
||||
|
||||
} // namespace svd
|
||||
} // namespace mlpack
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user