include/symbolism/N.GCD.h

00001 //
00002 // GCD algorithm selectors
00003 //
00004 inline void N::gcd(const N& a, const N& b)
00005 {
00006     if(is_small(a))
00007     {
00008         if(is_small(b))
00009         {
00010             gcd_small_small(a.limb, b.limb);
00011         }
00012         else
00013         {
00014             gcd_large_small(b, a.limb);
00015         }
00016     }
00017     else
00018     {
00019         if(is_small(b))
00020         {
00021             gcd_large_small(a, b.limb);
00022         }
00023         else
00024         {
00025             gcd_large_large(a, b);
00026         }
00027     }
00028 }
00029 
00030 inline void N::gcd(const N& b)
00031 {
00032 }
00033 
00034 inline void N::extended_gcd(N& x, N& y, const N& a, const N& b)
00035 {
00036 }
00037 
00038 //
00039 // GCD operators
00040 //
00041 inline N gcd(const N& a, const N& b)
00042 {
00043     N r;
00044     r.gcd(a, b);
00045     return r;
00046 }

Copyright © 2007-2008 Remco Bloemen.

Generated on Tue Jan 22 17:35:31 2008 for symbolism by doxygen 1.5.4

Hosted by SourceForge.net Logo