#18529: Topological manifolds: basics
-------------------------------------+-------------------------------------
Reporter: egourgoulhon | Owner: egourgoulhon
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.10
Component: geometry | Resolution:
Keywords: topological | Merged in:
manifolds | Reviewers:
Authors: Eric Gourgoulhon | Work issues:
Report Upstream: N/A | Commit:
Branch: | 902908b41a95d3455bfcc497997ad2054c530a96
public/manifolds/top_manif_basics | Stopgaps:
Dependencies: #18175 |
-------------------------------------+-------------------------------------
Comment (by egourgoulhon):
Replying to [comment:41 tscrim]:
> Replying to [comment:40 egourgoulhon]:
> > I've already noticed some important loss of performance due to the
equality not being by id; I am afraid that for tensor computations this
will become much worse.
>
> Did you have as the first lines of the `__eq__` being
> {{{
> if self is other:
> return True
> }}}
Actually no (except for points).
> since "most" equality checks should be by identity.
Well, as soon as we have more than two charts on a manifold, this is no
longer true.
> Granted, we do lose some speed because this is a python check, as
opposed to a cython check.
>
> `__eq__` does not have to represent mathematical equality; IIRC we
already have examples of this in Sage, both when `__eq__` is weaker and
stronger than mathematical equality (which often times people wish it
could be isomorphism). So we are okay with making `__eq__` not reflect the
mathematical equality.
OK.
> > For the above reasons, I am considering to revert to the
`UniqueRepresentation` for manifolds. To solve the issue of the
redefinition by the end user disccused in comment:32, we could have some
handling of the cache in the function `Manifold`, so that
> > {{{
> > M1 = Manifold(2, 'M')
> > M2 = Manifold(2, 'M')
> > }}}
> > will construct two different objects. What do you think?
>
> I worry that this will cause subtle issues with pickling. For example,
if we clear the cache when creating `M2`, then `loads(dumps(M1))` will
probably not equal `M1`, but instead equal `M2`. I haven't checked if this
actually happens.
Thanks for pointing this, I think you are right.
>
> There are a few different options that I see at this point.
>
> - Drop pickling `==` support and use
`sage.misc.fast_methods.WithEqualityById` (this will get your speed back).
However we could get close by implementing pickling as saving the current
atlas.
I am quite reluctant to drop pickling `==` support, although, as you say,
pickling within a session is usually not needed/used. This would break all
`TestSuite()` tests, except of course if we run them with
`skip='_test_pickling'`.
> - Go back to `UniqueRepresentation`, but also have it additionally keyed
by the time it was created:
> {{{
> sage: import time
> sage: time.time()
> 1446566813.121567
> }}}
> You could do this by having
> {{{
> @staticmethod
> def __classcall__(cls, dim, name, latex, R, time_key=None):
> if time_key is None:
> from time import time
> time_key = time()
> return super(TopologicalManifold, cls).__classcall__(cls, dim,
latex, R, time_key=time_key)
>
> def __init__(self, dim, name, latex, R, time_key):
> # Just ignore the time_key input
> }}}
> (or doing it via a `UniqueFactory`).
I like very much this one; thanks a lot for suggesting it! I have
implemented it in the above commit, with a small modification: I have not
redefined `TopologicalManifold.__classcall__` (which is inherited from
`UniqueRepresentation`), instead I have simply set the time tag in the
function `Manifold`. Everything works well: see the rubric "Reusability of
the manifold name" in the documentation of the function `Manifold`.
> - Ask someone else, like Jeroen, Simon, Volker, and/or sage-devel, for
other options.
Good idea, I will.
--
Ticket URL: <http://trac.sagemath.org/ticket/18529#comment:43>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.