This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
Re: gsl_quaternion proposition
- From: picca at synchrotron-soleil dot fr
- To: gsl-discuss at sources dot redhat dot com
- Cc: "Robert G. Brown" <rgb at phy dot duke dot edu>
- Date: Thu, 11 May 2006 13:56:28 +0200
- Subject: Re: gsl_quaternion proposition
- References: <20060510162815.15470ee8.picca@synchrotron-soleil.fr><Pine.LNX.4.64.0605101042560.12011@lilith.rgb.private.net><20060510165528.9c69a5b6.picca@synchrotron-soleil.fr><Pine.LNX.4.64.0605101106561.12011@lilith.rgb.private.net><20060510171946.28510201.picca@synchrotron-soleil.fr><Pine.LNX.4.64.0605101519360.4665@lilith.rgb.private.net>
On Wed, 10 May 2006 15:43:15 -0400 (EDT)
"Robert G. Brown" <rgb@phy.duke.edu> wrote:
> However, to remain consistent with "the gsl way" and its object/method type
> programming style you'd probably have to do
>
> typedef struct
> {
> double dat[4];
> } gsl_quaternion;
>
> (for a quaternion where q.dat[0]-dat[3] maps into q = s + ix +jy +kz)
> and define suitable macros like GSL_QR(q), GSL_SET_QR(qp,s), GSL_QI(q),
> GSL_SET_QI(qp,x), ...
>
> Then you'd have to define the whole raft of:
>
> gsl_quaternion_add(gsl_quaternion q1,gsl_quaternion q2);
>
> and so on for all the non-commutative sums and products, including the scalar
> and outer product parts separately.
This what I have done for now.
> So the arithmetic functions would
> basically have to be able to e.g. do \epsilon_{ijk} sums to create the cross
> products out of the ijk components, since quaternions are basically a mix of
> the Gibbs scalar product and Gibbs cross product in a single kind of number,
> for all that Hamilton thought them up first and better.
Can you explaine a little bit more please.
> This is fine, except that typing out the whole word "quaternion" inside each
> function call and definition is definitely a pain, and I never really liked
> using get/set macros when they take longer to type than a straightforward
> assignment.
yes "quaternion" is a pain to write but with completion in nowadays text editor this is not an issue.
An other point is that quaternion is explicite.
Frederic