mlpack  1.0.12
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 };
36 
37 }; // namespace gmm
38 }; // namespace mlpack
39 
40 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: load.hpp:23
Force a covariance matrix to be diagonal.
static void ApplyConstraint(arma::mat &covariance)
Force a covariance matrix to be diagonal.