R/dwrapnormal.R

Defines functions dwrapnormal

Documented in dwrapnormal

dwrapnormal <- function(x, m, rho, rads = FALSE, logden = FALSE) {
  if ( !rads )   x <- x * pi/180
  n <- length(x)
  y <- x - m
  k <- 1:100
  y <- Rfast::rep_row(y, 100)
  y <- Rfast::rowsums( rho^(k^2) * cos(k * y) )
  den <-  -log(2 * pi) + log1p(2 * y)
  if ( !logden )  den <- exp(den)
  den
}

Try the Directional package in your browser

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

Directional documentation built on April 3, 2025, 7:59 p.m.