1.0.0 API documentation
pca.hpp
Go to the documentation of this file.
1 
39 #pragma once
40 
41 // Dependency:
42 #include "../glm.hpp"
43 #include "../ext/scalar_relational.hpp"
44 
45 #ifndef GLM_ENABLE_EXPERIMENTAL
46 # error "GLM: GLM_GTX_pca is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
47 #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
48 # pragma message("GLM: GLM_GTX_pca extension included")
49 #endif
50 
51 namespace glm {
54 
58  template<length_t D, typename T, qualifier Q>
59  GLM_INLINE mat<D, D, T, Q> computeCovarianceMatrix(vec<D, T, Q> const* v, size_t n);
60 
65  template<length_t D, typename T, qualifier Q>
66  GLM_INLINE mat<D, D, T, Q> computeCovarianceMatrix(vec<D, T, Q> const* v, size_t n, vec<D, T, Q> const& c);
67 
70  template<length_t D, typename T, qualifier Q, typename I>
71  GLM_FUNC_DECL mat<D, D, T, Q> computeCovarianceMatrix(I const& b, I const& e);
72 
75  template<length_t D, typename T, qualifier Q, typename I>
76  GLM_FUNC_DECL mat<D, D, T, Q> computeCovarianceMatrix(I const& b, I const& e, vec<D, T, Q> const& c);
77 
86  template<length_t D, typename T, qualifier Q>
87  GLM_FUNC_DECL unsigned int findEigenvaluesSymReal
88  (
89  mat<D, D, T, Q> const& covarMat,
90  vec<D, T, Q>& outEigenvalues,
91  mat<D, D, T, Q>& outEigenvectors
92  );
93 
96  template<typename T, qualifier Q>
97  GLM_FUNC_DECL void sortEigenvalues(vec<2, T, Q>& eigenvalues, mat<2, 2, T, Q>& eigenvectors);
98 
101  template<typename T, qualifier Q>
102  GLM_FUNC_DECL void sortEigenvalues(vec<3, T, Q>& eigenvalues, mat<3, 3, T, Q>& eigenvectors);
103 
106  template<typename T, qualifier Q>
107  GLM_FUNC_DECL void sortEigenvalues(vec<4, T, Q>& eigenvalues, mat<4, 4, T, Q>& eigenvectors);
108 
110 }//namespace glm
111 
112 #include "pca.inl"
glm::computeCovarianceMatrix
GLM_FUNC_DECL mat< D, D, T, Q > computeCovarianceMatrix(I const &b, I const &e, vec< D, T, Q > const &c)
Compute a covariance matrix form a pair of iterators b (begin) and e (end) of a container with absolu...
glm::sortEigenvalues
GLM_FUNC_DECL void sortEigenvalues(vec< 4, T, Q > &eigenvalues, mat< 4, 4, T, Q > &eigenvectors)
Sorts a group of Eigenvalues&Eigenvectors, for largest Eigenvalue to smallest Eigenvalue.
glm::e
GLM_FUNC_DECL GLM_CONSTEXPR genType e()
Return e constant.
glm::findEigenvaluesSymReal
GLM_FUNC_DECL unsigned int findEigenvaluesSymReal(mat< D, D, T, Q > const &covarMat, vec< D, T, Q > &outEigenvalues, mat< D, D, T, Q > &outEigenvectors)
Assuming the provided covariance matrix covarMat is symmetric and real-valued, this function find the...