class gpr::pairlocal::TileEvaluator¶
Overview¶
One configuration pair of the joint covariance and its derivatives with respect to log m (parameter 0) and each log length (parameters 1..P, or the single parameter 1 for a shared length). More…
#include <gpr/ml/gp/PairLocalKernel.h>
class TileEvaluator {
public:
// construction
TileEvaluator(const Geometry& geometry, const Weights& weights);
TileEvaluator(const Geometry& left, const Geometry& right, const Weights& weights);
TileEvaluator(const Geometry& geometry, const Weights& weights, const std::vector<Eigen::Index>& derivative_groups);
TileEvaluator(const Geometry& left, const Geometry& right, const Weights& weights, const std::vector<Eigen::Index>& derivative_groups);
// methods
Eigen::Index tileSize() const;
Eigen::Index parameterCount() const;
void prepare(Eigen::Index i, Eigen::Index j);
void tile(Eigen::Index parameter, Eigen::MatrixXd& out) const;
void directional(const Eigen::VectorXd& direction, Eigen::MatrixXd& first, Eigen::MatrixXd& second) const;
void contract(const double* W, Eigen::Index row_stride, Eigen::Index col_stride, bool lower_only, Eigen::VectorXd& out) const;
void quadratic(const double* alpha_i, const double* alpha_j, Eigen::VectorXd& out) const;
void action(const double* vector, bool transpose, Eigen::MatrixXd& out) const;
void diagonals(Eigen::MatrixXd& out) const;
};
Detailed Documentation¶
One configuration pair of the joint covariance and its derivatives with respect to log m (parameter 0) and each log length (parameters 1..P, or the single parameter 1 for a shared length).
Construction¶
Cross tiles between the configurations of two geometries of the same atoms: i indexes left, j indexes right.
TileEvaluator(const Geometry& geometry, const Weights& weights, const std::vector<Eigen::Index>& derivative_groups)
Compact derivative groups, indexed by fine pair type. Each group parameter moves all of its members’ log lengths together. Group IDs must cover 0..G-1; an empty map retains the fine-coordinate workspace.
Methods¶
Eigen::Index parameterCount() const
1 + number of log lengths.
void tile(Eigen::Index parameter, Eigen::MatrixXd& out) const
The dense tile of parameter parameter (0 is the covariance itself, which equals its derivative with respect to log m).
void directional(const Eigen::VectorXd& direction, Eigen::MatrixXd& first, Eigen::MatrixXd& second) const
Exact first and second derivatives along one packed log-parameter direction. Pair products use their six-entry Cartesian support.
void contract(const double* W, Eigen::Index row_stride, Eigen::Index col_stride, bool lower_only, Eigen::VectorXd& out) const
Frobenius products of a weight tile with the covariance tile and every derivative tile: out(p) = <W, dK/dtheta_p>, out(0) = <W, K>. Entry (c, c’) of W sits at W[c * row_stride + c’ * col_stride]. When lower_only the tile is the diagonal tile i == j and only the entries with c >= c’ are read.
void quadratic(const double* alpha_i, const double* alpha_j, Eigen::VectorXd& out) const
alpha_i^T (dK/dtheta_p) alpha_j for every parameter, with the tiles of the two weight vectors given channel-contiguous.
void action(const double* vector, bool transpose, Eigen::MatrixXd& out) const
Apply every derivative tile to one channel vector without materializing the tiles. out(p, c) is the c-th component of (dK/dtheta_p) vector; transpose=true applies each transposed tile. Workspace is O(G D).
void diagonals(Eigen::MatrixXd& out) const
Diagonal of every parameter tile: out(p, c). Meaningful for i == j, where the kernel nugget scales the diagonal.