473,508 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiprecision arithmetic library question.

I already compiled and installed the GNU multiprecision library
on Mac OS X, and link to it in C programs.
How do I link to the library from Python?
I do not want to download and install redundant material.
(I am new to Python)

--
Michael Press
Jun 27 '08 #1
5 1499
On Jun 17, 5:13*pm, Michael Press <rub...@pacbell.netwrote:
I already compiled and installed the GNU multiprecision library
on Mac OS X, and link to it in C programs.
How do I link to the library from Python?
I do not want to download and install redundant material.
(I am new to Python)

--
Michael Press
GMPY provides the interface between Python and GMP. It is available at

http://code.google.com/p/gmpy/downloads/list

casevh
Jun 27 '08 #2
Michael Press <ru****@pacbell.netwrote:
I already compiled and installed the GNU multiprecision library
on Mac OS X, and link to it in C programs.
How do I link to the library from Python?
You know that Python already supports multiprecision integer arithmetic,
right? If you desperately want GMP, though, there's the gmpy module
(q.g.).

-- [mdw]
Jun 27 '08 #3
In article <sl****************@metalzone.distorted.org.uk>,
Mark Wooding <md*@distorted.org.ukwrote:
Michael Press <ru****@pacbell.netwrote:
I already compiled and installed the GNU multiprecision library
on Mac OS X, and link to it in C programs.
How do I link to the library from Python?

You know that Python already supports multiprecision integer arithmetic,
right? If you desperately want GMP, though, there's the gmpy module
(q.g.).
No, I do not know that. Define desperate.
Does Python support the extended Euclidean algorithm
and other number theory functions?
How fast does Python multiply?
Not that the latter is particularly important,
as C is built for speed.

I've been fooling around. Ran dir(gmpy), and
it does not show the full complement of GMP
library functions, such as the various division
functions. e.g. mpz_tdiv_qr.

--
Michael Press
Jun 27 '08 #4
Michael Press wrote:
In article <sl****************@metalzone.distorted.org.uk>,
Mark Wooding <md*@distorted.org.ukwrote:
>Michael Press <ru****@pacbell.netwrote:
>>I already compiled and installed the GNU multiprecision library
on Mac OS X, and link to it in C programs.
How do I link to the library from Python?
You know that Python already supports multiprecision integer arithmetic,
right? If you desperately want GMP, though, there's the gmpy module
(q.g.).

No, I do not know that. Define desperate.
Does Python support the extended Euclidean algorithm
and other number theory functions?
How fast does Python multiply?
Not that the latter is particularly important,
as C is built for speed.

I've been fooling around. Ran dir(gmpy), and
it does not show the full complement of GMP
library functions, such as the various division
functions. e.g. mpz_tdiv_qr.
There's also
http://www.egenix.com/products/pytho...ntal/mxNumber/. I'm not
sure how the functionality compares to GMPY.

Duncan
Jun 27 '08 #5
No, I do not know that. Define desperate.
Does Python support the extended Euclidean algorithm
and other number theory functions?
No.
How fast does Python multiply?
Python uses the Karatsuba algorithm which O(n^1.585). Division is
still O(n^2).
Not that the latter is particularly important,
as C is built for speed.

I've been fooling around. Ran dir(gmpy), and
it does not show the full complement of GMP
library functions, such as the various division
functions. e.g. mpz_tdiv_qr.
gmpy implements the Python numeric model using GMP and exposes some of
the high-level functions. Are you looking for low-level wrapper that
exposes all the GMP library functions?
--
Michael Press
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
30253
by: Gary.Hu | last post by:
I was trying to catch the Arithmetic exception, unsuccessfully. try{ int a = 0, b = 9; b = b / a; }catch(...){ cout << "arithmetic exception was catched!" << endl; } After ran the program,...
3
2384
by: Christian Brechbühler | last post by:
Let me use complex numbers as a familiar example. The following is taken verbatim from Bjarne Stroustrup, "The C++ Programming Language", except the include line and the "no match" comments. It...
3
2736
by: Karthik | last post by:
Hi, I am writing this application that needs a lot of arithmetic calculations. I was wondering if C++ language specifies any way of detecting arithmetic overflows. Let us consider the following...
5
1605
by: Jeremy Watts | last post by:
Hi, I'm a C++ newbie and wondered whether C or C++ have an 'arbitrary length' arithmetic facility, similar to say JAVA's 'BigInteger', that will carry out arithmetic operations symbolically on...
4
1542
by: PDHB | last post by:
I'm sorry, but this is just the height of stupidity. I love the dot net framework. It has actually been sufficient to convert an anti-microsoft extremist (myself) to the windows camp. But not...
26
3022
by: Bill Reid | last post by:
Bear with me, as I am not a "professional" programmer, but I was working on part of program that reads parts of four text files into a buffer which I re-allocate the size as I read each file. I...
7
3785
by: GCRhoads | last post by:
I'm looking for a very basic high-precision arithmetic library. I need to be able to specify a fixed number of bits or decimal digits (32 decimal digits should be all I need). The only arithmetic...
3
1984
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does simple decimal arithmetic give strange results?...
2
1568
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does simple decimal arithmetic give strange results?...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.