diagonal_constraint.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_GMM_DIAGONAL_CONSTRAINT_HPP
13 #define MLPACK_METHODS_GMM_DIAGONAL_CONSTRAINT_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace gmm {
19 
24 {
25  public:
27  static void ApplyConstraint(arma::mat& covariance)
28  {
29  // Save the diagonal only.
30  covariance = arma::diagmat(arma::clamp(covariance.diag(), 1e-10, DBL_MAX));
31  }
32 
34  template<typename Archive>
35  static void serialize(Archive& /* ar */, const unsigned int /* version */) { }
36 };
37 
38 } // namespace gmm
39 } // namespace mlpack
40 
41 #endif
.hpp
Definition: add_to_po.hpp:21
Force a covariance matrix to be diagonal.
static void ApplyConstraint(arma::mat &covariance)
Force a covariance matrix to be diagonal.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static void serialize(Archive &, const unsigned int)
Serialize the constraint (which holds nothing, so, nothing to do).