CUSP
Loading...
Searching...
No Matches
cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format > Class Template Reference

#include <smoothed_aggregation.h>

Inheritance diagram for cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format >:

Public Methods

 smoothed_aggregation (void)
 
template<typename MatrixType >
 smoothed_aggregation (const MatrixType &A)
 
template<typename MatrixType , typename ArrayType >
 smoothed_aggregation (const MatrixType &A, const ArrayType &B)
 
template<typename MemorySpace2 , typename SmootherType2 , typename SolverType2 , typename Format2 >
 smoothed_aggregation (const smoothed_aggregation< IndexType, ValueType, MemorySpace2, SmootherType2, SolverType2, Format2 > &M)
 
template<typename MatrixType >
void initialize (const MatrixType &A)
 
template<typename MatrixType , typename ArrayType >
void initialize (const MatrixType &A, const ArrayType &B)
 

Detailed description

template<typename IndexType, typename ValueType, typename MemorySpace, typename SmootherType = thrust::use_default, typename SolverType = thrust::use_default, typename Format = thrust::use_default>
class cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format >

Algebraic multigrid preconditioner based on smoothed aggregation.

Template Parameters
IndexTypeType used for matrix values (e.g. int or size_t).
ValueTypeType used for matrix values (e.g. float or double).
MemorySpaceA memory space (e.g. cusp::host_memory or cusp::device_memory)
Overview
Given a matrix A to precondition, the smoothed aggregation preconditioner constructs a algebraic multigrid (AMG) operator.

Smoothed aggregation is expensive to use but is a very effective preconditioning technique to solve challenging linear systems. The default configuration uses a symmetric strength measure, MIS-based aggregation in device memory, sequential aggregation in host_memory, Jacobi smoothing is applied to the tentative prolongator, Jacobi relaxation on each level of hierarchy and LU to solve the coarse matrix in host memory.

Example
The following code snippet demonstrates how to use a smoothed_aggregation preconditioner to solve a linear system.
#include <cusp/krylov/cg.h>
#include <iostream>
int main(int argc, char *argv[])
{
typedef int IndexType;
typedef double ValueType;
typedef cusp::device_memory MemorySpace;
// create an empty sparse matrix structure
// construct 2d poisson matrix
IndexType N = 256;
std::cout << "Generated matrix (poisson5pt) "
<< "with shape (" << A.num_rows << "," << A.num_cols << ") and "
<< A.num_entries << " entries" << "\n";
std::cout << "\nSolving with smoothed aggregation preconditioner and jacobi smoother" << std::endl;
// print AMG statistics
M.print();
// allocate storage for solution (x) and right hand side (b)
// set stopping criteria (iteration_limit = 1000, relative_tolerance = 1e-10)
// solve
cusp::krylov::cg(A, x, b, monitor, M);
// report status
return 0;
}
Conjugate Gradient (CG) method.
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
Definition array1d.h:99
Hybrid (HYB) representation a sparse matrix.
Definition hyb_matrix.h:143
Implements standard convergence criteria and reporting for iterative solvers.
Definition monitor.h:102
Algebraic multigrid preconditioner based on smoothed aggregation.
Compressed Sparse Row matrix format.
void cg(const LinearOperator &A, VectorType1 &x, const VectorType2 &b, Monitor &monitor, Preconditioner &M)
Conjugate Gradient method.
void print(void)
Prints the number of iterations and convergence history information.
MatrixMarket file I/O.
Poisson matrix generators.
Algebraic multigrid preconditioner based on smoothed aggregation.

Definition at line 161 of file smoothed_aggregation.h.

Constructor & Destructor Documentation

◆ smoothed_aggregation() [1/4]

template<typename IndexType , typename ValueType , typename MemorySpace , typename SmootherType = thrust::use_default, typename SolverType = thrust::use_default, typename Format = thrust::use_default>
cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format >::smoothed_aggregation ( void  )
inline

Construct an empty smoothed_aggregation preconditioner.

Definition at line 178 of file smoothed_aggregation.h.

◆ smoothed_aggregation() [2/4]

template<typename IndexType , typename ValueType , typename MemorySpace , typename SmootherType = thrust::use_default, typename SolverType = thrust::use_default, typename Format = thrust::use_default>
template<typename MatrixType >
cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format >::smoothed_aggregation ( const MatrixType &  A)

Construct a smoothed_aggregation preconditioner from a matrix.

Parameters
Amatrix used to create the AMG hierarchy.

◆ smoothed_aggregation() [3/4]

template<typename IndexType , typename ValueType , typename MemorySpace , typename SmootherType = thrust::use_default, typename SolverType = thrust::use_default, typename Format = thrust::use_default>
template<typename MatrixType , typename ArrayType >
cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format >::smoothed_aggregation ( const MatrixType &  A,
const ArrayType &  B 
)

Construct a smoothed_aggregation preconditioner from a matrix and specified near nullspace vector.

Parameters
Amatrix used to create the AMG hierarchy.
Bcandidate near nullspace vector.

◆ smoothed_aggregation() [4/4]

template<typename IndexType , typename ValueType , typename MemorySpace , typename SmootherType = thrust::use_default, typename SolverType = thrust::use_default, typename Format = thrust::use_default>
template<typename MemorySpace2 , typename SmootherType2 , typename SolverType2 , typename Format2 >
cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format >::smoothed_aggregation ( const smoothed_aggregation< IndexType, ValueType, MemorySpace2, SmootherType2, SolverType2, Format2 > &  M)

Construct a smoothed_aggregation preconditioner from a existing SA smoothed_aggregation preconditioner.

Parameters
Mother smoothed_aggregation preconditioner.

Member Function Documentation

◆ initialize() [1/2]

template<typename IndexType , typename ValueType , typename MemorySpace , typename SmootherType = thrust::use_default, typename SolverType = thrust::use_default, typename Format = thrust::use_default>
template<typename MatrixType >
void cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format >::initialize ( const MatrixType &  A)

Initialize a smoothed_aggregation preconditioner from a matrix. Used to initialize a smoothed_aggregation preconditioner constructed with no input matrix specified.

Parameters
Amatrix used to create the AMG hierarchy.

◆ initialize() [2/2]

template<typename IndexType , typename ValueType , typename MemorySpace , typename SmootherType = thrust::use_default, typename SolverType = thrust::use_default, typename Format = thrust::use_default>
template<typename MatrixType , typename ArrayType >
void cusp::precond::aggregation::smoothed_aggregation< IndexType, ValueType, MemorySpace, SmootherType, SolverType, Format >::initialize ( const MatrixType &  A,
const ArrayType &  B 
)

Initialize a smoothed_aggregation preconditioner from a matrix and initial near nullspace vector. Used to initialize a smoothed_aggregation preconditioner constructed with no input matrix specified.

Parameters
Amatrix used to create the AMG hierarchy.
Bcandidate near nullspace vector.