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

Detailed description

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

Represents a Gauss-Seidel 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 Gauss-Seidel relaxation
Example
#include <cusp/array1d.h>
#include <cusp/monitor.h>
#include <cusp/blas/blas.h>
// include cusp gauss_seidel header file
int main()
{
// Construct 5-pt Poisson example
// Initialize data
// Allocate temporaries
// Construct gauss_seidel 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 104 of file gauss_seidel.h.

#include <gauss_seidel.h>

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

Public Methods

 gauss_seidel (void)
 
template<typename MatrixType >
 gauss_seidel (const MatrixType &A, sweep default_direction=SYMMETRIC, typename thrust::detail::enable_if_convertible< typename MatrixType::format, cusp::csr_format >::type *=0)
 
template<typename MemorySpace2 >
 gauss_seidel (const gauss_seidel< 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, 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::gauss_seidel< ValueType, MemorySpace >::gauss_seidel ( void  )
inline

This constructor creates an empty gauss_seidel smoother.

Definition at line 117 of file gauss_seidel.h.

template<typename ValueType, typename MemorySpace>
template<typename MatrixType >
cusp::relaxation::gauss_seidel< ValueType, MemorySpace >::gauss_seidel ( const MatrixType &  A,
sweep  default_direction = SYMMETRIC,
typename thrust::detail::enable_if_convertible< typename MatrixType::format, cusp::csr_format >::type *  = 0 
)

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

Template Parameters
MatrixTypeType of input matrix used to create this gauss_seidel smoother.
Parameters
AInput matrix used to create smoother.
default_directionSweep strategy used to perform Gauss-Seidel smoothing.
template<typename ValueType, typename MemorySpace>
template<typename MemorySpace2 >
cusp::relaxation::gauss_seidel< ValueType, MemorySpace >::gauss_seidel ( const gauss_seidel< ValueType, MemorySpace2 > &  A)
inline

Copy constructor for gauss_seidel smoother.

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

Definition at line 140 of file gauss_seidel.h.

Member Function Documentation

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

Perform Gauss-Seidel relaxation using default sweep specified during construction of this gauss_seidel 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::gauss_seidel< ValueType, MemorySpace >::operator() ( const MatrixType &  A,
const VectorType1 &  b,
VectorType2 &  x,
sweep  direction 
)

Perform Gauss-Seidel relaxation using specified sweep strategy

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
directionsweeping strategy for this gauss_seidel smoother (FORWARD, BACKWARD, SYMMETRIC).