[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Comparing GSL Vector Elements with Double Precision Values
From: |
Matthew Boulton |
Subject: |
[Help-gsl] Comparing GSL Vector Elements with Double Precision Values |
Date: |
Sat, 25 Aug 2007 16:38:48 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (Windows/20070728) |
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
address@hidden
- [Help-gsl] Comparing GSL Vector Elements with Double Precision Values,
Matthew Boulton <=