From husam_74 at yahoo.com Wed Jul 2 00:32:26 2008 From: husam_74 at yahoo.com (Husam Abu-Haimed) Date: Tue, 1 Jul 2008 15:32:26 -0700 (PDT) Subject: Hash function Message-ID: <506542.18195.qm@web56002.mail.re3.yahoo.com> Hi, Is there a function to generate a hash key for an instance of the GMP class? I appreciate the help. Thanks, Husam From al at beshenov.ru Wed Jul 2 10:56:12 2008 From: al at beshenov.ru (Alexey Beshenov) Date: Wed, 2 Jul 2008 12:56:12 +0400 Subject: Hash function In-Reply-To: <506542.18195.qm@web56002.mail.re3.yahoo.com> References: <506542.18195.qm@web56002.mail.re3.yahoo.com> Message-ID: <200807021256.13000.al@beshenov.ru> On Wednesday 02 July 2008 02:32:26 Husam Abu-Haimed wrote: > Is there a function to generate a hash key for an instance of the GMP class? > > I appreciate the help. There is no "GMP class". GMP comes with moderate C++ interface with 3 classes: mpz_class, mpq_class, mpf_class. There are no hash functions. -- Alexey Beshenov http://beshenov.ru/ From pighogswine at gmail.com Thu Jul 10 13:47:46 2008 From: pighogswine at gmail.com (Fang, Zhe) Date: Thu, 10 Jul 2008 19:47:46 +0800 Subject: Insatllation cannot find compiler Message-ID: Hi All, I am trying to install gmp-4.2.2 on Ubuntu 7.10 with gcc 4.1.3 installed. But it failed at ./configure stage. I googled and found that this is a common problem. Anybody knows why? I'm pretty sure that gcc is correctly installed. The following is the output during config: pighogswine at pighogswine-desktop:~/gmp-4.2.2$ ./configure checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking ABI=64 checking compiler gcc -O2 -m64 ... no checking ABI=32 checking compiler gcc -m32 -O2 -fomit-frame-pointer ... no checking compiler gcc -O2 -fomit-frame-pointer ... no checking compiler icc -no-gcc ... no checking whether cc is gcc... yes checking compiler cc -m32 -O2 -fomit-frame-pointer ... no checking compiler cc -O2 -fomit-frame-pointer ... no configure: error: could not find a working compiler, see config.log for details -- Best wishes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://swox.com/list-archives/gmp-discuss/attachments/20080710/915d2648/attachment.html From csv610 at gmail.com Mon Jul 14 18:02:59 2008 From: csv610 at gmail.com (Chaman Singh Verma) Date: Mon, 14 Jul 2008 21:32:59 +0530 Subject: mathematical functions Message-ID: <21f0b0400807140902o3f342c26ia1e80d4a81539410@mail.gmail.com> Hello, I am new to GMP and I was looking for mathematical functions ( sinx, cosx, atan etc ) using GMP. Can someone give me hints/links for such functions ? Chaman Singh Verma Poona -------------- next part -------------- An HTML attachment was scrubbed... URL: http://swox.com/list-archives/gmp-discuss/attachments/20080714/62d99be5/attachment.html From sisyphus1 at optusnet.com.au Tue Jul 15 10:29:42 2008 From: sisyphus1 at optusnet.com.au (Sisyphus) Date: Tue, 15 Jul 2008 18:29:42 +1000 Subject: mathematical functions In-Reply-To: <21f0b0400807140902o3f342c26ia1e80d4a81539410@mail.gmail.com> References: <21f0b0400807140902o3f342c26ia1e80d4a81539410@mail.gmail.com> Message-ID: ----- Original Message ----- From: "Chaman Singh Verma" To: Sent: Tuesday, July 15, 2008 2:02 AM Subject: mathematical functions > Hello, > > I am new to GMP and I was looking for mathematical functions ( sinx, cosx, > atan etc ) using GMP. Can someone give me hints/links for such functions ? > See http://www.mpfr.org/ Documentation for the available trig functions can be found online at http://www.mpfr.org/mpfr-current/mpfr.html#Special-Functions Cheers, Rob Cheers, Rob From tg at swox.com Wed Jul 16 14:11:00 2008 From: tg at swox.com (Torbjorn Granlund) Date: Wed, 16 Jul 2008 14:11:00 +0200 Subject: Insatllation cannot find compiler In-Reply-To: (Zhe Fang's message of "Thu\, 10 Jul 2008 19\:47\:46 +0800") References: Message-ID: <86mykivxkb.fsf@king.swox.se> "Fang, Zhe" writes: I am trying to install gmp-4.2.2 on Ubuntu 7.10 with gcc 4.1.3 installed. But it failed at ./configure stage. I googled and found that this is a common problem. Anybody knows why? I'm pretty sure that gcc is correctly installed. Have you successfully compiled hello.c? I strongly suspect you dn't have any compiler, or that it is not in your path. -- Torbj?rn From tg at swox.com Wed Jul 16 15:17:57 2008 From: tg at swox.com (Torbjorn Granlund) Date: Wed, 16 Jul 2008 15:17:57 +0200 Subject: Insatllation cannot find compiler In-Reply-To: (Zhe Fang's message of "Wed\, 16 Jul 2008 20\:48\:55 +0800") References: <86mykivxkb.fsf@king.swox.se> Message-ID: <861w1uvugq.fsf@king.swox.se> "Fang, Zhe" writes: But, cc -v works... I asked if your compiler can compile a plain stand-alone program like the classical hello.c. Until you have verified that, please don't ask for more help. -- Torbj?rn From pighogswine at gmail.com Wed Jul 16 14:48:55 2008 From: pighogswine at gmail.com (Fang, Zhe) Date: Wed, 16 Jul 2008 20:48:55 +0800 Subject: Insatllation cannot find compiler In-Reply-To: <86mykivxkb.fsf@king.swox.se> References: <86mykivxkb.fsf@king.swox.se> Message-ID: But, cc -v works... On 7/16/08, Torbjorn Granlund wrote: > > "Fang, Zhe" writes: > > I am trying to install gmp-4.2.2 on Ubuntu 7.10 with gcc 4.1.3 installed. > But it failed at ./configure stage. I googled and found that this is a > common problem. Anybody knows why? I'm pretty sure that gcc is correctly > installed. > > Have you successfully compiled hello.c? > > I strongly suspect you dn't have any compiler, or > that it is not in your path. > > -- > Torbj?rn > -- Best wishes, Fang, Zhe -------------- next part -------------- An HTML attachment was scrubbed... URL: http://swox.com/list-archives/gmp-discuss/attachments/20080716/0cacd557/attachment.html From pighogswine at gmail.com Wed Jul 16 16:26:50 2008 From: pighogswine at gmail.com (Fang, Zhe) Date: Wed, 16 Jul 2008 22:26:50 +0800 Subject: Fwd: Insatllation cannot find compiler In-Reply-To: References: <86mykivxkb.fsf@king.swox.se> <861w1uvugq.fsf@king.swox.se> Message-ID: ---------- Forwarded message ---------- From: Fang, Zhe Date: Wed, Jul 16, 2008 at 10:26 PM Subject: Re: Insatllation cannot find compiler To: Torbjorn Granlund It does compile hello world. Although, I don't see why you are so convicted that gcc is not properly installed, even when "gcc -v" is working fine. Anyway, I have switched to another Linux distribution and the problem is gone. On Wed, Jul 16, 2008 at 9:17 PM, Torbjorn Granlund wrote: > "Fang, Zhe" writes: > > But, > cc -v > works... > > I asked if your compiler can compile a plain stand-alone program like > the classical hello.c. > > Until you have verified that, please don't ask for more help. > > -- > Torbj?rn > -- Best wishes, Fang, Zhe -- Best wishes, Fang, Zhe -------------- next part -------------- An HTML attachment was scrubbed... URL: http://swox.com/list-archives/gmp-discuss/attachments/20080716/391420c2/attachment.html From tom at dbservice.com Wed Jul 16 20:39:18 2008 From: tom at dbservice.com (Tomas Carnecky) Date: Wed, 16 Jul 2008 20:39:18 +0200 Subject: But on X86/64, -fno-pic doesn't seem to have any effect whatsoever. Message-ID: <487E4056.808@dbservice.com> On Linux, 64bit shared objects need position independent code, without it linking against them will fail. Static libraries / executables don't need it. See for example x264's ./configure to see how it detects whether PIC is needed or not. tom From tg at swox.com Thu Jul 17 14:57:58 2008 From: tg at swox.com (Torbjorn Granlund) Date: Thu, 17 Jul 2008 14:57:58 +0200 Subject: But on X86/64, -fno-pic doesn't seem to have any effect whatsoever. In-Reply-To: <487E4056.808@dbservice.com> (Tomas Carnecky's message of "Wed\, 16 Jul 2008 20\:39\:18 +0200") References: <487E4056.808@dbservice.com> Message-ID: <86hcaou0q1.fsf@king.swox.se> Tomas Carnecky writes: On Linux, 64bit shared objects need position independent code, without it linking against them will fail. Static libraries / executables don't need it. See for example x264's ./configure to see how it detects whether PIC is needed or not. What is your point? -- Torbj?rn From tom at dbservice.com Thu Jul 17 16:23:34 2008 From: tom at dbservice.com (Tomas Carnecky) Date: Thu, 17 Jul 2008 16:23:34 +0200 Subject: But on X86/64, -fno-pic doesn't seem to have any effect whatsoever. In-Reply-To: <487E4056.808@dbservice.com> References: <487E4056.808@dbservice.com> Message-ID: <487F55E6.7020202@dbservice.com> Tomas Carnecky wrote: > On Linux, 64bit shared objects need position independent code, without > it linking against them will fail. Static libraries / executables don't > need it. See for example x264's ./configure to see how it detects > whether PIC is needed or not. Sorry, I didn't explain fully. $subject is mentioned on this webpage: http://gmplib.org/macos.html. The 'doesn't seem to' tells me that the author of the text wasn't sure or didn't know why gcc behaved like that. I just wanted to clarify. tom From pedzsan at gmail.com Tue Jul 22 16:07:00 2008 From: pedzsan at gmail.com (Perry Smith) Date: Tue, 22 Jul 2008 09:07:00 -0500 Subject: AIX Questions Message-ID: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> I downloaded and compiled GMP 4.2.2 in AIX 5.3. That went fine. I them downloaded and tried to configure mpfr-2.3.1. The configure script says that it can not find libgmp.a. Actually it says that it can not find __gmpz_init. I am just now tracking down how and why but I am pretty sure that GMP is compiled only in 64 bit mode while the configure script of MPFR is looking for __gmpz_init in 32 bit mode. If I do: nm /usr/local/lib/libgmp.a | grep __gmpz_init I get no hits. But if I dod: nm -X64 /usr/local/lib/libgmp.a | grep __gmpz_init .__gmpz_init T 268487276 .__gmpz_init2 T 268487104 .__gmpz_init_set T 268486864 .__gmpz_init_set_d T 268597508 .__gmpz_init_set_si T 268597676 .__gmpz_init_set_str T 268479604 .__gmpz_init_set_ui T 268547336 __gmpz_init D 536874152 __gmpz_init d 536874152 24 __gmpz_init2 D 536874128 __gmpz_init2 d 536874128 24 __gmpz_init_set D 536874104 __gmpz_init_set d 536874104 24 __gmpz_init_set_d D 536878784 __gmpz_init_set_d d 536878784 24 __gmpz_init_set_si D 536878808 __gmpz_init_set_si d 536878808 24 __gmpz_init_set_str D 536873840 __gmpz_init_set_str d 536873840 24 __gmpz_init_set_ui D 536876816 __gmpz_init_set_ui d 536876816 24 I found similar threads asking questions on the ClamAV mailing list. So, my initial question is I assume that GMP is compiled only in 64 bit mode for a reason but I wanted to make sure. Usually, what IBM libraries do is they create two shared objects. I see that libgmp.a ha libgmp.so.3 which is a 64 bit object. Usually a library will have foo.so and foo64.so with foo.so being the 32 bit version and foo64.so being the 64 bit version. These are archived (ar) into foo.a. Then -lfoo will discover both shared objects and pick out the one to use at link time based upon various conditions. My ultimate goal is to compile gcc 4.3.1. Thank you, Perry Ease Software, Inc. ( http://www.easesoftware.com ) Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems From Paul.Zimmermann at loria.fr Wed Jul 23 08:10:15 2008 From: Paul.Zimmermann at loria.fr (Paul Zimmermann) Date: Wed, 23 Jul 2008 08:10:15 +0200 Subject: AIX Questions In-Reply-To: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> (message from Perry Smith on Tue, 22 Jul 2008 09:07:00 -0500) References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> Message-ID: Dear Perry, I suggest you read the following paragraph from MPFR's INSTALL file: If the "configure" fails, please check that the C compiler and its options are the same as those for the GMP build (specially the ABI). You can see the latter with the following command: grep "^CC\|^CFLAGS" GMPBUILD/Makefile if the GMP build directory is available. Then type: ./configure CC= CFLAGS= and continue the install. On some platforms, you should provide further options to match those used by GMP, or set some environment variables. For instance, see the "Notes on AIX/PowerPC" section below. Paul Zimmermann From pedzsan at gmail.com Wed Jul 23 13:59:23 2008 From: pedzsan at gmail.com (Perry Smith) Date: Wed, 23 Jul 2008 06:59:23 -0500 Subject: AIX Questions In-Reply-To: References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> Message-ID: On Jul 23, 2008, at 1:10 AM, Paul Zimmermann wrote: > Dear Perry, > > I suggest you read the following paragraph from MPFR's INSTALL file: > > If the "configure" fails, please check that the C compiler and its > options are the same as those for the GMP build (specially the ABI). > You can see the latter with the following command: > > grep "^CC\|^CFLAGS" GMPBUILD/Makefile > > if the GMP build directory is available. Then type: > > ./configure CC= CFLAGS= options> > > and continue the install. On some platforms, you should provide > further > options to match those used by GMP, or set some environment > variables. > For instance, see the "Notes on AIX/PowerPC" section below. Yes, I had already read that. The default for GMP is to compile with an ABI of aix64. But that default is not carried on by other packages such as MPFR and GCC. So, I went back and compiled GMP using an ABI of 32. Then MPFR compiled fine and GCC compiled as well -- although GCC's configure script still needed a little coaxing. All that does not address the bigger issue. Libraries need to be compiled with an ABI of 32 as well as aix64 (to use GMP's terminology). That is possible to do. The .a archive simply has two shared object files, one compiled in 32 bit mode and the other compiled in 64 bit mode. No open source package seems to bother with that and its a bit sad. I once tried to dig into the autogen / configure stuff on another project and got intimidated and quit. But you might consider changing the default for GMP on AIX to compile with an ABI of 32 since that is what everything else appears to assume. Perry Ease Software, Inc. ( http://www.easesoftware.com ) Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems From vincent at vinc17.org Wed Jul 23 16:32:14 2008 From: vincent at vinc17.org (Vincent Lefevre) Date: Wed, 23 Jul 2008 16:32:14 +0200 Subject: AIX Questions In-Reply-To: References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> Message-ID: <20080723143214.GR23038@prunille.vinc17.org> On 2008-07-23 06:59:23 -0500, Perry Smith wrote: > All that does not address the bigger issue. Libraries need to be > compiled with an ABI of 32 as well as aix64 (to use GMP's > terminology). That is possible to do. The .a archive simply has two > shared object files, one compiled in 32 bit mode and the other > compiled in 64 bit mode. No open source package seems to bother with > that and its a bit sad. I once tried to dig into the autogen / > configure stuff on another project and got intimidated and quit. If you have information on how to do this, we would be interested for MPFR (note that Mac OS X on PowerPC is also concerned). But I suppose that such a thing should first be added to the autotools. -- Vincent Lef?vre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon) From tg at swox.com Wed Jul 23 17:10:53 2008 From: tg at swox.com (Torbjorn Granlund) Date: Wed, 23 Jul 2008 17:10:53 +0200 Subject: AIX Questions In-Reply-To: <20080723143214.GR23038@prunille.vinc17.org> (Vincent Lefevre's message of "Wed\, 23 Jul 2008 16\:32\:14 +0200") References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> Message-ID: <86y73smy9u.fsf@king.swox.se> Vincent Lefevre writes: If you have information on how to do this, we would be interested for MPFR (note that Mac OS X on PowerPC is also concerned). But I suppose that such a thing should first be added to the autotools. GCC's own libraries are compiled for all supported ABIs. They use the term "multilib" for this feature, I think. Adding multiplib support to GMP would be nice, but it is not clear how to do it. For one thing, we will need to generate *one* gmp.h supporting multiple limb sizes, then choose the proper definition based on compiler predefines. I am afraid that such compiler predefines do not in general exist. Then we will need to comply to various library path conventions. -- Torbj?rn From pedzsan at gmail.com Wed Jul 23 18:42:06 2008 From: pedzsan at gmail.com (Perry Smith) Date: Wed, 23 Jul 2008 11:42:06 -0500 Subject: AIX Questions In-Reply-To: <86y73smy9u.fsf@king.swox.se> References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> <86y73smy9u.fsf@king.swox.se> Message-ID: <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> On Jul 23, 2008, at 10:10 AM, Torbjorn Granlund wrote: > Vincent Lefevre writes: > > If you have information on how to do this, we would be interested > for MPFR (note that Mac OS X on PowerPC is also concerned). But I > suppose that such a thing should first be added to the autotools. > > GCC's own libraries are compiled for all supported ABIs. > They use the term "multilib" for this feature, I think. > > Adding multiplib support to GMP would be nice, but it is not clear how > to do it. > > For one thing, we will need to generate *one* gmp.h supporting > multiple limb sizes, then choose the proper definition based on > compiler predefines. I am afraid that such compiler predefines do not > in general exist. > > Then we will need to comply to various library path conventions. I'm happy with the AIX side of things. And I would like to learn about the autoconf stuff more. I will poke around with the gcc libraries and see how they name things. For normal object files in an archive like dog.o in foo.a, dog.o will be in 32 bit mode. And then foo.a will also have either dog.64o or dog64.o which will have been compiled in 64 bit mode. The shared objects from IBM tend to name them shr.o for 32 bit mode and shr_64.o for 64 bit mode. One side question: is the configure file with gmp and fpmr able to compiled outside of the source? There are already conventions for AIX for 64 bit mode as far as cpp flags and I'm fairly sure that gcc follows them. __64BIT__ is defined if the comiler is in 64 bit mode. Perry Ease Software, Inc. ( http://www.easesoftware.com ) Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems From tg at swox.com Wed Jul 23 19:54:35 2008 From: tg at swox.com (Torbjorn Granlund) Date: Wed, 23 Jul 2008 19:54:35 +0200 Subject: AIX Questions In-Reply-To: <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> (Perry Smith's message of "Wed\, 23 Jul 2008 11\:42\:06 -0500") References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> <86y73smy9u.fsf@king.swox.se> <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> Message-ID: <86bq0ocwpw.fsf@king.swox.se> Perry Smith writes: There are already conventions for AIX for 64 bit mode as far as cpp flags and I'm fairly sure that gcc follows them. __64BIT__ is defined if the comiler is in 64 bit mode. Perhaps __64BIT__ is defined by "the compiler", but it is not defined by any GCC on any of the machine I use. -- Torbj?rn From patrick.pelissier at gmail.com Wed Jul 23 20:44:39 2008 From: patrick.pelissier at gmail.com (Patrick Pelissier) Date: Wed, 23 Jul 2008 20:44:39 +0200 Subject: AIX Questions In-Reply-To: <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> <86y73smy9u.fsf@king.swox.se> <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> Message-ID: <921a2890807231144m734dc2ddkdfe89633ea796645@mail.gmail.com> > One side question: is the configure file with gmp and fpmr able to > compiled outside of the source? Yes. -- Sincerely, Patrick P?lissier From vincent at vinc17.org Wed Jul 23 23:43:35 2008 From: vincent at vinc17.org (Vincent Lefevre) Date: Wed, 23 Jul 2008 23:43:35 +0200 Subject: AIX Questions In-Reply-To: <86bq0ocwpw.fsf@king.swox.se> References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> <86y73smy9u.fsf@king.swox.se> <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> <86bq0ocwpw.fsf@king.swox.se> Message-ID: <20080723214335.GB6385@prunille.vinc17.org> On 2008-07-23 19:54:35 +0200, Torbjorn Granlund wrote: > Perhaps __64BIT__ is defined by "the compiler", but it is not defined > by any GCC on any of the machine I use. FYI under Mac OS X 10.4: prunille% gcc -dM -E -xc /dev/null | grep ppc #define __ppc__ 1 prunille% gcc -dM -E -xc /dev/null -m64 | grep ppc #define __ppc64__ 1 prunille% prunille% gcc -dM -E -xc /dev/null | grep _LP prunille% gcc -dM -E -xc /dev/null -m64 | grep _LP #define __LP64__ 1 #define _LP64 1 prunille% and under Linux/x86_64: vin% gcc -dM -E -xc /dev/null | grep 'amd\|x86' #define __x86_64 1 #define __amd64 1 #define __x86_64__ 1 #define __amd64__ 1 vin% gcc -dM -E -xc /dev/null -m32 | grep 'amd\|x86' vin% vin% gcc -dM -E -xc /dev/null | grep '_LP' #define __LP64__ 1 #define _LP64 1 vin% gcc -dM -E -xc /dev/null -m32 | grep '_LP' vin% This would be the job of the autotools to find what needs to be tested exactly. -- Vincent Lef?vre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon) From tg at swox.com Thu Jul 24 13:20:17 2008 From: tg at swox.com (Torbjorn Granlund) Date: Thu, 24 Jul 2008 13:20:17 +0200 Subject: AIX Questions In-Reply-To: <19D6F493-FD1C-4274-8F49-6EB7F92E7C71@gmail.com> (Perry Smith's message of "Wed\, 23 Jul 2008 19\:32\:31 -0500") References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> <86y73smy9u.fsf@king.swox.se> <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> <86bq0ocwpw.fsf@king.swox.se> <19D6F493-FD1C-4274-8F49-6EB7F92E7C71@gmail.com> Message-ID: <86hcafmsum.fsf@king.swox.se> > Perhaps __64BIT__ is defined by "the compiler", but it is not defined > by any GCC on any of the machine I use. Not true. gcc defines __64BIT__ Clever. So your gcc install does define it, good. Unfortunately, GMP needs to work on other systems but yours. -- Torbj?rn From pedzsan at gmail.com Thu Jul 24 02:32:31 2008 From: pedzsan at gmail.com (Perry Smith) Date: Wed, 23 Jul 2008 19:32:31 -0500 Subject: AIX Questions In-Reply-To: <86bq0ocwpw.fsf@king.swox.se> References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> <86y73smy9u.fsf@king.swox.se> <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> <86bq0ocwpw.fsf@king.swox.se> Message-ID: <19D6F493-FD1C-4274-8F49-6EB7F92E7C71@gmail.com> On Jul 23, 2008, at 12:54 PM, Torbjorn Granlund wrote: > Perry Smith writes: > > There are already conventions for AIX for 64 bit mode as far as cpp > flags and I'm fairly sure that gcc follows them. > > __64BIT__ is defined if the comiler is in 64 bit mode. > > Perhaps __64BIT__ is defined by "the compiler", but it is not defined > by any GCC on any of the machine I use. Not true. gcc defines __64BIT__ cat hello.c #ifdef __64BIT__ int main() { printf("hello 64\n"); } #else int main() { printf("hello 32\n"); } #endif gcc -maix64 -o hello hello.c hello.c: In function 'main': hello.c:2: warning: incompatible implicit declaration of built-in function 'printf' ./hello hello 64 rm hello gcc -o hello hello.c hello.c: In function 'main': hello.c:4: warning: incompatible implicit declaration of built-in function 'printf' ./hello hello 32 Perry Ease Software, Inc. ( http://www.easesoftware.com ) Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems From pedzsan at gmail.com Thu Jul 24 14:13:29 2008 From: pedzsan at gmail.com (Perry Smith) Date: Thu, 24 Jul 2008 07:13:29 -0500 Subject: AIX Questions In-Reply-To: <86hcafmsum.fsf@king.swox.se> References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> <86y73smy9u.fsf@king.swox.se> <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> <86bq0ocwpw.fsf@king.swox.se> <19D6F493-FD1C-4274-8F49-6EB7F92E7C71@gmail.com> <86hcafmsum.fsf@king.swox.se> Message-ID: <7905C12A-A8BE-4B7E-B54C-3FA70979496D@gmail.com> On Jul 24, 2008, at 6:20 AM, Torbjorn Granlund wrote: >> Perhaps __64BIT__ is defined by "the compiler", but it is not defined >> by any GCC on any of the machine I use. > > Not true. gcc defines __64BIT__ > > Clever. So your gcc install does define it, good. Unfortunately, GMP > needs to work on other systems but yours. I'm not sure you understand. This is standard on any AIX system. Try it on yours. Perry Ease Software, Inc. ( http://www.easesoftware.com ) Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems From pedzsan at gmail.com Thu Jul 24 15:26:39 2008 From: pedzsan at gmail.com (Perry Smith) Date: Thu, 24 Jul 2008 08:26:39 -0500 Subject: AIX Questions In-Reply-To: <86hcafmsum.fsf@king.swox.se> References: <796EDB38-495B-4D1C-A534-201612571A9D@gmail.com> <20080723143214.GR23038@prunille.vinc17.org> <86y73smy9u.fsf@king.swox.se> <1301FB03-F2EA-48B9-85F3-57220444DE1A@gmail.com> <86bq0ocwpw.fsf@king.swox.se> <19D6F493-FD1C-4274-8F49-6EB7F92E7C71@gmail.com> <86hcafmsum.fsf@king.swox.se> Message-ID: On Jul 24, 2008, at 6:20 AM, Torbjorn Granlund wrote: >> Perhaps __64BIT__ is defined by "the compiler", but it is not defined >> by any GCC on any of the machine I use. > > Not true. gcc defines __64BIT__ > > Clever. So your gcc install does define it, good. Unfortunately, GMP > needs to work on other systems but yours. Again, my objective was to make this work for AIX since the original topic was to be able to use its ability to store 32 and 64 bit objects in the same archive. To do that and keep it "AIX"ish, I would use __64BIT__. Its what AIX programmers want and it is supported by xlc and gcc. But, if, for some reason, you are wanting something that cuts across all platforms, there is this: @item __LP64__ @itemx _LP64 These macros are defined, with value 1, if (and only if) the compilation is for a target where @code{long int} and pointer both use 64-bits and @code{int} uses 32-bit. This is used on AIX as well as my Mac platform. But, just to repeat, I don't think that is really want you want to use. For one thing, xlc is not going to use it. Perry Ease Software, Inc. ( http://www.easesoftware.com ) Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems From rafael.anschau at gmail.com Thu Jul 24 21:48:03 2008 From: rafael.anschau at gmail.com (Rafael Anschau) Date: Thu, 24 Jul 2008 16:48:03 -0300 Subject: Addressing single digits of big integers Message-ID: Is it possible to address single digits in big integers, without the high costs of export import ? Something like a pointer to the digit ? Thanks. Rafael -------------- next part -------------- An HTML attachment was scrubbed... URL: http://swox.com/list-archives/gmp-discuss/attachments/20080724/12a06136/attachment.html From decio at decpp.net Sat Jul 26 00:29:08 2008 From: decio at decpp.net (decio at decpp.net) Date: Fri, 25 Jul 2008 19:29:08 -0300 Subject: Addressing single digits of big integers Message-ID: <488a53b4.94.2466.821384423@seti.serverlogistics.com> ----- Original Message ----- From: "Rafael Anschau" To: gmp-discuss at swox.com Subject: Addressing single digits of big integers Date: Thu, 24 Jul 2008 16:48:03 -0300 > Is it possible to address single digits in big integers, > without the high costs of export import ? Something like a > pointer to the digit ? If by digit you mean a base-10 digit, sorry, it's gonna be fairly costly. Most large integer packages represent values internally in a power-of-two base, so you can't directly get base-10 digits, only base-2^k digits. To get base-10 digits you'll have to incur the cost of changing representation by exporting, or doing a calculation like x/10^k mod 10, and both the division and the modulo are costly for large values. If you routinely need to work with the base-10 representation of your large integers, and it's a bottleneck of your code (profile it somewhere to be sure, otherwise you may lose performance by following this advice), try a different library which works with a power-of-10 base representation. I can't name any, but I know that most of the various Pi-calculator programs out there use base-10 extensively to avoid a costly change of representation at the end. D?cio From hillcino368 at hotmail.com Sat Jul 26 18:04:55 2008 From: hillcino368 at hotmail.com (cino hilliard) Date: Sat, 26 Jul 2008 11:04:55 -0500 Subject: Getting digits from mpz_t integers In-Reply-To: References: Message-ID: Hi Rafael, This works to get the digits from an mpz_t variable. I did it with a char arraybut you could use pointers if you like. #include #include #include #include #include #include "gmp.h"#define getz(a) mpz_inp_str(a,stdin,10) int main(int argc, char * argv[]){int i;char digit[2000];char *tmp; mpz_t num;printf(" Get mpz digits \n");while(1){ mpz_init(num);printf("num\n");getz(num);mpz_get_str (digit,10,num);for(i=0;i Today's Topics:> > 1. Re: Addressing single digits of big integers (decio at decpp.net)> > > ----------------------------------------------------------------------> > Message: 1> Date: Fri, 25 Jul 2008 19:29:08 -0300> From: "decio at decpp.net" > Subject: Re: Addressing single digits of big integers> To: "Rafael Anschau" , gmp-discuss at swox.com> Message-ID: <488a53b4.94.2466.821384423 at seti.serverlogistics.com>> Content-Type: text/plain; charset="iso-8859-1"> > > ----- Original Message -----> From: "Rafael Anschau" > To: gmp-discuss at swox.com> Subject: Addressing single digits of big integers> Date: Thu, 24 Jul 2008 16:48:03 -0300> > > Is it possible to address single digits in big integers,> > without the high costs of export import ? Something like a> > pointer to the digit ?> > If by digit you mean a base-10 digit, sorry, it's gonna be> fairly costly. Most large integer packages represent values> internally in a power-of-two base, so you can't directly get> base-10 digits, only base-2^k digits. To get base-10 digits> you'll have to incur the cost of changing representation by> exporting, or doing a calculation like x/10^k mod 10, and> both the division and the modulo are costly for large> values.> > If you routinely need to work with the base-10> representation of your large integers, and it's a bottleneck> of your code (profile it somewhere to be sure, otherwise you> may lose performance by following this advice), try a> different library which works with a power-of-10 base> representation. I can't name any, but I know that most of> the various Pi-calculator programs out there use base-10> extensively to avoid a costly change of representation at> the end.> > D?cio> > > ------------------------------> > _______________________________________________> gmp-discuss mailing list> gmp-discuss at swox.com> http://swox.com/mailman/listinfo/gmp-discuss> > > End of gmp-discuss Digest, Vol 59, Issue 9> ****************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: http://swox.com/list-archives/gmp-discuss/attachments/20080726/d80e59ff/attachment.html From Paul.Zimmermann at loria.fr Mon Jul 28 13:38:02 2008 From: Paul.Zimmermann at loria.fr (Paul Zimmermann) Date: Mon, 28 Jul 2008 13:38:02 +0200 Subject: Addressing single digits of big integers In-Reply-To: (rafael.anschau@gmail.com) Message-ID: Rafael, > Date: Thu, 24 Jul 2008 16:48:03 -0300 > From: "Rafael Anschau" > > Is it possible to address single digits in big integers, without the high > costs of export import ? Something like a pointer to the digit ? > > Thanks. > > Rafael from a theoretical point of view, as far as I know, the complexity of computing a single digit (say the middle one) in a base that is not commensurable to the internal base (for example in base 10 when numbers are represented in radix 2) is the same as converting the whole number, i.e., O(n log n). Now if you mean digits in base say 16 or 256, that are commensurable to 2, you can access them directly using the mpn layer. Paul Zimmermann From Paul.Zimmermann at loria.fr Tue Jul 29 13:43:10 2008 From: Paul.Zimmermann at loria.fr (Paul Zimmermann) Date: Tue, 29 Jul 2008 13:43:10 +0200 Subject: gmp-discuss Digest, Vol 59, Issue 11 In-Reply-To: (message from David Harvey on Tue, 29 Jul 2008 07:22:55 -0400) Message-ID: David, > From: David Harvey > Date: Tue, 29 Jul 2008 07:22:55 -0400 > > > from a theoretical point of view, as far as I know, the complexity > > of computing > > a single digit (say the middle one) in a base that is not > > commensurable to the > > internal base (for example in base 10 when numbers are represented > > in radix 2) > > is the same as converting the whole number, i.e., O(n log n). > > How do you do a full base conversion in O(n log n)? I only know how > to get O(n log(n)^2), i.e. divide-and-conquer, with O(log(n)) layers, > each layer costs O(n log(n)). sorry, I meant O(M(n) log n). > But to get the k-th base-b digit, assuming b is fixed, you need to > compute b^k, which costs O(k log(k)) = O(n log(n)) by repeated > squaring, and then a single division costing O(n log n), and a single- > precision division to get the last digit. So I agree you can get a > single digit in O(n log n). you're right, this gives indeed O(M(n)), thus I was wrong above, since I meant O(M(n) log n). > (Of course, because of GMP's non-optimal division in 4.2.1, there's > an extra factor of log(n) in all of that.) that extra log(n) factor should disappear in GMP 5. Paul