Opened 13 months ago

Last modified 3 months ago

#30714 new enhancement

Tensor Arithmetics on Minimal Amount of Domains

Reported by: gh-mjungmath Owned by:
Priority: major Milestone: sage-9.5
Component: manifolds Keywords:
Cc: egourgoulhon, tscrim, mkoeppe Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

If I get the code correctly, operations between two tensor fields on non-parallelizable manifolds are performed as follows:

  1. get common domains from the _restrictions dictionary,
  2. perform the corresponding operation on each of those domains.

However, in most cases not all domains are necessary to fully determine the result. It is enough to find a minimal set of common domains which cover the manifold and perform the computation on those. The wanted restrictions of the result can then be computed on demand.

Allow me an example:

sage: M = Manifold(2, 'S^2') # the 2-dimensional sphere S^2
sage: U = M.open_subset('U') # complement of the North pole
sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
sage: V = M.open_subset('V') # complement of the South pole
sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
sage: M.declare_union(U,V)   # S^2 is the union of U and V
sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
....:                                intersection_name='W',
....:                                restrictions1=x^2+y^2!=0,
....:                                restrictions2=u^2+v^2!=0)
sage: uv_to_xy = xy_to_uv.inverse()
sage: W = U.intersection(V)
sage: eU = c_xy.frame()
sage: eV = c_uv.frame()
sage: v = M.vector_field(name='v')
sage: v[eU,:] = [1, -2]
sage: v.add_comp_by_continuation(eV, W, chart=c_uv)
sage: v._restrictions
{Open subset U of the 2-dimensional differentiable manifold S^2: Vector field v on the Open subset U of the 2-dimensional differentiable manifold S^2,
 Open subset W of the 2-dimensional differentiable manifold S^2: Vector field v on the Open subset W of the 2-dimensional differentiable manifold S^2,
 Open subset V of the 2-dimensional differentiable manifold S^2: Vector field v on the Open subset V of the 2-dimensional differentiable manifold S^2}

Now, if you add v and another vector field defined similarly, the addition would be performed on U, V and W. Even though the computation on W is not necessary.

Change History (12)

comment:1 follow-up: Changed 13 months ago by mkoeppe

This is an NP-hard optimization problem.

comment:2 follow-ups: Changed 13 months ago by egourgoulhon

Maybe one shall introduce the concept of "top restrictions", i.e. restrictions that are not restrictions of a larger restriction on a parallelizable domain (there are already similar concepts in TopologicalManifold._top_charts and DifferentiableManifold._top_frames). Then the method TensorField._common_subdomains(), which is invoked by _add_(), could deal only with these top restrictions.

comment:3 in reply to: ↑ 1 Changed 13 months ago by gh-mjungmath

Replying to mkoeppe:

This is an NP-hard optimization problem.

I'm sorry, I don't know what you mean. Can you explain please?

comment:4 in reply to: ↑ 2 Changed 13 months ago by gh-mjungmath

Just for the records, I have introduced a method called _get_min_covering for characteristic forms and orientations (you can find it in manifold.py), which returns the minimal amount of objects necessary to cover the manifold. Maybe this is something we can use? I don't know how speedy it is compared to the computational cost we might save.

Last edited 13 months ago by gh-mjungmath (previous) (diff)

comment:5 in reply to: ↑ 2 Changed 13 months ago by gh-mjungmath

Replying to egourgoulhon:

Maybe one shall introduce the concept of "top restrictions", i.e. restrictions that are not restrictions of a larger restriction on a parallelizable domain (there are already similar concepts in TopologicalManifold._top_charts and DifferentiableManifold._top_frames). Then the method TensorField._common_subdomains(), which is invoked by _add_(), could deal only with these top restrictions.

This sounds like a great idea to me. I'm eager to hear what Matthias and Travis think about it.

comment:6 Changed 12 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3

comment:7 Changed 8 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

comment:8 Changed 6 months ago by gh-mjungmath

Possibly related: #31740, #31703.

comment:9 Changed 6 months ago by gh-mjungmath

  • Cc mkoeppe added

comment:10 Changed 6 months ago by mkoeppe

A first step in line with #31740 could be to introduce methods TensorField.restriction_digraph, .restriction_poset etc. in analogy to ManifoldSubset.subset_{digraph,subset} (most recent version in #31736). A generator of the top elements of the poset then comes for free - see #31766.

comment:11 Changed 6 months ago by gh-mjungmath

Perhaps it is a good idea to implement that behavior into sheaves (#31703) first and then wrap this over tensors and vb sections etc.

comment:12 Changed 3 months ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5
Note: See TracTickets for help on using tickets.