Learn R Programming

complexplus (version 2.1)

matexp: Matrix Exponential

Description

matexp computes the exponential of a square matrix A i.e. \(exp(A)\).

Usage

matexp(A, ...)

Arguments

A
a square matrix, real or complex.
...
arguments passed to or from other methods.

Value

The matrix exponential of A. Method used may be chosen from the options available in expm.

Details

This function adapts function expm from package expm to be able to handle complex matrices, by decomposing the original matrix into real and purely imaginary matrices and creating a real block matrix that function expm can successfully process. If the original matrix is real, matexp calls expm directly for maximum efficiency.

See Also

expm

Examples

Run this code
A <- matrix(c(1, 2, 2+3i, 5), ncol = 2)  # complex matrix
B <- matrix(1:4, ncol = 2)  # real matrix

matexp(A)
matexp(A, "Ward77")  # uses Ward77's method in function expm
matexp(B)
matexp(B, "Taylor")  # uses Taylor's method in function expm

Run the code above in your browser using DataLab