logo       

Custom structures containing gsl_vector: msg#00061

lib.gsl.general

Subject: Custom structures containing gsl_vector

Hello,

I have implement a data structure that stores two columns of experimental data using the gsl_vector type. However, I am having a run time error when initialising the my custom data type, EXC_BAD_ACCESS. I think it is silly pointer related problem.

Can anybody help? I have highlighted the line in the following code.

Regards,

Dan.

___

typedef struct _Spectra
{

gsl_vector *x;
gsl_vector *y;
unsigned count;

} Spectra;

void MakeSpectra (Spectra *spectra, double *x, double *y, unsigned count)
{

/* error on the line below */
spectra->x = gsl_vector_alloc(count);

spectra->y = gsl_vector_alloc(count);
memcpy(spectra->x->block->data,x,count * sizeof(double));
memcpy(spectra->y->block->data,y,count * sizeof(double));
spectra->count = count;

}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise