Matrix exponentiation
It does not appear that non-element-wise matrix exponentiation, i.e. e^X = sum X^k/k!
for k = 0, 1, ... inf
and matrix X
, is currently supported. This can be accomplished easily for some special cases (nilpotent matrices to name one) using the tools provided by blaze, but I imagine that if it were incorporated into the project directly it could be optimized for all kinds of matrices. Currently there does not appear to be a direct diagonal decomposition function, but exposing one could make writing a general matrix exponentiation routine pretty easy.
Comments (6)
-
reporter -
Hi Nathan!
Thanks a lot for the proposal. You are correct, the feature is currently not directly supported. We hope that until we can realize the feature in Blaze the existing features are sufficient. Thanks again,
Best regards,
Klaus!
-
I vote for it. Today I needed to calculate a matrix exponential and could not find it in Blaze.
-
-
assigned issue to
-
assigned issue to
-
- changed status to open
-
- changed status to resolved
Summary
The feature has been implemented, tested, optimized, and documented as required. It is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.7.
Matrix Exponential
The matrix exponential of a NxN matrix
X
is defined asIn order to compute the matrix exponential of a square dense matrix, the
matexp()
function can be used:blaze::DynamicMatrix<float,blaze::rowMajor> A, B; // ... Resizing and initialization B = matexp( A ); // Compute the exponential of A
Note that the matrix exponential can only be used for dense matrices with
float
,double
,complex<float>
orcomplex<double>
element type. The attempt to call the function with matrices of any other element type results in a compile time error!Also note that it is not possible to use any kind of view on the expression object returned by the
matexp()
function. Also, it is not possible to access individual elements via the function call operator on the expression object:row( matexp( A ), 2UL ); // Compilation error: Views cannot be used on an matexp() expression! matexp( A )(1,2); // Compilation error: It is not possible to access individual elements!
- Log in to comment
I believe this could be piggy-backed on issue
#64, as SVD gets you most of the way to a general matrix exponentiation, but for special cases there might be optimizations that could be incorporated into an "official" matrix exponentiation routine.