gnuastro-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-devel] [task #14497] GSL extension for type-agnostic permutati


From: Mohammad Akhlaghi
Subject: [gnuastro-devel] [task #14497] GSL extension for type-agnostic permutation
Date: Sun, 30 Apr 2017 11:26:08 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0

URL:
  <http://savannah.gnu.org/task/?14497>

                 Summary: GSL extension for type-agnostic permutation
                 Project: GNU Astronomy Utilities
            Submitted by: makhlaghi
            Submitted on: Sun 30 Apr 2017 05:26:06 PM CEST
         Should Start On: Sun 30 Apr 2017 12:00:00 AM CEST
   Should be Finished on: Sun 30 Apr 2017 12:00:00 AM CEST
                Category: Libraries
                Priority: 5 - Normal
              Item Group: Enhancement
                  Status: Postponed
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                  Effort: 0.00

    _______________________________________________________

Details:

Gnuastro has to deal directly with file input/output, so to make the code as
generic and less buggy as possible, Gnuastro uses the fixed width types of
`stdint.h' (for example `uin8_t' or `int32_t') rather than the standard
subjective types (like `short', `int', or `long') which don't have guaranteed
widths. 

As part of Gnuastro's tessellation facilities
<http://git.savannah.gnu.org/cgit/gnuastro.git/tree/lib/tile.c>, we needed
permutations and fortunately the GNU Scientific Library (GSL) has some good
functions
<https://www.gnu.org/software/gsl/manual/html_node/Permutations.html> for this
job. But unfortunately, those functions were based on the subjective types not
the fixed width types. Writing wrappers to find the proper type based on the
system would be buggy and make the code hard to read. 

So after reviewing GSL's implementation of the forward and reverse
permutations (based on Knuth's "Art of computer programming"), a type-agnostic
implementation of permutations were written for Gnuastro (in lib/permutation.c
<http://git.savannah.gnu.org/cgit/gnuastro.git/tree/lib/permutation.c>). It
uses `memcpy' and can work on any type only with the knowledge of its width
(in number of bytes). It is now used in several Gnuastro programs and it works
nicely.

So, I thus got in touch with Patrick Alken (maintainer of GSL) to share these
functions with him and see if they can be moved into GSL. He was supportive
and suggested preparing them as a GSL Extension
<https://www.gnu.org/software/gsl/#extensions> (a simple library which can be
linked together with GSL in your application and uses the GSL coding
conventions), so it can be further tested and possibly later be integrated
into GSL.

So I am defining this task to write a GSL extension based on these functions
and submitting it to GSL. 

GSL deals with the different types by heavy usage of macros which make the
code hard to read. Since Gnuastro's implementation accepts `void *' (of any
type) and just needs the number of bytes in the type, type-specific functions
(that are just wrappers over the type-agnostic implementation with a
`sizeof(int)' for example) can also be written to replace the currently
macro-heavy implementations in GSL. So in our suggested GSL extension, we can
also include these wrappers for different types.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/task/?14497>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]