Esempio n. 1
0
int
main (void)
{
  struct data ntuple_row;
  int i;

  gsl_ntuple *ntuple = gsl_ntuple_open ("test.dat", &ntuple_row,
                                        sizeof (ntuple_row));

  gsl_histogram *h = gsl_histogram_calloc_uniform (100, 0., 10.);

  gsl_ntuple_select_fn S;
  gsl_ntuple_value_fn V;

  double scale = 1.5;

  S.function = &sel_func;
  S.params = &scale;

  V.function = &val_func;
  V.params = 0;

  gsl_ntuple_project (h, ntuple, &V, &S);

  gsl_histogram_fprintf (stdout, h, "%f", "%f");

  gsl_histogram_free (h);

  gsl_ntuple_close (ntuple);
}
Esempio n. 2
0
int main(void) {
	struct data ntuple_row;

	gsl_ntuple *ntuple
	= gsl_ntuple_open ("test.dat", &ntuple_row,
	sizeof (ntuple_row));
	double lower = 1.5;

	gsl_ntuple_select_fn S;
	gsl_ntuple_value_fn V;

	gsl_histogram *h = gsl_histogram_alloc (100);
	gsl_histogram_set_ranges_uniform(h, 0.0, 10.0);

	S.function = &sel_func;
	S.params = &lower;

	V.function = &val_func;
	V.params = 0;

	gsl_ntuple_project (h, ntuple, &V, &S);

	gsl_histogram_fprintf (stdout, h, "%f", "%f");
	gsl_histogram_free (h);
	gsl_ntuple_close (ntuple);

	return 0;
}