Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Measuring byte size of structures that use Lazy_exact_nt

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Measuring byte size of structures that use Lazy_exact_nt


Chronological Thread 
  • From: Costas Tsirogiannis <>
  • To:
  • Subject: Re: [cgal-discuss] Measuring byte size of structures that use Lazy_exact_nt
  • Date: Mon, 23 May 2011 15:24:30 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ERumco3tLMIfLwm+2tOpP5jado56vTQq/0K7foDi4rJwFGDkDsE8y5YUDVMCi875JF 9CDCsn3OczHI4IEO+XjKRV7YE8ydMXT0oxTN/XS8wuoGnL0tMbIyPKTTFszxTF2w8m6y Kkegi5+IACwQ9AKG9o+dHh5Gf8Fnsrto1U8+I=

Thanks for both of the replies.

>> You don't ask for the size of the representation. You ask for the size
>> of the representation with GMP.

Well, it's about a structure that so far it has been implemented with fixed-precision arithmetic and produced inconsistencies. On the other hand, if you use "pure" Gmp the byte-size is extravagant to be applicable in large data sets. But if you use lazy_exact_nt things may be a little bit better as it comes to what you get in practice from the allocated memory, so that's what I want to find. I think that using mallinfo might be the least complicated solution for that.

thanks again,

Constantinos



On Mon, May 23, 2011 at 3:08 PM, Andreas Fabri <> wrote:
On 23/05/2011 14:45, Costas Tsirogiannis wrote:

 Greetings,

Suppose that one uses CGAL::Lazy_exact_nt<CGAL::Gmpq> as a number type
for some algorithm.

If one asks for the byte size of an object of this class, then what is
returned is a constant which is equal to the minimum number of bytes
that are needed to represent a Gmpq object + the size of the fixed
precision part of the number type.

On the other hand, If one asks for the PRECISE byte size of the exact
part + the approximate part of the lazy_exact number type if he uses a
function like this:

 int byte_size( NT a)
{ return sizeof(CGAL::Lazy_exact_nt<CGAL::Gmpq>) -
sizeof(CGAL::Gmpq)+a.exact().size(); }  (That I learned from a previous
question here, thanks :) )

 But, in fact, the "exact().size()"  function forces the exact part of
the object to be computed even if algebraic filtering was sufficient to
avoid this computation so far. Thus, then we get an overestimation of
what is computed by the algorithm.  It's like a "schrodinger"
phenomenon: to read the byte-size, you have to force the computation of
the exact part.

Is there a way then to detect for a lazy_exact_nt object if the exact
part is not computed so far? In other words, given a geometric structure
whose coordinates are represented with this number type,  can one
measure the number of bytes which are used for the structure's
representation, no more, no less?

You don't ask for the size of the representation. You ask for the size
of the representation with GMP.

When you have the GMP 1/3 you also only want to know that it takes 2 limbs, and not infinitely many characters if you write it as a string.

andreas


--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project

phone: +33.492.954.912    skype: andreas.fabri


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





Archive powered by MHonArc 2.6.16.

Top of Page