Matrix functions and scalar powers of gr_mat
#2198
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds
gr_mat_func_jordan
for computing arbitrary analytic functions of square matrices using Jordan decomposition (generalized out from the previous code for exp and log)Improves that method to fall back on diagonalization over inexact fields in the case where one has n distinct eigenvalues (would previously attempt to compute ranks and fail)
Adds
gr_mat_pow_si
,gr_mat_pow_fmpq
,gr_mat_pow_scalar
,gr_mat_sqrt
,gr_mat_rsqrt
Also fixes a couple of other minor issues caught while testing (including a memory leak in
gr_mat_fflu
).So, amusingly one can now do this:
Note that this code has many limitations. For example, it is not very useful for the purpose of detecting whether matrices over non-closed fields or rings are perfect powers:
This does work though:
In the following example, there is a negative real eigenvalue and the error bounds blow up on the branch cut. Here we would need a non-principal internal square root: