Greatest common divisor

`g = gcd(A,B)`

is calculated using the Euclidian
algorithm.[1]

`[g,u,v] = gcd(A,B)`

is calculated using the
extended Euclidian algorithm.[1]

[1] Knuth, D. “Algorithms A and X.” *The
Art of Computer Programming, Vol. 2*, Section 4.5.2. Reading,
MA: Addison-Wesley, 1973.