/[escript]/branches/diaplayground/cusplibrary/cusp/relaxation/jacobi.h
ViewVC logotype

Contents of /branches/diaplayground/cusplibrary/cusp/relaxation/jacobi.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4955 - (show annotations)
Tue May 20 04:33:15 2014 UTC (6 years, 1 month ago) by caltinay
File MIME type: text/plain
File size: 2384 byte(s)
added pristine copy of cusplibrary (apache license) to be used by ripley.

1 /*
2 * Copyright 2008-2009 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
17 /*! \file jacobi.h
18 * \brief Jacobi relaxation.
19 */
20
21 #pragma once
22
23 #include <cusp/detail/config.h>
24 #include <cusp/linear_operator.h>
25
26 namespace cusp
27 {
28 namespace precond
29 {
30 namespace aggregation
31 {
32 // forward definitions
33 template<typename MatrixType> struct sa_level;
34 } // end namespace aggregation
35 } // end namespace precond
36
37 namespace relaxation
38 {
39
40 template <typename ValueType, typename MemorySpace>
41 class jacobi : public cusp::linear_operator<ValueType, MemorySpace>
42 {
43 public:
44 ValueType default_omega;
45 cusp::array1d<ValueType,MemorySpace> diagonal;
46 cusp::array1d<ValueType,MemorySpace> temp;
47
48 jacobi();
49
50 template <typename MatrixType>
51 jacobi(const MatrixType& A, ValueType omega=1.0);
52
53 template <typename MemorySpace2>
54 jacobi(const jacobi<ValueType,MemorySpace2>& A);
55
56 template <typename MatrixType>
57 jacobi(const cusp::precond::aggregation::sa_level<MatrixType>& sa_level, ValueType weight=4.0/3.0);
58
59 // ignores initial x
60 template<typename MatrixType, typename VectorType1, typename VectorType2>
61 void presmooth(const MatrixType& A, const VectorType1& b, VectorType2& x);
62
63 // smooths initial x
64 template<typename MatrixType, typename VectorType1, typename VectorType2>
65 void postsmooth(const MatrixType& A, const VectorType1& b, VectorType2& x);
66
67 template <typename MatrixType, typename VectorType1, typename VectorType2>
68 void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x);
69
70 template <typename MatrixType, typename VectorType1, typename VectorType2>
71 void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x, ValueType omega);
72 };
73
74 } // end namespace relaxation
75 } // end namespace cusp
76
77 #include <cusp/relaxation/detail/jacobi.inl>
78

  ViewVC Help
Powered by ViewVC 1.1.26