Hierarchical matrix¶
Builder¶
-
template<typename CoefficientsPrecision, typename CoordinatesPrecision = htool::underlying_type<CoefficientsPrecision>>
class HMatrixBuilder¶ Public Functions
-
inline HMatrixBuilder(int target_number_of_points, int target_spatial_dimension, const CoordinatesPrecision *target_coordinates, const ClusterTreeBuilder<CoordinatesPrecision> *target_cluster_tree_builder, int target_number_of_children, int target_number_of_partitions, int source_number_of_points, int source_spatial_dimension, const CoordinatesPrecision *source_coordinates, const ClusterTreeBuilder<CoordinatesPrecision> *source_cluster_tree_builder, int source_number_of_children, int source_number_of_partitions)¶
-
inline HMatrixBuilder(int target_number_of_points, int target_spatial_dimension, const CoordinatesPrecision *target_coordinates, int source_number_of_points, int source_spatial_dimension, const CoordinatesPrecision *source_coordinates)¶
-
inline HMatrixBuilder(int number_of_points, int spatial_dimension, const CoordinatesPrecision *coordinates, const ClusterTreeBuilder<CoordinatesPrecision> *cluster_tree_builder = nullptr, int number_of_children = 2, int number_of_partitions = 2)¶
-
template<typename ExecutionPolicy>
inline HMatrix<CoefficientsPrecision, CoordinatesPrecision> build(ExecutionPolicy &&execution_policy, const VirtualGenerator<CoefficientsPrecision> &generator, const HMatrixTreeBuilder<CoefficientsPrecision, CoordinatesPrecision> &hmatrix_tree_builder)¶
-
inline HMatrix<CoefficientsPrecision, CoordinatesPrecision> build(const VirtualGenerator<CoefficientsPrecision> &generator, const HMatrixTreeBuilder<CoefficientsPrecision, CoordinatesPrecision> &hmatrix_tree_builder)¶
Public Members
-
Cluster<CoordinatesPrecision> target_cluster¶
-
std::unique_ptr<Cluster<CoordinatesPrecision>> source_cluster_ptr = nullptr¶
-
inline HMatrixBuilder(int target_number_of_points, int target_spatial_dimension, const CoordinatesPrecision *target_coordinates, const ClusterTreeBuilder<CoordinatesPrecision> *target_cluster_tree_builder, int target_number_of_children, int target_number_of_partitions, int source_number_of_points, int source_spatial_dimension, const CoordinatesPrecision *source_coordinates, const ClusterTreeBuilder<CoordinatesPrecision> *source_cluster_tree_builder, int source_number_of_children, int source_number_of_partitions)¶
-
template<typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
class HMatrixTreeBuilder¶ Public Functions
-
HMatrixTreeBuilder(const HMatrixTreeBuilder&) = delete¶
-
HMatrixTreeBuilder &operator=(const HMatrixTreeBuilder&) = delete¶
-
HMatrixTreeBuilder(HMatrixTreeBuilder&&) noexcept = default¶
-
HMatrixTreeBuilder &operator=(HMatrixTreeBuilder&&) noexcept = default¶
-
virtual ~HMatrixTreeBuilder() = default¶
-
template<typename ExecutionPolicy>
HMatrixType build(ExecutionPolicy&&, const VirtualInternalGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
template<typename ExecutionPolicy>
inline HMatrixType build(ExecutionPolicy &&execution_policy, const VirtualGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
inline HMatrixType build(const VirtualInternalGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
inline HMatrixType build(const VirtualGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
HMatrixType sequential_build(const VirtualInternalGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
inline HMatrixType sequential_build(const VirtualGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
HMatrixType openmp_build(const VirtualInternalGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
inline HMatrixType openmp_build(const VirtualGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
HMatrixType task_based_build(const VirtualInternalGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, HMatrixTaskDependencies<CoefficientPrecision, CoordinatePrecision> &hmatrix_task_dependencies, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
inline HMatrixType task_based_build(const VirtualGenerator<CoefficientPrecision> &generator, const ClusterType &target_root_cluster_tree, const ClusterType &source_root_cluster_tree, HMatrixTaskDependencies<CoefficientPrecision, CoordinatePrecision> &hmatrix_task_dependencies, int target_partition_number = -1, int partition_number_for_symmetry = -1) const¶
-
inline void set_symmetry(char symmetry_type)¶
-
inline void set_UPLO(char UPLO_type)¶
-
inline void set_minimal_source_depth(int minimal_source_depth)¶
-
inline void set_minimal_target_depth(int minimal_target_depth)¶
-
inline void set_block_tree_consistency(bool consistency)¶
-
inline char get_symmetry() const¶
-
inline char get_UPLO() const¶
-
inline double get_epsilon() const¶
-
inline double get_eta() const¶
-
inline std::shared_ptr<VirtualInternalLowRankGenerator<CoefficientPrecision>> get_internal_low_rank_generator() const¶
-
inline std::shared_ptr<VirtualLowRankGenerator<CoefficientPrecision>> get_low_rank_generator() const¶
-
template<typename ExecutionPolicy>
HMatrix<CoefficientPrecision, CoordinatePrecision> build(ExecutionPolicy &&execution_policy, const VirtualInternalGenerator<CoefficientPrecision> &generator, const ClusterType &root_target_cluster_tree, const ClusterType &root_source_cluster_tree, int target_partition_number, int partition_number_for_symmetry) const¶
-
HMatrixTreeBuilder(const HMatrixTreeBuilder&) = delete¶
HMatrix¶
-
template<typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
class HMatrix : public htool::TreeNode<HMatrix<CoefficientPrecision, underlying_type<CoefficientPrecision>>, HMatrixTreeData<CoefficientPrecision, underlying_type<CoefficientPrecision>>>¶ Public Types
Public Functions
-
inline HMatrix(const Cluster<CoordinatePrecision> &target_cluster, const Cluster<CoordinatePrecision> &source_cluster)¶
-
inline HMatrix(const HMatrix &parent, const Cluster<CoordinatePrecision> *target_cluster, const Cluster<CoordinatePrecision> *source_cluster)¶
-
virtual ~HMatrix() = default¶
-
inline const Cluster<CoordinatePrecision> &get_target_cluster() const¶
-
inline const Cluster<CoordinatePrecision> &get_source_cluster() const¶
-
inline int nb_cols() const¶
-
inline int nb_rows() const¶
-
inline htool::underlying_type<CoefficientPrecision> get_epsilon() const¶
-
inline HMatrix<CoefficientPrecision, CoordinatePrecision> *get_child_or_this(const Cluster<CoordinatePrecision> &required_target_cluster, const Cluster<CoordinatePrecision> &required_source_cluster)¶
-
inline const HMatrix<CoefficientPrecision, CoordinatePrecision> *get_child_or_this(const Cluster<CoordinatePrecision> &required_target_cluster, const Cluster<CoordinatePrecision> &required_source_cluster) const¶
-
inline int get_rank() const¶
-
inline const Matrix<CoefficientPrecision> *get_dense_data() const¶
-
inline Matrix<CoefficientPrecision> *get_dense_data()¶
-
inline const LowRankMatrix<CoefficientPrecision> *get_low_rank_data() const¶
-
inline LowRankMatrix<CoefficientPrecision> *get_low_rank_data()¶
-
inline char get_symmetry() const¶
-
inline char get_UPLO() const¶
-
inline const HMatrixTreeData<CoefficientPrecision, CoordinatePrecision> *get_hmatrix_tree_data() const¶
-
inline const HMatrix<CoefficientPrecision> *get_sub_hmatrix(const Cluster<CoordinatePrecision> &target_cluster, const Cluster<CoordinatePrecision> &source_cluster) const¶
-
inline HMatrix<CoefficientPrecision> *get_sub_hmatrix(const Cluster<CoordinatePrecision> &target_cluster, const Cluster<CoordinatePrecision> &source_cluster)¶
-
inline StorageType get_storage_type() const¶
-
inline void set_symmetry(char symmetry)¶
-
inline void set_UPLO(char UPLO)¶
-
inline void set_symmetry_for_leaves(char symmetry)¶
-
inline void set_UPLO_for_leaves(char UPLO)¶
-
inline void set_target_cluster(const Cluster<CoordinatePrecision> *new_target_cluster)¶
-
inline bool is_dense() const¶
-
inline bool is_low_rank() const¶
-
inline bool is_hierarchical() const¶
-
inline void set_eta(CoordinatePrecision eta)¶
-
inline void set_epsilon(underlying_type<CoefficientPrecision> epsilon)¶
-
inline void set_minimal_target_depth(unsigned int minimal_target_depth)¶
-
inline void set_minimal_source_depth(unsigned int minimal_source_depth)¶
-
inline void set_block_tree_consistency(bool consistency)¶
-
inline char get_symmetry_for_leaves() const¶
-
inline char get_UPLO_for_leaves() const¶
-
inline bool is_block_tree_consistent() const¶
-
inline void compute_dense_data(const VirtualInternalGenerator<CoefficientPrecision> &generator)¶
-
inline bool compute_low_rank_data(const VirtualInternalLowRankGenerator<CoefficientPrecision> &low_rank_generator, int reqrank, underlying_type<CoefficientPrecision> epsilon)¶
-
inline void clear_low_rank_data()¶
-
inline void set_dense_data(std::unique_ptr<Matrix<CoefficientPrecision>> dense_matrix_ptr)¶
-
inline void set_low_rank_data(std::unique_ptr<LowRankMatrix<CoefficientPrecision>> low_rank_matrix_ptr)¶
-
inline HMatrix(const Cluster<CoordinatePrecision> &target_cluster, const Cluster<CoordinatePrecision> &source_cluster)¶
Admissibility conditions¶
-
template<typename CoordinatePrecision>
class VirtualAdmissibilityCondition¶ Subclassed by htool::RjasanowSteinbach< CoordinatePrecision >
Public Functions
-
virtual bool ComputeAdmissibility(const Cluster<CoordinatePrecision> &target, const Cluster<CoordinatePrecision> &source, double eta) const = 0¶
-
inline virtual ~VirtualAdmissibilityCondition()¶
-
virtual bool ComputeAdmissibility(const Cluster<CoordinatePrecision> &target, const Cluster<CoordinatePrecision> &source, double eta) const = 0¶
-
template<typename CoordinatePrecision>
class RjasanowSteinbach : public htool::VirtualAdmissibilityCondition<CoordinatePrecision>¶ Public Functions
-
inline virtual bool ComputeAdmissibility(const Cluster<CoordinatePrecision> &target, const Cluster<CoordinatePrecision> &source, double eta) const override¶
-
inline virtual bool ComputeAdmissibility(const Cluster<CoordinatePrecision> &target, const Cluster<CoordinatePrecision> &source, double eta) const override¶
Low-rank compression¶
-
template<typename CoefficientPrecision, typename CoordinatesPrecision = underlying_type<CoefficientPrecision>>
class VirtualLowRankGenerator¶ Public Functions
-
inline VirtualLowRankGenerator()¶
-
virtual bool copy_low_rank_approximation(int M, int N, const int *rows, const int *cols, LowRankMatrix<CoefficientPrecision> &lrmat) const = 0¶
-
virtual bool copy_low_rank_approximation(int M, int N, const int *rows, const int *cols, int reqrank, LowRankMatrix<CoefficientPrecision> &lrmat) const = 0¶
-
inline virtual ~VirtualLowRankGenerator()¶
-
inline VirtualLowRankGenerator()¶
-
template<typename CoefficientPrecision>
class SVD : public htool::VirtualInternalLowRankGenerator<CoefficientPrecision>¶ Public Functions
-
inline SVD(const VirtualInternalGenerator<CoefficientPrecision> &A)¶
-
inline SVD(const VirtualGenerator<CoefficientPrecision> &A, const int *target_permutation, const int *source_permutation)¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, LowRankMatrix<CoefficientPrecision> &lrmat) const override¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, int rank, LowRankMatrix<CoefficientPrecision> &lrmat) const override¶
-
inline SVD(const VirtualInternalGenerator<CoefficientPrecision> &A)¶
-
template<typename CoefficientPrecision>
class fullACA : public htool::VirtualInternalLowRankGenerator<CoefficientPrecision>¶ Public Functions
-
inline fullACA(const VirtualInternalGenerator<CoefficientPrecision> &A)¶
-
inline fullACA(const VirtualGenerator<CoefficientPrecision> &A, const int *target_permutation, const int *source_permutation)¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, LowRankMatrix<CoefficientPrecision> &lrmat) const override¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, int reqrank, LowRankMatrix<CoefficientPrecision> &lrmat) const override¶
-
inline fullACA(const VirtualInternalGenerator<CoefficientPrecision> &A)¶
-
template<typename CoefficientPrecision>
class partialACA : public htool::VirtualInternalLowRankGenerator<CoefficientPrecision>¶ Public Functions
-
inline partialACA(const VirtualInternalGenerator<CoefficientPrecision> &A)¶
-
inline partialACA(const VirtualGenerator<CoefficientPrecision> &A, const int *target_permutation, const int *source_permutation)¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, LowRankMatrix<CoefficientPrecision> &lrmat) const override¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, int reqrank, LowRankMatrix<CoefficientPrecision> &lrmat) const override¶
-
inline partialACA(const VirtualInternalGenerator<CoefficientPrecision> &A)¶
-
template<typename CoefficientPrecision>
class sympartialACA : public htool::VirtualInternalLowRankGenerator<CoefficientPrecision>¶ Public Functions
-
inline sympartialACA(const VirtualInternalGenerator<CoefficientPrecision> &A)¶
-
inline sympartialACA(const VirtualGenerator<CoefficientPrecision> &A, const int *target_permutation, const int *source_permutation)¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, LowRankMatrix<CoefficientPrecision> &lrmat) const override¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, int reqrank, LowRankMatrix<CoefficientPrecision> &lrmat) const override¶
-
inline sympartialACA(const VirtualInternalGenerator<CoefficientPrecision> &A)¶
-
template<typename CoefficientPrecision>
class RecompressedLowRankGenerator : public htool::VirtualInternalLowRankGenerator<CoefficientPrecision>¶ Public Functions
-
inline RecompressedLowRankGenerator(const VirtualInternalLowRankGenerator<CoefficientPrecision> &low_rank_generator, std::function<void(LowRankMatrix<CoefficientPrecision>&)> recompression)¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, LowRankMatrix<CoefficientPrecision> &lrmat) const¶
-
inline virtual bool copy_low_rank_approximation(int M, int N, int row_offset, int col_offset, int reqrank, LowRankMatrix<CoefficientPrecision> &lrmat) const¶
-
inline RecompressedLowRankGenerator(const VirtualInternalLowRankGenerator<CoefficientPrecision> &low_rank_generator, std::function<void(LowRankMatrix<CoefficientPrecision>&)> recompression)¶
Visualisation¶
-
template<typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
void htool::save_leaves_with_rank(const HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix, const std::string &filename)¶
-
template<typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
std::map<std::string, std::string> htool::get_tree_parameters(const HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix)¶
-
template<typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
void htool::print_tree_parameters(const HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix, std::ostream &os)¶
-
template<typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
std::map<std::string, std::string> htool::get_hmatrix_information(const HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix)¶
-
template<typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
void htool::print_hmatrix_information(const HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix, std::ostream &os)¶
Linear algebra¶
-
template<typename ExecutionPolicy, typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
void htool::add_hmatrix_vector_product(ExecutionPolicy&&, char trans, CoefficientPrecision alpha, const HMatrix<CoefficientPrecision, CoordinatePrecision> &A, const CoefficientPrecision *in, CoefficientPrecision beta, CoefficientPrecision *out, CoefficientPrecision *buffer = nullptr)¶
-
template<typename ExecutionPolicy, typename MatB, typename MatC, typename CoordinatePrecision = underlying_type<typename MatB::value_type>, typename = std::enable_if_t<std::is_same<typename MatB::value_type, typename MatC::value_type>::value>>
void htool::add_hmatrix_matrix_product(ExecutionPolicy &&execution_policy, char transa, char transb, typename MatB::value_type alpha, const HMatrix<typename MatB::value_type, CoordinatePrecision> &A, const MatB &B, typename MatB::value_type beta, MatC &C, typename MatB::value_type *buffer = nullptr)¶
-
template<typename ExecutionPolicy, typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
void htool::lu_factorization(ExecutionPolicy &&execution_policy, HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix)¶
-
template<typename Mat, typename CoordinatePrecision = underlying_type<typename Mat::value_type>>
void htool::lu_solve(char trans, const HMatrix<typename Mat::value_type, CoordinatePrecision> &A, Mat &X)¶
-
template<typename ExecutionPolicy, typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
void htool::cholesky_factorization(ExecutionPolicy &&execution_policy, char UPLO, HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix)¶
-
template<typename Mat, typename CoordinatePrecision = underlying_type<typename Mat::value_type>>
void htool::cholesky_solve(char UPLO, const HMatrix<typename Mat::value_type, CoordinatePrecision> &A, Mat &X)¶
-
template<typename ExecutionPolicy, typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
void htool::ldlt_factorization(ExecutionPolicy &&execution_policy, char symmetry, char UPLO, HMatrix<CoefficientPrecision, CoordinatePrecision> &hmatrix)¶
Execution policies¶
-
template<typename CoefficientPrecision, typename CoordinatePrecision = underlying_type<CoefficientPrecision>>
struct omp_task_policy¶ Execution policy for OpenMP task-based build and factorizations.
Stores the L0 used as task dependencies. build always sets L0 for the new HMatrix. The factorizations keep L0 if it is a cut of the block tree of the factorized HMatrix (for example the L0 set by its build, or one assigned directly), and recompute it otherwise; call set_L0 explicitly after changing max_number_of_nodes or cost_function.
If called outside a parallel region, build, lu_factorization, cholesky_factorization and ldlt_factorization create one and return once all their tasks are done. If L0 is reduced to the root, they run sequentially.
If called inside a parallel region (e.g. in a single construct), they only create tasks and return before these tasks are completed, so that tasks of successive calls can overlap through their dependencies. Until a taskwait (or the end of the enclosing region):
the HMatrix is only complete after a taskwait: before that, it can only be passed to other task-based calls with the same policy (hence the same L0), whose tasks wait for the ones they need through their dependencies,
the HMatrix can be moved, but must not be destroyed while its tasks are pending,
the generator passed to build must stay alive, and so must the HMatrixTreeBuilder if the generator is a VirtualGenerator, since the builder holds the internal generator wrapping it.
Public Members
-
HMatrixTaskDependencies<CoefficientPrecision, CoordinatePrecision> hmatrix_task_dependencies¶