Changeset: 0fb74d107207 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0fb74d107207 Added Files: sql/backends/monet5/gsl/46_gsl.sql sql/backends/monet5/gsl/73_gsl.mal sql/backends/monet5/gsl/Makefile.ag sql/backends/monet5/gsl/Tests/All sql/backends/monet5/gsl/Tests/gsl00.mal sql/backends/monet5/gsl/Tests/gsl00.stable.err sql/backends/monet5/gsl/Tests/gsl00.stable.out sql/backends/monet5/gsl/Tests/gsl01.sql sql/backends/monet5/gsl/Tests/gsl01.stable.err sql/backends/monet5/gsl/Tests/gsl01.stable.out sql/backends/monet5/gsl/gsl.c sql/backends/monet5/gsl/gsl.mal Modified Files: configure.ag sql/backends/monet5/Makefile.ag Branch: default Log Message:
add wrapper for gsl function for Bart diffs (truncated from 459 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -234,6 +234,13 @@ AC_ARG_ENABLE(jsonstore, enable_jsonstore=$enableval, enable_jsonstore=$dft_jsonstore) +dft_gsl=auto +AC_ARG_ENABLE(gsl, + AS_HELP_STRING([--enable-gsl], + [enable support for GSL (default=no)]), + enable_gsl=$enableval, + enable_gsl=$dft_gsl) + dft_odbc=auto AC_ARG_ENABLE(odbc, AS_HELP_STRING([--enable-odbc], @@ -2453,6 +2460,18 @@ if test "x$enable_jsonstore" != xno; the esac fi +dnl Check for gsl library for statistical functions +org_have_gsl=no +have_gsl=$org_have_gsl +if test "x$enable_gsl" != xno; then + PKG_CHECK_MODULES([gsl], [gsl], + [have_gsl=yes; AC_DEFINE(HAVE_GSL, 1, [Define if you have the gsl library])], + [have_gsl=no; why_have_gsl="(gsl library not found)" + if test "x$enable_gsl" = xyes; then AC_MSG_ERROR([gsl library required for GSL support]); fi; + enable_gsl=no; disable_gsl="(gsl library not found)"]) +fi +AM_CONDITIONAL(HAVE_GSL, test x"$have_gsl" != xno) + dnl checks for header files AC_HEADER_STDBOOL AC_HEADER_STDC @@ -3266,6 +3285,7 @@ for comp in \ 'jaql ' \ 'jsonstore' \ 'geom ' \ + 'gsl ' \ 'fits ' \ 'rdf ' \ 'datacell ' \ @@ -3293,6 +3313,7 @@ for comp in \ 'curl ' \ 'geos ' \ 'getaddrinfo ' \ + 'gsl ' \ 'hwcounters ' \ 'java ' \ 'java_control ' \ diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag --- a/sql/backends/monet5/Makefile.ag +++ b/sql/backends/monet5/Makefile.ag @@ -15,7 +15,7 @@ # Copyright August 2008-2013 MonetDB B.V. # All Rights Reserved. -SUBDIRS = NOT_WIN32?vaults UDF LSST ENABLE_DATACELL?datacell HAVE_JSONSTORE?rest +SUBDIRS = NOT_WIN32?vaults UDF LSST ENABLE_DATACELL?datacell HAVE_JSONSTORE?rest HAVE_GSL?gsl INCLUDES = ../../include ../../common ../../storage ../../server \ ../../../monetdb5/modules/atoms \ diff --git a/sql/backends/monet5/gsl/46_gsl.sql b/sql/backends/monet5/gsl/46_gsl.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/46_gsl.sql @@ -0,0 +1,22 @@ +-- The contents of this file are subject to the MonetDB Public License +-- Version 1.1 (the "License"); you may not use this file except in +-- compliance with the License. You may obtain a copy of the License at +-- http://www.monetdb.org/Legal/MonetDBLicense +-- +-- Software distributed under the License is distributed on an "AS IS" +-- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +-- License for the specific language governing rights and limitations +-- under the License. +-- +-- The Original Code is the MonetDB Database System. +-- +-- The Initial Developer of the Original Code is CWI. +-- Copyright August 2008-2013 MonetDB B.V. +-- All Rights Reserved. + +-- (co) Arjen de Rijke, Bart Scheers +-- Use statistical functions from gsl library + +-- Calculate Chi squared probability +create function sys.chi2prob(chi2 double, datapoints double) +returns double external name gsl."chi2prob"; diff --git a/sql/backends/monet5/gsl/73_gsl.mal b/sql/backends/monet5/gsl/73_gsl.mal new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/73_gsl.mal @@ -0,0 +1,18 @@ +# The contents of this file are subject to the MonetDB Public License +# Version 1.1 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://www.monetdb.org/Legal/MonetDBLicense +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the specific language governing rights and limitations +# under the License. +# +# The Original Code is the MonetDB Database System. +# +# The Initial Developer of the Original Code is CWI. +# Portions created by CWI are Copyright (C) 1997-July 2008 CWI. +# Copyright August 2008-2013 MonetDB B.V. +# All Rights Reserved. + +include gsl; diff --git a/sql/backends/monet5/gsl/Makefile.ag b/sql/backends/monet5/gsl/Makefile.ag new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/Makefile.ag @@ -0,0 +1,54 @@ +# The contents of this file are subject to the MonetDB Public License +# Version 1.1 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://www.monetdb.org/Legal/MonetDBLicense +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the specific language governing rights and limitations +# under the License. +# +# The Original Code is the MonetDB Database System. +# +# The Initial Developer of the Original Code is CWI. +# Portions created by CWI are Copyright (C) 1997-July 2008 CWI. +# Copyright August 2008-2013 MonetDB B.V. +# All Rights Reserved. + +INCLUDES = ../../../../monetdb5/mal \ + ../../../../common/options \ + ../../../../common/stream \ + ../../../../common/utils \ + ../../../../gdk + +lib__gsl = { + MODULE + COND = HAVE_GSL + DIR = libdir/monetdb5 + SOURCES = gsl.c + LIBS = $(gsl_LIBS) +} + +headers_gslmal = { + COND = HAVE_GSL + HEADERS = mal + DIR = libdir/monetdb5 + SOURCES = gsl.mal +} + +headers_gslautoload = { + COND = HAVE_GSL + HEADERS = mal + DIR = libdir/monetdb5/autoload + SOURCES = 73_gsl.mal +} + +headers_gsl = { + COND = HAVE_GSL + HEADERS = sql + DIR = libdir/monetdb5/createdb + SOURCES = 46_gsl.sql +} + +EXTRA_DIST_DIR = Tests +EXTRA_DIST = 73_gsl.mal gsl.mal diff --git a/sql/backends/monet5/gsl/Tests/All b/sql/backends/monet5/gsl/Tests/All new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/Tests/All @@ -0,0 +1,2 @@ +gsl00 +gsl01 diff --git a/sql/backends/monet5/gsl/Tests/gsl00.mal b/sql/backends/monet5/gsl/Tests/gsl00.mal new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/Tests/gsl00.mal @@ -0,0 +1,4 @@ +a:=20:dbl; +b:=5:dbl; +c:=gsl.chi2prob(a,b); +io.print(c); diff --git a/sql/backends/monet5/gsl/Tests/gsl00.stable.err b/sql/backends/monet5/gsl/Tests/gsl00.stable.err new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/Tests/gsl00.stable.err @@ -0,0 +1,29 @@ +stderr of test 'gsl00` in directory 'sql/backends/monet5/gsl` itself: + + +# 15:55:26 > +# 15:55:26 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=36073" "--set" "mapi_usock=/var/tmp/mtest-19131/.s.monetdb.36073" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_backends_monet5_gsl" "gsl00.mal" +# 15:55:26 > + +# builtin opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 36073 +# cmdline opt mapi_usock = /var/tmp/mtest-19131/.s.monetdb.36073 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_backends_monet5_gsl + +# 15:55:26 > +# 15:55:26 > "Done." +# 15:55:26 > + diff --git a/sql/backends/monet5/gsl/Tests/gsl00.stable.out b/sql/backends/monet5/gsl/Tests/gsl00.stable.out new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/Tests/gsl00.stable.out @@ -0,0 +1,32 @@ +stdout of test 'gsl00` in directory 'sql/backends/monet5/gsl` itself: + + +# 15:55:26 > +# 15:55:26 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=36073" "--set" "mapi_usock=/var/tmp/mtest-19131/.s.monetdb.36073" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_backends_monet5_gsl" "gsl00.mal" +# 15:55:26 > + +# MonetDB 5 server v11.16.0 +# This is an unreleased version +# Serving database 'mTests_sql_backends_monet5_gsl', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 15.592 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://rotterdam.ins.cwi.nl:36073/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-19131/.s.monetdb.36073 +# MonetDB/GIS module loaded +# MonetDB/JAQL module loaded +# MonetDB/SQL module loaded +function user.main():void; + a := 20:dbl; + b := 5:dbl; + c := gsl.chi2prob(a,b); + io.print(c); +end main; +[ 0.0012497305630313768 ] + +# 15:55:26 > +# 15:55:26 > "Done." +# 15:55:26 > + diff --git a/sql/backends/monet5/gsl/Tests/gsl01.sql b/sql/backends/monet5/gsl/Tests/gsl01.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/Tests/gsl01.sql @@ -0,0 +1,1 @@ +SELECT gsl.chi2prob(20.0,5.0); diff --git a/sql/backends/monet5/gsl/Tests/gsl01.stable.err b/sql/backends/monet5/gsl/Tests/gsl01.stable.err new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/gsl/Tests/gsl01.stable.err @@ -0,0 +1,35 @@ +stderr of test 'gsl01` in directory 'sql/backends/monet5/gsl` itself: + + +# 15:55:26 > +# 15:55:26 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=36073" "--set" "mapi_usock=/var/tmp/mtest-19131/.s.monetdb.36073" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_backends_monet5_gsl" "--set" "mal_listing=0" +# 15:55:26 > + +# builtin opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 36073 +# cmdline opt mapi_usock = /var/tmp/mtest-19131/.s.monetdb.36073 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /export/scratch2/rijke/monetdb/default/var/MonetDB/mTests_sql_backends_monet5_gsl +# cmdline opt mal_listing = 0 + +# 15:55:27 > +# 15:55:27 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-19131" "--port=36073" +# 15:55:27 > _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list