mlpack  2.0.1
diagonal_constraint.hpp
Go to the documentation of this file.
1 
14 #ifndef __MLPACK_METHODS_GMM_DIAGONAL_CONSTRAINT_HPP
15 #define __MLPACK_METHODS_GMM_DIAGONAL_CONSTRAINT_HPP
16 
17 #include <mlpack/core.hpp>
18 
19 namespace mlpack {
20 namespace gmm {
21 
26 {
27  public:
29  static void ApplyConstraint(arma::mat& covariance)
30  {
31  // Save the diagonal only.
32  arma::vec diagonal = covariance.diag();
33  covariance = arma::diagmat(diagonal);
34  }
35 
37  template<typename Archive>
38  static void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
39 };
40 
41 } // namespace gmm
42 } // namespace mlpack
43 
44 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Force a covariance matrix to be diagonal.
static void ApplyConstraint(arma::mat &covariance)
Force a covariance matrix to be diagonal.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
static void Serialize(Archive &, const unsigned int)
Serialize the constraint (which holds nothing, so, nothing to do).