This articleis missing information about many aspects of the subject (see thetalk page). Please expand the article to include this information. Further details may exist on thetalk page.(July 2018)
Aresidue number system orresidue numeral system (RNS) is anumeral system representingintegers by their valuesmodulo severalpairwise coprime integers called the moduli. This representation is allowed by theChinese remainder theorem, which asserts that, ifM is the product of the moduli, there is, in an interval of lengthM, exactly one integer having any given set of modular values. Using a residue numeral system forarithmetic operations is also calledmulti-modular arithmetic.
Multi-modular arithmetic is widely used for computation with large integers, typically inlinear algebra, because it provides faster computation than with the usual numeral systems, even when the time for converting between numeral systems is taken into account. Other applications of multi-modular arithmetic includepolynomial greatest common divisor,Gröbner basis computation andcryptography.
A residue numeral system is defined by a set ofk integers
called themoduli, which are generally supposed to bepairwise coprime (that is, any two of them have agreatest common divisor equal to one). Residue number systems have been defined for non-coprime moduli, but are not commonly used because of worse properties.[1]
An integerx is represented in the residue numeral system by thefamily of its remainders (indexed by the moduli of the indexes of the moduli)
LetM be the product of all the. Two integers whose difference is a multiple ofM have the same representation in the residue numeral system defined by themis. More precisely, theChinese remainder theorem asserts that each of theM different sets of possible residues represents exactly oneresidue class moduloM. That is, each set of residues represents exactly one integer in the interval. For signed numbers, the dynamic range is(when is even, generally an extra negative value is represented).[2]
For adding, subtracting and multiplying numbers represented in a residue number system, it suffices to perform the samemodular operation on each pair of residues. More precisely, if
is the list of moduli, the sum of the integersx andy, respectively represented by the residues and is the integerz represented by such that
fori = 1, ...,k (as usual, mod denotes themodulo operation consisting of taking the remainder of theEuclidean division by the right operand). Subtraction and multiplication are defined similarly.
For a succession of operations, it is not necessary to apply the modulo operation at each step. It may be applied at the end of the computation, or, during the computation, for avoidingoverflow of hardware operations.
However, operations such as magnitude comparison, sign computation, overflow detection, scaling, and division are difficult to perform in a residue number system.[3]
If two integers are equal, then all their residues are equal. Conversely, if all residues are equal, then the two integers are equal or differ by a multiple ofM. It follows that testing equality is easy.
At the opposite, testing inequalities (x <y) is difficult and, usually, requires to convert integers to the standard representation. As a consequence, this representation of numbers is not suitable for algorithms using inequality tests, such asEuclidean division andEuclidean algorithm.
This sectionneeds expansion. You can help byadding to it.(July 2018)
RNS have applications in the field ofdigitalcomputer arithmetic. By decomposing in this a large integer into a set of smaller integers, a large calculation can be performed as a series of smaller calculations that can be performed independently and in parallel.
Szabo, Nicholas S.; Tanaka, Richard I. (1967).Residue Arithmetic and its Applications to Computer Technology (1 ed.). New York, USA:McGraw-Hill.
Sonderstrand, Michael A.; Jenkins, W. Kenneth; Jullien, Graham A.; Taylor, Fred J., eds. (1986).Residue Number System Arithmetic: Modern Applications in Digital Signal Processing. IEEE Press Reprint Series (1 ed.). New York, USA:IEEE Circuits and Systems Society,IEEE Press.ISBN0-87942-205-X.LCCN86-10516. IEEE order code PC01982. (viii+418+6 pages)
Bajard, Jean-Claude; Méloni, Nicolas; Plantard, Thomas (2006-10-06) [July 2005]."Efficient RNS bases for Cryptography"(PDF).IMACS'05: World Congress: Scientific Computation Applied Mathematics and Simulation. Paris, France. HAL Id: lirmm-00106470.Archived(PDF) from the original on 2021-01-23. Retrieved2021-01-23. (1+7 pages)
Lecerf, Grégoire; Schost, Éric (2003). "Fast multivariate power series multiplication in characteristic zero".SADIO Electronic Journal on Informatics and Operations Research.5 (1):1–10.
Yokoyama, Kazuhiro (September 2012). "Usage of modular techniques for efficient computation of ideal operations".International Workshop on Computer Algebra in Scientific Computing. Berlin / Heidelberg, Germany: Springer. pp. 361–362.
Hladík, Jakub; Šimeček, Ivan (January 2012). "Modular Arithmetic for Solving Linear Equations on the GPU".Seminar on Numerical Analysis. pp. 68–70.
Pernet, Clément (June 2015). "Exact linear algebra algorithmic: Theory and practice".Proceedings of the 2015 ACM on International Symposium on Symbolic and Algebraic Computation.Association for Computing Machinery. pp. 17–18.
Isupov, Konstantin (2021). "High-Performance Computation in Residue Number System Using Floating-Point Arithmetic".Computation.9 (2): 9.doi:10.3390/computation9020009. ISSN 2079-3197.