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);
}
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
Compressed sparse row (CSR) representation a sparse matrix.
Abstract representation of a linear operator.
Diagonal preconditioner (aka Jacobi preconditioner)
Compressed Sparse Row matrix format.
void poisson5pt(MatrixType &matrix, const size_t m, const size_t n)
void print(const Printable &p)
print a textual representation of an object
void multiply(const LinearOperator &A, const MatrixOrVector1 &B, MatrixOrVector2 &C)
Implements matrix-matrix and matrix-vector multiplication.
Abstract interface for iterative solvers.
Poisson matrix generators.
Print textual representation of an object.
Definition at line 111 of file linear_operator.h.