R/localCovarianceGradients.R

localCovarianceGradients <-
function(model, y, dimension) {
  if (!"isSpherical" %in% names(model) || model$isSpherical) {
    invKy = model$invK_uu %*% y
    gK = -model$invK_uu + invKy%*%t(invKy)
  } else {
    if (model$isMissingData)
      m = y[model$indexPresent[[dimension]]]
    else
      m = y

    invKy = model$invK_uu[[dimension]] %*% m
    gK = -model$invK_uu[[dimension]] + invKy%*%t(invKy)
  }
  gK = gK * .5
  return (gK)
}

Try the gptk package in your browser

Any scripts or data that you put into this service are public.

gptk documentation built on May 2, 2019, 3:27 p.m.