ViennaCL - The Vienna Computing Library: viennacl/linalg/detail/spai/spai_tag.hpp Source File

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2016, 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
47 #include "viennacl/linalg/detail/spai/block_matrix.hpp"
48 #include "viennacl/linalg/detail/spai/block_vector.hpp"
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
viennacl::linalg::detail::spai::spai_tag::setBegInd
void setBegInd(long beg_ind)
Definition: spai_tag.hpp:124
viennacl::linalg::detail::spai::spai_tag::setIsRight
void setIsRight(bool is_right)
Definition: spai_tag.hpp:120
viennacl::linalg::detail::spai::spai_tag
A tag for SPAI.
Definition: spai_tag.hpp:64
block_matrix.hpp
Implementation of a bunch of (small) matrices on GPU. Experimental.
viennacl::linalg::detail::spai::spai_tag::getEndInd
long getEndInd() const
Definition: spai_tag.hpp:98
viennacl::linalg::detail::spai::spai_tag::getIsRight
bool getIsRight() const
Definition: spai_tag.hpp:94
block_vector.hpp
Implementation of a bunch of vectors on GPU. Experimental.
viennacl::linalg::detail::spai::spai_tag::getBegInd
long getBegInd() const
Definition: spai_tag.hpp:96
viennacl::linalg::detail::spai::spai_tag::spai_tag
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
viennacl::linalg::detail::spai::spai_tag::setIterationLimit
void setIterationLimit(unsigned int iteration_limit)
Definition: spai_tag.hpp:114
viennacl::linalg::detail::spai::spai_tag::getResidualNormThreshold
double getResidualNormThreshold() const
Definition: spai_tag.hpp:86
backend.hpp
Implementations of the OpenCL backend, where all contexts are stored in.
viennacl::linalg::detail::spai::spai_tag::getIsStatic
bool getIsStatic() const
Definition: spai_tag.hpp:92
viennacl::linalg::detail::spai::spai_tag::setEndInd
void setEndInd(long end_ind)
Definition: spai_tag.hpp:126
viennacl::linalg::detail::spai::spai_tag::setResidualThreshold
void setResidualThreshold(double residual_threshold)
Definition: spai_tag.hpp:108
viennacl::linalg::detail::spai::spai_tag::setResidualNormThreshold
void setResidualNormThreshold(double residual_norm_threshold)
Definition: spai_tag.hpp:102
viennacl::linalg::detail::spai::spai_tag::getIterationLimit
unsigned int getIterationLimit() const
Definition: spai_tag.hpp:90
viennacl::linalg::detail::spai::spai_tag::setIsStatic
void setIsStatic(bool is_static)
Definition: spai_tag.hpp:122
viennacl::linalg::detail::spai::spai_tag::getResidualThreshold
double getResidualThreshold() const
Definition: spai_tag.hpp:88