CoeffSize: function to measure the size of coeffs in a poly
In email Anna proposed a function, tentatively named
CoeffSize, to measure the size of the coeffs in a poly (over
#1 Updated by John Abbott over 1 year ago
The definition originally proposed in email was to return a pair of integers being effectively
[max(FloorLog10(num(c))) | c in coeffs] and
[max(FloorLog10(den(c))) | c in coeffs].
- determine the least common denom of the coeffs, return log of the commondenom and the max of log of numerators (after clearing the denom)
- return sum of logs of numerators and sum of logs of denominators (roughly the print-size of the poly)
Anna wrote saying that the idea was to estimate the modulus needed so that (fault-tolerant) rational recovery would work. In this case the result should probably be a single integer being
max([FloorLog10(num(c)) + FloorLog10(den(c)) | c in coeffs]. Maybe it would be better to find the max of
If the rational recovery tries to be clever by keeping track of common-denom-so-far then
CoeffSize needs to be a little more sophisticated (keep track itself of the common-denom-so-far, then return max of
#2 Updated by John Abbott over 1 year ago
Anna has put a first prototype in
experimental.cpkg5; it follows the original defn. It is deliberately not documented.
JAA thinks that if we find a function useful then it should be made public because it will probably be useful (eventually) to someone else.
Regarding fault-tolerant rational recovery, JAA thinks the most appropriate size measure for a rational is something like
0.3*(3.5+FloorLog2(num(q)*den(q))+FloorSqrt(FloorLog2(num(q)*den(q)))) if the "continued fraction method" is used.
4+FloorLog10(num(q)*den(q)) gives a fair approximation in most cases.