ViennaCL - The Vienna Computing Library  1.5.2
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-2014, 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 PDF 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 
63  class spai_tag
64  {
72  public:
74  double residual_norm_threshold = 1e-3,
75  unsigned int iteration_limit = 5,
76  double residual_threshold = 1e-2,
77  bool is_static = false,
78  bool is_right = false) :
79  residual_norm_threshold_(residual_norm_threshold),
80  iteration_limit_(iteration_limit),
81  residual_threshold_(residual_threshold),
82  is_static_(is_static),
83  is_right_(is_right) {}
84 
85  double getResidualNormThreshold() const
86  { return residual_norm_threshold_; }
87 
88  double getResidualThreshold() const
89  { return residual_threshold_; }
90 
91  unsigned int getIterationLimit () const
92  { return iteration_limit_; }
93 
94  bool getIsStatic() const
95  { return is_static_; }
96 
97  bool getIsRight() const
98  { return is_right_; }
99 
100  long getBegInd() const
101  { return beg_ind_; }
102 
103  long getEndInd() const
104  { return end_ind_; }
105 
106 
107 
108  void setResidualNormThreshold(double residual_norm_threshold)
109  {
110  if(residual_norm_threshold > 0)
111  residual_norm_threshold_ = residual_norm_threshold;
112  }
113 
114  void setResidualThreshold(double residual_threshold)
115  {
116  if(residual_threshold > 0)
117  residual_threshold_ = residual_threshold;
118  }
119 
120  void setIterationLimit(unsigned int iteration_limit)
121  {
122  if(iteration_limit > 0)
123  iteration_limit_ = iteration_limit;
124  }
125 
126  void setIsRight(bool is_right) { is_right_ = is_right; }
127 
128  void setIsStatic(bool is_static) { is_static_ = is_static; }
129 
130  void setBegInd(long beg_ind) { beg_ind_ = beg_ind; }
131 
132  void setEndInd(long end_ind){ end_ind_ = end_ind; }
133 
134 
135  private:
136  double residual_norm_threshold_;
137  unsigned int iteration_limit_;
138  long beg_ind_, end_ind_;
139  double residual_threshold_;
140  bool is_static_;
141  bool is_right_;
142  };
143 
144  }
145  }
146  }
147 }
148 #endif
void setResidualNormThreshold(double residual_norm_threshold)
Definition: spai_tag.hpp:108
bool getIsStatic() const
Definition: spai_tag.hpp:94
void setResidualThreshold(double residual_threshold)
Definition: spai_tag.hpp:114
long getEndInd() const
Definition: spai_tag.hpp:103
A tag for SPAI Contains values for the algorithm. Must be passed to spai_precond constructor.
Definition: spai_tag.hpp:63
void setIsStatic(bool is_static)
Definition: spai_tag.hpp:128
void setBegInd(long beg_ind)
Definition: spai_tag.hpp:130
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:29
Implementation of a bunch of (small) matrices on GPU. Experimental.
long getBegInd() const
Definition: spai_tag.hpp:100
Implementation of a bunch of vectors on GPU. Experimental.
void setEndInd(long end_ind)
Definition: spai_tag.hpp:132
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:73
double getResidualThreshold() const
Definition: spai_tag.hpp:88
void setIsRight(bool is_right)
Definition: spai_tag.hpp:126
Implementations of the OpenCL backend, where all contexts are stored in.
bool getIsRight() const
Definition: spai_tag.hpp:97
unsigned int getIterationLimit() const
Definition: spai_tag.hpp:91
double getResidualNormThreshold() const
Definition: spai_tag.hpp:85
void setIterationLimit(unsigned int iteration_limit)
Definition: spai_tag.hpp:120