I am currently developing with my own C++/Mex code and Matlab, but my project is getting big and I am considering switching to a proper linear algebra library. I have read very good things about Armadillo, but I can't find a few essential functions I need for my project.
I understand Armadillo links to LAPACK and BLAS libraries, but I couldn't find the matrix exponential function in Armdaillo's API , nor in the LAPACK functions .
Can anyone tell me if there is an add-on to compute matrix exponentials with Armadillo? If so, a short example code would be much appreciated.
The matrix exponential is something Matlab has. So Octave implemented it. So other Free Software projects looked at what Octave has and reimplemented it by borrowing this implementation.
I work a lot with R and Armadillo via the RcppArmadillo package (for which I'm a co-author). In one piece of recent work I needed expm()
and borrowed it for use by Armadillo from the R package exmp .
The code goes like this:
arma::mat expm(arma::mat x) {
arma::mat z(x.n_rows, x.n_cols);
(*expmat)(x.begin(), x.n_rows, z.begin(), Ward_2);
return z;
}
but it hinges of course on the fact that I get the function pointer to expmat
from the R package exmp . The full file is here on Github which has the enum Ward_2
as well.
这已作为expmat
添加到最新版本中,请参见http://arma.sourceforge.net/docs.html#expmat
Here's a port of John Burkardt's c/c++ implementation of one of the 19 dubious to Armadillo...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.