File: MxExponential.R

package info (click to toggle)
r-cran-openmx 2.21.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,412 kB
  • sloc: cpp: 36,577; ansic: 13,811; fortran: 2,001; sh: 1,440; python: 350; perl: 21; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 506 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
##' Matrix exponential
##'
##' @param x matrix
##' @aliases omxExponential
expm <- function(x) {
	if (length(dim(x)) != 2 || nrow(x) != ncol(x)) {
		stop("input to omxExponential() must be a square matrix")
	}
	.Call(do_expm_eigen, x)
}

omxExponential <- expm

##' Matrix logarithm
##' 
##' @param x matrix
##' @param tol tolerance
logm <- function(x, tol = .Machine$double.eps) {
    d <- dim(x)
    if(length(d) != 2 || d[1] != d[2]) stop("'x' must be a quadratic matrix")
    .Call(do_logm_eigen, x)
}