HOME

TheInfoList



OR:

A residue numeral system (RNS) is a
numeral system A numeral system (or system of numeration) is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using Numerical digit, digits or other symbols in a consistent manner. The same s ...
representing
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
s by their values
modulo In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the '' modulus'' of the operation). Given two positive numbers and , modulo (often abbreviated as ) is t ...
several
pairwise coprime In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
integers called the moduli. This representation is allowed by the
Chinese remainder theorem In mathematics, the Chinese remainder theorem states that if one knows the remainders of the Euclidean division of an integer ''n'' by several integers, then one can determine uniquely the remainder of the division of ''n'' by the product of thes ...
, which asserts that, if is the product of the moduli, there is, in an interval of length , exactly one integer having any given set of modular values. The
arithmetic Arithmetic () is an elementary part of mathematics that consists of the study of the properties of the traditional operations on numbers— addition, subtraction, multiplication, division, exponentiation, and extraction of roots. In the 19th ...
of a residue numeral system is also called multi-modular arithmetic. Multi-modular arithmetic is widely used for computation with large integers, typically in
linear algebra Linear algebra is the branch of mathematics concerning linear equations such as: :a_1x_1+\cdots +a_nx_n=b, linear maps such as: :(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n, and their representations in vector spaces and through matrices. ...
, 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 include
polynomial greatest common divisor In algebra, the greatest common divisor (frequently abbreviated as GCD) of two polynomials is a polynomial, of the highest possible degree, that is a factor of both the two original polynomials. This concept is analogous to the greatest common di ...
,
Gröbner basis In mathematics, and more specifically in computer algebra, computational algebraic geometry, and computational commutative algebra, a Gröbner basis is a particular kind of generating set of an ideal in a polynomial ring over a field . A Gröbn ...
computation and
cryptography Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or ''-logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of adver ...
.


Definition

A residue numeral system is defined by a set of integers :\, called the ''moduli'', which are generally supposed to be
pairwise coprime In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
(that is, any two of them have a
greatest common divisor In mathematics, the greatest common divisor (GCD) of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For two integers ''x'', ''y'', the greatest common divisor of ''x'' and ''y'' is ...
equal to one). Residue number systems have been defined for non-coprime moduli, but are not commonly used because of worse properties. Therefore, they will not be considered in the remainder of this article. An integer is represented in the residue numeral system by the set of its remainders :\ under
Euclidean division In arithmetic, Euclidean division – or division with remainder – is the process of dividing one integer (the dividend) by another (the divisor), in a way that produces an integer quotient and a natural number remainder strictly smaller than ...
by the moduli. That is : x_i = x \operatornamem_i, and :0\le x_i for every Let be the product of all the m_i. Two integers whose difference is a multiple of have the same representation in the residue numeral system defined by the s. More precisely, the
Chinese remainder theorem In mathematics, the Chinese remainder theorem states that if one knows the remainders of the Euclidean division of an integer ''n'' by several integers, then one can determine uniquely the remainder of the division of ''n'' by the product of thes ...
asserts that each of the different sets of possible residues represents exactly one
residue class In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book ...
modulo . That is, each set of residues represents exactly one integer X in the interval 0,\dots,M-1. For signed numbers, the dynamic range is \le X \le \lfloor (M-1)/2 \rfloor (when M is even, generally an extra negative value is represented).


Arithmetic operations

For adding, subtracting and multiplying numbers represented in a residue number system, it suffices to perform the same modular operation on each pair of residues. More precisely, if : _1, \ldots, m_k/math> is the list of moduli, the sum of the integers and , respectively represented by the residues _1,\ldots, x_k/math> and _1,\ldots, y_k is the integer represented by _1,\ldots, z_k such that :z_i= (x_i+y_i)\operatorname m_i, for (as usual, mod denotes the
modulo operation In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the '' modulus'' of the operation). Given two positive numbers and , modulo (often abbreviated as ) is th ...
consisting of taking the remainder of the
Euclidean division In arithmetic, Euclidean division – or division with remainder – is the process of dividing one integer (the dividend) by another (the divisor), in a way that produces an integer quotient and a natural number remainder strictly smaller than ...
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 avoiding overflow 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.


Comparison

If two integers are equal, then all their residues are equal. Conversely, if all residues are equal, then the two integers are equal, or their differences is a multiple of . It follows that testing equality is easy. At the opposite, testing inequalities () 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
Euclidean division In arithmetic, Euclidean division – or division with remainder – is the process of dividing one integer (the dividend) by another (the divisor), in a way that produces an integer quotient and a natural number remainder strictly smaller than ...
and
Euclidean algorithm In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is an effi ...
.


Division

Division in residue numeral systems is problematic. On the other hand, if B is coprime with M (that is b_i\not =0) then :C=A\cdot B^ \mod M can be easily calculated by :c_i=a_i \cdot b_i^ \mod m_i, where B^ is
multiplicative inverse In mathematics, a multiplicative inverse or reciprocal for a number ''x'', denoted by 1/''x'' or ''x''−1, is a number which when Multiplication, multiplied by ''x'' yields the multiplicative identity, 1. The multiplicative inverse of a rat ...
of B modulo M, and b_i^ is multiplicative inverse of b_i modulo m_i.


Applications

RNS have applications in the field of
digital Digital usually refers to something using discrete digits, often binary digits. Technology and computing Hardware *Digital electronics, electronic circuits which operate using digital signals **Digital camera, which captures and stores digital i ...
computer arithmetic In computing, an arithmetic logic unit (ALU) is a combinational digital circuit that performs arithmetic and bitwise operations on integer binary numbers. This is in contrast to a floating-point unit (FPU), which operates on floating point numb ...
. 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.


See also

*
Covering system In mathematics, a covering system (also called a complete residue system) is a collection :\ of finitely many residue classes a_i(\mathrm\ ) = \ whose union contains every integer. Examples and definitions The notion of covering system was i ...
*
Reduced residue system In mathematics, a subset ''R'' of the integers is called a reduced residue system modulo ''n'' if: #gcd(''r'', ''n'') = 1 for each ''r'' in ''R'', #''R'' contains φ(''n'') elements, #no two elements of ''R'' are congruent modulo ''n''. Here φ d ...


References


Further reading

* * (viii+418+6 pages) *Chervyakov, N. I.; Molahosseini, A. S.; Lyakhov, P. A. (2017)
Residue-to-binary conversion for general moduli sets based on approximate Chinese remainder theorem
International Journal of Computer Mathematics The ''International Journal of Computer Mathematics'' is a monthly peer-reviewed scientific journal covering numerical analysis and scientific computing. It was established in 1964 and is published by Taylor & Francis. The editors-in-chief are Choi ...
, 94:9, 1833-1849, doi: 10.1080/00207160.2016.1247439. * *Chervyakov, N. I.; Lyakhov, P. A.; Deryabin, M. A. (2020)
Residue Number System-Based Solution for Reducing the Hardware Cost of a Convolutional Neural Network
Neurocomputing Computational neuroscience (also known as theoretical neuroscience or mathematical neuroscience) is a branch of neuroscience which employs mathematical models, computer simulations, theoretical analysis and abstractions of the brain to u ...
, 407, 439-453, doi: 10.1016/j.neucom.2020.04.018. * (1+7 pages) * (296 pages) * (351 pages) * (389 pages) * Division algorithms * * * * * * * * * {{cite journal , author-last1=Yokoyama , author-first1=Kazuhiro , author-last2=Noro , author-first2=Masayuki , author-last3=Takeshima , author-first3=Taku , date=1994 , title=Multi-Modular Approach to Polynomial-Time Factorization of Bivariate Integral Polynomials , journal=
Journal of Symbolic Computation The ''Journal of Symbolic Computation'' is a peer-reviewed monthly scientific journal covering all aspects of symbolic computation published by Academic Press and then by Elsevier. It is targeted to both mathematicians and computer scientists. It ...
, volume=17 , issue=6 , pages=545–563, doi=10.1006/jsco.1994.1034 , doi-access=free *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. Modular arithmetic Computer arithmetic