Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
block_polynomial.h
Go to the documentation of this file.
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 
21 #pragma once
22 
23 #include <cusp/detail/config.h>
24 
25 #include <cusp/linear_operator.h>
26 
27 namespace cusp
28 {
29 namespace precond
30 {
31 namespace aggregation
32 {
33 // forward definitions
34 template<typename MatrixType> struct sa_level;
35 } // end namespace aggregation
36 } // end namespace precond
37 
38 namespace relaxation
39 {
40 
41 template <typename ValueType, typename MemorySpace, typename Orientation>
42 class block_polynomial : public cusp::linear_operator<ValueType, MemorySpace>
43 {
44 public:
45 
46  typedef Orientation orientation;
47 
48  // note: default_coefficients lives on the host
49  cusp::array1d<ValueType, cusp::host_memory> default_coefficients;
50  cusp::array2d<ValueType, MemorySpace, Orientation> residual;
51  cusp::array2d<ValueType, MemorySpace, Orientation> h;
52  cusp::array2d<ValueType, MemorySpace, Orientation> y;
53 
55 
56  template <typename MatrixType, typename VectorType>
57  block_polynomial(const MatrixType& A, const VectorType& coefficients);
58 
59  template <typename MemorySpace2>
61 
62  template <typename MatrixType>
64 
65  // ignores initial x
66  template<typename MatrixType, typename VectorType1, typename VectorType2>
67  void presmooth(const MatrixType& A, const VectorType1& b, VectorType2& x);
68 
69  // smooths initial x
70  template<typename MatrixType, typename VectorType1, typename VectorType2>
71  void postsmooth(const MatrixType& A, const VectorType1& b, VectorType2& x);
72 
73  template <typename MatrixType, typename VectorType1, typename VectorType2>
74  void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x) const;
75 
76  template <typename MatrixType, typename VectorType1, typename VectorType2, typename VectorType3>
77  void operator()(const MatrixType& A, const VectorType1& b, VectorType2& x, VectorType3& coeffients);
78 };
79 
80 } // end namespace relaxation
81 } // end namespace cusp
82 
83 #include <cusp/relaxation/block_polynomial.inl>
void presmooth(const MatrixType &A, const VectorType1 &b, VectorType2 &x)
cusp::array2d< ValueType, MemorySpace, Orientation > h
void operator()(const MatrixType &A, const VectorType1 &b, VectorType2 &x) const
cusp::array1d< ValueType, cusp::host_memory > default_coefficients
cusp::array2d< ValueType, MemorySpace, Orientation > residual
void postsmooth(const MatrixType &A, const VectorType1 &b, VectorType2 &x)
cusp::array2d< ValueType, MemorySpace, Orientation > y