Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
linear_operator.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 
25 #include <cusp/detail/format.h>
26 #include <cusp/exception.h>
27 #include <cusp/blas/blas.h>
28 #include <cusp/detail/matrix_base.h>
29 
30 namespace cusp
31 {
32 
110 template <typename ValueType, typename MemorySpace, typename IndexType=int>
111 class linear_operator : public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::unknown_format>
112 {
113 private:
114 
115  typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::unknown_format> Parent;
116 
117 public:
118 
122  : Parent() {}
123 
129  linear_operator(IndexType num_rows, IndexType num_cols)
130  : Parent(num_rows, num_cols) {}
131 
139  linear_operator(IndexType num_rows, IndexType num_cols, IndexType num_entries)
140  : Parent(num_rows, num_cols, num_entries) {}
141 }; // linear_operator
142 
182 template <typename ValueType, typename MemorySpace, typename IndexType=int>
183 class identity_operator : public linear_operator<ValueType,MemorySpace,IndexType>
184 {
185 private:
186 
188 
189 public:
190 
194  : Parent() {}
195 
201  identity_operator(IndexType num_rows, IndexType num_cols)
202  : Parent(num_rows, num_cols) {}
203 
212  template <typename VectorType1, typename VectorType2>
213  void operator()(const VectorType1& x, VectorType2& y) const
214  {
215  cusp::blas::copy(x, y);
216  }
217 }; // identity_operator
218 
219 } // end namespace cusp
220 
identity_operator(IndexType num_rows, IndexType num_cols)
BLAS-like functions.
linear_operator(IndexType num_rows, IndexType num_cols, IndexType num_entries)
Simple identity operator.
void operator()(const VectorType1 &x, VectorType2 &y) const
linear_operator(IndexType num_rows, IndexType num_cols)
Abstract representation of a linear operator.
void copy(const SourceType &src, DestinationType &dst)
Copy one array or matrix to another.