gcd

Greatest common divisor

Syntax

  • G = gcd(A, B)

Input argument

  • A - a scalar, vector, or matrix of real integer values.

  • B - a scalar, vector, or matrix of real integer values.

Output argument

  • G - result of gcd function (Greatest common divisor).

Description

G = gcd(A, B) computes the greatest common divisor using the Euclidian algorithm.

Bibliography

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

Example

A = [-5 7; 10 0];
B = [-15 3; 50 0];
G = gcd(A, B)

See also

gamma.

History

Author

Allan CORNET

Last updated