R/utils.R

Defines functions interp_complex make_K_C phi0_vec

#' @keywords internal
#' @importFrom stats approx

phi0_vec <- function(t) exp(-0.5 * t^2)

make_K_C <- function(t) {
  phi  <- function(x) exp(-0.5 * x^2)
  S <- outer(t, t, "+")
  D <- outer(t, t, "-")
  ft <- outer(t, t, function(s, u) phi(s) * phi(u))

  K <- phi(D) - ft
  C <- phi(S) - ft

  list(K = K, C = C)
}

interp_complex <- function(x.known, y.complex, x.out) {
  y.re <- approx(x.known, Re(y.complex), xout = x.out, rule = 2)$y
  y.im <- approx(x.known, Im(y.complex), xout = x.out, rule = 2)$y
  y.re + 1i * y.im
}

Try the sstn package in your browser

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

sstn documentation built on Aug. 30, 2026, 1:07 a.m.