summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Laboissiere <rafael@debian.org>2018-04-24 09:04:38 -0300
committerRafael Laboissiere <rafael@debian.org>2018-04-24 09:04:38 -0300
commite14c8b157d3e9b95c0fd22c87761007aabb32a32 (patch)
tree0f71a6816ea3b99f149b293a80c9802e91064776
parentb0660d88a5c0bb689dc770b741b098ccf2901733 (diff)
parentb9c223bd4cd58caccb5ad784e215e8dbdc46e243 (diff)
Update upstream source from tag 'upstream/0.3.5'
Update to upstream version '0.3.5' with Debian dir 74bed3278e5dee6469f486349a17eaaebae9f28f
-rw-r--r--.gitignore14
-rw-r--r--.hgignore30
-rw-r--r--DESCRIPTION6
-rw-r--r--Makefile241
-rw-r--r--NEWS8
-rw-r--r--inst/optiminterp1.m44
-rw-r--r--inst/optiminterp2.m126
-rw-r--r--inst/optiminterp3.m48
-rw-r--r--inst/optiminterp4.m53
-rw-r--r--inst/optiminterpn.m27
-rw-r--r--inst/test_optiminterp.m162
-rw-r--r--inst/test_optiminterp_err.m105
-rw-r--r--inst/test_optiminterp_mult.m174
-rw-r--r--src/Makeconf.in64
-rw-r--r--src/Makefile.in (renamed from src/Makefile)28
-rwxr-xr-xsrc/autogen.sh27
-rwxr-xr-xsrc/bootstrap4
-rwxr-xr-xsrc/configure709
-rw-r--r--src/configure.ac193
-rw-r--r--src/configure.base372
-rw-r--r--src/optimal_interpolation.F9030
-rw-r--r--src/optiminterp.cc27
22 files changed, 1029 insertions, 1463 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index f9961e7..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,14 +0,0 @@
-global-list
-local-list
-debian/files
-debian/octave-optiminterp*
-.pc/
-/debian/.debhelper/
-inst/*-api-v*/
-src/Makeconf
-src/config.log
-src/config.status
-src/optimal_interpolation.mod
-src/*.o
-src/*.oct
-/debian/debhelper-build-stamp
diff --git a/.hgignore b/.hgignore
new file mode 100644
index 0000000..0da9d96
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,30 @@
+syntax: regexp
+# The recurrent (^|/) idiom in the regexps below should be understood
+# to mean "at any directory" while the ^ idiom means "from the
+# project's top-level directory".
+
+(^|/).*\.dvi$
+(^|/).*\.pdf$
+(^|/).*\.o$
+(^|/).*\.oct$
+(^|/).*\.octlink$
+(^|/)octave-core$
+(^|/).*\.tar\.gz$
+
+(^|/)aclocal\.m4$
+(^|/)configure$
+(^|/)autom4te\.cache($|/)
+
+# e.g. doc/faq/OctaveFAQ.info
+# doc/interpreter/octave.info-4
+^doc/.*\.info(-\d)?$
+
+^doc/\w*/stamp-vti$
+^doc/\w*/version\.texi$
+
+# Emacs tools create these
+(^|/)TAGS$
+(^|/)semantic.cache$
+
+# Other text editors often create these
+(^|/)~.*
diff --git a/DESCRIPTION b/DESCRIPTION
index 95bf1e3..ecadf65 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
Name: optiminterp
-Version: 0.3.4
-Date: 2013-02-22
+Version: 0.3.5
+Date: 2018-04-15
Author: Alexander Barth <barth.alexander@gmail.com>, Aida Alvera-Azcárate <aalvera@marine.usf.edu>
-Maintainer: Alexander Barth <barth.alexander@gmail.com>
+Maintainer: Alexander Barth <barth.alexander@gmail.com>, John Donoghue <john.donoghue@ieee.org>
Title: optiminterp
Description: An optimal interpolation toolbox for octave. This package provides functions to perform a n-dimensional optimal interpolations of arbitrarily distributed data points.
Depends: octave (>= 2.9.9)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b3fe537
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,241 @@
+## Copyright 2015-2016 Carnë Draug
+## Copyright 2015-2016 Oliver Heimlich
+## Copyright 2017 Julien Bect <jbect@users.sf.net>
+## Copyright 2017 Olaf Till <i7tiol@t-online.de>
+## Copyright 2018 John Donoghue <john.donoghue@ieee.org>
+##
+## Copying and distribution of this file, with or without modification,
+## are permitted in any medium without royalty provided the copyright
+## notice and this notice are preserved. This file is offered as-is,
+## without any warranty.
+
+## Some basic tools (can be overriden using environment variables)
+SED ?= sed
+TAR ?= tar
+GREP ?= grep
+CUT ?= cut
+TR ?= tr
+
+## Note the use of ':=' (immediate set) and not just '=' (lazy set).
+## http://stackoverflow.com/a/448939/1609556
+package := $(shell $(GREP) "^Name: " DESCRIPTION | $(CUT) -f2 -d" " | \
+$(TR) '[:upper:]' '[:lower:]')
+version := $(shell $(GREP) "^Version: " DESCRIPTION | $(CUT) -f2 -d" ")
+
+## These are the paths that will be created for the releases.
+target_dir := target
+release_dir := $(target_dir)/$(package)-$(version)
+release_tarball := $(target_dir)/$(package)-$(version).tar.gz
+html_dir := $(target_dir)/$(package)-html
+html_tarball := $(target_dir)/$(package)-html.tar.gz
+## Using $(realpath ...) avoids problems with symlinks due to bug
+## #50994 in Octaves scripts/pkg/private/install.m. But at least the
+## release directory above is needed in the relative form, for 'git
+## archive --format=tar --prefix=$(release_dir).
+real_target_dir := $(realpath .)/$(target_dir)
+installation_dir := $(real_target_dir)/.installation
+package_list := $(installation_dir)/.octave_packages
+install_stamp := $(installation_dir)/.install_stamp
+
+## These can be set by environment variables which allow to easily
+## test with different Octave versions.
+ifndef OCTAVE
+OCTAVE := octave
+endif
+OCTAVE := $(OCTAVE) --no-gui --silent --norc
+MKOCTFILE ?= mkoctfile
+
+## Command used to set permissions before creating tarballs
+FIX_PERMISSIONS ?= chmod -R a+rX,u+w,go-w,ug-s
+
+## Detect which VCS is used
+vcs := $(if $(wildcard .hg),hg,$(if $(wildcard .git),git,unknown))
+ifeq ($(vcs),hg)
+release_dir_dep := .hg/dirstate
+endif
+ifeq ($(vcs),git)
+release_dir_dep := .git/index
+endif
+
+
+## .PHONY indicates targets that are not filenames
+## (https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html)
+.PHONY: help
+
+## make will display the command before runnning them. Use @command
+## to not display it (makes specially sense for echo).
+help:
+ @echo "Targets:"
+ @echo " dist - Create $(release_tarball) for release."
+ @echo " html - Create $(html_tarball) for release."
+ @echo " release - Create both of the above and show md5sums."
+ @echo " install - Install the package in $(installation_dir), where it is not visible in a normal Octave session."
+ @echo " check - Execute package tests."
+ @echo " doctest - Test the help texts with the doctest package."
+ @echo " run - Run Octave with the package installed in $(installation_dir) in the path."
+ @echo " clean - Remove everything made with this Makefile."
+
+
+##
+## Recipes for release tarballs (package + html)
+##
+
+.PHONY: release dist html clean-tarballs clean-unpacked-release
+
+## To make a release, build the distribution and html tarballs.
+release: dist html
+ md5sum $(release_tarball) $(html_tarball)
+ @echo "Upload @ https://sourceforge.net/p/octave/package-releases/new/"
+ @echo " and note the changeset the release corresponds to"
+
+## dist and html targets are only PHONY/alias targets to the release
+## and html tarballs.
+dist: $(release_tarball)
+html: $(html_tarball)
+
+## An implicit rule with a recipe to build the tarballs correctly.
+%.tar.gz: %
+ $(TAR) -c -f - --posix -C "$(target_dir)/" "$(notdir $<)" | gzip -9n > "$@"
+
+clean-tarballs:
+ @echo "## Cleaning release tarballs (package + html)..."
+ -$(RM) $(release_tarball) $(html_tarball)
+ @echo
+
+## Create the unpacked package.
+##
+## Notes:
+## * having ".hg/dirstate" (or ".git/index") as a prerequesite means it is
+## only rebuilt if we are at a different commit.
+## * the variable RM usually defaults to "rm -f"
+## * having this recipe separate from the one that makes the tarball
+## makes it easy to have packages in alternative formats (such as zip)
+## * note that if a commands needs to be run in a specific directory,
+## the command to "cd" needs to be on the same line. Each line restores
+## the original working directory.
+$(release_dir): $(release_dir_dep)
+ -$(RM) -r "$@"
+ifeq (${vcs},hg)
+ hg archive --exclude ".hg*" --type files "$@"
+endif
+ifeq (${vcs},git)
+ git archive --format=tar --prefix="$@/" HEAD | $(TAR) -x
+ $(RM) "$@/.gitignore"
+endif
+## Don't fall back to run the supposed necessary contents of
+## 'bootstrap' here. Users are better off if they provide
+## 'bootstrap'. Administrators, checking build reproducibility, can
+## put in the missing 'bootstrap' file if they feel they know its
+## necessary contents.
+ifneq (,$(wildcard src/bootstrap))
+ cd "$@/src" && ./bootstrap && $(RM) -r "autom4te.cache"
+endif
+## Uncomment this if your src/Makefile.in has these targets for
+## pre-building something for the release (e.g. documentation).
+# cd "$@/src" && ./configure && $(MAKE) prebuild && \
+# $(MAKE) distclean && $(RM) Makefile
+##
+ ${FIX_PERMISSIONS} "$@"
+
+run_in_place = $(OCTAVE) --eval ' pkg ("local_list", "$(package_list)"); ' \
+ --eval ' pkg ("load", "$(package)"); '
+
+# html_options = --eval 'options = get_html_options ("octave-forge");'
+## Uncomment this for package documentation.
+html_options = --eval 'options = get_html_options ("octave-forge");'
+#html_options = --eval 'options = get_html_options ("octave-forge");' \
+# --eval 'options.package_doc = "$(package).texi";'
+$(html_dir): $(install_stamp)
+ $(RM) -r "$@";
+ $(run_in_place) \
+ --eval ' pkg load generate_html; ' \
+ $(html_options) \
+ --eval ' generate_package_html ("$(package)", "$@", options); ';
+ $(FIX_PERMISSIONS) "$@";
+
+clean-unpacked-release:
+ @echo "## Cleaning unpacked release tarballs (package + html)..."
+ -$(RM) -r $(release_dir) $(html_dir)
+ @echo
+
+##
+## Recipes for installing the package.
+##
+
+.PHONY: install clean-install
+
+octave_install_commands = \
+' llist_path = pkg ("local_list"); \
+ mkdir ("$(installation_dir)"); \
+ load (llist_path); \
+ local_packages(cellfun (@ (x) strcmp ("$(package)", x.name), local_packages)) = []; \
+ save ("$(package_list)", "local_packages"); \
+ pkg ("local_list", "$(package_list)"); \
+ pkg ("prefix", "$(installation_dir)", "$(installation_dir)"); \
+ pkg ("install", "-local", "-verbose", "$(release_tarball)"); '
+
+## Install unconditionally. Maybe useful for testing installation with
+## different versions of Octave.
+install: $(release_tarball)
+ @echo "Installing package under $(installation_dir) ..."
+ $(OCTAVE) --eval $(octave_install_commands)
+ touch $(install_stamp)
+
+## Install only if installation (under target/...) is not current.
+$(install_stamp): $(release_tarball)
+ @echo "Installing package under $(installation_dir) ..."
+ $(OCTAVE) --eval $(octave_install_commands)
+ touch $(install_stamp)
+
+clean-install:
+ @echo "## Cleaning installation under $(installation_dir) ..."
+ -$(RM) -r $(installation_dir)
+ @echo
+
+
+##
+## Recipes for testing purposes
+##
+
+.PHONY: run doctest check
+
+## Start an Octave session with the package directories on the path for
+## interactice test of development sources.
+run: $(install_stamp)
+ $(run_in_place) --persist
+
+## Test example blocks in the documentation. Needs doctest package
+## https://octave.sourceforge.io/doctest/index.html
+doctest: $(install_stamp)
+ $(run_in_place) --eval 'pkg load doctest;' \
+ --eval "targets = '$(shell (cd inst && ls *.m) | $(CUT) -f2 -d@ | $(CUT) -f1 -d.)';" \
+ --eval "targets = strsplit (targets, ' '); doctest (targets);"
+
+
+## Test package.
+octave_test_commands = \
+' dirs = {"inst", "src"}; \
+ dirs(cellfun (@ (x) ! isdir (x), dirs)) = []; \
+ if (isempty (dirs)) error ("no \"inst\" or \"src\" directory"); exit (1); \
+ else __run_test_suite__ (dirs, {}); endif '
+## the following works, too, but provides no overall summary output as
+## __run_test_suite__ does:
+##
+## else cellfun (@runtests, horzcat (cellfun (@ (dir) ostrsplit (([~, dirs] = system (sprintf ("find %s -type d", dir))), "\n\r", true), dirs, "UniformOutput", false){:})); endif '
+check: $(install_stamp)
+ $(run_in_place) --eval $(octave_test_commands)
+
+
+##
+## CLEAN
+##
+
+.PHONY: clean
+
+clean: clean-tarballs clean-unpacked-release clean-install
+ @echo "## Removing target directory (if empty)..."
+ -rmdir $(target_dir)
+ @echo
+ @echo "## Cleaning done"
+ @echo
+
diff --git a/NEWS b/NEWS
index 804f94f..79a492d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Summary of important user-visible changes for optiminterp 0.3.5:
+-------------------------------------------------------------------
+
+ ** Update build scripts for octave 4.4 (Bug #51498)
+
+ ** Move test scripts into embedded test blocks
+
+
Summary of important user-visible changes for optiminterp 0.3.4:
-------------------------------------------------------------------
diff --git a/inst/optiminterp1.m b/inst/optiminterp1.m
index c3f1e83..95bf3d0 100644
--- a/inst/optiminterp1.m
+++ b/inst/optiminterp1.m
@@ -1,4 +1,4 @@
-## Copyright (C) 2006 Alexander Barth <barth.alexander@gmail.com>
+## Copyright (C) 2006-2018 Alexander Barth <barth.alexander@gmail.com>
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
@@ -39,3 +39,45 @@ function [fi,vari] = optiminterp1(x,f,var,lenx,m,xi)
[fi,vari] = optiminterpn(x,f,var,lenx,m,xi);
endfunction
+
+%!test
+%! # grid of background field
+%! xi = linspace(0,1,50);
+%! fi_ref = sin( xi*6 );
+%!
+%! # grid of observations
+%! x = linspace(0,1,20);
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f = sin( x*6 );
+%!
+%! m = 15;
+%!
+%! [fi,vari] = optiminterp1(x,f,var,0.1,m,xi);
+%!
+%! rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
+%!
+%! assert (rms <= 0.005, "unexpected large difference with reference field");
+
+%!test
+%! # grid of background field
+%! xi = linspace(0,1,50)';
+%! fi_ref(:,1) = sin( xi*6 );
+%! fi_ref(:,2) = cos( xi*6 );
+%!
+%! # grid of observations
+%! x = linspace(0,1,20)';
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f(:,1) = sin( x*6 );
+%! f(:,2) = cos( x*6 );
+%!
+%! m = 15;
+%!
+%! [fi,vari] = optiminterp1(x,f,var,0.1,m,xi);
+%!
+%! rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
+%!
+%! assert (rms <= 0.005, "unexpected large difference with reference field");
diff --git a/inst/optiminterp2.m b/inst/optiminterp2.m
index a7fae69..b135a6a 100644
--- a/inst/optiminterp2.m
+++ b/inst/optiminterp2.m
@@ -1,4 +1,4 @@
-## Copyright (C) 2006 Alexander Barth <barth.alexander@gmail.com>
+## Copyright (C) 2006-2018 Alexander Barth <barth.alexander@gmail.com>
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
@@ -42,3 +42,127 @@ function [fi,vari] = optiminterp2(x,y,f,var,lenx,leny,m,xi,yi)
[fi,vari] = optiminterpn(x,y,f,var,lenx,leny,m,xi,yi);
endfunction
+
+%!test
+%! # grid of background field
+%! [xi,yi] = ndgrid(linspace(0,1,30));
+%! fi_ref = sin( xi*6 ) .* cos( yi*6);
+%!
+%! # grid of observations
+%! [x,y] = ndgrid(linspace(0,1,20));
+%! x = x(:);
+%! y = y(:);
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f = sin( x*6 ) .* cos( y*6);
+%!
+%! m = 30;
+%!
+%! [fi,vari] = optiminterp2(x,y,f,var,0.1,0.1,m,xi,yi);
+%!
+%! rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
+%!
+%! assert (rms <= 0.005, "unexpected large difference with reference field");
+
+%!test
+%! # grid of background field
+%! [xi,yi] = ndgrid(linspace(0,1,30));
+%!
+%! fi_ref(:,:,1) = sin( xi*6 ) .* cos( yi*6);
+%! fi_ref(:,:,2) = cos( xi*6 ) .* sin( yi*6);
+%!
+%! # grid of observations
+%! [x,y] = ndgrid(linspace(0,1,20));
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f(:,:,1) = sin( x*6 ) .* cos( y*6);
+%! f(:,:,2) = cos( x*6 ) .* sin( y*6);
+%!
+%! m = 30;
+%!
+%! [fi,vari] = optiminterp2(x,y,f,var,0.1,0.1,m,xi,yi);
+%!
+%! rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
+%!
+%! assert (rms <= 0.005, "unexpected large difference with reference field");
+
+%!test
+%! # grid of background field
+%! [xi,yi] = ndgrid(linspace(0,1,30));
+%! fi_ref = sin( xi*6 ) .* cos( yi*6);
+%!
+%! # grid of observations
+%! [x,y] = ndgrid(linspace(0,1,6));
+%! x = x(:);
+%! y = y(:);
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f = sin( x*6 ) .* cos( y*6);
+%!
+%! len = 0.1;
+%! m = min(30,on);
+%!
+%! # covariance function
+%! # gaussian
+%! bcovar2 = @(d2) exp(-d2/len^2) ;
+%! # diva
+%! #bcovar2 = @(d2) max(sqrt(d2)/len,eps) .* besselk(1,max(sqrt(d2)/len,eps));
+%!
+%! # P: covariance between grid points (xi,yi) and grid points (xi,yi)
+%! P = zeros(numel(xi),numel(xi));
+%!
+%! for j=1:numel(xi)
+%! for i=1:numel(xi)
+%! P(i,j) = (xi(i) - xi(j))^2 + (yi(i) - yi(j))^2;
+%! end
+%! end
+%! P = bcovar2(P);
+%!
+%! # HPH: covariance between observation points (x,y) and observation points (x,y)
+%! HPH = zeros(numel(x),numel(x));
+%!
+%! for j=1:numel(x)
+%! for i=1:numel(x)
+%! HPH(i,j) = (x(i) - x(j))^2 + (y(i) - y(j))^2;
+%! end
+%! end
+%! HPH = bcovar2(HPH);
+%!
+%! # PH: covariance between grid points (xi,yi) and observation points (x,y)
+%! PH = zeros(numel(xi),numel(x));
+%!
+%! for j=1:numel(x)
+%! for i=1:numel(xi)
+%! PH(i,j) = (xi(i) - x(j))^2 + (yi(i) - y(j))^2;
+%! end
+%! end
+%! PH = bcovar2(PH);
+%!
+%! R = diag(var);
+%!
+%! # call optiminterp
+%! [fi,vari] = optiminterp2(x,y,f,var,len,len,m,xi,yi);
+%!
+%! # Kalman gain
+%! K = PH * inv(HPH + R);
+%!
+%! # analysis
+%! fi2 = K * f;
+%!
+%! # error field
+%! vari2 = diag(P - K * PH');
+%!
+%! # transform vectors into 2d-arrays
+%! fi2 = reshape(fi2,size(fi));
+%! vari2 = reshape(vari2,size(fi));
+%!
+%! rms = sqrt(mean((fi2(:) - fi(:)).^2));
+%!
+%! assert (rms <= 1e-4, "unexpected large RMS difference (analysis)");
+%!
+%! rms = sqrt(mean((vari2(:) - vari(:)).^2));
+%!
+%! assert (rms <= 1e-4, "unexpected large RMS difference (error field)");
diff --git a/inst/optiminterp3.m b/inst/optiminterp3.m
index f8686f8..4172859 100644
--- a/inst/optiminterp3.m
+++ b/inst/optiminterp3.m
@@ -1,4 +1,4 @@
-## Copyright (C) 2006 Alexander Barth <barth.alexander@gmail.com>
+## Copyright (C) 2006-2018 Alexander Barth <barth.alexander@gmail.com>
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
@@ -44,3 +44,49 @@ function [fi,vari] = optiminterp3(x,y,z,f,var,lenx,leny,lenz,m,xi,yi,zi)
[fi,vari] = optiminterpn(x,y,z,f,var,lenx,leny,lenz,m,xi,yi,zi);
endfunction
+
+%!test
+%! # grid of background field
+%! [xi,yi,zi] = ndgrid(linspace(0,1,15));
+%! fi_ref = sin(6*xi) .* cos(6*yi) .* sin(6*zi);
+%!
+%! # grid of observations
+%! [x,y,z] = ndgrid(linspace(0,1,10));
+%! x = x(:);
+%! y = y(:);
+%! z = z(:);
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f = sin(6*x) .* cos(6*y) .* sin(6*z);
+%!
+%! m = 20;
+%!
+%! [fi,vari] = optiminterp3(x,y,z,f,var,0.1,0.1,0.1,m,xi,yi,zi);
+%!
+%! rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
+%!
+%! assert (rms <= 0.04, "'unexpected large difference with reference field");
+
+%!test
+%! # grid of background field
+%! [xi,yi,zi] = ndgrid(linspace(0,1,15));
+%!
+%! fi_ref(:,:,:,1) = sin(6*xi) .* cos(6*yi) .* sin(6*zi);
+%! fi_ref(:,:,:,2) = cos(6*xi) .* sin(6*yi) .* cos(6*zi);
+%!
+%! # grid of observations
+%! [x,y,z] = ndgrid(linspace(0,1,10));
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f(:,:,:,1) = sin(6*x) .* cos(6*y) .* sin(6*z);
+%! f(:,:,:,2) = cos(6*x) .* sin(6*y) .* cos(6*z);
+%!
+%! m = 20;
+%!
+%! [fi,vari] = optiminterp3(x,y,z,f,var,0.1,0.1,0.1,m,xi,yi,zi);
+%!
+%! rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
+%!
+%! assert (rms <= 0.04, "'unexpected large difference with reference field");
diff --git a/inst/optiminterp4.m b/inst/optiminterp4.m
index f129b9a..9e7e87b 100644
--- a/inst/optiminterp4.m
+++ b/inst/optiminterp4.m
@@ -1,5 +1,5 @@
## Copyright (C) 2007 Aida Alvera-Azcárate <aalvera@marine.usf.edu>
-## Copyright (C) 2007 Alexander Barth <barth.alexander@gmail.com>
+## Copyright (C) 2007, 2018 Alexander Barth <barth.alexander@gmail.com>
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
@@ -45,3 +45,54 @@ function [fi,vari] = optiminterp4(x,y,z,t,f,var,lenx,leny,lenz,lent,m,xi,yi,zi,t
[fi,vari] = optiminterpn(x,y,z,t,f,var,lenx,leny,lenz,lent,m,xi,yi,zi,ti);
endfunction
+
+%!test
+%! # grid of background field
+%! [xi,yi,zi,ti] = ndgrid(linspace(0,1,5));
+%! fi_ref = sin(6*xi) .* cos(6*yi) .* sin(6*zi) .* cos(6*ti);
+%!
+%! # grid of observations
+%! [x,y,z,t] = ndgrid(linspace(0,1,10));
+%! x = x(:);
+%! y = y(:);
+%! z = z(:);
+%! t = t(:);
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f = sin(6*x) .* cos(6*y) .* sin(6*z) .* cos(6*t);
+%!
+%! m = 20;
+%!
+%! [fi,vari] = optiminterp4(x,y,z,t,f,var,0.1,0.1,0.1,0.1,m,xi,yi,zi,ti);
+%!
+%! rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
+%!
+%! assert (rms <= 0.04, "unexpected large difference with reference field");
+
+%!test
+%! # grid of background field
+%! [xi,yi,zi,ti] = ndgrid(linspace(0,1,5));
+%!
+%! fi_ref(:,:,:,:,1) = sin(6*xi) .* cos(6*yi) .* sin(6*zi) .* cos(6*ti);
+%! fi_ref(:,:,:,:,2) = cos(6*xi) .* sin(6*yi) .* cos(6*zi) .* sin(6*ti);
+%!
+%! # grid of observations
+%! [x,y,z,t] = ndgrid(linspace(0,1,10));
+%! x = x(:);
+%! y = y(:);
+%! z = z(:);
+%! t = t(:);
+%!
+%! on = numel(x);
+%! var = 0.01 * ones(on,1);
+%! f(:,:,:,:,1) = sin(6*x) .* cos(6*y) .* sin(6*z) .* cos(6*t);
+%! f(:,:,:,:,2) = cos(6*x) .* sin(6*y) .* cos(6*z) .* sin(6*t);
+%!
+%! m = 20;
+%!
+%! [fi,vari] = optiminterp4(x,y,z,t,f,var,0.1,0.1,0.1,0.1,m,xi,yi,zi,ti);
+%!
+%! rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
+%!
+%! assert (rms <= 0.04, "unexpected large difference with reference field");
diff --git a/inst/optiminterpn.m b/inst/optiminterpn.m
index 3c1f46b..c7c4dd8 100644
--- a/inst/optiminterpn.m
+++ b/inst/optiminterpn.m
@@ -1,4 +1,4 @@
-## Copyright (C) 2008 Alexander Barth <barth.alexander@gmail.com>
+## Copyright (C) 2008-2018 Alexander Barth <barth.alexander@gmail.com>
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
@@ -91,8 +91,31 @@ end
f=reshape(f,[on nf]);
-%whos ox f var len m gx
+% whos ox f var len m gx
[fi,vari] = optiminterp(ox,f,var,len,m,gx);
fi = reshape(fi,[gsz nf]);
vari = reshape(vari,gsz);
+
+end
+
+% alculation parts will be tested from optiminterp1.m, optiminterp1.m etc
+% so only testing the invalid inpouts calls here
+%!error <wrong number of arguments> optiminterpn ()
+
+%!error <wrong number of arguments> optiminterpn (1)
+
+%!error <wrong number of arguments> optiminterpn (1,2)
+
+%!test
+%! # grid of background field
+%! xi = linspace(0,1,50);
+%!
+%! # grid of observations
+%! x = linspace(0,1,20);
+%!
+%! on = numel(x) + 1;
+%! var = 0.01 * ones(on,1);
+%! f = sin( x*6 );
+%!
+%! fail ("optiminterpn(x,f,var,0.1,15,xi)", "number of columns in ox must be equal to the number of elements in of and ovar");
diff --git a/inst/test_optiminterp.m b/inst/test_optiminterp.m
deleted file mode 100644
index 1dccc4a..0000000
--- a/inst/test_optiminterp.m
+++ /dev/null
@@ -1,162 +0,0 @@
-%% Copyright (C) 2006 Alexander Barth <barth.alexander@gmail.com>
-%%
-%% This program is free software; you can redistribute it and/or modify it under
-%% the terms of the GNU General Public License as published by the Free Software
-%% Foundation; either version 3 of the License, or (at your option) any later
-%% version.
-%%
-%% This program is distributed in the hope that it will be useful, but WITHOUT
-%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-%% details.
-%%
-%% You should have received a copy of the GNU General Public License along with
-%% this program; if not, see <http://www.gnu.org/licenses/>.
-
-% Tests 1D, 2D, 3D and 4D optimal interpolation.
-% All tests should pass; any error indicates that either
-% there is a bug in the optimal interpolation package or
-% that it is incrorrectly installed.
-
-function test_optiminterp
-
-more off
-
-printf('Testing 1D-optimal interpolation: ');
-
-try
- % grid of background field
- xi = linspace(0,1,50);
- fi_ref = sin( xi*6 );
-
- % grid of observations
- x = linspace(0,1,20);
-
- on = numel(x);
- var = 0.01 * ones(on,1);
- f = sin( x*6 );
-
- m = 15;
-
- [fi,vari] = optiminterp1(x,f,var,0.1,m,xi);
-
-
- rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
-
- if (rms > 0.005)
- error('unexpected large difference with reference field');
- end
-
- disp('OK');
-
-catch
- disp('failed');
- disp(lasterr);
-end
-
-
-printf('Testing 2D-optimal interpolation: ');
-
-try
- % grid of background field
- [xi,yi] = ndgrid(linspace(0,1,30));
- fi_ref = sin( xi*6 ) .* cos( yi*6);
-
- % grid of observations
- [x,y] = ndgrid(linspace(0,1,20));
- x = x(:);
- y = y(:);
-
- on = numel(x);
- var = 0.01 * ones(on,1);
- f = sin( x*6 ) .* cos( y*6);
-
- m = 30;
-
- [fi,vari] = optiminterp2(x,y,f,var,0.1,0.1,m,xi,yi);
-
-
- rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
-
- if (rms > 0.005)
- error('unexpected large difference with reference field');
- end
-
- disp('OK');
-
-catch
- disp('failed');
- disp(lasterr);
-end
-
-
-printf('Testing 3D-optimal interpolation: ');
-
-try
- % grid of background field
- [xi,yi,zi] = ndgrid(linspace(0,1,15));
- fi_ref = sin(6*xi) .* cos(6*yi) .* sin(6*zi);
-
- % grid of observations
- [x,y,z] = ndgrid(linspace(0,1,10));
- x = x(:);
- y = y(:);
- z = z(:);
-
- on = numel(x);
- var = 0.01 * ones(on,1);
- f = sin(6*x) .* cos(6*y) .* sin(6*z);
-
- m = 20;
-
- [fi,vari] = optiminterp3(x,y,z,f,var,0.1,0.1,0.1,m,xi,yi,zi);
-
-
- rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
-
- if (rms > 0.04)
- error('unexpected large difference with reference field');
- end
-
- disp('OK');
-
-catch
- disp('failed');
- disp(lasterr);
-end
-
-printf('Testing 4D-optimal interpolation: ');
-
-try
- % grid of background field
- [xi,yi,zi,ti] = ndgrid(linspace(0,1,5));
- fi_ref = sin(6*xi) .* cos(6*yi) .* sin(6*zi) .* cos(6*ti);
-
- % grid of observations
- [x,y,z,t] = ndgrid(linspace(0,1,10));
- x = x(:);
- y = y(:);
- z = z(:);
- t = t(:);
-
- on = numel(x);
- var = 0.01 * ones(on,1);
- f = sin(6*x) .* cos(6*y) .* sin(6*z) .* cos(6*t);
-
- m = 20;
-
- [fi,vari] = optiminterp4(x,y,z,t,f,var,0.1,0.1,0.1,0.1,m,xi,yi,zi,ti);
-
- rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
-
- if (rms > 0.04)
- error('unexpected large difference with reference field');
- end
-
- disp('OK');
-
-catch
- disp('failed');
- disp(lasterr);
-end
-
diff --git a/inst/test_optiminterp_err.m b/inst/test_optiminterp_err.m
deleted file mode 100644
index 6454bbd..0000000
--- a/inst/test_optiminterp_err.m
+++ /dev/null
@@ -1,105 +0,0 @@
-%% Copyright (C) 2006 Alexander Barth <barth.alexander@gmail.com>
-%%
-%% This program is free software; you can redistribute it and/or modify it under
-%% the terms of the GNU General Public License as published by the Free Software
-%% Foundation; either version 3 of the License, or (at your option) any later
-%% version.
-%%
-%% This program is distributed in the hope that it will be useful, but WITHOUT
-%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-%% details.
-%%
-%% You should have received a copy of the GNU General Public License along with
-%% this program; if not, see <http://www.gnu.org/licenses/>.
-
-% Tests 2D optimal interpolation and compares result
-% (analysis and error field) to global OI solution
-
-printf('Testing 2D-optimal interpolation (analysis and error field): ');
-
-
-% grid of background field
-[xi,yi] = ndgrid(linspace(0,1,30));
-fi_ref = sin( xi*6 ) .* cos( yi*6);
-
-
-% grid of observations
-[x,y] = ndgrid(linspace(0,1,6));
-x = x(:);
-y = y(:);
-
-on = numel(x);
-var = 0.01 * ones(on,1);
-f = sin( x*6 ) .* cos( y*6);
-
-len = 0.1;
-m = min(30,on);
-
-% covariance function
-% gaussian
-%bcovar2 = @(d2) exp(-d2/len^2) ;
-% diva
-bcovar2 = @(d2) max(sqrt(d2)/len,eps) .* besselk(1,max(sqrt(d2)/len,eps));
-
-% P: covariance between grid points (xi,yi) and grid points (xi,yi)
-P = zeros(numel(xi),numel(xi));
-
-for j=1:numel(xi)
- for i=1:numel(xi)
- P(i,j) = (xi(i) - xi(j))^2 + (yi(i) - yi(j))^2;
- end
-end
-P = bcovar2(P);
-
-% HPH: covariance between observation points (x,y) and observation points (x,y)
-HPH = zeros(numel(x),numel(x));
-
-for j=1:numel(x)
- for i=1:numel(x)
- HPH(i,j) = (x(i) - x(j))^2 + (y(i) - y(j))^2;
- end
-end
-HPH = bcovar2(HPH);
-
-% PH: covariance between grid points (xi,yi) and observation points (x,y)
-PH = zeros(numel(xi),numel(x));
-
-for j=1:numel(x)
- for i=1:numel(xi)
- PH(i,j) = (xi(i) - x(j))^2 + (yi(i) - y(j))^2;
- end
-end
-PH = bcovar2(PH);
-
-R = diag(var);
-
-% call optiminterp
-[fi,vari] = optiminterp2(x,y,f,var,len,len,m,xi,yi);
-
-% Kalman gain
-K = PH * inv(HPH + R);
-
-% analysis
-fi2 = K * f;
-
-% error field
-vari2 = diag(P - K * PH');
-
-% transform vectors into 2d-arrays
-fi2 = reshape(fi2,size(fi));
-vari2 = reshape(vari2,size(fi));
-
-rms = sqrt(mean((fi2(:) - fi(:)).^2));
-
-if rms > 1e-4
- error('unexpected large RMS difference (analysis)');
-end
-
-rms = sqrt(mean((vari2(:) - vari(:)).^2));
-
-if rms > 1e-4
- error('unexpected large RMS difference (error field)');
-end
-
-disp('OK');
diff --git a/inst/test_optiminterp_mult.m b/inst/test_optiminterp_mult.m
deleted file mode 100644
index e384910..0000000
--- a/inst/test_optiminterp_mult.m
+++ /dev/null
@@ -1,174 +0,0 @@
-%% Copyright (C) 2006 Alexander Barth <barth.alexander@gmail.com>
-%%
-%% This program is free software; you can redistribute it and/or modify it under
-%% the terms of the GNU General Public License as published by the Free Software
-%% Foundation; either version 3 of the License, or (at your option) any later
-%% version.
-%%
-%% This program is distributed in the hope that it will be useful, but WITHOUT
-%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-%% details.
-%%
-%% You should have received a copy of the GNU General Public License along with
-%% this program; if not, see <http://www.gnu.org/licenses/>.
-
-% Tests 1D, 2D and 3D optimal interpolation.
-% All tests should pass; any error indicates that either
-% there is a bug in the optimal interpolation package or
-% that it is incrorrectly installed.
-
-function test_optiminterp_mult
-
-more off
-
-printf('Testing multiple 1D-optimal interpolation: ');
-
-try
- % grid of background field
- xi = linspace(0,1,50)';
- fi_ref(:,1) = sin( xi*6 );
- fi_ref(:,2) = cos( xi*6 );
-
- % grid of observations
- x = linspace(0,1,20)';
-
- on = numel(x);
- var = 0.01 * ones(on,1);
- f(:,1) = sin( x*6 );
- f(:,2) = cos( x*6 );
-
- m = 15;
-
- [fi,vari] = optiminterp1(x,f,var,0.1,m,xi);
-
-
- rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
-
- if (rms > 0.005)
- error('unexpected large difference with reference field');
- end
-
- disp('OK');
-
-catch
- disp('failed');
- disp(lasterr);
-end
-
-
-
-printf('Testing multiple 2D-optimal interpolation: ');
-
-try
- clear fi_ref f
- % grid of background field
- [xi,yi] = ndgrid(linspace(0,1,30));
-
- fi_ref(:,:,1) = sin( xi*6 ) .* cos( yi*6);
- fi_ref(:,:,2) = cos( xi*6 ) .* sin( yi*6);
-
- % grid of observations
- [x,y] = ndgrid(linspace(0,1,20));
-
- on = numel(x);
- var = 0.01 * ones(on,1);
- f(:,:,1) = sin( x*6 ) .* cos( y*6);
- f(:,:,2) = cos( x*6 ) .* sin( y*6);
-
- m = 30;
-
- [fi,vari] = optiminterp2(x,y,f,var,0.1,0.1,m,xi,yi);
-
-
- rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
-
- if (rms > 0.005)
- error('unexpected large difference with reference field');
- end
-
- disp('OK');
-
-catch
- disp('failed');
- disp(lasterr);
-end
-
-printf('Testing multiple 3D-optimal interpolation: ');
-
-
-try
- clear fi_ref f
-
- % grid of background field
- [xi,yi,zi] = ndgrid(linspace(0,1,15));
-
- fi_ref(:,:,:,1) = sin(6*xi) .* cos(6*yi) .* sin(6*zi);
- fi_ref(:,:,:,2) = cos(6*xi) .* sin(6*yi) .* cos(6*zi);
-
- % grid of observations
- [x,y,z] = ndgrid(linspace(0,1,10));
-
- on = numel(x);
- var = 0.01 * ones(on,1);
- f(:,:,:,1) = sin(6*x) .* cos(6*y) .* sin(6*z);
- f(:,:,:,2) = cos(6*x) .* sin(6*y) .* cos(6*z);
-
- m = 20;
-
- [fi,vari] = optiminterp3(x,y,z,f,var,0.1,0.1,0.1,m,xi,yi,zi);
-
-
- rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
-
- if (rms > 0.04)
- error('unexpected large difference with reference field');
- end
-
- disp('OK');
-
-catch
- disp('failed');
- disp(lasterr);
-end
-
-printf('Testing multiple 4D-optimal interpolation: ');
-
-try
- clear fi_ref f
-
- % grid of background field
- [xi,yi,zi,ti] = ndgrid(linspace(0,1,5));
-
- fi_ref(:,:,:,:,1) = sin(6*xi) .* cos(6*yi) .* sin(6*zi) .* cos(6*ti);
- fi_ref(:,:,:,:,2) = cos(6*xi) .* sin(6*yi) .* cos(6*zi) .* sin(6*ti);
-
- % grid of observations
- [x,y,z,t] = ndgrid(linspace(0,1,10));
- x = x(:);
- y = y(:);
- z = z(:);
- t = t(:);
-
- on = numel(x);
- var = 0.01 * ones(on,1);
- f(:,:,:,:,1) = sin(6*x) .* cos(6*y) .* sin(6*z) .* cos(6*t);
- f(:,:,:,:,2) = cos(6*x) .* sin(6*y) .* cos(6*z) .* sin(6*t);
-
- m = 20;
-
- [fi,vari] = optiminterp4(x,y,z,t,f,var,0.1,0.1,0.1,0.1,m,xi,yi,zi,ti);
-
- rms = sqrt(mean((fi_ref(:) - fi(:)).^2));
-
- if (rms > 0.04)
- error('unexpected large difference with reference field');
- end
-
- disp('OK');
-
-catch
- disp('failed');
- disp(lasterr);
-end
-
diff --git a/src/Makeconf.in b/src/Makeconf.in
deleted file mode 100644
index d089552..0000000
--- a/src/Makeconf.in
+++ /dev/null
@@ -1,64 +0,0 @@
-
-## Makeconf is automatically generated from Makeconf.base and Makeconf.add
-## in the various subdirectories. To regenerate, use ./autogen.sh to
-## create a new ./Makeconf.in, then use ./configure to generate a new
-## Makeconf.
-
-OCTAVE_FORGE = 1
-
-SHELL = @SHELL@
-
-canonical_host_type = @canonical_host_type@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-mandir = @mandir@
-libdir = @libdir@
-datadir = @datadir@
-infodir = @infodir@
-includedir = @includedir@
-datarootdir = @datarootdir@
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALLOCT=octinst.sh
-
-DESTDIR =
-
-RANLIB = @RANLIB@
-STRIP = @STRIP@
-LN_S = @LN_S@
-
-AWK = @AWK@
-
-# Most octave programs will be compiled with $(MKOCTFILE). Those which
-# cannot use mkoctfile directly can request the flags that mkoctfile
-# would use as follows:
-# FLAG = $(shell $(MKOCTFILE) -p FLAG)
-# The following flags are for compiling programs that are independent
-# of Octave. How confusing.
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-CPICFLAG = @CPICFLAG@
-CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
-CXXPICFLAG = @CXXPICFLAG@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-FPICFLAG = @FPICFLAG@
-
-OCTAVE = @OCTAVE@
-OCTAVE_VERSION = @OCTAVE_VERSION@
-MKOCTFILE = @MKOCTFILE@ -DHAVE_OCTAVE_$(ver) -v
-SHLEXT = @SHLEXT@
-
-MKOCTFILE_FORTRAN_90=@MKOCTFILE_FORTRAN_90@
-OPTIMINTERP_LIBS=@OPTIMINTERP_LIBS@
-OPTIMINTERP_CFLAGS=@OPTIMINTERP_CFLAGS@
-
-%.o: %.c ; $(MKOCTFILE) -c $<
-%.o: %.f ; $(MKOCTFILE) -c $<
-%.o: %.cc ; $(MKOCTFILE) -c $<
-%.oct: %.cc ; $(MKOCTFILE) $<
diff --git a/src/Makefile b/src/Makefile.in
index a0f2fb4..4c56e3a 100644
--- a/src/Makefile
+++ b/src/Makefile.in
@@ -1,5 +1,27 @@
+SHELL = @SHELL@
-sinclude Makeconf
+ver = @ver@
+
+# Most octave programs will be compiled with $(MKOCTFILE). Those which
+# cannot use mkoctfile directly can request the flags that mkoctfile
+# would use as follows:
+# FLAG = $(shell $(MKOCTFILE) -p FLAG)
+# The following flags are for compiling programs that are independent
+# of Octave. How confusing.
+FFLAGS = @FFLAGS@
+
+OCTAVE = @OCTAVE@
+OCTAVE_VERSION = @OCTAVE_VERSION@
+MKOCTFILE = @MKOCTFILE@ -DHAVE_OCTAVE_$(ver) -v
+
+MKOCTFILE_FORTRAN_90=@MKOCTFILE_FORTRAN_90@
+OPTIMINTERP_LIBS=@OPTIMINTERP_LIBS@
+OPTIMINTERP_CFLAGS=@OPTIMINTERP_CFLAGS@
+
+%.o: %.c ; $(MKOCTFILE) -c $<
+%.o: %.f ; $(MKOCTFILE) -c $<
+%.o: %.cc ; $(MKOCTFILE) -c $<
+%.oct: %.cc ; $(MKOCTFILE) $<
SOURCES=optiminterp.cc optimal_interpolation.F90 optiminterp_wrapper.F90
@@ -35,8 +57,8 @@ optiminterp.oct: $(OBJECTS)
LFLAGS="$(LFLAGS)" \
$(MKOCTFILE) -o $@ $(OBJECTS) $(LIBS) $(LAPACK_LIBS) $(FLIBS)
-check:
- octave --silent --norc --eval test_optiminterp
+# make sure to compile optimal_interpolation.o first
+optiminterp_wrapper.o: optiminterp_wrapper.F90 optimal_interpolation.o
clean:
rm -f *.o *.oct *~ *.mod
diff --git a/src/autogen.sh b/src/autogen.sh
deleted file mode 100755
index 354e6cf..0000000
--- a/src/autogen.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/sh
-
-## Generate ./configure
-rm -f configure.in
-echo "dnl --- DO NOT EDIT --- Automatically generated by autogen.sh" > configure.in
-cat configure.base >> configure.in
-cat <<EOF >> configure.in
- AC_OUTPUT(\$CONFIGURE_OUTPUTS)
- dnl XXX FIXME XXX chmod is not in autoconf's list of portable functions
-
- echo " "
- echo " \"\\\$prefix\" is \$prefix"
- echo " \"\\\$exec_prefix\" is \$exec_prefix"
- AC_MSG_RESULT([\$STATUS_MSG
-
-find . -name NOINSTALL -print # shows which toolboxes won't be installed
-])
-EOF
-
-autoconf configure.in > configure.tmp
-if [ diff configure.tmp configure > /dev/null 2>&1 ]; then
- rm -f configure.tmp;
-else
- mv -f configure.tmp configure
- chmod 0755 configure
-fi
-rm -f configure.in
diff --git a/src/bootstrap b/src/bootstrap
new file mode 100755
index 0000000..dc3f1fc
--- /dev/null
+++ b/src/bootstrap
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+autoconf
+rm -rf autom4te.cache
diff --git a/src/configure b/src/configure
index 4cfad8f..af67eac 100755
--- a/src/configure
+++ b/src/configure
@@ -1,11 +1,9 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68.
+# Generated by GNU Autoconf 2.69 for octave optiminterp 0.3.5.
#
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -211,21 +235,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
- # We cannot yet assume a decent shell, so we have to provide a
- # neutralization value for shells without unset; and this also
- # works around shells that cannot unset nonexistent variables.
- # Preserve -v and -x to the replacement shell.
- BASH_ENV=/dev/null
- ENV=/dev/null
- (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
- export CONFIG_SHELL
- case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
- esac
- exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
if test x$as_have_required = xno; then :
@@ -327,6 +355,14 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -448,6 +484,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -482,16 +522,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -503,28 +543,8 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -554,14 +574,13 @@ MFLAGS=
MAKEFLAGS=
# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-PACKAGE_URL=
-
-ac_unique_file="configure.base"
+PACKAGE_NAME='octave optiminterp'
+PACKAGE_TARNAME='octave-optiminterp'
+PACKAGE_VERSION='0.3.5'
+PACKAGE_STRING='octave optiminterp 0.3.5'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
ac_subst_vars='LTLIBOBJS
LIBOBJS
FCFLAGS_F90
@@ -571,29 +590,11 @@ FC
OPTIMINTERP_CFLAGS
OPTIMINTERP_LIBS
MKOCTFILE_FORTRAN_90
-STRIP
-COPY_FLAGS
-RANLIB
-LN_S
-SHLEXT
-canonical_host_type
+ver
OCTAVE_VERSION
OCTAVE
-CXXPICFLAG
-CXXFLAGS
-CXX
-FPICFLAG
FFLAGS
-F77
-CPICFLAG
-altopath
-altmpath
-altpath
-xpath
-opath
-mpath
-subver
-ver
+OCTAVE_CONFIG
MKOCTFILE
OBJEXT
EXEEXT
@@ -602,9 +603,6 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
-TOPDIR
-VERSION
-PACKAGE
target_alias
host_alias
build_alias
@@ -624,6 +622,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -646,13 +645,6 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
-with_path
-with_mpath
-with_opath
-with_xpath
-with_altpath
-with_altmpath
-with_altopath
'
ac_precious_vars='build_alias
host_alias
@@ -702,9 +694,10 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
@@ -954,6 +947,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1091,7 +1093,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1119,8 +1121,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1206,7 +1206,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
+\`configure' configures octave optiminterp 0.3.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1246,6 +1246,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1254,7 +1255,8 @@ Fine tuning of the installation directories:
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --docdir=DIR documentation root
+ [DATAROOTDIR/doc/octave-optiminterp]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
@@ -1266,20 +1268,11 @@ _ACEOF
fi
if test -n "$ac_init_help"; then
-
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of octave optiminterp 0.3.5:";;
+ esac
cat <<\_ACEOF
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-path install path prefix
- --with-mpath override path for m-files
- --with-opath override path for oct-files
- --with-xpath override path for executables
- --with-altpath alternative functions install path prefix
- --with-altmpath override path for alternative m-files
- --with-altopath override path for alternative oct-files
-
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
@@ -1357,10 +1350,10 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-configure
-generated by GNU Autoconf 2.68
+octave optiminterp configure 0.3.5
+generated by GNU Autoconf 2.69
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1450,8 +1443,8 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by $as_me, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+It was created by octave optiminterp $as_me 0.3.5, which was
+generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -1799,19 +1792,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-PACKAGE=octave-forge
-MAJOR_VERSION=0
-MINOR_VERSION=1
-PATCH_LEVEL=0
-
-
-
-VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
-
-
-
-TOPDIR=`pwd`
-
ac_ext=c
@@ -1836,7 +1816,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -1876,7 +1856,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -1929,7 +1909,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -1970,7 +1950,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -2028,7 +2008,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2072,7 +2052,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2518,8 +2498,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -2624,7 +2603,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_MKOCTFILE="mkoctfile"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2648,150 +2627,48 @@ fi
test -z "$MKOCTFILE" && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no mkoctfile found on path" >&5
$as_echo "$as_me: WARNING: no mkoctfile found on path" >&2;}
+# Extract the first word of "octave-config", so it can be a program name with args.
+set dummy octave-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OCTAVE_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OCTAVE_CONFIG"; then
+ ac_cv_prog_OCTAVE_CONFIG="$OCTAVE_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OCTAVE_CONFIG="octave-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
-
-
-
-
-
-
-
-
-
-# Check whether --with-path was given.
-if test "${with_path+set}" = set; then :
- withval=$with_path; path=$withval
-fi
-
-
-# Check whether --with-mpath was given.
-if test "${with_mpath+set}" = set; then :
- withval=$with_mpath; mpath=$withval
-fi
-
-
-# Check whether --with-opath was given.
-if test "${with_opath+set}" = set; then :
- withval=$with_opath; opath=$withval
-fi
-
-
-# Check whether --with-xpath was given.
-if test "${with_xpath+set}" = set; then :
- withval=$with_xpath; xpath=$withval
-fi
-
-
-# Check whether --with-altpath was given.
-if test "${with_altpath+set}" = set; then :
- withval=$with_altpath; altpath=$withval
-fi
-
-
-# Check whether --with-altmpath was given.
-if test "${with_altmpath+set}" = set; then :
- withval=$with_altmpath; altmpath=$withval
-fi
-
-
-# Check whether --with-altopath was given.
-if test "${with_altopath+set}" = set; then :
- withval=$with_altopath; altopath=$withval
-fi
-
-
-if test -n "$path" ; then
- test -z "$mpath" && mpath=$path
- test -z "$opath" && opath=$path/oct
- test -z "$xpath" && xpath=$path/bin
- test -z "$altpath" && altpath=$path-alternatives
fi
-
-if test -n "$altpath" ; then
- test -z "$altmpath" && altmpath=$altpath
- test -z "$altopath" && altopath=$altpath/oct
fi
-
-#if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$altmpath" || test -z "$altopath" || test -z "$ver" ; then
-if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$ver" ; then
- cat > conftest.cc <<EOF
-#include <octave/config.h>
-#include <octave/version.h>
-#include <octave/defaults.h>
-
-#define INFOV "\nINFOV=" OCTAVE_VERSION "\n"
-
-#define INFOH "\nINFOH=" OCTAVE_CANONICAL_HOST_TYPE "\n"
-
-#ifdef OCTAVE_LOCALVERFCNFILEDIR
-# define INFOM "\nINFOM=" OCTAVE_LOCALVERFCNFILEDIR "\n"
-#else
-# define INFOM "\nINFOM=" OCTAVE_LOCALFCNFILEPATH "\n"
-#endif
-
-#ifdef OCTAVE_LOCALVEROCTFILEDIR
-# define INFOO "\nINFOO=" OCTAVE_LOCALVEROCTFILEDIR "\n"
-#else
-# define INFOO "\nINFOO=" OCTAVE_LOCALOCTFILEPATH "\n"
-#endif
-
-#ifdef OCTAVE_LOCALVERARCHLIBDIR
-# define INFOX "\nINFOX=" OCTAVE_LOCALVERARCHLIBDIR "\n"
-#else
-# define INFOX "\nINFOX=" OCTAVE_LOCALARCHLIBDIR "\n"
-#endif
-
-const char *infom = INFOM;
-const char *infoo = INFOO;
-const char *infox = INFOX;
-const char *infoh = INFOH;
-const char *infov = INFOV;
-EOF
-
- $MKOCTFILE conftest.cc || as_fn_error $? "Could not run $MKOCTFILE" "$LINENO" 5
-
- eval `strings conftest.o | grep "^INFO.=" | sed -e "s,//.*$,,"`
- rm -rf conftest*
-
- ver=`echo $INFOV | sed -e "s/\.//" -e "s/\..*$//"`
- subver=`echo $INFOV | sed -e "s/^[^.]*[.][^.]*[.]//"`
- alt_mbase=`echo $INFOM | sed -e "s,\/[^\/]*$,,"`
- alt_obase=`echo $INFOO | sed -e "s,/site.*$,/site,"`
- test -z "$mpath" && mpath=$INFOM/octave-forge
- test -z "$opath" && opath=$INFOO/octave-forge
- test -z "$xpath" && xpath=$INFOX
- test -z "$altmpath" && altmpath=$alt_mbase/octave-forge-alternatives/m
- test -z "$altopath" && altopath=$alt_obase/octave-forge-alternatives/oct/$INFOH
+OCTAVE_CONFIG=$ac_cv_prog_OCTAVE_CONFIG
+if test -n "$OCTAVE_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE_CONFIG" >&5
+$as_echo "$OCTAVE_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: retrieving compile and link flags from $MKOCTFILE" >&5
-$as_echo "retrieving compile and link flags from $MKOCTFILE" >&6; }
-CC=`$MKOCTFILE -p CC`
-CFLAGS=`$MKOCTFILE -p CFLAGS`
-CPPFLAGS=`$MKOCTFILE -p CPPFLAGS`
-CPICFLAG=`$MKOCTFILE -p CPICFLAG`
-LDFLAGS=`$MKOCTFILE -p LDFLAGS`
-LIBS=`$MKOCTFILE -p LIBS`
-
+test -z "$OCTAVE_CONFIG" && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no octave-config found on path" >&5
+$as_echo "$as_me: WARNING: no octave-config found on path" >&2;}
-
-
-F77=`$MKOCTFILE -p F77`
FFLAGS=`$MKOCTFILE -p FFLAGS | sed -e 's/-pipe//'`
-FPICFLAG=`$MKOCTFILE -p FPICFLAG`
-
-
-
-
-CXX=`$MKOCTFILE -p CXX`
-CXXFLAGS=`$MKOCTFILE -p CXXFLAGS`
-CXXPICFLAG=`$MKOCTFILE -p CXXPICFLAG`
-
-
-
@@ -2802,7 +2679,7 @@ CXXPICFLAG=`$MKOCTFILE -p CXXPICFLAG`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for F77_FUNC" >&5
$as_echo_n "checking for F77_FUNC... " >&6; }
cat > conftest.cc << EOF
-#include <octave/config.h>
+#include <octave/oct.h>
int F77_FUNC (hello, HELLO) (const int &n);
EOF
ac_try="$MKOCTFILE -c conftest.cc"
@@ -2826,6 +2703,8 @@ fi
+
+
# Extract the first word of "octave", so it can be a program name with args.
set dummy octave; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -2842,7 +2721,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OCTAVE="octave"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2863,192 +2742,17 @@ $as_echo "no" >&6; }
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OCTAVE_VERSION in Octave" >&5
-$as_echo_n "checking for OCTAVE_VERSION in Octave... " >&6; }
-OCTAVE_VERSION=`echo "disp(OCTAVE_VERSION)" | $OCTAVE -qf`
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VERSION in octave-config" >&5
+$as_echo_n "checking for VERSION in octave-config... " >&6; }
+OCTAVE_VERSION=`$OCTAVE_CONFIG -p VERSION`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE_VERSION" >&5
$as_echo "$OCTAVE_VERSION" >&6; }
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for octave_config_info('canonical_host_type') in Octave" >&5
-$as_echo_n "checking for octave_config_info('canonical_host_type') in Octave... " >&6; }
-canonical_host_type=`echo "disp(octave_config_info('canonical_host_type'))" | $OCTAVE -qf`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $canonical_host_type" >&5
-$as_echo "$canonical_host_type" >&6; }
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for octave_config_info('SHLEXT') in Octave" >&5
-$as_echo_n "checking for octave_config_info('SHLEXT') in Octave... " >&6; }
-SHLEXT=`echo "disp(octave_config_info('SHLEXT'))" | $OCTAVE -qf`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHLEXT" >&5
-$as_echo "$SHLEXT" >&6; }
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
-$as_echo_n "checking whether ln -s works... " >&6; }
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
-$as_echo "no, using $LN_S" >&6; }
-fi
-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- RANLIB=$ac_ct_RANLIB
- fi
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
+ver=`echo $OCTAVE_VERSION | sed -e "s/\.//" -e "s/\..*$//"`
-COPY_FLAGS="-Rfp"
-case "$canonical_host_type" in
- *-*-linux*)
- COPY_FLAGS="-fdp"
- ;;
-esac
-
-
-STRIP=${STRIP-strip}
-# Extract the first word of "$STRIP", so it can be a program name with args.
-set dummy $STRIP; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_STRIP="$STRIP"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-case "$canonical_host_type" in
- powerpc-apple-darwin*|*-sgi-*)
- STRIP=:
- ;;
- *-cygwin-*|*-mingw-*)
- MKOCTFILE="$MKOCTFILE -s"
- ;;
-esac
-
@@ -3089,7 +2793,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_FC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3133,7 +2837,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_FC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3266,6 +2970,11 @@ else
fi
fi
+if test $ac_compiler_gnu = yes; then
+ GFC=yes
+else
+ GFC=
+fi
ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
@@ -3287,7 +2996,11 @@ else
ac_fcflags_srcext_save=$ac_fcflags_srcext
ac_fcflags_srcext=
ac_cv_fc_srcext_F90=unknown
-for ac_flag in none -qsuffix=f=F90 -Tf; do
+case $ac_ext in #(
+ [fF]77) ac_try=f77;; #(
+ *) ac_try=f95;;
+esac
+for ac_flag in none -qsuffix=f=F90 -Tf "-x $ac_try"; do
test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"
cat > conftest.$ac_ext <<_ACEOF
program main
@@ -3357,27 +3070,7 @@ fi
rm -f test_module.mod TEST_MODULE.mod test_module.MOD TEST_MODULE.MOD
-CONFIGURE_OUTPUTS="Makeconf"
-STATUS_MSG="
-octave commands will install into the following directories:
- m-files: $mpath
- oct-files: $opath
- binaries: $xpath
-alternatives:
- m-files: $altmpath
- oct-files: $altopath
-
-shell commands will install into the following directories:
- binaries: $bindir
- man pages: $mandir
- libraries: $libdir
- headers: $includedir
-
-octave-forge is configured with
- octave: $OCTAVE (version $OCTAVE_VERSION)
- mkoctfile: $MKOCTFILE for Octave $subver
- optiminterp toolbox: $OPTIMINTERPSTATUS"
- ac_config_files="$ac_config_files $CONFIGURE_OUTPUTS"
+ac_config_files="$ac_config_files Makefile"
@@ -3738,16 +3431,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -3807,28 +3500,16 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -3849,8 +3530,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by $as_me, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+This file was extended by octave optiminterp $as_me 0.3.5, which was
+generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -3902,11 +3583,11 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-config.status
-configured by $0, generated by GNU Autoconf 2.68,
+octave optiminterp config.status 0.3.5
+configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -3983,7 +3664,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
@@ -4012,7 +3693,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
- "$CONFIGURE_OUTPUTS") CONFIG_FILES="$CONFIG_FILES $CONFIGURE_OUTPUTS" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -4463,14 +4144,18 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
- echo " "
- echo " \"\$prefix\" is $prefix"
- echo " \"\$exec_prefix\" is $exec_prefix"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STATUS_MSG
-
-find . -name NOINSTALL -print # shows which toolboxes won't be installed
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
+$PACKAGE_NAME is configured with
+ octave: $OCTAVE (version $OCTAVE_VERSION)
+ mkoctfile: $MKOCTFILE for Octave $OCTAVE_VERSION
+ octave-config: $OCTAVE_CONFIG for Octave $OCTAVE_VERSION
+ optiminterp toolbox: $OPTIMINTERPSTATUS
" >&5
-$as_echo "$STATUS_MSG
-
-find . -name NOINSTALL -print # shows which toolboxes won't be installed
+$as_echo "
+$PACKAGE_NAME is configured with
+ octave: $OCTAVE (version $OCTAVE_VERSION)
+ mkoctfile: $MKOCTFILE for Octave $OCTAVE_VERSION
+ octave-config: $OCTAVE_CONFIG for Octave $OCTAVE_VERSION
+ optiminterp toolbox: $OPTIMINTERPSTATUS
" >&6; }
+
diff --git a/src/configure.ac b/src/configure.ac
new file mode 100644
index 0000000..5eb9aed
--- /dev/null
+++ b/src/configure.ac
@@ -0,0 +1,193 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+#
+
+dnl autoconf 2.13 certainly doesn't work! What is the minimum requirement?
+AC_PREREQ(2.2)
+
+AC_INIT([octave optiminterp],[0.3.5])
+
+dnl Kill caching --- this ought to be the default
+define([AC_CACHE_LOAD], )dnl
+define([AC_CACHE_SAVE], )dnl
+
+dnl uncomment to put support files in another directory
+dnl AC_CONFIG_AUX_DIR(admin)
+
+dnl if mkoctfile doesn't work, then we need the following:
+dnl AC_PROG_CXX
+dnl AC_PROG_F77
+AC_PROG_CC
+
+
+dnl *******************************************************************
+dnl Sort out mkoctfile version number and install paths
+
+dnl XXX FIXME XXX latest octave has octave-config so we don't
+dnl need to discover things here. Doesn't have --exe-site-dir
+dnl but defines --oct-site-dir and --m-site-dir
+
+dnl Check for mkoctfile
+AC_CHECK_PROG(MKOCTFILE,mkoctfile,mkoctfile)
+test -z "$MKOCTFILE" && AC_MSG_WARN([no mkoctfile found on path])
+
+dnl Check for octave-cofig
+AC_CHECK_PROG(OCTAVE_CONFIG,octave-config,octave-config)
+test -z "$OCTAVE_CONFIG" && AC_MSG_WARN([no octave-config found on path])
+
+dnl *******************************************************************
+
+dnl Fortran compiler flags
+dnl Note remove "-pipe" from FFLAGS as gfortran v4.0.x has issue with
+dnl this an F90 files
+FFLAGS=`$MKOCTFILE -p FFLAGS | sed -e 's/-pipe//'`
+AC_SUBST(FFLAGS)
+dnl *******************************************************************
+
+dnl Check for features of your version of mkoctfile.
+dnl All checks should be designed so that the default
+dnl action if the tests are not performed is to do whatever
+dnl is appropriate for the most recent version of Octave.
+
+dnl Define the following macro:
+dnl OF_CHECK_LIB(lib,fn,true,false,helpers)
+dnl This is just like AC_CHECK_LIB, but it doesn't update LIBS
+AC_DEFUN(OF_CHECK_LIB,
+[save_LIBS="$LIBS"
+AC_CHECK_LIB($1,$2,$3,$4,$5)
+LIBS="$save_LIBS"
+])
+
+dnl Define the following macro:
+dnl TRY_MKOCTFILE(msg,program,action_if_true,action_if_false)
+dnl
+AC_DEFUN(TRY_MKOCTFILE,
+[AC_MSG_CHECKING($1)
+cat > conftest.cc << EOF
+#include <octave/oct.h>
+$2
+EOF
+ac_try="$MKOCTFILE -c conftest.cc"
+if AC_TRY_EVAL(ac_try) ; then
+ AC_MSG_RESULT(yes)
+ $3
+else
+ AC_MSG_RESULT(no)
+ $4
+fi
+])
+
+dnl
+dnl Check if F77_FUNC works with MKOCTFILE
+dnl
+TRY_MKOCTFILE([for F77_FUNC],
+[int F77_FUNC (hello, HELLO) (const int &n);],,
+[MKOCTFILE="$MKOCTFILE -DF77_FUNC=F77_FCN"])
+
+dnl **********************************************************
+
+dnl Evaluate an expression in octave
+dnl
+dnl OCTAVE_EVAL(expr,var) -> var=expr
+dnl
+AC_DEFUN(OCTAVE_EVAL,
+[AC_MSG_CHECKING([for $1 in Octave])
+$2=`echo "disp($1)" | $OCTAVE -qf`
+AC_MSG_RESULT($$2)
+AC_SUBST($2)
+])
+
+dnl Evaluate an expression in octave-config
+dnl
+dnl OCTAVE_CONFIG_EVAL(expr,var) -> var=expr
+dnl
+AC_DEFUN(OCTAVE_CONFIG_EVAL,
+[AC_MSG_CHECKING([for $1 in octave-config])
+$2=`$OCTAVE_CONFIG -p $1`
+AC_MSG_RESULT($$2)
+AC_SUBST($2)
+])
+
+dnl Check status of an octave variable
+dnl
+dnl OCTAVE_CHECK_EXIST(variable,action_if_true,action_if_false)
+dnl
+AC_DEFUN(OCTAVE_CHECK_EXIST,
+[AC_MSG_CHECKING([for $1 in Octave])
+if test `echo 'disp(exist("$1"))' | $OCTAVE -qf`X != 0X ; then
+ AC_MSG_RESULT(yes)
+ $2
+else
+ AC_MSG_RESULT(no)
+ $3
+fi
+])
+
+dnl should check that $(OCTAVE) --version matches $(MKOCTFILE) --version
+AC_CHECK_PROG(OCTAVE,octave,octave)
+
+OCTAVE_CONFIG_EVAL(VERSION,OCTAVE_VERSION)
+dnl get major ver part as used for a HAVE_OCTAVE_XXX define
+ver=`echo $OCTAVE_VERSION | sed -e "s/\.//" -e "s/\..*$//"`
+AC_SUBST(ver)
+
+AC_SUBST(MKOCTFILE_FORTRAN_90)
+AC_SUBST(OPTIMINTERP_LIBS)
+AC_SUBST(OPTIMINTERP_CFLAGS)
+
+OPTIMINTERP_LIBS="$LDFLAGS"
+OPTIMINTERP_CFLAGS="$CPPFLAGS"
+
+dnl By default, autoconf tries to compile Fortran programs with
+dnl optimization (-O2) which mkoctfile does not support as argument
+
+FCFLAGS=
+
+dnl Set Language to Fortran
+AC_LANG(Fortran)
+
+dnl Use mkoctfile as Fortran 90 compiler.
+dnl No tests are performed at this stage if mkoctfile can actually handle
+dnl Fortran 90 code.
+
+AC_PROG_FC([mkoctfile], 1990)
+
+dnl Test if mkoctfile and the Fortran 90 compiler support
+dnl the extention .F90 (free-form with pre-processor directives)
+export FFLAGS
+AC_FC_SRCEXT(F90,,AC_ERROR([mkoctfile does not accept files with the extention .F90. \
+Support for this file extension has been added to version 2.9.9 of octave.]))
+
+dnl Test if mkoctfile can handle Fortran 90 features such as modules
+
+AC_MSG_CHECKING([whether mkoctfile accepts Fortran 90])
+
+AC_COMPILE_IFELSE([[\
+module test_module; \
+contains; \
+subroutine foo()
+end subroutine
+end module \
+]], MKOCTFILE_FORTRAN_90=yes, MKOCTFILE_FORTRAN_90=no)
+
+OPTIMINTERPSTATUS=$MKOCTFILE_FORTRAN_90
+AC_MSG_RESULT([$MKOCTFILE_FORTRAN_90])
+
+if test $MKOCTFILE_FORTRAN_90 = no ; then
+ AC_MSG_ERROR([mkoctfile does not accept Fortran 90 code. Octave was not build with a Fortran 90 compiler.])
+fi
+
+dnl Delete the module file. Capitalization is compiler dependent
+rm -f test_module.mod TEST_MODULE.mod test_module.MOD TEST_MODULE.MOD
+
+
+AC_OUTPUT([Makefile])
+
+AC_MSG_RESULT([
+$PACKAGE_NAME is configured with
+ octave: $OCTAVE (version $OCTAVE_VERSION)
+ mkoctfile: $MKOCTFILE for Octave $OCTAVE_VERSION
+ octave-config: $OCTAVE_CONFIG for Octave $OCTAVE_VERSION
+ optiminterp toolbox: $OPTIMINTERPSTATUS
+])
+
diff --git a/src/configure.base b/src/configure.base
deleted file mode 100644
index 3081f53..0000000
--- a/src/configure.base
+++ /dev/null
@@ -1,372 +0,0 @@
-dnl The configure script is generated by autogen.sh from configure.base
-dnl and the various configure.add files in the source tree. Edit
-dnl configure.base and reprocess rather than modifying ./configure.
-
-dnl autoconf 2.13 certainly doesn't work! What is the minimum requirement?
-AC_PREREQ(2.2)
-
-AC_INIT(configure.base)
-
-PACKAGE=octave-forge
-MAJOR_VERSION=0
-MINOR_VERSION=1
-PATCH_LEVEL=0
-
-dnl Kill caching --- this ought to be the default
-define([AC_CACHE_LOAD], )dnl
-define([AC_CACHE_SAVE], )dnl
-
-dnl uncomment to put support files in another directory
-dnl AC_CONFIG_AUX_DIR(admin)
-
-VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
-AC_SUBST(PACKAGE)
-AC_SUBST(VERSION)
-
-dnl need to find admin files, so keep track of the top dir.
-TOPDIR=`pwd`
-AC_SUBST(TOPDIR)
-
-dnl if mkoctfile doesn't work, then we need the following:
-dnl AC_PROG_CXX
-dnl AC_PROG_F77
-
-dnl Need C compiler regardless so define it in a way that
-dnl makes autoconf happy and we can override whatever we
-dnl need with mkoctfile -p.
-dnl XXX FIXME XXX should use mkoctfile to get CC and CFLAGS
-AC_PROG_CC
-
-dnl XXX FIXME XXX need tests for -p -c -s in mkoctfile.
-
-dnl *******************************************************************
-dnl Sort out mkoctfile version number and install paths
-
-dnl XXX FIXME XXX latest octave has octave-config so we don't
-dnl need to discover things here. Doesn't have --exe-site-dir
-dnl but defines --oct-site-dir and --m-site-dir
-
-dnl Check for mkoctfile
-AC_CHECK_PROG(MKOCTFILE,mkoctfile,mkoctfile)
-test -z "$MKOCTFILE" && AC_MSG_WARN([no mkoctfile found on path])
-
-AC_SUBST(ver)
-AC_SUBST(subver)
-AC_SUBST(mpath)
-AC_SUBST(opath)
-AC_SUBST(xpath)
-AC_SUBST(altpath)
-AC_SUBST(altmpath)
-AC_SUBST(altopath)
-
-AC_ARG_WITH(path,
- [ --with-path install path prefix],
- [ path=$withval ])
-AC_ARG_WITH(mpath,
- [ --with-mpath override path for m-files],
- [mpath=$withval])
-AC_ARG_WITH(opath,
- [ --with-opath override path for oct-files],
- [opath=$withval])
-AC_ARG_WITH(xpath,
- [ --with-xpath override path for executables],
- [xpath=$withval])
-AC_ARG_WITH(altpath,
- [ --with-altpath alternative functions install path prefix],
- [ altpath=$withval ])
-AC_ARG_WITH(altmpath,
- [ --with-altmpath override path for alternative m-files],
- [altmpath=$withval])
-AC_ARG_WITH(altopath,
- [ --with-altopath override path for alternative oct-files],
- [altopath=$withval])
-
-if test -n "$path" ; then
- test -z "$mpath" && mpath=$path
- test -z "$opath" && opath=$path/oct
- test -z "$xpath" && xpath=$path/bin
- test -z "$altpath" && altpath=$path-alternatives
-fi
-
-if test -n "$altpath" ; then
- test -z "$altmpath" && altmpath=$altpath
- test -z "$altopath" && altopath=$altpath/oct
-fi
-
-dnl Don't query if path/ver are given in the configure environment
-#if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$altmpath" || test -z "$altopath" || test -z "$ver" ; then
-if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$ver" ; then
- dnl Construct program to get mkoctfile version and local install paths
- cat > conftest.cc <<EOF
-#include <octave/config.h>
-#include <octave/version.h>
-#include <octave/defaults.h>
-
-#define INFOV "\nINFOV=" OCTAVE_VERSION "\n"
-
-#define INFOH "\nINFOH=" OCTAVE_CANONICAL_HOST_TYPE "\n"
-
-#ifdef OCTAVE_LOCALVERFCNFILEDIR
-# define INFOM "\nINFOM=" OCTAVE_LOCALVERFCNFILEDIR "\n"
-#else
-# define INFOM "\nINFOM=" OCTAVE_LOCALFCNFILEPATH "\n"
-#endif
-
-#ifdef OCTAVE_LOCALVEROCTFILEDIR
-# define INFOO "\nINFOO=" OCTAVE_LOCALVEROCTFILEDIR "\n"
-#else
-# define INFOO "\nINFOO=" OCTAVE_LOCALOCTFILEPATH "\n"
-#endif
-
-#ifdef OCTAVE_LOCALVERARCHLIBDIR
-# define INFOX "\nINFOX=" OCTAVE_LOCALVERARCHLIBDIR "\n"
-#else
-# define INFOX "\nINFOX=" OCTAVE_LOCALARCHLIBDIR "\n"
-#endif
-
-const char *infom = INFOM;
-const char *infoo = INFOO;
-const char *infox = INFOX;
-const char *infoh = INFOH;
-const char *infov = INFOV;
-EOF
-
- dnl Compile program perhaps with a special version of mkoctfile
- $MKOCTFILE conftest.cc || AC_MSG_ERROR(Could not run $MKOCTFILE)
-
- dnl Strip the config info from the compiled file
- eval `strings conftest.o | grep "^INFO.=" | sed -e "s,//.*$,,"`
- rm -rf conftest*
-
- dnl set the appropriate variables if they are not already set
- ver=`echo $INFOV | sed -e "s/\.//" -e "s/\..*$//"`
- subver=`echo $INFOV | sed -e "[s/^[^.]*[.][^.]*[.]//]"`
- alt_mbase=`echo $INFOM | sed -e "[s,\/[^\/]*$,,]"`
- alt_obase=`echo $INFOO | sed -e "[s,/site.*$,/site,]"`
- test -z "$mpath" && mpath=$INFOM/octave-forge
- test -z "$opath" && opath=$INFOO/octave-forge
- test -z "$xpath" && xpath=$INFOX
- test -z "$altmpath" && altmpath=$alt_mbase/octave-forge-alternatives/m
- test -z "$altopath" && altopath=$alt_obase/octave-forge-alternatives/oct/$INFOH
-fi
-
-dnl *******************************************************************
-
-dnl XXX FIXME XXX Should we allow the user to override these?
-dnl Do we even need them? The individual makefiles can call mkoctfile -p
-dnl themselves, so the only reason to keep them is for configure, and
-dnl for those things which are not built using mkoctfile (e.g., aurecord)
-dnl but it is not clear we should be using octave compile flags for those.
-
-dnl C compiler and flags
-AC_MSG_RESULT([retrieving compile and link flags from $MKOCTFILE])
-CC=`$MKOCTFILE -p CC`
-CFLAGS=`$MKOCTFILE -p CFLAGS`
-CPPFLAGS=`$MKOCTFILE -p CPPFLAGS`
-CPICFLAG=`$MKOCTFILE -p CPICFLAG`
-LDFLAGS=`$MKOCTFILE -p LDFLAGS`
-LIBS=`$MKOCTFILE -p LIBS`
-AC_SUBST(CC)
-AC_SUBST(CFLAGS)
-AC_SUBST(CPPFLAGS)
-AC_SUBST(CPICFLAG)
-
-dnl Fortran compiler and flags
-dnl Note remove "-pipe" from FFLAGS as gfortran v4.0.x has issue with
-dnl this an F90 files
-F77=`$MKOCTFILE -p F77`
-FFLAGS=`$MKOCTFILE -p FFLAGS | sed -e 's/-pipe//'`
-FPICFLAG=`$MKOCTFILE -p FPICFLAG`
-AC_SUBST(F77)
-AC_SUBST(FFLAGS)
-AC_SUBST(FPICFLAG)
-
-dnl C++ compiler and flags
-CXX=`$MKOCTFILE -p CXX`
-CXXFLAGS=`$MKOCTFILE -p CXXFLAGS`
-CXXPICFLAG=`$MKOCTFILE -p CXXPICFLAG`
-AC_SUBST(CXX)
-AC_SUBST(CXXFLAGS)
-AC_SUBST(CXXPICFLAG)
-
-dnl *******************************************************************
-
-dnl Check for features of your version of mkoctfile.
-dnl All checks should be designed so that the default
-dnl action if the tests are not performed is to do whatever
-dnl is appropriate for the most recent version of Octave.
-
-dnl Define the following macro:
-dnl OF_CHECK_LIB(lib,fn,true,false,helpers)
-dnl This is just like AC_CHECK_LIB, but it doesn't update LIBS
-AC_DEFUN(OF_CHECK_LIB,
-[save_LIBS="$LIBS"
-AC_CHECK_LIB($1,$2,$3,$4,$5)
-LIBS="$save_LIBS"
-])
-
-dnl Define the following macro:
-dnl TRY_MKOCTFILE(msg,program,action_if_true,action_if_false)
-dnl
-AC_DEFUN(TRY_MKOCTFILE,
-[AC_MSG_CHECKING($1)
-cat > conftest.cc << EOF
-#include <octave/config.h>
-$2
-EOF
-ac_try="$MKOCTFILE -c conftest.cc"
-if AC_TRY_EVAL(ac_try) ; then
- AC_MSG_RESULT(yes)
- $3
-else
- AC_MSG_RESULT(no)
- $4
-fi
-])
-
-dnl
-dnl Check if F77_FUNC works with MKOCTFILE
-dnl
-TRY_MKOCTFILE([for F77_FUNC],
-[int F77_FUNC (hello, HELLO) (const int &n);],,
-[MKOCTFILE="$MKOCTFILE -DF77_FUNC=F77_FCN"])
-
-dnl **********************************************************
-
-dnl Evaluate an expression in octave
-dnl
-dnl OCTAVE_EVAL(expr,var) -> var=expr
-dnl
-AC_DEFUN(OCTAVE_EVAL,
-[AC_MSG_CHECKING([for $1 in Octave])
-$2=`echo "disp($1)" | $OCTAVE -qf`
-AC_MSG_RESULT($$2)
-AC_SUBST($2)
-])
-
-dnl Check status of an octave variable
-dnl
-dnl OCTAVE_CHECK_EXIST(variable,action_if_true,action_if_false)
-dnl
-AC_DEFUN(OCTAVE_CHECK_EXIST,
-[AC_MSG_CHECKING([for $1 in Octave])
-if test `echo 'disp(exist("$1"))' | $OCTAVE -qf`X != 0X ; then
- AC_MSG_RESULT(yes)
- $2
-else
- AC_MSG_RESULT(no)
- $3
-fi
-])
-
-dnl should check that $(OCTAVE) --version matches $(MKOCTFILE) --version
-AC_CHECK_PROG(OCTAVE,octave,octave)
-OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)
-
-dnl grab canonical host type so we can write system specific install stuff
-OCTAVE_EVAL(octave_config_info('canonical_host_type'),canonical_host_type)
-
-dnl grab SHLEXT from octave config
-OCTAVE_EVAL(octave_config_info('SHLEXT'),SHLEXT)
-
-AC_PROG_LN_S
-
-AC_PROG_RANLIB
-
-dnl Use $(COPY_FLAGS) to set options for cp when installing .oct files.
-COPY_FLAGS="-Rfp"
-case "$canonical_host_type" in
- *-*-linux*)
- COPY_FLAGS="-fdp"
- ;;
-esac
-AC_SUBST(COPY_FLAGS)
-
-dnl Use $(STRIP) in the makefile to strip executables. If not found,
-dnl STRIP expands to ':', which in the makefile does nothing.
-dnl Don't need this for .oct files since mkoctfile handles them directly
-STRIP=${STRIP-strip}
-AC_CHECK_PROG(STRIP,$STRIP,$STRIP,:)
-
-dnl Strip on windows, don't strip on Mac OS/X or IRIX
-dnl For the rest, you can force strip using MKOCTFILE="mkoctfile -s"
-dnl or avoid strip using STRIP=: before ./configure
-case "$canonical_host_type" in
- powerpc-apple-darwin*|*-sgi-*)
- STRIP=:
- ;;
- *-cygwin-*|*-mingw-*)
- MKOCTFILE="$MKOCTFILE -s"
- ;;
-esac
-
-AC_SUBST(MKOCTFILE_FORTRAN_90)
-AC_SUBST(OPTIMINTERP_LIBS)
-AC_SUBST(OPTIMINTERP_CFLAGS)
-
-OPTIMINTERP_LIBS="$LDFLAGS"
-OPTIMINTERP_CFLAGS="$CPPFLAGS"
-
-dnl By default, autoconf tries to compile Fortran programs with
-dnl optimization (-O2) which mkoctfile does not support as argument
-
-FCFLAGS=
-
-dnl Set Language to Fortran
-AC_LANG(Fortran)
-
-dnl Use mkoctfile as Fortran 90 compiler.
-dnl No tests are performed at this stage if mkoctfile can actually handle
-dnl Fortran 90 code.
-
-AC_PROG_FC([mkoctfile], 1990)
-
-dnl Test if mkoctfile and the Fortran 90 compiler support
-dnl the extention .F90 (free-form with pre-processor directives)
-export FFLAGS
-AC_FC_SRCEXT(F90,,AC_ERROR([mkoctfile does not accept files with the extention .F90. \
-Support for this file extension has been added to version 2.9.9 of octave.]))
-
-dnl Test if mkoctfile can handle Fortran 90 features such as modules
-
-AC_MSG_CHECKING([whether mkoctfile accepts Fortran 90])
-
-AC_COMPILE_IFELSE([[\
-module test_module; \
-contains; \
-subroutine foo()
-end subroutine
-end module \
-]], MKOCTFILE_FORTRAN_90=yes, MKOCTFILE_FORTRAN_90=no)
-
-OPTIMINTERPSTATUS=$MKOCTFILE_FORTRAN_90
-AC_MSG_RESULT([$MKOCTFILE_FORTRAN_90])
-
-if test $MKOCTFILE_FORTRAN_90 = no ; then
- AC_MSG_ERROR([mkoctfile does not accept Fortran 90 code. Octave was not build with a Fortran 90 compiler.])
-fi
-
-dnl Delete the module file. Capitalization is compiler dependent
-rm -f test_module.mod TEST_MODULE.mod test_module.MOD TEST_MODULE.MOD
-
-
-CONFIGURE_OUTPUTS="Makeconf"
-STATUS_MSG="
-octave commands will install into the following directories:
- m-files: $mpath
- oct-files: $opath
- binaries: $xpath
-alternatives:
- m-files: $altmpath
- oct-files: $altopath
-
-shell commands will install into the following directories:
- binaries: $bindir
- man pages: $mandir
- libraries: $libdir
- headers: $includedir
-
-octave-forge is configured with
- octave: $OCTAVE (version $OCTAVE_VERSION)
- mkoctfile: $MKOCTFILE for Octave $subver
- optiminterp toolbox: $OPTIMINTERPSTATUS"
diff --git a/src/optimal_interpolation.F90 b/src/optimal_interpolation.F90
index 9ce7976..ba306bb 100644
--- a/src/optimal_interpolation.F90
+++ b/src/optimal_interpolation.F90
@@ -1,4 +1,4 @@
-!! Copyright (C) 2005 Alexander Barth <barth.alexander@gmail.com>
+!! Copyright (C) 2005,2013 Alexander Barth <barth.alexander@gmail.com>
!! Copyright (C) 2006 David Saunders (NASA Ames Research Center)
!! Copyright (C) 2008 Gian Franco Marras (CINECA) <g.marras@cineca.it>
!!
@@ -30,7 +30,7 @@
! --------------------------------------------------------------------------
- subroutine select_nearest(x,ox,param,m,index,distance)
+ pure subroutine select_nearest(x,ox,param,m,index,distance)
! Select the m observations from ox(1:nd,1:on) closest to point x(1:nd).
@@ -64,7 +64,7 @@
! --------------------------------------------------------------------------
- subroutine sort(d,m,pannier)
+ pure subroutine sort(d,m,pannier)
! Return the indices of the m smallest elements in d(:).
! The algorithm is succinctly coded, but would a heap sort be faster?
@@ -95,7 +95,7 @@
! --------------------------------------------------------------------------
- subroutine observation_covariance(ovar,index,R)
+ pure subroutine observation_covariance(ovar,index,R)
implicit none
real(wp),intent(in) ::ovar(:)
integer,intent(in) :: index(:)
@@ -121,7 +121,7 @@
! --------------------------------------------------------------------------
! Modified Bessel functions of 2nd kind (order 1)
- function mod_bessel_K1(x)
+ pure function mod_bessel_K1(x)
implicit none
real(wp), intent(in) :: x
real(wp) :: mod_bessel_K1
@@ -143,9 +143,15 @@
Q6 = 0.325614D-2, &
Q7 = -0.68245D-3
- if(x <= 0.) stop 'error x <= 0'
+ if (x <= 0.) then
+ ! a pure function cannot call stop therefore we return NaN
+ ! stop 'error x <= 0'
+ y = 0
+ mod_bessel_K1 = y/y
+ return
+ end if
- if(x <= 2.0) then
+ if (x <= 2.0) then
y = x * x * 0.25
mod_bessel_K1 = (log(x/2.0)*mod_bessel_I1(x))+(1.0/x)*(P1+y*(P2+y*(P3+ &
y*(P4+y*(P5+y*(P6+y*P7))))))
@@ -160,9 +166,9 @@
! --------------------------------------------------------------------------
! Modified Bessel functions of 1st kind (order 1)
- function mod_bessel_I1(x)
+ pure function mod_bessel_I1(x)
implicit none
- real(wp) :: x
+ real(wp), intent(in) :: x
real(wp) :: mod_bessel_I1
real(8) :: y, ax
@@ -199,7 +205,7 @@
! --------------------------------------------------------------------------
- function background_covariance_diva(x1,x2,param) result(c)
+ pure function background_covariance_diva(x1,x2,param) result(c)
implicit none
real(wp),intent(in) :: x1(:),x2(:),param(:)
real(wp) :: c
@@ -221,7 +227,7 @@
! --------------------------------------------------------------------------
- function background_covariance_gaussian(x1,x2,param) result(c)
+ pure function background_covariance_gaussian(x1,x2,param) result(c)
implicit none
real(wp),intent(in) :: x1(:),x2(:),param(:)
real(wp) :: c
@@ -236,7 +242,7 @@
! --------------------------------------------------------------------------
- function background_covariance(x1,x2,param) result(c)
+ pure function background_covariance(x1,x2,param) result(c)
implicit none
real(wp),intent(in) :: x1(:),x2(:),param(:)
real(wp) :: c
diff --git a/src/optiminterp.cc b/src/optiminterp.cc
index 60d8119..3a886dc 100644
--- a/src/optiminterp.cc
+++ b/src/optiminterp.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2005 Alexander Barth <barth.alexander@gmail.com>
+// 2017 John Donoghue <john.david.donoghue@gmail.com>
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
@@ -16,16 +17,24 @@
// n-dimensional optimal interpolation
#include <octave/oct.h>
-#include "f77-fcn.h"
+#include <octave/f77-fcn.h>
+
+#if defined (OCTAVE_HAVE_F77_INT_TYPE)
+# define TO_F77_INT(x) octave::to_f77_int (x)
+#else
+typedef octave_idx_type F77_INT;
+# define TO_F77_INT(x) (x)
+#endif
extern "C"
{
F77_RET_T
F77_FUNC (optiminterpwrapper, OPTIMINTERPWRAPPER)
(
- const int& n, const int& nf, const int& gn, const int& on, const int& nparam,
+ const F77_INT& n, const F77_INT& nf, const F77_INT& gn,
+ const F77_INT& on, const F77_INT& nparam,
double* ox, double* of, double* ovar, double* param,
- const int& m, double* gx, double* gf, double* gvar);
+ const F77_INT& m, double* gx, double* gf, double* gvar);
}
DEFUN_DLD (optiminterp, args, ,
@@ -66,7 +75,7 @@ have a error variance of one. The error variances of the observations need to be
Matrix of = args(1).matrix_value();
Matrix ovar = args(2).matrix_value();
Matrix param = args(3).matrix_value();
- int m = (int)args(4).scalar_value();
+ F77_INT m = TO_F77_INT ((int)args(4).scalar_value());
Matrix gx = args(5).matrix_value();
// The Fortran routine expects the inverse of the correlation length
@@ -85,11 +94,11 @@ have a error variance of one. The error variances of the observations need to be
ox = ox.transpose();
//octave_stdout << "shape(of) " << of.rows() << "x" << of.cols() << std::endl;
- int n = gx.rows();
- int nf = of.rows();
- int gn = gx.cols();
- int on = ox.cols();
- int nparam = param.numel();
+ F77_INT n = TO_F77_INT (gx.rows());
+ F77_INT nf = TO_F77_INT (of.rows());
+ F77_INT gn = TO_F77_INT (gx.cols());
+ F77_INT on = TO_F77_INT (ox.cols());
+ F77_INT nparam = TO_F77_INT (param.numel());
Matrix gf = Matrix(nf,gn);
Matrix gvar = Matrix(gn,1);