CUSP
Loading...
Searching...
No Matches
cusp::identity_operator< ValueType, MemorySpace, IndexType > Class Template Reference

#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 DerivedPolicy , typename VectorType1 , typename VectorType2 >
void operator() (thrust::execution_policy< DerivedPolicy > &exec, const VectorType1 &x, VectorType2 &y) const
 Apply the identity operator to vector x using an explicit execution policy.
 
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)
 

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
}
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
Definition array1d.h:99
Simple identity operator.
void print(const Printable &p)
print a textual representation of an object
Abstract interface for iterative solvers.
Print textual representation of an object.

Definition at line 183 of file linear_operator.h.

Constructor & Destructor Documentation

◆ identity_operator() [1/2]

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.

◆ identity_operator() [2/2]

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

◆ operator()() [1/2]

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 228 of file linear_operator.h.

◆ operator()() [2/2]

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

Apply the identity operator to vector x using an explicit execution policy.

Template Parameters
DerivedPolicyexecution policy
VectorType1Type of the input vector
VectorType2Type of the output vector
Parameters
execthe execution policy
xinput vector
youtput vector

Definition at line 214 of file linear_operator.h.