Residue Number System

A residue numeral system (RNS) is a numeral system representing integers by their values modulo several pairwise coprime integers called the moduli.

This representation is allowed by the Chinese remainder theorem, which asserts that, if M is the product of the moduli, there is, in an interval of length M, exactly one integer having any given set of modular values. The arithmetic 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, 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, Gröbner basis computation and cryptography.

Definition

A residue numeral system is defined by a set of k integers

    Residue Number System 

called the moduli, which are generally supposed to be pairwise coprime (that is, any two of them have a greatest common divisor 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 x is represented in the residue numeral system by the set of its remainders

    Residue Number System 

under Euclidean division by the moduli. That is

    Residue Number System 

and

    Residue Number System 

for every i

Let M be the product of all the Residue Number System . Two integers whose difference is a multiple of M have the same representation in the residue numeral system defined by the mis. More precisely, the Chinese remainder theorem asserts that each of the M different sets of possible residues represents exactly one residue class modulo M. That is, each set of residues represents exactly one integer Residue Number System  in the interval Residue Number System . For signed numbers, the dynamic range is Residue Number System  (when Residue Number System  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

    Residue Number System 

is the list of moduli, the sum of the integers x and y, respectively represented by the residues Residue Number System  and Residue Number System  is the integer z represented by Residue Number System  such that

    Residue Number System 

for i = 1, ..., k (as usual, mod denotes the modulo operation consisting of taking the remainder of the Euclidean 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 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 M. 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 as Euclidean division and Euclidean algorithm.

Division

Division in residue numeral systems is problematic. On the other hand, if Residue Number System  is coprime with Residue Number System  (that is Residue Number System ) then

    Residue Number System 

can be easily calculated by

    Residue Number System 

where Residue Number System  is multiplicative inverse of Residue Number System  modulo Residue Number System , and Residue Number System  is multiplicative inverse of Residue Number System  modulo Residue Number System .

Applications

RNS have applications in the field of digital computer 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

References

Further reading

Tags:

Residue Number System DefinitionResidue Number System Arithmetic operationsResidue Number System ApplicationsResidue Number System Further readingResidue Number System

🔥 Trending searches on Wiki English:

Ford v FerrariBradley CooperSamantha MortonXXX (2002 film)ACherry blossomCharles BronsonDavid BeckhamLiam Neeson2024 Indian general election in KarnatakaNirmala SitharamanChesapeake Bay BridgeBilly BushKingdom of Heaven (film)South AfricaRachel McAdamsEnglish languageWe Were the Lucky OnesThe Pirate BayMax VerstappenGeorge IIIPremaluNatasha RichardsonMadgaon ExpressPeaky BlindersChalino SánchezThe Amazing Race 36TikTokGenghis KhanCanadaSeven deadly sinsBlessyLady GagaRoyal MaundyUnited StatesArvind KejriwalList of presidents of the United StatesWorld War IIFrank SinatraBrandon LeeElizabeth TaylorFascismCamila CabelloJennifer LawrenceSexual intercourseMarie CurieConjoined twinsBassirou Diomaye FayeGoogle MapsX-Men '97Guy RitchieWorld War IRed heiferPope FrancisDev PatelThe Beekeeper (2024 film)Damsel (2024 film)BeetlejuiceSibgatullah AnsariBiggest ball of twineBramayugamSunshine Skyway BridgeItalyHouse of the DragonThe Accountant (2016 film)Electoral BondKobbie MainooJon Paul SteuerChang and Eng BunkerList of World Series championsUkraine2024 Summer OlympicsKurt CobainXHamsterSolo LevelingJackie Chan🡆 More