This is the basic C++ program of C++ armadillo library which shows how to find Matrix exponential of general square matrix A of some particular size. It can be carried out by the help of inbuilt function "expmat" in armadillo library. It takes one parameter i.e input matrix name.
If A is not square sized, a std::logic_error exception is thrown
If the matrix exponential cannot be found:
B = expmat(A) resets B and throws a std::runtime_error exception
expmat(B,A) resets B and returns a bool set to false (exception is not thrown)
Caveat: if matrix A is symmetric, using expmat_sym() is faster
Caveat: the matrix exponential operation is generally not the same as applying the exp() function to each element
Comments