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 */ 00009 00010 #ifndef ITERATIVE_SHIFTED_LINEAR_FAMILY_SOLVER_H_ 00011 #define ITERATIVE_SHIFTED_LINEAR_FAMILY_SOLVER_H_ 00012 00013 #include <shogun/lib/config.h> 00014 #include <shogun/mathematics/linalg/linsolver/IterativeLinearSolver.h> 00015 00016 namespace shogun 00017 { 00018 template <class T> class SGVector; 00019 template <class T> class CLinearOperator; 00020 00034 template<class T, class ST=T> class CIterativeShiftedLinearFamilySolver : public CIterativeLinearSolver<T, T> 00035 { 00036 00037 public: 00039 CIterativeShiftedLinearFamilySolver(); 00040 00042 CIterativeShiftedLinearFamilySolver(bool store_residuals); 00043 00045 virtual ~CIterativeShiftedLinearFamilySolver(); 00046 00055 virtual SGVector<T> solve(CLinearOperator<T>* A, SGVector<T> b) = 0; 00056 00068 virtual SGVector<ST> solve_shifted_weighted(CLinearOperator<T>* A, 00069 SGVector<T> b, SGVector<ST> shifts, SGVector<ST> weights) = 0; 00070 00072 virtual const char* get_name() const 00073 { 00074 return "IterativeShiftedLinearFamilySolver"; 00075 } 00076 00077 protected: 00092 void compute_zeta_sh_new(const SGVector<ST>& zeta_sh_old, 00093 const SGVector<ST>& zeta_sh_cur, const SGVector<ST>& shifts, 00094 const T& beta_old, const T& beta_cur, const T& alpha, SGVector<ST>& zeta_sh_new); 00095 00105 void compute_beta_sh(const SGVector<ST>& zeta_sh_new, 00106 const SGVector<ST>& zeta_sh_cur, const T& beta_cur, SGVector<ST>& beta_sh); 00107 00119 void compute_alpha_sh(const SGVector<ST>& zeta_sh_cur, 00120 const SGVector<ST>& zeta_sh_old, const SGVector<ST>& beta_sh_old, 00121 const T& beta_old, const T& alpha, SGVector<ST>& alpha_sh); 00122 00123 }; 00124 00125 } 00126 00127 #endif // ITERATIVE_SHIFTED_LINEAR_FAMILY_SOLVER_H_