Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Computing the exact bit-size of some structure

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Computing the exact bit-size of some structure


Chronological Thread 
  • From: Sylvain Pion <>
  • To:
  • Subject: Re: [cgal-discuss] Computing the exact bit-size of some structure
  • Date: Fri, 20 Aug 2010 12:04:42 +0200
  • Organization: INRIA

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



Archive powered by MHonArc 2.6.16.

Top of Page