changeset 7361:a2870fd8ac58

[project @ 2008-01-12 07:50:54 by jwe]
author jwe
date Sat, 12 Jan 2008 07:50:55 +0000
parents 1e716cb4b2a3
children 94f66d813b2d
files ChangeLog Makeconf.in aclocal.m4 configure.in scripts/ChangeLog scripts/optimization/sqp.m scripts/plot/Makefile.in scripts/plot/gnuplot_binary.in scripts/plot/gnuplot_binary.m src/ChangeLog src/DLD-FUNCTIONS/__qp__.cc src/oct-conf.h.in src/toplev.cc
diffstat 13 files changed, 141 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jan 11 02:59:02 2008 +0000
+++ b/ChangeLog	Sat Jan 12 07:50:55 2008 +0000
@@ -1,3 +1,12 @@
+2008-01-12  John W. Eaton  <jwe@octave.org>
+
+	* aclocal.m4: Call AC_SUBST instead of AC_DEFINE_UNQOTED for
+	GNUPLOT_BINARY.
+	* aclocal.m4, configure.in: Use GNUPLOT instead of GNUPLOT_BINARY
+	as variable name.
+	* Makeconf.in (GNUPLOT): Substitute.
+	(do-subst-config-vals): Substitute GNUPLOT.
+
 2007-12-21  John W. Eaton  <jwe@octave.org>
 
 	Version 3.0.0 released.
--- a/Makeconf.in	Fri Jan 11 02:59:02 2008 +0000
+++ b/Makeconf.in	Sat Jan 12 07:50:55 2008 +0000
@@ -35,6 +35,8 @@
 PERL = @PERL@
 PYTHON = @PYTHON@
 
+GNUPLOT = @GNUPLOT@
+
 DESKTOP_FILE_INSTALL = @DESKTOP_FILE_INSTALL@
 
 # A shell command to extract the version number from version.h.
@@ -478,6 +480,7 @@
   -e "s|%OCTAVE_CONF_FLIBS%|\"${FLIBS}\"|" \
   -e "s|%OCTAVE_CONF_FPICFLAG%|\"${FPICFLAG}\"|" \
   -e "s|%OCTAVE_CONF_GLPK_LIBS%|\"${GLPK_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_GNUPLOT%|\"${GNUPLOT}\"|" \
   -e "s|%OCTAVE_CONF_INCFLAGS%|\"${INCFLAGS}\"|" \
   -e "s|%OCTAVE_CONF_INCLUDEDIR%|\"${includedir}\"|" \
   -e "s|%OCTAVE_CONF_LD_CXX%|\"${LD_CXX}\"|" \
--- a/aclocal.m4	Fri Jan 11 02:59:02 2008 +0000
+++ b/aclocal.m4	Sat Jan 12 07:50:55 2008 +0000
@@ -502,13 +502,14 @@
   ;;
 esac
 if test "$cross_compiling" = yes; then
-  AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host)
+  GNUPLOT="$gp_default"
+  AC_MSG_RESULT(assuming $GNUPLOT exists on $canonical_host_type host)
 else
-  AC_CHECK_PROGS(GNUPLOT_BINARY, $gp_names)
-  if test -z "$GNUPLOT_BINARY"; then
+  AC_CHECK_PROGS(GNUPLOT, $gp_names)
+  if test -z "$GNUPLOT"; then
     warn_gnuplot=yes
 
-    GNUPLOT_BINARY="$gp_default"
+    GNUPLOT="$gp_default"
 
     ## If you change this text, be sure to also copy it to the set of
     ## warnings at the end of the script
@@ -524,10 +525,10 @@
     AC_MSG_WARN([])
     AC_MSG_WARN([at the Octave prompt.])
     AC_MSG_WARN([])
-    AC_MSG_WARN([Setting default value to $GNUPLOT_BINARY])
+    AC_MSG_WARN([Setting default value to $GNUPLOT])
   fi
 fi
-AC_DEFINE_UNQUOTED(GNUPLOT_BINARY, "$GNUPLOT_BINARY", [Name of gnuplot program.])
+AC_SUBST(GNUPLOT)
 ])
 dnl
 dnl Is gperf installed?
--- a/configure.in	Fri Jan 11 02:59:02 2008 +0000
+++ b/configure.in	Sat Jan 12 07:50:55 2008 +0000
@@ -29,7 +29,7 @@
 EXTERN_CXXFLAGS="$CXXFLAGS"
 
 AC_INIT
-AC_REVISION($Revision: 1.601 $)
+AC_REVISION($Revision: 1.602 $)
 AC_PREREQ(2.57)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -1875,7 +1875,7 @@
   QHULL libraries:	$QHULL_LIBS
   LIBS:                 $LIBS
   Default pager:        $DEFAULT_PAGER
