Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

abkfunc.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class  CompareNameEqual

Functions

unsigned abkGcd (unsigned, unsigned)
 author=" Devendra"

unsigned abkGcd (const std::vector< unsigned > &)
unsigned abkFactorial (unsigned n)


Function Documentation

unsigned abkFactorial unsigned  n  ) 
 

Definition at line 95 of file abkfunc.cxx.

00096 {
00097         unsigned fact=n--;
00098         for(;n!=1;n--) fact*=n;
00099         return fact;
00100 }

unsigned abkGcd const std::vector< unsigned > &   ) 
 

Definition at line 72 of file abkfunc.cxx.

References abkfatal.

00073 {
00074     unsigned count = numbers.size();
00075         abkfatal (count!=0, "Vector of size 0 passed to abkGcd");
00076 
00077     std::vector<unsigned> numsLocal(numbers);
00078     while (1)
00079     {
00080         if (count == 1) return numsLocal[0];
00081 
00082         unsigned i=0;
00083         for (; i < (count/2); i++)
00084           numsLocal[i] = abkGcd (numsLocal[2*i], numsLocal[2*i+1]);
00085 
00086         if (2*i == count) count = i;
00087         else
00088         {
00089             numsLocal[i] = numsLocal[count-1];
00090             count = i+1;
00091         }
00092     }
00093 }

unsigned abkGcd unsigned  ,
unsigned 
 

author=" Devendra"

Definition at line 54 of file abkfunc.cxx.

00055 {
00056     unsigned temp;
00057 
00058     if (x < y)
00059     {
00060         std::swap(x, y);
00061     }
00062 
00063     if (y == 0) return x;
00064 
00065     while (y != 0)
00066     {
00067         temp = x % y; x = y; y = temp;
00068     }
00069     return x;
00070 }


Generated on Mon Apr 25 01:09:37 2005 for Parquete by doxygen 1.3.2