Permalink
Browse files

First Ruby::GSL mapping

  • Loading branch information...
1 parent 0dd92b1 commit 852a07e95a5521f0b0a59c4c919a008ed7b636be @pjotrp committed Apr 11, 2009
@@ -26,7 +26,7 @@ FIND_PACKAGE(MapLibraries REQUIRED)
SET (USE_LANGUAGE "ruby")
SET (USE_LANGUAGE_LIBRARY ${RUBY_LIBRARY})
-SET (USE_SWIG_FLAGS ";-prefix;'${MAP_projectname}::'")
+SET (USE_SWIG_FLAGS "-prefix;'${MAP_projectname}::';${USE_SWIG_FLAGS}")
FIND_PACKAGE(MapSWIG REQUIRED)
@@ -0,0 +1,64 @@
+/* gsl_common includes SWIG mappings shared by all languages */
+
+/* Successfully mapped: */
+
+%include Statistics.i
+%include Sum.i
+/*
+%include BLAS.i
+%include BSpline.i
+%include CDF.i
+%include Combination.i
+%include Complex.i
+%include Const.i
+%include Spline.i
+%include Sys.i
+%include VectorComplex.i
+%include Vector.i
+%include DHT.i
+%include Diff.i
+%include Eigen.i
+%include Histogram2D.i
+%include Histogram.i
+%include Interp.i
+%include Linalg.i
+%include Machine.i
+%include MatrixComplex.i
+%include Matrix.i
+%include Multifit.i
+%include Multimin.i
+%include ODEIV.i
+%include PowInt.i
+%include QRNG.i
+%include RNG.i
+%include SF.i
+%include Siman.i
+%include Wavelet2D.i
+%include Wavelet.i
+*/
+/*
+Succeed when mapped in isolation (need to make modules)
+
+%include FFT.i
+%include Fit.i
+%include IEEEUtils.i
+%include Poly.i
+*/
+/*
+Failing to map:
+
+%include CBLAS.i
+%include Deriv.i
+%include Chebyshev.i
+%include Errno.i
+%include Heapsort.i
+%include Integration.i
+%include Min.i
+%include Monte.i
+%include Multiroots.i
+%include NTuple.i
+%include Permutation.i
+%include Randist.i
+%include Roots.i
+%include Sort.i
+*/
@@ -10,6 +10,7 @@ IF(NOT BUILD_LIBS)
ENDIF(NOT BUILD_LIBS)
SET (USE_SWIG_INCLUDEPATH "../../contrib/math--gsl/swig")
+# SET (USE_SWIG_FLAGS "-debug-module;2")
# INCLUDE(CMakeBackwardCompatibilityC)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ascilib)
@@ -1,3 +1,3 @@
%module gsl
-%include ../../gsl_common.i
+%include ../../gsl_ruby.i
@@ -0,0 +1,3 @@
+#define ASCILIB 1
+#define GSL_MAJOR_VERSION 1
+#define GSL_MINOR_VERSION 12
@@ -0,0 +1,16 @@
+
+require 'ascilib/gsl'
+
+data = [
+ 17, 18, 16, 18, 12,
+ 20, 18, 20, 20, 22,
+ 20, 10, 8, 12, 16,
+ 16, 18, 20, 18, 21
+ ];
+
+# result = Ascilib::gsl_stats_kurtosis(data, 1, 20);
+# raise 'test failed' if result != 766
+result = Ascilib::Gsl.gsl_stats_mean([3,4,5,7],1,4);
+raise 'test failed' if result != 4.75
+
+exit 0

0 comments on commit 852a07e

Please sign in to comment.