#include "abkcommon.h"
Include dependency graph for abkfunc.cxx:
Go to the source code of this file.
Functions | |
unsigned | abkGcd (unsigned x, unsigned y) |
author=" Devendra" | |
unsigned | abkGcd (const std::vector< unsigned > &numbers) |
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 } |
|
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 } |
|
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 } |