Loading...
Searching...
No Matches
ScalapackPDPotrfInverse.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4
44
45#ifndef GPR_LINALG_SCALAPACK_PDPOTRF_INVERSE_H_
46#define GPR_LINALG_SCALAPACK_PDPOTRF_INVERSE_H_
47
48#ifdef GPR_LINALG_SCALAPACK
49#include <cstdint>
50#include <memory>
51#include <vector>
52
53#include "CanonicalTriangular.h"
54#include "CholeskyPanels.h"
55#include "KernelInverse.h"
56
57namespace gpr {
58namespace linalg {
59
61
62class ScalapackPDPotrfInverse final : public KernelInverse {
63public:
64 ScalapackPDPotrfInverse() = default;
65 explicit ScalapackPDPotrfInverse(std::shared_ptr<DistributedState> state);
67 [[nodiscard]] bool factorise(const EigenMatrix& covariance);
84 // Knob types match the distributed factorisation input so no narrowing
85 // happens at the call site.
86 [[nodiscard]] bool factorise(std::vector<double> K_distributed,
87 const int desc[9], int n);
88
89 [[nodiscard]] Kind kind() const noexcept override
90 {
91 return Kind::Distributed;
92 }
93 [[nodiscard]] Eigen::VectorXd solve(
94 const Eigen::VectorXd& b) const override;
95 [[nodiscard]] EigenMatrix solve_mat(const EigenMatrix& B) const override;
96 [[nodiscard]] double log_det() const override;
97 [[nodiscard]] double trace_inv_times(const EigenMatrix& A) const override;
98
100 [[nodiscard]] EigenMatrix lowerFactor() const;
101
103 [[nodiscard]] CholeskyPanels lowerFactorPanels() const;
104
107 [[nodiscard]] EigenMatrix precision() const;
108
109private:
110 [[nodiscard]] DistributedState& state() const;
111 void require_factor() const;
112
113 std::shared_ptr<DistributedState> state_;
114 std::uint64_t grid_generation_ = 0;
115 std::uint64_t factorization_generation_ = 0;
116 std::vector<double> L_dist_{};
117 mutable canonical::SubstitutionCache substitution_{};
118 int L_desc_[9] = {};
119 int n_{0};
120 bool factored_{false};
121};
122
123} // namespace linalg
124} // namespace gpr
125
126#endif // GPR_LINALG_SCALAPACK
127
128#endif // GPR_LINALG_SCALAPACK_PDPOTRF_INVERSE_H_
Triangular solves and Cholesky inverse whose floating-point result does not depend on the process gri...
Abstract operator interface for K^{-1} actions used by Laplace Hessian probe loops and Williams-Rasmu...
Dense and structured linear algebra behind the GP: Cholesky and eigen solvers, linear operators,...
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16
Eigen::Matrix< double, EigenDynamic, EigenDynamic, EigenMatrixStorage > EigenMatrix
Definition Macros.h:20