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

Detailed description

template<typename ValueType, typename MemorySpace>
class cusp::relaxation::sor< ValueType, MemorySpace >

Represents a Successive Over-Relaxation relaxation scheme.

Template Parameters
ValueTypevalue_type of the array
MemorySpacememory space of the array (cusp::host_memory or cusp::device_memory)
Overview
Computes vertex coloring and performs indexed Successive Over-Relaxation relaxation
Example
#include <cusp/array1d.h>
#include <cusp/monitor.h>
#include <cusp/blas/blas.h>
// include cusp sor header file
int main()
{
// Construct 5-pt Poisson example
// Initialize data
// Allocate temporaries
// Construct sor relaxation class
// Compute initial residual
cusp::multiply(A, x, r);
cusp::blas::axpy(b, r, float(-1));
// Construct monitor with stopping criteria of 100 iterations or 1e-4 residual error
cusp::monitor<float> monitor(b, 100, 1e-4, 0, true);
// Iteratively solve system
while (!monitor.finished(r))
{
M(A, b, x);
cusp::multiply(A, x, r);
cusp::blas::axpy(b, r, float(-1));
++monitor;
}
}

Definition at line 98 of file sor.h.

#include <sor.h>

Inheritance diagram for cusp::relaxation::sor< ValueType, MemorySpace >:
cusp::linear_operator<ValueType, MemorySpace >

Public Methods

 sor (void)
 
template<typename MatrixType >
 sor (const MatrixType &A, const ValueType omega, sweep default_direction=SYMMETRIC)
 
template<typename MemorySpace2 >
 sor (const sor< ValueType, MemorySpace2 > &A)
 
template<typename MatrixType , typename VectorType1 , typename VectorType2 >
void operator() (const MatrixType &A, const VectorType1 &b, VectorType2 &x)
 
template<typename MatrixType , typename VectorType1 , typename VectorType2 >
void operator() (const MatrixType &A, const VectorType1 &b, VectorType2 &x, const ValueType omega, sweep direction)
 
- Public Methods inherited from cusp::linear_operator<ValueType, MemorySpace >
 linear_operator (void)
 
 linear_operator (intnum_rows, intnum_cols)
 
 linear_operator (intnum_rows, intnum_cols, intnum_entries)
 

Constructor & Destructor Documentation

template<typename ValueType, typename MemorySpace>
cusp::relaxation::sor< ValueType, MemorySpace >::sor ( void  )
inline

This constructor creates an empty sor smoother.

Definition at line 110 of file sor.h.

template<typename ValueType, typename MemorySpace>
template<typename MatrixType >
cusp::relaxation::sor< ValueType, MemorySpace >::sor ( const MatrixType &  A,
const ValueType  omega,
sweep  default_direction = SYMMETRIC 
)
inline

This constructor creates a sor smoother using a given matrix and sweeping strategy (FORWARD, BACKWARD, SYMMETRIC).

Template Parameters
MatrixTypeType of input matrix used to create this sor smoother.
Parameters
AInput matrix used to create smoother.
omegaDamping factor used in SOR smoother.
default_directionSweep strategy used to perform Gauss-Seidel smoothing.

Definition at line 124 of file sor.h.

template<typename ValueType, typename MemorySpace>
template<typename MemorySpace2 >
cusp::relaxation::sor< ValueType, MemorySpace >::sor ( const sor< ValueType, MemorySpace2 > &  A)
inline

Copy constructor for sor smoother.

Template Parameters
MemorySpace2Memory space of input sor smoother.
Parameters
AInput sor smoother.

Definition at line 134 of file sor.h.

Member Function Documentation

template<typename ValueType, typename MemorySpace>
template<typename MatrixType , typename VectorType1 , typename VectorType2 >
void cusp::relaxation::sor< ValueType, MemorySpace >::operator() ( const MatrixType &  A,
const VectorType1 &  b,
VectorType2 &  x 
)

Perform SOR relaxation using default omega damping factor specified during construction of this sor smoother

Template Parameters
MatrixTypeType of input matrix.
VectorType1Type of input right-hand side vector.
VectorType2Type of input approximate solution vector.
Parameters
Amatrix of the linear system
xapproximate solution of the linear system
bright-hand side of the linear system
template<typename ValueType, typename MemorySpace>
template<typename MatrixType , typename VectorType1 , typename VectorType2 >
void cusp::relaxation::sor< ValueType, MemorySpace >::operator() ( const MatrixType &  A,
const VectorType1 &  b,
VectorType2 &  x,
const ValueType  omega,
sweep  direction 
)

Perform SOR relaxation using specified omega damping factor.

Template Parameters
MatrixTypeType of input matrix.
VectorType1Type of input right-hand side vector.
VectorType2Type of input approximate solution vector.
Parameters
Amatrix of the linear system
xapproximate solution of the linear system
bright-hand side of the linear system
omegaDamping factor used in SOR smoother.
directionsweeping strategy for this gauss_seidel smoother (FORWARD, BACKWARD, SYMMETRIC).