.. index:: pair: class; gpr::ConstantCF .. _doxid-classgpr_1_1_constant_c_f: class gpr::ConstantCF ===================== .. toctree:: :hidden: Overview ~~~~~~~~ Constant covariance function. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class ConstantCF { public: // construction :target:`ConstantCF`(); :target:`~ConstantCF`(); // methods double :ref:`calculateLogPrior`(); :ref:`FieldMatrixd` :ref:`calculateLogPriorGradient`(); void :ref:`calculateGradOfCovMatrix`(const :ref:`Coord`& x, :ref:`Coord`& x2, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`calculateGradOfCovMatrixWithDerivatives`(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`calculateGradOfCovMatrixWithDerivatives2`(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims1, :ref:`FieldMatrixIdx`& dims2, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`ginput2`(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`ginput3`(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims1, :ref:`FieldMatrixIdx`& dims2, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`ginput4`(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff); void :ref:`calculateCovarianceMatrix`(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixd`& C); void :ref:`setConstSigma2`(const double _constSigma2); void :ref:`setParameters`(const Eigen::VectorXd& w); double :target:`getConstSigma2`(); double :target:`getConstSigma2`() const; Eigen::VectorXd :ref:`combineParameters`(); }; .. _details-classgpr_1_1_constant_c_f: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Constant covariance function. Methods ------- .. index:: pair: function; calculateLogPrior .. _doxid-classgpr_1_1_constant_c_f_1a523ee5428b668f72b06c7ea24efa38e6: .. ref-code-block:: cpp :class: doxyrest-title-code-block double calculateLogPrior() Evaluate the log prior of covariance function parameters. .. rubric:: Returns: Result .. index:: pair: function; calculateLogPriorGradient .. _doxid-classgpr_1_1_constant_c_f_1a5a8afc1942b4affb6f412dc2fe1fa90a: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`FieldMatrixd` calculateLogPriorGradient() Evaluate gradient of the log prior with respect to the parameters. .. rubric:: Returns: Result .. index:: pair: function; calculateGradOfCovMatrix .. _doxid-classgpr_1_1_constant_c_f_1a1e049dd7b26cb6da4fd34b4370aee8fd: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateGradOfCovMatrix(const :ref:`Coord`& x, :ref:`Coord`& x2, std::vector<:ref:`FieldMatrixd`>& DKff) The function takes a matrix x of input vectors and returns DKff, the gradients of covariance matrix Kff = k(X,X2) with respect to th (cell array with matrix elements). This is a mandatory subfunction used in gradient computations. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - Configurations for the first covariance argument. * - x2 - Configurations for the second covariance argument. * - DKff - Output covariance-matrix derivatives with respect to the covariance hyperparameters. .. index:: pair: function; calculateGradOfCovMatrixWithDerivatives .. _doxid-classgpr_1_1_constant_c_f_1aff175a076a95b43fffa3ea621c4ed69c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateGradOfCovMatrixWithDerivatives(const :ref:`Coord`& x, :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 x, with respect to parameters. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - Configurations for the first covariance argument. * - x2 - Configurations for the second covariance argument. * - dims - Coordinate-dimension indices for the derivative observations. * - DKff - Output derivative-covariance blocks differentiated with respect to the covariance hyperparameters. .. index:: pair: function; calculateGradOfCovMatrixWithDerivatives2 .. _doxid-classgpr_1_1_constant_c_f_1a7be7d88c7376a977433d7acc0cf2996f: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateGradOfCovMatrixWithDerivatives2(const :ref:`Coord`& x, :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 x, with respect to parameters. 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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - Configurations for the first covariance argument. * - x2 - Configurations for the second covariance argument. * - dims1 - Coordinate-dimension indices for derivatives with respect to the first input. * - dims2 - Coordinate-dimension indices for derivatives with respect to the second input. * - DKff - Output second-derivative covariance blocks differentiated with respect to the covariance hyperparameters. .. index:: pair: function; ginput2 .. _doxid-classgpr_1_1_constant_c_f_1a7b2be875f5488c24f29ee44d88adf4de: .. ref-code-block:: cpp :class: doxyrest-title-code-block void ginput2(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff) Evaluate gradient of covariance function with respect to both input variables x and x2 (in same dimension). Returns DKff, the gradients of twice derivatived covariance matrix K(df,df) = dk(X1,X2)/dX1dX2 (cell array with matrix elements). Input variable's dimensions are expected to be same. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - Configurations for the first covariance argument. * - x2 - Configurations for the second covariance argument. * - dims - Coordinate-dimension indices for derivative observations. * - DKff - Output second-derivative covariance blocks. .. index:: pair: function; ginput3 .. _doxid-classgpr_1_1_constant_c_f_1ac8edb564d958ad7ec0f4a0b6f14f642d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void ginput3(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims1, :ref:`FieldMatrixIdx`& dims2, std::vector<:ref:`FieldMatrixd`>& DKff) Evaluate gradient of covariance function with respect to both input variables x and x2 (in different dimensions). DKff = GPCF_CONSTANT_GINPUT3(GPCF, X, X2) 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 * - x - Configurations for the first covariance argument. * - x2 - Configurations for the second covariance argument. * - dims1 - Coordinate-dimension indices for derivatives with respect to the first input. * - dims2 - Coordinate-dimension indices for derivatives with respect to the second input. * - DKff - Output second-derivative covariance blocks. .. index:: pair: function; ginput4 .. _doxid-classgpr_1_1_constant_c_f_1aec5247b29e55a1c468a55170e8bd2f38: .. ref-code-block:: cpp :class: doxyrest-title-code-block void ginput4(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixIdx`& dims, std::vector<:ref:`FieldMatrixd`>& DKff) Evaluate gradient of covariance function with respect to x. Simplified and faster version of constant_ginput, returns full matrices. Returns DKff, the gradients of covariance matrix Kff = k(X,X2) with respect to X (whole matrix). This function is needed when using derivative observations. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - x - Configurations for the first covariance argument. * - x2 - Configurations for the second covariance argument. * - dims - Coordinate-dimension indices for derivatives with respect to the first input. * - DKff - Output covariance-derivative blocks. .. index:: pair: function; calculateCovarianceMatrix .. _doxid-classgpr_1_1_constant_c_f_1aa5ce7ccbfff425812bedd2b936bcb6e8: .. ref-code-block:: cpp :class: doxyrest-title-code-block void calculateCovarianceMatrix(const :ref:`Coord`& x, :ref:`Coord`& x2, :ref:`FieldMatrixd`& C) Evaluate covariance matrix between two input vectors. C = GP_CONSTANT_COV(GP, TX, X) 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 * - x - Configurations supplying the rows of the covariance matrix. * - x2 - Configurations supplying the columns of the covariance matrix. * - C - Output covariance matrix between ``x`` and ``x2``. .. index:: pair: function; setConstSigma2 .. _doxid-classgpr_1_1_constant_c_f_1ac593b237f492c1bef3576a29d2f7bbce: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setConstSigma2(const double _constSigma2) Set the constSigma2 value. .. index:: pair: function; setParameters .. _doxid-classgpr_1_1_constant_c_f_1a2fc0608388ba77bdd6a013faeb3e589a: .. 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 hyperparameters .. index:: pair: function; combineParameters .. _doxid-classgpr_1_1_constant_c_f_1a579b9062f884c224c59c6251ec8b1107: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd combineParameters() Combine parameters of the covariance function into one :ref:`Eigen ` vector.