This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: a few questions about discrete rng


On Mon, 8 Jul 2002, Rodney Sparapani wrote:

] I'm working on a multinomial RNG for GSL.  I was looking at the code in
] randist/discrete.c and I'm perplexed.  For the number of categories, the type
] declaration is size_t.  This is the type returned by the sizeof operator
] according to the ANSI C standard for the number of bytes that a type has.  I
] don't think this is an appropriate definition.  I believe it should be an
] unsigned int, but not this one which has a special meaning and makes the source
] hard to read.  Also, the probability array is not of type gsl_vector.  Is there
] some reason for this?  If we all agree on these changes, then I will submit an
] updated discrete.c with my multinomial code.  Thanks.

I'll let Brian (or others) comment on size_t; I've only recently been
introduced to the convention that uses size_t for certain unsigned
integers, usually array sizes.  If I used it, I was copying somebody
else.

With respect to using gsl_vector versus an array, you ask: Is there
some reason for this?  The reason is that when I wrote it, gsl_vector
was not well established (at least not in my usage).  I don't have a
strong opinion.  You might argue that gsl_vector is more appropriately
limited to linear algebra operations.  In the early days of GSL, I
advocated an approach which required less dependencies on the various
types, but I've been won over to the single library approach, and in
that case the gsl_vector is a pretty useful type.  So, once again, I
realize I'm not actually contributing anything to the discussion, and
am deferring to Brian on whether this is an appropriate use of
gsl_vector.

regards,
jt

---------------------------------------------
James Theiler                     jt@lanl.gov
MS-D436, NIS-2, LANL        tel: 505/665-5682
Los Alamos, NM 87545        fax: 505/665-4414
----- Space and Remote Sensing Sciences -----



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]