35 #ifndef STRUMPACK_CLUSTERING_HPP
36 #define STRUMPACK_CLUSTERING_HPP
72 default:
return "unknown";
90 std::cerr <<
"WARNING: binary tree clustering not recognized,"
91 <<
" setting to recursive 2 means (2means)."
98 template<
typename T>
void
99 pca_partition(DenseMatrix<T>& p, std::vector<std::size_t>& nc,
int* perm);
100 template<
typename T> structured::ClusterTree
101 recursive_pca(DenseMatrix<T>& p, std::size_t cluster_size,
int* perm);
103 template<
typename T>
void
104 cobble_partition(DenseMatrix<T>& p, std::vector<std::size_t>& nc,
int* perm);
105 template<
typename T> structured::ClusterTree
106 recursive_cobble(DenseMatrix<T>& p, std::size_t cluster_size,
int* perm);
108 template<
typename T> structured::ClusterTree
109 recursive_2_means(DenseMatrix<T>& p, std::size_t cluster_size,
110 int* perm, std::mt19937& generator);
112 template<
typename T>
void
113 kd_partition(DenseMatrix<T>& p, std::vector<std::size_t>& nc,
114 std::size_t cluster_size,
int* perm);
115 template<
typename T> structured::ClusterTree
116 recursive_kd(DenseMatrix<T>& p, std::size_t cluster_size,
int* perm);
142 template<
typename scalar_t>
145 std::vector<int>& perm, std::size_t cluster_size) {
147 perm.resize(p.
cols());
148 std::iota(perm.begin(), perm.end(), 1);
152 tree.
refine(cluster_size);
156 tree = recursive_2_means(p, cluster_size, perm.
data(), gen);
159 tree = recursive_kd(p, cluster_size, perm.
data());
break;
161 tree = recursive_pca(p, cluster_size, perm.
data());
break;
163 tree = recursive_cobble(p, cluster_size, perm.
data());
break;
165 std::cerr <<
"ERROR: clustering type not recognized." << std::endl;
This file contains the ClusterTree class definition.
Contains the DenseMatrix and DenseMatrixWrapper classes, simple wrappers around BLAS/LAPACK style den...
This class represents a matrix, stored in column major format, to allow direct use of BLAS/LAPACK rou...
Definition: DenseMatrix.hpp:138
std::size_t cols() const
Definition: DenseMatrix.hpp:230
const scalar_t * data() const
Definition: DenseMatrix.hpp:241
The cluster tree, or partition tree that represents the partitioning of the rows or columns of a hier...
Definition: ClusterTree.hpp:67
const ClusterTree & refine(int leaf_size)
Definition: ClusterTree.hpp:104
int size
Definition: ClusterTree.hpp:73
Definition: StrumpackOptions.hpp:43
ClusteringAlgorithm get_clustering_algorithm(const std::string &c)
Definition: Clustering.hpp:83
ClusteringAlgorithm
Definition: Clustering.hpp:51
structured::ClusterTree binary_tree_clustering(ClusteringAlgorithm algo, DenseMatrix< scalar_t > &p, std::vector< int > &perm, std::size_t cluster_size)
Definition: Clustering.hpp:144
std::string get_name(ReorderingStrategy method)