Airy zeta function

From formulasearchengine
Revision as of 21:18, 9 November 2013 by 46.115.90.113 (talk) (MathWorld)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In modular arithmetic, Barrett reduction is a reduction algorithm introduced in 1986 by P.D. Barrett.[1] A naive way of computing

c=amodn.

would be to use a fast division algorithm. Barrett reduction is an algorithm designed to optimize this operation assuming n is constant, and a<n2, replacing divisions by multiplications.

Naive idea

Let m=1/n be the inverse of n as a floating point number. Then

amodn=aamn where x denotes the floor function,

assuming m was computed with sufficient accuracy.

Barrett algorithm

Barrett algorithm is a fixed-point analog which expresses everything in terms of integers. Let k be the smallest integer such that 2k>n. Think of n as representing the fixed-point number n2k. We precompute m such that m=4k/n. Then m represents the fixed-point number m2k(n2k)1.

Let q=ma4k and r=aqn.

Clearly ar(modn), and if a<n2 then r<2n. So

amodn={rif r<nrnotherwise

Barrett algorithm for polynomials

It is also possible to use Barrett algorithm for polynomial division, by reversing polynomials and using X-adic arithmetic.Template:Clarify

See also

Montgomery reduction is another similar algorithm.

References

43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.

Sources