]> git.donarmstrong.com Git - ape.git/blob - R/matexpo.R
some updates (including new CADM.global.Rd file)
[ape.git] / R / matexpo.R
1 ## ladderize.R (2007-10-08)
2
3 ##   Matrix Exponential
4
5 ## Copyright 2007 Emmanuel Paradis
6
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
9
10 matexpo <- function(x)
11 {
12     if (!is.matrix(x)) stop('"x" must be a matrix')
13     nr <- dim(x)[1]
14     if (nr != dim(x)[2]) stop('"x" must be a square matrix')
15     ans <- .C("mat_expo", as.double(x), as.integer(nr),
16               PACKAGE = "ape")[[1]]
17     dim(ans) <- c(nr, nr)
18     ans
19 }