Fix slow numerical computation of zeta({7,3}).
authorStefan Weinzierl <weinzierl@uni-mainz.de>
Tue, 4 Jun 2019 08:21:10 +0000 (10:21 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Tue, 4 Jun 2019 08:21:10 +0000 (10:21 +0200)
The bug was reported by Vitaly Magerya <vmagerya@gmail.com>, see
<https://www.ginac.de/pipermail/ginac-list/2019-May/002265.html>.

ginac/inifcns_nstdsums.cpp

index 0a60d78..f040e8a 100644 (file)
@@ -3882,17 +3882,21 @@ static ex zeta1_evalf(const ex& x)
                const int count = x.nops();
                const lst& xlst = ex_to<lst>(x);
                std::vector<int> r(count);
+               std::vector<int> si(count);
 
                // check parameters and convert them
                auto it1 = xlst.begin();
                auto it2 = r.begin();
+               auto it_swrite = si.begin();
                do {
                        if (!(*it1).info(info_flags::posint)) {
                                return zeta(x).hold();
                        }
                        *it2 = ex_to<numeric>(*it1).to_int();
+                       *it_swrite = 1;
                        it1++;
                        it2++;
+                       it_swrite++;
                } while (it2 != r.end());
 
                // check for divergence
@@ -3900,6 +3904,10 @@ static ex zeta1_evalf(const ex& x)
                        return zeta(x).hold();
                }
 
+               // use Hoelder convolution if Digits is large
+               if (Digits>50)
+                       return numeric(zeta_do_Hoelder_convolution(r, si));
+
                // decide on summation algorithm
                // this is still a bit clumsy
                int limit = (Digits>17) ? 10 : 6;