Opened 3 years ago

Closed 3 years ago

#28543 closed defect (fixed)

Improve computation of connection coefficients

Reported by: egourgoulhon Owned by:
Priority: major Milestone: sage-9.0
Component: geometry Keywords: affine_connection, manifold
Cc: tscrim Merged in:
Authors: Eric Gourgoulhon Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 439162b (Commits, GitHub, GitLab) Commit: 439162b50d7300e4ecc1212efaf08063e1706e89
Dependencies: Stopgaps:

Status badges

Description (last modified by egourgoulhon)

The coefficients of an affine connection D in a frame (ei) are computed according to the formula

Gammakij = (Dei)(fk , ej)

where (fk) stands for the coframe dual to (ei). In the current implementation, this is performed by a triple loop on k, i and j with a recomputation of Dei at each stage of the inner loop (!). This makes the whole computation terribly slow for manifold dimensions > 2. This ticket reorders the loops, factoring Dei. As a result, in Sage 8.9.rc1, we move from

sage -t --long src/sage/manifolds/differentiable/
    [441 tests, 132.77 s]
All tests passed!
Total time for all tests: 132.9 seconds
    cpu time: 152.0 seconds
    cumulative wall time: 132.8 seconds


sage -t --long src/sage/manifolds/differentiable/
    [441 tests, 111.16 s]
All tests passed!
Total time for all tests: 111.3 seconds
    cpu time: 124.1 seconds
    cumulative wall time: 111.2 seconds

In passing, additional factorizations have been performed in other loops (in methods connection_forms, curvature_forms, etc.), but they were less critical since they involve cached quantities.

Change History (7)

comment:1 Changed 3 years ago by egourgoulhon

  • Description modified (diff)

comment:2 Changed 3 years ago by egourgoulhon

  • Branch set to public/manifolds/connection_coef-28543
  • Commit set to 439162b50d7300e4ecc1212efaf08063e1706e89
  • Description modified (diff)

New commits:

439162bImprove computation of connection coefficients

comment:3 Changed 3 years ago by egourgoulhon

  • Cc tscrim added
  • Status changed from new to needs_review

comment:4 Changed 3 years ago by egourgoulhon

  • Description modified (diff)

comment:5 Changed 3 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

Yes, definitely a good idea to pull these out and not redo these computations. LGTM.

comment:6 Changed 3 years ago by egourgoulhon

Thanks for the review!

comment:7 Changed 3 years ago by vbraun

  • Branch changed from public/manifolds/connection_coef-28543 to 439162b50d7300e4ecc1212efaf08063e1706e89
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.