-
-
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
Faster multiplication for multivariate power series #10532
Comments
depends on #1956 and |
Author: pernici |
comment:1
Attachment: trac_10532_faster_MPowerSeries_mul.patch.gz A patch posted by pernici at #1956: First apply #1956, then Comparisons with the Karatsuba algorithm of #10480 still need to be done. |
Reviewer: Niles Johnson |
comment:2
(cc me) |
benchmark |
Attachment: mu2.sage.gz benchmark |
comment:3
Attachment: bench1.sage.gz Attachments: bench1.sage, mu2.sage Here are some benchmarks comparing: (1) with do_mul_trunc_generic (2,K) with do_trunc_karatsuba, where K is K_threshold (1) or (2) are applied after applying These tests are run with QQ and GF(7) as examples of fields Various values of K are tried; (1) corresponds to the K=infinity case The conclusion is that I think that (2) with K=infinity (or a large bench1.sage are the benchmarks posted by Niles to compare with Magma, times are in seconds;
mu2.sage is a modification of the benchmark mu.sage posted in ticket #1956
|
comment:4
If K=infinity is needed to obtain good performance then either we are doing something wrong or truncated karatsuba should be eliminated in favor of the classical truncated algorithm. I will try to look at this, but probably not this week. |
comment:5
In the message above I claimed that patch (1) uses do_mul_trunc_generic; The conclusion of the previous message stands: lftabera wrote:
Right, it can call directly the classical truncated algorithm, but the K=infinity case |
Attachment: trac_1956_faster_MPowerSeries_mul2.patch.gz |
comment:6
The attached patch trac_1956_faster_MPowerSeries_mul2.patch For multivariate series Karatsuba multiplication is slower than generic
The attached patch uses generic multiplication for any precision;
|
Attachment: trac_10532_invert.patch.gz |
comment:7
The attached trac_10532_invert.patch is applied after #1956 patches and In this patch In the benchmarks (0) is without this patch, (1) with it
A special kind of series inversion are series of degree much lower than prec, like
inversion is much faster because in the iteration in the Newton method Finally I point out that in ticket #10720 I wrote a similar but slower |
Attachment: trac_10532_square_trunc.patch.gz |
comment:8
The attached trac_10532_square_trunc.patch is applied after #1956 patches, With this patch truncated multiplication is optimized for squares. Benchmark comparison with PARI/GP:
to do the computation with
|
comment:9
Replying to @sagetrac-pernici:
This looks really good -- but I'm a little confused by the comparison with |
comment:10
niles wrote:
with Well, I don't know either, I just looked at it today.
so that it starts to be convenient to use it when the computation is long For this reason
In the above benchmarks |
comment:11
Replying to @sagetrac-pernici:
I see -- maybe -- can this patch be written to use PARI directly by default then? In the cases where it isn't as fast, the computation time should be small anyway, right? |
comment:12
Replying to @nilesjohnson:
It depends on the use cases; a user may need to do usually a lot of computations with low precision series; then it is important that they are done fast; in the rare case in which he needs a high precision computation, maybe he does not care that it takes 3x longer. Another user may care only for long computations. Another observation: I suspect that total degree multivariate power series implemented with PARI would require changes in the implementation in ticket #1956, not only in this patch; the background power series ring would not be Maybe it would be better to make a specialized multivariate power series class using PARI; this would be the argument of another ticket, if someone is interested in working on it; ticket #1956 and this patch would deal with the generic implementation. |
comment:13
Replying to @sagetrac-pernici:
This sounds like a good idea -- thanks for clarifying. The improvements you've made are certainly worth finishing and including in sage. |
Attachment: trac_10532_send_to_bg.patch.gz |
comment:14
The attached trac_10532_send_to_bg.patch fixes _send_to_bg in the case
|
Multivariate power series are implemented in #1956. Ticket #10480 has a couple of different algorithms for improving
PowerSeries_poly
multiplication.MPowerSeries._mul_
should be modified to take advantage of the optimal algorithm.CC: @sagetrac-mario @sagetrac-pernici @lftabera @nathanncohen
Component: commutative algebra
Keywords: multivariate power series multiplication Karatsuba
Author: pernici
Reviewer: Niles Johnson
Issue created by migration from https://trac.sagemath.org/ticket/10532
The text was updated successfully, but these errors were encountered: