planc
Parallel Lowrank Approximation with Non-negativity Constraints
distntfmu.hpp
Go to the documentation of this file.
1 /* Copyright Ramakrishnan Kannan 2018 */
2 
3 #ifndef DISTNTF_DISTNTFMU_HPP_
4 #define DISTNTF_DISTNTFMU_HPP_
5 
6 #include "distntf/distauntf.hpp"
7 
8 namespace planc {
9 
10 class DistNTFMU : public DistAUNTF {
11  protected:
19  MAT update(const int mode) {
20  MAT H(this->m_local_ncp_factors.factor(mode));
21  if (m_nls_sizes[mode] > 0) {
22  MAT temp = H * this->global_gram + EPSILON;
23  MAT rhs = this->ncp_local_mttkrp_t[mode].t();
24  H = (H % rhs) / temp;
25  } else { // Return unmodified factor
26  H.zeros();
27  }
28  return H.t();
29  }
30 
31  public:
32  DistNTFMU(const Tensor &i_tensor, const int i_k, algotype i_algo,
33  const UVEC &i_global_dims, const UVEC &i_local_dims,
34  const UVEC &i_nls_sizes, const UVEC &i_nls_idxs,
35  const NTFMPICommunicator &i_mpicomm)
36  : DistAUNTF(i_tensor, i_k, i_algo, i_global_dims, i_local_dims,
37  i_nls_sizes, i_nls_idxs, i_mpicomm) {}
38 }; // class DistNTFMU
39 
40 } // namespace planc
41 
42 #endif // DISTNTF_DISTNTFMU_HPP_
Data is stored such that the unfolding is column major.
Definition: tensor.hpp:32
DistNTFMU(const Tensor &i_tensor, const int i_k, algotype i_algo, const UVEC &i_global_dims, const UVEC &i_local_dims, const UVEC &i_nls_sizes, const UVEC &i_nls_idxs, const NTFMPICommunicator &i_mpicomm)
Definition: distntfmu.hpp:32
algotype
Definition: utils.h:10
#define UVEC
Definition: utils.h:58
#define EPSILON
Definition: utils.h:44
#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