numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::linear::impl::amg Namespace Reference

Namespace of internal implementations of algebraic multigrid method [24]. More...

Classes

class  node_connection_list
 Class of lists of connected nodes per node. More...
 

Enumerations

enum  node_layer : std::uint8_t { unclassified , coarse , fine }
 Enumeration of types of grids which nodes belong to in AMG method. More...
 

Functions

template<typename StorageIndex >
auto build_first_coarse_grid_candidate (const node_connection_list< StorageIndex > &connections, const node_connection_list< StorageIndex > &transposed_connections) -> util::vector< node_layer >
 Build the first candidate of a coarse grid.
 
template<typename StorageIndex >
auto compute_node_scores (const node_connection_list< StorageIndex > &transposed_connections) -> util::vector< StorageIndex >
 Compute the first scores of nodes.
 
template<base::concepts::sparse_matrix Matrix>
auto compute_strong_connection_list (const Matrix &matrix, typename Matrix::Scalar strong_coeff_rate_threshold) -> node_connection_list< typename Matrix::StorageIndex >
 Compute a list of strong connections in a matrix [24].
 
template<base::concepts::sparse_matrix Matrix>
auto create_coarse_grid (const Matrix &matrix, typename Matrix::Scalar strong_coeff_rate_threshold) -> util::vector< node_layer >
 Create a coarse grid from a sparse matrix using an algorithm in [24].
 
template<base::concepts::sparse_matrix Matrix>
void create_prolongation_matrix (Matrix &prolongation_matrix, const node_connection_list< typename Matrix::StorageIndex > &transposed_connections, const util::vector< node_layer > &node_classification)
 Create a prolongation matrix.
 
template<typename StorageIndex >
auto find_max_score_index (const util::vector< StorageIndex > &scores, const util::vector< node_layer > &classification) -> std::optional< index_type >
 Find the index of the maximum score among unclassified nodes.
 
template<typename StorageIndex >
auto find_node_unsatisfying_interpolation_condition (const node_connection_list< StorageIndex > &connections, const std::unordered_set< StorageIndex > &neighbors_in_coarse_grid, const std::unordered_set< StorageIndex > &neighbors_in_fine_grid) -> std::optional< StorageIndex >
 Find a neighboring node unsatisfying the condition of interpolation in [24] for a node.
 
template<typename StorageIndex >
void tune_coarse_grid_selection (const node_connection_list< StorageIndex > &connections, const node_connection_list< StorageIndex > &transposed_connections, util::vector< node_layer > &node_classification)
 Tune a coarse grid to satisfy the condition for interpolation specified in [24].
 
template<typename StorageIndex >
void tune_coarse_grid_selection_for_one_node (const node_connection_list< StorageIndex > &connections, util::vector< node_layer > &node_classification, index_type tested_node_index)
 Tune a node in a coarse grid to satisfy the condition for interpolation specified in [24].
 

Detailed Description

Namespace of internal implementations of algebraic multigrid method [24].

Enumeration Type Documentation

◆ node_layer

Enumeration of types of grids which nodes belong to in AMG method.

Enumerator
unclassified 

Unclassified.

coarse 

Carse grid.

fine 

Only in finer grid.

Definition at line 29 of file node_layer.h.

Function Documentation

◆ build_first_coarse_grid_candidate()

template<typename StorageIndex >
auto num_collect::linear::impl::amg::build_first_coarse_grid_candidate ( const node_connection_list< StorageIndex > & connections,
const node_connection_list< StorageIndex > & transposed_connections ) -> util::vector<node_layer>
inlinenodiscard

Build the first candidate of a coarse grid.

Template Parameters
StorageIndexType of indices in storage.
Parameters
[in]connectionsList of connections.
[in]transposed_connectionsTransposed list of connections.
Returns
Classification of nodes.

Definition at line 86 of file build_first_coarse_grid_candidate.h.

◆ compute_node_scores()

template<typename StorageIndex >
auto num_collect::linear::impl::amg::compute_node_scores ( const node_connection_list< StorageIndex > & transposed_connections) -> util::vector<StorageIndex>
inlinenodiscard

Compute the first scores of nodes.

Template Parameters
StorageIndexType of indices in storage.
Parameters
[in]transposed_connectionsTransposed list of connections.
Returns
Scores.

Definition at line 40 of file build_first_coarse_grid_candidate.h.

◆ compute_strong_connection_list()

template<base::concepts::sparse_matrix Matrix>
auto num_collect::linear::impl::amg::compute_strong_connection_list ( const Matrix & matrix,
typename Matrix::Scalar strong_coeff_rate_threshold ) -> node_connection_list<typename Matrix::StorageIndex>
inline

Compute a list of strong connections in a matrix [24].

Template Parameters
MatrixType of the matrix.
Parameters
[in]matrixMatrix.
[in]strong_coeff_rate_thresholdThreshold of the rate of coefficients to determine strong connections.
Returns
List of strong connections.

Definition at line 40 of file compute_strong_connection_list.h.

◆ create_coarse_grid()

template<base::concepts::sparse_matrix Matrix>
auto num_collect::linear::impl::amg::create_coarse_grid ( const Matrix & matrix,
typename Matrix::Scalar strong_coeff_rate_threshold ) -> util::vector<node_layer>
inlinenodiscard

Create a coarse grid from a sparse matrix using an algorithm in [24].

Template Parameters
MatrixType of the matrix.
Parameters
[in]matrixMatrix.
[in]strong_coeff_rate_thresholdThreshold of the rate of coefficients to determine strong connections.
Returns
Node classification.

Definition at line 42 of file create_coarse_grid.h.

◆ create_prolongation_matrix()

template<base::concepts::sparse_matrix Matrix>
void num_collect::linear::impl::amg::create_prolongation_matrix ( Matrix & prolongation_matrix,
const node_connection_list< typename Matrix::StorageIndex > & transposed_connections,
const util::vector< node_layer > & node_classification )

Create a prolongation matrix.

Template Parameters
MatrixType of the prolongation matrix.
Parameters
[out]prolongation_matrixProlongation matrix.
[in]transposed_connectionsTransposed list of connections.
[in]node_classificationClassification of nodes.

Definition at line 43 of file create_prolongation_matrix.h.

◆ find_max_score_index()

template<typename StorageIndex >
auto num_collect::linear::impl::amg::find_max_score_index ( const util::vector< StorageIndex > & scores,
const util::vector< node_layer > & classification ) -> std::optional<index_type>
nodiscard

Find the index of the maximum score among unclassified nodes.

Template Parameters
StorageIndexType of indices in storage.
Parameters
[in]scoresCurrent score.
[in]classificationClassification of nodes.
Returns
Index. (Null if no unclassified nodes.)

Definition at line 60 of file build_first_coarse_grid_candidate.h.

◆ find_node_unsatisfying_interpolation_condition()

template<typename StorageIndex >
auto num_collect::linear::impl::amg::find_node_unsatisfying_interpolation_condition ( const node_connection_list< StorageIndex > & connections,
const std::unordered_set< StorageIndex > & neighbors_in_coarse_grid,
const std::unordered_set< StorageIndex > & neighbors_in_fine_grid ) -> std::optional<StorageIndex>
inlinenodiscard

Find a neighboring node unsatisfying the condition of interpolation in [24] for a node.

Template Parameters
StorageIndexType of indices in storage.
Parameters
[in]connectionsList of connections.
[in]neighbors_in_coarse_gridNeighboring nodes in coarse grid.
[in]neighbors_in_fine_gridNeighboring nodes only in finer grid.
Returns
Index of unsatisfying node. (Null if not found.)

Definition at line 45 of file tune_coarse_grid_selection.h.

◆ tune_coarse_grid_selection()

template<typename StorageIndex >
void num_collect::linear::impl::amg::tune_coarse_grid_selection ( const node_connection_list< StorageIndex > & connections,
const node_connection_list< StorageIndex > & transposed_connections,
util::vector< node_layer > & node_classification )

Tune a coarse grid to satisfy the condition for interpolation specified in [24].

Template Parameters
StorageIndexType of indices in storage.
Parameters
[in]connectionsList of connections.
[in]transposed_connectionsTransposed list of connections.
[in,out]node_classificationClassification of nodes.

Definition at line 121 of file tune_coarse_grid_selection.h.

◆ tune_coarse_grid_selection_for_one_node()

template<typename StorageIndex >
void num_collect::linear::impl::amg::tune_coarse_grid_selection_for_one_node ( const node_connection_list< StorageIndex > & connections,
util::vector< node_layer > & node_classification,
index_type tested_node_index )

Tune a node in a coarse grid to satisfy the condition for interpolation specified in [24].

Template Parameters
StorageIndexType of indices in storage.
Parameters
[in]connectionsList of connections.
[in,out]node_classificationClassification of nodes.
[in]tested_node_indexIndex of the tested node.

Definition at line 71 of file tune_coarse_grid_selection.h.