Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Residue number system

From Wikipedia, the free encyclopedia
(Redirected fromResidue numeral system)
Multi-modular arithmetic
This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages)
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)
This articlerelies largely or entirely on asingle source. Relevant discussion may be found on thetalk page. Please helpimprove this article byintroducing citations to additional sources.
Find sources: "Residue number system" – news ·newspapers ·books ·scholar ·JSTOR
(July 2018)
This article includes alist of references,related reading, orexternal links,but its sources remain unclear because it lacksinline citations. Please helpimprove this article byintroducing more precise citations.(July 2018) (Learn how and when to remove this message)

(Learn how and when to remove this message)

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.

Definition

[edit]

A residue numeral system is defined by a set ofk integers

{m1,m2,m3,,mk},{\displaystyle \{m_{1},m_{2},m_{3},\ldots ,m_{k}\},}

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)

{x1,x2,x3,,xk}{\displaystyle \{x_{1},x_{2},x_{3},\ldots ,x_{k}\}}

underEuclidean division by the moduli. That is

xi=xmodmi,{\displaystyle x_{i}=x\operatorname {mod} m_{i},}

and

0xi<mi{\displaystyle 0\leq x_{i}<m_{i}}

for everyi

LetM be the product of all themi{\displaystyle m_{i}}. 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 integerX{\displaystyle X} in the interval0,,M1{\displaystyle 0,\dots ,M-1}. For signed numbers, the dynamic range isM/2X(M1)/2{\textstyle {-\lfloor M/2\rfloor }\leq X\leq \lfloor (M-1)/2\rfloor }(whenM{\displaystyle M} is even, generally an extra negative value is represented).[2]

Arithmetic operations

[edit]

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

[m1,,mk]{\displaystyle [m_{1},\ldots ,m_{k}]}

is the list of moduli, the sum of the integersx andy, respectively represented by the residues[x1,,xk]{\displaystyle [x_{1},\ldots ,x_{k}]} and[y1,,yk],{\displaystyle [y_{1},\ldots ,y_{k}],} is the integerz represented by[z1,,zk],{\displaystyle [z_{1},\ldots ,z_{k}],} such that

zi=(xi+yi)modmi,{\displaystyle z_{i}=(x_{i}+y_{i})\operatorname {mod} m_{i},}

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]

Comparison

[edit]

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.

Division

[edit]

Division in residue numeral systems is problematic. On the other hand, ifB{\displaystyle B} is coprime withM{\displaystyle M} (that isbi0{\displaystyle b_{i}\not =0}) then

C=AB1modM{\displaystyle C=A\cdot B^{-1}\mod M}

can be easily calculated by

ci=aibi1modmi,{\displaystyle c_{i}=a_{i}\cdot b_{i}^{-1}\mod m_{i},}

whereB1{\displaystyle B^{-1}} ismultiplicative inverse ofB{\displaystyle B} moduloM{\displaystyle M}, andbi1{\displaystyle b_{i}^{-1}} is multiplicative inverse ofbi{\displaystyle b_{i}} modulomi{\displaystyle m_{i}}.

Applications

[edit]
[icon]
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.

See also

[edit]

References

[edit]
  1. ^Parhami, Behrooz (2010).Computer Arithmetic: Algorithms and Hardware Designs (2 ed.). New York, USA:Oxford University Press.ISBN 978-0-19-532848-6.Archived from the original on 2020-08-04. Retrieved2021-01-23. (xxv+641 pages)
  2. ^Hung, C.Y.; Parhami, B. (1994-02-01)."An approximate sign detection method for residue numbers and its application to RNS division"(PDF).Computers & Mathematics with Applications.27 (4):23–35.doi:10.1016/0898-1221(94)90052-3.
  3. ^Isupov, Konstantin (2020-04-07) [2020-03-20, 2020-03-08, 2020-02-17]."Using Floating-Point Intervals for Non-Modular Computations in Residue Number System".IEEE Access.8:58603–58619.Bibcode:2020IEEEA...858603I.doi:10.1109/ACCESS.2020.2982365.ISSN 2169-3536.

Further reading

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Residue_number_system&oldid=1314007648"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp