Skip to content

Improve computation of connection coefficients #28543

@egourgoulhon

Description

@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/affine_connection.py
    [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

to

sage -t --long src/sage/manifolds/differentiable/affine_connection.py
    [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.

CC: @tscrim

Component: geometry

Keywords: affine_connection

Author: Eric Gourgoulhon

Branch/Commit: 439162b

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/28543

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions