Hello. I'm having difficult making comparisons between the elements in my GSL vectors and some double precision values in my programmes. I've produced a test programme below which illustrates the problem I am having:

#include <stdio.h>

#include <gsl/gsl_vector.h>

gsl_vector *sub_ref;
gsl_vector *sub_image;

int main()

{

 int i,j;
 int sub_width = 1536;
 int sub_height = 1536;
 int width = 10000;

 double PIX_MIN = 100.0, SATURATION = 59000.0;

 sub_ref = gsl_vector_calloc( sub_width * sub_height );
 sub_image = gsl_vector_calloc( sub_width * sub_height );

if ( sub_image[ i + width * j ] < PIX_MIN || sub_ref[ i + width * j ] < PIX_MIN )

 {
printf("IF 1 executed\n");

 }

if (sub_image[ i + width * j ] >= SATURATION || sub_ref[ i + width * j ] >= SATURATION )

 {
printf("IF 2 executed\n");

 }

 return 0;

}

The GSL vectors are being declared as double precision, yet I am getting the following errors:

PIX_MIN_test.c: In function 'main':
PIX_MIN_test.c:22: error: invalid operands to binary <
PIX_MIN_test.c:22: error: invalid operands to binary <
PIX_MIN_test.c:30: error: invalid operands to binary >=
PIX_MIN_test.c:30: error: invalid operands to binary >=

Can anyone advise me on what I'm doing wrong?

Kind Regards,

Matt

--
Matthew Boulton
Level 4 Physics and Astronomy
Collingwood College

[EMAIL PROTECTED]



_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to