SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2013 Soumyajit De 00008 * Written (W) 2013 Heiko Strathmann 00009 */ 00010 00011 #ifndef RATIONAL_APPROXIMATION_H_ 00012 #define RATIONAL_APPROXIMATION_H_ 00013 00014 #include <shogun/lib/config.h> 00015 #include <shogun/mathematics/linalg/ratapprox/opfunc/OperatorFunction.h> 00016 00017 namespace shogun 00018 { 00019 00020 template<class T> class SGVector; 00021 template<class T> class CLinearOperator; 00022 class CIndependentComputationEngine; 00023 class CJobResultAggregator; 00024 class CEigenSolver; 00025 00063 class CRationalApproximation : public COperatorFunction<float64_t> 00064 { 00065 public: 00067 CRationalApproximation(); 00068 00081 CRationalApproximation( 00082 CLinearOperator<float64_t>* linear_operator, 00083 CIndependentComputationEngine* computation_engine, 00084 CEigenSolver* eigen_solver, 00085 float64_t desired_accuracy, 00086 EOperatorFunction function_type); 00087 00089 virtual ~CRationalApproximation(); 00090 00099 virtual void precompute(); 00100 00112 int32_t compute_num_shifts_from_accuracy(); 00113 00124 virtual CJobResultAggregator* submit_jobs(SGVector<float64_t> sample) = 0; 00125 00127 SGVector<complex128_t> get_shifts() const; 00128 00130 SGVector<complex128_t> get_weights() const; 00131 00133 float64_t get_constant_multiplier() const; 00134 00136 index_t get_num_shifts() const; 00137 00139 void set_num_shifts(index_t num_shifts); 00140 00142 virtual const char* get_name() const 00143 { 00144 return "RationalApproximation"; 00145 } 00146 00147 protected: 00149 CEigenSolver* m_eigen_solver; 00150 00152 SGVector<complex128_t> m_shifts; 00153 00155 SGVector<complex128_t> m_weights; 00156 00158 float64_t m_constant_multiplier; 00159 00161 int32_t m_num_shifts; 00162 00164 float64_t m_desired_accuracy; 00165 00166 private: 00168 void init(); 00169 00174 void compute_shifts_weights_const(); 00175 }; 00176 00177 } 00178 00179 #endif // RATIONAL_APPROXIMATION_H_