1
function [g,u] = %i_bezout(a,b)
2
// g = bezout(a,b) is the greatest common divisor of a and b.
3
// a and b must contain non-negative integer scalars.
4
// [g,U] = bezout(a,b) also returns a (2x2) unimodular matrix U such that:
6
// These are useful for solving Diophantine equations and computing
7
// Hermite transformations.
9
it=max(inttype(a),inttype(b))
10
a=iconvert(a,it);b=iconvert(b,it)
11
u = [iconvert([1 0],it) a];
12
v = [iconvert([0 1],it) b];
21
u=[u(1) -v(1);u(2) -v(2)]