[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Turn off range checking in GSL
From: |
Khoa Tran |
Subject: |
[Help-gsl] Turn off range checking in GSL |
Date: |
Thu, 10 Apr 2014 12:17:54 +0000 |
Hello everyone,
I’m following up with an old topic here
http://lists.gnu.org/archive/html/help-gsl/2010-07/msg00027.html. I tried the
suggestion their in or either:
#define GSL_RANGE_CHECK 0
or
#define GSL_RANGE_CHECK_OFF
Neither of these options would disable the range checking feature. Would any of
us have any success at this? I’m using clang/llvm on a MAC OS 10.9.
The test case is below:
#include <stdlib.h> // Contain size_t, exit()...
#include <stdio.h> // Standard I/O
#include <gsl/gsl_errno.h> // Error handler
#include <math.h> // Native C math functions
#include <gsl/gsl_math.h> // GSL basic math fucntions
#define GSL_RANGE_CHECK 0
//#define GSL_RANGE_CHECK_OFF // Turn off range checking for arrays
#include <gsl/gsl_check_range.h>
#include <gsl/gsl_block.h> // Allocating blocks
#include <gsl/gsl_vector.h> // Allocating vectors and more
#include <gsl/gsl_matrix.h> // Allocating matrices and more
int main(void)
{
int i;
gsl_vector * v = gsl_vector_alloc(3);
for (i = 0; i < 3; i++)
{
gsl_vector_set(v, i, 1.23 + i);
}
printf ("length of vector = %d\n", (int)v->size);
printf ("length of stride = %d\n", (int)v->stride);
printf ("first element from data = %lf\n", * v->data);
printf ("address of block = %#x\n", v->block);
printf ("Owner flag of block = %d\n\n", v->owner);
for (i = 0; i < 4; i++) /* OUT OF RANGE ERROR */
{
printf(“v_%d = %g\n", i, gsl_vector_get(v, i));
}
return 0;
}
My compilation commands are:
gcc -Wall -I/usr/local/include -DHAVE_INLINE -c main.c
gcc -L/usr/local/lib main.o -lgsl -lgslcblas -lm -o main
Best regards!
Khoa
- [Help-gsl] Turn off range checking in GSL,
Khoa Tran <=
- Re: [Help-gsl] Turn off range checking in GSL, Patrick Alken, 2014/04/10
- Re: [Help-gsl] Turn off range checking in GSL, Peter Johansson, 2014/04/10
- Re: [Help-gsl] Turn off range checking in GSL, Khoa Tran, 2014/04/10
- Re: [Help-gsl] Turn off range checking in GSL, Peter Johansson, 2014/04/10
- Re: [Help-gsl] Turn off range checking in GSL, Khoa Tran, 2014/04/10
- Re: [Help-gsl] Turn off range checking in GSL, Peter Johansson, 2014/04/10
- Re: [Help-gsl] Turn off range checking in GSL, Khoa Tran, 2014/04/10
- Re: [Help-gsl] Turn off range checking in GSL, Khoa Tran, 2014/04/10