ViennaCL - The Vienna Computing Library
1.5.1
|
00001 #ifndef VIENNACL_LINALG_DETAIL_SPAI_SPAI_TAG_HPP 00002 #define VIENNACL_LINALG_DETAIL_SPAI_SPAI_TAG_HPP 00003 00004 /* ========================================================================= 00005 Copyright (c) 2010-2014, Institute for Microelectronics, 00006 Institute for Analysis and Scientific Computing, 00007 TU Wien. 00008 Portions of this software are copyright by UChicago Argonne, LLC. 00009 00010 ----------------- 00011 ViennaCL - The Vienna Computing Library 00012 ----------------- 00013 00014 Project Head: Karl Rupp rupp@iue.tuwien.ac.at 00015 00016 (A list of authors and contributors can be found in the PDF manual) 00017 00018 License: MIT (X11), see file LICENSE in the base directory 00019 ============================================================================= */ 00020 00021 00029 #include <utility> 00030 #include <iostream> 00031 #include <fstream> 00032 #include <string> 00033 #include <algorithm> 00034 #include <vector> 00035 #include <math.h> 00036 #include <cmath> 00037 #include <sstream> 00038 #include "viennacl/ocl/backend.hpp" 00039 #include "boost/numeric/ublas/vector.hpp" 00040 #include "boost/numeric/ublas/matrix.hpp" 00041 #include "boost/numeric/ublas/matrix_proxy.hpp" 00042 #include "boost/numeric/ublas/storage.hpp" 00043 #include "boost/numeric/ublas/io.hpp" 00044 #include "boost/numeric/ublas/matrix_expression.hpp" 00045 #include "boost/numeric/ublas/detail/matrix_assign.hpp" 00046 00047 #include "viennacl/linalg/detail/spai/block_matrix.hpp" 00048 #include "viennacl/linalg/detail/spai/block_vector.hpp" 00049 00050 namespace viennacl 00051 { 00052 namespace linalg 00053 { 00054 namespace detail 00055 { 00056 namespace spai 00057 { 00058 00063 class spai_tag 00064 { 00072 public: 00073 spai_tag( 00074 double residual_norm_threshold = 1e-3, 00075 unsigned int iteration_limit = 5, 00076 double residual_threshold = 1e-2, 00077 bool is_static = false, 00078 bool is_right = false) : 00079 residual_norm_threshold_(residual_norm_threshold), 00080 iteration_limit_(iteration_limit), 00081 residual_threshold_(residual_threshold), 00082 is_static_(is_static), 00083 is_right_(is_right) {} 00084 00085 double getResidualNormThreshold() const 00086 { return residual_norm_threshold_; } 00087 00088 double getResidualThreshold() const 00089 { return residual_threshold_; } 00090 00091 unsigned int getIterationLimit () const 00092 { return iteration_limit_; } 00093 00094 bool getIsStatic() const 00095 { return is_static_; } 00096 00097 bool getIsRight() const 00098 { return is_right_; } 00099 00100 long getBegInd() const 00101 { return beg_ind_; } 00102 00103 long getEndInd() const 00104 { return end_ind_; } 00105 00106 00107 00108 void setResidualNormThreshold(double residual_norm_threshold) 00109 { 00110 if(residual_norm_threshold > 0) 00111 residual_norm_threshold_ = residual_norm_threshold; 00112 } 00113 00114 void setResidualThreshold(double residual_threshold) 00115 { 00116 if(residual_threshold > 0) 00117 residual_threshold_ = residual_threshold; 00118 } 00119 00120 void setIterationLimit(unsigned int iteration_limit) 00121 { 00122 if(iteration_limit > 0) 00123 iteration_limit_ = iteration_limit; 00124 } 00125 00126 void setIsRight(bool is_right) { is_right_ = is_right; } 00127 00128 void setIsStatic(bool is_static) { is_static_ = is_static; } 00129 00130 void setBegInd(long beg_ind) { beg_ind_ = beg_ind; } 00131 00132 void setEndInd(long end_ind){ end_ind_ = end_ind; } 00133 00134 00135 private: 00136 double residual_norm_threshold_; 00137 unsigned int iteration_limit_; 00138 long beg_ind_, end_ind_; 00139 double residual_threshold_; 00140 bool is_static_; 00141 bool is_right_; 00142 }; 00143 00144 } 00145 } 00146 } 00147 } 00148 #endif