ViennaCL - The Vienna Computing Library  1.2.0
spai_tag.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_DETAIL_SPAI_SPAI_TAG_HPP
2 #define VIENNACL_LINALG_DETAIL_SPAI_SPAI_TAG_HPP
3 
4 /* =========================================================================
5  Copyright (c) 2010-2011, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8 
9  -----------------
10  ViennaCL - The Vienna Computing Library
11  -----------------
12 
13  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
14 
15  (A list of authors and contributors can be found in the PDF manual)
16 
17  License: MIT (X11), see file LICENSE in the base directory
18 ============================================================================= */
19 
20 
29 //#define __NO_STD_VECTOR
30 #include <utility>
31 #include <iostream>
32 #include <fstream>
33 #include <string>
34 #include <algorithm>
35 #include <vector>
36 #include <math.h>
37 #include <cmath>
38 #include <sstream>
39 #include "viennacl/ocl/backend.hpp"
40 #include "boost/numeric/ublas/vector.hpp"
41 #include "boost/numeric/ublas/matrix.hpp"
42 #include "boost/numeric/ublas/matrix_proxy.hpp"
43 #include "boost/numeric/ublas/storage.hpp"
44 #include "boost/numeric/ublas/io.hpp"
45 #include "boost/numeric/ublas/matrix_expression.hpp"
46 #include "boost/numeric/ublas/detail/matrix_assign.hpp"
47 //#include "boost/thread/thread.hpp"
50 
51 namespace viennacl
52 {
53  namespace linalg
54  {
55  namespace detail
56  {
57  namespace spai
58  {
59 
64  class spai_tag
65  {
73  public:
75  double residual_norm_threshold = 1e-3,
76  unsigned int iteration_limit = 5,
77  double residual_threshold = 1e-2,
78  bool is_static = false,
79  bool is_right = false) :
80  _residual_norm_threshold(residual_norm_threshold),
81  _iteration_limit(iteration_limit),
82  _residual_threshold(residual_threshold),
83  _is_static(is_static),
84  _is_right(is_right) {};
85 
86  double getResidualNormThreshold() const
87  { return _residual_norm_threshold; }
88 
89  double getResidualThreshold() const
90  { return _residual_threshold; }
91 
92  unsigned int getIterationLimit () const
93  { return _iteration_limit; }
94 
95  bool getIsStatic() const
96  { return _is_static; }
97 
98  bool getIsRight() const
99  { return _is_right; }
100 
101  long getBegInd() const
102  { return _beg_ind; }
103 
104  long getEndInd() const
105  { return _end_ind; }
106 
107 
108 
109  void setResidualNormThreshold(double residual_norm_threshold)
110  {
111  if(residual_norm_threshold > 0)
112  _residual_norm_threshold = residual_norm_threshold;
113  }
114 
115  void setResidualThreshold(double residual_threshold)
116  {
117  if(residual_threshold > 0)
118  _residual_threshold = residual_threshold;
119  }
120 
121  void setIterationLimit(unsigned int iteration_limit)
122  {
123  if(iteration_limit > 0)
124  _iteration_limit = iteration_limit;
125  }
126 
127  void setIsRight(bool is_right) { _is_right = is_right; }
128 
129  void setIsStatic(bool is_static) { _is_static = is_static; }
130 
131  void setBegInd(long beg_ind) { _beg_ind = beg_ind; }
132 
133  void setEndInd(long end_ind){ _end_ind = end_ind; }
134 
135 
136  private:
137  double _residual_norm_threshold;
138  unsigned int _iteration_limit;
139  long _beg_ind, _end_ind;
140  double _residual_threshold;
141  bool _is_static;
142  bool _is_right;
143  };
144 
145  }
146  }
147  }
148 }
149 #endif