.. _program_listing_file_src_kden_Bandwidth.hpp: Program Listing for File Bandwidth.hpp ====================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/kden/Bandwidth.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef BANDWIDTH_HPP #define BANDWIDTH_HPP #include // NOLINT(misc-include-cleaner) -- provides Eigen::MatrixXd/VectorXd/LLT/LDLT; clang-tidy's IWYU mapping doesn't know this header #include #include #include #include #include namespace kden { class Bandwidth { public: explicit Bandwidth(Eigen::MatrixXd h2Inv); // NOLINT(misc-include-cleaner) -- Eigen::MatrixXd is provided by (included above); clang-tidy's IWYU mapping doesn't know that [[nodiscard]] static auto identity(std::size_t nDim) -> Bandwidth; [[nodiscard]] auto nDim() const -> std::size_t { return unspecified_.size(); } [[nodiscard]] auto h2Inv() const -> const Eigen::MatrixXd& { return h2Inv_; } [[nodiscard]] auto unspecified() const -> const std::vector& { return unspecified_; } [[nodiscard]] auto isReduced() const -> bool { return spec_.size() != unspecified_.size(); } [[nodiscard]] auto isDiagonal() const -> bool { return diagonal_; } [[nodiscard]] auto nSpecified() const -> std::size_t { return spec_.size(); } [[nodiscard]] auto det() const -> double { return det_; } [[nodiscard]] auto reduce(const std::vector& unspecified) const -> Bandwidth; [[nodiscard]] auto convolve(const Bandwidth& other) const -> Bandwidth; [[nodiscard]] auto convolveCov(const Eigen::MatrixXd& cov) const -> Bandwidth; // NOLINT(misc-include-cleaner) -- Eigen::MatrixXd is provided by (included above); clang-tidy's IWYU mapping doesn't know that [[nodiscard]] static auto nanPattern(std::span x) -> std::vector; [[nodiscard]] auto matches(std::span x) const -> bool; [[nodiscard]] auto dist2(std::span x1, std::span x2) const -> double; [[nodiscard]] auto dist2(std::span x1, std::span x2, std::vector& scratch) const -> double; class BoxBounder { public: [[nodiscard]] auto lower(std::span lo, std::span hi) const -> double; [[nodiscard]] auto nDim() const -> std::size_t { return bandwidth_.get().nDim(); } [[nodiscard]] auto upper(std::span lo, std::span hi) const -> double; [[nodiscard]] auto bounds(std::span lo, std::span hi) const -> std::pair; private: friend class Bandwidth; BoxBounder(const Bandwidth& bandwidth, std::span x); template auto compute(std::span lo, std::span hi) const -> std::pair; std::reference_wrapper bandwidth_; Eigen::VectorXd xs_; // NOLINT(misc-include-cleaner) -- Eigen::VectorXd is provided by (included above); clang-tidy's IWYU mapping doesn't know that Eigen::VectorXd wx_; mutable Eigen::VectorXd center_; mutable Eigen::VectorXd half_; }; [[nodiscard]] auto boxBounder(std::span x) const -> BoxBounder; private: Bandwidth(Eigen::MatrixXd h2Inv, std::vector unspecified); void prepare(); [[nodiscard]] auto embed(const Eigen::MatrixXd& block) const -> Eigen::MatrixXd; Eigen::MatrixXd h2Inv_; std::vector unspecified_; std::vector spec_; Eigen::MatrixXd ms_; Eigen::VectorXd diag_; bool diagonal_ = false; double det_ = 1.0; Eigen::MatrixXd w_; Eigen::MatrixXd absW_; }; } // namespace kden #endif // BANDWIDTH_HPP