template<typename ValueType, typename MemorySpace, typename IndexType = int>
class cusp::linear_operator< ValueType, MemorySpace, IndexType >
Abstract representation of a linear operator.
- Template Parameters
-
IndexType | Type used for operator indices (e.g. int ). |
ValueType | Type used for operator values (e.g. float ). |
MemorySpace | A memory space (e.g. cusp::host_memory or cusp::device_memory ) |
- Overview
- A
linear
operator is a abstract container that supports encapsulates abstract linear operators for use with other routines. All linear operators should provide a implementation of the operator()(x,y) for interoperability with the multiply
routine.
- Example
- The following code snippet demonstrates how to create a custom linear operator.
template <typename MatrixType>
struct Dinv_A :
public cusp::linear_operator<typename MatrixType::value_type, typename MatrixType::memory_space>
{
typedef typename MatrixType::value_type ValueType;
typedef typename MatrixType::memory_space MemorySpace;
const MatrixType& A;
Dinv_A(const MatrixType& A)
: A(A), Dinv(A),
cusp::
linear_operator<ValueType,MemorySpace>(A.num_rows, A.num_cols, A.num_entries + A.num_rows)
{}
template <typename Array1, typename Array2>
void operator()(const Array1& x, Array2& y) const
{
}
};
int main(void)
{
CsrMatrix A;
const int N = 4;
Dinv_A<CsrMatrix> M(A);
}
- Examples:
- stencil.cu.
Definition at line 111 of file linear_operator.h.