public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Gerard Jungman <jungman@lanl.gov>
To: GSL Discuss Mailing List <gsl-discuss@sourceware.org>
Subject: Re: gsl container designs
Date: Thu, 07 Jan 2010 01:50:00 -0000	[thread overview]
Message-ID: <1262829020.27244.361.camel@manticore.lanl.gov> (raw)
In-Reply-To: <alpine.LFD.2.00.1001061011530.3462@localhost>

On Wed, 2010-01-06 at 10:47 -0500, Robert G. Brown wrote:

First, I want to say that I agree with everything you
say. These are exactly the problems that we need to solve.


> IMO the primary reason for "fixing" vector/matrix objects in the GSL is
> to enable the single vector that represents the actual data in the
> object to be presented to the user in a matrix-intuitive way, even at
> some cost in code efficiency (and to try to minimize that cost or
> provide further benefits to counterbalance it by enabling efficient
> linear algebra routines to be matched to it, for example).

In fact, I don't even see a need to sacrifice efficiency. I think 
this goal is directly achievable at essentially optimal efficiency.
My attitude about C is that it is all about lining up the bytes.
A good C design is just some syntactic layer on top of a
rudimentary layer, where-in you are careful to line up all
the bytes. After that, optimal efficiency is pretty much
automatic. C is very friendly, once you are careful to
line everything up. I hope you see my small but non-vacuous
technical meaning.


> What I want is extremely simple:
> 
> * A way to construct/allocate a matrix of arbitrary dimension (out to some
> (un)reasonable max, e.g. 10

Check.


> but I want to be able to use it
> just like m[i][j][k]...[r][s] when all is said and done.

This is the only part which I wonder about. I thought about this
before and came to the conclusion that it is not easy to get right.
Probably possible, but very tricky.

The most annoying aspect of this is that these little problems
are trivial in C++. But maybe just beyond the capability of C.


> * The specific dimension bounds need to be user specified.  If I want to
> make a 6 dimensional triple triangular array to hold e.g. 3j symbols, I
> don't want to have to allocate a rectangular array most of which is
> empty wasted space.

See the earlier comment by Tuomo Keskitalo, about banded/packed storage.
Not something I have thought about yet, but probably not hard.


> * Access to the underlying actual data vector (non-opaque, in other
> words) so it can be passed to e.g. ODE solvers and the like that can
> only be sensibly written in a general way for a vector.

Check.


> My problem in this regard with the GSL is that so far, the matrix and
> vector constructs are pretty much useless -- they are far away from the
> standard way one usually does this sort of thing in C using pointers or
> just allocating a vector or matrix.

I find them useless as well, for exactly these reasons.


> One of the ADVANTAGES of C is that it permits one to work pointer magic
> to improve the readability (and sometimes execution efficiency) of code.
> Opaque types and set/get calls are dark evil in both regards.

Right. The layer which defines the "types" should be essentially
syntactic, just there to make it easier to organize/understand
your code. The underlying implementation should be a brutally
simple pile of bytes, and it should be visible.


--
G. Jungman


  reply	other threads:[~2010-01-07  1:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25  0:55 Gerard Jungman
2009-11-29 21:04 ` Brian Gough
2009-12-04 18:48 ` Brian Gough
2009-12-09 21:04   ` using GSL with C++ (was Re: gsl container designs) James Amundson
2009-12-09 21:14     ` Jochen Küpper
2009-12-09 21:54     ` Jari Häkkinen
2009-12-10 11:46     ` Brian Gough
2009-12-10 12:09       ` Brian Gough
2009-12-10 13:42     ` Robert G. Brown
2009-12-10 21:44       ` James Bergstra
2009-12-10 15:15     ` Kevin H. Hobbs
2010-01-06 11:45   ` gsl container designs Tuomo Keskitalo
2010-01-06 15:47     ` Robert G. Brown
2010-01-07  1:50       ` Gerard Jungman [this message]
2010-01-07  3:29         ` Robert G. Brown
     [not found]           ` <4a00655d1001062110m139c0a8tf2eae7de67da8f6f@mail.gmail.com>
2010-01-07  5:46             ` Rhys Ulerich
2010-01-07 13:22               ` Robert G. Brown
2010-01-08 20:08           ` Gerard Jungman
2010-01-07 18:29     ` Brian Gough
2010-01-06 12:04 ` Tuomo Keskitalo
2010-01-06 19:57   ` Gerard Jungman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1262829020.27244.361.camel@manticore.lanl.gov \
    --to=jungman@lanl.gov \
    --cc=gsl-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).