-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some new and some improved tensor operations #76
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t matrix log, exp, and sqrt
Before: the primal output was computed in-line in the custom jvp function. The advantage is that this avoids a second call to the eigendecomposition. The downside is that this in-line computation doesn't itself have a custom jvp, so its derivative can be wrong. After: I re-compute the primal value through the base function (e.g., log_symm), which has the custom jvp defined on it. The eigendecomposition is repeated. We can refactor to eliminate this later if profiling reveals it to be a performance bottleneck.
Put a leading underscore on functions menat for internal use. Most Python tools will ignore these when reporting contents of a module.
Replace all calls except in the new viscoelastic model. Changes are about to merge there and I want to handle the conflicts separately.
tupek2
approved these changes
Feb 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR contributes the following:
I changed the matrix log/exp derivative calculations form Mike's very clever implementation that maintains high precision with Taylor and Pade approximations. The version I put in seems to do just as well in the test cases. It doesn't use Pade approximants, it uses the built-in implementations of
log1p
andexpm1
(which may use the same trick as Mike under the hood, for all I know). I kept Mike's code around in case I'm wrong and these versions are not as accurate.Finally: There are still two calls to the eigenvalue solve when computing the derivative of the matrix functions. I think it's possible to reduce it to one, but it's trickier than I thought. I'll wait until we profile and confirm this is a bottleneck before working on that.