class gpr::ManifoldEnergyForceKernel¶
Overview¶
Squared-exponential scalar energy kernel pulled back through a fixed differentiable Cartesian or molecular internal-coordinate chart. More…
#include <gpr/covariance_functions/ManifoldEnergyForceKernel.h>
class ManifoldEnergyForceKernel {
public:
// typedefs
typedef std::function<Eigen::MatrixXd(Eigen::Index, Eigen::Index)> JointCovarianceTileFunction;
typedef std::function<double(Eigen::Index, const Eigen::MatrixXd&, Derivative)> JointContraction;
typedef std::function<Eigen::MatrixXd(Eigen::Index, Eigen::Index)> JointWeightRows;
// enums
enum Derivative;
// structs
struct ChartPoint;
// construction
ManifoldEnergyForceKernel(std::shared_ptr<const geometry::CoordinateChart> chart, double magnitude_variance, double length_scale);
// methods
double magnitudeVariance() const;
double lengthScale() const;
const geometry::CoordinateChart& chart() const;
void setMagnitudeVariance(double value);
void setLengthScale(double value);
Eigen::MatrixXd covarianceBlock(const Eigen::MatrixXd& left_positions, const Eigen::MatrixXd& right_positions, Eigen::Index left_channel, Eigen::Index right_channel) const;
Eigen::MatrixXd jointEnergyGradientCrossCovariance(const Eigen::MatrixXd& left_positions, const Eigen::MatrixXd& right_positions) const;
JointCovarianceTileFunction prepareJointCovarianceTiles(const Eigen::MatrixXd& positions) const;
Eigen::MatrixXd jointEnergyGradientCovariance(const Eigen::MatrixXd& positions) const;
Eigen::MatrixXd jointEnergyGradientCovariance(const Eigen::MatrixXd& positions, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const;
double contractJointEnergyGradientCrossCovariance(const Eigen::MatrixXd& left_positions, const Eigen::MatrixXd& right_positions, const Eigen::MatrixXd& weight, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const;
Eigen::MatrixXd jointEnergyForceCovariance(const Eigen::MatrixXd& positions) const;
void setDerivative(Derivative d);
Derivative derivative() const;
JointContraction prepareJointContraction(const Eigen::MatrixXd& positions, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const;
Eigen::Vector2d contractJointLogHyperparameterDerivatives(const Eigen::MatrixXd& positions, const JointWeightRows& weight_rows, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const;
Eigen::Vector2d contractJointLogHyperparameterDerivatives(const Eigen::MatrixXd& positions, const JointWeightRows& left_factors, const JointWeightRows& right_factors, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const;
};
Detailed Documentation¶
Squared-exponential scalar energy kernel pulled back through a fixed differentiable Cartesian or molecular internal-coordinate chart.
The scalar process E(x) = f(z(x)) induces Cartesian gradients through G(x) = Dz(x)^T grad_z f. Consequently all energy, gradient, and physical force channels belong to one positive-semidefinite differential-observation tensor. The kernel has one intrinsic length scale; primitive bonds, angles, and torsions do not receive separate hyperparameters.
Methods¶
Eigen::MatrixXd covarianceBlock(const Eigen::MatrixXd& left_positions, const Eigen::MatrixXd& right_positions, Eigen::Index left_channel, Eigen::Index right_channel) const
Covariance between one channel at each set of geometry rows. Channel -1 denotes energy; channel d in [0, D) denotes Cartesian gradient component d. This is the Observation storage convention, where physical force is F = -G.
Eigen::MatrixXd jointEnergyGradientCrossCovariance(const Eigen::MatrixXd& left_positions, const Eigen::MatrixXd& right_positions) const
Cross covariance in Observation order on each operand: [E; G_col0; …; G_colD-1].
JointCovarianceTileFunction prepareJointCovarianceTiles(const Eigen::MatrixXd& positions) const
Own chart coordinates, Jacobians and kernel parameters for each row. Each call evaluates one geometry pair in [E; G] channel order.
Eigen::MatrixXd jointEnergyGradientCovariance(const Eigen::MatrixXd& positions) const
Joint covariance in Observation order [E; G_col0; …; G_colD-1].
Eigen::MatrixXd jointEnergyGradientCovariance(const Eigen::MatrixXd& positions, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const
Assemble each geometry pair once within the supplied process group. Local workers own disjoint entries and join before MPI communication.
double contractJointEnergyGradientCrossCovariance(const Eigen::MatrixXd& left_positions, const Eigen::MatrixXd& right_positions, const Eigen::MatrixXd& weight, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const
Frobenius contraction with a rectangular joint covariance (or the selected hyperparameter derivative), without storing that covariance. Geometry pairs are partitioned across the supplied process group.
Eigen::MatrixXd jointEnergyForceCovariance(const Eigen::MatrixXd& positions) const
Joint covariance in physical order [E; F_col0; …; F_colD-1].
JointContraction prepareJointContraction(const Eigen::MatrixXd& positions, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const
Retain chart coordinates and Jacobians for repeated row contractions. The callable owns its kernel parameters and geometry data. Its first argument selects a contiguous geometry range in every weight channel; the weight columns cover every prepared geometry.
Eigen::Vector2d contractJointLogHyperparameterDerivatives(const Eigen::MatrixXd& positions, const JointWeightRows& weight_rows, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const
Contract log magnitude and log length derivatives against joint weights. Each rank requests only its own geometry rows from weight_rows, in bounded batches. The callback is local and must not enter collectives. Its matrix contains every channel for the requested rows and every prepared geometry on the column axis, in Observation order.
Eigen::Vector2d contractJointLogHyperparameterDerivatives(const Eigen::MatrixXd& positions, const JointWeightRows& left_factors, const JointWeightRows& right_factors, const linalg::MpiContext& context, const linalg::LocalExecutor& execution) const
Contract a joint weight L R^T through its thin factors. Each callback returns one geometry’s [E; G] rows and the same number of factor columns. Left geometries belong to one rank; right factors stream in bounded batches. Affine charts use their fixed Jacobian; other chart geometries retain the general joint-weight contraction.