LinearPca.hpp

00001 // This file is part of the imaging2 class library.
00002 //
00003 // University of Innsbruck, Infmath Imaging, 2009.
00004 // http://infmath.uibk.ac.at
00005 //
00006 // All rights reserved.
00007 
00008 
00009 #ifndef STATISTIC_LINEARPCA_H
00010 #define STATISTIC_LINEARPCA_H
00011 
00012 #include <core/imaging2.hpp>
00013 
00014 
00015 namespace imaging
00016 {
00024   class LinearPca
00025   {
00026     size_t _dimension;
00027     size_t _data_dimension;
00028     
00029     ublas::vector<float_t> _mean;
00030     ublas::vector<float_t> _standard_deviations;
00031     ublas::matrix<float_t> _root_of_covariance;
00032     ublas::matrix<float_t> _inverse_root_of_covariance;
00033 
00034     void set_data(const ublas::matrix<float_t> & data);
00035     void set_data(const ublas::matrix<float_t> & data, size_t dimension);
00036     
00037   public:
00038     LinearPca() : _dimension(0), _data_dimension(0) {}
00039     
00044     LinearPca(const ublas::matrix<float_t> & data);
00045     
00049     LinearPca(const ublas::matrix<float_t> & data, size_t dimension);
00050     
00052     const ublas::vector<float_t> & mean() const;
00053     
00055     void compute_vector(const ublas::vector<float_t> & coefficients, ublas::vector<float_t> & vector) const;
00056     
00058     float_t norm(const ublas::vector<float_t> & vector) const;
00059     
00061     void compute_coefficients(const ublas::vector<float_t> & vector, ublas::vector<float_t> & coefficients) const;
00062     
00064     void compute_coefficients(const ublas::matrix<float_t> & matrix, ublas::matrix<float_t> & coefficients) const;
00065     
00067     const ublas::vector<float_t> & standard_deviations() const;
00068     
00070     size_t dimension() const;
00071     
00073     size_t data_dimension() const;
00074     
00076     float_t squared_norm_derivative(const ublas::vector<float_t> & vector, const ublas::vector<float_t> & direction) const;
00077   };
00078 }
00079 
00080 #endif

Generated on Tue Feb 10 10:01:31 2009 for imaging2 by  doxygen 1.5.5