Naive question from novice C programmer

Alex Casti arc@camelot.mssm.edu
Sat Sep 28 19:13:00 GMT 2002


I'm fairly new to both GSL and the C programming language.
What I'm wondering is if there's a way to employ the GSL
routines that take arrays as input, where the arrays are *not*
defined the GSL way using "gsl_vector_alloc" and so forth,
but rather the usual manual way with malloc, i.e.

xarray = (double *) malloc((nsize)*sizeof(double));


I would prefer to use my own array names and definitions
because the GSL calling names are somewhat unwieldy and long.
However, it doesn't appear that I can define "xarray" as
above and then shove this into a GSL function like

gsl_vector_set_all(xarray, 10.)

When I try this I get an error complaining about incompatible
pointer types.

Am I correct in concluding that I *cannot* set my own array allocations
and use the GSL routines?  Must I always use the GSL vector structs?

Thanks for your help.





More information about the Gsl-discuss mailing list