Computing the exact bit-size of some structure

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Computing the exact bit-size of some structure

Costas Tsirogiannis

Greetings,

I have built a Polyhedron_3 object using Gmpq as NT.  What I want to do is to compute the exact bit-size of the structure.

This object that I compute contains vertices that were already part of the input plus vertices constructed from line intersections.  So not all the vertex coordinates have the same bit size. The Polyhedron_3 class has a member function bytes() which just gives a standard answer:

sizeof(Vertex_type)*number_of_vertices()+sizeof(Facet_type)*number_of_facets()

But this must not be exact since Gmpq can have an arbitrary number of bits, right? Theoretically, the bit-size of the coordinates of a single vertex in the structure that I compute can be very high (can actually be comparable to the size of the entire input) so this function does not really help me. Any suggestions of how can I compute the exact bit size here or, at least, how can I compute the exact bit-size of a single Gmpq object?

thanks

Constantinos
Reply | Threaded
Open this post in threaded view
|

Re: Computing the exact bit-size of some structure

Sylvain Pion
Administrator
Le 20/08/10 11:58, Costas Tsirogiannis a écrit :

>
> Greetings,
>
> I have built a Polyhedron_3 object using Gmpq as NT.  What I want to do is to compute the exact bit-size of the structure.
>
> This object that I compute contains vertices that were already part of the input plus vertices constructed from line intersections.  So not all the vertex coordinates have the same bit size. The Polyhedron_3 class has a member function bytes() which just gives a standard answer:
>
> sizeof(Vertex_type)*number_of_vertices()+sizeof(Facet_type)*number_of_facets()
>
> But this must not be exact since Gmpq can have an arbitrary number of bits, right? Theoretically, the bit-size of the coordinates of a single vertex in the structure that I compute can be very high (can actually be comparable to the size of the entire input) so this function does not really help me. Any suggestions of how can I compute the exact bit size here or, at least, how can I compute the exact bit-size of a single Gmpq object?

Looking at the Gmpq class, I see :

   // Gives the memory size in bytes. (not documented yet)
   std::size_t size() const
   {
     std::size_t s_num = mpz_size(mpq_numref(mpq())) * (mp_bits_per_limb/8);
     std::size_t s_den = mpz_size(mpq_denref(mpq())) * (mp_bits_per_limb/8);
     return s_num + s_den;
   }

--
Sylvain

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss