Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
diagonal.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 
24 #pragma once
25 
26 #include <cusp/detail/config.h>
27 
28 #include <cusp/array1d.h>
29 #include <cusp/linear_operator.h>
30 
31 namespace cusp
32 {
33 namespace precond
34 {
35 
84 template <typename ValueType, typename MemorySpace>
85 class diagonal : public linear_operator<ValueType, MemorySpace>
86 {
88  cusp::array1d<ValueType, MemorySpace> diagonal_reciprocals;
89 
90 public:
96  template<typename MatrixType>
97  diagonal(const MatrixType& A);
98 
106  template <typename VectorType1, typename VectorType2>
107  void operator()(const VectorType1& x, VectorType2& y) const;
108 };
112 } // end namespace precond
113 } // end namespace cusp
114 
115 #include <cusp/precond/detail/diagonal.inl>
116 
Diagonal preconditoner (aka Jacobi preconditioner)
Definition: diagonal.h:85
diagonal(const MatrixType &A)
void operator()(const VectorType1 &x, VectorType2 &y) const
Abstract representation of a linear operator.
Abstract interface for iterative solvers.
1D array of elements that may reside in "host" or "device" memory space