Investigating GCD in Euclidean Domains Rohil Prasad under mentorship of Tanya Khovanova

advertisement
Investigating GCD in Euclidean Domains
Rohil Prasad
under mentorship of Tanya Khovanova
PRIMES 2013
May 18, 2013
W HAT IS GCD?
The greatest common divisor, or GCD, of two integers is the
largest integer that divides both of them.
I
Many algorithms use GCD calculation, one of the more
famous being the RSA encryption algorithm.
I
Several algorithms have been devised to efficiently
calculate GCD for integers.
T HE E UCLIDEAN A LGORITHM
T HE E UCLIDEAN A LGORITHM
T HE E UCLIDEAN A LGORITHM
T HE E UCLIDEAN A LGORITHM
T HE E UCLIDEAN A LGORITHM
T HE B INARY GCD A LGORITHM
T HE B INARY GCD A LGORITHM
T HE B INARY GCD A LGORITHM
T HE B INARY GCD A LGORITHM
T HE B INARY GCD A LGORITHM
T HE B INARY GCD A LGORITHM
T HE B INARY GCD A LGORITHM
T HE B INARY GCD A LGORITHM
T HE B INARY GCD A LGORITHM
E UCLIDEAN D OMAINS
We can extend our definition of GCD to arbitrary Euclidean
domains.
I
A Euclidean domain E is a principal ideal domain with a
function f such that for any nonzero a and b in E, there
exists q and r in E with a = bq + r and f (r) < f (b). This
function is called a norm, and q is called the quotient of a
and b.
I
The integers are an example of a Euclidean domain with
norm f (a) = |a|.
√
√
We work in Z[ 2] and Z[ 3].
I
F INDING GCD IN E UCLIDEAN D OMAINS
What are some ways of efficiently calculating GCD in
Euclidean domains?
I
Option 1: Calculate a quotient
F INDING GCD IN E UCLIDEAN D OMAINS
What are some ways of efficiently calculating GCD in
Euclidean domains?
I
Option 1: Calculate a quotient
I
Option 2: Divide out by a small prime
F INDING GCD IN E UCLIDEAN D OMAINS
What are some ways of efficiently calculating GCD in
Euclidean domains?
I
Option 1: Calculate a quotient
I
Option 2: Divide out by a small prime
I
Option 3: Approximate division
O PTION 1: C ALCULATING THE QUOTIENT
I
√
The quotient of elements in Z[ 2] is calculated as follows:
√
a+b√2
c+d 2
=
√
√
(a+b 2)(c−d 2)
c2 −2d2
=
ac−2bd
c2 −2d2
+
√
(bc−ad) 2
c2 −2d2
O PTION 1: C ALCULATING THE QUOTIENT
I
√
The quotient of elements in Z[ 2] is calculated as follows:
√
a+b√2
c+d 2
I
=
√
√
(a+b 2)(c−d 2)
c2 −2d2
=
ac−2bd
c2 −2d2
+
√
(bc−ad) 2
c2 −2d2
Rounding each component to the nearest integer gives the
quotient.
O PTION 1: C ALCULATING THE QUOTIENT
I
√
The quotient of elements in Z[ 2] is calculated as follows:
√
a+b√2
c+d 2
I
I
=
√
√
(a+b 2)(c−d 2)
c2 −2d2
=
ac−2bd
c2 −2d2
+
√
(bc−ad) 2
c2 −2d2
Rounding each component to the nearest integer gives the
quotient.
√
Quotient calculation is identical in Z[ 3].
O PTION 2: D IVISION BY A SMALL PRIME
I
We use primes of norm 2 because it is easiest to check for
divisibility.
O PTION 2: D IVISION BY A SMALL PRIME
I
We use primes of norm 2 because it is easiest to check for
divisibility.
I
Primes with small components have the fastest
implemented division.
O PTION 2: D IVISION BY A SMALL PRIME
I
We use primes of norm 2 because it is easiest to check for
divisibility.
I
Primes with small components have the fastest
implemented division.
√
√
√
√
We use 1 + 3 for Z[ 3] and 2 ± 2 for Z[ 2].
I
O PTION 3: A PPROXIMATE DIVISION
I
Calcuation of the quotient limits the Euclidean algorithm’s
runtime.
O PTION 3: A PPROXIMATE DIVISION
I
Calcuation of the quotient limits the Euclidean algorithm’s
runtime.
I
A possible solution to this is to approximate the quotient
quickly.
O PTION 3: A PPROXIMATE DIVISION
I
Calcuation of the quotient limits the Euclidean algorithm’s
runtime.
I
A possible solution to this is to approximate the quotient
quickly.
√
√
Current implementations for Z[ 2] and Z[ 3] involves
bitshifting the components of each number by about half
their bitsize and approximating the quotient with these.
I
C OMPARING ALGORITHMS
F UTURE R ESEARCH
There are many directions in which this research can be taken:
√
I Extend ideas to Z[ d] for squarefree d.
F UTURE R ESEARCH
There are many directions in which this research can be taken:
√
I Extend ideas to Z[ d] for squarefree d.
I
Improve performance of the new ‘binary’ and
‘approximate division’ algorithms.
F UTURE R ESEARCH
There are many directions in which this research can be taken:
√
I Extend ideas to Z[ d] for squarefree d.
I
I
Improve performance of the new ‘binary’ and
‘approximate division’ algorithms.
√
Find worst cases for the Euclidean algorithm in Z[ d].
A CKNOWLEDGMENTS
I would like to acknowledge the following:
I
Stefan Wehmeier and Ben Hinkle of Mathworks.
I
My mentor Tanya Khovanova.
I
The MIT PRIMES Program.
I
My family.
Download