Go to the documentation of this file.00001 #ifndef mcal_pca_h
00002 #define mcal_pca_h
00003
00004
00005
00006
00007
00008 #include <mcal/mcal_component_analyzer.h>
00009 #include <vnl/io/vnl_io_vector.h>
00010 #include <vnl/io/vnl_io_matrix.h>
00011 #include <mbl/mbl_data_wrapper.h>
00012 #include <vcl_iosfwd.h>
00013
00014
00015
00016
00017 class mcal_pca : public mcal_component_analyzer
00018 {
00019 private:
00020
00021 double var_prop_;
00022 unsigned int min_modes_,max_modes_;
00023
00024
00025 unsigned choose_n_modes(const vnl_vector<double>& evals);
00026
00027
00028 void fillDDt(vnl_matrix<double>& DDt, const vnl_matrix<double>& A,
00029 int rlo, int rhi, int clo, int chi);
00030
00031
00032 void build_evecs_nd_smaller(mbl_data_wrapper<vnl_vector<double> >& data,
00033 const vnl_vector<double>& mean,
00034 vnl_matrix<double>& evecs,
00035 vnl_vector<double>& evals);
00036
00037
00038 void build_evecs_ns_smaller(mbl_data_wrapper<vnl_vector<double> >& data,
00039 const vnl_vector<double>& mean,
00040 vnl_matrix<double>& evecs,
00041 vnl_vector<double>& evals);
00042
00043
00044 double max_d_in_memory_;
00045
00046
00047 bool use_chunks_;
00048
00049 public:
00050
00051
00052 mcal_pca();
00053
00054
00055 virtual ~mcal_pca();
00056
00057
00058
00059 void set_mode_choice(unsigned min, unsigned max, double var_proportion);
00060
00061
00062
00063 void set_min_modes( unsigned min );
00064
00065 unsigned min_modes() const;
00066
00067
00068 void set_max_modes(unsigned max);
00069
00070 unsigned max_modes() const;
00071
00072
00073 virtual void set_var_prop(double v);
00074
00075
00076 virtual double var_prop() const;
00077
00078
00079 void set_max_d_in_memory(double max_n);
00080
00081
00082 double max_d_in_memory() const { return max_d_in_memory_; }
00083
00084
00085 void set_use_chunks(bool chunks);
00086
00087
00088 bool use_chunks() const { return use_chunks_; }
00089
00090
00091
00092
00093 virtual void build_about_mean(mbl_data_wrapper<vnl_vector<double> >& data,
00094 const vnl_vector<double>& mean,
00095 vnl_matrix<double>& modes,
00096 vnl_vector<double>& mode_var);
00097
00098
00099 short version_no() const;
00100
00101
00102 virtual vcl_string is_a() const;
00103
00104
00105 virtual mcal_component_analyzer* clone() const;
00106
00107
00108 virtual void print_summary(vcl_ostream& os) const;
00109
00110
00111 virtual void b_write(vsl_b_ostream& bfs) const;
00112
00113
00114 virtual void b_read(vsl_b_istream& bfs);
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 virtual void config_from_stream(vcl_istream & is);
00129 };
00130
00131 #endif // mcal_pca_h