File: matexpo.R

package info (click to toggle)
r-cran-ape 5.8-1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,676 kB
  • sloc: ansic: 7,676; cpp: 116; sh: 17; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 438 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## 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
}