iratrecon - rational reconstruction
|
Calling Sequence
|
|
iratrecon(u, m)
iratrecon(u, m, N, D)
iratrecon(u, m, maxquo, Q)
|
|
Parameters
|
|
u
|
-
|
integer or polynomial with integer coefficients (or list or Vector or Matrix of these)
|
m
|
-
|
positive integer (the modulus)
|
N, D
|
-
|
(optional) positive integers satisfying
|
maxquo
|
-
|
literal name
|
Q
|
-
|
(optional) positive integer
|
scaled
|
-
|
(optional) literal name
|
|
|
|
|
Description
|
|
•
|
If u is an integer, the iratrecon routine reconstructs a signed rational number from its image u modulo m.
|
•
|
In the first calling sequence, both N (the maximum magnitude of the numerator) and D (the maximum magnitude of the denominator) are chosen to be the largest integer satisfying .
|
•
|
The second calling sequence allows specification of N and D. Note that to obtain a unique answer, N and D must satisfy , though it is still possible to obtain a (possibly not unique) solution in some cases when .
|
•
|
In the third calling sequence, if the integer Q is specified, iratrecon(u,m,'maxquo',Q) returns, if it exists, a rational number satisfying , such that the quotient in the Euclidean algorithm corresponding to the rational is maximal and . Otherwise, iratrecon returns FAIL. If the integer Q is not specified, it defaults to .
|
•
|
To use this routine to reconstruct a rational from u satisfying , the modulus m used must be chosen to be relatively prime to d. Otherwise, the reconstruction will never succeed.
|
•
|
If the input image u is a list or vector or matrix of (polynomials of) integers, iratrecon is applied to the entries of the list (or vector or matrix).
|
|
|
Examples
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
>
|
|
| (12) |
>
|
|
| (13) |
>
|
|
| (14) |
>
|
|
| (15) |
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.
>
|
|
| (16) |
>
|
|
| (17) |
>
|
|
| (18) |
As mentioned, , not satisfying may be used, but a solution, if returned, is not necessarily unique.
>
|
|
| (19) |
>
|
|
| (20) |
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) |
>
|
|
| (22) |
>
|
|
| (23) |
>
|
|
| (24) |
|
|
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.
|
|
|