Opened 4 years ago
Closed 4 years ago
#23623 closed enhancement (fixed)
Add is_trivial_zero() to coordinate functions and scalar fields on manifolds
Reported by: | egourgoulhon | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.1 |
Component: | geometry | Keywords: | coordinate function, scalar field, tensor calculus |
Cc: | roed, tscrim | Merged in: | |
Authors: | Eric Gourgoulhon | Reviewers: | Richard L Lozes |
Report Upstream: | N/A | Work issues: | |
Branch: | 169afc2 (Commits, GitHub, GitLab) | Commit: | 169afc24cfc83d2e86771305eb59d96192d99f14 |
Dependencies: | Stopgaps: |
Description
This ticket implements the fast method is_trivial_zero
in coordinate functions (classes sage.manifolds.coord_func.CoordFunction
and sage.manifolds.coord_func_symb.CoordFunctionSymb
) and scalar fields (class sage.manifolds.scalarfield.ScalarField
). The method is_trivial_zero
is then used instead of == 0
in tensor calculus, especially in tensor assignement, where the check for zero is performed because only nonzero components of a tensor are stored. This avoids the call to Maxima, which can be problematic in some cases, as reported in
this sage-devel post. Moreover, this results in a significant speed-up factor. For instance, the computation time of the coefficients of the Levi-Civita connection of the Kerr-Newman metric, as performed in cell 20 of this example notebook, is reduced from 5.37 s to 4.11 s (this is on a Intel Core i7-6700HQ computer).
Change History (5)
comment:1 Changed 4 years ago by
- Branch set to public/manifolds/is_trivial_zero
- Commit set to 169afc24cfc83d2e86771305eb59d96192d99f14
- Status changed from new to needs_review
comment:2 Changed 4 years ago by
- Cc roed tscrim added
comment:3 Changed 4 years ago by
- Reviewers set to Richard L Lozes
- Status changed from needs_review to positive_review
Built against 8.1 beta 3. No test failures, including the original sage-devel post and other, more elaborate tests.
comment:4 Changed 4 years ago by
Thank you for the review!
comment:5 Changed 4 years ago by
- Branch changed from public/manifolds/is_trivial_zero to 169afc24cfc83d2e86771305eb59d96192d99f14
- Resolution set to fixed
- Status changed from positive_review to closed
New commits:
Add is_trivial_zero() to coordinate functions and scalar fields and use it in tensor calculus