Code covered by the BSD License  

Highlights from
egcd.m

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.45 KB File ID: #23944

egcd.m

by Steven Gregory

 

28 Apr 2009 (Updated 24 Jan 2011)

Extended greatest common divisor. Finds g = GCD(x(1), ..., x(end)) and v such that g == sum(v.*x).

| Watch this File

File Information
Description

[g v] = egcd(x) returns g = gcd(x(1), x(2), ..., x(end)) and v such that g == sum(v.*abs(x)).

MATLAB release MATLAB 7.4 (R2007a)
Other requirements The vpi suite of objects is required.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
24 Jan 2011

Just realized that egcd works on abs(x) and not x. If you need v, use v = sign(x)*v. Then g == sum(v.*x) will be true.

Tag Activity for this File
Tag Applied By Date/Time
vpi Steven Gregory 28 Apr 2009 15:23:00
number theory Steven Gregory 28 Apr 2009 15:23:00
mathematics Steven Gregory 28 Apr 2009 15:23:00
mathematics tirumala vasu 28 Feb 2010 14:06:03
mathematics Binbin Qi 25 Jan 2011 03:24:38
vpi Ryan 09 Dec 2011 18:36:10

Contact us at files@mathworks.com