This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
GSL containers: was Re: [Help-gsl] Linear least squares, webpages and the next release
- From: John D Lamb <J dot D dot Lamb at johndlamb dot net>
- To: Patrick Alken <patrick dot alken at noaa dot gov>, gsl-discuss at sourceware dot org, Gerard Jungman <jungman at lanl dot gov>
- Date: Sun, 1 Nov 2015 21:00:04 +0000
- Subject: GSL containers: was Re: [Help-gsl] Linear least squares, webpages and the next release
- Authentication-results: sourceware.org; auth=none
- References: <56293649 dot 8010009 at colorado dot edu> <562BA530 dot 7090508 at johndlamb dot net> <562E432D dot 9050002 at colorado dot edu>
On 26/10/15 15:13, Patrick Alken wrote:
Yes. Iâd be happy to look at redesign of the GSL containers. Whatâs
needed?
There was a discussion on gsl-discuss some time back, see:
https://www.sourceware.org/ml/gsl-discuss/2014-q2/
Gerard may have already done some work on this, or have some ideas on a
good starting point, so I suggest getting in touch with him too (cc'd).
Iâd forgotten the detail of that discussion.
I can think of a way to change the gsl block/vector/matrix alloc
functions to be more efficient. In essence it is a pool allocator.
It would keep a record, for each power k of two up to some limit n, of
the number of blocks allocated for sizes 2^k to 2^{k+1} together with a
capacity (also a power of two) for blocks of that range. These would
form linked lists of allocated and unallocated blocks. Given a request
for a new block, if an unallocated one was available, it would be
allocated. Otherwise the capacity would be doubled. When a block is
freed, memory is only deallocated if no more than a quarter of capacity
is used or if no blocks are used.
This idea needs more input.
I canât think of a good way to create gsl_vectors and the like in stack
memory. Of course, it is always possible to create a struct and
initialise it.
I also donât know of a good, easy solution to the problem of constness.
--
John D Lamb