Re: [Numpy-discussion] Greater common divisor

2010-06-08 Thread Sebastian Haase
googling for
greatest common divisor OR denominator numpy OR scipy OR python

I found this:
http://projects.scipy.org/numpy/browser/trunk/numpy/core/_internal.py?rev=8316
554 def _gcd(a, b):
555 Calculate the greatest common divisor of a and b
556 while b:
557 a, b = b, a%b
558 return a

or this:
http://www.geekpedia.com/code120_Find-The-Greatest-Common-Divisor.html
def euclid(numA, numB):
   while numB != 0:
  numRem = numA % numB
  numA = numB
  numB = numRem
   return numA


HTH,
Sebastian Haase



On Mon, Jun 7, 2010 at 12:19 PM, Daniele Nicolodi dani...@grinta.net wrote:
 Hello. There is a method in numpy to compute the greater common divisor
 of the elements of an array? Searching through the documentation I
 didn't find it.

 Thanks. Cheers,
 --
 Daniele
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Greater common divisor

2010-06-08 Thread Charles R Harris
On Mon, Jun 7, 2010 at 4:19 AM, Daniele Nicolodi dani...@grinta.net wrote:

 Hello. There is a method in numpy to compute the greater common divisor
 of the elements of an array? Searching through the documentation I
 didn't find it.


If you need to do more complicated stuff based around the GCD, like finding
the Hermite normal form, SAGE might be a better bet.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion