ForK Library

Subroutine to predict mean derivative values from Kriging Surface (requires buildkriging to be called first) More...

Go to the source code of this file.

## Functions/Subroutines

subroutine kriginggradpredict (ndim, ntot, X, stot, H, beta, V, hyper, mtot, Xm, gtotm, ptsm, dimsm, Gm, dYm, covarflagi)
Using the Kriging model, the derivative values from the Kriging model can be calculated using the covariance between derivative and function values. Due to the linearity of differentiation, the covariance between the derivative and function values is given as:

$cov(\frac{\partial y_{i}}{\partial x_{k}}, y_{j}) = \frac{\partial}{\partial x_{k}} k(\vec{x}_{i},\vec{x}_{j})$

## Detailed Description

Subroutine to predict mean derivative values from Kriging Surface (requires buildkriging to be called first)

## Function Documentation

 subroutine kriginggradpredict ( integer,intent(in) ndim, integer,intent(in) ntot, real(8),dimension(ndim,ntot),intent(in) X, integer,intent(in) stot, real(8),dimension(stot,ntot),intent(in) H, real(8),dimension(stot),intent(in) Beta, real(8),dimension(ntot),intent(in) V, real(8),dimension(ndim+2),intent(in) hyper, integer,intent(in) mtot, real(8),dimension(ndim,mtot),intent(in) Xm, integer,intent(in) gtotm, integer,dimension(gtotm),intent(in) ptsm, integer,dimension(gtotm),intent(in) dimsm, real(8),dimension(stot,gtotm),intent(in) Gm, real(8),dimension(gtotm),intent(out) dYm, integer,intent(in) covarflagi )

Using the Kriging model, the derivative values from the Kriging model can be calculated using the covariance between derivative and function values. Due to the linearity of differentiation, the covariance between the derivative and function values is given as:

$cov(\frac{\partial y_{i}}{\partial x_{k}}, y_{j}) = \frac{\partial}{\partial x_{k}} k(\vec{x}_{i},\vec{x}_{j})$

Additionally, the derivative of the regression basis can be used to predict the mean value of the derivative. Let the elements of the vector $$g_{k}(\vec{x})$$ represent the derivatives of basis functions with respect to $$x_{k}$$. Using this definition, the derivative predictions from the Kriging surface are given by:

$\frac{\partial y(\vec{x}_{*})}{\partial x_{k}} = g_{k}(\vec{x}_{*}) \beta + l_{*,k}^{T} K^{-1} (Y - H^{T} \beta)$

where $$l_{*,k}^{T}$$ is a vector with elements representing the covariance between the derivative value with respect to $$x_{k}$$ and the training point function values.

$l_{*,k}^{T} = \left[\frac{\partial}{\partial x_{k}} k(\vec{x}_{*},\vec{X}_{1}) \dots \frac{\partial}{\partial x_{k}} k(\vec{x}_{*},\vec{X}_{N}) \right]$

Using the processed data produced by buildkriging can be used to predict the derivative values inexpensively. Using the variable $$V$$, the derivative values can be predicted as:

$\frac{\partial y(\vec{x}_{*})}{\partial x_{k}} = g_{k}(\vec{x}_{*}) \beta + l_{*,k}^{T} V$

To predict the gradient, the derivative of the covariance matrix is required. Hence, the derivative must be differentiable once. This allows all of the covariance functions to be used in this context. In addition to predicting the mean derivative value, the variance associated with the gradient can be predicted with kriginggradvariance. If the variance of the derivative prediction is desired, the covariance must be twice differentiable. This allows only the Matern functions with $$\nu \geq 3/2$$ to be used.

Date:
May 2, 2012
Parameters:
 in) ndim : The dimension of the problem in) ntot : The number of Training points in) X : The location of the training points (size=[ndimxntot]) in) stot : Number of Terms in the regression in) H: The collocation matrix for the regression (size=[stotxntot]) in) beta: Regression coefficients based on the optimal estimate for the Kriging model (size=[stot]) Supplied by buildkriging subroutine in) V: Processed Training Data (size=[ntot]) Supplied by buildkriging subroutine in) hyper: Hyperparameters for the Kriging Model (size=[ndim+2]) Supplied by buildkriging subroutine in) mtot : The number of test points, the places where function prediction are desired in) Xm : The location of the test points (size=[ndimxmtot]) in) gtotm: The total number of derivatives to be predicted (ndim*mtot if the gradient at every test point is desired) in) ptsm: A vector identifying the test point where a particular derivative is specified (size=[gtotm] with values ranging from 1 to mtot) in) dimsm: A vector identifying the dimension the derivative is taken with respect to (size=[gtotm] with values ranging from 1 to ndim) in) Gm : The derivative of the regression basis evaluated at the test points (size=[stotxgtotm]) out) dYm: The predicted function values (size=[gtotm]) Using the processed data V, predicting derivative values is essentially linear with respect to the number of test points so mtot can be set to one and this subroutine can be called multiple times if desired. in) covarflagi: Flag to govern which covariance function is used covarflag==0 Uses Matern function with $$\nu=1/2$$ covarflag==1 Uses Matern function with $$\nu=3/2$$ covarflag==2 Uses Matern function with $$\nu=5/2$$ The parameter $$\nu$$ governs the smoothness and differentiability of the covariance function. For function only Kriging, all three options are available. Must supply the same covariance flag as used in buildkriging.

Definition at line 60 of file kriginggradpredict.f90.

References covars::covarflag.

Referenced by krigingwrapper().