From 24dd4052607c8f212635872a4fc02f9be5054b09 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Sat, 28 Jul 2012 13:19:21 +0200 Subject: [PATCH] Remove unused octave code --- configure.ac | 1 - src/Makefile.am | 2 -- src/octave/Makefile.am | 20 ----------- src/octave/curve.m | 54 ---------------------------- src/octave/duneevaluate.cc | 66 ---------------------------------- src/octave/duneminimise.cc | 74 -------------------------------------- src/octave/octave.mk | 7 ---- src/octave/zigzag.m | 54 ---------------------------- 8 files changed, 278 deletions(-) delete mode 100644 src/octave/Makefile.am delete mode 100644 src/octave/curve.m delete mode 100644 src/octave/duneevaluate.cc delete mode 100644 src/octave/duneminimise.cc delete mode 100644 src/octave/octave.mk delete mode 100644 src/octave/zigzag.m diff --git a/configure.ac b/configure.ac index 7416cf73..36ba21d8 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,6 @@ LIBS="$DUNE_LIBS" AC_CONFIG_FILES([ Makefile src/Makefile - src/octave/Makefile doc/Makefile doc/doxygen/Makefile doc/doxygen/Doxyfile diff --git a/src/Makefile.am b/src/Makefile.am index e0ade588..7af3c3da 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,3 @@ -SUBDIRS = octave - check_PROGRAMS = \ test-gradient-horrible \ test-gradient-horrible-logarithmic \ diff --git a/src/octave/Makefile.am b/src/octave/Makefile.am deleted file mode 100644 index 627d9b6c..00000000 --- a/src/octave/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -SUBDIRS = - -AM_CPPFLAGS = \ - $(DUNE_CPPFLAGS) \ - -I$(top_srcdir) - -## Octave - -MKOCTFILE ?= mkoctfile -OCTAVE ?= octave - -OCTAVE_MODULES= duneminimise.oct duneevaluate.oct - -.PHONY: run-octave -run-octave: $(OCTAVE_MODULES) - $(OCTAVE) --path $(abs_builddir) --path $(abs_srcdir) - -include $(srcdir)/octave.mk - -include $(top_srcdir)/am/global-rules diff --git a/src/octave/curve.m b/src/octave/curve.m deleted file mode 100644 index 9e258340..00000000 --- a/src/octave/curve.m +++ /dev/null @@ -1,54 +0,0 @@ -% -*- mode:octave -*- - -clear all -close all - -if exist('graphics_toolkit','file') graphics_toolkit('fltk') end - -A=[ - 1 0 - 0 1 -]; -b=[ - 1 - 2.5 -]; -func = 'S'; % slope 1/100 - -x = -.1:.005: .4; -y = .9:.005:1.1; -[X, Y] = meshgrid(x,y); -xlabel('x') -ylabel('y') - -tic -for i=1:length(y) - in = [ X(i,:); Y(i,:) ]; - f(i,:) = duneevaluate(A,b,func, in); -end -clear X Y; -toc - -surf(x, y, f) -hold on; - -steps = 1100; -vecs = zeros(steps + 1, 2); -diffs = zeros(steps, 2); - -vecs(1,:) = [0; 0]; % So that we can always calculate a difference -vecs(2,:) = [0; 1]; % Start - -for j = 2:steps+1 - vecs(j+1,:) = duneminimise(A,b,func,vecs(j,:)); - diffs(j,:) = vecs(j+1,:) - vecs(j,:); - line([vecs(j,1) vecs(j+1,1)], ... - [vecs(j,2) vecs(j+1,2)], ... - [duneevaluate(A,b,func,vecs(j,:)') duneevaluate(A,b,func,vecs(j+1,:)')], ... - 'color', 'y'); -end - -axis tight; -xlabel x; -ylabel y; -hold off; diff --git a/src/octave/duneevaluate.cc b/src/octave/duneevaluate.cc deleted file mode 100644 index 6ac06c8f..00000000 --- a/src/octave/duneevaluate.cc +++ /dev/null @@ -1,66 +0,0 @@ -#include <octave/oct.h> - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <dune/common/shared_ptr.hh> - -#include <dune/tectonic/octave/duneoctave.hh> -#include <dune/tectonic/samplefunctional.hh> - -#include <cassert> - -DEFUN_DLD(duneevaluate, args, nargout, "duneevaluate(A,b,points)\n\ -\n\ -Evaluate x -> 1/2<Ax,x> - <b,x> + H(|x|) at each point y that is a column vector of A using DUNE\n") { - int const dim = 2; - - assert(args.length() == 4); - assert(nargout <= 1); - - typedef Dune::SampleFunctional<dim> Functional; - - Functional::SmallMatrix A; - Dune::octaveToDune<dim>(args(0).matrix_value(), A); - - Functional::SmallVector b; - Dune::octaveToDune<dim>(args(1).vector_value(), b); - - Dune::shared_ptr<Functional::NonlinearityType const> phi; - - charNDArray bar = args(2).char_array_value(); - switch (bar(0)) { - case 'S': { - Dune::NiceFunction const *pre_f = new Dune::SampleFunction<100>(); - Dune::shared_ptr<Dune::NiceFunction const> f(pre_f); - phi = Dune::make_shared<Functional::NonlinearityType const>(f); - break; - } - case 's': { - Dune::NiceFunction const *pre_f = new Dune::SampleFunction<2>(); - Dune::shared_ptr<Dune::NiceFunction const> f(pre_f); - phi = Dune::make_shared<Functional::NonlinearityType const>(f); - break; - } - case 't': { - Dune::NiceFunction const *pre_f = new Dune::TrivialFunction(); - Dune::shared_ptr<Dune::NiceFunction const> f(pre_f); - phi = Dune::make_shared<Functional::NonlinearityType const>(f); - break; - } - default: - assert(false); - } - Functional J(A, b, phi); - - Matrix points(args(3).matrix_value()); - size_t const columns = points.columns(); - RowVector ret(columns); - Functional::SmallVector our_point; - for (size_t i = 0; i < columns; ++i) { - Dune::octaveToDune<dim>(points.column(i), our_point); - ret(i) = J(our_point); - } - return octave_value(ret); -} diff --git a/src/octave/duneminimise.cc b/src/octave/duneminimise.cc deleted file mode 100644 index 8e0cf9bf..00000000 --- a/src/octave/duneminimise.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include <octave/oct.h> - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <cassert> - -#include <dune/common/shared_ptr.hh> - -#include <dune/tnnmg/problem-classes/bisection.hh> - -#include <dune/tectonic/octave/duneoctave.hh> -#include <dune/tectonic/samplefunctional.hh> - -DEFUN_DLD(duneminimise, args, nargout, "duneminimise(A,b,f,y)\n\ -\n\ -Make a minimisation step of x -> 1/2<Ax,x> - <b,x> + H(|x|) using DUNE starting at x\n") { - int const dim = 2; - - assert(args.length() == 4); - assert(nargout <= 1); - - typedef Dune::SampleFunctional<dim> Functional; - - Functional::SmallMatrix A; - Dune::octaveToDune<dim>(args(0).matrix_value(), A); - - Functional::SmallVector b; - Dune::octaveToDune<dim>(args(1).vector_value(), b); - - Dune::shared_ptr<Functional::NonlinearityType const> phi; - - charNDArray bar = args(2).char_array_value(); - switch (bar(0)) { - case 'S': { - Dune::NiceFunction const *pre_f = new Dune::SampleFunction<100>(); - Dune::shared_ptr<Dune::NiceFunction const> f(pre_f); - phi = Dune::make_shared<Functional::NonlinearityType const>(f); - break; - } - case 's': { - Dune::NiceFunction const *pre_f = new Dune::SampleFunction<2>(); - Dune::shared_ptr<Dune::NiceFunction const> f(pre_f); - phi = Dune::make_shared<Functional::NonlinearityType const>(f); - break; - } - case 't': { - Dune::NiceFunction const *pre_f = new Dune::TrivialFunction(); - Dune::shared_ptr<Dune::NiceFunction const> f(pre_f); - phi = Dune::make_shared<Functional::NonlinearityType const>(f); - break; - } - default: - assert(false); - } - Functional J(A, b, phi); - - ColumnVector start_octave(args(3).vector_value()); - Functional::SmallVector start; - Dune::octaveToDune<dim>(start_octave, start); - - Bisection const &bisection = - Bisection(0.0, // acceptError: Stop if the search interval has - // become smaller than this number - 1.0, // acceptFactor: ? - 1e-12, // requiredResidual: ? - true, // fastQuadratic - 0); // safety: acceptance factor for inexact minimization - Dune::minimise(J, start, 1, bisection); - - Dune::duneToOctave<dim>(start, start_octave); - return octave_value(start_octave); -} diff --git a/src/octave/octave.mk b/src/octave/octave.mk deleted file mode 100644 index 9d41dbdc..00000000 --- a/src/octave/octave.mk +++ /dev/null @@ -1,7 +0,0 @@ -$(OCTAVE_MODULES): %.oct: %.o - $(MKOCTFILE) -o $@ $< -ldunecommon - -$(OCTAVE_MODULES:.oct=.o): %.o: %.cc - $(MKOCTFILE) $(DEFS) $(AM_CPPFLAGS) -c -o $@ $< - -CLEANFILES = $(OCTAVE_MODULES) $(OCTAVE_MODULES:.oct=.o) diff --git a/src/octave/zigzag.m b/src/octave/zigzag.m deleted file mode 100644 index a6667c16..00000000 --- a/src/octave/zigzag.m +++ /dev/null @@ -1,54 +0,0 @@ -% -*- mode:octave -*- - -clear all -close all - -if exist('graphics_toolkit','file') graphics_toolkit('fltk') end - -A=[ - 3 1.5 - 1.5 4 -]; -b=[ - 1 - 2 -]; -func = 's'; % slope 1/2 - -x = -50:1:300; -y = -125:1:50; -[X, Y] = meshgrid(x,y); -xlabel('x') -ylabel('y') - -tic -for i=1:length(y) - in = [ X(i,:); Y(i,:) ]; - f(i,:) = duneevaluate(A,b,func,in); -end -clear X Y; -toc - -surf(x, y, f) -hold on; - -steps = 10; -vecs = zeros(steps + 1, 2); -diffs = zeros(steps, 2); - -vecs(1,:) = [ 0; 0]; % So that we can always calculate a difference -vecs(2,:) = [279; 0]; % Start - -for j = 2:steps+1 - vecs(j+1,:) = duneminimise(A,b,func,vecs(j,:)); - diffs(j,:) = vecs(j+1,:) - vecs(j,:); - line([vecs(j,1) vecs(j+1,1)], ... - [vecs(j,2) vecs(j+1,2)], ... - [duneevaluate(A,b,func,vecs(j,:)') duneevaluate(A,b,func,vecs(j+1,:)')], ... - 'color', 'y'); -end - -axis tight; -xlabel x; -ylabel y; -hold off; -- GitLab