-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
major improvements to lazy power series #15673
Comments
Branch: u/mhansen/species_stream |
comment:2
One thing that should be done (maybe not on this ticket) is to deprecate the code in Last 10 new commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:4
Hi Mike! Thank you for uploading the new code! I have one immediate question: if I understand correctly, you chose to introduce a new class for every operation on streams, eg. SumStream, ProductStream, TailStream, DerivativeStream, etc. Could you explain why...? I would have thought that these things fit more natural into various generating series classes, but I'm sure you have thought quite a lot about this... Thanks again, Martin |
comment:5
The main idea is to have the streams know about their (approximate) order. That way we don't have to worry about initializing generators with the correct approximate order. We can also do some improvements w.r.t. caching if the streams are a bit more structured. |
comment:6
Thanks for the explanation! I am currently compiling sage to try your code. In case you have enough time: I recently reviewed ticket #14846, which is based on the old code... Unfortunately, it is still not in the develop branch, so maybe it's better to wait until it is. |
This comment has been minimized.
This comment has been minimized.
comment:8
Mike, Are you sure that #12659 is related? |
comment:9
Oops, I meant #12649. |
This comment has been minimized.
This comment has been minimized.
comment:10
I'm slowly digging through the new code. I cannot yet decide whether I like it or not, because I really care about it, so I'd like to understand it first :-) Questions so far:
and moreover, I'd expect If we don't, then this behaviour has to be documented very LOUDLY. (I do see that
Would it be possible to use the category framework to export operations depending on what the
to do change of basis.
|
comment:11
Replying to @mantepse:
Sure -- I'm not sure the best place for streams to go at the moment.
You can basically do that with the "OldStreamBehavior" class.
Agreed.
The current semantics of
The distinction is pretty fine and in fact they could probably be merged. The main thing would be just be dealing with the class situation as if you had For now, the best way to think of a difference between a
Since many of the (internal) operations need to work with the power-sum basis, you'd mainly just wanting to be converting the coefficients "at the edges". Or would you want them to always convert to the powersum basis when they needed to?
That's fine -- I mainly kept aorder for backwards compatibility, but we don't need that on the new streams.
In terms of the name? Or in terms of being able to access "sub-streams"?
Will fix. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:13
Replying to @mwhansen:
Well, we certainly do not want to keep two implementations for the same thing, do we? To put it bluntly, I'm not sure whether this design decision is a good one. Let's make the decisions clear: A) do we want to create streams using
B) do we want finite streams?
Yes, it may be good to have both. But then the semantics should be precisely the other way round.
I dislike at least the choice for the names here.
It would be great if you could give your opinion on that, I don't know the category framework well enough. In Axiom/FriCAS/Aldor it was extremely useful especially for formal power series. NB, Ralf implemented the lazy series in aldor from scratch only because he wanted to be independent from Axiom/FriCAS. Need to run. All the best, Martin New commits:
|
comment:14
Hi Mike, one minor further issue: we still have
While I was unable to produce an actual bug using this, it might be possible. I think we should have a simple linear order |
comment:15
Yes, that's still an issue when using Integers as series orders due to the way Python works. One way to do it would be to make sure that ".aorder" is an element of a special ordered set so that we can make sure the current comparison is being used. |
comment:16
(Off topic) Mike, there's something I do not understand about trac: in the change history here on the ticket I see two identical commits: should I expect this? |
Reviewer: Ralf Stephan |
comment:18
The branch does not merge cleanly into 6.2.beta2 but it's a one line change. Tests within species are good. Docs build fine. I also think that stream is another word for infinite sequence, and so a finite stream implementation already exists in structure.sequence, which is also fast (there are however problems in that Sequence doesn't have a parent, see #15852). |
comment:19
Replying to @rwst:
Note that there is also |
comment:20
I have rebased on 6.2.beta6 : here is a git branch Is this considered to be "needs review" ? New commits:
|
Commit: |
comment:44
I have now completed the rebase. All tests pass. It would be great if someone more versed in python than me could look at the design... |
comment:45
Well done for the rebase! Some personal feelings about the code
Then
Though there are missing features. For example, current This series code would be a good test case to see whether
|
comment:46
Thanks for your comments! ad 1. and 3.: yes, that's what I want to do. I'm currently trying to figure out whether I should let ad 4.: I guess that you are referring to the examples in the species code - I do not think there is any recursive definition used in library code. Of course Newton would be faster. The point of the recursive facility is only to create a species easily, for example to check the first few terms of the cycle index series. In case one needs more speed, one will have to "really" implement the species. ad 2.: unfortunately, I do not really know what it does. I'll try to figure out. |
comment:47
Hello, Thanks to update and improve this code! ;-) I have a stupid question: the lazy thing is a trick to compute efficiently the coefficient of the product of series or some other operations on series, right? About the code, why does All I read in the code look like this
so it seems better to inherit of Jean-Baptiste Priez |
comment:48
Replying to @sagetrac-elixyre:
No. The laziness is for having potentially infinite sequences.
Unless I misunderstand python's inheritance, the point is that a My current plan is to remove |
comment:49
There is a bad and doc does not build, see patchbot report |
comment:50
Replying to @fchapoton:
Thanks, I changed this locally. However, I will not take care of the documentation at the moment, because I'm currently (really!) working on the design. Right now I think that I want a class I am not yet sure whether the computation of the approximate order really belongs here: after all, we want to recursively specify formal power series, not coefficient streams. The design decision is not completely clear, because formal power series and coefficient streams are almost the same thing - except that most operations feel more natural on the level of formal power series. Suggestions and comments very welcome! |
comment:51
Replying to @mantepse:
I will be happy to discuss code design with you. I have some code (about species) on the branch Whatever I recode my own (Specially I have a nice simple tool to compute the valuation.) Do you have some branch where you try your own design that I could pull? |
comment:52
Great!
Is this in the species2 directory?
So, very likely it makes sense to start from your branch?
No, because I'm doing this with pencil and paper... Eventually we could talk, too, I have webcam + whiteboard. |
comment:53
This is no longer relevant, since #32367. (essentially, a similar approach was used) |
Changed branch from u/mantepse/15673 to none |
Changed author from Mike Hansen to none |
Changed reviewer from Ralf Stephan, Matthieu Dien to Travis Scrimshaw |
Changed commit from |
Some re-structuring of the streams / series code fixes many issues and makes the code quite a bit simpler.
Fixes #15249, #15248, #10084, #10085, #10086, #13433, #14685, #12648, #12649.
CC: @mantepse @videlec
Component: combinatorics
Keywords: LazyPowerSeries, days57
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/15673
The text was updated successfully, but these errors were encountered: