39template <base::concepts::sparse_matrix Matrix>
41 const Matrix& matrix,
typename Matrix::Scalar strong_coeff_rate_threshold)
43 using scalar_type =
typename Matrix::Scalar;
48 const index_type num_nodes = matrix.outerSize();
50 auto max_coeff =
static_cast<scalar_type
>(0);
51 for (
typename Matrix::InnerIterator iter(matrix, i); iter; ++iter) {
52 const auto abs_coeff = abs(iter.value());
53 if (iter.index() != i && abs_coeff > max_coeff) {
54 max_coeff = abs_coeff;
57 const auto strong_coeff_threshold =
58 strong_coeff_rate_threshold * max_coeff;
59 for (
typename Matrix::InnerIterator iter(matrix, i); iter; ++iter) {
60 if (iter.index() != i &&
61 abs(iter.value()) >= strong_coeff_threshold) {
Class of lists of connected nodes per node.
void finish_current_node()
Finish adding connected nodes to the current node and start the next node.
void push_back(storage_index_type node_index)
Add a connected node to the current node.
Definition of index_type type.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of internal implementations of algebraic multigrid method ruge1987.
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 ruge1987.
Definition of node_connection_list class.
Definition of sparse_matrix concept.