[PPL-devel] [Fwd: Re: C++ interface and mpz_addmul]

Roberto Bagnara bagnara at cs.unipr.it
Sat Jun 29 07:22:25 CEST 2002


-------- Original Message --------
Subject: Re: C++ interface and mpz_addmul
Date: Sat, 29 Jun 2002 07:57:06 +1000
From: Kevin Ryde <user42 at zip.com.au>
To: gmp at swox.com, ppl-devel at cs.unipr.it
CC: Gerardo.Ballabio at unimib.it
References: <3D1CD64E.4030508 at cs.unipr.it>

Roberto Bagnara <bagnara at cs.unipr.it> writes:
 >
 > it seems that C++ statements of the form
 >
 >      a += b*c
 >
 > for a, b and c of type mpz_class, are not translated
 > by the C++ interface into an invocation of mpz_addmul.

Alas you're right.  mpz_addmul is only used for "mpq += mpz" at the
moment.  (Hmm.  Should use mpz_addmul_ui for "mpq += ulong" too I
guess.)

 > The reason I am asking is twofold: on the one hand, expressions
 > like that are quite common in several applications and they usually
 > occur in critical computation paths (e.g., applications computing
 > zillions of scalar products);

You can call mpz_addmul directly with mpz_class::get_mpz_t if you
want.  Not terribly pretty, but it'll work right now.

 > on the other hand, the template machinery
 > used to implement the C++ interface of GMP would seem powerful enough
 > to do the right thing.

I wonder if the templating can cope with two operators like that.

 > Am I missing something?
 > If not, are there any plans to enhance the C++ interface so as to
 > capture this case?

Gerardo?

_______________________________________________
gmp mailing list
gmp at swox.com
http://swox.com/mailman/listinfo/gmp


-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it




More information about the PPL-devel mailing list