-  gnuplot:              $GNUPLOT_BINARY
+  gnuplot:              $GNUPLOT
 
   Do internal array bounds checking:  $BOUNDS_CHECKING
   Build static libraries:             $STATIC_LIBS
--- a/scripts/ChangeLog	Fri Jan 11 02:59:02 2008 +0000
+++ b/scripts/ChangeLog	Sat Jan 12 07:50:55 2008 +0000
@@ -1,3 +1,18 @@
+2008-01-12  John W. Eaton  <jwe@octave.org>
+
+	* plot/gnuplot_binary.in: New file.
+	* plot/gnuplot_binary.m: Delete.
+	* plot/Makefile.in (SOURCES): Remove gnuplot_binary.m from the list.
+	(SOURCES_IN, GEN_M): New macros.
+	(DISTFILES): Include $(SOURCES_IN) in the list.
+	(FCN_FILES): Include $(GEN_M) in the list.
+	(all): Depend on $(GEN_M).
+	($(GEN_M): %.m : $(TOPDIR)/Makeconf): New pattern rule.
+
+2008-01-11  John W. Eaton  <jwe@octave.org>
+
+	* optimization/sqp.m: New test from example in doc string.
+
 2008-01-10  Ben Abbott  <bpabbott@mac.com>
 
 	* polynomial/mpoles.m: Avoid cases where poles could be assigned
--- a/scripts/optimization/sqp.m	Fri Jan 11 02:59:02 2008 +0000
+++ b/scripts/optimization/sqp.m	Sat Jan 12 07:50:55 2008 +0000
@@ -712,3 +712,29 @@
   endif
 
 ### endfunction
+
+%! function r = g (x)
+%!
+%!   r = [ sumsq(x)-10;
+%!         x(2)*x(3)-5*x(4)*x(5);
+%!         x(1)^3+x(2)^3+1 ];
+%! endfunction
+%!
+%! function obj = phi (x)
+%!   obj = exp(prod(x)) - 0.5*(x(1)^3+x(2)^3+1)^2;
+%! endfunction
+%!
+%!test
+%! x0 = [-1.8; 1.7; 1.9; -0.8; -0.8];
+%!
+%! [x, obj, info, iter, nf, lambda] = sqp (x0, @phi, @g, [])
+%!
+%! x_opt = [-1.717143501952599;
+%!           1.595709610928535;
+%!           1.827245880097156;
+%!          -0.763643103133572;
+%!          -0.763643068453300];
+%!
+%! obj_opt = 0.0539498477702739
+%!
+%! assert (all (abs (x-x_opt) < sqrt (eps)) && abs (obj-obj_opt) < sqrt (eps));
--- a/scripts/plot/Makefile.in	Fri Jan 11 02:59:02 2008 +0000
+++ b/scripts/plot/Makefile.in	Sat Jan 12 07:50:55 2008 +0000
@@ -103,7 +103,6 @@
   fplot.m \
   gca.m \
   gcf.m \
-  gnuplot_binary.m \
   grid.m \
   hidden.m \
   hist.m \
@@ -167,12 +166,16 @@
   zlabel.m \
   zlim.m
 
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
+SOURCES_IN = gnuplot_binary.in
+
+GEN_M = $(SOURCES_IN:.in=.m)
 
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
+DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES) $(SOURCES_IN))
+
+FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES)) $(GEN_M)
 FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
 
-all: PKG_ADD
+all: $(GEN_M) PKG_ADD
 .PHONY: all
 
 install install-strip:
@@ -210,3 +213,6 @@
 dist:
 	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/plot
 .PHONY: dist
