Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
gauss_seidel.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2014 NVIDIA Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
21 #pragma once
22 
23 #include <cusp/detail/config.h>
24 #include <cusp/linear_operator.h>
25 
26 namespace cusp
27 {
28 namespace relaxation
29 {
30 
38 /* \cond */
39 typedef enum
40 {
41  FORWARD,
42  BACKWARD,
43  SYMMETRIC
44 } sweep;
45 /* \endcond */
46 
103 template <typename ValueType, typename MemorySpace>
104 class gauss_seidel : public cusp::linear_operator<ValueType, MemorySpace>
105 {
106 public:
107 
108  /* \cond */
112  sweep default_direction;
113  /* \endcond */
114 
117  gauss_seidel(void) {}
118 
129  template <typename MatrixType>
130  gauss_seidel(const MatrixType& A, sweep default_direction=SYMMETRIC,
131  typename thrust::detail::enable_if_convertible<typename MatrixType::format,cusp::csr_format>::type* = 0);
132 
139  template<typename MemorySpace2>
141  : ordering(A.ordering), color_offsets(A.color_offsets), default_direction(A.default_direction) {}
142 
154  template <typename MatrixType, typename VectorType1, typename VectorType2>
155  void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x);
156 
169  template <typename MatrixType, typename VectorType1, typename VectorType2>
170  void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x, sweep direction);
171 };
175 } // end namespace relaxation
176 } // end namespace cusp
177 
178 #include <cusp/relaxation/detail/gauss_seidel.inl>
179 
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
Definition: array1d.h:98
gauss_seidel(const gauss_seidel< ValueType, MemorySpace2 > &A)
Definition: gauss_seidel.h:140
Represents a Gauss-Seidel relaxation scheme.
Definition: gauss_seidel.h:104
Abstract representation of a linear operator.
Abstract interface for iterative solvers.
void operator()(const MatrixType &A, const VectorType1 &b, VectorType2 &x)