mlpack  1.0.12
random_init.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_METHODS_LMF_RANDOM_INIT_HPP
16 #define __MLPACK_METHODS_LMF_RANDOM_INIT_HPP
17 
18 #include <mlpack/core.hpp>
19 
20 namespace mlpack {
21 namespace amf {
22 
24 {
25  public:
26  // Empty constructor required for the InitializeRule template
28 
29  template<typename MatType>
30  inline static void Initialize(const MatType& V,
31  const size_t r,
32  arma::mat& W,
33  arma::mat& H)
34  {
35  // Simple implementation (left in the header file due to its simplicity).
36  size_t n = V.n_rows;
37  size_t m = V.n_cols;
38 
39  // Initialize to random values.
40  W.randu(n, r);
41  H.randu(r, m);
42  }
43 };
44 
45 }; // namespace amf
46 }; // namespace mlpack
47 
48 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: load.hpp:23
static void Initialize(const MatType &V, const size_t r, arma::mat &W, arma::mat &H)
Definition: random_init.hpp:30