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 preconditoner based on smoothed aggregation.
- Template Parameters
-
IndexType | Type used for matrix values (e.g. int or size_t ). |
ValueType | Type used for matrix values (e.g. float or double ). |
MemorySpace | A 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 <iostream>
int main(int argc, char *argv[])
{
typedef int IndexType;
typedef double ValueType;
typedef cusp::device_memory MemorySpace;
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;
M.print();
monitor.print();
return 0;
}
- Examples:
- custom_amg.cu, and smoothed_aggregation.cu.
Definition at line 160 of file smoothed_aggregation.h.
|
| smoothed_aggregation (void) |
|
template<typename MatrixType > |
| smoothed_aggregation (const MatrixType &A) |
|
template<typename MatrixType , typename ArrayType > |
| smoothed_aggregation (const MatrixType &A, const ArrayType &B, typename thrust::detail::enable_if_convertible< typename ArrayType::format, cusp::array1d_format >::type *=0) |
|
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, typename thrust::detail::enable_if_convertible< typename MatrixType::format, cusp::known_format >::type *=0) |
|
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 >
Construct a smoothed_aggregation
preconditioner from a matrix and specified near nullspace vector.
- Parameters
-
A | matrix used to create the AMG hierarchy. |
B | candidate near nullspace vector. |
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 | ) |
|
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 >
Initialize a smoothed_aggregation
preconditioner from a matrix. Used to initialize a smoothed_aggregation
preconditioner constructed with no input matrix specified.
- Parameters
-
A | matrix used to create the AMG hierarchy. |
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, |
|
|
typename thrust::detail::enable_if_convertible< typename MatrixType::format, cusp::known_format >::type * |
= 0 |
|
) |
| |
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
-
A | matrix used to create the AMG hierarchy. |
B | candidate near nullspace vector. |