Can GMP compress a vector into an integer?

David McKen dmlmcken at comcast.net
Thu Jun 17 16:00:05 CEST 2004


When you say compress I assume you mean convert to a large integer. You
wont get much (if any) compression by converting a set of integers into
one number (correct me if I am wrong).

mpz_import is you best bet. It doesn't take a vetor but an array of word
values. Seeing that a vector stores the data in a contiguous block of
memory, you may be able to take the address of the first element and try
feeding that to mpz_import. If you want to play it safe you could just
copy the values to an array and then give that to mpz_import.

Hope this Helps
David McKen

yanrj wrote:

>gmp-discuss£¬
>     There is a vector consisting of groups of integer. Is there any function in GMP can compress the vector and uncompress the result to get the initial vector?
>	
>
>Best wishes
>Rj Yan
>
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡yanrj
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡yrj at ios.ac.cn
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2004-06-17
>
>_________________________________________________________________________
>
>
>
>
>
>_______________________________________________
>gmp-discuss mailing list
>gmp-discuss at swox.com
>https://gmplib.org/mailman/listinfo/gmp-discuss
>
>  
>



More information about the gmp-discuss mailing list