.. index:: pair: class; gpr::SexpatCF .. _doxid-classgpr_1_1_sexpat_c_f: class gpr::SexpatCF =================== .. toctree:: :hidden: struct_gpr_SexpatCF_CrossBlockGeometry.rst struct_gpr_SexpatCF_PriorState.rst Overview ~~~~~~~~ Pair-type inverse-distance squared-exponential primitive. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class SexpatCF { public: // typedefs typedef :ref:`Sexpat::AlphaKPairInfo` :target:`AlphaKPairInfo`; typedef :ref:`Sexpat::PreparedAlphaK` :target:`PreparedAlphaK`; typedef :ref:`Sexpat::HessianPrecision` :target:`HessianPrecision`; typedef Eigen::Array :ref:`ExpDistArray`; typedef :ref:`Derivatives``>> :ref:`SharedDerivatives`; // structs struct :ref:`CrossBlockGeometry`; struct :ref:`PriorState`; // construction :target:`SexpatCF`(); virtual :target:`~SexpatCF`(); // methods void :target:`setHessianPrecision`(:ref:`HessianPrecision` precision); :ref:`HessianPrecision` :target:`hessianPrecision`() const; void :target:`setUseLongDoubleHessian`(bool enabled); bool :target:`useLongDoubleHessian`() const; bool :target:`meanHessianVector`(const :ref:`Coord`& training, const Eigen::VectorXd& weights, const Eigen::VectorXd& position, const Eigen::VectorXd& direction, Eigen::VectorXd& action) const; double :ref:`calculateLogPrior`(); :ref:`FieldMatrixd` :ref:`calculateLogPriorGradient`(); void :ref:`calculateCovarianceMatrix`(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixd`& C); void :ref:`correlationDistances`(const :ref:`Coord`& left, const :ref:`Coord`& right, const :ref:`AtomsConfiguration`& configuration, :ref:`FieldMatrixd`& distances) const; void :ref:`calculateTrainingCovarianceMatrix`(const :ref:`Coord`& x, :ref:`FieldMatrixd`& C); void :ref:`calculateGradOfCovMatrix`(const :ref:`Coord`& x1, :ref:`Coord`& x2, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`calculateGradOfCovMatrixWithDerivatives`(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`calculateGradOfCovMatrixWithDerivatives2`(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims1, :ref:`FieldMatrixIdx`& dims2, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`calculateDirectionalCovarianceMatrix`(const :ref:`Coord`& x1, :ref:`Coord`& x2, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second); void :ref:`calculateDirectionalCovarianceMatrixWithDerivatives`(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second); void :ref:`calculateDirectionalCovarianceMatrixWithDerivatives2`(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims1, :ref:`FieldMatrixIdx`& dims2, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second); bool :ref:`buildCrossBlockGeometry`(const :ref:`Coord`& x1, const :ref:`Coord`& x2, uint8_t derivative_options, const :ref:`FieldMatrixIdx`& dims1, const :ref:`FieldMatrixIdx`& dims2, :ref:`CrossBlockGeometry`& geometry) const; bool :ref:`buildCrossBlockDerivativesOnly`(const :ref:`Coord`& x1, const :ref:`Coord`& x2, uint8_t derivative_options, const :ref:`FieldMatrixIdx`& dims1, const :ref:`FieldMatrixIdx`& dims2, :ref:`CrossBlockGeometry`& geometry) const; bool :ref:`buildSharedDistanceForTrainingGeometry`(const :ref:`Coord`& x_loc, std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt) const; bool :ref:`evaluateCrossBlockGeometry`(const :ref:`CrossBlockGeometry`& geometry, const Eigen::VectorXd& theta, :ref:`FieldMatrixd`& out) const; bool :ref:`evaluateCrossBlockGeometryShared`(const :ref:`CrossBlockGeometry`& geometry, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, :ref:`FieldMatrixd`& out) const; bool :ref:`buildSharedKernel`(const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, :ref:`FieldMatrixd`& kernel_out) const; bool :ref:`evaluateCrossBlockGeometryWithSharedKernel`(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const Eigen::VectorXd& theta, :ref:`FieldMatrixd`& out) const; bool :ref:`calculateDirectionalCovarianceMatrixFromGeometry`(const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) const; bool :ref:`calculateDirectionalCovarianceMatrixWithDerivativesFromGeometry`(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) const; bool :ref:`calculateDirectionalCovarianceMatrixWithDerivatives2FromGeometry`(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) const; bool :ref:`calculateGradOfCovMatrixFromGeometry`(const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, std::vector<:ref:`FieldMatrixd`>& DKff, const std::vector* parameter_indices = nullptr) const; bool :ref:`calculateGradOfCovMatrixWithDerivativesFromGeometry`(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, std::vector<:ref:`FieldMatrixd`>& DKff, const std::vector* parameter_indices = nullptr) const; bool :ref:`calculateGradOfCovMatrixWithDerivatives2FromGeometry`(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, std::vector<:ref:`FieldMatrixd`>& DKff, const std::vector* parameter_indices = nullptr) const; bool :ref:`applyCrossBlockGeometryToVector`(const :ref:`CrossBlockGeometry`& geometry, const Eigen::VectorXd& theta, const Eigen::VectorXd& weights, bool transpose_field, Eigen::VectorXd& out) const; void :target:`ginput2`(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff, :ref:`ExpDistArray`* out_expdist = nullptr); void :target:`ginput3`(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims1, :ref:`FieldMatrixIdx`& dims2, std::vector<:ref:`FieldMatrixd`>& DKff, :ref:`ExpDistArray`* out_expdist = nullptr, const :ref:`SharedDerivatives`* precomputed = nullptr); void :ref:`ginput4`(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff, :ref:`ExpDistArray`* out_expdist = nullptr); void :ref:`predictMeanAlphaK`(const :ref:`Coord`& x_train, const :ref:`Coord`& x_test, const Eigen::Ref& alpha_E, const Eigen::Ref& alpha_G_flat, Eigen::Ref mu_E_out, Eigen::Ref> mu_G_out); bool :target:`prepareAlphaK`(const :ref:`Coord`& x_train, const Eigen::Ref& alpha_E, const Eigen::Ref& alpha_G_flat, :ref:`PreparedAlphaK`& prepared) const; void :target:`predictMeanAlphaKPrepared`(const :ref:`PreparedAlphaK`& prepared, const :ref:`Coord`& x_test, Eigen::Ref mu_E_out, Eigen::Ref> mu_G_out) const; void :ref:`trainingGradientAlphaK`(const :ref:`Coord`& x_train, const Eigen::Ref& alpha_E, const Eigen::Ref& alpha_G_flat, Eigen::Ref quad_out, bool distributed = false, std::size_t* local_pair_count = nullptr, const :ref:`linalg::MpiContext`* process_group = nullptr); void :target:`setMagnSigma2`(double value); void :target:`setLengthScale`(double value); void :ref:`setFarFieldRadius`(double radius); double :target:`farFieldRadius`() const; void :ref:`setManifoldChart`(std::shared_ptr`> chart, double length_scale); void :target:`clearManifoldChart`(); bool :target:`usesManifoldChart`() const; const std::shared_ptr`>& :target:`manifoldChart`() const; Eigen::Index :target:`manifoldDimensions`() const; :ref:`FieldMatrixd` :target:`manifoldJointEnergyGradientCovariance`(const :ref:`Coord`& positions) const; :ref:`FieldMatrixd` :target:`manifoldJointEnergyGradientCrossCovariance`(const :ref:`Coord`& left_positions, const :ref:`Coord`& right_positions) const; void :target:`resetManifoldGeometryRowsEvaluatedForTesting`() const; void :target:`addManifoldGeometryRowsEvaluatedForTesting`(Eigen::Index left_rows, Eigen::Index right_rows) const; std::size_t :target:`manifoldGeometryRowsEvaluatedForTesting`() const; void :ref:`setGeodesicHeatReferencePath`(const :ref:`Coord`& reference_path, double covariance_weight); void :ref:`setGeodesicHeatKernel`(std::shared_ptr`> kernel); const std::shared_ptr`>& :target:`geodesicHeatKernel`() const; void :ref:`rescaleGeodesicHeatCovariance`(double factor); void :target:`clearGeodesicHeatKernel`(); bool :target:`usesGeodesicHeatKernel`() const; Eigen::Index :target:`geodesicHeatDimensions`() const; :ref:`FieldMatrixd` :target:`geodesicHeatJointEnergyGradientCovariance`(const :ref:`Coord`& positions) const; :ref:`FieldMatrixd` :target:`geodesicHeatJointEnergyGradientCrossCovariance`(const :ref:`Coord`& left_positions, const :ref:`Coord`& right_positions) const; void :target:`setConfInfo`(const :ref:`AtomsConfiguration`& value); const :ref:`AtomsConfiguration`& :target:`getConfInfo`() const; void :ref:`setParameters`(const Eigen::VectorXd& w); double :target:`getMagnSigma2`(); double :target:`getMagnSigma2`() const; :ref:`FieldMatrixd`& :target:`getLengthScaleRef`(); const :ref:`FieldMatrixd`& :target:`getLengthScaleRef`() const; :ref:`FieldMatrixd`& :ref:`getAtomisticLengthScaleRef`(); const :ref:`FieldMatrixd`& :target:`getAtomisticLengthScaleRef`() const; std::shared_ptr`> :ref:`assembledOperator`() const; void :target:`clear`(); void :target:`setPriorParametersGaussian`(const :ref:`PriorBase`& prior); void :target:`setPriorParametersSqrtt`(const :ref:`PriorBase`& prior); void :ref:`setPriorParametersLogNormal`(const :ref:`PriorBase`& prior); :ref:`PriorBase` :target:`getPriorParametersGaussian`(); :ref:`PriorBase` :target:`getPriorParametersSqrtt`(); :ref:`PriorBase` :target:`getPriorParametersLogNormal`(); void :ref:`setUseLogNormalMagnPrior`(bool enabled); bool :target:`useLogNormalMagnPrior`() const; void :target:`setModelProfile`(:ref:`GPModelProfile` profile); :ref:`GPModelProfile` :target:`getModelProfile`() const; void :ref:`setLengthScalePriorWeights`(const Eigen::VectorXd& weights); const Eigen::VectorXd& :target:`lengthScalePriorWeights`() const; void :target:`setHierarchicalPrior`(const Eigen::VectorXd& mu_log, double s2_log); void :ref:`setHierarchicalPrior`(const Eigen::VectorXd& mu_log, double s2_log, const Eigen::VectorXd& s2_log_per); const Eigen::VectorXd& :target:`hierarchicalPriorMu`() const; void :ref:`setHierarchicalAnchorMask`(std::vector mask); bool :target:`hierarchicalAnchored`(Eigen::Index n) const; double :ref:`hierarchicalPriorVariance`(Eigen::Index n) const; void :ref:`clearHierarchicalPrior`(); void :ref:`setPcLengthScalePrior`(const Eigen::VectorXd& lambda); void :target:`clearPcLengthScalePrior`(); bool :target:`hasHierarchicalPrior`() const; bool :target:`hasPcLengthScalePrior`() const; :ref:`PriorState` :target:`priorState`() const; void :target:`restorePriorState`(:ref:`PriorState` state); Eigen::VectorXd :ref:`combineParameters`(); double :ref:`calculateDirectionalLogPriorCurvature`(const Eigen::VectorXd& direction) const; void :ref:`cacheDistances`(const :ref:`Coord`& x1, const :ref:`Coord`& x2); void :ref:`clearDistanceCache`(); bool :target:`hasDistanceCache`() const; }; .. _details-classgpr_1_1_sexpat_c_f: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Pair-type inverse-distance squared-exponential primitive. Geodesic add is assembled as Sum(Sexpat, GeodesicHeat). Manifold dispatch is assembled as Pullback(SE, chart). A geodesic summand can augment either base; chart and pair-metric length scales are independent. Typedefs -------- .. index:: pair: typedef; ExpDistArray .. _doxid-classgpr_1_1_sexpat_c_f_1ae9e0fa4b49fbada4b7435abd07442273: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef Eigen::Array ExpDistArray Calculates covariances between the derivatives. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x1 - Matrix of coordinates * - x2 - Matrix of coordinates * - dims - Coordinate-dimension indices for the derivative covariance. * - DKff - Output derivative-covariance blocks. * - out_expdist - Optional output array of the shared exponential distance factors. Row-major array of exp(-0.5 \* d^2), the shared squared-exponential factor. ginput2 and ginput3 both build one; the out-parameter below hands it to a caller that would otherwise recompute the same transcendental over the same distances. .. index:: pair: typedef; SharedDerivatives .. _doxid-classgpr_1_1_sexpat_c_f_1ab51bdca39ef7cb596b275b8e3ec927a6: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef :ref:`Derivatives``>> SharedDerivatives Evaluate gradient of covariance function with respect to both input variables x1 and x2 (in different dimensions). This function takes a covariance function structure GPCF, a matrix X of input vectors and returns DKff, the gradients of twice derivatived covariance matrix K(df,df) = dk(X1,X2)/dX1dX2 (cell array with matrix elements). The derivative is calculated in multidimensional problem between input's observation dimensions which are not same. This subfunction is needed when using derivative observations. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x1 - Configurations supplying the first covariance argument. * - x2 - Configurations supplying the second covariance argument. * - dims1 - Coordinate-dimension indices differentiated in ``x1``. * - dims2 - Coordinate-dimension indices differentiated in ``x2``. * - DKff - Output second-derivative covariance blocks. Optional precomputed D1/D2/D12 for ginput3. Its caller calculateGradOfCovMatrixWithDerivatives2 asks calculateDerivativesDiffDim for a superset of the same fields over the same inputs, and the direction argument that appears to distinguish the two calls is unread (``Gradient.cpp``), so the shared part is identical. Passing it in lets the pair be computed once. Methods ------- .. index:: pair: function; calculateLogPrior .. _doxid-classgpr_1_1_sexpat_c_f_1ae89f6c7d905989ef734857d93c110fd9: .. ref-code-block:: cpp :class: doxyrest-title-code-block double calculateLogPrior() Evaluate the log prior density of the parameters. This function takes a covariance function structure GPCF and returns log(p(th)), where th collects the parameters. This is a mandatory subfunction used for example in energy computations. Evaluate the prior contribution to the error. The parameters that are sampled are transformed, e.g., W = log(w) where w is all the "real" samples. On the other hand errors are evaluated in the W-space so we need take into account also the Jacobian of transformation, e.g., W -> w = exp(W). See Gelman et al. (2013), Bayesian Data Analysis, third edition, p. 21. .. index:: pair: function; calculateLogPriorGradient .. _doxid-classgpr_1_1_sexpat_c_f_1a751a5e0e729351dbdc4582210baf8bcd: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`FieldMatrixd` calculateLogPriorGradient() Evaluate the gradient of the log prior density of the parameters with respect to parameters. This function takes a covariance function structure GPCF and returns LPG = d log (p(th))/dth, where th is the vector of parameters. This is a mandatory subfunction used in gradient computations. .. index:: pair: function; calculateCovarianceMatrix .. _doxid-classgpr_1_1_sexpat_c_f_1ab97025e0f34829188ed6f73cd4eeff68: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateCovarianceMatrix(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixd`& C) Evaluate covariance matrix between two input vectors. The function takes in covariance function of a Gaussian process GP and two matrixes TX and X that contain input vectors to GP. Returns covariance matrix C. Every element ij of C contains covariance between inputs i in TX and j in X. This is a mandatory subfunction used for example in prediction and energy computations. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x1 - Input configurations supplying the rows of the covariance. * - x2 - Input configurations supplying the columns of the covariance. * - C - Output covariance matrix between ``x1`` and ``x2``. .. index:: pair: function; correlationDistances .. _doxid-classgpr_1_1_sexpat_c_f_1a6211c9484e62159e6bd5c9de283dac05: .. ref-code-block:: cpp :class: doxyrest-title-code-block void correlationDistances(const :ref:`Coord`& left, const :ref:`Coord`& right, const :ref:`AtomsConfiguration`& configuration, :ref:`FieldMatrixd`& distances) const Dimensionless support scores from the selected prediction covariance. A score of one corresponds to normalized energy covariance exp(-1/2). Nonpositive composed covariance gives an infinite score. .. index:: pair: function; calculateTrainingCovarianceMatrix .. _doxid-classgpr_1_1_sexpat_c_f_1a7d2e67bca443d493704413caf190de49: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateTrainingCovarianceMatrix(const :ref:`Coord`& x, :ref:`FieldMatrixd`& C) Evaluate the prior variance for each training input. Function takes in covariance function of a Gaussian process GPCF and matrix TX that contains training inputs. Returns variance vector C. Every element i of C contains variance of input i in TX. This is a mandatory subfunction used for example in prediction and energy computations. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - Input configurations whose prior variances are evaluated. * - C - Output column vector of prior variances, one per configuration. .. index:: pair: function; calculateGradOfCovMatrix .. _doxid-classgpr_1_1_sexpat_c_f_1a54aa5f9172fe73c79c8e78dea93dfe58: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateGradOfCovMatrix(const :ref:`Coord`& x1, :ref:`Coord`& x2, std::vector<:ref:`FieldMatrixd`>& DKff) Evaluate gradient of covariance function with respect to the parameters. The function takes a covariance function structure GPCF, a matrix X of input vectors and returns DKff, the gradients of covariance matrix Kff = k(X,X) with respect to th (cell array with matrix elements). This is a mandatory subfunction used for example in gradient computations. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x1 - Input configurations for the first covariance argument. * - x2 - Input configurations for the second covariance argument. * - DKff - Output covariance-matrix gradients with respect to the covariance hyperparameters. .. index:: pair: function; calculateGradOfCovMatrixWithDerivatives .. _doxid-classgpr_1_1_sexpat_c_f_1ae29e29885b8a4a54f62a4c637ef69c4f: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateGradOfCovMatrixWithDerivatives(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff) Evaluate gradient of covariance function, of which has been taken partial derivative with respect to x1, with respect to parameters. The function takes a covariance function structure GPCF, a matrix X of input vectors and returns DKff, the gradients of derivatived covariance matrix dK(df,f)/dhyp = d(d k(X,X)/dx)/dhyp, with respect to the parameters. Evaluate: DKff{1:m} = d Kff / d magnSigma2 DKff{m+1:2m} = d Kff / d lengthScale_m m is the dimension of inputs. If ARD is used, then multiple lengthScales. This subfunction is needed when using derivative observations. dims - is a vector of input dimensions with respect to which the derivatives of the covariance function have been calculated [by default dims=1:size(x,2)] Note! When coding the derivatives of the covariance function, remember to double check them. See gp_cov for lines of code to check the matrices .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x1 - Configurations supplying the first covariance argument. * - x2 - Configurations supplying the second covariance argument. * - dims - Coordinate-dimension indices of the derivative observations. * - DKff - Output covariance-derivative blocks for each hyperparameter. .. index:: pair: function; calculateGradOfCovMatrixWithDerivatives2 .. _doxid-classgpr_1_1_sexpat_c_f_1ac1084172f4bcf253e1f2f87c8b1be5fb: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateGradOfCovMatrixWithDerivatives2(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims1, :ref:`FieldMatrixIdx`& dims2, std::vector<:ref:`FieldMatrixd`>& DKff) Evaluate gradient of covariance function, of which has been taken partial derivatives with respect to both input variables x1 and x2 with respect to parameters. The function takes a covariance function structure GPCF, a matrix X of input vectors and returns DKff, the gradients of derivative covariance matrix dK(df,df)/dhyp = d(d^2 k(X1,X2)/dX1dX2)/dhyp with respect to the parameters. Evaluate: DKff{1-m} = d Kff / d magnSigma2 DKff{m+1-2m} = d Kff / d lengthScale_m m is the dimension of inputs. If ARD is used, then multiple lengthScales. This subfunction is needed when using derivative observations. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x1 - Configurations supplying the first covariance argument. * - x2 - Configurations supplying the second covariance argument. * - dims1 - Coordinate-dimension indices differentiated in ``x1``. * - dims2 - Coordinate-dimension indices differentiated in ``x2``. * - DKff - Output second-derivative covariance blocks for each hyperparameter. .. index:: pair: function; calculateDirectionalCovarianceMatrix .. _doxid-classgpr_1_1_sexpat_c_f_1a29bd1d5b8aa56c331ce25683d3ec6709: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateDirectionalCovarianceMatrix(const :ref:`Coord`& x1, :ref:`Coord`& x2, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) Evaluate the directional first and second derivatives of the covariance matrix along a parameter-space direction. The direction is expressed in the packed log-parameter coordinates returned by :ref:`combineParameters() `. .. index:: pair: function; calculateDirectionalCovarianceMatrixWithDerivatives .. _doxid-classgpr_1_1_sexpat_c_f_1ae2ac1c3c1df62e031c7ae1be1f15a4d1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateDirectionalCovarianceMatrixWithDerivatives(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) Evaluate directional first and second derivatives of the derivative-vs-value covariance block. .. index:: pair: function; calculateDirectionalCovarianceMatrixWithDerivatives2 .. _doxid-classgpr_1_1_sexpat_c_f_1ad60816a9c193d50e4056b9c57999f9f1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateDirectionalCovarianceMatrixWithDerivatives2(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims1, :ref:`FieldMatrixIdx`& dims2, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) Evaluate directional first and second derivatives of the derivative-vs-derivative covariance block. .. index:: pair: function; buildCrossBlockGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1a14da4d8c936e782213015087da4c90a1: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool buildCrossBlockGeometry(const :ref:`Coord`& x1, const :ref:`Coord`& x2, uint8_t derivative_options, const :ref:`FieldMatrixIdx`& dims1, const :ref:`FieldMatrixIdx`& dims2, :ref:`CrossBlockGeometry`& geometry) const Build theta-independent pairtype geometry for a covariance block. The stored fields are raw pairtype contributions. They can be evaluated at any packed :ref:`Sexpat ` log-parameter vector without re-walking atomic coordinates. .. index:: pair: function; buildCrossBlockDerivativesOnly .. _doxid-classgpr_1_1_sexpat_c_f_1abfed9c7ba1d46a77ad99eda0bd7bd159: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool buildCrossBlockDerivativesOnly(const :ref:`Coord`& x1, const :ref:`Coord`& x2, uint8_t derivative_options, const :ref:`FieldMatrixIdx`& dims1, const :ref:`FieldMatrixIdx`& dims2, :ref:`CrossBlockGeometry`& geometry) const Populate only the derivative fields (d1, d2, d12) of a :ref:`CrossBlockGeometry `, skipping the per-pairtype distance computation. Companion to buildCrossBlockGeometry for callers that already hold a shared per-pairtype distance tensor across many blocks with identical atom positions (e.g. the SCG training-cov assembly, where each (block_n, block_m) (D+1)\*N row slice contains the same coordinates with different derivative-dim tags by construction of assembleMatrixOfRepetitiveCoordinates). The shared distance must be applied at evaluate time via evaluateCrossBlockGeometryShared. .. index:: pair: function; buildSharedDistanceForTrainingGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1a5a606047f94203f6ac654a84df94807d: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool buildSharedDistanceForTrainingGeometry(const :ref:`Coord`& x_loc, std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt) const Build the per-pairtype distance tensor at unit lengthscale for a single coordinate slice (shared across all training-cov blocks). The output convention matches :ref:`CrossBlockGeometry.distance ` : shared_distance_neg_per_pt[pt] = -dist_at_vec(x_loc, x_loc, unit)[pt]. .. index:: pair: function; evaluateCrossBlockGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1ad398fc5787edecbea7639ffb7a84a670: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool evaluateCrossBlockGeometry(const :ref:`CrossBlockGeometry`& geometry, const Eigen::VectorXd& theta, :ref:`FieldMatrixd`& out) const Evaluate a cross-block geometry at packed :ref:`Sexpat ` log parameters. .. index:: pair: function; evaluateCrossBlockGeometryShared .. _doxid-classgpr_1_1_sexpat_c_f_1a36326ff3344425fb834cfca272906433: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool evaluateCrossBlockGeometryShared(const :ref:`CrossBlockGeometry`& geometry, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, :ref:`FieldMatrixd`& out) const Same as evaluateCrossBlockGeometry but reads the per-pairtype distance from an externally-shared tensor (negated, matching the sign convention of buildCrossBlockGeometry). The supplied geometry's .distance field is ignored; .d1, .d2, .d12 are still consulted. Used together with buildCrossBlockDerivativesOnly to skip 946-fold redundant dist_at_vec calls in the SCG training-cov assembly when all (block_n, block_m) blocks share the same atom positions. .. index:: pair: function; buildSharedKernel .. _doxid-classgpr_1_1_sexpat_c_f_1aea0e1456c1bccd090c3c1199260447a9: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool buildSharedKernel(const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, :ref:`FieldMatrixd`& kernel_out) const Apply theta to a shared distance to produce the kernel value K(theta)[n, m] = exp(theta(0)) \* exp(-0.5 \* sum_pt exp(-2 theta(1+pt)). * (-shared_distance_neg[pt][n, m])). Pre-computed once per inner iter and reused by per-block apply. .. index:: pair: function; evaluateCrossBlockGeometryWithSharedKernel .. _doxid-classgpr_1_1_sexpat_c_f_1abe98d6e96b5f6b999f5a2afd52b11202: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool evaluateCrossBlockGeometryWithSharedKernel(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const Eigen::VectorXd& theta, :ref:`FieldMatrixd`& out) const Evaluate a derivative-only block against a pre-computed shared kernel matrix (from buildSharedKernel). No exp() per call. .. index:: pair: function; calculateDirectionalCovarianceMatrixFromGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1a880a7ddf9e4cec036292d6ed8f3a156c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool calculateDirectionalCovarianceMatrixFromGeometry(const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) const Directional first and second derivatives for the Kff block from shared training geometry. .. index:: pair: function; calculateDirectionalCovarianceMatrixWithDerivativesFromGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1a4f4d7ec07752a513e8d31bd18a4ced55: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool calculateDirectionalCovarianceMatrixWithDerivativesFromGeometry(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) const Directional first and second derivatives for a Kdf block from shared training geometry. .. index:: pair: function; calculateDirectionalCovarianceMatrixWithDerivatives2FromGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1a1cf534ffdfb9485c4300ade4579ff11c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool calculateDirectionalCovarianceMatrixWithDerivatives2FromGeometry(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, const Eigen::VectorXd& direction, :ref:`FieldMatrixd`& first, :ref:`FieldMatrixd`& second) const Directional first and second derivatives for a D/Kdf2 block from shared training geometry. .. index:: pair: function; calculateGradOfCovMatrixFromGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1a01de915b81d36ebe5b0f95cba13d893b: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool calculateGradOfCovMatrixFromGeometry(const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, std::vector<:ref:`FieldMatrixd`>& DKff, const std::vector* parameter_indices = nullptr) const Geometry-path replacement for calculateGradOfCovMatrix. Produces DKff[0] = K (untruncated kernel), DKff[1+pt] = K \* inv_l_pt^2 \* shared_distance_neg[pt] (== -K \* dist_pt_actual in the legacy negated sign convention). Scalar-length case collapses to a single DKff[1] entry that sums across pairtypes. An optional nonempty parameter list selects output blocks in the given order. All parameters still contribute to the kernel and its Cartesian derivatives; only the requested hyperparameter derivatives are formed. .. index:: pair: function; calculateGradOfCovMatrixWithDerivativesFromGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1a0bdea73e3e2d97037a9c9369ab232b5a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool calculateGradOfCovMatrixWithDerivativesFromGeometry(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, std::vector<:ref:`FieldMatrixd`>& DKff, const std::vector* parameter_indices = nullptr) const Geometry-path replacement for calculateGradOfCovMatrixWithDerivatives (Kdf block dK). The Kdf block geometry (built once at unit lengthscale and stored in ``geometry`` with derivative_options=D1) gives the per-pairtype d1 fields. DKff[0] = Kdf(theta) (== evaluateCrossBlockGeometryWithSharedKernel with options=D1). DKff[1+pt] is dKdf/dloglength_pt; the algebra matches the live calculateGradOfCovMatrixWithDerivatives (DK_pt[pt] = magnSigma2 \* exp \* (-D1_pt[pt] + 0.5 \* D1[n] \* dist_pt[pt])) with D1_pt being the per-pairtype gradient at unit lengthscale and D1 being the lengthscale-weighted sum across pairtypes. .. index:: pair: function; calculateGradOfCovMatrixWithDerivatives2FromGeometry .. _doxid-classgpr_1_1_sexpat_c_f_1a257c0a06e8b9650f17e414b566db652c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool calculateGradOfCovMatrixWithDerivatives2FromGeometry(const :ref:`CrossBlockGeometry`& geometry, const :ref:`FieldMatrixd`& shared_kernel, const std::vector<:ref:`FieldMatrixd`>& shared_distance_neg_per_pt, const Eigen::VectorXd& theta, std::vector<:ref:`FieldMatrixd`>& DKff, const std::vector* parameter_indices = nullptr) const Geometry-path replacement for calculateGradOfCovMatrixWithDerivatives2 (D and Kdf2 blocks). Same shape as the original: DKff[0] is the block value at theta (== evaluateCrossBlockGeometryWithSharedKernel options=D1|D2|D12), DKff[1+pt] is the derivative wrt loglength_pt. .. index:: pair: function; applyCrossBlockGeometryToVector .. _doxid-classgpr_1_1_sexpat_c_f_1aa6a154d4d504c52535cbc0bdea393925: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool applyCrossBlockGeometryToVector(const :ref:`CrossBlockGeometry`& geometry, const Eigen::VectorXd& theta, const Eigen::VectorXd& weights, bool transpose_field, Eigen::VectorXd& out) const Apply a cross-block geometry directly to a vector. When ``transpose_field`` is false, computes out = A(theta)^T \* weights. When it is true, computes out = A(theta) \* weights. .. index:: pair: function; ginput4 .. _doxid-classgpr_1_1_sexpat_c_f_1aa96ea46432b08f512414c87f4bcb5bed: .. ref-code-block:: cpp :class: doxyrest-title-code-block void ginput4(const :ref:`Coord`& x1, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff, :ref:`ExpDistArray`* out_expdist = nullptr) Evaluate gradient of covariance function with respect to x. Simplified and faster version of sexp_ginput, returns full matrices. Returns DKff, the gradients of covariance matrix Kff = k(X,X2) with respect to dimensions DIMS of X. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x1 - Configurations supplying the first covariance argument. * - x2 - Configurations supplying the second covariance argument. * - dims - Coordinate-dimension indices differentiated in ``x1``. * - DKff - Output covariance-derivative blocks. * - out_expdist - Optional output array of the shared exponential distance factors. .. index:: pair: function; predictMeanAlphaK .. _doxid-classgpr_1_1_sexpat_c_f_1aa407ec0f6cdac72afed8c182b75c47f2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void predictMeanAlphaK(const :ref:`Coord`& x_train, const :ref:`Coord`& x_test, const Eigen::Ref& alpha_E, const Eigen::Ref& alpha_G_flat, Eigen::Ref mu_E_out, Eigen::Ref> mu_G_out) Per-test-point predict mean (energy + gradient) via the Schmitz/Chmiela JPCL 2022 eq.6 alpha-K early contraction applied at the per-pair level. For each test point m, accumulates into mu_E_out[m] and mu_G_out(m, beta) the SexpAt contribution to predict mean: mu_E[m] += Sum_i alpha_E[i] \* k(x_i, x_m) * Sum_i Sum_d alpha_G[i, d] \* dk/dx_i^d mu_G[m, beta] += Sum_i alpha_E[i] \* dk/dx_m^beta * Sum_i Sum_d alpha_G[i, d] \* d^2k/(dx_i^d dx_m^beta) Cost: O(num_train \* n_pairs) per test point instead of the O(num_train \* num_test \* D^2) of the legacy per-(d1, d2) loop. alpha_G_flat layout matches the existing accumulator's ``weights`` vector: alpha_G_flat[d \* num_train + i] is the gradient alpha for training point i, atomic-coord dim d (1-based d, i.e. uDdim[k] for k in 0..D-1; entries at d=0 are alpha_E and live separately in alpha_E). Outputs are ACCUMULATED in place (callers zero them first). RowMajor mu_G_out keeps the layout consistent with image1.G in calculatePotential. Math notes: * Per pair p in a pairtype, the per-pair gradient du_p/dx_alpha is nonzero on only 6 atomic-coord slots (3 per atom in the pair; 3 for moving-frozen pairs). * The D12 fold collapses to a per-pair scalar c_i_p = :ref:`Sum ` over 6 x-slots of alpha_G[i, d] \* du_p/dx_i^d, verified rank-1 per pair by python/tests/test_sympy_alpha_k_d12.py. * Convention: dist returned by dist_at_cached_sq is 2 \* Sum_p (1/l_p^2) \* (u_p_i - v_p_m)^2; k = magn \* exp(-0.5 \* dist). .. index:: pair: function; trainingGradientAlphaK .. _doxid-classgpr_1_1_sexpat_c_f_1a7923ea78e56f6a12c99098288fda8001: .. ref-code-block:: cpp :class: doxyrest-title-code-block void trainingGradientAlphaK(const :ref:`Coord`& x_train, const Eigen::Ref& alpha_E, const Eigen::Ref& alpha_G_flat, Eigen::Ref quad_out, bool distributed = false, std::size_t* local_pair_count = nullptr, const :ref:`linalg::MpiContext`* process_group = nullptr) Accumulate joint energy/force quadratic derivatives. Distributed execution is collective; local calls do not enter MPI. The optional count reports the unique training pairs evaluated by this rank. .. index:: pair: function; setFarFieldRadius .. _doxid-classgpr_1_1_sexpat_c_f_1a309e5a9c409ab27bd7635205c6a82f58: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setFarFieldRadius(double radius) Frozen atoms at or beyond radius use the dipole tensor. Zero keeps the exact inverse-distance pairs. .. index:: pair: function; setManifoldChart .. _doxid-classgpr_1_1_sexpat_c_f_1acd4dd97677707c9d92c7632d4994c49c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setManifoldChart(std::shared_ptr`> chart, double length_scale) Attach a chart so assembly can wrap this primitive as Pullback(SE, chart). :ref:`Sexpat ` itself stays the inverse-distance kernel. .. index:: pair: function; setGeodesicHeatReferencePath .. _doxid-classgpr_1_1_sexpat_c_f_1afa031f8c909fcf800168a8fd8a9279b4: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setGeodesicHeatReferencePath(const :ref:`Coord`& reference_path, double covariance_weight) Attach a geodesic heat summand to the selected pair or chart base. A zero covariance weight disables it. .. index:: pair: function; setGeodesicHeatKernel .. _doxid-classgpr_1_1_sexpat_c_f_1a4f7e63cb87fd80459c8a7f3b26d3195e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setGeodesicHeatKernel(std::shared_ptr`> kernel) Attach an immutable heat component with its own reference and metric. .. index:: pair: function; rescaleGeodesicHeatCovariance .. _doxid-classgpr_1_1_sexpat_c_f_1ac459ce7191421add5905a02086c46894: .. ref-code-block:: cpp :class: doxyrest-title-code-block void rescaleGeodesicHeatCovariance(double factor) Convert the additive component to a different output variance unit. .. index:: pair: function; setParameters .. _doxid-classgpr_1_1_sexpat_c_f_1a083fc9925fdd795ac712b2ca39550fa1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setParameters(const Eigen::VectorXd& w) Set parameters of *this* covariance function using the provided vector. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - w - Vector of combined parameters from covariance functions and likelyhood .. index:: pair: function; getAtomisticLengthScaleRef .. _doxid-classgpr_1_1_sexpat_c_f_1a0352f97ae8ad6b5baa84326700fba2cc: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`FieldMatrixd`& getAtomisticLengthScaleRef() Pair-type metric retained independently of the chart's fitted length. .. index:: pair: function; assembledOperator .. _doxid-classgpr_1_1_sexpat_c_f_1a9044fd8199d21170ccfa0608947b3483: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::shared_ptr`> assembledOperator() const The configured base and optional additive heat component. .. index:: pair: function; setPriorParametersLogNormal .. _doxid-classgpr_1_1_sexpat_c_f_1ab450ad269c3b002dbc5d29c3c9c7397d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setPriorParametersLogNormal(const :ref:`PriorBase`& prior) Parameters of the optional log-normal prior on magnSigma2. Inactive until setUseLogNormalMagnPrior(true). .. index:: pair: function; setUseLogNormalMagnPrior .. _doxid-classgpr_1_1_sexpat_c_f_1a2f32262e1e70513cbb45bc4a3b8756f5: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setUseLogNormalMagnPrior(bool enabled) Opt-in log-normal prior on the positive signal variance magnSigma2. Off (the default) keeps the half-Student-t magnitude prior on classic profiles and the half-Cauchy magnitude prior in the MAP objective. .. index:: pair: function; setLengthScalePriorWeights .. _doxid-classgpr_1_1_sexpat_c_f_1aae1fb69cfec8a5360e1e768e1b58ba40: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setLengthScalePriorWeights(const Eigen::VectorXd& weights) Enable a hierarchical-Bayes Gaussian prior on the *log-space* kernel parameters: ~log(theta_i) ~ N(mu_log, s2_log \* I)~ where ~mu_log~ is the packed log-parameter target (~[log(magnSigma2), log(lengthScale[0]), ..., log(lengthScale[K-1])]~, same layout as ~combineParameters()~) and ~s2_log~ is the shared variance. When enabled, ~calculateLogPrior~ / ~calculateLogPriorGradient~ use this hierarchical density instead of the global-GP zero-prior branch. The density operates in log-space directly, so no linear-to-log Jacobian terms are added (the SCG optimiser already runs on the packed log-parameters returned by ~combineParameters~). Per-image GP fits use ~mu_log = theta_global~ from the session GP's MAP and a shared ~s2_log = tau^2~ regulariser that pulls per-image ~theta_i~ back toward the global MAP when the per-image data set is small. Per-length-scale weights of the prior terms; empty restores one prior per length scale. .. index:: pair: function; setHierarchicalPrior .. _doxid-classgpr_1_1_sexpat_c_f_1a9be1834c136d4549b5a3f0e123250cc2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setHierarchicalPrior(const Eigen::VectorXd& mu_log, double s2_log, const Eigen::VectorXd& s2_log_per) The same prior with a variance per packed parameter (the shared ~s2_log~ where an entry is not positive): the population prior of a pair type sets its own width. .. index:: pair: function; setHierarchicalAnchorMask .. _doxid-classgpr_1_1_sexpat_c_f_1ab4eae01dfc99c12dfcfad3f4be20046e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setHierarchicalAnchorMask(std::vector mask) Length scales (index into the length-scale block) the population prior anchors: under the classic joint energy/force prior of the gprd profiles these take the per-type log-Gaussian in place of the classic term; the others keep the classic term. .. index:: pair: function; hierarchicalPriorVariance .. _doxid-classgpr_1_1_sexpat_c_f_1a56e5f81e53f8746111acc4433b5543a5: .. ref-code-block:: cpp :class: doxyrest-title-code-block double hierarchicalPriorVariance(Eigen::Index n) const Variance of packed parameter ~n~ under the hierarchical prior. .. index:: pair: function; clearHierarchicalPrior .. _doxid-classgpr_1_1_sexpat_c_f_1a9c8d3270029392f014fb73e573ba0b86: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clearHierarchicalPrior() Disable the hierarchical prior set via ~setHierarchicalPrior~. Restores the global-GP zero-prior branch. .. index:: pair: function; setPcLengthScalePrior .. _doxid-classgpr_1_1_sexpat_c_f_1a3c3b56835130ba9f569eb6e27a1ff01e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setPcLengthScalePrior(const Eigen::VectorXd& lambda) Penalized-Complexity length-scale prior for the global GP. ``lambda`` is the per-pairtype PC rate (lambda_k = -rho0_k \* ln(alpha)); element k applies to lengthScale[k]. magnSigma2 is left unpenalised. .. index:: pair: function; combineParameters .. _doxid-classgpr_1_1_sexpat_c_f_1a78f6fb10fb921f50e980a636f671ed8d: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd combineParameters() Combine parameters of the covariance function into one :ref:`Eigen ` vector. .. index:: pair: function; calculateDirectionalLogPriorCurvature .. _doxid-classgpr_1_1_sexpat_c_f_1a4b256ea5254b162823d91fbd233a3510: .. ref-code-block:: cpp :class: doxyrest-title-code-block double calculateDirectionalLogPriorCurvature(const Eigen::VectorXd& direction) const Evaluate the second directional derivative of log p(theta) along the packed log-parameter direction. .. index:: pair: function; cacheDistances .. _doxid-classgpr_1_1_sexpat_c_f_1a5f8c83f23dda083b4ecfb3edca61ef45: .. ref-code-block:: cpp :class: doxyrest-title-code-block void cacheDistances(const :ref:`Coord`& x1, const :ref:`Coord`& x2) Pre-compute and cache inverse distances for the given positions. Call once before an optimization loop. Subsequent covariance matrix evaluations will use the cached 1/r values, avoiding redundant coordinate extractions and norm computations. .. index:: pair: function; clearDistanceCache .. _doxid-classgpr_1_1_sexpat_c_f_1afc7faf34961c67f1151fc008fcebec43: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clearDistanceCache() Invalidate the distance cache. Call when positions change (e.g. after optimization completes and new observations are added).