R/ry_bmf.R

Defines functions ry_bmf

Documented in ry_bmf

#' Helper Function for Sampling a Bingham-von Mises-Fisher-distributed Vector
#' 
#' C interface to perform a Gibbs update of \code{y} with invariant
#' distribution proportional to \code{exp( sum(l*y^2+y*d) } with respect to the
#' uniform measure on the sphere.
#' 
#' 
#' @param y a normal vector.
#' @param l a vector.
#' @param d a vector.
#' @return a normal vector
#' @author Peter Hoff
#' @references Hoff(2009)
#' @examples
#' 
#' ## The function is currently defined as
#' function (y, l, d) 
#' {
#'     .C("ry_bmf", y = as.double(y), l = as.double(l), d = as.double(d), 
#'         n = as.integer(length(y)))$y
#'   }
#' 
#' @export ry_bmf
ry_bmf <-
function(y,l,d)
{
  .C("ry_bmfc",y=as.double(y),l=as.double(l),d=as.double(d),
               n=as.integer(length(y)))$y
}

Try the rstiefel package in your browser

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

rstiefel documentation built on June 12, 2018, 5:19 p.m.