|
|
Subject: GSL 1.11 available for Windows and Visual Studio .NET 2003 - msg#00064
List: lib.gsl.general
Hi all,
I have updated my earlier "port" of the GNU Scientific Library (GSL) for
Windows Visual Studio .NET 2003 / Visual C++ 7.1 to its 1.11 version.
Binaries and sources could be downloaded at the following URL :
http://david.geldreich.free.fr/dev.html
The sources implements the tests, all of which pass.
The binary package comes with an Visual Studio project example to
show how to use the library with Visual.
You could use the source package to compile the whole thing under
Visual Studio 2005.
David.
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: Help with random sampling
Hi Tim,
there are two problems in your code:
1. You have to add the lines
#include <stdio.h>
#include <gsl/gsl_randist.h>
to the beginning of your program. The header files "stdio.h" and
"gsl/gsl_randist.h" contain declarations of the functions you use (printf,
gsl_ran_choose). Without this information, the compiler complains about the
"implicit declaration", i.e., the appearance of a function without a proper
declaration. Additionally, you have to tell the linker where to find the
actual code of the functions. In order to do this, you have to add '-lgsl
-lgslcblas -lm' to the gcc command line, e.g.
gcc test.c -lgsl -lgslcblas -lm
2. The compiler issues a warning about your incorrect use of gsl_ran_choose.
Indeed, the first argument to this function should be of type gsl_rng *, not
int, see
http://www.gnu.org/software/gsl/manual/html_node/Shuffling-and-Sampling.html
Maybe you should read the chapter
http://www.gnu.org/software/gsl/manual/html_node/Using-the-library.html
in the manual and have a look at some example programs in the documentation
to get familiar with GSL programming.
Regards,
Frank
Previous Message by Thread:
click to view message preview
Help with random sampling
Hello,
I am new to programming, so I apologize for the simplicity of this
question. I am trying to learn how to use the gsl_ran_choose and
gsl_ran_sample functions, but am having trouble getting them to work. I
always get the error "implicit declaration of function
'gsl_ran_choose'". I am just trying to work through simple examples
now, and my code is below (for taking an array from 0 to 9, and
shuffling those into another array). I would appreciate any help that
you could give. Thank you for your time.
-Tim Frasier
int main(void)
{
int i, r;
int a[10];
int b[10];
r = 10;
for (i = 0; i < 10; i++)
{
a[i] = i;
}
gsl_ran_choose (r, a, 10, b, 10, sizeof(int));
for(i = 0; i < 10; i++)
{
printf("\nb[%d] = ", i);
printf("%d", b[i]);
}
printf("\n");
return(0);
}
Timothy R. Frasier, Ph.D.
Trent University
DNA Building
2140 East Bank Drive
Peterborough, Ontario K9J 7B8
Canada
Tel: 705-748-1011 ext. 7226
E-mail: timothyfrasier@xxxxxxxxx
|
|