CUSP
Loading...
Searching...
No Matches
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>
30
31namespace cusp
32{
33namespace precond
34{
35
84template <typename ValueType, typename MemorySpace>
85class diagonal : public linear_operator<ValueType, MemorySpace>
86{
88 cusp::array1d<ValueType, MemorySpace> diagonal_reciprocals;
89
90public:
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
1D array of elements that may reside in "host" or "device" memory space
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
Definition array1d.h:99
Abstract representation of a linear operator.
Diagonal preconditioner (aka Jacobi preconditioner)
Definition diagonal.h:86
void operator()(const VectorType1 &x, VectorType2 &y) const
diagonal(const MatrixType &A)
Abstract interface for iterative solvers.