Compiling with optimization flags, made it work. gcc gslRangeCheck.c -lgsl -lgslcblas -O1 -DHAVE_INLINE -DGSL_RANGE_CHECK_OFF
This might need clarification on the website, http://www.gnu.org/software/gsl/manual/html_node/Accessing-vector-elements.html , that optimization must be enabled. Thanks for your help On Mon, Aug 23, 2010 at 10:50 PM, Brian Gough <[email protected]> wrote: > At Thu, 12 Aug 2010 03:20:55 +0200, > glide creme wrote: >> >> On Tue, Aug 10, 2010 at 10:31 PM, Brian Gough <[email protected]> wrote: >> > At Mon, 9 Aug 2010 18:45:10 +0200, >> > glide creme wrote: >> >> >> >> Yes, i wanted to do this, because of speed issues. >> >> >> >> But it would seem from the lack of responses, >> >> that it might not be possible afterall to disable the range checking. >> >> >> > >> > It is possible, and is tested in the test suite. >> > >> > Maybe your header file is from an older version which used a different >> > macro. >> > >> >> Hi thanks for your reply, >> >> Can you specify which testsuite that is? >> I ran 'make check' and everything seems to be working >> >> It says '1 test passed' 42 times, and twice it says 'All 2 tests passed' >> >> I'm using the gsl version 1.14, and I installed it using the make utility, >> No other version of gsl has been previously installed on this computer. >> >> >> My sourcecode which is taken directly from >> http://www.gnu.org/software/gsl/manual/html_node/Example-programs-for-vectors.html >> looks like. >> >> //file start >> #define GSL_RANGE_CHECK_OFF >> >> #include <stdio.h> >> #include <gsl/gsl_vector.h> >> >> 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); >> } >> >> for (i = 0; i < 100; i++) /* OUT OF RANGE ERROR */ >> { >> printf ("v_%d = %g\n", i, gsl_vector_get (v, i)); >> } >> >> gsl_vector_free (v); >> return 0; >> } >> //fileend >> >> >> When I have GSL_RANGE_CHECK_OFF in the file, the compiler complains if >> I also supply the -DGSL_RANGE_CHECK=0 in the command line. >> >> >> gcc -lgsl gslRangeCheck.c -lgslcblas -DGSL_RANGE_CHECK=0 >> In file included from /usr/include/gsl/gsl_vector_complex_long_double.h:27, >> from /usr/include/gsl/gsl_vector.h:4, >> from gslRangeCheck.c:4: >> /usr/include/gsl/gsl_check_range.h:47:4: error: #error "cannot set >> both GSL_RANGE_CHECK and GSL_RANGE_CHECK_OFF" >> > > Since inline functions are not enabled (-DHAVE_INLINE -O2) the call > goes to the static version of the function where range checking is > controlled by the global variable gsl_check_range. It's described > shortly after the section about GSL_RANGE_CHECK_OFF. > > -- > Brian Gough > > _______________________________________________ Help-gsl mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gsl
