/** * @brief Self covariance matrix between the training data, K(X, X) or its partial derivative * @note It calls the protected general member function, * CovMaterniso::K(const Hyp, const MatrixConstPtr, const int) * which only depends on pair-wise absolute distances.\n\n * Only this function returns partial derivatives * since they are used for learning hyperparameters with training data. * @param [in] logHyp The log hyperparameters * - logHyp(0) = \f$\log(l)\f$ * - logHyp(1) = \f$\log(\sigma_f)\f$ * @param [in] trainingData The training data * @param [in] pdHypIndex (Optional) Hyperparameter index for partial derivatives * - pdHypIndex = -1: return \f$\mathbf{K}(\mathbf{X}, \mathbf{X})\f$ (default) * - pdHypIndex = 0: return \f$\frac{\partial \mathbf{K}}{\partial \log(l)}\f$ * - pdHypIndex = 1: return \f$\frac{\partial \mathbf{K}}{\partial \log(\sigma_f)}\f$ * @return An NxN matrix pointer\n * N: The number of training data */ static MatrixPtr K(const Hyp &logHyp, TrainingData<Scalar> &trainingData, const int pdHypIndex = -1) { // Assertions only in the begining of the public static member functions which can be accessed outside. // The hyparparameter index should be less than the number of hyperparameters assert(pdHypIndex < logHyp.size()); // K(r) return K(logHyp, trainingData.pAbsDistXX(), pdHypIndex); }