-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
implement van Hoeven's algorithm for relaxed multiplication of power series #34616
Comments
comment:2
Unfortunately, the code does not work yet, because I have some trouble with some details in the article. Last 10 new commits:
|
Author: Martin Rubey |
This comment has been minimized.
This comment has been minimized.
Changed keywords from none to LazyPowerSeries |
Commit: |
comment:3
I think the mistake is that the caching is not implemented correctly. (References below are to van der Hoeven's paper) Sec. 2.2., pg. 484 says that In Sec. 4.2.1., pg. 502, the definition of of The implementation of van der Hoeven's algorithm should really use the dense version of streams. It probably makes sense to adapt the framework slightly. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:5
Although the implementation is quite ugly in some details, I think we can learn enough for some decisions.
|
comment:6
Somewhat orthogonal to the ticket: I think the decision whether a For example, for For |
comment:7
See #34636 |
comment:8
Thank you for doing this. +1 on using van der Hoeven's algorithm for the dense. We might want to add some more documentation to this to explain when one version might be preferred to the other. |
comment:9
Thank you for looking at it :-) - and more generally, all the reviews! The thing I am somewhat stuck with here is the class hierarchy. Consider: class Stream_cauchy_mul_DAC():
def __init__(self, left, right, phi, N, threshold):
self._left = [left[k] for k in range(N)]
self._right = [right[k] for k in range(N)]
if phi is None:
self._phi = [0]*(2*N)
self._lo = None
self._n = ZZ.zero()
else:
# TODO: the first N/2 entries of self._phi are already
# computed, the computation of the next N/2 is initiated
# by the next line. Could / should this be done lazily?
self._phi = [phi[k] for k in range(N)] + [0]*N
self._lo = phi
self._n = ZZ(N / 2) Currently, this class does not inherit from anything. However, it shares functionality with class Stream_cauchy_mul_fast(Stream_binary):
def __init__(self, left, right, threshold=2 ** 1):
super().__init__(left, right, False)
self._threshold = threshold
self._h = Stream_cauchy_mul_DAC(left, right, None,
self._threshold, self._threshold)
def get_coefficient(self, n):
if n >= self._threshold and is_power_of_two(n):
self._h = Stream_cauchy_mul_DAC(self._left, self._right, self._h,
2*n, self._threshold)
return self._h[n] In summary: to my eyes, this is a complete mess. I think it would be more beautiful if the caching mechanism provided by I do not understand the algorithm well enough to see how much of |
comment:10
Is there a reason why these need to be two separate classes? It seems like you really just want to have one class that inherits from |
comment:11
(I should have documented: DAC is for divide and conquer) |
comment:12
It is certainly possible by passing the same list around and mutating it. However, each instance would just have to know which block is its responsibility, which creates a bit more complicated code structure and is likely harder to debug. How often are lists needed to be (re)constructed or are short-lived transient objects? |
This is an experimental implementation of the algorithm presented in section 4.2. of van der Hoeven's "Relax but don't be too lazy".
CC: @tscrim @fchapoton
Component: combinatorics
Keywords: LazyPowerSeries
Author: Martin Rubey
Branch/Commit: u/mantepse/implement_van_hoeven_s_algorithm_for_relaxed_multiplication_of_power_series @
1de1e6d
Issue created by migration from https://trac.sagemath.org/ticket/34616
The text was updated successfully, but these errors were encountered: