gsl_quaternion proposition
Thu May 11 11:58:00 GMT 2006

On Wed, 10 May 2006 15:43:15 -0400 (EDT)
"Robert G. Brown" <> 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.


More information about the Gsl-discuss mailing list