|
Calling Sequence
|
|
iratrecon(u, m)
iratrecon(u, m, scaled)
iratrecon(u, m, N, D)
iratrecon(u, m, maxquo, Q)
iratrecon(u, m, N, D, num, den)
iratrecon(u, m, maxquo, Q, num, den)
|
|
Parameters
|
|
u
|
-
|
integer or polynomial with integer coefficients (or a list or Vector or Matrix of these)
|
m
|
-
|
positive integer (the modulus)
|
scaled
|
-
|
(optional) literal name, must be the last argument
|
N, D
|
-
|
(optional) positive integer bounds satisfying
|
maxquo
|
-
|
literal name
|
Q
|
-
|
(optional) positive integer bound
|
num, den
|
-
|
(optional) names assigned the numerator and denominator
|
|
|
|
|
Description
|
|
•
|
If u is an integer, the iratrecon routine reconstructs a signed rational number from its image u modulo m. The routine applies recursively to the coefficients of polynomials, and to the entries of lists, vectors, and matrices. It returns FAIL if reconstruction does not succeed.
|
•
|
The optional last argument scaled reconstructs all rationals over a common denominator. This is faster and appropriate for modular algorithms.
|
•
|
There are two algorithms for recovering rational numbers. Wang's algorithm (the default) uses bounds N and D on the numerator and denominator. If these are not specified, both bounds default to the largest integer satisfying . The condition implies a unique answer.
|
•
|
The optional third argument maxquo specifies that Monagan's maximal quotient algorithm should be used. This algorithm reconstructs with high probability when the modulus is only a modest number of bits longer than , the minimum possible. The algorithm returns the rational corresponding to the largest quotient in the Euclidean algorithm, provided that quotient is larger than a bound Q. If Q is not specified it defaults to , which yields a probability of error that is approximately . If then the algorithm always returns .
|
•
|
An optional six argument syntax specifies all bounds and iratrecon returns true or false to indicate whether reconstruction was successful. On success, the numerator and common denominator are assigned to the 5th and 6th arguments. This syntax implies the scaled option and offers the best performance.
|
|
|
Examples
|
|
>
|
|
>
|
|
>
|
|
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
>
|
|
| (12) |
This example illustrates the improvement (fewer primes needed) of the maximal quotient rational reconstruction algorithm when the rationals being reconstructed when the size of the numerators and denominators are not uniform. The first modulus used is 89*97*101*103*107 which is sufficiently large so that the three rationals appearing in the polynomial do arise in the Euclidean algorithm.
>
|
|
| (17) |
>
|
|
| |
| |
| |
| |
| (18) |
As mentioned, not satisfying may be used, but a solution, if returned, is not necessarily unique.
>
|
|
>
|
|
Note that the is also a viable solution for the second query, but is returned instead. This final example is a vector of rationals using the scaled option.
>
|
|
| (21) |
| (23) |
>
|
|
| (24) |
>
|
|
The common denominator can make it appear as though some numerators exceed the bound, but this is not so when rationals are reduced to lowest terms.
| (28) |
|
|
References
|
|
|
Monagan, M. B. "Maximal Quotient Rational Reconstruction: An Almost Optimal Algorithm for Rational Reconstruction." In Proceedings of ISSAC '04, pp. 243-249. Edited by Jaime Gutierrez. New York: ACM Press, 2004.
|
|
Wang, P. S. "Early Detection of True Factors in Univariate Polynomial Factorization." In Proceedings of EUROCAL '83, pp. 225-235. Edited by J. A. van Hulzen. Springer-Verlag, 1983.
|
|
|
|