Vector types

Marc Glisse marc.glisse at inria.fr
Fri Sep 21 23:42:17 CEST 2012


On Sat, 22 Sep 2012, Иван Вайгульт wrote:

> Yes, cache mises takes a big overhead, because the total execution time
> depends on row and cols of matrix as O(nm) on each iteration (And the
> number of iteration depends on rows as O(2^(m/2)) in worst case).

I was asking about numbers, not theory.

> About mpz_array_init:
> Is there any non documented way to free allocated data?

Get the deallocation function and call it on the _mp_d member of the first 
element of the array.

> (since you are using C++, I'd rather use vector<mpz_class>)
>
> May be, it's good, but what about mixed arithmetic functions? (for example
> mpz_addmull, I have heared that it is little faster than two calls of
> mpz_add and mpz_mul)
> What will happen if I write "a+b*c" in c++?

Nothing. See, that's way faster than C. Now if you write: d=a+b*c and d is 
not a, it will do d=b*c; d=a+d; (at least with the current mercurial 
version). For a+=b*c; old versions used addmul in an unsafe way, some 
future version will use addmul in a correct way, but it does indeed use a 
temporary now.

-- 
Marc Glisse


More information about the gmp-discuss mailing list