# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1336420951 14400 # Node ID c2ca3b71cd7c4513cfe9967bfda4b116183aa7a5 # Parent eeddf586cf0f53fe839467461b96ca0c57c9021a# Parent 34f067bcac1230469205f7f211456fd8f7feaf4c maint: periodic merge of default to gui diff -r eeddf586cf0f -r c2ca3b71cd7c configure.ac --- a/configure.ac Mon May 07 21:44:32 2012 +0200 +++ b/configure.ac Mon May 07 16:02:31 2012 -0400 @@ -193,7 +193,7 @@ [if test "$enableval" = no; then DOCDIR= warn_docs="building documentation disabled; make dist will fail" - AC_MSG_WARN([$warn_docs]) + OCTAVE_CONFIGURE_WARNING([warn_docs]) fi], []) AC_SUBST(DOCDIR) @@ -217,12 +217,12 @@ AC_DEFINE(IDX_TYPE_LONG, 1, [Define to 1 if octave index type is long]) else warn_64_bit="no suitable type found for octave_idx_type so disabling 64-bit features" - AC_MSG_WARN([$warn_64_bit]) + OCTAVE_CONFIGURE_WARNING([warn_64_bit]) USE_64_BIT_IDX_T=false fi else warn_64_bit="pointers are not 64-bits wide so disabling 64-bit features" - AC_MSG_WARN([$warn_64_bit]) + OCTAVE_CONFIGURE_WARNING([warn_64_bit]) USE_64_BIT_IDX_T=false fi fi @@ -286,7 +286,7 @@ case "$gcc_version" in [12].*) warn_gcc_version="gcc version $gcc_version is likely to cause problems" - AC_MSG_WARN([$warn_gcc_version]) + OCTAVE_CONFIGURE_WARNING([warn_gcc_version]) ;; esac @@ -1348,13 +1348,15 @@ ## libraries needed for native graphics renderer warn_freetype="" +native_graphics=true check_opengl=false AC_ARG_WITH([opengl], [AS_HELP_STRING([--without-opengl], [don't use OpenGL libraries, disable native graphics])], [if test "x$withval" = xno; then warn_opengl="--without-opengl specified. Native graphics will be disabled." - AC_MSG_WARN([$warn_opengl]) + OCTAVE_CONFIGURE_WARNING([warn_opengl]) + native_graphics=false else check_opengl=true fi], @@ -1370,6 +1372,8 @@ if test -z "$OPENGL_LIBS"; then if $check_opengl; then warn_fltk_opengl="OpenGL libs (GL and GLU) not found. Native graphics will be disabled." + OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl]) + native_graphics=false fi fi @@ -1382,6 +1386,11 @@ XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FT2_CFLAGS"], [warn_freetype="FreeType library not found. Native graphics will be disabled."]) + if test -n "$warn_freetype"; then + OCTAVE_CONFIGURE_WARNING([warn_freetype]) + native_graphics=false + fi + ## fontconfig library warn_fontconfig="" @@ -1395,6 +1404,11 @@ warn_fontconfig="Fontconfig library not found. Native graphics will be disabled."]) fi + if test -n "$warn_fontconfig"; then + OCTAVE_CONFIGURE_WARNING([warn_fontconfig]) + native_graphics=false + fi + ## fltk (www.fltk.org) AC_ARG_WITH([fltk-prefix], [ @@ -1430,6 +1444,8 @@ if test "$FLTK_CONFIG" = "no" ; then warn_fltk_config="FLTK config script not found. Native graphics will be disabled." + OCTAVE_CONFIGURE_WARNING([warn_fltk_config]) + native_graphics=false else FLTK_CFLAGS="`$FLTK_CONFIG $fltkconf_args --use-gl --cflags`" FLTK_LDFLAGS="`$FLTK_CONFIG $fltkconf_args --use-gl --ldflags`" @@ -1456,6 +1472,9 @@ if test -z "$warn_fltk_opengl"; then GRAPHICS_CFLAGS="$FLTK_CFLAGS" GRAPHICS_LIBS="$FLTK_LDFLAGS" + else + OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl]) + native_graphics=false fi CFLAGS="$save_CFLAGS" fi @@ -2420,7 +2439,7 @@ if test -n "$DOCDIR" && test -n "$warn_gnuplot"; then DOCDIR= warn_docs="building documentation disabled because gnuplot was not found; make dist will fail" - AC_MSG_WARN([$warn_docs]) + OCTAVE_CONFIGURE_WARNING([warn_docs]) fi AM_CONDITIONAL([AMCOND_BUILD_DOCS], [test -n "$DOCDIR"]) @@ -2771,6 +2790,8 @@ warn_msg_printed=false +OCTAVE_CONFIGURE_WARNING_SUMMARY + if $ENABLE_DYNAMIC_LINKING; then if $SHARED_LIBS; then true @@ -2781,156 +2802,6 @@ fi fi -if test -n "$gxx_only"; then - AC_MSG_WARN([$gxx_only]) - warn_msg_printed=true -fi - -if test -n "$warn_gcc_version"; then - AC_MSG_WARN([$warn_gcc_version]) - warn_msg_printed=true -fi - -if test -n "$warn_gcc_only"; then - AC_MSG_WARN([$warn_gcc_only]) - warn_msg_printed=true -fi - -if test -n "$warn_readline"; then - AC_MSG_WARN([$warn_readline]) - warn_msg_printed=true -fi - -if test -n "$warn_termlibs"; then - AC_MSG_WARN([$warn_termlibs]) - warn_msg_printed=true -fi - -if test -n "$warn_gperf"; then - AC_MSG_WARN([$warn_gperf]) - warn_msg_printed=true -fi - -if test -n "$warn_flex"; then - AC_MSG_WARN([$warn_flex]) - warn_msg_printed=true -fi - -if test -n "$warn_bison"; then - AC_MSG_WARN([$warn_bison]) - warn_msg_printed=true -fi - -if test -n "$warn_less"; then - AC_MSG_WARN([$warn_less]) - warn_msg_printed=true -fi - -if test -n "$warn_umfpack"; then - AC_MSG_WARN([$warn_umfpack]) - warn_msg_printed=true -fi - -if test -n "$warn_qrupdate"; then - AC_MSG_WARN([$warn_qrupdate]) - warn_msg_printed=true -fi - -if test -n "$warn_amd"; then - AC_MSG_WARN([$warn_amd]) - warn_msg_printed=true -fi - -if test -n "$warn_colamd"; then - AC_MSG_WARN([$warn_colamd]) - warn_msg_printed=true -fi - -if test -n "$warn_ccolamd"; then - AC_MSG_WARN([$warn_ccolamd]) - warn_msg_printed=true -fi - -if test -n "$warn_cholmod"; then - AC_MSG_WARN([$warn_cholmod]) - warn_msg_printed=true -fi - -if test -n "$warn_cxsparse"; then - AC_MSG_WARN([$warn_cxsparse]) - warn_msg_printed=true -fi - -if test -n "$warn_curl"; then - AC_MSG_WARN([$warn_curl]) - warn_msg_printed=true -fi - -if test -n "$warn_fftw"; then - AC_MSG_WARN([$warn_fftw]) - warn_msg_printed=true -fi - -if test -n "$warn_glpk"; then - AC_MSG_WARN([$warn_glpk]) - warn_msg_printed=true -fi - -if test -n "$warn_magick"; then - AC_MSG_WARN([$warn_magick]) - warn_msg_printed=true -fi - -if test -n "$warn_hdf5"; then - AC_MSG_WARN([$warn_hdf5]) - warn_msg_printed=true -fi - -if test -n "$warn_regex"; then - AC_MSG_WARN([$warn_regex]) - warn_msg_printed=true -fi - -if test -n "$warn_pcre"; then - AC_MSG_WARN([$warn_pcre]) - warn_msg_printed=true -fi - -if test -n "$warn_qhull"; then - AC_MSG_WARN([$warn_qhull]) - warn_msg_printed=true -fi - -if test -n "$warn_zlib"; then - AC_MSG_WARN([$warn_zlib]) - warn_msg_printed=true -fi - -if test -n "$warn_ghostscript"; then - AC_MSG_WARN([$warn_ghostscript]) - warn_msg_printed=true -fi - -if test -n "$warn_texi2dvi"; then - AC_MSG_WARN([$warn_texi2dvi]) - warn_msg_printed=true -fi - -if test -n "$warn_texi2pdf"; then - AC_MSG_WARN([$warn_texi2pdf]) - warn_msg_printed=true -fi - -if test -n "$warn_docs"; then - AC_MSG_WARN([$warn_docs]) - warn_msg_printed=true -fi - -if test -n "$warn_64_bit"; then - AC_MSG_WARN([$warn_64_bit]) - warn_msg_printed=true -fi - if $USE_64_BIT_IDX_T; then AC_MSG_WARN([]) AC_MSG_WARN([You used the EXPERIMENTAL --enable-64 option.]) @@ -2961,37 +2832,6 @@ warn_msg_printed=true fi -native_graphics=true -if test -n "$warn_opengl"; then - AC_MSG_WARN([$warn_opengl]) - native_graphics=false - warn_msg_printed=true -fi - -if test -n "$warn_freetype"; then - AC_MSG_WARN([$warn_freetype]) - native_graphics=false - warn_msg_printed=true -fi - -if test -n "$warn_fontconfig"; then - AC_MSG_WARN([$warn_fontconfig]) - native_graphics=false - warn_msg_printed=true -fi - -if test -n "$warn_fltk_config"; then - AC_MSG_WARN([$warn_fltk_config]) - native_graphics=false - warn_msg_printed=true -fi - -if test -n "$warn_fltk_opengl"; then - AC_MSG_WARN([$warn_fltk_opengl]) - native_graphics=false - warn_msg_printed=true -fi - if $native_graphics; then true; else diff -r eeddf586cf0f -r c2ca3b71cd7c libcruft/blas-xtra/cconv2.f --- a/libcruft/blas-xtra/cconv2.f Mon May 07 21:44:32 2012 +0200 +++ b/libcruft/blas-xtra/cconv2.f Mon May 07 16:02:31 2012 -0400 @@ -70,7 +70,7 @@ do k = 1,na-nb+1 do j = 1,nb do i = 1,mb - call caxpy(ma-mb+1,b(i,j),a(mb+1-i,k+j-1),1,c(1,k),1) + call caxpy(ma-mb+1,b(i,j),a(mb+1-i,k+nb-j),1,c(1,k),1) end do end do end do diff -r eeddf586cf0f -r c2ca3b71cd7c libcruft/blas-xtra/csconv2.f --- a/libcruft/blas-xtra/csconv2.f Mon May 07 21:44:32 2012 +0200 +++ b/libcruft/blas-xtra/csconv2.f Mon May 07 16:02:31 2012 -0400 @@ -76,7 +76,7 @@ do j = 1,nb do i = 1,mb btmp = b(i,j) - call caxpy(ma-mb+1,btmp,a(mb+1-i,k+j-1),1,c(1,k),1) + call caxpy(ma-mb+1,btmp,a(mb+1-i,k+nb-j),1,c(1,k),1) end do end do end do diff -r eeddf586cf0f -r c2ca3b71cd7c libcruft/blas-xtra/dconv2.f --- a/libcruft/blas-xtra/dconv2.f Mon May 07 21:44:32 2012 +0200 +++ b/libcruft/blas-xtra/dconv2.f Mon May 07 16:02:31 2012 -0400 @@ -70,7 +70,7 @@ do k = 1,na-nb+1 do j = 1,nb do i = 1,mb - call daxpy(ma-mb+1,b(i,j),a(mb+1-i,k+j-1),1,c(1,k),1) + call daxpy(ma-mb+1,b(i,j),a(mb+1-i,k+nb-j),1,c(1,k),1) end do end do end do diff -r eeddf586cf0f -r c2ca3b71cd7c libcruft/blas-xtra/sconv2.f --- a/libcruft/blas-xtra/sconv2.f Mon May 07 21:44:32 2012 +0200 +++ b/libcruft/blas-xtra/sconv2.f Mon May 07 16:02:31 2012 -0400 @@ -70,7 +70,7 @@ do k = 1,na-nb+1 do j = 1,nb do i = 1,mb - call saxpy(ma-mb+1,b(i,j),a(mb+1-i,k+j-1),1,c(1,k),1) + call saxpy(ma-mb+1,b(i,j),a(mb+1-i,k+nb-j),1,c(1,k),1) end do end do end do diff -r eeddf586cf0f -r c2ca3b71cd7c libcruft/blas-xtra/zconv2.f --- a/libcruft/blas-xtra/zconv2.f Mon May 07 21:44:32 2012 +0200 +++ b/libcruft/blas-xtra/zconv2.f Mon May 07 16:02:31 2012 -0400 @@ -70,7 +70,7 @@ do k = 1,na-nb+1 do j = 1,nb do i = 1,mb - call zaxpy(ma-mb+1,b(i,j),a(mb+1-i,k+j-1),1,c(1,k),1) + call zaxpy(ma-mb+1,b(i,j),a(mb+1-i,k+nb-j),1,c(1,k),1) end do end do end do diff -r eeddf586cf0f -r c2ca3b71cd7c libcruft/blas-xtra/zdconv2.f --- a/libcruft/blas-xtra/zdconv2.f Mon May 07 21:44:32 2012 +0200 +++ b/libcruft/blas-xtra/zdconv2.f Mon May 07 16:02:31 2012 -0400 @@ -76,7 +76,7 @@ do j = 1,nb do i = 1,mb btmp = b(i,j) - call zaxpy(ma-mb+1,btmp,a(mb+1-i,k+j-1),1,c(1,k),1) + call zaxpy(ma-mb+1,btmp,a(mb+1-i,k+nb-j),1,c(1,k),1) end do end do end do diff -r eeddf586cf0f -r c2ca3b71cd7c m4/acinclude.m4 --- a/m4/acinclude.m4 Mon May 07 21:44:32 2012 +0200 +++ b/m4/acinclude.m4 Mon May 07 16:02:31 2012 -0400 @@ -406,6 +406,25 @@ ]) dnl dnl +dnl Adds warnings to final summary +dnl +AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [ + AC_MSG_WARN([$][$1]) + m4_set_add([summary_warning_list], [$1]) +]) +dnl +dnl +dnl Prints final summary +dnl +AC_DEFUN([OCTAVE_CONFIGURE_WARNING_SUMMARY], [ + m4_set_foreach([summary_warning_list], [elt], [ + if test -n "[$]elt"; then + AC_MSG_WARN([$]elt) + warn_msg_printed=true + fi]) +]) +dnl +dnl dnl dnl OCTAVE_CHECK_LIBRARY(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC, dnl LANG, DOC-STRING, EXTRA-CHECK) @@ -446,6 +465,8 @@ [TEXINFO_]m4_toupper([$1])= warn_$1="$3" + m4_set_add([summary_warning_list], [warn_$1]) + if test -n "$m4_toupper([$1])_LIBS"; then octave_check_library_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS" diff -r eeddf586cf0f -r c2ca3b71cd7c scripts/general/bicubic.m --- a/scripts/general/bicubic.m Mon May 07 21:44:32 2012 +0200 +++ b/scripts/general/bicubic.m Mon May 07 16:02:31 2012 -0400 @@ -50,9 +50,9 @@ if (isa (x, "single") || isa (y, "single") || isa (z, "single") || isa (xi, "single") || isa (yi, "single")) - myeps = eps("single"); + myeps = eps ("single"); else - myeps = eps; + myeps = eps (); endif if (nargin <= 2) @@ -65,8 +65,8 @@ z = x; x = []; [rz, cz] = size (z); - s = linspace (1, cz, (cz-1)*pow2(n)+1); - t = linspace (1, rz, (rz-1)*pow2(n)+1); + s = linspace (1, cz, (cz-1) * pow2 (n) + 1); + t = linspace (1, rz, (rz-1) * pow2 (n) + 1); elseif (nargin == 3) if (! isvector (x) || ! isvector (y)) error ("bicubic: XI and YI must be vector"); @@ -88,6 +88,23 @@ error ("bicubic: X, Y and Z must be equal size matrices of same size"); endif + if (all (diff (x) < 0)) + flipx = true; + x = fliplr (x); + elseif (all (diff (x) > 0)) + flipx = false; + else + error ("bicubic:nonmonotonic", "bicubic: X values must be monotonic") + endif + if (all (diff (y) < 0)) + flipy = true; + y = flipud (y); + elseif (all (diff (y) > 0)) + flipy = false; + else + error ("bicubic:nonmonotonic", "bicubic: Y values must be monotonic") + endif + ## Mark values outside the lookup table. xfirst_ind = find (xi < x(1)); xlast_ind = find (xi > x(cz)); @@ -99,9 +116,8 @@ yi(yfirst_ind) = y(1); yi(ylast_ind) = y(rz); - x = reshape (x, 1, cz); - x(cz) *= 1 + sign (x(cz))*myeps; + x(cz) *= 1 + sign (x(cz)) * myeps; if (x(cz) == 0) x(cz) = myeps; endif; @@ -111,7 +127,7 @@ xidx = o(find (i > cz)); y = reshape (y, rz, 1); - y(rz) *= 1 + sign (y(rz))*myeps; + y(rz) *= 1 + sign (y(rz)) * myeps; if (y(rz) == 0) y(rz) = myeps; endif; @@ -121,8 +137,15 @@ yidx = o([find(i > rz)]); ## Set s and t used follow codes. - s = xidx + ((xi .- x(xidx))./(x(xidx+1) .- x(xidx))); - t = yidx + ((yi - y(yidx))./(y(yidx+1) - y(yidx))); + s = xidx + ((xi .- x(xidx)) ./ (x(xidx+1) .- x(xidx))); + t = yidx + ((yi - y(yidx)) ./ (y(yidx+1) - y(yidx))); + + if (flipx) + s = fliplr (s); + endif + if (flipy) + t = flipud (t); + endif else print_usage (); endif @@ -198,7 +221,6 @@ endfunction - %!demo %! clf; %! colormap ("default"); @@ -211,3 +233,15 @@ %! [x,y] = meshgrid (x,y); %! hold on; plot3 (x(:),y(:),A(:),"b*"); hold off; +%!test +%! x = linspace (1, -1, 10); +%! [xx, yy] = meshgrid (x); +%! z = cos (6 * xx) + sin (6 * yy); +%! x = linspace (1, -1, 30); +%! [xx2, yy2] = meshgrid (x); +%! z1 = interp2 (xx, yy, z, xx2, yy2, "cubic"); +%! z2 = interp2 (fliplr(xx), flipud(yy), fliplr(flipud(z)), +%! fliplr(xx2), flipud(yy2), "cubic"); +%! z2 = fliplr (flipud (z2)); +%! assert (z1, z2, 100 * eps ()) + diff -r eeddf586cf0f -r c2ca3b71cd7c scripts/optimization/sqp.m --- a/scripts/optimization/sqp.m Mon May 07 21:44:32 2012 +0200 +++ b/scripts/optimization/sqp.m Mon May 07 16:02:31 2012 -0400 @@ -186,12 +186,8 @@ function [x, obj, info, iter, nf, lambda] = sqp (x0, objf, cef, cif, lb, ub, maxiter, tolerance) - global __sqp_nfun__; - global __sqp_obj_fun__; - global __sqp_ce_fun__; - global __sqp_ci_fun__; - global __sqp_cif__; - global __sqp_cifcn__; + globals = struct (); # data and handles, needed and changed by + # subfunctions if (nargin < 2 || nargin > 8 || nargin == 5) print_usage (); @@ -204,12 +200,12 @@ x0 = x0'; endif - obj_grd = @fd_obj_grd; have_hess = 0; if (iscell (objf)) switch (numel (objf)) case 1 obj_fun = objf{1}; + obj_grd = @ (x) fd_obj_grd (x, obj_fun); case 2 obj_fun = objf{1}; obj_grd = objf{2}; @@ -223,17 +219,17 @@ endswitch else obj_fun = objf; # No cell array, only obj_fun set + obj_grd = @ (x) fd_obj_grd (x, obj_fun); endif - __sqp_obj_fun__ = obj_fun; ce_fun = @empty_cf; ce_grd = @empty_jac; if (nargin > 2) - ce_grd = @fd_ce_jac; if (iscell (cef)) switch (numel (cef)) case 1 ce_fun = cef{1}; + ce_grd = @ (x) fd_ce_jac (x, ce_fun); case 2 ce_fun = cef{1}; ce_grd = cef{2}; @@ -242,28 +238,28 @@ endswitch elseif (! isempty (cef)) ce_fun = cef; # No cell array, only constraint equality function set + ce_grd = @ (x) fd_ce_jac (x, ce_fun); endif endif - __sqp_ce_fun__ = ce_fun; ci_fun = @empty_cf; ci_grd = @empty_jac; if (nargin > 3) ## constraint function given by user with possible gradient - __sqp_cif__ = cif; + globals.cif = cif; ## constraint function given by user without gradient - __sqp_cifcn__ = @empty_cf; + globals.cifcn = @empty_cf; if (iscell (cif)) if (length (cif) > 0) - __sqp_cifcn__ = cif{1}; + globals.cifcn = cif{1}; endif elseif (! isempty (cif)) - __sqp_cifcn__ = cif; + globals.cifcn = cif; endif if (nargin < 5 || (nargin > 5 && isempty (lb) && isempty (ub))) ## constraint inequality function only without any bounds - ci_grd = @fd_ci_jac; + ci_grd = @ (x) fd_ci_jac (x, globals.cifcn); if (iscell (cif)) switch length (cif) case {1} @@ -279,35 +275,33 @@ endif else ## constraint inequality function with bounds present - global __sqp_lb__; lb_idx = ub_idx = true (size (x0)); ub_grad = - (lb_grad = eye (rows (x0))); if (isvector (lb)) - __sqp_lb__ = tmp_lb = lb(:); + globals.lb = tmp_lb = lb(:); lb_idx(:) = tmp_idx = (lb != -Inf); - __sqp_lb__ = __sqp_lb__(tmp_idx, 1); + globals.lb = globals.lb(tmp_idx, 1); lb_grad = lb_grad(lb_idx, :); elseif (isempty (lb)) if (isa (x0, "single")) - __sqp_lb__ = tmp_lb = -realmax ("single"); + globals.lb = tmp_lb = -realmax ("single"); else - __sqp_lb__ = tmp_lb = -realmax; + globals.lb = tmp_lb = -realmax; endif else error ("sqp: invalid lower bound"); endif - global __sqp_ub__; if (isvector (ub)) - __sqp_ub__ = tmp_ub = ub(:); + globals.ub = tmp_ub = ub(:); ub_idx(:) = tmp_idx = (ub != Inf); - __sqp_ub__ = __sqp_ub__(tmp_idx, 1); + globals.ub = globals.ub(tmp_idx, 1); ub_grad = ub_grad(ub_idx, :); elseif (isempty (ub)) if (isa (x0, "single")) - __sqp_ub__ = tmp_ub = realmax ("single"); + globals.ub = tmp_ub = realmax ("single"); else - __sqp_ub__ = tmp_ub = realmax; + globals.ub = tmp_ub = realmax; endif else error ("sqp: invalid upper bound"); @@ -317,11 +311,10 @@ error ("sqp: upper bound smaller than lower bound"); endif bounds_grad = [lb_grad; ub_grad]; - ci_fun = @ (x) cf_ub_lb (x, lb_idx, ub_idx); - ci_grd = @ (x) cigrad_ub_lb (x, bounds_grad); + ci_fun = @ (x) cf_ub_lb (x, lb_idx, ub_idx, globals); + ci_grd = @ (x) cigrad_ub_lb (x, bounds_grad, globals); endif - __sqp_ci_fun__ = ci_fun; endif # if (nargin > 3) iter_max = 100; @@ -354,7 +347,7 @@ x = x0; obj = feval (obj_fun, x0); - __sqp_nfun__ = 1; + globals.nfun = 1; c = feval (obj_grd, x0); @@ -432,8 +425,9 @@ ## Choose mu such that p is a descent direction for the chosen ## merit function phi. - [x_new, alpha, obj_new] = linesearch_L1 (x, p, obj_fun, obj_grd, - ce_fun, ci_fun, lambda, obj); + [x_new, alpha, obj_new, globals] = \ + linesearch_L1 (x, p, obj_fun, obj_grd, ce_fun, ci_fun, lambda, \ + obj, globals); ## Evaluate objective function, constraints, and gradients at x_new. c_new = feval (obj_grd, x_new); @@ -521,14 +515,13 @@ info = 103; endif - nf = __sqp_nfun__; + nf = globals.nfun; endfunction -function [merit, obj] = phi_L1 (obj, obj_fun, ce_fun, ci_fun, x, mu) - - global __sqp_nfun__; +function [merit, obj, globals] = phi_L1 (obj, obj_fun, ce_fun, ci_fun, \ + x, mu, globals) ce = feval (ce_fun, x); ci = feval (ci_fun, x); @@ -539,7 +532,7 @@ if (isempty (obj)) obj = feval (obj_fun, x); - __sqp_nfun__++; + globals.nfun++; endif merit = obj; @@ -552,8 +545,9 @@ endfunction -function [x_new, alpha, obj] = linesearch_L1 (x, p, obj_fun, obj_grd, - ce_fun, ci_fun, lambda, obj) +function [x_new, alpha, obj, globals] = \ + linesearch_L1 (x, p, obj_fun, obj_grd, ce_fun, ci_fun, lambda, \ + obj, globals) ## Choose parameters ## @@ -576,7 +570,8 @@ c = feval (obj_grd, x); ce = feval (ce_fun, x); - [phi_x_mu, obj] = phi_L1 (obj, obj_fun, ce_fun, ci_fun, x, mu); + [phi_x_mu, obj, globals] = phi_L1 (obj, obj_fun, ce_fun, ci_fun, x, \ + mu, globals); D_phi_x_mu = c' * p; d = feval (ci_fun, x); @@ -589,7 +584,8 @@ endif while (1) - [p1, obj] = phi_L1 ([], obj_fun, ce_fun, ci_fun, x+alpha*p, mu); + [p1, obj, globals] = phi_L1 ([], obj_fun, ce_fun, ci_fun, \ + x+alpha*p, mu, globals); p2 = phi_x_mu+eta*alpha*D_phi_x_mu; if (p1 > p2) ## Reset alpha = tau_alpha * alpha for some tau_alpha in the @@ -648,11 +644,9 @@ endfunction -function grd = fd_obj_grd (x) +function grd = fd_obj_grd (x, obj_fun) - global __sqp_obj_fun__; - - grd = fdgrd (__sqp_obj_fun__, x); + grd = fdgrd (obj_fun, x); endfunction @@ -671,47 +665,40 @@ endfunction -function jac = fd_ce_jac (x) +function jac = fd_ce_jac (x, ce_fun) - global __sqp_ce_fun__; - - jac = fdjac (__sqp_ce_fun__, x); + jac = fdjac (ce_fun, x); endfunction -function jac = fd_ci_jac (x) +function jac = fd_ci_jac (x, cifcn) - global __sqp_cifcn__; - ## __sqp_cifcn__ = constraint function without gradients and lb or ub - jac = fdjac (__sqp_cifcn__, x); + ## cifcn = constraint function without gradients and lb or ub + jac = fdjac (cifcn, x); endfunction -function res = cf_ub_lb (x, lbidx, ubidx) +function res = cf_ub_lb (x, lbidx, ubidx, globals) ## combine constraint function with ub and lb - global __sqp_cifcn__ __sqp_lb__ __sqp_ub__ - - if (isempty (__sqp_cifcn__)) - res = [x(lbidx,1)-__sqp_lb__; __sqp_ub__-x(ubidx,1)]; + if (isempty (globals.cifcn)) + res = [x(lbidx,1)-globals.lb; globals.ub-x(ubidx,1)]; else - res = [feval(__sqp_cifcn__,x); x(lbidx,1)-__sqp_lb__; - __sqp_ub__-x(ubidx,1)]; + res = [feval(globals.cifcn,x); x(lbidx,1)-globals.lb; + globals.ub-x(ubidx,1)]; endif endfunction -function res = cigrad_ub_lb (x, bgrad) - - global __sqp_cif__ +function res = cigrad_ub_lb (x, bgrad, globals) - cigradfcn = @fd_ci_jac; + cigradfcn = @ (x) fd_ci_jac (x, globals.cifcn); - if (iscell (__sqp_cif__) && length (__sqp_cif__) > 1) - cigradfcn = __sqp_cif__{2}; + if (iscell (globals.cif) && length (globals.cif) > 1) + cigradfcn = globals.cif{2}; endif if (isempty (cigradfcn)) diff -r eeddf586cf0f -r c2ca3b71cd7c src/DLD-FUNCTIONS/conv2.cc --- a/src/DLD-FUNCTIONS/conv2.cc Mon May 07 21:44:32 2012 +0200 +++ b/src/DLD-FUNCTIONS/conv2.cc Mon May 07 16:02:31 2012 -0400 @@ -262,9 +262,18 @@ %% Test cases from Bug #34893 %!assert (conv2 ([1:5;1:5], [1:2], "same"), [4 7 10 13 10; 4 7 10 13 10]) %!assert (conv2 ([1:5;1:5]', [1:2]', "same"), [4 7 10 13 10; 4 7 10 13 10]') -%!#assert (conv2 ([1:5;1:5], [1:2], "valid"), [4 7 10 13; 4 7 10 13]) +%!assert (conv2 ([1:5;1:5], [1:2], "valid"), [4 7 10 13; 4 7 10 13]) %!assert (conv2 ([1:5;1:5]', [1:2]', "valid"), [4 7 10 13; 4 7 10 13]') +%!test +%! rand ("seed", 42); +%! x = rand (100); +%! y = ones (5); +%! A = conv2 (x, y)(5:end-4,5:end-4); +%! B = conv2 (x, y, "valid"); +%! assert (B, A); ## Yes, this test is for *exact* equivalence. + + %% Test input validation %!error conv2 () %!error conv2 (1) diff -r eeddf586cf0f -r c2ca3b71cd7c src/graphics.cc --- a/src/graphics.cc Mon May 07 21:44:32 2012 +0200 +++ b/src/graphics.cc Mon May 07 16:02:31 2012 -0400 @@ -3044,7 +3044,7 @@ } Matrix -root_figure::properties::get_boundingbox (bool internal, const Matrix&) const +root_figure::properties::get_boundingbox (bool, const Matrix&) const { Matrix screen_size = screen_size_pixels (); Matrix pos = Matrix (1, 4, 0); diff -r eeddf586cf0f -r c2ca3b71cd7c src/symtab.cc --- a/src/symtab.cc Mon May 07 21:44:32 2012 +0200 +++ b/src/symtab.cc Mon May 07 16:02:31 2012 -0400 @@ -1143,11 +1143,11 @@ // Stash the nest_parent for resolving variables after parsing is done. octave_function *fv = fcn.function_value(); - symbol_table *fcn_table = get_instance (fv->scope()); + symbol_table *fcn_table_loc = get_instance (fv->scope()); symbol_table *parent_table = get_instance (parent_scope); - parent_table->add_nest_child (*fcn_table); + parent_table->add_nest_child (*fcn_table_loc); } octave_value