R/matexpo.R

Defines functions matexpo

Documented in matexpo

## ladderize.R (2007-10-08)

##   Matrix Exponential

## Copyright 2007 Emmanuel Paradis

## This file is part of the R-package `ape'.
## See the file ../COPYING for licensing issues.

matexpo <- function(x)
{
    if (!is.matrix(x)) stop('"x" must be a matrix')
    nr <- dim(x)[1]
    if (nr != dim(x)[2]) stop('"x" must be a square matrix')
    ans <- .C(mat_expo, as.double(x), as.integer(nr))[[1]]
    dim(ans) <- c(nr, nr)
    ans
}

Try the ape package in your browser

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

ape documentation built on March 31, 2023, 6:56 p.m.