123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /**
- * @file AlgebraTools.h
- * @brief Algebra Tools
- * @author Michael Koch,Erik Rodner
- * @date 05/20/2009
- */
- #ifndef AlgebraToolsINCLUDE
- #define AlgebraToolsINCLUDE
- #include <vislearning/nice_nonvis.h>
- namespace OBJREC
- {
- class AlgebraTools
- {
- public:
- //FIXME: find a better place
- template<typename T>
- static T sign(T n);
-
- static void calculateMean(const NICE::Matrix &data, NICE::Vector &mean);
- static void calculateMean(const NICE::Matrix &data,NICE::Vector &mean,NICE::Vector &sigma);
- static void orthogonalize(NICE::Matrix &M,bool iterative=true);
- static double trace(const NICE::Matrix &M);
- static double matrixRowColNorm(const NICE::Matrix &M);
- static NICE::Matrix vectorToMatrix(const NICE::Vector &vec);
- static NICE::Vector matrixToVector(const NICE::Matrix &mat);
- /**
- * Converting Vector to diagonal Matrix
- * @param diagonalelements diagonal elements
- * @return Matrix with diagonal elements
- */
- static NICE::Matrix diag(const NICE::Vector &diagonalelements);
- static double meanOfVector(const NICE::Vector &vec);
- static NICE::Vector meanOfMatrix(const NICE::Matrix &M);
- };
- template<typename T>
- T AlgebraTools::sign(T n)
- {
- if (n < 0) return -1;
- if (n > 0) return 1;
- return 0;
- }
- }
- #endif
|