Go to the documentation of this file.00001 #ifndef mcal_general_ca_h_
00002 #define mcal_general_ca_h_
00003
00004
00005
00006
00007
00008 #include <mcal/mcal_component_analyzer.h>
00009 #include <mcal/mcal_single_basis_cost.h>
00010 #include <mbl/mbl_cloneable_ptr.h>
00011 #include <vnl/io/vnl_io_vector.h>
00012 #include <vnl/io/vnl_io_matrix.h>
00013 #include <mbl/mbl_data_wrapper.h>
00014 #include <vcl_iosfwd.h>
00015
00016
00017
00018
00019
00020
00021
00022 class mcal_general_ca : public mcal_component_analyzer
00023 {
00024 private:
00025
00026 mbl_cloneable_ptr<mcal_component_analyzer> initial_ca_;
00027
00028
00029 mbl_cloneable_ptr<mcal_single_basis_cost> basis_cost_;
00030
00031
00032 unsigned max_passes_;
00033
00034
00035 double move_thresh_;
00036
00037
00038 double optimise_mode_pair(vnl_vector<double>& proj1,
00039 vnl_vector<double>& proj2,
00040 vnl_vector<double>& mode1,
00041 vnl_vector<double>& mode2);
00042
00043
00044 double optimise_one_pass(vcl_vector<vnl_vector<double> >& proj,
00045 vnl_matrix<double>& modes);
00046
00047
00048 void optimise_about_mean(mbl_data_wrapper<vnl_vector<double> >& data,
00049 const vnl_vector<double>& mean,
00050 vnl_matrix<double>& modes,
00051 vnl_vector<double>& mode_var);
00052
00053
00054
00055 void compute_projections(mbl_data_wrapper<vnl_vector<double> >& data,
00056 const vnl_vector<double>& mean,
00057 vnl_matrix<double>& modes,
00058 vcl_vector<vnl_vector<double> >& proj);
00059
00060
00061 void set_defaults();
00062 public:
00063
00064
00065 mcal_general_ca();
00066
00067
00068 virtual ~mcal_general_ca();
00069
00070
00071 void set(const mcal_component_analyzer& initial_ca,
00072 const mcal_single_basis_cost& basis_cost);
00073
00074
00075 mcal_component_analyzer& initial_ca() { return initial_ca_; }
00076
00077
00078 mcal_single_basis_cost& basis_cost() { return basis_cost_; }
00079
00080
00081
00082
00083 virtual void build_about_mean(mbl_data_wrapper<vnl_vector<double> >& data,
00084 const vnl_vector<double>& mean,
00085 vnl_matrix<double>& modes,
00086 vnl_vector<double>& mode_var);
00087
00088
00089 short version_no() const;
00090
00091
00092 virtual vcl_string is_a() const;
00093
00094
00095 virtual mcal_component_analyzer* clone() const;
00096
00097
00098 virtual void print_summary(vcl_ostream& os) const;
00099
00100
00101 virtual void b_write(vsl_b_ostream& bfs) const;
00102
00103
00104 virtual void b_read(vsl_b_istream& bfs);
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 virtual void config_from_stream(vcl_istream & is);
00118 };
00119
00120 #endif // mcal_general_ca_h_