matrix_completion.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_MATRIX_COMPLETION_MATRIX_COMPLETION_HPP
14 #define MLPACK_METHODS_MATRIX_COMPLETION_MATRIX_COMPLETION_HPP
15 
16 #include <ensmallen.hpp>
17 #include <mlpack/prereqs.hpp>
18 
19 namespace mlpack {
20 namespace matrix_completion {
21 
54 {
55  public:
68  MatrixCompletion(const size_t m,
69  const size_t n,
70  const arma::umat& indices,
71  const arma::vec& values,
72  const size_t r);
73 
86  MatrixCompletion(const size_t m,
87  const size_t n,
88  const arma::umat& indices,
89  const arma::vec& values,
90  const arma::mat& initialPoint);
91 
102  MatrixCompletion(const size_t m,
103  const size_t n,
104  const arma::umat& indices,
105  const arma::vec& values);
106 
112  void Recover(arma::mat& recovered);
113 
115  const ens::LRSDP<ens::SDP<arma::sp_mat>>& Sdp() const
116  {
117  return sdp;
118  }
120  ens::LRSDP<ens::SDP<arma::sp_mat>>& Sdp() { return sdp; }
121 
122  private:
124  size_t m;
126  size_t n;
128  arma::umat indices;
130  arma::mat values;
131 
133  ens::LRSDP<ens::SDP<arma::sp_mat>> sdp;
134 
136  void CheckValues();
138  void InitSDP();
139 
142  static size_t DefaultRank(const size_t m, const size_t n, const size_t p);
143 };
144 
145 } // namespace matrix_completion
146 } // namespace mlpack
147 
148 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
MatrixCompletion(const size_t m, const size_t n, const arma::umat &indices, const arma::vec &values, const size_t r)
Construct a matrix completion problem, specifying the maximum rank of the solution.
The core includes that mlpack expects; standard C++ includes and Armadillo.
ens::LRSDP< ens::SDP< arma::sp_mat > > & Sdp()
Modify the underlying SDP.
const ens::LRSDP< ens::SDP< arma::sp_mat > > & Sdp() const
Return the underlying SDP.
void Recover(arma::mat &recovered)
Solve the underlying SDP to fill in the remaining values.
This class implements the popular nuclear norm minimization heuristic for matrix completion problems...