Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
Public Methods | List of all members
cusp::identity_operator< ValueType, MemorySpace, IndexType > Class Template Reference

Detailed description

template<typename ValueType, typename MemorySpace, typename IndexType = int>
class cusp::identity_operator< ValueType, MemorySpace, IndexType >

Simple identity operator.

Template Parameters
IndexTypeType used for operator indices (e.g. int).
ValueTypeType used for operator values (e.g. float).
MemorySpaceA memory space (e.g. cusp::host_memory or cusp::device_memory)
Overview
A linear operator that copies the input vector to the output vector unchanged. Corresponds to the identity matrix (I).
Example
The following code snippet demonstrates using the identity operator.
// include linear_operator header file
#include <cusp/print.h>
int main(void)
{
// number of entries
const int N = 4;
// construct instance of identity operator
// initialize x and y vectors
// call operator()(x,y) through multiply interface
A(x,y);
// print the transformed vector
}
Examples:
bicgstab.cu, cg.cu, and cr.cu.

Definition at line 183 of file linear_operator.h.

#include <linear_operator.h>

Inheritance diagram for cusp::identity_operator< ValueType, MemorySpace, IndexType >:
cusp::linear_operator< ValueType, MemorySpace, IndexType >

Public Methods

 identity_operator (void)
 
 identity_operator (IndexType num_rows, IndexType num_cols)
 
template<typename VectorType1 , typename VectorType2 >
void operator() (const VectorType1 &x, VectorType2 &y) const
 
- Public Methods inherited from cusp::linear_operator< ValueType, MemorySpace, IndexType >
 linear_operator (void)
 
 linear_operator (IndexType num_rows, IndexType num_cols)
 
 linear_operator (IndexType num_rows, IndexType num_cols, IndexType num_entries)
 

Constructor & Destructor Documentation

template<typename ValueType, typename MemorySpace, typename IndexType = int>
cusp::identity_operator< ValueType, MemorySpace, IndexType >::identity_operator ( void  )
inline

Construct an empty identity_operator.

Definition at line 193 of file linear_operator.h.

template<typename ValueType, typename MemorySpace, typename IndexType = int>
cusp::identity_operator< ValueType, MemorySpace, IndexType >::identity_operator ( IndexType  num_rows,
IndexType  num_cols 
)
inline

Construct a identity_operator with a specific shape.

Parameters
num_rowsNumber of rows.
num_colsNumber of columns.

Definition at line 201 of file linear_operator.h.

Member Function Documentation

template<typename ValueType, typename MemorySpace, typename IndexType = int>
template<typename VectorType1 , typename VectorType2 >
void cusp::identity_operator< ValueType, MemorySpace, IndexType >::operator() ( const VectorType1 &  x,
VectorType2 &  y 
) const
inline

Apply the identity_operator to vector x and produce vector y.

Template Parameters
VectorType1Type of the input vector
VectorType2Type of the output vector
Parameters
xInput vector to copy.
yOutput vector to produce.

Definition at line 213 of file linear_operator.h.