ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
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-2015, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8  Portions of this software are copyright by UChicago Argonne, LLC.
9 
10  -----------------
11  ViennaCL - The Vienna Computing Library
12  -----------------
13 
14  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15 
16  (A list of authors and contributors can be found in the manual)
17 
18  License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
21 
29 #include <utility>
30 #include <iostream>
31 #include <fstream>
32 #include <string>
33 #include <algorithm>
34 #include <vector>
35 #include <math.h>
36 #include <cmath>
37 #include <sstream>
38 #include "viennacl/ocl/backend.hpp"
39 #include "boost/numeric/ublas/vector.hpp"
40 #include "boost/numeric/ublas/matrix.hpp"
41 #include "boost/numeric/ublas/matrix_proxy.hpp"
42 #include "boost/numeric/ublas/storage.hpp"
43 #include "boost/numeric/ublas/io.hpp"
44 #include "boost/numeric/ublas/matrix_expression.hpp"
45 #include "boost/numeric/ublas/detail/matrix_assign.hpp"
46 
49 
50 namespace viennacl
51 {
52 namespace linalg
53 {
54 namespace detail
55 {
56 namespace spai
57 {
58 
64 class spai_tag
65 {
74 public:
75  spai_tag(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 { return residual_norm_threshold_; }
87 
88  double getResidualThreshold() const { return residual_threshold_; }
89 
90  unsigned int getIterationLimit () const { return iteration_limit_; }
91 
92  bool getIsStatic() const { return is_static_; }
93 
94  bool getIsRight() const { return is_right_; }
95 
96  long getBegInd() const { return beg_ind_; }
97 
98  long getEndInd() const { return end_ind_; }
99 
100 
101 
102  void setResidualNormThreshold(double residual_norm_threshold)
103  {
104  if (residual_norm_threshold > 0)
105  residual_norm_threshold_ = residual_norm_threshold;
106  }
107 
108  void setResidualThreshold(double residual_threshold)
109  {
110  if (residual_threshold > 0)
111  residual_threshold_ = residual_threshold;
112  }
113 
114  void setIterationLimit(unsigned int iteration_limit)
115  {
116  if (iteration_limit > 0)
117  iteration_limit_ = iteration_limit;
118  }
119 
120  void setIsRight(bool is_right) { is_right_ = is_right; }
121 
122  void setIsStatic(bool is_static) { is_static_ = is_static; }
123 
124  void setBegInd(long beg_ind) { beg_ind_ = beg_ind; }
125 
126  void setEndInd(long end_ind){ end_ind_ = end_ind; }
127 
128 
129 private:
130  double residual_norm_threshold_;
131  unsigned int iteration_limit_;
132  long beg_ind_;
133  long end_ind_;
134  double residual_threshold_;
135  bool is_static_;
136  bool is_right_;
137 };
138 
139 }
140 }
141 }
142 }
143 #endif
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:34
Implementation of a bunch of (small) matrices on GPU. Experimental.
Definition: blas3.hpp:36
Implementation of a bunch of vectors on GPU. Experimental.
spai_tag(double residual_norm_threshold=1e-3, unsigned int iteration_limit=5, double residual_threshold=1e-2, bool is_static=false, bool is_right=false)
Constructor.
Definition: spai_tag.hpp:75
void setIterationLimit(unsigned int iteration_limit)
Definition: spai_tag.hpp:114
Implementations of the OpenCL backend, where all contexts are stored in.
void setResidualThreshold(double residual_threshold)
Definition: spai_tag.hpp:108
void setResidualNormThreshold(double residual_norm_threshold)
Definition: spai_tag.hpp:102
unsigned int getIterationLimit() const
Definition: spai_tag.hpp:90