The big problem with setting bits and shifting is that it is a
quadratic algorithm. It will be much slower than setting the
individual bits.

The best idea would be to set the top bit first, then set the other bits.

The fastest method would use mpn's instead of mpz's, but this requires
considerably more work and may not be appropriate.

As for cutting out portions of MPIR, this would be a massive job I am
afraid. I wouldn't recommend spending valuable time doing that.

Bill.

On 31/08/2012, James M. <jamesma...@gmail.com> wrote:
> I am using MPIR to calculate Morton numbers or Z-curve indexes for high
> dimensional data for gamma-ray coincidence analysis. While not truly meant
> for this, they work fantastically, so thank you very much for that.
> Anyways I was wondering a few things:
>
> First of all, does anyone have any suggestions for a a good way to write an
>
> integer dilation function? As a quick, get it working, implementation I
> pretty much preallocate an mpz_class to the appropriate size and then set
> each bit.
> Obviously this is... not optimal. So I have been looking at taking the
> coordinate value for each dimension, placing it into a preallocated
> mpz_class and adding zeros between the bits. If I do this for each
> dimension then all I have to do is a little bitshifting and addition to get
>
> the Morton number. If anyone has suggestions or advice it would be welcome.
>
> Second of all, all I use is the C++ integers portion of MPIR, mostly the
> bit manipulation in fact, how difficult is it to trim the source down to
> that? I don't really use all the super fancy bit of the integers either but
>
> I realize that those would be harder trim out.
>
> Anyways, thanks for reading my possibly (probably) inane questions.
> --
> James M
>
> --
> You received this message because you are subscribed to the Google Groups
> "mpir-devel" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mpir-devel/-/ZoSw11GEucoJ.
> To post to this group, send email to mpir-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> mpir-devel+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mpir-devel?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to mpir-devel@googlegroups.com.
To unsubscribe from this group, send email to 
mpir-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mpir-devel?hl=en.

Reply via email to