help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Custom structures containing gsl_vector


From: Daniel J Farrell
Subject: [Help-gsl] Custom structures containing gsl_vector
Date: Tue, 27 Nov 2007 17:50:53 +0000

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;

}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]