This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Some (probably) ridiculous questions
- To: gsl-discuss at sourceware dot cygnus dot com
- Subject: Some (probably) ridiculous questions
- From: Jean-Max Redonnet <redonnet at lgmt-fab1 dot ups-tlse dot fr>
- Date: Fri, 6 Jul 2001 11:53:12 +0200
- Organization: LGMT
- Reply-To: redonnetNO at SPAMlgmt dot ups-tlse dot fr
Sorry, if this point is obvious, but I'm not very familiar with GSL and I
would like to use it in the right way.
My question is : How to declare a function of multiple variables ?
I manage with parametric curves and surfaces, so I need functions of one or
two parameters. Futhermore This functions should be vectorial.
For example : I need to deal with a ruled surface.
Its definition is
C0(u) : vectorial function with 3 components : C0x(u), C0y(u) and C0z(u)
C1(u) : idem with C1x(u), C1y(u) and C1z(u)
then surface S(u,v) is built from C0 and C1 with
S(u,v) = (1-v)C0(u) + vC1(u)
How can I define this with GSL ?
For moment I've defined a
struct v3func
{
gsl_function fx;
gsl_function fy;
gsl_function fz;
};
then, once declared
struct v3func *C0;
I can do
C0 = (struct v3func *)malloc(sizeof(struct v3func *));
C0->fx.function = &C0_fx;
C0->fy.function = &C0_fy;
C0->fz.function = &C0_fz;
with C0_fx, C0_fy and C0_fz declared by
double C0_fx(double u, void * params);
double C0_fy(double u, void * params);
double C0_fz(double u, void * params);
This seems to work. Idem for C1 (of course).
But I have a problem to declare S(u,v)...
I've tried to do the same with S_fx(double u, double v, void * params)
but compilation says : "assignment from incompatible pointer type"
Any help would be very appreciated...
--
===============================================================================
Jean-Max Redonnet
PhD University Paul Sabatier - Toulouse (France)
mailto:redonnetNO@SPAMlgmt.ups-tlse.fr