-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mutable poset: a data structure for asymptotic expressions #17693
Comments
Branch: u/dkrenn/asy/mutable_poset |
Last 10 new commits:
|
Commit: |
Author: Daniel Krenn |
comment:3
A mutable poset class should be stored in Nathann |
comment:4
This series of comments are the result of an email discussion. Its aim is to give a better understanding of the needs of the data structure used in an asymptotic expression. An example of an asymptotic expression in say 2 variables (n->oo, t->oo) is
This is stored in the mutable poset in the following way: the elements of the poset are exactly the summands of the expression above. This means
The growth of these summands is partially ordered:
|
comment:5
We want to perform arithmetic with asymptotic expressions, in particular we need to do efficiently:
or
To make them efficent, we store successors and predecessors of each element in the poset. These are updated when inserting/removing elements. Note that an asymptotic expression can contain several O-terms, e.g.
is a valid expression. In the poset each O-term is a minimal
we have We also need to deal with situations where we want to insert an |
comment:6
Note that all the terms (individual summands) support one
Thus we have monoids here. "Addition" of terms is more complicated
But since this is an operation we want to have, the data Here an example of the addition of two asymptotic expressions, to
Steps in computing B + C:
To achieve this, we have to search for what can be "absorbed" by the Note that this data structure does a preprocessing of its relations, which is definitely good for nonsmall instances. At the moment this class should provide an interface for the needed routines. A fine tuning (w.r.t. speed optimization for various sizes) can be done later (if the performance is too bad). To conclude, the data structure needed in an asymptotic expression needs to deal with dynamic changes (mutability) and do some caching to provide efficient methods. And it needs to do more than a poset which is made mutable. In particular, it has to provide the methods for the above mentioned merging and absorbing. |
comment:7
Replying to @nathanncohen:
This class has nothing to do with combinatorics, therefore I am against |
comment:8
Graphs are a data structure, they are in graphs/. Incidence Structures are data structure, and they are in combinat/designs. Matrices are a data structure, and they are in matrix/. Posets and Hasse Diagrams are a data structure, and they are in combinat/posets/. Also, you wrote in your branch a 'todo note' to implement in your Could you also explain what "shells" are, and how they differ from the 'facade' boolean argument of Posets ? Thanks, Nathann |
comment:9
Replying to @nathanncohen:
A |
comment:10
Indeed, but it may actually be time to change that. We are also having problem with this, because apparently the construction of That is what is already preventing us from implementing a proper iterator over all non-isomorphic posets of a given size: this operation creates too many parents and is the bottleneck in the computations. If it seems that you are bothered by the same thing, it gives all the more reasons to make that change. Nathann |
comment:11
Replying to @nathanncohen:
There are similarities between shells and facades, but a facade is something in Sage that represent other things and again uses parents/elements (thus immutable). It has well-defined properties and there is even a category for facade sets. |
comment:12
Replying to @nathanncohen:
No, graphs are mathematical objects. "a binary symmetric matrix implemented using bitsets" (which could be used for dense graphs) is a data structure. |
comment:13
I was not thinking of a graph as it is defined in a book, but of Sage's graphs. I should have said "the Graph class" probably. Nathann |
Changed branch from u/dkrenn/asy/mutable_poset to u/dkrenn/asy/mutable-poset |
Last 10 new commits:
|
comment:15
If Just my two cents. I would give three, if I would have more time. |
comment:16
Replying to @jm58660:
No, it does not do the same. Union takes only one instance of equal elements, whereas disjoint_union makes each one of the equal elements distinct.
The developer guide
says
Therefore skipping one of these blocks seems to be against the rules (and hopefully helps avoiding the confusion of a missing input block).
Many thanks for all your cents. Best, Daniel |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:18
Replying to @dkrenn:
OK.
True. But I don't think if it has been thinked that "no input" must be documented. Is it in other places? Or should this part of developer guide be changed? And should for example docstring of |
comment:20
Replying to @jm58660:
I would keep it. (At the moment) the developer guide says to include it and I find it very nice to have constistent docstrings starting with one-liner, INPUT, OUTPUT, more details, EXAMPLES, ... (And: there are other places.)
What do you suggest? |
comment:21
Replying to @dkrenn:
This is discussed at #19041. But don't let this stop coding -- Sage will propably never get finished so that questions like this would have The Final Answer.
Every I don't know. For input it is explicitly said that the docstring can say "x in integer", not "x must be |
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
|
comment:39
Replying to @cheuberg:
Cross-reviewed. One commit added.
Thanks; see my comments below.
Done.
Deleted.
Activated it; it seems (for some (to me) unknown reason) the warning appears now in every doctest and not only once in the file. Thus, deactivated it again; and I am for keeping it this way.
Good idea. Done.
MutablePosetShell is typically used by the MutablePoset; and there, adding a
Rewritten.
Now it is cached (see also follow up ticket #19281).
Added a note in the class description.
Rewritten.
Done.
Rewritten.
True; rewritten.
Changed.
Simplified.
Rewritten note box.
Rewritten.
Extended description of parameter
I do not understand what you mean (but it is already late...).
Rewritten.
Rewritten.
Rewritten.
Merged and minor simplification.
Documented.
Documented.
Documented.
Documented.
Deleted.
Documented.
Behavior changed.
See Python's set.
Done.
Mentioned this more explicitly in docs
Done.
Done.
Rewritten.
Removed.
Completed.
Completed.
Merged and cross-reviewed....ok.
This needs comparisons of the elements, but one of the main ideas of this data structure is that comparisions are only needed for inserting an element into the poset and none needed once it is inside. Thus I am for keeping the current solution. However, I am fine with introducing (now or at any point later) an algorithm option which makes it possible to select different removing algorithms depending on the situation.
Python's set has both,
Done.
Done.
Deleted.
Rewritten INPUT-block
Note added/changed.
Copied.
Indeed. Code rewritten.
Done.
Done.
True. Code simplified.
Documented.
Added.
Added note.
Mentioned.
Example changed.
Added a note on key-order preservation. I think having |
Changed branch from u/dkrenn/asy/mutable-poset to u/cheuberg/asy/mutable-poset |
comment:43
Thank you for your changes. I added three commits. See my remaining comments below. Replying to @dkrenn:
ok.
I rather thought about calling
wouldn't
that would be good to test (and comment on).
I mean that shells
This does not solve the problem. What about renaming the method
This should be discussed when more benchmarking results are available. I opened #19300 for that.
removed comment on non-commutativity because
Remove comment on non-commutativity? merge does not play a role here, and keys might be covered in the previous sentence?
|
Changed branch from u/cheuberg/asy/mutable-poset to u/dkrenn/asy/mutable-poset |
comment:45
Replying to @cheuberg:
Cross-review...ok.
Oh...yes, I agree; changed.
True. Changed.
Inserted.
Now I understand what you mean. Inserted a doctest there.
Good idea; changed and inserted
Removed.
Changed. New commits:
|
Changed branch from u/dkrenn/asy/mutable-poset to u/cheuberg/asy/mutable-poset |
comment:49
Added three final reviewer commits. Doctests pass, documentation builds, documentation seems to be fine, code seems to be fine. |
comment:50
Replying to @cheuberg:
Thanks; checked.
:) |
Changed branch from u/cheuberg/asy/mutable-poset to |
The aim of this ticket is to implement a data structure which is to be used within an asymptotic expression (see Meta-Ticket #17601). This mutable poset stores elements together with its successors and predecessors. Those data is updated when a new element is inserted or an element is removed. It offers a couple of efficient routines for manipulations (all of which will be needed for the asymptotic expression).
CC: @behackl @cheuberg @jm58660
Component: asymptotic expansions
Author: Daniel Krenn
Branch/Commit:
a0b3d7b
Reviewer: Benjamin Hackl, Clemens Heuberger
Issue created by migration from https://trac.sagemath.org/ticket/17693
The text was updated successfully, but these errors were encountered: