You are on page 1of 19

GSL

Visual C/C++

2008/6/20

Reinventing the wheel

IT
SE

Numerical Recipes

GSL

GSL

GNUUNIX


z


Numerical Recipes

z
Numerical Recipes

Numerical Recipes


z 20086 gsl-1.11
z GNU
http://www.gnu.org/software/gsl/

UNIX

z Windows Visual C/C++


CERN
http://service-spi.web.cern.ch/service-spi/external/distribution/

GSL_<version>__LCG_<platform>.tar.gz

GSL_1.10__LCG_win32_vc71.tar.gz
CERN
WWW


ztar.gz
z
includegsl
*.h
lib
*.lib, *.dll


z gsl
(Visual Studio)VCinclude

z
#include <gsl/gsl_***.h>

*.lib
z (Visual Studio)VClib
gsl
z lib *.lib
(Visual Studio)VClibgsl

*.exp

*.dll
z gsl.dll gslcblas.dll PATH

C:WINDOWSsystem32


*.exe
debug release
DLL
gsltest

system32

Visual C/C++
z GSL
z Visual C/C++
1.
2. C/C++

3.
4.
5.
6. DLL
7.

z
DebugRelease


z
z*.c *.cpp
z
#include <gsl/gsl_***.h>
***
gsl_matrix.h


z
z C/C++
z ;GSL_DLL
C/C++


z
z *.lib

gsl.lib GSL
gslcblas.lib
(BLAS = Basic Linear Algebra Subprogram)

gsl.exp
gslcblas.exp
gslML.lib
gslcblasML.lib

&


#include <stdio.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_blas.h>
int
main (void)
{
const gsl_rng_type * T = gsl_rng_default;
gsl_rng * r = gsl_rng_alloc (T);
int i;
printf ("Here are ten random numbers in the range 0-99:n");
for (i = 0; i < 10; i++)
{
int k = gsl_rng_uniform_int (r, 100);
printf(" %d", k);
}
printf("n");
{
double x[5] = { 1.0, 2.0, 3.0, 4.0, 5.0} ;
double y[5] = { 5.5, 4.4, 3.3, 2.2, 1.1} ;
gsl_vector_view v = gsl_vector_view_array(x, 5);
gsl_vector_view w = gsl_vector_view_array(y, 5);
printf("blas operation DAXPYn");
printf("x:"); for (i = 0; i < 5; i++) { printf(" %g", x[i]); } ;
printf(" y:"); for (i = 0; i < 5; i++) { printf(" %g", y[i]); } ;
gsl_blas_daxpy (1.0, &v.vector, &w.vector);
printf("n");
printf("a x + y:"); for (i = 0; i < 5; i++) { printf(" %g", y[i]); } ;
}
printf("n");
return 0;
}

GSL 1.2 for Visual C


zDebug
Release
;GSL_DLL
z

gsl.dllgslcblas.dll


z
Microsoft Windows XP SP2 Professional
Microsoft Visual C++ 2005 Express Edition


zGSL
http://www.gnu.org/software/gsl/
z
http://www.cbrc.jp/~tominaga/translations/index.php

Numerical Recipes
z Numerical Recipes
http://numerical-recipes.com/
Numerical Recipes in C

Numerical Recipes in C++


$65

z Numerical Recipes in C

Why Not Numerical Recipes?


http://nakano.webmasters.gr.jp/nr.html