planc
Parallel Lowrank Approximation with Non-negativity Constraints
distals.hpp
Go to the documentation of this file.
1 /* Copyright 2016 Ramakrishnan Kannan */
2 
3 #ifndef DISTNMF_DISTALS_HPP_
4 #define DISTNMF_DISTALS_HPP_
5 #include "distnmf/aunmf.hpp"
6 
12 namespace planc {
13 
14 template <class INPUTMATTYPE>
15 class DistALS : public DistAUNMF<INPUTMATTYPE> {
16  protected:
23  void updateW() {
24  this->Wt = arma::solve(arma::trimatl(this->HtH), this->AHtij);
25  this->W = this->Wt.t();
26  DISTPRINTINFO("ALS::updateW::HtH::" << PRINTMATINFO(this->HtH)
27  << "::AHtij::"
28  << PRINTMATINFO(this->AHtij)
29  << "::W::" << PRINTMATINFO(this->W));
30  DISTPRINTINFO("ALS::updateW::HtH::" << norm(this->HtH, "fro") << "::AHtij::"
31  << norm(this->AHtij, "fro")
32  << "::W::" << norm(this->W, "fro"));
33  }
40  void updateH() {
41  this->Ht = arma::solve(arma::trimatl(this->WtW), this->WtAij);
42  this->H = this->Ht.t();
43  DISTPRINTINFO("ALS::updateH::WtW::" << PRINTMATINFO(this->WtW)
44  << "::WtAij::"
45  << PRINTMATINFO(this->WtAij)
46  << "::H::" << PRINTMATINFO(this->H));
47  DISTPRINTINFO("ALS::updateH::WtW::" << norm(this->WtW, "fro") << "::WtAij::"
48  << norm(this->WtAij, "fro")
49  << "::H::" << norm(this->H, "fro"));
50  }
51 
52  public:
53  DistALS(const INPUTMATTYPE& input, const MAT& leftlowrankfactor,
54  const MAT& rightlowrankfactor, const MPICommunicator& communicator,
55  const int numkblks)
56  : DistAUNMF<INPUTMATTYPE>(input, leftlowrankfactor, rightlowrankfactor,
57  communicator, numkblks) {
58  PRINTROOT("DistALS() constructor successful");
59  }
60 };
61 
62 } // namespace planc
63 
64 #endif // DISTNMF_DISTALS_HPP_
DistALS(const INPUTMATTYPE &input, const MAT &leftlowrankfactor, const MAT &rightlowrankfactor, const MPICommunicator &communicator, const int numkblks)
Definition: distals.hpp:53
#define DISTPRINTINFO(MSG)
Definition: distutils.h:37
#define MAT
Definition: utils.h:52
ncp_factors contains the factors of the ncp every ith factor is of size n_i * k number of factors is ...
Definition: ncpfactors.hpp:20
#define PRINTROOT(MSG)
Definition: distutils.h:32
#define PRINTMATINFO(A)
Definition: utils.h:63