+
+$(GEN_M): %.m : %.in $(TOPDIR)/Makeconf
+	@$(do-subst-config-vals)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/gnuplot_binary.in	Sat Jan 12 07:50:55 2008 +0000
@@ -0,0 +1,50 @@
+## Copyright (C) 2008 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave 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.
+##
+## Octave 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 Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Loadable Function} {@var{val} =} gnuplot_binary ()
+## @deftypefnx {Loadable Function} {@var{old_val} =} gnuplot_binary (@var{new_val})
+## Query or set the name of the program invoked by the plot command.
+## The default value @code{\"gnuplot\"}.  @xref{Installation}.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = gnuplot_binary (new_val)
+
+  persistent gp_binary = %OCTAVE_CONF_GNUPLOT%;
+
+  if (nargout > 0 || nargin == 0)
+    retval = gp_binary;
+  endif
+
+  if (nargin == 1)
+    if (ischar (new_val))
+      if (! isempty (new_val))
+	gp_binary = new_val;
+      else
+	error ("gnuplot_binary: value must not be empty");
+      endif
+    else
+      error ("gnuplot_binary: expecting arg to be a character string");
+    endif
+  elseif (nargin > 1)
+    print_usage ();
+  endif
+
+endfunction
--- a/scripts/plot/gnuplot_binary.m	Fri Jan 11 02:59:02 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-## Copyright (C) 2008 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave 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.
-##
-## Octave 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 Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Loadable Function} {@var{val} =} gnuplot_binary ()
-## @deftypefnx {Loadable Function} {@var{old_val} =} gnuplot_binary (@var{new_val})
-## Query or set the name of the program invoked by the plot command.
-## The default value @code{\"gnuplot\"}.  @xref{Installation}.
-## @end deftypefn
-
-## Author: jwe
-
-function retval = gnuplot_binary (new_val)
-
-  persistent gp_binary = "gnuplot";
-
-  if (nargout > 0 || nargin == 0)
-    retval = gp_binary;
-  endif
-
-  if (nargin == 1)
-    if (ischar (new_val))
-      if (! isempty (new_val))
-	gp_binary = new_val;
-      else
-	error ("gnuplot_binary: value must not be empty");
-      endif
-    else
-      error ("gnuplot_binary: expecting arg to be a character string");
-    endif
-  elseif (nargin > 1)
-    print_usage ();
-  endif
-
-endfunction
--- a/src/ChangeLog	Fri Jan 11 02:59:02 2008 +0000
+++ b/src/ChangeLog	Sat Jan 12 07:50:55 2008 +0000
@@ -1,3 +1,13 @@
+2008-01-12  John W. Eaton  <jwe@octave.org>
+
+	* toplev.cc (octave_config_info): Add GNUPLOT to the struct.
+	* oct-conf.h.in (OCTAVE_CONF_GNUPLOT): New macro.
+
+2008-01-11  John W. Eaton  <jwe@octave.org>
+
+	* DLD-FUNCTIONS/__qp__.cc (qp): Undo part of change from
+	2007-09-04 (compute Y at each iteration).
+
 2008-01-10  John W. Eaton  <jwe@octave.org>
 
 	* DLD-FUNCTIONS/fsolve.cc (Ffsolve): Doc fix.
--- a/src/DLD-FUNCTIONS/__qp__.cc	Fri Jan 11 02:59:02 2008 +0000
+++ b/src/DLD-FUNCTIONS/__qp__.cc	Sat Jan 12 07:50:55 2008 +0000
@@ -1,6 +1,6 @@
 /*
 
-Copyright (C) 2000, 2001, 2004, 2005, 2006, 2007 Gabriele Pannocchia
+Copyright (C) 2000, 2001, 2004, 2005, 2006, 2007, 2008 Gabriele Pannocchia
 
 This file is part of Octave.
 
@@ -226,6 +226,9 @@
 	  // FIXME -- still remain to handle the case of
 	  // non-full rank active set matrix.
 
+	  // Computing the Y matrix (orthogonal to Z)
+	  Y = Aact.pseudo_inverse ();
+
 	  // Reduced Hessian
 	  Matrix Zt = Z.transpose ();
 	  Matrix rH = Zt * H * Z;
@@ -313,7 +316,6 @@
 	      // Computing the multipliers only for the inequality
 	      // constraints that are active.  We do NOT compute
 	      // multipliers for the equality constraints.
- 	      Y = Aact.pseudo_inverse ();
 	      Matrix Yt = Y.transpose ();
 	      Yt = Yt.extract_n (n_eq, 0, n_act-n_eq, n);
 	      lambda_tmp = Yt * (g + H * p);
--- a/src/oct-conf.h.in	Fri Jan 11 02:59:02 2008 +0000
+++ b/src/oct-conf.h.in	Sat Jan 12 07:50:55 2008 +0000
@@ -157,6 +157,10 @@
 #define OCTAVE_CONF_GLPK_LIBS %OCTAVE_CONF_GLPK_LIBS%
 #endif
 
+#ifndef OCTAVE_CONF_GNUPLOT
+#define OCTAVE_CONF_GNUPLOT %OCTAVE_CONF_GNUPLOT%
+#endif
+
 #ifndef OCTAVE_CONF_INCFLAGS
 #define OCTAVE_CONF_INCFLAGS %OCTAVE_CONF_INCFLAGS%
 #endif
--- a/src/toplev.cc	Fri Jan 11 02:59:02 2008 +0000
+++ b/src/toplev.cc	Sat Jan 12 07:50:55 2008 +0000
@@ -819,6 +819,7 @@
       { false, "FLIBS", OCTAVE_CONF_FLIBS },
       { false, "FPICFLAG", OCTAVE_CONF_FPICFLAG },
       { false, "GLPK_LIBS", OCTAVE_CONF_GLPK_LIBS },
+      { false, "GNUPLOT", OCTAVE_CONF_GNUPLOT },
       { false, "INCFLAGS", OCTAVE_CONF_INCFLAGS },
       { false, "LDFLAGS", OCTAVE_CONF_LDFLAGS },
       { false, "LD_CXX", OCTAVE_CONF_LD_CXX },