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

#include <polynomial.h>

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

Public Methods

 polynomial (void)
 
template<typename MatrixType >
 polynomial (const MatrixType &A)
 
template<typename MatrixType , typename VectorType >
 polynomial (const MatrixType &A, const VectorType &coefficients)
 
template<typename MemorySpace2 >
 polynomial (const polynomial< 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 , typename VectorType3 >
void operator() (const MatrixType &A, const VectorType1 &b, VectorType2 &x, const VectorType3 &coefficients)
 
- 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>
class cusp::relaxation::polynomial< ValueType, MemorySpace >

Represents a Polynomial relaxation scheme.

Template Parameters
ValueTypevalue_type of the array
MemorySpacememory space of the array (cusp::host_memory or cusp::device_memory)
Overview
Performs 3rd degree Polynomial relaxation
Example
#include <cusp/array1d.h>
#include <cusp/monitor.h>
#include <cusp/blas/blas.h>
// include cusp polynomial header file
int main()
{
// Construct 5-pt Poisson example
// Initialize data
// Allocate temporaries
// Compute spectral radius of A
float rho = cusp::detail::ritz_spectral_radius_symmetric(A, 8);
// Compute 3rd degree Chebyshev polynomial
cusp::relaxation::detail::chebyshev_polynomial_coefficients(rho, coefficients);
// Construct polynomial 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));
}
}
1D array of elements that may reside in "host" or "device" memory space
BLAS-like functions.
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
Definition array1d.h:99
Compressed sparse row (CSR) representation a sparse matrix.
Definition csr_matrix.h:108
Implements standard convergence criteria and reporting for iterative solvers.
Definition monitor.h:102
Represents a Polynomial relaxation scheme.
Definition polynomial.h:102
Compressed Sparse Row matrix format.
void multiply(const LinearOperator &A, const MatrixOrVector1 &B, MatrixOrVector2 &C)
Implements matrix-matrix and matrix-vector multiplication.
bool finished(const Vector &r)
Applies convergence criteria to determine whether iteration is finished.
Abstract interface for iterative solvers.
Monitor iterative solver convergence.
Poisson matrix generators.
polynomial relaxation.

Definition at line 101 of file polynomial.h.

Constructor & Destructor Documentation

◆ polynomial() [1/4]

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

This constructor creates an empty polynomial smoother.

Definition at line 115 of file polynomial.h.

◆ polynomial() [2/4]

template<typename ValueType , typename MemorySpace >
template<typename MatrixType >
cusp::relaxation::polynomial< ValueType, MemorySpace >::polynomial ( const MatrixType &  A)

This constructor creates a polynomial smoother using a given matrix.

Template Parameters
MatrixTypeType of input matrix used to create this polynomial smoother.
Parameters
AInput matrix used to create smoother.

◆ polynomial() [3/4]

template<typename ValueType , typename MemorySpace >
template<typename MatrixType , typename VectorType >
cusp::relaxation::polynomial< ValueType, MemorySpace >::polynomial ( const MatrixType &  A,
const VectorType &  coefficients 
)

This constructor creates a polynomial smoother using a given matrix and coefficients.

Template Parameters
MatrixTypeType of input matrix used to create this polynomial smoother.
Parameters
AInput matrix used to create smoother.
coefficientsUsed in polynomial smoother.

◆ polynomial() [4/4]

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

Copy constructor for polynomial smoother.

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

Definition at line 147 of file polynomial.h.

Member Function Documentation

◆ operator()() [1/2]

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

Perform polynomial relaxation using default coefficients specified during construction of this polynomial 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

◆ operator()() [2/2]

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

Perform polynomial relaxation using specified coefficients

Template Parameters
MatrixTypeType of input matrix.
VectorType1Type of input right-hand side vector.
VectorType2Type of input approximate solution vector.
VectorType3Type of input coefficients vector.
Parameters
Amatrix of the linear system
xapproximate solution of the linear system
bright-hand side of the linear system
coefficientsUsed in polynomial smoother.