changeset 20309:140ce5e857bf

maint: Periodic merge of stable to default.
author Rik <rik@octave.org>
date Tue, 23 Jun 2015 20:00:59 -0700
parents c2206fda3986 (diff) b8c1b3e9aa91 (current diff)
children 92c0fead20da
files libinterp/corefcn/graphics.in.h libinterp/corefcn/oct-hdf5.h libinterp/octave-value/ov-java.cc
diffstat 314 files changed, 5129 insertions(+), 3727 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Jun 23 09:59:54 2015 -0700
+++ b/.hgtags	Tue Jun 23 20:00:59 2015 -0700
@@ -94,3 +94,4 @@
 eba80000fa0dad32ba0f1cd767dd826d1ce1aba6 rc-4-0-0-2
 065f933ef08318e40b81f7fe75236e6175088117 rc-4-0-0-3
 42bb3a776c9fcc008669f382d2409297c4a901b3 rc-4-0-0-4
+3ccc2d02e64b61c6827009d42e5b12274e7ba5fc release-4-0-0
--- a/NEWS	Tue Jun 23 09:59:54 2015 -0700
+++ b/NEWS	Tue Jun 23 20:00:59 2015 -0700
@@ -1,3 +1,32 @@
+Summary of important user-visible changes for version 4.2:
+---------------------------------------------------------
+
+ ** Octal ('\NNN') and hex ('\xNN') escape sequences in single quoted
+    strings are now interpreted by the function do_string_escapes().
+    The *printf family of functions now supports octal and hex escape
+    sequences in single-quoted strings for Matlab compatibility.
+
+ ** Special octal and hex escape sequences for the pattern and replacement
+    strings in regular expressions are now interpreted for Matlab compatibility.
+
+    octal: '\oNNN' or '\o{NNN}'
+    hex  : '\xNN'  or '\x{NN}'
+
+ ** mkfifo now interprets the MODE argument as an octal, not decimal, integer.
+    This is consistent with the equivalent shell command. 
+
+ ** The griddata function no longer plots the interpolated mesh if no output
+    argument is requested, instead the vector or array of interpolated values
+    is always returned for Matlab compatibility.
+
+ ** The surfnorm function now returns unnormalized (magnitude != 1) normal
+    vectors for compatibility with Matlab.
+
+ ** Other new functions added in 4.2:
+
+      psi
+
+
 Summary of important user-visible changes for version 4.0:
 ---------------------------------------------------------
 
--- a/build-aux/common.mk	Tue Jun 23 09:59:54 2015 -0700
+++ b/build-aux/common.mk	Tue Jun 23 20:00:59 2015 -0700
@@ -537,7 +537,6 @@
     -e "s|%OCTAVE_CONF_CXXCPP%|\"${CXXCPP}\"|" \
     -e "s|%OCTAVE_CONF_CXXFLAGS%|\"${CXXFLAGS}\"|" \
     -e "s|%OCTAVE_CONF_CXXPICFLAG%|\"${CXXPICFLAG}\"|" \
-    -e "s|%OCTAVE_CONF_CXX_VERSION%|\"${CXX_VERSION}\"|" \
     -e "s|%OCTAVE_CONF_DEFAULT_PAGER%|\"${DEFAULT_PAGER}\"|" \
     -e "s|%OCTAVE_CONF_DEFS%|\"${DEFS}\"|" \
     -e "s|%OCTAVE_CONF_DEPEND_FLAGS%|\"${DEPEND_FLAGS}\"|" \
@@ -707,7 +706,6 @@
     -e "s|%OCTAVE_CONF_CXXCPP%|\"${CXXCPP}\"|" \
     -e "s|%OCTAVE_CONF_CXXFLAGS%|\"${CXXFLAGS}\"|" \
     -e "s|%OCTAVE_CONF_CXXPICFLAG%|\"${CXXPICFLAG}\"|" \
-    -e "s|%OCTAVE_CONF_CXX_VERSION%|\"${CXX_VERSION}\"|" \
     -e "s|%OCTAVE_CONF_DEFAULT_PAGER%|\"${DEFAULT_PAGER}\"|" \
     -e "s|%OCTAVE_CONF_DEFS%|\"${DEFS}\"|" \
     -e "s|%OCTAVE_CONF_DEPEND_FLAGS%|\"${DEPEND_FLAGS}\"|" \
--- a/build-aux/mk-opts.pl	Tue Jun 23 09:59:54 2015 -0700
+++ b/build-aux/mk-opts.pl	Tue Jun 23 20:00:59 2015 -0700
@@ -676,14 +676,14 @@
               $elt_type = "octave_idx_type";
             }
           print qq|    Array<$elt_type> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
-          print qq|    if (val.length () == 1)
+          print qq|    if (val.numel () == 1)
       {
         os << val(0) << "\\n";
       }
     else
       {
         os << "\\n\\n";
-        octave_idx_type len = val.length ();
+        octave_idx_type len = val.numel ();
         Matrix tmp (len, 1);
         for (octave_idx_type i = 0; i < len; i++)
           tmp(i,0) = val(i);
@@ -694,7 +694,7 @@
       elsif ($TYPE[$i] eq "Array<double>")
         {
           print qq|    Array<double> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
-          print qq|    if (val.length () == 1)
+          print qq|    if (val.numel () == 1)
       {
         os << val(0) << "\\n";
       }
@@ -709,7 +709,7 @@
       elsif ($TYPE[$i] eq "Array<float>")
         {
           print qq|    Array<float> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n|;
-          print qq|    if (val.length () == 1)
+          print qq|    if (val.numel () == 1)
       {
         os << val(0) << "\\n";
       }
@@ -856,13 +856,13 @@
               $elt_type = "octave_idx_type";
             }
           print "      Array<$elt_type> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
-          print "      if (val.length () == 1)
+          print "      if (val.numel () == 1)
         {
           retval = static_cast<double> (val(0));
         }
       else
         {
-          octave_idx_type len = val.length ();
+          octave_idx_type len = val.numel ();
           ColumnVector tmp (len);
           for (octave_idx_type i = 0; i < len; i++)
             tmp(i) = val(i);
@@ -872,7 +872,7 @@
       elsif ($TYPE[$i] eq "Array<double>")
         {
           print "      Array<double> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
-          print "      if (val.length () == 1)
+          print "      if (val.numel () == 1)
         {
           retval = val(0);
         }
@@ -884,7 +884,7 @@
       elsif ($TYPE[$i] eq "Array<float>")
         {
           print "      Array<float> val = $STATIC_OBJECT_NAME.$OPT[$i] ();\n\n";
-          print "      if (val.length () == 1)
+          print "      if (val.numel () == 1)
         {
           retval = val(0);
         }
--- a/configure.ac	Tue Jun 23 09:59:54 2015 -0700
+++ b/configure.ac	Tue Jun 23 20:00:59 2015 -0700
@@ -19,14 +19,14 @@
 ### <http://www.gnu.org/licenses/>.
 
 AC_PREREQ([2.63])
-AC_INIT([GNU Octave], [4.0.0], [http://octave.org/bugs.html], [octave])
+AC_INIT([GNU Octave], [4.1.0+], [http://octave.org/bugs.html], [octave])
 
 dnl Note that the version number is duplicated here and in AC_INIT
 dnl because AC_INIT requires it to be static, not computed from
 dnl shell variables.
 OCTAVE_MAJOR_VERSION=4
-OCTAVE_MINOR_VERSION=0
-OCTAVE_PATCH_VERSION=0
+OCTAVE_MINOR_VERSION=1
+OCTAVE_PATCH_VERSION=0+
 
 dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg
 OCTAVE_VERSION="$PACKAGE_VERSION"
@@ -584,11 +584,6 @@
 
 ### Determine the Fortran compiler and how to invoke it
 
-## Default FFLAGS is -O.
-if test -z "$FFLAGS"; then
-  FFLAGS="-O"
-fi
-
 ## Prefer gfortran, but the user's F77 environment variable will override.
 AC_PROG_F77([gfortran])
 if test -z "$F77"; then
--- a/doc/doxyhtml/Doxyfile.in	Tue Jun 23 09:59:54 2015 -0700
+++ b/doc/doxyhtml/Doxyfile.in	Tue Jun 23 20:00:59 2015 -0700
@@ -189,6 +189,23 @@
 MACRO_EXPANSION = YES
 EXPAND_ONLY_PREDEF = NO
 
+# We need to specify INCLUDE_PATH otherwise preprocessor will fail to
+# include, and macro expansion will not work.
+
+INCLUDE_PATH = \
+  @top_srcdir@/libgnu \
+  @top_srcdir@/libinterp/corefcn \
+  @top_srcdir@/libinterp/octave-value \
+  @top_srcdir@/libinterp/operators \
+  @top_srcdir@/libinterp/parse-tree \
+  @top_srcdir@/libinterp/template-inst \
+  @top_srcdir@/liboctave/array \
+  @top_srcdir@/liboctave/numeric \
+  @top_srcdir@/liboctave/operators \
+  @top_srcdir@/liboctave/system \
+  @top_srcdir@/liboctave/util \
+  @top_srcdir@/src
+
 # So that features that are behind #ifdef HAVE_FOO macros get processed by Doxygen
 
 PREDEFINED = HAVE_ARPACK=1          \
@@ -314,4 +331,4 @@
 
 # Some of our dependency graphs are really huge...
 
-DOT_GRAPH_MAX_NODES    = 100
\ No newline at end of file
+DOT_GRAPH_MAX_NODES    = 100
--- a/doc/interpreter/arith.txi	Tue Jun 23 09:59:54 2015 -0700
+++ b/doc/interpreter/arith.txi	Tue Jun 23 20:00:59 2015 -0700
@@ -315,6 +315,8 @@
 @anchor{XREFgammaln}
 @DOCSTRING(lgamma)
 
+@DOCSTRING(psi)
+
 @node Rational Approximations
 @section Rational Approximations
 
--- a/doc/interpreter/genpropdoc.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/doc/interpreter/genpropdoc.m	Tue Jun 23 20:00:59 2015 -0700
@@ -123,6 +123,7 @@
       case "busyaction"
       case "buttondownfcn"
         s.valid = valid_fcn;
+
       case "children"
         s.doc = "Graphics handles of the __objname__'s children.";
         s.valid = "vector of graphics handles";
@@ -195,9 +196,9 @@
 
       ## Specific properties
       case "callbackobject"
+        s.doc = "Graphics handle of the current object whose callback is executing.";
         s.valid = valid_handle;
 
-      case "commandwindowsize"
       case "currentfigure"
         s.doc = "Graphics handle of the current figure.";
         s.valid = valid_handle;
@@ -282,6 +283,7 @@
       ## Specific properties
       case "alphamap"
         s.doc = sprintf (doc_notimpl, "Transparency");
+
       case "closerequestfcn"
         s.valid = valid_fcn;
 
@@ -325,10 +327,14 @@
         s.doc = doc_unused;
 
       case "doublebuffer"
+
       case "filename"
-        s.doc = "The filename used when saving the plot figure";
+        s.doc = "The filename used when saving the plot figure.";
         s.valid = valid_string;
 
+      case "graphicssmoothing"
+        s.doc = doc_unused;
+
       case "integerhandle"
         s.doc = "Assign the next lowest unused integer as the Figure number.";
 
@@ -363,6 +369,10 @@
 property.";
         s.valid = valid_string;
 
+      ## FIXME: Uncomment when support added in graphics.in.h
+      #case "number"
+      #  s.doc = "Number of current figure (RO).";
+
       case "nextplot"
 
       case "numbertitle"
@@ -388,7 +398,7 @@
       case "papersize"
         s.doc = "Vector @code{[width height]} defining the size of the \
 paper for printing.  Setting this property forces the @code{papertype} \
-property to be set to @qcode{\"<custom>\"}.";
+property to the value @qcode{\"<custom>\"}.";
         s.valid = valid_2elvec;
 
       case "papertype"
@@ -410,15 +420,23 @@
 
       case "renderer"
       case "renderermode"
+
       case "resize"
+        s.doc = doc_unused;
+
       case "resizefcn"
         s.valid = valid_fcn;
 
       case "selectiontype"
-        s.doc = doc_unused;
+        ## FIXME: docstring explaining what "{normal}|open|alt|extend" mean.
+
+      case "sizechangedfcn"
+        s.valid = valid_fcn;
 
       case "toolbar"
-        s.doc = doc_unused;
+        s.doc = "Control the display of the toolbar along the bottom of the \
+figure window.  When set to @qcode{\"auto\"}, the display is based on the \
+value of the @code{menubar} property.";
 
       case "units"
         s.doc = "The unit used to compute the @code{position} and \
@@ -452,6 +470,9 @@
         s.valid = valid_fcn;
 
       case "windowstyle"
+        s.doc = doc_unused;
+
+      ## FIXME: Need to deprecate these for 4.2
       case "wvisual"
       case "wvisualmode"
       case "xdisplay"
@@ -471,12 +492,17 @@
       case "activepositionproperty"
       case "alim"
         s.doc = sprintf (doc_notimpl, "Transparency");
+
       case "alimmode"
       case "ambientlightcolor"
         s.doc = sprintf (doc_notimpl, "Light");
+
       case "box"
         s.doc = "Control whether the axes has a surrounding box.";
 
+      case "boxstyle"
+        s.doc = doc_unused;
+
       case "cameraposition"
         s.valid = valid_3elvec;
 
@@ -500,6 +526,9 @@
 
       case "climmode"
 
+      case "clippingstyle"
+        s.doc = doc_unused;
+
       case "color"
         s.doc = "Color of the axes background.  @xref{Colors, , colorspec}.";
         s.valid = valid_color;
@@ -509,6 +538,9 @@
 coloring.";
         s.valid = "N-by-3 RGB matrix";
 
+      case "colororderindex"
+        s.doc = doc_unused;
+
       case "currentpoint"
         s.doc = "Matrix @code{[xf, yf, zf; xb, yb, zb]} which holds the \
 coordinates (in axes data units) of the point over which the mouse pointer \
@@ -528,7 +560,6 @@
         s.valid = valid_3elvec;
 
       case "dataaspectratiomode"
-      case "drawmode"
       case "fontangle"
       case "fontname"
         s.doc = "Name of the font used for axes annotations.";
@@ -542,18 +573,53 @@
       case "fontunits"
         s.doc = "Unit used to interpret @code{fontsize} property.";
 
+      case "fontsmoothing"
+        s.doc = doc_unused;
+
       case "fontweight"
 
+      case "gridalpha"
+        s.doc = sprintf (doc_notimpl, "Transparency");
+
+      case "gridalphamode"
+        s.doc = doc_unused;
+
+      case "gridcolor"
+        s.doc = doc_unused;
+
+      case "gridcolormode"
+        s.doc = doc_unused;
+
       case "gridlinestyle"
       case "interpreter"
 
+      case "labelfontsizemultiplier"
+        s.doc = doc_unused;
+
       case "layer"
         s.doc = "Control whether the axes is drawn below child graphics \
 objects (ticks, labels, etc. covered by plotted objects) or above.";
 
       case "linestyleorder"
+        s.doc = doc_unused;
+
+      case "linestyleorderindex"
+        s.doc = doc_unused;
 
       case "linewidth"
+
+      case "minorgridalpha"
+        s.doc = sprintf (doc_notimpl, "Transparency");
+
+      case "minorgridalphamode"
+        s.doc = doc_unused;
+
+      case "minorgridcolor"
+        s.doc = doc_unused;
+
+      case "minorgridcolormode"
+        s.doc = doc_unused;
+
       case "minorgridlinestyle"
       case "mousewheelzoom"
         s.doc = "Fraction of axes limits to zoom for each wheel movement."; 
@@ -571,6 +637,9 @@
 @xref{XREFaxesposition, , @w{position property}}.";
         s.valid = valid_4elvec;
 
+      case "pickableparts"
+        s.doc = doc_unused;
+
       case "plotboxaspectratio"
       case "plotboxaspectratiomode"
       case "position"
@@ -585,6 +654,10 @@
         s.valid = valid_4elvec;
 
       case "projection"
+        s.doc = doc_unused;
+
+      case "sortmethod"
+        s.doc = doc_unused;
 
       case "tickdir"
         s.doc = "Control whether axes tick marks project \"in\" to the plot \
@@ -602,6 +675,12 @@
         s.doc = "Graphics handle of the title text object.";
         s.valid = valid_handle;
 
+      case "titlefontsizemultiplier"
+        s.doc = doc_unused;
+
+      case "titlefontweight"
+        s.doc = doc_unused;
+
       case "units"
       case "view"
         s.doc = "Two-element vector @code{[azimuth elevation]} specifying \
@@ -613,6 +692,9 @@
         s.doc = "Color of the x-axis.  @xref{Colors, , colorspec}.";
         s.valid = packopt ({markdef(valid_color), "@qcode{\"none\"}"});
 
+      case "xcolormode"
+        s.doc = doc_unused;
+
       case "xdir"
       case "xgrid"
         s.doc = "Control whether major x grid lines are displayed.";
@@ -641,12 +723,18 @@
         s.valid = valid_cellstring;
 
       case "xticklabelmode"
+      case "xticklabelrotation"
+        s.doc = doc_unused;
+
       case "xtickmode"
       case "yaxislocation"
       case "ycolor"
         s.doc = "Color of the y-axis.  @xref{Colors, , colorspec}.";
         s.valid = packopt ({markdef(valid_color), "@qcode{\"none\"}"});
 
+      case "ycolormode"
+        s.doc = doc_unused;
+
       case "ydir"
       case "ygrid"
         s.doc = "Control whether major y grid lines are displayed.";
@@ -675,11 +763,17 @@
         s.valid = valid_cellstring;
 
       case "yticklabelmode"
+      case "yticklabelrotation"
+        s.doc = doc_unused;
+
       case "ytickmode"
       case "zcolor"
         s.doc = "Color of the z-axis.  @xref{Colors, , colorspec}.";
         s.valid = packopt ({markdef(valid_color), "@qcode{\"none\"}"});
 
+      case "zcolormode"
+        s.doc = doc_unused;
+
       case "zdir"
       case "zgrid"
         s.doc = "Control whether major z grid lines are displayed.";
@@ -708,6 +802,9 @@
         s.valid = valid_cellstring;
 
       case "zticklabelmode"
+      case "zticklabelrotation"
+        s.doc = doc_unused;
+
       case "ztickmode"
     endswitch
 
@@ -1335,4 +1432,5 @@
   elseif (! isempty (default))
     str = ["def. " default];
   endif
+
 endfunction
--- a/doc/interpreter/geometry.txi	Tue Jun 23 09:59:54 2015 -0700
+++ b/doc/interpreter/geometry.txi	Tue Jun 23 20:00:59 2015 -0700
@@ -433,7 +433,8 @@
 y = 2*rand (size (x)) - 1;
 z = sin (2*(x.^2+y.^2));
 [xx,yy] = meshgrid (linspace (-1,1,32));
-griddata (x,y,z,xx,yy);
+zz = griddata (x, y, z, xx, yy);
+mesh (xx, yy, zz);
 @end group
 @end example
 
--- a/doc/interpreter/geometryimages.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/doc/interpreter/geometryimages.m	Tue Jun 23 20:00:59 2015 -0700
@@ -65,7 +65,8 @@
     y = 2 * rand (size (x)) - 1;
     z = sin (2 * (x.^2 + y.^2));
     [xx,yy] = meshgrid (linspace (-1,1,32));
-    griddata (x,y,z,xx,yy);
+    zz = griddata (x, y, z, xx, yy);
+    mesh (xx, yy, zz);
     print ([nm "." typ], d_typ);
   elseif (strcmp (nm, "convhull"))
     x = -3:0.05:3;
--- a/libgui/graphics/Canvas.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/graphics/Canvas.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -395,6 +395,63 @@
   return zm.contents ("Direction").string_value ();
 }
 
+void 
+Canvas::select_object (graphics_object obj, QMouseEvent* event, 
+                       graphics_object &currentObj, graphics_object &axesObj)
+{
+  QList<graphics_object> axesList;
+  Matrix children = obj.get_properties ().get_all_children ();
+  octave_idx_type num_children = children.numel ();
+
+  for (int i = 0; i < num_children; i++)
+    {
+      graphics_object childObj (gh_manager::get_object (children(i)));
+
+      if (childObj.isa ("axes"))
+        axesList.append (childObj);
+      else if (childObj.isa ("uicontrol") || childObj.isa ("uipanel"))
+        {
+          Matrix bb = childObj.get_properties ().get_boundingbox (false);
+          QRectF r (bb(0), bb(1), bb(2), bb(3));
+
+          r.adjust (-5, -5, 5, 5);
+          if (r.contains (event->posF ()))
+            {
+              currentObj = childObj;
+              break;
+            }
+        }
+    }
+
+  if (! currentObj)
+    {
+      for (QList<graphics_object>::ConstIterator it = axesList.begin ();
+           it != axesList.end (); ++it)
+        {
+          graphics_object go = selectFromAxes (*it, event->pos ());
+
+          if (go)
+            {
+              currentObj = go;
+              axesObj = *it;
+            }
+          // FIXME: is this really necessary? the axes object should
+          //        have been selected through selectFromAxes anyway
+          else if (it->get_properties ().is_hittest ())
+            {
+              Matrix bb = it->get_properties ().get_boundingbox (true);
+              QRectF r (bb(0), bb(1), bb(2), bb(3));
+
+              if (r.contains (event->posF ()))
+                axesObj = *it;
+            }
+
+          if (axesObj && currentObj)
+            break;
+        }
+    }
+}
+
 void
 Canvas::canvasMouseMoveEvent (QMouseEvent* event)
 {
@@ -452,7 +509,7 @@
           break;
         }
     }
-  else if (m_mouseMode == NoMode)
+  else if (m_mouseMode == NoMode && m_updateCurrentPoint)
     {
       graphics_object obj = gh_manager::get_object (m_handle);
 
@@ -465,6 +522,23 @@
                                      "windowbuttonmotionfcn");
         }
     }
+
+  // Update mouse coordinates in the figure window status bar 
+  graphics_object obj = gh_manager::get_object (m_handle);
+
+  if (obj.valid_object ())
+    {
+      graphics_object currentObj, axesObj;
+      select_object (obj, event, currentObj, axesObj);
+
+      if (axesObj.valid_object ())
+        {
+          Figure* fig = 
+            dynamic_cast<Figure*> (Backend::toolkitObject (obj));
+          axes::properties& ap = Utils::properties<axes> (axesObj);
+          fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ()));
+        }
+    }    
 }
 
 void
@@ -512,66 +586,16 @@
     {
       graphics_object figObj (obj.get_ancestor ("figure"));
       graphics_object currentObj, axesObj;
-      QList<graphics_object> axesList;
-
-      Matrix children = obj.get_properties ().get_all_children ();
-      octave_idx_type num_children = children.numel ();
-
-      for (int i = 0; i < num_children; i++)
-        {
-          graphics_object childObj (gh_manager::get_object (children(i)));
+      
+      select_object (obj, event, currentObj, axesObj);
 
-          if (childObj.isa ("axes"))
-            axesList.append (childObj);
-          else if (childObj.isa ("uicontrol") || childObj.isa ("uipanel"))
-            {
-              Matrix bb = childObj.get_properties ().get_boundingbox (false);
-              QRectF r (bb(0), bb(1), bb(2), bb(3));
-
-              r.adjust (-5, -5, 5, 5);
-              if (r.contains (event->posF ()))
-                {
-                  currentObj = childObj;
-                  break;
-                }
-            }
-        }
-
-      if (! currentObj)
+      if (axesObj)
         {
-          for (QList<graphics_object>::ConstIterator it = axesList.begin ();
-               it != axesList.end (); ++it)
-            {
-              graphics_object go = selectFromAxes (*it, event->pos ());
-
-              if (go)
-                {
-                  currentObj = go;
-                  axesObj = *it;
-                }
-              // FIXME: is this really necessary? the axes object should
-              //        have been selected through selectFromAxes anyway
-              else if (it->get_properties ().is_hittest ())
-                {
-                  Matrix bb = it->get_properties ().get_boundingbox (true);
-                  QRectF r (bb(0), bb(1), bb(2), bb(3));
-
-                  if (r.contains (event->posF ()))
-                    axesObj = *it;
-                }
-
-              if (axesObj && currentObj)
-                break;
-            }
-
-          if (axesObj)
-            {
-              if (axesObj.get_properties ().handlevisibility_is ("on"))
-                Utils::properties<figure> (figObj)
-                  .set_currentaxes (axesObj.get_handle ().as_octave_value ());
-              if (! currentObj)
-                currentObj = axesObj;
-            }
+          if (axesObj.get_properties ().handlevisibility_is ("on"))
+            Utils::properties<figure> (figObj)
+              .set_currentaxes (axesObj.get_handle ().as_octave_value ());
+          if (! currentObj)
+            currentObj = axesObj;
         }
 
       if (! currentObj)
--- a/libgui/graphics/Canvas.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/graphics/Canvas.h	Tue Jun 23 20:00:59 2015 -0700
@@ -70,6 +70,7 @@
   virtual void toggleAxes (const graphics_handle& handle) = 0;
   virtual void toggleGrid (const graphics_handle& handle) = 0;
   virtual void autoAxes (const graphics_handle& handle) = 0;
+  void enableCurrentPointUpdates (bool on) { m_updateCurrentPoint = on; }
 
 protected:
   virtual void draw (const graphics_handle& handle) = 0;
@@ -85,7 +86,8 @@
       m_mouseMode (NoMode),
       m_clickMode (false),
       m_eventMask (0),
-      m_rectMode (false)
+      m_rectMode (false),
+      m_updateCurrentPoint (false)
     { }
 
   void canvasToggleAxes (const graphics_handle& handle);
@@ -106,6 +108,8 @@
                            const graphics_object& obj);
 
   void annotation_callback (const octave_value_list& args);
+  void select_object (graphics_object obj, QMouseEvent* event, 
+                      graphics_object &currentObj, graphics_object &axesObj);
 
 private:
   graphics_handle m_handle;
@@ -117,6 +121,7 @@
   graphics_handle m_mouseAxes;
   int m_eventMask;
   bool m_rectMode;
+  bool m_updateCurrentPoint;
 };
 
 }; // namespace QtHandles
--- a/libgui/graphics/Figure.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/graphics/Figure.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -129,20 +129,32 @@
 {
   m_container = new Container (win);
   win->setCentralWidget (m_container);
-
+  
   figure::properties& fp = properties<figure> ();
 
-  createFigureToolBarAndMenuBar ();
+  // Enable mouse tracking
+  m_container->setMouseTracking (true);
+  foreach (QWidget* w, m_container->findChildren<QWidget*> ())
+    { w->setMouseTracking (true); }
+  
+  // Status bar
+  m_statusBar = win->statusBar ();
+  m_statusBar->setVisible (true);
+  int boffset = m_statusBar->sizeHint ().height ();
+  
 
-  int offset = 0;
+  // Toolbar and menubar
+  createFigureToolBarAndMenuBar ();
+  int toffset = 0;
+
   if (fp.toolbar_is ("figure") ||
       (fp.toolbar_is ("auto") && fp.menubar_is ("figure") &&
        ! hasUiControlChildren (fp)))
-    offset += m_figureToolBar->sizeHint ().height ();
+    toffset += m_figureToolBar->sizeHint ().height ();
   else
     m_figureToolBar->hide ();
   if (fp.menubar_is ("figure") || hasUiMenuChildren (fp))
-    offset += m_menuBar->sizeHint ().height () + 1;
+    toffset += m_menuBar->sizeHint ().height () + 1;
   else
     m_menuBar->hide ();
 
@@ -150,7 +162,7 @@
   m_outerRect = boundingBoxToRect (fp.get_boundingbox (false));
 
   //qDebug () << "Figure::Figure:" << m_innerRect;
-  win->setGeometry (m_innerRect.adjusted (0, -offset, 0, 0));
+  win->setGeometry (m_innerRect.adjusted (0, -toffset, 0, boffset));
   //qDebug () << "Figure::Figure(adjusted)" << m_innerRect.adjusted (0, -offset, 0, 0);
   win->setWindowTitle (Utils::fromStdString (fp.get_title ()));
 
@@ -411,17 +423,20 @@
     case figure::properties::ID_POSITION:
         {
           m_innerRect = boundingBoxToRect (fp.get_boundingbox (true));
-          //qDebug () << "Figure::update(position):" << m_innerRect;
-          int offset = 0;
+          int toffset = 0;
+          int boffset = 0;
 
           foreach (QToolBar* tb, win->findChildren<QToolBar*> ())
             if (! tb->isHidden ())
-              offset += tb->sizeHint ().height ();
+              toffset += tb->sizeHint ().height ();
+
           if (! m_menuBar->isHidden ())
-            offset += m_menuBar->sizeHint ().height () + 1;
-          //qDebug () << "Figure::update(position)(adjusted):" << m_innerRect.adjusted (0, -offset, 0, 0);
-          win->setGeometry (m_innerRect.adjusted (0, -offset, 0, 0));
-          //qDebug () << "Figure::update(position): done";
+            toffset += m_menuBar->sizeHint ().height () + 1;
+          
+          if (! m_statusBar->isHidden ())
+            boffset += m_statusBar->sizeHint ().height () + 1;
+
+          win->setGeometry (m_innerRect.adjusted (0, -toffset, 0, boffset));
         }
       break;
 
@@ -471,9 +486,7 @@
         {
           bool hasCallback = ! fp.get_windowbuttonmotionfcn ().is_empty ();
 
-          m_container->setMouseTracking (hasCallback);
-          foreach (QWidget* w, m_container->findChildren<QWidget*> ())
-            { w->setMouseTracking (hasCallback); }
+          m_container->canvas (m_handle)->enableCurrentPointUpdates (hasCallback);
         }
       break;
 
@@ -551,6 +564,15 @@
     showMenuBar (Utils::properties<figure> (go).menubar_is ("figure"));
 }
 
+void
+Figure::updateStatusBar (ColumnVector pt)
+{
+  if (! m_statusBar->isHidden ())
+    m_statusBar->showMessage (QString ("(%1, %2)")
+                              .arg (pt(0), 0, 'g', 5)
+                              .arg (pt(1), 0, 'g', 5));
+}
+
 QWidget*
 Figure::menu (void)
 {
--- a/libgui/graphics/Figure.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/graphics/Figure.h	Tue Jun 23 20:00:59 2015 -0700
@@ -24,6 +24,7 @@
 #define __QtHandles_Figure__ 1
 
 #include <QRect>
+#include <QStatusBar>
 
 #include "GenericEventNotify.h"
 #include "MenuContainer.h"
@@ -78,6 +79,7 @@
 
   Container* innerContainer (void);
   QWidget* menu (void);
+  void updateStatusBar (ColumnVector pt);
 
   bool eventNotifyBefore (QObject* watched, QEvent* event);
   void eventNotifyAfter (QObject* watched, QEvent* event);
@@ -132,6 +134,7 @@
   bool m_blockUpdates;
   QToolBar* m_figureToolBar;
   MenuBar* m_menuBar;
+  QStatusBar* m_statusBar;
   QRect m_innerRect;
   QRect m_outerRect;
   MouseModeActionGroup* m_mouseModeGroup;
--- a/libgui/graphics/QtHandlesUtils.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/graphics/QtHandlesUtils.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -61,7 +61,7 @@
 fromStringVector (const string_vector& v)
 {
   QStringList l;
-  octave_idx_type n = v.length ();
+  octave_idx_type n = v.numel ();
 
   for (octave_idx_type i = 0; i < n; i++)
     l << fromStdString (v[i]);
--- a/libgui/src/dialog.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/src/dialog.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -519,7 +519,7 @@
 
   // if not showing only dirs, add end slash for the path component
   if (testOption (QFileDialog::ShowDirsOnly)  == false)
-    path = path + "/";
+    path += "/";
 
   // convert to native slashes
   path = QDir::toNativeSeparators (path);
--- a/libgui/src/m-editor/file-editor-tab.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/src/m-editor/file-editor-tab.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -482,12 +482,12 @@
           _prep_apis_file = prep_apis_path + lexer->lexer () + "_k";
 
           if (octave_builtins)
-            _prep_apis_file = _prep_apis_file + "b";  // use builtins, too
+            _prep_apis_file += "b";  // use builtins, too
 
           if (octave_functions)
-            _prep_apis_file = _prep_apis_file + "f";  // use keywords, too
+            _prep_apis_file += "f";  // use keywords, too
 
-          _prep_apis_file = _prep_apis_file + ".pap"; // final name of apis file
+          _prep_apis_file += ".pap"; // final name of apis file
 
           // check whether the APIs info needs to be prepared and saved
           QFileInfo apis_file = QFileInfo (_prep_apis_file);
--- a/libgui/src/main-window.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/src/main-window.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -747,7 +747,7 @@
         { // if children has a name
           icon = widget_icon_data[icon_set_found].path; // prefix or octave-logo
           if (widget_icon_data[icon_set_found].name != "NONE")
-            icon = icon + name + ".png"; // add widget name and ext.
+            icon += name + ".png"; // add widget name and ext.
           widget->setWindowIcon (QIcon (icon));
         }
     }
--- a/libgui/src/octave-qt-link.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libgui/src/octave-qt-link.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -490,7 +490,7 @@
 {
   QStringList qt_hist;
 
-  for (octave_idx_type i = 0; i < hist.length (); i++)
+  for (octave_idx_type i = 0; i < hist.numel (); i++)
     qt_hist.append (QString::fromStdString (hist[i]));
 
   emit set_history_signal (qt_hist);
--- a/libinterp/corefcn/Cell.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/Cell.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -40,7 +40,7 @@
 Cell::Cell (const string_vector& sv, bool trim)
   : Array<octave_value> ()
 {
-  octave_idx_type n = sv.length ();
+  octave_idx_type n = sv.numel ();
 
   if (n > 0)
     {
@@ -99,7 +99,7 @@
 Cell::Cell (const dim_vector& dv, const string_vector& sv, bool trim)
   : Array<octave_value> (dv, Matrix ())
 {
-  octave_idx_type n = sv.length ();
+  octave_idx_type n = sv.numel ();
 
   if (n > 0)
     {
--- a/libinterp/corefcn/__contourc__.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/__contourc__.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -316,7 +316,7 @@
         {
           contourc.resize (2, 0);
 
-          for (int i = 0; i < L.length (); i++)
+          for (int i = 0; i < L.numel (); i++)
             cntr (X, Y, Z, L (i));
 
           end_contour ();
--- a/libinterp/corefcn/__pchip_deriv__.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/__pchip_deriv__.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -68,7 +68,7 @@
           FloatColumnVector xvec (args(0).float_vector_value ());
           FloatMatrix ymat (args(1).float_matrix_value ());
 
-          octave_idx_type nx = xvec.length ();
+          octave_idx_type nx = xvec.numel ();
 
           if (nx < 2)
             {
@@ -115,7 +115,7 @@
           ColumnVector xvec (args(0).vector_value ());
           Matrix ymat (args(1).matrix_value ());
 
-          octave_idx_type nx = xvec.length ();
+          octave_idx_type nx = xvec.numel ();
 
           if (nx < 2)
             {
--- a/libinterp/corefcn/__qp__.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/__qp__.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -62,7 +62,7 @@
 
       double tol = tmp * s(0) * std::numeric_limits<double>::epsilon ();
 
-      octave_idx_type n = s.length ();
+      octave_idx_type n = s.numel ();
 
       for (octave_idx_type i = 0; i < n; i++)
         {
@@ -97,11 +97,11 @@
   double rtol = sqrt (std::numeric_limits<double>::epsilon ());
 
   // Problem dimension.
-  octave_idx_type n = x.length ();
+  octave_idx_type n = x.numel ();
 
   // Dimension of constraints.
-  octave_idx_type n_eq = beq.length ();
-  octave_idx_type n_in = bin.length ();
+  octave_idx_type n_eq = beq.numel ();
+  octave_idx_type n_in = bin.numel ();
 
   // Filling the current active set.
 
--- a/libinterp/corefcn/besselj.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/besselj.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -178,8 +178,8 @@
               dim_vector dv0 = args(0).dims ();
               dim_vector dv1 = args(1).dims ();
 
-              bool args0_is_row_vector = (dv0 (1) == dv0.numel ());
-              bool args1_is_col_vector = (dv1 (0) == dv1.numel ());
+              bool args0_is_row_vector = (dv0(1) == dv0.numel ());
+              bool args1_is_col_vector = (dv1(0) == dv1.numel ());
 
               if (args0_is_row_vector && args1_is_col_vector)
                 {
@@ -314,8 +314,8 @@
               dim_vector dv0 = args(0).dims ();
               dim_vector dv1 = args(1).dims ();
 
-              bool args0_is_row_vector = (dv0 (1) == dv0.numel ());
-              bool args1_is_col_vector = (dv1 (0) == dv1.numel ());
+              bool args0_is_row_vector = (dv0(1) == dv0.numel ());
+              bool args1_is_col_vector = (dv1(0) == dv1.numel ());
 
               if (args0_is_row_vector && args1_is_col_vector)
                 {
--- a/libinterp/corefcn/bsxfun.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/bsxfun.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -237,12 +237,12 @@
       idx(0) = octave_value (':');
       for (octave_idx_type j = 1; j < nd; j++)
         {
-          if (dva (j) == 1)
+          if (dva(j) == 1)
             idx(j) = octave_value (1);
           else
             idx(j) = octave_value ((i % dvc(j)) + 1);
 
-          i = i / dvc (j);
+          i /= dvc(j);
         }
 
       Ac = A;
@@ -256,14 +256,14 @@
       octave_idx_type k1 = i - 1;
       for (octave_idx_type j = 1; j < nd; j++)
         {
-          if (dva(j) != 1 && k % dvc (j) != k1 % dvc (j))
+          if (dva(j) != 1 && k % dvc(j) != k1 % dvc(j))
             {
               idx (j) = octave_value ((k % dvc(j)) + 1);
               is_changed = true;
             }
 
-          k = k / dvc (j);
-          k1 = k1 / dvc (j);
+          k /= dvc(j);
+          k1 /= dvc(j);
         }
 
       if (is_changed)
@@ -294,8 +294,8 @@
     {
       for (octave_idx_type j = 1; j < nd; j++)
         {
-          idx (j) = octave_value (i % dv (j) + 1);
-          i = i / dv (j);
+          idx (j) = octave_value (i % dv(j) + 1);
+          i /= dv(j);
         }
     }
 }
@@ -309,8 +309,8 @@
   idx(0) = 0;
   for (octave_idx_type j = 1; j < nd; j++)
     {
-      idx (j) = i % dv (j);
-      i = i / dv (j);
+      idx(j) = i % dv(j);
+      i /= dv(j);
     }
 }
 
@@ -391,7 +391,7 @@
             }
 
           for (octave_idx_type i = 0; i < nd; i++)
-            if (dva (i) != dvb (i) && dva (i) != 1 && dvb (i) != 1)
+            if (dva(i) != dvb(i) && dva(i) != 1 && dvb(i) != 1)
               {
                 error ("bsxfun: dimensions of A and B must match");
                 break;
@@ -404,10 +404,10 @@
               dvc.resize (nd);
 
               for (octave_idx_type i = 0; i < nd; i++)
-                dvc (i) = (dva (i) < 1 ? dva (i)
-                                       : (dvb (i) < 1 ? dvb (i)
-                                                      : (dva (i) > dvb (i)
-                                                        ? dva (i) : dvb (i))));
+                dvc(i) = (dva(i) < 1 ? dva(i)
+                                     : (dvb(i) < 1 ? dvb(i)
+                                                   : (dva(i) > dvb(i)
+                                                       ? dva(i) : dvb(i))));
 
               if (dva == dvb || dva.numel () == 1 || dvb.numel () == 1)
                 {
@@ -427,7 +427,7 @@
                 {
                   octave_idx_type ncount = 1;
                   for (octave_idx_type i = 1; i < nd; i++)
-                    ncount *= dvc (i);
+                    ncount *= dvc(i);
 
 #define BSXDEF(T) \
                   T result_ ## T; \
--- a/libinterp/corefcn/cellfun.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/cellfun.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -1714,7 +1714,7 @@
                     dim_vector& celldv, dim_vector& arraydv,
                     Array<int>& perm)
 {
-  int dvl = dimv.length ();
+  int dvl = dimv.numel ();
   int maxd = dv.length ();
   celldv = dv;
   for (int i = 0; i < dvl; i++)
@@ -1981,7 +1981,7 @@
   for (int i = 0; i < nd; i++)
     {
       octave_idx_type s = 0;
-      for (octave_idx_type j = 0; j < d[i].length (); j++)
+      for (octave_idx_type j = 0; j < d[i].numel (); j++)
         s += d[i](j);
 
       octave_idx_type r = i < dv.length () ? dv(i) : 1;
@@ -2031,8 +2031,8 @@
   if (mat2cell_mismatch (a.dims (), d, nd))
     return retval;
 
-  octave_idx_type nridx = d[0].length ();
-  octave_idx_type ncidx = nd == 1 ? 1 : d[1].length ();
+  octave_idx_type nridx = d[0].numel ();
+  octave_idx_type ncidx = nd == 1 ? 1 : d[1].numel ();
   retval.clear (nridx, ncidx);
 
   int ivec = -1;
@@ -2092,7 +2092,7 @@
   octave_idx_type idxtot = 0;
   for (int i = 0; i < nd; i++)
     {
-      rdv(i) = nidx[i] = d[i].length ();
+      rdv(i) = nidx[i] = d[i].numel ();
       idxtot += nidx[i];
     }
 
@@ -2156,7 +2156,7 @@
   octave_idx_type idxtot = 0;
   for (int i = 0; i < nd; i++)
     {
-      rdv(i) = nidx[i] = d[i].length ();
+      rdv(i) = nidx[i] = d[i].numel ();
       idxtot += nidx[i];
     }
 
@@ -2339,7 +2339,7 @@
                    const Array<octave_idx_type>& ub,
                    int dim = -1)
 {
-  octave_idx_type n = lb.length ();
+  octave_idx_type n = lb.numel ();
   Cell retval (1, n);
   if (array.is_vector () && (dim == -1
                              || (dim == 0 && array.columns () == 1)
@@ -2409,7 +2409,7 @@
 
       if (! error_state)
         {
-          if (lb.length () != ub.length ())
+          if (lb.numel () != ub.numel ())
             error ("cellslices: the lengths of LB and UB must match");
           else
             {
@@ -2472,7 +2472,7 @@
               else
                 {
                   // generic code.
-                  octave_idx_type n = lb.length ();
+                  octave_idx_type n = lb.numel ();
                   retcell = Cell (1, n);
                   const dim_vector dv = x.dims ();
                   int ndims = dv.length ();
--- a/libinterp/corefcn/daspk.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/daspk.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -63,7 +63,7 @@
 {
   ColumnVector retval;
 
-  assert (x.capacity () == xdot.capacity ());
+  assert (x.numel () == xdot.numel ());
 
   octave_value_list args;
 
@@ -95,7 +95,7 @@
           if (tlen > 1)
             ires = tmp(1).int_value ();
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("daspk");
         }
       else
@@ -111,7 +111,7 @@
 {
   Matrix retval;
 
-  assert (x.capacity () == xdot.capacity ());
+  assert (x.numel () == xdot.numel ());
 
   octave_value_list args;
 
@@ -141,7 +141,7 @@
 
           retval = tmp(0).matrix_value ();
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("daspk");
         }
       else
@@ -297,9 +297,9 @@
       if (f_arg.is_cell ())
         {
           Cell c = f_arg.cell_value ();
-          if (c.length () == 1)
+          if (c.numel () == 1)
             f_arg = c(0);
-          else if (c.length () == 2)
+          else if (c.numel () == 2)
             {
               if (c(0).is_function_handle () || c(0).is_inline_function ())
                 daspk_fcn = c(0).function_value ();
@@ -426,7 +426,7 @@
           crit_times_set = 1;
         }
 
-      if (state.capacity () != deriv.capacity ())
+      if (state.numel () != deriv.numel ())
         DASPK_ABORT1 ("x and xdot must have the same size");
 
       double tzero = out_times (0);
--- a/libinterp/corefcn/dasrt.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/dasrt.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -63,7 +63,7 @@
 {
   ColumnVector retval;
 
-  assert (x.capacity () == xdot.capacity ());
+  assert (x.numel () == xdot.numel ());
 
   octave_value_list args;
 
@@ -91,7 +91,7 @@
 
           retval = ColumnVector (tmp(0).vector_value ());
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("dasrt");
         }
       else
@@ -131,7 +131,7 @@
 
           retval = ColumnVector (tmp(0).vector_value ());
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("dasrt");
         }
       else
@@ -147,7 +147,7 @@
 {
   Matrix retval;
 
-  assert (x.capacity () == xdot.capacity ());
+  assert (x.numel () == xdot.numel ());
 
   octave_value_list args;
 
@@ -177,7 +177,7 @@
 
           retval = tmp(0).matrix_value ();
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("dasrt");
         }
       else
@@ -385,9 +385,9 @@
   if (f_arg.is_cell ())
     {
       Cell c = f_arg.cell_value ();
-      if (c.length () == 1)
+      if (c.numel () == 1)
         f_arg = c(0);
-      else if (c.length () == 2)
+      else if (c.numel () == 2)
         {
           if (c(0).is_function_handle () || c(0).is_inline_function ())
             dasrt_f = c(0).function_value ();
--- a/libinterp/corefcn/dassl.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/dassl.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -63,7 +63,7 @@
 {
   ColumnVector retval;
 
-  assert (x.capacity () == xdot.capacity ());
+  assert (x.numel () == xdot.numel ());
 
   octave_value_list args;
 
@@ -95,7 +95,7 @@
           if (tlen > 1)
             ires = tmp(1).int_value ();
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("dassl");
         }
       else
@@ -111,7 +111,7 @@
 {
   Matrix retval;
 
-  assert (x.capacity () == xdot.capacity ());
+  assert (x.numel () == xdot.numel ());
 
   octave_value_list args;
 
@@ -141,7 +141,7 @@
 
           retval = tmp(0).matrix_value ();
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("dassl");
         }
       else
@@ -298,9 +298,9 @@
       if (f_arg.is_cell ())
         {
           Cell c = f_arg.cell_value ();
-          if (c.length () == 1)
+          if (c.numel () == 1)
             f_arg = c(0);
-          else if (c.length () == 2)
+          else if (c.numel () == 2)
             {
               if (c(0).is_function_handle () || c(0).is_inline_function ())
                 dassl_fcn = c(0).function_value ();
@@ -427,7 +427,7 @@
           crit_times_set = 1;
         }
 
-      if (state.capacity () != deriv.capacity ())
+      if (state.numel () != deriv.numel ())
         DASSL_ABORT1 ("x and xdot must have the same size");
 
       double tzero = out_times (0);
--- a/libinterp/corefcn/data.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/data.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -2051,7 +2051,7 @@
         retval = do_single_type_concat_map (args, dim);
       else
         {
-          dim_vector  dv = args(0).dims ();
+          dim_vector dv = args(0).dims ();
 
           // Default concatenation.
           bool (dim_vector::*concat_rule) (const dim_vector&, int)
@@ -2115,8 +2115,7 @@
                   break;
                 }
               else
-                ra_idx (dim) += (dim < dv_tmp.length () ?
-                                 dv_tmp (dim) : 1);
+                ra_idx(dim) += (dim < dv_tmp.length () ? dv_tmp(dim) : 1);
             }
           retval = tmp;
         }
@@ -2584,7 +2583,7 @@
       // FIXME: maybe we should create an idx_vector object
       // here and pass that to permute?
 
-      int n = vec.length ();
+      int n = vec.numel ();
 
       for (int i = 0; i < n; i++)
         vec(i)--;
@@ -4065,8 +4064,8 @@
 
             case oct_data_conv::dt_double:
               {
-                if (val == 1 && dims.length () == 2 && dims (0) == 1)
-                  retval = Range (1.0, 0.0, dims (1)); // packed form
+                if (val == 1 && dims.length () == 2 && dims(0) == 1)
+                  retval = Range (1.0, 0.0, dims(1));  // packed form
                 else
                   retval = NDArray (dims, val);
               }
@@ -5263,7 +5262,7 @@
       else
         {
           CVT lv = octave_value_extract<CVT> (limit);
-          CVT bv (lv.length (), bs);
+          CVT bv (lv.numel (), bs);
           retval = linspace (bv, lv, n);
         }
     }
@@ -5273,7 +5272,7 @@
       if (limit.is_scalar_type ())
         {
           T ls = octave_value_extract<T> (limit);
-          CVT lv (bv.length (), ls);
+          CVT lv (bv.numel (), ls);
           retval = linspace (bv, lv, n);
         }
       else
@@ -5433,7 +5432,7 @@
   if (nargin == 2)
     {
       Array<double> vec = args(1).vector_value ();
-      int ndim = vec.length ();
+      int ndim = vec.numel ();
       if (ndim == 1)
         {
           octave_idx_type m = static_cast<octave_idx_type> (vec(0));
@@ -5514,15 +5513,15 @@
     {
       Array<octave_idx_type> new_size = args(1).octave_idx_type_vector_value ();
 
-      if (new_size.length () < 2)
+      if (new_size.numel () < 2)
         {
           error ("reshape: SIZE must have 2 or more dimensions");
           return retval;
         }
 
-      new_dims = dim_vector::alloc (new_size.length ());
-
-      for (octave_idx_type i = 0; i < new_size.length (); i++)
+      new_dims = dim_vector::alloc (new_size.numel ());
+
+      for (octave_idx_type i = 0; i < new_size.numel (); i++)
         {
           if (new_size(i) < 0)
             {
@@ -8127,8 +8126,8 @@
 
           if (! error_state)
             {
-              dims = dim_vector::alloc (size.length ());
-              for (octave_idx_type i = 0; i < size.length (); i++)
+              dims = dim_vector::alloc (size.numel ());
+              for (octave_idx_type i = 0; i < size.numel (); i++)
                 dims(i) = size(i);
             }
         }
--- a/libinterp/corefcn/debug.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/debug.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -263,7 +263,7 @@
           if (error_state)
             break;
 
-          for (octave_idx_type j = 0; j < arg.nelem (); j++)
+          for (octave_idx_type j = 0; j < arg.numel (); j++)
             {
               int line = static_cast<int> (arg.elem (j));
               if (error_state)
--- a/libinterp/corefcn/dot.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/dot.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -173,7 +173,7 @@
                       FloatComplexNDArray x = argx.float_complex_array_value ();
                       FloatComplexNDArray y = argy.float_complex_array_value ();
                       get_red_dims (dimx, dimy, dim, dimz, m, n, k);
-                      FloatComplexNDArray z(dimz);
+                      FloatComplexNDArray z (dimz);
                       if (! error_state)
                         F77_XFCN (cdotc3, CDOTC3, (m, n, k,
                                                    x.data (), y.data (),
@@ -185,7 +185,7 @@
                       ComplexNDArray x = argx.complex_array_value ();
                       ComplexNDArray y = argy.complex_array_value ();
                       get_red_dims (dimx, dimy, dim, dimz, m, n, k);
-                      ComplexNDArray z(dimz);
+                      ComplexNDArray z (dimz);
                       if (! error_state)
                         F77_XFCN (zdotc3, ZDOTC3, (m, n, k,
                                                    x.data (), y.data (),
@@ -200,7 +200,7 @@
                       FloatNDArray x = argx.float_array_value ();
                       FloatNDArray y = argy.float_array_value ();
                       get_red_dims (dimx, dimy, dim, dimz, m, n, k);
-                      FloatNDArray z(dimz);
+                      FloatNDArray z (dimz);
                       if (! error_state)
                         F77_XFCN (sdot3, SDOT3, (m, n, k, x.data (), y.data (),
                                                  z.fortran_vec ()));
@@ -211,7 +211,7 @@
                       NDArray x = argx.array_value ();
                       NDArray y = argy.array_value ();
                       get_red_dims (dimx, dimy, dim, dimz, m, n, k);
-                      NDArray z(dimz);
+                      NDArray z (dimz);
                       if (! error_state)
                         F77_XFCN (ddot3, DDOT3, (m, n, k, x.data (), y.data (),
                                                  z.fortran_vec ()));
@@ -340,7 +340,7 @@
                 {
                   FloatComplexNDArray x = argx.float_complex_array_value ();
                   FloatComplexNDArray y = argy.float_complex_array_value ();
-                  FloatComplexNDArray z(dimz);
+                  FloatComplexNDArray z (dimz);
                   if (! error_state)
                     F77_XFCN (cmatm3, CMATM3, (m, n, k, np,
                                                x.data (), y.data (),
@@ -351,7 +351,7 @@
                 {
                   ComplexNDArray x = argx.complex_array_value ();
                   ComplexNDArray y = argy.complex_array_value ();
-                  ComplexNDArray z(dimz);
+                  ComplexNDArray z (dimz);
                   if (! error_state)
                     F77_XFCN (zmatm3, ZMATM3, (m, n, k, np,
                                                x.data (), y.data (),
@@ -365,7 +365,7 @@
                 {
                   FloatNDArray x = argx.float_array_value ();
                   FloatNDArray y = argy.float_array_value ();
-                  FloatNDArray z(dimz);
+                  FloatNDArray z (dimz);
                   if (! error_state)
                     F77_XFCN (smatm3, SMATM3, (m, n, k, np,
                                                x.data (), y.data (),
@@ -376,7 +376,7 @@
                 {
                   NDArray x = argx.array_value ();
                   NDArray y = argy.array_value ();
-                  NDArray z(dimz);
+                  NDArray z (dimz);
                   if (! error_state)
                     F77_XFCN (dmatm3, DMATM3, (m, n, k, np,
                                                x.data (), y.data (),
--- a/libinterp/corefcn/fft.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/fft.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -112,9 +112,9 @@
     }
 
   if (n_points < 0)
-    n_points = dims (dim);
+    n_points = dims(dim);
   else
-    dims (dim) = n_points;
+    dims(dim) = n_points;
 
   if (dims.any_zero () || n_points == 0)
     {
--- a/libinterp/corefcn/fft2.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/fft2.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -96,14 +96,14 @@
       return retval;
 
   if (n_rows < 0)
-    n_rows = dims (0);
+    n_rows = dims(0);
   else
-    dims (0) = n_rows;
+    dims(0) = n_rows;
 
   if (n_cols < 0)
-    n_cols = dims (1);
+    n_cols = dims(1);
   else
-    dims (1) = n_cols;
+    dims(1) = n_cols;
 
   if (dims.all_zero () || n_rows == 0 || n_cols == 0)
     {
--- a/libinterp/corefcn/file-io.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/file-io.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -2204,6 +2204,8 @@
   return retval;
 }
 
+// FIXME: This routine also exists verbatim in syscalls.cc.
+//        Maybe change to be a general utility routine.
 static int
 convert (int x, int ibase, int obase)
 {
--- a/libinterp/corefcn/filter.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/filter.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -60,8 +60,8 @@
 {
   MArray<T> y;
 
-  octave_idx_type a_len  = a.length ();
-  octave_idx_type b_len  = b.length ();
+  octave_idx_type a_len  = a.numel ();
+  octave_idx_type b_len  = b.numel ();
 
   octave_idx_type ab_len = a_len > b_len ? a_len : b_len;
 
@@ -127,8 +127,8 @@
 
   if (norm != static_cast<T> (1.0))
     {
-      a = a / norm;
-      b = b / norm;
+      a /= norm;
+      b /= norm;
     }
 
   if (a_len <= 1 && si_len <= 0)
@@ -275,8 +275,8 @@
       return MArray<T> ();
     }
 
-  octave_idx_type a_len = a.length ();
-  octave_idx_type b_len = b.length ();
+  octave_idx_type a_len = a.numel ();
+  octave_idx_type b_len = b.numel ();
 
   octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
   dim_vector si_dims = x.dims ();
@@ -451,8 +451,8 @@
 
               if (nargin == 3 || args(3).is_empty ())
                 {
-                  octave_idx_type a_len = a.length ();
-                  octave_idx_type b_len = b.length ();
+                  octave_idx_type a_len = a.numel ();
+                  octave_idx_type b_len = b.numel ();
 
                   octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
 
@@ -499,8 +499,8 @@
 
               if (nargin == 3 || args(3).is_empty ())
                 {
-                  octave_idx_type a_len = a.length ();
-                  octave_idx_type b_len = b.length ();
+                  octave_idx_type a_len = a.numel ();
+                  octave_idx_type b_len = b.numel ();
 
                   octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
 
@@ -550,8 +550,8 @@
 
               if (nargin == 3 || args(3).is_empty ())
                 {
-                  octave_idx_type a_len = a.length ();
-                  octave_idx_type b_len = b.length ();
+                  octave_idx_type a_len = a.numel ();
+                  octave_idx_type b_len = b.numel ();
 
                   octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
 
@@ -598,8 +598,8 @@
 
               if (nargin == 3 || args(3).is_empty ())
                 {
-                  octave_idx_type a_len = a.length ();
-                  octave_idx_type b_len = b.length ();
+                  octave_idx_type a_len = a.numel ();
+                  octave_idx_type b_len = b.numel ();
 
                   octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
 
--- a/libinterp/corefcn/find.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/find.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -61,7 +61,7 @@
     case 2:
       {
         Array<octave_idx_type> jdx (idx.dims ());
-        octave_idx_type n = idx.length ();
+        octave_idx_type n = idx.numel ();
         octave_idx_type nr = nda.rows ();
         for (octave_idx_type i = 0; i < n; i++)
           {
--- a/libinterp/corefcn/gl-render.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/gl-render.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -667,7 +667,7 @@
 
   // Clear background
 
-  if (c.length () >= 3)
+  if (c.numel () >= 3)
     {
       glClearColor (c(0), c(1), c(2), 1);
       glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
--- a/libinterp/corefcn/gl-render.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/gl-render.h	Tue Jun 23 20:00:59 2015 -0700
@@ -71,7 +71,7 @@
 
   virtual void draw (const Matrix& hlist, bool toplevel = false)
   {
-    int len = hlist.length ();
+    int len = hlist.numel ();
 
     for (int i = len-1; i >= 0; i--)
       {
--- a/libinterp/corefcn/graphics.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/graphics.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -144,12 +144,10 @@
 
   for (octave_idx_type i = 0; i < 64; i++)
     {
-      // This is the jet colormap.  It would be nice to be able
-      // to feval the jet function but since there is a static
-      // property object that includes a colormap_property
-      // object, we need to initialize this before main is even
-      // called, so calling an interpreted function is not
-      // possible.
+      // This is the jet colormap.  It would be nice to be able to feval the
+      // jet function but since there is a static property object that includes
+      // a colormap_property object, we need to initialize this before main is
+      // even called, so calling an interpreted function is not possible.
 
       double x = i*delta;
 
@@ -187,8 +185,10 @@
 static Matrix
 default_screensize (void)
 {
-  Matrix retval (1, 4, 1.0);
-
+  Matrix retval (1, 4);
+
+  retval(0) = 1.0;
+  retval(1) = 1.0;
   retval(2) = display_info::width ();
   retval(3) = display_info::height ();
 
@@ -231,7 +231,7 @@
 static Matrix
 default_lim (bool logscale = false)
 {
-  Matrix m (1, 2, 0);
+  Matrix m (1, 2);
 
   if (logscale)
     {
@@ -239,7 +239,10 @@
       m(1) = 1.0;
     }
   else
-    m(1) = 1;
+    {
+      m(0) = 0.0;
+      m(1) = 1.0;
+    }
 
   return m;
 }
@@ -258,7 +261,8 @@
 static Matrix
 default_image_cdata (void)
 {
-  Matrix m (64, 64, 0.0);
+  Matrix m (64, 64);
+
   int i = 0;
   for (int col = 0; col < 64; col++)
     for (int row = 0; row < 64; row++)
@@ -273,7 +277,8 @@
 static Matrix
 default_surface_xdata (void)
 {
-  Matrix m (3, 3, 0.0);
+  Matrix m (3, 3);
+
   for (int col = 0; col < 3; col++)
     for (int row = 0; row < 3; row++)
       m(row,col) = col+1;
@@ -284,7 +289,8 @@
 static Matrix
 default_surface_ydata (void)
 {
-  Matrix m (3, 3, 0.0);
+  Matrix m (3, 3);
+
   for (int row = 0; row < 3; row++)
     for (int col = 0; col < 3; col++)
       m(row,col) = row+1;
@@ -296,8 +302,10 @@
 default_surface_zdata (void)
 {
   Matrix m (3, 3, 0.0);
+
   for (int row = 0; row < 3; row++)
     m(row,row) = 1.0;
+
   return m;
 }
 
@@ -310,19 +318,24 @@
 static Matrix
 default_patch_faces (void)
 {
-  Matrix m (1, 3, 1.0);
+  Matrix m (1, 3);
+
+  m(0) = 1.0;
   m(1) = 2.0;
   m(2) = 3.0;
+
   return m;
 }
 
 static Matrix
 default_patch_vertices (void)
 {
-  Matrix m (3, 2, 0);
+  Matrix m (3, 2, 0.0);
+
   m(1) = 1.0;
   m(3) = 1.0;
   m(4) = 1.0;
+
   return m;
 }
 
@@ -330,7 +343,9 @@
 default_patch_xdata (void)
 {
   Matrix m (3, 1, 0.0);
+
   m(1) = 1.0;
+
   return m;
 }
 
@@ -338,94 +353,116 @@
 default_patch_ydata (void)
 {
   Matrix m (3, 1, 1.0);
+
   m(2) = 0.0;
+
   return m;
 }
 
 static Matrix
 default_axes_position (void)
 {
-  Matrix m (1, 4, 0.0);
+  Matrix m (1, 4);
+
   m(0) = 0.13;
   m(1) = 0.11;
   m(2) = 0.775;
   m(3) = 0.815;
+
   return m;
 }
 
 static Matrix
 default_axes_outerposition (void)
 {
-  Matrix m (1, 4, 0.0);
-  m(2) = m(3) = 1.0;
+  Matrix m (1, 4);
+
+  m(0) = 0.0;
+  m(1) = 0.0;
+  m(2) = 1.0;
+  m(3) = 1.0;
+
   return m;
 }
 
 static Matrix
 default_axes_view (void)
 {
-  Matrix m (1, 2, 0.0);
+  Matrix m (1, 2);
+
+  m(0) = 0.0;
   m(1) = 90.0;
+
   return m;
 }
 
 static Matrix
 default_axes_tick (void)
 {
-  Matrix m (1, 6, 0.0);
+  Matrix m (1, 6);
+
   m(0) = 0.0;
   m(1) = 0.2;
   m(2) = 0.4;
   m(3) = 0.6;
   m(4) = 0.8;
   m(5) = 1.0;
+
   return m;
 }
 
 static Matrix
 default_axes_ticklength (void)
 {
-  Matrix m (1, 2, 0.0);
+  Matrix m (1, 2);
+
   m(0) = 0.01;
   m(1) = 0.025;
+
   return m;
 }
 
 static Matrix
 default_figure_position (void)
 {
-  Matrix m (1, 4, 0.0);
+  Matrix m (1, 4);
+
   m(0) = 300;
   m(1) = 200;
   m(2) = 560;
   m(3) = 420;
+
   return m;
 }
 
 static Matrix
 default_figure_papersize (void)
 {
-  Matrix m (1, 2, 0.0);
+  Matrix m (1, 2);
+
   m(0) = 8.5;
   m(1) = 11.0;
+
   return m;
 }
 
 static Matrix
 default_figure_paperposition (void)
 {
-  Matrix m (1, 4, 0.0);
+  Matrix m (1, 4);
+
   m(0) = 0.25;
   m(1) = 2.50;
   m(2) = 8.00;
   m(3) = 6.00;
+
   return m;
 }
 
 static Matrix
 default_control_position (void)
 {
-  Matrix retval (1, 4, 0.0);
+  Matrix retval (1, 4);
 
   retval(0) = 0;
   retval(1) = 0;
@@ -438,7 +475,7 @@
 static Matrix
 default_control_sliderstep (void)
 {
-  Matrix retval (1, 2, 0.0);
+  Matrix retval (1, 2);
 
   retval(0) = 0.01;
   retval(1) = 0.1;
@@ -449,7 +486,7 @@
 static Matrix
 default_panel_position (void)
 {
-  Matrix retval (1, 4, 0.0);
+  Matrix retval (1, 4);
 
   retval(0) = 0;
   retval(1) = 0;
@@ -548,7 +585,7 @@
       double f = 0.0;
 
       // FIXME: this assumes the system font is Helvetica 10pt
-      //          (for which "x" requires 6x12 pixels at 74.951 pixels/inch)
+      //        (for which "x" requires 6x12 pixels at 74.951 pixels/inch)
       f = 12.0 * res / 74.951;
 
       if (f > 0)
@@ -1047,7 +1084,6 @@
 {
   if (do_set (v))
     {
-
       // Notify graphics toolkit.
       if (id >= 0 && do_notify_toolkit)
         {
@@ -1559,7 +1595,6 @@
 
       if (go.valid_object ())
         gh_manager::free (*p);
-
     }
 
   if (clear)
@@ -1569,30 +1604,28 @@
 bool
 callback_property::validate (const octave_value& v) const
 {
-  // case 1: function handle
-  // case 2: cell array with first element being a function handle
+  // case 1: empty matrix
+  // case 2: function handle
   // case 3: string corresponding to known function name
-  // case 4: evaluatable string
-  // case 5: empty matrix
-
-  if (v.is_function_handle ())
+  // case 4: string that can be eval()'ed
+  // case 5: cell array with first element being a function handle
+
+  if (v.is_empty ())
+    return true;
+  else if (v.is_function_handle ())
     return true;
   else if (v.is_string ())
     // complete validation will be done at execution-time
     return true;
-  else if (v.is_cell () && v.length () > 0
-           && (v.rows () == 1 || v.columns () == 1)
+  else if (v.is_cell () && (v.rows () == 1 || v.columns () == 1)
            && v.cell_value ()(0).is_function_handle ())
     return true;
-  else if (v.is_empty ())
-    return true;
 
   return false;
 }
 
-// If TRUE, we are executing any callback function, or the functions it
-// calls.  Used to determine handle visibility inside callback
-// functions.
+// If TRUE, we are executing any callback function, or the functions it calls.
+// Used to determine handle visibility inside callback functions.
 static bool executing_callback = false;
 
 void
@@ -1619,8 +1652,8 @@
     }
 }
 
-// Used to cache dummy graphics objects from which dynamic
-// properties can be cloned.
+// Used to cache dummy graphics objects from which dynamic properties can be
+// cloned.
 static std::map<caseless_str, graphics_object> dprop_obj_map;
 
 property
@@ -1631,27 +1664,29 @@
 
   if (type.compare ("string"))
     {
-      std::string val = (args.length () > 0 ? args(0).string_value () : "");
+      std::string sv = (args.length () > 0 ? args(0).string_value () : "");
 
       if (! error_state)
-        retval = property (new string_property (name, h, val));
+        retval = property (new string_property (name, h, sv));
     }
   else if (type.compare ("any"))
     {
-      octave_value val = args.length () > 0 ? args(0)
-                                            : octave_value (Matrix ());
-
-      retval = property (new any_property (name, h, val));
+      octave_value ov = args.length () > 0 ? args(0)
+                                           : octave_value (Matrix ());
+
+      retval = property (new any_property (name, h, ov));
     }
   else if (type.compare ("radio"))
     {
-      if (args.length () > 0)
-        {
-          std::string vals = args(0).string_value ();
+      if (args.length () < 1)
+        error ("addproperty: missing possible values for radio property");
+      else
+        {
+          std::string sv = args(0).string_value ();
 
           if (! error_state)
             {
-              retval = property (new radio_property (name, h, vals));
+              retval = property (new radio_property (name, h, sv));
 
               if (args.length () > 1)
                 retval.set (args(1));
@@ -1659,23 +1694,21 @@
           else
             error ("addproperty: invalid argument for radio property, expected a string value");
         }
-      else
-        error ("addproperty: missing possible values for radio property");
     }
   else if (type.compare ("double"))
     {
-      double d = (args.length () > 0 ? args(0).double_value () : 0);
+      double dv = (args.length () > 0 ? args(0).double_value () : 0.0);
 
       if (! error_state)
-        retval = property (new double_property (name, h, d));
+        retval = property (new double_property (name, h, dv));
     }
   else if (type.compare ("handle"))
     {
-      double hh = (args.length () > 0 ? args(0).double_value () : octave_NaN);
+      double hv = (args.length () > 0 ? args(0).double_value () : octave_NaN);
 
       if (! error_state)
         {
-          graphics_handle gh (hh);
+          graphics_handle gh (hv);
 
           retval = property (new handle_property (name, h, gh));
         }
@@ -1694,7 +1727,6 @@
       if (args.length () > 0)
         {
           retval.set (args(0));
-
           // FIXME: additional argument could define constraints,
           //        but is this really useful?
         }
@@ -1963,6 +1995,8 @@
           bool has_property = false;
           if (pfx == "axes")
             has_property = axes::properties::has_core_property (pname);
+          else if (pfx == "figure")
+            has_property = figure::properties::has_core_property (pname);
           else if (pfx == "line")
             has_property = line::properties::has_core_property (pname);
           else if (pfx == "text")
@@ -1971,8 +2005,6 @@
             has_property = image::properties::has_core_property (pname);
           else if (pfx == "patch")
             has_property = patch::properties::has_core_property (pname);
-          else if (pfx == "figure")
-            has_property = figure::properties::has_core_property (pname);
           else if (pfx == "surface")
             has_property = surface::properties::has_core_property (pname);
           else if (pfx == "hggroup")
@@ -1995,9 +2027,9 @@
               bool remove = false;
               if (val.is_string ())
                 {
-                  std::string tval = val.string_value ();
-
-                  remove = (tval.compare ("remove") == 0);
+                  std::string sval = val.string_value ();
+
+                  remove = (sval.compare ("remove") == 0);
                 }
 
               pval_map_type& pval_map = plist_map[pfx];
@@ -2143,17 +2175,19 @@
 
   if (nargin == 0)
     error ("graphics_object::set: Nothing to set");
-  else if (nargin % 2 == 0)
+  else if (nargin % 2 != 0)
+    error ("set: invalid number of arguments");
+  else
     {
       for (int i = 0; i < nargin; i += 2)
         {
-          caseless_str name = args(i).string_value ();
+          caseless_str pname = args(i).string_value ();
 
           if (! error_state)
             {
               octave_value val = args(i+1);
 
-              set_value_or_default (name, val);
+              set_value_or_default (pname, val);
 
               if (error_state)
                 break;
@@ -2162,8 +2196,6 @@
             error ("set: expecting argument %d to be a property name", i);
         }
     }
-  else
-    error ("set: invalid number of arguments");
 }
 
 /*
@@ -2181,23 +2213,23 @@
 
 // Set properties given in two cell arrays containing names and values.
 void
-graphics_object::set (const Array<std::string>& names,
+graphics_object::set (const Array<std::string>& pnames,
                       const Cell& values, octave_idx_type row)
 {
-  if (names.numel () != values.columns ())
+  if (pnames.numel () != values.columns ())
     {
       error ("set: number of names must match number of value columns (%d != %d)",
-             names.numel (), values.columns ());
-    }
-
-  octave_idx_type k = names.columns ();
+             pnames.numel (), values.columns ());
+    }
+
+  octave_idx_type k = pnames.columns ();
 
   for (octave_idx_type column = 0; column < k; column++)
     {
-      caseless_str name = names(column);
+      caseless_str pname = pnames(column);
       octave_value val  = values(row, column);
 
-      set_value_or_default (name, val);
+      set_value_or_default (pname, val);
 
       if (error_state)
         break;
@@ -2256,11 +2288,13 @@
 {
   for (octave_idx_type p = 0; p < m.nfields (); p++)
     {
-      caseless_str name  = m.keys ()[p];
-
-      octave_value val = octave_value (m.contents (name).elem (m.numel () - 1));
-
-      set_value_or_default (name, val);
+      // FIXME: Would it be better to extract all the keys at once rather than
+      //        repeatedly call keys() inside a for loop? 
+      caseless_str pname = m.keys ()[p];
+
+      octave_value val = octave_value (m.contents (pname).elem (m.numel () - 1));
+
+      set_value_or_default (pname, val);
 
       if (error_state)
         break;
@@ -2351,46 +2385,46 @@
 // Set a property to a value or to its (factory) default value.
 
 void
-graphics_object::set_value_or_default (const caseless_str& name,
+graphics_object::set_value_or_default (const caseless_str& pname,
                                        const octave_value& val)
 {
   if (val.is_string ())
     {
-      std::string tval = val.string_value ();
+      std::string sval = val.string_value ();
 
       octave_value default_val;
 
-      if (tval.compare ("default") == 0)
-        {
-          default_val = get_default (name);
+      if (sval.compare ("default") == 0)
+        {
+          default_val = get_default (pname);
 
           if (error_state)
             return;
 
-          rep->set (name, default_val);
-        }
-      else if (tval.compare ("factory") == 0)
-        {
-          default_val = get_factory_default (name);
+          rep->set (pname, default_val);
+        }
+      else if (sval.compare ("factory") == 0)
+        {
+          default_val = get_factory_default (pname);
 
           if (error_state)
             return;
 
-          rep->set (name, default_val);
+          rep->set (pname, default_val);
         }
       else
         {
           // Matlab specifically uses "\default" to escape string setting
-          if (tval.compare ("\\default") == 0)
-            rep->set (name, "default");
-          else if (tval.compare ("\\factory") == 0)
-            rep->set (name, "factory");
+          if (sval.compare ("\\default") == 0)
+            rep->set (pname, "default");
+          else if (sval.compare ("\\factory") == 0)
+            rep->set (pname, "factory");
           else
-            rep->set (name, val);
-        }
-    }
-  else
-    rep->set (name, val);
+            rep->set (pname, val);
+        }
+    }
+  else
+    rep->set (pname, val);
 }
 
 /*
@@ -2426,8 +2460,8 @@
 
   if (integer_figure_handle)
     {
-      // Figure handles are positive integers corresponding to the
-      // figure number.
+      // Figure handles are positive integers corresponding
+      // to the figure number.
 
       // We always want the lowest unused figure number.
 
@@ -2439,9 +2473,8 @@
   else
     {
       // Other graphics handles are negative integers plus some random
-      // fractional part.  To avoid running out of integers, we
-      // recycle the integer part but tack on a new random part each
-      // time.
+      // fractional part.  To avoid running out of integers, we recycle the
+      // integer part but tack on a new random part each time.
 
       free_list_iterator p = handle_free_list.begin ();
 
@@ -2485,8 +2518,8 @@
               // Notify graphics toolkit.
               p->second.finalize ();
 
-              // Note: this will be valid only for first explicitly
-              // deleted object.  All its children will then have an
+              // Note: this will be valid only for first explicitly deleted
+              // object.  All its children will then have an
               // unknown graphics toolkit.
 
               // Graphics handles for non-figure objects are negative
@@ -2543,11 +2576,11 @@
 gh_manager *gh_manager::instance = 0;
 
 static void
-xset (const graphics_handle& h, const caseless_str& name,
+xset (const graphics_handle& h, const caseless_str& pname,
       const octave_value& val)
 {
-  graphics_object obj = gh_manager::get_object (h);
-  obj.set (name, val);
+  graphics_object go = gh_manager::get_object (h);
+  go.set (pname, val);
 }
 
 static void
@@ -2555,53 +2588,53 @@
 {
   if (args.length () > 0)
     {
-      graphics_object obj = gh_manager::get_object (h);
-      obj.set (args);
+      graphics_object go = gh_manager::get_object (h);
+      go.set (args);
     }
 }
 
 static octave_value
-xget (const graphics_handle& h, const caseless_str& name)
-{
-  graphics_object obj = gh_manager::get_object (h);
-  return obj.get (name);
+xget (const graphics_handle& h, const caseless_str& pname)
+{
+  graphics_object go = gh_manager::get_object (h);
+  return go.get (pname);
 }
 
 static graphics_handle
 reparent (const octave_value& ov, const std::string& who,
-          const std::string& property, const graphics_handle& new_parent,
+          const std::string& pname, const graphics_handle& new_parent,
           bool adopt = true)
 {
   graphics_handle h = octave_NaN;
 
-  double val = ov.double_value ();
+  double hv = ov.double_value ();
 
   if (! error_state)
     {
-      h = gh_manager::lookup (val);
+      h = gh_manager::lookup (hv);
 
       if (h.ok ())
         {
-          graphics_object obj = gh_manager::get_object (h);
-
-          graphics_handle parent_h = obj.get_parent ();
-
-          graphics_object parent_obj = gh_manager::get_object (parent_h);
-
-          parent_obj.remove_child (h);
+          graphics_object go = gh_manager::get_object (h);
+
+          graphics_handle parent_h = go.get_parent ();
+
+          graphics_object parent_go = gh_manager::get_object (parent_h);
+
+          parent_go.remove_child (h);
 
           if (adopt)
-            obj.set ("parent", new_parent.value ());
+            go.set ("parent", new_parent.value ());
           else
-            obj.reparent (new_parent);
+            go.reparent (new_parent);
         }
       else
         error ("%s: invalid graphics handle (= %g) for %s",
-               who.c_str (), val, property.c_str ());
+               who.c_str (), hv, pname.c_str ());
     }
   else
     error ("%s: expecting %s to be a graphics handle",
-           who.c_str (), property.c_str ());
+           who.c_str (), pname.c_str ());
 
   return h;
 }
@@ -2629,27 +2662,24 @@
 {
   if (h.ok ())
     {
-      graphics_object obj = gh_manager::get_object (h);
+      graphics_object go = gh_manager::get_object (h);
 
       // Don't do recursive deleting, due to callbacks
-      if (! obj.get_properties ().is_beingdeleted ())
-        {
-          graphics_handle parent_h = obj.get_parent ();
-
-          graphics_object parent_obj =
-            gh_manager::get_object (parent_h);
-
-          // NOTE: free the handle before removing it from its
-          //       parent's children, such that the object's
-          //       state is correct when the deletefcn callback
-          //       is executed
+      if (! go.get_properties ().is_beingdeleted ())
+        {
+          graphics_handle parent_h = go.get_parent ();
+
+          graphics_object parent_go = gh_manager::get_object (parent_h);
+
+          // NOTE: free the handle before removing it from its parent's
+          //       children, such that the object's state is correct when the
+          //       deletefcn callback is executed
 
           gh_manager::free (h);
 
-          // A callback function might have already deleted
-          // the parent
-          if (parent_obj.valid_object ())
-            parent_obj.remove_child (h);
+          // A callback function might have already deleted the parent
+          if (parent_go.valid_object ())
+            parent_go.remove_child (h);
 
           Vdrawnow_requested = true;
         }
@@ -2670,23 +2700,23 @@
 }
 
 static void
-close_figure (const graphics_handle& handle)
-{
-  octave_value closerequestfcn = xget (handle, "closerequestfcn");
-
-  OCTAVE_SAFE_CALL (gh_manager::execute_callback, (handle, closerequestfcn));
+close_figure (const graphics_handle& h)
+{
+  octave_value closerequestfcn = xget (h, "closerequestfcn");
+
+  OCTAVE_SAFE_CALL (gh_manager::execute_callback, (h, closerequestfcn));
 }
 
 static void
-force_close_figure (const graphics_handle& handle)
-{
-  // Remove the deletefcn and closerequestfcn callbacks and delete the
-  // object directly.
-
-  xset (handle, "deletefcn", Matrix ());
-  xset (handle, "closerequestfcn", Matrix ());
-
-  delete_graphics_object (handle);
+force_close_figure (const graphics_handle& h)
+{
+  // Remove the deletefcn and closerequestfcn callbacks
+  // and delete the object directly.
+
+  xset (h, "deletefcn", Matrix ());
+  xset (h, "closerequestfcn", Matrix ());
+
+  delete_graphics_object (h);
 }
 
 void
@@ -2733,10 +2763,10 @@
 }
 
 static void
-adopt (const graphics_handle& p, const graphics_handle& h)
-{
-  graphics_object parent_obj = gh_manager::get_object (p);
-  parent_obj.adopt (h);
+adopt (const graphics_handle& parent_h, const graphics_handle& h)
+{
+  graphics_object parent_go = gh_manager::get_object (parent_h);
+  parent_go.adopt (h);
 }
 
 static bool
@@ -2769,7 +2799,7 @@
           boolNDArray result (handles.dims ());
 
           for (octave_idx_type i = 0; i < handles.numel (); i++)
-            result.xelem (i) = is_handle (handles (i));
+            result.xelem (i) = is_handle (handles(i));
 
           retval = result;
         }
@@ -2781,16 +2811,16 @@
 static bool
 is_figure (double val)
 {
-  graphics_object obj = gh_manager::get_object (val);
-
-  return obj && obj.isa ("figure");
+  graphics_object go = gh_manager::get_object (val);
+
+  return go && go.isa ("figure");
 }
 
 static void
 xcreatefcn (const graphics_handle& h)
 {
-  graphics_object obj = gh_manager::get_object (h);
-  obj.get_properties ().execute_createfcn  ();
+  graphics_object go = gh_manager::get_object (h);
+  go.get_properties ().execute_createfcn  ();
 }
 
 static void
@@ -2829,15 +2859,15 @@
 }
 
 static void
-xreset_default_properties (graphics_handle gh,
+xreset_default_properties (graphics_handle h,
                            property_list::pval_map_type factory_pval)
 {
-  graphics_object obj = gh_manager::get_object (gh);
+  graphics_object go = gh_manager::get_object (h);
 
   // Replace factory defaults by user defined ones
-  std::string go_name = obj.get_properties ().graphics_object_name ();
+  std::string go_name = go.get_properties ().graphics_object_name ();
   property_list::pval_map_type pval;
-  obj.build_user_defaults_map (pval, go_name);
+  go.build_user_defaults_map (pval, go_name);
 
   for (property_list::pval_map_const_iterator p = pval.begin ();
        p != pval.end (); p++)
@@ -2845,7 +2875,6 @@
       factory_pval[p->first] = p->second;
     }
 
-
   // Reset defaults
   for (property_list::pval_map_const_iterator it = factory_pval.begin ();
        it != factory_pval.end (); it++)
@@ -2853,7 +2882,7 @@
       std::string pname = it->first;
 
       // Don't reset internal properties and handle_properties
-      if (! obj.has_readonly_property (pname)
+      if (! go.has_readonly_property (pname)
           && pname.find ("__") != 0 && pname.find ("current") != 0
           && pname != "uicontextmenu" && pname != "parent")
         {
@@ -2861,20 +2890,20 @@
           if (pname.find ("mode") == (pname.length () - 4))
             pval[pname] = it->second;
           else
-            obj.set (pname, it->second);
+            go.set (pname, it->second);
         }
     }
 
   // set *mode properties
   for (property_list::pval_map_const_iterator it = pval.begin ();
        it != pval.end (); it++)
-    obj.set (it->first, it->second);
+    go.set (it->first, it->second);
 }
 
 // ---------------------------------------------------------------------
 
 void
-base_properties::set_from_list (base_graphics_object& obj,
+base_properties::set_from_list (base_graphics_object& bgo,
                                 property_list& defaults)
 {
   std::string go_name = graphics_object_name ();
@@ -2891,7 +2920,7 @@
         {
           std::string pname = q->first;
 
-          obj.set (pname, q->second);
+          bgo.set (pname, q->second);
 
           if (error_state)
             {
@@ -2919,17 +2948,17 @@
 */
 
 octave_value
-base_properties::get_dynamic (const caseless_str& name) const
+base_properties::get_dynamic (const caseless_str& pname) const
 {
   octave_value retval;
 
   std::map<caseless_str, property, cmp_caseless_str>::const_iterator it =
-    all_props.find (name);
+    all_props.find (pname);
 
   if (it != all_props.end ())
     retval = it->second.get ();
   else
-    error ("get: unknown property \"%s\"", name.c_str ());
+    error ("get: unknown property \"%s\"", pname.c_str ());
 
   return retval;
 }
@@ -2985,14 +3014,14 @@
 }
 
 property
-base_properties::get_property_dynamic (const caseless_str& name)
+base_properties::get_property_dynamic (const caseless_str& pname)
 {
   std::map<caseless_str, property, cmp_caseless_str>::const_iterator it =
-    all_props.find (name);
+    all_props.find (pname);
 
   if (it == all_props.end ())
     {
-      error ("get_property: unknown property \"%s\"", name.c_str ());
+      error ("get_property: unknown property \"%s\"", pname.c_str ());
       return property ();
     }
   else
@@ -3002,38 +3031,36 @@
 void
 base_properties::set_parent (const octave_value& val)
 {
-  double hnp = val.double_value ();
+  double hp = val.double_value ();
 
   graphics_handle new_parent = octave_NaN;
 
   if (! error_state)
     {
-      if (hnp == __myhandle__)
+      if (hp == __myhandle__)
         error ("set: can not set object parent to be object itself");
       else
         {
-          new_parent = gh_manager::lookup (hnp);
+          new_parent = gh_manager::lookup (hp);
 
           if (new_parent.ok ())
             {
               // Remove child from current parent
-              graphics_object old_parent_obj;
-              old_parent_obj = gh_manager::get_object (get_parent ());
-
-
-              if (old_parent_obj.get_handle () != hnp)
-                old_parent_obj.remove_child (__myhandle__);
+              graphics_object old_parent_go;
+              old_parent_go = gh_manager::get_object (get_parent ());
+
+              if (old_parent_go.get_handle () != hp)
+                old_parent_go.remove_child (__myhandle__);
               else
-                // Do nothing more
-                return;
+                return;  // Do nothing more
 
               // Check new parent's parent is not this child to avoid recursion
-              graphics_object new_parent_obj;
-              new_parent_obj = gh_manager::get_object (new_parent);
-              if (new_parent_obj.get_parent () == __myhandle__)
+              graphics_object new_parent_go;
+              new_parent_go = gh_manager::get_object (new_parent);
+              if (new_parent_go.get_parent () == __myhandle__)
                 {
                   // new parent's parent gets child's original parent
-                  new_parent_obj.get_properties ().set_parent (get_parent ().as_octave_value ());
+                  new_parent_go.get_properties ().set_parent (get_parent ().as_octave_value ());
                 }
 
               // Set parent property to new_parent and do adoption
@@ -3041,7 +3068,7 @@
               ::adopt (parent.handle_value (), __myhandle__);
             }
           else
-            error ("set: invalid graphics handle (= %g) for parent", hnp);
+            error ("set: invalid graphics handle (= %g) for parent", hp);
         }
     }
   else
@@ -3063,38 +3090,40 @@
 void
 base_properties::mark_modified (void)
 {
-  __modified__ = "on";
-  graphics_object parent_obj = gh_manager::get_object (get_parent ());
-  if (parent_obj)
-    parent_obj.mark_modified ();
+  // Mark existing object as modified
+  __modified__ = "on";  
+  // Attempt to mark parent object as modified if it exists
+  graphics_object parent_go = gh_manager::get_object (get_parent ());
+  if (parent_go)
+    parent_go.mark_modified ();
 }
 
 void
 base_properties::override_defaults (base_graphics_object& obj)
 {
-  graphics_object parent_obj = gh_manager::get_object (get_parent ());
-
-  if (parent_obj)
-    parent_obj.override_defaults (obj);
+  graphics_object parent_go = gh_manager::get_object (get_parent ());
+
+  if (parent_go)
+    parent_go.override_defaults (obj);
 }
 
 void
 base_properties::update_axis_limits (const std::string& axis_type) const
 {
-  graphics_object obj = gh_manager::get_object (__myhandle__);
-
-  if (obj)
-    obj.update_axis_limits (axis_type);
+  graphics_object go = gh_manager::get_object (__myhandle__);
+
+  if (go)
+    go.update_axis_limits (axis_type);
 }
 
 void
 base_properties::update_axis_limits (const std::string& axis_type,
                                      const graphics_handle& h) const
 {
-  graphics_object obj = gh_manager::get_object (__myhandle__);
-
-  if (obj)
-    obj.update_axis_limits (axis_type, h);
+  graphics_object go = gh_manager::get_object (__myhandle__);
+
+  if (go)
+    go.update_axis_limits (axis_type, h);
 }
 
 void
@@ -3103,11 +3132,11 @@
   if (uicontextmenu.get ().is_empty ())
     return;
 
-  graphics_object obj = gh_manager::get_object (uicontextmenu.get ());
-  if (obj && obj.isa ("uicontextmenu"))
+  graphics_object go = gh_manager::get_object (uicontextmenu.get ());
+  if (go && go.isa ("uicontextmenu"))
     {
       uicontextmenu::properties& props =
-        reinterpret_cast<uicontextmenu::properties&> (obj.get_properties ());
+        reinterpret_cast<uicontextmenu::properties&> (go.get_properties ());
       props.add_dependent_obj (__myhandle__);
     }
 }
@@ -3147,30 +3176,32 @@
 void
 base_properties::update_autopos (const std::string& elem_type)
 {
-  graphics_object parent_obj = gh_manager::get_object (get_parent ());
-
-  if (parent_obj.valid_object ())
-    parent_obj.get_properties ().update_autopos (elem_type);
-}
-
-void
-base_properties::add_listener (const caseless_str& nm, const octave_value& v,
+  graphics_object parent_go = gh_manager::get_object (get_parent ());
+
+  if (parent_go.valid_object ())
+    parent_go.get_properties ().update_autopos (elem_type);
+}
+
+void
+base_properties::add_listener (const caseless_str& pname,
+                               const octave_value& val,
                                listener_mode mode)
 {
-  property p = get_property (nm);
+  property p = get_property (pname);
 
   if (! error_state && p.ok ())
-    p.add_listener (v, mode);
-}
-
-void
-base_properties::delete_listener (const caseless_str& nm,
-                                  const octave_value& v, listener_mode mode)
-{
-  property p = get_property (nm);
+    p.add_listener (val, mode);
+}
+
+void
+base_properties::delete_listener (const caseless_str& pname,
+                                  const octave_value& val,
+                                  listener_mode mode)
+{
+  property p = get_property (pname);
 
   if (! error_state && p.ok ())
-    p.delete_listener (v, mode);
+    p.delete_listener (val, mode);
 }
 
 // ---------------------------------------------------------------------
@@ -3180,10 +3211,10 @@
 {
   if (valid_object ())
     {
-      graphics_object parent_obj = gh_manager::get_object (get_parent ());
-
-      if (parent_obj)
-        parent_obj.update_axis_limits (axis_type);
+      graphics_object parent_go = gh_manager::get_object (get_parent ());
+
+      if (parent_go)
+        parent_go.update_axis_limits (axis_type);
     }
   else
     error ("base_graphics_object::update_axis_limits: invalid graphics object");
@@ -3193,15 +3224,15 @@
 base_graphics_object::update_axis_limits (const std::string& axis_type,
                                           const graphics_handle& h)
 {
-  if (valid_object ())
-    {
-      graphics_object parent_obj = gh_manager::get_object (get_parent ());
-
-      if (parent_obj)
-        parent_obj.update_axis_limits (axis_type, h);
-    }
-  else
+  if (! valid_object ())
     error ("base_graphics_object::update_axis_limits: invalid graphics object");
+  else
+    {
+      graphics_object parent_go = gh_manager::get_object (get_parent ());
+
+      if (parent_go)
+        parent_go.update_axis_limits (axis_type, h);
+    }
 }
 
 void
@@ -3252,11 +3283,10 @@
         }
     }
 
-  graphics_object parent_obj = gh_manager::get_object (get_parent ());
-
-  if (parent_obj)
-    parent_obj.build_user_defaults_map (def, go_name);
-
+  graphics_object parent_go = gh_manager::get_object (get_parent ());
+
+  if (parent_go)
+    parent_go.build_user_defaults_map (def, go_name);
 }
 
 void
@@ -3277,15 +3307,16 @@
 {
   std::string retval;
 
-  if (valid_object ())
+  if (! valid_object ())
+    error ("base_graphics_object::values_as_string: invalid graphics object");
+  else
     {
       octave_map m = get ().map_value ();
-      graphics_object obj = gh_manager::get_object (get_handle ());
+      graphics_object go = gh_manager::get_object (get_handle ());
 
       for (octave_map::const_iterator pa = m.begin (); pa != m.end (); pa++)
         {
-          if (pa->first != "children"
-              && ! obj.has_readonly_property (pa->first))
+          if (pa->first != "children" && ! go.has_readonly_property (pa->first))
             {
               property p = get_properties ().get_property (pa->first);
 
@@ -3301,8 +3332,6 @@
       if (! retval.empty ())
         retval += "\n";
     }
-  else
-    error ("base_graphics_object::values_as_string: invalid graphics object");
 
   return retval;
 }
@@ -3312,11 +3341,13 @@
 {
   std::string retval;
 
-  if (valid_object ())
-    {
-      graphics_object obj = gh_manager::get_object (get_handle ());
-
-      if (prop != "children" && ! obj.has_readonly_property (prop))
+  if (! valid_object ())
+    error ("base_graphics_object::value_as_string: invalid graphics object");
+  else
+    {
+      graphics_object go = gh_manager::get_object (get_handle ());
+
+      if (prop != "children" && ! go.has_readonly_property (prop))
         {
           property p = get_properties ().get_property (prop);
 
@@ -3330,8 +3361,6 @@
       if (! retval.empty ())
         retval += "\n";
     }
-  else
-    error ("base_graphics_object::value_as_string: invalid graphics object");
 
   return retval;
 }
@@ -3341,16 +3370,18 @@
 {
   octave_scalar_map retval;
 
-  if (valid_object ())
+  if (! valid_object ())
+    error ("base_graphics_object::values_as_struct: invalid graphics object");
+  else
     {
       octave_scalar_map m = get ().scalar_map_value ();
-      graphics_object obj = gh_manager::get_object (get_handle ());
+      graphics_object go = gh_manager::get_object (get_handle ());
 
       for (octave_scalar_map::const_iterator pa = m.begin ();
            pa != m.end (); pa++)
         {
           if (pa->first != "children"
-              && ! obj.has_readonly_property (pa->first))
+              && ! go.has_readonly_property (pa->first))
             {
               property p = get_properties ().get_property (pa->first);
 
@@ -3364,8 +3395,6 @@
             }
         }
     }
-  else
-    error ("base_graphics_object::values_as_struct: invalid graphics object");
 
   return retval;
 }
@@ -3597,7 +3626,6 @@
     }
 }
 
-
 double
 root_figure::properties::get_recursionlimit (void) const
 {
@@ -3667,56 +3695,57 @@
     }
 }
 
-// FIXME: This should update monitorpositions and pointerlocation, but
-// as these properties are yet used, and so it doesn't matter that they
-// aren't set yet.
+// FIXME: This should update monitorpositions and pointerlocation, but as these
+// properties aren't yet used, it doesn't matter that they aren't set either.
 void
 root_figure::properties::update_units (void)
 {
   caseless_str xunits = get_units ();
 
-  Matrix ss = default_screensize ();
+  Matrix scrn_sz = default_screensize ();
 
   double dpi = get_screenpixelsperinch ();
 
   if (xunits.compare ("inches"))
     {
-      ss(0) = 0;
-      ss(1) = 0;
-      ss(2) /= dpi;
-      ss(3) /= dpi;
+      scrn_sz(0) = 0;
+      scrn_sz(1) = 0;
+      scrn_sz(2) /= dpi;
+      scrn_sz(3) /= dpi;
     }
   else if (xunits.compare ("centimeters"))
     {
-      ss(0) = 0;
-      ss(1) = 0;
-      ss(2) *= 2.54 / dpi;
-      ss(3) *= 2.54 / dpi;
+      scrn_sz(0) = 0;
+      scrn_sz(1) = 0;
+      scrn_sz(2) *= 2.54 / dpi;
+      scrn_sz(3) *= 2.54 / dpi;
     }
   else if (xunits.compare ("normalized"))
     {
-      ss = Matrix (1, 4, 1.0);
-      ss(0) = 0;
-      ss(1) = 0;
+      scrn_sz = Matrix (1, 4, 1.0);
+      scrn_sz(0) = 0;
+      scrn_sz(1) = 0;
     }
   else if (xunits.compare ("points"))
     {
-      ss(0) = 0;
-      ss(1) = 0;
-      ss(2) *= 72 / dpi;
-      ss(3) *= 72 / dpi;
-    }
-
-  set_screensize (ss);
+      scrn_sz(0) = 0;
+      scrn_sz(1) = 0;
+      scrn_sz(2) *= 72 / dpi;
+      scrn_sz(3) *= 72 / dpi;
+    }
+
+  set_screensize (scrn_sz);
 }
 
 Matrix
 root_figure::properties::get_boundingbox (bool, const Matrix&) const
 {
   Matrix screen_size = screen_size_pixels ();
-  Matrix pos = Matrix (1, 4, 0);
+  Matrix pos = Matrix (1, 4, 0.0);
+
   pos(2) = screen_size(0);
   pos(3) = screen_size(1);
+
   return pos;
 }
 
@@ -3743,15 +3772,15 @@
 */
 
 void
-root_figure::properties::remove_child (const graphics_handle& gh)
-{
-  gh_manager::pop_figure (gh);
+root_figure::properties::remove_child (const graphics_handle& h)
+{
+  gh_manager::pop_figure (h);
 
   graphics_handle cf = gh_manager::current_figure ();
 
   xset (0, "currentfigure", cf.value ());
 
-  base_properties::remove_child (gh);
+  base_properties::remove_child (h);
 }
 
 property_list
@@ -3770,25 +3799,25 @@
 // ---------------------------------------------------------------------
 
 void
-figure::properties::set_currentaxes (const octave_value& v)
-{
-  graphics_handle val (v);
+figure::properties::set_currentaxes (const octave_value& val)
+{
+  graphics_handle hax (val);
 
   if (error_state)
     return;
 
-  if (xisnan (val.value ()) || is_handle (val))
-    currentaxes = val;
+  if (xisnan (hax.value ()) || is_handle (hax))
+    currentaxes = hax;
   else
     gripe_set_invalid ("currentaxes");
 }
 
 void
-figure::properties::remove_child (const graphics_handle& gh)
-{
-  base_properties::remove_child (gh);
-
-  if (gh == currentaxes.handle_value ())
+figure::properties::remove_child (const graphics_handle& h)
+{
+  base_properties::remove_child (h);
+
+  if (h == currentaxes.handle_value ())
     {
       graphics_handle new_currentaxes;
 
@@ -3846,11 +3875,11 @@
 void
 figure::properties::set_visible (const octave_value& val)
 {
-  std::string s = val.string_value ();
+  std::string sval = val.string_value ();
 
   if (! error_state)
     {
-      if (s == "on")
+      if (sval == "on")
         xset (0, "currentfigure", __myhandle__.value ());
 
       visible = val;
@@ -3896,7 +3925,7 @@
 figure::properties::map_from_boundingbox (double x, double y) const
 {
   Matrix bb = get_boundingbox (true);
-  Matrix pos (1, 2, 0);
+  Matrix pos (1, 2, 0.0);
 
   pos(0) = x;
   pos(1) = y;
@@ -3913,7 +3942,7 @@
 figure::properties::map_to_boundingbox (double x, double y) const
 {
   Matrix bb = get_boundingbox (true);
-  Matrix pos (1, 2, 0);
+  Matrix pos (1, 2, 0.0);
 
   pos(0) = x;
   pos(1) = y;
@@ -3973,20 +4002,20 @@
 }
 
 void
-figure::properties::set_paperunits (const octave_value& v)
+figure::properties::set_paperunits (const octave_value& val)
 {
   if (! error_state)
     {
-      caseless_str typ = get_papertype ();
-      caseless_str punits = v.string_value ();
+      caseless_str punits = val.string_value ();
+      caseless_str ptype = get_papertype ();
       if (! error_state)
         {
-          if (punits.compare ("normalized") && typ.compare ("<custom>"))
-            error ("set: can't set the paperunits to normalized when the papertype is custom");
+          if (punits.compare ("normalized") && ptype.compare ("<custom>"))
+            error ("set: can't set paperunits to normalized when papertype is custom");
           else
             {
               caseless_str old_paperunits = get_paperunits ();
-              if (paperunits.set (v, true))
+              if (paperunits.set (val, true))
                 {
                   update_paperunits (old_paperunits);
                   mark_modified ();
@@ -3997,19 +4026,19 @@
 }
 
 void
-figure::properties::set_papertype (const octave_value& v)
+figure::properties::set_papertype (const octave_value& val)
 {
   if (! error_state)
     {
-      caseless_str typ = v.string_value ();
+      caseless_str ptype = val.string_value ();
       caseless_str punits = get_paperunits ();
       if (! error_state)
         {
-          if (punits.compare ("normalized") && typ.compare ("<custom>"))
-            error ("set: can't set the paperunits to normalized when the papertype is custom");
+          if (punits.compare ("normalized") && ptype.compare ("<custom>"))
+            error ("set: can't set paperunits to normalized when papertype is custom");
           else
             {
-              if (papertype.set (v, true))
+              if (papertype.set (val, true))
                 {
                   update_papertype ();
                   mark_modified ();
@@ -4020,9 +4049,9 @@
 }
 
 static Matrix
-papersize_from_type (const caseless_str punits, const caseless_str typ)
-{
-  Matrix ret (1, 2, 1.0);
+papersize_from_type (const caseless_str punits, const caseless_str ptype)
+{
+  Matrix retval (1, 2, 1.0);
 
   if (! punits.compare ("normalized"))
     {
@@ -4045,134 +4074,134 @@
           mm2units = 72.0 / 25.4;
         }
 
-      if (typ.compare ("usletter"))
-        {
-          ret (0) = 8.5 * in2units;
-          ret (1) = 11.0 * in2units;
-        }
-      else if (typ.compare ("uslegal"))
-        {
-          ret (0) = 8.5 * in2units;
-          ret (1) = 14.0 * in2units;
-        }
-      else if (typ.compare ("tabloid"))
-        {
-          ret (0) = 11.0 * in2units;
-          ret (1) = 17.0 * in2units;
-        }
-      else if (typ.compare ("a0"))
-        {
-          ret (0) = 841.0 * mm2units;
-          ret (1) = 1189.0 * mm2units;
-        }
-      else if (typ.compare ("a1"))
-        {
-          ret (0) = 594.0 * mm2units;
-          ret (1) = 841.0 * mm2units;
-        }
-      else if (typ.compare ("a2"))
-        {
-          ret (0) = 420.0 * mm2units;
-          ret (1) = 594.0 * mm2units;
-        }
-      else if (typ.compare ("a3"))
-        {
-          ret (0) = 297.0 * mm2units;
-          ret (1) = 420.0 * mm2units;
-        }
-      else if (typ.compare ("a4"))
-        {
-          ret (0) = 210.0 * mm2units;
-          ret (1) = 297.0 * mm2units;
-        }
-      else if (typ.compare ("a5"))
-        {
-          ret (0) = 148.0 * mm2units;
-          ret (1) = 210.0 * mm2units;
-        }
-      else if (typ.compare ("b0"))
-        {
-          ret (0) = 1029.0 * mm2units;
-          ret (1) = 1456.0 * mm2units;
-        }
-      else if (typ.compare ("b1"))
-        {
-          ret (0) = 728.0 * mm2units;
-          ret (1) = 1028.0 * mm2units;
-        }
-      else if (typ.compare ("b2"))
-        {
-          ret (0) = 514.0 * mm2units;
-          ret (1) = 728.0 * mm2units;
-        }
-      else if (typ.compare ("b3"))
-        {
-          ret (0) = 364.0 * mm2units;
-          ret (1) = 514.0 * mm2units;
-        }
-      else if (typ.compare ("b4"))
-        {
-          ret (0) = 257.0 * mm2units;
-          ret (1) = 364.0 * mm2units;
-        }
-      else if (typ.compare ("b5"))
-        {
-          ret (0) = 182.0 * mm2units;
-          ret (1) = 257.0 * mm2units;
-        }
-      else if (typ.compare ("arch-a"))
-        {
-          ret (0) = 9.0 * in2units;
-          ret (1) = 12.0 * in2units;
-        }
-      else if (typ.compare ("arch-b"))
-        {
-          ret (0) = 12.0 * in2units;
-          ret (1) = 18.0 * in2units;
-        }
-      else if (typ.compare ("arch-c"))
-        {
-          ret (0) = 18.0 * in2units;
-          ret (1) = 24.0 * in2units;
-        }
-      else if (typ.compare ("arch-d"))
-        {
-          ret (0) = 24.0 * in2units;
-          ret (1) = 36.0 * in2units;
-        }
-      else if (typ.compare ("arch-e"))
-        {
-          ret (0) = 36.0 * in2units;
-          ret (1) = 48.0 * in2units;
-        }
-      else if (typ.compare ("a"))
-        {
-          ret (0) = 8.5 * in2units;
-          ret (1) = 11.0 * in2units;
-        }
-      else if (typ.compare ("b"))
-        {
-          ret (0) = 11.0 * in2units;
-          ret (1) = 17.0 * in2units;
-        }
-      else if (typ.compare ("c"))
-        {
-          ret (0) = 17.0 * in2units;
-          ret (1) = 22.0 * in2units;
-        }
-      else if (typ.compare ("d"))
-        {
-          ret (0) = 22.0 * in2units;
-          ret (1) = 34.0 * in2units;
-        }
-      else if (typ.compare ("e"))
-        {
-          ret (0) = 34.0 * in2units;
-          ret (1) = 43.0 * in2units;
-        }
-    }
-
-  return ret;
+      if (ptype.compare ("usletter"))
+        {
+          retval(0) = 8.5 * in2units;
+          retval(1) = 11.0 * in2units;
+        }
+      else if (ptype.compare ("uslegal"))
+        {
+          retval(0) = 8.5 * in2units;
+          retval(1) = 14.0 * in2units;
+        }
+      else if (ptype.compare ("tabloid"))
+        {
+          retval(0) = 11.0 * in2units;
+          retval(1) = 17.0 * in2units;
+        }
+      else if (ptype.compare ("a0"))
+        {
+          retval(0) = 841.0 * mm2units;
+          retval(1) = 1189.0 * mm2units;
+        }
+      else if (ptype.compare ("a1"))
+        {
+          retval(0) = 594.0 * mm2units;
+          retval(1) = 841.0 * mm2units;
+        }
+      else if (ptype.compare ("a2"))
+        {
+          retval(0) = 420.0 * mm2units;
+          retval(1) = 594.0 * mm2units;
+        }
+      else if (ptype.compare ("a3"))
+        {
+          retval(0) = 297.0 * mm2units;
+          retval(1) = 420.0 * mm2units;
+        }
+      else if (ptype.compare ("a4"))
+        {
+          retval(0) = 210.0 * mm2units;
+          retval(1) = 297.0 * mm2units;
+        }
+      else if (ptype.compare ("a5"))
+        {
+          retval(0) = 148.0 * mm2units;
+          retval(1) = 210.0 * mm2units;
+        }
+      else if (ptype.compare ("b0"))
+        {
+          retval(0) = 1029.0 * mm2units;
+          retval(1) = 1456.0 * mm2units;
+        }
+      else if (ptype.compare ("b1"))
+        {
+          retval(0) = 728.0 * mm2units;
+          retval(1) = 1028.0 * mm2units;
+        }
+      else if (ptype.compare ("b2"))
+        {
+          retval(0) = 514.0 * mm2units;
+          retval(1) = 728.0 * mm2units;
+        }
+      else if (ptype.compare ("b3"))
+        {
+          retval(0) = 364.0 * mm2units;
+          retval(1) = 514.0 * mm2units;
+        }
+      else if (ptype.compare ("b4"))
+        {
+          retval(0) = 257.0 * mm2units;
+          retval(1) = 364.0 * mm2units;
+        }
+      else if (ptype.compare ("b5"))
+        {
+          retval(0) = 182.0 * mm2units;
+          retval(1) = 257.0 * mm2units;
+        }
+      else if (ptype.compare ("arch-a"))
+        {
+          retval(0) = 9.0 * in2units;
+          retval(1) = 12.0 * in2units;
+        }
+      else if (ptype.compare ("arch-b"))
+        {
+          retval(0) = 12.0 * in2units;
+          retval(1) = 18.0 * in2units;
+        }
+      else if (ptype.compare ("arch-c"))
+        {
+          retval(0) = 18.0 * in2units;
+          retval(1) = 24.0 * in2units;
+        }
+      else if (ptype.compare ("arch-d"))
+        {
+          retval(0) = 24.0 * in2units;
+          retval(1) = 36.0 * in2units;
+        }
+      else if (ptype.compare ("arch-e"))
+        {
+          retval(0) = 36.0 * in2units;
+          retval(1) = 48.0 * in2units;
+        }
+      else if (ptype.compare ("a"))
+        {
+          retval(0) = 8.5 * in2units;
+          retval(1) = 11.0 * in2units;
+        }
+      else if (ptype.compare ("b"))
+        {
+          retval(0) = 11.0 * in2units;
+          retval(1) = 17.0 * in2units;
+        }
+      else if (ptype.compare ("c"))
+        {
+          retval(0) = 17.0 * in2units;
+          retval(1) = 22.0 * in2units;
+        }
+      else if (ptype.compare ("d"))
+        {
+          retval(0) = 22.0 * in2units;
+          retval(1) = 34.0 * in2units;
+        }
+      else if (ptype.compare ("e"))
+        {
+          retval(0) = 34.0 * in2units;
+          retval(1) = 43.0 * in2units;
+        }
+    }
+
+  return retval;
 }
 
 
@@ -4304,9 +4333,9 @@
 
   std::string porient = get_paperorientation ();
   caseless_str punits = get_paperunits ();
-  caseless_str typ = get_papertype ();
-
-  if (typ.compare ("<custom>"))
+  caseless_str ptype = get_papertype ();
+
+  if (ptype.compare ("<custom>"))
     {
       if (old_paperunits.compare ("centimeters"))
         {
@@ -4332,7 +4361,7 @@
     }
   else
     {
-      sz = papersize_from_type (punits, typ);
+      sz = papersize_from_type (punits, ptype);
       if (porient == "landscape")
         std::swap (sz(0), sz(1));
     }
@@ -4356,7 +4385,7 @@
       if (get_paperorientation () == "landscape")
         std::swap (sz(0), sz(1));
       // Call papersize.set rather than set_papersize to avoid loops
-      // between update_papersize and update_papertype
+      // between update_papersize and update_papertype.
       papersize.set (octave_value (sz));
     }
 
@@ -4378,6 +4407,7 @@
     {
       paperorientation.set ("portrait");
     }
+
   std::string punits = get_paperunits ();
   if (punits == "centimeters")
     {
@@ -4391,93 +4421,93 @@
     }
   if (punits == "normalized")
     {
-      caseless_str typ = get_papertype ();
       if (get_papertype () == "<custom>")
         error ("set: can't set the papertype to <custom> when the paperunits is normalized");
     }
   else
     {
-      // TODO - the papersizes info is also in papersize_from_type().
-      // Both should be rewritten to avoid the duplication.
-      std::string typ = "<custom>";
+      // FIXME: The papersizes info is also in papersize_from_type().
+      //        Both should be rewritten to avoid the duplication.
+      //        Don't Repeat Yourself (DRY) principle.
+      std::string ptype = "<custom>";
       const double mm2in = 1.0 / 25.4;
       const double tol = 0.01;
 
       if (std::abs (sz(0) - 8.5) + std::abs (sz(1) - 11.0) < tol)
-        typ = "usletter";
+        ptype = "usletter";
       else if (std::abs (sz(0) - 8.5) + std::abs (sz(1) - 14.0) < tol)
-        typ = "uslegal";
+        ptype = "uslegal";
       else if (std::abs (sz(0) - 11.0) + std::abs (sz(1) - 17.0) < tol)
-        typ = "tabloid";
+        ptype = "tabloid";
       else if (std::abs (sz(0) - 841.0 * mm2in)
                + std::abs (sz(1) - 1198.0 * mm2in) < tol)
-        typ = "a0";
+        ptype = "a0";
       else if (std::abs (sz(0) - 594.0 * mm2in)
                + std::abs (sz(1) - 841.0 * mm2in) < tol)
-        typ = "a1";
+        ptype = "a1";
       else if (std::abs (sz(0) - 420.0 * mm2in)
                + std::abs (sz(1) - 594.0 * mm2in) < tol)
-        typ = "a2";
+        ptype = "a2";
       else if (std::abs (sz(0) - 297.0 * mm2in)
                + std::abs (sz(1) - 420.0 * mm2in) < tol)
-        typ = "a3";
+        ptype = "a3";
       else if (std::abs (sz(0) - 210.0 * mm2in)
                + std::abs (sz(1) - 297.0 * mm2in) < tol)
-        typ = "a4";
+        ptype = "a4";
       else if (std::abs (sz(0) - 148.0 * mm2in)
                + std::abs (sz(1) - 210.0 * mm2in) < tol)
-        typ = "a5";
+        ptype = "a5";
       else if (std::abs (sz(0) - 1029.0 * mm2in)
                + std::abs (sz(1) - 1456.0 * mm2in) < tol)
-        typ = "b0";
+        ptype = "b0";
       else if (std::abs (sz(0) - 728.0 * mm2in)
                + std::abs (sz(1) - 1028.0 * mm2in) < tol)
-        typ = "b1";
+        ptype = "b1";
       else if (std::abs (sz(0) - 514.0 * mm2in)
                + std::abs (sz(1) - 728.0 * mm2in) < tol)
-        typ = "b2";
+        ptype = "b2";
       else if (std::abs (sz(0) - 364.0 * mm2in)
                + std::abs (sz(1) - 514.0 * mm2in) < tol)
-        typ = "b3";
+        ptype = "b3";
       else if (std::abs (sz(0) - 257.0 * mm2in)
                + std::abs (sz(1) - 364.0 * mm2in) < tol)
-        typ = "b4";
+        ptype = "b4";
       else if (std::abs (sz(0) - 182.0 * mm2in)
                + std::abs (sz(1) - 257.0 * mm2in) < tol)
-        typ = "b5";
+        ptype = "b5";
       else if (std::abs (sz(0) - 9.0)
                + std::abs (sz(1) - 12.0) < tol)
-        typ = "arch-a";
+        ptype = "arch-a";
       else if (std::abs (sz(0) - 12.0)
                + std::abs (sz(1) - 18.0) < tol)
-        typ = "arch-b";
+        ptype = "arch-b";
       else if (std::abs (sz(0) - 18.0)
                + std::abs (sz(1) - 24.0) < tol)
-        typ = "arch-c";
+        ptype = "arch-c";
       else if (std::abs (sz(0) - 24.0)
                + std::abs (sz(1) - 36.0) < tol)
-        typ = "arch-d";
+        ptype = "arch-d";
       else if (std::abs (sz(0) - 36.0)
                + std::abs (sz(1) - 48.0) < tol)
-        typ = "arch-e";
+        ptype = "arch-e";
       else if (std::abs (sz(0) - 8.5)
                + std::abs (sz(1) - 11.0) < tol)
-        typ = "a";
+        ptype = "a";
       else if (std::abs (sz(0) - 11.0)
                + std::abs (sz(1) - 17.0) < tol)
-        typ = "b";
+        ptype = "b";
       else if (std::abs (sz(0) - 17.0)
                + std::abs (sz(1) - 22.0) < tol)
-        typ = "c";
+        ptype = "c";
       else if (std::abs (sz(0) - 22.0)
                + std::abs (sz(1) - 34.0) < tol)
-        typ = "d";
+        ptype = "d";
       else if (std::abs (sz(0) - 34.0)
                + std::abs (sz(1) - 43.0) < tol)
-        typ = "e";
+        ptype = "e";
       // Call papertype.set rather than set_papertype to avoid loops between
       // update_papersize and update_papertype
-      papertype.set (typ);
+      papertype.set (ptype);
     }
   if (punits == "centimeters")
     {
@@ -4581,12 +4611,12 @@
 */
 
 void
-figure::properties::set_units (const octave_value& v)
+figure::properties::set_units (const octave_value& val)
 {
   if (! error_state)
     {
       caseless_str old_units = get_units ();
-      if (units.set (v, true))
+      if (units.set (val, true))
         {
           update_units (old_units);
           mark_modified ();
@@ -4644,10 +4674,10 @@
 
   if (retval.is_undefined ())
     {
-      graphics_handle parent = get_parent ();
-      graphics_object parent_obj = gh_manager::get_object (parent);
-
-      retval = parent_obj.get_default (name);
+      graphics_handle parent_h = get_parent ();
+      graphics_object parent_go = gh_manager::get_object (parent_h);
+
+      retval = parent_go.get_default (name);
     }
 
   return retval;
@@ -4682,6 +4712,8 @@
   colororder.add_constraint (dim_vector (-1, 3));
   dataaspectratio.add_constraint (dim_vector (1, 3));
   plotboxaspectratio.add_constraint (dim_vector (1, 3));
+  // FIXME: Should these use dimension vectors?  Currently can set 'xlim' to
+  // any matrix size, but only first two elements are used.
   alim.add_constraint (2);
   clim.add_constraint (2);
   xlim.add_constraint (2);
@@ -4766,8 +4798,8 @@
 axes::properties::calc_tightbox (const Matrix& init_pos)
 {
   Matrix pos = init_pos;
-  graphics_object obj = gh_manager::get_object (get_parent ());
-  Matrix parent_bb = obj.get_properties ().get_boundingbox (true);
+  graphics_object go = gh_manager::get_object (get_parent ());
+  Matrix parent_bb = go.get_properties ().get_boundingbox (true);
   Matrix ext = get_extent (true, true);
   ext(1) = parent_bb(3) - ext(1) - ext(3);
   ext(0)++;
@@ -4789,6 +4821,7 @@
     }
   if (ext(1)+ext(3) > pos(1)+pos(3))
     pos(3) = ext(1)+ext(3)-pos(1);
+
   return pos;
 }
 
@@ -4975,7 +5008,7 @@
 }
 
 void
-axes::properties::set_defaults (base_graphics_object& obj,
+axes::properties::set_defaults (base_graphics_object& bgo,
                                 const std::string& mode)
 {
   box = "on";
@@ -4986,16 +5019,15 @@
 
   Matrix tlim (1, 2, 0.0);
   tlim(1) = 1;
+  alim = tlim;
   xlim = tlim;
   ylim = tlim;
   zlim = tlim;
 
-  Matrix cl (1, 2, 0);
+  Matrix cl (1, 2, 0.0);
   cl(1) = 1;
   clim = cl;
 
-  alim = tlim;
-
   xlimmode = "auto";
   ylimmode = "auto";
   zlimmode = "auto";
@@ -5169,7 +5201,7 @@
 
   update_transform ();
   sync_positions ();
-  override_defaults (obj);
+  override_defaults (bgo);
 }
 
 void
@@ -5234,8 +5266,10 @@
 xform_matrix (void)
 {
   Matrix m (4, 4, 0.0);
+
   for (int i = 0; i < 4; i++)
     m(i,i) = 1;
+
   return m;
 }
 
@@ -5243,7 +5277,9 @@
 xform_vector (void)
 {
   ColumnVector v (4, 0.0);
+
   v(3) = 1;
+
   return v;
 }
 
@@ -5251,7 +5287,11 @@
 xform_vector (double x, double y, double z)
 {
   ColumnVector v (4, 1.0);
-  v(0) = x; v(1) = y; v(2) = z;
+
+  v(0) = x;
+  v(1) = y;
+  v(2) = z;
+
   return v;
 }
 
@@ -5265,7 +5305,12 @@
 xform_scale (double x, double y, double z)
 {
   Matrix m (4, 4, 0.0);
-  m(0,0) = x; m(1,1) = y; m(2,2) = z; m(3,3) = 1;
+
+  m(0,0) = x;
+  m(1,1) = y;
+  m(2,2) = z;
+  m(3,3) = 1;
+
   return m;
 }
 
@@ -5273,7 +5318,12 @@
 xform_translate (double x, double y, double z)
 {
   Matrix m = xform_matrix ();
-  m(0,3) = x; m(1,3) = y; m(2,3) = z; m(3,3) = 1;
+
+  m(0,3) = x;
+  m(1,3) = y;
+  m(2,3) = z;
+  m(3,3) = 1;
+
   return m;
 }
 
@@ -5292,7 +5342,7 @@
 inline void
 xform (ColumnVector& v, const Matrix& m)
 {
-  v = m*v;
+  v = m * v;
 }
 
 inline void
@@ -5334,9 +5384,11 @@
 cross (const ColumnVector& v1, const ColumnVector& v2)
 {
   ColumnVector r = xform_vector ();
-  r(0) = v1(1)*v2(2)-v1(2)*v2(1);
-  r(1) = v1(2)*v2(0)-v1(0)*v2(2);
-  r(2) = v1(0)*v2(1)-v1(1)*v2(0);
+
+  r(0) = v1(1)*v2(2) - v1(2)*v2(1);
+  r(1) = v1(2)*v2(0) - v1(0)*v2(2);
+  r(2) = v1(0)*v2(1) - v1(1)*v2(0);
+
   return r;
 }
 
@@ -5355,7 +5407,9 @@
     1,1,1,1
   };
   Matrix m (4, 8);
+
   memcpy (m.fortran_vec (), data, sizeof (double)*32);
+
   return m;
 }
 
@@ -5363,7 +5417,9 @@
 cam2xform (const Array<double>& m)
 {
   ColumnVector retval (4, 1.0);
+
   memcpy (retval.fortran_vec (), m.fortran_vec (), sizeof (double)*3);
+
   return retval;
 }
 
@@ -5403,9 +5459,9 @@
 
   if (cameratargetmode_is ("auto"))
     {
-      c_center(0) = (xlimits(0)+xlimits(1))/2;
-      c_center(1) = (ylimits(0)+ylimits(1))/2;
-      c_center(2) = (zlimits(0)+zlimits(1))/2;
+      c_center(0) = (xlimits(0) + xlimits(1)) / 2;
+      c_center(1) = (ylimits(0) + ylimits(1)) / 2;
+      c_center(2) = (zlimits(0) + zlimits(1)) / 2;
 
       cameratarget = xform2cam (c_center);
     }
@@ -5417,7 +5473,7 @@
       Matrix tview = get_view ().matrix_value ();
       double az = tview(0);
       double el = tview(1);
-      double d = 5 * sqrt (pb(0)*pb(0)+pb(1)*pb(1)+pb(2)*pb(2));
+      double d = 5 * sqrt (pb(0)*pb(0) + pb(1)*pb(1) + pb(2)*pb(2));
 
       if (el == 90 || el == -90)
         c_eye(2) = d*signum (el);
@@ -5486,7 +5542,7 @@
 
   if (std::abs (dot (f, UP)) > 1e-15)
     {
-      double fa = 1 / sqrt(1-f(2)*f(2));
+      double fa = 1 / sqrt (1 - f(2)*f(2));
       scale (UP, fa, fa, fa);
     }
 
@@ -5506,8 +5562,8 @@
   Matrix x_cube = x_view * unit_cube ();
   ColumnVector cmin = x_cube.row_min ();
   ColumnVector cmax = x_cube.row_max ();
-  double xM = cmax(0)-cmin(0);
-  double yM = cmax(1)-cmin(1);
+  double xM = cmax(0) - cmin(0);
+  double yM = cmax(1) - cmin(1);
 
   Matrix bb = get_boundingbox (true);
 
@@ -5584,9 +5640,8 @@
 
   x_render_inv = x_render.inverse ();
 
-  // Note: these matrices are a slight modified version of the regular
-  // matrices, more suited for OpenGL rendering (x_gl_mat1 => light
-  // => x_gl_mat2)
+  // Note: these matrices are a slight modified version of the regular matrices,
+  // more suited for OpenGL rendering (x_gl_mat1 => light => x_gl_mat2)
   x_gl_mat1 = x_view;
   scale (x_gl_mat1, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
          zd/(zlimits(1)-zlimits(0)));
@@ -5623,9 +5678,9 @@
 
   p1 = xform.transform (x_min, (y_min+y_max)/2, (z_min+z_max)/2, false);
   p2 = xform.transform (x_max, (y_min+y_max)/2, (z_min+z_max)/2, false);
-  dir(0) = xround (p2(0)-p1(0));
-  dir(1) = xround (p2(1)-p1(1));
-  dir(2) = (p2(2)-p1(2));
+  dir(0) = xround (p2(0) - p1(0));
+  dir(1) = xround (p2(1) - p1(1));
+  dir(2) = (p2(2) - p1(2));
   if (dir(0) == 0 && dir(1) == 0)
     xstate = AXE_DEPTH_DIR;
   else if (dir(2) == 0)
@@ -5647,13 +5702,13 @@
     xPlane = (dir(2) < 0 ? x_min : x_max);
 
   xPlaneN = (xPlane == x_min ? x_max : x_min);
-  fx = (x_max-x_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1));
-
-  p1 = xform.transform ((x_min+x_max)/2, y_min, (z_min+z_max)/2, false);
-  p2 = xform.transform ((x_min+x_max)/2, y_max, (z_min+z_max)/2, false);
-  dir(0) = xround (p2(0)-p1(0));
-  dir(1) = xround (p2(1)-p1(1));
-  dir(2) = (p2(2)-p1(2));
+  fx = (x_max - x_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
+
+  p1 = xform.transform ((x_min + x_max)/2, y_min, (z_min + z_max)/2, false);
+  p2 = xform.transform ((x_min + x_max)/2, y_max, (z_min + z_max)/2, false);
+  dir(0) = xround (p2(0) - p1(0));
+  dir(1) = xround (p2(1) - p1(1));
+  dir(2) = (p2(2) - p1(2));
   if (dir(0) == 0 && dir(1) == 0)
     ystate = AXE_DEPTH_DIR;
   else if (dir(2) == 0)
@@ -5675,13 +5730,13 @@
     yPlane = (dir(2) < 0 ? y_min : y_max);
 
   yPlaneN = (yPlane == y_min ? y_max : y_min);
-  fy = (y_max-y_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1));
-
-  p1 = xform.transform ((x_min+x_max)/2, (y_min+y_max)/2, z_min, false);
-  p2 = xform.transform ((x_min+x_max)/2, (y_min+y_max)/2, z_max, false);
-  dir(0) = xround (p2(0)-p1(0));
-  dir(1) = xround (p2(1)-p1(1));
-  dir(2) = (p2(2)-p1(2));
+  fy = (y_max - y_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
+
+  p1 = xform.transform ((x_min + x_max)/2, (y_min + y_max)/2, z_min, false);
+  p2 = xform.transform ((x_min + x_max)/2, (y_min + y_max)/2, z_max, false);
+  dir(0) = xround (p2(0) - p1(0));
+  dir(1) = xround (p2(1) - p1(1));
+  dir(2) = (p2(2) - p1(2));
   if (dir(0) == 0 && dir(1) == 0)
     zstate = AXE_DEPTH_DIR;
   else if (dir(2) == 0)
@@ -5703,7 +5758,7 @@
     zPlane = (dir(2) < 0 ? z_min : z_max);
 
   zPlaneN = (zPlane == z_min ? z_max : z_min);
-  fz = (z_max-z_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1));
+  fz = (z_max - z_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
 
   unwind_protect frame;
   frame.protect_var (updating_axes_layout);
@@ -5769,8 +5824,8 @@
 
   Matrix bbox = get_boundingbox (true);
   Matrix ticklen = get_ticklength ().matrix_value ();
-  ticklen(0) = ticklen(0) * std::max (bbox(2), bbox(3));
-  ticklen(1) = ticklen(1) * std::max (bbox(2), bbox(3));
+  ticklen(0) *= std::max (bbox(2), bbox(3));
+  ticklen(1) *= std::max (bbox(2), bbox(3));
 
   xticklen = ticksign * (mode2d ? ticklen(0) : ticklen(1));
   yticklen = ticksign * (mode2d ? ticklen(0) : ticklen(1));
@@ -5841,13 +5896,13 @@
   if (updating_xlabel_position)
     return;
 
-  graphics_object obj = gh_manager::get_object (get_xlabel ());
-
-  if (! obj.valid_object ())
+  graphics_object go = gh_manager::get_object (get_xlabel ());
+
+  if (! go.valid_object ())
     return;
 
   text::properties& xlabel_props
-    = reinterpret_cast<text::properties&> (obj.get_properties ());
+    = reinterpret_cast<text::properties&> (go.get_properties ());
 
   bool is_empty = xlabel_props.get_string ().is_empty ();
 
@@ -5860,8 +5915,7 @@
       if (xlabel_props.horizontalalignmentmode_is ("auto"))
         {
           xlabel_props.set_horizontalalignment
-            (xstate > AXE_DEPTH_DIR
-             ? "center" : (xyzSym ? "left" : "right"));
+            (xstate > AXE_DEPTH_DIR ? "center" : (xyzSym ? "left" : "right"));
 
           xlabel_props.set_horizontalalignmentmode ("auto");
         }
@@ -5887,15 +5941,15 @@
 
       double wmax = ext(0);
       double hmax = ext(1);
-      double angle = 0;
+      double angle = 0.0;
       ColumnVector p =
-        graphics_xform::xform_vector ((xpTickN+xpTick)/2, ypTick, zpTick);
+        graphics_xform::xform_vector ((xpTickN + xpTick)/2, ypTick, zpTick);
 
       bool tick_along_z = nearhoriz || xisinf (fy);
       if (tick_along_z)
-        p(2) += (signum (zpTick-zpTickN)*fz*xtickoffset);
+        p(2) += (signum (zpTick - zpTickN) * fz * xtickoffset);
       else
-        p(1) += (signum (ypTick-ypTickN)*fy*xtickoffset);
+        p(1) += (signum (ypTick - ypTickN) * fy * xtickoffset);
 
       p = xform.transform (p(0), p(1), p(2), false);
 
@@ -5943,13 +5997,13 @@
   if (updating_ylabel_position)
     return;
 
-  graphics_object obj = gh_manager::get_object (get_ylabel ());
-
-  if (! obj.valid_object ())
+  graphics_object go = gh_manager::get_object (get_ylabel ());
+
+  if (! go.valid_object ())
     return;
 
   text::properties& ylabel_props
-    = reinterpret_cast<text::properties&> (obj.get_properties ());
+    = reinterpret_cast<text::properties&> (go.get_properties ());
 
   bool is_empty = ylabel_props.get_string ().is_empty ();
 
@@ -5962,8 +6016,7 @@
       if (ylabel_props.horizontalalignmentmode_is ("auto"))
         {
           ylabel_props.set_horizontalalignment
-            (ystate > AXE_DEPTH_DIR
-             ? "center" : (!xyzSym ? "left" : "right"));
+            (ystate > AXE_DEPTH_DIR ? "center" : (!xyzSym ? "left" : "right"));
 
           ylabel_props.set_horizontalalignmentmode ("auto");
         }
@@ -5998,15 +6051,15 @@
 
       double wmax = ext(0)+4;
       double hmax = ext(1);
-      double angle = 0;
+      double angle = 0.0;
       ColumnVector p =
-        graphics_xform::xform_vector (xpTick, (ypTickN+ypTick)/2, zpTick);
+        graphics_xform::xform_vector (xpTick, (ypTickN + ypTick)/2, zpTick);
 
       bool tick_along_z = nearhoriz || xisinf (fx);
       if (tick_along_z)
-        p(2) += (signum (zpTick-zpTickN)*fz*ytickoffset);
+        p(2) += (signum (zpTick - zpTickN) * fz * ytickoffset);
       else
-        p(0) += (signum (xpTick-xpTickN)*fx*ytickoffset);
+        p(0) += (signum (xpTick - xpTickN) * fx * ytickoffset);
 
       p = xform.transform (p(0), p(1), p(2), false);
 
@@ -6054,13 +6107,13 @@
   if (updating_zlabel_position)
     return;
 
-  graphics_object obj = gh_manager::get_object (get_zlabel ());
-
-  if (! obj.valid_object ())
+  graphics_object go = gh_manager::get_object (get_zlabel ());
+
+  if (! go.valid_object ())
     return;
 
   text::properties& zlabel_props
-    = reinterpret_cast<text::properties&> (obj.get_properties ());
+    = reinterpret_cast<text::properties&> (go.get_properties ());
 
   bool camAuto = cameraupvectormode_is ("auto");
   bool is_empty = zlabel_props.get_string ().is_empty ();
@@ -6101,26 +6154,26 @@
 
       double wmax = ext(0);
       double hmax = ext(1);
-      double angle = 0;
+      double angle = 0.0;
       ColumnVector p;
 
       if (xySym)
         {
           p = graphics_xform::xform_vector (xPlaneN, yPlane,
-                                            (zpTickN+zpTick)/2);
+                                            (zpTickN + zpTick)/2);
           if (xisinf (fy))
-            p(0) += (signum (xPlaneN-xPlane)*fx*ztickoffset);
+            p(0) += (signum (xPlaneN - xPlane) * fx * ztickoffset);
           else
-            p(1) += (signum (yPlane-yPlaneN)*fy*ztickoffset);
+            p(1) += (signum (yPlane - yPlaneN) * fy * ztickoffset);
         }
       else
         {
           p = graphics_xform::xform_vector (xPlane, yPlaneN,
-                                            (zpTickN+zpTick)/2);
+                                            (zpTickN + zpTick)/2);
           if (xisinf (fx))
-            p(1) += (signum (yPlaneN-yPlane)*fy*ztickoffset);
+            p(1) += (signum (yPlaneN - yPlane) * fy * ztickoffset);
           else
-            p(0) += (signum (xPlane-xPlaneN)*fx*ztickoffset);
+            p(0) += (signum (xPlane - xPlaneN) * fx * ztickoffset);
         }
 
       p = xform.transform (p(0), p(1), p(2), false);
@@ -6178,13 +6231,13 @@
   if (updating_title_position)
     return;
 
-  graphics_object obj = gh_manager::get_object (get_title ());
-
-  if (! obj.valid_object ())
+  graphics_object go = gh_manager::get_object (get_title ());
+
+  if (! go.valid_object ())
     return;
 
   text::properties& title_props
-    = reinterpret_cast<text::properties&> (obj.get_properties ());
+    = reinterpret_cast<text::properties&> (go.get_properties ());
 
   unwind_protect frame;
   frame.protect_var (updating_title_position);
@@ -6198,9 +6251,9 @@
       Matrix bbox = get_extent (false);
 
       ColumnVector p =
-        graphics_xform::xform_vector (bbox(0)+bbox(2)/2,
-                                      bbox(1)-10,
-                                      (x_zlim(0)+x_zlim(1))/2);
+        graphics_xform::xform_vector (bbox(0) + bbox(2)/2,
+                                      bbox(1) - 10,
+                                      (x_zlim(0) + x_zlim(1))/2);
 
       if (x2Dtop)
         {
@@ -6239,15 +6292,15 @@
 normalized_aspectratios (Matrix& aspectratios, const Matrix& scalefactors,
                          double xlength, double ylength, double zlength)
 {
-  double xval = xlength/scalefactors(0);
-  double yval = ylength/scalefactors(1);
-  double zval = zlength/scalefactors(2);
+  double xval = xlength / scalefactors(0);
+  double yval = ylength / scalefactors(1);
+  double zval = zlength / scalefactors(2);
 
   double minval = xmin (xmin (xval, yval), zval);
 
-  aspectratios(0) = xval/minval;
-  aspectratios(1) = yval/minval;
-  aspectratios(2) = zval/minval;
+  aspectratios(0) = xval / minval;
+  aspectratios(1) = yval / minval;
+  aspectratios(2) = zval / minval;
 }
 
 static void
@@ -6265,11 +6318,11 @@
         {
           limits(0) = minval;
           limits(1) = maxval;
-          s = xmax(s, (maxval - minval) / (pbfactor * dafactor));
-        }
-    }
-  else
-    s = xmax(s, (limits(1) - limits(0)) / (pbfactor * dafactor));
+          s = xmax (s, (maxval - minval) / (pbfactor * dafactor));
+        }
+    }
+  else
+    s = xmax (s, (limits(1) - limits(0)) / (pbfactor * dafactor));
 }
 
 static std::set<double> updating_aspectratios;
@@ -6285,9 +6338,9 @@
   Matrix ylimits = get_ylim ().matrix_value ();
   Matrix zlimits = get_zlim ().matrix_value ();
 
-  double dx = (xlimits(1)-xlimits(0));
-  double dy = (ylimits(1)-ylimits(0));
-  double dz = (zlimits(1)-zlimits(0));
+  double dx = (xlimits(1) - xlimits(0));
+  double dy = (ylimits(1) - ylimits(0));
+  double dz = (zlimits(1) - zlimits(0));
 
   Matrix da = get_dataaspectratio ().matrix_value ();
   Matrix pba = get_plotboxaspectratio ().matrix_value ();
@@ -6340,15 +6393,14 @@
 
       if (modified_limits)
         {
-
           unwind_protect frame;
           frame.protect_var (updating_aspectratios);
 
           updating_aspectratios.insert (get___myhandle__ ().value ());
 
-          dx = pba(0) *da(0);
-          dy = pba(1) *da(1);
-          dz = pba(2) *da(2);
+          dx = pba(0) * da(0);
+          dy = pba(1) * da(1);
+          dz = pba(2) * da(2);
           if (xisinf (s))
             s = 1 / xmin (xmin (dx, dy), dz);
 
@@ -6410,13 +6462,13 @@
                         : get_outerposition ().matrix_value ();
   Matrix parent_size (parent_pix_size);
 
-  if (parent_size.numel () == 0)
-    {
-      graphics_object obj = gh_manager::get_object (get_parent ());
-
-      if (obj.valid_object ())
+  if (parent_size.is_empty ())
+    {
+      graphics_object go = gh_manager::get_object (get_parent ());
+
+      if (go.valid_object ())
         parent_size =
-          obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2);
+          go.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2);
       else
         parent_size = default_figure_position ();
     }
@@ -6436,10 +6488,8 @@
   graphics_xform xform = get_transform ();
 
   Matrix ext (1, 4, 0.0);
-  ext(0) = octave_Inf;
-  ext(1) = octave_Inf;
-  ext(2) = -octave_Inf;
-  ext(3) = -octave_Inf;
+  ext(0) = ext(1) = octave_Inf;
+  ext(2) = ext(3) = -octave_Inf;
   for (int i = 0; i <= 1; i++)
     for (int j = 0; j <= 1; j++)
       for (int k = 0; k <= 1; k++)
@@ -6457,19 +6507,19 @@
     {
       for (int i = 0; i < 4; i++)
         {
-          graphics_handle text_handle;
+          graphics_handle htext;
           if (i == 0)
-            text_handle = get_title ();
+            htext = get_title ();
           else if (i == 1)
-            text_handle = get_xlabel ();
+            htext = get_xlabel ();
           else if (i == 2)
-            text_handle = get_ylabel ();
+            htext = get_ylabel ();
           else if (i == 3)
-            text_handle = get_zlabel ();
+            htext = get_zlabel ();
 
           text::properties& text_props
             = reinterpret_cast<text::properties&>
-                (gh_manager::get_object (text_handle).get_properties ());
+                (gh_manager::get_object (htext).get_properties ());
 
           Matrix text_pos = text_props.get_data_position ();
           text_pos = xform.transform (text_pos(0), text_pos(1), text_pos(2));
@@ -6512,8 +6562,8 @@
         }
     }
 
-  ext(2) = ext(2)-ext(0);
-  ext(3) = ext(3)-ext(1);
+  ext(2) = ext(2) - ext(0);
+  ext(3) = ext(3) - ext(1);
 
   return ext;
 }
@@ -6525,7 +6575,7 @@
 
   if (val.is_cellstr ())
     {
-      // Always return a column vector for Matlab Compatibility
+      // Always return a column vector for Matlab compatibility
       if (val.columns () > 1)
         retval = val.reshape (dim_vector (val.numel (), 1));
     }
@@ -6570,11 +6620,11 @@
 }
 
 void
-axes::properties::set_xticklabel (const octave_value& v)
-{
-  if (!error_state)
-    {
-      if (xticklabel.set (convert_ticklabel_string (v), false))
+axes::properties::set_xticklabel (const octave_value& val)
+{
+  if (! error_state)
+    {
+      if (xticklabel.set (convert_ticklabel_string (val), false))
         {
           set_xticklabelmode ("manual");
           xticklabel.run_listeners (POSTSET);
@@ -6588,11 +6638,11 @@
 }
 
 void
-axes::properties::set_yticklabel (const octave_value& v)
-{
-  if (!error_state)
-    {
-      if (yticklabel.set (convert_ticklabel_string (v), false))
+axes::properties::set_yticklabel (const octave_value& val)
+{
+  if (! error_state)
+    {
+      if (yticklabel.set (convert_ticklabel_string (val), false))
         {
           set_yticklabelmode ("manual");
           yticklabel.run_listeners (POSTSET);
@@ -6606,11 +6656,11 @@
 }
 
 void
-axes::properties::set_zticklabel (const octave_value& v)
-{
-  if (!error_state)
-    {
-      if (zticklabel.set (convert_ticklabel_string (v), false))
+axes::properties::set_zticklabel (const octave_value& val)
+{
+  if (! error_state)
+    {
+      if (zticklabel.set (convert_ticklabel_string (val), false))
         {
           set_zticklabelmode ("manual");
           zticklabel.run_listeners (POSTSET);
@@ -6665,21 +6715,21 @@
 }
 
 void
-axes::properties::set_linestyleorder (const octave_value& v)
-{
-  if (!error_state)
-    {
-      linestyleorder.set (convert_linestyleorder_string (v), false);
-    }
-}
-
-void
-axes::properties::set_units (const octave_value& v)
+axes::properties::set_linestyleorder (const octave_value& val)
+{
+  if (! error_state)
+    {
+      linestyleorder.set (convert_linestyleorder_string (val), false);
+    }
+}
+
+void
+axes::properties::set_units (const octave_value& val)
 {
   if (! error_state)
     {
       caseless_str old_units = get_units ();
-      if (units.set (v, true))
+      if (units.set (val, true))
         {
           update_units (old_units);
           mark_modified ();
@@ -6690,9 +6740,9 @@
 void
 axes::properties::update_units (const caseless_str& old_units)
 {
-  graphics_object obj = gh_manager::get_object (get_parent ());
+  graphics_object parent_go = gh_manager::get_object (get_parent ());
   Matrix parent_bb
-    = obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2);
+    = parent_go.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2);
   caseless_str new_units = get_units ();
   position.set (octave_value (convert_position (get_position ().matrix_value (),
                                                 old_units, new_units,
@@ -6713,12 +6763,12 @@
 }
 
 void
-axes::properties::set_fontunits (const octave_value& v)
+axes::properties::set_fontunits (const octave_value& val)
 {
   if (! error_state)
     {
       caseless_str old_fontunits = get_fontunits ();
-      if (fontunits.set (v, true))
+      if (fontunits.set (val, true))
         {
           update_fontunits (old_fontunits);
           mark_modified ();
@@ -6731,23 +6781,23 @@
 {
   caseless_str new_units = get_fontunits ();
   double parent_height = get_boundingbox (true).elem (3);
-  double fsz = get_fontsize ();
-
-  fsz = convert_font_size (fsz, old_units, new_units, parent_height);
-
-  set_fontsize (octave_value (fsz));
+  double fontsz = get_fontsize ();
+
+  fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
+
+  set_fontsize (octave_value (fontsz));
 }
 
 double
 axes::properties::get_fontsize_points (double box_pix_height) const
 {
-  double fs = get_fontsize ();
+  double fontsz = get_fontsize ();
   double parent_height = box_pix_height;
 
   if (fontunits_is ("normalized") && parent_height <= 0)
     parent_height = get_boundingbox (true).elem (3);
 
-  return convert_font_size (fs, get_fontunits (), "points", parent_height);
+  return convert_font_size (fontsz, get_fontunits (), "points", parent_height);
 }
 
 ColumnVector
@@ -6763,8 +6813,7 @@
 }
 
 ColumnVector
-graphics_xform::transform (double x, double y, double z,
-                           bool use_scale) const
+graphics_xform::transform (double x, double y, double z, bool use_scale) const
 {
   if (use_scale)
     {
@@ -6793,16 +6842,16 @@
 }
 
 octave_value
-axes::get_default (const caseless_str& name) const
-{
-  octave_value retval = default_properties.lookup (name);
+axes::get_default (const caseless_str& pname) const
+{
+  octave_value retval = default_properties.lookup (pname);
 
   if (retval.is_undefined ())
     {
-      graphics_handle parent = get_parent ();
-      graphics_object parent_obj = gh_manager::get_object (parent);
-
-      retval = parent_obj.get_default (name);
+      graphics_handle parent_h = get_parent ();
+      graphics_object parent_go = gh_manager::get_object (parent_h);
+
+      retval = parent_go.get_default (pname);
     }
 
   return retval;
@@ -6863,8 +6912,8 @@
     }
 }
 
-// magform(x) Returns (a, b), where x = a * 10^b, abs (a) >= 1., and b is
-// integer.
+// magform(x) Returns (a, b),
+// where x = a * 10^b, abs (a) >= 1., and b is integer.
 
 static void
 magform (double x, double& a, int& b)
@@ -6890,15 +6939,15 @@
 {
   int ticint = 5;
 
-  // Reference: Lewart, C. R., "Algorithms SCALE1, SCALE2, and
-  // SCALE3 for Determination of Scales on Computer Generated
-  // Plots", Communications of the ACM, 10 (1973), 639-640.
+  // Reference: Lewart, C. R., "Algorithms SCALE1, SCALE2, and SCALE3 for
+  // Determination of Scales on Computer Generated Plots", Communications of
+  // the ACM, 10 (1973), 639-640.
   // Also cited as ACM Algorithm 463.
 
   double a;
   int b, x;
 
-  magform ((hi-lo)/ticint, a, b);
+  magform ((hi - lo) / ticint, a, b);
 
   static const double sqrt_2 = sqrt (2.0);
   static const double sqrt_10 = sqrt (10.0);
@@ -6914,12 +6963,10 @@
     x = 10;
 
   return x * std::pow (10., b);
-
-}
-
-// Attempt to make "nice" limits from the actual max and min of the
-// data.  For log plots, we will also use the smallest strictly positive
-// value.
+}
+
+// Attempt to make "nice" limits from the actual max and min of the data.
+// For log plots, we will also use the smallest strictly positive value.
 
 Matrix
 axes::properties::get_axis_limits (double xmin, double xmax,
@@ -6942,15 +6989,15 @@
         {
           if (xisinf (min_pos) && xisinf (max_neg))
             {
-              // TODO -- max_neg is needed for "loglog ([0 -Inf])"
-              //         This is the only place where max_neg is needed.
-              //         Is there another way?
+              // FIXME: max_neg is needed for "loglog ([0 -Inf])"
+              //        This is the *only* place where max_neg is needed.
+              //        Is there another way?
               retval = default_lim ();
               retval(0) = pow (10., retval(0));
               retval(1) = pow (10., retval(1));
               return retval;
             }
-          if ((min_val <= 0 && max_val > 0))
+          if (min_val <= 0 && max_val > 0)
             {
               warning ("axis: omitting non-positive data in log plot");
               min_val = min_pos;
@@ -6999,7 +7046,7 @@
               max_val += 0.1 * std::abs (max_val);
             }
 
-          double tick_sep = calc_tick_sep (min_val , max_val);
+          double tick_sep = calc_tick_sep (min_val, max_val);
           double min_tick = gnulib::floor (min_val / tick_sep);
           double max_tick = std::ceil (max_val / tick_sep);
           // Prevent round-off from cropping ticks
@@ -7027,8 +7074,8 @@
   if (lims.get ().is_empty ())
     return;
 
-  double lo = (lims.get ().matrix_value ()) (0);
-  double hi = (lims.get ().matrix_value ()) (1);
+  double lo = (lims.get ().matrix_value ())(0);
+  double hi = (lims.get ().matrix_value ())(1);
   bool is_negative = lo < 0 && hi < 0;
   double tmp;
   // FIXME: should this be checked for somewhere else? (i.e. set{x,y,z}lim)
@@ -7060,22 +7107,22 @@
         tick_sep = 0;
     }
   else
-    tick_sep = calc_tick_sep (lo , hi);
+    tick_sep = calc_tick_sep (lo, hi);
 
   int i1 = static_cast<int> (gnulib::floor (lo / tick_sep));
   int i2 = static_cast<int> (std::ceil (hi / tick_sep));
 
   if (limmode_is_auto)
     {
-      // adjust limits to include min and max tics
+      // Adjust limits to include min and max tics
       Matrix tmp_lims (1,2);
       tmp_lims(0) = std::min (tick_sep * i1, lo);
       tmp_lims(1) = std::max (tick_sep * i2, hi);
 
       if (is_logscale)
         {
-          tmp_lims(0) = std::pow (10.,tmp_lims(0));
-          tmp_lims(1) = std::pow (10.,tmp_lims(1));
+          tmp_lims(0) = std::pow (10., tmp_lims(0));
+          tmp_lims(1) = std::pow (10., tmp_lims(1));
           if (tmp_lims(0) <= 0)
             tmp_lims(0) = std::pow (10., lo);
           if (is_negative)
@@ -7087,20 +7134,28 @@
         }
       lims = tmp_lims;
     }
+  else
+    {
+      // adjust min and max tics to be within limits
+      if (i1*tick_sep < lo)
+        i1++;
+      if (i2*tick_sep > hi)
+        i2--;
+    }
 
   Matrix tmp_ticks (1, i2-i1+1);
   for (int i = 0; i <= i2-i1; i++)
     {
-      tmp_ticks (i) = tick_sep * (i+i1);
+      tmp_ticks(i) = tick_sep * (i+i1);
       if (is_logscale)
-        tmp_ticks (i) = std::pow (10., tmp_ticks (i));
+        tmp_ticks(i) = std::pow (10., tmp_ticks(i));
     }
   if (is_logscale && is_negative)
     {
       Matrix rev_ticks (1, i2-i1+1);
       rev_ticks = -tmp_ticks;
       for (int i = 0; i <= i2-i1; i++)
-        tmp_ticks (i) = rev_ticks (i2-i1-i);
+        tmp_ticks(i) = rev_ticks(i2-i1-i);
     }
 
   ticks = tmp_ticks;
@@ -7110,15 +7165,28 @@
 
   for (int i = 0; i < tmp_ticks.numel ()-1; i++)
     {
-      double d = (tmp_ticks (i+1) - tmp_ticks (i)) / (n+1);
+      double d = (tmp_ticks(i+1) - tmp_ticks(i)) / (n + 1);
       for (int j = 0; j < n; j++)
         {
-          tmp_mticks (n*i+j) = tmp_ticks (i) + d * (j+1);
+          tmp_mticks(n*i+j) = tmp_ticks(i) + d * (j+1);
         }
     }
   mticks = tmp_mticks;
 }
 
+/*
+%!test  # Bug #45356
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot (1:10);
+%!   xlim ([4.75, 8.5]);
+%!   tics = get (gca, "xtick");
+%!   assert (tics, [5 6 7 8]);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+*/
+
 void
 axes::properties::calc_ticklabels (const array_property& ticks,
                                    any_property& labels, bool logscale)
@@ -7131,8 +7199,8 @@
     {
       double significand;
       double exponent;
-      double exp_max = 0.;
-      double exp_min = 0.;
+      double exp_max = 0.0;
+      double exp_min = 0.0;
 
       for (int i = 0; i < values.numel (); i++)
         {
@@ -7142,14 +7210,14 @@
 
       for (int i = 0; i < values.numel (); i++)
         {
-          if (values(i) < 0.)
+          if (values(i) < 0.0)
             exponent = gnulib::floor (std::log10 (-values(i)));
           else
             exponent = gnulib::floor (std::log10 (values(i)));
           significand = values(i) * std::pow (10., -exponent);
           os.str (std::string ());
           os << significand;
-          if (exponent < 0.)
+          if (exponent < 0.0)
             {
               os << "e-";
               exponent = -exponent;
@@ -7186,7 +7254,7 @@
 
   Matrix ext (1, 2, 0.0);
   double wmax, hmax;
-  wmax = hmax = 0.;
+  wmax = hmax = 0.0;
   int n = std::min (ticklabels.numel (), ticks.numel ());
   for (int i = 0; i < n; i++)
     {
@@ -7226,11 +7294,11 @@
     case 'x':
       for (octave_idx_type i = 0; i < n; i++)
         {
-          graphics_object obj = gh_manager::get_object (kids(i));
-
-          if (obj.is_xliminclude ())
-            {
-              octave_value lim = obj.get_xlim ();
+          graphics_object go = gh_manager::get_object (kids(i));
+
+          if (go.is_xliminclude ())
+            {
+              octave_value lim = go.get_xlim ();
 
               check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
             }
@@ -7240,11 +7308,11 @@
     case 'y':
       for (octave_idx_type i = 0; i < n; i++)
         {
-          graphics_object obj = gh_manager::get_object (kids(i));
-
-          if (obj.is_yliminclude ())
-            {
-              octave_value lim = obj.get_ylim ();
+          graphics_object go = gh_manager::get_object (kids(i));
+
+          if (go.is_yliminclude ())
+            {
+              octave_value lim = go.get_ylim ();
 
               check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
             }
@@ -7254,11 +7322,11 @@
     case 'z':
       for (octave_idx_type i = 0; i < n; i++)
         {
-          graphics_object obj = gh_manager::get_object (kids(i));
-
-          if (obj.is_zliminclude ())
-            {
-              octave_value lim = obj.get_zlim ();
+          graphics_object go = gh_manager::get_object (kids(i));
+
+          if (go.is_zliminclude ())
+            {
+              octave_value lim = go.get_zlim ();
 
               check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
             }
@@ -7268,11 +7336,11 @@
     case 'c':
       for (octave_idx_type i = 0; i < n; i++)
         {
-          graphics_object obj = gh_manager::get_object (kids(i));
-
-          if (obj.is_climinclude ())
-            {
-              octave_value lim = obj.get_clim ();
+          graphics_object go = gh_manager::get_object (kids(i));
+
+          if (go.is_climinclude ())
+            {
+              octave_value lim = go.get_clim ();
 
               check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
             }
@@ -7282,11 +7350,11 @@
     case 'a':
       for (octave_idx_type i = 0; i < n; i++)
         {
-          graphics_object obj = gh_manager::get_object (kids(i));
-
-          if (obj.is_aliminclude ())
-            {
-              octave_value lim = obj.get_alim ();
+          graphics_object go = gh_manager::get_object (kids(i));
+
+          if (go.is_aliminclude ())
+            {
+              octave_value lim = go.get_alim ();
 
               check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
             }
@@ -7501,7 +7569,6 @@
     }
 
   xproperties.update_transform ();
-
 }
 
 void
@@ -7944,11 +8011,10 @@
     new_view(0) += 360.0;
 
   // Snapping
-  double snapMargin = 1.0;
+  double snapmargin = 1.0;
   for (int a = -90; a <= 90; a += 90)
     {
-      if ((a - snapMargin) < new_view(1)
-          && new_view(1) < (a + snapMargin))
+      if ((a - snapmargin) < new_view(1) && new_view(1) < (a + snapmargin))
         {
           new_view(1) = a;
           break;
@@ -7956,8 +8022,7 @@
     }
 
   for (int a = -180; a <= 180; a += 180)
-    if ((a - snapMargin) < new_view(0)
-        && new_view(0) < (a + snapMargin))
+    if ((a - snapmargin) < new_view(0) && new_view(0) < (a + snapmargin))
       {
         if (a == 180)
           new_view(0) = -180;
@@ -8128,12 +8193,12 @@
 }
 
 void
-text::properties::set_fontunits (const octave_value& v)
+text::properties::set_fontunits (const octave_value& val)
 {
   if (! error_state)
     {
       caseless_str old_fontunits = get_fontunits ();
-      if (fontunits.set (v, true))
+      if (fontunits.set (val, true))
         {
           update_fontunits (old_fontunits);
           mark_modified ();
@@ -8146,7 +8211,7 @@
 {
   caseless_str new_units = get_fontunits ();
   double parent_height = 0;
-  double fsz = get_fontsize ();
+  double fontsz = get_fontsize ();
 
   if (new_units == "normalized")
     {
@@ -8156,9 +8221,9 @@
       parent_height = ax.get_properties ().get_boundingbox (true).elem (3);
     }
 
-  fsz = convert_font_size (fsz, old_units, new_units, parent_height);
-
-  set_fontsize (octave_value (fsz));
+  fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
+
+  set_fontsize (octave_value (fontsz));
 }
 
 void
@@ -8243,9 +8308,8 @@
 
   pos = convert_text_position (pos, *this, cached_units, get_units ());
 
-  // FIXME: if the current axes view is 2D, then one should
-  // probably drop the z-component of "pos" and leave "zliminclude"
-  // to "off".
+  // FIXME: if the current axes view is 2D, then one should probably drop
+  // the z-component of "pos" and leave "zliminclude" to "off".
 
   bool autopos = positionmode_is ("auto");
 
@@ -8268,7 +8332,7 @@
 double
 text::properties::get_fontsize_points (double box_pix_height) const
 {
-  double fs = get_fontsize ();
+  double fontsz = get_fontsize ();
   double parent_height = box_pix_height;
 
   if (fontunits_is ("normalized") && parent_height <= 0)
@@ -8279,7 +8343,7 @@
       parent_height = ax.get_properties ().get_boundingbox (true).elem (3);
     }
 
-  return convert_font_size (fs, get_fontunits (), "points", parent_height);
+  return convert_font_size (fontsz, get_fontunits (), "points", parent_height);
 }
 
 // ---------------------------------------------------------------------
@@ -8287,8 +8351,7 @@
 octave_value
 image::properties::get_color_data (void) const
 {
-  return convert_cdata (*this, get_cdata (),
-                        cdatamapping_is ("scaled"), 3);
+  return convert_cdata (*this, get_cdata (), cdatamapping_is ("scaled"), 3);
 }
 
 // ---------------------------------------------------------------------
@@ -8320,7 +8383,7 @@
   if (xd.dims () != yd.dims ()
       || (xd.dims () != zd.dims () && ! zd.is_empty ()))
     {
-      bad_data_msg = "x/y/zdata should have the same dimensions";
+      bad_data_msg = "x/y/zdata must have the same dimensions";
       return;
     }
 
@@ -8465,7 +8528,6 @@
       has_zd = true;
     }
 
-
   for (octave_idx_type jj = 0; jj < nfaces; jj++)
     {
       for (octave_idx_type ii = 0; ii < idx.rows (); ii++)
@@ -8608,30 +8670,30 @@
 void
 hggroup::properties::update_limits (void) const
 {
-  graphics_object obj = gh_manager::get_object (__myhandle__);
-
-  if (obj)
-    {
-      obj.update_axis_limits ("xlim");
-      obj.update_axis_limits ("ylim");
-      obj.update_axis_limits ("zlim");
-      obj.update_axis_limits ("clim");
-      obj.update_axis_limits ("alim");
+  graphics_object go = gh_manager::get_object (__myhandle__);
+
+  if (go)
+    {
+      go.update_axis_limits ("xlim");
+      go.update_axis_limits ("ylim");
+      go.update_axis_limits ("zlim");
+      go.update_axis_limits ("clim");
+      go.update_axis_limits ("alim");
     }
 }
 
 void
 hggroup::properties::update_limits (const graphics_handle& h) const
 {
-  graphics_object obj = gh_manager::get_object (__myhandle__);
-
-  if (obj)
-    {
-      obj.update_axis_limits ("xlim", h);
-      obj.update_axis_limits ("ylim", h);
-      obj.update_axis_limits ("zlim", h);
-      obj.update_axis_limits ("clim", h);
-      obj.update_axis_limits ("alim", h);
+  graphics_object go = gh_manager::get_object (__myhandle__);
+
+  if (go)
+    {
+      go.update_axis_limits ("xlim", h);
+      go.update_axis_limits ("ylim", h);
+      go.update_axis_limits ("zlim", h);
+      go.update_axis_limits ("clim", h);
+      go.update_axis_limits ("alim", h);
     }
 }
 
@@ -8699,7 +8761,7 @@
     }
   else
     {
-      limits.resize (4,1);
+      limits.resize (4, 1);
       limits(0) = min_val;
       limits(1) = max_val;
       limits(2) = min_pos;
@@ -8881,7 +8943,7 @@
 %! unwind_protect_cleanup
 %!   close (hf);
 %! end_unwind_protect;
- */
+*/
 
 // ---------------------------------------------------------------------
 
@@ -8890,10 +8952,9 @@
 {
   Matrix m = extent.get ().matrix_value ();
 
-  graphics_object parent_obj =
-    gh_manager::get_object (get_parent ());
-  Matrix parent_bbox = parent_obj.get_properties ().get_boundingbox (true),
-         parent_size = parent_bbox.extract_n (0, 2, 1, 2);
+  graphics_object parent_go = gh_manager::get_object (get_parent ());
+  Matrix parent_bbox = parent_go.get_properties ().get_boundingbox (true);
+  Matrix parent_size = parent_bbox.extract_n (0, 2, 1, 2);
 
   return convert_position (m, "pixels", get_units (), parent_size);
 }
@@ -8920,7 +8981,7 @@
   box = text_renderer.get_extent (elt, 0);
   delete elt;
 
-  Matrix ext (1, 4, 0.0);
+  Matrix ext (1, 4);
 
   // FIXME: also handle left and bottom components
 
@@ -8938,9 +8999,9 @@
 {
   Matrix pos = get_position ().matrix_value ();
 
-  graphics_object parent_obj = gh_manager::get_object (get_parent ());
-  Matrix parent_bbox = parent_obj.get_properties ().get_boundingbox (true),
-         parent_size = parent_bbox.extract_n (0, 2, 1, 2);
+  graphics_object parent_go = gh_manager::get_object (get_parent ());
+  Matrix parent_bbox = parent_go.get_properties ().get_boundingbox (true);
+  Matrix parent_size = parent_bbox.extract_n (0, 2, 1, 2);
 
   pos = convert_position (pos, cached_units, get_units (), parent_size);
   set_position (pos);
@@ -8964,13 +9025,13 @@
   Matrix pos = get_position ().matrix_value ();
   Matrix parent_size (parent_pix_size);
 
-  if (parent_size.numel () == 0)
-    {
-      graphics_object obj = gh_manager::get_object (get_parent ());
-
-      if (obj.valid_object ())
+  if (parent_size.is_empty ())
+    {
+      graphics_object go = gh_manager::get_object (get_parent ());
+
+      if (go.valid_object ())
         parent_size =
-          obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2);
+          go.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2);
       else
         parent_size = default_figure_position ();
     }
@@ -8985,12 +9046,12 @@
 }
 
 void
-uicontrol::properties::set_fontunits (const octave_value& v)
+uicontrol::properties::set_fontunits (const octave_value& val)
 {
   if (! error_state)
     {
       caseless_str old_fontunits = get_fontunits ();
-      if (fontunits.set (v, true))
+      if (fontunits.set (val, true))
         {
           update_fontunits (old_fontunits);
           mark_modified ();
@@ -9003,23 +9064,23 @@
 {
   caseless_str new_units = get_fontunits ();
   double parent_height = get_boundingbox (false).elem (3);
-  double fsz = get_fontsize ();
-
-  fsz = convert_font_size (fsz, old_units, new_units, parent_height);
-
-  fontsize.set (octave_value (fsz), true);
+  double fontsz = get_fontsize ();
+
+  fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
+
+  fontsize.set (octave_value (fontsz), true);
 }
 
 double
 uicontrol::properties::get_fontsize_points (double box_pix_height) const
 {
-  double fs = get_fontsize ();
+  double fontsz = get_fontsize ();
   double parent_height = box_pix_height;
 
   if (fontunits_is ("normalized") && parent_height <= 0)
     parent_height = get_boundingbox (false).elem (3);
 
-  return convert_font_size (fs, get_fontunits (), "points", parent_height);
+  return convert_font_size (fontsz, get_fontunits (), "points", parent_height);
 }
 
 // ---------------------------------------------------------------------
@@ -9031,12 +9092,12 @@
   Matrix pos = get_position ().matrix_value ();
   Matrix parent_size (parent_pix_size);
 
-  if (parent_size.numel () == 0)
-    {
-      graphics_object obj = gh_manager::get_object (get_parent ());
+  if (parent_size.is_empty ())
+    {
+      graphics_object go = gh_manager::get_object (get_parent ());
 
       parent_size =
-        obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2);
+        go.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2);
     }
 
   pos = convert_position (pos, get_units (), "pixels", parent_size);
@@ -9067,26 +9128,26 @@
 
       if (! get_title ().empty ())
         {
-          double fs = get_fontsize ();
+          double fontsz = get_fontsize ();
 
           if (! fontunits_is ("pixels"))
             {
               double res = xget (0, "screenpixelsperinch").double_value ();
 
               if (fontunits_is ("points"))
-                fs *= (res / 72.0);
+                fontsz *= (res / 72.0);
               else if (fontunits_is ("inches"))
-                fs *= res;
+                fontsz *= res;
               else if (fontunits_is ("centimeters"))
-                fs *= (res / 2.54);
+                fontsz *= (res / 2.54);
               else if (fontunits_is ("normalized"))
-                fs *= outer_height;
+                fontsz *= outer_height;
             }
 
           if (titleposition_is ("lefttop") || titleposition_is ("centertop")
               || titleposition_is ("righttop"))
-            pos(1) += (fs / 2);
-          pos(3) -= (fs / 2);
+            pos(1) += (fontsz / 2);
+          pos(3) -= (fontsz / 2);
         }
     }
 
@@ -9094,12 +9155,12 @@
 }
 
 void
-uipanel::properties::set_units (const octave_value& v)
+uipanel::properties::set_units (const octave_value& val)
 {
   if (! error_state)
     {
       caseless_str old_units = get_units ();
-      if (units.set (v, true))
+      if (units.set (val, true))
         {
           update_units (old_units);
           mark_modified ();
@@ -9112,21 +9173,21 @@
 {
   Matrix pos = get_position ().matrix_value ();
 
-  graphics_object parent_obj = gh_manager::get_object (get_parent ());
-  Matrix parent_bbox = parent_obj.get_properties ().get_boundingbox (true),
-         parent_size = parent_bbox.extract_n (0, 2, 1, 2);
+  graphics_object parent_go = gh_manager::get_object (get_parent ());
+  Matrix parent_bbox = parent_go.get_properties ().get_boundingbox (true);
+  Matrix parent_size = parent_bbox.extract_n (0, 2, 1, 2);
 
   pos = convert_position (pos, old_units, get_units (), parent_size);
   set_position (pos);
 }
 
 void
-uipanel::properties::set_fontunits (const octave_value& v)
+uipanel::properties::set_fontunits (const octave_value& val)
 {
   if (! error_state)
     {
       caseless_str old_fontunits = get_fontunits ();
-      if (fontunits.set (v, true))
+      if (fontunits.set (val, true))
         {
           update_fontunits (old_fontunits);
           mark_modified ();
@@ -9139,38 +9200,38 @@
 {
   caseless_str new_units = get_fontunits ();
   double parent_height = get_boundingbox (false).elem (3);
-  double fsz = get_fontsize ();
-
-  fsz = convert_font_size (fsz, old_units, new_units, parent_height);
-
-  set_fontsize (octave_value (fsz));
+  double fontsz = get_fontsize ();
+
+  fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
+
+  set_fontsize (octave_value (fontsz));
 }
 
 double
 uipanel::properties::get_fontsize_points (double box_pix_height) const
 {
-  double fs = get_fontsize ();
+  double fontsz = get_fontsize ();
   double parent_height = box_pix_height;
 
   if (fontunits_is ("normalized") && parent_height <= 0)
     parent_height = get_boundingbox (false).elem (3);
 
-  return convert_font_size (fs, get_fontunits (), "points", parent_height);
+  return convert_font_size (fontsz, get_fontunits (), "points", parent_height);
 }
 
 // ---------------------------------------------------------------------
 
 octave_value
-uitoolbar::get_default (const caseless_str& name) const
-{
-  octave_value retval = default_properties.lookup (name);
+uitoolbar::get_default (const caseless_str& pname) const
+{
+  octave_value retval = default_properties.lookup (pname);
 
   if (retval.is_undefined ())
     {
-      graphics_handle parent = get_parent ();
-      graphics_object parent_obj = gh_manager::get_object (parent);
-
-      retval = parent_obj.get_default (name);
+      graphics_handle parent_h = get_parent ();
+      graphics_object parent_go = gh_manager::get_object (parent_h);
+
+      retval = parent_go.get_default (pname);
     }
 
   return retval;
@@ -9182,27 +9243,26 @@
   // empty list of local defaults
   default_properties = property_list ();
 
-  xreset_default_properties (get_handle (),
-                             xproperties.factory_defaults ());
+  xreset_default_properties (get_handle (), xproperties.factory_defaults ());
 }
 
 // ---------------------------------------------------------------------
 
 octave_value
-base_graphics_object::get_default (const caseless_str& name) const
-{
-  graphics_handle parent = get_parent ();
-  graphics_object parent_obj = gh_manager::get_object (parent);
-
-  return parent_obj.get_default (type () + name);
+base_graphics_object::get_default (const caseless_str& pname) const
+{
+  graphics_handle parent_h = get_parent ();
+  graphics_object parent_go = gh_manager::get_object (parent_h);
+
+  return parent_go.get_default (type () + pname);
 }
 
 octave_value
 base_graphics_object::get_factory_default (const caseless_str& name) const
 {
-  graphics_object parent_obj = gh_manager::get_object (0);
-
-  return parent_obj.get_factory_default (type () + name);
+  graphics_object parent_go = gh_manager::get_object (0);
+
+  return parent_go.get_factory_default (type () + name);
 }
 
 // We use a random value for the handle to avoid issues with plots and
@@ -9237,19 +9297,19 @@
 {
   graphics_handle h = get_handle (integer_figure_handle);
 
-  base_graphics_object *go = 0;
-
-  go = make_graphics_object_from_type (go_name, h, p);
-
-  if (go)
-    {
-      graphics_object obj (go);
-
-      handle_map[h] = obj;
+  base_graphics_object *bgo = 0;
+
+  bgo = make_graphics_object_from_type (go_name, h, p);
+
+  if (bgo)
+    {
+      graphics_object go (bgo);
+
+      handle_map[h] = go;
 
       // Overriding defaults will work now because the handle is valid
       // and we can find parent objects (not just handles).
-      obj.override_defaults ();
+      go.override_defaults ();
 
       if (go_name == "axes")
         {
@@ -9258,7 +9318,7 @@
           // constructed.
 
           axes::properties& props =
-            dynamic_cast<axes::properties&> (obj.get_properties ());
+            dynamic_cast<axes::properties&> (go.get_properties ());
 
           graphics_object tgo;
 
@@ -9276,11 +9336,11 @@
         }
 
       if (do_createfcn)
-        go->get_properties ().execute_createfcn ();
+        bgo->get_properties ().execute_createfcn ();
 
       // Notify graphics toolkit.
       if (do_notify_toolkit)
-        obj.initialize ();
+        go.initialize ();
     }
   else
     error ("gh_manager::do_make_graphics_handle: invalid object type '%s'",
@@ -9294,16 +9354,16 @@
 {
   graphics_handle h = val;
 
-  base_graphics_object* go = new figure (h, 0);
-  graphics_object obj (go);
-
-  handle_map[h] = obj;
+  base_graphics_object* bgo = new figure (h, 0);
+  graphics_object go (bgo);
+
+  handle_map[h] = go;
 
   // Notify graphics toolkit.
   if (do_notify_toolkit)
-    obj.initialize ();
-
-  obj.override_defaults ();
+    go.initialize ();
+
+  go.override_defaults ();
 
   return h;
 }
@@ -9496,8 +9556,7 @@
   callback_objects.pop_front ();
 
   xset_gcbo (callback_objects.empty ()
-             ? graphics_handle ()
-             : callback_objects.front ().get_handle ());
+             ? graphics_handle () : callback_objects.front ().get_handle ());
 }
 
 void
@@ -9566,7 +9625,7 @@
           fcn = c(0).function_value ();
           if (! error_state)
             {
-              for (int i = 1; i < c.length () ; i++)
+              for (int i = 1; i < c.numel () ; i++)
                 args(1+i) = c(i);
             }
         }
@@ -9813,7 +9872,7 @@
           boolNDArray result (handles.dims ());
 
           for (octave_idx_type i = 0; i < handles.numel (); i++)
-            result.xelem (i) = is_handle_visible (handles (i));
+            result.xelem (i) = is_handle_visible (handles(i));
 
           retval = result;
         }
@@ -9865,7 +9924,7 @@
       if (! error_state)
         {
           // loop over graphics objects
-          for (octave_idx_type n = 0; n < hcv.length (); n++)
+          for (octave_idx_type n = 0; n < hcv.numel (); n++)
             gh_manager::get_object (hcv(n)).reset_default_properties ();
 
           if (! error_state)
@@ -10080,44 +10139,44 @@
           bool request_drawnow = false;
 
           // loop over graphics objects
-          for (octave_idx_type n = 0; n < hcv.length (); n++)
-            {
-              graphics_object obj = gh_manager::get_object (hcv(n));
-
-              if (obj)
+          for (octave_idx_type n = 0; n < hcv.numel (); n++)
+            {
+              graphics_object go = gh_manager::get_object (hcv(n));
+
+              if (go)
                 {
-                  if (nargin == 3 && args(1).is_cellstr ()
-                      && args(2).is_cell ())
+                  if (nargin == 3
+                      && args(1).is_cellstr () && args(2).is_cell ())
                     {
                       if (args(2).cell_value ().rows () == 1)
                         {
-                          obj.set (args(1).cellstr_value (),
-                                   args(2).cell_value (), 0);
+                          go.set (args(1).cellstr_value (),
+                                  args(2).cell_value (), 0);
                         }
-                      else if (hcv.length () == args(2).cell_value ().rows ())
+                      else if (hcv.numel () == args(2).cell_value ().rows ())
                         {
-                          obj.set (args(1).cellstr_value (),
-                                   args(2).cell_value (), n);
+                          go.set (args(1).cellstr_value (),
+                                  args(2).cell_value (), n);
                         }
                       else
                         {
                           error ("set: number of graphics handles must match number of value rows (%d != %d)",
-                                 hcv.length (), args(2).cell_value ().rows ());
+                                 hcv.numel (), args(2).cell_value ().rows ());
                           break;
 
                         }
                     }
                   else if (nargin == 2 && args(1).is_map ())
                     {
-                      obj.set (args(1).map_value ());
+                      go.set (args(1).map_value ());
                     }
                   else if (nargin == 2 && args(1).is_string ())
                     {
                       std::string property = args(1).string_value ();
 
-                      octave_map pmap = obj.values_as_struct ();
-
-                      if (obj.has_readonly_property (property))
+                      octave_map pmap = go.values_as_struct ();
+
+                      if (go.has_readonly_property (property))
                         if (nargout != 0)
                           retval = Matrix ();
                         else
@@ -10129,7 +10188,7 @@
                             retval = pmap.getfield (property)(0);
                           else
                             {
-                              std::string s = obj.value_as_string (property);
+                              std::string s = go.value_as_string (property);
                               if (! error_state)
                                 octave_stdout << s;
                             }
@@ -10143,17 +10202,17 @@
                   else if (nargin == 1)
                     {
                       if (nargout != 0)
-                        retval = obj.values_as_struct ();
+                        retval = go.values_as_struct ();
                       else
                         {
-                          std::string s = obj.values_as_string ();
+                          std::string s = go.values_as_string ();
                           if (! error_state)
                             octave_stdout << s;
                         }
                     }
                   else
                     {
-                      obj.set (args.splice (0, 1));
+                      go.set (args.splice (0, 1));
                       request_drawnow = true;
                     }
                 }
@@ -10186,10 +10245,10 @@
 {
   std::string retval;
 
-  graphics_object obj = gh_manager::get_object (val);
-
-  if (obj)
-    retval = obj.type ();
+  graphics_object go = gh_manager::get_object (val);
+
+  if (go)
+    retval = go.type ();
   else
     error ("get: invalid handle (= %g)", val);
 
@@ -10232,22 +10291,22 @@
 
       if (! error_state)
         {
-          octave_idx_type len = hcv.length ();
+          octave_idx_type len = hcv.numel ();
 
           if (nargin == 1 && len > 1)
             {
-              std::string t0 = get_graphics_object_type (hcv(0));
+              std::string typ0 = get_graphics_object_type (hcv(0));
 
               if (! error_state)
                 {
                   for (octave_idx_type n = 1; n < len; n++)
                     {
-                      std::string t = get_graphics_object_type (hcv(n));
+                      std::string typ = get_graphics_object_type (hcv(n));
 
                       if (error_state)
                         break;
 
-                      if (t != t0)
+                      if (typ != typ0)
                         {
                           error ("get: vector of handles must all have same type");
                           break;
@@ -10273,9 +10332,9 @@
 
                       for (octave_idx_type n = 0; ! error_state && n < len; n++)
                         {
-                          graphics_object obj = gh_manager::get_object (hcv(n));
-
-                          if (obj)
+                          graphics_object go = gh_manager::get_object (hcv(n));
+
+                          if (go)
                             {
                               for (octave_idx_type m = 0;
                                    ! error_state && m < plen;
@@ -10283,7 +10342,7 @@
                                 {
                                   caseless_str property = plist(m);
 
-                                  vals(n, m) = obj.get (property);
+                                  vals(n, m) = go.get (property);
                                 }
                             }
                           else
@@ -10314,14 +10373,14 @@
                     {
                       for (octave_idx_type n = 0; ! error_state && n < len; n++)
                         {
-                          graphics_object obj = gh_manager::get_object (hcv(n));
-
-                          if (obj)
+                          graphics_object go = gh_manager::get_object (hcv(n));
+
+                          if (go)
                             {
                               if (nargin == 1)
-                                vals(n) = obj.get ();
+                                vals(n) = go.get ();
                               else
-                                vals(n) = obj.get (property);
+                                vals(n) = go.get (property);
                             }
                           else
                             {
@@ -10396,16 +10455,16 @@
 
       if (! error_state)
         {
-          octave_idx_type len = hcv.length ();
+          octave_idx_type len = hcv.numel ();
 
           vals.resize (dim_vector (len, 1));
 
           for (octave_idx_type n = 0; n < len; n++)
             {
-              graphics_object obj = gh_manager::get_object (hcv(n));
-
-              if (obj)
-                vals(n) = obj.get (true);
+              graphics_object go = gh_manager::get_object (hcv(n));
+
+              if (go)
+                vals(n) = go.get (true);
               else
                 {
                   error ("get: invalid handle (= %g)", hcv(n));
@@ -10446,8 +10505,7 @@
   caseless_str p ("parent");
 
   for (int i = 0; i < xargs.length (); i++)
-    if (xargs(i).is_string ()
-        && p.compare (xargs(i).string_value ()))
+    if (xargs(i).is_string () && p.compare (xargs(i).string_value ()))
       {
         if (i < (xargs.length () - 1))
           {
@@ -10538,12 +10596,12 @@
 
               if (xisnan (val))
                 {
-                  caseless_str p ("integerhandle");
+                  caseless_str pname ("integerhandle");
 
                   for (int i = 0; i < xargs.length (); i++)
                     {
                       if (xargs(i).is_string ()
-                          && p.compare (xargs(i).string_value ()))
+                          && pname.compare (xargs(i).string_value ()))
                         {
                           if (i < (xargs.length () - 1))
                             {
@@ -10566,10 +10624,9 @@
 
                   if (! int_fig_handle)
                     {
-                      // We need to intiailize the integerhandle
-                      // property without calling the set_integerhandle
-                      // method, because doing that will generate a new
-                      // handle value...
+                      // We need to initialize the integerhandle property
+                      // without calling the set_integerhandle method,
+                      // because doing that will generate a new handle value...
 
                       graphics_object go = gh_manager::get_object (h);
                       go.get_properties ().init_integerhandle ("off");
@@ -10618,7 +10675,6 @@
 int
 calc_dimensions (const graphics_object& go)
 {
-
   int nd = 2;
 
   if (go.isa ("surface"))
@@ -10630,13 +10686,13 @@
     {
       Matrix kids = go.get_properties ().get_children ();
 
-      for (octave_idx_type i = 0; i < kids.length (); i++)
-        {
-          graphics_handle hnd = gh_manager::lookup (kids(i));
-
-          if (hnd.ok ())
-            {
-              const graphics_object& kid = gh_manager::get_object (hnd);
+      for (octave_idx_type i = 0; i < kids.numel (); i++)
+        {
+          graphics_handle hkid = gh_manager::lookup (kids(i));
+
+          if (hkid.ok ())
+            {
+              const graphics_object& kid = gh_manager::get_object (hkid);
 
               if (kid.valid_object ())
                 nd = calc_dimensions (kid);
@@ -10822,17 +10878,15 @@
 
       if (! error_state)
         {
-          // Check is all the handles to delete are valid first
-          // as callbacks might delete one of the handles we
-          // later want to delete
+          // Check all the handles to delete are valid first, as callbacks
+          // might delete one of the handles we later want to delete
           for (octave_idx_type i = 0; i < vals.numel (); i++)
             {
-              h = gh_manager::lookup (vals.elem (i));
+              h = gh_manager::lookup (vals(i));
 
               if (! h.ok ())
                 {
-                  error ("delete: invalid graphics object (= %g)",
-                         vals.elem (i));
+                  error ("delete: invalid graphics object (= %g)", vals(i));
                   break;
                 }
             }
@@ -10883,9 +10937,9 @@
 
           if (h.ok ())
             {
-              graphics_object obj = gh_manager::get_object (h);
-
-              obj.set_defaults (mode);
+              graphics_object go = gh_manager::get_object (h);
+
+              go.set_defaults (mode);
 
               h = gh_manager::lookup (val);
               if (! h.ok ())
@@ -10998,15 +11052,15 @@
 
       if (! error_state)
         {
-          graphics_object fobj = gh_manager::get_object (h);
-          if (fobj &&  fobj.isa ("image"))
+          graphics_object go = gh_manager::get_object (h);
+          if (go && go.isa ("image"))
             {
               image::properties& ip =
-                dynamic_cast<image::properties&> (fobj.get_properties ());
-
-              Matrix dp =  Matrix (1, 2, 0);
-              dp(0, 0) = ip.pixel_xsize ();
-              dp(0, 1) = ip.pixel_ysize ();
+                dynamic_cast<image::properties&> (go.get_properties ());
+
+              Matrix dp = Matrix (1, 2);
+              dp(0) = ip.pixel_xsize ();
+              dp(1) = ip.pixel_ysize ();
               retval = dp;
             }
           else
@@ -11197,7 +11251,7 @@
         {
           Matrix hlist = gh_manager::figure_handle_list (true);
 
-          for (int i = 0; ! error_state && i < hlist.length (); i++)
+          for (int i = 0; ! error_state && i < hlist.numel (); i++)
             {
               graphics_handle h = gh_manager::lookup (hlist(i));
 
@@ -11649,11 +11703,11 @@
 {
   gh_manager::auto_lock guard;
 
-  graphics_object obj = gh_manager::get_object (handle);
   octave_value retval;
-
-  if (obj)
-    retval = obj.get (caseless_str (property));
+  graphics_object go = gh_manager::get_object (handle);
+
+  if (go)
+    retval = go.get (caseless_str (property));
   else
     error ("%s: invalid handle (= %g)", func.c_str (), handle);
 
@@ -11666,12 +11720,12 @@
 {
   gh_manager::auto_lock guard;
 
-  graphics_object obj = gh_manager::get_object (handle);
   int ret = false;
-
-  if (obj)
-    {
-      obj.set (caseless_str (property), arg);
+  graphics_object go = gh_manager::get_object (handle);
+
+  if (go)
+    {
+      go.set (caseless_str (property), arg);
 
       if (! error_state)
         ret = true;
@@ -11683,12 +11737,12 @@
 }
 
 static bool
-compare_property_values (const octave_value& o1, const octave_value& o2)
+compare_property_values (const octave_value& ov1, const octave_value& ov2)
 {
   octave_value_list args(2);
 
-  args(0) = o1;
-  args(1) = o2;
+  args(0) = ov1;
+  args(1) = ov2;
 
   octave_value_list result = feval ("isequal", args, 1);
 
@@ -11724,11 +11778,11 @@
             {
               gh_manager::auto_lock guard;
 
-              graphics_handle handle = gh_manager::lookup (h);
-
-              if (handle.ok ())
+              graphics_handle gh = gh_manager::lookup (h);
+
+              if (gh.ok ())
                 {
-                  graphics_object go = gh_manager::get_object (handle);
+                  graphics_object go = gh_manager::get_object (gh);
 
                   if (go.get_properties ().has_property (pname))
                     {
@@ -11773,11 +11827,11 @@
                     {
                       gh_manager::auto_lock guard;
 
-                      graphics_handle handle = gh_manager::lookup (h);
-
-                      if (handle.ok ())
+                      graphics_handle gh = gh_manager::lookup (h);
+
+                      if (gh.ok ())
                         {
-                          graphics_object go = gh_manager::get_object (handle);
+                          graphics_object go = gh_manager::get_object (gh);
                           octave_value pvalue = go.get (pname);
 
                           if (compare_property_values (pvalue, args(5)))
@@ -11872,8 +11926,7 @@
             {
               pname = args(1).string_value ();
               if (! error_state
-                  && ! pname.empty ()
-                  && ! pname.compare ("timeout"))
+                  && ! pname.empty () && ! pname.compare ("timeout"))
                 {
                   if (pname.compare ("\\timeout"))
                     pname = "timeout";
@@ -11919,11 +11972,11 @@
 
                   gh_manager::auto_lock guard;
 
-                  graphics_handle handle = gh_manager::lookup (h);
-
-                  if (handle.ok ())
+                  graphics_handle gh = gh_manager::lookup (h);
+
+                  if (gh.ok ())
                     {
-                      graphics_object go = gh_manager::get_object (handle);
+                      graphics_object go = gh_manager::get_object (gh);
 
                       if (max_arg_index >= 2
                           && compare_property_values (go.get (pname),
@@ -11972,8 +12025,7 @@
             }
 
           if (! error_state
-              && timeout_index < 0
-              && args.length () > (max_arg_index + 1))
+              && timeout_index < 0 && args.length () > (max_arg_index + 1))
             {
               caseless_str s = args(max_arg_index + 1).string_value ();
 
@@ -12012,10 +12064,10 @@
 
           // FIXME: There is still a "hole" in the following loop. The code
           //        assumes that an object handle is unique, which is a fair
-          //        assumption, except for figures. If a figure is destroyed
+          //        assumption, except for figures.  If a figure is destroyed
           //        then recreated with the same figure ID, within the same
           //        run of event hooks, then the figure destruction won't be
-          //        caught and the loop will not stop. This is an unlikely
+          //        caught and the loop will not stop.  This is an unlikely
           //        possibility in practice, though.
           //
           //        Using deletefcn callback is also unreliable as it could be
@@ -12036,9 +12088,9 @@
                 {
                   gh_manager::auto_lock guard;
 
-                  graphics_handle handle = gh_manager::lookup (h);
-
-                  if (handle.ok ())
+                  graphics_handle gh = gh_manager::lookup (h);
+
+                  if (gh.ok ())
                     {
                       if (! pname.empty () && waitfor_results[id])
                         break;
@@ -12123,7 +12175,6 @@
             }
           else
             ax_props.clear_zoom_stack (false);
-
         }
     }
   else
@@ -12140,3 +12191,4 @@
 
   return retval;
 }
+
--- a/libinterp/corefcn/graphics.in.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/graphics.in.h	Tue Jun 23 20:00:59 2015 -0700
@@ -536,10 +536,10 @@
   {
     std::string s;
 
-    for (octave_idx_type i = 0; i < str.length (); i++)
+    for (octave_idx_type i = 0; i < str.numel (); i++)
       {
         s += str[i];
-        if (i != str.length () - 1)
+        if (i != str.numel () - 1)
           s += separator;
       }
 
@@ -636,9 +636,9 @@
 
         string_vector strings = new_cell.cellstr_value ();
 
-        octave_idx_type nel = strings.length ();
-
-        if (nel != str.length ())
+        octave_idx_type nel = strings.numel ();
+
+        if (nel != str.numel ())
           replace = true;
         else
           {
@@ -3218,11 +3218,17 @@
     // See the genprops.awk script for an explanation of the
     // properties declarations.
 
-    // FIXME: Properties that still dont have callbacks are:
-    // language, monitorpositions, pointerlocation, pointerwindow.
+    // FIXME: Properties that still don't have callbacks are:
+    // monitorpositions, pointerlocation, pointerwindow.
     // Note that these properties are not yet used by Octave, so setting
     // them will have no effect.
 
+    // FIXME: Several properties have been deleted from Matlab.
+    //        We should either immediately remove them or figure out a way
+    //        to deprecate them for a release or two.
+    // Obsolete properties: commandwindowsize, diary, diaryfile, echo,
+    // errormessage, format, formatspacing, language, recursionlimit.
+
     // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (root_figure, root)
@@ -3237,7 +3243,7 @@
       radio_property format GS , "+|bank|bit|hex|long|longe|longeng|longg|native-bit|native-hex|none|rat|{short}|shorte|shorteng|shortg"
       radio_property formatspacing GS , "compact|{loose}"
       string_property language , "ascii"
-      array_property monitorpositions , Matrix (1, 4, 0)
+      array_property monitorpositions r , Matrix (1, 4, 0)
       array_property pointerlocation , Matrix (1, 2, 0)
       double_property pointerwindow r , 0.0
       double_property recursionlimit GS , 256.0
@@ -3449,6 +3455,12 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+    // FIXME: Several properties have been deleted from Matlab.
+    //        We should either immediately remove them or figure out a way
+    //        to deprecate them for a release or two.
+    // Obsolete properties: doublebuffer, mincolormap, wvisual, wvisualmode,
+    // xdisplay, xvisual, xvisualmode
+
     // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (figure)
@@ -3464,6 +3476,7 @@
       bool_property dockcontrols , "off"
       bool_property doublebuffer , "on"
       string_property filename , ""
+      bool_property graphicssmoothing , "on"
       bool_property integerhandle S , "on"
       bool_property inverthardcopy , "off"
       callback_property keypressfcn , Matrix ()
@@ -3471,6 +3484,8 @@
       radio_property menubar , "none|{figure}"
       double_property mincolormap , 64
       string_property name , ""
+      // FIXME: Need RO property which returns current figure number.
+      // double_property number r ,
       radio_property nextplot , "new|{add}|replacechildren|replace"
       bool_property numbertitle , "on"
       array_property outerposition s , Matrix (1, 4, -1.0)
@@ -3489,6 +3504,9 @@
       bool_property resize , "on"
       callback_property resizefcn , Matrix ()
       radio_property selectiontype , "{normal}|open|alt|extend"
+      // FIXME: This is the new name for the resizefcn from Matlab.
+      //        Need to try supporting both for some amount of time.
+      callback_property sizechangedfcn , Matrix ()
       radio_property toolbar , "none|{auto}|figure"
       radio_property units Su , "inches|centimeters|normalized|points|{pixels}|characters"
       callback_property windowbuttondownfcn , Matrix ()
@@ -3504,14 +3522,14 @@
       string_property xvisual , ""
       radio_property xvisualmode , "{auto}|manual"
       // Octave-specific properties
-      radio_property __mouse_mode__ hS , "{none}|pan|rotate|select|text|zoom"
-      any_property __pan_mode__ h , Matrix ()
-      any_property __rotate_mode__ h , Matrix ()
-      any_property __zoom_mode__ h , Matrix ()
       bool_property __enhanced__ h , "on"
       string_property __graphics_toolkit__ hs , gtk_manager::default_toolkit ()
       any_property __guidata__ h , Matrix ()
+      radio_property __mouse_mode__ hS , "{none}|pan|rotate|select|text|zoom"
+      any_property __pan_mode__ h , Matrix ()
       any_property __plot_stream__ h , Matrix ()
+      any_property __rotate_mode__ h , Matrix ()
+      any_property __zoom_mode__ h , Matrix ()
     END_PROPERTIES
 
   protected:
@@ -3867,6 +3885,12 @@
 
     // See the genprops.awk script for an explanation of the
     // properties declarations.
+
+    // FIXME: Several properties have been deleted from Matlab.
+    //        We should either immediately remove them or figure out a way
+    //        to deprecate them for a release or two.
+    // Obsolete properties: drawmode
+
     // Programming note: Keep property list sorted if new ones are added.
 
     BEGIN_PROPERTIES (axes)
@@ -3875,53 +3899,73 @@
       radio_property alimmode , "{auto}|manual"
       color_property ambientlightcolor , color_values (1, 1, 1)
       bool_property box , "on"
+      radio_property boxstyle , "{back}|full"
       array_property cameraposition m , Matrix (1, 3, 0.0)
       radio_property camerapositionmode , "{auto}|manual"
       array_property cameratarget m , Matrix (1, 3, 0.0)
       radio_property cameratargetmode , "{auto}|manual"
       array_property cameraupvector m , Matrix (1, 3, 0.0)
       radio_property cameraupvectormode , "{auto}|manual"
-      double_property cameraviewangle m , 10.0
+      double_property cameraviewangle m , 6.6086
       radio_property cameraviewanglemode , "{auto}|manual"
       row_vector_property clim m , default_lim ()
       radio_property climmode al , "{auto}|manual"
+      radio_property clippingstyle , "{3dbox}|rectangle"
       color_property color , color_property (color_values (1, 1, 1), radio_values ("none"))
       array_property colororder , default_colororder ()
+      double_property colororderindex , 1.0
       array_property currentpoint , Matrix (2, 3, 0.0)
       array_property dataaspectratio mu , Matrix (1, 3, 1.0)
       radio_property dataaspectratiomode u , "{auto}|manual"
       radio_property drawmode , "{normal}|fast"
-      radio_property fontangle u , "{normal}|italic|oblique"
+      radio_property fontangle u , "{normal}|italic"
       string_property fontname u , OCTAVE_DEFAULT_FONTNAME
       double_property fontsize u , 10
-      radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels"
-      radio_property fontweight u , "{normal}|light|demi|bold"
-      radio_property gridlinestyle , "-|--|{:}|-.|none"
+      radio_property fontunits SU , "{points}|inches|centimeters|normalized|pixels"
+      bool_property fontsmoothing , "on"
+      radio_property fontweight u , "{normal}|bold"
+      double_property gridalpha , 0.15
+      radio_property gridalphamode , "{auto}|manual"
+      color_property gridcolor , color_property (color_values (0.15, 0.15, 0.15), radio_values ("none"))
+      radio_property gridcolormode , "{auto}|manual"
+      radio_property gridlinestyle , "{:}|-|--|-.|none"
       // NOTE: interpreter is not a Matlab axis property, but it makes
       //       more sense to have it so that axis ticklabels can use it.
-      radio_property interpreter , "tex|{none}|latex"
+      radio_property interpreter , "{tex}|latex|{none}"
+      double_property labelfontsizemultiplier , 1.1
       radio_property layer u , "{bottom}|top"
       // FIXME: should be kind of string array.
       any_property linestyleorder S , "-"
+      double_property linestyleorderindex , 1.0
       double_property linewidth , 0.5
-      radio_property minorgridlinestyle , "-|--|{:}|-.|none"
-      double_property mousewheelzoom , 0.5
-      radio_property nextplot , "add|replacechildren|{replace}"
+      double_property minorgridalpha , 0.25
+      radio_property minorgridalphamode , "{auto}|manual"
+      color_property minorgridcolor , color_property (color_values (0.1, 0.1, 0.1), radio_values ("none"))
+      radio_property minorgridcolormode , "{auto}|manual"
+      radio_property minorgridlinestyle , "{:}|-|--|-.|none"
+      radio_property nextplot , "{replace}|add|replacechildren"
       array_property outerposition u , default_axes_outerposition ()
       array_property plotboxaspectratio mu , Matrix (1, 3, 1.0)
       radio_property plotboxaspectratiomode u , "{auto}|manual"
+      radio_property pickableparts , "{visible}|all|none"
       array_property position u , default_axes_position ()
       radio_property projection , "{orthographic}|perspective"
+      radio_property sortmethod , "{depth}|childorder"
       radio_property tickdir mu , "{in}|out"
       radio_property tickdirmode u , "{auto}|manual"
+      // FIXME: Added recently to Matlab, should replace interpreter property.
+      radio_property ticklabelinterpreter , "{tex}|latex|{none}"
       array_property ticklength u , default_axes_ticklength ()
       array_property tightinset r , Matrix (1, 4, 0.0)
       handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
+      double_property titlefontsizemultiplier , 1.1
+      radio_property titlefontweight , "{bold}|normal"
       // FIXME: uicontextmenu should be moved here.
       radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters"
       array_property view u , default_axes_view ()
       radio_property xaxislocation u , "{bottom}|top|zero"
       color_property xcolor , color_values (0, 0, 0)
+      radio_property xcolormode , "{auto}|manual"
       radio_property xdir u , "{normal}|reverse"
       bool_property xgrid , "off"
       handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
@@ -3934,9 +3978,11 @@
       // FIXME: should be kind of string array.
       any_property xticklabel S , ""
       radio_property xticklabelmode u , "{auto}|manual"
+      double_property xticklabelrotation , 0.0
       radio_property xtickmode u , "{auto}|manual"
       radio_property yaxislocation u , "{left}|right|zero"
       color_property ycolor , color_values (0, 0, 0)
+      radio_property ycolormode , "{auto}|manual"
       radio_property ydir u , "{normal}|reverse"
       bool_property ygrid , "off"
       handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
@@ -3948,8 +3994,10 @@
       row_vector_property ytick mu , default_axes_tick ()
       any_property yticklabel S , ""
       radio_property yticklabelmode u , "{auto}|manual"
+      double_property yticklabelrotation , 0.0
       radio_property ytickmode u , "{auto}|manual"
       color_property zcolor , color_values (0, 0, 0)
+      radio_property zcolormode , "{auto}|manual"
       radio_property zdir u , "{normal}|reverse"
       bool_property zgrid , "off"
       handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
@@ -3961,8 +4009,10 @@
       row_vector_property ztick mu , default_axes_tick ()
       any_property zticklabel S , ""
       radio_property zticklabelmode u , "{auto}|manual"
+      double_property zticklabelrotation , 0.0
       radio_property ztickmode u , "{auto}|manual"
       // Octave-specific properties
+      double_property mousewheelzoom , 0.5
       bool_property __hold_all__ h , "off"
       // hidden properties for alignment of subplots
       radio_property autopos_tag h , "{none}|subplot"
--- a/libinterp/corefcn/help.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/help.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -797,22 +797,22 @@
 string_vector
 make_name_list (void)
 {
-  const int key_len = keyword_names.length ();
+  const int key_len = keyword_names.numel ();
 
   const string_vector bif = symbol_table::built_in_function_names ();
-  const int bif_len = bif.length ();
+  const int bif_len = bif.numel ();
 
   const string_vector cfl = symbol_table::cmdline_function_names ();
-  const int cfl_len = cfl.length ();
+  const int cfl_len = cfl.numel ();
 
   const string_vector lcl = symbol_table::variable_names ();
-  const int lcl_len = lcl.length ();
+  const int lcl_len = lcl.numel ();
 
   const string_vector ffl = load_path::fcn_names ();
-  const int ffl_len = ffl.length ();
+  const int ffl_len = ffl.numel ();
 
   const string_vector afl = autoloaded_functions ();
-  const int afl_len = afl.length ();
+  const int afl_len = afl.numel ();
 
   const int total_len
     = key_len + bif_len + cfl_len + lcl_len + ffl_len + afl_len;
@@ -1303,7 +1303,7 @@
 
   if (! error_state)
     {
-      int argc = argv.length ();
+      int argc = argv.numel ();
 
       if (argc > 1)
         {
--- a/libinterp/corefcn/hex2num.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/hex2num.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -242,7 +242,7 @@
       if (! error_state)
         {
           octave_idx_type nchars = 8;
-          octave_idx_type nr = v.length ();
+          octave_idx_type nr = v.numel ();
           charMatrix m (nr, nchars);
           const float *pv = v.fortran_vec ();
 
@@ -279,7 +279,7 @@
       if (! error_state)
         {
           octave_idx_type nchars = 16;
-          octave_idx_type nr = v.length ();
+          octave_idx_type nr = v.numel ();
           charMatrix m (nr, nchars);
           const double *pv = v.fortran_vec ();
 
--- a/libinterp/corefcn/input.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/input.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -408,13 +408,13 @@
       else
         name_list = generate_possible_completions (text, prefix, hint);
 
-      name_list_len = name_list.length ();
+      name_list_len = name_list.numel ();
 
       file_name_list = command_editor::generate_filename_completions (text);
 
       name_list.append (file_name_list);
 
-      name_list_total_len = name_list.length ();
+      name_list_total_len = name_list.numel ();
 
       hint_len = hint.length ();
 
@@ -1028,6 +1028,53 @@
   return retval;
 }
 
+/*
+%!test
+%! state = echo_executing_commands ();
+%! unwind_protect
+%!   echo ();
+%!   s1 = echo_executing_commands ();
+%!   assert (s1 != state);
+%!   echo ();
+%!   s2 = echo_executing_commands ();
+%!   assert (s2 != s1);
+%! unwind_protect_cleanup
+%!   echo_executing_commands (state);
+%! end_unwind_protect
+
+%!test
+%! state = echo_executing_commands ();
+%! unwind_protect
+%!   echo ("off");
+%!   assert (echo_executing_commands () == 0);
+%!   echo ("on");
+%!   assert (echo_executing_commands () != 0);
+%!   echo ("off");
+%!   assert (echo_executing_commands () == 0);
+%! unwind_protect_cleanup
+%!   echo_executing_commands (state);
+%! end_unwind_protect
+
+%!#test  # FIXME: Uncommend when ug #45209 is fixed
+%! state = echo_executing_commands ();
+%! unwind_protect
+%!   echo ("on", "all");
+%!   assert (echo_executing_commands () != 0);
+%!   echo ("off", "all");
+%!   assert (echo_executing_commands () == 0);
+%! unwind_protect_cleanup
+%!   echo_executing_commands (state);
+%! end_unwind_protect
+
+%!error echo ([])
+%!error echo (0)
+%!error echo ("")
+%!error echo ("Octave")
+%!error echo ("off", "invalid")
+%!error echo ("on", "invalid")
+%!error echo ("on", "all", "all")
+*/
+
 DEFUN (__echostate__, , ,
        "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {@var{state} =} __echostate__ ()\n\
@@ -1098,7 +1145,7 @@
               // because it will be easier for Emacs if the names
               // appear in a single column.
 
-              int len = list.length ();
+              int len = list.numel ();
 
               for (int i = 0; i < len; i++)
                 octave_stdout << list[i] << "\n";
@@ -1113,6 +1160,21 @@
   return retval;
 }
 
+/*
+%!assert (ischar (completion_matches ("")))
+%!assert (ischar (completion_matches ("a")))
+%!assert (ischar (completion_matches (" ")))
+%!assert (isempty (completion_matches (" ")))
+%!assert (any (strcmp ("abs", deblank (cellstr (completion_matches (""))))))
+%!assert (any (strcmp ("abs", deblank (cellstr (completion_matches ("a"))))))
+%!assert (any (strcmp ("abs", deblank (cellstr (completion_matches ("ab"))))))
+%!assert (any (strcmp ("abs", deblank (cellstr (completion_matches ("abs"))))))
+%!assert (! any (strcmp ("abs", deblank (cellstr (completion_matches ("absa"))))))
+
+%!error completion_matches ()
+%!error completion_matches (1, 2)
+*/
+
 DEFUN (readline_read_init_file, args, ,
        "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} readline_read_init_file (@var{file})\n\
--- a/libinterp/corefcn/jit-typeinfo.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/jit-typeinfo.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -257,7 +257,7 @@
                                 double value)
 {
   NDArray *array = mat->array;
-  if (array->nelem () < index)
+  if (array->numel () < index)
     array->resize1 (index);
 
   double *data = array->fortran_vec ();
--- a/libinterp/corefcn/jit-typeinfo.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/jit-typeinfo.h	Tue Jun 23 20:00:59 2015 -0700
@@ -79,7 +79,7 @@
   {
     ref_count = array->jit_ref_count ();
     slice_data = array->jit_slice_data () - 1;
-    slice_len = array->capacity ();
+    slice_len = array->numel ();
     dimensions = array->jit_dimensions ();
   }
 
--- a/libinterp/corefcn/load-path.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/load-path.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -180,7 +180,7 @@
     {
       string_vector flist = dir.read ();
 
-      octave_idx_type len = flist.length ();
+      octave_idx_type len = flist.numel ();
 
       all_files.resize (len);
       fcn_files.resize (len);
@@ -250,7 +250,7 @@
     {
       string_vector flist = dir.read ();
 
-      octave_idx_type len = flist.length ();
+      octave_idx_type len = flist.numel ();
 
       for (octave_idx_type i = 0; i < len; i++)
         {
@@ -408,7 +408,7 @@
 load_path::loader::move_fcn_map (const std::string& dir_name,
                                  const string_vector& fcn_files, bool at_end)
 {
-  octave_idx_type len = fcn_files.length ();
+  octave_idx_type len = fcn_files.numel ();
 
   for (octave_idx_type k = 0; k < len; k++)
     {
@@ -803,7 +803,7 @@
 load_path::loader::remove_fcn_map (const std::string& dir,
                                    const string_vector& fcn_files)
 {
-  octave_idx_type len = fcn_files.length ();
+  octave_idx_type len = fcn_files.numel ();
 
   for (octave_idx_type k = 0; k < len; k++)
     {
@@ -1373,7 +1373,7 @@
         {
           string_vector all_files = p->all_files;
 
-          octave_idx_type len = all_files.length ();
+          octave_idx_type len = all_files.numel ();
 
           for (octave_idx_type i = 0; i < len; i++)
             {
@@ -1488,7 +1488,7 @@
   std::string dir_name;
   std::string file_name;
 
-  octave_idx_type flen = flist.length ();
+  octave_idx_type flen = flist.numel ();
   octave_idx_type rel_flen = 0;
 
   string_vector rel_flist (flen);
@@ -1534,7 +1534,7 @@
     {
       string_vector all_files = p->all_files;
 
-      octave_idx_type len = all_files.length ();
+      octave_idx_type len = all_files.numel ();
 
       for (octave_idx_type i = 0; i < len; i++)
         {
@@ -1567,7 +1567,7 @@
   std::string dir_name;
   std::string file_name;
 
-  octave_idx_type flen = flist.length ();
+  octave_idx_type flen = flist.numel ();
   octave_idx_type rel_flen = 0;
 
   string_vector rel_flist (flen);
@@ -1612,7 +1612,7 @@
     {
       string_vector all_files = p->all_files;
 
-      octave_idx_type len = all_files.length ();
+      octave_idx_type len = all_files.numel ();
 
       for (octave_idx_type i = 0; i < len; i++)
         {
@@ -1670,7 +1670,7 @@
 
   if (omit_exts)
     {
-      octave_idx_type len = retval.length ();
+      octave_idx_type len = retval.numel ();
 
       for (octave_idx_type i = 0; i < len; i++)
         {
@@ -1716,7 +1716,7 @@
 
   string_vector xdirs = load_path::dirs ();
 
-  octave_idx_type len = xdirs.length ();
+  octave_idx_type len = xdirs.numel ();
 
   if (len > 0)
     xpath = xdirs[0];
@@ -1893,7 +1893,7 @@
 
   string_vector fcn_files = di.fcn_files;
 
-  octave_idx_type len = fcn_files.length ();
+  octave_idx_type len = fcn_files.numel ();
 
   for (octave_idx_type i = 0; i < len; i++)
     {
@@ -2150,7 +2150,7 @@
 
       string_vector dirlist = dir.read ().sort (false);
 
-      octave_idx_type len = dirlist.length ();
+      octave_idx_type len = dirlist.numel ();
 
       for (octave_idx_type i = 0; i < len; i++)
         {
@@ -2161,7 +2161,7 @@
 
           if (! skip_p)
             {
-              for (octave_idx_type j = 0; j < skip.length (); j++)
+              for (octave_idx_type j = 0; j < skip.numel (); j++)
                 {
                   skip_p = (elt == skip[j]);
                   if (skip_p)
--- a/libinterp/corefcn/load-save.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/load-save.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -59,6 +59,7 @@
 #include "gripes.h"
 #include "load-path.h"
 #include "load-save.h"
+#include "oct-hdf5.h"
 #include "oct-obj.h"
 #include "oct-map.h"
 #include "ov-cell.h"
@@ -1052,7 +1053,7 @@
                     bool &save_as_floats, bool &use_zlib)
 {
   string_vector retval;
-  int argc = argv.length ();
+  int argc = argv.numel ();
 
   bool do_double = false;
   bool do_tabs = false;
@@ -1634,7 +1635,7 @@
   // override from command line
   argv = parse_save_options (argv, format, append, save_as_floats,
                              use_zlib);
-  int argc = argv.length ();
+  int argc = argv.numel ();
   int i = 0;
 
   if (error_state)
--- a/libinterp/corefcn/ls-hdf5.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/ls-hdf5.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -55,7 +55,7 @@
 #include "error.h"
 #include "gripes.h"
 #include "load-save.h"
-#include "oct-hdf5-id.h"
+#include "oct-hdf5.h"
 #include "oct-obj.h"
 #include "oct-map.h"
 #include "ov-cell.h"
@@ -72,6 +72,57 @@
 #include "ls-utils.h"
 #include "ls-hdf5.h"
 
+hdf5_fstreambase::hdf5_fstreambase (const char *name, int mode, int /* prot */)
+  : file_id (-1), current_item (-1)
+{
+  if (mode & std::ios::in)
+    file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT);
+  else if (mode & std::ios::out)
+    {
+      if (mode & std::ios::app && H5Fis_hdf5 (name) > 0)
+        file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT);
+      else
+        file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT,
+                             H5P_DEFAULT);
+    }
+  if (file_id < 0)
+    std::ios::setstate (std::ios::badbit);
+
+  current_item = 0;
+}
+
+void
+hdf5_fstreambase::close (void)
+{
+  if (file_id >= 0)
+    {
+      if (H5Fclose (file_id) < 0)
+        std::ios::setstate (std::ios::badbit);
+      file_id = -1;
+    }
+}
+
+void
+hdf5_fstreambase::open (const char *name, int mode, int)
+{
+  clear ();
+
+  if (mode & std::ios::in)
+    file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT);
+  else if (mode & std::ios::out)
+    {
+      if (mode & std::ios::app && H5Fis_hdf5 (name) > 0)
+        file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT);
+      else
+        file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT,
+                             H5P_DEFAULT);
+    }
+  if (file_id < 0)
+    std::ios::setstate (std::ios::badbit);
+
+  current_item = 0;
+}
+
 static std::string
 make_valid_identifier (const std::string& nm)
 {
@@ -104,7 +155,7 @@
 // which is all we need it for
 
 bool
-hdf5_types_compatible (hid_t t1, hid_t t2)
+hdf5_types_compatible (octave_hdf5_id t1, octave_hdf5_id t2)
 {
   int n;
   if ((n = H5Tget_nmembers (t1)) != H5Tget_nmembers (t2))
@@ -129,7 +180,7 @@
 // otherwise.
 
 bool
-hdf5_check_attr (hid_t loc_id, const char *attr_name)
+hdf5_check_attr (octave_hdf5_id loc_id, const char *attr_name)
 {
   bool retval = false;
 
@@ -170,7 +221,7 @@
 }
 
 bool
-hdf5_get_scalar_attr (hid_t loc_id, hid_t type_id,
+hdf5_get_scalar_attr (octave_hdf5_id loc_id, octave_hdf5_id type_id,
                       const char *attr_name, void *buf)
 {
   bool retval = false;
@@ -224,8 +275,8 @@
 // H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary
 // conversions are handled automatically by HDF5.
 
-hid_t
-hdf5_make_complex_type (hid_t num_type)
+octave_hdf5_id
+hdf5_make_complex_type (octave_hdf5_id num_type)
 {
   hid_t type_id = H5Tcreate (H5T_COMPOUND, sizeof (double) * 2);
 
@@ -245,8 +296,8 @@
 // -1 on error, and 0 to tell H5Giterate to continue on to the next item
 // (e.g. if NAME was a data type we don't recognize).
 
-herr_t
-hdf5_read_next_data (hid_t group_id, const char *name, void *dv)
+octave_hdf5_err
+hdf5_read_next_data (octave_hdf5_id group_id, const char *name, void *dv)
 {
   hdf5_callback_data *d = static_cast<hdf5_callback_data *> (dv);
   hid_t type_id = -1;
@@ -588,7 +639,7 @@
                 bool& global, octave_value& tc, std::string& doc,
                 const string_vector& argv, int argv_idx, int argc)
 {
-  check_hdf5_id_type ();
+  check_hdf5_types ();
 
   std::string retval;
 
@@ -663,8 +714,8 @@
 
 // Add an attribute named attr_name to loc_id (a simple scalar
 // attribute with value 1).  Return value is >= 0 on success.
-herr_t
-hdf5_add_attr (hid_t loc_id, const char *attr_name)
+octave_hdf5_err
+hdf5_add_attr (octave_hdf5_id loc_id, const char *attr_name)
 {
   herr_t retval = 0;
 
@@ -698,8 +749,8 @@
   return retval;
 }
 
-herr_t
-hdf5_add_scalar_attr (hid_t loc_id, hid_t type_id,
+octave_hdf5_err
+hdf5_add_scalar_attr (octave_hdf5_id loc_id, octave_hdf5_id type_id,
                       const char *attr_name, void *buf)
 {
   herr_t retval = 0;
@@ -737,7 +788,7 @@
 //    = 0  Not an empty matrix; did nothing
 //    < 0  Error condition
 int
-save_hdf5_empty (hid_t loc_id, const char *name, const dim_vector d)
+save_hdf5_empty (octave_hdf5_id loc_id, const char *name, const dim_vector d)
 {
   hsize_t sz = d.length ();
   OCTAVE_LOCAL_BUFFER (octave_idx_type, dims, sz);
@@ -787,7 +838,7 @@
 //    = 0  Not an empty matrix; did nothing
 //    < 0  Error condition
 int
-load_hdf5_empty (hid_t loc_id, const char *name, dim_vector &d)
+load_hdf5_empty (octave_hdf5_id loc_id, const char *name, dim_vector &d)
 {
   if (! hdf5_check_attr (loc_id, "OCTAVE_EMPTY_MATRIX"))
     return 0;
@@ -826,7 +877,7 @@
 
 // return the HDF5 type id corresponding to the Octave save_type
 
-hid_t
+octave_hdf5_id
 save_type_to_hdf5 (save_type st)
 {
   switch (st)
@@ -865,7 +916,7 @@
 // (stored as HDF5 groups).
 
 bool
-add_hdf5_data (hid_t loc_id, const octave_value& tc,
+add_hdf5_data (octave_hdf5_id loc_id, const octave_value& tc,
                const std::string& name, const std::string& doc,
                bool mark_as_global, bool save_as_floats)
 {
@@ -955,7 +1006,7 @@
                 const std::string& name, const std::string& doc,
                 bool mark_as_global, bool save_as_floats)
 {
-  check_hdf5_id_type ();
+  check_hdf5_types ();
 
   hdf5_ofstream& hs = dynamic_cast<hdf5_ofstream&> (os);
 
--- a/libinterp/corefcn/ls-hdf5.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/ls-hdf5.h	Tue Jun 23 20:00:59 2015 -0700
@@ -25,7 +25,7 @@
 
 #if defined (HAVE_HDF5)
 
-#include "oct-hdf5.h"
+#include "oct-hdf5-types.h"
 
 // first, we need to define our own dummy stream subclass, since
 // HDF5 needs to do its own file i/o
@@ -38,7 +38,7 @@
 public:
 
   // HDF5 uses an "id" to refer to an open file
-  hid_t file_id;
+  octave_hdf5_id file_id;
 
   // keep track of current item index in the file
   int current_item;
@@ -47,54 +47,11 @@
 
   ~hdf5_fstreambase () { close (); }
 
-  hdf5_fstreambase (const char *name, int mode, int /* prot */ = 0)
-    : file_id (-1), current_item (-1)
-  {
-    if (mode & std::ios::in)
-      file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT);
-    else if (mode & std::ios::out)
-      {
-        if (mode & std::ios::app && H5Fis_hdf5 (name) > 0)
-          file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT);
-        else
-          file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT,
-                               H5P_DEFAULT);
-      }
-    if (file_id < 0)
-      std::ios::setstate (std::ios::badbit);
-
-    current_item = 0;
-  }
+  hdf5_fstreambase (const char *name, int mode, int /* prot */ = 0);
 
-  void close ()
-  {
-    if (file_id >= 0)
-      {
-        if (H5Fclose (file_id) < 0)
-          std::ios::setstate (std::ios::badbit);
-        file_id = -1;
-      }
-  }
-
-  void open (const char *name, int mode, int)
-  {
-    clear ();
+  void close (void);
 
-    if (mode & std::ios::in)
-      file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT);
-    else if (mode & std::ios::out)
-      {
-        if (mode & std::ios::app && H5Fis_hdf5 (name) > 0)
-          file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT);
-        else
-          file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT,
-                               H5P_DEFAULT);
-      }
-    if (file_id < 0)
-      std::ios::setstate (std::ios::badbit);
-
-    current_item = 0;
-  }
+  void open (const char *name, int mode, int);
 };
 
 // input and output streams, subclassing istream and ostream
@@ -154,29 +111,29 @@
 };
 
 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS
-extern OCTINTERP_API hid_t
+extern OCTINTERP_API octave_hdf5_id
 save_type_to_hdf5 (save_type st)
 #endif
 
-extern OCTINTERP_API hid_t
-hdf5_make_complex_type (hid_t num_type);
+extern OCTINTERP_API octave_hdf5_id
+hdf5_make_complex_type (octave_hdf5_id num_type);
 
 extern OCTINTERP_API bool
-hdf5_types_compatible (hid_t t1, hid_t t2);
+hdf5_types_compatible (octave_hdf5_id t1, octave_hdf5_id t2);
 
-extern OCTINTERP_API herr_t
-hdf5_read_next_data (hid_t group_id, const char *name, void *dv);
+extern OCTINTERP_API octave_hdf5_err
+hdf5_read_next_data (octave_hdf5_id group_id, const char *name, void *dv);
 
 extern OCTINTERP_API bool
-add_hdf5_data (hid_t loc_id, const octave_value& tc,
+add_hdf5_data (octave_hdf5_id loc_id, const octave_value& tc,
                const std::string& name, const std::string& doc,
                bool mark_as_global, bool save_as_floats);
 
 extern OCTINTERP_API int
-save_hdf5_empty (hid_t loc_id, const char *name, const dim_vector d);
+save_hdf5_empty (octave_hdf5_id loc_id, const char *name, const dim_vector d);
 
 extern OCTINTERP_API int
-load_hdf5_empty (hid_t loc_id, const char *name, dim_vector &d);
+load_hdf5_empty (octave_hdf5_id loc_id, const char *name, dim_vector &d);
 
 extern OCTINTERP_API std::string
 read_hdf5_data (std::istream& is,  const std::string& filename, bool& global,
@@ -189,26 +146,20 @@
                 bool mark_as_global, bool save_as_floats);
 
 extern OCTINTERP_API bool
-hdf5_check_attr (hid_t loc_id, const char *attr_name);
+hdf5_check_attr (octave_hdf5_id loc_id, const char *attr_name);
 
 extern OCTINTERP_API bool
-hdf5_get_scalar_attr (hid_t loc_id, hid_t type_id, const char *attr_name,
-                      void *buf);
+hdf5_get_scalar_attr (octave_hdf5_id loc_id, octave_hdf5_id type_id,
+                      const char *attr_name, void *buf);
 
-extern OCTINTERP_API herr_t
-hdf5_add_attr (hid_t loc_id, const char *attr_name);
+extern OCTINTERP_API octave_hdf5_err
+hdf5_add_attr (octave_hdf5_id loc_id, const char *attr_name);
 
 
-extern OCTINTERP_API herr_t
-hdf5_add_scalar_attr (hid_t loc_id, hid_t type_id,
+extern OCTINTERP_API octave_hdf5_err
+hdf5_add_scalar_attr (octave_hdf5_id loc_id, octave_hdf5_id type_id,
                       const char *attr_name, void *buf);
 
-#ifdef USE_64_BIT_IDX_T
-#define H5T_NATIVE_IDX H5T_NATIVE_INT64
-#else
-#define H5T_NATIVE_IDX H5T_NATIVE_INT
-#endif
-
 #endif
 
 #endif
--- a/libinterp/corefcn/ls-mat4.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/ls-mat4.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -498,7 +498,7 @@
       Range r = tc.range_value ();
       double base = r.base ();
       double inc = r.inc ();
-      octave_idx_type nel = r.nelem ();
+      octave_idx_type nel = r.numel ();
       for (octave_idx_type i = 0; i < nel; i++)
         {
           double x = base + i * inc;
--- a/libinterp/corefcn/ls-oct-ascii.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/ls-oct-ascii.h	Tue Jun 23 20:00:59 2015 -0700
@@ -158,7 +158,7 @@
 
           std::string tmp = buf.str ();
 
-          for (int i = 0; i < keywords.length (); i++)
+          for (int i = 0; i < keywords.numel (); i++)
             {
               int match = (tmp == keywords[i]);
 
--- a/libinterp/corefcn/lsode.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/lsode.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -88,7 +88,7 @@
 
           retval = ColumnVector (tmp(0).vector_value ());
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("lsode");
         }
       else
@@ -127,7 +127,7 @@
 
           retval = tmp(0).matrix_value ();
 
-          if (error_state || retval.length () == 0)
+          if (error_state || retval.numel () == 0)
             gripe_user_supplied_eval ("lsode");
         }
       else
@@ -300,9 +300,9 @@
       if (f_arg.is_cell ())
         {
           Cell c = f_arg.cell_value ();
-          if (c.length () == 1)
+          if (c.numel () == 1)
             f_arg = c(0);
-          else if (c.length () == 2)
+          else if (c.numel () == 2)
             {
               if (c(0).is_function_handle () || c(0).is_inline_function ())
                 lsode_fcn = c(0).function_value ();
--- a/libinterp/corefcn/lu.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/lu.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -177,13 +177,13 @@
             {
               if (!issparse)
                 error ("lu: can not define pivoting threshold THRES for full matrices");
-              else if (tmp.nelem () == 1)
+              else if (tmp.numel () == 1)
                 {
                   thres.resize (1,2);
                   thres(0) = tmp(0);
                   thres(1) = tmp(0);
                 }
-              else if (tmp.nelem () == 2)
+              else if (tmp.numel () == 2)
                 thres = tmp;
               else
                 error ("lu: expecting 2-element vector for THRES");
--- a/libinterp/corefcn/luinc.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/luinc.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -154,12 +154,12 @@
                 {
                   thresh = tmp.matrix_value ();
 
-                  if (thresh.nelem () == 1)
+                  if (thresh.numel () == 1)
                     {
                       thresh.resize (1,2);
                       thresh(1) = thresh(0);
                     }
-                  else if (thresh.nelem () != 2)
+                  else if (thresh.numel () != 2)
                     {
                       error ("luinc: expecting 2-element vector for thresh");
                       return retval;
--- a/libinterp/corefcn/matrix_type.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/matrix_type.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -292,7 +292,7 @@
                             error ("matrix_type: Invalid permutation vector PERM");
                           else
                             {
-                              octave_idx_type len = perm.length ();
+                              octave_idx_type len = perm.numel ();
                               dim_vector dv = args(0).dims ();
 
                               if (len != dv(0))
@@ -465,7 +465,7 @@
                             error ("matrix_type: Invalid permutation vector PERM");
                           else
                             {
-                              octave_idx_type len = perm.length ();
+                              octave_idx_type len = perm.numel ();
                               dim_vector dv = args(0).dims ();
 
                               if (len != dv(0))
--- a/libinterp/corefcn/max.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/max.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -271,7 +271,7 @@
             if (arg.is_range () && (dim == -1 || dim == 1))
               {
                 Range range = arg.range_value ();
-                if (range.nelem () < 1)
+                if (range.numel () < 1)
                   {
                     retval(0) = arg;
                     if (nargout > 1)
@@ -282,14 +282,14 @@
                     retval(0) = range.min ();
                     if (nargout > 1)
                       retval(1) = static_cast<double>
-                                  (range.inc () < 0 ? range.nelem () : 1);
+                                  (range.inc () < 0 ? range.numel () : 1);
                   }
                 else
                   {
                     retval(0) = range.max ();
                     if (nargout > 1)
                       retval(1) = static_cast<double>
-                                  (range.inc () >= 0 ? range.nelem () : 1);
+                                  (range.inc () >= 0 ? range.numel () : 1);
                   }
               }
             else if (arg.is_sparse_type ())
--- a/libinterp/corefcn/mgorth.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/mgorth.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -45,7 +45,7 @@
 
   h(Vc) = xnorm (x);
   if (real (h(Vc)) > 0)
-    x = x / h(Vc);
+    x /= h(Vc);
 }
 
 DEFUN (mgorth, args, nargout,
--- a/libinterp/corefcn/module.mk	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/module.mk	Tue Jun 23 20:00:59 2015 -0700
@@ -82,7 +82,7 @@
   corefcn/oct-fstrm.h \
   corefcn/oct-handle.h \
   corefcn/oct-hdf5.h \
-  corefcn/oct-hdf5-id.h \
+  corefcn/oct-hdf5-types.h \
   corefcn/oct-hist.h \
   corefcn/oct-iostrm.h \
   corefcn/oct-lvalue.h \
@@ -216,7 +216,7 @@
   corefcn/mgorth.cc \
   corefcn/nproc.cc \
   corefcn/oct-fstrm.cc \
-  corefcn/oct-hdf5-id.cc \
+  corefcn/oct-hdf5-types.cc \
   corefcn/oct-hist.cc \
   corefcn/oct-iostrm.cc \
   corefcn/oct-lvalue.cc \
@@ -233,6 +233,7 @@
   corefcn/pr-output.cc \
   corefcn/procstream.cc \
   corefcn/profiler.cc \
+  corefcn/psi.cc \
   corefcn/quad.cc \
   corefcn/quadcc.cc \
   corefcn/qz.cc \
--- a/libinterp/corefcn/oct-hdf5-id.cc	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2015 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/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "oct-hdf5.h"
-#include "oct-hdf5-id.h"
-
-bool
-check_hdf5_id_type (bool warn)
-{
-  static bool checked = false;
-  static bool ok = false;
-
-  if (! checked)
-    {
-#if defined (HAVE_HDF5)
-      ok = sizeof (octave_hdf5_id) >= sizeof (hid_t);
-
-      if (warn && ! ok)
-        warning_with_id
-          ("Octave:internal",
-           "the size of octave_hdf5_id is smaller than the size of HDF5 hid_t");
-#else
-      warning_with_id
-        ("Octave:internal",
-         "check_hdf5_id_type called but Octave was not compiled with support for HDF5");
-#endif
-
-      checked = true;
-    }
-
-  return ok;
-}
--- a/libinterp/corefcn/oct-hdf5-id.h	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-
-Copyright (C) 2015 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/>.
-
-*/
-
-#if !defined (octave_oct_hdf5_id_h)
-#define octave_oct_hdf5_id_h 1
-
-typedef int octave_hdf5_id;
-
-extern bool check_hdf5_id_type (bool warn = true);
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/oct-hdf5-types.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -0,0 +1,63 @@
+/*
+
+Copyright (C) 2015 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/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "oct-hdf5.h"
+#include "oct-hdf5-types.h"
+
+bool
+check_hdf5_types (bool warn)
+{
+  static bool checked = false;
+  static bool ok = false;
+
+  if (! checked)
+    {
+#if defined (HAVE_HDF5)
+      ok = sizeof (octave_hdf5_id) >= sizeof (hid_t);
+
+      if (warn && ! ok)
+        warning_with_id
+          ("Octave:internal",
+           "the size of octave_hdf5_id is smaller than the size of HDF5 hid_t");
+
+      ok = sizeof (octave_hdf5_err) >= sizeof (herr_t);
+
+      if (warn && ! ok)
+        warning_with_id
+          ("Octave:internal",
+           "the size of octave_hdf5_err is smaller than the size of HDF5 herr_t");
+#else
+      warning_with_id
+        ("Octave:internal",
+         "check_hdf5_id_type called but Octave was not compiled with support for HDF5");
+#endif
+
+      checked = true;
+    }
+
+  return ok;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/oct-hdf5-types.h	Tue Jun 23 20:00:59 2015 -0700
@@ -0,0 +1,31 @@
+/*
+
+Copyright (C) 2015 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/>.
+
+*/
+
+#if !defined (octave_oct_hdf5_types_h)
+#define octave_oct_hdf5_types_h 1
+
+typedef int octave_hdf5_id;
+typedef int octave_hdf5_err;
+
+extern bool check_hdf5_types (bool warn = true);
+
+#endif
--- a/libinterp/corefcn/oct-hdf5.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-hdf5.h	Tue Jun 23 20:00:59 2015 -0700
@@ -27,6 +27,14 @@
 
 #include <hdf5.h>
 
+#include "oct-hdf5-types.h"
+
+
+#ifdef USE_64_BIT_IDX_T
+#define H5T_NATIVE_IDX H5T_NATIVE_INT64
+#else
+#define H5T_NATIVE_IDX H5T_NATIVE_INT
+#endif
 #endif
 
 #endif
--- a/libinterp/corefcn/oct-hist.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-hist.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -250,7 +250,7 @@
 
   hlist = command_history::list (limit, numbered_output);
 
-  int len = hlist.length ();
+  int len = hlist.numel ();
 
   if (nargout == 0)
     {
@@ -360,7 +360,7 @@
 
   string_vector hlist = command_history::list ();
 
-  int hist_count = hlist.length () - 1;  // switch to zero-based indexing
+  int hist_count = hlist.numel () - 1;  // switch to zero-based indexing
 
   // The current command line is already part of the history list by
   // the time we get to this point.  Delete the cmd from the list when
--- a/libinterp/corefcn/oct-lvalue.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-lvalue.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -54,6 +54,21 @@
     error ("invalid index expression in assignment");
 }
 
+bool
+octave_lvalue::index_is_empty (void) const
+{
+  bool retval = false;
+
+  if (idx.size () == 1)
+    {
+      octave_value_list tmp = idx.front ();
+
+      retval = (tmp.length () == 1 && tmp(0).is_empty ());
+    }
+
+  return retval;
+}
+
 void
 octave_lvalue::do_unary_op (octave_value::unary_op op)
 {
--- a/libinterp/corefcn/oct-lvalue.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-lvalue.h	Tue Jun 23 20:00:59 2015 -0700
@@ -90,6 +90,10 @@
 
   void clear_index (void) { type = std::string (); idx.clear (); }
 
+  std::string index_type (void) const { return type; }
+
+  bool index_is_empty (void) const;
+
   void do_unary_op (octave_value::unary_op op);
 
   octave_value value (void) const;
--- a/libinterp/corefcn/oct-map.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-map.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -142,7 +142,7 @@
                                   Array<octave_idx_type>& perm) const
 {
   octave_idx_type n = nfields ();
-  if (perm.length () != n)
+  if (perm.numel () != n)
     perm.clear (1, n);
 
   return equal_up_to_order (other, perm.fortran_vec ());
--- a/libinterp/corefcn/oct-map.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-map.h	Tue Jun 23 20:00:59 2015 -0700
@@ -161,7 +161,7 @@
   octave_scalar_map (void) : xkeys (), xvals () { }
 
   octave_scalar_map (const string_vector& k)
-    : xkeys (k), xvals (k.length ()) { }
+    : xkeys (k), xvals (k.numel ()) { }
 
   octave_scalar_map (const octave_scalar_map& m)
     : xkeys (m.xkeys), xvals(m.xvals) { }
@@ -277,10 +277,10 @@
   octave_map (const dim_vector& dv) : xkeys (), xvals (), dimensions (dv) { }
 
   octave_map (const string_vector& k)
-    : xkeys (k), xvals (k.length (), Cell (1, 1)), dimensions (1, 1) { }
+    : xkeys (k), xvals (k.numel (), Cell (1, 1)), dimensions (1, 1) { }
 
   octave_map (const dim_vector& dv, const string_vector& k)
-    : xkeys (k), xvals (k.length (), Cell (dv)), dimensions (dv) { }
+    : xkeys (k), xvals (k.numel (), Cell (dv)), dimensions (dv) { }
 
   octave_map (const octave_map& m)
     : xkeys (m.xkeys), xvals (m.xvals), dimensions (m.dimensions) { }
--- a/libinterp/corefcn/oct-obj.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-obj.h	Tue Jun 23 20:00:59 2015 -0700
@@ -86,7 +86,7 @@
 
   const octave_value& operator () (octave_idx_type n) const { return elem (n); }
 
-  octave_idx_type length (void) const { return data.length (); }
+  octave_idx_type length (void) const { return data.numel (); }
 
   bool empty (void) const { return length () == 0; }
 
@@ -113,9 +113,9 @@
     octave_value_list retval
       = data.linear_slice (offset, std::min (offset + len, length ()));
 
-    if (tags && len > 0 && names.length () > 0)
+    if (tags && len > 0 && names.numel () > 0)
       retval.names = names.linear_slice (offset, std::min (offset + len,
-                                                           names.length ()));
+                                                           names.numel ()));
 
     return retval;
   }
--- a/libinterp/corefcn/oct-stream.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-stream.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -123,7 +123,7 @@
   double dnr = -1.0;
   double dnc = -1.0;
 
-  octave_idx_type sz_len = size.length ();
+  octave_idx_type sz_len = size.numel ();
 
   if (sz_len == 1)
     {
@@ -235,7 +235,7 @@
 
 scanf_format_list::~scanf_format_list (void)
 {
-  octave_idx_type n = list.length ();
+  octave_idx_type n = list.numel ();
 
   for (octave_idx_type i = 0; i < n; i++)
     {
@@ -259,7 +259,7 @@
             = new scanf_format_elt (text.c_str (), width, discard, type,
                                     modifier, char_class);
 
-          if (num_elts == list.length ())
+          if (num_elts == list.numel ())
             list.resize (dim_vector (2 * num_elts, 1));
 
           list(num_elts++) = elt;
@@ -342,13 +342,13 @@
           else
             {
               char c = s[i++];
-              width = width * 10 + c - '0';
+              width = 10 * width + c - '0';
               have_width = true;
               *buf << c;
               while (i < n && isdigit (s[i]))
                 {
                   c = s[i++];
-                  width = width * 10 + c - '0';
+                  width = 10 * width + c - '0';
                   *buf << c;
                 }
             }
@@ -489,7 +489,7 @@
 void
 scanf_format_list::printme (void) const
 {
-  octave_idx_type n = list.length ();
+  octave_idx_type n = list.numel ();
 
   for (octave_idx_type i = 0; i < n; i++)
     {
@@ -517,7 +517,7 @@
 bool
 scanf_format_list::all_character_conversions (void)
 {
-  octave_idx_type n = list.length ();
+  octave_idx_type n = list.numel ();
 
   if (n > 0)
     {
@@ -547,7 +547,7 @@
 bool
 scanf_format_list::all_numeric_conversions (void)
 {
-  octave_idx_type n = list.length ();
+  octave_idx_type n = list.numel ();
 
   if (n > 0)
     {
@@ -664,7 +664,7 @@
 
 printf_format_list::~printf_format_list (void)
 {
-  octave_idx_type n = list.length ();
+  octave_idx_type n = list.numel ();
 
   for (octave_idx_type i = 0; i < n; i++)
     {
@@ -688,7 +688,7 @@
             = new printf_format_elt (text.c_str (), args, fw, prec, flags,
                                      type, modifier);
 
-          if (num_elts == list.length ())
+          if (num_elts == list.numel ())
             list.resize (dim_vector (2 * num_elts, 1));
 
           list(num_elts++) = elt;
@@ -871,7 +871,7 @@
 void
 printf_format_list::printme (void) const
 {
-  int n = list.length ();
+  int n = list.numel ();
 
   for (int i = 0; i < n; i++)
     {
--- a/libinterp/corefcn/oct-stream.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/oct-stream.h	Tue Jun 23 20:00:59 2015 -0700
@@ -116,7 +116,7 @@
   // the list is 3 because of the characters that appear after the
   // last conversion.
 
-  octave_idx_type length (void) { return list.length (); }
+  octave_idx_type length (void) { return list.numel (); }
 
   const scanf_format_elt *first (void)
   {
@@ -125,13 +125,13 @@
   }
 
   const scanf_format_elt *current (void) const
-  { return list.length () > 0 ? list.elem (curr_idx) : 0; }
+  { return list.numel () > 0 ? list.elem (curr_idx) : 0; }
 
   const scanf_format_elt *next (bool cycle = true)
   {
     curr_idx++;
 
-    if (curr_idx >= list.length ())
+    if (curr_idx >= list.numel ())
       {
         if (cycle)
           curr_idx = 0;
@@ -260,13 +260,13 @@
   }
 
   const printf_format_elt *current (void) const
-  { return list.length () > 0 ? list.elem (curr_idx) : 0; }
+  { return list.numel () > 0 ? list.elem (curr_idx) : 0; }
 
   const printf_format_elt *next (bool cycle = true)
   {
     curr_idx++;
 
-    if (curr_idx >= list.length ())
+    if (curr_idx >= list.numel ())
       {
         if (cycle)
           curr_idx = 0;
@@ -277,7 +277,7 @@
     return current ();
   }
 
-  bool last_elt_p (void) { return (curr_idx + 1 == list.length ()); }
+  bool last_elt_p (void) { return (curr_idx + 1 == list.numel ()); }
 
   void printme (void) const;
 
--- a/libinterp/corefcn/pr-output.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/pr-output.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -393,8 +393,8 @@
             }
 
           frac = flip - step;
-          n = n * step + lastn;
-          d = d * step + lastd;
+          n = step * n + lastn;
+          d = step * d + lastd;
           lastn = nextn;
           lastd = nextd;
 
@@ -2664,7 +2664,7 @@
   double base = r.base ();
   double increment = r.inc ();
   double limit = r.limit ();
-  octave_idx_type num_elem = r.nelem ();
+  octave_idx_type num_elem = r.numel ();
 
   if (plus_format && ! pr_as_read_syntax)
     {
@@ -2886,7 +2886,7 @@
 
   if (nda.is_empty ())
     print_empty_nd_array (os, nda.dims (), pr_as_read_syntax);
-  else if (nda.length () == 1)
+  else if (nda.numel () == 1)
     {
       os << nda(0);
     }
@@ -3155,7 +3155,7 @@
 
   if (nda.is_empty ())
     print_empty_nd_array (os, nda.dims (), pr_as_read_syntax);
-  else if (nda.length () == 1)
+  else if (nda.numel () == 1)
     octave_print_internal_template (os, nda(0), pr_as_read_syntax);
   else if (plus_format && ! pr_as_read_syntax)
     {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/psi.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -0,0 +1,240 @@
+/*
+
+Copyright (C) 2015 Carnë Draug
+
+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/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ov.h"
+#include "defun.h"
+#include "error.h"
+#include "dNDArray.h"
+#include "fNDArray.h"
+
+#include "lo-specfun.h"
+
+DEFUN (psi, args, ,
+"-*- texinfo -*-\n\
+@deftypefn  {Function File} {} psi (@var{z})\n\
+@deftypefnx {Function File} {} psi (@var{k}, @var{z})\n\
+Compute the psi (polygamma) function.\n\
+\n\
+The polygamma functions are the @var{k}th derivative of the logarithm\n\
+of the gamma function.  If unspecified, @var{k} defaults to zero.  A value\n\
+of zero computes the digamma function, a value of 1, the trigamma function,\n\
+and so on.\n\
+\n\
+The digamma function is defined:\n\
+\n\
+@tex\n\
+$$\n\
+\\Psi (z) = {d (log (\\Gamma (z))) \\over dx}\n\
+$$\n\
+@end tex\n\
+@ifnottex\n\
+@example\n\
+@group\n\
+psi (z) = d (log (gamma (z))) / dx\n\
+@end group\n\
+@end example\n\
+@end ifnottex\n\
+\n\
+When computing the digamma function (when @var{k} equals zero), @var{z}\n\
+can have any value real or complex value.  However, for polygamma functions\n\
+(@var{k} higher than 0), @var{z} must be real and non-negative.\n\
+\n\
+@seealso{gamma, gammainc, gammaln}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  const octave_idx_type nargin = args.length ();
+  if (nargin < 1 || nargin > 2)
+    {
+      print_usage ();
+      return retval;
+    }
+
+  const octave_value oct_z = (nargin == 1) ? args(0) : args(1);
+  const octave_idx_type k = (nargin == 1) ? 0 : args(0).idx_type_value ();
+  if (error_state || k < 0)
+    {
+      error ("psi: K must be a non-negative integer");
+      return retval;
+    }
+  else if (k == 0)
+    {
+#define FLOAT_BRANCH(T, A, M, E) \
+      if (oct_z.is_ ## T ##_type ()) \
+        { \
+          const A ## NDArray z = oct_z.M ## array_value (); \
+          A ## NDArray psi_z (z.dims ()); \
+\
+          const E* zv = z.data (); \
+          E* psi_zv = psi_z.fortran_vec (); \
+          const octave_idx_type n = z.numel (); \
+          for (octave_idx_type i = 0; i < n; i++) \
+            *psi_zv++ = psi (*zv++); \
+\
+          retval = psi_z; \
+        }
+
+      if (oct_z.is_complex_type ())
+        {
+          FLOAT_BRANCH(double, Complex, complex_, Complex)
+          else FLOAT_BRANCH(single, FloatComplex, float_complex_, FloatComplex)
+          else
+            {
+              error ("psi: Z must be a floating point");
+            }
+        }
+      else
+        {
+          FLOAT_BRANCH(double, , , double)
+          else FLOAT_BRANCH(single, Float, float_, float)
+          else
+            {
+              error ("psi: Z must be a floating point");
+            }
+        }
+
+#undef FLOAT_BRANCH
+    }
+  else
+    {
+      if (! oct_z.is_real_type ())
+        {
+          error ("psi: Z must be real value for polygamma (K > 0)");
+          return retval;
+        }
+
+#define FLOAT_BRANCH(T, A, M, E) \
+      if (oct_z.is_ ## T ##_type ()) \
+        { \
+          const A ## NDArray z = oct_z.M ## array_value (); \
+          A ## NDArray psi_z (z.dims ()); \
+\
+          const E* zv = z.data (); \
+          E* psi_zv = psi_z.fortran_vec (); \
+          const octave_idx_type n = z.numel (); \
+          for (octave_idx_type i = 0; i < n; i++) \
+            { \
+              if (*zv < 0) \
+                { \
+                  error ("psi: Z must be non-negative for polygamma (K > 0)"); \
+                  return retval; \
+                } \
+              *psi_zv++ = psi (k, *zv++); \
+            } \
+          retval = psi_z; \
+        }
+
+      FLOAT_BRANCH(double, , , double)
+      else FLOAT_BRANCH(single, Float, float_, float)
+      else
+        {
+          error ("psi: Z must be a floating point for polygamma (K > 0)");
+        }
+
+#undef FLOAT_BRANCH
+    }
+
+  return retval;
+}
+
+/*
+%!shared em
+%! em = 0.577215664901532860606512090082402431042; # Euler-Mascheroni Constant
+
+%!assert (psi (ones (7, 3, 5)), repmat (-em, [7 3 5]))
+%!assert (psi ([0 1]), [-Inf -em])
+%!assert (psi ([-20:1]), [repmat(-Inf, [1 21]) -em])
+%!assert (psi (single ([0 1])), single ([-Inf -em]))
+
+## Abramowitz and Stegun, page 258, eq 6.3.5
+%!test
+%! z = [-10:.1:-.1 .1:.1:20]; # drop the 0
+%! assert (psi (z + 1), psi (z) + 1 ./ z, eps*1000)
+
+## Abramowitz and Stegun, page 258, eq 6.3.2
+%!assert (psi (1), -em)
+
+## Abramowitz and Stegun, page 258, eq 6.3.3
+%!assert (psi (1/2), -em - 2 * log (2))
+
+## The following tests are from Pascal Sebah and Xavier Gourdon (2002)
+## "Introduction to the Gamma Function"
+
+## Interesting identities of the digamma function, in section of 5.1.3
+%!assert (psi (1/3), - em - (3/2) * log(3) - ((sqrt (3) / 6) * pi), eps*10)
+%!assert (psi (1/4), - em -3 * log (2) - pi /2)
+%!assert (psi (1/6), - em -2 * log (2) - (3/2) * log (3) - ((sqrt (3) / 2) * pi), eps*10)
+
+## First 6 zeros of the digamma function, in section of 5.1.5 (and also on
+## Abramowitz and Stegun, page 258, eq 6.3.19)
+%!assert (psi ( 1.46163214496836234126265954232572132846819620400644), 0, eps)
+%!assert (psi (-0.504083008264455409258269304533302498955385182368579), 0, eps)
+%!assert (psi (-1.573498473162390458778286043690434612655040859116846), 0, eps)
+%!assert (psi (-2.610720868444144650001537715718724207951074010873480), 0, eps*10)
+%!assert (psi (-3.635293366436901097839181566946017713948423861193530), 0, eps*10)
+%!assert (psi (-4.653237761743142441714598151148207363719069416133868), 0, eps*100)
+
+## Tests for complex values
+%!shared z
+%! z = [-10:.1:-.1 .1:.1:20]; # drop the 0
+
+## Abramowitz and Stegun, page 259 eq 6.3.10
+%!assert (real (psi (i*z)), real (psi (1 - i*z)))
+
+## Abramowitz and Stegun, page 259 eq 6.3.11
+%!assert (imag (psi (i*z)), 1/2 .* 1./z + 1/2 * pi * coth (pi * z), eps *10)
+
+## Abramowitz and Stegun, page 259 eq 6.3.12
+%!assert (imag (psi (1/2 + i*z)), 1/2 * pi * tanh (pi * z), eps)
+
+## Abramowitz and Stegun, page 259 eq 6.3.13
+%!assert (imag (psi (1 + i*z)), - 1./(2*z) + 1/2 * pi * coth (pi * z), eps*10)
+
+## Abramowitz and Stegun, page 260 eq 6.4.5
+%!test
+%! for z = 0:20
+%!   assert (psi (1, z + 0.5), 0.5 * (pi^2) - 4 * sum ((2*(1:z) -1) .^(-2)), eps*10)
+%! endfor
+
+## Abramowitz and Stegun, page 260 eq 6.4.6
+%!test
+%! z = 0.1:0.1:20;
+%! for n = 0:8
+%!   ## our precision goes down really quick when computing n is too high,
+%!   assert (psi (n, z+1), psi (n, z) + ((-1)^n) * factorial (n) * (z.^(-n-1)), 0.1)
+%! endfor
+
+## Test input validation
+%!error psi ()
+%!error psi (1, 2, 3)
+%!error <Z must be> psi ("non numeric")
+%!error <K must be a non-negative integer> psi (-5, 1)
+%!error <Z must be non-negative for polygamma> psi (5, -1)
+%!error <Z must be a floating point> psi (5, uint8 (-1))
+%!error <Z must be real value for polygamma> psi (5, 5i)
+
+*/
--- a/libinterp/corefcn/quad.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/quad.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -312,7 +312,7 @@
               if (error_state)
                 QUAD_ABORT1 ("expecting vector of tolerances as fifth argument");
 
-              switch (tol.capacity ())
+              switch (tol.numel ())
                 {
                 case 2:
                   quad_opts.set_single_precision_relative_tolerance (tol (1));
@@ -421,7 +421,7 @@
               if (error_state)
                 QUAD_ABORT1 ("expecting vector of tolerances as fifth argument");
 
-              switch (tol.capacity ())
+              switch (tol.numel ())
                 {
                 case 2:
                   quad_opts.set_relative_tolerance (tol (1));
--- a/libinterp/corefcn/quadcc.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/quadcc.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -1713,7 +1713,7 @@
           return retval;
         }
       Matrix effex = fvals(0).matrix_value ();
-      if (effex.length () != ex.length ())
+      if (effex.numel () != ex.numel ())
         {
           error ("quadcc: integrand F must return a single, real-valued vector of the same size as the input");
           return retval;
@@ -1832,12 +1832,12 @@
                 return retval;
               }
             Matrix effex = fvals(0).matrix_value ();
-            if (effex.length () != ex.length ())
+            if (effex.numel () != ex.numel ())
               {
                 error ("quadcc: integrand F must return a single, real-valued vector of the same size as the input");
                 return retval;
               }
-            neval += effex.length ();
+            neval += effex.numel ();
             for (i = 0; i < n[d] / 2; i++)
               {
                 j = (2 * i + 1) * skip[d];
@@ -1980,12 +1980,12 @@
                 return retval;
               }
             Matrix effex = fvals(0).matrix_value ();
-            if (effex.length () != ex.length ())
+            if (effex.numel () != ex.numel ())
               {
                 error ("quadcc: integrand F must return a single, real-valued vector of the same size as the input");
                 return retval;
               }
-            neval += effex.length ();
+            neval += effex.numel ();
             for (i = 0; i < n[0] - 1; i++)
               {
                 j = (i + 1) * skip[0];
@@ -2076,12 +2076,12 @@
                 return retval;
               }
             Matrix effex = fvals(0).matrix_value ();
-            if (effex.length () != ex.length ())
+            if (effex.numel () != ex.numel ())
               {
                 error ("quadcc: integrand F must return a single, real-valued vector of the same size as the input");
                 return retval;
               }
-            neval += effex.length ();
+            neval += effex.numel ();
             for (i = 0; i < n[0] - 1; i++)
               {
                 j = (i + 1) * skip[0];
--- a/libinterp/corefcn/rand.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/rand.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -190,7 +190,7 @@
 
             if (r.all_elements_are_ints ())
               {
-                octave_idx_type n = r.nelem ();
+                octave_idx_type n = r.numel ();
 
                 dims.resize (n);
 
@@ -218,7 +218,7 @@
 
             if (! error_state)
               {
-                octave_idx_type len = iv.length ();
+                octave_idx_type len = iv.numel ();
 
                 dims.resize (len);
 
@@ -317,7 +317,7 @@
     {
       if (additional_arg)
         {
-          if (a.length () == 1)
+          if (a.numel () == 1)
             return octave_rand::float_nd_array (dims, a(0));
           else
             {
@@ -326,7 +326,7 @@
                   error ("%s: mismatch in argument size", fcn);
                   return retval;
                 }
-              octave_idx_type len = a.length ();
+              octave_idx_type len = a.numel ();
               FloatNDArray m (dims);
               float *v = m.fortran_vec ();
               for (octave_idx_type i = 0; i < len; i++)
@@ -341,7 +341,7 @@
     {
       if (additional_arg)
         {
-          if (a.length () == 1)
+          if (a.numel () == 1)
             return octave_rand::nd_array (dims, a(0));
           else
             {
@@ -350,7 +350,7 @@
                   error ("%s: mismatch in argument size", fcn);
                   return retval;
                 }
-              octave_idx_type len = a.length ();
+              octave_idx_type len = a.numel ();
               NDArray m (dims);
               double *v = m.fortran_vec ();
               for (octave_idx_type i = 0; i < len; i++)
--- a/libinterp/corefcn/regexp.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/regexp.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -77,13 +77,38 @@
               retval[++i] = 'b';
               break;
 
-#if 0
-// FIXME: To be complete, we need to handle \oN, \o{N}.
-//        The PCRE library already handles \N where N
-//        is an octal number.  New code needs to merely
-//        replace \oN or \o{N} with \N.
-            case 'o': // octal number
-#endif
+            case 'o': // octal input
+            {
+              bool bad_esc_seq = (j+1 >= len);
+
+              bool brace = false;
+              if (! bad_esc_seq && s[++j] == '{')
+                {
+                  brace = true;
+                  j++;
+                }
+
+              int tmpi = 0;
+              size_t k;
+              for (k = j; k < std::min (j+3+brace, len); k++)
+                {
+                  int digit = s[k] - '0';
+                  if (digit < 0 || digit > 7)
+                    break;
+                  tmpi <<= 3;
+                  tmpi += digit;
+                }
+              if (bad_esc_seq || (brace && s[k++] != '}'))
+                {
+                  bad_esc_seq = true;
+                  tmpi = 0;
+                  warning ("malformed octal escape sequence '\\o' --\
+ converting to '\\0'");
+                }
+              retval[i] = tmpi;
+              j = k - 1;
+              break;
+            }
 
             default:  // pass escape sequence through
               retval[i] = '\\';
@@ -150,14 +175,75 @@
               retval[i] = '\v';
               break;
 
-#if 0
-// FIXME: to be complete, we need to handle \oN, \o{N}, \xN, and
-// \x{N}.  Hex digits may be upper or lower case.  Brackets are
-// optional, so \x5Bz is the same as \x{5B}z.
+            case 'o': // octal input
+            {
+              bool bad_esc_seq = (j+1 >= len);
+
+              bool brace = false;
+              if (! bad_esc_seq && s[++j] == '{')
+                {
+                  brace = true;
+                  j++;
+                }
+
+              int tmpi = 0;
+              size_t k;
+              for (k = j; k < std::min (j+3+brace, len); k++)
+                {
+                  int digit = s[k] - '0';
+                  if (digit < 0 || digit > 7)
+                    break;
+                  tmpi <<= 3;
+                  tmpi += digit;
+                }
+              if (bad_esc_seq || (brace && s[k++] != '}'))
+                {
+                  warning ("malformed octal escape sequence '\\o' --\
+ converting to '\\0'");
+                  tmpi = 0;
+                }
+              retval[i] = tmpi;
+              j = k - 1;
+              break;
+            }
 
-            case 'o': // octal number
-            case 'x': // hex number
-#endif
+            case 'x': // hex input
+            {
+              bool bad_esc_seq = (j+1 >= len);
+
+              bool brace = false;
+              if (! bad_esc_seq && s[++j] == '{')
+                {
+                  brace = true;
+                  j++;
+                }
+
+              int tmpi = 0;
+              size_t k;
+              for (k = j; k < std::min (j+2+brace, len); k++)
+                {
+                  if (! isxdigit (s[k]))
+                    break;
+
+                  tmpi <<= 4;
+                  int digit = s[k];
+                  if (digit >= 'a')
+                    tmpi += digit - 'a' + 10;
+                  else if (digit >= 'A')
+                    tmpi += digit - 'A' + 10;
+                  else
+                    tmpi += digit - '0';
+                }
+              if (bad_esc_seq || (brace && s[k++] != '}'))
+                {
+                  warning ("malformed hex escape sequence '\\x' --\
+ converting to '\\0'");
+                  tmpi = 0;
+                }
+              retval[i] = tmpi;
+              j = k - 1;
+              break;
+            }
 
             default:  // pass escape sequence through
               retval[i] = '\\';
@@ -282,14 +368,14 @@
         {
           string_vector named_tokens = rx_lst.begin ()->named_tokens ();
 
-          for (int j = 0; j < named_pats.length (); j++)
+          for (int j = 0; j < named_pats.numel (); j++)
             nmap.assign (named_pats(j), named_tokens(j));
 
           retval(5) = nmap;
         }
       else
         {
-          for (int j = 0; j < named_pats.length (); j++)
+          for (int j = 0; j < named_pats.numel (); j++)
             {
               Cell tmp (dim_vector (1, sz));
 
@@ -354,7 +440,7 @@
               double e = p->end ();
 
               string_vector tmp = p->tokens ();
-              tokens(i) = Cell (dim_vector (1, tmp.length ()), tmp);
+              tokens(i) = Cell (dim_vector (1, tmp.numel ()), tmp);
               match_string(i) = p->match_string ();
               token_extents(i) = p->token_extents ();
               end(i) = e;
--- a/libinterp/corefcn/strfns.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/strfns.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -103,8 +103,8 @@
               return retval;
             }
 
-          if (s.length () > 0)
-            n_elts += s.length ();
+          if (s.numel () > 0)
+            n_elts += s.numel ();
           else
             n_elts += 1;
 
@@ -125,7 +125,7 @@
           string_vector s = args_as_strings.front ();
           args_as_strings.pop ();
 
-          int n = s.length ();
+          int n = s.numel ();
 
           if (n > 0)
             {
@@ -210,78 +210,70 @@
   octave_value retval;
 
   int nargin = args.length ();
-
-  if (nargin > 0)
-    {
-      int n_elts = 0;
-
-      size_t max_len = 0;
-
-      std::queue<string_vector> args_as_strings;
+  int n_elts = 0;
+  size_t max_len = 0;
+  std::queue<string_vector> args_as_strings;
 
-      for (int i = 0; i < nargin; i++)
-        {
-          string_vector s = args(i).all_strings ();
-
-          if (error_state)
-            {
-              error ("strvcat: unable to convert some args to strings");
-              return retval;
-            }
+  for (int i = 0; i < nargin; i++)
+    {
+      string_vector s = args(i).all_strings ();
 
-          size_t n = s.length ();
+      if (error_state)
+        {
+          error ("strvcat: unable to convert some args to strings");
+          return retval;
+        }
 
-          // do not count empty strings in calculation of number of elements
-          if (n > 0)
+      size_t n = s.numel ();
+
+      // do not count empty strings in calculation of number of elements
+      if (n > 0)
+        {
+          for (size_t j = 0; j < n; j++)
             {
-              for (size_t j = 0; j < n; j++)
-                {
-                  if (s[j].length () > 0)
-                    n_elts++;
-                }
+              if (s[j].length () > 0)
+                n_elts++;
             }
-
-          size_t s_max_len = s.max_length ();
-
-          if (s_max_len > max_len)
-            max_len = s_max_len;
-
-          args_as_strings.push (s);
         }
 
-      string_vector result (n_elts);
+      size_t s_max_len = s.max_length ();
+
+      if (s_max_len > max_len)
+        max_len = s_max_len;
+
+      args_as_strings.push (s);
+    }
+
+  string_vector result (n_elts);
 
-      octave_idx_type k = 0;
+  octave_idx_type k = 0;
 
-      for (int i = 0; i < nargin; i++)
+  for (int i = 0; i < nargin; i++)
+    {
+      string_vector s = args_as_strings.front ();
+      args_as_strings.pop ();
+
+      size_t n = s.numel ();
+
+      if (n > 0)
         {
-          string_vector s = args_as_strings.front ();
-          args_as_strings.pop ();
-
-          size_t n = s.length ();
-
-          if (n > 0)
+          for (size_t j = 0; j < n; j++)
             {
-              for (size_t j = 0; j < n; j++)
+              std::string t = s[j];
+              if (t.length () > 0)
                 {
-                  std::string t = s[j];
-                  if (t.length () > 0)
-                    {
-                      size_t t_len = t.length ();
+                  size_t t_len = t.length ();
 
-                      if (max_len > t_len)
-                        t += std::string (max_len - t_len, ' ');
+                  if (max_len > t_len)
+                    t += std::string (max_len - t_len, ' ');
 
-                      result[k++] = t;
-                    }
+                  result[k++] = t;
                 }
             }
         }
+    }
 
-      retval = octave_value (result, '\'');
-    }
-  else
-    print_usage ();
+  retval = octave_value (result, '\'');
 
   return retval;
 }
@@ -298,8 +290,7 @@
 %!assert (strvcat ({100,{100, {""}}}), ["d";"d"])
 %!assert (strvcat (["a";"be"], {"c", 100}), ["a";"be";"c";"d"])
 %!assert (strvcat ("a", "bb", "ccc"), ["a  "; "bb "; "ccc"])
-
-%!error strvcat ()
+%!assert (strvcat (), "")
 */
 
 
@@ -374,7 +365,7 @@
 
       const Cell cell = cell_val.cell_value ();
       const string_vector str = str_val.all_strings ();
-      octave_idx_type r = str.length ();
+      octave_idx_type r = str.numel ();
 
       if (r == 0 || r == 1)
         {
@@ -387,13 +378,13 @@
           if (cell_val.is_cellstr ())
             {
               const Array<std::string> cellstr = cell_val.cellstr_value ();
-              for (octave_idx_type i = 0; i < cellstr.length (); i++)
+              for (octave_idx_type i = 0; i < cellstr.numel (); i++)
                 output(i) = str_op (cellstr(i), s, n);
             }
           else
             {
               // FIXME: should we warn here?
-              for (octave_idx_type i = 0; i < cell.length (); i++)
+              for (octave_idx_type i = 0; i < cell.numel (); i++)
                 {
                   if (cell(i).is_string ())
                     output(i) = str_op (cell(i).string_value (), s, n);
@@ -404,7 +395,7 @@
         }
       else if (r > 1)
         {
-          if (cell.length () == 1)
+          if (cell.numel () == 1)
             {
               // Broadcast the cell.
 
@@ -427,13 +418,13 @@
 
               boolNDArray output (cell.dims (), false);
 
-              if (cell.length () == r)
+              if (cell.numel () == r)
                 {
                   if (cell_val.is_cellstr ())
                     {
                       const Array<std::string> cellstr
                         = cell_val.cellstr_value ();
-                      for (octave_idx_type i = 0; i < cellstr.length (); i++)
+                      for (octave_idx_type i = 0; i < cellstr.numel (); i++)
                         output(i) = str_op (str[i], cellstr(i), n);
                     }
                   else
@@ -493,7 +484,7 @@
               if (cell1_val.is_cellstr ())
                 {
                   const Array<std::string> cellstr = cell1_val.cellstr_value ();
-                  for (octave_idx_type i = 0; i < cellstr.length (); i++)
+                  for (octave_idx_type i = 0; i < cellstr.numel (); i++)
                     output(i) = str_op (cellstr(i), str2, n);
                 }
               else
--- a/libinterp/corefcn/sub2ind.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/sub2ind.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -39,7 +39,7 @@
 {
   RowVector dimsv = val.row_vector_value (false, true);
   dim_vector dv;
-  octave_idx_type n = dimsv.length ();
+  octave_idx_type n = dimsv.numel ();
 
   if (n < 1)
     error ("%s: dimension vector DIMS must not be empty", name);
--- a/libinterp/corefcn/symtab.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/symtab.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -44,6 +44,7 @@
 #include "pager.h"
 #include "parse.h"
 #include "pt-arg-list.h"
+#include "pt-pr-code.h"
 #include "symtab.h"
 #include "unwind-prot.h"
 #include "utils.h"
@@ -1810,6 +1811,44 @@
   return retval;
 }
 
+DEFUN (__get_cmdline_fcn_txt__, args, ,
+       "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} __get_cmdline_fcn_txt__ (@var{name})\n\
+Undocumented internal function.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    {
+      std::string name = args(0).string_value ();
+
+      if (! error_state)
+        {
+          octave_value ov = symbol_table::find_cmdline_function (name);
+
+          octave_user_function *f = ov.user_function_value ();
+
+          if (f)
+            {
+              std::ostringstream buf;
+
+              tree_print_code tpc (buf);
+
+              f->accept (tpc);
+
+              retval = buf.str ();
+            }
+        }
+      else
+        error ("__get_cmd_line_function_text__: expecting function name");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
 #if 0
 
 // FIXME: should we have functions like this in Octave?
--- a/libinterp/corefcn/symtab.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/symtab.h	Tue Jun 23 20:00:59 2015 -0700
@@ -1548,6 +1548,14 @@
            ? p->second.find_user_function () : octave_value ();
   }
 
+  static octave_value find_cmdline_function (const std::string& name)
+  {
+    fcn_table_iterator p = fcn_table.find (name);
+
+    return (p != fcn_table.end ())
+           ? p->second.find_cmdline_function () : octave_value ();
+  }
+
   static void install_cmdline_function (const std::string& name,
                                         const octave_value& fcn)
   {
@@ -2044,7 +2052,7 @@
   {
     std::list<symbol_record> retval;
 
-    size_t len = patterns.length ();
+    size_t len = patterns.numel ();
 
     for (size_t i = 0; i < len; i++)
       {
@@ -2061,7 +2069,7 @@
   {
     std::list<symbol_record> retval;
 
-    size_t len = patterns.length ();
+    size_t len = patterns.numel ();
 
     for (size_t i = 0; i < len; i++)
       {
--- a/libinterp/corefcn/syscalls.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/syscalls.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -204,7 +204,7 @@
 
               if (! error_state)
                 {
-                  int len = tmp.length ();
+                  int len = tmp.numel ();
 
                   exec_args.resize (len + 1);
 
@@ -316,7 +316,7 @@
 
               if (! error_state)
                 {
-                  int len = tmp.length ();
+                  int len = tmp.numel ();
 
                   arg_list.resize (len + 1);
 
@@ -819,15 +819,45 @@
   return retval;
 }
 
+// FIXME: This routine also exists verbatim in file-io.cc.
+//        Maybe change to be a general utility routine.
+static int
+convert (int x, int ibase, int obase)
+{
+  int retval = 0;
+
+  int tmp = x % obase;
+
+  if (tmp > ibase - 1)
+    ::error ("mkfifo: invalid digit");
+  else
+    {
+      retval = tmp;
+      int mult = ibase;
+      while ((x = (x - tmp) / obase))
+        {
+          tmp = x % obase;
+          if (tmp > ibase - 1)
+            {
+              ::error ("mkfifo: invalid digit");
+              break;
+            }
+          retval += mult * tmp;
+          mult *= ibase;
+        }
+    }
+
+  return retval;
+}
+
 DEFUNX ("mkfifo", Fmkfifo, args, ,
         "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {@var{err} =} mkfifo (@var{name}, @var{mode})\n\
 @deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} mkfifo (@var{name}, @var{mode})\n\
 Create a FIFO special file named @var{name} with file mode @var{mode}.\n\
 \n\
-@var{mode} is interpreted as a decimal number (@emph{not} octal) and is\n\
-subject to umask processing.  The final calculated mode is\n\
-@code{@var{mode} - @var{umask}}.\n\
+@var{mode} is interpreted as an octal number and is subject to umask\n\
+processing.  The final calculated mode is @code{@var{mode} - @var{umask}}.\n\
 \n\
 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\
 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent\n\
@@ -835,7 +865,7 @@
 @seealso{pipe, umask}\n\
 @end deftypefn")
 {
-  octave_value_list retval;
+  octave_value_list retval (2);
 
   retval(1) = std::string ();
   retval(0) = -1;
@@ -848,23 +878,28 @@
         {
           std::string name = args(0).string_value ();
 
-          if (args(1).is_scalar_type ())
-            {
-              long mode = args(1).long_value ();
+          int octal_mode = args(1).int_value ();
 
-              if (! error_state)
+          if (! error_state)
+            {
+              if (octal_mode < 0)
+                error ("mkfifo: MODE must be a positive integer value");
+              else
                 {
-                  std::string msg;
+                  int mode = convert (octal_mode, 8, 10);
 
-                  int status = octave_mkfifo (name, mode, msg);
+                  if (! error_state)
+                    {
+                      std::string msg;
 
-                  retval(0) = status;
+                      int status = octave_mkfifo (name, mode, msg);
 
-                  if (status < 0)
-                    retval(1) = msg;
+                      retval(0) = status;
+
+                      if (status < 0)
+                        retval(1) = msg;
+                    }
                 }
-              else
-                error ("mkfifo: invalid MODE");
             }
           else
             error ("mkfifo: MODE must be an integer");
@@ -878,6 +913,19 @@
   return retval;
 }
 
+/*
+
+## Test input validation
+%!error mkfifo ()
+%!error mkfifo ("abc")
+%!error mkfifo ("abc", 777, 123)
+%!error <FILE must be a string> mkfifo (123, 456)
+## FIXME: These tests should work, but lasterr is not being set correctly.
+#%!error <MODE must be an integer> mkfifo ("abc", {456})
+#%!error <MODE must be a positive integer value> mkfifo ("abc", -1)
+
+*/
+
 DEFUNX ("pipe", Fpipe, args, ,
         "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {[@var{read_fd}, @var{write_fd}, @var{err}, @var{msg}] =} pipe ()\n\
--- a/libinterp/corefcn/tril.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/tril.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -218,7 +218,7 @@
       dim_vector dims = arg.dims ();
       if (dims.length () != 2)
         error ("%s: need a 2-D matrix", name.c_str ());
-      else if (k < -dims (0) || k > dims(1))
+      else if (k < -dims(0) || k > dims(1))
         error ("%s: requested diagonal out of range", name.c_str ());
       else
         {
--- a/libinterp/corefcn/tsearch.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/tsearch.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -103,7 +103,7 @@
       maxy(k) = max (REF (y, k, 0), REF (y, k, 1), REF (y, k, 2)) + eps;
     }
 
-  const octave_idx_type np = xi.length ();
+  const octave_idx_type np = xi.numel ();
   ColumnVector values (np);
 
   double x0, y0, a11, a12, a21, a22, det;
--- a/libinterp/corefcn/typecast.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/typecast.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -40,7 +40,7 @@
 {
   if (old_dims.length () == 2 && old_dims(0) == 1)
     return dim_vector (1, n);
-  else if (old_dims.length () == 2 && old_dims (0) == 0 && old_dims (1) == 0)
+  else if (old_dims.length () == 2 && old_dims(0) == 0 && old_dims(1) == 0)
     return dim_vector ();
   else
     return dim_vector (n, 1);
--- a/libinterp/corefcn/urlwrite.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/urlwrite.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -712,7 +712,7 @@
           else
             {
               string_vector sv = curl.list ();
-              octave_idx_type n = sv.length ();
+              octave_idx_type n = sv.numel ();
 
               if (n == 0)
                 {
@@ -1050,7 +1050,7 @@
               glob_match pattern (file_ops::tilde_expand (pat));
               string_vector files = pattern.glob ();
 
-              for (octave_idx_type i = 0; i < files.length (); i++)
+              for (octave_idx_type i = 0; i < files.numel (); i++)
                 {
                   std::string file = files (i);
 
@@ -1145,7 +1145,7 @@
               glob_match pattern (file);
 
 
-              for (octave_idx_type i = 0; i < sv.length (); i++)
+              for (octave_idx_type i = 0; i < sv.numel (); i++)
                 {
                   if (pattern.match (sv(i)))
                     {
--- a/libinterp/corefcn/utils.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/utils.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -267,7 +267,7 @@
 
   string_vector sv = p.find_all_first_of (names);
 
-  octave_idx_type len = sv.length ();
+  octave_idx_type len = sv.numel ();
 
   for (octave_idx_type i = 0; i < len; i++)
     sv[i] = octave_env::make_absolute (sv[i]);
@@ -278,7 +278,7 @@
 static string_vector
 make_absolute (const string_vector& sv)
 {
-  octave_idx_type len = sv.length ();
+  octave_idx_type len = sv.numel ();
 
   string_vector retval (len);
 
@@ -316,7 +316,7 @@
     {
       string_vector names = args(0).all_strings ();
 
-      if (! error_state && names.length () > 0)
+      if (! error_state && names.numel () > 0)
         {
           if (nargin == 1)
             retval =
@@ -399,7 +399,7 @@
 
           string_vector names = args(1).all_strings ();
 
-          if (! error_state && names.length () > 0)
+          if (! error_state && names.numel () > 0)
             {
               if (nargin == 2)
                 retval = search_path_for_file (path, names);
@@ -631,11 +631,7 @@
         {
           switch (s[++j])
             {
-            case '0':
-              retval[i] = '\0';
-              break;
-
-            case 'a':
+            case 'a': // alarm
               retval[i] = '\a';
               break;
 
@@ -675,6 +671,58 @@
               retval[i] = '"';
               break;
 
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7': // octal input
+            {
+              size_t k;
+              int tmpi = s[j] - '0';
+              for (k = j+1; k < std::min (j+3, len); k++)
+                {
+                  int digit = s[k] - '0';
+                  if (digit < 0 || digit > 7)
+                    break;
+                  tmpi <<= 3;
+                  tmpi += digit;
+                }
+              retval[i] = tmpi;
+              j = k - 1;
+              break;
+            }
+
+            case 'x': // hex input
+            {
+              size_t k;
+              int tmpi = 0;
+              for (k = j+1; k < std::min (j+3, len); k++)
+                {
+                  if (! isxdigit (s[k]))
+                    break;
+
+                  tmpi <<= 4;
+                  int digit = s[k];
+                  if (digit >= 'a')
+                    tmpi += digit - 'a' + 10;
+                  else if (digit >= 'A')
+                    tmpi += digit - 'A' + 10;
+                  else
+                    tmpi += digit - '0';
+                }
+
+              if (k == j+1)
+                warning ("malformed hex escape sequence '\\x' --\
+ converting to '\\0'");
+
+              retval[i] = tmpi;
+              j = k - 1;
+              break;
+            }
+
             default:
               warning ("unrecognized escape sequence '\\%c' --\
  converting to '%c'", s[j], s[j]);
@@ -745,9 +793,20 @@
 %!assert (do_string_escapes ('\"double-quoted\"'), "\"double-quoted\"")
 %!assert (do_string_escapes ("\\\"double-quoted\\\""), "\"double-quoted\"")
 
+%!assert (do_string_escapes ('A\4B'), ["A" char(4) "B"])
+%!assert (do_string_escapes ('A\45B'), ["A" char(37) "B"])
+%!assert (do_string_escapes ('A\123B'), ["A" char(83) "B"])
+%!assert (sprintf ('\117\143\164\141\166\145'), "Octave")
+
+%!assert (do_string_escapes ('A\x4G'), ["A" char(4) "G"])
+%!assert (do_string_escapes ('A\x4AG'), ["A" char(74) "G"])
+%!assert (sprintf ('\x4f\x63\x74\x61\x76\x65'), "Octave")
+
 %!error do_string_escapes ()
 %!error do_string_escapes ("foo", "bar")
-%!error do_string_escapes (3)
+%!error <STRING argument> do_string_escapes (3)
+%!warning <malformed hex escape sequence> do_string_escapes ('\xG');
+%!warning <unrecognized escape sequence> do_string_escapes ('\G');
 */
 
 const char *
@@ -1159,7 +1218,7 @@
           if (error_state)
             return;
 
-          octave_idx_type n = v.length ();
+          octave_idx_type n = v.numel ();
           dim.resize (n);
           for (octave_idx_type i = 0; i < n; i++)
             dim(i) = static_cast<int> (fix (v(i)));
--- a/libinterp/corefcn/variables.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/variables.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -395,6 +395,14 @@
   bool search_dir = type == "dir";
   bool search_file = type == "file";
   bool search_builtin = type == "builtin";
+  bool search_class = type == "class";
+
+  if (! (search_any || search_var || search_dir || search_file ||
+         search_builtin || search_class))
+    {
+      error ("exist: unrecognized type argument \"%s\"", type.c_str ());
+      return 0;
+    }
 
   if (search_any || search_var)
     {
@@ -682,6 +690,7 @@
 %!warning <"class" type argument is not implemented> exist ("a", "class");
 %!error <TYPE must be a string> exist ("a", 1)
 %!error <NAME must be a string> exist (1)
+%!error <unrecognized type argument "foobar"> exist ("a", "foobar")
 
 */
 
@@ -1247,7 +1256,7 @@
                   break;
 
                 case 'e':
-                  os << varval.capacity ();
+                  os << varval.numel ();
                   break;
 
                 case 'n':
@@ -1395,7 +1404,7 @@
 
             octave_value val = p->varval;
 
-            elements += val.capacity ();
+            elements += val.numel ();
             bytes += val.byte_size ();
           }
 
@@ -1467,7 +1476,7 @@
                                 > static_cast<size_t> (param_length(pos_t)))
                                ? str.length () : param_length(pos_t));
 
-        elements1 = val.capacity ();
+        elements1 = val.numel ();
         ss1 << elements1;
         str = ss1.str ();
         param_length(pos_e) = ((str.length ()
@@ -2208,7 +2217,7 @@
         {
           string_vector fcns = symbol_table::user_function_names ();
 
-          int fcount = fcns.length ();
+          int fcount = fcns.numel ();
 
           for (int i = 0; i < fcount; i++)
             {
@@ -2234,7 +2243,7 @@
     {
       string_vector gvars = symbol_table::global_variable_names ();
 
-      int gcount = gvars.length ();
+      int gcount = gvars.numel ();
 
       for (int i = 0; i < gcount; i++)
         symbol_table::clear_global (gvars[i]);
@@ -2245,7 +2254,7 @@
         {
           string_vector gvars = symbol_table::global_variable_names ();
 
-          int gcount = gvars.length ();
+          int gcount = gvars.numel ();
 
           for (int i = 0; i < gcount; i++)
             {
@@ -2275,7 +2284,7 @@
         {
           string_vector lvars = symbol_table::variable_names ();
 
-          int lcount = lvars.length ();
+          int lcount = lvars.numel ();
 
           for (int i = 0; i < lcount; i++)
             {
--- a/libinterp/corefcn/xdiv.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/xdiv.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -289,7 +289,7 @@
 {
   NDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result (i) = a / b (i);
@@ -303,7 +303,7 @@
 {
   ComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result (i) = a / b (i);
@@ -317,7 +317,7 @@
 {
   ComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result (i) = a / b (i);
@@ -331,7 +331,7 @@
 {
   ComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result (i) = a / b (i);
@@ -590,7 +590,7 @@
 {
   FloatNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result (i) = a / b (i);
@@ -604,7 +604,7 @@
 {
   FloatComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result (i) = a / b (i);
@@ -618,7 +618,7 @@
 {
   FloatComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result (i) = a / b (i);
@@ -632,7 +632,7 @@
 {
   FloatComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result (i) = a / b (i);
--- a/libinterp/corefcn/xpow.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/corefcn/xpow.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -705,10 +705,10 @@
 
   // Only optimize powers with ranges that are integer and monotonic in
   // magnitude.
-  if (r.nelem () > 1 && r.all_elements_are_ints ()
+  if (r.numel () > 1 && r.all_elements_are_ints ()
       && same_sign (r.base (), r.limit ()))
     {
-      octave_idx_type n = r.nelem ();
+      octave_idx_type n = r.numel ();
       Matrix result (1, n);
       if (same_sign (r.base (), r.inc ()))
         {
@@ -940,10 +940,10 @@
 
   // Only optimize powers with ranges that are integer and monotonic in
   // magnitude.
-  if (r.nelem () > 1 && r.all_elements_are_ints ()
+  if (r.numel () > 1 && r.all_elements_are_ints ()
       && same_sign (r.base (), r.limit ()))
     {
-      octave_idx_type n = r.nelem ();
+      octave_idx_type n = r.numel ();
       ComplexMatrix result (1, n);
 
       if (same_sign (r.base (), r.inc ()))
@@ -1121,7 +1121,7 @@
     {
       Complex atmp (a);
       ComplexNDArray result (b.dims ());
-      for (octave_idx_type i = 0; i < b.length (); i++)
+      for (octave_idx_type i = 0; i < b.numel (); i++)
         {
           octave_quit ();
           result(i) = std::pow (atmp, b(i));
@@ -1132,7 +1132,7 @@
   else
     {
       NDArray result (b.dims ());
-      for (octave_idx_type i = 0; i < b.length (); i++)
+      for (octave_idx_type i = 0; i < b.numel (); i++)
         {
           octave_quit ();
           result (i) = std::pow (a, b(i));
@@ -1150,7 +1150,7 @@
 {
   ComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a, b(i));
@@ -1171,7 +1171,7 @@
         {
           ComplexNDArray result (a.dims ());
 
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             {
               octave_quit ();
 
@@ -1185,7 +1185,7 @@
       else
         {
           NDArray result (a.dims ());
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             {
               octave_quit ();
               result(i) = std::pow (a(i), b);
@@ -1201,22 +1201,22 @@
       int ib = static_cast<int> (b);
       if (ib == 2)
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             result(i) = a(i) * a(i);
         }
       else if (ib == 3)
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             result(i) = a(i) * a(i) * a(i);
         }
       else if (ib == -1)
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             result(i) = 1.0 / a(i);
         }
       else
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             {
               octave_quit ();
               result(i) = std::pow (a(i), ib);
@@ -1257,7 +1257,7 @@
         }
     }
 
-  int len = a.length ();
+  int len = a.numel ();
 
   bool convert_to_complex = false;
 
@@ -1310,7 +1310,7 @@
 {
   ComplexNDArray result (a.dims ());
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a(i), b);
@@ -1341,7 +1341,7 @@
 
   ComplexNDArray result (a_dims);
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a(i), b(i));
@@ -1356,7 +1356,7 @@
 {
   ComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       double btmp = b(i);
@@ -1375,7 +1375,7 @@
 {
   ComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a, b(i));
@@ -1394,12 +1394,12 @@
     {
       if (b == -1)
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             result.xelem (i) = 1.0 / a(i);
         }
       else
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             {
               octave_quit ();
               result(i) = std::pow (a(i), static_cast<int> (b));
@@ -1408,7 +1408,7 @@
     }
   else
     {
-      for (octave_idx_type i = 0; i < a.length (); i++)
+      for (octave_idx_type i = 0; i < a.numel (); i++)
         {
           octave_quit ();
           result(i) = std::pow (a(i), b);
@@ -1440,7 +1440,7 @@
 
   ComplexNDArray result (a_dims);
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       double btmp = b(i);
@@ -1459,7 +1459,7 @@
 {
   ComplexNDArray result (a.dims ());
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a(i), b);
@@ -1490,7 +1490,7 @@
 
   ComplexNDArray result (a_dims);
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a(i), b(i));
@@ -2471,7 +2471,7 @@
     {
       FloatComplex atmp (a);
       FloatComplexNDArray result (b.dims ());
-      for (octave_idx_type i = 0; i < b.length (); i++)
+      for (octave_idx_type i = 0; i < b.numel (); i++)
         {
           octave_quit ();
           result(i) = std::pow (atmp, b(i));
@@ -2482,7 +2482,7 @@
   else
     {
       FloatNDArray result (b.dims ());
-      for (octave_idx_type i = 0; i < b.length (); i++)
+      for (octave_idx_type i = 0; i < b.numel (); i++)
         {
           octave_quit ();
           result (i) = std::pow (a, b(i));
@@ -2500,7 +2500,7 @@
 {
   FloatComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a, b(i));
@@ -2521,7 +2521,7 @@
         {
           FloatComplexNDArray result (a.dims ());
 
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             {
               octave_quit ();
 
@@ -2535,7 +2535,7 @@
       else
         {
           FloatNDArray result (a.dims ());
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             {
               octave_quit ();
               result(i) = std::pow (a(i), b);
@@ -2551,22 +2551,22 @@
       int ib = static_cast<int> (b);
       if (ib == 2)
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             result(i) = a(i) * a(i);
         }
       else if (ib == 3)
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             result(i) = a(i) * a(i) * a(i);
         }
       else if (ib == -1)
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             result(i) = 1.0f / a(i);
         }
       else
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             {
               octave_quit ();
               result(i) = std::pow (a(i), ib);
@@ -2607,7 +2607,7 @@
         }
     }
 
-  int len = a.length ();
+  int len = a.numel ();
 
   bool convert_to_complex = false;
 
@@ -2660,7 +2660,7 @@
 {
   FloatComplexNDArray result (a.dims ());
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a(i), b);
@@ -2691,7 +2691,7 @@
 
   FloatComplexNDArray result (a_dims);
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a(i), b(i));
@@ -2706,7 +2706,7 @@
 {
   FloatComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       float btmp = b(i);
@@ -2725,7 +2725,7 @@
 {
   FloatComplexNDArray result (b.dims ());
 
-  for (octave_idx_type i = 0; i < b.length (); i++)
+  for (octave_idx_type i = 0; i < b.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a, b(i));
@@ -2744,12 +2744,12 @@
     {
       if (b == -1)
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             result.xelem (i) = 1.0f / a(i);
         }
       else
         {
-          for (octave_idx_type i = 0; i < a.length (); i++)
+          for (octave_idx_type i = 0; i < a.numel (); i++)
             {
               octave_quit ();
               result(i) = std::pow (a(i), static_cast<int> (b));
@@ -2758,7 +2758,7 @@
     }
   else
     {
-      for (octave_idx_type i = 0; i < a.length (); i++)
+      for (octave_idx_type i = 0; i < a.numel (); i++)
         {
           octave_quit ();
           result(i) = std::pow (a(i), b);
@@ -2790,7 +2790,7 @@
 
   FloatComplexNDArray result (a_dims);
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       float btmp = b(i);
@@ -2809,7 +2809,7 @@
 {
   FloatComplexNDArray result (a.dims ());
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a(i), b);
@@ -2840,7 +2840,7 @@
 
   FloatComplexNDArray result (a_dims);
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     {
       octave_quit ();
       result(i) = std::pow (a(i), b(i));
--- a/libinterp/dldfcn/__glpk__.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/dldfcn/__glpk__.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -470,7 +470,7 @@
   //--            bound on each of the variables.
   Matrix LB (args(3).matrix_value ());
 
-  if (error_state || LB.length () < mrowsc)
+  if (error_state || LB.numel () < mrowsc)
     {
       error ("__glpk__: invalid value of LB");
       return retval;
@@ -495,7 +495,7 @@
   //--            bound on each of the variables.
   Matrix UB (args(4).matrix_value ());
 
-  if (error_state || UB.length () < mrowsc)
+  if (error_state || UB.numel () < mrowsc)
     {
       error ("__glpk__: invalid value of UB");
       return retval;
--- a/libinterp/dldfcn/__init_fltk__.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/dldfcn/__init_fltk__.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -563,7 +563,7 @@
   {
     std::vector<int> delayed_menus;
     Matrix kids = find_uimenu_children (uimenup);
-    int len = kids.length ();
+    int len = kids.numel ();
     std::string fltk_label = uimenup.get_fltk_label ();
     int count = 0;
 
@@ -613,7 +613,7 @@
   {
     std::vector<int> delayed_menus;
     Matrix kids = find_uimenu_children (figp);
-    int len = kids.length ();
+    int len = kids.numel ();
     int count = 0;
     menubar->clear ();
     for (octave_idx_type ii = 0; ii < len; ii++)
@@ -658,7 +658,7 @@
     Matrix kids;
     std::string type = prop.get_type ();
     kids = find_uimenu_children (prop);
-    int len = kids.length ();
+    int len = kids.numel ();
 
     for (octave_idx_type ii = 0; ii < len; ii++)
       {
@@ -1113,7 +1113,7 @@
   graphics_handle pixel2axes_or_ca (int px, int py)
   {
     Matrix kids = fp.get_children ();
-    int len = kids.length ();
+    int len = kids.numel ();
 
     for (int k = 0; k < len; k++)
       {
--- a/libinterp/dldfcn/__magick_read__.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/dldfcn/__magick_read__.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -177,8 +177,8 @@
                         (region["row_cache"] + rows.inc () -1) - cols.inc ();
 
   // The actual height and width of the output image
-  region["row_out"] = rows.nelem ();
-  region["col_out"] = cols.nelem ();
+  region["row_out"] = rows.numel ();
+  region["col_out"] = cols.numel ();
 
   return region;
 }
@@ -216,7 +216,7 @@
   octave_value_list retval (3, Matrix ());
 
   std::map<std::string, octave_idx_type> region = calculate_region (options);
-  const octave_idx_type nFrames = frameidx.length ();
+  const octave_idx_type nFrames = frameidx.numel ();
   const octave_idx_type nRows = region["row_out"];
   const octave_idx_type nCols = region["col_out"];
 
@@ -311,7 +311,7 @@
   octave_value_list retval (3, Matrix ());
 
   std::map<std::string, octave_idx_type> region = calculate_region (options);
-  const octave_idx_type nFrames = frameidx.length ();
+  const octave_idx_type nFrames = frameidx.numel ();
   const octave_idx_type nRows = region["row_out"];
   const octave_idx_type nCols = region["col_out"];
   T img;
@@ -711,7 +711,7 @@
 
       if (QuantumDepth < 32)
         warning_with_id ("Octave:GraphicsMagic-Quantum-Depth",
-                         "your version of %s limits images to %d bits per pixel",
+                         "your version of %s limits images to %d bits per pixel\n",
                          MagickPackageName, QuantumDepth);
 
       initialized = true;
@@ -776,7 +776,7 @@
         }
       // Fix indexes from base 1 to base 0, and at the same time, make
       // sure none of the indexes is outside the range of image number.
-      const octave_idx_type n = frameidx.nelem ();
+      const octave_idx_type n = frameidx.numel ();
       for (octave_idx_type i = 0; i < n; i++)
         {
           frameidx(i)--;
@@ -798,7 +798,7 @@
   {
     const unsigned int nRows = imvec[frameidx(0)].rows ();
     const unsigned int nCols = imvec[frameidx(0)].columns ();
-    const octave_idx_type n = frameidx.nelem ();
+    const octave_idx_type n = frameidx.numel ();
     for (octave_idx_type frame = 0; frame < n; frame++)
       {
         if (nRows != imvec[frameidx(frame)].rows ()
--- a/libinterp/dldfcn/audiodevinfo.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/dldfcn/audiodevinfo.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -1086,7 +1086,7 @@
 unsigned int
 audioplayer::get_total_samples (void)
 {
-  return left.length ();
+  return left.numel ();
 }
 
 void
@@ -1104,7 +1104,7 @@
 void
 audioplayer::reset_end_sample (void)
 {
-  set_end_sample (left.length ());
+  set_end_sample (left.numel ());
 }
 
 void
--- a/libinterp/dldfcn/audioread.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/dldfcn/audioread.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -115,7 +115,7 @@
       if (error_state)
         return retval;
 
-      if (range.nelem () != 2)
+      if (range.numel () != 2)
         {
           error ("audioread: invalid specification for range of frames");
           return retval;
--- a/libinterp/dldfcn/ccolamd.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/dldfcn/ccolamd.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -162,7 +162,7 @@
       if (nargin > 1)
         {
           NDArray User_knobs = args(1).array_value ();
-          int nel_User_knobs = User_knobs.length ();
+          int nel_User_knobs = User_knobs.numel ();
 
           if (nel_User_knobs > 0)
             knobs[CCOLAMD_LU] = (User_knobs(0) != 0);
@@ -273,7 +273,7 @@
       if (nargin > 2)
         {
           NDArray in_cmember = args(2).array_value ();
-          octave_idx_type cslen = in_cmember.length ();
+          octave_idx_type cslen = in_cmember.numel ();
           OCTAVE_LOCAL_BUFFER (octave_idx_type, cmember, cslen);
           for (octave_idx_type i = 0; i < cslen; i++)
             // convert cmember from 1-based to 0-based
@@ -422,7 +422,7 @@
       if (nargin > 1)
         {
           NDArray User_knobs = args(1).array_value ();
-          int nel_User_knobs = User_knobs.length ();
+          int nel_User_knobs = User_knobs.numel ();
 
           if (nel_User_knobs > 0)
             knobs[CCOLAMD_DENSE_ROW] = User_knobs(0);
@@ -511,7 +511,7 @@
       if (nargin > 2)
         {
           NDArray in_cmember = args(2).array_value ();
-          octave_idx_type cslen = in_cmember.length ();
+          octave_idx_type cslen = in_cmember.numel ();
           OCTAVE_LOCAL_BUFFER (octave_idx_type, cmember, cslen);
           for (octave_idx_type i = 0; i < cslen; i++)
             // convert cmember from 1-based to 0-based
--- a/libinterp/dldfcn/colamd.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/dldfcn/colamd.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -297,7 +297,7 @@
       if (nargin == 2)
         {
           NDArray User_knobs = args(1).array_value ();
-          int nel_User_knobs = User_knobs.length ();
+          int nel_User_knobs = User_knobs.numel ();
 
           if (nel_User_knobs > 0)
             knobs[COLAMD_DENSE_ROW] = User_knobs(0);
@@ -534,7 +534,7 @@
       if (nargin == 2)
         {
           NDArray User_knobs = args(1).array_value ();
-          int nel_User_knobs = User_knobs.length ();
+          int nel_User_knobs = User_knobs.numel ();
 
           if (nel_User_knobs > 0)
             knobs[COLAMD_DENSE_ROW] = User_knobs(COLAMD_DENSE_ROW);
--- a/libinterp/octave-value/ov-base-int.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-base-int.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -129,7 +129,7 @@
 {
   octave_base_value *retval = 0;
 
-  if (this->matrix.nelem () == 1)
+  if (this->matrix.numel () == 1)
     retval = new typename octave_value_int_traits<T>::scalar_type
                (this->matrix (0));
 
@@ -193,7 +193,7 @@
   os << "# ndims: " << d.length () << "\n";
 
   for (int i = 0; i < d.length (); i++)
-    os << " " << d (i);
+    os << " " << d(i);
 
   os << "\n" << this->matrix;
 
@@ -355,7 +355,7 @@
 
   // Octave uses column-major, while HDF5 uses row-major ordering
   for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
+    hdims[i] = dv(rank-i-1);
 
   space_hid = H5Screate_simple (rank, hdims, 0);
 
--- a/libinterp/octave-value/ov-base-mat.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-base-mat.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -358,7 +358,7 @@
                 for (octave_idx_type i = 0; i < n_idx; i++)
                   {
                     j += idx_vec(i)(0) * k;
-                    k *= dv (i);
+                    k *= dv(i);
                   }
                 matrix(j) = rhs;
               }
--- a/libinterp/octave-value/ov-base-sparse.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-base-sparse.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -394,8 +394,8 @@
   matrix.maybe_compress ();
 
   os << "# nnz: "      << nnz () << "\n";
-  os << "# rows: "     << dv (0) << "\n";
-  os << "# columns: "  << dv (1) << "\n";
+  os << "# rows: "     << dv(0) << "\n";
+  os << "# columns: "  << dv(1) << "\n";
 
   os << this->matrix;
 
--- a/libinterp/octave-value/ov-base-sparse.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-base-sparse.h	Tue Jun 23 20:00:59 2015 -0700
@@ -143,7 +143,7 @@
 
   bool is_true (void) const;
 
-  octave_idx_type capacity (void) const { return matrix.capacity (); }
+  GCC_ATTR_DEPRECATED octave_idx_type capacity (void) const { return nzmax (); }
 
   bool print_as_scalar (void) const;
 
--- a/libinterp/octave-value/ov-base.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-base.h	Tue Jun 23 20:00:59 2015 -0700
@@ -36,7 +36,7 @@
 #include "str-vec.h"
 
 #include "error.h"
-#include "oct-hdf5-id.h"
+#include "oct-hdf5-types.h"
 
 class Cell;
 class mxArray;
@@ -310,7 +310,8 @@
 
   virtual octave_idx_type numel (void) const { return dims ().numel (); }
 
-  virtual octave_idx_type capacity (void) const { return numel (); }
+  GCC_ATTR_DEPRECATED virtual octave_idx_type capacity (void) const
+  { return numel (); }
 
   virtual size_t byte_size (void) const { return 0; }
 
--- a/libinterp/octave-value/ov-bool-mat.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-bool-mat.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -193,7 +193,7 @@
       os << "# ndims: " << d.length () << "\n";
 
       for (int i = 0; i < d.length (); i++)
-        os << " " << d (i);
+        os << " " << d(i);
 
       os << "\n" << tmp;
     }
@@ -252,7 +252,7 @@
 
                       if (is)
                         {
-                          for (octave_idx_type i = 0; i < btmp.nelem (); i++)
+                          for (octave_idx_type i = 0; i < btmp.numel (); i++)
                             btmp.elem (i) = (tmp.elem (i) != 0.);
 
                           matrix = btmp;
@@ -344,7 +344,7 @@
 
   boolNDArray m = bool_array_value ();
   bool *mtmp = m.fortran_vec ();
-  octave_idx_type nel = m.nelem ();
+  octave_idx_type nel = m.numel ();
   OCTAVE_LOCAL_BUFFER (char, htmp, nel);
 
   for (octave_idx_type i = 0; i < nel; i++)
@@ -431,7 +431,7 @@
 
   // Octave uses column-major, while HDF5 uses row-major ordering
   for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
+    hdims[i] = dv(rank-i-1);
 
   space_hid = H5Screate_simple (rank, hdims, 0);
   if (space_hid < 0) return false;
@@ -448,7 +448,7 @@
       return false;
     }
 
-  octave_idx_type nel = m.nelem ();
+  octave_idx_type nel = m.numel ();
   bool *mtmp = m.fortran_vec ();
   OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel);
 
--- a/libinterp/octave-value/ov-cell.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-cell.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -156,7 +156,7 @@
           {
             Cell tcell = tmp.cell_value ();
 
-            if (tcell.length () == 1)
+            if (tcell.numel () == 1)
               retval(0) = tcell(0,0);
             else
               retval = octave_value (octave_value_list (tcell), true);
@@ -208,7 +208,7 @@
           {
             const Cell tcell = tmp.cell_value ();
 
-            if (tcell.length () == 1)
+            if (tcell.numel () == 1)
               retval = tcell(0,0);
             else
               retval = octave_value (octave_value_list (tcell), true);
@@ -617,7 +617,7 @@
       if (error_state)
         return retval;
 
-      octave_idx_type s_len = s.length ();
+      octave_idx_type s_len = s.numel ();
 
       n_elts += s_len ? s_len : 1;
 
@@ -638,7 +638,7 @@
       const string_vector s = strvec_queue.front ();
       strvec_queue.pop ();
 
-      octave_idx_type s_len = s.length ();
+      octave_idx_type s_len = s.numel ();
 
       if (s_len)
         {
@@ -767,7 +767,7 @@
       os << "# ndims: " << d.length () << "\n";
 
       for (int i = 0; i < d.length (); i++)
-        os << " " << d (i);
+        os << " " << d(i);
       os << "\n";
 
       Cell tmp = cell_value ();
@@ -1470,7 +1470,7 @@
           // except if the struct is a column vector.
 
           dim_vector result_dv;
-          if (m_dv (m_dv.length () - 1) == 1)
+          if (m_dv(m_dv.length () - 1) == 1)
             result_dv.resize (m_dv.length ());
           else
             result_dv.resize (m_dv.length () + 1); // Add 1 for the fields.
--- a/libinterp/octave-value/ov-class.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-class.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -406,7 +406,7 @@
                   {
                     Cell t = tmp.index (idx.front ());
 
-                    retval(0) = (t.length () == 1) ? t(0)
+                    retval(0) = (t.numel () == 1) ? t(0)
                                                    : octave_value (t, true);
 
                     // We handled two index elements, so tell
@@ -427,7 +427,7 @@
               {
                 Cell t = dotref (idx.front ());
 
-                retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
+                retval(0) = (t.numel () == 1) ? t(0) : octave_value (t, true);
               }
           }
           break;
@@ -508,7 +508,7 @@
 {
   octave_value retval;
 
-  if (val.length () == 1)
+  if (val.numel () == 1)
     {
       retval = val(0);
 
--- a/libinterp/octave-value/ov-class.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-class.h	Tue Jun 23 20:00:59 2015 -0700
@@ -257,7 +257,7 @@
       return *this;
     }
 
-    octave_idx_type nfields (void) const { return field_names.length (); }
+    octave_idx_type nfields (void) const { return field_names.numel (); }
 
     size_t nparents (void) const { return parent_class_names.size (); }
 
--- a/libinterp/octave-value/ov-classdef.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-classdef.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -1476,17 +1476,26 @@
 
     case '(':
       {
+        const octave_value_list& ival = idx.front ();
+
         refcount++;
-
         cdef_object this_obj (this);
 
-        Array<cdef_object> arr (dim_vector (1, 1), this_obj);
-
-        cdef_object new_obj = cdef_object (new cdef_object_array (arr));
-
-        new_obj.set_class (get_class ());
-
-        retval = new_obj.subsref (type, idx, nargout, skip, cls, auto_add);
+        if (ival.empty ())
+          {
+            skip++;
+            retval(0) = to_ov (this_obj);
+          }
+        else
+          {
+            Array<cdef_object> arr (dim_vector (1, 1), this_obj);
+
+            cdef_object new_obj = cdef_object (new cdef_object_array (arr));
+
+            new_obj.set_class (get_class ());
+
+            retval = new_obj.subsref (type, idx, nargout, skip, cls, auto_add);
+          }
       }
       break;
 
@@ -1626,16 +1635,17 @@
     case '(':
       {
         const octave_value_list& ival = idx.front ();
-        bool is_scalar = true;
-        Array<idx_vector> iv (dim_vector (1, ival.length ()));
 
         if (ival.empty ())
           {
-            ::error ("can't index %s object(s) with empty parentheses",
-                     class_name ().c_str ());
+            refcount++;
+            retval(0) = to_ov (cdef_object (this));
             break;
           }
 
+        bool is_scalar = true;
+        Array<idx_vector> iv (dim_vector (1, ival.length ()));
+
         for (int i = 0; ! error_state && i < ival.length (); i++)
           {
             iv(i) = ival(i).index_vector ();
--- a/libinterp/octave-value/ov-cx-mat.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-cx-mat.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -337,7 +337,7 @@
       os << "# ndims: " << d.length () << "\n";
 
       for (int i = 0; i < d.length (); i++)
-        os << " " << d (i);
+        os << " " << d(i);
 
       os << "\n" << tmp;
     }
@@ -584,7 +584,7 @@
 
   // Octave uses column-major, while HDF5 uses row-major ordering
   for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
+    hdims[i] = dv(rank-i-1);
 
   space_hid = H5Screate_simple (rank, hdims, 0);
   if (space_hid < 0) return false;
--- a/libinterp/octave-value/ov-fcn-inline.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-fcn-inline.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -70,7 +70,7 @@
 
   buf << "@(";
 
-  for (int i = 0; i < ifargs.length (); i++)
+  for (int i = 0; i < ifargs.numel (); i++)
     {
       if (i > 0)
         buf << ", ";
@@ -128,12 +128,12 @@
 
   string_vector args = fcn_arg_names ();
 
-  m.assign ("numArgs", args.length ());
+  m.assign ("numArgs", args.numel ());
   m.assign ("args", args);
 
   std::ostringstream buf;
 
-  for (int i = 0; i < args.length (); i++)
+  for (int i = 0; i < args.numel (); i++)
     buf << args(i) << " = INLINE_INPUTS_{" << i + 1 << "}; ";
 
   m.assign ("inputExpr", buf.str ());
@@ -144,8 +144,8 @@
 bool
 octave_fcn_inline::save_ascii (std::ostream& os)
 {
-  os << "# nargs: " <<  ifargs.length () << "\n";
-  for (int i = 0; i < ifargs.length (); i++)
+  os << "# nargs: " <<  ifargs.numel () << "\n";
+  for (int i = 0; i < ifargs.numel (); i++)
     os << ifargs(i) << "\n";
   if (nm.length () < 1)
     // Write an invalid value to flag empty fcn handle name.
@@ -195,9 +195,9 @@
 bool
 octave_fcn_inline::save_binary (std::ostream& os, bool&)
 {
-  int32_t tmp = ifargs.length ();
+  int32_t tmp = ifargs.numel ();
   os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i = 0; i < ifargs.length (); i++)
+  for (int i = 0; i < ifargs.numel (); i++)
     {
       tmp = ifargs(i).length ();
       os.write (reinterpret_cast<char *> (&tmp), 4);
@@ -291,7 +291,7 @@
   if (group_hid < 0) return false;
 
   size_t len = 0;
-  for (int i = 0; i < ifargs.length (); i++)
+  for (int i = 0; i < ifargs.numel (); i++)
     if (len < ifargs(i).length ())
       len = ifargs(i).length ();
 
@@ -304,7 +304,7 @@
   OCTAVE_LOCAL_BUFFER (hsize_t, hdims, 2);
 
   // Octave uses column-major, while HDF5 uses row-major ordering
-  hdims[1] = ifargs.length ();
+  hdims[1] = ifargs.numel ();
   hdims[0] = len + 1;
 
   space_hid = H5Screate_simple (2, hdims, 0);
@@ -327,10 +327,10 @@
       return false;
     }
 
-  OCTAVE_LOCAL_BUFFER (char, s, ifargs.length () * (len + 1));
+  OCTAVE_LOCAL_BUFFER (char, s, ifargs.numel () * (len + 1));
 
   // Save the args as a null teminated list
-  for (int i = 0; i < ifargs.length (); i++)
+  for (int i = 0; i < ifargs.numel (); i++)
     {
       const char * cptr = ifargs(i).c_str ();
       for (size_t j = 0; j < ifargs(i).length (); j++)
@@ -627,7 +627,7 @@
   else
     buf << nm << "(";
 
-  for (int i = 0; i < ifargs.length (); i++)
+  for (int i = 0; i < ifargs.numel (); i++)
     {
       if (i)
         buf << ", ";
@@ -751,7 +751,7 @@
                     {
                       bool have_arg = false;
 
-                      for (int j = 0; j < fargs.length (); j++)
+                      for (int j = 0; j < fargs.numel (); j++)
                         if (tmp_arg == fargs (j))
                           {
                             have_arg = true;
@@ -773,7 +773,7 @@
               // Sort the arguments into ascii order.
               fargs.sort ();
 
-              if (fargs.length () == 0)
+              if (fargs.numel () == 0)
                 fargs.append (std::string ("x"));
 
             }
@@ -920,9 +920,9 @@
         {
           string_vector t1 = fn->fcn_arg_names ();
 
-          Cell t2 (dim_vector (t1.length (), 1));
+          Cell t2 (dim_vector (t1.numel (), 1));
 
-          for (int i = 0; i < t1.length (); i++)
+          for (int i = 0; i < t1.numel (); i++)
             t2(i) = t1(i);
 
           retval = t2;
--- a/libinterp/octave-value/ov-flt-cx-mat.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-flt-cx-mat.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -311,7 +311,7 @@
       os << "# ndims: " << d.length () << "\n";
 
       for (int i = 0; i < d.length (); i++)
-        os << " " << d (i);
+        os << " " << d(i);
 
       os << "\n" << tmp;
     }
@@ -546,7 +546,7 @@
 
   // Octave uses column-major, while HDF5 uses row-major ordering
   for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
+    hdims[i] = dv(rank-i-1);
 
   space_hid = H5Screate_simple (rank, hdims, 0);
   if (space_hid < 0) return false;
--- a/libinterp/octave-value/ov-flt-re-mat.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-flt-re-mat.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -80,7 +80,7 @@
 {
   octave_base_value *retval = 0;
 
-  if (matrix.nelem () == 1)
+  if (matrix.numel () == 1)
     retval = new octave_float_scalar (matrix (0));
 
   return retval;
@@ -338,7 +338,7 @@
       os << "# ndims: " << d.length () << "\n";
 
       for (int i=0; i < d.length (); i++)
-        os << " " << d (i);
+        os << " " << d(i);
 
       os << "\n" << tmp;
     }
@@ -573,7 +573,7 @@
 
   // Octave uses column-major, while HDF5 uses row-major ordering
   for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
+    hdims[i] = dv(rank-i-1);
 
   space_hid = H5Screate_simple (rank, hdims, 0);
 
--- a/libinterp/octave-value/ov-java.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-java.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -1060,14 +1060,14 @@
           break; \
         }
 
-BOX_PRIMITIVE_ARRAY (jboolean, "[Z", Boolean, bool)
-BOX_PRIMITIVE_ARRAY (jchar,    "[C", Char,    char)
-BOX_PRIMITIVE_ARRAY (jbyte,    "[B", Byte,    int8)
-BOX_PRIMITIVE_ARRAY (jshort,   "[S", Short,   int16)
-BOX_PRIMITIVE_ARRAY (jint,     "[I", Int,     int32)
-BOX_PRIMITIVE_ARRAY (jlong,    "[J", Long,    int64)
-BOX_PRIMITIVE_ARRAY (jfloat,   "[F", Float,   Float)
-BOX_PRIMITIVE_ARRAY (jdouble,  "[D", Double,  )
+      BOX_PRIMITIVE_ARRAY (jdouble,  "[D", Double,  )
+      BOX_PRIMITIVE_ARRAY (jboolean, "[Z", Boolean, bool)
+      BOX_PRIMITIVE_ARRAY (jfloat,   "[F", Float,   Float)
+      BOX_PRIMITIVE_ARRAY (jchar,    "[C", Char,    char)
+      BOX_PRIMITIVE_ARRAY (jbyte,    "[B", Byte,    int8)
+      BOX_PRIMITIVE_ARRAY (jshort,   "[S", Short,   int16)
+      BOX_PRIMITIVE_ARRAY (jint,     "[I", Int,     int32)
+      BOX_PRIMITIVE_ARRAY (jlong,    "[J", Long,    int64)
 
 #undef BOX_PRIMITIVE_ARRAY
 
@@ -1097,7 +1097,7 @@
                   NDArray m (dims);
                   mID = jni_env->GetMethodID (cls, "toDouble", "()[D");
                   jdoubleArray_ref dv (jni_env, reinterpret_cast<jdoubleArray> (jni_env->CallObjectMethod (jobj, mID)));
-                  jni_env->GetDoubleArrayRegion (dv, 0, m.length (), m.fortran_vec ());
+                  jni_env->GetDoubleArrayRegion (dv, 0, m.numel (), m.fortran_vec ());
                   retval = m;
                   break;
                 }
@@ -1108,7 +1108,7 @@
                       uint8NDArray m (dims);
                       mID = jni_env->GetMethodID (cls, "toByte", "()[B");
                       jbyteArray_ref dv (jni_env, reinterpret_cast<jbyteArray> (jni_env->CallObjectMethod (jobj, mID)));
-                      jni_env->GetByteArrayRegion (dv, 0, m.length (), reinterpret_cast<jbyte *> (m.fortran_vec ()));
+                      jni_env->GetByteArrayRegion (dv, 0, m.numel (), reinterpret_cast<jbyte *> (m.fortran_vec ()));
                       retval = m;
                       break;
                     }
@@ -1117,7 +1117,7 @@
                       int8NDArray m (dims);
                       mID = jni_env->GetMethodID (cls, "toByte", "()[B");
                       jbyteArray_ref dv (jni_env, reinterpret_cast<jbyteArray> (jni_env->CallObjectMethod (jobj, mID)));
-                      jni_env->GetByteArrayRegion (dv, 0, m.length (), reinterpret_cast<jbyte *> (m.fortran_vec ()));
+                      jni_env->GetByteArrayRegion (dv, 0, m.numel (), reinterpret_cast<jbyte *> (m.fortran_vec ()));
                       retval = m;
                       break;
                     }
@@ -1129,7 +1129,7 @@
                       uint32NDArray m (dims);
                       mID = jni_env->GetMethodID (cls, "toInt", "()[I");
                       jintArray_ref dv (jni_env, reinterpret_cast<jintArray> (jni_env->CallObjectMethod (jobj, mID)));
-                      jni_env->GetIntArrayRegion (dv, 0, m.length (), reinterpret_cast<jint *> (m.fortran_vec ()));
+                      jni_env->GetIntArrayRegion (dv, 0, m.numel (), reinterpret_cast<jint *> (m.fortran_vec ()));
                       retval = m;
                       break;
                     }
@@ -1138,7 +1138,7 @@
                       int32NDArray m (dims);
                       mID = jni_env->GetMethodID (cls, "toInt", "()[I");
                       jintArray_ref dv (jni_env, reinterpret_cast<jintArray> (jni_env->CallObjectMethod (jobj, mID)));
-                      jni_env->GetIntArrayRegion (dv, 0, m.length (), reinterpret_cast<jint *> (m.fortran_vec ()));
+                      jni_env->GetIntArrayRegion (dv, 0, m.numel (), reinterpret_cast<jint *> (m.fortran_vec ()));
                       retval = m;
                       break;
                     }
@@ -1217,7 +1217,7 @@
                       jdoubleArray_ref row (jni_env,
                                             reinterpret_cast<jdoubleArray> (jni_env->GetObjectArrayElement (jarr, r)));
 
-                      if (m.length () == 0)
+                      if (m.numel () == 0)
                         {
                           cols = jni_env->GetArrayLength (row);
                           m.resize (cols, rows);
@@ -1338,8 +1338,8 @@
          }
 
            IF_UNBOX_PRIMITIVE_SCALAR(double, double,   double,        "java/lang/Double",  "(D)V")
+      else IF_UNBOX_PRIMITIVE_SCALAR(bool,   bool,     bool,          "java/lang/Boolean", "(Z)V")
       else IF_UNBOX_PRIMITIVE_SCALAR(float,  float,    float,         "java/lang/Float",   "(F)V")
-      else IF_UNBOX_PRIMITIVE_SCALAR(bool,   bool,     bool,          "java/lang/Boolean", "(Z)V")
       else IF_UNBOX_PRIMITIVE_SCALAR(int8,   int8_t,   int8_scalar,   "java/lang/Byte",    "(B)V")
       else IF_UNBOX_PRIMITIVE_SCALAR(uint8,  uint8_t,  uint8_scalar,  "java/lang/Byte",    "(B)V")
       else IF_UNBOX_PRIMITIVE_SCALAR(int16,  int16_t,  int16_scalar,  "java/lang/Short",   "(S)V")
@@ -1363,8 +1363,8 @@
                || val.is_range ()))
     {
       Matrix m = val.matrix_value ();
-      jdoubleArray dv = jni_env->NewDoubleArray (m.length ());
-      jni_env->SetDoubleArrayRegion (dv, 0, m.length (), m.fortran_vec ());
+      jdoubleArray dv = jni_env->NewDoubleArray (m.numel ());
+      jni_env->SetDoubleArrayRegion (dv, 0, m.numel (), m.fortran_vec ());
       jobj = dv;
       jcls = jni_env->GetObjectClass (jobj);
     }
@@ -1384,8 +1384,8 @@
       if (val.is_double_type ())
         {
           NDArray m = val.array_value ();
-          jdoubleArray_ref dv (jni_env, jni_env->NewDoubleArray (m.length ()));
-          jni_env->SetDoubleArrayRegion (jdoubleArray (dv), 0, m.length (),
+          jdoubleArray_ref dv (jni_env, jni_env->NewDoubleArray (m.numel ()));
+          jni_env->SetDoubleArrayRegion (jdoubleArray (dv), 0, m.numel (),
                                          m.fortran_vec ());
           jmethodID mID = jni_env->GetMethodID (mcls, "<init>", "([D[I)V");
           jobj = jni_env->NewObject (jclass (mcls), mID, jdoubleArray (dv),
@@ -1395,8 +1395,8 @@
       else if (val.is_int8_type ())
         {
           int8NDArray m = val.int8_array_value ();
-          jbyteArray_ref bv (jni_env, jni_env->NewByteArray (m.length ()));
-          jni_env->SetByteArrayRegion (jbyteArray (bv), 0, m.length (),
+          jbyteArray_ref bv (jni_env, jni_env->NewByteArray (m.numel ()));
+          jni_env->SetByteArrayRegion (jbyteArray (bv), 0, m.numel (),
                                        reinterpret_cast <jbyte *> (m.fortran_vec ()));
           jmethodID mID = jni_env->GetMethodID (mcls, "<init>", "([B[I)V");
           jobj = jni_env->NewObject (jclass (mcls), mID, jbyteArray (bv), jintArray (iv));
@@ -1405,8 +1405,8 @@
       else if (val.is_uint8_type ())
         {
           uint8NDArray m = val.uint8_array_value ();
-          jbyteArray_ref bv (jni_env, jni_env->NewByteArray (m.length ()));
-          jni_env->SetByteArrayRegion (jbyteArray (bv), 0, m.length (),
+          jbyteArray_ref bv (jni_env, jni_env->NewByteArray (m.numel ()));
+          jni_env->SetByteArrayRegion (jbyteArray (bv), 0, m.numel (),
                                        reinterpret_cast<jbyte *> (m.fortran_vec ()));
           jmethodID mID = jni_env->GetMethodID (mcls, "<init>", "([B[I)V");
           jobj = jni_env->NewObject (jclass (mcls), mID, jbyteArray (bv), jintArray (iv));
@@ -1415,8 +1415,8 @@
       else if (val.is_int32_type ())
         {
           int32NDArray m = val.int32_array_value ();
-          jintArray_ref v (jni_env, jni_env->NewIntArray (m.length ()));
-          jni_env->SetIntArrayRegion (jintArray (v), 0, m.length (),
+          jintArray_ref v (jni_env, jni_env->NewIntArray (m.numel ()));
+          jni_env->SetIntArrayRegion (jintArray (v), 0, m.numel (),
                                       reinterpret_cast<jint *> (m.fortran_vec ()));
           jmethodID mID = jni_env->GetMethodID (mcls, "<init>", "([I[I)V");
           jobj = jni_env->NewObject (jclass (mcls), mID, jintArray (v), jintArray (iv));
@@ -1603,7 +1603,7 @@
               Cell c = val.cell_value ();
               octave_function *fcn = c(0).function_value ();
 
-              for (int i=1; i<c.length (); i++)
+              for (int i=1; i<c.numel (); i++)
                 oct_args(len+i-1) = c(i);
 
               if (! error_state)
--- a/libinterp/octave-value/ov-lazy-idx.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-lazy-idx.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -106,7 +106,7 @@
   const dim_vector odims = index.orig_dimensions ();
   // index_vector can employ a more efficient sorting algorithm.
   if (mode == ASCENDING && odims.length () == 2
-      && (dim >= 0 && dim <= 1) && odims (1-dim) == 1)
+      && (dim >= 0 && dim <= 1) && odims(1-dim) == 1)
     return index_vector ().sorted ();
   else
     return idx_vector (index.as_array ().sort (dim, mode),
@@ -120,7 +120,7 @@
   const dim_vector odims = index.orig_dimensions ();
   // index_vector can employ a more efficient sorting algorithm.
   if (mode == ASCENDING && odims.length () == 2
-      && (dim >= 0 && dim <= 1) && odims (1-dim) == 1)
+      && (dim >= 0 && dim <= 1) && odims(1-dim) == 1)
     return index_vector ().sorted (sidx);
   else
     return idx_vector (index.as_array ().sort (sidx, dim, mode),
--- a/libinterp/octave-value/ov-oncleanup.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-oncleanup.h	Tue Jun 23 20:00:59 2015 -0700
@@ -20,10 +20,6 @@
 
 */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <iosfwd>
 
 #include "ov-base.h"
--- a/libinterp/octave-value/ov-perm.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-perm.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -261,7 +261,7 @@
   os << "# orient: c\n";
 
   Array<octave_idx_type> pvec = matrix.col_perm_vec ();
-  octave_idx_type n = pvec.length ();
+  octave_idx_type n = pvec.numel ();
   ColumnVector tmp (n);
   for (octave_idx_type i = 0; i < n; i++) tmp(i) = pvec(i) + 1;
   os << tmp;
@@ -439,7 +439,7 @@
 {
   octave_base_value *retval = 0;
 
-  if (matrix.nelem () == 1)
+  if (matrix.numel () == 1)
     retval = new octave_scalar (matrix (0, 0));
 
   return retval;
--- a/libinterp/octave-value/ov-range.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-range.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -72,7 +72,7 @@
 {
   octave_base_value *retval = 0;
 
-  switch (range.nelem ())
+  switch (range.numel ())
     {
     case 1:
       retval = new octave_scalar (range.base ());
@@ -131,7 +131,7 @@
       idx_vector i = idx(0).index_vector ();
       if (! error_state)
         {
-          if (i.is_scalar () && i(0) < range.nelem ())
+          if (i.is_scalar () && i(0) < range.numel ())
             retval = range.elem (i(0));
           else
             retval = range.index (i);
@@ -173,7 +173,7 @@
 {
   double retval = lo_ieee_nan_value ();
 
-  octave_idx_type nel = range.nelem ();
+  octave_idx_type nel = range.numel ();
 
   if (nel > 0)
     {
@@ -193,7 +193,7 @@
 {
   float retval = lo_ieee_float_nan_value ();
 
-  octave_idx_type nel = range.nelem ();
+  octave_idx_type nel = range.numel ();
 
   if (nel > 0)
     {
@@ -264,7 +264,7 @@
 {
   bool retval = false;
 
-  if (range.nelem () != 0)
+  if (range.numel () != 0)
     {
       // FIXME: this is a potential waste of memory.
 
@@ -283,7 +283,7 @@
 
   Complex retval (tmp, tmp);
 
-  octave_idx_type nel = range.nelem ();
+  octave_idx_type nel = range.numel ();
 
   if (nel > 0)
     {
@@ -305,7 +305,7 @@
 
   FloatComplex retval (tmp, tmp);
 
-  octave_idx_type nel = range.nelem ();
+  octave_idx_type nel = range.numel ();
 
   if (nel > 0)
     {
@@ -370,7 +370,7 @@
 {
   bool retval = false;
 
-  octave_idx_type n = range.nelem ();
+  octave_idx_type n = range.numel ();
 
   indent (os);
 
@@ -392,7 +392,7 @@
 void
 octave_range::short_disp (std::ostream& os) const
 {
-  octave_idx_type len = range.nelem ();
+  octave_idx_type len = range.numel ();
 
   if (len == 0)
     os << "[]";
@@ -434,7 +434,7 @@
   double base = r.base ();
   double limit = r.limit ();
   double inc = r.inc ();
-  octave_idx_type len = r.nelem ();
+  octave_idx_type len = r.numel ();
 
   if (inc != 0)
     os << "# base, limit, increment\n";
@@ -487,7 +487,7 @@
   double lim = r.limit ();
   double inc = r.inc ();
   if (inc == 0)
-    lim = r.nelem ();
+    lim = r.numel ();
 
   os.write (reinterpret_cast<char *> (&bas), 8);
   os.write (reinterpret_cast<char *> (&lim), 8);
@@ -583,13 +583,13 @@
   Range r = range_value ();
   double range_vals[3];
   range_vals[0] = r.base ();
-  range_vals[1] = r.inc () != 0 ? r.limit () : r.nelem ();
+  range_vals[1] = r.inc () != 0 ? r.limit () : r.numel ();
   range_vals[2] = r.inc ();
 
   if (H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
                 range_vals) >= 0)
     {
-      octave_idx_type nel = r.nelem ();
+      octave_idx_type nel = r.numel ();
       retval = hdf5_add_scalar_attr (data_hid, H5T_NATIVE_IDX,
                                      "OCTAVE_RANGE_NELEM", &nel) >= 0;
     }
@@ -693,7 +693,7 @@
 octave_value
 octave_range::fast_elem_extract (octave_idx_type n) const
 {
-  return (n < range.nelem ()) ? octave_value (range.elem (n))
+  return (n < range.numel ()) ? octave_value (range.elem (n))
                               : octave_value ();
 }
 
--- a/libinterp/octave-value/ov-range.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-range.h	Tue Jun 23 20:00:59 2015 -0700
@@ -58,14 +58,14 @@
   octave_range (double base, double limit, double inc)
     : octave_base_value (), range (base, limit, inc), idx_cache ()
   {
-    if (range.nelem () < 0)
+    if (range.numel () < 0)
       ::error ("invalid range");
   }
 
   octave_range (const Range& r)
     : octave_base_value (), range (r), idx_cache ()
   {
-    if (range.nelem () < 0 && range.nelem () != -2)
+    if (range.numel () < 0 && range.numel () != -2)
       ::error ("invalid range");
   }
 
@@ -107,7 +107,7 @@
 
   dim_vector dims (void) const
   {
-    octave_idx_type n = range.nelem ();
+    octave_idx_type n = range.numel ();
     return dim_vector (n > 0, n);
   }
 
--- a/libinterp/octave-value/ov-re-mat.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-re-mat.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -95,7 +95,7 @@
 {
   octave_base_value *retval = 0;
 
-  if (matrix.nelem () == 1)
+  if (matrix.numel () == 1)
     retval = new octave_scalar (matrix (0));
 
   return retval;
@@ -440,7 +440,7 @@
       os << "# ndims: " << d.length () << "\n";
 
       for (int i=0; i < d.length (); i++)
-        os << " " << d (i);
+        os << " " << d(i);
 
       os << "\n" << tmp;
     }
@@ -685,7 +685,7 @@
 
   // Octave uses column-major, while HDF5 uses row-major ordering
   for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
+    hdims[i] = dv(rank-i-1);
 
   space_hid = H5Screate_simple (rank, hdims, 0);
 
--- a/libinterp/octave-value/ov-str-mat.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-str-mat.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -292,7 +292,7 @@
       charNDArray tmp = char_array_value ();
       os << "# ndims: " << d.length () << "\n";
       for (int i=0; i < d.length (); i++)
-        os << " " << d (i);
+        os << " " << d(i);
       os << "\n";
       os.write (tmp.fortran_vec (), d.numel ());
       os << "\n";
@@ -592,7 +592,7 @@
 
   // Octave uses column-major, while HDF5 uses row-major ordering
   for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
+    hdims[i] = dv(rank-i-1);
 
   space_hid = H5Screate_simple (rank, hdims, 0);
   if (space_hid < 0)
--- a/libinterp/octave-value/ov-struct.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-struct.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -157,7 +157,7 @@
               {
                 const Cell t = tmp.index (idx.front ());
 
-                retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
+                retval(0) = (t.numel () == 1) ? t(0) : octave_value (t, true);
 
                 // We handled two index elements, so tell
                 // next_subsref to skip both of them.
@@ -176,7 +176,7 @@
           {
             const Cell t = dotref (idx.front ());
 
-            retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
+            retval(0) = (t.numel () == 1) ? t(0) : octave_value (t, true);
           }
       }
       break;
@@ -223,7 +223,7 @@
               {
                 const Cell t = tmp.index (idx.front (), auto_add);
 
-                retval = (t.length () == 1) ? t(0) : octave_value (t, true);
+                retval = (t.numel () == 1) ? t(0) : octave_value (t, true);
 
                 // We handled two index elements, so tell
                 // next_subsref to skip both of them.
@@ -242,7 +242,7 @@
           {
             const Cell t = dotref (idx.front (), auto_add);
 
-            retval = (t.length () == 1) ? t(0) : octave_value (t, true);
+            retval = (t.numel () == 1) ? t(0) : octave_value (t, true);
           }
       }
       break;
@@ -679,7 +679,7 @@
 
       string_vector key_list = map.fieldnames ();
 
-      for (octave_idx_type i = 0; i < key_list.length (); i++)
+      for (octave_idx_type i = 0; i < key_list.numel (); i++)
         {
           std::string key = key_list[i];
 
@@ -735,7 +735,7 @@
 static bool
 scalar (const dim_vector& dims)
 {
-  return dims.length () == 2 && dims (0) == 1 && dims (1) == 1;
+  return dims.length () == 2 && dims(0) == 1 && dims(1) == 1;
 }
 
 
@@ -751,7 +751,7 @@
   os << "# ndims: " << dv.length () << "\n";
 
   for (int i = 0; i < dv.length (); i++)
-    os << " " << dv (i);
+    os << " " << dv(i);
   os << "\n";
 
   os << "# length: " << nf << "\n";
@@ -1400,7 +1400,7 @@
 
       string_vector key_list = map.fieldnames ();
 
-      for (octave_idx_type i = 0; i < key_list.length (); i++)
+      for (octave_idx_type i = 0; i < key_list.numel (); i++)
         {
           std::string key = key_list[i];
 
@@ -1461,7 +1461,7 @@
   os << "# ndims: " << dv.length () << "\n";
 
   for (int i = 0; i < dv.length (); i++)
-    os << " " << dv (i);
+    os << " " << dv(i);
   os << "\n";
 
   os << "# length: " << nf << "\n";
@@ -2017,7 +2017,7 @@
 
   string_vector keys = m.fieldnames ();
 
-  if (keys.length () == 0)
+  if (keys.numel () == 0)
     retval = Cell (0, 1);
   else
     retval = Cell (keys);
--- a/libinterp/octave-value/ov-typeinfo.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov-typeinfo.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -193,7 +193,7 @@
     if (t_name == types (i))
       return i;
 
-  int len = types.length ();
+  int len = types.numel ();
 
   if (i == len)
     {
--- a/libinterp/octave-value/ov.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -2998,7 +2998,7 @@
             {
               Cell subs_cell = subs(k).cell_value ();
 
-              for (int n = 0; n < subs_cell.length (); n++)
+              for (int n = 0; n < subs_cell.numel (); n++)
                 {
                   if (subs_cell(n).is_string ()
                       && subs_cell(n).string_value () == ":")
--- a/libinterp/octave-value/ov.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/octave-value/ov.h	Tue Jun 23 20:00:59 2015 -0700
@@ -483,8 +483,8 @@
   octave_idx_type numel (void) const
   { return rep->numel (); }
 
-  octave_idx_type capacity (void) const
-  { return rep->capacity (); }
+  GCC_ATTR_DEPRECATED octave_idx_type capacity (void) const
+  { return rep->numel (); }
 
   size_t byte_size (void) const
   { return rep->byte_size (); }
--- a/libinterp/operators/op-int.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/operators/op-int.h	Tue Jun 23 20:00:59 2015 -0700
@@ -370,7 +370,7 @@
   elem_xpow (const octave_ ## T1& a, const T2 ## NDArray& b) \
   { \
     T2 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
+    for (int i = 0; i < b.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = pow (a, b(i)); \
@@ -382,7 +382,7 @@
   elem_xpow (const octave_ ## T1& a, const NDArray& b) \
   { \
     T1 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
+    for (int i = 0; i < b.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = pow (a, b(i)); \
@@ -394,7 +394,7 @@
   elem_xpow (double a, const T2 ## NDArray& b) \
   { \
     T2 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
+    for (int i = 0; i < b.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = pow (a, b(i)); \
@@ -406,7 +406,7 @@
   elem_xpow (const octave_ ## T1& a, const FloatNDArray& b) \
   { \
     T1 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
+    for (int i = 0; i < b.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = powf (a, b(i)); \
@@ -418,7 +418,7 @@
   elem_xpow (float a, const T2 ## NDArray& b) \
   { \
     T2 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
+    for (int i = 0; i < b.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = powf (a, b(i)); \
@@ -536,7 +536,7 @@
 octave_value elem_xpow (T1 ## NDArray a, octave_ ## T2  b) \
 { \
   T1 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
+  for (int i = 0; i < a.numel (); i++) \
     { \
       OCTAVE_QUIT; \
       result (i) = pow (a(i), b);               \
@@ -547,7 +547,7 @@
 octave_value elem_xpow (T1 ## NDArray a, double  b) \
 { \
   T1 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
+  for (int i = 0; i < a.numel (); i++) \
     { \
       OCTAVE_QUIT; \
       result (i) = pow (a(i), b);               \
@@ -558,7 +558,7 @@
 octave_value elem_xpow (NDArray a, octave_ ## T2  b) \
 { \
   T2 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
+  for (int i = 0; i < a.numel (); i++) \
     { \
       OCTAVE_QUIT; \
       result (i) = pow (a(i), b);               \
@@ -569,7 +569,7 @@
 octave_value elem_xpow (T1 ## NDArray a, float  b) \
 { \
   T1 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
+  for (int i = 0; i < a.numel (); i++) \
     { \
       OCTAVE_QUIT; \
       result (i) = powf (a(i), b);              \
@@ -580,7 +580,7 @@
 octave_value elem_xpow (FloatNDArray a, octave_ ## T2  b) \
 { \
   T2 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
+  for (int i = 0; i < a.numel (); i++) \
     { \
       OCTAVE_QUIT; \
       result (i) = powf (a(i), b);              \
@@ -715,7 +715,7 @@
           } \
       } \
     T1 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
+    for (int i = 0; i < a.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = pow (a(i), b(i)); \
@@ -741,7 +741,7 @@
           } \
       } \
     T1 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
+    for (int i = 0; i < a.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = pow (a(i), b(i)); \
@@ -767,7 +767,7 @@
           } \
       } \
     T2 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
+    for (int i = 0; i < a.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = pow (a(i), b(i)); \
@@ -793,7 +793,7 @@
           } \
       } \
     T1 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
+    for (int i = 0; i < a.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = powf (a(i), b(i)); \
@@ -819,7 +819,7 @@
           } \
       } \
     T2 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
+    for (int i = 0; i < a.numel (); i++) \
       { \
         OCTAVE_QUIT; \
         result (i) = powf (a(i), b(i)); \
--- a/libinterp/parse-tree/pt-assign.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/parse-tree/pt-assign.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -260,6 +260,33 @@
 
           if (nel != 1)
             {
+              // Huge kluge so that wrapper scripts with lines like
+              //
+              //   [varargout{1:nargout}] = fcn (args);
+              //
+              // Will work the same as calling fcn directly when nargout
+              // is 0 and fcn produces more than one output even when
+              // nargout is 0.  This only works if varargout has not yet
+              // been defined.  See also bug #43813.
+
+              if (lvalue_list.size () == 1 && nel == 0 && n > 0
+                  && ! ult.is_black_hole () && ult.is_undefined ()
+                  && ult.index_type () == "{" && ult.index_is_empty ())
+                {
+                  // Convert undefined lvalue with empty index to a cell
+                  // array with a single value and indexed by 1 to
+                  // handle a single output.
+
+                  nel = 1;
+
+                  ult.define (Cell (1, 1));
+
+                  ult.clear_index ();
+                  std::list<octave_value_list> idx;
+                  idx.push_back (octave_value_list (octave_value (1)));
+                  ult.set_index ("{", idx);
+                }
+
               if (k + nel <= n)
                 {
                   // This won't do a copy.
--- a/libinterp/parse-tree/pt-eval.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/parse-tree/pt-eval.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -337,7 +337,7 @@
       {
         Range rng = rhs.range_value ();
 
-        octave_idx_type steps = rng.nelem ();
+        octave_idx_type steps = rng.numel ();
 
         for (octave_idx_type i = 0; i < steps; i++)
           {
--- a/libinterp/parse-tree/pt-pr-code.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/libinterp/parse-tree/pt-pr-code.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -329,7 +329,7 @@
 
       cmd_list->accept (*this);
 
-      decrement_indent_level ();
+      // endfunction will decrement the indent level.
     }
 
   visit_octave_user_function_trailer (fcn);
@@ -600,7 +600,7 @@
         case '.':
           {
             string_vector nm = *p_arg_names;
-            assert (nm.length () == 1);
+            assert (nm.numel () == 1);
             os << "." << nm(0);
           }
           break;
@@ -719,6 +719,9 @@
 void
 tree_print_code::visit_no_op_command (tree_no_op_command& cmd)
 {
+  if (cmd.is_end_of_fcn_or_script ())
+    decrement_indent_level ();
+
   indent ();
 
   os << cmd.original_command ();
@@ -873,13 +876,7 @@
     {
       cmd->accept (*this);
 
-      if (! stmt.print_result ())
-        {
-          os << ";";
-          newline (" ");
-        }
-      else
-        newline ();
+      newline ();
     }
   else
     {
--- a/liboctave/array/Array-util.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/Array-util.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -36,7 +36,7 @@
 {
   bool retval = true;
 
-  int n = ra_idx.length ();
+  int n = ra_idx.numel ();
 
   if (n == dimensions.length ())
     {
@@ -61,7 +61,7 @@
 {
   ra_idx(start_dimension)++;
 
-  int n = ra_idx.length () - 1;
+  int n = ra_idx.numel () - 1;
   int nda = dimensions.length ();
 
   for (int i = start_dimension; i < n; i++)
@@ -81,7 +81,7 @@
 {
   octave_idx_type retval (-1);
 
-  int n = idx.length ();
+  int n = idx.numel ();
 
   if (n > 0)
     {
@@ -89,7 +89,7 @@
 
       while (--n >= 0)
         {
-          retval *= dims (n);
+          retval *= dims(n);
 
           retval += idx(n);
         }
@@ -102,9 +102,9 @@
 {
   octave_idx_type retval = 0;
 
-  for (octave_idx_type i = 0; i < ra_idx.length (); i++)
+  for (octave_idx_type i = 0; i < ra_idx.numel (); i++)
     {
-      if (ra_idx (i) == 1)
+      if (ra_idx(i) == 1)
         retval++;
     }
 
@@ -126,7 +126,7 @@
     {
       for (int i = 0; i < n; i ++)
         {
-          if (dim (i) != 1)
+          if (dim(i) != 1)
             {
               retval = false;
 
@@ -148,7 +148,7 @@
   else
     {
       for (int i = 0; i < n; i ++)
-        if (dim (i) > 1)
+        if (dim(i) > 1)
           m++;
         else if (dim(i) < 1)
           m += 2;
@@ -162,7 +162,7 @@
 {
   bool retval = false;
 
-  for (octave_idx_type i = 0; i < arr.length (); i++)
+  for (octave_idx_type i = 0; i < arr.numel (); i++)
     {
       if (arr (i) == 1)
         {
@@ -217,7 +217,7 @@
 octave_idx_type
 compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims)
 {
-  int nd = ra_idx.length ();
+  int nd = ra_idx.numel ();
   const dim_vector dv = dims.redim (nd);
   for (int d = 0; d < nd; d++)
     {
@@ -235,7 +235,7 @@
 {
   Array<octave_idx_type> retval (a.dims ());
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     retval(i) = a(i).elem (0);
 
   return retval;
@@ -257,7 +257,7 @@
 {
   dim_vector retval;
 
-  int n = ra_idx.length ();
+  int n = ra_idx.numel ();
 
   assert (n == dimensions.length ());
 
@@ -298,7 +298,7 @@
 {
   bool retval = true;
 
-  octave_idx_type n = ra_idx.length ();
+  octave_idx_type n = ra_idx.numel ();
 
   for (octave_idx_type i = 0; i < n; i++)
     {
@@ -317,7 +317,7 @@
 {
   bool retval = false;
 
-  octave_idx_type n = ra_idx.length ();
+  octave_idx_type n = ra_idx.numel ();
 
   for (octave_idx_type i = 0; i < n; i++)
     {
@@ -337,7 +337,7 @@
 {
   bool retval = true;
 
-  octave_idx_type idx_n = ra_idx.length ();
+  octave_idx_type idx_n = ra_idx.numel ();
 
   int n = frozen_lengths.length ();
 
@@ -360,7 +360,7 @@
 {
   bool retval = true;
 
-  for (octave_idx_type i = 0; i < arr.length (); i++)
+  for (octave_idx_type i = 0; i < arr.numel (); i++)
     {
       if (arr(i) != 1)
         {
@@ -376,7 +376,7 @@
 get_elt_idx (const Array<idx_vector>& ra_idx,
              const Array<octave_idx_type>& result_idx)
 {
-  octave_idx_type n = ra_idx.length ();
+  octave_idx_type n = ra_idx.numel ();
 
   Array<octave_idx_type> retval (dim_vector (n, 1));
 
@@ -423,7 +423,7 @@
 dim_vector
 zero_dims_inquire (const Array<idx_vector>& ia, const dim_vector& rhdv)
 {
-  int ial = ia.length ();
+  int ial = ia.numel ();
   int rhdvl = rhdv.length ();
   dim_vector rdv = dim_vector::alloc (ial);
   bool *scalar = new bool [ial];
@@ -530,7 +530,7 @@
 sub2ind (const dim_vector& dv, const Array<idx_vector>& idxa)
 {
   idx_vector retval;
-  octave_idx_type len = idxa.length ();
+  octave_idx_type len = idxa.numel ();
 
   if (len >= 1)
     {
@@ -560,7 +560,7 @@
           // All scalars case - the result is a scalar.
           octave_idx_type idx = idxa(len-1)(0);
           for (octave_idx_type i = len - 2; i >= 0; i--)
-            idx = idx * dvx(i) + idxa(i)(0);
+            idx = dvx(i) * idx + idxa(i)(0);
           retval = idx_vector (idx);
         }
       else if (all_ranges && clen != 0)
@@ -572,8 +572,8 @@
             {
               octave_idx_type xstart = idxa(i)(0);
               octave_idx_type xstep = idxa(i)(1) - xstart;
-              start = start * dvx(i) + xstart;
-              step = step * dvx(i) + xstep;
+              start = dvx(i) * start + xstart;
+              step = dvx(i) * step + xstep;
             }
           retval = idx_vector::make_range (start, step, clen);
         }
--- a/liboctave/array/Array.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/Array.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -72,7 +72,7 @@
   if (rep->count > 1)
     {
       --rep->count;
-      rep = new ArrayRep (length (), val);
+      rep = new ArrayRep (numel (), val);
       slice_data = rep->data;
     }
   else
@@ -313,7 +313,7 @@
     : n (dv.length ()), top (0), dim (new octave_idx_type [2*n]),
       stride (dim + n), use_blk (false)
   {
-    assert (n == perm.length ());
+    assert (n == perm.numel ());
 
     // Get cumulative dimensions.
     OCTAVE_LOCAL_BUFFER (octave_idx_type, cdim, n+1);
@@ -446,7 +446,7 @@
 
   dim_vector dv = dims ();
 
-  int perm_vec_len = perm_vec_arg.length ();
+  int perm_vec_len = perm_vec_arg.numel ();
 
   if (perm_vec_len < dv.length ())
     (*current_liboctave_error_handler)
@@ -532,7 +532,7 @@
 
 public:
   rec_index_helper (const dim_vector& dv, const Array<idx_vector>& ia)
-    : n (ia.length ()), top (0), dim (new octave_idx_type [2*n]),
+    : n (ia.numel ()), top (0), dim (new octave_idx_type [2*n]),
       cdim (dim + n), idx (new idx_vector [n])
   {
     assert (n > 0 && (dv.length () == std::max (n, 2)));
@@ -837,7 +837,7 @@
 Array<T>
 Array<T>::index (const Array<idx_vector>& ia) const
 {
-  int ial = ia.length ();
+  int ial = ia.numel ();
   Array<T> retval;
 
   // FIXME: is this dispatching necessary?
@@ -1112,10 +1112,10 @@
   Array<T> tmp = *this;
   if (resize_ok)
     {
-      int ial = ia.length ();
+      int ial = ia.numel ();
       dim_vector dv = dimensions.redim (ial);
       dim_vector dvx = dim_vector::alloc (ial);
-      for (int i = 0; i < ial; i++) dvx(i) = ia(i).extent (dv (i));
+      for (int i = 0; i < ial; i++) dvx(i) = ia(i).extent (dv(i));
       if (! (dvx == dv))
         {
           bool all_scalars = true;
@@ -1290,7 +1290,7 @@
 Array<T>::assign (const Array<idx_vector>& ia,
                   const Array<T>& rhs, const T& rfv)
 {
-  int ial = ia.length ();
+  int ial = ia.numel ();
 
   // FIXME: is this dispatching necessary / desirable?
   if (ial == 1)
@@ -1439,7 +1439,7 @@
       return;
     }
 
-  octave_idx_type n = dimensions (dim);
+  octave_idx_type n = dimensions(dim);
   if (i.is_colon ())
     {
       *this = Array<T> ();
@@ -1492,7 +1492,7 @@
 void
 Array<T>::delete_elements (const Array<idx_vector>& ia)
 {
-  int ial = ia.length ();
+  int ial = ia.numel ();
 
   if (ial == 1)
     delete_elements (ia(0));
@@ -1590,11 +1590,11 @@
 Array<T>&
 Array<T>::insert (const Array<T>& a, const Array<octave_idx_type>& ra_idx)
 {
-  octave_idx_type n = ra_idx.length ();
+  octave_idx_type n = ra_idx.numel ();
   Array<idx_vector> idx (dim_vector (n, 1));
   const dim_vector dva = a.dims ().redim (n);
   for (octave_idx_type k = 0; k < n; k++)
-    idx(k) = idx_vector (ra_idx (k), ra_idx (k) + dva(k));
+    idx(k) = idx_vector (ra_idx(k), ra_idx(k) + dva(k));
 
   assign (idx, a);
 
@@ -1776,7 +1776,7 @@
 
   dim_vector dv = m.dims ();
 
-  if (m.length () < 1)
+  if (m.numel () < 1)
     return m;
 
   if (dim >= dv.length ())
@@ -1897,7 +1897,7 @@
 
   dim_vector dv = m.dims ();
 
-  if (m.length () < 1)
+  if (m.numel () < 1)
     {
       sidx = Array<octave_idx_type> (dv);
       return m;
@@ -2231,7 +2231,7 @@
 Array<T>::nnz (void) const
 {
   const T *src = data ();
-  octave_idx_type nel = nelem ();
+  octave_idx_type nel = numel ();
   octave_idx_type retval = 0;
   const T zero = T ();
   for (octave_idx_type i = 0; i < nel; i++)
@@ -2247,7 +2247,7 @@
 {
   Array<octave_idx_type> retval;
   const T *src = data ();
-  octave_idx_type nel = nelem ();
+  octave_idx_type nel = numel ();
   const T zero = T ();
   if (n < 0 || n >= nel)
     {
@@ -2317,7 +2317,7 @@
       || (rows () == 0 && dims ().numel (1) == 0))
     retval.dimensions = dim_vector ();
   else if (rows () == 1 && ndims () == 2)
-    retval.dimensions = dim_vector (1, retval.length ());
+    retval.dimensions = dim_vector (1, retval.numel ());
 
   return retval;
 }
@@ -2533,8 +2533,8 @@
     (*current_liboctave_error_handler) ("Matrix must be 2-dimensional");
   else
     {
-      octave_idx_type nnr = dv (0);
-      octave_idx_type nnc = dv (1);
+      octave_idx_type nnr = dv(0);
+      octave_idx_type nnc = dv(1);
 
       if (nnr == 0 && nnc == 0)
         ; // do nothing for empty matrix
--- a/liboctave/array/Array.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/Array.h	Tue Jun 23 20:00:59 2015 -0700
@@ -88,7 +88,7 @@
 
     ~ArrayRep (void) { delete [] data; }
 
-    octave_idx_type length (void) const { return len; }
+    octave_idx_type numel (void) const { return len; }
 
   private:
 
@@ -203,7 +203,7 @@
   template <class U>
   Array (const Array<U>& a)
     : dimensions (a.dims ()),
-      rep (new typename Array<T>::ArrayRep (a.data (), a.length ())),
+      rep (new typename Array<T>::ArrayRep (a.data (), a.numel ())),
       slice_data (rep->data), slice_len (rep->len)
   { }
 
@@ -252,11 +252,13 @@
   // Number of elements in the array. These are all synonyms.
   //@{
   //! Number of elements in the array.
-  //! Synonymous with length(), nelem(), and numel().
-  octave_idx_type capacity (void) const { return slice_len; }
+  //! Synonymous with numel().
+  //! @note This method is deprecated in favour of numel().
+  GCC_ATTR_DEPRECATED octave_idx_type capacity (void) const { return numel (); }
 
   //! Number of elements in the array.
-  /*! Synonymous with capacity(), nelem(), and numel().
+  /*! Synonymous with numel().
+      @note This method is deprecated in favour of numel().
 
       @note
       This is @em not the same as @c %length() at the Octave interpreter.
@@ -264,15 +266,15 @@
       length of the greatest dimension.  This method returns the total
       number of elements.
    */
-  octave_idx_type length (void) const { return capacity (); }
+  GCC_ATTR_DEPRECATED octave_idx_type length (void) const { return numel (); }
 
   //! Number of elements in the array.
-  //! Synonymous with capacity(), length(), and numel().
-  octave_idx_type nelem (void) const { return capacity (); }
+  //! Synonymous with numel().
+  //! @note This method is deprecated in favour of numel().
+  GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return numel (); }
 
   //! Number of elements in the array.
-  //! Synonymous with capacity(), length(), and nelem().
-  octave_idx_type numel (void) const { return nelem (); }
+  octave_idx_type numel (void) const { return slice_len; }
   //@}
 
   //! Return the array as a column vector.
@@ -346,7 +348,7 @@
 
   octave_idx_type compute_index_unchecked (const Array<octave_idx_type>& ra_idx)
   const
-  { return dimensions.compute_index (ra_idx.data (), ra_idx.length ()); }
+  { return dimensions.compute_index (ra_idx.data (), ra_idx.numel ()); }
 
   // No checking, even for multiple references, ever.
 
@@ -658,7 +660,7 @@
   Array<U>
   map (F fcn) const
   {
-    octave_idx_type len = length ();
+    octave_idx_type len = numel ();
 
     const T *m = data ();
 
@@ -701,7 +703,7 @@
   template <class F, bool zero>
   bool test (F fcn) const
   {
-    return any_all_test<F, T, zero> (fcn, data (), length ());
+    return any_all_test<F, T, zero> (fcn, data (), numel ());
   }
 
   //@{
--- a/liboctave/array/CColVector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/CColVector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -60,8 +60,8 @@
 bool
 ComplexColumnVector::operator == (const ComplexColumnVector& a) const
 {
-  octave_idx_type len = length ();
-  if (len != a.length ())
+  octave_idx_type len = numel ();
+  if (len != a.numel ())
     return 0;
   return mx_inline_equal (len, data (), a.data ());
 }
@@ -77,9 +77,9 @@
 ComplexColumnVector&
 ComplexColumnVector::insert (const ColumnVector& a, octave_idx_type r)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (r < 0 || r + a_len > length ())
+  if (r < 0 || r + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -99,9 +99,9 @@
 ComplexColumnVector&
 ComplexColumnVector::insert (const ComplexColumnVector& a, octave_idx_type r)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (r < 0 || r + a_len > length ())
+  if (r < 0 || r + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -121,7 +121,7 @@
 ComplexColumnVector&
 ComplexColumnVector::fill (double val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -137,7 +137,7 @@
 ComplexColumnVector&
 ComplexColumnVector::fill (const Complex& val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -154,7 +154,7 @@
 ComplexColumnVector&
 ComplexColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len)
     {
@@ -179,7 +179,7 @@
 ComplexColumnVector::fill (const Complex& val,
                            octave_idx_type r1, octave_idx_type r2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len)
     {
@@ -203,9 +203,9 @@
 ComplexColumnVector
 ComplexColumnVector::stack (const ColumnVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nr_insert = len;
-  ComplexColumnVector retval (len + a.length ());
+  ComplexColumnVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nr_insert);
   return retval;
@@ -214,9 +214,9 @@
 ComplexColumnVector
 ComplexColumnVector::stack (const ComplexColumnVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nr_insert = len;
-  ComplexColumnVector retval (len + a.length ());
+  ComplexColumnVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nr_insert);
   return retval;
@@ -279,9 +279,9 @@
 ComplexColumnVector&
 ComplexColumnVector::operator += (const ColumnVector& a)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     {
@@ -301,9 +301,9 @@
 ComplexColumnVector&
 ComplexColumnVector::operator -= (const ColumnVector& a)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     {
@@ -337,7 +337,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     gripe_nonconformant ("operator *", nr, nc, a_len, 1);
@@ -382,7 +382,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     {
@@ -410,7 +410,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     {
@@ -438,7 +438,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     {
@@ -465,7 +465,7 @@
 Complex
 ComplexColumnVector::min (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0.0;
 
@@ -485,7 +485,7 @@
 Complex
 ComplexColumnVector::max (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0.0;
 
@@ -508,7 +508,7 @@
 operator << (std::ostream& os, const ComplexColumnVector& a)
 {
 //  int field_width = os.precision () + 7;
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     os << /* setw (field_width) << */ a.elem (i) << "\n";
   return os;
 }
@@ -516,7 +516,7 @@
 std::istream&
 operator >> (std::istream& is, ComplexColumnVector& a)
 {
-  octave_idx_type len = a.length ();
+  octave_idx_type len = a.numel ();
 
   if (len > 0)
     {
--- a/liboctave/array/CDiagMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/CDiagMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -110,7 +110,7 @@
 ComplexDiagMatrix::fill (const ColumnVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -126,7 +126,7 @@
 ComplexDiagMatrix::fill (const ComplexColumnVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -142,7 +142,7 @@
 ComplexDiagMatrix::fill (const RowVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -158,7 +158,7 @@
 ComplexDiagMatrix::fill (const ComplexRowVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -173,7 +173,7 @@
 ComplexDiagMatrix&
 ComplexDiagMatrix::fill (const ColumnVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
@@ -189,7 +189,7 @@
 ComplexDiagMatrix&
 ComplexDiagMatrix::fill (const ComplexColumnVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
@@ -205,7 +205,7 @@
 ComplexDiagMatrix&
 ComplexDiagMatrix::fill (const RowVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
@@ -221,7 +221,7 @@
 ComplexDiagMatrix&
 ComplexDiagMatrix::fill (const ComplexRowVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
--- a/liboctave/array/CMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/CMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -366,7 +366,7 @@
   if (rows () != a.rows () || cols () != a.cols ())
     return false;
 
-  return mx_inline_equal (length (), data (), a.data ());
+  return mx_inline_equal (numel (), data (), a.data ());
 }
 
 bool
@@ -423,7 +423,7 @@
 ComplexMatrix&
 ComplexMatrix::insert (const RowVector& a, octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ())
     {
@@ -446,7 +446,7 @@
 ComplexMatrix::insert (const ColumnVector& a,
                        octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ())
     {
@@ -505,7 +505,7 @@
 ComplexMatrix::insert (const ComplexRowVector& a,
                        octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
@@ -522,7 +522,7 @@
 ComplexMatrix::insert (const ComplexColumnVector& a,
                        octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ())
     {
@@ -693,7 +693,7 @@
     }
 
   octave_idx_type nc_insert = nc;
-  ComplexMatrix retval (nr, nc + a.length ());
+  ComplexMatrix retval (nr, nc + a.numel ());
   retval.insert (*this, 0, 0);
   retval.insert (a, 0, nc_insert);
   return retval;
@@ -704,7 +704,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nr != a.length ())
+  if (nr != a.numel ())
     {
       (*current_liboctave_error_handler) ("row dimension mismatch for append");
       return *this;
@@ -765,7 +765,7 @@
     }
 
   octave_idx_type nc_insert = nc;
-  ComplexMatrix retval (nr, nc + a.length ());
+  ComplexMatrix retval (nr, nc + a.numel ());
   retval.insert (*this, 0, 0);
   retval.insert (a, 0, nc_insert);
   return retval;
@@ -776,7 +776,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nr != a.length ())
+  if (nr != a.numel ())
     {
       (*current_liboctave_error_handler) ("row dimension mismatch for append");
       return *this;
@@ -831,7 +831,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nc != a.length ())
+  if (nc != a.numel ())
     {
       (*current_liboctave_error_handler)
         ("column dimension mismatch for stack");
@@ -858,7 +858,7 @@
     }
 
   octave_idx_type nr_insert = nr;
-  ComplexMatrix retval (nr + a.length (), nc);
+  ComplexMatrix retval (nr + a.numel (), nc);
   retval.insert (*this, 0, 0);
   retval.insert (a, nr_insert, 0);
   return retval;
@@ -907,7 +907,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nc != a.length ())
+  if (nc != a.numel ())
     {
       (*current_liboctave_error_handler)
         ("column dimension mismatch for stack");
@@ -934,7 +934,7 @@
     }
 
   octave_idx_type nr_insert = nr;
-  ComplexMatrix retval (nr + a.length (), nc);
+  ComplexMatrix retval (nr + a.numel (), nc);
   retval.insert (*this, 0, 0);
   retval.insert (a, nr_insert, 0);
   return retval;
@@ -1229,7 +1229,7 @@
 
   ColumnVector sigma = S.extract_diag ();
 
-  octave_idx_type r = sigma.length () - 1;
+  octave_idx_type r = sigma.numel () - 1;
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
@@ -1320,7 +1320,7 @@
 ComplexMatrix
 ComplexMatrix::fourier2d (void) const
 {
-  dim_vector dv(rows (), cols ());
+  dim_vector dv (rows (), cols ());
 
   ComplexMatrix retval (rows (), cols ());
   const Complex *in (data ());
@@ -1334,7 +1334,7 @@
 ComplexMatrix
 ComplexMatrix::ifourier2d (void) const
 {
-  dim_vector dv(rows (), cols ());
+  dim_vector dv (rows (), cols ());
 
   ComplexMatrix retval (rows (), cols ());
   const Complex *in (data ());
@@ -2844,7 +2844,7 @@
   octave_idx_type m = rows ();
   octave_idx_type n = cols ();
 
-  if (m != b.length ())
+  if (m != b.numel ())
     (*current_liboctave_error_handler)
       ("matrix dimension mismatch solution of linear equations");
   else if (m == 0 || n == 0 || b.cols () == 0)
@@ -2957,11 +2957,11 @@
 {
   ComplexMatrix retval;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
   if (len != 0)
     {
-      octave_idx_type a_len = a.length ();
+      octave_idx_type a_len = a.numel ();
 
       retval = ComplexMatrix (len, a_len);
       Complex *c = retval.fortran_vec ();
@@ -3085,7 +3085,7 @@
 
   Complex *d = fortran_vec (); // Ensures only one reference to my privates!
 
-  mx_inline_add2 (length (), d, a.data ());
+  mx_inline_add2 (numel (), d, a.data ());
   return *this;
 }
 
@@ -3109,7 +3109,7 @@
 
   Complex *d = fortran_vec (); // Ensures only one reference to my privates!
 
-  mx_inline_sub2 (length (), d, a.data ());
+  mx_inline_sub2 (numel (), d, a.data ());
   return *this;
 }
 
@@ -4001,9 +4001,9 @@
 {
   if (n < 1) n = 1;
 
-  octave_idx_type m = x1.length ();
-
-  if (x2.length () != m)
+  octave_idx_type m = x1.numel ();
+
+  if (x2.numel () != m)
     (*current_liboctave_error_handler)
       ("linspace: vectors must be of equal length");
 
--- a/liboctave/array/CNDArray.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/CNDArray.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -69,9 +69,9 @@
   for (int i = 0; i < dim; i++)
     stride *= dv(i);
 
-  octave_idx_type howmany = numel () / dv (dim);
+  octave_idx_type howmany = numel () / dv(dim);
   howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
-  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride);
+  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
   octave_idx_type dist = (stride == 1 ? n : 1);
 
   const Complex *in (fortran_vec ());
@@ -100,9 +100,9 @@
   for (int i = 0; i < dim; i++)
     stride *= dv(i);
 
-  octave_idx_type howmany = numel () / dv (dim);
+  octave_idx_type howmany = numel () / dv(dim);
   howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
-  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride);
+  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
   octave_idx_type dist = (stride == 1 ? n : 1);
 
   const Complex *in (fortran_vec ());
@@ -124,7 +124,7 @@
   if (dv.length () < 2)
     return ComplexNDArray ();
 
-  dim_vector dv2(dv(0), dv(1));
+  dim_vector dv2 (dv(0), dv(1));
   const Complex *in = fortran_vec ();
   ComplexNDArray retval (dv);
   Complex *out = retval.fortran_vec ();
@@ -144,7 +144,7 @@
   if (dv.length () < 2)
     return ComplexNDArray ();
 
-  dim_vector dv2(dv(0), dv(1));
+  dim_vector dv2 (dv(0), dv(1));
   const Complex *in = fortran_vec ();
   ComplexNDArray retval (dv);
   Complex *out = retval.fortran_vec ();
@@ -535,7 +535,7 @@
 bool
 ComplexNDArray::all_integers (double& max_val, double& min_val) const
 {
-  octave_idx_type nel = nelem ();
+  octave_idx_type nel = numel ();
 
   if (nel > 0)
     {
@@ -765,7 +765,7 @@
 
       for (int i = 0; i < n; i++)
         {
-          if (a_ra_idx (i) < 0 || (a_ra_idx (i) + a_dv (i)) > dimensions (i))
+          if (a_ra_idx(i) < 0 || (a_ra_idx(i) + a_dv(i)) > dimensions(i))
             {
               (*current_liboctave_error_handler)
                 ("Array<T>::insert: range error for insert");
@@ -778,14 +778,14 @@
 
       octave_idx_type n_elt = a.numel ();
 
-      // IS make_unique () NECCESSARY HERE??
+      // IS make_unique () NECESSARY HERE?
 
       for (octave_idx_type i = 0; i < n_elt; i++)
         {
           Array<octave_idx_type> ra_idx = a_ra_idx;
 
-          ra_idx.elem (0) = a_ra_idx (0) + r;
-          ra_idx.elem (1) = a_ra_idx (1) + c;
+          ra_idx.elem (0) = a_ra_idx(0) + r;
+          ra_idx.elem (1) = a_ra_idx(1) + c;
 
           elem (ra_idx) = a.elem (a_ra_idx);
 
@@ -846,7 +846,7 @@
 std::ostream&
 operator << (std::ostream& os, const ComplexNDArray& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   for (octave_idx_type i = 0; i < nel; i++)
     {
@@ -860,7 +860,7 @@
 std::istream&
 operator >> (std::istream& is, ComplexNDArray& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   if (nel > 0)
     {
--- a/liboctave/array/CRowVector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/CRowVector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -59,8 +59,8 @@
 bool
 ComplexRowVector::operator == (const ComplexRowVector& a) const
 {
-  octave_idx_type len = length ();
-  if (len != a.length ())
+  octave_idx_type len = numel ();
+  if (len != a.numel ())
     return 0;
   return mx_inline_equal (len, data (), a.data ());
 }
@@ -76,9 +76,9 @@
 ComplexRowVector&
 ComplexRowVector::insert (const RowVector& a, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (c < 0 || c + a_len > length ())
+  if (c < 0 || c + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -98,9 +98,9 @@
 ComplexRowVector&
 ComplexRowVector::insert (const ComplexRowVector& a, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (c < 0 || c + a_len > length ())
+  if (c < 0 || c + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -120,7 +120,7 @@
 ComplexRowVector&
 ComplexRowVector::fill (double val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -136,7 +136,7 @@
 ComplexRowVector&
 ComplexRowVector::fill (const Complex& val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -152,7 +152,7 @@
 ComplexRowVector&
 ComplexRowVector::fill (double val, octave_idx_type c1, octave_idx_type c2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len)
     {
@@ -177,7 +177,7 @@
 ComplexRowVector::fill (const Complex& val,
                         octave_idx_type c1, octave_idx_type c2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len)
     {
@@ -201,9 +201,9 @@
 ComplexRowVector
 ComplexRowVector::append (const RowVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nc_insert = len;
-  ComplexRowVector retval (len + a.length ());
+  ComplexRowVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nc_insert);
   return retval;
@@ -212,9 +212,9 @@
 ComplexRowVector
 ComplexRowVector::append (const ComplexRowVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nc_insert = len;
-  ComplexRowVector retval (len + a.length ());
+  ComplexRowVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nc_insert);
   return retval;
@@ -271,9 +271,9 @@
 ComplexRowVector&
 ComplexRowVector::operator += (const RowVector& a)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     {
@@ -293,9 +293,9 @@
 ComplexRowVector&
 ComplexRowVector::operator -= (const RowVector& a)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     {
@@ -319,7 +319,7 @@
 {
   ComplexRowVector retval;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
   octave_idx_type a_nr = a.rows ();
   octave_idx_type a_nc = a.cols ();
@@ -361,7 +361,7 @@
 Complex
 ComplexRowVector::min (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return Complex (0.0);
 
@@ -381,7 +381,7 @@
 Complex
 ComplexRowVector::max (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return Complex (0.0);
 
@@ -404,7 +404,7 @@
 operator << (std::ostream& os, const ComplexRowVector& a)
 {
 //  int field_width = os.precision () + 7;
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     os << " " /* setw (field_width) */ << a.elem (i);
   return os;
 }
@@ -412,7 +412,7 @@
 std::istream&
 operator >> (std::istream& is, ComplexRowVector& a)
 {
-  octave_idx_type len = a.length ();
+  octave_idx_type len = a.numel ();
 
   if (len > 0)
     {
@@ -445,9 +445,9 @@
 {
   Complex retval (0.0, 0.0);
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     gripe_nonconformant ("operator *", len, a_len);
--- a/liboctave/array/DiagArray2.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/DiagArray2.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -42,7 +42,7 @@
   : Array<T> (a.as_column ()), d1 (r), d2 (c)
 {
   octave_idx_type rcmin = std::min (r, c);
-  if (rcmin != a.length ())
+  if (rcmin != a.numel ())
     Array<T>::resize (dim_vector (rcmin, 1));
 }
 
--- a/liboctave/array/DiagArray2.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/DiagArray2.h	Tue Jun 23 20:00:59 2015 -0700
@@ -87,9 +87,9 @@
   octave_idx_type cols (void) const { return dim2 (); }
   octave_idx_type columns (void) const { return dim2 (); }
 
-  octave_idx_type diag_length (void) const { return Array<T>::length (); }
+  octave_idx_type diag_length (void) const { return Array<T>::numel (); }
   // FIXME: a dangerous ambiguity?
-  octave_idx_type length (void) const { return Array<T>::length (); }
+  octave_idx_type length (void) const { return Array<T>::numel (); }
   octave_idx_type nelem (void) const { return dim1 () * dim2 (); }
   octave_idx_type numel (void) const { return nelem (); }
 
--- a/liboctave/array/MArray.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/MArray.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -56,7 +56,7 @@
 void
 MArray<T>::idx_add (const idx_vector& idx, T val)
 {
-  octave_idx_type n = this->length ();
+  octave_idx_type n = this->numel ();
   octave_idx_type ext = idx.extent (n);
   if (ext > n)
     {
@@ -74,7 +74,7 @@
 void
 MArray<T>::idx_add (const idx_vector& idx, const MArray<T>& vals)
 {
-  octave_idx_type n = this->length ();
+  octave_idx_type n = this->numel ();
   octave_idx_type ext = idx.extent (n);
   if (ext > n)
     {
@@ -84,7 +84,7 @@
 
   octave_quit ();
 
-  octave_idx_type len = std::min (idx.length (n), vals.length ());
+  octave_idx_type len = std::min (idx.length (n), vals.numel ());
   idx.loop (len, _idxadda_helper<T> (this->fortran_vec (), vals.data ()));
 }
 
@@ -103,7 +103,7 @@
 void
 MArray<T>::idx_min (const idx_vector& idx, const MArray<T>& vals)
 {
-  octave_idx_type n = this->length ();
+  octave_idx_type n = this->numel ();
   octave_idx_type ext = idx.extent (n);
   if (ext > n)
     {
@@ -113,7 +113,7 @@
 
   octave_quit ();
 
-  octave_idx_type len = std::min (idx.length (n), vals.length ());
+  octave_idx_type len = std::min (idx.length (n), vals.numel ());
   idx.loop (len, _idxbinop_helper<T, xmin> (this->fortran_vec (),
                                             vals.data ()));
 }
@@ -122,7 +122,7 @@
 void
 MArray<T>::idx_max (const idx_vector& idx, const MArray<T>& vals)
 {
-  octave_idx_type n = this->length ();
+  octave_idx_type n = this->numel ();
   octave_idx_type ext = idx.extent (n);
   if (ext > n)
     {
@@ -132,7 +132,7 @@
 
   octave_quit ();
 
-  octave_idx_type len = std::min (idx.length (n), vals.length ());
+  octave_idx_type len = std::min (idx.length (n), vals.numel ());
   idx.loop (len, _idxbinop_helper<T, xmax> (this->fortran_vec (),
                                             vals.data ()));
 }
@@ -153,7 +153,7 @@
   dim_vector ddv = Array<T>::dims ().redim (nd);
   dim_vector sdv = vals.dims ().redim (nd);
 
-  octave_idx_type ext = idx.extent (ddv (dim));
+  octave_idx_type ext = idx.extent (ddv(dim));
 
   if (ext > ddv(dim))
     {
--- a/liboctave/array/PermMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/PermMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -41,7 +41,7 @@
 {
   if (check)
     {
-      if (! idx_vector (p).is_permutation (p.length ()))
+      if (! idx_vector (p).is_permutation (p.numel ()))
         {
           gripe_invalid_permutation ();
           Array<octave_idx_type>::operator = (Array<octave_idx_type> ());
@@ -104,7 +104,7 @@
 octave_idx_type
 PermMatrix::checkelem (octave_idx_type i, octave_idx_type j) const
 {
-  octave_idx_type len = Array<octave_idx_type>::length ();
+  octave_idx_type len = Array<octave_idx_type>::numel ();
   if (i < 0 || j < 0 || i > len || j > len)
     {
       (*current_liboctave_error_handler) ("index out of range");
@@ -118,7 +118,7 @@
 PermMatrix
 PermMatrix::transpose (void) const
 {
-  octave_idx_type len = Array<octave_idx_type>::length ();
+  octave_idx_type len = Array<octave_idx_type>::numel ();
 
   PermMatrix retval (len);
 
--- a/liboctave/array/PermMatrix.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/PermMatrix.h	Tue Jun 23 20:00:59 2015 -0700
@@ -48,21 +48,21 @@
   PermMatrix (const idx_vector& idx, bool colp, octave_idx_type n = 0);
 
   octave_idx_type dim1 (void) const
-  { return Array<octave_idx_type>::length (); }
+  { return Array<octave_idx_type>::numel (); }
   octave_idx_type dim2 (void) const
-  { return Array<octave_idx_type>::length (); }
+  { return Array<octave_idx_type>::numel (); }
 
   octave_idx_type rows (void) const { return dim1 (); }
   octave_idx_type cols (void) const { return dim2 (); }
   octave_idx_type columns (void) const { return dim2 (); }
 
   octave_idx_type perm_length (void) const
-  { return Array<octave_idx_type>::length (); }
+  { return Array<octave_idx_type>::numel (); }
   // FIXME: a dangerous ambiguity?
   octave_idx_type length (void) const
   { return perm_length (); }
-  octave_idx_type nelem (void) const { return dim1 () * dim2 (); }
-  octave_idx_type numel (void) const { return nelem (); }
+  GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return numel (); }
+  octave_idx_type numel (void) const { return dim1 () * dim2 (); }
 
   size_t byte_size (void) const
   { return Array<octave_idx_type>::byte_size (); }
--- a/liboctave/array/Range.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/Range.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -44,24 +44,24 @@
   // or fewer elements only the base needs to be an integer
 
   return (! (xisnan (rng_base) || xisnan (rng_inc))
-          && (NINTbig (rng_base) == rng_base || rng_nelem < 1)
-          && (NINTbig (rng_inc) == rng_inc || rng_nelem <= 1));
+          && (NINTbig (rng_base) == rng_base || rng_numel < 1)
+          && (NINTbig (rng_inc) == rng_inc || rng_numel <= 1));
 }
 
 Matrix
 Range::matrix_value (void) const
 {
-  if (rng_nelem > 0 && cache.nelem () == 0)
+  if (rng_numel > 0 && cache.numel () == 0)
     {
-      cache.resize (1, rng_nelem);
+      cache.resize (1, rng_numel);
       double b = rng_base;
       double increment = rng_inc;
-      if (rng_nelem > 0)
+      if (rng_numel > 0)
         {
           // The first element must always be *exactly* the base.
           // E.g, -0 would otherwise become +0 in the loop (-0 + 0*increment).
           cache(0) = b;
-          for (octave_idx_type i = 1; i < rng_nelem; i++)
+          for (octave_idx_type i = 1; i < rng_numel; i++)
             cache(i) = b + i * increment;
         }
 
@@ -72,9 +72,9 @@
       // elements.  The tests need equality (>= rng_limit or <= rng_limit)
       // to have expressions like -5:1:-0 result in a -0 endpoint.
 
-      if ((rng_inc > 0 && cache(rng_nelem-1) >= rng_limit)
-          || (rng_inc < 0 && cache(rng_nelem-1) <= rng_limit))
-        cache(rng_nelem-1) = rng_limit;
+      if ((rng_inc > 0 && cache(rng_numel-1) >= rng_limit)
+          || (rng_inc < 0 && cache(rng_numel-1) <= rng_limit))
+        cache(rng_numel-1) = rng_limit;
     }
 
   return cache;
@@ -83,12 +83,12 @@
 double
 Range::checkelem (octave_idx_type i) const
 {
-  if (i < 0 || i >= rng_nelem)
-    gripe_index_out_of_range (1, 1, i+1, rng_nelem);
+  if (i < 0 || i >= rng_numel)
+    gripe_index_out_of_range (1, 1, i+1, rng_numel);
 
   if (i == 0)
     return rng_base;
-  else if (i < rng_nelem - 1)
+  else if (i < rng_numel - 1)
     return rng_base + i * rng_inc;
   else
     {
@@ -109,7 +109,7 @@
 #else
   if (i == 0)
     return rng_base;
-  else if (i < rng_nelem - 1)
+  else if (i < rng_numel - 1)
     return rng_base + i * rng_inc;
   else
     {
@@ -158,11 +158,11 @@
 {
   Array<double> retval;
 
-  octave_idx_type n = rng_nelem;
+  octave_idx_type n = rng_numel;
 
   if (i.is_colon ())
     {
-      retval = matrix_value ().reshape (dim_vector (rng_nelem, 1));
+      retval = matrix_value ().reshape (dim_vector (rng_numel, 1));
     }
   else
     {
@@ -181,26 +181,26 @@
       // idx_vector loop across all values in i,
       // executing __rangeidx_helper (i) for each i
       i.loop (n, __rangeidx_helper (retval.fortran_vec (),
-                                    rng_base, rng_inc, rng_limit, rng_nelem));
+                                    rng_base, rng_inc, rng_limit, rng_numel));
     }
 
   return retval;
 }
 
-// NOTE: max and min only return useful values if nelem > 0.
-//       do_minmax_body() in max.cc avoids calling Range::min/max if nelem == 0.
+// NOTE: max and min only return useful values if numel > 0.
+//       do_minmax_body() in max.cc avoids calling Range::min/max if numel == 0.
 
 double
 Range::min (void) const
 {
   double retval = 0.0;
-  if (rng_nelem > 0)
+  if (rng_numel > 0)
     {
       if (rng_inc > 0)
         retval = rng_base;
       else
         {
-          retval = rng_base + (rng_nelem - 1) * rng_inc;
+          retval = rng_base + (rng_numel - 1) * rng_inc;
 
           // See the note in the matrix_value method above.
           if (retval <= rng_limit)
@@ -215,11 +215,11 @@
 Range::max (void) const
 {
   double retval = 0.0;
-  if (rng_nelem > 0)
+  if (rng_numel > 0)
     {
       if (rng_inc > 0)
         {
-          retval = rng_base + (rng_nelem - 1) * rng_inc;
+          retval = rng_base + (rng_numel - 1) * rng_inc;
 
           // See the note in the matrix_value method above.
           if (retval >= rng_limit)
@@ -255,7 +255,7 @@
 void
 Range::sort_internal (Array<octave_idx_type>& sidx, bool ascending)
 {
-  octave_idx_type nel = nelem ();
+  octave_idx_type nel = numel ();
 
   sidx.resize (dim_vector (1, nel));
 
@@ -336,9 +336,9 @@
 sortmode
 Range::is_sorted (sortmode mode) const
 {
-  if (rng_nelem > 1 && rng_inc > 0)
+  if (rng_numel > 1 && rng_inc > 0)
     mode = (mode == DESCENDING) ? UNSORTED : ASCENDING;
-  else if (rng_nelem > 1 && rng_inc < 0)
+  else if (rng_numel > 1 && rng_inc < 0)
     mode = (mode == ASCENDING) ? UNSORTED : DESCENDING;
   else
     mode = mode ? mode : ASCENDING;
@@ -351,7 +351,7 @@
 {
   double b = a.base ();
   double increment = a.inc ();
-  octave_idx_type num_elem = a.nelem ();
+  octave_idx_type num_elem = a.numel ();
 
   if (num_elem > 1)
     {
@@ -377,7 +377,7 @@
       if (is)
         {
           is >> a.rng_inc;
-          a.rng_nelem = a.nelem_internal ();
+          a.rng_numel = a.numel_internal ();
         }
     }
 
@@ -387,13 +387,13 @@
 Range
 operator - (const Range& r)
 {
-  return Range (-r.base (), -r.limit (), -r.inc (), r.nelem ());
+  return Range (-r.base (), -r.limit (), -r.inc (), r.numel ());
 }
 
 Range operator + (double x, const Range& r)
 {
-  Range result (x + r.base (), x + r.limit (), r.inc (), r.nelem ());
-  if (result.rng_nelem < 0)
+  Range result (x + r.base (), x + r.limit (), r.inc (), r.numel ());
+  if (result.rng_numel < 0)
     result.cache = x + r.matrix_value ();
 
   return result;
@@ -401,8 +401,8 @@
 
 Range operator + (const Range& r, double x)
 {
-  Range result (r.base () + x, r.limit () + x, r.inc (), r.nelem ());
-  if (result.rng_nelem < 0)
+  Range result (r.base () + x, r.limit () + x, r.inc (), r.numel ());
+  if (result.rng_numel < 0)
     result.cache = r.matrix_value () + x;
 
   return result;
@@ -410,8 +410,8 @@
 
 Range operator - (double x, const Range& r)
 {
-  Range result (x - r.base (), x - r.limit (), -r.inc (), r.nelem ());
-  if (result.rng_nelem < 0)
+  Range result (x - r.base (), x - r.limit (), -r.inc (), r.numel ());
+  if (result.rng_numel < 0)
     result.cache = x - r.matrix_value ();
 
   return result;
@@ -419,8 +419,8 @@
 
 Range operator - (const Range& r, double x)
 {
-  Range result (r.base () - x, r.limit () - x, r.inc (), r.nelem ());
-  if (result.rng_nelem < 0)
+  Range result (r.base () - x, r.limit () - x, r.inc (), r.numel ());
+  if (result.rng_numel < 0)
     result.cache = r.matrix_value () - x;
 
   return result;
@@ -428,8 +428,8 @@
 
 Range operator * (double x, const Range& r)
 {
-  Range result (x * r.base (), x * r.limit (), x * r.inc (), r.nelem ());
-  if (result.rng_nelem < 0)
+  Range result (x * r.base (), x * r.limit (), x * r.inc (), r.numel ());
+  if (result.rng_numel < 0)
     result.cache = x * r.matrix_value ();
 
   return result;
@@ -437,8 +437,8 @@
 
 Range operator * (const Range& r, double x)
 {
-  Range result (r.base () * x, r.limit () * x, r.inc () * x, r.nelem ());
-  if (result.rng_nelem < 0)
+  Range result (r.base () * x, r.limit () * x, r.inc () * x, r.numel ());
+  if (result.rng_numel < 0)
     result.cache = r.matrix_value () * x;
 
   return result;
@@ -524,7 +524,7 @@
 }
 
 octave_idx_type
-Range::nelem_internal (void) const
+Range::numel_internal (void) const
 {
   octave_idx_type retval = -1;
 
--- a/liboctave/array/Range.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/Range.h	Tue Jun 23 20:00:59 2015 -0700
@@ -35,33 +35,34 @@
 public:
 
   Range (void)
-    : rng_base (0), rng_limit (0), rng_inc (0), rng_nelem (0), cache (1, 0) { }
+    : rng_base (0), rng_limit (0), rng_inc (0), rng_numel (0), cache (1, 0) { }
 
   Range (const Range& r)
     : rng_base (r.rng_base), rng_limit (r.rng_limit), rng_inc (r.rng_inc),
-      rng_nelem (r.rng_nelem), cache (r.cache) { }
+      rng_numel (r.rng_numel), cache (r.cache) { }
 
   Range (double b, double l)
     : rng_base (b), rng_limit (l), rng_inc (1),
-      rng_nelem (nelem_internal ()), cache () { }
+      rng_numel (numel_internal ()), cache () { }
 
   Range (double b, double l, double i)
     : rng_base (b), rng_limit (l), rng_inc (i),
-      rng_nelem (nelem_internal ()), cache () { }
+      rng_numel (numel_internal ()), cache () { }
 
   // For operators' usage (to preserve element count).
   Range (double b, double i, octave_idx_type n)
     : rng_base (b), rng_limit (b + (n-1) * i), rng_inc (i),
-      rng_nelem (n), cache ()
+      rng_numel (n), cache ()
   {
     if (! xfinite (b) || ! xfinite (i) || ! xfinite (rng_limit))
-      rng_nelem = -2;
+      rng_numel = -2;
   }
 
   double base (void) const { return rng_base; }
   double limit (void) const { return rng_limit; }
   double inc (void) const { return rng_inc; }
-  octave_idx_type nelem (void) const { return rng_nelem; }
+  GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return numel (); }
+  octave_idx_type numel (void) const { return rng_numel; }
 
   bool all_elements_are_ints (void) const;
 
@@ -137,11 +138,11 @@
   double rng_limit;
   double rng_inc;
 
-  octave_idx_type rng_nelem;
+  octave_idx_type rng_numel;
 
   mutable Matrix cache;
 
-  octave_idx_type nelem_internal (void) const;
+  octave_idx_type numel_internal (void) const;
 
   void clear_cache (void) const { cache.resize (0, 0); }
 
@@ -150,10 +151,10 @@
   // For operators' usage (to allow all values to be set directly).
   Range (double b, double l, double i, octave_idx_type n)
     : rng_base (b), rng_limit (l), rng_inc (i),
-      rng_nelem (n), cache ()
+      rng_numel (n), cache ()
   {
     if (! xfinite (b) || ! xfinite (i) || ! xfinite (l))
-      rng_nelem = -2;
+      rng_numel = -2;
   }
 };
 
--- a/liboctave/array/Sparse.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/Sparse.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -239,8 +239,8 @@
   // Work in unsigned long long to avoid overflow issues with numel
   unsigned long long a_nel = static_cast<unsigned long long>(a.rows ()) *
                              static_cast<unsigned long long>(a.cols ());
-  unsigned long long dv_nel = static_cast<unsigned long long>(dv (0)) *
-                              static_cast<unsigned long long>(dv (1));
+  unsigned long long dv_nel = static_cast<unsigned long long>(dv(0)) *
+                              static_cast<unsigned long long>(dv(1));
 
   if (a_nel != dv_nel)
     (*current_liboctave_error_handler)
@@ -249,10 +249,10 @@
     {
       dim_vector old_dims = a.dims ();
       octave_idx_type new_nzmx = a.nnz ();
-      octave_idx_type new_nr = dv (0);
-      octave_idx_type new_nc = dv (1);
-      octave_idx_type old_nr = old_dims (0);
-      octave_idx_type old_nc = old_dims (1);
+      octave_idx_type new_nr = dv(0);
+      octave_idx_type new_nc = dv(1);
+      octave_idx_type old_nr = old_dims(0);
+      octave_idx_type old_nc = old_dims(1);
 
       rep = new typename Sparse<T>::SparseRep (new_nr, new_nc, new_nzmx);
 
@@ -646,7 +646,7 @@
     {
       octave_idx_type nr = rows ();
       octave_idx_type nc = cols ();
-      octave_idx_type len = a.length ();
+      octave_idx_type len = a.numel ();
       octave_idx_type new_nzmx = 0;
 
       // First count the number of nonzero terms
@@ -704,7 +704,7 @@
 
   octave_idx_type n = dimensions.length ();
 
-  if (n > 0 && n == ra_idx.length ())
+  if (n > 0 && n == ra_idx.numel ())
     {
       retval = ra_idx(--n);
 
@@ -767,7 +767,7 @@
 
   buf << fcn << " (";
 
-  octave_idx_type n = ra_idx.length ();
+  octave_idx_type n = ra_idx.numel ();
 
   if (n > 0)
     buf << ra_idx(0);
@@ -792,7 +792,7 @@
 
   buf << fcn << " (";
 
-  octave_idx_type n = ra_idx.length ();
+  octave_idx_type n = ra_idx.numel ();
 
   if (n > 0)
     buf << ra_idx(0);
@@ -886,7 +886,7 @@
   bool fail = false;
   bool trans = false;
 
-  if (perm_vec.length () == 2)
+  if (perm_vec.numel () == 2)
     {
       if (perm_vec(0) == 0 && perm_vec(1) == 1)
         /* do nothing */;
@@ -1082,13 +1082,13 @@
 Sparse<T>::insert (const Sparse<T>& a, const Array<octave_idx_type>& ra_idx)
 {
 
-  if (ra_idx.length () != 2)
+  if (ra_idx.numel () != 2)
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
     }
 
-  return insert (a, ra_idx (0), ra_idx (1));
+  return insert (a, ra_idx(0), ra_idx(1));
 }
 
 template <class T>
@@ -1879,7 +1879,7 @@
               octave_idx_type rnz = rhs.nnz ();
               octave_idx_type new_nz = nz - (ui - li) + rnz;
 
-              if (new_nz >= nz && new_nz <= capacity ())
+              if (new_nz >= nz && new_nz <= nzmax ())
                 {
                   // Adding/overwriting elements, enough capacity allocated.
 
@@ -2062,7 +2062,7 @@
               octave_idx_type rnz = rhs.nnz ();
               octave_idx_type new_nz = nz - (ui - li) + rnz;
 
-              if (new_nz >= nz && new_nz <= capacity ())
+              if (new_nz >= nz && new_nz <= nzmax ())
                 {
                   // Adding/overwriting elements, enough capacity allocated.
 
@@ -2244,7 +2244,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.columns ();
 
-  if (m.length () < 1 || dim > 1)
+  if (m.numel () < 1 || dim > 1)
     return m;
 
   if (dim > 0)
@@ -2310,7 +2310,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.columns ();
 
-  if (m.length () < 1 || dim > 1)
+  if (m.numel () < 1 || dim > 1)
     {
       sidx = Array<octave_idx_type> (dim_vector (nr, nc), 1);
       return m;
--- a/liboctave/array/Sparse.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/Sparse.h	Tue Jun 23 20:00:59 2015 -0700
@@ -240,11 +240,13 @@
 
   Sparse<T>& operator = (const Sparse<T>& a);
 
-  // Note that nzmax and capacity are the amount of storage for
-  // nonzero elements, while nnz is the actual number of nonzero
-  // terms.
+  //! Amount of storage for nonzero elements.
+  //! This may differ from the actual number of elements, see nnz().
   octave_idx_type nzmax (void) const { return rep->length (); }
-  octave_idx_type capacity (void) const { return nzmax (); }
+  //! Amount of storage for nonzero elements.
+  //! Synonymous with nzmax().
+  GCC_ATTR_DEPRECATED octave_idx_type capacity (void) const { return nzmax (); }
+  //!Actual number of nonzero terms.
   octave_idx_type nnz (void) const { return rep->nnz (); }
 
   // Querying the number of elements (incl. zeros) may overflow the index type,
@@ -254,8 +256,8 @@
     return dimensions.safe_numel ();
   }
 
-  octave_idx_type nelem (void) const { return capacity (); }
-  octave_idx_type length (void) const { return numel (); }
+  GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return nzmax (); }
+  GCC_ATTR_DEPRECATED octave_idx_type length (void) const { return numel (); }
 
   octave_idx_type dim1 (void) const { return dimensions(0); }
   octave_idx_type dim2 (void) const { return dimensions(1); }
@@ -276,7 +278,7 @@
   size_t byte_size (void) const
   {
     return (static_cast<size_t>(cols () + 1) * sizeof (octave_idx_type)
-            + static_cast<size_t> (capacity ())
+            + static_cast<size_t> (nzmax ())
             * (sizeof (T) + sizeof (octave_idx_type)));
   }
 
--- a/liboctave/array/boolMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/boolMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -43,7 +43,7 @@
   if (rows () != a.rows () || cols () != a.cols ())
     return 0;
 
-  return mx_inline_equal (length (), data (), a.data ());
+  return mx_inline_equal (numel (), data (), a.data ());
 }
 
 bool
--- a/liboctave/array/chMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/chMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -45,7 +45,7 @@
   if (rows () != a.rows () || cols () != a.cols ())
     return 0;
 
-  return mx_inline_equal (length (), data (), a.data ());
+  return mx_inline_equal (numel (), data (), a.data ());
 }
 
 bool
--- a/liboctave/array/chNDArray.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/chNDArray.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -70,7 +70,7 @@
 }
 
 charNDArray::charNDArray (const string_vector& s, char fill_value)
-  : Array<char> (dim_vector (s.length (), s.max_length ()), fill_value)
+  : Array<char> (dim_vector (s.numel (), s.max_length ()), fill_value)
 {
   octave_idx_type nr = rows ();
 
--- a/liboctave/array/dColVector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/dColVector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -55,8 +55,8 @@
 bool
 ColumnVector::operator == (const ColumnVector& a) const
 {
-  octave_idx_type len = length ();
-  if (len != a.length ())
+  octave_idx_type len = numel ();
+  if (len != a.numel ())
     return 0;
   return mx_inline_equal (len, data (), a.data ());
 }
@@ -70,9 +70,9 @@
 ColumnVector&
 ColumnVector::insert (const ColumnVector& a, octave_idx_type r)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (r < 0 || r + a_len > length ())
+  if (r < 0 || r + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -92,7 +92,7 @@
 ColumnVector&
 ColumnVector::fill (double val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -108,7 +108,7 @@
 ColumnVector&
 ColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len)
     {
@@ -132,9 +132,9 @@
 ColumnVector
 ColumnVector::stack (const ColumnVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nr_insert = len;
-  ColumnVector retval (len + a.length ());
+  ColumnVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nr_insert);
   return retval;
@@ -202,7 +202,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     gripe_nonconformant ("operator *", nr, nc, a_len, 1);
@@ -239,7 +239,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     gripe_nonconformant ("operator *", nr, nc, a_len, 1);
@@ -267,7 +267,7 @@
 double
 ColumnVector::min (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0.0;
 
@@ -283,7 +283,7 @@
 double
 ColumnVector::max (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0.0;
 
@@ -300,7 +300,7 @@
 operator << (std::ostream& os, const ColumnVector& a)
 {
 //  int field_width = os.precision () + 7;
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     os << /* setw (field_width) << */ a.elem (i) << "\n";
   return os;
 }
@@ -308,7 +308,7 @@
 std::istream&
 operator >> (std::istream& is, ColumnVector& a)
 {
-  octave_idx_type len = a.length ();
+  octave_idx_type len = a.numel ();
 
   if (len > 0)
     {
--- a/liboctave/array/dDiagMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/dDiagMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -78,7 +78,7 @@
 DiagMatrix::fill (const ColumnVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -94,7 +94,7 @@
 DiagMatrix::fill (const RowVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -109,7 +109,7 @@
 DiagMatrix&
 DiagMatrix::fill (const ColumnVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
@@ -125,7 +125,7 @@
 DiagMatrix&
 DiagMatrix::fill (const RowVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
--- a/liboctave/array/dMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/dMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -306,7 +306,7 @@
   if (rows () != a.rows () || cols () != a.cols ())
     return false;
 
-  return mx_inline_equal (length (), data (), a.data ());
+  return mx_inline_equal (numel (), data (), a.data ());
 }
 
 bool
@@ -341,7 +341,7 @@
 Matrix&
 Matrix::insert (const RowVector& a, octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ())
     {
@@ -363,7 +363,7 @@
 Matrix&
 Matrix::insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ())
     {
@@ -486,7 +486,7 @@
     }
 
   octave_idx_type nc_insert = nc;
-  Matrix retval (nr, nc + a.length ());
+  Matrix retval (nr, nc + a.numel ());
   retval.insert (*this, 0, 0);
   retval.insert (a, 0, nc_insert);
   return retval;
@@ -497,7 +497,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nr != a.length ())
+  if (nr != a.numel ())
     {
       (*current_liboctave_error_handler) ("row dimension mismatch for append");
       return Matrix ();
@@ -552,7 +552,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nc != a.length ())
+  if (nc != a.numel ())
     {
       (*current_liboctave_error_handler)
         ("column dimension mismatch for stack");
@@ -579,7 +579,7 @@
     }
 
   octave_idx_type nr_insert = nr;
-  Matrix retval (nr + a.length (), nc);
+  Matrix retval (nr + a.numel (), nc);
   retval.insert (*this, 0, 0);
   retval.insert (a, nr_insert, 0);
   return retval;
@@ -877,7 +877,7 @@
 
   ColumnVector sigma = S.extract_diag ();
 
-  octave_idx_type r = sigma.length () - 1;
+  octave_idx_type r = sigma.numel () - 1;
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
@@ -967,7 +967,7 @@
 ComplexMatrix
 Matrix::fourier2d (void) const
 {
-  dim_vector dv(rows (), cols ());
+  dim_vector dv (rows (), cols ());
 
   const double *in = fortran_vec ();
   ComplexMatrix retval (rows (), cols ());
@@ -979,7 +979,7 @@
 ComplexMatrix
 Matrix::ifourier2d (void) const
 {
-  dim_vector dv(rows (), cols ());
+  dim_vector dv (rows (), cols ());
 
   ComplexMatrix retval (*this);
   Complex *out (retval.fortran_vec ());
@@ -2467,7 +2467,7 @@
   octave_idx_type m = rows ();
   octave_idx_type n = cols ();
 
-  if (m != b.length ())
+  if (m != b.numel ())
     (*current_liboctave_error_handler)
       ("matrix dimension mismatch solution of linear equations");
   else if (m == 0 || n == 0)
@@ -2636,11 +2636,11 @@
 {
   Matrix retval;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
   if (len != 0)
     {
-      octave_idx_type a_len = a.length ();
+      octave_idx_type a_len = a.numel ();
 
       retval = Matrix (len, a_len);
       double *c = retval.fortran_vec ();
@@ -3332,9 +3332,9 @@
 {
   if (n < 1) n = 1;
 
-  octave_idx_type m = x1.length ();
-
-  if (x2.length () != m)
+  octave_idx_type m = x1.numel ();
+
+  if (x2.numel () != m)
     (*current_liboctave_error_handler)
       ("linspace: vectors must be of equal length");
 
--- a/liboctave/array/dNDArray.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/dNDArray.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -110,9 +110,9 @@
   for (int i = 0; i < dim; i++)
     stride *= dv(i);
 
-  octave_idx_type howmany = numel () / dv (dim);
+  octave_idx_type howmany = numel () / dv(dim);
   howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
-  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride);
+  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
   octave_idx_type dist = (stride == 1 ? n : 1);
 
   const double *in (fortran_vec ());
@@ -141,9 +141,9 @@
   for (int i = 0; i < dim; i++)
     stride *= dv(i);
 
-  octave_idx_type howmany = numel () / dv (dim);
+  octave_idx_type howmany = numel () / dv(dim);
   howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
-  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride);
+  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
   octave_idx_type dist = (stride == 1 ? n : 1);
 
   ComplexNDArray retval (*this);
@@ -164,7 +164,7 @@
   if (dv.length () < 2)
     return ComplexNDArray ();
 
-  dim_vector dv2(dv(0), dv(1));
+  dim_vector dv2 (dv(0), dv(1));
   const double *in = fortran_vec ();
   ComplexNDArray retval (dv);
   Complex *out = retval.fortran_vec ();
@@ -184,7 +184,7 @@
   if (dv.length () < 2)
     return ComplexNDArray ();
 
-  dim_vector dv2(dv(0), dv(1));
+  dim_vector dv2 (dv(0), dv(1));
   ComplexNDArray retval (*this);
   Complex *out = retval.fortran_vec ();
   octave_idx_type howmany = numel () / dv(0) / dv(1);
@@ -596,7 +596,7 @@
 bool
 NDArray::all_integers (double& max_val, double& min_val) const
 {
-  octave_idx_type nel = nelem ();
+  octave_idx_type nel = numel ();
 
   if (nel > 0)
     {
@@ -872,7 +872,7 @@
 std::ostream&
 operator << (std::ostream& os, const NDArray& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   for (octave_idx_type i = 0; i < nel; i++)
     {
@@ -886,7 +886,7 @@
 std::istream&
 operator >> (std::istream& is, NDArray& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   if (nel > 0)
     {
--- a/liboctave/array/dRowVector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/dRowVector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -58,8 +58,8 @@
 bool
 RowVector::operator == (const RowVector& a) const
 {
-  octave_idx_type len = length ();
-  if (len != a.length ())
+  octave_idx_type len = numel ();
+  if (len != a.numel ())
     return 0;
   return mx_inline_equal (len, data (), a.data ());
 }
@@ -73,9 +73,9 @@
 RowVector&
 RowVector::insert (const RowVector& a, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (c < 0 || c + a_len > length ())
+  if (c < 0 || c + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -95,7 +95,7 @@
 RowVector&
 RowVector::fill (double val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -111,7 +111,7 @@
 RowVector&
 RowVector::fill (double val, octave_idx_type c1, octave_idx_type c2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len)
     {
@@ -135,9 +135,9 @@
 RowVector
 RowVector::append (const RowVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nc_insert = len;
-  RowVector retval (len + a.length ());
+  RowVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nc_insert);
   return retval;
@@ -194,7 +194,7 @@
 {
   RowVector retval;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
   octave_idx_type a_nr = a.rows ();
   octave_idx_type a_nc = a.cols ();
@@ -229,7 +229,7 @@
 double
 RowVector::min (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0;
 
@@ -245,7 +245,7 @@
 double
 RowVector::max (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0;
 
@@ -263,7 +263,7 @@
 {
 //  int field_width = os.precision () + 7;
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     os << " " /* setw (field_width) */ << a.elem (i);
   return os;
 }
@@ -271,7 +271,7 @@
 std::istream&
 operator >> (std::istream& is, RowVector& a)
 {
-  octave_idx_type len = a.length ();
+  octave_idx_type len = a.numel ();
 
   if (len > 0)
     {
@@ -313,9 +313,9 @@
 {
   double retval = 0.0;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     gripe_nonconformant ("operator *", len, a_len);
--- a/liboctave/array/dim-vector.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/dim-vector.h	Tue Jun 23 20:00:59 2015 -0700
@@ -34,21 +34,54 @@
 #include "lo-macros.h"
 #include "oct-refcount.h"
 
-// Rationale: This implementation is more tricky than Array, but the
-// big plus is that dim_vector requires only one allocation instead of
-// two.  It is (slightly) patterned after GCC's basic_string
-// implementation.  rep is a pointer to an array of memory, comprising
-// count, length, and the data:
-//
-//          <count>
-//          <ndims>
-//  rep --> <dims[0]>
-//          <dims[1]>
-//          ...
-//
-// The inlines count(), ndims() recover this data from the rep.  Note
-// that rep points to the beginning of dims to grant faster access
-// (reinterpret_cast is assumed to be an inexpensive operation).
+//! Vector representing the dimensions (size) of an Array.
+/*!
+  A dim_vector is used to represent dimensions of an Array.  It is used
+  on its constructor to specify its size, or when reshaping it.
+
+  @code{.cc}
+  // Matrix with 10 rows and 20 columns.
+  Matrix m Matrix (dim_vector (10, 20));
+
+  // Change its size to 5 rows and 40 columns.
+  Matrix m2 = m.reshape (dim_vector (5, 40));
+
+  // Five dimensional Array of length 10, 20, 3, 8, 7 on each dimension.
+  NDArray a (dim_vector (10, 20, 3, 8, 7));
+
+  // Uninitialized array of same size as other.
+  NDArray b (a.dims ());
+  @endcode
+
+  The main thing to understand about this class, is that methods such as
+  ndims() and numel(), return the value for an Array of these dimensions,
+  not the actual number of elements in the dim_vector.
+
+  @code{.cc}
+  dim_vector d (10, 5, 3);
+  octave_idx_type n = d.numel (); // returns 150
+  octave_idx_type nd = d.ndims (); // returns 2
+  @endcode
+
+  ## Implementation details ##
+
+  This implementation is more tricky than Array, but the big plus is that
+  dim_vector requires only one allocation instead of two.  It is (slightly)
+  patterned after GCC's basic_string implementation.  rep is a pointer to an
+  array of memory, comprising count, length, and the data:
+
+  @verbatim
+          <count>
+          <ndims>
+  rep --> <dims[0]>
+          <dims[1]>
+          ...
+  @endverbatim
+
+  The inlines count(), ndims() recover this data from the rep.  Note
+  that rep points to the beginning of dims to grant faster access
+  (reinterpret_cast is assumed to be an inexpensive operation).
+*/
 
 class
 OCTAVE_API
@@ -458,7 +491,7 @@
   {
     octave_idx_type k = 0;
     for (int i = length () - 1; i >= 0; i--)
-      k = k * rep[i] + idx[i];
+      k = rep[i] * k + idx[i];
 
     return k;
   }
@@ -469,7 +502,7 @@
   {
     octave_idx_type k = 0;
     for (int i = nidx - 1; i >= 0; i--)
-      k = k * rep[i] + idx[i];
+      k = rep[i] * k + idx[i];
 
     return k;
   }
--- a/liboctave/array/fCColVector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fCColVector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -60,8 +60,8 @@
 bool
 FloatComplexColumnVector::operator == (const FloatComplexColumnVector& a) const
 {
-  octave_idx_type len = length ();
-  if (len != a.length ())
+  octave_idx_type len = numel ();
+  if (len != a.numel ())
     return 0;
   return mx_inline_equal (len, data (), a.data ());
 }
@@ -77,9 +77,9 @@
 FloatComplexColumnVector&
 FloatComplexColumnVector::insert (const FloatColumnVector& a, octave_idx_type r)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (r < 0 || r + a_len > length ())
+  if (r < 0 || r + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -100,9 +100,9 @@
 FloatComplexColumnVector::insert (const FloatComplexColumnVector& a,
                                   octave_idx_type r)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (r < 0 || r + a_len > length ())
+  if (r < 0 || r + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -122,7 +122,7 @@
 FloatComplexColumnVector&
 FloatComplexColumnVector::fill (float val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -138,7 +138,7 @@
 FloatComplexColumnVector&
 FloatComplexColumnVector::fill (const FloatComplex& val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -156,7 +156,7 @@
 FloatComplexColumnVector::fill (float val,
                                 octave_idx_type r1, octave_idx_type r2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len)
     {
@@ -181,7 +181,7 @@
 FloatComplexColumnVector::fill (const FloatComplex& val,
                                 octave_idx_type r1, octave_idx_type r2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len)
     {
@@ -205,9 +205,9 @@
 FloatComplexColumnVector
 FloatComplexColumnVector::stack (const FloatColumnVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nr_insert = len;
-  FloatComplexColumnVector retval (len + a.length ());
+  FloatComplexColumnVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nr_insert);
   return retval;
@@ -216,9 +216,9 @@
 FloatComplexColumnVector
 FloatComplexColumnVector::stack (const FloatComplexColumnVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nr_insert = len;
-  FloatComplexColumnVector retval (len + a.length ());
+  FloatComplexColumnVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nr_insert);
   return retval;
@@ -282,9 +282,9 @@
 FloatComplexColumnVector&
 FloatComplexColumnVector::operator += (const FloatColumnVector& a)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     {
@@ -304,9 +304,9 @@
 FloatComplexColumnVector&
 FloatComplexColumnVector::operator -= (const FloatColumnVector& a)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     {
@@ -340,7 +340,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     gripe_nonconformant ("operator *", nr, nc, a_len, 1);
@@ -384,7 +384,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     {
@@ -412,7 +412,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     {
@@ -440,7 +440,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     {
@@ -467,7 +467,7 @@
 FloatComplex
 FloatComplexColumnVector::min (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0.0;
 
@@ -487,7 +487,7 @@
 FloatComplex
 FloatComplexColumnVector::max (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0.0;
 
@@ -510,7 +510,7 @@
 operator << (std::ostream& os, const FloatComplexColumnVector& a)
 {
 //  int field_width = os.precision () + 7;
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     os << /* setw (field_width) << */ a.elem (i) << "\n";
   return os;
 }
@@ -518,7 +518,7 @@
 std::istream&
 operator >> (std::istream& is, FloatComplexColumnVector& a)
 {
-  octave_idx_type len = a.length ();
+  octave_idx_type len = a.numel ();
 
   if (len > 0)
     {
--- a/liboctave/array/fCDiagMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fCDiagMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -111,7 +111,7 @@
 FloatComplexDiagMatrix::fill (const FloatColumnVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -127,7 +127,7 @@
 FloatComplexDiagMatrix::fill (const FloatComplexColumnVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -143,7 +143,7 @@
 FloatComplexDiagMatrix::fill (const FloatRowVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -159,7 +159,7 @@
 FloatComplexDiagMatrix::fill (const FloatComplexRowVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -174,7 +174,7 @@
 FloatComplexDiagMatrix&
 FloatComplexDiagMatrix::fill (const FloatColumnVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
@@ -191,7 +191,7 @@
 FloatComplexDiagMatrix::fill (const FloatComplexColumnVector& a,
                               octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
@@ -207,7 +207,7 @@
 FloatComplexDiagMatrix&
 FloatComplexDiagMatrix::fill (const FloatRowVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
@@ -224,7 +224,7 @@
 FloatComplexDiagMatrix::fill (const FloatComplexRowVector& a,
                               octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
--- a/liboctave/array/fCMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fCMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -369,7 +369,7 @@
   if (rows () != a.rows () || cols () != a.cols ())
     return false;
 
-  return mx_inline_equal (length (), data (), a.data ());
+  return mx_inline_equal (numel (), data (), a.data ());
 }
 
 bool
@@ -428,7 +428,7 @@
 FloatComplexMatrix::insert (const FloatRowVector& a,
                             octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ())
     {
@@ -451,7 +451,7 @@
 FloatComplexMatrix::insert (const FloatColumnVector& a,
                             octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ())
     {
@@ -510,7 +510,7 @@
 FloatComplexMatrix::insert (const FloatComplexRowVector& a,
                             octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
@@ -527,7 +527,7 @@
 FloatComplexMatrix::insert (const FloatComplexColumnVector& a,
                             octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ())
     {
@@ -699,7 +699,7 @@
     }
 
   octave_idx_type nc_insert = nc;
-  FloatComplexMatrix retval (nr, nc + a.length ());
+  FloatComplexMatrix retval (nr, nc + a.numel ());
   retval.insert (*this, 0, 0);
   retval.insert (a, 0, nc_insert);
   return retval;
@@ -710,7 +710,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nr != a.length ())
+  if (nr != a.numel ())
     {
       (*current_liboctave_error_handler) ("row dimension mismatch for append");
       return *this;
@@ -771,7 +771,7 @@
     }
 
   octave_idx_type nc_insert = nc;
-  FloatComplexMatrix retval (nr, nc + a.length ());
+  FloatComplexMatrix retval (nr, nc + a.numel ());
   retval.insert (*this, 0, 0);
   retval.insert (a, 0, nc_insert);
   return retval;
@@ -782,7 +782,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nr != a.length ())
+  if (nr != a.numel ())
     {
       (*current_liboctave_error_handler) ("row dimension mismatch for append");
       return *this;
@@ -837,7 +837,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nc != a.length ())
+  if (nc != a.numel ())
     {
       (*current_liboctave_error_handler)
         ("column dimension mismatch for stack");
@@ -864,7 +864,7 @@
     }
 
   octave_idx_type nr_insert = nr;
-  FloatComplexMatrix retval (nr + a.length (), nc);
+  FloatComplexMatrix retval (nr + a.numel (), nc);
   retval.insert (*this, 0, 0);
   retval.insert (a, nr_insert, 0);
   return retval;
@@ -913,7 +913,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nc != a.length ())
+  if (nc != a.numel ())
     {
       (*current_liboctave_error_handler)
         ("column dimension mismatch for stack");
@@ -940,7 +940,7 @@
     }
 
   octave_idx_type nr_insert = nr;
-  FloatComplexMatrix retval (nr + a.length (), nc);
+  FloatComplexMatrix retval (nr + a.numel (), nc);
   retval.insert (*this, 0, 0);
   retval.insert (a, nr_insert, 0);
   return retval;
@@ -1236,7 +1236,7 @@
 
   FloatColumnVector sigma = S.extract_diag ();
 
-  octave_idx_type r = sigma.length () - 1;
+  octave_idx_type r = sigma.numel () - 1;
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
@@ -1327,7 +1327,7 @@
 FloatComplexMatrix
 FloatComplexMatrix::fourier2d (void) const
 {
-  dim_vector dv(rows (), cols ());
+  dim_vector dv (rows (), cols ());
 
   FloatComplexMatrix retval (rows (), cols ());
   const FloatComplex *in (data ());
@@ -1341,7 +1341,7 @@
 FloatComplexMatrix
 FloatComplexMatrix::ifourier2d (void) const
 {
-  dim_vector dv(rows (), cols ());
+  dim_vector dv (rows (), cols ());
 
   FloatComplexMatrix retval (rows (), cols ());
   const FloatComplex *in (data ());
@@ -2862,7 +2862,7 @@
   octave_idx_type m = rows ();
   octave_idx_type n = cols ();
 
-  if (m != b.length ())
+  if (m != b.numel ())
     (*current_liboctave_error_handler)
       ("matrix dimension mismatch solution of linear equations");
   else if (m == 0 || n == 0 || b.cols () == 0)
@@ -2975,11 +2975,11 @@
 {
   FloatComplexMatrix retval;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
   if (len != 0)
     {
-      octave_idx_type a_len = a.length ();
+      octave_idx_type a_len = a.numel ();
 
       retval = FloatComplexMatrix (len, a_len);
       FloatComplex *c = retval.fortran_vec ();
@@ -3103,7 +3103,7 @@
 
   FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates!
 
-  mx_inline_add2 (length (), d, a.data ());
+  mx_inline_add2 (numel (), d, a.data ());
   return *this;
 }
 
@@ -3127,7 +3127,7 @@
 
   FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates!
 
-  mx_inline_sub2 (length (), d, a.data ());
+  mx_inline_sub2 (numel (), d, a.data ());
   return *this;
 }
 
@@ -4021,9 +4021,9 @@
 {
   if (n < 1) n = 1;
 
-  octave_idx_type m = x1.length ();
-
-  if (x2.length () != m)
+  octave_idx_type m = x1.numel ();
+
+  if (x2.numel () != m)
     (*current_liboctave_error_handler)
       ("linspace: vectors must be of equal length");
 
--- a/liboctave/array/fCNDArray.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fCNDArray.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -69,9 +69,9 @@
   for (int i = 0; i < dim; i++)
     stride *= dv(i);
 
-  octave_idx_type howmany = numel () / dv (dim);
+  octave_idx_type howmany = numel () / dv(dim);
   howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
-  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride);
+  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
   octave_idx_type dist = (stride == 1 ? n : 1);
 
   const FloatComplex *in (fortran_vec ());
@@ -100,9 +100,9 @@
   for (int i = 0; i < dim; i++)
     stride *= dv(i);
 
-  octave_idx_type howmany = numel () / dv (dim);
+  octave_idx_type howmany = numel () / dv(dim);
   howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
-  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride);
+  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
   octave_idx_type dist = (stride == 1 ? n : 1);
 
   const FloatComplex *in (fortran_vec ());
@@ -124,7 +124,7 @@
   if (dv.length () < 2)
     return FloatComplexNDArray ();
 
-  dim_vector dv2(dv(0), dv(1));
+  dim_vector dv2 (dv(0), dv(1));
   const FloatComplex *in = fortran_vec ();
   FloatComplexNDArray retval (dv);
   FloatComplex *out = retval.fortran_vec ();
@@ -144,7 +144,7 @@
   if (dv.length () < 2)
     return FloatComplexNDArray ();
 
-  dim_vector dv2(dv(0), dv(1));
+  dim_vector dv2 (dv(0), dv(1));
   const FloatComplex *in = fortran_vec ();
   FloatComplexNDArray retval (dv);
   FloatComplex *out = retval.fortran_vec ();
@@ -532,7 +532,7 @@
 bool
 FloatComplexNDArray::all_integers (float& max_val, float& min_val) const
 {
-  octave_idx_type nel = nelem ();
+  octave_idx_type nel = numel ();
 
   if (nel > 0)
     {
@@ -776,7 +776,7 @@
 
       for (int i = 0; i < n; i++)
         {
-          if (a_ra_idx (i) < 0 || (a_ra_idx (i) + a_dv (i)) > dimensions (i))
+          if (a_ra_idx(i) < 0 || (a_ra_idx(i) + a_dv(i)) > dimensions(i))
             {
               (*current_liboctave_error_handler)
                 ("Array<T>::insert: range error for insert");
@@ -789,14 +789,14 @@
 
       octave_idx_type n_elt = a.numel ();
 
-      // IS make_unique () NECCESSARY HERE??
+      // IS make_unique () NECESSARY HERE?
 
       for (octave_idx_type i = 0; i < n_elt; i++)
         {
           Array<octave_idx_type> ra_idx = a_ra_idx;
 
-          ra_idx.elem (0) = a_ra_idx (0) + r;
-          ra_idx.elem (1) = a_ra_idx (1) + c;
+          ra_idx.elem (0) = a_ra_idx(0) + r;
+          ra_idx.elem (1) = a_ra_idx(1) + c;
 
           elem (ra_idx) = a.elem (a_ra_idx);
 
@@ -857,7 +857,7 @@
 std::ostream&
 operator << (std::ostream& os, const FloatComplexNDArray& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   for (octave_idx_type i = 0; i < nel; i++)
     {
@@ -871,7 +871,7 @@
 std::istream&
 operator >> (std::istream& is, FloatComplexNDArray& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   if (nel > 0)
     {
--- a/liboctave/array/fCRowVector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fCRowVector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -59,8 +59,8 @@
 bool
 FloatComplexRowVector::operator == (const FloatComplexRowVector& a) const
 {
-  octave_idx_type len = length ();
-  if (len != a.length ())
+  octave_idx_type len = numel ();
+  if (len != a.numel ())
     return 0;
   return mx_inline_equal (len, data (), a.data ());
 }
@@ -76,9 +76,9 @@
 FloatComplexRowVector&
 FloatComplexRowVector::insert (const FloatRowVector& a, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (c < 0 || c + a_len > length ())
+  if (c < 0 || c + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -99,9 +99,9 @@
 FloatComplexRowVector::insert (const FloatComplexRowVector& a,
                                octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (c < 0 || c + a_len > length ())
+  if (c < 0 || c + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -121,7 +121,7 @@
 FloatComplexRowVector&
 FloatComplexRowVector::fill (float val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -137,7 +137,7 @@
 FloatComplexRowVector&
 FloatComplexRowVector::fill (const FloatComplex& val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -153,7 +153,7 @@
 FloatComplexRowVector&
 FloatComplexRowVector::fill (float val, octave_idx_type c1, octave_idx_type c2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len)
     {
@@ -178,7 +178,7 @@
 FloatComplexRowVector::fill (const FloatComplex& val,
                              octave_idx_type c1, octave_idx_type c2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len)
     {
@@ -202,9 +202,9 @@
 FloatComplexRowVector
 FloatComplexRowVector::append (const FloatRowVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nc_insert = len;
-  FloatComplexRowVector retval (len + a.length ());
+  FloatComplexRowVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nc_insert);
   return retval;
@@ -213,9 +213,9 @@
 FloatComplexRowVector
 FloatComplexRowVector::append (const FloatComplexRowVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nc_insert = len;
-  FloatComplexRowVector retval (len + a.length ());
+  FloatComplexRowVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nc_insert);
   return retval;
@@ -272,9 +272,9 @@
 FloatComplexRowVector&
 FloatComplexRowVector::operator += (const FloatRowVector& a)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     {
@@ -294,9 +294,9 @@
 FloatComplexRowVector&
 FloatComplexRowVector::operator -= (const FloatRowVector& a)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     {
@@ -320,7 +320,7 @@
 {
   FloatComplexRowVector retval;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
   octave_idx_type a_nr = a.rows ();
   octave_idx_type a_nc = a.cols ();
@@ -362,7 +362,7 @@
 FloatComplex
 FloatComplexRowVector::min (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return FloatComplex (0.0);
 
@@ -382,7 +382,7 @@
 FloatComplex
 FloatComplexRowVector::max (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return FloatComplex (0.0);
 
@@ -405,7 +405,7 @@
 operator << (std::ostream& os, const FloatComplexRowVector& a)
 {
 //  int field_width = os.precision () + 7;
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     os << " " /* setw (field_width) */ << a.elem (i);
   return os;
 }
@@ -413,7 +413,7 @@
 std::istream&
 operator >> (std::istream& is, FloatComplexRowVector& a)
 {
-  octave_idx_type len = a.length ();
+  octave_idx_type len = a.numel ();
 
   if (len > 0)
     {
@@ -446,9 +446,9 @@
 {
   FloatComplex retval (0.0, 0.0);
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     gripe_nonconformant ("operator *", len, a_len);
--- a/liboctave/array/fColVector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fColVector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -54,8 +54,8 @@
 bool
 FloatColumnVector::operator == (const FloatColumnVector& a) const
 {
-  octave_idx_type len = length ();
-  if (len != a.length ())
+  octave_idx_type len = numel ();
+  if (len != a.numel ())
     return 0;
   return mx_inline_equal (len, data (), a.data ());
 }
@@ -69,9 +69,9 @@
 FloatColumnVector&
 FloatColumnVector::insert (const FloatColumnVector& a, octave_idx_type r)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (r < 0 || r + a_len > length ())
+  if (r < 0 || r + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -91,7 +91,7 @@
 FloatColumnVector&
 FloatColumnVector::fill (float val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -107,7 +107,7 @@
 FloatColumnVector&
 FloatColumnVector::fill (float val, octave_idx_type r1, octave_idx_type r2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len)
     {
@@ -131,9 +131,9 @@
 FloatColumnVector
 FloatColumnVector::stack (const FloatColumnVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nr_insert = len;
-  FloatColumnVector retval (len + a.length ());
+  FloatColumnVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nr_insert);
   return retval;
@@ -201,7 +201,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     gripe_nonconformant ("operator *", nr, nc, a_len, 1);
@@ -238,7 +238,7 @@
   octave_idx_type nr = m.rows ();
   octave_idx_type nc = m.cols ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (nc != a_len)
     gripe_nonconformant ("operator *", nr, nc, a_len, 1);
@@ -266,7 +266,7 @@
 float
 FloatColumnVector::min (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0.0;
 
@@ -282,7 +282,7 @@
 float
 FloatColumnVector::max (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0.0;
 
@@ -299,7 +299,7 @@
 operator << (std::ostream& os, const FloatColumnVector& a)
 {
 //  int field_width = os.precision () + 7;
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     os << /* setw (field_width) << */ a.elem (i) << "\n";
   return os;
 }
@@ -307,7 +307,7 @@
 std::istream&
 operator >> (std::istream& is, FloatColumnVector& a)
 {
-  octave_idx_type len = a.length ();
+  octave_idx_type len = a.numel ();
 
   if (len > 0)
     {
--- a/liboctave/array/fDiagMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fDiagMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -78,7 +78,7 @@
 FloatDiagMatrix::fill (const FloatColumnVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -94,7 +94,7 @@
 FloatDiagMatrix::fill (const FloatRowVector& a)
 {
   octave_idx_type len = length ();
-  if (a.length () != len)
+  if (a.numel () != len)
     {
       (*current_liboctave_error_handler) ("range error for fill");
       return *this;
@@ -109,7 +109,7 @@
 FloatDiagMatrix&
 FloatDiagMatrix::fill (const FloatColumnVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
@@ -125,7 +125,7 @@
 FloatDiagMatrix&
 FloatDiagMatrix::fill (const FloatRowVector& a, octave_idx_type beg)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
   if (beg < 0 || beg + a_len >= length ())
     {
       (*current_liboctave_error_handler) ("range error for fill");
--- a/liboctave/array/fMatrix.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fMatrix.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -309,7 +309,7 @@
   if (rows () != a.rows () || cols () != a.cols ())
     return false;
 
-  return mx_inline_equal (length (), data (), a.data ());
+  return mx_inline_equal (numel (), data (), a.data ());
 }
 
 bool
@@ -346,7 +346,7 @@
 FloatMatrix::insert (const FloatRowVector& a,
                      octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ())
     {
@@ -369,7 +369,7 @@
 FloatMatrix::insert (const FloatColumnVector& a,
                      octave_idx_type r, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ())
     {
@@ -493,7 +493,7 @@
     }
 
   octave_idx_type nc_insert = nc;
-  FloatMatrix retval (nr, nc + a.length ());
+  FloatMatrix retval (nr, nc + a.numel ());
   retval.insert (*this, 0, 0);
   retval.insert (a, 0, nc_insert);
   return retval;
@@ -504,7 +504,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nr != a.length ())
+  if (nr != a.numel ())
     {
       (*current_liboctave_error_handler) ("row dimension mismatch for append");
       return FloatMatrix ();
@@ -559,7 +559,7 @@
 {
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
-  if (nc != a.length ())
+  if (nc != a.numel ())
     {
       (*current_liboctave_error_handler)
         ("column dimension mismatch for stack");
@@ -586,7 +586,7 @@
     }
 
   octave_idx_type nr_insert = nr;
-  FloatMatrix retval (nr + a.length (), nc);
+  FloatMatrix retval (nr + a.numel (), nc);
   retval.insert (*this, 0, 0);
   retval.insert (a, nr_insert, 0);
   return retval;
@@ -884,7 +884,7 @@
 
   FloatColumnVector sigma = S.extract_diag ();
 
-  octave_idx_type r = sigma.length () - 1;
+  octave_idx_type r = sigma.numel () - 1;
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
@@ -974,7 +974,7 @@
 FloatComplexMatrix
 FloatMatrix::fourier2d (void) const
 {
-  dim_vector dv(rows (), cols ());
+  dim_vector dv (rows (), cols ());
 
   const float *in = fortran_vec ();
   FloatComplexMatrix retval (rows (), cols ());
@@ -986,7 +986,7 @@
 FloatComplexMatrix
 FloatMatrix::ifourier2d (void) const
 {
-  dim_vector dv(rows (), cols ());
+  dim_vector dv (rows (), cols ());
 
   FloatComplexMatrix retval (*this);
   FloatComplex *out (retval.fortran_vec ());
@@ -2491,7 +2491,7 @@
   octave_idx_type m = rows ();
   octave_idx_type n = cols ();
 
-  if (m != b.length ())
+  if (m != b.numel ())
     (*current_liboctave_error_handler)
       ("matrix dimension mismatch solution of linear equations");
   else if (m == 0 || n == 0)
@@ -2659,11 +2659,11 @@
 {
   FloatMatrix retval;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
   if (len != 0)
     {
-      octave_idx_type a_len = a.length ();
+      octave_idx_type a_len = a.numel ();
 
       retval = FloatMatrix (len, a_len);
       float *c = retval.fortran_vec ();
@@ -3337,9 +3337,9 @@
 {
   if (n < 1) n = 1;
 
-  octave_idx_type m = x1.length ();
-
-  if (x2.length () != m)
+  octave_idx_type m = x1.numel ();
+
+  if (x2.numel () != m)
     (*current_liboctave_error_handler)
       ("linspace: vectors must be of equal length");
 
--- a/liboctave/array/fNDArray.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fNDArray.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -68,9 +68,9 @@
   for (int i = 0; i < dim; i++)
     stride *= dv(i);
 
-  octave_idx_type howmany = numel () / dv (dim);
+  octave_idx_type howmany = numel () / dv(dim);
   howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
-  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride);
+  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
   octave_idx_type dist = (stride == 1 ? n : 1);
 
   const float *in (fortran_vec ());
@@ -99,9 +99,9 @@
   for (int i = 0; i < dim; i++)
     stride *= dv(i);
 
-  octave_idx_type howmany = numel () / dv (dim);
+  octave_idx_type howmany = numel () / dv(dim);
   howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany));
-  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride);
+  octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride);
   octave_idx_type dist = (stride == 1 ? n : 1);
 
   FloatComplexNDArray retval (*this);
@@ -122,7 +122,7 @@
   if (dv.length () < 2)
     return FloatComplexNDArray ();
 
-  dim_vector dv2(dv(0), dv(1));
+  dim_vector dv2 (dv(0), dv(1));
   const float *in = fortran_vec ();
   FloatComplexNDArray retval (dv);
   FloatComplex *out = retval.fortran_vec ();
@@ -142,7 +142,7 @@
   if (dv.length () < 2)
     return FloatComplexNDArray ();
 
-  dim_vector dv2(dv(0), dv(1));
+  dim_vector dv2 (dv(0), dv(1));
   FloatComplexNDArray retval (*this);
   FloatComplex *out = retval.fortran_vec ();
   octave_idx_type howmany = numel () / dv(0) / dv(1);
@@ -556,7 +556,7 @@
 bool
 FloatNDArray::all_integers (float& max_val, float& min_val) const
 {
-  octave_idx_type nel = nelem ();
+  octave_idx_type nel = numel ();
 
   if (nel > 0)
     {
@@ -843,7 +843,7 @@
 std::ostream&
 operator << (std::ostream& os, const FloatNDArray& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   for (octave_idx_type i = 0; i < nel; i++)
     {
@@ -857,7 +857,7 @@
 std::istream&
 operator >> (std::istream& is, FloatNDArray& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   if (nel > 0)
     {
--- a/liboctave/array/fRowVector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/fRowVector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -58,8 +58,8 @@
 bool
 FloatRowVector::operator == (const FloatRowVector& a) const
 {
-  octave_idx_type len = length ();
-  if (len != a.length ())
+  octave_idx_type len = numel ();
+  if (len != a.numel ())
     return 0;
   return mx_inline_equal (len, data (), a.data ());
 }
@@ -73,9 +73,9 @@
 FloatRowVector&
 FloatRowVector::insert (const FloatRowVector& a, octave_idx_type c)
 {
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
-  if (c < 0 || c + a_len > length ())
+  if (c < 0 || c + a_len > numel ())
     {
       (*current_liboctave_error_handler) ("range error for insert");
       return *this;
@@ -95,7 +95,7 @@
 FloatRowVector&
 FloatRowVector::fill (float val)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -111,7 +111,7 @@
 FloatRowVector&
 FloatRowVector::fill (float val, octave_idx_type c1, octave_idx_type c2)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len)
     {
@@ -135,9 +135,9 @@
 FloatRowVector
 FloatRowVector::append (const FloatRowVector& a) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   octave_idx_type nc_insert = len;
-  FloatRowVector retval (len + a.length ());
+  FloatRowVector retval (len + a.numel ());
   retval.insert (*this, 0);
   retval.insert (a, nc_insert);
   return retval;
@@ -194,7 +194,7 @@
 {
   FloatRowVector retval;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
   octave_idx_type a_nr = a.rows ();
   octave_idx_type a_nc = a.cols ();
@@ -229,7 +229,7 @@
 float
 FloatRowVector::min (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0;
 
@@ -245,7 +245,7 @@
 float
 FloatRowVector::max (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
   if (len == 0)
     return 0;
 
@@ -263,7 +263,7 @@
 {
 //  int field_width = os.precision () + 7;
 
-  for (octave_idx_type i = 0; i < a.length (); i++)
+  for (octave_idx_type i = 0; i < a.numel (); i++)
     os << " " /* setw (field_width) */ << a.elem (i);
   return os;
 }
@@ -271,7 +271,7 @@
 std::istream&
 operator >> (std::istream& is, FloatRowVector& a)
 {
-  octave_idx_type len = a.length ();
+  octave_idx_type len = a.numel ();
 
   if (len > 0)
     {
@@ -313,9 +313,9 @@
 {
   float retval = 0.0;
 
-  octave_idx_type len = v.length ();
+  octave_idx_type len = v.numel ();
 
-  octave_idx_type a_len = a.length ();
+  octave_idx_type a_len = a.numel ();
 
   if (len != a_len)
     gripe_nonconformant ("operator *", len, a_len);
--- a/liboctave/array/idx-vector.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/idx-vector.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -121,7 +121,7 @@
 }
 
 idx_vector::idx_range_rep::idx_range_rep (const Range& r)
-  : start (0), len (r.nelem ()), step (1)
+  : start (0), len (r.numel ()), step (1)
 {
   if (len < 0)
     {
@@ -405,7 +405,7 @@
     {
       octave_idx_type *d = new octave_idx_type [len];
 
-      octave_idx_type ntot = bnda.length ();
+      octave_idx_type ntot = bnda.numel ();
 
       octave_idx_type k = 0;
       for (octave_idx_type i = 0; i < ntot; i++)
--- a/liboctave/array/intNDArray.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/array/intNDArray.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -39,7 +39,7 @@
 {
   boolNDArray b (this->dims ());
 
-  for (octave_idx_type i = 0; i < this->length (); i++)
+  for (octave_idx_type i = 0; i < this->numel (); i++)
     b.elem (i) = ! this->elem (i);
 
   return b;
@@ -49,7 +49,7 @@
 bool
 intNDArray<T>::any_element_not_one_or_zero (void) const
 {
-  octave_idx_type nel = this->nelem ();
+  octave_idx_type nel = this->numel ();
 
   for (octave_idx_type i = 0; i < nel; i++)
     {
@@ -143,7 +143,7 @@
 std::ostream&
 operator << (std::ostream& os, const intNDArray<T>& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   for (octave_idx_type i = 0; i < nel; i++)
     os << " " << a.elem (i) << "\n";
@@ -155,7 +155,7 @@
 std::istream&
 operator >> (std::istream& is, intNDArray<T>& a)
 {
-  octave_idx_type nel = a.nelem ();
+  octave_idx_type nel = a.numel ();
 
   if (nel > 0)
     {
@@ -183,7 +183,7 @@
 intNDArray<T>
 intNDArray<T>::abs (void) const
 {
-  octave_idx_type nel = this->nelem ();
+  octave_idx_type nel = this->numel ();
   intNDArray<T> ret (this->dims ());
 
   for (octave_idx_type i = 0; i < nel; i++)
@@ -199,7 +199,7 @@
 intNDArray<T>
 intNDArray<T>::signum (void) const
 {
-  octave_idx_type nel = this->nelem ();
+  octave_idx_type nel = this->numel ();
   intNDArray<T> ret (this->dims ());
 
   for (octave_idx_type i = 0; i < nel; i++)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/cruft/slatec-fn/dpsifn.f	Tue Jun 23 20:00:59 2015 -0700
@@ -0,0 +1,368 @@
+*DECK DPSIFN
+      SUBROUTINE DPSIFN (X, N, KODE, M, ANS, NZ, IERR)
+C***BEGIN PROLOGUE  DPSIFN
+C***PURPOSE  Compute derivatives of the Psi function.
+C***LIBRARY   SLATEC
+C***CATEGORY  C7C
+C***TYPE      DOUBLE PRECISION (PSIFN-S, DPSIFN-D)
+C***KEYWORDS  DERIVATIVES OF THE GAMMA FUNCTION, POLYGAMMA FUNCTION,
+C             PSI FUNCTION
+C***AUTHOR  Amos, D. E., (SNLA)
+C***DESCRIPTION
+C
+C         The following definitions are used in DPSIFN:
+C
+C      Definition 1
+C         PSI(X) = d/dx (ln(GAMMA(X)), the first derivative of
+C                  the log GAMMA function.
+C      Definition 2
+C                     K   K
+C         PSI(K,X) = d /dx (PSI(X)), the K-th derivative of PSI(X).
+C   ___________________________________________________________________
+C      DPSIFN computes a sequence of SCALED derivatives of
+C      the PSI function; i.e. for fixed X and M it computes
+C      the M-member sequence
+C
+C                    ((-1)**(K+1)/GAMMA(K+1))*PSI(K,X)
+C                       for K = N,...,N+M-1
+C
+C      where PSI(K,X) is as defined above.   For KODE=1, DPSIFN returns
+C      the scaled derivatives as described.  KODE=2 is operative only
+C      when K=0 and in that case DPSIFN returns -PSI(X) + LN(X).  That
+C      is, the logarithmic behavior for large X is removed when KODE=2
+C      and K=0.  When sums or differences of PSI functions are computed
+C      the logarithmic terms can be combined analytically and computed
+C      separately to help retain significant digits.
+C
+C         Note that CALL DPSIFN(X,0,1,1,ANS) results in
+C                   ANS = -PSI(X)
+C
+C     Input      X is DOUBLE PRECISION
+C           X      - Argument, X .gt. 0.0D0
+C           N      - First member of the sequence, 0 .le. N .le. 100
+C                    N=0 gives ANS(1) = -PSI(X)       for KODE=1
+C                                       -PSI(X)+LN(X) for KODE=2
+C           KODE   - Selection parameter
+C                    KODE=1 returns scaled derivatives of the PSI
+C                    function.
+C                    KODE=2 returns scaled derivatives of the PSI
+C                    function EXCEPT when N=0. In this case,
+C                    ANS(1) = -PSI(X) + LN(X) is returned.
+C           M      - Number of members of the sequence, M.ge.1
+C
+C    Output     ANS is DOUBLE PRECISION
+C           ANS    - A vector of length at least M whose first M
+C                    components contain the sequence of derivatives
+C                    scaled according to KODE.
+C           NZ     - Underflow flag
+C                    NZ.eq.0, A normal return
+C                    NZ.ne.0, Underflow, last NZ components of ANS are
+C                             set to zero, ANS(M-K+1)=0.0, K=1,...,NZ
+C           IERR   - Error flag
+C                    IERR=0, A normal return, computation completed
+C                    IERR=1, Input error,     no computation
+C                    IERR=2, Overflow,        X too small or N+M-1 too
+C                            large or both
+C                    IERR=3, Error,           N too large. Dimensioned
+C                            array TRMR(NMAX) is not large enough for N
+C
+C         The nominal computational accuracy is the maximum of unit
+C         roundoff (=D1MACH(4)) and 1.0D-18 since critical constants
+C         are given to only 18 digits.
+C
+C         PSIFN is the single precision version of DPSIFN.
+C
+C *Long Description:
+C
+C         The basic method of evaluation is the asymptotic expansion
+C         for large X.ge.XMIN followed by backward recursion on a two
+C         term recursion relation
+C
+C                  W(X+1) + X**(-N-1) = W(X).
+C
+C         This is supplemented by a series
+C
+C                  SUM( (X+K)**(-N-1) , K=0,1,2,... )
+C
+C         which converges rapidly for large N. Both XMIN and the
+C         number of terms of the series are calculated from the unit
+C         roundoff of the machine environment.
+C
+C***REFERENCES  Handbook of Mathematical Functions, National Bureau
+C                 of Standards Applied Mathematics Series 55, edited
+C                 by M. Abramowitz and I. A. Stegun, equations 6.3.5,
+C                 6.3.18, 6.4.6, 6.4.9 and 6.4.10, pp.258-260, 1964.
+C               D. E. Amos, A portable Fortran subroutine for
+C                 derivatives of the Psi function, Algorithm 610, ACM
+C                 Transactions on Mathematical Software 9, 4 (1983),
+C                 pp. 494-502.
+C***ROUTINES CALLED  D1MACH, I1MACH
+C***REVISION HISTORY  (YYMMDD)
+C   820601  DATE WRITTEN
+C   890531  Changed all specific intrinsics to generic.  (WRB)
+C   890911  Removed unnecessary intrinsics.  (WRB)
+C   891006  Cosmetic changes to prologue.  (WRB)
+C   891006  REVISION DATE from Version 3.2
+C   891214  Prologue converted to Version 4.0 format.  (BAB)
+C   920501  Reformatted the REFERENCES section.  (WRB)
+C***END PROLOGUE  DPSIFN
+      INTEGER I, IERR, J, K, KODE, M, MM, MX, N, NMAX, NN, NP, NX, NZ,
+     *  FN
+      INTEGER I1MACH
+      DOUBLE PRECISION ANS, ARG, B, DEN, ELIM, EPS, FLN,
+     * FX, RLN, RXSQ, R1M4, R1M5, S, SLOPE, T, TA, TK, TOL, TOLS, TRM,
+     * TRMR, TSS, TST, TT, T1, T2, WDTOL, X, XDMLN, XDMY, XINC, XLN,
+     * XM, XMIN, XQ, YINT
+      DOUBLE PRECISION D1MACH
+      DIMENSION B(22), TRM(22), TRMR(100), ANS(*)
+      SAVE NMAX, B
+      DATA NMAX /100/
+C-----------------------------------------------------------------------
+C             BERNOULLI NUMBERS
+C-----------------------------------------------------------------------
+      DATA B(1), B(2), B(3), B(4), B(5), B(6), B(7), B(8), B(9), B(10),
+     * B(11), B(12), B(13), B(14), B(15), B(16), B(17), B(18), B(19),
+     * B(20), B(21), B(22) /1.00000000000000000D+00,
+     * -5.00000000000000000D-01,1.66666666666666667D-01,
+     * -3.33333333333333333D-02,2.38095238095238095D-02,
+     * -3.33333333333333333D-02,7.57575757575757576D-02,
+     * -2.53113553113553114D-01,1.16666666666666667D+00,
+     * -7.09215686274509804D+00,5.49711779448621554D+01,
+     * -5.29124242424242424D+02,6.19212318840579710D+03,
+     * -8.65802531135531136D+04,1.42551716666666667D+06,
+     * -2.72982310678160920D+07,6.01580873900642368D+08,
+     * -1.51163157670921569D+10,4.29614643061166667D+11,
+     * -1.37116552050883328D+13,4.88332318973593167D+14,
+     * -1.92965793419400681D+16/
+C
+C***FIRST EXECUTABLE STATEMENT  DPSIFN
+      IERR = 0
+      NZ=0
+      IF (X.LE.0.0D0) IERR=1
+      IF (N.LT.0) IERR=1
+      IF (KODE.LT.1 .OR. KODE.GT.2) IERR=1
+      IF (M.LT.1) IERR=1
+      IF (IERR.NE.0) RETURN
+      MM=M
+      NX = MIN(-I1MACH(15),I1MACH(16))
+      R1M5 = D1MACH(5)
+      R1M4 = D1MACH(4)*0.5D0
+      WDTOL = MAX(R1M4,0.5D-18)
+C-----------------------------------------------------------------------
+C     ELIM = APPROXIMATE EXPONENTIAL OVER AND UNDERFLOW LIMIT
+C-----------------------------------------------------------------------
+      ELIM = 2.302D0*(NX*R1M5-3.0D0)
+      XLN = LOG(X)
+   41 CONTINUE
+      NN = N + MM - 1
+      FN = NN
+      T = (FN+1)*XLN
+C-----------------------------------------------------------------------
+C     OVERFLOW AND UNDERFLOW TEST FOR SMALL AND LARGE X
+C-----------------------------------------------------------------------
+      IF (ABS(T).GT.ELIM) GO TO 290
+      IF (X.LT.WDTOL) GO TO 260
+C-----------------------------------------------------------------------
+C     COMPUTE XMIN AND THE NUMBER OF TERMS OF THE SERIES, FLN+1
+C-----------------------------------------------------------------------
+      RLN = R1M5*I1MACH(14)
+      RLN = MIN(RLN,18.06D0)
+      FLN = MAX(RLN,3.0D0) - 3.0D0
+      YINT = 3.50D0 + 0.40D0*FLN
+      SLOPE = 0.21D0 + FLN*(0.0006038D0*FLN+0.008677D0)
+      XM = YINT + SLOPE*FN
+      MX = INT(XM) + 1
+      XMIN = MX
+      IF (N.EQ.0) GO TO 50
+      XM = -2.302D0*RLN - MIN(0.0D0,XLN)
+      ARG = XM/N
+      ARG = MIN(0.0D0,ARG)
+      EPS = EXP(ARG)
+      XM = 1.0D0 - EPS
+      IF (ABS(ARG).LT.1.0D-3) XM = -ARG
+      FLN = X*XM/EPS
+      XM = XMIN - X
+      IF (XM.GT.7.0D0 .AND. FLN.LT.15.0D0) GO TO 200
+   50 CONTINUE
+      XDMY = X
+      XDMLN = XLN
+      XINC = 0.0D0
+      IF (X.GE.XMIN) GO TO 60
+      NX = INT(X)
+      XINC = XMIN - NX
+      XDMY = X + XINC
+      XDMLN = LOG(XDMY)
+   60 CONTINUE
+C-----------------------------------------------------------------------
+C     GENERATE W(N+MM-1,X) BY THE ASYMPTOTIC EXPANSION
+C-----------------------------------------------------------------------
+      T = FN*XDMLN
+      T1 = XDMLN + XDMLN
+      T2 = T + XDMLN
+      TK = MAX(ABS(T),ABS(T1),ABS(T2))
+      IF (TK.GT.ELIM) GO TO 380
+      TSS = EXP(-T)
+      TT = 0.5D0/XDMY
+      T1 = TT
+      TST = WDTOL*TT
+      IF (NN.NE.0) T1 = TT + 1.0D0/FN
+      RXSQ = 1.0D0/(XDMY*XDMY)
+      TA = 0.5D0*RXSQ
+      T = (FN+1)*TA
+      S = T*B(3)
+      IF (ABS(S).LT.TST) GO TO 80
+      TK = 2.0D0
+      DO 70 K=4,22
+        T = T*((TK+FN+1)/(TK+1.0D0))*((TK+FN)/(TK+2.0D0))*RXSQ
+        TRM(K) = T*B(K)
+        IF (ABS(TRM(K)).LT.TST) GO TO 80
+        S = S + TRM(K)
+        TK = TK + 2.0D0
+   70 CONTINUE
+   80 CONTINUE
+      S = (S+T1)*TSS
+      IF (XINC.EQ.0.0D0) GO TO 100
+C-----------------------------------------------------------------------
+C     BACKWARD RECUR FROM XDMY TO X
+C-----------------------------------------------------------------------
+      NX = INT(XINC)
+      NP = NN + 1
+      IF (NX.GT.NMAX) GO TO 390
+      IF (NN.EQ.0) GO TO 160
+      XM = XINC - 1.0D0
+      FX = X + XM
+C-----------------------------------------------------------------------
+C     THIS LOOP SHOULD NOT BE CHANGED. FX IS ACCURATE WHEN X IS SMALL
+C-----------------------------------------------------------------------
+      DO 90 I=1,NX
+        TRMR(I) = FX**(-NP)
+        S = S + TRMR(I)
+        XM = XM - 1.0D0
+        FX = X + XM
+   90 CONTINUE
+  100 CONTINUE
+      ANS(MM) = S
+      IF (FN.EQ.0) GO TO 180
+C-----------------------------------------------------------------------
+C     GENERATE LOWER DERIVATIVES, J.LT.N+MM-1
+C-----------------------------------------------------------------------
+      IF (MM.EQ.1) RETURN
+      DO 150 J=2,MM
+        FN = FN - 1
+        TSS = TSS*XDMY
+        T1 = TT
+        IF (FN.NE.0) T1 = TT + 1.0D0/FN
+        T = (FN+1)*TA
+        S = T*B(3)
+        IF (ABS(S).LT.TST) GO TO 120
+        TK = 4 + FN
+        DO 110 K=4,22
+          TRM(K) = TRM(K)*(FN+1)/TK
+          IF (ABS(TRM(K)).LT.TST) GO TO 120
+          S = S + TRM(K)
+          TK = TK + 2.0D0
+  110   CONTINUE
+  120   CONTINUE
+        S = (S+T1)*TSS
+        IF (XINC.EQ.0.0D0) GO TO 140
+        IF (FN.EQ.0) GO TO 160
+        XM = XINC - 1.0D0
+        FX = X + XM
+        DO 130 I=1,NX
+          TRMR(I) = TRMR(I)*FX
+          S = S + TRMR(I)
+          XM = XM - 1.0D0
+          FX = X + XM
+  130   CONTINUE
+  140   CONTINUE
+        MX = MM - J + 1
+        ANS(MX) = S
+        IF (FN.EQ.0) GO TO 180
+  150 CONTINUE
+      RETURN
+C-----------------------------------------------------------------------
+C     RECURSION FOR N = 0
+C-----------------------------------------------------------------------
+  160 CONTINUE
+      DO 170 I=1,NX
+        S = S + 1.0D0/(X+NX-I)
+  170 CONTINUE
+  180 CONTINUE
+      IF (KODE.EQ.2) GO TO 190
+      ANS(1) = S - XDMLN
+      RETURN
+  190 CONTINUE
+      IF (XDMY.EQ.X) RETURN
+      XQ = XDMY/X
+      ANS(1) = S - LOG(XQ)
+      RETURN
+C-----------------------------------------------------------------------
+C     COMPUTE BY SERIES (X+K)**(-(N+1)) , K=0,1,2,...
+C-----------------------------------------------------------------------
+  200 CONTINUE
+      NN = INT(FLN) + 1
+      NP = N + 1
+      T1 = (N+1)*XLN
+      T = EXP(-T1)
+      S = T
+      DEN = X
+      DO 210 I=1,NN
+        DEN = DEN + 1.0D0
+        TRM(I) = DEN**(-NP)
+        S = S + TRM(I)
+  210 CONTINUE
+      ANS(1) = S
+      IF (N.NE.0) GO TO 220
+      IF (KODE.EQ.2) ANS(1) = S + XLN
+  220 CONTINUE
+      IF (MM.EQ.1) RETURN
+C-----------------------------------------------------------------------
+C     GENERATE HIGHER DERIVATIVES, J.GT.N
+C-----------------------------------------------------------------------
+      TOL = WDTOL/5.0D0
+      DO 250 J=2,MM
+        T = T/X
+        S = T
+        TOLS = T*TOL
+        DEN = X
+        DO 230 I=1,NN
+          DEN = DEN + 1.0D0
+          TRM(I) = TRM(I)/DEN
+          S = S + TRM(I)
+          IF (TRM(I).LT.TOLS) GO TO 240
+  230   CONTINUE
+  240   CONTINUE
+        ANS(J) = S
+  250 CONTINUE
+      RETURN
+C-----------------------------------------------------------------------
+C     SMALL X.LT.UNIT ROUND OFF
+C-----------------------------------------------------------------------
+  260 CONTINUE
+      ANS(1) = X**(-N-1)
+      IF (MM.EQ.1) GO TO 280
+      K = 1
+      DO 270 I=2,MM
+        ANS(K+1) = ANS(K)/X
+        K = K + 1
+  270 CONTINUE
+  280 CONTINUE
+      IF (N.NE.0) RETURN
+      IF (KODE.EQ.2) ANS(1) = ANS(1) + XLN
+      RETURN
+  290 CONTINUE
+      IF (T.GT.0.0D0) GO TO 380
+      NZ=0
+      IERR=2
+      RETURN
+  380 CONTINUE
+      NZ=NZ+1
+      ANS(MM)=0.0D0
+      MM=MM-1
+      IF (MM.EQ.0) RETURN
+      GO TO 41
+  390 CONTINUE
+      NZ=0
+      IERR=3
+      RETURN
+      END
--- a/liboctave/cruft/slatec-fn/module.mk	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/cruft/slatec-fn/module.mk	Tue Jun 23 20:00:59 2015 -0700
@@ -34,6 +34,7 @@
   cruft/slatec-fn/dlnrel.f \
   cruft/slatec-fn/dpchim.f \
   cruft/slatec-fn/dpchst.f \
+  cruft/slatec-fn/dpsifn.f \
   cruft/slatec-fn/erf.f \
   cruft/slatec-fn/gami.f \
   cruft/slatec-fn/gamit.f \
@@ -44,6 +45,7 @@
   cruft/slatec-fn/inits.f \
   cruft/slatec-fn/pchim.f \
   cruft/slatec-fn/pchst.f \
+  cruft/slatec-fn/psifn.f \
   cruft/slatec-fn/r9lgmc.f \
   cruft/slatec-fn/r9lgit.f \
   cruft/slatec-fn/r9gmit.f \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/cruft/slatec-fn/psifn.f	Tue Jun 23 20:00:59 2015 -0700
@@ -0,0 +1,368 @@
+*DECK PSIFN
+      SUBROUTINE PSIFN (X, N, KODE, M, ANS, NZ, IERR)
+C***BEGIN PROLOGUE  PSIFN
+C***PURPOSE  Compute derivatives of the Psi function.
+C***LIBRARY   SLATEC
+C***CATEGORY  C7C
+C***TYPE      SINGLE PRECISION (PSIFN-S, DPSIFN-D)
+C***KEYWORDS  DERIVATIVES OF THE GAMMA FUNCTION, POLYGAMMA FUNCTION,
+C             PSI FUNCTION
+C***AUTHOR  Amos, D. E., (SNLA)
+C***DESCRIPTION
+C
+C         The following definitions are used in PSIFN:
+C
+C      Definition 1
+C         PSI(X) = d/dx (ln(GAMMA(X)), the first derivative of
+C                  the LOG GAMMA function.
+C      Definition 2
+C                     K   K
+C         PSI(K,X) = d /dx (PSI(X)), the K-th derivative of PSI(X).
+C   ___________________________________________________________________
+C       PSIFN computes a sequence of SCALED derivatives of
+C       the PSI function; i.e. for fixed X and M it computes
+C       the M-member sequence
+C
+C                  ((-1)**(K+1)/GAMMA(K+1))*PSI(K,X)
+C                    for K = N,...,N+M-1
+C
+C       where PSI(K,X) is as defined above.   For KODE=1, PSIFN returns
+C       the scaled derivatives as described.  KODE=2 is operative only
+C       when K=0 and in that case PSIFN returns -PSI(X) + LN(X).  That
+C       is, the logarithmic behavior for large X is removed when KODE=1
+C       and K=0.  When sums or differences of PSI functions are computed
+C       the logarithmic terms can be combined analytically and computed
+C       separately to help retain significant digits.
+C
+C         Note that CALL PSIFN(X,0,1,1,ANS) results in
+C                   ANS = -PSI(X)
+C
+C     Input
+C           X      - Argument, X .gt. 0.0E0
+C           N      - First member of the sequence, 0 .le. N .le. 100
+C                    N=0 gives ANS(1) = -PSI(X)       for KODE=1
+C                                       -PSI(X)+LN(X) for KODE=2
+C           KODE   - Selection parameter
+C                    KODE=1 returns scaled derivatives of the PSI
+C                    function.
+C                    KODE=2 returns scaled derivatives of the PSI
+C                    function EXCEPT when N=0. In this case,
+C                    ANS(1) = -PSI(X) + LN(X) is returned.
+C           M      - Number of members of the sequence, M .ge. 1
+C
+C    Output
+C           ANS    - A vector of length at least M whose first M
+C                    components contain the sequence of derivatives
+C                    scaled according to KODE.
+C           NZ     - Underflow flag
+C                    NZ.eq.0, A normal return
+C                    NZ.ne.0, Underflow, last NZ components of ANS are
+C                             set to zero, ANS(M-K+1)=0.0, K=1,...,NZ
+C           IERR   - Error flag
+C                    IERR=0, A normal return, computation completed
+C                    IERR=1, Input error,     no computation
+C                    IERR=2, Overflow,        X too small or N+M-1 too
+C                            large or both
+C                    IERR=3, Error,           N too large. Dimensioned
+C                            array TRMR(NMAX) is not large enough for N
+C
+C         The nominal computational accuracy is the maximum of unit
+C         roundoff (=R1MACH(4)) and 1.0E-18 since critical constants
+C         are given to only 18 digits.
+C
+C         DPSIFN is the Double Precision version of PSIFN.
+C
+C *Long Description:
+C
+C         The basic method of evaluation is the asymptotic expansion
+C         for large X.ge.XMIN followed by backward recursion on a two
+C         term recursion relation
+C
+C                  W(X+1) + X**(-N-1) = W(X).
+C
+C         This is supplemented by a series
+C
+C                  SUM( (X+K)**(-N-1) , K=0,1,2,... )
+C
+C         which converges rapidly for large N. Both XMIN and the
+C         number of terms of the series are calculated from the unit
+C         roundoff of the machine environment.
+C
+C***REFERENCES  Handbook of Mathematical Functions, National Bureau
+C                 of Standards Applied Mathematics Series 55, edited
+C                 by M. Abramowitz and I. A. Stegun, equations 6.3.5,
+C                 6.3.18, 6.4.6, 6.4.9 and 6.4.10, pp.258-260, 1964.
+C               D. E. Amos, A portable Fortran subroutine for
+C                 derivatives of the Psi function, Algorithm 610, ACM
+C                 Transactions on Mathematical Software 9, 4 (1983),
+C                 pp. 494-502.
+C***ROUTINES CALLED  I1MACH, R1MACH
+C***REVISION HISTORY  (YYMMDD)
+C   820601  DATE WRITTEN
+C   890531  Changed all specific intrinsics to generic.  (WRB)
+C   890531  REVISION DATE from Version 3.2
+C   891214  Prologue converted to Version 4.0 format.  (BAB)
+C   920501  Reformatted the REFERENCES section.  (WRB)
+C***END PROLOGUE  PSIFN
+      INTEGER I, IERR, J, K, KODE, M, MM, MX, N, NMAX, NN, NP, NX, NZ
+      INTEGER I1MACH
+      REAL ANS, ARG, B, DEN, ELIM, EPS, FLN, FN, FNP, FNS, FX, RLN,
+     * RXSQ, R1M4, R1M5, S, SLOPE, T, TA, TK, TOL, TOLS, TRM, TRMR,
+     * TSS, TST, TT, T1, T2, WDTOL, X, XDMLN, XDMY, XINC, XLN, XM,
+     * XMIN, XQ, YINT
+      REAL R1MACH
+      DIMENSION B(22), TRM(22), TRMR(100), ANS(*)
+      SAVE NMAX, B
+      DATA NMAX /100/
+C-----------------------------------------------------------------------
+C             BERNOULLI NUMBERS
+C-----------------------------------------------------------------------
+      DATA B(1), B(2), B(3), B(4), B(5), B(6), B(7), B(8), B(9), B(10),
+     * B(11), B(12), B(13), B(14), B(15), B(16), B(17), B(18), B(19),
+     * B(20), B(21), B(22) /1.00000000000000000E+00,
+     * -5.00000000000000000E-01,1.66666666666666667E-01,
+     * -3.33333333333333333E-02,2.38095238095238095E-02,
+     * -3.33333333333333333E-02,7.57575757575757576E-02,
+     * -2.53113553113553114E-01,1.16666666666666667E+00,
+     * -7.09215686274509804E+00,5.49711779448621554E+01,
+     * -5.29124242424242424E+02,6.19212318840579710E+03,
+     * -8.65802531135531136E+04,1.42551716666666667E+06,
+     * -2.72982310678160920E+07,6.01580873900642368E+08,
+     * -1.51163157670921569E+10,4.29614643061166667E+11,
+     * -1.37116552050883328E+13,4.88332318973593167E+14,
+     * -1.92965793419400681E+16/
+C
+C***FIRST EXECUTABLE STATEMENT  PSIFN
+      IERR = 0
+      NZ=0
+      IF (X.LE.0.0E0) IERR=1
+      IF (N.LT.0) IERR=1
+      IF (KODE.LT.1 .OR. KODE.GT.2) IERR=1
+      IF (M.LT.1) IERR=1
+      IF (IERR.NE.0) RETURN
+      MM=M
+      NX = MIN(-I1MACH(12),I1MACH(13))
+      R1M5 = R1MACH(5)
+      R1M4 = R1MACH(4)*0.5E0
+      WDTOL = MAX(R1M4,0.5E-18)
+C-----------------------------------------------------------------------
+C     ELIM = APPROXIMATE EXPONENTIAL OVER AND UNDERFLOW LIMIT
+C-----------------------------------------------------------------------
+      ELIM = 2.302E0*(NX*R1M5-3.0E0)
+      XLN = LOG(X)
+   41 CONTINUE
+      NN = N + MM - 1
+      FN = NN
+      FNP = FN + 1.0E0
+      T = FNP*XLN
+C-----------------------------------------------------------------------
+C     OVERFLOW AND UNDERFLOW TEST FOR SMALL AND LARGE X
+C-----------------------------------------------------------------------
+      IF (ABS(T).GT.ELIM) GO TO 290
+      IF (X.LT.WDTOL) GO TO 260
+C-----------------------------------------------------------------------
+C     COMPUTE XMIN AND THE NUMBER OF TERMS OF THE SERIES, FLN+1
+C-----------------------------------------------------------------------
+      RLN = R1M5*I1MACH(11)
+      RLN = MIN(RLN,18.06E0)
+      FLN = MAX(RLN,3.0E0) - 3.0E0
+      YINT = 3.50E0 + 0.40E0*FLN
+      SLOPE = 0.21E0 + FLN*(0.0006038E0*FLN+0.008677E0)
+      XM = YINT + SLOPE*FN
+      MX = INT(XM) + 1
+      XMIN = MX
+      IF (N.EQ.0) GO TO 50
+      XM = -2.302E0*RLN - MIN(0.0E0,XLN)
+      FNS = N
+      ARG = XM/FNS
+      ARG = MIN(0.0E0,ARG)
+      EPS = EXP(ARG)
+      XM = 1.0E0 - EPS
+      IF (ABS(ARG).LT.1.0E-3) XM = -ARG
+      FLN = X*XM/EPS
+      XM = XMIN - X
+      IF (XM.GT.7.0E0 .AND. FLN.LT.15.0E0) GO TO 200
+   50 CONTINUE
+      XDMY = X
+      XDMLN = XLN
+      XINC = 0.0E0
+      IF (X.GE.XMIN) GO TO 60
+      NX = INT(X)
+      XINC = XMIN - NX
+      XDMY = X + XINC
+      XDMLN = LOG(XDMY)
+   60 CONTINUE
+C-----------------------------------------------------------------------
+C     GENERATE W(N+MM-1,X) BY THE ASYMPTOTIC EXPANSION
+C-----------------------------------------------------------------------
+      T = FN*XDMLN
+      T1 = XDMLN + XDMLN
+      T2 = T + XDMLN
+      TK = MAX(ABS(T),ABS(T1),ABS(T2))
+      IF (TK.GT.ELIM) GO TO 380
+      TSS = EXP(-T)
+      TT = 0.5E0/XDMY
+      T1 = TT
+      TST = WDTOL*TT
+      IF (NN.NE.0) T1 = TT + 1.0E0/FN
+      RXSQ = 1.0E0/(XDMY*XDMY)
+      TA = 0.5E0*RXSQ
+      T = FNP*TA
+      S = T*B(3)
+      IF (ABS(S).LT.TST) GO TO 80
+      TK = 2.0E0
+      DO 70 K=4,22
+        T = T*((TK+FN+1.0E0)/(TK+1.0E0))*((TK+FN)/(TK+2.0E0))*RXSQ
+        TRM(K) = T*B(K)
+        IF (ABS(TRM(K)).LT.TST) GO TO 80
+        S = S + TRM(K)
+        TK = TK + 2.0E0
+   70 CONTINUE
+   80 CONTINUE
+      S = (S+T1)*TSS
+      IF (XINC.EQ.0.0E0) GO TO 100
+C-----------------------------------------------------------------------
+C     BACKWARD RECUR FROM XDMY TO X
+C-----------------------------------------------------------------------
+      NX = INT(XINC)
+      NP = NN + 1
+      IF (NX.GT.NMAX) GO TO 390
+      IF (NN.EQ.0) GO TO 160
+      XM = XINC - 1.0E0
+      FX = X + XM
+C-----------------------------------------------------------------------
+C     THIS LOOP SHOULD NOT BE CHANGED. FX IS ACCURATE WHEN X IS SMALL
+C-----------------------------------------------------------------------
+      DO 90 I=1,NX
+        TRMR(I) = FX**(-NP)
+        S = S + TRMR(I)
+        XM = XM - 1.0E0
+        FX = X + XM
+   90 CONTINUE
+  100 CONTINUE
+      ANS(MM) = S
+      IF (FN.EQ.0.0E0) GO TO 180
+C-----------------------------------------------------------------------
+C     GENERATE LOWER DERIVATIVES, J.LT.N+MM-1
+C-----------------------------------------------------------------------
+      IF (MM.EQ.1) RETURN
+      DO 150 J=2,MM
+        FNP = FN
+        FN = FN - 1.0E0
+        TSS = TSS*XDMY
+        T1 = TT
+        IF (FN.NE.0.0E0) T1 = TT + 1.0E0/FN
+        T = FNP*TA
+        S = T*B(3)
+        IF (ABS(S).LT.TST) GO TO 120
+        TK = 3.0E0 + FNP
+        DO 110 K=4,22
+          TRM(K) = TRM(K)*FNP/TK
+          IF (ABS(TRM(K)).LT.TST) GO TO 120
+          S = S + TRM(K)
+          TK = TK + 2.0E0
+  110   CONTINUE
+  120   CONTINUE
+        S = (S+T1)*TSS
+        IF (XINC.EQ.0.0E0) GO TO 140
+        IF (FN.EQ.0.0E0) GO TO 160
+        XM = XINC - 1.0E0
+        FX = X + XM
+        DO 130 I=1,NX
+          TRMR(I) = TRMR(I)*FX
+          S = S + TRMR(I)
+          XM = XM - 1.0E0
+          FX = X + XM
+  130   CONTINUE
+  140   CONTINUE
+        MX = MM - J + 1
+        ANS(MX) = S
+        IF (FN.EQ.0.0E0) GO TO 180
+  150 CONTINUE
+      RETURN
+C-----------------------------------------------------------------------
+C     RECURSION FOR N = 0
+C-----------------------------------------------------------------------
+  160 CONTINUE
+      DO 170 I=1,NX
+        S = S + 1.0E0/(X+NX-I)
+  170 CONTINUE
+  180 CONTINUE
+      IF (KODE.EQ.2) GO TO 190
+      ANS(1) = S - XDMLN
+      RETURN
+  190 CONTINUE
+      IF (XDMY.EQ.X) RETURN
+      XQ = XDMY/X
+      ANS(1) = S - LOG(XQ)
+      RETURN
+C-----------------------------------------------------------------------
+C     COMPUTE BY SERIES (X+K)**(-(N+1)) , K=0,1,2,...
+C-----------------------------------------------------------------------
+  200 CONTINUE
+      NN = INT(FLN) + 1
+      NP = N + 1
+      T1 = (FNS+1.0E0)*XLN
+      T = EXP(-T1)
+      S = T
+      DEN = X
+      DO 210 I=1,NN
+        DEN = DEN + 1.0E0
+        TRM(I) = DEN**(-NP)
+        S = S + TRM(I)
+  210 CONTINUE
+      ANS(1) = S
+      IF (N.NE.0) GO TO 220
+      IF (KODE.EQ.2) ANS(1) = S + XLN
+  220 CONTINUE
+      IF (MM.EQ.1) RETURN
+C-----------------------------------------------------------------------
+C     GENERATE HIGHER DERIVATIVES, J.GT.N
+C-----------------------------------------------------------------------
+      TOL = WDTOL/5.0E0
+      DO 250 J=2,MM
+        T = T/X
+        S = T
+        TOLS = T*TOL
+        DEN = X
+        DO 230 I=1,NN
+          DEN = DEN + 1.0E0
+          TRM(I) = TRM(I)/DEN
+          S = S + TRM(I)
+          IF (TRM(I).LT.TOLS) GO TO 240
+  230   CONTINUE
+  240   CONTINUE
+        ANS(J) = S
+  250 CONTINUE
+      RETURN
+C-----------------------------------------------------------------------
+C     SMALL X.LT.UNIT ROUND OFF
+C-----------------------------------------------------------------------
+  260 CONTINUE
+      ANS(1) = X**(-N-1)
+      IF (MM.EQ.1) GO TO 280
+      K = 1
+      DO 270 I=2,MM
+        ANS(K+1) = ANS(K)/X
+        K = K + 1
+  270 CONTINUE
+  280 CONTINUE
+      IF (N.NE.0) RETURN
+      IF (KODE.EQ.2) ANS(1) = ANS(1) + XLN
+      RETURN
+  290 CONTINUE
+      IF (T.GT.0.0E0) GO TO 380
+      NZ=0
+      IERR=2
+      RETURN
+  380 CONTINUE
+      NZ=NZ+1
+      ANS(MM)=0.0E0
+      MM=MM-1
+      IF(MM.EQ.0) RETURN
+      GO TO 41
+  390 CONTINUE
+      IERR=3
+      NZ=0
+      RETURN
+      END
--- a/liboctave/numeric/CmplxCHOL.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/CmplxCHOL.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -200,7 +200,7 @@
 {
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       ComplexColumnVector utmp = u;
 
@@ -220,7 +220,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       ComplexColumnVector utmp = u;
 
@@ -242,7 +242,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () != n + 1)
+  if (u.numel () != n + 1)
     (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("cholinsert: index out of range");
@@ -305,7 +305,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       init (chol_mat.hermitian () * chol_mat
             + ComplexMatrix (u) * ComplexMatrix (u).hermitian (), false);
@@ -331,7 +331,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       if (singular (chol_mat))
         info = 2;
@@ -358,7 +358,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () != n + 1)
+  if (u.numel () != n + 1)
     (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("cholinsert: index out of range");
--- a/liboctave/numeric/CmplxLU.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/CmplxLU.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -98,7 +98,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = l.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       ComplexColumnVector utmp = u;
       ComplexColumnVector vtmp = v;
@@ -149,7 +149,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = l.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       ComplexColumnVector utmp = u;
       ComplexColumnVector vtmp = v;
--- a/liboctave/numeric/CmplxQR.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/CmplxQR.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -212,7 +212,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = q.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       ComplexColumnVector utmp = u;
       ComplexColumnVector vtmp = v;
@@ -259,7 +259,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = q.columns ();
 
-  if (u.length () != m)
+  if (u.numel () != m)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -292,14 +292,14 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
 
   if (dups)
     (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
-  else if (u.length () != m || u.columns () != nj)
+  else if (u.numel () != m || u.columns () != nj)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -317,7 +317,7 @@
         }
 
       OCTAVE_LOCAL_BUFFER (double, rw, kmax);
-      for (volatile octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.numel (); i++)
         {
           octave_idx_type ii = i;
           ComplexColumnVector utmp = u.column (jsi(i));
@@ -365,7 +365,7 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
@@ -377,7 +377,7 @@
   else if (nj > 0)
     {
       OCTAVE_LOCAL_BUFFER (double, rw, k);
-      for (volatile octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.numel (); i++)
         {
           octave_idx_type ii = i;
           F77_XFCN (zqrdec, ZQRDEC, (m, n - ii, k == m ? k : k - ii,
@@ -405,7 +405,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = std::min (m, n);
 
-  if (! q.is_square () || u.length () != n)
+  if (! q.is_square () || u.numel () != n)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > m)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -477,7 +477,7 @@
   octave_idx_type m = q.rows ();
   octave_idx_type n = r.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       init (q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (),
             get_type ());
@@ -573,7 +573,7 @@
   octave_idx_type m = q.rows ();
   octave_idx_type n = r.columns ();
 
-  if (u.length () != m)
+  if (u.numel () != m)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -593,21 +593,21 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
 
   if (dups)
     (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
-  else if (u.length () != m || u.columns () != nj)
+  else if (u.numel () != m || u.columns () != nj)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
   else if (nj > 0)
     {
       ComplexMatrix a = q*r;
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (octave_idx_type i = 0; i < js.numel (); i++)
         a = ::insert_col (a, js(i), u.column (i));
       init (a, get_type ());
     }
@@ -637,7 +637,7 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
@@ -649,7 +649,7 @@
   else if (nj > 0)
     {
       ComplexMatrix a = q*r;
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (octave_idx_type i = 0; i < js.numel (); i++)
         a = ::delete_col (a, js(i));
       init (a, get_type ());
     }
@@ -663,7 +663,7 @@
   octave_idx_type m = r.rows ();
   octave_idx_type n = r.columns ();
 
-  if (! q.is_square () || u.length () != n)
+  if (! q.is_square () || u.numel () != n)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > m)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
--- a/liboctave/numeric/CollocWt.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/CollocWt.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -175,9 +175,9 @@
             dif2[i] = (ab + ap + z1) / z / z / (z + 1.0);
           else
             {
-              z = z * z;
+              z *= z;
               double y = z1 * (ab + z1);
-              y = y * (ap + y);
+              y *= (ap + y);
               dif2[i] = y / z / (z - 1.0);
             }
         }
@@ -218,11 +218,11 @@
           if (i != 0)
             {
               for (octave_idx_type j = 1; j <= i; j++)
-                zc = zc - z / (x - root[j-1]);
+                zc -= z / (x - root[j-1]);
             }
 
-          z = z / zc;
-          x = x - z;
+          z /= zc;
+          x -= z;
 
           // Famous last words:  100 iterations should be more than
           // enough in all cases.
@@ -235,7 +235,7 @@
         }
 
       root[i] = x;
-      x = x + sqrt (std::numeric_limits<double>::epsilon ());
+      x += sqrt (std::numeric_limits<double>::epsilon ());
     }
 
   // Add interpolation points at x = 0 and/or x = 1.
@@ -362,7 +362,7 @@
 
           vect[j] = ax / (dif1[j] * dif1[j]);
 
-          y = y + vect[j];
+          y += vect[j];
         }
 
       for (octave_idx_type j = 0; j < nt; j++)
--- a/liboctave/numeric/DASPK.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/DASPK.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -91,7 +91,7 @@
 
   if (ires >= 0)
     {
-      if (tmp_delta.length () == 0)
+      if (tmp_delta.numel () == 0)
         ires = -2;
       else
         {
@@ -196,7 +196,7 @@
 
           ColumnVector res = (*user_fun) (x, xdot, t, ires);
 
-          if (res.length () != x.length ())
+          if (res.numel () != x.numel ())
             {
               (*current_liboctave_error_handler)
                 ("daspk: inconsistent sizes for state and residual vectors");
@@ -240,8 +240,8 @@
       abs_tol = absolute_tolerance ();
       rel_tol = relative_tolerance ();
 
-      octave_idx_type abs_tol_len = abs_tol.length ();
-      octave_idx_type rel_tol_len = rel_tol.length ();
+      octave_idx_type abs_tol_len = abs_tol.numel ();
+      octave_idx_type rel_tol_len = rel_tol.numel ();
 
       if (abs_tol_len == 1 && rel_tol_len == 1)
         {
@@ -302,7 +302,7 @@
           {
             Array<octave_idx_type> ict = inequality_constraint_types ();
 
-            if (ict.length () == n)
+            if (ict.numel () == n)
               {
                 for (octave_idx_type i = 0; i < n; i++)
                   {
@@ -347,7 +347,7 @@
 
               Array<octave_idx_type> av = algebraic_variables ();
 
-              if (av.length () == n)
+              if (av.numel () == n)
                 {
                   octave_idx_type lid;
                   if (eiq == 0 || eiq == 2)
@@ -387,7 +387,7 @@
 
           Array<octave_idx_type> av = algebraic_variables ();
 
-          if (av.length () == n)
+          if (av.numel () == n)
             {
               octave_idx_type lid;
               if (eiq == 0 || eiq == 2)
@@ -406,7 +406,7 @@
         {
           Array<double> ich = initial_condition_heuristics ();
 
-          if (ich.length () == 6)
+          if (ich.numel () == 6)
             {
               iwork(31) = NINTbig (ich(0));
               iwork(32) = NINTbig (ich(1));
@@ -538,7 +538,7 @@
 {
   Matrix retval;
 
-  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n_out = tout.numel ();
   octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
@@ -583,7 +583,7 @@
 {
   Matrix retval;
 
-  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n_out = tout.numel ();
   octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
@@ -597,7 +597,7 @@
           xdot_out.elem (0, i) = xdot.elem (i);
         }
 
-      octave_idx_type n_crit = tcrit.capacity ();
+      octave_idx_type n_crit = tcrit.numel ();
 
       if (n_crit > 0)
         {
--- a/liboctave/numeric/DASRT.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/DASRT.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -87,7 +87,7 @@
 
   ColumnVector tmp_fval = (*user_fsub) (tmp_state, tmp_deriv, t, ires);
 
-  if (tmp_fval.length () == 0)
+  if (tmp_fval.numel () == 0)
     ires = -2;
   else
     {
@@ -182,7 +182,7 @@
       if (user_csub)
         {
           ColumnVector tmp = (*user_csub) (x, t);
-          ng = tmp.length ();
+          ng = tmp.numel ();
         }
       else
         ng = 0;
@@ -233,7 +233,7 @@
 
           ColumnVector fval = (*user_fsub) (x, xdot, t, ires);
 
-          if (fval.length () != x.length ())
+          if (fval.numel () != x.numel ())
             {
               (*current_liboctave_error_handler)
                 ("dasrt: inconsistent sizes for state and residual vectors");
@@ -290,8 +290,8 @@
       abs_tol = absolute_tolerance ();
       rel_tol = relative_tolerance ();
 
-      octave_idx_type abs_tol_len = abs_tol.length ();
-      octave_idx_type rel_tol_len = rel_tol.length ();
+      octave_idx_type abs_tol_len = abs_tol.numel ();
+      octave_idx_type rel_tol_len = rel_tol.numel ();
 
       if (abs_tol_len == 1 && rel_tol_len == 1)
         {
@@ -393,7 +393,7 @@
   Matrix xdot_out;
   ColumnVector t_out = tout;
 
-  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n_out = tout.numel ();
   octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
@@ -452,7 +452,7 @@
   Matrix xdot_out;
   ColumnVector t_outs = tout;
 
-  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n_out = tout.numel ();
   octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
@@ -460,7 +460,7 @@
       x_out.resize (n_out, n);
       xdot_out.resize (n_out, n);
 
-      octave_idx_type n_crit = tcrit.capacity ();
+      octave_idx_type n_crit = tcrit.numel ();
 
       if (n_crit > 0)
         {
--- a/liboctave/numeric/DASSL.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/DASSL.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -84,7 +84,7 @@
 
   if (ires >= 0)
     {
-      if (tmp_delta.length () == 0)
+      if (tmp_delta.numel () == 0)
         ires = -2;
       else
         {
@@ -175,7 +175,7 @@
 
           ColumnVector res = (*user_fun) (x, xdot, t, ires);
 
-          if (res.length () != x.length ())
+          if (res.numel () != x.numel ())
             {
               (*current_liboctave_error_handler)
                 ("dassl: inconsistent sizes for state and residual vectors");
@@ -251,8 +251,8 @@
       abs_tol = absolute_tolerance ();
       rel_tol = relative_tolerance ();
 
-      octave_idx_type abs_tol_len = abs_tol.length ();
-      octave_idx_type rel_tol_len = rel_tol.length ();
+      octave_idx_type abs_tol_len = abs_tol.numel ();
+      octave_idx_type rel_tol_len = rel_tol.numel ();
 
       if (abs_tol_len == 1 && rel_tol_len == 1)
         {
@@ -353,7 +353,7 @@
 {
   Matrix retval;
 
-  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n_out = tout.numel ();
   octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
@@ -398,7 +398,7 @@
 {
   Matrix retval;
 
-  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n_out = tout.numel ();
   octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
@@ -412,7 +412,7 @@
           xdot_out.elem (0, i) = xdot.elem (i);
         }
 
-      octave_idx_type n_crit = tcrit.capacity ();
+      octave_idx_type n_crit = tcrit.numel ();
 
       if (n_crit > 0)
         {
--- a/liboctave/numeric/LSODE.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/LSODE.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -74,7 +74,7 @@
 
   tmp_deriv = (*user_fun) (*tmp_x, time);
 
-  if (tmp_deriv.length () == 0)
+  if (tmp_deriv.numel () == 0)
     ierr = -1;
   else
     {
@@ -208,7 +208,7 @@
 
       ColumnVector xdot = (*user_fun) (x, t);
 
-      if (x.length () != xdot.length ())
+      if (x.numel () != xdot.numel ())
         {
           (*current_liboctave_error_handler)
             ("lsode: inconsistent sizes for state and derivative vectors");
@@ -224,7 +224,7 @@
       rel_tol = relative_tolerance ();
       abs_tol = absolute_tolerance ();
 
-      octave_idx_type abs_tol_len = abs_tol.length ();
+      octave_idx_type abs_tol_len = abs_tol.numel ();
 
       if (abs_tol_len == 1)
         itol = 1;
@@ -383,7 +383,7 @@
 {
   Matrix retval;
 
-  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n_out = tout.numel ();
   octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
@@ -413,7 +413,7 @@
 {
   Matrix retval;
 
-  octave_idx_type n_out = tout.capacity ();
+  octave_idx_type n_out = tout.numel ();
   octave_idx_type n = size ();
 
   if (n_out > 0 && n > 0)
@@ -423,7 +423,7 @@
       for (octave_idx_type i = 0; i < n; i++)
         retval.elem (0, i) = x.elem (i);
 
-      octave_idx_type n_crit = tcrit.capacity ();
+      octave_idx_type n_crit = tcrit.numel ();
 
       if (n_crit > 0)
         {
--- a/liboctave/numeric/ODES.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/ODES.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -31,7 +31,7 @@
 ODES::initialize (const ColumnVector& xx, double tt)
 {
   base_diff_eqn::initialize (xx, tt);
-  xdot = ColumnVector (xx.length (), 0.0);
+  xdot = ColumnVector (xx.numel (), 0.0);
 }
 
 void
@@ -39,6 +39,6 @@
                   const ColumnVector& xtheta)
 {
   base_diff_eqn::initialize (xx, tt);
-  xdot = ColumnVector (xx.length (), 0.0);
+  xdot = ColumnVector (xx.numel (), 0.0);
   theta = xtheta;
 }
--- a/liboctave/numeric/ODES.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/ODES.h	Tue Jun 23 20:00:59 2015 -0700
@@ -35,11 +35,11 @@
     : base_diff_eqn (), ODESFunc (), xdot (), theta () { }
 
   ODES (const ColumnVector& s, double tm, ODESFunc& f)
-    : base_diff_eqn (s, tm), ODESFunc (f), xdot (s.length (), 0.0), theta () { }
+    : base_diff_eqn (s, tm), ODESFunc (f), xdot (s.numel (), 0.0), theta () { }
 
   ODES (const ColumnVector& s, const ColumnVector& xtheta, double tm,
         ODESFunc& f)
-    : base_diff_eqn (s, tm), ODESFunc (f), xdot (s.length (), 0.0),
+    : base_diff_eqn (s, tm), ODESFunc (f), xdot (s.numel (), 0.0),
       theta (xtheta) { }
 
   ODES (const ODES& a)
--- a/liboctave/numeric/Quad.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/Quad.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -126,7 +126,7 @@
 DefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval,
                        double& abserr)
 {
-  octave_idx_type npts = singularities.capacity () + 2;
+  octave_idx_type npts = singularities.numel () + 2;
   double *points = singularities.fortran_vec ();
   double result = 0.0;
 
@@ -224,7 +224,7 @@
 FloatDefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval,
                             float& abserr)
 {
-  octave_idx_type npts = singularities.capacity () + 2;
+  octave_idx_type npts = singularities.numel () + 2;
   float *points = singularities.fortran_vec ();
   float result = 0.0;
 
--- a/liboctave/numeric/SparseCmplxLU.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/SparseCmplxLU.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -58,7 +58,7 @@
   double tmp = octave_sparse_params::get_key ("spumoni");
   if (!xisnan (tmp))
     Control (UMFPACK_PRL) = tmp;
-  if (piv_thres.nelem () == 2)
+  if (piv_thres.numel () == 2)
     {
       tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0));
       if (!xisnan (tmp))
@@ -267,7 +267,7 @@
       double tmp = octave_sparse_params::get_key ("spumoni");
       if (!xisnan (tmp))
         Control (UMFPACK_PRL) = tmp;
-      if (piv_thres.nelem () == 2)
+      if (piv_thres.numel () == 2)
         {
           tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0));
           if (!xisnan (tmp))
--- a/liboctave/numeric/SparsedbleLU.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/SparsedbleLU.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -57,7 +57,7 @@
   if (!xisnan (tmp))
     Control (UMFPACK_PRL) = tmp;
 
-  if (piv_thres.nelem () == 2)
+  if (piv_thres.numel () == 2)
     {
       tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0));
       if (!xisnan (tmp))
@@ -253,7 +253,7 @@
       if (!xisnan (tmp))
         Control (UMFPACK_PRL) = tmp;
 
-      if (piv_thres.nelem () == 2)
+      if (piv_thres.numel () == 2)
         {
           tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0));
           if (!xisnan (tmp))
--- a/liboctave/numeric/base-dae.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/base-dae.h	Tue Jun 23 20:00:59 2015 -0700
@@ -34,7 +34,7 @@
     : base_diff_eqn (), xdot () { }
 
   base_diff_alg_eqn (const ColumnVector& xx, double tt)
-    : base_diff_eqn (xx, tt), xdot (xx.length (), 0.0) { }
+    : base_diff_eqn (xx, tt), xdot (xx.numel (), 0.0) { }
 
   base_diff_alg_eqn (const ColumnVector& xx, const ColumnVector& xxdot,
                      double tt)
@@ -58,7 +58,7 @@
   void initialize (const ColumnVector& x0, double t0)
   {
     base_diff_eqn::initialize (x0, t0);
-    xdot = ColumnVector (x0.length (), 0.0);
+    xdot = ColumnVector (x0.numel (), 0.0);
   }
 
   void initialize (const ColumnVector& x0, const ColumnVector& xdot0,
--- a/liboctave/numeric/base-de.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/base-de.h	Tue Jun 23 20:00:59 2015 -0700
@@ -72,7 +72,7 @@
     force_restart ();
   }
 
-  octave_idx_type size (void) const { return x.capacity (); }
+  octave_idx_type size (void) const { return x.numel (); }
 
   ColumnVector state (void) const { return x; }
 
--- a/liboctave/numeric/base-lu.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/base-lu.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -129,7 +129,7 @@
       for (octave_idx_type i = 0; i < a_nr; i++)
         pvt.xelem (i) = i;
 
-      for (octave_idx_type i = 0; i < ipvt.length (); i++)
+      for (octave_idx_type i = 0; i < ipvt.numel (); i++)
         {
           octave_idx_type k = ipvt.xelem (i);
 
--- a/liboctave/numeric/base-min.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/base-min.h	Tue Jun 23 20:00:59 2015 -0700
@@ -114,7 +114,7 @@
     return do_minimize (objf, inform, lambda);
   }
 
-  octave_idx_type size (void) const { return x.capacity (); }
+  octave_idx_type size (void) const { return x.numel (); }
 
 protected:
 
--- a/liboctave/numeric/dbleCHOL.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/dbleCHOL.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -205,7 +205,7 @@
 {
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       ColumnVector utmp = u;
 
@@ -225,7 +225,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       ColumnVector utmp = u;
 
@@ -247,7 +247,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () != n + 1)
+  if (u.numel () != n + 1)
     (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("cholinsert: index out of range");
@@ -309,7 +309,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       init (chol_mat.transpose () * chol_mat
             + Matrix (u) * Matrix (u).transpose (), false);
@@ -335,7 +335,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       if (singular (chol_mat))
         info = 2;
@@ -361,7 +361,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () != n + 1)
+  if (u.numel () != n + 1)
     (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("cholinsert: index out of range");
--- a/liboctave/numeric/dbleLU.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/dbleLU.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -97,7 +97,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = l.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       ColumnVector utmp = u;
       ColumnVector vtmp = v;
@@ -147,7 +147,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = l.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       ColumnVector utmp = u;
       ColumnVector vtmp = v;
--- a/liboctave/numeric/dbleQR.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/dbleQR.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -213,7 +213,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = q.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       ColumnVector utmp = u;
       ColumnVector vtmp = v;
@@ -257,7 +257,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = q.columns ();
 
-  if (u.length () != m)
+  if (u.numel () != m)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -290,14 +290,14 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
 
   if (dups)
     (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
-  else if (u.length () != m || u.columns () != nj)
+  else if (u.numel () != m || u.columns () != nj)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -315,7 +315,7 @@
         }
 
       OCTAVE_LOCAL_BUFFER (double, w, kmax);
-      for (volatile octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.numel (); i++)
         {
           octave_idx_type ii = i;
           ColumnVector utmp = u.column (jsi(i));
@@ -363,7 +363,7 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
@@ -375,7 +375,7 @@
   else if (nj > 0)
     {
       OCTAVE_LOCAL_BUFFER (double, w, k);
-      for (volatile octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.numel (); i++)
         {
           octave_idx_type ii = i;
           F77_XFCN (dqrdec, DQRDEC, (m, n - ii, k == m ? k : k - ii,
@@ -403,7 +403,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = std::min (m, n);
 
-  if (! q.is_square () || u.length () != n)
+  if (! q.is_square () || u.numel () != n)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > m)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -473,7 +473,7 @@
   octave_idx_type m = q.rows ();
   octave_idx_type n = r.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       init (q*r + Matrix (u) * Matrix (v).transpose (), get_type ());
     }
@@ -568,7 +568,7 @@
   octave_idx_type m = q.rows ();
   octave_idx_type n = r.columns ();
 
-  if (u.length () != m)
+  if (u.numel () != m)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -588,21 +588,21 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
 
   if (dups)
     (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
-  else if (u.length () != m || u.columns () != nj)
+  else if (u.numel () != m || u.columns () != nj)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
   else if (nj > 0)
     {
       Matrix a = q*r;
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (octave_idx_type i = 0; i < js.numel (); i++)
         a = ::insert_col (a, js(i), u.column (i));
       init (a, get_type ());
     }
@@ -632,7 +632,7 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
@@ -644,7 +644,7 @@
   else if (nj > 0)
     {
       Matrix a = q*r;
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (octave_idx_type i = 0; i < js.numel (); i++)
         a = ::delete_col (a, js(i));
       init (a, get_type ());
     }
@@ -658,7 +658,7 @@
   octave_idx_type m = r.rows ();
   octave_idx_type n = r.columns ();
 
-  if (! q.is_square () || u.length () != n)
+  if (! q.is_square () || u.numel () != n)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > m)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
--- a/liboctave/numeric/eigs-base.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/eigs-base.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -445,7 +445,7 @@
     {
       if (cholB)
         {
-          if (permB.length ())
+          if (permB.numel ())
             {
               SparseMatrix tmp(n,n,n);
               for (octave_idx_type i = 0; i < n; i++)
@@ -457,15 +457,14 @@
                 }
               tmp.xcidx (n) = n;
 
-              AminusSigmaB = AminusSigmaB - sigma * tmp *
-                             b.transpose () * b * tmp.transpose ();
+              AminusSigmaB -= sigma * tmp *
+                              b.transpose () * b * tmp.transpose ();
             }
           else
-            AminusSigmaB = AminusSigmaB - sigma *
-                           b.transpose () * b;
+            AminusSigmaB -= sigma * b.transpose () * b;
         }
       else
-        AminusSigmaB = AminusSigmaB - sigma * b;
+        AminusSigmaB -= sigma * b;
     }
   else
     {
@@ -480,7 +479,7 @@
           sigmat.xcidx (i+1) = i + 1;
         }
 
-      AminusSigmaB = AminusSigmaB - sigmat;
+      AminusSigmaB -= sigmat;
     }
 
   SparseLU fact (AminusSigmaB);
@@ -542,7 +541,7 @@
           const double *pB = permB.fortran_vec ();
           double *p = AminusSigmaB.fortran_vec ();
 
-          if (permB.length ())
+          if (permB.numel ())
             {
               for (octave_idx_type j = 0;
                    j < b.cols (); j++)
@@ -552,10 +551,10 @@
                                      static_cast<octave_idx_type>(pB[j]));
             }
           else
-            AminusSigmaB = AminusSigmaB - tmp;
+            AminusSigmaB -= tmp;
         }
       else
-        AminusSigmaB = AminusSigmaB - sigma * b;
+        AminusSigmaB -= sigma * b;
     }
   else
     {
@@ -610,7 +609,7 @@
     {
       if (cholB)
         {
-          if (permB.length ())
+          if (permB.numel ())
             {
               SparseMatrix tmp(n,n,n);
               for (octave_idx_type i = 0; i < n; i++)
@@ -622,14 +621,14 @@
                 }
               tmp.xcidx (n) = n;
 
-              AminusSigmaB = AminusSigmaB - tmp * b.hermitian () * b *
-                             tmp.transpose () * sigma;
+              AminusSigmaB -= tmp * b.hermitian () * b *
+                              tmp.transpose () * sigma;
             }
           else
-            AminusSigmaB = AminusSigmaB - sigma * b.hermitian () * b;
+            AminusSigmaB -= sigma * b.hermitian () * b;
         }
       else
-        AminusSigmaB = AminusSigmaB - sigma * b;
+        AminusSigmaB -= sigma * b;
     }
   else
     {
@@ -644,7 +643,7 @@
           sigmat.xcidx (i+1) = i + 1;
         }
 
-      AminusSigmaB = AminusSigmaB - sigmat;
+      AminusSigmaB -= sigmat;
     }
 
   SparseComplexLU fact (AminusSigmaB);
@@ -706,7 +705,7 @@
           const double *pB = permB.fortran_vec ();
           Complex *p = AminusSigmaB.fortran_vec ();
 
-          if (permB.length ())
+          if (permB.numel ())
             {
               for (octave_idx_type j = 0;
                    j < b.cols (); j++)
@@ -716,10 +715,10 @@
                                      static_cast<octave_idx_type>(pB[j]));
             }
           else
-            AminusSigmaB = AminusSigmaB - tmp;
+            AminusSigmaB -= tmp;
         }
       else
-        AminusSigmaB = AminusSigmaB - sigma * b;
+        AminusSigmaB -= sigma * b;
     }
   else
     {
@@ -830,10 +829,10 @@
       return -1;
     }
 
-  if (have_b && cholB && permB.length () != 0)
+  if (have_b && cholB && permB.numel () != 0)
     {
       // Check the we really have a permutation vector
-      if (permB.length () != n)
+      if (permB.numel () != n)
         {
           (*current_liboctave_error_handler)
             ("eigs: permB vector invalid");
@@ -881,7 +880,7 @@
         {
           bt = b;
           b = b.transpose ();
-          if (permB.length () == 0)
+          if (permB.numel () == 0)
             {
               permB = ColumnVector (n);
               for (octave_idx_type i = 0; i < n; i++)
@@ -1154,10 +1153,10 @@
       return -1;
     }
 
-  if (have_b && cholB && permB.length () != 0)
+  if (have_b && cholB && permB.numel () != 0)
     {
       // Check the we really have a permutation vector
-      if (permB.length () != n)
+      if (permB.numel () != n)
         {
           (*current_liboctave_error_handler) ("eigs: permB vector invalid");
           return -1;
@@ -1744,10 +1743,10 @@
       return -1;
     }
 
-  if (have_b && cholB && permB.length () != 0)
+  if (have_b && cholB && permB.numel () != 0)
     {
       // Check the we really have a permutation vector
-      if (permB.length () != n)
+      if (permB.numel () != n)
         {
           (*current_liboctave_error_handler)
             ("eigs: permB vector invalid");
@@ -1795,7 +1794,7 @@
         {
           bt = b;
           b = b.transpose ();
-          if (permB.length () == 0)
+          if (permB.numel () == 0)
             {
               permB = ColumnVector (n);
               for (octave_idx_type i = 0; i < n; i++)
@@ -2117,10 +2116,10 @@
       return -1;
     }
 
-  if (have_b && cholB && permB.length () != 0)
+  if (have_b && cholB && permB.numel () != 0)
     {
       // Check that we really have a permutation vector
-      if (permB.length () != n)
+      if (permB.numel () != n)
         {
           (*current_liboctave_error_handler) ("eigs: permB vector invalid");
           return -1;
@@ -2812,10 +2811,10 @@
       return -1;
     }
 
-  if (have_b && cholB && permB.length () != 0)
+  if (have_b && cholB && permB.numel () != 0)
     {
       // Check the we really have a permutation vector
-      if (permB.length () != n)
+      if (permB.numel () != n)
         {
           (*current_liboctave_error_handler)
             ("eigs: permB vector invalid");
@@ -2863,7 +2862,7 @@
         {
           bt = b;
           b = b.hermitian ();
-          if (permB.length () == 0)
+          if (permB.numel () == 0)
             {
               permB = ColumnVector (n);
               for (octave_idx_type i = 0; i < n; i++)
@@ -3137,10 +3136,10 @@
       return -1;
     }
 
-  if (have_b && cholB && permB.length () != 0)
+  if (have_b && cholB && permB.numel () != 0)
     {
       // Check that we really have a permutation vector
-      if (permB.length () != n)
+      if (permB.numel () != n)
         {
           (*current_liboctave_error_handler) ("eigs: permB vector invalid");
           return -1;
--- a/liboctave/numeric/fCmplxCHOL.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/fCmplxCHOL.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -200,7 +200,7 @@
 {
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       FloatComplexColumnVector utmp = u;
 
@@ -220,7 +220,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       FloatComplexColumnVector utmp = u;
 
@@ -243,7 +243,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () != n + 1)
+  if (u.numel () != n + 1)
     (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("cholinsert: index out of range");
--- a/liboctave/numeric/fCmplxLU.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/fCmplxLU.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -98,7 +98,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = l.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       FloatComplexColumnVector utmp = u;
       FloatComplexColumnVector vtmp = v;
@@ -150,7 +150,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = l.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       FloatComplexColumnVector utmp = u;
       FloatComplexColumnVector vtmp = v;
--- a/liboctave/numeric/fCmplxQR.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/fCmplxQR.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -216,7 +216,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = q.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       FloatComplexColumnVector utmp = u;
       FloatComplexColumnVector vtmp = v;
@@ -265,7 +265,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = q.columns ();
 
-  if (u.length () != m)
+  if (u.numel () != m)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -299,14 +299,14 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
 
   if (dups)
     (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
-  else if (u.length () != m || u.columns () != nj)
+  else if (u.numel () != m || u.columns () != nj)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -324,7 +324,7 @@
         }
 
       OCTAVE_LOCAL_BUFFER (float, rw, kmax);
-      for (volatile octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.numel (); i++)
         {
           octave_idx_type ii = i;
           F77_XFCN (cqrinc, CQRINC, (m, n + ii, std::min (kmax, k + ii),
@@ -371,7 +371,7 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
@@ -383,7 +383,7 @@
   else if (nj > 0)
     {
       OCTAVE_LOCAL_BUFFER (float, rw, k);
-      for (volatile octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.numel (); i++)
         {
           octave_idx_type ii = i;
           F77_XFCN (cqrdec, CQRDEC, (m, n - ii, k == m ? k : k - ii,
@@ -411,7 +411,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = std::min (m, n);
 
-  if (! q.is_square () || u.length () != n)
+  if (! q.is_square () || u.numel () != n)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > m)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -484,7 +484,7 @@
   octave_idx_type m = q.rows ();
   octave_idx_type n = r.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       init (q*r + FloatComplexMatrix (u) * FloatComplexMatrix (v).hermitian (),
             get_type ());
@@ -582,7 +582,7 @@
   octave_idx_type m = q.rows ();
   octave_idx_type n = r.columns ();
 
-  if (u.length () != m)
+  if (u.numel () != m)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -603,21 +603,21 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
 
   if (dups)
     (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
-  else if (u.length () != m || u.columns () != nj)
+  else if (u.numel () != m || u.columns () != nj)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
   else if (nj > 0)
     {
       FloatComplexMatrix a = q*r;
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (octave_idx_type i = 0; i < js.numel (); i++)
         a = ::insert_col (a, js(i), u.column (i));
       init (a, get_type ());
     }
@@ -647,7 +647,7 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
@@ -659,7 +659,7 @@
   else if (nj > 0)
     {
       FloatComplexMatrix a = q*r;
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (octave_idx_type i = 0; i < js.numel (); i++)
         a = ::delete_col (a, js(i));
       init (a, get_type ());
     }
@@ -673,7 +673,7 @@
   octave_idx_type m = r.rows ();
   octave_idx_type n = r.columns ();
 
-  if (! q.is_square () || u.length () != n)
+  if (! q.is_square () || u.numel () != n)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > m)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
--- a/liboctave/numeric/floatCHOL.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/floatCHOL.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -205,7 +205,7 @@
 {
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       FloatColumnVector utmp = u;
 
@@ -225,7 +225,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       FloatColumnVector utmp = u;
 
@@ -247,7 +247,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () != n + 1)
+  if (u.numel () != n + 1)
     (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("cholinsert: index out of range");
@@ -309,7 +309,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       init (chol_mat.transpose () * chol_mat
             + FloatMatrix (u) * FloatMatrix (u).transpose (), false);
@@ -335,7 +335,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () == n)
+  if (u.numel () == n)
     {
       if (singular (chol_mat))
         info = 2;
@@ -361,7 +361,7 @@
 
   octave_idx_type n = chol_mat.rows ();
 
-  if (u.length () != n + 1)
+  if (u.numel () != n + 1)
     (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("cholinsert: index out of range");
--- a/liboctave/numeric/floatLU.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/floatLU.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -97,7 +97,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = l.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       FloatColumnVector utmp = u;
       FloatColumnVector vtmp = v;
@@ -149,7 +149,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = l.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       FloatColumnVector utmp = u;
       FloatColumnVector vtmp = v;
--- a/liboctave/numeric/floatQR.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/floatQR.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -211,7 +211,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = q.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       FloatColumnVector utmp = u;
       FloatColumnVector vtmp = v;
@@ -255,7 +255,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = q.columns ();
 
-  if (u.length () != m)
+  if (u.numel () != m)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -288,14 +288,14 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
 
   if (dups)
     (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
-  else if (u.length () != m || u.columns () != nj)
+  else if (u.numel () != m || u.columns () != nj)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -313,7 +313,7 @@
         }
 
       OCTAVE_LOCAL_BUFFER (float, w, kmax);
-      for (volatile octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.numel (); i++)
         {
           octave_idx_type ii = i;
           FloatColumnVector utmp = u.column (jsi(i));
@@ -361,7 +361,7 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
@@ -373,7 +373,7 @@
   else if (nj > 0)
     {
       OCTAVE_LOCAL_BUFFER (float, w, k);
-      for (volatile octave_idx_type i = 0; i < js.length (); i++)
+      for (volatile octave_idx_type i = 0; i < js.numel (); i++)
         {
           octave_idx_type ii = i;
           F77_XFCN (sqrdec, SQRDEC, (m, n - ii, k == m ? k : k - ii,
@@ -401,7 +401,7 @@
   octave_idx_type n = r.columns ();
   octave_idx_type k = std::min (m, n);
 
-  if (! q.is_square () || u.length () != n)
+  if (! q.is_square () || u.numel () != n)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > m)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -471,7 +471,7 @@
   octave_idx_type m = q.rows ();
   octave_idx_type n = r.columns ();
 
-  if (u.length () == m && v.length () == n)
+  if (u.numel () == m && v.numel () == n)
     {
       init (q*r + FloatMatrix (u) * FloatMatrix (v).transpose (), get_type ());
     }
@@ -566,7 +566,7 @@
   octave_idx_type m = q.rows ();
   octave_idx_type n = r.columns ();
 
-  if (u.length () != m)
+  if (u.numel () != m)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > n)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
@@ -586,21 +586,21 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
 
   if (dups)
     (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
-  else if (u.length () != m || u.columns () != nj)
+  else if (u.numel () != m || u.columns () != nj)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
   else if (nj > 0)
     {
       FloatMatrix a = q*r;
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (octave_idx_type i = 0; i < js.numel (); i++)
         a = ::insert_col (a, js(i), u.column (i));
       init (a, get_type ());
     }
@@ -630,7 +630,7 @@
 
   Array<octave_idx_type> jsi;
   Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
-  octave_idx_type nj = js.length ();
+  octave_idx_type nj = js.numel ();
   bool dups = false;
   for (octave_idx_type i = 0; i < nj - 1; i++)
     dups = dups && js(i) == js(i+1);
@@ -642,7 +642,7 @@
   else if (nj > 0)
     {
       FloatMatrix a = q*r;
-      for (octave_idx_type i = 0; i < js.length (); i++)
+      for (octave_idx_type i = 0; i < js.numel (); i++)
         a = ::delete_col (a, js(i));
       init (a, get_type ());
     }
@@ -656,7 +656,7 @@
   octave_idx_type m = r.rows ();
   octave_idx_type n = r.columns ();
 
-  if (! q.is_square () || u.length () != n)
+  if (! q.is_square () || u.numel () != n)
     (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
   else if (j < 0 || j > m)
     (*current_liboctave_error_handler) ("qrinsert: index out of range");
--- a/liboctave/numeric/lo-specfun.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/lo-specfun.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -1,8 +1,10 @@
 /*
 
 Copyright (C) 1996-2015 John W. Eaton
+Copyright (C) 2007-2010 D. Martin
 Copyright (C) 2010 Jaroslav Hajek
 Copyright (C) 2010 VZLU Prague
+Copyright (C) 2015 Carnë Draug
 
 This file is part of Octave.
 
@@ -45,6 +47,7 @@
 #include "lo-specfun.h"
 #include "mx-inlines.cc"
 #include "lo-mappers.h"
+#include "lo-math.h"
 
 #include "Faddeeva.hh"
 
@@ -183,6 +186,16 @@
 
   F77_RET_T
   F77_FUNC (algams, ALGAMS) (const float&, float&, float&);
+
+  F77_RET_T
+  F77_FUNC (psifn, PSIFN) (const float*, const octave_idx_type&,
+                           const octave_idx_type&, const octave_idx_type&,
+                           float*, octave_idx_type*, octave_idx_type*);
+
+  F77_RET_T
+  F77_FUNC (dpsifn, DPSIFN) (const double*, const octave_idx_type&,
+                             const octave_idx_type&, const octave_idx_type&,
+                             double*, octave_idx_type*, octave_idx_type*);
 }
 
 #if !defined (HAVE_ACOSH)
@@ -1264,8 +1277,8 @@
            const ComplexColumnVector& x, bool scaled,
            Array<octave_idx_type>& ierr)
 {
-  octave_idx_type nr = x.length ();
-  octave_idx_type nc = alpha.length ();
+  octave_idx_type nr = x.numel ();
+  octave_idx_type nc = alpha.numel ();
 
   ComplexMatrix retval (nr, nc);
 
@@ -1875,8 +1888,8 @@
            const FloatComplexColumnVector& x, bool scaled,
            Array<octave_idx_type>& ierr)
 {
-  octave_idx_type nr = x.length ();
-  octave_idx_type nc = alpha.length ();
+  octave_idx_type nr = x.numel ();
+  octave_idx_type nc = alpha.numel ();
 
   FloatComplexMatrix retval (nr, nc);
 
@@ -3237,14 +3250,14 @@
 
   for ( ; ; )
     {
-      term = term * temp * rx / (pp + ai);
-      value = value + term;
+      term *= temp * rx / (pp + ai);
+      value += term;
       temp = fabs (term);
 
       if (temp <= acu && temp <= acu * value)
         {
-          value = value * exp (pp * gnulib::log (xx)
-                               + (qq - 1.0) * gnulib::log (cx) - beta) / pp;
+          value *= exp (pp * gnulib::log (xx)
+                        + (qq - 1.0) * gnulib::log (cx) - beta) / pp;
 
           if (indx)
             {
@@ -3253,8 +3266,8 @@
           break;
         }
 
-      ai = ai + 1.0;
-      ns = ns - 1;
+      ai += 1.0;
+      ns -= 1;
 
       if (0 <= ns)
         {
@@ -3267,7 +3280,7 @@
       else
         {
           temp = psq;
-          psq = psq + 1.0;
+          psq += 1.0;
         }
     }
 
@@ -3439,7 +3452,7 @@
                       break;
                     }
                 }
-              g = g / 3.0;
+              g /= 3.0;
             }
 
           if (prev <= acu)
@@ -3465,7 +3478,7 @@
               break;
             }
 
-          g = g / 3.0;
+          g /= 3.0;
         }
 
       if (tx == value)
@@ -3724,3 +3737,185 @@
       dn = Complex (dd*cc1*dd1/ddd, -m*ss*cc*ss1/ddd);
     }
 }
+
+static const double pi = 3.14159265358979323846;
+
+template<class T>
+static T
+Lanczos_approximation_psi (const T zc)
+{
+  // Coefficients for C.Lanczos expansion of psi function from XLiFE++ gammaFunctions
+  // psi_coef[k] = - (2k+1) * lg_coef[k] (see melina++ gamma functions)
+  // -1/12, 3/360,-5/1260, 7/1680,-9/1188, 11*691/360360,-13/156, 15*3617/122400, ? , ?
+  static const T dg_coeff[10] = {
+    -0.83333333333333333e-1, 0.83333333333333333e-2,
+    -0.39682539682539683e-2, 0.41666666666666667e-2,
+    -0.75757575757575758e-2, 0.21092796092796093e-1,
+    -0.83333333333333333e-1, 0.4432598039215686,
+    -0.3053954330270122e+1,  0.125318899521531e+2
+  };
+
+  T overz2  = T (1.0) / (zc * zc);
+  T overz2k = overz2;
+
+  T p = 0;
+  for (octave_idx_type k = 0; k < 10; k++, overz2k *= overz2)
+    p += dg_coeff[k] * overz2k;
+  p += log (zc) - T (0.5) / zc;
+  return p;
+}
+
+template<class T>
+T
+psi (const T& z)
+{
+  static const double euler_mascheroni = 0.577215664901532860606512090082402431042;
+
+  const bool is_int = (xfloor (z) == z);
+
+  T p = 0;
+  if (z <= 0)
+    {
+      // limits - zeros of the gamma function
+      if (is_int)
+        p = -octave_Inf; // Matlab returns -Inf for psi (0)
+      else
+        // Abramowitz and Stegun, page 259, eq 6.3.7
+        p = psi (1 - z) - (pi / tan (pi * z));
+    }
+  else if (is_int)
+    {
+      // Abramowitz and Stegun, page 258, eq 6.3.2
+      p = - euler_mascheroni;
+      for (octave_idx_type k = z - 1; k > 0; k--)
+        p += 1.0 / k;
+    }
+  else if (xfloor (z + 0.5) == z + 0.5)
+    {
+      // Abramowitz and Stegun, page 258, eq 6.3.3 and 6.3.4
+      for (octave_idx_type k = z; k > 0; k--)
+        p += 1.0 / (2 * k - 1);
+
+      p = - euler_mascheroni - 2 * log (2) + 2 * (p);
+    }
+  else
+    {
+      // adapted from XLiFE++ gammaFunctions
+
+      T zc = z;
+      // Use formula for derivative of LogGamma(z)
+      if (z < 10)
+        {
+          const signed char n = 10 - z;
+          for (signed char k = n - 1; k >= 0; k--)
+            p -= 1.0 / (k + z);
+          zc += n;
+        }
+      p += Lanczos_approximation_psi (zc);
+    }
+
+  return p;
+}
+
+// explicit instantiations
+template double psi<double> (const double& z);
+template float  psi<float> (const float& z);
+
+template<class T>
+std::complex<T>
+psi (const std::complex<T>& z)
+{
+  // adapted from XLiFE++ gammaFunctions
+
+  typedef typename std::complex<T>::value_type P;
+
+  P z_r  = z.real ();
+  P z_ra = z_r;
+
+  std::complex<T> dgam (0.0, 0.0);
+  if (z.imag () == 0)
+    dgam = std::complex<T> (psi (z_r), 0.0);
+  else if (z_r < 0)
+    dgam = psi (P (1.0) - z)- (P (pi) / tan (P (pi) * z));
+  else
+    {
+      // Use formula for derivative of LogGamma(z)
+      std::complex<T> z_m = z;
+      if (z_ra < 8)
+        {
+          unsigned char n = 8 - z_ra;
+          z_m = z + std::complex<T> (n, 0.0);
+
+          // Recurrence formula
+          // for | Re(z) | < 8 , use recursively DiGamma(z) = DiGamma(z+1) - 1/z
+          std::complex<T> z_p = z + P (n - 1);
+          for (unsigned char k = n; k > 0; k--, z_p -= 1.0)
+            dgam -= P (1.0) / z_p;
+        }
+
+      // for | Re(z) | > 8, use derivative of C.Lanczos expansion for LogGamma
+      // psi(z) = log(z) - 1/(2z) - 1/12z^2 + 3/360z^4 - 5/1260z^6 + 7/1680z^8 - 9/1188z^10 + ...
+      // (Abramowitz&Stegun, page 259, formula 6.3.18
+      dgam += Lanczos_approximation_psi (z_m);
+    }
+  return dgam;
+}
+
+// explicit instantiations
+template Complex psi<double> (const Complex& z);
+template FloatComplex psi<float> (const FloatComplex& z);
+
+
+template<typename T>
+static inline void
+fortran_psifn (const T z, const octave_idx_type n, T* ans,
+               octave_idx_type* ierr);
+
+template<>
+inline void
+fortran_psifn<double> (const double z, const octave_idx_type n,
+                       double* ans, octave_idx_type* ierr)
+{
+  octave_idx_type flag = 0;
+  F77_XFCN (dpsifn, DPSIFN, (&z, n, 1, 1, ans, &flag, ierr));
+}
+
+template<>
+inline void
+fortran_psifn<float> (const float z, const octave_idx_type n,
+                      float* ans, octave_idx_type* ierr)
+{
+  octave_idx_type flag = 0;
+  F77_XFCN (psifn, PSIFN, (&z, n, 1, 1, ans, &flag, ierr));
+}
+
+template<class T>
+T
+psi (const octave_idx_type n, const T z)
+{
+  T ans;
+  octave_idx_type ierr = 0;
+  fortran_psifn<T> (z, n, &ans, &ierr);
+  if (ierr == 0)
+    {
+      // Remember that psifn and dpsifn return scales values
+      // When n is 1: do nothing since ((-1)**(n+1)/gamma(n+1)) == 1
+      // When n is 0: change sign since ((-1)**(n+1)/gamma(n+1)) == -1
+      if (n > 1)
+        // FIXME xgamma here is a killer for our precision since it grows
+        //       way too fast
+        ans = ans / (pow (-1.0, n + 1) / xgamma (double (n+1)));
+      else if (n == 0)
+        ans = -ans;
+    }
+  else if (ierr == 2)
+    ans = - octave_Inf;
+  else // we probably never get here
+    ans = octave_NaN;
+
+  return ans;
+}
+
+// explicit instantiations
+template double psi<double> (const octave_idx_type n, const double z);
+template float  psi<float>  (const octave_idx_type n, const float z);
--- a/liboctave/numeric/lo-specfun.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/lo-specfun.h	Tue Jun 23 20:00:59 2015 -0700
@@ -663,4 +663,24 @@
 ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn,
         double& err);
 
+//! Digamma function.
+//!
+//! Only defined for double and float.
+template<class T>
+extern OCTAVE_API T psi (const T& z);
+
+//! Digamma function for complex input.
+//!
+//! Only defined for double and float.
+template<class T>
+extern OCTAVE_API std::complex<T> psi (const std::complex<T>& z);
+
+//! Polygamma function.
+//!
+//! Only defined for double and float.
+//! @param n must be non-negative.  If zero, the digamma function is computed.
+//! @param z must be real and non-negative.
+template<class T>
+extern OCTAVE_API T psi (const octave_idx_type n, const T z);
+
 #endif
--- a/liboctave/numeric/oct-rand.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/oct-rand.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -513,7 +513,7 @@
     {
       retval.clear (n, 1);
 
-      fill (retval.capacity (), retval.fortran_vec (), a);
+      fill (retval.numel (), retval.fortran_vec (), a);
     }
   else if (n < 0)
     (*current_liboctave_error_handler) ("rand: invalid negative argument");
@@ -530,7 +530,7 @@
     {
       retval.clear (n, 1);
 
-      fill (retval.capacity (), retval.fortran_vec (), a);
+      fill (retval.numel (), retval.fortran_vec (), a);
     }
   else if (n < 0)
     (*current_liboctave_error_handler) ("rand: invalid negative argument");
@@ -547,7 +547,7 @@
     {
       retval.clear (dims);
 
-      fill (retval.capacity (), retval.fortran_vec (), a);
+      fill (retval.numel (), retval.fortran_vec (), a);
     }
 
   return retval;
@@ -562,7 +562,7 @@
     {
       retval.clear (dims);
 
-      fill (retval.capacity (), retval.fortran_vec (), a);
+      fill (retval.numel (), retval.fortran_vec (), a);
     }
 
   return retval;
@@ -690,7 +690,7 @@
 void
 octave_rand::set_internal_state (const ColumnVector& s)
 {
-  octave_idx_type len = s.length ();
+  octave_idx_type len = s.numel ();
   octave_idx_type n = len < MT_N + 1 ? len : MT_N + 1;
 
   OCTAVE_LOCAL_BUFFER (uint32_t, tmp, MT_N + 1);
--- a/liboctave/numeric/oct-spparms.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/oct-spparms.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -177,7 +177,7 @@
 bool
 octave_sparse_params::do_set_vals (const NDArray& vals)
 {
-  octave_idx_type len = vals.length ();
+  octave_idx_type len = vals.numel ();
 
   if (len > OCTAVE_SPARSE_CONTROLS_SIZE)
     {
--- a/liboctave/numeric/sparse-base-chol.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/numeric/sparse-base-chol.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -280,7 +280,7 @@
   MatrixType mattype (MatrixType::Upper);
   chol_type linv = L ().hermitian ().inverse (mattype, info, rcond2, 1, 0);
 
-  if (perms.length () == n)
+  if (perms.numel () == n)
     {
       p_type Qc = Q ();
       retval = Qc * linv * linv.hermitian () * Qc.transpose ();
--- a/liboctave/operators/mx-inlines.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/operators/mx-inlines.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -371,7 +371,7 @@
   if (dx == dy)
     {
       Array<R> r (dx);
-      op (r.length (), r.fortran_vec (), x.data (), y.data ());
+      op (r.numel (), r.fortran_vec (), x.data (), y.data ());
       return r;
     }
   else if (is_valid_bsxfun (opname, dx, dy))
@@ -391,7 +391,7 @@
                  void (*op) (size_t, R *, const X *, Y) throw ())
 {
   Array<R> r (x.dims ());
-  op (r.length (), r.fortran_vec (), x.data (), y);
+  op (r.numel (), r.fortran_vec (), x.data (), y);
   return r;
 }
 
@@ -401,7 +401,7 @@
                  void (*op) (size_t, R *, X, const Y *) throw ())
 {
   Array<R> r (y.dims ());
-  op (r.length (), r.fortran_vec (), x, y.data ());
+  op (r.numel (), r.fortran_vec (), x, y.data ());
   return r;
 }
 
@@ -416,7 +416,7 @@
   dim_vector dx = x.dims ();
   if (dr == dx)
     {
-      op (r.length (), r.fortran_vec (), x.data ());
+      op (r.numel (), r.fortran_vec (), x.data ());
     }
   else if (is_valid_inplace_bsxfun (opname, dr, dx))
     {
@@ -432,7 +432,7 @@
 do_ms_inplace_op (Array<R>& r, const X& x,
                   void (*op) (size_t, R *, X) throw ())
 {
-  op (r.length (), r.fortran_vec (), x);
+  op (r.numel (), r.fortran_vec (), x);
   return r;
 }
 
@@ -1179,9 +1179,9 @@
       // calculate extent triplet.
       l = 1, n = dims(dim), u = 1;
       for (octave_idx_type i = 0; i < dim; i++)
-        l *= dims (i);
+        l *= dims(i);
       for (octave_idx_type i = dim + 1; i < ndims; i++)
-        u *= dims (i);
+        u *= dims(i);
     }
 }
 
@@ -1199,7 +1199,7 @@
   dim_vector dims = src.dims ();
   // M*b inconsistency: sum ([]) = 0 etc.
   if (dims.length () == 2 && dims(0) == 0 && dims(1) == 0)
-    dims (1) = 1;
+    dims(1) = 1;
 
   get_extent_triplet (dims, dim, l, n, u);
 
@@ -1327,7 +1327,7 @@
 
   if (dims(dim) <= order)
     {
-      dims (dim) = 0;
+      dims(dim) = 0;
       return Array<R> (dims);
     }
   else
--- a/liboctave/system/file-ops.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/system/file-ops.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -152,7 +152,7 @@
     {
       for (size_t i = 0; i < s_len; i++)
         {
-          for (int j = 0; j < prefixes.length (); j++)
+          for (int j = 0; j < prefixes.numel (); j++)
             {
               size_t pfx_len = prefixes[j].length ();
 
@@ -187,7 +187,7 @@
 
       if (! suffixes.empty ())
         {
-          for (int j = 0; j < suffixes.length (); j++)
+          for (int j = 0; j < suffixes.numel (); j++)
             {
               size_t sfx_len = suffixes[j].length ();
 
@@ -346,7 +346,7 @@
 {
   string_vector retval;
 
-  int n = names.length ();
+  int n = names.numel ();
 
   retval.resize (n);
 
@@ -580,7 +580,7 @@
     {
       string_vector dirlist = dir.read ();
 
-      for (octave_idx_type i = 0; i < dirlist.length (); i++)
+      for (octave_idx_type i = 0; i < dirlist.numel (); i++)
         {
           octave_quit ();
 
--- a/liboctave/util/glob-match.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/util/glob-match.h	Tue Jun 23 20:00:59 2015 -0700
@@ -72,7 +72,7 @@
 
   Array<bool> match (const string_vector& str) const
   {
-    int n = str.length ();
+    int n = str.numel ();
 
     Array<bool> retval (dim_vector (n, 1));
 
--- a/liboctave/util/kpse.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/util/kpse.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -427,7 +427,7 @@
         gnulib::fputs (" (nil)\n", stderr);
       else
         {
-          int len = ret.length ();
+          int len = ret.numel ();
           for (int i = 0; i < len; i++)
             {
               gnulib::putc (' ', stderr);
@@ -704,7 +704,7 @@
   if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH) || log_file)
     {
       /* FILENAMES should never be null, but safety doesn't hurt.  */
-      for (int e = 0; e < filenames.length () && ! filenames[e].empty (); e++)
+      for (int e = 0; e < filenames.numel () && ! filenames[e].empty (); e++)
         {
           std::string filename = filenames[e];
 
@@ -1010,7 +1010,7 @@
         {
           const std::string dir = STR_LLIST (*dirs_elt);
 
-          int len = names.length ();
+          int len = names.numel ();
           for (int i = 0; i < len && !done; i++)
             {
               std::string name = names[i];
@@ -1076,7 +1076,7 @@
     {
       gnulib::fputs ("start find_first_of ((", stderr);
 
-      int len = names.length ();
+      int len = names.numel ();
 
       for (int i = 0; i < len; i++)
         {
@@ -1090,7 +1090,7 @@
                        path.c_str (), must_exist);
     }
 
-  for (int i = 0; i < names.length (); i++)
+  for (int i = 0; i < names.numel (); i++)
     {
       std::string name = names[i];
 
@@ -1125,7 +1125,7 @@
         {
           gnulib::fputs ("find_first_of (", stderr);
 
-          int len = names.length ();
+          int len = names.numel ();
 
           for (int i = 0; i < len; i++)
             {
@@ -1337,7 +1337,7 @@
 
   string_vector expansions = brace_expand (elt);
 
-  for (int i = 0; i < expansions.length (); i++)
+  for (int i = 0; i < expansions.numel (); i++)
     {
       /* Do $ and ~ expansion on each element.  */
       std::string x = kpse_expand (expansions[i]);
@@ -1511,8 +1511,8 @@
     result = arr1;
   else
     {
-      int len1 = arr1.length ();
-      int len2 = arr2.length ();
+      int len1 = arr1.numel ();
+      int len2 = arr2.numel ();
 
       result = string_vector (len1 * len2);
 
@@ -1886,7 +1886,7 @@
      extra couple of hash lookups matter -- they don't -- but rather
      because we want to return NULL in this case, so path_search can
      know to do a disk search.  */
-  for (int e = 0; ! relevant && e < db_dir_list.length (); e++)
+  for (int e = 0; ! relevant && e < db_dir_list.numel (); e++)
     relevant = elt_in_db (db_dir_list[e], path_elt);
 
   if (! relevant)
@@ -1897,14 +1897,14 @@
     aliases = hash_lookup (alias_db, name);
 
   /* Push aliases up by one and insert the original name at the front.  */
-  int len = aliases.length ();
+  int len = aliases.numel ();
   aliases.resize (len+1);
   for (int i = len; i > 0; i--)
     aliases[i] = aliases[i - 1];
   aliases[0] = name;
 
   done = false;
-  len = aliases.length ();
+  len = aliases.numel ();
   for (int i = 0; i < len && !done; i++)
     {
       std::string atry = aliases[i];
@@ -1916,7 +1916,7 @@
          example, if we have .../cx/cmr10.300pk and .../ricoh/cmr10.300pk,
          and the path looks like .../cx, we don't want the ricoh file.  */
 
-      int db_dirs_len = db_dirs.length ();
+      int db_dirs_len = db_dirs.numel ();
       for (int j = 0; j < db_dirs_len && !done; j++)
         {
           std::string db_file = db_dirs[j] + atry;
@@ -1946,7 +1946,7 @@
                      and shouldn't hurt.  The upshot is that if one of
                      the aliases actually exists, we use that.  */
 
-                  int aliases_len = aliases.length ();
+                  int aliases_len = aliases.numel ();
 
                   for (int k = 1; k < aliases_len && found.empty (); k++)
                     {
--- a/liboctave/util/lo-regexp.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/util/lo-regexp.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -434,11 +434,11 @@
 Array<bool>
 regexp::is_match (const string_vector& buffer)
 {
-  octave_idx_type len = buffer.length ();
+  octave_idx_type len = buffer.numel ();
 
   Array<bool> retval (dim_vector (len, 1));
 
-  for (octave_idx_type i = 0; i < buffer.length (); i++)
+  for (octave_idx_type i = 0; i < buffer.numel (); i++)
     retval(i) = is_match (buffer(i));
 
   return retval;
--- a/liboctave/util/oct-glob.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/util/oct-glob.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -51,7 +51,7 @@
 octave_fnmatch (const string_vector& pat, const std::string& str,
                 int fnmatch_flags)
 {
-  int npat = pat.length ();
+  int npat = pat.numel ();
 
   const char *cstr = str.c_str ();
 
@@ -67,7 +67,7 @@
 {
   string_vector retval;
 
-  int npat = pat.length ();
+  int npat = pat.numel ();
 
   int k = 0;
 
--- a/liboctave/util/pathsearch.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/util/pathsearch.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -79,7 +79,7 @@
 
   if (initialized)
     {
-      int len = pv.length ();
+      int len = pv.numel ();
 
       int nmax = len > 32 ? len : 32;
 
--- a/liboctave/util/str-vec.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/util/str-vec.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -108,7 +108,7 @@
 {
   // Don't use Array<std::string>::sort () to allow sorting in place.
   octave_sort<std::string> lsort;
-  lsort.sort (Array<std::string>::fortran_vec (), length ());
+  lsort.sort (Array<std::string>::fortran_vec (), numel ());
 
   if (make_uniq)
     uniq ();
@@ -118,7 +118,7 @@
 string_vector&
 string_vector::uniq (void)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -139,7 +139,7 @@
 string_vector&
 string_vector::append (const std::string& s)
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   resize (len + 1);
 
@@ -151,8 +151,8 @@
 string_vector&
 string_vector::append (const string_vector& sv)
 {
-  octave_idx_type len = length ();
-  octave_idx_type sv_len = sv.length ();
+  octave_idx_type len = numel ();
+  octave_idx_type sv_len = sv.numel ();
   octave_idx_type new_len = len + sv_len;
 
   resize (new_len);
@@ -168,7 +168,7 @@
 {
   std::string retval;
 
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   if (len > 0)
     {
@@ -186,7 +186,7 @@
 char **
 string_vector::c_str_vec (void) const
 {
-  octave_idx_type len = length ();
+  octave_idx_type len = numel ();
 
   char **retval = new char * [len + 1];
 
@@ -218,7 +218,7 @@
   // Compute the maximum name length.
 
   octave_idx_type max_name_length = 0;
-  octave_idx_type total_names = length ();
+  octave_idx_type total_names = numel ();
 
   if (total_names == 0)
     {
--- a/liboctave/util/str-vec.h	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/util/str-vec.h	Tue Jun 23 20:00:59 2015 -0700
@@ -70,11 +70,11 @@
 
   ~string_vector (void) { }
 
-  bool empty (void) const { return length () == 0; }
+  bool empty (void) const { return numel () == 0; }
 
   octave_idx_type max_length (void) const
   {
-    octave_idx_type n = length ();
+    octave_idx_type n = numel ();
     octave_idx_type longest = 0;
 
     for (octave_idx_type i = 0; i < n; i++)
--- a/liboctave/util/url-transfer.cc	Tue Jun 23 09:59:54 2015 -0700
+++ b/liboctave/util/url-transfer.cc	Tue Jun 23 20:00:59 2015 -0700
@@ -82,7 +82,7 @@
 
       string_vector sv = list ();
 
-      for (octave_idx_type i = 0; i < sv.length (); i++)
+      for (octave_idx_type i = 0; i < sv.numel (); i++)
         {
           time_t ftime;
           bool fisdir;
@@ -153,7 +153,7 @@
         {
           string_vector files = dirlist.read ();
 
-          for (octave_idx_type i = 0; i < files.length (); i++)
+          for (octave_idx_type i = 0; i < files.numel (); i++)
             {
               std::string file = files (i);
 
--- a/m4/acinclude.m4	Tue Jun 23 09:59:54 2015 -0700
+++ b/m4/acinclude.m4	Tue Jun 23 20:00:59 2015 -0700
@@ -291,7 +291,7 @@
     [AC_LANG_PUSH(C++)
     ac_octave_save_CPPFLAGS="$CPPFLAGS"
     CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
         #include <Qsci/qsciglobal.h>
         ]], [[
         #if QSCINTILLA_VERSION < 0x020600
@@ -417,7 +417,7 @@
     [AC_LANG_PUSH(C++)
     ac_octave_save_CPPFLAGS="$CPPFLAGS"
     CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
         #include <Qt/qglobal.h>
         ]], [[
         #if QT_VERSION < 0x040700
--- a/scripts/audio/@audioplayer/set.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/audio/@audioplayer/set.m	Tue Jun 23 20:00:59 2015 -0700
@@ -50,7 +50,7 @@
       index = 1;
       for property = varargin{2}
         setproperty (player, char (property), varargin{3}{index});
-        index = index + 1;
+        index += 1;
       endfor
     else
       setproperty (player, varargin{2}, varargin{3});
--- a/scripts/audio/@audiorecorder/set.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/audio/@audiorecorder/set.m	Tue Jun 23 20:00:59 2015 -0700
@@ -50,7 +50,7 @@
       index = 1;
       for property = varargin{2}
         setproperty (recorder, char (property), varargin{3}{index});
-        index = index + 1;
+        index += 1;
       endfor
     else
       setproperty (recorder, varargin{2}, varargin{3});
--- a/scripts/audio/mu2lin.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/audio/mu2lin.m	Tue Jun 23 20:00:59 2015 -0700
@@ -69,7 +69,7 @@
   ## Convert to real or 8-bit.
   if (n == 0)
     ## [ -32768, 32767 ] -> [ -1, 1)
-    y = y/32768;
+    y /= 32768;
   elseif (n == 8)
     ld = max (abs (y (:)));
     if (ld < 16384 && ld > 0)
--- a/scripts/deprecated/default_save_options.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-## Copyright (C) 2013-2015 Rik Wehbring
-##
-## 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  {Built-in Function} {@var{val} =} default_save_options ()
-## @deftypefnx {Built-in Function} {@var{old_val} =} default_save_options (@var{new_val})
-## @deftypefnx {Built-in Function} {} default_save_options (@var{new_val}, "local")
-## This function has been deprecated.  Use @code{@file{save_default_options}}
-## instead.
-## @seealso{save_default_options}
-## @end deftypefn
-
-## Deprecated in 3.8
-
-function retval = default_save_options (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "default_save_options is obsolete and will be removed from a future version of Octave, please use save_default_options instead");
-  endif
-
-  retval = save_default_options (varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/gen_doc_cache.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-## Copyright (C) 2013-2015 Rik Wehbring
-##
-## 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 {Function File} {} gen_doc_cache (@var{out_file}, @var{directory})
-## This function has been deprecated.  Use @code{doc_cache_create} instead.
-## @seealso{doc_cache_create}
-## @end deftypefn
-
-## Deprecated in 3.8
-
-function gen_doc_cache (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "gen_doc_cache is obsolete and will be removed from a future version of Octave, please use doc_cache_create instead");
-  endif
-
-  doc_cache_create (varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/interp1q.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-## Copyright (C) 2008-2015 David Bateman
-##
-## 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 {Function File} {@var{yi} =} interp1q (@var{x}, @var{y}, @var{xi})
-## One-dimensional linear interpolation without error checking.
-## Interpolates @var{y}, defined at the points @var{x}, at the points
-## @var{xi}.  The sample points @var{x} must be a strictly monotonically
-## increasing column vector.  If @var{y} is a matrix or an N-dimensional
-## array, the interpolation is performed on each column of @var{y}.  If
-## @var{y} is a vector, it must be a column vector of the same length as
-## @var{x}.
-##
-## Values of @var{xi} beyond the endpoints of the interpolation result
-## in NA being returned.
-##
-## Note that the error checking is only a significant portion of the
-## execution time of this @code{interp1} if the size of the input arguments
-## is relatively small.  Therefore, the benefit of using @code{interp1q}
-## is relatively small.
-## @seealso{interp1}
-## @end deftypefn
-
-function yi = interp1q (x, y, xi)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "interp1q is obsolete and will be removed from a future version of Octave; use interp1 instead");
-  endif
-
-  x = x(:);
-  nx = rows (x);
-  szy = size (y);
-  y = y(:,:);
-  [ny, nc] = size (y);
-  szx = size (xi);
-  xi = xi (:);
-  dy = diff (y);
-  dx = diff (x);
-  idx = lookup (x, xi, "lr");
-  s = (xi - x(idx)) ./ dx(idx);
-  yi = bsxfun (@times, s, dy(idx,:)) + y(idx,:);
-  range = xi < x(1) | !(xi <= x(nx));
-  yi(range,:) = NA;
-  if (length (szx) == 2 && any (szx == 1))
-    yi = reshape (yi, [max(szx), szy(2:end)]);
-  else
-    yi = reshape (yi, [szx, szy(2:end)]);
-  endif
-endfunction
-
-
-%!shared xp, yp, xi, yi
-%! xp = [0:2:10].';   yp = sin (2*pi*xp/5);
-%! xi = [-1; 0; 2.2; 4; 6.6; 10; 11];
-%! yi = interp1 (xp,yp,xi);
-%!assert (interp1q (xp,yp, [min(xp)-1; max(xp)+1]), [NA; NA]);
-%!assert (interp1q (xp,yp,xp), yp, 100*eps);
-%!assert (isempty (interp1q (xp,yp,[])));
-%!assert (interp1q (xp,yp,xi), yi);
-%!assert (interp1q (xp,[yp,yp],xi), [yi, yi]);
-%!assert (interp1q (xp,yp,[xi,xi]), [yi, yi]);
-%!assert (interp1q (xp,[yp,yp],[xi,xi]), cat (3, [yi, yi], [yi, yi]));
-
--- a/scripts/deprecated/isequalwithequalnans.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-## Copyright (C) 2005-2015 William Poetra Yoga Hadisoeseno
-##
-## 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 {Function File} {} isequalwithequalnans (@var{x1}, @var{x2}, @dots{})
-## This function has been deprecated.  Use @code{@file{isequaln}} instead.
-## @seealso{isequaln}
-## @end deftypefn
-
-## Deprecated in 3.8
-
-function retval = isequalwithequalnans (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "isequalwithequalnans is obsolete and will be removed from a future version of Octave, please use isequaln instead");
-  endif
-
-  retval = isequaln (varargin{:});
-
-endfunction
-
-
-## test for equality
-%!assert (isequalwithequalnans ({1,2,NaN,4},{1,2,NaN,4}), true)
-%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,NaN,4]), true)
-## test for inequality
-%!assert (isequalwithequalnans ([1,2,NaN,4],[1,NaN,3,4]), false)
-%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,3,4]), false)
-## test for equality (struct)
-%!assert (isequalwithequalnans (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), true)
-%!assert (isequalwithequalnans (1,2,1), false)
-
--- a/scripts/deprecated/java_convert_matrix.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-## Copyright (C) 2012-2015 Rik Wehbring
-##
-## 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  {Built-in Function} {@var{val} =} java_convert_matrix ()
-## @deftypefnx {Built-in Function} {@var{old_val} =} java_convert_matrix (@var{new_val})
-## @deftypefnx {Built-in Function} {} java_convert_matrix (@var{new_val}, "local")
-## Query or set the internal variable that controls whether Java arrays are
-## automatically converted to Octave matrices.  The default value is false.
-##
-## When called from inside a function with the @qcode{"local"} option, the
-## variable is changed locally for the function and any subroutines it calls.
-##  The original variable value is restored when exiting the function.
-## @seealso{java_matrix_autoconversion, java_unsigned_conversion, java_debug}
-## @end deftypefn
-
-function old_val = java_convert_matrix (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "java_convert_matrix is obsolete and will be removed from a future version of Octave; use java_matrix_autoconversion instead");
-  endif
-
-  if (nargin > 2)
-    print_usage ();
-  endif
-
-  old_val = java_matrix_autoconversion (varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/java_debug.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-## Copyright (C) 2012-2015 Rik Wehbring
-##
-## 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  {Built-in Function} {@var{val} =} java_debug ()
-## @deftypefnx {Built-in Function} {@var{old_val} =} java_debug (@var{new_val})
-## @deftypefnx {Built-in Function} {} java_debug (@var{new_val}, "local")
-## Query or set the internal variable that determines whether extra debugging
-## information regarding the initialization of the JVM and any Java exceptions
-## is printed.
-##
-## When called from inside a function with the @qcode{"local"} option, the
-## variable is changed locally for the function and any subroutines it calls.
-##  The original variable value is restored when exiting the function.
-## @seealso{debug_java, java_convert_matrix, java_unsigned_conversion}
-## @end deftypefn
-
-function old_val = java_debug (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "java_debug is obsolete and will be removed from a future version of Octave; use debug_java instead");
-  endif
-
-  if (nargin > 2)
-    print_usage ();
-  endif
-
-  old_val = debug_java (varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/java_invoke.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-## Copyright (C) 2007, 2013 Michael Goffioul
-##
-## 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  {Built-in Function} {@var{ret} =} java_invoke (@var{obj}, @var{methodname})
-## @deftypefnx {Built-in Function} {@var{ret} =} java_invoke (@var{obj}, @var{methodname}, @var{arg1}, @dots{})
-## Invoke the method @var{methodname} on the Java object @var{obj} with the
-## arguments @var{arg1}, @dots{}  For static methods, @var{obj} can be a
-## string representing the fully qualified name of the corresponding class.
-## The function returns the result of the method invocation.
-##
-## When @var{obj} is a regular Java object, structure-like indexing can be
-## used as a shortcut syntax.  For instance, the two following statements are
-## equivalent
-##
-## @example
-## @group
-##   ret = java_invoke (x, "method1", 1.0, "a string")
-##   ret = x.method1 (1.0, "a string")
-## @end group
-## @end example
-##
-## @seealso{javaMethod, javaObject}
-## @end deftypefn
-
-function retval = java_invoke (obj, methodname, varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "java_invoke is obsolete and will be removed from a future version of Octave, please use javaMethod instead");
-  endif
-
-  if (nargin < 2)
-    print_usage ();
-  endif
-
-  retval = javaMethod (methodname, obj, varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/java_new.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-## Copyright (C) 2012-2015 Rik Wehbring
-##
-## 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{obj} =} java_new (@var{name})
-## @deftypefnx {Loadable Function} {@var{obj} =} java_new (@var{name}, @var{arg1}, @dots{})
-## Create a Java object of class @var{name}, by calling the class constructor
-## with the arguments @var{arg1}, @dots{}
-##
-## @example
-## @group
-##   x = java_new ("java.lang.StringBuffer")
-##   x = java_new ("java.lang.StringBuffer", "Initial string")
-## @end group
-## @end example
-##
-## @seealso{javaObject, javaMethod}
-## @end deftypefn
-
-function retval = java_new (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "java_new is obsolete and will be removed from a future version of Octave; please use javaObject instead");
-  endif
-
-  if (nargin < 1)
-    print_usage ();
-  endif
-
-  retval = javaObject (varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/java_unsigned_conversion.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-## Copyright (C) 2012-2015 Rik Wehbring
-##
-## 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  {Built-in Function} {@var{val} =} java_unsigned_conversion ()
-## @deftypefnx {Built-in Function} {@var{old_val} =} java_unsigned_conversion (@var{new_val})
-## @deftypefnx {Built-in Function} {} java_unsigned_conversion (@var{new_val}, "local")
-## Query or set the internal variable that controls how integer classes are
-## converted when Java matrix autoconversion is enabled.  When enabled, Java
-## arrays of class Byte or Integer are converted to matrices of class uint8 or
-## uint32 respectively.
-##
-## When called from inside a function with the @qcode{"local"} option, the
-## variable is changed locally for the function and any subroutines it calls.
-##  The original variable value is restored when exiting the function.
-## @seealso{java_unsigned_autoconversion, java_convert_matrix, debug_java}
-## @end deftypefn
-
-function old_val = java_unsigned_conversion (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "java_unsigned_conversion is obsolete and will be removed from a future version of Octave; use java_unsigned_autoconversion instead");
-  endif
-
-  if (nargin > 2)
-    print_usage ();
-  endif
-
-  old_val = java_unsigned_autoconversion (varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/javafields.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-## Copyright (C) 2007, 2013 Michael Goffioul
-##
-## 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  {Function File} {} javafields (@var{javaobj})
-## @deftypefnx {Function File} {} javafields ("@var{classname}")
-## @deftypefnx {Function File} {@var{fld_names} =} javafields (@dots{})
-## Return the fields of a Java object or Java class in the form of a cell
-## array of strings.  If no output is requested, print the result
-## to the standard output.
-## @seealso{fieldnames, methods, javaObject}
-## @end deftypefn
-
-function fld_names = javafields (javaobj)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "javafields is obsolete and will be removed from a future version of Octave, please use fieldnames instead");
-  endif
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  c_methods = javaMethod ("getFields", "org.octave.ClassHelper", javaobj);
-  method_list = ostrsplit (c_methods, ';');
-
-  if (nargout == 0)
-    if (! isempty (method_list))
-      disp (method_list);
-    endif
-  else
-    fld_names = cellstr (method_list);
-  endif
-
-endfunction
-
--- a/scripts/deprecated/javamethods.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-## Copyright (C) 2007, 2013 Michael Goffioul
-##
-## 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  {Function File} {} javamethods (@var{javaobj})
-## @deftypefnx {Function File} {} javamethods ("@var{classname}")
-## @deftypefnx {Function File} {@var{mtd_names} =} javamethods (@dots{})
-## Return the methods of a Java object or Java class in the form of a cell
-## array of strings.  If no output is requested, print the result to the
-## standard output.
-## @seealso{methods, fieldnames, javaMethod, javaObject}
-## @end deftypefn
-
-function mtd_names = javamethods (classname)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "javamethods is obsolete and will be removed from a future version of Octave, please use methods instead");
-  endif
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  cls_methods = javaMethod ("getMethods", "org.octave.ClassHelper", classname);
-  method_list = ostrsplit (cls_methods, ';');
-
-  if (nargout == 0)
-    if (! isempty (method_list))
-      disp (method_list);
-    endif
-  else
-    mtd_names = cellstr (method_list);
-  endif
-
-endfunction
-
--- a/scripts/deprecated/module.mk	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/deprecated/module.mk	Tue Jun 23 20:00:59 2015 -0700
@@ -2,35 +2,21 @@
 
 deprecated_FCN_FILES = \
   deprecated/bicubic.m \
-  deprecated/default_save_options.m \
   deprecated/delaunay3.m \
   deprecated/dump_prefs.m \
   deprecated/find_dir_in_path.m \
   deprecated/finite.m \
   deprecated/fmod.m \
   deprecated/fnmatch.m \
-  deprecated/gen_doc_cache.m \
   deprecated/gmap40.m \
-  deprecated/interp1q.m \
-  deprecated/isequalwithequalnans.m \
   deprecated/isstr.m \
-  deprecated/java_convert_matrix.m \
-  deprecated/java_debug.m \
-  deprecated/java_invoke.m \
-  deprecated/java_new.m \
-  deprecated/java_unsigned_conversion.m \
-  deprecated/javafields.m \
-  deprecated/javamethods.m \
   deprecated/loadaudio.m \
   deprecated/luinc.m \
   deprecated/mouse_wheel_zoom.m \
   deprecated/nfields.m \
   deprecated/octave_tmp_file_name.m \
   deprecated/playaudio.m \
-  deprecated/re_read_readline_init_file.m \
-  deprecated/read_readline_init_file.m \
   deprecated/saveaudio.m \
-  deprecated/saving_history.m \
   deprecated/setaudio.m \
   deprecated/syl.m \
   deprecated/usage.m
--- a/scripts/deprecated/re_read_readline_init_file.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-## Copyright (C) 2013-2015 Rik Wehbring
-##
-## 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 {Built-in Function} {} re_read_readline_init_file (@var{file})
-## This function has been deprecated.  Use
-## @code{@file{readline_re_read_init_file}} instead.
-## @seealso{readline_read_init_file}
-## @end deftypefn
-
-## Deprecated in 3.8
-
-function re_read_readline_init_file (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "re_read_readline_init_file is obsolete and will be removed from a future version of Octave, please use readline_re_read_init_file instead");
-  endif
-
-  readline_re_read_init_file (varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/read_readline_init_file.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-## Copyright (C) 2013-2015 Rik Wehbring
-##
-## 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 {Built-in Function} {} read_readline_init_file (@var{file})
-## This function has been deprecated.  Use
-## @code{@file{readline_read_init_file}} instead.
-## @seealso{readline_read_init_file}
-## @end deftypefn
-
-## Deprecated in 3.8
-
-function read_readline_init_file (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "read_readline_init_file is obsolete and will be removed from a future version of Octave, please use readline_read_init_file instead");
-  endif
-
-  readline_read_init_file (varargin{:});
-
-endfunction
-
--- a/scripts/deprecated/saving_history.m	Tue Jun 23 09:59:54 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-## Copyright (C) 2013-2015 Rik Wehbring
-##
-## 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  {Built-in Function} {@var{val} =} saving_history ()
-## @deftypefnx {Built-in Function} {@var{old_val} =} saving_history (@var{new_val})
-## @deftypefnx {Built-in Function} {} saving_history (@var{new_val}, "local")
-## This function has been deprecated.  Use @code{@file{history_save}} instead.
-## @seealso{history_save}
-## @end deftypefn
-
-## Deprecated in 3.8
-
-function retval = saving_history (varargin)
-
-  persistent warned = false;
-  if (! warned)
-    warned = true;
-    warning ("Octave:deprecated-function",
-             "saving_history is obsolete and will be removed from a future version of Octave, please use history_save instead");
-  endif
-
-  retval = save_default_options (varargin{:});
-
-endfunction
-
--- a/scripts/elfun/cosd.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/elfun/cosd.m	Tue Jun 23 20:00:59 2015 -0700
@@ -34,7 +34,7 @@
 
   I = x / 180;
   y = cos (I .* pi);
-  I = I + 0.5;
+  I += 0.5;
   y(I == fix (I) & isfinite (I)) = 0;
 
 endfunction
--- a/scripts/general/del2.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/general/del2.m	Tue Jun 23 20:00:59 2015 -0700
@@ -156,7 +156,7 @@
     endif
   endfor
 
-  D = D ./ nd;
+  D ./= nd;
 endfunction
 
 
--- a/scripts/general/num2str.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/general/num2str.m	Tue Jun 23 20:00:59 2015 -0700
@@ -115,10 +115,15 @@
         fmt = "%3d";
       endif
     endif
-    fmt = [deblank(repmat(fmt, 1, columns(x))), "\n"];
+    fmt = do_string_escapes (fmt);  # required now that '\n' is interpreted.
     nd = ndims (x);
-    tmp = sprintf (fmt, permute (x, [2, 1, 3:nd]));
-    retval = strtrim (char (ostrsplit (tmp(1:end-1), "\n")));
+    nc = columns (x);
+    x  = permute (x, [2, 1, 3:nd]);
+    if (! (sum (fmt == "%") > 1 || any (strcmp (fmt, {"%s", "%c"}))))
+      fmt = [deblank(repmat (fmt, 1, nc)), "\n"];
+    endif
+    tmp    = sprintf (fmt, x);
+    retval = strtrim (char (ostrsplit (tmp, "\n", true)));
   else   # Complex matrix input
     if (nargin == 2)
       if (ischar (arg))
@@ -204,6 +209,12 @@
 %!xtest
 %! assert (num2str (1e23), "100000000000000000000000");
 
+## Test for bug #44864, extra rows generated from newlines in format
+%!assert (rows (num2str (magic (3), '%3d %3d %3d\n')), 3)
+
+## Test for bug #45174
+%!assert (num2str ([65 66 67], '%s'), "ABC")
+
 %!error num2str ()
 %!error num2str (1, 2, 3)
 %!error <X must be a numeric> num2str ({1})
--- a/scripts/general/profexplore.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/general/profexplore.m	Tue Jun 23 20:00:59 2015 -0700
@@ -105,7 +105,7 @@
         if (rv == 0)
           return;
         elseif (rv > 1)
-          rv = rv - 1;
+          rv -= 1;
           return;
         else
           assert (rv == 1);
--- a/scripts/general/quadl.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/general/quadl.m	Tue Jun 23 20:00:59 2015 -0700
@@ -133,7 +133,7 @@
     R = 1;
   endif
   if (R > 0 && R < 1)
-    tol = tol/R;
+    tol /= R;
   endif
   is = s * abs (is) * tol/myeps;
   if (is == 0)
--- a/scripts/general/rat.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/general/rat.m	Tue Jun 23 20:00:59 2015 -0700
@@ -102,7 +102,7 @@
 
   if (nargout == 2)
     ## Move the minus sign to the top.
-    n = n .* sign (d);
+    n .*= sign (d);
     d = abs (d);
 
     ## Return the same shape as you receive.
--- a/scripts/general/rotdim.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/general/rotdim.m	Tue Jun 23 20:00:59 2015 -0700
@@ -78,7 +78,7 @@
       plane = [];
       dim = 0;
       while (dim < nd)
-        dim = dim + 1;
+        dim += 1;
         if (sz (dim) != 1)
           plane = [plane, dim];
           if (length (plane) == 2)
@@ -104,7 +104,7 @@
 
   n = rem (n, 4);
   if (n < 0)
-    n = n + 4;
+    n += 4;
   endif
   if (n == 0)
     y = x;
--- a/scripts/geometry/griddata.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/geometry/griddata.m	Tue Jun 23 20:00:59 2015 -0700
@@ -133,14 +133,12 @@
     error ("griddata: unknown interpolation METHOD");
   endif
 
-  if (nargout == 3)
+  if (nargout > 1)
     rx = xi;
     ry = yi;
     rz = zi;
-  elseif (nargout == 1)
+  else
     rx = zi;
-  elseif (nargout == 0)
-    mesh (xi, yi, zi);
   endif
 
 endfunction
@@ -153,7 +151,8 @@
 %! y = 2*rand (size (x)) - 1;
 %! z = sin (2*(x.^2 + y.^2));
 %! [xx,yy] = meshgrid (linspace (-1,1,32));
-%! griddata (x,y,z,xx,yy);
+%! zz = griddata (x,y,z,xx,yy);
+%! mesh (xx, yy, zz);
 %! title ("nonuniform grid sampled at 100 points");
 
 %!demo
@@ -163,7 +162,8 @@
 %! y = 2*rand (size (x)) - 1;
 %! z = sin (2*(x.^2 + y.^2));
 %! [xx,yy] = meshgrid (linspace (-1,1,32));
-%! griddata (x,y,z,xx,yy);
+%! zz = griddata (x,y,z,xx,yy);
+%! mesh (xx, yy, zz);
 %! title ("nonuniform grid sampled at 1000 points");
 
 %!demo
@@ -173,7 +173,8 @@
 %! y = 2*rand (size (x)) - 1;
 %! z = sin (2*(x.^2 + y.^2));
 %! [xx,yy] = meshgrid (linspace (-1,1,32));
-%! griddata (x,y,z,xx,yy,"nearest");
+%! zz = griddata (x,y,z,xx,yy,"nearest");
+%! mesh (xx, yy, zz);
 %! title ("nonuniform grid sampled at 1000 points with nearest neighbor");
 
 %!testif HAVE_QHULL
--- a/scripts/gui/private/__fltk_file_filter__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/gui/private/__fltk_file_filter__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -37,7 +37,7 @@
     curr_ext = ostrsplit (curr_ext, ";");
 
     if (length (curr_ext) > 1)
-      curr_ext = regexprep (curr_ext, '\*\.', ',');
+      curr_ext = strrep (curr_ext, '*.', ',');
       curr_ext = strcat (curr_ext{:})(2 : end);
       curr_ext = strcat ("*.{", curr_ext, "}");
     else
@@ -48,8 +48,8 @@
 
     if (c == 2)
       curr_desc = file_filter{idx, 2};
-      curr_desc = regexprep (curr_desc, '\(', '<');
-      curr_desc = regexprep (curr_desc, '\)', '>');
+      curr_desc = strrep (curr_desc, '(', '<');
+      curr_desc = strrep (curr_desc, ')', '>');
     endif
 
     if (length (fltk_str) > 0)
--- a/scripts/gui/waitbar.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/gui/waitbar.m	Tue Jun 23 20:00:59 2015 -0700
@@ -19,7 +19,8 @@
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {@var{h} =} waitbar (@var{frac})
 ## @deftypefnx {Function File} {@var{h} =} waitbar (@var{frac}, @var{msg})
-## @deftypefnx {Function File} {@var{h} =} waitbar (@dots{}, "FigureProperty", "Value", @dots{})
+## @deftypefnx {Function File} {@var{h} =} waitbar (@dots{}, "createcancelbtn", @var{fcn}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} waitbar (@dots{}, @var{prop}, @var{val}, @dots{})
 ## @deftypefnx {Function File} {} waitbar (@var{frac})
 ## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar})
 ## @deftypefnx {Function File} {} waitbar (@var{frac}, @var{hwbar}, @var{msg})
@@ -30,8 +31,13 @@
 ##
 ## The optional message @var{msg} is centered and displayed above the waitbar.
 ##
+## A cancel button can be added to the bottom of the waitbar using the
+## "createcancelbtn" property of waitbar figures. The action to be
+## executed when the user presses the button is specified using a string or
+## function handle @var{fcn}.
+## 
 ## The appearance of the waitbar figure window can be configured by passing
-## property/value pairs to the function.
+## @var{prop}/@var{val} pairs to the function.
 ##
 ## When called with a single input the current waitbar, if it exists, is
 ## updated to the new value @var{frac}.  If there are multiple outstanding
@@ -115,14 +121,21 @@
                  "menubar", "none", "toolbar", "none",
                  "integerhandle", "off",
                  "handlevisibility", "callback",
-                 "tag", "waitbar",
-                 varargin{:});
-
+                 "tag", "waitbar");
+    
     ax = axes ("parent", hf,
                "xtick", [], "ytick", [],
                "xlim", [0, 1], "ylim", [0, 1],
                "position", [0.1, 0.3, 0.8, 0.2]);
 
+    ## Add createcancelbtn property
+    addproperty ("createcancelbtn", hf, "figurebuttondownfcn");
+    addlistener (hf, "createcancelbtn", {@updatecancelbutton, ax});
+
+    if (! isempty (varargin))
+      set (hf, varargin{:});
+    endif
+    
     hp = patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]);
 
     ## Cache the axes and patch handles.
@@ -147,6 +160,47 @@
 
 endfunction
 
+function updatecancelbutton (hf, dummy, hax)
+  if (! strcmpi (get (hf, "__graphics_toolkit__"), "qt"))
+    return
+  endif
+
+  hbtn = findobj (hf, "type", "uicontrol", "-and", "style", "pushbutton");
+  cb = get (hf, "createcancelbtn");
+  if (! isempty (cb))
+    if (isempty (hbtn))
+      units =  get (hax, "units");
+      fpos = get (hf, "position");
+      set (hax, "units", "pixels");
+      apos = get (hax, "position");
+      
+      fpos (2) -= 40;
+      fpos (4) += 40;
+      apos (2) += 40;
+      set (hf, "position", fpos);
+      set (hax, "position", apos, "units", units);
+      
+      hbtn = uicontrol ("style", "pushbutton", "string", "Cancel", ...
+                        "position", [fpos(3)-100 10 60 25],...
+                        "callback", cb, "parent", hf);
+    else
+      set (hbtn, "callback", cb)
+    endif
+  elseif (! isempty (hbtn))
+    delete (hbtn);
+    units =  get (hax, "units");
+    fpos = get (hf, "position");
+    set (hax, "units", "pixels");
+    apos = get (hax, "position");
+    
+    fpos (2) += 40;
+    fpos (4) -= 40;
+    apos (2) -= 40;
+    set (hf, "position", fpos);
+    set (hax, "position", apos, "units", units);
+  endif
+endfunction
+
 
 %!demo
 %! h = waitbar (0, '0.00%');
@@ -192,6 +246,51 @@
 %! pause (0.5);
 %! close (h1);
 %! close (h2);
+ 
+%!demo
+%! clf ();
+%! niter = 9;
+%! l = 1;
+%! xx = [0 l];
+%! yy = [0 0];
+%! hli = plot (xx, yy);
+%! 
+%! disp ("Push the cancel to stop the process.")
+%! hf = waitbar(0,"0","Name","Building Koch curve ...",...
+%!              "createcancelbtn", "setappdata (gcbf,'interrupt', true)");
+%! for ii = 1:niter
+%!   ## Check cancel request
+%!   if (! ishandle (hf))
+%!     break
+%!   elseif (getappdata (hf, "interrupt"))
+%!     delete (hf)
+%!     break
+%!   else
+%!     waitbar (ii/niter, hf, sprintf ("Step %d/%d", ii, niter));
+%!   endif
+%! 
+%!   ## Increasingly lengthy computation
+%!   l /= 3;
+%!   theta = angle (complex (diff (xx), diff (yy)));
+%!   
+%!   xy = @(th, x0, y0) [cos(th) -sin(th) x0
+%!                       sin(th) cos(th) y0] * [0 l l*3/2      2*l; 
+%!                                              0 0 l*(3)^.5/2 0;
+%!                                              1 1 1          1];
+%!   tmp = arrayfun (xy, theta, xx(1:end-1), yy(1:end-1),
+%!                  "uniformoutput", false);
+%! 
+%!   tmp = cell2mat (tmp);
+%!   xx = [tmp(1,:) xx(end)];
+%!   yy = [tmp(2,:) yy(end)];
+%!   set (hli, "xdata", xx, "ydata", yy)
+%!   drawnow ();
+%!   pause (0.5)
+%! endfor
+%! 
+%! if (ishandle (hf))
+%!   delete (hf)
+%! endif
 
 ## Test input validation
 %!error <FRAC must be between 0 and 1> waitbar (-0.5)
--- a/scripts/help/get_first_help_sentence.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/help/get_first_help_sentence.m	Tue Jun 23 20:00:59 2015 -0700
@@ -117,9 +117,9 @@
     ## Remove the @end ... that corresponds to the @def we removed above
     def1 = def_idx(1);
     space_idx = find (help_text == " ");
-    space_idx = space_idx (find (space_idx > def1, 1));
+    space_idx = space_idx(find (space_idx > def1, 1));
     bracket_idx = find (help_text == "{" | help_text == "}");
-    bracket_idx = bracket_idx (find (bracket_idx > def1, 1));
+    bracket_idx = bracket_idx(find (bracket_idx > def1, 1));
     if (isempty (space_idx) && isempty (bracket_idx))
       error ("get_first_help_sentence: couldn't parse texinfo");
     endif
--- a/scripts/help/private/__strip_html_tags__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/help/private/__strip_html_tags__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -77,6 +77,6 @@
   endfor
 
   ## Actually remove the elements
-  text = text (keep);
+  text = text(keep);
 endfunction
 
--- a/scripts/help/type.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/help/type.m	Tue Jun 23 20:00:59 2015 -0700
@@ -97,6 +97,19 @@
       txt = sprintf ("%s is a dynamically-linked function", name);
     elseif (e == 5)
       txt = sprintf ("%s is a built-in function", name);
+    elseif (e == 103)
+      contents = __get_cmdline_fcn_txt__ (name);
+      if (isempty (contents))
+        txt = sprintf ("%s is a command-line function with no definition",
+                       name);
+      else
+        if (quiet)
+          txt = contents;
+        else
+          txt = sprintf ("%s is the command-line function:\n\n%s",
+                         name, contents);
+        endif
+      endif
     elseif (any (strcmp (__operators__ (), name)))
       txt = sprintf ("%s is an operator", name);
     elseif (any (strcmp (__keywords__ (), name)))
--- a/scripts/image/cubehelix.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/image/cubehelix.m	Tue Jun 23 20:00:59 2015 -0700
@@ -62,7 +62,7 @@
 
     fract = ((0:n-1) / (n-1))';
     angle = 2 * pi * (start/3 + 1 + rots*fract);
-    fract = fract .^ gamma;
+    fract .^= gamma;
     amp   = hue * fract .* (1-fract) /2;
     map   = fract + amp .* ([cos(angle) sin(angle)] * coeff);
 
--- a/scripts/image/imformats.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/image/imformats.m	Tue Jun 23 20:00:59 2015 -0700
@@ -79,7 +79,7 @@
   persistent formats = default_formats ();
 
   if (nargin == 0 && nargout == 0)
-    error ("imformats: pretty print not yet implemented.");
+    pretty_print_formats (formats);
   elseif (nargin >= 1)
     if (isstruct (arg1))
       arrayfun (@is_valid_format, arg1);
@@ -281,6 +281,40 @@
   end_try_catch
 endfunction
 
+function pretty_print_formats (formats)
+  ## define header names (none should be shorter than 3 characters)
+  headers = {"Extension", "isa", "Info", "Read", "Write", "Alpha", "Description"};
+  cols_length = cellfun (@numel, headers);
+
+  ## Adjust the maximal length of the extensions column
+  extensions = cellfun (@strjoin, {formats.ext}, {", "},
+                        "UniformOutput", false);
+  cols_length(1) = max (max (cellfun (@numel, extensions)), cols_length(1));
+  headers{1} = postpad (headers{1}, cols_length(1), " ");
+
+  ## Print the headers
+  disp (strjoin (headers, " | "));
+  under_headers = cellfun (@(x) repmat ("-", 1, numel (x)), headers,
+                           "UniformOutput", false);
+  disp (strjoin (under_headers, "-+-"));
+
+  template = strjoin (arrayfun (@(x) sprintf ("%%-%is", x), cols_length,
+                                "UniformOutput", false), " | ");
+
+  ## Print the function handle for this things won't be a pretty table.  So
+  ## instead we replace them with "yes" or "no", based on the support it has.
+  yes_no_cols = cat (2, {formats.isa}(:), {formats.info}(:), {formats.read}(:),
+                     {formats.write}(:), {formats.alpha}(:));
+  empty = cellfun (@isempty, yes_no_cols);
+  yes_no_cols(empty) = "no";
+  yes_no_cols(! empty) = "yes";
+
+  descriptions = {formats.description};
+  table = cat (2, extensions(:), yes_no_cols, descriptions(:));
+  printf ([template "\n"], table'{:});
+
+endfunction
+
 ## When imread or imfinfo are called, the file must exist or the
 ## function defined by imformats will never be called.  Because
 ## of this, we must create a file for the tests to work.
--- a/scripts/io/strread.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/io/strread.m	Tue Jun 23 20:00:59 2015 -0700
@@ -352,7 +352,7 @@
   ## Remove comments in str
   if (comment_flag)
     ## Expand 'eol_char' here, after option processing which may have set value
-    comment_end = regexprep (comment_end, "eol_char", eol_char);
+    comment_end = strrep (comment_end, "eol_char", eol_char);
     cstart = strfind (str, comment_start);
     cstop  = strfind (str, comment_end);
     ## Treat end of string as additional comment stop
--- a/scripts/io/textread.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/io/textread.m	Tue Jun 23 20:00:59 2015 -0700
@@ -144,7 +144,6 @@
     if (varargin{headerlines + 1} > 0)
       fskipl (fid, varargin{headerlines + 1});
       varargin(headerlines:headerlines+1) = [];
-      nargin = nargin - 2;
     elseif (varargin{headerlines + 1} < 0)
       warning ("textread: negative headerline value ignored");
     endif
--- a/scripts/linear-algebra/duplication_matrix.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/linear-algebra/duplication_matrix.m	Tue Jun 23 20:00:59 2015 -0700
@@ -82,7 +82,7 @@
       d((j - 1) * n + i, count + i) = 1;
       d((i - 1) * n + j, count + i) = 1;
     endfor
-    count = count + n - j;
+    count += n - j;
   endfor
 
 endfunction
--- a/scripts/linear-algebra/housh.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/linear-algebra/housh.m	Tue Jun 23 20:00:59 2015 -0700
@@ -72,7 +72,7 @@
     housv = x;
     m = max (abs (housv));
     if (m != 0.0)
-      housv = housv / m;
+      housv /= m;
       alpha = norm (housv);
       if (alpha > z)
         beta = 1.0 / (alpha * (alpha + abs (housv(j))));
--- a/scripts/linear-algebra/krylov.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/linear-algebra/krylov.m	Tue Jun 23 20:00:59 2015 -0700
@@ -209,7 +209,7 @@
     for i = 1:nu
       hv = U(:,i);
       av = alpha(i);
-      V = V - av*hv*(hv'*V);
+      V -= av*hv*(hv'*V);
       H(i,nu-columns(V)+(1:columns(V))) = V(pivot_vec(i),:);
     endfor
 
--- a/scripts/linear-algebra/logm.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/linear-algebra/logm.m	Tue Jun 23 20:00:59 2015 -0700
@@ -86,7 +86,7 @@
   while (k < opt_iters)
     tau = norm (s - eye (size (s)),1);
     if (tau <= theta (7))
-      p = p + 1;
+      p += 1;
       j(1) = find (tau <= theta, 1);
       j(2) = find (tau / 2 <= theta, 1);
       if (j(1) - j(2) <= 1 || p == 2)
@@ -94,7 +94,7 @@
         break
       endif
     endif
-    k = k + 1;
+    k += 1;
     s = sqrtm (s);
   endwhile
 
@@ -102,7 +102,7 @@
     warning ("logm: maximum number of square roots exceeded; results may still be accurate");
   endif
 
-  s = s - eye (size (s));
+  s -= eye (size (s));
 
   if (m > 1)
     s = logm_pade_pf (s, m);
@@ -136,7 +136,7 @@
   [nodes, wts] = gauss_legendre (m);
   ## Convert from [-1,1] to [0,1].
   nodes = (nodes+1)/2;
-  wts = wts/2;
+  wts /= 2;
 
   n = length (A);
   s = zeros (n);
--- a/scripts/linear-algebra/normest.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/linear-algebra/normest.m	Tue Jun 23 20:00:59 2015 -0700
@@ -68,7 +68,7 @@
     if (normx == 0)
       x = rand (ncols, 1);
     else
-      x = x / normx;
+      x /= normx;
     endif
     y = A' * x;
     n = norm (y);
--- a/scripts/linear-algebra/onenormest.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/linear-algebra/onenormest.m	Tue Jun 23 20:00:59 2015 -0700
@@ -133,7 +133,7 @@
 
   ## Initial test vectors X.
   X = rand (n, t);
-  X = X ./ (ones (n,1) * sum (abs (X), 1));
+  X ./= ones (n,1) * sum (abs (X), 1);
 
   ## Track if a vertex has been visited.
   been_there = zeros (n, 1);
--- a/scripts/miscellaneous/fullfile.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/miscellaneous/fullfile.m	Tue Jun 23 20:00:59 2015 -0700
@@ -42,6 +42,8 @@
 ## replaced by backslashes; in addition drive letters are stripped of leading
 ## file separators to obtain a valid file path.
 ##
+## Note: @code{fullfile} does not perform any validation of the resulting full
+## filename.
 ## @seealso{fileparts, filesep}
 ## @end deftypefn
 
@@ -54,12 +56,14 @@
                                        "UniformOutput", false);
   else
     non_empty = cellfun ("isempty", varargin);
+    unc = 0;
     if (ispc && ! isempty (varargin))
-      varargin = strrep (varargin, "/", filesep);
+      varargin = strrep (varargin, '/', filesep);
+      unc = strncmp (varargin{1}, '\\', 2);
       varargin(1) = regexprep (varargin{1}, '[\\/]*([a-zA-Z]:[\\/]*)', "$1");
     endif
     filename = strjoin (varargin(! non_empty), filesep);
-    filename(strfind (filename, [filesep filesep])) = "";
+    filename(unc + strfind (filename(1+unc : end), [filesep filesep])) = "";
   endif
 
 endfunction
@@ -87,7 +91,6 @@
 %!assert (fullfile ("x", "", "y", ""), xfsy)
 %!assert (fullfile ("", "x", "", "y", ""), xfsy)
 %!assert (fullfile (fs), fs)
-%!assert (fullfile (fs, fs), fs)
 %!assert (fullfile (fs, "x"), fsx)
 %!assert (fullfile (fs, xfs), fsxfs)
 %!assert (fullfile (fsx, fs), fsxfs)
@@ -109,6 +112,12 @@
 %!           ['A:\' xfsyfs]);
 %! endif
 
+## *nix specific - double backslash
+%!test
+%! if (isunix || ismac)
+%!   assert (fullfile (fs, fs), fs)
+%! endif
+
 ## Windows specific - drive letters and file sep type, cell array
 %!test
 %! if (ispc)
--- a/scripts/optimization/fminsearch.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/optimization/fminsearch.m	Tue Jun 23 20:00:59 2015 -0700
@@ -265,14 +265,14 @@
     vr = (1 + alpha)*vbar - alpha*V(:,n+1);
     x(:) = vr;
     fr = dirn * feval (fun,x,varargin{:});
-    nf = nf + 1;
+    nf += 1;
     vk = vr;  fk = fr; how = "reflect, ";
     if (fr > f(n))
       if (fr > f(1))
         ve = gamma*vr + (1-gamma)*vbar;
         x(:) = ve;
         fe = dirn * feval (fun,x,varargin{:});
-        nf = nf + 1;
+        nf += 1;
         if (fe > f(1))
           vk = ve;
           fk = fe;
@@ -289,7 +289,7 @@
       vc = beta*vt + (1-beta)*vbar;
       x(:) = vc;
       fc = dirn * feval (fun,x,varargin{:});
-      nf = nf + 1;
+      nf += 1;
       if (fc > f(n))
         vk = vc; fk = fc;
         how = "contract,";
@@ -299,11 +299,11 @@
           x(:) = V(:,j);
           f(j) = dirn * feval (fun,x,varargin{:});
         endfor
-        nf = nf + n-1;
+        nf += n-1;
         vk = (V(:,1) + V(:,n+1))/2;
         x(:) = vk;
         fk = dirn * feval (fun,x,varargin{:});
-        nf = nf + 1;
+        nf += 1;
         how = "shrink,  ";
       endif
     endif
--- a/scripts/optimization/lsqnonneg.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/optimization/lsqnonneg.m	Tue Jun 23 20:00:59 2015 -0700
@@ -144,7 +144,7 @@
         x += alpha*(xx - x);
         ## LH11: move from P to Z all X == 0.
         ## This corresponds to those indices where minimum of sf is attained.
-        idx = idx (sf == alpha);
+        idx = idx(sf == alpha);
         p(idx) = [];
         if (useqr)
           ## update the QR factorization.
--- a/scripts/optimization/qp.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/optimization/qp.m	Tue Jun 23 20:00:59 2015 -0700
@@ -116,13 +116,12 @@
 
 function [x, obj, INFO, lambda] = qp (x0, H, varargin)
 
-  nargs = nargin;
-
-  if (nargin == 1 && ischar (x0) && strcmp (x0, 'defaults'))
+  if (nargin == 1 && ischar (x0) && strcmp (x0, "defaults"))
     x = optimset ("MaxIter", 200);
     return;
   endif
 
+  nargs = nargin;
   if (nargs > 2 && isstruct (varargin{end}))
     options = varargin{end};
     nargs--;
@@ -130,6 +129,10 @@
     options = struct ();
   endif
 
+  if (nargs != 2 && nargs != 3 && nargs != 5 && nargs != 7 && nargs != 10)
+    print_usage ();
+  endif
+
   if (nargs >= 3)
     q = varargin{1};
   else
@@ -162,250 +165,256 @@
     A_ub = [];
   endif
 
-  if (nargs == 2 || nargs == 3 || nargs == 5 || nargs == 7 || nargs == 10)
-
-    maxit = optimget (options, "MaxIter", 200);
+  maxit = optimget (options, "MaxIter", 200);
 
-    ## Checking the quadratic penalty
-    if (! issquare (H))
-      error ("qp: quadratic penalty matrix not square");
-    elseif (! ishermitian (H))
-      ## warning ("qp: quadratic penalty matrix not hermitian");
-      H = (H + H')/2;
-    endif
-    n = rows (H);
+  ## Validate the quadratic penalty.
+  if (! issquare (H))
+    error ("qp: quadratic penalty matrix must be square");
+  elseif (! ishermitian (H))
+    ## warning ("qp: quadratic penalty matrix not hermitian");
+    H = (H + H')/2;
+  endif
+  n = rows (H);
 
-    ## Checking the initial guess (if empty it is resized to the
-    ## right dimension and filled with 0)
-    if (isempty (x0))
-      x0 = zeros (n, 1);
+  ## Validate the initial guess.
+  ## If empty it is resized to the right dimension and filled with 0.
+  if (isempty (x0))
+    x0 = zeros (n, 1);
+  else
+    if (! isvector (x0))
+      error ("qp: the initial guess X0 must be a vector");
     elseif (numel (x0) != n)
-      error ("qp: the initial guess has incorrect length");
+      error ("qp: the initial guess X0 has incorrect length");
     endif
+    x0 = x0(:);  # always use column vector.
+  endif
 
-    ## Linear penalty.
-    if (isempty (q))
-      q = zeros (n, 1);
+  ## Validate linear penalty.
+  if (isempty (q))
+    q = zeros (n, 1);
+  else
+    if (! isvector (q))
+      error ("qp: Q must be a vector");
     elseif (numel (q) != n)
-      error ("qp: the linear term has incorrect length");
+      error ("qp: Q has incorrect length");
     endif
+    q = q(:);   # always use column vector.
+  endif
 
-    ## Equality constraint matrices
-    if (isempty (A) || isempty (b))
-      A = zeros (0, n);
-      b = zeros (0, 1);
-      n_eq = 0;
-    else
-      [n_eq, n1] = size (A);
-      if (n1 != n)
-        error ("qp: equality constraint matrix has incorrect column dimension");
-      endif
-      if (numel (b) != n_eq)
-        error ("qp: equality constraint matrix and vector have inconsistent dimension");
+  ## Validate equality constraint matrices.
+  if (isempty (A) || isempty (b))
+    A = zeros (0, n);
+    b = zeros (0, 1);
+    n_eq = 0;
+  else
+    [n_eq, n1] = size (A);
+    if (n1 != n)
+      error ("qp: equality constraint matrix has incorrect column dimension");
+    endif
+    if (numel (b) != n_eq)
+      error ("qp: equality constraint matrix and vector have inconsistent dimensions");
+    endif
+  endif
+
+  ## Validate bound constraints.
+  Ain = zeros (0, n);
+  bin = zeros (0, 1);
+  n_in = 0;
+  if (nargs > 5)
+    if (! isempty (lb))
+      if (numel (lb) != n)
+        error ("qp: lower bound LB has incorrect length");
+      elseif (isempty (ub))
+        Ain = [Ain; eye(n)];
+        bin = [bin; lb];
       endif
     endif
 
-    ## Bound constraints
-    Ain = zeros (0, n);
-    bin = zeros (0, 1);
-    n_in = 0;
-    if (nargs > 5)
-      if (! isempty (lb))
-        if (numel (lb) != n)
-          error ("qp: lower bound has incorrect length");
-        elseif (isempty (ub))
-          Ain = [Ain; eye(n)];
-          bin = [bin; lb];
+    if (! isempty (ub))
+      if (numel (ub) != n)
+        error ("qp: upper bound UB has incorrect length");
+      elseif (isempty (lb))
+        Ain = [Ain; -eye(n)];
+        bin = [bin; -ub];
+      endif
+    endif
+
+    if (! isempty (lb) && ! isempty (ub))
+      rtol = sqrt (eps);
+      for i = 1:n
+        if (abs (lb (i) - ub(i)) < rtol*(1 + max (abs (lb(i) + ub(i)))))
+          ## These are actually an equality constraint
+          tmprow = zeros (1,n);
+          tmprow(i) = 1;
+          A = [A;tmprow];
+          b = [b; 0.5*(lb(i) + ub(i))];
+          n_eq += 1;
+        else
+          tmprow = zeros (1,n);
+          tmprow(i) = 1;
+          Ain = [Ain; tmprow; -tmprow];
+          bin = [bin; lb(i); -ub(i)];
+          n_in += 2;
+        endif
+      endfor
+    endif
+  endif
+
+  ## Validate inequality constraints.
+  if (nargs > 7)
+    [dimA_in, n1] = size (A_in);
+    if (n1 != n)
+      error ("qp: inequality constraint matrix has incorrect column dimension");
+    else
+      if (! isempty (A_lb))
+        if (numel (A_lb) != dimA_in)
+          error ("qp: inequality constraint matrix and lower bound vector are inconsistent");
+        elseif (isempty (A_ub))
+          Ain = [Ain; A_in];
+          bin = [bin; A_lb];
+        endif
+      endif
+      if (! isempty (A_ub))
+        if (numel (A_ub) != dimA_in)
+          error ("qp: inequality constraint matrix and upper bound vector are inconsistent");
+        elseif (isempty (A_lb))
+          Ain = [Ain; -A_in];
+          bin = [bin; -A_ub];
         endif
       endif
 
-      if (! isempty (ub))
-        if (numel (ub) != n)
-          error ("qp: upper bound has incorrect length");
-        elseif (isempty (lb))
-          Ain = [Ain; -eye(n)];
-          bin = [bin; -ub];
-        endif
-      endif
-
-      if (! isempty (lb) && ! isempty (ub))
+      if (! isempty (A_lb) && ! isempty (A_ub))
         rtol = sqrt (eps);
-        for i = 1:n
-          if (abs (lb (i) - ub(i)) < rtol*(1 + max (abs (lb(i) + ub(i)))))
+        for i = 1:dimA_in
+          if (abs (A_lb(i) - A_ub(i))
+              < rtol*(1 + max (abs (A_lb(i) + A_ub(i)))))
             ## These are actually an equality constraint
-            tmprow = zeros (1,n);
-            tmprow(i) = 1;
+            tmprow = A_in(i,:);
             A = [A;tmprow];
-            b = [b; 0.5*(lb(i) + ub(i))];
-            n_eq = n_eq + 1;
+            b = [b; 0.5*(A_lb(i) + A_ub(i))];
+            n_eq += 1;
           else
-            tmprow = zeros (1,n);
-            tmprow(i) = 1;
+            tmprow = A_in(i,:);
             Ain = [Ain; tmprow; -tmprow];
-            bin = [bin; lb(i); -ub(i)];
-            n_in = n_in + 2;
+            bin = [bin; A_lb(i); -A_ub(i)];
+            n_in += 2;
           endif
         endfor
       endif
     endif
+  endif
 
-    ## Inequality constraints
-    if (nargs > 7)
-      [dimA_in, n1] = size (A_in);
-      if (n1 != n)
-        error ("qp: inequality constraint matrix has incorrect column dimension");
-      else
-        if (! isempty (A_lb))
-          if (numel (A_lb) != dimA_in)
-            error ("qp: inequality constraint matrix and lower bound vector inconsistent");
-          elseif (isempty (A_ub))
-            Ain = [Ain; A_in];
-            bin = [bin; A_lb];
-          endif
-        endif
-        if (! isempty (A_ub))
-          if (numel (A_ub) != dimA_in)
-            error ("qp: inequality constraint matrix and upper bound vector inconsistent");
-          elseif (isempty (A_lb))
-            Ain = [Ain; -A_in];
-            bin = [bin; -A_ub];
+  ## Now we should have the following QP:
+  ##
+  ##   min_x  0.5*x'*H*x + x'*q
+  ##   s.t.   A*x = b
+  ##          Ain*x >= bin
+
+  ## Discard inequality constraints that have -Inf bounds since those
+  ## will never be active.
+  idx = (bin == -Inf);
+
+  bin(idx) = [];
+  Ain(idx,:) = [];
+
+  n_in = numel (bin);
+
+  ## Check if the initial guess is feasible.
+  if (isa (x0, "single") || isa (H, "single") || isa (q, "single")
+      || isa (A, "single") || isa (b, "single"))
+    rtol = sqrt (eps ("single"));
+  else
+    rtol = sqrt (eps);
+  endif
+
+  eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+abs (b)));
+  in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+abs (bin))));
+
+  info = 0;
+  if (eq_infeasible || in_infeasible)
+    ## The initial guess is not feasible.
+    ## First, define an xbar that is feasible with respect to the
+    ## equality constraints.
+    if (eq_infeasible)
+      if (rank (A) < n_eq)
+        error ("qp: equality constraint matrix must be full row rank");
+      endif
+      xbar = pinv (A) * b;
+    else
+      xbar = x0;
+    endif
+
+    ## Second, check that xbar is also feasible with respect to the
+    ## inequality constraints.
+    if (n_in > 0)
+      res = Ain * xbar - bin;
+      if (any (res < -rtol * (1 + abs (bin))))
+        ## xbar is not feasible with respect to the inequality constraints.
+        ## Compute a step in the null space of the equality constraints,
+        ## by solving a QP.  If the slack is small, we have a feasible initial
+        ## guess.  Otherwise, the problem is infeasible.
+        if (n_eq > 0)
+          Z = null (A);
+          if (isempty (Z))
+            ## The problem is infeasible because A is square and full rank,
+            ## but xbar is not feasible.
+            info = 6;
           endif
         endif
 
-        if (! isempty (A_lb) && ! isempty (A_ub))
-          rtol = sqrt (eps);
-          for i = 1:dimA_in
-            if (abs (A_lb(i) - A_ub(i))
-                < rtol*(1 + max (abs (A_lb(i) + A_ub(i)))))
-              ## These are actually an equality constraint
-              tmprow = A_in(i,:);
-              A = [A;tmprow];
-              b = [b; 0.5*(A_lb(i) + A_ub(i))];
-              n_eq = n_eq + 1;
+        if (info != 6)
+          ## Solve an LP with additional slack variables
+          ## to find a feasible starting point.
+          gamma = eye (n_in);
+          if (n_eq > 0)
+            Atmp = [Ain*Z, gamma];
+            btmp = -res;
+          else
+            Atmp = [Ain, gamma];
+            btmp = bin;
+          endif
+          ctmp = [zeros(n-n_eq, 1); ones(n_in, 1)];
+          lb = [-Inf(n-n_eq,1); zeros(n_in,1)];
+          ub = [];
+          ctype = repmat ("L", n_in, 1);
+          [P, dummy, status] = glpk (ctmp, Atmp, btmp, lb, ub, ctype);
+          if ((status == 0)
+              && all (abs (P(n-n_eq+1:end)) < rtol * (1 + norm (btmp))))
+            ## We found a feasible starting point
+            if (n_eq > 0)
+              x0 = xbar + Z*P(1:n-n_eq);
             else
-              tmprow = A_in(i,:);
-              Ain = [Ain; tmprow; -tmprow];
-              bin = [bin; A_lb(i); -A_ub(i)];
-              n_in = n_in + 2;
+              x0 = P(1:n);
             endif
-          endfor
-        endif
-      endif
-    endif
-
-    ## Now we should have the following QP:
-    ##
-    ##   min_x  0.5*x'*H*x + x'*q
-    ##   s.t.   A*x = b
-    ##          Ain*x >= bin
-
-    ## Discard inequality constraints that have -Inf bounds since those
-    ## will never be active.
-    idx = isinf (bin) & bin < 0;
-
-    bin(idx) = [];
-    Ain(idx,:) = [];
-
-    n_in = numel (bin);
-
-    ## Check if the initial guess is feasible.
-    if (isa (x0, "single") || isa (H, "single") || isa (q, "single")
-        || isa (A, "single") || isa (b, "single"))
-      rtol = sqrt (eps ("single"));
-    else
-      rtol = sqrt (eps);
-    endif
-
-    eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+abs (b)));
-    in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+abs (bin))));
-
-    info = 0;
-    if (eq_infeasible || in_infeasible)
-      ## The initial guess is not feasible.
-      ## First define xbar that is feasible with respect to the equality
-      ## constraints.
-      if (eq_infeasible)
-        if (rank (A) < n_eq)
-          error ("qp: equality constraint matrix must be full row rank");
-        endif
-        xbar = pinv (A) * b;
-      else
-        xbar = x0;
-      endif
-
-      ## Check if xbar is feasible with respect to the inequality
-      ## constraints also.
-      if (n_in > 0)
-        res = Ain * xbar - bin;
-        if (any (res < -rtol * (1 + abs (bin))))
-          ## xbar is not feasible with respect to the inequality
-          ## constraints.  Compute a step in the null space of the
-          ## equality constraints, by solving a QP.  If the slack is
-          ## small, we have a feasible initial guess.  Otherwise, the
-          ## problem is infeasible.
-          if (n_eq > 0)
-            Z = null (A);
-            if (isempty (Z))
-              ## The problem is infeasible because A is square and full
-              ## rank, but xbar is not feasible.
-              info = 6;
-            endif
+          else
+            ## The problem is infeasible
+            info = 6;
           endif
-
-          if (info != 6)
-            ## Solve an LP with additional slack variables to find
-            ## a feasible starting point.
-            gamma = eye (n_in);
-            if (n_eq > 0)
-              Atmp = [Ain*Z, gamma];
-              btmp = -res;
-            else
-              Atmp = [Ain, gamma];
-              btmp = bin;
-            endif
-            ctmp = [zeros(n-n_eq, 1); ones(n_in, 1)];
-            lb = [-Inf(n-n_eq,1); zeros(n_in,1)];
-            ub = [];
-            ctype = repmat ("L", n_in, 1);
-            [P, dummy, status] = glpk (ctmp, Atmp, btmp, lb, ub, ctype);
-            if ((status == 0)
-                && all (abs (P(n-n_eq+1:end)) < rtol * (1 + norm (btmp))))
-              ## We found a feasible starting point
-              if (n_eq > 0)
-                x0 = xbar + Z*P(1:n-n_eq);
-              else
-                x0 = P(1:n);
-              endif
-            else
-              ## The problem is infeasible
-              info = 6;
-            endif
-          endif
-        else
-          ## xbar is feasible.  We use it a starting point.
-          x0 = xbar;
         endif
       else
         ## xbar is feasible.  We use it a starting point.
         x0 = xbar;
       endif
+    else
+      ## xbar is feasible.  We use it a starting point.
+      x0 = xbar;
     endif
+  endif
 
-    if (info == 0)
-      ## The initial (or computed) guess is feasible.
-      ## We call the solver.
-      [x, lambda, info, iter] = __qp__ (x0, H, q, A, b, Ain, bin, maxit);
-    else
-      iter = 0;
-      x = x0;
-      lambda = [];
-    endif
+  if (info == 0)
+    ## The initial (or computed) guess is feasible.  Call the solver.
+    [x, lambda, info, iter] = __qp__ (x0, H, q, A, b, Ain, bin, maxit);
+  else
+    iter = 0;
+    x = x0;
+    lambda = [];
+  endif
+  if (isargout (2))
     obj = 0.5 * x' * H * x + q' * x;
+  endif
+  if (isargout (3))
     INFO.solveiter = iter;
     INFO.info = info;
-
-  else
-    print_usage ();
   endif
 
 endfunction
--- a/scripts/plot/appearance/annotation.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/appearance/annotation.m	Tue Jun 23 20:00:59 2015 -0700
@@ -1096,7 +1096,7 @@
   ## the vertical alignment of the arrow.
 
   ang = angle (complex (pos(3), pos(4)));
-  rot = rot / 180 * pi;
+  rot *= pi / 180;
 
   [~, pt] = min (abs ((-pi:pi/4:pi) - ang));
   pt -= floor (rot / (pi/4));
--- a/scripts/plot/appearance/axis.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/appearance/axis.m	Tue Jun 23 20:00:59 2015 -0700
@@ -375,13 +375,13 @@
   if (all (xlim == 0))
     xlim = eps () * [-1 1];
   elseif (diff (xlim == 0))
-    xlim = xlim .* (1 + eps () * [-1, 1]);
+    xlim .*= (1 + eps () * [-1, 1]);
   endif
   ylim = __get_tight_lims__ (ca, "y");
   if (all (ylim == 0))
     ylim = eps () * [-1 1];
   elseif (diff (ylim == 0))
-    ylim = ylim .* (1 + eps () * [-1, 1]);
+    ylim .*= (1 + eps () * [-1, 1]);
   endif
   set (ca, "xlim", xlim, "ylim", ylim)
   nd = __calc_dimensions__ (ca);
@@ -391,7 +391,7 @@
     if (all (zlim == 0))
       zlim = eps () * [-1 1];
     elseif (diff (zlim == 0))
-      zlim = zlim .* (1 + eps () * [-1, 1]);
+      zlim .*= (1 + eps () * [-1, 1]);
     endif
     set (ca, "zlim", zlim);
   endif
--- a/scripts/plot/appearance/legend.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/appearance/legend.m	Tue Jun 23 20:00:59 2015 -0700
@@ -715,7 +715,7 @@
           ## This implies that a change in fontsize should trigger a listener
           ## to update the legend.  The "2" was determined using a long legend
           ## key in the absence of any subplots.
-          gnuplot_offset = gnuplot_offset - 2 * fontsize;
+          gnuplot_offset -= 2 * fontsize;
         else
           gnuplot_offset = 0;
         endif
--- a/scripts/plot/appearance/specular.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/appearance/specular.m	Tue Jun 23 20:00:59 2015 -0700
@@ -88,7 +88,7 @@
 
   ## Allow postive values only
   retval(retval < 0) = 0;
-  retval = retval .^ se;
+  retval .^= se;
 
 endfunction
 
--- a/scripts/plot/draw/colorbar.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/draw/colorbar.m	Tue Jun 23 20:00:59 2015 -0700
@@ -398,48 +398,48 @@
   switch (cbox)
     case "northoutside"
       origin = pos(1:2) + [0., 0.9] .* sz + [1, -1] .* off;
-      sz = sz .* [1.0, 0.06];
+      sz .*= [1.0, 0.06];
       pos(4) = 0.8 * pos(4);
       mirr = true;
       vertical = false;
     case "north"
       origin = pos(1:2) + [0.05, 0.9] .* sz + [1, -1] .* off;
-      sz = sz .* [1.0, 0.06] * 0.9;
+      sz .*= [1.0, 0.06] * 0.9;
       mirr = false;
       vertical = false;
     case "southoutside"
       origin = pos(1:2) + off;
-      sz = sz .* [1.0, 0.06];
+      sz .*= [1.0, 0.06];
       pos(2) = pos(2) + pos(4) * 0.2;
       pos(4) = 0.8 * pos(4);
       mirr = false;
       vertical = false;
     case "south"
       origin = pos(1:2) + [0.05, 0.05] .* sz + off;
-      sz = sz .* [1.0, 0.06] * 0.9;
+      sz .*= [1.0, 0.06] * 0.9;
       mirr = true;
       vertical = false;
     case "eastoutside"
       origin = pos(1:2) + [0.9, 0] .* sz + [-1, 1] .* off;
-      sz = sz .* [0.06, 1.0];
+      sz .*= [0.06, 1.0];
       pos(3) = 0.8 * pos(3);
       mirr = true;
       vertical = true;
     case "east"
       origin = pos(1:2) + [0.9, 0.05] .* sz + [-1, 1] .* off;
-      sz = sz .* [0.06, 1.0] * 0.9;
+      sz .*= [0.06, 1.0] * 0.9;
       mirr = false;
       vertical = true;
     case "westoutside"
       origin = pos(1:2) + off;
-      sz = sz .* [0.06, 1.0];
+      sz .*= [0.06, 1.0];
       pos(1) = pos(1) + pos(3) * 0.2;
       pos(3) = 0.8 * pos(3);
       mirr = false;
       vertical = true;
     case "west"
       origin = pos(1:2) + [0.05, 0.05] .* sz + off;
-      sz = sz .* [0.06, 1.0] .* 0.9;
+      sz .*= [0.06, 1.0] .* 0.9;
       mirr = true;
       vertical = true;
   endswitch
--- a/scripts/plot/draw/hist.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/draw/hist.m	Tue Jun 23 20:00:59 2015 -0700
@@ -101,7 +101,7 @@
   if (nargin == 1 || ischar (varargin{iarg}))
     n = 10;
     x = [0.5:n]'/n;
-    x = x * (max_val - min_val) + ones (size (x)) * min_val;
+    x = (max_val - min_val) * x + min_val * ones (size (x));
   else
     ## nargin is either 2 or 3
     x = varargin{iarg++};
@@ -111,7 +111,7 @@
         error ("hist: number of bins NBINS must be positive");
       endif
       x = [0.5:n]'/n;
-      x = x * (max_val - min_val) + ones (size (x)) * min_val;
+      x = (max_val - min_val) * x  + min_val * ones (size (x));
     elseif (isreal (x))
       if (isvector (x))
         x = x(:);
--- a/scripts/plot/draw/plotmatrix.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/draw/plotmatrix.m	Tue Jun 23 20:00:59 2015 -0700
@@ -138,7 +138,7 @@
         have_line_spec = true;
         linespec = varargin(i);
         varargin(i) = [];
-        nargin = nargin - 1;
+        nargin -= 1;
         break;
       else
         print_usage ("plotmatrix");
--- a/scripts/plot/draw/private/__contour__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/draw/private/__contour__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -28,40 +28,42 @@
 
   linespec.color = "auto";
   linespec.linestyle = "-";
-  for i = 3:2:nargin
-    arg = varargin{i};
-    if (ischar (arg) || iscellstr (arg))
+  opts = {};
+  i = 3;
+  while (i <= length (varargin))
+    if (ischar (varargin{i}) || iscellstr (varargin{i}))
+      arg = varargin{i};
+      if (i < length (varargin))
+        if (strcmpi (arg, "fill"))
+          filled = varargin{i+1};
+          varargin(i:i+1) = [];
+          continue;
+        elseif (strcmpi (arg, "linecolor"))
+          linespec.color = varargin{i+1};
+          varargin(i:i+1) = [];
+          continue;
+        endif
+      endif
+
       [lspec, valid] = __pltopt__ ("__contour__", arg, false);
       if (valid)
-        have_line_spec = true;
         varargin(i) = [];
-        linespec = lspec;
-        if (isempty (linespec.color))
-          linespec.color = "auto";
+        if (! isempty (lspec.color))
+          linespec.color = lspec.color;
+        endif
+        if (! isempty (lspec.linestyle))
+          linespec.linestyle = lspec.linestyle;
         endif
-        if (isempty (linespec.linestyle))
-          linespec.linestyle = "-";
+      else  # unrecognized option, pass unmodified in opts cell array
+        if (i < length (varargin))
+          opts(end+(1:2)) = varargin(i:i+1);
+          varargin(i:i+1) = [];
+        else
+          error ("__contour__: Uneven number of PROP/VAL pairs");
         endif
-        break;
       endif
-    endif
-  endfor
 
-  opts = {};
-  i = 3;
-  while (i < length (varargin))
-    if (ischar (varargin{i}))
-      if (strcmpi (varargin{i}, "fill"))
-        filled = varargin{i+1};
-        varargin(i:i+1) = [];
-      elseif (strcmpi (varargin{i}, "linecolor"))
-        linespec.color = varargin{i+1};
-        varargin(i:i+1) = [];
-      else
-        opts(end+(1:2)) = varargin(i:i+1);
-        varargin(i:i+1) = [];
-      endif
-    else
+    else  # skip numeric arguments
       i++;
     endif
   endwhile
--- a/scripts/plot/draw/private/__stem__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/draw/private/__stem__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -192,7 +192,7 @@
   else
     caller = "stem";
   endif
-  nargin = nargin - 1;  # account for have_z argument
+  nargin = nargin () - 1;  # account for have_z argument
 
   num_numeric = find (cellfun ("isclass", varargin, "char"), 1) - 1;
   if (isempty (num_numeric))
--- a/scripts/plot/draw/surfnorm.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/draw/surfnorm.m	Tue Jun 23 20:00:59 2015 -0700
@@ -41,7 +41,13 @@
 ##
 ## If output arguments are requested then the components of the normal
 ## vectors are returned in @var{nx}, @var{ny}, and @var{nz} and no plot is
-## made.
+## made.  The normal vectors are unnormalized (magnitude != 1).  To normalize,
+## use
+##
+## @example
+## mag = sqrt (nx.^2 + ny.^2 + nz.^2);
+## nx ./= len;  ny ./= len;  nz ./= len;
+## @end example
 ##
 ## An example of the use of @code{surfnorm} is
 ##
@@ -50,10 +56,14 @@
 ## @end example
 ##
 ## Algorithm: The normal vectors are calculated by taking the cross product
-## of the diagonals of each of the quadrilaterals in the meshgrid to find the
-## normal vectors of the centers of these quadrilaterals.  The four nearest
-## normal vectors to the meshgrid points are then averaged to obtain the
-## normal to the surface at the meshgridded points.
+## of the diagonals of each of the quadrilateral faces in the meshgrid to find
+## the normal vectors at the center of each face.  Next, for each meshgrid
+## point the four nearest normal vectors are averaged to obtain the final
+## normal to the surface at the meshgrid point.
+##
+## For surface objects, the @qcode{"VertexNormals"} property contains
+## equivalent information, except possibly near the boundary of the surface
+## where different interpolation schemes may yield slightly different values.
 ##
 ## @seealso{isonormals, quiver3, surf, meshgrid}
 ## @end deftypefn
@@ -84,6 +94,7 @@
     error ("surfnorm: X, Y, and Z must have the same dimensions");
   endif
 
+  ## FIXME: Matlab uses a bicubic interpolation, not linear, along the boundary.
   ## Do a linear extrapolation for mesh points on the boundary so that the mesh
   ## is increased by 1 on each side.  This allows each original meshgrid point
   ## to be surrounded by four quadrilaterals and the same calculation can be
@@ -116,14 +127,6 @@
   nz = (w.z(1:end-1,1:end-1) + w.z(1:end-1,2:end) +
         w.z(2:end,1:end-1) + w.z(2:end,2:end)) / 4;
 
-  ## FIXME: According to Matlab documentation the vertex normals
-  ##        returned are not normalized.
-  ## Normalize the normal vectors
-  len = sqrt (nx.^2 + ny.^2 + nz.^2);
-  nx ./= len;
-  ny ./= len;
-  nz ./= len;
-
   if (nargout == 0)
     oldfig = [];
     if (! isempty (hax))
@@ -137,21 +140,20 @@
       unwind_protect
         set (hax, "nextplot", "add");
 
-        ## FIXME: Scale unit normals by data aspect ratio in order for
-        ##        normals to appear correct.
-        ##daratio = daspect (hax);
-        ##daspect ("manual");
-        ##len = norm (daratio);
-        ## This assumes an even meshgrid which isn't a great assumption
-        ##dx = x(1,2) - x(1,1);
-        ##dy = y(2,1) - y(1,1);
-        ##nx *= daratio(1);
-        ##ny *= daratio(2);
-        ##nz *= daratio(3);
-        ##len = sqrt (nx.^2 + ny.^2 + nz.^2);
-        ##nx ./= len;
-        ##ny ./= len;
-        ##nz ./= len;
+        ## Normalize the normal vectors
+        nmag = sqrt (nx.^2 + ny.^2 + nz.^2);
+
+        ## And correct for the aspect ratio of the display
+        daratio = daspect (hax);
+        damag = sqrt (sumsq (daratio)); 
+
+        ## FIXME: May also want to normalize the vectors relative to the size
+        ##        of the diagonal.
+
+        nx ./= nmag / (daratio(1)^2 / damag);
+        ny ./= nmag / (daratio(2)^2 / damag);
+        nz ./= nmag / (daratio(3)^2 / damag);
+
         plot3 ([x(:).'; x(:).' + nx(:).' ; NaN(size(x(:).'))](:),
                [y(:).'; y(:).' + ny(:).' ; NaN(size(y(:).'))](:),
                [z(:).'; z(:).' + nz(:).' ; NaN(size(z(:).'))](:),
@@ -177,10 +179,10 @@
 %!demo
 %! clf;
 %! colormap ('default');
-%! surfnorm (peaks (32));
-%! shading interp;
+%! surfnorm (peaks (19));
+%! shading faceted;
 %! title ({'surfnorm() shows surface and normals at each vertex', ...
-%!         'peaks() function with 32 faces'});
+%!         'peaks() function with 19 faces'});
 
 %!demo
 %! clf;
--- a/scripts/plot/util/__actual_axis_position__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/__actual_axis_position__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -67,13 +67,13 @@
     endif
     orig_aspect_ratio_2d = pos_in_pixels(3:4);
     rel_aspect_ratio_2d = aspect_ratio_2d ./ orig_aspect_ratio_2d;
-    rel_aspect_ratio_2d = rel_aspect_ratio_2d ./ max (rel_aspect_ratio_2d);
+    rel_aspect_ratio_2d ./= max (rel_aspect_ratio_2d);
     if (rel_aspect_ratio_2d(1) < rel_aspect_ratio_2d(2));
       dx = (1.0 - rel_aspect_ratio_2d(1)) * pos_in_pixels(3);
-      pos_in_pixels = pos_in_pixels + dx*[0.5, 0.0, -1.0, 0.0];
+      pos_in_pixels += dx*[0.5, 0.0, -1.0, 0.0];
     elseif (rel_aspect_ratio_2d(1) > rel_aspect_ratio_2d(2))
       dy = (1.0 - rel_aspect_ratio_2d(2)) * pos_in_pixels(4);
-      pos_in_pixels = pos_in_pixels + dy*[0.0, 0.5, 0.0, -1.0];
+      pos_in_pixels += dy*[0.0, 0.5, 0.0, -1.0];
     endif
     pos = pos_in_pixels ./ fig_position([3, 4, 3, 4]);
   elseif (strcmp (get (axis_obj.parent, "__graphics_toolkit__"), "gnuplot")
--- a/scripts/plot/util/__gnuplot_drawnow__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/__gnuplot_drawnow__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -185,8 +185,8 @@
                || any (strcmp (term, {"canvas", "emf", "gif", "jpeg", ...
                                       "pbm", "png", "pngcairo", "svg"}))))
           ## Convert to inches
-          gnuplot_pos = gnuplot_pos / 72;
-          gnuplot_size = gnuplot_size / 72;
+          gnuplot_pos /= 72;
+          gnuplot_size /= 72;
         endif
         if (all (gnuplot_size > 0))
           terminals_with_size = {"canvas", "emf", "epslatex", "fig", ...
--- a/scripts/plot/util/findobj.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/findobj.m	Tue Jun 23 20:00:59 2015 -0700
@@ -99,7 +99,7 @@
       if (ischar (varargin{n1}))
         if (strcmpi (varargin{n1}, "flat"))
           depth = 0;
-          n1 = n1 + 1;
+          n1 += 1;
         endif
       else
         error ("findobj: properties and options must be strings");
@@ -133,32 +133,32 @@
     if (ischar (args{na}))
       if (strcmpi (args{na}, "-property"))
         if (na + 1 <= numel (args))
-          na = na + 1;
+          na += 1;
           property(np) = 1;
           pname{np} = args{na};
-          na = na + 1;
+          na += 1;
           pvalue{np} = [];
-          np = np + 1;
+          np += 1;
         else
           error ("findobj: inconsistent number of arguments");
         endif
       elseif (strcmpi (args{na}, "-regexp"))
         if (na + 2 <= numel (args))
           regularexpression(np) = 1;
-          na = na + 1;
+          na += 1;
           pname{np} = args{na};
-          na = na + 1;
+          na += 1;
           pvalue{np} = args{na};
-          na = na + 1;
-          np = np + 1;
+          na += 1;
+          np += 1;
         else
           error ("findobj: inconsistent number of arguments");
         endif
       elseif (strcmpi (args{na}, "-depth"))
         if (na + 1 <= numel (args))
-          na = na + 1;
+          na += 1;
           depth = args{na};
-          na = na + 1;
+          na += 1;
         else
           error ("findobj: inconsistent number of arguments");
         endif
@@ -166,14 +166,14 @@
         ## Parameter/value pairs.
         if (na + 1 <= numel (args))
           pname{np} = args{na};
-          na = na + 1;
+          na += 1;
           pvalue{np} = args{na};
-          na = na + 1;
+          na += 1;
           if (na <= numel (args))
             if (ischar (args{na}))
               if (any (strcmpi (args{na}, operatorprecedence)))
                 logicaloperator{np} = args{na}(2:end);
-                na = na+1;
+                na += 1;
               endif
             else
               error ("findobj: properties and options must be strings");
@@ -181,7 +181,7 @@
           else
             logicaloperator{np} = "and";
           endif
-          np = np + 1;
+          np += 1;
         else
           error ("findobj: inconsistent number of arguments");
         endif
@@ -189,7 +189,7 @@
         if (strcmpi (args{na}, "-not"))
           extranegation(np) = true;
         endif
-        na = na + 1;
+        na += 1;
       endif
     else
       error ("findobj: properties and options must be strings");
@@ -211,7 +211,7 @@
     endfor
     handles = children;
     h = [h; children];
-    idepth = idepth + 1;
+    idepth += 1;
   endwhile
 
   if (numpairs > 0)
@@ -267,7 +267,7 @@
                                  match(:,np+1));
             logicaloperator(np+1) = [];
             match(:,np+1) = [];
-            numpairs = numpairs - 1;
+            numpairs -= 1;
           endif
           if (numpairs < 2)
             break;
--- a/scripts/plot/util/ginput.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/ginput.m	Tue Jun 23 20:00:59 2015 -0700
@@ -69,12 +69,15 @@
   ginput_accumulator (0, 0, 0, 0);  # initialize accumulator
 
   orig_windowbuttondownfcn = get (fig, "windowbuttondownfcn");
-  orig_ginput_keypressfcn = get (fig, "keypressfcn");
+  orig_keypressfcn = get (fig, "keypressfcn");
+  orig_closerequestfcn = get (fig, "closerequestfcn");
 
   unwind_protect
 
     set (fig, "windowbuttondownfcn", @ginput_windowbuttondownfcn);
     set (fig, "keypressfcn", @ginput_keypressfcn);
+    set (fig, "closerequestfcn", {@ginput_closerequestfcn,
+                                  orig_closerequestfcn});
 
     do
       if (strcmp (toolkit, "fltk"))
@@ -95,8 +98,12 @@
     endif
 
   unwind_protect_cleanup
-    set (fig, "windowbuttondownfcn", orig_windowbuttondownfcn);
-    set (fig, "keypressfcn", orig_ginput_keypressfcn);
+    if (isfigure (fig))
+      ## Only execute if window still exists
+      set (fig, "windowbuttondownfcn", orig_windowbuttondownfcn);
+      set (fig, "keypressfcn", orig_keypressfcn);
+      set (fig, "closerequestfcn", orig_closerequestfcn);
+    endif
   end_unwind_protect
 
   varargout = {x, y, button};
@@ -123,12 +130,12 @@
 
 endfunction
 
-function ginput_windowbuttondownfcn (src, button)
+function ginput_windowbuttondownfcn (~, button)
   point = get (gca (), "currentpoint");
   ginput_accumulator (1, point(1,1), point(1,2), button);
 endfunction
 
-function ginput_keypressfcn (src, evt)
+function ginput_keypressfcn (~, evt)
   point = get (gca (), "currentpoint");
   if (strcmp (evt.Key, "return"))
     ## Enter key stops ginput.
@@ -141,6 +148,11 @@
   endif
 endfunction
 
+function ginput_closerequestfcn (hfig, ~, orig_closerequestfcn)
+  ginput_accumulator (2, NaN, NaN, NaN);  # Stop ginput
+  feval (orig_closerequestfcn);           # Close window with original fcn
+endfunction
+
 
 ## Remove from test statistics.  No real tests possible.
 %!test
--- a/scripts/plot/util/print.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/print.m	Tue Jun 23 20:00:59 2015 -0700
@@ -412,7 +412,7 @@
         endif
         if (! isempty (opts.scalefontsize) && ! opts.scalefontsize != 1)
           ## This is done to work around the bbox being whole numbers.
-          fontsize = fontsize * opts.scalefontsize;
+          fontsize *= opts.scalefontsize;
         endif
         ## FIXME: legend child objects need to be acted on first.
         ##        or legend fontsize callback will destroy them.
--- a/scripts/plot/util/private/__gnuplot_get_var__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/private/__gnuplot_get_var__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -52,8 +52,7 @@
   if (use_mkfifo)
     gpin_name = tempname ();
 
-    ## Mode: 0600 == 6*8*8
-    [err, msg] = mkfifo (gpin_name, 6*8*8);
+    [err, msg] = mkfifo (gpin_name, 600);
 
     if (err)
       error ("__gnuplot_get_var__: Can not make FIFO (%s)", msg);
--- a/scripts/plot/util/private/__gnuplot_ginput__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/private/__gnuplot_ginput__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -63,8 +63,7 @@
   if (use_mkfifo)
     gpin_name = tempname ();
 
-    ##Mode: 6*8*8 ==  0600
-    [err, msg] = mkfifo (gpin_name, 6*8*8);
+    [err, msg] = mkfifo (gpin_name, 600);
 
     if (err)
       error ("ginput: Can not open fifo (%s)", msg);
--- a/scripts/plot/util/private/__go_draw_axes__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/private/__go_draw_axes__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -414,7 +414,7 @@
   ## preserved the original order.
   [jnk, k] = setdiff (kids, [axis_obj.xlabel; axis_obj.ylabel; ...
                              axis_obj.zlabel; axis_obj.title]);
-  kids = kids (sort (k));
+  kids = kids(sort (k));
 
   if (nd == 3)
     fputs (plot_stream, "set parametric;\n");
@@ -1631,7 +1631,7 @@
   fputs (plot_stream, "set style data lines;\n");
 
   cmap = [cmap; addedcmap];
-  cmap_sz = cmap_sz + rows (addedcmap);
+  cmap_sz += rows (addedcmap);
   if (mono == false && length (cmap) > 0)
     fprintf (plot_stream,
              "set palette positive color model RGB maxcolors %i;\n",
@@ -2345,12 +2345,12 @@
         ## FIXME: The symbol font doesn't seem to support bold or italic
         ##if (bld)
         ##  if (it)
-        ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
+        ##    g = strrep (g, '/Symbol', '/Symbol-bolditalic');
         ##  else
-        ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
+        ##    g = strrep (g, '/Symbol', '/Symbol-bold');
         ##  endif
         ##elseif (it)
-        ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
+        ##  g = strrep (g, '/Symbol', '/Symbol-italic');
         ##endif
         str = [str(1:s(i) - 1) g str(e(i) + 1:end)];
       elseif (strncmp (f, "rm", 2))
@@ -2406,12 +2406,12 @@
             ## FIXME: The symbol font doesn't seem to support bold or italic
             ##if (bld)
             ##  if (it)
-            ##    g = regexprep (g, '/Symbol', '/Symbol-bolditalic');
+            ##    g = strrep (g, '/Symbol', '/Symbol-bolditalic');
             ##  else
-            ##    g = regexprep (g, '/Symbol', '/Symbol-bold');
+            ##    g = strrep (g, '/Symbol', '/Symbol-bold');
             ##  endif
             ##elseif (it)
-            ##  g = regexprep (g, '/Symbol', '/Symbol-italic');
+            ##  g = strrep (g, '/Symbol', '/Symbol-italic');
             ##endif
             str = [str(1:s(i) - 1) g str(s(i) + length (flds{j}) + 1:end)];
             break;
@@ -2449,7 +2449,7 @@
             si++;
           endif
         endwhile
-        l1 = l1 (min (length (l1), si));
+        l1 = l1(min (length (l1), si));
         if (s(i) + l1 + 1 == s(i+1))
           if (str(s(i + 1) + p + 1) == "{")
             s2 = strfind (str(s(i + 1) + p + 2:end),'{');
@@ -2466,7 +2466,7 @@
                 si++;
               endif
             endwhile
-            l2 = l2 (min (length (l2), si));
+            l2 = l2(min (length (l2), si));
             if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <=
                 length_string (str(s(i+1)+p+2:s(i+1)+p+l2-1)))
               ## Shortest already first!
@@ -2507,7 +2507,7 @@
   l = length (s) - length (strfind (s,'{')) - length (strfind (s,'}'));
   m = regexp (s, '/([\w-]+|[\w-]+=\d+)', 'matches');
   if (! isempty (m))
-    l = l - sum (cellfun ("length", m));
+    l -= sum (cellfun ("length", m));
   endif
 endfunction
 
--- a/scripts/plot/util/private/__print_parse_opts__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/private/__print_parse_opts__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -495,7 +495,7 @@
     endif
     n = 0;
     while (n < numel (gs_binaries) && isempty (ghostscript_binary))
-      n = n + 1;
+      n += 1;
       ghostscript_binary = file_in_path (getenv ("PATH"), gs_binaries{n});
     endwhile
     if (warn_on_no_ghostscript && isempty (ghostscript_binary))
@@ -529,7 +529,7 @@
     endif
     n = 0;
     while (n < numel (binaries) && isempty (data.(binary).bin))
-      n = n + 1;
+      n += 1;
       data.(binary).bin = file_in_path (getenv ("PATH"), binaries{n});
     endwhile
     if (isempty (data.(binary).bin) && data.(binary).warn_on_absence)
@@ -574,7 +574,7 @@
   endif
 
   if (strcmp (paperunits, "normalized"))
-    paperposition = paperposition .* papersize([1,2,1,2]);
+    paperposition .*= papersize([1,2,1,2]);
   else
     paperposition = convert2points (paperposition, paperunits);
   endif
@@ -611,9 +611,9 @@
 function value = convert2points (value, units)
   switch (units)
     case "inches"
-      value = value * 72;
+      value *= 72;
     case "centimeters"
-      value = value * 72 / 2.54;
+      value *= 72 / 2.54;
     case "normalized"
       error ("print:customnormalized",
              "print.m: papersize=='<custom>' and paperunits='normalized' may not be combined");
--- a/scripts/plot/util/rotate.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/plot/util/rotate.m	Tue Jun 23 20:00:59 2015 -0700
@@ -111,7 +111,7 @@
     origin = [a, b, c];
   endif
 
-  direction = direction / norm (direction);
+  direction /= norm (direction);
 
   u = direction(1);
   v = direction(2);
--- a/scripts/polynomial/pchip.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/polynomial/pchip.m	Tue Jun 23 20:00:59 2015 -0700
@@ -116,7 +116,7 @@
   del2 = (d2 - delta) / h;
   c3 = del1 + del2;
   c2 = -c3 - del1;
-  c3 = c3 / h;
+  c3 /= h;
   coeffs = cat (3, c3, c2, d1, f1);
 
   ret = mkpp (x, coeffs, szy(1:end-1));
--- a/scripts/polynomial/polyaffine.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/polynomial/polyaffine.m	Tue Jun 23 20:00:59 2015 -0700
@@ -56,7 +56,7 @@
 
    ## Scale.
    if (mu(2) != 1)
-     g = g ./ (mu(2) .^ (lf-1:-1:0));
+     g ./= mu(2) .^ (lf-1:-1:0);
    endif
 
    ## Translate.
--- a/scripts/polynomial/polyder.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/polynomial/polyder.m	Tue Jun 23 20:00:59 2015 -0700
@@ -69,8 +69,8 @@
         endif
 
         ## move all the gain into the numerator
-        q = q/d(1);
-        d = d/d(1);
+        q /= d(1);
+        d /= d(1);
       endif
     else
       lp = numel (p);
--- a/scripts/polynomial/private/__splinefit__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/polynomial/private/__splinefit__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -151,7 +151,7 @@
     % Solve constraints
     [Z,u0] = solvecon(B,constr);
     % Solve Min norm(u*A-y), subject to u*B = yc
-    y = y - u0*A;
+    y -= u0*A;
     A = Z*A;
     v = lsqsolve(A,y,beta);
     u = u0 + v*Z;
@@ -487,7 +487,7 @@
 end
 
 % Reduce number of pieces
-pieces = pieces - 2*deg;
+pieces -= 2*deg;
 
 % Sort coefficients by interval number
 ii = [n*(1:pieces); deg*ones(deg,pieces)];
@@ -517,7 +517,7 @@
 B0 = zeros(n,nx);
 for k = 1:size(cc,1)
     if any(cc(k,:))
-        B0 = B0 + repmat(cc(k,:),n,1).*ppval(base,xc);
+        B0 += repmat(cc(k,:),n,1).*ppval(base,xc);
     end
     % Differentiate base
     coefs = base.coefs(:,1:n-k);
--- a/scripts/polynomial/residue.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/polynomial/residue.m	Tue Jun 23 20:00:59 2015 -0700
@@ -170,8 +170,8 @@
   a = polyreduce (a);
   b = polyreduce (b);
 
-  b = b / a(1);
-  a = a / a(1);
+  b /= a(1);
+  a /= a(1);
 
   la = length (a);
   lb = length (b);
@@ -329,13 +329,13 @@
     endfor
     pn = deconv (pden, pm);
     pn = r(n) * pn;
-    pnum = pnum + prepad (pn, N+1, 0, 2);
+    pnum += prepad (pn, N+1, 0, 2);
   endfor
 
   ## Add the direct term.
 
   if (numel (k))
-    pnum = pnum + conv (pden, k);
+    pnum += conv (pden, k);
   endif
 
   ## Check for leading zeros and trim the polynomial coefficients.
--- a/scripts/signal/arch_fit.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/arch_fit.m	Tue Jun 23 20:00:59 2015 -0700
@@ -96,17 +96,17 @@
     tmp = esq ./ h.^2 - 1 ./ h;
     s   = 1 ./ h(1:T-p);
     for j = 1 : p;
-      s = s - a(j+1) * tmp(j+1:T-p+j);
+      s -= a(j+1) * tmp(j+1:T-p+j);
     endfor
     r = 1 ./ h(1:T-p);
     for j = 1:p;
-      r = r + 2 * h(j+1:T-p+j).^2 .* esq(1:T-p);
+      r += 2 * h(j+1:T-p+j).^2 .* esq(1:T-p);
     endfor
     r = sqrt (r);
     X_tilde = x(1:T-p, :) .* (r * ones (1,k));
     e_tilde = e(1:T-p) .*s ./ r;
     delta_b = inv (X_tilde' * X_tilde) * X_tilde' * e_tilde;
-    b   = b + gamma * delta_b;
+    b  += gamma * delta_b;
     e   = y - x * b;
     esq = e .^ 2;
     Z   = autoreg_matrix (esq, p);
@@ -114,7 +114,7 @@
     f   = esq ./ h - ones (T,1);
     Z_tilde = Z ./ (h * ones (1, p+1));
     delta_a = inv (Z_tilde' * Z_tilde) * Z_tilde' * f;
-    a = a + gamma * delta_a;
+    a += gamma * delta_a;
   endfor
 
 endfunction
--- a/scripts/signal/arch_rnd.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/arch_rnd.m	Tue Jun 23 20:00:59 2015 -0700
@@ -63,14 +63,14 @@
   a  = reshape (a, 1, la);
   if (la == 1)
     a  = [a, 0];
-    la = la + 1;
+    la += 1;
   endif
 
   lb = length (b);
   b  = reshape (b, 1, lb);
   if (lb == 1)
     b  = [b, 0];
-    lb = lb + 1;
+    lb += 1;
   endif
   m = max ([la, lb]);
 
--- a/scripts/signal/bartlett.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/bartlett.m	Tue Jun 23 20:00:59 2015 -0700
@@ -42,7 +42,7 @@
   if (m == 1)
     c = 1;
   else
-    m = m - 1;
+    m -= 1;
     n = fix (m / 2);
     c = [2*(0:n)/m, 2-2*(n+1:m)/m]';
   endif
--- a/scripts/signal/blackman.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/blackman.m	Tue Jun 23 20:00:59 2015 -0700
@@ -60,7 +60,7 @@
   if (m == 1)
     c = 1;
   else
-    m = m - 1;
+    m -= 1;
     k = (0 : m)' / N;
     c = 0.42 - 0.5 * cos (2 * pi * k) + 0.08 * cos (4 * pi * k);
   endif
--- a/scripts/signal/freqz.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/freqz.m	Tue Jun 23 20:00:59 2015 -0700
@@ -152,7 +152,7 @@
     k = max (length (b), length (a));
     if (k > n/2 && nargout == 0)
       ## Ensure a causal phase response.
-      n = n * 2 .^ ceil (log2 (2*k/n));
+      n *= 2 .^ ceil (log2 (2*k/n));
     endif
 
     if (whole_region)
@@ -178,8 +178,8 @@
     ha = zeros (n, 1);
 
     for i = 1:N:pad_sz
-      hb = hb + fft (postpad (b(i:i+N-1), N))(1:n);
-      ha = ha + fft (postpad (a(i:i+N-1), N))(1:n);
+      hb += fft (postpad (b(i:i+N-1), N))(1:n);
+      ha += fft (postpad (a(i:i+N-1), N))(1:n);
     endfor
 
   endif
--- a/scripts/signal/hamming.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/hamming.m	Tue Jun 23 20:00:59 2015 -0700
@@ -60,7 +60,7 @@
   if (m == 1)
     c = 1;
   else
-    m = m - 1;
+    m -= 1;
     c = 0.54 - 0.46 * cos (2 * pi * (0 : m)' / N);
   endif
 
--- a/scripts/signal/hanning.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/hanning.m	Tue Jun 23 20:00:59 2015 -0700
@@ -60,7 +60,7 @@
   if (m == 1)
     c = 1;
   else
-    m = m - 1;
+    m -= 1;
     c = 0.5 - 0.5 * cos (2 * pi * (0 : m)' / N);
   endif
 
--- a/scripts/signal/spectral_adf.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/spectral_adf.m	Tue Jun 23 20:00:59 2015 -0700
@@ -60,7 +60,7 @@
     w = feval (win, cr, b);
   endif
 
-  c = c .* w;
+  c .*= w;
 
   retval = 2 * real (fft (c)) - c(1);
   retval = [(zeros (cr, 1)), retval];
--- a/scripts/signal/spectral_xdf.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/spectral_xdf.m	Tue Jun 23 20:00:59 2015 -0700
@@ -60,7 +60,7 @@
     w = feval (win, xr, b);
   endif
 
-  x = x - sum (x) / xr;
+  x -= sum (x) / xr;
 
   retval = (abs (fft (x)) / xr).^2;
   retval = real (ifft (fft (retval) .* fft (w)));
--- a/scripts/signal/stft.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/signal/stft.m	Tue Jun 23 20:00:59 2015 -0700
@@ -101,7 +101,7 @@
   start = 1;
   for i = 0:num_win
     z(1:win_size, i+1) = x(start:start+win_size-1) .* win_coef;
-    start = start + inc;
+    start += inc;
   endfor
 
   y = fft (z);
--- a/scripts/sparse/bicgstab.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/sparse/bicgstab.m	Tue Jun 23 20:00:59 2015 -0700
@@ -163,7 +163,7 @@
 
       t = Ax (shat);
       omega = (s' * t) / (t' * t);
-      x = x + alpha * phat + omega * shat;
+      x += alpha * phat + omega * shat;
       res = s - omega * t;
       rho_2 = rho_1;
 
--- a/scripts/sparse/cgs.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/sparse/cgs.m	Tue Jun 23 20:00:59 2015 -0700
@@ -147,9 +147,9 @@
       ## Cache.
       q = Ax (p);
       alpha = ro / (p' * q);
-      x = x + alpha * p;
+      x += alpha * p;
 
-      res = res - alpha * q;
+      res -= alpha * q;
       relres = norm (res) / norm_b;
       resvec = [resvec; relres];
 
--- a/scripts/sparse/private/__sprand_impl__.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/sparse/private/__sprand_impl__.m	Tue Jun 23 20:00:59 2015 -0700
@@ -135,7 +135,7 @@
           V = Vinit;
           V(i, i) = cv;  V(i, j) = sv;
           V(j, i) = -sv; V(j, j) = cv;
-          S = S * V;
+          S *= V;
         endif
       endwhile
     endif
--- a/scripts/sparse/qmr.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/sparse/qmr.m	Tue Jun 23 20:00:59 2015 -0700
@@ -181,9 +181,9 @@
     for iter=1:1:maxit
       ## If rho0 == 0 or xi1 == 0, method fails.
       v = vt / rho0;
-      y = y / rho0;
+      y /= rho0;
       w = wt / xi1;
-      z = z / xi1;
+      z /= xi1;
 
       delta1 = z' * y;   # If delta1 == 0, method fails.
 
--- a/scripts/sparse/sprandsym.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/sparse/sprandsym.m	Tue Jun 23 20:00:59 2015 -0700
@@ -41,7 +41,7 @@
     [i, j] = find (tril (n));
     [nr, nc] = size (n);
     S = sparse (i, j, randn (size (i)), nr, nc);
-    S = S + tril (S, -1)';
+    S += tril (S, -1)';
     return;
   endif
 
--- a/scripts/sparse/svds.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/sparse/svds.m	Tue Jun 23 20:00:59 2015 -0700
@@ -162,7 +162,7 @@
     b_opts.issym = true;
     b_sigma = sigma;
     if (! ischar (b_sigma))
-      b_sigma = b_sigma / max_a;
+      b_sigma /= max_a;
     endif
 
     if (b_sigma == 0)
@@ -225,7 +225,7 @@
       endif
     endif
 
-    s = s * max_a;
+    s *= max_a;
   endif
 
   if (nargout < 2)
--- a/scripts/specfun/legendre.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/specfun/legendre.m	Tue Jun 23 20:00:59 2015 -0700
@@ -192,7 +192,7 @@
       error ('legendre: NORMALIZATION option must be "unnorm", "norm", or "sch"');
   endswitch
 
-  scale = scale * ones (size (x));
+  scale *= ones (size (x));
 
   ## Based on the recurrence relation below
   ##            m                 m              m
--- a/scripts/special-matrix/gallery.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/special-matrix/gallery.m	Tue Jun 23 20:00:59 2015 -0700
@@ -595,7 +595,7 @@
       error ("gallery: unknown K '%d' for chebspec matrix.", k);
   endswitch
 
-  n = n-1;
+  n -= 1;
   C = zeros (n+1);
 
   one    = ones (n+1, 1);
@@ -773,7 +773,7 @@
     error ("gallery: K must be a numeric scalar for clement matrix.");
   endif
 
-  n = n-1;
+  n -= 1;
   x = n:-1:1;
   z = 1:n;
 
@@ -1493,13 +1493,13 @@
 
     if (k == 0)
       for i = 1:n-1
-        d = d * prod (1:i+1) * prod (1:n-i);
+        d *= prod (1:i+1) * prod (1:n-i);
       endfor
-      d = d * prod (1:n+1);
+      d *= prod (1:n+1);
 
     elseif (k == 1)
       for i = 0:n-1
-        d = d * prod (1:i) / prod (1:n+1+i);
+        d *= prod (1:i) / prod (1:n+1+i);
       endfor
       if (rem (n*(n-1)/2, 2))
         d = -d;
@@ -2218,7 +2218,7 @@
   ## If A will be a vector
   if (p == 1)
     A = randn (m, n);
-    A = A / norm (A);
+    A /= norm (A);
     return;
   endif
 
@@ -2339,7 +2339,7 @@
     error ("gallery: N must be an integer for riemann matrix.");
   endif
 
-  n = n+1;
+  n += 1;
   i = (2:n)' * ones (1, n-1);
   j = i';
   A = i .* (! rem (j, i)) - ones (n-1);
@@ -2435,7 +2435,7 @@
   E = 2*pi * ((1:n)' * ones (1, n) - ones (n, 1) * (1:n));
 
   for i = 1:m
-    T = T + w(i) * cos (theta(i)*E);
+    T += w(i) * cos (theta(i)*E);
   endfor
 endfunction
 
--- a/scripts/statistics/base/gls.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/statistics/base/gls.m	Tue Jun 23 20:00:59 2015 -0700
@@ -99,7 +99,7 @@
   endif
 
   ## Start of algorithm
-  o = o^(-1/2);
+  o ^= -1/2;
   z = kron (eye (cy), x);
   z = o * z;
   y1 = o * reshape (y, ry*cy, 1);
--- a/scripts/statistics/models/logistic_regression.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/statistics/models/logistic_regression.m	Tue Jun 23 20:00:59 2015 -0700
@@ -128,16 +128,16 @@
   ## maximize likelihood using Levenberg modified Newton's method
   iter = 0;
   while (abs (dl' * (d2l \ dl) / length (dl)) > tol)
-    iter = iter + 1;
+    iter += 1;
     tbold = tb;
     devold = dev;
     tb = tbold - d2l \ dl;
     [g, g1, p, dev] = logistic_regression_likelihood (y, x, tb, z, z1);
     if ((dev - devold) / (dl' * (tb - tbold)) < 0)
-      epsilon = epsilon / decr;
+      epsilon /= decr;
     else
       while ((dev - devold) / (dl' * (tb - tbold)) > 0)
-        epsilon = epsilon * incr;
+        epsilon *= incr;
          if (epsilon > 1e+15)
            error ("logistic_regression: epsilon too large");
          endif
--- a/scripts/statistics/tests/kruskal_wallis_test.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/statistics/tests/kruskal_wallis_test.m	Tue Jun 23 20:00:59 2015 -0700
@@ -73,7 +73,7 @@
   k = 0;
   j = 0;
   for i = 1 : m;
-    k = k + (sum (r ((j + 1) : (j + n(i))))) ^ 2 / n(i);
+    k += (sum (r ((j + 1) : (j + n(i))))) ^ 2 / n(i);
     j = j + n(i);
   endfor
 
@@ -82,7 +82,7 @@
 
   ## Adjust the result to takes ties into account.
   sum_ties = sum (polyval ([1, 0, -1, 0], runlength (sort (p))));
-  k = k / (1 - sum_ties / (n^3 - n));
+  k /= (1 - sum_ties / (n^3 - n));
 
   df = m - 1;
   pval = 1 - chi2cdf (k, df);
--- a/scripts/statistics/tests/manova.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/statistics/tests/manova.m	Tue Jun 23 20:00:59 2015 -0700
@@ -69,7 +69,7 @@
     group_label = s ([1, (reshape (i, 1, k - 1) + 1)]);
   endif
 
-  x = x - ones (n, 1) * mean (x);
+  x -= ones (n, 1) * mean (x);
   SST = x' * x;
 
   s = zeros (1, p);
@@ -77,7 +77,7 @@
   for i = 1 : k;
     v = x (find (g == group_label (i)), :);
     s = sum (v);
-    SSB = SSB + s' * s / rows (v);
+    SSB += s' * s / rows (v);
   endfor
   n_b = k - 1;
 
--- a/scripts/statistics/tests/wilcoxon_test.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/statistics/tests/wilcoxon_test.m	Tue Jun 23 20:00:59 2015 -0700
@@ -58,11 +58,11 @@
   x = reshape (x, 1, n);
   y = reshape (y, 1, n);
   d = x - y;
-  d = d (find (d != 0));
+  d = d(find (d != 0));
   n = length (d);
   if (n > 25)
     r = ranks (abs (d));
-    z = sum (r (find (d > 0)));
+    z = sum (r(find (d > 0)));
     z = ((z - n * (n + 1) / 4) / sqrt (n * (n + 1) * (2 * n + 1) / 24));
   else
     error ("wilcoxon_test: implementation requires more than 25 different pairs");
--- a/scripts/strings/cstrcat.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/strings/cstrcat.m	Tue Jun 23 20:00:59 2015 -0700
@@ -45,14 +45,16 @@
 
 function st = cstrcat (varargin)
 
-  if (nargin < 1)
-    print_usage ();
-  elseif (! iscellstr (varargin))
+  if (nargin == 0)
+    ## Special because if varargin is empty, iscellstr still returns
+    ## true but then "[varargin{:}]" would be of class double.
+    st = "";
+  elseif (iscellstr (varargin))
+    st = [varargin{:}];
+  else
     error ("cstrcat: expecting arguments to character strings");
   endif
 
-  st = [varargin{:}];
-
 endfunction
 
 
@@ -65,7 +67,8 @@
 %!assert (cstrcat ("foo", "bar"), "foobar")
 %!assert (cstrcat (["a"; "bb"], ["foo"; "bar"]), ["a foo"; "bbbar"])
 
+%!assert (cstrcat (), "")
+
 ## Test input validation
-%!error cstrcat ()
 %!error cstrcat (1, 2)
 
--- a/scripts/strings/strcat.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/strings/strcat.m	Tue Jun 23 20:00:59 2015 -0700
@@ -82,10 +82,8 @@
 function st = strcat (varargin)
 
   if (nargin == 0)
-    print_usage ();
-  endif
-
-  if (nargin == 1)
+    st = "";
+  elseif (nargin == 1)
     st = varargin{1};
   else
     ## Convert to cells of strings
@@ -149,5 +147,5 @@
 %!assert (strcat (1, 2), strcat (char (1), char (2)))
 %!assert (strcat ("", 2), strcat ([], char (2)))
 
-%!error strcat ()
+%!assert (strcat (), "")
 
--- a/scripts/testfun/private/html_compare_plot_demos.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/testfun/private/html_compare_plot_demos.m	Tue Jun 23 20:00:59 2015 -0700
@@ -113,7 +113,7 @@
           fprintf (fid, "<img src='%s' style='width: %dpx;'>", ...
                         ffn, in.column_width);
         else
-          err_fn = regexprep(ffn, ".png", ".err");
+          err_fn = strrep (ffn, ".png", ".err");
           if (! exist (err_fn, "file"))
             warning("File %s doesn't exist...", err_fn);
           else
--- a/scripts/testfun/test.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/testfun/test.m	Tue Jun 23 20:00:59 2015 -0700
@@ -609,14 +609,13 @@
           fflush (__fid);
         endif
         fprintf (__fid, "%s\n", __msg);
-        fflush (__fid);
         ## Show the variable context.
         if (! strcmp (__type, "error") && ! strcmp (__type, "testif")
             && ! all (__shared == " "))
           fputs (__fid, "shared variables ");
           eval (sprintf ("fdisp(__fid,var2struct(%s));", __shared));
-          fflush (__fid);
         endif
+        fflush (__fid);
       endif
       if (! __success && ! __isxtest)
         __all_success = false;
--- a/scripts/time/datevec.m	Tue Jun 23 09:59:54 2015 -0700
+++ b/scripts/time/datevec.m	Tue Jun 23 20:00:59 2015 -0700
@@ -183,9 +183,9 @@
     srnd = 2 .^ floor (- log2 (tmps));
     s = round (86400 * fracd .* srnd) ./ srnd;
     h = floor (s / 3600);
-    s = s - 3600 * h;
+    s -= 3600 * h;
     mi = floor (s / 60);
-    s = s - 60 * mi;
+    s -= 60 * mi;
 
   endif
 
--- a/test/Makefile.am	Tue Jun 23 09:59:54 2015 -0700
+++ b/test/Makefile.am	Tue Jun 23 20:00:59 2015 -0700
@@ -58,6 +58,7 @@
 include bug-36025/module.mk
 include bug-38236/module.mk
 include bug-38691/module.mk
+include bug-44940/module.mk
 include classdef/module.mk
 include classes/module.mk
 include class-concat/module.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-44940/bug-44940.tst	Tue Jun 23 20:00:59 2015 -0700
@@ -0,0 +1,11 @@
+%!test
+%! a = class_bug44940 ();
+%! b = a;
+%! c = a ();
+%! a.child = 100;
+%! assert (a.child, b.child)
+%! assert (a.child, c.child)
+%! c.child = 500;
+%! assert (a.child, b.child)
+%! assert (a.child, c.child)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-44940/class_bug44940.m	Tue Jun 23 20:00:59 2015 -0700
@@ -0,0 +1,5 @@
+classdef class_bug44940 < handle
+  properties
+    child
+  endproperties
+endclassdef
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-44940/module.mk	Tue Jun 23 20:00:59 2015 -0700
@@ -0,0 +1,5 @@
+bug_44940_FCN_FILES = \
+  bug-44940/bug-44940.tst \
+  bug-44940/class_bug44940.m
+
+FCN_FILES += $(bug_44940_FCN_FILES)