diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-04-08 17:33:11 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-04-08 17:33:11 +0000 |
commit | 73f643f3f4a55310b2c8c1a9858906b2dd676e72 (patch) | |
tree | b1df97f18dace4a5702b0bc7aafdfee8a2f25ada /gsl-1.9/doc/examples | |
parent | ee523abdace8337d05ec4a179fcdf5de3fe0f634 (diff) |
2011-04-08 Joel Sherrill <joel.sherrill@oarcorp.com>
* AUTHORS, BUGS, COPYING, ChangeLog, INSTALL, Makefile.am, Makefile.in,
NEWS, README, SUPPORT, THANKS, TODO, acconfig.h, aclocal.m4,
autogen.sh, config.guess, config.h.in, config.sub, configure,
configure.ac, gsl-config.in, gsl-histogram.c, gsl-randist.c, gsl.m4,
gsl.pc.in, gsl.spec.in, gsl_machine.h, gsl_math.h, gsl_mode.h,
gsl_nan.h, gsl_pow_int.h, gsl_precision.h, gsl_types.h,
gsl_version.h.in, install-sh, ltmain.sh, mdate-sh, missing,
mkinstalldirs, templates_off.h, templates_on.h,
test_gsl_histogram.sh, version.c, blas/ChangeLog, blas/Makefile.am,
blas/Makefile.in, blas/TODO, blas/blas.c, blas/gsl_blas.h,
blas/gsl_blas_types.h, block/ChangeLog, block/Makefile.am,
block/Makefile.in, block/block.c, block/block_source.c, block/file.c,
block/fprintf_source.c, block/fwrite_source.c, block/gsl_block.h,
block/gsl_block_char.h, block/gsl_block_complex_double.h,
block/gsl_block_complex_float.h,
block/gsl_block_complex_long_double.h, block/gsl_block_double.h,
block/gsl_block_float.h, block/gsl_block_int.h,
block/gsl_block_long.h, block/gsl_block_long_double.h,
block/gsl_block_short.h, block/gsl_block_uchar.h,
block/gsl_block_uint.h, block/gsl_block_ulong.h,
block/gsl_block_ushort.h, block/gsl_check_range.h, block/init.c,
block/init_source.c, block/test.c, block/test_complex_io.c,
block/test_complex_source.c, block/test_io.c, block/test_source.c,
bspline/ChangeLog, bspline/Makefile.am, bspline/Makefile.in,
bspline/TODO, bspline/bspline.c, bspline/gsl_bspline.h,
bspline/test.c, cblas/ChangeLog, cblas/Makefile.am,
cblas/Makefile.in, cblas/TODO, cblas/caxpy.c, cblas/cblas.h,
cblas/ccopy.c, cblas/cdotc_sub.c, cblas/cdotu_sub.c, cblas/cgbmv.c,
cblas/cgemm.c, cblas/cgemv.c, cblas/cgerc.c, cblas/cgeru.c,
cblas/chbmv.c, cblas/chemm.c, cblas/chemv.c, cblas/cher.c,
cblas/cher2.c, cblas/cher2k.c, cblas/cherk.c, cblas/chpmv.c,
cblas/chpr.c, cblas/chpr2.c, cblas/cscal.c, cblas/csscal.c,
cblas/cswap.c, cblas/csymm.c, cblas/csyr2k.c, cblas/csyrk.c,
cblas/ctbmv.c, cblas/ctbsv.c, cblas/ctpmv.c, cblas/ctpsv.c,
cblas/ctrmm.c, cblas/ctrmv.c, cblas/ctrsm.c, cblas/ctrsv.c,
cblas/dasum.c, cblas/daxpy.c, cblas/dcopy.c, cblas/ddot.c,
cblas/dgbmv.c, cblas/dgemm.c, cblas/dgemv.c, cblas/dger.c,
cblas/dnrm2.c, cblas/drot.c, cblas/drotg.c, cblas/drotm.c,
cblas/drotmg.c, cblas/dsbmv.c, cblas/dscal.c, cblas/dsdot.c,
cblas/dspmv.c, cblas/dspr.c, cblas/dspr2.c, cblas/dswap.c,
cblas/dsymm.c, cblas/dsymv.c, cblas/dsyr.c, cblas/dsyr2.c,
cblas/dsyr2k.c, cblas/dsyrk.c, cblas/dtbmv.c, cblas/dtbsv.c,
cblas/dtpmv.c, cblas/dtpsv.c, cblas/dtrmm.c, cblas/dtrmv.c,
cblas/dtrsm.c, cblas/dtrsv.c, cblas/dzasum.c, cblas/dznrm2.c,
cblas/gsl_cblas.h, cblas/hypot.c, cblas/icamax.c, cblas/idamax.c,
cblas/isamax.c, cblas/izamax.c, cblas/sasum.c, cblas/saxpy.c,
cblas/scasum.c, cblas/scnrm2.c, cblas/scopy.c, cblas/sdot.c,
cblas/sdsdot.c, cblas/sgbmv.c, cblas/sgemm.c, cblas/sgemv.c,
cblas/sger.c, cblas/snrm2.c, cblas/source_asum_c.h,
cblas/source_asum_r.h, cblas/source_axpy_c.h, cblas/source_axpy_r.h,
cblas/source_copy_c.h, cblas/source_copy_r.h, cblas/source_dot_c.h,
cblas/source_dot_r.h, cblas/source_gbmv_c.h, cblas/source_gbmv_r.h,
cblas/source_gemm_c.h, cblas/source_gemm_r.h, cblas/source_gemv_c.h,
cblas/source_gemv_r.h, cblas/source_ger.h, cblas/source_gerc.h,
cblas/source_geru.h, cblas/source_hbmv.h, cblas/source_hemm.h,
cblas/source_hemv.h, cblas/source_her.h, cblas/source_her2.h,
cblas/source_her2k.h, cblas/source_herk.h, cblas/source_hpmv.h,
cblas/source_hpr.h, cblas/source_hpr2.h, cblas/source_iamax_c.h,
cblas/source_iamax_r.h, cblas/source_nrm2_c.h, cblas/source_nrm2_r.h,
cblas/source_rot.h, cblas/source_rotg.h, cblas/source_rotm.h,
cblas/source_rotmg.h, cblas/source_sbmv.h, cblas/source_scal_c.h,
cblas/source_scal_c_s.h, cblas/source_scal_r.h, cblas/source_spmv.h,
cblas/source_spr.h, cblas/source_spr2.h, cblas/source_swap_c.h,
cblas/source_swap_r.h, cblas/source_symm_c.h, cblas/source_symm_r.h,
cblas/source_symv.h, cblas/source_syr.h, cblas/source_syr2.h,
cblas/source_syr2k_c.h, cblas/source_syr2k_r.h,
cblas/source_syrk_c.h, cblas/source_syrk_r.h, cblas/source_tbmv_c.h,
cblas/source_tbmv_r.h, cblas/source_tbsv_c.h, cblas/source_tbsv_r.h,
cblas/source_tpmv_c.h, cblas/source_tpmv_r.h, cblas/source_tpsv_c.h,
cblas/source_tpsv_r.h, cblas/source_trmm_c.h, cblas/source_trmm_r.h,
cblas/source_trmv_c.h, cblas/source_trmv_r.h, cblas/source_trsm_c.h,
cblas/source_trsm_r.h, cblas/source_trsv_c.h, cblas/source_trsv_r.h,
cblas/srot.c, cblas/srotg.c, cblas/srotm.c, cblas/srotmg.c,
cblas/ssbmv.c, cblas/sscal.c, cblas/sspmv.c, cblas/sspr.c,
cblas/sspr2.c, cblas/sswap.c, cblas/ssymm.c, cblas/ssymv.c,
cblas/ssyr.c, cblas/ssyr2.c, cblas/ssyr2k.c, cblas/ssyrk.c,
cblas/stbmv.c, cblas/stbsv.c, cblas/stpmv.c, cblas/stpsv.c,
cblas/strmm.c, cblas/strmv.c, cblas/strsm.c, cblas/strsv.c,
cblas/test.c, cblas/test_amax.c, cblas/test_asum.c,
cblas/test_axpy.c, cblas/test_copy.c, cblas/test_dot.c,
cblas/test_gbmv.c, cblas/test_gemm.c, cblas/test_gemv.c,
cblas/test_ger.c, cblas/test_hbmv.c, cblas/test_hemm.c,
cblas/test_hemv.c, cblas/test_her.c, cblas/test_her2.c,
cblas/test_her2k.c, cblas/test_herk.c, cblas/test_hpmv.c,
cblas/test_hpr.c, cblas/test_hpr2.c, cblas/test_nrm2.c,
cblas/test_rot.c, cblas/test_rotg.c, cblas/test_rotm.c,
cblas/test_rotmg.c, cblas/test_sbmv.c, cblas/test_scal.c,
cblas/test_spmv.c, cblas/test_spr.c, cblas/test_spr2.c,
cblas/test_swap.c, cblas/test_symm.c, cblas/test_symv.c,
cblas/test_syr.c, cblas/test_syr2.c, cblas/test_syr2k.c,
cblas/test_syrk.c, cblas/test_tbmv.c, cblas/test_tbsv.c,
cblas/test_tpmv.c, cblas/test_tpsv.c, cblas/test_trmm.c,
cblas/test_trmv.c, cblas/test_trsm.c, cblas/test_trsv.c,
cblas/tests.c, cblas/tests.h, cblas/xerbla.c, cblas/zaxpy.c,
cblas/zcopy.c, cblas/zdotc_sub.c, cblas/zdotu_sub.c, cblas/zdscal.c,
cblas/zgbmv.c, cblas/zgemm.c, cblas/zgemv.c, cblas/zgerc.c,
cblas/zgeru.c, cblas/zhbmv.c, cblas/zhemm.c, cblas/zhemv.c,
cblas/zher.c, cblas/zher2.c, cblas/zher2k.c, cblas/zherk.c,
cblas/zhpmv.c, cblas/zhpr.c, cblas/zhpr2.c, cblas/zscal.c,
cblas/zswap.c, cblas/zsymm.c, cblas/zsyr2k.c, cblas/zsyrk.c,
cblas/ztbmv.c, cblas/ztbsv.c, cblas/ztpmv.c, cblas/ztpsv.c,
cblas/ztrmm.c, cblas/ztrmv.c, cblas/ztrsm.c, cblas/ztrsv.c,
cdf/ChangeLog, cdf/Makefile.am, cdf/Makefile.in, cdf/beta.c,
cdf/beta_inc.c, cdf/betainv.c, cdf/binomial.c, cdf/cauchy.c,
cdf/cauchyinv.c, cdf/chisq.c, cdf/chisqinv.c, cdf/error.h,
cdf/exponential.c, cdf/exponentialinv.c, cdf/exppow.c, cdf/fdist.c,
cdf/fdistinv.c, cdf/flat.c, cdf/flatinv.c, cdf/gamma.c,
cdf/gammainv.c, cdf/gauss.c, cdf/gaussinv.c, cdf/geometric.c,
cdf/gsl_cdf.h, cdf/gumbel1.c, cdf/gumbel1inv.c, cdf/gumbel2.c,
cdf/gumbel2inv.c, cdf/hypergeometric.c, cdf/laplace.c,
cdf/laplaceinv.c, cdf/logistic.c, cdf/logisticinv.c, cdf/lognormal.c,
cdf/lognormalinv.c, cdf/nbinomial.c, cdf/pareto.c, cdf/paretoinv.c,
cdf/pascal.c, cdf/poisson.c, cdf/rat_eval.h, cdf/rayleigh.c,
cdf/rayleighinv.c, cdf/tdist.c, cdf/tdistinv.c, cdf/test.c,
cdf/test_auto.c, cdf/weibull.c, cdf/weibullinv.c, cheb/ChangeLog,
cheb/Makefile.am, cheb/Makefile.in, cheb/deriv.c, cheb/eval.c,
cheb/gsl_chebyshev.h, cheb/init.c, cheb/integ.c, cheb/test.c,
combination/ChangeLog, combination/Makefile.am,
combination/Makefile.in, combination/combination.c,
combination/file.c, combination/gsl_combination.h,
combination/init.c, combination/test.c, complex/ChangeLog,
complex/Makefile.am, complex/Makefile.in, complex/TODO,
complex/gsl_complex.h, complex/gsl_complex_math.h, complex/math.c,
complex/results.h, complex/results1.h, complex/results_real.h,
complex/test.c, const/ChangeLog, const/Makefile.am,
const/Makefile.in, const/TODO, const/gsl_const.h,
const/gsl_const_cgs.h, const/gsl_const_cgsm.h, const/gsl_const_mks.h,
const/gsl_const_mksa.h, const/gsl_const_num.h, const/test.c,
deriv/ChangeLog, deriv/Makefile.am, deriv/Makefile.in, deriv/deriv.c,
deriv/gsl_deriv.h, deriv/test.c, dht/ChangeLog, dht/Makefile.am,
dht/Makefile.in, dht/dht.c, dht/gsl_dht.h, dht/test.c,
diff/ChangeLog, diff/Makefile.am, diff/Makefile.in, diff/diff.c,
diff/gsl_diff.h, diff/test.c, doc/12-cities.eps, doc/ChangeLog,
doc/Makefile.am, doc/Makefile.in, doc/algorithm.sty,
doc/algorithmic.sty, doc/autoconf.texi, doc/blas.texi,
doc/bspline.eps, doc/bspline.texi, doc/calc.sty, doc/cblas.texi,
doc/cheb.eps, doc/cheb.texi, doc/combination.texi, doc/complex.texi,
doc/const.texi, doc/debug.texi, doc/dht.texi, doc/diff.texi,
doc/dwt-orig.eps, doc/dwt-samp.eps, doc/dwt.texi, doc/eigen.texi,
doc/err.texi, doc/fdl.texi, doc/fft-complex-radix2-f.eps,
doc/fft-complex-radix2-t.eps, doc/fft-complex-radix2.eps,
doc/fft-real-mixedradix.eps, doc/fft.texi, doc/fftalgorithms.bib,
doc/fftalgorithms.tex, doc/final-route.eps, doc/fit-exp.eps,
doc/fit-wlinear.eps, doc/fit-wlinear2.eps, doc/fitting.texi,
doc/freemanuals.texi, doc/gpl.texi, doc/gsl-config.1,
doc/gsl-design.texi, doc/gsl-histogram.1, doc/gsl-randist.1,
doc/gsl-ref.info, doc/gsl-ref.info-1, doc/gsl-ref.info-2,
doc/gsl-ref.info-3, doc/gsl-ref.info-4, doc/gsl-ref.info-5,
doc/gsl-ref.info-6, doc/gsl-ref.texi, doc/gsl.3, doc/histogram.eps,
doc/histogram.texi, doc/histogram2d.eps, doc/ieee754.texi,
doc/initial-route.eps, doc/integration.texi, doc/interp.texi,
doc/interp2.eps, doc/interpp2.eps, doc/intro.texi, doc/landau.dat,
doc/linalg.texi, doc/math.texi, doc/mdate-sh, doc/min-interval.eps,
doc/min.texi, doc/montecarlo.texi, doc/multifit.texi,
doc/multimin.eps, doc/multimin.texi, doc/multiroots.texi,
doc/ntuple.eps, doc/ntuple.texi, doc/ode-initval.texi,
doc/permutation.texi, doc/poly.texi, doc/qrng.eps, doc/qrng.texi,
doc/rand-bernoulli.tex, doc/rand-beta.tex, doc/rand-binomial.tex,
doc/rand-bivariate-gaussian.tex, doc/rand-cauchy.tex,
doc/rand-chisq.tex, doc/rand-erlang.tex, doc/rand-exponential.tex,
doc/rand-exppow.tex, doc/rand-fdist.tex, doc/rand-flat.tex,
doc/rand-gamma.tex, doc/rand-gaussian-tail.tex,
doc/rand-gaussian.tex, doc/rand-geometric.tex, doc/rand-gumbel.tex,
doc/rand-gumbel1.tex, doc/rand-gumbel2.tex,
doc/rand-hypergeometric.tex, doc/rand-landau.tex,
doc/rand-laplace.tex, doc/rand-levy.tex, doc/rand-levyskew.tex,
doc/rand-logarithmic.tex, doc/rand-logistic.tex,
doc/rand-lognormal.tex, doc/rand-nbinomial.tex, doc/rand-pareto.tex,
doc/rand-pascal.tex, doc/rand-poisson.tex,
doc/rand-rayleigh-tail.tex, doc/rand-rayleigh.tex,
doc/rand-tdist.tex, doc/rand-weibull.tex, doc/randist.texi,
doc/random-walk.tex, doc/randplots.gnp, doc/rng.texi,
doc/roots-bisection.eps, doc/roots-false-position.eps,
doc/roots-newtons-method.eps, doc/roots-secant-method.eps,
doc/roots.texi, doc/siman-energy.eps, doc/siman-test.eps,
doc/siman.texi, doc/sort.texi, doc/specfunc-airy.texi,
doc/specfunc-bessel.texi, doc/specfunc-clausen.texi,
doc/specfunc-coulomb.texi, doc/specfunc-coupling.texi,
doc/specfunc-dawson.texi, doc/specfunc-debye.texi,
doc/specfunc-dilog.texi, doc/specfunc-elementary.texi,
doc/specfunc-ellint.texi, doc/specfunc-elljac.texi,
doc/specfunc-erf.texi, doc/specfunc-exp.texi,
doc/specfunc-expint.texi, doc/specfunc-fermi-dirac.texi,
doc/specfunc-gamma.texi, doc/specfunc-gegenbauer.texi,
doc/specfunc-hyperg.texi, doc/specfunc-laguerre.texi,
doc/specfunc-lambert.texi, doc/specfunc-legendre.texi,
doc/specfunc-log.texi, doc/specfunc-mathieu.texi,
doc/specfunc-pow-int.texi, doc/specfunc-psi.texi,
doc/specfunc-synchrotron.texi, doc/specfunc-transport.texi,
doc/specfunc-trig.texi, doc/specfunc-zeta.texi, doc/specfunc.texi,
doc/stamp-vti, doc/statistics.texi, doc/sum.texi, doc/texinfo.tex,
doc/usage.texi, doc/vdp.eps, doc/vectors.texi, doc/version-ref.texi,
doc/examples/blas.c, doc/examples/blas.out, doc/examples/block.c,
doc/examples/block.out, doc/examples/bspline.c, doc/examples/cblas.c,
doc/examples/cblas.out, doc/examples/cdf.c, doc/examples/cdf.out,
doc/examples/cheb.c, doc/examples/combination.c,
doc/examples/combination.out, doc/examples/const.c,
doc/examples/const.out, doc/examples/demo_fn.c,
doc/examples/demo_fn.h, doc/examples/diff.c, doc/examples/diff.out,
doc/examples/dwt.c, doc/examples/dwt.dat, doc/examples/ecg.dat,
doc/examples/eigen.c, doc/examples/eigen_nonsymm.c,
doc/examples/expfit.c, doc/examples/fft.c, doc/examples/fftmr.c,
doc/examples/fftreal.c, doc/examples/fitting.c,
doc/examples/fitting2.c, doc/examples/fitting3.c,
doc/examples/histogram.c, doc/examples/histogram2d.c,
doc/examples/ieee.c, doc/examples/ieeeround.c,
doc/examples/integration.c, doc/examples/integration.out,
doc/examples/interp.c, doc/examples/interpp.c, doc/examples/intro.c,
doc/examples/intro.out, doc/examples/linalglu.c,
doc/examples/linalglu.out, doc/examples/matrix.c,
doc/examples/matrixw.c, doc/examples/min.c, doc/examples/min.out,
doc/examples/monte.c, doc/examples/nlfit.c, doc/examples/ntupler.c,
doc/examples/ntuplew.c, doc/examples/ode-initval.c,
doc/examples/odefixed.c, doc/examples/permseq.c,
doc/examples/permshuffle.c, doc/examples/polyroots.c,
doc/examples/polyroots.out, doc/examples/qrng.c,
doc/examples/randpoisson.2.out, doc/examples/randpoisson.c,
doc/examples/randpoisson.out, doc/examples/randwalk.c,
doc/examples/rng.c, doc/examples/rng.out, doc/examples/rngunif.2.out,
doc/examples/rngunif.c, doc/examples/rngunif.out,
doc/examples/rootnewt.c, doc/examples/roots.c, doc/examples/siman.c,
doc/examples/sortsmall.c, doc/examples/sortsmall.out,
doc/examples/specfun.c, doc/examples/specfun.out,
doc/examples/specfun_e.c, doc/examples/specfun_e.out,
doc/examples/stat.c, doc/examples/stat.out, doc/examples/statsort.c,
doc/examples/statsort.out, doc/examples/sum.c, doc/examples/sum.out,
doc/examples/vector.c, doc/examples/vectorr.c,
doc/examples/vectorview.c, doc/examples/vectorview.out,
doc/examples/vectorw.c, eigen/ChangeLog, eigen/Makefile.am,
eigen/Makefile.in, eigen/TODO, eigen/francis.c, eigen/gsl_eigen.h,
eigen/herm.c, eigen/hermv.c, eigen/jacobi.c, eigen/nonsymm.c,
eigen/nonsymmv.c, eigen/qrstep.c, eigen/schur.c, eigen/schur.h,
eigen/sort.c, eigen/symm.c, eigen/symmv.c, eigen/test.c,
err/ChangeLog, err/Makefile.am, err/Makefile.in, err/TODO,
err/error.c, err/gsl_errno.h, err/gsl_message.h, err/message.c,
err/stream.c, err/strerror.c, err/test.c, fft/ChangeLog,
fft/Makefile.am, fft/Makefile.in, fft/TODO, fft/bitreverse.c,
fft/bitreverse.h, fft/c_init.c, fft/c_main.c, fft/c_pass.h,
fft/c_pass_2.c, fft/c_pass_3.c, fft/c_pass_4.c, fft/c_pass_5.c,
fft/c_pass_6.c, fft/c_pass_7.c, fft/c_pass_n.c, fft/c_radix2.c,
fft/compare.h, fft/compare_source.c, fft/complex_internal.h,
fft/dft.c, fft/dft_source.c, fft/factorize.c, fft/factorize.h,
fft/fft.c, fft/gsl_dft_complex.h, fft/gsl_dft_complex_float.h,
fft/gsl_fft.h, fft/gsl_fft_complex.h, fft/gsl_fft_complex_float.h,
fft/gsl_fft_halfcomplex.h, fft/gsl_fft_halfcomplex_float.h,
fft/gsl_fft_real.h, fft/gsl_fft_real_float.h, fft/hc_init.c,
fft/hc_main.c, fft/hc_pass.h, fft/hc_pass_2.c, fft/hc_pass_3.c,
fft/hc_pass_4.c, fft/hc_pass_5.c, fft/hc_pass_n.c, fft/hc_radix2.c,
fft/hc_unpack.c, fft/real_init.c, fft/real_main.c, fft/real_pass.h,
fft/real_pass_2.c, fft/real_pass_3.c, fft/real_pass_4.c,
fft/real_pass_5.c, fft/real_pass_n.c, fft/real_radix2.c,
fft/real_unpack.c, fft/signals.c, fft/signals.h,
fft/signals_source.c, fft/test.c, fft/test_complex_source.c,
fft/test_real_source.c, fft/test_trap_source.c, fft/urand.c,
fit/ChangeLog, fit/Makefile.am, fit/Makefile.in, fit/gsl_fit.h,
fit/linear.c, fit/test.c, gsl/Makefile.am, gsl/Makefile.in,
histogram/ChangeLog, histogram/Makefile.am, histogram/Makefile.in,
histogram/TODO, histogram/add.c, histogram/add2d.c,
histogram/calloc_range.c, histogram/calloc_range2d.c,
histogram/copy.c, histogram/copy2d.c, histogram/file.c,
histogram/file2d.c, histogram/find.c, histogram/find2d.c,
histogram/get.c, histogram/get2d.c, histogram/gsl_histogram.h,
histogram/gsl_histogram2d.h, histogram/init.c, histogram/init2d.c,
histogram/maxval.c, histogram/maxval2d.c, histogram/oper.c,
histogram/oper2d.c, histogram/params.c, histogram/params2d.c,
histogram/pdf.c, histogram/pdf2d.c, histogram/reset.c,
histogram/reset2d.c, histogram/stat.c, histogram/stat2d.c,
histogram/test.c, histogram/test1d.c, histogram/test1d_resample.c,
histogram/test1d_trap.c, histogram/test2d.c,
histogram/test2d_resample.c, histogram/test2d_trap.c,
histogram/urand.c, ieee-utils/ChangeLog, ieee-utils/Makefile.am,
ieee-utils/Makefile.in, ieee-utils/TODO, ieee-utils/endian.c,
ieee-utils/env.c, ieee-utils/fp-aix.c, ieee-utils/fp-darwin.c,
ieee-utils/fp-darwin86.c, ieee-utils/fp-freebsd.c,
ieee-utils/fp-gnuc99.c, ieee-utils/fp-gnum68k.c,
ieee-utils/fp-gnuppc.c, ieee-utils/fp-gnusparc.c,
ieee-utils/fp-gnux86.c, ieee-utils/fp-hpux.c, ieee-utils/fp-hpux11.c,
ieee-utils/fp-irix.c, ieee-utils/fp-netbsd.c,
ieee-utils/fp-openbsd.c, ieee-utils/fp-os2emx.c,
ieee-utils/fp-solaris.c, ieee-utils/fp-sunos4.c,
ieee-utils/fp-tru64.c, ieee-utils/fp-unknown.c, ieee-utils/fp.c,
ieee-utils/gsl_ieee_utils.h, ieee-utils/make_rep.c,
ieee-utils/print.c, ieee-utils/read.c, ieee-utils/standardize.c,
ieee-utils/test.c, integration/ChangeLog, integration/Makefile.am,
integration/Makefile.in, integration/TODO, integration/append.c,
integration/err.c, integration/gsl_integration.h,
integration/initialise.c, integration/positivity.c,
integration/ptsort.c, integration/qag.c, integration/qagp.c,
integration/qags.c, integration/qawc.c, integration/qawf.c,
integration/qawo.c, integration/qaws.c, integration/qc25c.c,
integration/qc25f.c, integration/qc25s.c, integration/qcheb.c,
integration/qelg.c, integration/qk.c, integration/qk15.c,
integration/qk21.c, integration/qk31.c, integration/qk41.c,
integration/qk51.c, integration/qk61.c, integration/qmomo.c,
integration/qmomof.c, integration/qng.c, integration/qng.h,
integration/qpsrt.c, integration/qpsrt2.c, integration/reset.c,
integration/set_initial.c, integration/test.c, integration/tests.c,
integration/tests.h, integration/util.c, integration/workspace.c,
interpolation/ChangeLog, interpolation/Makefile.am,
interpolation/Makefile.in, interpolation/TODO, interpolation/accel.c,
interpolation/akima.c, interpolation/bsearch.c,
interpolation/bsearch.h, interpolation/cspline.c,
interpolation/gsl_interp.h, interpolation/gsl_spline.h,
interpolation/integ_eval.h, interpolation/interp.c,
interpolation/linear.c, interpolation/poly.c, interpolation/spline.c,
interpolation/test.c, linalg/ChangeLog, linalg/Makefile.am,
linalg/Makefile.in, linalg/TODO, linalg/apply_givens.c,
linalg/balance.c, linalg/balancemat.c, linalg/bidiag.c,
linalg/cholesky.c, linalg/exponential.c, linalg/givens.c,
linalg/gsl_linalg.h, linalg/hermtd.c, linalg/hessenberg.c,
linalg/hh.c, linalg/householder.c, linalg/householdercomplex.c,
linalg/lq.c, linalg/lu.c, linalg/luc.c, linalg/multiply.c,
linalg/ptlq.c, linalg/qr.c, linalg/qrpt.c, linalg/svd.c,
linalg/svdstep.c, linalg/symmtd.c, linalg/test.c, linalg/tridiag.c,
linalg/tridiag.h, matrix/ChangeLog, matrix/Makefile.am,
matrix/Makefile.in, matrix/TODO, matrix/copy.c, matrix/copy_source.c,
matrix/file.c, matrix/file_source.c, matrix/getset.c,
matrix/getset_source.c, matrix/gsl_matrix.h,
matrix/gsl_matrix_char.h, matrix/gsl_matrix_complex_double.h,
matrix/gsl_matrix_complex_float.h,
matrix/gsl_matrix_complex_long_double.h, matrix/gsl_matrix_double.h,
matrix/gsl_matrix_float.h, matrix/gsl_matrix_int.h,
matrix/gsl_matrix_long.h, matrix/gsl_matrix_long_double.h,
matrix/gsl_matrix_short.h, matrix/gsl_matrix_uchar.h,
matrix/gsl_matrix_uint.h, matrix/gsl_matrix_ulong.h,
matrix/gsl_matrix_ushort.h, matrix/init.c, matrix/init_source.c,
matrix/matrix.c, matrix/matrix_source.c, matrix/minmax.c,
matrix/minmax_source.c, matrix/oper.c, matrix/oper_complex_source.c,
matrix/oper_source.c, matrix/prop.c, matrix/prop_source.c,
matrix/rowcol.c, matrix/rowcol_source.c, matrix/submatrix.c,
matrix/submatrix_source.c, matrix/swap.c, matrix/swap_source.c,
matrix/test.c, matrix/test_complex_source.c, matrix/test_source.c,
matrix/test_static.c, matrix/view.c, matrix/view.h,
matrix/view_source.c, min/ChangeLog, min/Makefile.am,
min/Makefile.in, min/bracketing.c, min/brent.c, min/convergence.c,
min/fsolver.c, min/golden.c, min/gsl_min.h, min/min.h, min/test.c,
min/test.h, min/test_funcs.c, monte/ChangeLog, monte/Makefile.am,
monte/Makefile.in, monte/README, monte/TODO, monte/gsl_monte.h,
monte/gsl_monte_miser.h, monte/gsl_monte_plain.h,
monte/gsl_monte_vegas.h, monte/miser.c, monte/plain.c, monte/test.c,
monte/test_main.c, monte/vegas.c, multifit/ChangeLog,
multifit/Makefile.am, multifit/Makefile.in, multifit/TODO,
multifit/convergence.c, multifit/covar.c, multifit/fdfsolver.c,
multifit/fsolver.c, multifit/gradient.c, multifit/gsl_multifit.h,
multifit/gsl_multifit_nlin.h, multifit/lmder.c, multifit/lmiterate.c,
multifit/lmpar.c, multifit/lmset.c, multifit/lmutil.c,
multifit/multilinear.c, multifit/qrsolv.c, multifit/test.c,
multifit/test_brown.c, multifit/test_enso.c,
multifit/test_estimator.c, multifit/test_filip.c, multifit/test_fn.c,
multifit/test_hahn1.c, multifit/test_kirby2.c,
multifit/test_longley.c, multifit/test_nelson.c,
multifit/test_pontius.c, multifit/work.c, multimin/ChangeLog,
multimin/Makefile.am, multimin/Makefile.in, multimin/TODO,
multimin/conjugate_fr.c, multimin/conjugate_pr.c,
multimin/convergence.c, multimin/diff.c,
multimin/directional_minimize.c, multimin/fdfminimizer.c,
multimin/fminimizer.c, multimin/gsl_multimin.h,
multimin/linear_minimize.c, multimin/linear_wrapper.c,
multimin/simplex.c, multimin/steepest_descent.c, multimin/test.c,
multimin/test_funcs.c, multimin/test_funcs.h, multimin/vector_bfgs.c,
multimin/vector_bfgs2.c, multiroots/ChangeLog,
multiroots/Makefile.am, multiroots/Makefile.in, multiroots/broyden.c,
multiroots/convergence.c, multiroots/dnewton.c, multiroots/dogleg.c,
multiroots/enorm.c, multiroots/fdfsolver.c, multiroots/fdjac.c,
multiroots/fsolver.c, multiroots/gnewton.c,
multiroots/gsl_multiroots.h, multiroots/hybrid.c,
multiroots/hybridj.c, multiroots/newton.c, multiroots/test.c,
multiroots/test_funcs.c, multiroots/test_funcs.h, ntuple/ChangeLog,
ntuple/Makefile.am, ntuple/Makefile.in, ntuple/gsl_ntuple.h,
ntuple/ntuple.c, ntuple/test.c, ode-initval/ChangeLog,
ode-initval/Makefile.am, ode-initval/Makefile.in, ode-initval/TODO,
ode-initval/bsimp.c, ode-initval/control.c, ode-initval/cscal.c,
ode-initval/cstd.c, ode-initval/evolve.c, ode-initval/gear1.c,
ode-initval/gear2.c, ode-initval/gsl_odeiv.h,
ode-initval/odeiv_util.h, ode-initval/rk2.c, ode-initval/rk2imp.c,
ode-initval/rk2simp.c, ode-initval/rk4.c, ode-initval/rk4imp.c,
ode-initval/rk8pd.c, ode-initval/rkck.c, ode-initval/rkf45.c,
ode-initval/step.c, ode-initval/test.c, permutation/ChangeLog,
permutation/Makefile.am, permutation/Makefile.in,
permutation/canonical.c, permutation/file.c,
permutation/gsl_permutation.h, permutation/gsl_permute.h,
permutation/gsl_permute_char.h,
permutation/gsl_permute_complex_double.h,
permutation/gsl_permute_complex_float.h,
permutation/gsl_permute_complex_long_double.h,
permutation/gsl_permute_double.h, permutation/gsl_permute_float.h,
permutation/gsl_permute_int.h, permutation/gsl_permute_long.h,
permutation/gsl_permute_long_double.h,
permutation/gsl_permute_short.h, permutation/gsl_permute_uchar.h,
permutation/gsl_permute_uint.h, permutation/gsl_permute_ulong.h,
permutation/gsl_permute_ushort.h, permutation/gsl_permute_vector.h,
permutation/gsl_permute_vector_char.h,
permutation/gsl_permute_vector_complex_double.h,
permutation/gsl_permute_vector_complex_float.h,
permutation/gsl_permute_vector_complex_long_double.h,
permutation/gsl_permute_vector_double.h,
permutation/gsl_permute_vector_float.h,
permutation/gsl_permute_vector_int.h,
permutation/gsl_permute_vector_long.h,
permutation/gsl_permute_vector_long_double.h,
permutation/gsl_permute_vector_short.h,
permutation/gsl_permute_vector_uchar.h,
permutation/gsl_permute_vector_uint.h,
permutation/gsl_permute_vector_ulong.h,
permutation/gsl_permute_vector_ushort.h, permutation/init.c,
permutation/permutation.c, permutation/permute.c,
permutation/permute_source.c, permutation/test.c, poly/ChangeLog,
poly/Makefile.am, poly/Makefile.in, poly/TODO, poly/balance.c,
poly/companion.c, poly/dd.c, poly/eval.c, poly/gsl_poly.h, poly/qr.c,
poly/solve_cubic.c, poly/solve_quadratic.c, poly/test.c,
poly/zsolve.c, poly/zsolve_cubic.c, poly/zsolve_init.c,
poly/zsolve_quadratic.c, qrng/ChangeLog, qrng/Makefile.am,
qrng/Makefile.in, qrng/TODO, qrng/gsl_qrng.h, qrng/niederreiter-2.c,
qrng/qrng.c, qrng/sobol.c, qrng/test.c, randist/ChangeLog,
randist/Makefile.am, randist/Makefile.in, randist/TODO,
randist/bernoulli.c, randist/beta.c, randist/bigauss.c,
randist/binomial.c, randist/binomial_tpe.c, randist/cauchy.c,
randist/chisq.c, randist/dirichlet.c, randist/discrete.c,
randist/erlang.c, randist/exponential.c, randist/exppow.c,
randist/fdist.c, randist/flat.c, randist/gamma.c, randist/gauss.c,
randist/gausstail.c, randist/gausszig.c, randist/geometric.c,
randist/gsl_randist.h, randist/gumbel.c, randist/hyperg.c,
randist/landau.c, randist/laplace.c, randist/levy.c,
randist/logarithmic.c, randist/logistic.c, randist/lognormal.c,
randist/multinomial.c, randist/nbinomial.c, randist/pareto.c,
randist/pascal.c, randist/poisson.c, randist/rayleigh.c,
randist/shuffle.c, randist/sphere.c, randist/tdist.c, randist/test.c,
randist/weibull.c, rng/ChangeLog, rng/Makefile.am, rng/Makefile.in,
rng/TODO, rng/borosh13.c, rng/cmrg.c, rng/coveyou.c, rng/default.c,
rng/file.c, rng/fishman18.c, rng/fishman20.c, rng/fishman2x.c,
rng/gfsr4.c, rng/gsl_rng.h, rng/knuthran.c, rng/knuthran2.c,
rng/knuthran2002.c, rng/lecuyer21.c, rng/minstd.c, rng/mrg.c,
rng/mt.c, rng/r250.c, rng/ran0.c, rng/ran1.c, rng/ran2.c, rng/ran3.c,
rng/rand.c, rng/rand48.c, rng/random.c, rng/randu.c, rng/ranf.c,
rng/ranlux.c, rng/ranlxd.c, rng/ranlxs.c, rng/ranmar.c, rng/rng.c,
rng/schrage.c, rng/slatec.c, rng/taus.c, rng/taus113.c, rng/test.c,
rng/transputer.c, rng/tt.c, rng/types.c, rng/uni.c, rng/uni32.c,
rng/vax.c, rng/waterman14.c, rng/zuf.c, roots/ChangeLog,
roots/Makefile.am, roots/Makefile.in, roots/TODO, roots/bisection.c,
roots/brent.c, roots/convergence.c, roots/falsepos.c,
roots/fdfsolver.c, roots/fsolver.c, roots/gsl_roots.h,
roots/newton.c, roots/roots.h, roots/secant.c, roots/steffenson.c,
roots/test.c, roots/test.h, roots/test_funcs.c, siman/ChangeLog,
siman/Makefile.am, siman/Makefile.in, siman/TODO, siman/gsl_siman.h,
siman/siman.c, siman/siman_test_driver.sh, siman/siman_tsp.c,
siman/test.c, sort/ChangeLog, sort/Makefile.am, sort/Makefile.in,
sort/TODO, sort/gsl_heapsort.h, sort/gsl_sort.h,
sort/gsl_sort_char.h, sort/gsl_sort_double.h, sort/gsl_sort_float.h,
sort/gsl_sort_int.h, sort/gsl_sort_long.h,
sort/gsl_sort_long_double.h, sort/gsl_sort_short.h,
sort/gsl_sort_uchar.h, sort/gsl_sort_uint.h, sort/gsl_sort_ulong.h,
sort/gsl_sort_ushort.h, sort/gsl_sort_vector.h,
sort/gsl_sort_vector_char.h, sort/gsl_sort_vector_double.h,
sort/gsl_sort_vector_float.h, sort/gsl_sort_vector_int.h,
sort/gsl_sort_vector_long.h, sort/gsl_sort_vector_long_double.h,
sort/gsl_sort_vector_short.h, sort/gsl_sort_vector_uchar.h,
sort/gsl_sort_vector_uint.h, sort/gsl_sort_vector_ulong.h,
sort/gsl_sort_vector_ushort.h, sort/sort.c, sort/sortind.c,
sort/sortvec.c, sort/sortvec_source.c, sort/sortvecind.c,
sort/sortvecind_source.c, sort/subset.c, sort/subset_source.c,
sort/subsetind.c, sort/subsetind_source.c, sort/test.c,
sort/test_heapsort.c, sort/test_source.c, specfunc/ChangeLog,
specfunc/Makefile.am, specfunc/Makefile.in, specfunc/TODO,
specfunc/airy.c, specfunc/airy_der.c, specfunc/airy_zero.c,
specfunc/atanint.c, specfunc/bessel.c, specfunc/bessel.h,
specfunc/bessel_I0.c, specfunc/bessel_I1.c, specfunc/bessel_In.c,
specfunc/bessel_Inu.c, specfunc/bessel_J0.c, specfunc/bessel_J1.c,
specfunc/bessel_Jn.c, specfunc/bessel_Jnu.c, specfunc/bessel_K0.c,
specfunc/bessel_K1.c, specfunc/bessel_Kn.c, specfunc/bessel_Knu.c,
specfunc/bessel_Y0.c, specfunc/bessel_Y1.c, specfunc/bessel_Yn.c,
specfunc/bessel_Ynu.c, specfunc/bessel_amp_phase.c,
specfunc/bessel_amp_phase.h, specfunc/bessel_i.c,
specfunc/bessel_j.c, specfunc/bessel_k.c, specfunc/bessel_olver.c,
specfunc/bessel_olver.h, specfunc/bessel_sequence.c,
specfunc/bessel_temme.c, specfunc/bessel_temme.h,
specfunc/bessel_y.c, specfunc/bessel_zero.c, specfunc/beta.c,
specfunc/beta_inc.c, specfunc/cheb_eval.c, specfunc/cheb_eval_mode.c,
specfunc/chebyshev.h, specfunc/check.h, specfunc/clausen.c,
specfunc/coulomb.c, specfunc/coulomb_bound.c, specfunc/coupling.c,
specfunc/dawson.c, specfunc/debye.c, specfunc/dilog.c,
specfunc/elementary.c, specfunc/ellint.c, specfunc/elljac.c,
specfunc/erfc.c, specfunc/error.h, specfunc/eval.h, specfunc/exp.c,
specfunc/expint.c, specfunc/expint3.c, specfunc/fermi_dirac.c,
specfunc/gamma.c, specfunc/gamma_inc.c, specfunc/gegenbauer.c,
specfunc/gsl_sf.h, specfunc/gsl_sf_airy.h, specfunc/gsl_sf_bessel.h,
specfunc/gsl_sf_clausen.h, specfunc/gsl_sf_coulomb.h,
specfunc/gsl_sf_coupling.h, specfunc/gsl_sf_dawson.h,
specfunc/gsl_sf_debye.h, specfunc/gsl_sf_dilog.h,
specfunc/gsl_sf_elementary.h, specfunc/gsl_sf_ellint.h,
specfunc/gsl_sf_elljac.h, specfunc/gsl_sf_erf.h,
specfunc/gsl_sf_exp.h, specfunc/gsl_sf_expint.h,
specfunc/gsl_sf_fermi_dirac.h, specfunc/gsl_sf_gamma.h,
specfunc/gsl_sf_gegenbauer.h, specfunc/gsl_sf_hyperg.h,
specfunc/gsl_sf_laguerre.h, specfunc/gsl_sf_lambert.h,
specfunc/gsl_sf_legendre.h, specfunc/gsl_sf_log.h,
specfunc/gsl_sf_mathieu.h, specfunc/gsl_sf_pow_int.h,
specfunc/gsl_sf_psi.h, specfunc/gsl_sf_result.h,
specfunc/gsl_sf_synchrotron.h, specfunc/gsl_sf_transport.h,
specfunc/gsl_sf_trig.h, specfunc/gsl_sf_zeta.h,
specfunc/gsl_specfunc.h, specfunc/hyperg.c, specfunc/hyperg.h,
specfunc/hyperg_0F1.c, specfunc/hyperg_1F1.c, specfunc/hyperg_2F0.c,
specfunc/hyperg_2F1.c, specfunc/hyperg_U.c, specfunc/laguerre.c,
specfunc/lambert.c, specfunc/legendre.h, specfunc/legendre_H3d.c,
specfunc/legendre_Qn.c, specfunc/legendre_con.c,
specfunc/legendre_poly.c, specfunc/log.c, specfunc/mathieu_angfunc.c,
specfunc/mathieu_charv.c, specfunc/mathieu_coeff.c,
specfunc/mathieu_radfunc.c, specfunc/mathieu_workspace.c,
specfunc/poch.c, specfunc/pow_int.c, specfunc/psi.c,
specfunc/recurse.h, specfunc/result.c, specfunc/shint.c,
specfunc/sinint.c, specfunc/synchrotron.c, specfunc/test_airy.c,
specfunc/test_bessel.c, specfunc/test_coulomb.c,
specfunc/test_dilog.c, specfunc/test_gamma.c, specfunc/test_hyperg.c,
specfunc/test_legendre.c, specfunc/test_mathieu.c,
specfunc/test_sf.c, specfunc/test_sf.h, specfunc/transport.c,
specfunc/trig.c, specfunc/zeta.c, statistics/ChangeLog,
statistics/Makefile.am, statistics/Makefile.in, statistics/TODO,
statistics/absdev.c, statistics/absdev_source.c,
statistics/covariance.c, statistics/covariance_source.c,
statistics/gsl_statistics.h, statistics/gsl_statistics_char.h,
statistics/gsl_statistics_double.h,
statistics/gsl_statistics_float.h, statistics/gsl_statistics_int.h,
statistics/gsl_statistics_long.h,
statistics/gsl_statistics_long_double.h,
statistics/gsl_statistics_short.h, statistics/gsl_statistics_uchar.h,
statistics/gsl_statistics_uint.h, statistics/gsl_statistics_ulong.h,
statistics/gsl_statistics_ushort.h, statistics/kurtosis.c,
statistics/kurtosis_source.c, statistics/lag1.c,
statistics/lag1_source.c, statistics/mean.c,
statistics/mean_source.c, statistics/median.c,
statistics/median_source.c, statistics/minmax.c,
statistics/minmax_source.c, statistics/p_variance.c,
statistics/p_variance_source.c, statistics/quantiles.c,
statistics/quantiles_source.c, statistics/skew.c,
statistics/skew_source.c, statistics/test.c,
statistics/test_float_source.c, statistics/test_int_source.c,
statistics/test_nist.c, statistics/ttest.c,
statistics/ttest_source.c, statistics/variance.c,
statistics/variance_source.c, statistics/wabsdev.c,
statistics/wabsdev_source.c, statistics/wkurtosis.c,
statistics/wkurtosis_source.c, statistics/wmean.c,
statistics/wmean_source.c, statistics/wskew.c,
statistics/wskew_source.c, statistics/wvariance.c,
statistics/wvariance_source.c, sum/ChangeLog, sum/Makefile.am,
sum/Makefile.in, sum/gsl_sum.h, sum/levin_u.c, sum/levin_utrunc.c,
sum/test.c, sum/work_u.c, sum/work_utrunc.c, sys/ChangeLog,
sys/Makefile.am, sys/Makefile.in, sys/coerce.c, sys/expm1.c,
sys/fcmp.c, sys/fdiv.c, sys/gsl_sys.h, sys/hypot.c, sys/infnan.c,
sys/invhyp.c, sys/ldfrexp.c, sys/log1p.c, sys/minmax.c,
sys/pow_int.c, sys/prec.c, sys/test.c, test/ChangeLog,
test/Makefile.am, test/Makefile.in, test/gsl_test.h, test/results.c,
utils/Makefile.am, utils/Makefile.in, utils/README, utils/memcpy.c,
utils/memmove.c, utils/placeholder.c, utils/strdup.c, utils/strtol.c,
utils/strtoul.c, utils/system.h, vector/ChangeLog,
vector/Makefile.am, vector/Makefile.in, vector/TODO, vector/copy.c,
vector/copy_source.c, vector/file.c, vector/file_source.c,
vector/gsl_vector.h, vector/gsl_vector_char.h,
vector/gsl_vector_complex.h, vector/gsl_vector_complex_double.h,
vector/gsl_vector_complex_float.h,
vector/gsl_vector_complex_long_double.h, vector/gsl_vector_double.h,
vector/gsl_vector_float.h, vector/gsl_vector_int.h,
vector/gsl_vector_long.h, vector/gsl_vector_long_double.h,
vector/gsl_vector_short.h, vector/gsl_vector_uchar.h,
vector/gsl_vector_uint.h, vector/gsl_vector_ulong.h,
vector/gsl_vector_ushort.h, vector/init.c, vector/init_source.c,
vector/minmax.c, vector/minmax_source.c, vector/oper.c,
vector/oper_source.c, vector/prop.c, vector/prop_source.c,
vector/reim.c, vector/reim_source.c, vector/subvector.c,
vector/subvector_source.c, vector/swap.c, vector/swap_source.c,
vector/test.c, vector/test_complex_source.c, vector/test_source.c,
vector/test_static.c, vector/vector.c, vector/vector_source.c,
vector/view.c, vector/view.h, vector/view_source.c,
wavelet/ChangeLog, wavelet/Makefile.am, wavelet/Makefile.in,
wavelet/TODO, wavelet/bspline.c, wavelet/daubechies.c, wavelet/dwt.c,
wavelet/gsl_wavelet.h, wavelet/gsl_wavelet2d.h, wavelet/haar.c,
wavelet/test.c, wavelet/wavelet.c: New files.
Diffstat (limited to 'gsl-1.9/doc/examples')
86 files changed, 3143 insertions, 0 deletions
diff --git a/gsl-1.9/doc/examples/blas.c b/gsl-1.9/doc/examples/blas.c new file mode 100644 index 0000000..ab4b39b --- /dev/null +++ b/gsl-1.9/doc/examples/blas.c @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <gsl/gsl_blas.h> + +int +main (void) +{ + double a[] = { 0.11, 0.12, 0.13, + 0.21, 0.22, 0.23 }; + + double b[] = { 1011, 1012, + 1021, 1022, + 1031, 1032 }; + + double c[] = { 0.00, 0.00, + 0.00, 0.00 }; + + gsl_matrix_view A = gsl_matrix_view_array(a, 2, 3); + gsl_matrix_view B = gsl_matrix_view_array(b, 3, 2); + gsl_matrix_view C = gsl_matrix_view_array(c, 2, 2); + + /* Compute C = A B */ + + gsl_blas_dgemm (CblasNoTrans, CblasNoTrans, + 1.0, &A.matrix, &B.matrix, + 0.0, &C.matrix); + + printf ("[ %g, %g\n", c[0], c[1]); + printf (" %g, %g ]\n", c[2], c[3]); + + return 0; +} diff --git a/gsl-1.9/doc/examples/blas.out b/gsl-1.9/doc/examples/blas.out new file mode 100644 index 0000000..e8ec960 --- /dev/null +++ b/gsl-1.9/doc/examples/blas.out @@ -0,0 +1,2 @@ +[ 367.76, 368.12 + 674.06, 674.72 ]
\ No newline at end of file diff --git a/gsl-1.9/doc/examples/block.c b/gsl-1.9/doc/examples/block.c new file mode 100644 index 0000000..53f62a1 --- /dev/null +++ b/gsl-1.9/doc/examples/block.c @@ -0,0 +1,14 @@ +#include <stdio.h> +#include <gsl/gsl_block.h> + +int +main (void) +{ + gsl_block * b = gsl_block_alloc (100); + + printf ("length of block = %u\n", b->size); + printf ("block data address = %#x\n", b->data); + + gsl_block_free (b); + return 0; +} diff --git a/gsl-1.9/doc/examples/block.out b/gsl-1.9/doc/examples/block.out new file mode 100644 index 0000000..1f84cd0 --- /dev/null +++ b/gsl-1.9/doc/examples/block.out @@ -0,0 +1,2 @@ +length of block = 100 +block data address = 0x804b0d8 diff --git a/gsl-1.9/doc/examples/bspline.c b/gsl-1.9/doc/examples/bspline.c new file mode 100644 index 0000000..0d6a584 --- /dev/null +++ b/gsl-1.9/doc/examples/bspline.c @@ -0,0 +1,116 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <gsl/gsl_bspline.h> +#include <gsl/gsl_multifit.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> + +/* number of data points to fit */ +#define N 200 + +/* number of fit coefficients */ +#define NCOEFFS 8 + +/* nbreak = ncoeffs + 2 - k = ncoeffs - 2 since k = 4 */ +#define NBREAK (NCOEFFS - 2) + +int +main (void) +{ + const size_t n = N; + const size_t ncoeffs = NCOEFFS; + const size_t nbreak = NBREAK; + size_t i, j; + gsl_bspline_workspace *bw; + gsl_vector *B; + double dy; + gsl_rng *r; + gsl_vector *c, *w; + gsl_vector *x, *y; + gsl_matrix *X, *cov; + gsl_multifit_linear_workspace *mw; + double chisq; + + gsl_rng_env_setup(); + r = gsl_rng_alloc(gsl_rng_default); + + /* allocate a cubic bspline workspace (k = 4) */ + bw = gsl_bspline_alloc(4, nbreak); + B = gsl_vector_alloc(ncoeffs); + + x = gsl_vector_alloc(n); + y = gsl_vector_alloc(n); + X = gsl_matrix_alloc(n, ncoeffs); + c = gsl_vector_alloc(ncoeffs); + w = gsl_vector_alloc(n); + cov = gsl_matrix_alloc(ncoeffs, ncoeffs); + mw = gsl_multifit_linear_alloc(n, ncoeffs); + + printf("#m=0,S=0\n"); + /* this is the data to be fitted */ + for (i = 0; i < n; ++i) + { + double sigma; + double xi = (15.0/(N-1)) * i; + double yi = cos(xi) * exp(-0.1 * xi); + + sigma = 0.1; + dy = gsl_ran_gaussian(r, sigma); + yi += dy; + + gsl_vector_set(x, i, xi); + gsl_vector_set(y, i, yi); + gsl_vector_set(w, i, 1.0 / (sigma*sigma)); + + printf("%f %f\n", xi, yi); + } + + /* use uniform breakpoints on [0, 15] */ + gsl_bspline_knots_uniform(0.0, 15.0, bw); + + /* construct the fit matrix X */ + for (i = 0; i < n; ++i) + { + double xi = gsl_vector_get(x, i); + + /* compute B_j(xi) for all j */ + gsl_bspline_eval(xi, B, bw); + + /* fill in row i of X */ + for (j = 0; j < ncoeffs; ++j) + { + double Bj = gsl_vector_get(B, j); + gsl_matrix_set(X, i, j, Bj); + } + } + + /* do the fit */ + gsl_multifit_wlinear(X, w, y, c, cov, &chisq, mw); + + /* output the smoothed curve */ + { + double xi, yi, yerr; + + printf("#m=1,S=0\n"); + for (xi = 0.0; xi < 15.0; xi += 0.1) + { + gsl_bspline_eval(xi, B, bw); + gsl_multifit_linear_est(B, c, cov, &yi, &yerr); + printf("%f %f\n", xi, yi); + } + } + + gsl_rng_free(r); + gsl_bspline_free(bw); + gsl_vector_free(B); + gsl_vector_free(x); + gsl_vector_free(y); + gsl_matrix_free(X); + gsl_vector_free(c); + gsl_vector_free(w); + gsl_matrix_free(cov); + gsl_multifit_linear_free(mw); + + return 0; +} /* main() */ diff --git a/gsl-1.9/doc/examples/cblas.c b/gsl-1.9/doc/examples/cblas.c new file mode 100644 index 0000000..cb6b31a --- /dev/null +++ b/gsl-1.9/doc/examples/cblas.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <gsl/gsl_cblas.h> + +int +main (void) +{ + int lda = 3; + + float A[] = { 0.11, 0.12, 0.13, + 0.21, 0.22, 0.23 }; + + int ldb = 2; + + float B[] = { 1011, 1012, + 1021, 1022, + 1031, 1032 }; + + int ldc = 2; + + float C[] = { 0.00, 0.00, + 0.00, 0.00 }; + + /* Compute C = A B */ + + cblas_sgemm (CblasRowMajor, + CblasNoTrans, CblasNoTrans, 2, 2, 3, + 1.0, A, lda, B, ldb, 0.0, C, ldc); + + printf ("[ %g, %g\n", C[0], C[1]); + printf (" %g, %g ]\n", C[2], C[3]); + + return 0; +} diff --git a/gsl-1.9/doc/examples/cblas.out b/gsl-1.9/doc/examples/cblas.out new file mode 100644 index 0000000..a0f51d7 --- /dev/null +++ b/gsl-1.9/doc/examples/cblas.out @@ -0,0 +1,2 @@ +[ 367.76, 368.12 + 674.06, 674.72 ] diff --git a/gsl-1.9/doc/examples/cdf.c b/gsl-1.9/doc/examples/cdf.c new file mode 100644 index 0000000..968eb96 --- /dev/null +++ b/gsl-1.9/doc/examples/cdf.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <gsl/gsl_cdf.h> + +int +main (void) +{ + double P, Q; + double x = 2.0; + + P = gsl_cdf_ugaussian_P (x); + printf ("prob(x < %f) = %f\n", x, P); + + Q = gsl_cdf_ugaussian_Q (x); + printf ("prob(x > %f) = %f\n", x, Q); + + x = gsl_cdf_ugaussian_Pinv (P); + printf ("Pinv(%f) = %f\n", P, x); + + x = gsl_cdf_ugaussian_Qinv (Q); + printf ("Qinv(%f) = %f\n", Q, x); + + return 0; +} diff --git a/gsl-1.9/doc/examples/cdf.out b/gsl-1.9/doc/examples/cdf.out new file mode 100644 index 0000000..f04b75b --- /dev/null +++ b/gsl-1.9/doc/examples/cdf.out @@ -0,0 +1,4 @@ +prob(x < 2.000000) = 0.977250 +prob(x > 2.000000) = 0.022750 +Pinv(0.977250) = 2.000000 +Qinv(0.022750) = 2.000000 diff --git a/gsl-1.9/doc/examples/cheb.c b/gsl-1.9/doc/examples/cheb.c new file mode 100644 index 0000000..58a0c54 --- /dev/null +++ b/gsl-1.9/doc/examples/cheb.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_chebyshev.h> + +double +f (double x, void *p) +{ + if (x < 0.5) + return 0.25; + else + return 0.75; +} + +int +main (void) +{ + int i, n = 10000; + + gsl_cheb_series *cs = gsl_cheb_alloc (40); + + gsl_function F; + + F.function = f; + F.params = 0; + + gsl_cheb_init (cs, &F, 0.0, 1.0); + + for (i = 0; i < n; i++) + { + double x = i / (double)n; + double r10 = gsl_cheb_eval_n (cs, 10, x); + double r40 = gsl_cheb_eval (cs, x); + printf ("%g %g %g %g\n", + x, GSL_FN_EVAL (&F, x), r10, r40); + } + + gsl_cheb_free (cs); + + return 0; +} diff --git a/gsl-1.9/doc/examples/combination.c b/gsl-1.9/doc/examples/combination.c new file mode 100644 index 0000000..708174f --- /dev/null +++ b/gsl-1.9/doc/examples/combination.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <gsl/gsl_combination.h> + +int +main (void) +{ + gsl_combination * c; + size_t i; + + printf ("All subsets of {0,1,2,3} by size:\n") ; + for (i = 0; i <= 4; i++) + { + c = gsl_combination_calloc (4, i); + do + { + printf ("{"); + gsl_combination_fprintf (stdout, c, " %u"); + printf (" }\n"); + } + while (gsl_combination_next (c) == GSL_SUCCESS); + gsl_combination_free (c); + } + + return 0; +} diff --git a/gsl-1.9/doc/examples/combination.out b/gsl-1.9/doc/examples/combination.out new file mode 100644 index 0000000..a9050ab --- /dev/null +++ b/gsl-1.9/doc/examples/combination.out @@ -0,0 +1,17 @@ +All subsets of {0,1,2,3} by size: +{ } +{ 0 } +{ 1 } +{ 2 } +{ 3 } +{ 0 1 } +{ 0 2 } +{ 0 3 } +{ 1 2 } +{ 1 3 } +{ 2 3 } +{ 0 1 2 } +{ 0 1 3 } +{ 0 2 3 } +{ 1 2 3 } +{ 0 1 2 3 } diff --git a/gsl-1.9/doc/examples/const.c b/gsl-1.9/doc/examples/const.c new file mode 100644 index 0000000..47718c5 --- /dev/null +++ b/gsl-1.9/doc/examples/const.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <gsl/gsl_const_mksa.h> + +int +main (void) +{ + double c = GSL_CONST_MKSA_SPEED_OF_LIGHT; + double au = GSL_CONST_MKSA_ASTRONOMICAL_UNIT; + double minutes = GSL_CONST_MKSA_MINUTE; + + /* distance stored in meters */ + double r_earth = 1.00 * au; + double r_mars = 1.52 * au; + + double t_min, t_max; + + t_min = (r_mars - r_earth) / c; + t_max = (r_mars + r_earth) / c; + + printf ("light travel time from Earth to Mars:\n"); + printf ("minimum = %.1f minutes\n", t_min / minutes); + printf ("maximum = %.1f minutes\n", t_max / minutes); + + return 0; +} diff --git a/gsl-1.9/doc/examples/const.out b/gsl-1.9/doc/examples/const.out new file mode 100644 index 0000000..6552a3d --- /dev/null +++ b/gsl-1.9/doc/examples/const.out @@ -0,0 +1,3 @@ +light travel time from Earth to Mars: +minimum = 4.3 minutes +maximum = 21.0 minutes diff --git a/gsl-1.9/doc/examples/demo_fn.c b/gsl-1.9/doc/examples/demo_fn.c new file mode 100644 index 0000000..4d8a552 --- /dev/null +++ b/gsl-1.9/doc/examples/demo_fn.c @@ -0,0 +1,40 @@ +double +quadratic (double x, void *params) +{ + struct quadratic_params *p + = (struct quadratic_params *) params; + + double a = p->a; + double b = p->b; + double c = p->c; + + return (a * x + b) * x + c; +} + +double +quadratic_deriv (double x, void *params) +{ + struct quadratic_params *p + = (struct quadratic_params *) params; + + double a = p->a; + double b = p->b; + double c = p->c; + + return 2.0 * a * x + b; +} + +void +quadratic_fdf (double x, void *params, + double *y, double *dy) +{ + struct quadratic_params *p + = (struct quadratic_params *) params; + + double a = p->a; + double b = p->b; + double c = p->c; + + *y = (a * x + b) * x + c; + *dy = 2.0 * a * x + b; +} diff --git a/gsl-1.9/doc/examples/demo_fn.h b/gsl-1.9/doc/examples/demo_fn.h new file mode 100644 index 0000000..77aeea1 --- /dev/null +++ b/gsl-1.9/doc/examples/demo_fn.h @@ -0,0 +1,9 @@ +struct quadratic_params + { + double a, b, c; + }; + +double quadratic (double x, void *params); +double quadratic_deriv (double x, void *params); +void quadratic_fdf (double x, void *params, + double *y, double *dy); diff --git a/gsl-1.9/doc/examples/diff.c b/gsl-1.9/doc/examples/diff.c new file mode 100644 index 0000000..b32e193 --- /dev/null +++ b/gsl-1.9/doc/examples/diff.c @@ -0,0 +1,32 @@ +#include <stdio.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_deriv.h> + +double f (double x, void * params) +{ + return pow (x, 1.5); +} + +int +main (void) +{ + gsl_function F; + double result, abserr; + + F.function = &f; + F.params = 0; + + printf ("f(x) = x^(3/2)\n"); + + gsl_deriv_central (&F, 2.0, 1e-8, &result, &abserr); + printf ("x = 2.0\n"); + printf ("f'(x) = %.10f +/- %.10f\n", result, abserr); + printf ("exact = %.10f\n\n", 1.5 * sqrt(2.0)); + + gsl_deriv_forward (&F, 0.0, 1e-8, &result, &abserr); + printf ("x = 0.0\n"); + printf ("f'(x) = %.10f +/- %.10f\n", result, abserr); + printf ("exact = %.10f\n", 0.0); + + return 0; +} diff --git a/gsl-1.9/doc/examples/diff.out b/gsl-1.9/doc/examples/diff.out new file mode 100644 index 0000000..dab42d5 --- /dev/null +++ b/gsl-1.9/doc/examples/diff.out @@ -0,0 +1,8 @@ +f(x) = x^(3/2) +x = 2.0 +f'(x) = 2.1213203120 +/- 0.0000004064 +exact = 2.1213203436 + +x = 0.0 +f'(x) = 0.0000000160 +/- 0.0000000339 +exact = 0.0000000000 diff --git a/gsl-1.9/doc/examples/dwt.c b/gsl-1.9/doc/examples/dwt.c new file mode 100644 index 0000000..062b2c6 --- /dev/null +++ b/gsl-1.9/doc/examples/dwt.c @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_sort.h> +#include <gsl/gsl_wavelet.h> + +int +main (int argc, char **argv) +{ + int i, n = 256, nc = 20; + double *data = malloc (n * sizeof (double)); + double *abscoeff = malloc (n * sizeof (double)); + size_t *p = malloc (n * sizeof (size_t)); + + FILE * f; + gsl_wavelet *w; + gsl_wavelet_workspace *work; + + w = gsl_wavelet_alloc (gsl_wavelet_daubechies, 4); + work = gsl_wavelet_workspace_alloc (n); + + f = fopen (argv[1], "r"); + for (i = 0; i < n; i++) + { + fscanf (f, "%lg", &data[i]); + } + fclose (f); + + gsl_wavelet_transform_forward (w, data, 1, n, work); + + for (i = 0; i < n; i++) + { + abscoeff[i] = fabs (data[i]); + } + + gsl_sort_index (p, abscoeff, 1, n); + + for (i = 0; (i + nc) < n; i++) + data[p[i]] = 0; + + gsl_wavelet_transform_inverse (w, data, 1, n, work); + + for (i = 0; i < n; i++) + { + printf ("%g\n", data[i]); + } + + gsl_wavelet_free (w); + gsl_wavelet_workspace_free (work); + + free (data); + free (abscoeff); + free (p); + return 0; +} diff --git a/gsl-1.9/doc/examples/dwt.dat b/gsl-1.9/doc/examples/dwt.dat new file mode 100644 index 0000000..e7ff47b --- /dev/null +++ b/gsl-1.9/doc/examples/dwt.dat @@ -0,0 +1,256 @@ +0.0167729 +0.031888 +0.0412921 +0.0522264 +0.0574496 +0.0642031 +0.0724869 +0.0803607 +0.0825233 +0.0862162 +0.0914394 +0.0962525 +0.102596 +0.108529 +0.114053 +0.119686 +0.104007 +0.094039 +0.0897813 +0.0839935 +0.0839162 +0.0823088 +0.0791713 +0.0764437 +0.0509741 +0.0315983 +0.0183161 +0.00340114 +-0.00542012 +-0.0158742 +-0.0279611 +-0.0396104 +-0.0160286 +-0.00188697 +0.00281451 +0.0100455 +0.00783627 +0.00815656 +0.0110063 +0.0131783 +0.00591016 +0.00117148 +-0.00103772 +-0.00392469 +-0.00428218 +-0.00531744 +-0.00703047 +-0.0085619 +-0.014332 +-0.0189663 +-0.0224649 +-0.0262678 +-0.0289349 +-0.0319064 +-0.0351822 +-0.0383765 +-0.0801973 +-0.111668 +-0.132789 +-0.156683 +-0.162696 +-0.1735 +-0.189095 +-0.203407 +-0.00510083 +0.136235 +0.341101 +0.528945 +0.801527 +1.0514 +1.15485 +1.29754 +1.16912 +1.11335 +0.760921 +0.487984 +0.24772 +-0.00129903 +-0.0610099 +-0.171446 +-0.102442 +-0.081519 +-0.108677 +-0.122951 +-0.0931296 +-0.0751235 +-0.0689329 +-0.0595764 +-0.0723311 +-0.0791611 +-0.0800665 +-0.0825593 +-0.0791275 +-0.0772832 +-0.0770263 +-0.0763442 +-0.078946 +-0.080668 +-0.0815099 +-0.0825877 +-0.0827855 +-0.083219 +-0.0838884 +-0.0844945 +-0.0842208 +-0.0841828 +-0.0843805 +-0.0845151 +-0.0848855 +-0.0851927 +-0.0854368 +-0.0856977 +-0.0858204 +-0.0859801 +-0.0861769 +-0.0863638 +-0.0865877 +-0.0868017 +-0.0870057 +-0.0872124 +-0.0874562 +-0.08769 +-0.0879139 +-0.0881405 +-0.0883571 +-0.0885764 +-0.0887984 +-0.0890196 +-0.0890797 +-0.0891829 +-0.0893293 +-0.0894642 +-0.0896423 +-0.0898087 +-0.0899636 +-0.0901216 +-0.0903228 +-0.0905125 +-0.0906905 +-0.0908717 +-0.0910413 +-0.0912139 +-0.0913897 +-0.0915647 +-0.0917828 +-0.0919894 +-0.0921844 +-0.0923825 +-0.092569 +-0.0927586 +-0.0929514 +-0.0931433 +-0.0933236 +-0.093507 +-0.0936935 +-0.0938792 +-0.094068 +-0.094256 +-0.0944431 +-0.0946305 +-0.103627 +-0.110264 +-0.11454 +-0.119448 +-0.121996 +-0.125177 +-0.12899 +-0.132633 +-0.133916 +-0.135831 +-0.138379 +-0.140758 +-0.143768 +-0.14661 +-0.149282 +-0.151999 +-0.121242 +-0.0994544 +-0.0866362 +-0.0714146 +-0.0651625 +-0.056507 +-0.0454482 +-0.0350333 +-0.033588 +-0.0297392 +-0.0234871 +-0.017879 +-0.00986753 +-0.00250002 +0.00422351 +0.0111196 +-0.00226639 +-0.0102178 +-0.0127347 +-0.0167077 +-0.0152462 +-0.0152409 +-0.0166917 +-0.0177524 +-0.0133785 +-0.0104608 +-0.00899926 +-0.00714755 +-0.00675204 +-0.00596633 +-0.00479045 +-0.00371911 +0.00278678 +0.00783649 +0.01143 +0.0154137 +0.0179412 +0.0208589 +0.0241668 +0.0273702 +0.0291173 +0.0312547 +0.0337822 +0.0362052 +0.0390183 +0.0417269 +0.044331 +0.0469631 +0.0347545 +0.0265225 +0.0222671 +0.0169461 +0.0156016 +0.0131917 +0.00971622 +0.00652626 +0.00731282 +0.00703387 +0.00568942 +0.00463047 +0.00250601 +0.000667052 +-0.000886403 +-0.00251636 +-0.000169788 +0.00111128 +0.00132683 +0.00182789 +0.00126344 +0.000984496 +0.000991051 +0.000921107 +-0.000214344 +-0.00106429 +-0.00162874 +-0.00226969 +-0.00262514 +-0.00305708 +-0.00356553 +-0.00405348 diff --git a/gsl-1.9/doc/examples/ecg.dat b/gsl-1.9/doc/examples/ecg.dat new file mode 100644 index 0000000..5ea824a --- /dev/null +++ b/gsl-1.9/doc/examples/ecg.dat @@ -0,0 +1,256 @@ + 0.0462458471760794 + 0.0462458471760794 + 0.0512458471760794 + 0.0712458471760795 + 0.0712458471760795 + 0.0662458471760795 + 0.0962458471760795 + 0.101245847176079 + 0.116245847176079 + 0.121245847176079 + 0.116245847176079 + 0.106245847176079 + 0.0912458471760794 + 0.101245847176079 + 0.0962458471760795 + 0.0962458471760795 + 0.0962458471760795 + 0.0912458471760794 + 0.0862458471760795 + 0.0812458471760795 + 0.0862458471760795 + 0.101245847176079 + 0.111245847176079 + 0.116245847176079 + 0.0762458471760795 + 0.0362458471760795 + 0.0362458471760795 + 0.0212458471760795 + 0.0112458471760795 + -0.00875415282392056 + -0.00875415282392056 + -0.00375415282392055 + 0.00624584717607946 + 0.00124584717607945 + 0.00624584717607946 + -0.00375415282392055 + -0.0187541528239206 + -0.0237541528239205 + -0.0187541528239206 + -0.0187541528239206 + -0.0287541528239205 + -0.0237541528239205 + -0.0337541528239205 + -0.00875415282392056 + -0.0137541528239206 + -0.00875415282392056 + 0.00124584717607945 + -0.0237541528239205 + -0.0337541528239205 + -0.0187541528239206 + -0.00875415282392056 + -0.00375415282392055 + -0.00875415282392056 + -0.0287541528239205 + -0.0437541528239205 + -0.0387541528239205 + -0.0587541528239205 + -0.103754152823921 + -0.123754152823921 + -0.153754152823921 + -0.188754152823921 + -0.213754152823921 + -0.183754152823921 + -0.0937541528239205 + 0.0212458471760795 + 0.161245847176079 + 0.306245847176079 + 0.556245847176079 + 0.81124584717608 + 1.04124584717608 + 1.19624584717608 + 1.26124584717608 + 1.22624584717608 + 1.07624584717608 + 0.81124584717608 + 0.486245847176079 + 0.211245847176079 + 0.0512458471760794 + -0.0687541528239206 + -0.128754152823921 + -0.153754152823921 + -0.133754152823921 + -0.103754152823921 + -0.0687541528239206 + -0.0687541528239206 + -0.0637541528239206 + -0.0687541528239206 + -0.0587541528239205 + -0.0587541528239205 + -0.0587541528239205 + -0.0737541528239206 + -0.0637541528239206 + -0.0637541528239206 + -0.0637541528239206 + -0.0537541528239205 + -0.0737541528239206 + -0.0887541528239205 + -0.0887541528239205 + -0.0787541528239206 + -0.0737541528239206 + -0.0687541528239206 + -0.0837541528239206 + -0.0737541528239206 + -0.0637541528239206 + -0.0537541528239205 + -0.0687541528239206 + -0.0687541528239206 + -0.0837541528239206 + -0.0887541528239205 + -0.0887541528239205 + -0.0687541528239206 + -0.0687541528239206 + -0.0737541528239206 + -0.0837541528239206 + -0.0937541528239205 + -0.0787541528239206 + -0.0887541528239205 + -0.0837541528239206 + -0.0887541528239205 + -0.0937541528239205 + -0.0887541528239205 + -0.0787541528239206 + -0.0787541528239206 + -0.0737541528239206 + -0.0687541528239206 + -0.0837541528239206 + -0.0887541528239205 + -0.0687541528239206 + -0.0687541528239206 + -0.0637541528239206 + -0.0637541528239206 + -0.0887541528239205 + -0.0837541528239206 + -0.0737541528239206 + -0.0687541528239206 + -0.0537541528239205 + -0.0687541528239206 + -0.0737541528239206 + -0.0887541528239205 + -0.0787541528239206 + -0.0687541528239206 + -0.0687541528239206 + -0.0637541528239206 + -0.0837541528239206 + -0.0937541528239205 + -0.0937541528239205 + -0.0787541528239206 + -0.0737541528239206 + -0.0837541528239206 + -0.0937541528239205 + -0.0987541528239205 + -0.0987541528239205 + -0.0887541528239205 + -0.0937541528239205 + -0.103754152823921 + -0.0987541528239205 + -0.113754152823921 + -0.108754152823921 + -0.108754152823921 + -0.0987541528239205 + -0.108754152823921 + -0.128754152823921 + -0.133754152823921 + -0.128754152823921 + -0.113754152823921 + -0.123754152823921 + -0.128754152823921 + -0.133754152823921 + -0.148754152823921 + -0.138754152823921 + -0.133754152823921 + -0.128754152823921 + -0.133754152823921 + -0.148754152823921 + -0.153754152823921 + -0.138754152823921 + -0.128754152823921 + -0.123754152823921 + -0.118754152823921 + -0.113754152823921 + -0.118754152823921 + -0.0887541528239205 + -0.0737541528239206 + -0.0487541528239205 + -0.0437541528239205 + -0.0387541528239205 + -0.0437541528239205 + -0.0187541528239206 + -0.00375415282392055 + 0.00624584717607946 + 0.00124584717607945 + -0.00875415282392056 + -0.00875415282392056 + 0.00124584717607945 + 0.0112458471760795 + 0.0212458471760795 + 0.0212458471760795 + 0.00124584717607945 + 0.00124584717607945 + 0.00624584717607946 + 0.0162458471760795 + 0.0162458471760795 + 0.0262458471760795 + 0.00124584717607945 + -0.00875415282392056 + 0.0162458471760795 + 0.0112458471760795 + 0.0212458471760795 + 0.0212458471760795 + 0.00124584717607945 + -0.00375415282392055 + 0.0112458471760795 + 0.0162458471760795 + 0.00624584717607946 + 0.0162458471760795 + 0.00624584717607946 + 0.00624584717607946 + 0.0112458471760795 + 0.0262458471760795 + 0.0312458471760795 + 0.0162458471760795 + 0.0112458471760795 + 0.00124584717607945 + 0.00624584717607946 + 0.0212458471760795 + 0.00624584717607946 + 0.00624584717607946 + 0.00624584717607946 + -0.00875415282392056 + 0.00624584717607946 + 0.00124584717607945 + 0.00624584717607946 + -0.00375415282392055 + -0.0137541528239206 + -0.0187541528239206 + -0.0137541528239206 + -0.0137541528239206 + -0.00875415282392056 + -0.00375415282392055 + -0.0237541528239205 + -0.0287541528239205 + -0.0237541528239205 + -0.0137541528239206 + -0.00875415282392056 + -0.00875415282392056 + -0.0237541528239205 + -0.0237541528239205 + -0.0237541528239205 + 0.00124584717607945 + -0.00875415282392056 + -0.0137541528239206 + -0.0187541528239206 + -0.0337541528239205 + -0.0137541528239206 + -0.00875415282392056 + -0.00875415282392056 diff --git a/gsl-1.9/doc/examples/eigen.c b/gsl-1.9/doc/examples/eigen.c new file mode 100644 index 0000000..a24c912 --- /dev/null +++ b/gsl-1.9/doc/examples/eigen.c @@ -0,0 +1,50 @@ +#include <stdio.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_eigen.h> + +int +main (void) +{ + double data[] = { 1.0 , 1/2.0, 1/3.0, 1/4.0, + 1/2.0, 1/3.0, 1/4.0, 1/5.0, + 1/3.0, 1/4.0, 1/5.0, 1/6.0, + 1/4.0, 1/5.0, 1/6.0, 1/7.0 }; + + gsl_matrix_view m + = gsl_matrix_view_array (data, 4, 4); + + gsl_vector *eval = gsl_vector_alloc (4); + gsl_matrix *evec = gsl_matrix_alloc (4, 4); + + gsl_eigen_symmv_workspace * w = + gsl_eigen_symmv_alloc (4); + + gsl_eigen_symmv (&m.matrix, eval, evec, w); + + gsl_eigen_symmv_free (w); + + gsl_eigen_symmv_sort (eval, evec, + GSL_EIGEN_SORT_ABS_ASC); + + { + int i; + + for (i = 0; i < 4; i++) + { + double eval_i + = gsl_vector_get (eval, i); + gsl_vector_view evec_i + = gsl_matrix_column (evec, i); + + printf ("eigenvalue = %g\n", eval_i); + printf ("eigenvector = \n"); + gsl_vector_fprintf (stdout, + &evec_i.vector, "%g"); + } + } + + gsl_vector_free (eval); + gsl_matrix_free (evec); + + return 0; +} diff --git a/gsl-1.9/doc/examples/eigen_nonsymm.c b/gsl-1.9/doc/examples/eigen_nonsymm.c new file mode 100644 index 0000000..ccbef2d --- /dev/null +++ b/gsl-1.9/doc/examples/eigen_nonsymm.c @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_eigen.h> + +int +main (void) +{ + double data[] = { -1.0, 1.0, -1.0, 1.0, + -8.0, 4.0, -2.0, 1.0, + 27.0, 9.0, 3.0, 1.0, + 64.0, 16.0, 4.0, 1.0 }; + + gsl_matrix_view m + = gsl_matrix_view_array (data, 4, 4); + + gsl_vector_complex *eval = gsl_vector_complex_alloc (4); + gsl_matrix_complex *evec = gsl_matrix_complex_alloc (4, 4); + + gsl_eigen_nonsymmv_workspace * w = + gsl_eigen_nonsymmv_alloc (4); + + gsl_eigen_nonsymmv (&m.matrix, eval, evec, w); + + gsl_eigen_nonsymmv_free (w); + + gsl_eigen_nonsymmv_sort (eval, evec, + GSL_EIGEN_SORT_ABS_DESC); + + { + int i, j; + + for (i = 0; i < 4; i++) + { + gsl_complex eval_i + = gsl_vector_complex_get (eval, i); + gsl_vector_complex_view evec_i + = gsl_matrix_complex_column (evec, i); + + printf ("eigenvalue = %g + %gi\n", + GSL_REAL(eval_i), GSL_IMAG(eval_i)); + printf ("eigenvector = \n"); + for (j = 0; j < 4; ++j) + { + gsl_complex z = gsl_vector_complex_get(&evec_i.vector, j); + printf("%g + %gi\n", GSL_REAL(z), GSL_IMAG(z)); + } + } + } + + gsl_vector_complex_free(eval); + gsl_matrix_complex_free(evec); + + return 0; +} diff --git a/gsl-1.9/doc/examples/expfit.c b/gsl-1.9/doc/examples/expfit.c new file mode 100644 index 0000000..f94cf2b --- /dev/null +++ b/gsl-1.9/doc/examples/expfit.c @@ -0,0 +1,70 @@ +/* expfit.c -- model functions for exponential + background */ + +struct data { + size_t n; + double * y; + double * sigma; +}; + +int +expb_f (const gsl_vector * x, void *data, + gsl_vector * f) +{ + size_t n = ((struct data *)data)->n; + double *y = ((struct data *)data)->y; + double *sigma = ((struct data *) data)->sigma; + + double A = gsl_vector_get (x, 0); + double lambda = gsl_vector_get (x, 1); + double b = gsl_vector_get (x, 2); + + size_t i; + + for (i = 0; i < n; i++) + { + /* Model Yi = A * exp(-lambda * i) + b */ + double t = i; + double Yi = A * exp (-lambda * t) + b; + gsl_vector_set (f, i, (Yi - y[i])/sigma[i]); + } + + return GSL_SUCCESS; +} + +int +expb_df (const gsl_vector * x, void *data, + gsl_matrix * J) +{ + size_t n = ((struct data *)data)->n; + double *sigma = ((struct data *) data)->sigma; + + double A = gsl_vector_get (x, 0); + double lambda = gsl_vector_get (x, 1); + + size_t i; + + for (i = 0; i < n; i++) + { + /* Jacobian matrix J(i,j) = dfi / dxj, */ + /* where fi = (Yi - yi)/sigma[i], */ + /* Yi = A * exp(-lambda * i) + b */ + /* and the xj are the parameters (A,lambda,b) */ + double t = i; + double s = sigma[i]; + double e = exp(-lambda * t); + gsl_matrix_set (J, i, 0, e/s); + gsl_matrix_set (J, i, 1, -t * A * e/s); + gsl_matrix_set (J, i, 2, 1/s); + } + return GSL_SUCCESS; +} + +int +expb_fdf (const gsl_vector * x, void *data, + gsl_vector * f, gsl_matrix * J) +{ + expb_f (x, data, f); + expb_df (x, data, J); + + return GSL_SUCCESS; +} diff --git a/gsl-1.9/doc/examples/fft.c b/gsl-1.9/doc/examples/fft.c new file mode 100644 index 0000000..aa00242 --- /dev/null +++ b/gsl-1.9/doc/examples/fft.c @@ -0,0 +1,43 @@ +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_fft_complex.h> + +#define REAL(z,i) ((z)[2*(i)]) +#define IMAG(z,i) ((z)[2*(i)+1]) + +int +main (void) +{ + int i; double data[2*128]; + + for (i = 0; i < 128; i++) + { + REAL(data,i) = 0.0; IMAG(data,i) = 0.0; + } + + REAL(data,0) = 1.0; + + for (i = 1; i <= 10; i++) + { + REAL(data,i) = REAL(data,128-i) = 1.0; + } + + for (i = 0; i < 128; i++) + { + printf ("%d %e %e\n", i, + REAL(data,i), IMAG(data,i)); + } + printf ("\n"); + + gsl_fft_complex_radix2_forward (data, 1, 128); + + for (i = 0; i < 128; i++) + { + printf ("%d %e %e\n", i, + REAL(data,i)/sqrt(128), + IMAG(data,i)/sqrt(128)); + } + + return 0; +} diff --git a/gsl-1.9/doc/examples/fftmr.c b/gsl-1.9/doc/examples/fftmr.c new file mode 100644 index 0000000..0a43e0a --- /dev/null +++ b/gsl-1.9/doc/examples/fftmr.c @@ -0,0 +1,60 @@ +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_fft_complex.h> + +#define REAL(z,i) ((z)[2*(i)]) +#define IMAG(z,i) ((z)[2*(i)+1]) + +int +main (void) +{ + int i; + const int n = 630; + double data[2*n]; + + gsl_fft_complex_wavetable * wavetable; + gsl_fft_complex_workspace * workspace; + + for (i = 0; i < n; i++) + { + REAL(data,i) = 0.0; + IMAG(data,i) = 0.0; + } + + data[0] = 1.0; + + for (i = 1; i <= 10; i++) + { + REAL(data,i) = REAL(data,n-i) = 1.0; + } + + for (i = 0; i < n; i++) + { + printf ("%d: %e %e\n", i, REAL(data,i), + IMAG(data,i)); + } + printf ("\n"); + + wavetable = gsl_fft_complex_wavetable_alloc (n); + workspace = gsl_fft_complex_workspace_alloc (n); + + for (i = 0; i < wavetable->nf; i++) + { + printf ("# factor %d: %d\n", i, + wavetable->factor[i]); + } + + gsl_fft_complex_forward (data, 1, n, + wavetable, workspace); + + for (i = 0; i < n; i++) + { + printf ("%d: %e %e\n", i, REAL(data,i), + IMAG(data,i)); + } + + gsl_fft_complex_wavetable_free (wavetable); + gsl_fft_complex_workspace_free (workspace); + return 0; +} diff --git a/gsl-1.9/doc/examples/fftreal.c b/gsl-1.9/doc/examples/fftreal.c new file mode 100644 index 0000000..ec34458 --- /dev/null +++ b/gsl-1.9/doc/examples/fftreal.c @@ -0,0 +1,59 @@ +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_fft_real.h> +#include <gsl/gsl_fft_halfcomplex.h> + +int +main (void) +{ + int i, n = 100; + double data[n]; + + gsl_fft_real_wavetable * real; + gsl_fft_halfcomplex_wavetable * hc; + gsl_fft_real_workspace * work; + + for (i = 0; i < n; i++) + { + data[i] = 0.0; + } + + for (i = n / 3; i < 2 * n / 3; i++) + { + data[i] = 1.0; + } + + for (i = 0; i < n; i++) + { + printf ("%d: %e\n", i, data[i]); + } + printf ("\n"); + + work = gsl_fft_real_workspace_alloc (n); + real = gsl_fft_real_wavetable_alloc (n); + + gsl_fft_real_transform (data, 1, n, + real, work); + + gsl_fft_real_wavetable_free (real); + + for (i = 11; i < n; i++) + { + data[i] = 0; + } + + hc = gsl_fft_halfcomplex_wavetable_alloc (n); + + gsl_fft_halfcomplex_inverse (data, 1, n, + hc, work); + gsl_fft_halfcomplex_wavetable_free (hc); + + for (i = 0; i < n; i++) + { + printf ("%d: %e\n", i, data[i]); + } + + gsl_fft_real_workspace_free (work); + return 0; +} diff --git a/gsl-1.9/doc/examples/fitting.c b/gsl-1.9/doc/examples/fitting.c new file mode 100644 index 0000000..5c36969 --- /dev/null +++ b/gsl-1.9/doc/examples/fitting.c @@ -0,0 +1,45 @@ +#include <stdio.h> +#include <gsl/gsl_fit.h> + +int +main (void) +{ + int i, n = 4; + double x[4] = { 1970, 1980, 1990, 2000 }; + double y[4] = { 12, 11, 14, 13 }; + double w[4] = { 0.1, 0.2, 0.3, 0.4 }; + + double c0, c1, cov00, cov01, cov11, chisq; + + gsl_fit_wlinear (x, 1, w, 1, y, 1, n, + &c0, &c1, &cov00, &cov01, &cov11, + &chisq); + + printf ("# best fit: Y = %g + %g X\n", c0, c1); + printf ("# covariance matrix:\n"); + printf ("# [ %g, %g\n# %g, %g]\n", + cov00, cov01, cov01, cov11); + printf ("# chisq = %g\n", chisq); + + for (i = 0; i < n; i++) + printf ("data: %g %g %g\n", + x[i], y[i], 1/sqrt(w[i])); + + printf ("\n"); + + for (i = -30; i < 130; i++) + { + double xf = x[0] + (i/100.0) * (x[n-1] - x[0]); + double yf, yf_err; + + gsl_fit_linear_est (xf, + c0, c1, + cov00, cov01, cov11, + &yf, &yf_err); + + printf ("fit: %g %g\n", xf, yf); + printf ("hi : %g %g\n", xf, yf + yf_err); + printf ("lo : %g %g\n", xf, yf - yf_err); + } + return 0; +} diff --git a/gsl-1.9/doc/examples/fitting2.c b/gsl-1.9/doc/examples/fitting2.c new file mode 100644 index 0000000..43f8c06 --- /dev/null +++ b/gsl-1.9/doc/examples/fitting2.c @@ -0,0 +1,80 @@ +#include <stdio.h> +#include <gsl/gsl_multifit.h> + +int +main (int argc, char **argv) +{ + int i, n; + double xi, yi, ei, chisq; + gsl_matrix *X, *cov; + gsl_vector *y, *w, *c; + + if (argc != 2) + { + fprintf (stderr,"usage: fit n < data\n"); + exit (-1); + } + + n = atoi (argv[1]); + + X = gsl_matrix_alloc (n, 3); + y = gsl_vector_alloc (n); + w = gsl_vector_alloc (n); + + c = gsl_vector_alloc (3); + cov = gsl_matrix_alloc (3, 3); + + for (i = 0; i < n; i++) + { + int count = fscanf (stdin, "%lg %lg %lg", + &xi, &yi, &ei); + + if (count != 3) + { + fprintf (stderr, "error reading file\n"); + exit (-1); + } + + printf ("%g %g +/- %g\n", xi, yi, ei); + + gsl_matrix_set (X, i, 0, 1.0); + gsl_matrix_set (X, i, 1, xi); + gsl_matrix_set (X, i, 2, xi*xi); + + gsl_vector_set (y, i, yi); + gsl_vector_set (w, i, 1.0/(ei*ei)); + } + + { + gsl_multifit_linear_workspace * work + = gsl_multifit_linear_alloc (n, 3); + gsl_multifit_wlinear (X, w, y, c, cov, + &chisq, work); + gsl_multifit_linear_free (work); + } + +#define C(i) (gsl_vector_get(c,(i))) +#define COV(i,j) (gsl_matrix_get(cov,(i),(j))) + + { + printf ("# best fit: Y = %g + %g X + %g X^2\n", + C(0), C(1), C(2)); + + printf ("# covariance matrix:\n"); + printf ("[ %+.5e, %+.5e, %+.5e \n", + COV(0,0), COV(0,1), COV(0,2)); + printf (" %+.5e, %+.5e, %+.5e \n", + COV(1,0), COV(1,1), COV(1,2)); + printf (" %+.5e, %+.5e, %+.5e ]\n", + COV(2,0), COV(2,1), COV(2,2)); + printf ("# chisq = %g\n", chisq); + } + + gsl_matrix_free (X); + gsl_vector_free (y); + gsl_vector_free (w); + gsl_vector_free (c); + gsl_matrix_free (cov); + + return 0; +} diff --git a/gsl-1.9/doc/examples/fitting3.c b/gsl-1.9/doc/examples/fitting3.c new file mode 100644 index 0000000..a3f1e32 --- /dev/null +++ b/gsl-1.9/doc/examples/fitting3.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_randist.h> + +int +main (void) +{ + double x; + const gsl_rng_type * T; + gsl_rng * r; + + gsl_rng_env_setup (); + + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + for (x = 0.1; x < 2; x+= 0.1) + { + double y0 = exp (x); + double sigma = 0.1 * y0; + double dy = gsl_ran_gaussian (r, sigma); + + printf ("%g %g %g\n", x, y0 + dy, sigma); + } + + gsl_rng_free(r); + + return 0; +} diff --git a/gsl-1.9/doc/examples/histogram.c b/gsl-1.9/doc/examples/histogram.c new file mode 100644 index 0000000..a3c5150 --- /dev/null +++ b/gsl-1.9/doc/examples/histogram.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <stdlib.h> +#include <gsl/gsl_histogram.h> + +int +main (int argc, char **argv) +{ + double a, b; + size_t n; + + if (argc != 4) + { + printf ("Usage: gsl-histogram xmin xmax n\n" + "Computes a histogram of the data " + "on stdin using n bins from xmin " + "to xmax\n"); + exit (0); + } + + a = atof (argv[1]); + b = atof (argv[2]); + n = atoi (argv[3]); + + { + double x; + gsl_histogram * h = gsl_histogram_alloc (n); + gsl_histogram_set_ranges_uniform (h, a, b); + + while (fscanf (stdin, "%lg", &x) == 1) + { + gsl_histogram_increment (h, x); + } + gsl_histogram_fprintf (stdout, h, "%g", "%g"); + gsl_histogram_free (h); + } + exit (0); +} diff --git a/gsl-1.9/doc/examples/histogram2d.c b/gsl-1.9/doc/examples/histogram2d.c new file mode 100644 index 0000000..3fcabb4 --- /dev/null +++ b/gsl-1.9/doc/examples/histogram2d.c @@ -0,0 +1,50 @@ +#include <stdio.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_histogram2d.h> + +int +main (void) +{ + const gsl_rng_type * T; + gsl_rng * r; + + gsl_histogram2d * h = gsl_histogram2d_alloc (10, 10); + + gsl_histogram2d_set_ranges_uniform (h, + 0.0, 1.0, + 0.0, 1.0); + + gsl_histogram2d_accumulate (h, 0.3, 0.3, 1); + gsl_histogram2d_accumulate (h, 0.8, 0.1, 5); + gsl_histogram2d_accumulate (h, 0.7, 0.9, 0.5); + + gsl_rng_env_setup (); + + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + { + int i; + gsl_histogram2d_pdf * p + = gsl_histogram2d_pdf_alloc (h->nx, h->ny); + + gsl_histogram2d_pdf_init (p, h); + + for (i = 0; i < 1000; i++) { + double x, y; + double u = gsl_rng_uniform (r); + double v = gsl_rng_uniform (r); + + gsl_histogram2d_pdf_sample (p, u, v, &x, &y); + + printf ("%g %g\n", x, y); + } + + gsl_histogram2d_pdf_free (p); + } + + gsl_histogram2d_free (h); + gsl_rng_free (r); + + return 0; +} diff --git a/gsl-1.9/doc/examples/ieee.c b/gsl-1.9/doc/examples/ieee.c new file mode 100644 index 0000000..c7f1110 --- /dev/null +++ b/gsl-1.9/doc/examples/ieee.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <gsl/gsl_ieee_utils.h> + +int +main (void) +{ + float f = 1.0/3.0; + double d = 1.0/3.0; + + double fd = f; /* promote from float to double */ + + printf (" f="); gsl_ieee_printf_float(&f); + printf ("\n"); + + printf ("fd="); gsl_ieee_printf_double(&fd); + printf ("\n"); + + printf (" d="); gsl_ieee_printf_double(&d); + printf ("\n"); + + return 0; +} diff --git a/gsl-1.9/doc/examples/ieeeround.c b/gsl-1.9/doc/examples/ieeeround.c new file mode 100644 index 0000000..04f837d --- /dev/null +++ b/gsl-1.9/doc/examples/ieeeround.c @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_ieee_utils.h> + +int +main (void) +{ + double x = 1, oldsum = 0, sum = 0; + int i = 0; + + gsl_ieee_env_setup (); /* read GSL_IEEE_MODE */ + + do + { + i++; + + oldsum = sum; + sum += x; + x = x / i; + + printf ("i=%2d sum=%.18f error=%g\n", + i, sum, sum - M_E); + + if (i > 30) + break; + } + while (sum != oldsum); + + return 0; +} diff --git a/gsl-1.9/doc/examples/integration.c b/gsl-1.9/doc/examples/integration.c new file mode 100644 index 0000000..a8f2450 --- /dev/null +++ b/gsl-1.9/doc/examples/integration.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_integration.h> + +double f (double x, void * params) { + double alpha = *(double *) params; + double f = log(alpha*x) / sqrt(x); + return f; +} + +int +main (void) +{ + gsl_integration_workspace * w + = gsl_integration_workspace_alloc (1000); + + double result, error; + double expected = -4.0; + double alpha = 1.0; + + gsl_function F; + F.function = &f; + F.params = α + + gsl_integration_qags (&F, 0, 1, 0, 1e-7, 1000, + w, &result, &error); + + printf ("result = % .18f\n", result); + printf ("exact result = % .18f\n", expected); + printf ("estimated error = % .18f\n", error); + printf ("actual error = % .18f\n", result - expected); + printf ("intervals = %d\n", w->size); + + gsl_integration_workspace_free (w); + + return 0; +} diff --git a/gsl-1.9/doc/examples/integration.out b/gsl-1.9/doc/examples/integration.out new file mode 100644 index 0000000..4758ebf --- /dev/null +++ b/gsl-1.9/doc/examples/integration.out @@ -0,0 +1,5 @@ +result = -3.999999999999973799 +exact result = -4.000000000000000000 +estimated error = 0.000000000000246025 +actual error = 0.000000000000026201 +intervals = 8 diff --git a/gsl-1.9/doc/examples/interp.c b/gsl-1.9/doc/examples/interp.c new file mode 100644 index 0000000..5c6e8fc --- /dev/null +++ b/gsl-1.9/doc/examples/interp.c @@ -0,0 +1,41 @@ +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_spline.h> + +int +main (void) +{ + int i; + double xi, yi, x[10], y[10]; + + printf ("#m=0,S=2\n"); + + for (i = 0; i < 10; i++) + { + x[i] = i + 0.5 * sin (i); + y[i] = i + cos (i * i); + printf ("%g %g\n", x[i], y[i]); + } + + printf ("#m=1,S=0\n"); + + { + gsl_interp_accel *acc + = gsl_interp_accel_alloc (); + gsl_spline *spline + = gsl_spline_alloc (gsl_interp_cspline, 10); + + gsl_spline_init (spline, x, y, 10); + + for (xi = x[0]; xi < x[9]; xi += 0.01) + { + yi = gsl_spline_eval (spline, xi, acc); + printf ("%g %g\n", xi, yi); + } + gsl_spline_free (spline); + gsl_interp_accel_free (acc); + } + return 0; +} diff --git a/gsl-1.9/doc/examples/interpp.c b/gsl-1.9/doc/examples/interpp.c new file mode 100644 index 0000000..8ffdbcc --- /dev/null +++ b/gsl-1.9/doc/examples/interpp.c @@ -0,0 +1,40 @@ +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_spline.h> + +int +main (void) +{ + int N = 4; + double x[4] = {0.00, 0.10, 0.27, 0.30}; + double y[4] = {0.15, 0.70, -0.10, 0.15}; /* Note: first = last + for periodic data */ + + gsl_interp_accel *acc = gsl_interp_accel_alloc (); + const gsl_interp_type *t = gsl_interp_cspline_periodic; + gsl_spline *spline = gsl_spline_alloc (t, N); + + int i; double xi, yi; + + printf ("#m=0,S=5\n"); + for (i = 0; i < N; i++) + { + printf ("%g %g\n", x[i], y[i]); + } + + printf ("#m=1,S=0\n"); + gsl_spline_init (spline, x, y, N); + + for (i = 0; i <= 100; i++) + { + xi = (1 - i / 100.0) * x[0] + (i / 100.0) * x[N-1]; + yi = gsl_spline_eval (spline, xi, acc); + printf ("%g %g\n", xi, yi); + } + + gsl_spline_free (spline); + gsl_interp_accel_free (acc); + return 0; +} diff --git a/gsl-1.9/doc/examples/intro.c b/gsl-1.9/doc/examples/intro.c new file mode 100644 index 0000000..bd28482 --- /dev/null +++ b/gsl-1.9/doc/examples/intro.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include <gsl/gsl_sf_bessel.h> + +int +main (void) +{ + double x = 5.0; + double y = gsl_sf_bessel_J0 (x); + printf ("J0(%g) = %.18e\n", x, y); + return 0; +} diff --git a/gsl-1.9/doc/examples/intro.out b/gsl-1.9/doc/examples/intro.out new file mode 100644 index 0000000..ca264dd --- /dev/null +++ b/gsl-1.9/doc/examples/intro.out @@ -0,0 +1 @@ +J0(5) = -1.775967713143382920e-01 diff --git a/gsl-1.9/doc/examples/linalglu.c b/gsl-1.9/doc/examples/linalglu.c new file mode 100644 index 0000000..61b5293 --- /dev/null +++ b/gsl-1.9/doc/examples/linalglu.c @@ -0,0 +1,36 @@ +#include <stdio.h> +#include <gsl/gsl_linalg.h> + +int +main (void) +{ + double a_data[] = { 0.18, 0.60, 0.57, 0.96, + 0.41, 0.24, 0.99, 0.58, + 0.14, 0.30, 0.97, 0.66, + 0.51, 0.13, 0.19, 0.85 }; + + double b_data[] = { 1.0, 2.0, 3.0, 4.0 }; + + gsl_matrix_view m + = gsl_matrix_view_array (a_data, 4, 4); + + gsl_vector_view b + = gsl_vector_view_array (b_data, 4); + + gsl_vector *x = gsl_vector_alloc (4); + + int s; + + gsl_permutation * p = gsl_permutation_alloc (4); + + gsl_linalg_LU_decomp (&m.matrix, p, &s); + + gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x); + + printf ("x = \n"); + gsl_vector_fprintf (stdout, x, "%g"); + + gsl_permutation_free (p); + gsl_vector_free (x); + return 0; +} diff --git a/gsl-1.9/doc/examples/linalglu.out b/gsl-1.9/doc/examples/linalglu.out new file mode 100644 index 0000000..406f59a --- /dev/null +++ b/gsl-1.9/doc/examples/linalglu.out @@ -0,0 +1,4 @@ +x = -4.05205 +-12.6056 +1.66091 +8.69377 diff --git a/gsl-1.9/doc/examples/matrix.c b/gsl-1.9/doc/examples/matrix.c new file mode 100644 index 0000000..7704687 --- /dev/null +++ b/gsl-1.9/doc/examples/matrix.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <gsl/gsl_matrix.h> + +int +main (void) +{ + int i, j; + gsl_matrix * m = gsl_matrix_alloc (10, 3); + + for (i = 0; i < 10; i++) + for (j = 0; j < 3; j++) + gsl_matrix_set (m, i, j, 0.23 + 100*i + j); + + for (i = 0; i < 100; i++) /* OUT OF RANGE ERROR */ + for (j = 0; j < 3; j++) + printf ("m(%d,%d) = %g\n", i, j, + gsl_matrix_get (m, i, j)); + + gsl_matrix_free (m); + + return 0; +} diff --git a/gsl-1.9/doc/examples/matrixw.c b/gsl-1.9/doc/examples/matrixw.c new file mode 100644 index 0000000..b05ffbd --- /dev/null +++ b/gsl-1.9/doc/examples/matrixw.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <gsl/gsl_matrix.h> + +int +main (void) +{ + int i, j, k = 0; + gsl_matrix * m = gsl_matrix_alloc (100, 100); + gsl_matrix * a = gsl_matrix_alloc (100, 100); + + for (i = 0; i < 100; i++) + for (j = 0; j < 100; j++) + gsl_matrix_set (m, i, j, 0.23 + i + j); + + { + FILE * f = fopen ("test.dat", "wb"); + gsl_matrix_fwrite (f, m); + fclose (f); + } + + { + FILE * f = fopen ("test.dat", "rb"); + gsl_matrix_fread (f, a); + fclose (f); + } + + for (i = 0; i < 100; i++) + for (j = 0; j < 100; j++) + { + double mij = gsl_matrix_get (m, i, j); + double aij = gsl_matrix_get (a, i, j); + if (mij != aij) k++; + } + + gsl_matrix_free (m); + gsl_matrix_free (a); + + printf ("differences = %d (should be zero)\n", k); + return (k > 0); +} diff --git a/gsl-1.9/doc/examples/min.c b/gsl-1.9/doc/examples/min.c new file mode 100644 index 0000000..ebba625 --- /dev/null +++ b/gsl-1.9/doc/examples/min.c @@ -0,0 +1,65 @@ +#include <stdio.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_min.h> + +double fn1 (double x, void * params) +{ + return cos(x) + 1.0; +} + +int +main (void) +{ + int status; + int iter = 0, max_iter = 100; + const gsl_min_fminimizer_type *T; + gsl_min_fminimizer *s; + double m = 2.0, m_expected = M_PI; + double a = 0.0, b = 6.0; + gsl_function F; + + F.function = &fn1; + F.params = 0; + + T = gsl_min_fminimizer_brent; + s = gsl_min_fminimizer_alloc (T); + gsl_min_fminimizer_set (s, &F, m, a, b); + + printf ("using %s method\n", + gsl_min_fminimizer_name (s)); + + printf ("%5s [%9s, %9s] %9s %10s %9s\n", + "iter", "lower", "upper", "min", + "err", "err(est)"); + + printf ("%5d [%.7f, %.7f] %.7f %+.7f %.7f\n", + iter, a, b, + m, m - m_expected, b - a); + + do + { + iter++; + status = gsl_min_fminimizer_iterate (s); + + m = gsl_min_fminimizer_x_minimum (s); + a = gsl_min_fminimizer_x_lower (s); + b = gsl_min_fminimizer_x_upper (s); + + status + = gsl_min_test_interval (a, b, 0.001, 0.0); + + if (status == GSL_SUCCESS) + printf ("Converged:\n"); + + printf ("%5d [%.7f, %.7f] " + "%.7f %.7f %+.7f %.7f\n", + iter, a, b, + m, m_expected, m - m_expected, b - a); + } + while (status == GSL_CONTINUE && iter < max_iter); + + gsl_min_fminimizer_free (s); + + return status; +} diff --git a/gsl-1.9/doc/examples/min.out b/gsl-1.9/doc/examples/min.out new file mode 100644 index 0000000..93d02fc --- /dev/null +++ b/gsl-1.9/doc/examples/min.out @@ -0,0 +1,13 @@ + 0 [0.0000000, 6.0000000] 2.0000000 -1.1415927 6.0000000 + 1 [2.0000000, 6.0000000] 3.2758640 +0.1342713 4.0000000 + 2 [2.0000000, 3.2831929] 3.2758640 +0.1342713 1.2831929 + 3 [2.8689068, 3.2831929] 3.2758640 +0.1342713 0.4142862 + 4 [2.8689068, 3.2831929] 3.2758640 +0.1342713 0.4142862 + 5 [2.8689068, 3.2758640] 3.1460585 +0.0044658 0.4069572 + 6 [3.1346075, 3.2758640] 3.1460585 +0.0044658 0.1412565 + 7 [3.1346075, 3.1874620] 3.1460585 +0.0044658 0.0528545 + 8 [3.1346075, 3.1460585] 3.1460585 +0.0044658 0.0114510 + 9 [3.1346075, 3.1460585] 3.1424060 +0.0008133 0.0114510 + 10 [3.1346075, 3.1424060] 3.1415885 -0.0000041 0.0077985 +Converged: + 11 [3.1415885, 3.1424060] 3.1415927 -0.0000000 0.0008175 diff --git a/gsl-1.9/doc/examples/monte.c b/gsl-1.9/doc/examples/monte.c new file mode 100644 index 0000000..2c23747 --- /dev/null +++ b/gsl-1.9/doc/examples/monte.c @@ -0,0 +1,106 @@ +#include <stdlib.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_monte.h> +#include <gsl/gsl_monte_plain.h> +#include <gsl/gsl_monte_miser.h> +#include <gsl/gsl_monte_vegas.h> + +/* Computation of the integral, + + I = int (dx dy dz)/(2pi)^3 1/(1-cos(x)cos(y)cos(z)) + + over (-pi,-pi,-pi) to (+pi, +pi, +pi). The exact answer + is Gamma(1/4)^4/(4 pi^3). This example is taken from + C.Itzykson, J.M.Drouffe, "Statistical Field Theory - + Volume 1", Section 1.1, p21, which cites the original + paper M.L.Glasser, I.J.Zucker, Proc.Natl.Acad.Sci.USA 74 + 1800 (1977) */ + +/* For simplicity we compute the integral over the region + (0,0,0) -> (pi,pi,pi) and multiply by 8 */ + +double exact = 1.3932039296856768591842462603255; + +double +g (double *k, size_t dim, void *params) +{ + double A = 1.0 / (M_PI * M_PI * M_PI); + return A / (1.0 - cos (k[0]) * cos (k[1]) * cos (k[2])); +} + +void +display_results (char *title, double result, double error) +{ + printf ("%s ==================\n", title); + printf ("result = % .6f\n", result); + printf ("sigma = % .6f\n", error); + printf ("exact = % .6f\n", exact); + printf ("error = % .6f = %.1g sigma\n", result - exact, + fabs (result - exact) / error); +} + +int +main (void) +{ + double res, err; + + double xl[3] = { 0, 0, 0 }; + double xu[3] = { M_PI, M_PI, M_PI }; + + const gsl_rng_type *T; + gsl_rng *r; + + gsl_monte_function G = { &g, 3, 0 }; + + size_t calls = 500000; + + gsl_rng_env_setup (); + + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + { + gsl_monte_plain_state *s = gsl_monte_plain_alloc (3); + gsl_monte_plain_integrate (&G, xl, xu, 3, calls, r, s, + &res, &err); + gsl_monte_plain_free (s); + + display_results ("plain", res, err); + } + + { + gsl_monte_miser_state *s = gsl_monte_miser_alloc (3); + gsl_monte_miser_integrate (&G, xl, xu, 3, calls, r, s, + &res, &err); + gsl_monte_miser_free (s); + + display_results ("miser", res, err); + } + + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (3); + + gsl_monte_vegas_integrate (&G, xl, xu, 3, 10000, r, s, + &res, &err); + display_results ("vegas warm-up", res, err); + + printf ("converging...\n"); + + do + { + gsl_monte_vegas_integrate (&G, xl, xu, 3, calls/5, r, s, + &res, &err); + printf ("result = % .6f sigma = % .6f " + "chisq/dof = %.1f\n", res, err, s->chisq); + } + while (fabs (s->chisq - 1.0) > 0.5); + + display_results ("vegas final", res, err); + + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 0; +} diff --git a/gsl-1.9/doc/examples/nlfit.c b/gsl-1.9/doc/examples/nlfit.c new file mode 100644 index 0000000..49b4137 --- /dev/null +++ b/gsl-1.9/doc/examples/nlfit.c @@ -0,0 +1,115 @@ +#include <stdlib.h> +#include <stdio.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_blas.h> +#include <gsl/gsl_multifit_nlin.h> + +#include "expfit.c" + +#define N 40 + +void print_state (size_t iter, gsl_multifit_fdfsolver * s); + +int +main (void) +{ + const gsl_multifit_fdfsolver_type *T; + gsl_multifit_fdfsolver *s; + int status; + unsigned int i, iter = 0; + const size_t n = N; + const size_t p = 3; + + gsl_matrix *covar = gsl_matrix_alloc (p, p); + double y[N], sigma[N]; + struct data d = { n, y, sigma}; + gsl_multifit_function_fdf f; + double x_init[3] = { 1.0, 0.0, 0.0 }; + gsl_vector_view x = gsl_vector_view_array (x_init, p); + const gsl_rng_type * type; + gsl_rng * r; + + gsl_rng_env_setup(); + + type = gsl_rng_default; + r = gsl_rng_alloc (type); + + f.f = &expb_f; + f.df = &expb_df; + f.fdf = &expb_fdf; + f.n = n; + f.p = p; + f.params = &d; + + /* This is the data to be fitted */ + + for (i = 0; i < n; i++) + { + double t = i; + y[i] = 1.0 + 5 * exp (-0.1 * t) + + gsl_ran_gaussian (r, 0.1); + sigma[i] = 0.1; + printf ("data: %u %g %g\n", i, y[i], sigma[i]); + }; + + T = gsl_multifit_fdfsolver_lmsder; + s = gsl_multifit_fdfsolver_alloc (T, n, p); + gsl_multifit_fdfsolver_set (s, &f, &x.vector); + + print_state (iter, s); + + do + { + iter++; + status = gsl_multifit_fdfsolver_iterate (s); + + printf ("status = %s\n", gsl_strerror (status)); + + print_state (iter, s); + + if (status) + break; + + status = gsl_multifit_test_delta (s->dx, s->x, + 1e-4, 1e-4); + } + while (status == GSL_CONTINUE && iter < 500); + + gsl_multifit_covar (s->J, 0.0, covar); + +#define FIT(i) gsl_vector_get(s->x, i) +#define ERR(i) sqrt(gsl_matrix_get(covar,i,i)) + + { + double chi = gsl_blas_dnrm2(s->f); + double dof = n - p; + double c = GSL_MAX_DBL(1, chi / sqrt(dof)); + + printf("chisq/dof = %g\n", pow(chi, 2.0) / dof); + + printf ("A = %.5f +/- %.5f\n", FIT(0), c*ERR(0)); + printf ("lambda = %.5f +/- %.5f\n", FIT(1), c*ERR(1)); + printf ("b = %.5f +/- %.5f\n", FIT(2), c*ERR(2)); + } + + printf ("status = %s\n", gsl_strerror (status)); + + gsl_multifit_fdfsolver_free (s); + gsl_matrix_free (covar); + gsl_rng_free (r); + return 0; +} + +void +print_state (size_t iter, gsl_multifit_fdfsolver * s) +{ + printf ("iter: %3u x = % 15.8f % 15.8f % 15.8f " + "|f(x)| = %g\n", + iter, + gsl_vector_get (s->x, 0), + gsl_vector_get (s->x, 1), + gsl_vector_get (s->x, 2), + gsl_blas_dnrm2 (s->f)); +} diff --git a/gsl-1.9/doc/examples/ntupler.c b/gsl-1.9/doc/examples/ntupler.c new file mode 100644 index 0000000..a926522 --- /dev/null +++ b/gsl-1.9/doc/examples/ntupler.c @@ -0,0 +1,72 @@ +#include <math.h> +#include <gsl/gsl_ntuple.h> +#include <gsl/gsl_histogram.h> + +struct data +{ + double x; + double y; + double z; +}; + +int sel_func (void *ntuple_data, void *params); +double val_func (void *ntuple_data, void *params); + +int +main (void) +{ + struct data ntuple_row; + + gsl_ntuple *ntuple + = gsl_ntuple_open ("test.dat", &ntuple_row, + sizeof (ntuple_row)); + double lower = 1.5; + + gsl_ntuple_select_fn S; + gsl_ntuple_value_fn V; + + gsl_histogram *h = gsl_histogram_alloc (100); + gsl_histogram_set_ranges_uniform(h, 0.0, 10.0); + + S.function = &sel_func; + S.params = &lower; + + V.function = &val_func; + V.params = 0; + + gsl_ntuple_project (h, ntuple, &V, &S); + gsl_histogram_fprintf (stdout, h, "%f", "%f"); + gsl_histogram_free (h); + gsl_ntuple_close (ntuple); + + return 0; +} + +int +sel_func (void *ntuple_data, void *params) +{ + struct data * data = (struct data *) ntuple_data; + double x, y, z, E2, scale; + scale = *(double *) params; + + x = data->x; + y = data->y; + z = data->z; + + E2 = x * x + y * y + z * z; + + return E2 > scale; +} + +double +val_func (void *ntuple_data, void *params) +{ + struct data * data = (struct data *) ntuple_data; + double x, y, z; + + x = data->x; + y = data->y; + z = data->z; + + return x * x + y * y + z * z; +} diff --git a/gsl-1.9/doc/examples/ntuplew.c b/gsl-1.9/doc/examples/ntuplew.c new file mode 100644 index 0000000..82f6fa4 --- /dev/null +++ b/gsl-1.9/doc/examples/ntuplew.c @@ -0,0 +1,43 @@ +#include <gsl/gsl_ntuple.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> + +struct data +{ + double x; + double y; + double z; +}; + +int +main (void) +{ + const gsl_rng_type * T; + gsl_rng * r; + + struct data ntuple_row; + int i; + + gsl_ntuple *ntuple + = gsl_ntuple_create ("test.dat", &ntuple_row, + sizeof (ntuple_row)); + + gsl_rng_env_setup (); + + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + for (i = 0; i < 10000; i++) + { + ntuple_row.x = gsl_ran_ugaussian (r); + ntuple_row.y = gsl_ran_ugaussian (r); + ntuple_row.z = gsl_ran_ugaussian (r); + + gsl_ntuple_write (ntuple); + } + + gsl_ntuple_close (ntuple); + gsl_rng_free (r); + + return 0; +} diff --git a/gsl-1.9/doc/examples/ode-initval.c b/gsl-1.9/doc/examples/ode-initval.c new file mode 100644 index 0000000..8a8f794 --- /dev/null +++ b/gsl-1.9/doc/examples/ode-initval.c @@ -0,0 +1,70 @@ +#include <stdio.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_odeiv.h> + +int +func (double t, const double y[], double f[], + void *params) +{ + double mu = *(double *)params; + f[0] = y[1]; + f[1] = -y[0] - mu*y[1]*(y[0]*y[0] - 1); + return GSL_SUCCESS; +} + +int +jac (double t, const double y[], double *dfdy, + double dfdt[], void *params) +{ + double mu = *(double *)params; + gsl_matrix_view dfdy_mat + = gsl_matrix_view_array (dfdy, 2, 2); + gsl_matrix * m = &dfdy_mat.matrix; + gsl_matrix_set (m, 0, 0, 0.0); + gsl_matrix_set (m, 0, 1, 1.0); + gsl_matrix_set (m, 1, 0, -2.0*mu*y[0]*y[1] - 1.0); + gsl_matrix_set (m, 1, 1, -mu*(y[0]*y[0] - 1.0)); + dfdt[0] = 0.0; + dfdt[1] = 0.0; + return GSL_SUCCESS; +} + +int +main (void) +{ + const gsl_odeiv_step_type * T + = gsl_odeiv_step_rk8pd; + + gsl_odeiv_step * s + = gsl_odeiv_step_alloc (T, 2); + gsl_odeiv_control * c + = gsl_odeiv_control_y_new (1e-6, 0.0); + gsl_odeiv_evolve * e + = gsl_odeiv_evolve_alloc (2); + + double mu = 10; + gsl_odeiv_system sys = {func, jac, 2, &mu}; + + double t = 0.0, t1 = 100.0; + double h = 1e-6; + double y[2] = { 1.0, 0.0 }; + + while (t < t1) + { + int status = gsl_odeiv_evolve_apply (e, c, s, + &sys, + &t, t1, + &h, y); + + if (status != GSL_SUCCESS) + break; + + printf ("%.5e %.5e %.5e\n", t, y[0], y[1]); + } + + gsl_odeiv_evolve_free (e); + gsl_odeiv_control_free (c); + gsl_odeiv_step_free (s); + return 0; +} diff --git a/gsl-1.9/doc/examples/odefixed.c b/gsl-1.9/doc/examples/odefixed.c new file mode 100644 index 0000000..3c81bf3 --- /dev/null +++ b/gsl-1.9/doc/examples/odefixed.c @@ -0,0 +1,42 @@ +int +main (void) +{ + const gsl_odeiv_step_type * T + = gsl_odeiv_step_rk4; + + gsl_odeiv_step * s + = gsl_odeiv_step_alloc (T, 2); + + double mu = 10; + gsl_odeiv_system sys = {func, jac, 2, &mu}; + + double t = 0.0, t1 = 100.0; + double h = 1e-2; + double y[2] = { 1.0, 0.0 }, y_err[2]; + double dydt_in[2], dydt_out[2]; + + /* initialise dydt_in from system parameters */ + GSL_ODEIV_FN_EVAL(&sys, t, y, dydt_in); + + while (t < t1) + { + int status = gsl_odeiv_step_apply (s, t, h, + y, y_err, + dydt_in, + dydt_out, + &sys); + + if (status != GSL_SUCCESS) + break; + + dydt_in[0] = dydt_out[0]; + dydt_in[1] = dydt_out[1]; + + t += h; + + printf ("%.5e %.5e %.5e\n", t, y[0], y[1]); + } + + gsl_odeiv_step_free (s); + return 0; +} diff --git a/gsl-1.9/doc/examples/permseq.c b/gsl-1.9/doc/examples/permseq.c new file mode 100644 index 0000000..08ebf63 --- /dev/null +++ b/gsl-1.9/doc/examples/permseq.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <gsl/gsl_permutation.h> + +int +main (void) +{ + gsl_permutation * p = gsl_permutation_alloc (3); + + gsl_permutation_init (p); + + do + { + gsl_permutation_fprintf (stdout, p, " %u"); + printf ("\n"); + } + while (gsl_permutation_next(p) == GSL_SUCCESS); + + gsl_permutation_free (p); + + return 0; +} diff --git a/gsl-1.9/doc/examples/permshuffle.c b/gsl-1.9/doc/examples/permshuffle.c new file mode 100644 index 0000000..7247864 --- /dev/null +++ b/gsl-1.9/doc/examples/permshuffle.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> +#include <gsl/gsl_permutation.h> + +int +main (void) +{ + const size_t N = 10; + const gsl_rng_type * T; + gsl_rng * r; + + gsl_permutation * p = gsl_permutation_alloc (N); + gsl_permutation * q = gsl_permutation_alloc (N); + + gsl_rng_env_setup(); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + printf ("initial permutation:"); + gsl_permutation_init (p); + gsl_permutation_fprintf (stdout, p, " %u"); + printf ("\n"); + + printf (" random permutation:"); + gsl_ran_shuffle (r, p->data, N, sizeof(size_t)); + gsl_permutation_fprintf (stdout, p, " %u"); + printf ("\n"); + + printf ("inverse permutation:"); + gsl_permutation_inverse (q, p); + gsl_permutation_fprintf (stdout, q, " %u"); + printf ("\n"); + + gsl_permutation_free (p); + gsl_permutation_free (q); + gsl_rng_free (r); + + return 0; +} diff --git a/gsl-1.9/doc/examples/polyroots.c b/gsl-1.9/doc/examples/polyroots.c new file mode 100644 index 0000000..6debbd5 --- /dev/null +++ b/gsl-1.9/doc/examples/polyroots.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <gsl/gsl_poly.h> + +int +main (void) +{ + int i; + /* coefficients of P(x) = -1 + x^5 */ + double a[6] = { -1, 0, 0, 0, 0, 1 }; + double z[10]; + + gsl_poly_complex_workspace * w + = gsl_poly_complex_workspace_alloc (6); + + gsl_poly_complex_solve (a, 6, w, z); + + gsl_poly_complex_workspace_free (w); + + for (i = 0; i < 5; i++) + { + printf ("z%d = %+.18f %+.18f\n", + i, z[2*i], z[2*i+1]); + } + + return 0; +} diff --git a/gsl-1.9/doc/examples/polyroots.out b/gsl-1.9/doc/examples/polyroots.out new file mode 100644 index 0000000..253fe11 --- /dev/null +++ b/gsl-1.9/doc/examples/polyroots.out @@ -0,0 +1,5 @@ +z0 = -0.809016994374947451 +0.587785252292473137 +z1 = -0.809016994374947451 -0.587785252292473137 +z2 = +0.309016994374947451 +0.951056516295153642 +z3 = +0.309016994374947451 -0.951056516295153642 +z4 = +1.000000000000000000 +0.000000000000000000 diff --git a/gsl-1.9/doc/examples/qrng.c b/gsl-1.9/doc/examples/qrng.c new file mode 100644 index 0000000..5275209 --- /dev/null +++ b/gsl-1.9/doc/examples/qrng.c @@ -0,0 +1,19 @@ +#include <stdio.h> +#include <gsl/gsl_qrng.h> + +int +main (void) +{ + int i; + gsl_qrng * q = gsl_qrng_alloc (gsl_qrng_sobol, 2); + + for (i = 0; i < 1024; i++) + { + double v[2]; + gsl_qrng_get (q, v); + printf ("%.5f %.5f\n", v[0], v[1]); + } + + gsl_qrng_free (q); + return 0; +} diff --git a/gsl-1.9/doc/examples/randpoisson.2.out b/gsl-1.9/doc/examples/randpoisson.2.out new file mode 100644 index 0000000..fbe36a2 --- /dev/null +++ b/gsl-1.9/doc/examples/randpoisson.2.out @@ -0,0 +1,2 @@ +GSL_RNG_SEED=123 + 4 5 6 3 3 1 4 2 5 5 diff --git a/gsl-1.9/doc/examples/randpoisson.c b/gsl-1.9/doc/examples/randpoisson.c new file mode 100644 index 0000000..ef69b72 --- /dev/null +++ b/gsl-1.9/doc/examples/randpoisson.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> + +int +main (void) +{ + const gsl_rng_type * T; + gsl_rng * r; + + int i, n = 10; + double mu = 3.0; + + /* create a generator chosen by the + environment variable GSL_RNG_TYPE */ + + gsl_rng_env_setup(); + + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + /* print n random variates chosen from + the poisson distribution with mean + parameter mu */ + + for (i = 0; i < n; i++) + { + unsigned int k = gsl_ran_poisson (r, mu); + printf (" %u", k); + } + + printf ("\n"); + gsl_rng_free (r); + return 0; +} diff --git a/gsl-1.9/doc/examples/randpoisson.out b/gsl-1.9/doc/examples/randpoisson.out new file mode 100644 index 0000000..1639cca --- /dev/null +++ b/gsl-1.9/doc/examples/randpoisson.out @@ -0,0 +1 @@ + 2 5 5 2 1 0 3 4 1 1 diff --git a/gsl-1.9/doc/examples/randwalk.c b/gsl-1.9/doc/examples/randwalk.c new file mode 100644 index 0000000..588aa50 --- /dev/null +++ b/gsl-1.9/doc/examples/randwalk.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> + +int +main (void) +{ + int i; + double x = 0, y = 0, dx, dy; + + const gsl_rng_type * T; + gsl_rng * r; + + gsl_rng_env_setup(); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + printf ("%g %g\n", x, y); + + for (i = 0; i < 10; i++) + { + gsl_ran_dir_2d (r, &dx, &dy); + x += dx; y += dy; + printf ("%g %g\n", x, y); + } + + gsl_rng_free (r); + return 0; +} diff --git a/gsl-1.9/doc/examples/rng.c b/gsl-1.9/doc/examples/rng.c new file mode 100644 index 0000000..6330264 --- /dev/null +++ b/gsl-1.9/doc/examples/rng.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <gsl/gsl_rng.h> + +gsl_rng * r; /* global generator */ + +int +main (void) +{ + const gsl_rng_type * T; + + gsl_rng_env_setup(); + + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + printf ("generator type: %s\n", gsl_rng_name (r)); + printf ("seed = %lu\n", gsl_rng_default_seed); + printf ("first value = %lu\n", gsl_rng_get (r)); + + gsl_rng_free (r); + return 0; +} diff --git a/gsl-1.9/doc/examples/rng.out b/gsl-1.9/doc/examples/rng.out new file mode 100644 index 0000000..00f33a3 --- /dev/null +++ b/gsl-1.9/doc/examples/rng.out @@ -0,0 +1,3 @@ +generator type: mt19937 +seed = 0 +first value = 4293858116 diff --git a/gsl-1.9/doc/examples/rngunif.2.out b/gsl-1.9/doc/examples/rngunif.2.out new file mode 100644 index 0000000..d04fccd --- /dev/null +++ b/gsl-1.9/doc/examples/rngunif.2.out @@ -0,0 +1,12 @@ +GSL_RNG_TYPE=mrg +GSL_RNG_SEED=123 +0.33050 +0.86631 +0.32982 +0.67620 +0.53391 +0.06457 +0.16847 +0.70229 +0.04371 +0.86374 diff --git a/gsl-1.9/doc/examples/rngunif.c b/gsl-1.9/doc/examples/rngunif.c new file mode 100644 index 0000000..ca4b2db --- /dev/null +++ b/gsl-1.9/doc/examples/rngunif.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <gsl/gsl_rng.h> + +int +main (void) +{ + const gsl_rng_type * T; + gsl_rng * r; + + int i, n = 10; + + gsl_rng_env_setup(); + + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + for (i = 0; i < n; i++) + { + double u = gsl_rng_uniform (r); + printf ("%.5f\n", u); + } + + gsl_rng_free (r); + + return 0; +} diff --git a/gsl-1.9/doc/examples/rngunif.out b/gsl-1.9/doc/examples/rngunif.out new file mode 100644 index 0000000..b4049ef --- /dev/null +++ b/gsl-1.9/doc/examples/rngunif.out @@ -0,0 +1,10 @@ +0.99974 +0.16291 +0.28262 +0.94720 +0.23166 +0.48497 +0.95748 +0.74431 +0.54004 +0.73995 diff --git a/gsl-1.9/doc/examples/rootnewt.c b/gsl-1.9/doc/examples/rootnewt.c new file mode 100644 index 0000000..fea5f11 --- /dev/null +++ b/gsl-1.9/doc/examples/rootnewt.c @@ -0,0 +1,52 @@ +#include <stdio.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_roots.h> + +#include "demo_fn.h" +#include "demo_fn.c" + +int +main (void) +{ + int status; + int iter = 0, max_iter = 100; + const gsl_root_fdfsolver_type *T; + gsl_root_fdfsolver *s; + double x0, x = 5.0, r_expected = sqrt (5.0); + gsl_function_fdf FDF; + struct quadratic_params params = {1.0, 0.0, -5.0}; + + FDF.f = &quadratic; + FDF.df = &quadratic_deriv; + FDF.fdf = &quadratic_fdf; + FDF.params = ¶ms; + + T = gsl_root_fdfsolver_newton; + s = gsl_root_fdfsolver_alloc (T); + gsl_root_fdfsolver_set (s, &FDF, x); + + printf ("using %s method\n", + gsl_root_fdfsolver_name (s)); + + printf ("%-5s %10s %10s %10s\n", + "iter", "root", "err", "err(est)"); + do + { + iter++; + status = gsl_root_fdfsolver_iterate (s); + x0 = x; + x = gsl_root_fdfsolver_root (s); + status = gsl_root_test_delta (x, x0, 0, 1e-3); + + if (status == GSL_SUCCESS) + printf ("Converged:\n"); + + printf ("%5d %10.7f %+10.7f %10.7f\n", + iter, x, x - r_expected, x - x0); + } + while (status == GSL_CONTINUE && iter < max_iter); + + gsl_root_fdfsolver_free (s); + return status; +} diff --git a/gsl-1.9/doc/examples/roots.c b/gsl-1.9/doc/examples/roots.c new file mode 100644 index 0000000..7854fbc --- /dev/null +++ b/gsl-1.9/doc/examples/roots.c @@ -0,0 +1,58 @@ +#include <stdio.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_roots.h> + +#include "demo_fn.h" +#include "demo_fn.c" + +int +main (void) +{ + int status; + int iter = 0, max_iter = 100; + const gsl_root_fsolver_type *T; + gsl_root_fsolver *s; + double r = 0, r_expected = sqrt (5.0); + double x_lo = 0.0, x_hi = 5.0; + gsl_function F; + struct quadratic_params params = {1.0, 0.0, -5.0}; + + F.function = &quadratic; + F.params = ¶ms; + + T = gsl_root_fsolver_brent; + s = gsl_root_fsolver_alloc (T); + gsl_root_fsolver_set (s, &F, x_lo, x_hi); + + printf ("using %s method\n", + gsl_root_fsolver_name (s)); + + printf ("%5s [%9s, %9s] %9s %10s %9s\n", + "iter", "lower", "upper", "root", + "err", "err(est)"); + + do + { + iter++; + status = gsl_root_fsolver_iterate (s); + r = gsl_root_fsolver_root (s); + x_lo = gsl_root_fsolver_x_lower (s); + x_hi = gsl_root_fsolver_x_upper (s); + status = gsl_root_test_interval (x_lo, x_hi, + 0, 0.001); + + if (status == GSL_SUCCESS) + printf ("Converged:\n"); + + printf ("%5d [%.7f, %.7f] %.7f %+.7f %.7f\n", + iter, x_lo, x_hi, + r, r - r_expected, + x_hi - x_lo); + } + while (status == GSL_CONTINUE && iter < max_iter); + + gsl_root_fsolver_free (s); + + return status; +} diff --git a/gsl-1.9/doc/examples/siman.c b/gsl-1.9/doc/examples/siman.c new file mode 100644 index 0000000..50f08e0 --- /dev/null +++ b/gsl-1.9/doc/examples/siman.c @@ -0,0 +1,82 @@ +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include <gsl/gsl_siman.h> + +/* set up parameters for this simulated annealing run */ + +/* how many points do we try before stepping */ +#define N_TRIES 200 + +/* how many iterations for each T? */ +#define ITERS_FIXED_T 1000 + +/* max step size in random walk */ +#define STEP_SIZE 1.0 + +/* Boltzmann constant */ +#define K 1.0 + +/* initial temperature */ +#define T_INITIAL 0.008 + +/* damping factor for temperature */ +#define MU_T 1.003 +#define T_MIN 2.0e-6 + +gsl_siman_params_t params + = {N_TRIES, ITERS_FIXED_T, STEP_SIZE, + K, T_INITIAL, MU_T, T_MIN}; + +/* now some functions to test in one dimension */ +double E1(void *xp) +{ + double x = * ((double *) xp); + + return exp(-pow((x-1.0),2.0))*sin(8*x); +} + +double M1(void *xp, void *yp) +{ + double x = *((double *) xp); + double y = *((double *) yp); + + return fabs(x - y); +} + +void S1(const gsl_rng * r, void *xp, double step_size) +{ + double old_x = *((double *) xp); + double new_x; + + double u = gsl_rng_uniform(r); + new_x = u * 2 * step_size - step_size + old_x; + + memcpy(xp, &new_x, sizeof(new_x)); +} + +void P1(void *xp) +{ + printf ("%12g", *((double *) xp)); +} + +int +main(int argc, char *argv[]) +{ + const gsl_rng_type * T; + gsl_rng * r; + + double x_initial = 15.5; + + gsl_rng_env_setup(); + + T = gsl_rng_default; + r = gsl_rng_alloc(T); + + gsl_siman_solve(r, &x_initial, E1, S1, M1, P1, + NULL, NULL, NULL, + sizeof(double), params); + + gsl_rng_free (r); + return 0; +} diff --git a/gsl-1.9/doc/examples/sortsmall.c b/gsl-1.9/doc/examples/sortsmall.c new file mode 100644 index 0000000..5b72517 --- /dev/null +++ b/gsl-1.9/doc/examples/sortsmall.c @@ -0,0 +1,38 @@ +#include <gsl/gsl_rng.h> +#include <gsl/gsl_sort_double.h> + +int +main (void) +{ + const gsl_rng_type * T; + gsl_rng * r; + + size_t i, k = 5, N = 100000; + + double * x = malloc (N * sizeof(double)); + double * small = malloc (k * sizeof(double)); + + gsl_rng_env_setup(); + + T = gsl_rng_default; + r = gsl_rng_alloc (T); + + for (i = 0; i < N; i++) + { + x[i] = gsl_rng_uniform(r); + } + + gsl_sort_smallest (small, k, x, 1, N); + + printf ("%d smallest values from %d\n", k, N); + + for (i = 0; i < k; i++) + { + printf ("%d: %.18f\n", i, small[i]); + } + + free (x); + free (small); + gsl_rng_free (r); + return 0; +} diff --git a/gsl-1.9/doc/examples/sortsmall.out b/gsl-1.9/doc/examples/sortsmall.out new file mode 100644 index 0000000..b8c7c93 --- /dev/null +++ b/gsl-1.9/doc/examples/sortsmall.out @@ -0,0 +1,6 @@ +5 smallest values from 100000 +0: 0.000003489200025797 +1: 0.000008199829608202 +2: 0.000008953968062997 +3: 0.000010712770745158 +4: 0.000033531803637743 diff --git a/gsl-1.9/doc/examples/specfun.c b/gsl-1.9/doc/examples/specfun.c new file mode 100644 index 0000000..7c1a9b0 --- /dev/null +++ b/gsl-1.9/doc/examples/specfun.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <gsl/gsl_sf_bessel.h> + +int +main (void) +{ + double x = 5.0; + double expected = -0.17759677131433830434739701; + + double y = gsl_sf_bessel_J0 (x); + + printf ("J0(5.0) = %.18f\n", y); + printf ("exact = %.18f\n", expected); + return 0; +} diff --git a/gsl-1.9/doc/examples/specfun.out b/gsl-1.9/doc/examples/specfun.out new file mode 100644 index 0000000..dbe2443 --- /dev/null +++ b/gsl-1.9/doc/examples/specfun.out @@ -0,0 +1,2 @@ +J0(5.0) = -0.177596771314338292 +exact = -0.177596771314338292 diff --git a/gsl-1.9/doc/examples/specfun_e.c b/gsl-1.9/doc/examples/specfun_e.c new file mode 100644 index 0000000..4f41f2a --- /dev/null +++ b/gsl-1.9/doc/examples/specfun_e.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_sf_bessel.h> + +int +main (void) +{ + double x = 5.0; + gsl_sf_result result; + + double expected = -0.17759677131433830434739701; + + int status = gsl_sf_bessel_J0_e (x, &result); + + printf ("status = %s\n", gsl_strerror(status)); + printf ("J0(5.0) = %.18f\n" + " +/- % .18f\n", + result.val, result.err); + printf ("exact = %.18f\n", expected); + return status; +} diff --git a/gsl-1.9/doc/examples/specfun_e.out b/gsl-1.9/doc/examples/specfun_e.out new file mode 100644 index 0000000..61e1314 --- /dev/null +++ b/gsl-1.9/doc/examples/specfun_e.out @@ -0,0 +1,4 @@ +status = success +J0(5.0) = -0.177596771314338292 + +/- 0.000000000000000193 +exact = -0.177596771314338292 diff --git a/gsl-1.9/doc/examples/stat.c b/gsl-1.9/doc/examples/stat.c new file mode 100644 index 0000000..253f704 --- /dev/null +++ b/gsl-1.9/doc/examples/stat.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <gsl/gsl_statistics.h> + +int +main(void) +{ + double data[5] = {17.2, 18.1, 16.5, 18.3, 12.6}; + double mean, variance, largest, smallest; + + mean = gsl_stats_mean(data, 1, 5); + variance = gsl_stats_variance(data, 1, 5); + largest = gsl_stats_max(data, 1, 5); + smallest = gsl_stats_min(data, 1, 5); + + printf ("The dataset is %g, %g, %g, %g, %g\n", + data[0], data[1], data[2], data[3], data[4]); + + printf ("The sample mean is %g\n", mean); + printf ("The estimated variance is %g\n", variance); + printf ("The largest value is %g\n", largest); + printf ("The smallest value is %g\n", smallest); + return 0; +} diff --git a/gsl-1.9/doc/examples/stat.out b/gsl-1.9/doc/examples/stat.out new file mode 100644 index 0000000..232081d --- /dev/null +++ b/gsl-1.9/doc/examples/stat.out @@ -0,0 +1,5 @@ +The dataset is 17.2, 18.1, 16.5, 18.3, 12.6 +The sample mean is 16.54 +The estimated variance is 4.2984 +The largest value is 18.3 +The smallest value is 12.6 diff --git a/gsl-1.9/doc/examples/statsort.c b/gsl-1.9/doc/examples/statsort.c new file mode 100644 index 0000000..2780f67 --- /dev/null +++ b/gsl-1.9/doc/examples/statsort.c @@ -0,0 +1,36 @@ +#include <stdio.h> +#include <gsl/gsl_sort.h> +#include <gsl/gsl_statistics.h> + +int +main(void) +{ + double data[5] = {17.2, 18.1, 16.5, 18.3, 12.6}; + double median, upperq, lowerq; + + printf ("Original dataset: %g, %g, %g, %g, %g\n", + data[0], data[1], data[2], data[3], data[4]); + + gsl_sort (data, 1, 5); + + printf ("Sorted dataset: %g, %g, %g, %g, %g\n", + data[0], data[1], data[2], data[3], data[4]); + + median + = gsl_stats_median_from_sorted_data (data, + 1, 5); + + upperq + = gsl_stats_quantile_from_sorted_data (data, + 1, 5, + 0.75); + lowerq + = gsl_stats_quantile_from_sorted_data (data, + 1, 5, + 0.25); + + printf ("The median is %g\n", median); + printf ("The upper quartile is %g\n", upperq); + printf ("The lower quartile is %g\n", lowerq); + return 0; +} diff --git a/gsl-1.9/doc/examples/statsort.out b/gsl-1.9/doc/examples/statsort.out new file mode 100644 index 0000000..628522c --- /dev/null +++ b/gsl-1.9/doc/examples/statsort.out @@ -0,0 +1,5 @@ +Original dataset: 17.2, 18.1, 16.5, 18.3, 12.6 +Sorted dataset: 12.6, 16.5, 17.2, 18.1, 18.3 +The median is 17.2 +The upper quartile is 18.1 +The lower quartile is 16.5 diff --git a/gsl-1.9/doc/examples/sum.c b/gsl-1.9/doc/examples/sum.c new file mode 100644 index 0000000..c0237ea --- /dev/null +++ b/gsl-1.9/doc/examples/sum.c @@ -0,0 +1,47 @@ +#include <stdio.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_sum.h> + +#define N 20 + +int +main (void) +{ + double t[N]; + double sum_accel, err; + double sum = 0; + int n; + + gsl_sum_levin_u_workspace * w + = gsl_sum_levin_u_alloc (N); + + const double zeta_2 = M_PI * M_PI / 6.0; + + /* terms for zeta(2) = \sum_{n=1}^{\infty} 1/n^2 */ + + for (n = 0; n < N; n++) + { + double np1 = n + 1.0; + t[n] = 1.0 / (np1 * np1); + sum += t[n]; + } + + gsl_sum_levin_u_accel (t, N, w, &sum_accel, &err); + + printf ("term-by-term sum = % .16f using %d terms\n", + sum, N); + + printf ("term-by-term sum = % .16f using %d terms\n", + w->sum_plain, w->terms_used); + + printf ("exact value = % .16f\n", zeta_2); + printf ("accelerated sum = % .16f using %d terms\n", + sum_accel, w->terms_used); + + printf ("estimated error = % .16f\n", err); + printf ("actual error = % .16f\n", + sum_accel - zeta_2); + + gsl_sum_levin_u_free (w); + return 0; +} diff --git a/gsl-1.9/doc/examples/sum.out b/gsl-1.9/doc/examples/sum.out new file mode 100644 index 0000000..28089e9 --- /dev/null +++ b/gsl-1.9/doc/examples/sum.out @@ -0,0 +1,6 @@ +term-by-term sum = 1.5961632439130233 using 20 terms +term-by-term sum = 1.5759958390005426 using 13 terms +exact value = 1.6449340668482264 +accelerated sum = 1.6449340668166479 using 13 terms +estimated error = 0.0000000000508580 +actual error = -0.0000000000315785 diff --git a/gsl-1.9/doc/examples/vector.c b/gsl-1.9/doc/examples/vector.c new file mode 100644 index 0000000..27462b0 --- /dev/null +++ b/gsl-1.9/doc/examples/vector.c @@ -0,0 +1,22 @@ +#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; +} diff --git a/gsl-1.9/doc/examples/vectorr.c b/gsl-1.9/doc/examples/vectorr.c new file mode 100644 index 0000000..203986b --- /dev/null +++ b/gsl-1.9/doc/examples/vectorr.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <gsl/gsl_vector.h> + +int +main (void) +{ + int i; + gsl_vector * v = gsl_vector_alloc (10); + + { + FILE * f = fopen ("test.dat", "r"); + gsl_vector_fscanf (f, v); + fclose (f); + } + + for (i = 0; i < 10; i++) + { + printf ("%g\n", gsl_vector_get(v, i)); + } + + gsl_vector_free (v); + return 0; +} diff --git a/gsl-1.9/doc/examples/vectorview.c b/gsl-1.9/doc/examples/vectorview.c new file mode 100644 index 0000000..9225c28 --- /dev/null +++ b/gsl-1.9/doc/examples/vectorview.c @@ -0,0 +1,30 @@ +#include <math.h> +#include <stdio.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_blas.h> + +int +main (void) +{ + size_t i,j; + + gsl_matrix *m = gsl_matrix_alloc (10, 10); + + for (i = 0; i < 10; i++) + for (j = 0; j < 10; j++) + gsl_matrix_set (m, i, j, sin (i) + cos (j)); + + for (j = 0; j < 10; j++) + { + gsl_vector_view column = gsl_matrix_column (m, j); + double d; + + d = gsl_blas_dnrm2 (&column.vector); + + printf ("matrix column %d, norm = %g\n", j, d); + } + + gsl_matrix_free (m); + + return 0; +} diff --git a/gsl-1.9/doc/examples/vectorview.out b/gsl-1.9/doc/examples/vectorview.out new file mode 100644 index 0000000..0138c24 --- /dev/null +++ b/gsl-1.9/doc/examples/vectorview.out @@ -0,0 +1,10 @@ +matrix column 0, norm = 4.31461 +matrix column 1, norm = 3.1205 +matrix column 2, norm = 2.19316 +matrix column 3, norm = 3.26114 +matrix column 4, norm = 2.53416 +matrix column 5, norm = 2.57281 +matrix column 6, norm = 4.20469 +matrix column 7, norm = 3.65202 +matrix column 8, norm = 2.08524 +matrix column 9, norm = 3.07313 diff --git a/gsl-1.9/doc/examples/vectorw.c b/gsl-1.9/doc/examples/vectorw.c new file mode 100644 index 0000000..f25468b --- /dev/null +++ b/gsl-1.9/doc/examples/vectorw.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <gsl/gsl_vector.h> + +int +main (void) +{ + int i; + gsl_vector * v = gsl_vector_alloc (100); + + for (i = 0; i < 100; i++) + { + gsl_vector_set (v, i, 1.23 + i); + } + + { + FILE * f = fopen ("test.dat", "w"); + gsl_vector_fprintf (f, v, "%.5g"); + fclose (f); + } + + gsl_vector_free (v); + return 0; +} |