changeset 15043:fabc0e37ead1 gui

maint: periodic merge of default to gui
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Sat, 28 Jul 2012 12:06:34 -0400
parents 7c14e3e6fc6b (current diff) 4328e28414aa (diff)
children b7b1ffc88086
files NEWS configure.ac scripts/pkg/private/absolute_pathname.m src/DLD-FUNCTIONS/__contourc__.cc src/DLD-FUNCTIONS/__dispatch__.cc src/DLD-FUNCTIONS/__lin_interpn__.cc src/DLD-FUNCTIONS/__pchip_deriv__.cc src/DLD-FUNCTIONS/__qp__.cc src/DLD-FUNCTIONS/balance.cc src/DLD-FUNCTIONS/besselj.cc src/DLD-FUNCTIONS/betainc.cc src/DLD-FUNCTIONS/bsxfun.cc src/DLD-FUNCTIONS/cellfun.cc src/DLD-FUNCTIONS/colloc.cc src/DLD-FUNCTIONS/conv2.cc src/DLD-FUNCTIONS/daspk.cc src/DLD-FUNCTIONS/dasrt.cc src/DLD-FUNCTIONS/dassl.cc src/DLD-FUNCTIONS/det.cc src/DLD-FUNCTIONS/dlmread.cc src/DLD-FUNCTIONS/dot.cc src/DLD-FUNCTIONS/eig.cc src/DLD-FUNCTIONS/fft.cc src/DLD-FUNCTIONS/fft2.cc src/DLD-FUNCTIONS/fftn.cc src/DLD-FUNCTIONS/filter.cc src/DLD-FUNCTIONS/find.cc src/DLD-FUNCTIONS/gammainc.cc src/DLD-FUNCTIONS/gcd.cc src/DLD-FUNCTIONS/getgrent.cc src/DLD-FUNCTIONS/getpwent.cc src/DLD-FUNCTIONS/getrusage.cc src/DLD-FUNCTIONS/givens.cc src/DLD-FUNCTIONS/hess.cc src/DLD-FUNCTIONS/hex2num.cc src/DLD-FUNCTIONS/inv.cc src/DLD-FUNCTIONS/kron.cc src/DLD-FUNCTIONS/lookup.cc src/DLD-FUNCTIONS/lsode.cc src/DLD-FUNCTIONS/lu.cc src/DLD-FUNCTIONS/luinc.cc src/DLD-FUNCTIONS/matrix_type.cc src/DLD-FUNCTIONS/max.cc src/DLD-FUNCTIONS/md5sum.cc src/DLD-FUNCTIONS/mgorth.cc src/DLD-FUNCTIONS/nproc.cc src/DLD-FUNCTIONS/pinv.cc src/DLD-FUNCTIONS/quad.cc src/DLD-FUNCTIONS/quadcc.cc src/DLD-FUNCTIONS/qz.cc src/DLD-FUNCTIONS/rand.cc src/DLD-FUNCTIONS/rcond.cc src/DLD-FUNCTIONS/regexp.cc src/DLD-FUNCTIONS/schur.cc src/DLD-FUNCTIONS/spparms.cc src/DLD-FUNCTIONS/sqrtm.cc src/DLD-FUNCTIONS/str2double.cc src/DLD-FUNCTIONS/strfind.cc src/DLD-FUNCTIONS/sub2ind.cc src/DLD-FUNCTIONS/svd.cc src/DLD-FUNCTIONS/syl.cc src/DLD-FUNCTIONS/time.cc src/DLD-FUNCTIONS/tril.cc src/DLD-FUNCTIONS/typecast.cc src/symtab.h
diffstat 234 files changed, 11806 insertions(+), 3673 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS
+++ b/NEWS
@@ -79,10 +79,13 @@
 
  ** Other new functions added in 3.8.0:
 
-      betaincinv  lines         tetramesh
-      colorcube   rgbplot
-      erfcinv     shrinkfaces
-      findfigs    splinefit
+      betaincinv   erfcinv      splinefit
+      cmpermute    findfigs     tetramesh
+      cmunique     fminsearch   rgbplot     
+      colorcube    lines        shrinkfaces 
+
+ ** The default name of the Octave crash dump file is now called
+    octave-workspace instead of octave-core.
       
  ** Deprecated functions.
 
--- a/build-aux/common.mk
+++ b/build-aux/common.mk
@@ -181,6 +181,10 @@
 Z_LDFLAGS = @Z_LDFLAGS@
 Z_LIBS = @Z_LIBS@
 
+LLVM_CPPFLAGS = @LLVM_CPPFLAGS@
+LLVM_LDFLAGS = @LLVM_LDFLAGS@
+LLVM_LIBS = @LLVM_LIBS@
+
 GRAPHICS_LIBS = @GRAPHICS_LIBS@
 
 QHULL_CPPFLAGS = @QHULL_CPPFLAGS@
@@ -252,7 +256,7 @@
 DL_LIBS = @DL_LIBS@
 LIBS = @LIBS@
 
-ALL_CPPFLAGS = $(CPPFLAGS) $(HDF5_CPPFLAGS) $(Z_CPPFLAGS)
+ALL_CPPFLAGS = $(CPPFLAGS) $(HDF5_CPPFLAGS) $(Z_CPPFLAGS) $(LLVM_CPPFLAGS)
 
 SPARSE_XCPPFLAGS = \
   $(CHOLMOD_CPPFLAGS) $(UMFPACK_CPPFLAGS) \
@@ -544,6 +548,9 @@
   -e "s|%OCTAVE_CONF_MAGICK_CPPFLAGS%|\"${MAGICK_CPPFLAGS}\"|" \
   -e "s|%OCTAVE_CONF_MAGICK_LDFLAGS%|\"${MAGICK_LDFLAGS}\"|" \
   -e "s|%OCTAVE_CONF_MAGICK_LIBS%|\"${MAGICK_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_LLVM_CPPFLAGS%|\"${LLVM_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_LLVM_LDFLAGS%|\"${LLVM_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_LLVM_LIBS%|\"${LLVM_LIBS}\"|" \
   -e 's|%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%|\"@MKOCTFILE_DL_LDFLAGS@\"|' \
   -e "s|%OCTAVE_CONF_OCTAVE_LINK_DEPS%|\"${OCTAVE_LINK_DEPS}\"|" \
   -e "s|%OCTAVE_CONF_OCTAVE_LINK_OPTS%|\"${OCTAVE_LINK_OPTS}\"|" \
--- a/build-aux/mk-opts.pl
+++ b/build-aux/mk-opts.pl
@@ -513,7 +513,7 @@
 
 #include "$header"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "pr-output.h"
 
 #include "oct-obj.h"
@@ -909,11 +909,11 @@
 sub emit_options_function
 {
   print <<"_END_EMIT_OPTIONS_FUNCTION_HDR_";
-DEFUN_DLD ($OPT_FCN_NAME, args, ,
+DEFUN ($OPT_FCN_NAME, args, ,
   "-*- texinfo -*-\\n\\
-\@deftypefn  {Loadable Function} {} $OPT_FCN_NAME ()\\n\\
-\@deftypefnx {Loadable Function} {val =} $OPT_FCN_NAME (\@var{opt})\\n\\
-\@deftypefnx {Loadable Function} {} $OPT_FCN_NAME (\@var{opt}, \@var{val})\\n\\
+\@deftypefn  {Built-in Function} {} $OPT_FCN_NAME ()\\n\\
+\@deftypefnx {Built-in Function} {val =} $OPT_FCN_NAME (\@var{opt})\\n\\
+\@deftypefnx {Built-in Function} {} $OPT_FCN_NAME (\@var{opt}, \@var{val})\\n\\
 $DOC_STRING\\n\\
 \\n\\
 Options include\\n\\
--- a/configure.ac
+++ b/configure.ac
@@ -715,6 +715,96 @@
   [ZLIB library not found.  Octave will not be able to save or load compressed data files or HDF5 files.],
   [zlib.h], [gzclearerr])
 
+### Check for the llvm library
+dnl
+dnl
+dnl llvm is odd and has its own pkg-config like script. We should probably check
+dnl for existance and 
+dnl
+save_CPPFLAGS="$CPPFLAGS"
+save_CXXFLAGS="$CXXFLAGS"
+save_LIBS="$LIBS"
+save_LDFLAGS="$LDFLAGS"
+
+warn_llvm="LLVM library fails tests. JIT compilation will be disabled."
+
+AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config utility])
+
+AC_ARG_ENABLE([jit-debug],
+  AS_HELP_STRING([--enable-jit-debug], [Enable debug printing of jit IRs]))
+
+AS_IF([test "x$enable_jit_debug" = "xyes"], [
+  AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define for jit debug printing])
+])
+
+LLVM_CXXFLAGS=
+LLVM_CPPFLAGS=
+LLVM_LDFLAGS=
+LLVM_LIBS=
+
+if test "x$ac_cv_env_LLVM_CONFIG_set" = "xset"; then
+  # We use -isystem if avaiable because we do not want to see warnings in llvm
+  LLVM_INCLUDE_FLAG=-I
+  OCTAVE_CC_FLAG(-isystem ., [
+    LLVM_INCLUDE_FLAG=-isystem
+    AC_MSG_NOTICE([using -isystem for llvm headers])])
+
+  LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
+  LLVM_LIBS=`$LLVM_CONFIG --libs`
+  dnl Use -isystem so we don't get warnings from llvm headers
+  LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
+  LLVM_CXXFLAGS=
+
+  dnl
+  dnl We define some extra flags that llvm requires in order to include headers.
+  dnl Idealy we should get these from llvm-config, but llvm-config isn't very
+  dnl helpful.
+  dnl
+  CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS"
+  CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS"
+  LIBS="$LLVM_LIBS $LIBS"
+  LDFLAGS="$LLVM_LDFLAGS $LDFLAGS"
+
+  AC_LANG_PUSH(C++)
+    AC_CHECK_HEADER([llvm/LLVMContext.h], [
+      AC_MSG_CHECKING([for llvm::getGlobalContext in llvm/LLVMContext.h])
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[#include <llvm/LLVMContext.h>]],
+                           [[llvm::LLVMContext& ctx = llvm::getGlobalContext ();]])],
+          [
+           AC_MSG_RESULT([yes])
+           warn_llvm=
+           XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"
+          ],
+          [AC_MSG_RESULT([no])
+      ])
+    ])
+  AC_LANG_POP(C++)
+  
+else
+  warn_llvm="LLVM_CONFIG not set. JIT compilation will be disabled."
+fi
+
+if test -z "$warn_llvm"; then
+  AC_DEFINE(HAVE_LLVM, 1, [Define if LLVM is available])
+else
+  LLVM_CXXFLAGS=
+  LLVM_CPPFLAGS=
+  LLVM_LDFLAGS=
+  LLVM_LIBS=
+  OCTAVE_CONFIGURE_WARNING([warn_llvm])
+fi
+
+AC_SUBST(LLVM_CXXFLAGS)
+AC_SUBST(LLVM_CPPFLAGS)
+AC_SUBST(LLVM_LDFLAGS)
+AC_SUBST(LLVM_LIBS)
+
+CPPFLAGS="$save_CPPFLAGS"
+CXXFLAGS="$save_CXXFLAGS"
+LIBS="$save_LIBS"
+LDFLAGS="$save_LDFLAGS"
+
 ### Check for HDF5 library.
 
 save_CPPFLAGS="$CPPFLAGS"
@@ -2748,17 +2838,20 @@
   FFTW3F LDFLAGS:              $FFTW3F_LDFLAGS
   FFTW3F libraries:            $FFTW3F_LIBS
   fontconfig CFLAGS:           $FONTCONFIG_CFLAGS
-  fontconfig LIBS:             $FONTCONFIG_LIBS
-  FT2_CFLAGS:                  $FT2_CFLAGS
-  FT2_LIBS:                    $FT2_LIBS
+  fontconfig libraries:        $FONTCONFIG_LIBS
+  FreeType2 CFLAGS:            $FT2_CFLAGS
+  FreeType2 libraries:         $FT2_LIBS
   GLPK CPPFLAGS:               $GLPK_CPPFLAGS
   GLPK LDFLAGS:                $GLPK_LDFLAGS
   GLPK libraries:              $GLPK_LIBS
   graphics CFLAGS:             $GRAPHICS_CFLAGS
-  graphics LIBS:               $GRAPHICS_LIBS
+  graphics libraries:          $GRAPHICS_LIBS
   Magick++ CPPFLAGS:           $MAGICK_CPPFLAGS
   Magick++ LDFLAGS:            $MAGICK_LDFLAGS
   Magick++ libraries:          $MAGICK_LIBS
+  LLVM CPPFLAGS:               $LLVM_CPPFLAGS
+  LLVM LDFLAGS:                $LLVM_LDFLAGS
+  LLVM libraries:              $LLVM_LIBS
   HDF5 CPPFLAGS:               $HDF5_CPPFLAGS
   HDF5 LDFLAGS:                $HDF5_LDFLAGS
   HDF5 libraries:              $HDF5_LIBS
--- a/doc/interpreter/arith.txi
+++ b/doc/interpreter/arith.txi
@@ -309,6 +309,10 @@
 
 @DOCSTRING(pi)
 
+@c Provide a Seealso link location for these objects in the documentation
+@anchor{doc-i}
+@anchor{doc-j}
+@anchor{doc-J}
 @DOCSTRING(I)
 
 @DOCSTRING(Inf)
--- a/doc/interpreter/contrib.txi
+++ b/doc/interpreter/contrib.txi
@@ -135,7 +135,11 @@
 @section Basics of Generating a Changeset
 
 The preferable form of contribution is creating a Mercurial changeset
-and sending it via e-mail to the octave-maintainers mailing list.
+and submit it to the @uref{http://savannah.gnu.org/bugs/?group=octave, bug} or
+@uref{http://savannah.gnu.org/patch/?func=additem&group=octave, patch}
+trackers@footnote{Please use the patch tracker only for patches which add new
+features.  If you have a patch to submit that fixes a bug, you should use the
+bug tracker instead.}.
 Mercurial is the source code management system currently used to develop
 Octave.  Other forms of contributions (e.g., simple diff patches) are
 also acceptable, but they slow down the review process.  If you want to
@@ -159,15 +163,14 @@
 hg export -o ../cool.diff tip
                              # export the changeset to a diff
                              # file
-# send ../cool.diff via email
+# attach ../cool.diff to your bug report
 @end group
 @end example
 
 You may want to get familiar with Mercurial queues to manage your
 changesets.  Here is a slightly more complex example using Mercurial
 queues, where work on two unrelated changesets is done in parallel and
-one of the changesets is updated after discussion on the maintainers
-mailing list:
+one of the changesets is updated after discussion on the bug tracker:
 
 @example
 hg qnew nasty_bug            # create a new patch
@@ -178,7 +181,7 @@
                              # save again with commit message
 hg export -o ../nasty.diff tip
                              # export the patch
-# send ../nasty.diff via email
+# attach ../nasty.diff to your bug report
 hg qpop                      # undo the application of the patch
                              # and remove the changes from the
                              # source tree
@@ -188,14 +191,14 @@
                              # save the changes into the patch
 hg export -o ../doc.diff tip
                              # export the second patch
-# send ../doc.diff tip via email
+# attach ../doc.diff to your bug report
 hg qpop
-# discussion in the maintainers mailing list @dots{}
+# discussion in the bug tracker @dots{}
 hg qpush nasty_bug           # apply the patch again
 # change sources yet again @dots{}
 hg qref
 hg export -o ../nasty2.diff tip
-# send ../nasty2.diff via email
+# attach ../nasty2.diff to your bug report
 @end example
 
 @node General Guidelines
--- a/doc/interpreter/doccheck/aspell-octave.en.pws
+++ b/doc/interpreter/doccheck/aspell-octave.en.pws
@@ -450,6 +450,7 @@
 isreal
 issparse
 isvector
+iter
 ith
 iy
 Jacobian
@@ -611,6 +612,7 @@
 nd
 ndgrid
 ne
+Nelder
 neq
 Neudecker
 Neumann
--- a/doc/interpreter/image.txi
+++ b/doc/interpreter/image.txi
@@ -60,7 +60,7 @@
 @group
 I = imread ("my_input_image.img");
 J = process_my_image (I);
-imwrite ("my_output_image.img", J);
+imwrite (J, "my_output_image.img");
 @end group
 @end example
 
@@ -93,15 +93,15 @@
 @node Representing Images
 @section Representing Images
 
-In general Octave supports four different kinds of images, gray-scale
-images, RGB images, binary images, and indexed images.  A gray-scale
+In general Octave supports four different kinds of images, grayscale
+images, RGB images, binary images, and indexed images.  A grayscale
 image is represented with an M-by-N matrix in which each
 element corresponds to the intensity of a pixel.  An RGB image is
 represented with an M-by-N-by-3 array where each
 3-vector corresponds to the red, green, and blue intensities of each
 pixel.
 
-The actual meaning of the value of a pixel in a gray-scale or RGB
+The actual meaning of the value of a pixel in a grayscale or RGB
 image depends on the class of the matrix.  If the matrix is of class
 @code{double} pixel intensities are between 0 and 1, if it is of class
 @code{uint8} intensities are between 0 and 255, and if it is of class
@@ -187,6 +187,12 @@
 
 @DOCSTRING(whitebg)
 
+The following functions can be used to manipulate colormaps.
+
+@DOCSTRING(cmunique)
+
+@DOCSTRING(cmpermute)
+
 @node Plotting on top of Images
 @section Plotting on top of Images
 
--- a/doc/interpreter/io.txi
+++ b/doc/interpreter/io.txi
@@ -239,7 +239,7 @@
 
 If Octave for some reason exits unexpectedly it will by default save the
 variables available in the workspace to a file in the current directory.
-By default this file is named @samp{octave-core} and can be loaded
+By default this file is named @samp{octave-workspace} and can be loaded
 into memory with the @code{load} command.  While the default behavior
 most often is reasonable it can be changed through the following
 functions.
--- a/doc/interpreter/nonlin.txi
+++ b/doc/interpreter/nonlin.txi
@@ -172,7 +172,11 @@
 the zeroes where it crosses the x-axis.  @code{fminbnd} is designed for the
 simpler, but very common, case of a univariate function where the interval
 to search is bounded.  For unbounded minimization of a function with
-potentially many variables use @code{fminunc}.  @xref{Optimization}, for
+potentially many variables use @code{fminunc} or @code{fminsearch}.  The two
+functions use different internal algorithms and some knowledge of the objective
+function is required.  For functions which can be differentiated, @code{fminunc}
+is appropriate.  For functions with discontinuities, or for which a gradient
+search would fail, use @code{fminsearch}.  @xref{Optimization}, for
 minimization with the presence of constraint functions.  Note that searches
 can be made for maxima by simply inverting the objective function
 @tex
@@ -186,3 +190,5 @@
 
 @DOCSTRING(fminunc)
 
+@DOCSTRING(fminsearch)
+
--- a/liboctave/Array-util.cc
+++ b/liboctave/Array-util.cc
@@ -426,7 +426,7 @@
 {
   int ial = ia.length (), rhdvl = rhdv.length ();
   dim_vector rdv = dim_vector::alloc (ial);
-  bool *scalar = new bool[ial], *colon = new bool[ial];
+  bool *scalar = new bool [ial], *colon = new bool [ial];
   // Mark scalars and colons, count non-scalar indices.
   int nonsc = 0;
   bool all_colons = true;
@@ -445,7 +445,7 @@
   if (all_colons)
     {
       rdv = rhdv;
-      rdv.resize(ial, 1);
+      rdv.resize (ial, 1);
     }
   else if (nonsc == rhdvl)
     {
@@ -466,7 +466,7 @@
         {
           if (scalar[i]) continue;
           if (colon[i])
-            rdv(i) =  (j < rhdv0l) ? rhdv0(j++) : 1;
+            rdv(i) = (j < rhdv0l) ? rhdv0(j++) : 1;
         }
     }
 
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -649,7 +649,7 @@
       int i = 0;
       for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i);
       n = l - i;
-      cext = new octave_idx_type[3*n];
+      cext = new octave_idx_type [3*n];
       // Trick to avoid three allocations
       sext = cext + n;
       dext = sext + n;
@@ -723,17 +723,17 @@
 
       // FIXME -- this is for Matlab compatibility.  Matlab 2007 given
       //
-      //   b = ones(3,1)
+      //   b = ones (3,1)
       //
       // yields the following:
       //
-      //   b(zeros(0,0)) gives []
-      //   b(zeros(1,0)) gives zeros(0,1)
-      //   b(zeros(0,1)) gives zeros(0,1)
-      //   b(zeros(0,m)) gives zeros(0,m)
-      //   b(zeros(m,0)) gives zeros(m,0)
-      //   b(1:2) gives ones(2,1)
-      //   b(ones(2)) gives ones(2) etc.
+      //   b(zeros (0,0)) gives []
+      //   b(zeros (1,0)) gives zeros (0,1)
+      //   b(zeros (0,1)) gives zeros (0,1)
+      //   b(zeros (0,m)) gives zeros (0,m)
+      //   b(zeros (m,0)) gives zeros (m,0)
+      //   b(1:2) gives ones (2,1)
+      //   b(ones (2)) gives ones (2) etc.
       //
       // As you can see, the behaviour is weird, but the tests end up pretty
       // simple.  Nah, I don't want to suggest that this is ad hoc :)
@@ -2223,13 +2223,13 @@
     }
 
   // Fixup return dimensions, for Matlab compatibility.
-  // find(zeros(0,0)) -> zeros(0,0)
-  // find(zeros(1,0)) -> zeros(1,0)
-  // find(zeros(0,1)) -> zeros(0,1)
-  // find(zeros(0,X)) -> zeros(0,1)
-  // find(zeros(1,1)) -> zeros(0,0) !!!! WHY?
-  // find(zeros(0,1,0)) -> zeros(0,0)
-  // find(zeros(0,1,0,1)) -> zeros(0,0) etc
+  // find (zeros (0,0)) -> zeros (0,0)
+  // find (zeros (1,0)) -> zeros (1,0)
+  // find (zeros (0,1)) -> zeros (0,1)
+  // find (zeros (0,X)) -> zeros (0,1)
+  // find (zeros (1,1)) -> zeros (0,0) !!!! WHY?
+  // find (zeros (0,1,0)) -> zeros (0,0)
+  // find (zeros (0,1,0,1)) -> zeros (0,0) etc
 
   if ((numel () == 1 && retval.is_empty ())
       || (rows () == 0 && dims ().numel (1) == 0))
@@ -2741,7 +2741,7 @@
                   for (octave_idx_type k = 0; k < cols; k++)
                     {
                       ra_idx(1) = k;
-                      os << " " << a.elem(ra_idx);
+                      os << " " << a.elem (ra_idx);
                     }
                   os << "\n";
                 }
@@ -2753,7 +2753,7 @@
               for (octave_idx_type k = 0; k < rows; k++)
                 {
                   ra_idx(0) = k;
-                  os << " " << a.elem(ra_idx);
+                  os << " " << a.elem (ra_idx);
                 }
               break;
             }
@@ -2781,7 +2781,7 @@
                   for (octave_idx_type k = 0; k < cols; k++)
                     {
                       ra_idx(1) = k;
-                      os << " " << a.elem(ra_idx);
+                      os << " " << a.elem (ra_idx);
                     }
 
                   os << "\n";
--- a/liboctave/Array.h
+++ b/liboctave/Array.h
@@ -164,6 +164,14 @@
       return &nr;
     }
 
+protected:
+
+  // For jit support
+  Array (T *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep)
+    : dimensions (adims),
+      rep (reinterpret_cast<typename Array<T>::ArrayRep *> (arep)),
+      slice_data (sdata), slice_len (slen) {}
+
 public:
 
   // Empty ctor (0x0).
@@ -324,8 +332,8 @@
 
   // No checking, even for multiple references, ever.
 
-  T& xelem (octave_idx_type n) { return slice_data [n]; }
-  crefT xelem (octave_idx_type n) const { return slice_data [n]; }
+  T& xelem (octave_idx_type n) { return slice_data[n]; }
+  crefT xelem (octave_idx_type n) const { return slice_data[n]; }
 
   T& xelem (octave_idx_type i, octave_idx_type j) { return xelem (dim1 ()*j+i); }
   crefT xelem (octave_idx_type i, octave_idx_type j) const { return xelem (dim1 ()*j+i); }
@@ -693,6 +701,16 @@
   // supposedly equal dimensions (e.g. structs in the interpreter).
   bool optimize_dimensions (const dim_vector& dv);
 
+  // WARNING: Only call these functions from jit
+
+  int *jit_ref_count (void) { return rep->count.get (); }
+
+  T *jit_slice_data (void) const { return slice_data; }
+
+  octave_idx_type *jit_dimensions (void) const { return dimensions.to_jit (); }
+
+  void *jit_array_rep (void) const { return rep; }
+
 private:
 
   void resize2 (octave_idx_type nr, octave_idx_type nc, const T& rfv);
--- a/liboctave/CMatrix.cc
+++ b/liboctave/CMatrix.cc
@@ -1079,7 +1079,7 @@
       F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt,
                                  z.fortran_vec (), lwork, info));
 
-      lwork = static_cast<octave_idx_type> (std::real(z(0)));
+      lwork = static_cast<octave_idx_type> (std::real (z(0)));
       lwork = (lwork <  2 *nc ? 2*nc : lwork);
       z.resize (dim_vector (lwork, 1));
       Complex *pz = z.fortran_vec ();
@@ -1089,7 +1089,7 @@
       // Calculate the norm of the matrix, for later use.
       double anorm;
       if (calc_cond)
-        anorm  = retval.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+        anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
       F77_XFCN (zgetrf, ZGETRF, (nc, nc, tmp_data, nr, pipvt, info));
 
@@ -1163,7 +1163,7 @@
         }
 
       if (!mattype.is_hermitian ())
-        ret = finverse(mattype, info, rcon, force, calc_cond);
+        ret = finverse (mattype, info, rcon, force, calc_cond);
 
       if ((mattype.is_hermitian () || calc_cond) && rcon == 0.)
         ret = ComplexMatrix (rows (), columns (), Complex (octave_Inf, 0.));
@@ -1832,7 +1832,7 @@
               Array<octave_idx_type> ipvt (dim_vector (nr, 1));
               octave_idx_type *pipvt = ipvt.fortran_vec ();
 
-              if(anorm < 0.)
+              if (anorm < 0.)
                 anorm = atmp.abs ().sum ().
                   row(static_cast<octave_idx_type>(0)).max ();
 
@@ -2100,7 +2100,7 @@
           char job = 'L';
           ComplexMatrix atmp = *this;
           Complex *tmp_data = atmp.fortran_vec ();
-          anorm = atmp.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+          anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
           F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                      tmp_data, nr, info
@@ -2184,7 +2184,7 @@
 
           // Calculate the norm of the matrix, for later use.
           if (anorm < 0.)
-            anorm = atmp.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+            anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
           F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info));
 
@@ -2410,7 +2410,7 @@
 
   ComplexMatrix tmp (b);
   tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt);
-  return tmp.column(static_cast<octave_idx_type> (0));
+  return tmp.column (static_cast<octave_idx_type> (0));
 }
 
 ComplexMatrix
--- a/liboctave/CNDArray.cc
+++ b/liboctave/CNDArray.cc
@@ -240,7 +240,7 @@
           octave_quit ();
 
           for (octave_idx_type i = 0; i < npts; i++)
-            tmp[i] = elem((i + k*npts)*stride + j*dist);
+            tmp[i] = elem ((i + k*npts)*stride + j*dist);
 
           F77_FUNC (zfftf, ZFFTF) (npts, tmp, pwsave);
 
@@ -287,7 +287,7 @@
           octave_quit ();
 
           for (octave_idx_type i = 0; i < npts; i++)
-            tmp[i] = elem((i + k*npts)*stride + j*dist);
+            tmp[i] = elem ((i + k*npts)*stride + j*dist);
 
           F77_FUNC (zfftb, ZFFTB) (npts, tmp, pwsave);
 
--- a/liboctave/CSparse.cc
+++ b/liboctave/CSparse.cc
@@ -172,7 +172,7 @@
         }
     }
   for (octave_idx_type i = l; i <= a.cols (); i++)
-    cidx(i) = j;
+    cidx (i) = j;
 }
 bool
 SparseComplexMatrix::operator == (const SparseComplexMatrix& a) const
@@ -188,11 +188,11 @@
     return false;
 
   for (octave_idx_type i = 0; i < nc + 1; i++)
-    if (cidx(i) != a.cidx(i))
+    if (cidx (i) != a.cidx (i))
         return false;
 
   for (octave_idx_type i = 0; i < nz; i++)
-    if (data(i) != a.data(i) || ridx(i) != a.ridx(i))
+    if (data (i) != a.data (i) || ridx (i) != a.ridx (i))
       return false;
 
   return true;
@@ -214,19 +214,19 @@
     {
       for (octave_idx_type j = 0; j < nc; j++)
         {
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-            {
-              octave_idx_type ri = ridx(i);
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+            {
+              octave_idx_type ri = ridx (i);
 
               if (ri != j)
                 {
                   bool found = false;
 
-                  for (octave_idx_type k = cidx(ri); k < cidx(ri+1); k++)
+                  for (octave_idx_type k = cidx (ri); k < cidx (ri+1); k++)
                     {
-                      if (ridx(k) == j)
+                      if (ridx (k) == j)
                         {
-                          if (data(i) == conj(data(k)))
+                          if (data (i) == conj (data (k)))
                             found = true;
                           break;
                         }
@@ -277,9 +277,9 @@
           Complex tmp_max;
           double abs_max = octave_NaN;
           octave_idx_type idx_j = 0;
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-            {
-              if (ridx(i) != idx_j)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+            {
+              if (ridx (i) != idx_j)
                 break;
               else
                 idx_j++;
@@ -291,7 +291,7 @@
               abs_max = 0.;
             }
 
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               Complex tmp = data (i);
 
@@ -332,30 +332,30 @@
     {
       idx_arg.resize (dim_vector (nr, 1), 0);
 
-      for (octave_idx_type i = cidx(0); i < cidx(1); i++)
-        idx_arg.elem(ridx(i)) = -1;
+      for (octave_idx_type i = cidx (0); i < cidx (1); i++)
+        idx_arg.elem (ridx (i)) = -1;
 
       for (octave_idx_type j = 0; j < nc; j++)
         for (octave_idx_type i = 0; i < nr; i++)
           {
-            if (idx_arg.elem(i) != -1)
+            if (idx_arg.elem (i) != -1)
               continue;
             bool found = false;
-            for (octave_idx_type k = cidx(j); k < cidx(j+1); k++)
-              if (ridx(k) == i)
+            for (octave_idx_type k = cidx (j); k < cidx (j+1); k++)
+              if (ridx (k) == i)
                 {
                   found = true;
                   break;
                 }
 
             if (!found)
-              idx_arg.elem(i) = j;
+              idx_arg.elem (i) = j;
 
           }
 
       for (octave_idx_type j = 0; j < nc; j++)
         {
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               octave_idx_type ir = ridx (i);
               octave_idx_type ix = idx_arg.elem (ir);
@@ -363,14 +363,14 @@
 
               if (xisnan (tmp))
                 continue;
-              else if (ix == -1 || std::abs(tmp) > std::abs(elem (ir, ix)))
+              else if (ix == -1 || std::abs (tmp) > std::abs (elem (ir, ix)))
                 idx_arg.elem (ir) = j;
             }
         }
 
       octave_idx_type nel = 0;
       for (octave_idx_type j = 0; j < nr; j++)
-        if (idx_arg.elem(j) == -1 || elem (j, idx_arg.elem (j)) != 0.)
+        if (idx_arg.elem (j) == -1 || elem (j, idx_arg.elem (j)) != 0.)
           nel++;
 
       result = SparseComplexMatrix (nr, 1, nel);
@@ -432,9 +432,9 @@
           Complex tmp_min;
           double abs_min = octave_NaN;
           octave_idx_type idx_j = 0;
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-            {
-              if (ridx(i) != idx_j)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+            {
+              if (ridx (i) != idx_j)
                 break;
               else
                 idx_j++;
@@ -446,7 +446,7 @@
               abs_min = 0.;
             }
 
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               Complex tmp = data (i);
 
@@ -487,30 +487,30 @@
     {
       idx_arg.resize (dim_vector (nr, 1), 0);
 
-      for (octave_idx_type i = cidx(0); i < cidx(1); i++)
-        idx_arg.elem(ridx(i)) = -1;
+      for (octave_idx_type i = cidx (0); i < cidx (1); i++)
+        idx_arg.elem (ridx (i)) = -1;
 
       for (octave_idx_type j = 0; j < nc; j++)
         for (octave_idx_type i = 0; i < nr; i++)
           {
-            if (idx_arg.elem(i) != -1)
+            if (idx_arg.elem (i) != -1)
               continue;
             bool found = false;
-            for (octave_idx_type k = cidx(j); k < cidx(j+1); k++)
-              if (ridx(k) == i)
+            for (octave_idx_type k = cidx (j); k < cidx (j+1); k++)
+              if (ridx (k) == i)
                 {
                   found = true;
                   break;
                 }
 
             if (!found)
-              idx_arg.elem(i) = j;
+              idx_arg.elem (i) = j;
 
           }
 
       for (octave_idx_type j = 0; j < nc; j++)
         {
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               octave_idx_type ir = ridx (i);
               octave_idx_type ix = idx_arg.elem (ir);
@@ -518,14 +518,14 @@
 
               if (xisnan (tmp))
                 continue;
-              else if (ix == -1 || std::abs(tmp) < std::abs(elem (ir, ix)))
+              else if (ix == -1 || std::abs (tmp) < std::abs (elem (ir, ix)))
                 idx_arg.elem (ir) = j;
             }
         }
 
       octave_idx_type nel = 0;
       for (octave_idx_type j = 0; j < nr; j++)
-        if (idx_arg.elem(j) == -1 || elem (j, idx_arg.elem (j)) != 0.)
+        if (idx_arg.elem (j) == -1 || elem (j, idx_arg.elem (j)) != 0.)
           nel++;
 
       result = SparseComplexMatrix (nr, 1, nel);
@@ -663,7 +663,7 @@
   // retval.xcidx[1:nr] holds row entry *start* offsets for rows 0:(nr-1)
 
   for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type k = cidx(j); k < cidx(j+1); k++)
+    for (octave_idx_type k = cidx (j); k < cidx (j+1); k++)
       {
         octave_idx_type q = retval.xcidx (ridx (k) + 1)++;
         retval.xridx (q) = j;
@@ -755,7 +755,7 @@
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nr; i++)
                 {
-                  double tmp = std::abs(v[i]);
+                  double tmp = std::abs (v[i]);
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -805,8 +805,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -831,9 +831,9 @@
                       retval.change_capacity (nz2);
                     }
 
-                  retval.xcidx(i) = cx;
-                  retval.xridx(cx) = i;
-                  retval.xdata(cx) = 1.0;
+                  retval.xcidx (i) = cx;
+                  retval.xridx (cx) = i;
+                  retval.xdata (cx) = 1.0;
                   cx++;
 
                   // iterate accross columns of input matrix
@@ -841,11 +841,11 @@
                     {
                       Complex v = 0.;
                       // iterate to calculate sum
-                      octave_idx_type colXp = retval.xcidx(i);
-                      octave_idx_type colUp = cidx(j);
+                      octave_idx_type colXp = retval.xcidx (i);
+                      octave_idx_type colUp = cidx (j);
                       octave_idx_type rpX, rpU;
 
-                      if (cidx(j) == cidx(j+1))
+                      if (cidx (j) == cidx (j+1))
                         {
                           (*current_liboctave_error_handler)
                             ("division by zero");
@@ -855,8 +855,8 @@
                       do
                         {
                           octave_quit ();
-                          rpX = retval.xridx(colXp);
-                          rpU = ridx(colUp);
+                          rpX = retval.xridx (colXp);
+                          rpU = ridx (colUp);
 
                           if (rpX < rpU)
                             colXp++;
@@ -864,7 +864,7 @@
                             colUp++;
                           else
                             {
-                              v -= retval.xdata(colXp) * data(colUp);
+                              v -= retval.xdata (colXp) * data (colUp);
                               colXp++;
                               colUp++;
                             }
@@ -874,11 +874,11 @@
 
                       // get A(m,m)
                       if (typ == MatrixType::Upper)
-                        colUp = cidx(j+1) - 1;
+                        colUp = cidx (j+1) - 1;
                       else
-                        colUp = cidx(j);
-                      Complex pivot = data(colUp);
-                      if (pivot == 0. || ridx(colUp) != j)
+                        colUp = cidx (j);
+                      Complex pivot = data (colUp);
+                      if (pivot == 0. || ridx (colUp) != j)
                         {
                           (*current_liboctave_error_handler)
                             ("division by zero");
@@ -893,8 +893,8 @@
                               retval.change_capacity (nz2);
                             }
 
-                          retval.xridx(cx) = j;
-                          retval.xdata(cx) = v / pivot;
+                          retval.xridx (cx) = j;
+                          retval.xdata (cx) = v / pivot;
                           cx++;
                         }
                     }
@@ -902,11 +902,11 @@
                   // get A(m,m)
                   octave_idx_type colUp;
                   if (typ == MatrixType::Upper)
-                    colUp = cidx(i+1) - 1;
+                    colUp = cidx (i+1) - 1;
                   else
-                    colUp = cidx(i);
-                  Complex pivot = data(colUp);
-                  if (pivot == 0. || ridx(colUp) != i)
+                    colUp = cidx (i);
+                  Complex pivot = data (colUp);
+                  if (pivot == 0. || ridx (colUp) != i)
                     {
                       (*current_liboctave_error_handler) ("division by zero");
                       goto inverse_singular;
@@ -914,9 +914,9 @@
 
                   if (pivot != 1.0)
                     for (octave_idx_type j = cx_colstart; j < cx; j++)
-                      retval.xdata(j) /= pivot;
-                }
-              retval.xcidx(nr) = cx;
+                      retval.xdata (j) /= pivot;
+                }
+              retval.xcidx (nr) = cx;
               retval.maybe_compress ();
             }
           else
@@ -960,19 +960,19 @@
                       Complex v = 0.;
                       octave_idx_type jidx = perm[j];
                       // iterate to calculate sum
-                      for (octave_idx_type k = cidx(jidx);
-                           k < cidx(jidx+1); k++)
+                      for (octave_idx_type k = cidx (jidx);
+                           k < cidx (jidx+1); k++)
                         {
                           octave_quit ();
-                          v -= work[ridx(k)] * data(k);
+                          v -= work[ridx (k)] * data (k);
                         }
 
                       // get A(m,m)
                       Complex pivot;
                       if (typ == MatrixType::Permuted_Upper)
-                        pivot = data(cidx(jidx+1) - 1);
+                        pivot = data (cidx (jidx+1) - 1);
                       else
-                        pivot = data(cidx(jidx));
+                        pivot = data (cidx (jidx));
                       if (pivot == 0.)
                         {
                           (*current_liboctave_error_handler)
@@ -986,11 +986,11 @@
                   // get A(m,m)
                   octave_idx_type colUp;
                   if (typ == MatrixType::Permuted_Upper)
-                    colUp = cidx(perm[iidx]+1) - 1;
+                    colUp = cidx (perm[iidx]+1) - 1;
                   else
-                    colUp = cidx(perm[iidx]);
-
-                  Complex pivot = data(colUp);
+                    colUp = cidx (perm[iidx]);
+
+                  Complex pivot = data (colUp);
                   if (pivot == 0.)
                     {
                       (*current_liboctave_error_handler)
@@ -1013,16 +1013,16 @@
                       retval.change_capacity (nz2);
                     }
 
-                  retval.xcidx(i) = cx;
+                  retval.xcidx (i) = cx;
                   for (octave_idx_type j = iidx; j < nr; j++)
                     if (work[j] != 0.)
                       {
-                        retval.xridx(cx) = j;
-                        retval.xdata(cx++) = work[j];
+                        retval.xridx (cx) = j;
+                        retval.xdata (cx++) = work[j];
                       }
                 }
 
-              retval.xcidx(nr) = cx;
+              retval.xcidx (nr) = cx;
               retval.maybe_compress ();
             }
 
@@ -1032,9 +1032,9 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = retval.cidx(j);
-                       i < retval.cidx(j+1); i++)
-                    atmp += std::abs(retval.data(i));
+                  for (octave_idx_type i = retval.cidx (j);
+                       i < retval.cidx (j+1); i++)
+                    atmp += std::abs (retval.data (i));
                   if (atmp > ainvnorm)
                     ainvnorm = atmp;
                 }
@@ -1083,7 +1083,7 @@
               double rcond2;
               SparseMatrix Q = fact.Q ();
               SparseComplexMatrix InvL = fact.L ().transpose ().
-                tinverse(tmp_typ, info, rcond2, true, false);
+                tinverse (tmp_typ, info, rcond2, true, false);
               ret = Q * InvL.hermitian () * InvL * Q.transpose ();
             }
           else
@@ -1106,9 +1106,9 @@
           rcond = fact.rcond ();
           double rcond2;
           SparseComplexMatrix InvL = fact.L ().transpose ().
-            tinverse(tmp_typ, info, rcond2, true, false);
+            tinverse (tmp_typ, info, rcond2, true, false);
           SparseComplexMatrix InvU = fact.U ().
-            tinverse(tmp_typ, info, rcond2, true, false).transpose ();
+            tinverse (tmp_typ, info, rcond2, true, false).transpose ();
           ret = fact.Pc ().transpose () * InvU * InvL * fact.Pr ();
         }
     }
@@ -1279,7 +1279,7 @@
       if (typ == MatrixType::Diagonal ||
           typ == MatrixType::Permuted_Diagonal)
         {
-          retval.resize (nc, b.cols (), Complex(0.,0.));
+          retval.resize (nc, b.cols (), Complex (0.,0.));
           if (typ == MatrixType::Diagonal)
             for (octave_idx_type j = 0; j < b.cols (); j++)
                 for (octave_idx_type i = 0; i < nm; i++)
@@ -1287,15 +1287,15 @@
           else
             for (octave_idx_type j = 0; j < b.cols (); j++)
               for (octave_idx_type k = 0; k < nc; k++)
-                for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                  retval(k,j) = b(ridx(i),j) / data (i);
+                for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                  retval(k,j) = b(ridx (i),j) / data (i);
 
           if (calc_cond)
             {
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nm; i++)
                 {
-                  double tmp = std::abs(data(i));
+                  double tmp = std::abs (data (i));
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -1344,30 +1344,30 @@
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
 
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           if (typ == MatrixType::Diagonal)
             for (octave_idx_type j = 0; j < b.cols (); j++)
               {
-                for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
+                for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
                   {
-                    if (b.ridx(i) >= nm)
+                    if (b.ridx (i) >= nm)
                       break;
-                    retval.xridx (ii) = b.ridx(i);
-                    retval.xdata (ii++) = b.data(i) / data (b.ridx (i));
+                    retval.xridx (ii) = b.ridx (i);
+                    retval.xdata (ii++) = b.data (i) / data (b.ridx (i));
                   }
-                retval.xcidx(j+1) = ii;
+                retval.xcidx (j+1) = ii;
               }
           else
             for (octave_idx_type j = 0; j < b.cols (); j++)
               {
                 for (octave_idx_type l = 0; l < nc; l++)
-                  for (octave_idx_type i = cidx(l); i < cidx(l+1); i++)
+                  for (octave_idx_type i = cidx (l); i < cidx (l+1); i++)
                     {
                       bool found = false;
                       octave_idx_type k;
-                      for (k = b.cidx(j); k < b.cidx(j+1); k++)
-                        if (ridx(i) == b.ridx(k))
+                      for (k = b.cidx (j); k < b.cidx (j+1); k++)
+                        if (ridx (i) == b.ridx (k))
                           {
                             found = true;
                             break;
@@ -1375,10 +1375,10 @@
                       if (found)
                         {
                           retval.xridx (ii) = l;
-                          retval.xdata (ii++) = b.data(k) / data (i);
+                          retval.xdata (ii++) = b.data (k) / data (i);
                         }
                     }
-                retval.xcidx(j+1) = ii;
+                retval.xcidx (j+1) = ii;
               }
 
           if (calc_cond)
@@ -1386,7 +1386,7 @@
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nm; i++)
                 {
-                  double tmp = std::abs(data(i));
+                  double tmp = std::abs (data (i));
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -1431,7 +1431,7 @@
       if (typ == MatrixType::Diagonal ||
           typ == MatrixType::Permuted_Diagonal)
         {
-          retval.resize (nc, b.cols (), Complex(0.,0.));
+          retval.resize (nc, b.cols (), Complex (0.,0.));
           if (typ == MatrixType::Diagonal)
             for (octave_idx_type j = 0; j < b.cols (); j++)
               for (octave_idx_type i = 0; i < nm; i++)
@@ -1439,15 +1439,15 @@
           else
             for (octave_idx_type j = 0; j < b.cols (); j++)
               for (octave_idx_type k = 0; k < nc; k++)
-                for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                  retval(k,j) = b(ridx(i),j) / data (i);
+                for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                  retval(k,j) = b(ridx (i),j) / data (i);
 
           if (calc_cond)
             {
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nr; i++)
                 {
-                  double tmp = std::abs(data(i));
+                  double tmp = std::abs (data (i));
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -1496,30 +1496,30 @@
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
 
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           if (typ == MatrixType::Diagonal)
             for (octave_idx_type j = 0; j < b.cols (); j++)
               {
-                for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
+                for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
                   {
-                    if (b.ridx(i) >= nm)
+                    if (b.ridx (i) >= nm)
                       break;
-                    retval.xridx (ii) = b.ridx(i);
-                    retval.xdata (ii++) = b.data(i) / data (b.ridx (i));
+                    retval.xridx (ii) = b.ridx (i);
+                    retval.xdata (ii++) = b.data (i) / data (b.ridx (i));
                   }
-                retval.xcidx(j+1) = ii;
+                retval.xcidx (j+1) = ii;
               }
           else
             for (octave_idx_type j = 0; j < b.cols (); j++)
               {
                 for (octave_idx_type l = 0; l < nc; l++)
-                  for (octave_idx_type i = cidx(l); i < cidx(l+1); i++)
+                  for (octave_idx_type i = cidx (l); i < cidx (l+1); i++)
                     {
                       bool found = false;
                       octave_idx_type k;
-                      for (k = b.cidx(j); k < b.cidx(j+1); k++)
-                        if (ridx(i) == b.ridx(k))
+                      for (k = b.cidx (j); k < b.cidx (j+1); k++)
+                        if (ridx (i) == b.ridx (k))
                           {
                             found = true;
                             break;
@@ -1527,10 +1527,10 @@
                       if (found)
                         {
                           retval.xridx (ii) = l;
-                          retval.xdata (ii++) = b.data(k) / data (i);
+                          retval.xdata (ii++) = b.data (k) / data (i);
                         }
                     }
-                retval.xcidx(j+1) = ii;
+                retval.xcidx (j+1) = ii;
               }
 
           if (calc_cond)
@@ -1538,7 +1538,7 @@
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nm; i++)
                 {
-                  double tmp = std::abs(data(i));
+                  double tmp = std::abs (data (i));
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -1594,8 +1594,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -1620,20 +1620,20 @@
 
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(kidx+1)-1) != k ||
-                              data(cidx(kidx+1)-1) == 0.)
+                          if (ridx (cidx (kidx+1)-1) != k ||
+                              data (cidx (kidx+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(kidx+1)-1);
+                          Complex tmp = work[k] / data (cidx (kidx+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(kidx);
-                               i < cidx(kidx+1)-1; i++)
+                          for (octave_idx_type i = cidx (kidx);
+                               i < cidx (kidx+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -1658,20 +1658,20 @@
 
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(iidx+1)-1);
+                              Complex tmp = work[k] / data (cidx (iidx+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(iidx);
-                                   i < cidx(iidx+1)-1; i++)
+                              for (octave_idx_type i = cidx (iidx);
+                                   i < cidx (iidx+1)-1; i++)
                                 {
-                                  octave_idx_type idx2 = ridx(i);
-                                  work[idx2] = work[idx2] - tmp * data(i);
+                                  octave_idx_type idx2 = ridx (i);
+                                  work[idx2] = work[idx2] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -1696,19 +1696,19 @@
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k+1)-1) != k ||
-                              data(cidx(k+1)-1) == 0.)
+                          if (ridx (cidx (k+1)-1) != k ||
+                              data (cidx (k+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(k+1)-1);
+                          Complex tmp = work[k] / data (cidx (k+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -1731,20 +1731,20 @@
                         {
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(k+1)-1);
+                              Complex tmp = work[k] / data (cidx (k+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1)-1; i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1)-1; i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -1829,8 +1829,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -1839,7 +1839,7 @@
           octave_idx_type b_nc = b.cols ();
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           octave_idx_type x_nz = b_nz;
 
@@ -1856,8 +1856,8 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = nc-1; k >= 0; k--)
                     {
@@ -1865,20 +1865,20 @@
 
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(kidx+1)-1) != k ||
-                              data(cidx(kidx+1)-1) == 0.)
+                          if (ridx (cidx (kidx+1)-1) != k ||
+                              data (cidx (kidx+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(kidx+1)-1);
+                          Complex tmp = work[k] / data (cidx (kidx+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(kidx);
-                               i < cidx(kidx+1)-1; i++)
+                          for (octave_idx_type i = cidx (kidx);
+                               i < cidx (kidx+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -1901,10 +1901,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[rperm[i]] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[rperm[i]];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[rperm[i]];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -1925,20 +1925,20 @@
 
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(iidx+1)-1);
+                              Complex tmp = work[k] / data (cidx (iidx+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(iidx);
-                                   i < cidx(iidx+1)-1; i++)
+                              for (octave_idx_type i = cidx (iidx);
+                                   i < cidx (iidx+1)-1; i++)
                                 {
-                                  octave_idx_type idx2 = ridx(i);
-                                  work[idx2] = work[idx2] - tmp * data(i);
+                                  octave_idx_type idx2 = ridx (i);
+                                  work[idx2] = work[idx2] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -1955,26 +1955,26 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = nc-1; k >= 0; k--)
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k+1)-1) != k ||
-                              data(cidx(k+1)-1) == 0.)
+                          if (ridx (cidx (k+1)-1) != k ||
+                              data (cidx (k+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(k+1)-1);
+                          Complex tmp = work[k] / data (cidx (k+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -1997,10 +1997,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -2019,20 +2019,20 @@
                         {
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(k+1)-1);
+                              Complex tmp = work[k] / data (cidx (k+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1)-1; i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1)-1; i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2117,8 +2117,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -2143,20 +2143,20 @@
 
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(kidx+1)-1) != k ||
-                              data(cidx(kidx+1)-1) == 0.)
+                          if (ridx (cidx (kidx+1)-1) != k ||
+                              data (cidx (kidx+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(kidx+1)-1);
+                          Complex tmp = work[k] / data (cidx (kidx+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(kidx);
-                               i < cidx(kidx+1)-1; i++)
+                          for (octave_idx_type i = cidx (kidx);
+                               i < cidx (kidx+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2181,20 +2181,20 @@
 
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(iidx+1)-1);
+                              Complex tmp = work[k] / data (cidx (iidx+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(iidx);
-                                   i < cidx(iidx+1)-1; i++)
+                              for (octave_idx_type i = cidx (iidx);
+                                   i < cidx (iidx+1)-1; i++)
                                 {
-                                  octave_idx_type idx2 = ridx(i);
-                                  work[idx2] = work[idx2] - tmp * data(i);
+                                  octave_idx_type idx2 = ridx (i);
+                                  work[idx2] = work[idx2] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2219,19 +2219,19 @@
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k+1)-1) != k ||
-                              data(cidx(k+1)-1) == 0.)
+                          if (ridx (cidx (k+1)-1) != k ||
+                              data (cidx (k+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(k+1)-1);
+                          Complex tmp = work[k] / data (cidx (k+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2254,20 +2254,20 @@
                         {
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(k+1)-1);
+                              Complex tmp = work[k] / data (cidx (k+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1)-1; i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1)-1; i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2352,8 +2352,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -2362,7 +2362,7 @@
           octave_idx_type b_nc = b.cols ();
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           octave_idx_type x_nz = b_nz;
 
@@ -2379,8 +2379,8 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = nc-1; k >= 0; k--)
                     {
@@ -2388,20 +2388,20 @@
 
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(kidx+1)-1) != k ||
-                              data(cidx(kidx+1)-1) == 0.)
+                          if (ridx (cidx (kidx+1)-1) != k ||
+                              data (cidx (kidx+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(kidx+1)-1);
+                          Complex tmp = work[k] / data (cidx (kidx+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(kidx);
-                               i < cidx(kidx+1)-1; i++)
+                          for (octave_idx_type i = cidx (kidx);
+                               i < cidx (kidx+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2424,10 +2424,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[rperm[i]] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[rperm[i]];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[rperm[i]];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -2448,20 +2448,20 @@
 
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(iidx+1)-1);
+                              Complex tmp = work[k] / data (cidx (iidx+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(iidx);
-                                   i < cidx(iidx+1)-1; i++)
+                              for (octave_idx_type i = cidx (iidx);
+                                   i < cidx (iidx+1)-1; i++)
                                 {
-                                  octave_idx_type idx2 = ridx(i);
-                                  work[idx2] = work[idx2] - tmp * data(i);
+                                  octave_idx_type idx2 = ridx (i);
+                                  work[idx2] = work[idx2] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2478,26 +2478,26 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = nr-1; k >= 0; k--)
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k+1)-1) != k ||
-                              data(cidx(k+1)-1) == 0.)
+                          if (ridx (cidx (k+1)-1) != k ||
+                              data (cidx (k+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(k+1)-1);
+                          Complex tmp = work[k] / data (cidx (k+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2520,10 +2520,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -2542,20 +2542,20 @@
                         {
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(k+1)-1);
+                              Complex tmp = work[k] / data (cidx (k+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1)-1; i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1)-1; i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2641,8 +2641,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -2668,10 +2668,10 @@
                           octave_idx_type minr = nr;
                           octave_idx_type mini = 0;
 
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                            if (perm[ridx(i)] < minr)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                            if (perm[ridx (i)] < minr)
                               {
-                                minr = perm[ridx(i)];
+                                minr = perm[ridx (i)];
                                 mini = i;
                               }
 
@@ -2681,15 +2681,15 @@
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(mini);
+                          Complex tmp = work[k] / data (mini);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
                             {
                               if (i == mini)
                                 continue;
 
-                              octave_idx_type iidx = perm[ridx(i)];
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = perm[ridx (i)];
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2715,24 +2715,24 @@
                               octave_idx_type minr = nr;
                               octave_idx_type mini = 0;
 
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
-                                if (perm[ridx(i)] < minr)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
+                                if (perm[ridx (i)] < minr)
                                   {
-                                    minr = perm[ridx(i)];
+                                    minr = perm[ridx (i)];
                                     mini = i;
                                   }
 
-                              Complex tmp = work[k] / data(mini);
+                              Complex tmp = work[k] / data (mini);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
                                 {
                                   if (i == mini)
                                     continue;
 
-                                  octave_idx_type iidx = perm[ridx(i)];
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = perm[ridx (i)];
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
@@ -2740,7 +2740,7 @@
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2764,19 +2764,19 @@
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k)) != k ||
-                              data(cidx(k)) == 0.)
+                          if (ridx (cidx (k)) != k ||
+                              data (cidx (k)) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(k));
+                          Complex tmp = work[k] / data (cidx (k));
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k)+1; i < cidx (k+1); i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2799,20 +2799,20 @@
 
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(k));
+                              Complex tmp = work[k] / data (cidx (k));
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k)+1;
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k)+1;
+                                   i < cidx (k+1); i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2897,8 +2897,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -2907,7 +2907,7 @@
           octave_idx_type b_nc = b.cols ();
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           octave_idx_type x_nz = b_nz;
 
@@ -2920,8 +2920,8 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[perm[b.ridx(i)]] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[perm[b.ridx (i)]] = b.data (i);
 
                   for (octave_idx_type k = 0; k < nc; k++)
                     {
@@ -2930,10 +2930,10 @@
                           octave_idx_type minr = nr;
                           octave_idx_type mini = 0;
 
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                            if (perm[ridx(i)] < minr)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                            if (perm[ridx (i)] < minr)
                               {
-                                minr = perm[ridx(i)];
+                                minr = perm[ridx (i)];
                                 mini = i;
                               }
 
@@ -2943,15 +2943,15 @@
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(mini);
+                          Complex tmp = work[k] / data (mini);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
                             {
                               if (i == mini)
                                 continue;
 
-                              octave_idx_type iidx = perm[ridx(i)];
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = perm[ridx (i)];
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2974,10 +2974,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -2999,24 +2999,24 @@
                               octave_idx_type minr = nr;
                               octave_idx_type mini = 0;
 
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
-                                if (perm[ridx(i)] < minr)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
+                                if (perm[ridx (i)] < minr)
                                   {
-                                    minr = perm[ridx(i)];
+                                    minr = perm[ridx (i)];
                                     mini = i;
                                   }
 
-                              Complex tmp = work[k] / data(mini);
+                              Complex tmp = work[k] / data (mini);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
                                 {
                                   if (i == mini)
                                     continue;
 
-                                  octave_idx_type iidx = perm[ridx(i)];
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = perm[ridx (i)];
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
@@ -3024,7 +3024,7 @@
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3041,26 +3041,26 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = 0; k < nc; k++)
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k)) != k ||
-                              data(cidx(k)) == 0.)
+                          if (ridx (cidx (k)) != k ||
+                              data (cidx (k)) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(k));
+                          Complex tmp = work[k] / data (cidx (k));
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k)+1; i < cidx (k+1); i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3083,10 +3083,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -3106,20 +3106,20 @@
 
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(k));
+                              Complex tmp = work[k] / data (cidx (k));
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k)+1;
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k)+1;
+                                   i < cidx (k+1); i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3205,8 +3205,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -3232,10 +3232,10 @@
                           octave_idx_type minr = nr;
                           octave_idx_type mini = 0;
 
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                            if (perm[ridx(i)] < minr)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                            if (perm[ridx (i)] < minr)
                               {
-                                minr = perm[ridx(i)];
+                                minr = perm[ridx (i)];
                                 mini = i;
                               }
 
@@ -3245,15 +3245,15 @@
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(mini);
+                          Complex tmp = work[k] / data (mini);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
                             {
                               if (i == mini)
                                 continue;
 
-                              octave_idx_type iidx = perm[ridx(i)];
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = perm[ridx (i)];
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3279,24 +3279,24 @@
                               octave_idx_type minr = nr;
                               octave_idx_type mini = 0;
 
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
-                                if (perm[ridx(i)] < minr)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
+                                if (perm[ridx (i)] < minr)
                                   {
-                                    minr = perm[ridx(i)];
+                                    minr = perm[ridx (i)];
                                     mini = i;
                                   }
 
-                              Complex tmp = work[k] / data(mini);
+                              Complex tmp = work[k] / data (mini);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
                                 {
                                   if (i == mini)
                                     continue;
 
-                                  octave_idx_type iidx = perm[ridx(i)];
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = perm[ridx (i)];
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
@@ -3304,7 +3304,7 @@
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3330,19 +3330,19 @@
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k)) != k ||
-                              data(cidx(k)) == 0.)
+                          if (ridx (cidx (k)) != k ||
+                              data (cidx (k)) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(k));
+                          Complex tmp = work[k] / data (cidx (k));
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k)+1; i < cidx (k+1); i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3366,20 +3366,20 @@
 
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(k));
+                              Complex tmp = work[k] / data (cidx (k));
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k)+1;
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k)+1;
+                                   i < cidx (k+1); i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3464,8 +3464,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -3474,7 +3474,7 @@
           octave_idx_type b_nc = b.cols ();
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           octave_idx_type x_nz = b_nz;
 
@@ -3487,8 +3487,8 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[perm[b.ridx(i)]] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[perm[b.ridx (i)]] = b.data (i);
 
                   for (octave_idx_type k = 0; k < nc; k++)
                     {
@@ -3497,10 +3497,10 @@
                           octave_idx_type minr = nr;
                           octave_idx_type mini = 0;
 
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                            if (perm[ridx(i)] < minr)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                            if (perm[ridx (i)] < minr)
                               {
-                                minr = perm[ridx(i)];
+                                minr = perm[ridx (i)];
                                 mini = i;
                               }
 
@@ -3510,15 +3510,15 @@
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(mini);
+                          Complex tmp = work[k] / data (mini);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
                             {
                               if (i == mini)
                                 continue;
 
-                              octave_idx_type iidx = perm[ridx(i)];
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = perm[ridx (i)];
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3541,10 +3541,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -3566,24 +3566,24 @@
                               octave_idx_type minr = nr;
                               octave_idx_type mini = 0;
 
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
-                                if (perm[ridx(i)] < minr)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
+                                if (perm[ridx (i)] < minr)
                                   {
-                                    minr = perm[ridx(i)];
+                                    minr = perm[ridx (i)];
                                     mini = i;
                                   }
 
-                              Complex tmp = work[k] / data(mini);
+                              Complex tmp = work[k] / data (mini);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
                                 {
                                   if (i == mini)
                                     continue;
 
-                                  octave_idx_type iidx = perm[ridx(i)];
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = perm[ridx (i)];
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
@@ -3591,7 +3591,7 @@
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3608,26 +3608,26 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = 0; k < nc; k++)
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k)) != k ||
-                              data(cidx(k)) == 0.)
+                          if (ridx (cidx (k)) != k ||
+                              data (cidx (k)) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = work[k] / data(cidx(k));
+                          Complex tmp = work[k] / data (cidx (k));
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k)+1; i < cidx (k+1); i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3650,10 +3650,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -3673,20 +3673,20 @@
 
                           if (work[k] != 0.)
                             {
-                              Complex tmp = work[k] / data(cidx(k));
+                              Complex tmp = work[k] / data (cidx (k));
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k)+1;
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k)+1;
+                                   i < cidx (k+1); i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += std::abs(work[i]);
+                          atmp += std::abs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3771,11 +3771,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = std::real(data(ii++));
-                  DL[j] = data(ii);
+                  D[j] = std::real (data (ii++));
+                  DL[j] = data (ii);
                   ii += 2;
                 }
-              D[nc-1] = std::real(data(ii));
+              D[nc-1] = std::real (data (ii));
             }
           else
             {
@@ -3787,12 +3787,12 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = std::real(data(i));
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = std::real (data (i));
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
                   }
             }
 
@@ -3825,11 +3825,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii++);
-                  DU[j] = data(ii++);
-                }
-              D[nc-1] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii++);
+                  DU[j] = data (ii++);
+                }
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -3842,14 +3842,14 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
-                    else if (ridx(i) == j - 1)
-                      DU[j-1] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
+                    else if (ridx (i) == j - 1)
+                      DU[j-1] = data (i);
                   }
             }
 
@@ -3928,11 +3928,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii++);
-                  DU[j] = data(ii++);
-                }
-              D[nc-1] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii++);
+                  DU[j] = data (ii++);
+                }
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -3945,14 +3945,14 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
-                    else if (ridx(i) == j - 1)
-                      DU[j-1] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
+                    else if (ridx (i) == j - 1)
+                      DU[j-1] = data (i);
                   }
             }
 
@@ -3979,7 +3979,7 @@
               volatile octave_idx_type x_nz = b.nnz ();
               octave_idx_type b_nc = b.cols ();
               retval = SparseComplexMatrix (nr, b_nc, x_nz);
-              retval.xcidx(0) = 0;
+              retval.xcidx (0) = 0;
               volatile octave_idx_type ii = 0;
               rcond = 1.0;
 
@@ -3989,8 +3989,8 @@
                 {
                   for (octave_idx_type i = 0; i < nr; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   F77_XFCN (zgttrs, ZGTTRS,
                             (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -4016,10 +4016,10 @@
                   for (octave_idx_type i = 0; i < nr; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -4069,11 +4069,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = std::real(data(ii++));
-                  DL[j] = data(ii);
+                  D[j] = std::real (data (ii++));
+                  DL[j] = data (ii);
                   ii += 2;
                 }
-              D[nc-1] = std::real(data(ii));
+              D[nc-1] = std::real (data (ii));
             }
           else
             {
@@ -4085,12 +4085,12 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = std::real (data(i));
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = std::real (data (i));
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
                   }
             }
 
@@ -4124,11 +4124,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii++);
-                  DU[j] = data(ii++);
-                }
-              D[nc-1] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii++);
+                  DU[j] = data (ii++);
+                }
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -4141,14 +4141,14 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
-                    else if (ridx(i) == j - 1)
-                      DU[j-1] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
+                    else if (ridx (i) == j - 1)
+                      DU[j-1] = data (i);
                   }
             }
 
@@ -4228,11 +4228,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii++);
-                  DU[j] = data(ii++);
-                }
-              D[nc-1] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii++);
+                  DU[j] = data (ii++);
+                }
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -4245,14 +4245,14 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
-                    else if (ridx(i) == j - 1)
-                      DU[j-1] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
+                    else if (ridx (i) == j - 1)
+                      DU[j-1] = data (i);
                   }
             }
 
@@ -4286,7 +4286,7 @@
               volatile octave_idx_type ii = 0;
               retval = SparseComplexMatrix (b_nr, b_nc, x_nz);
 
-              retval.xcidx(0) = 0;
+              retval.xcidx (0) = 0;
               for (volatile octave_idx_type j = 0; j < b_nc; j++)
                 {
 
@@ -4326,11 +4326,11 @@
                   for (octave_idx_type i = 0; i < nr; i++)
                     if (Bx[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = Bx[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = Bx[i];
                       }
 
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -4383,17 +4383,17 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 octave_idx_type ri = ridx (i);
                 if (ri >= j)
-                  m_band(ri - j, j) = data(i);
+                  m_band(ri - j, j) = data (i);
               }
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
           if (calc_cond)
-            anorm = m_band.abs ().sum ().row(0).max ();
+            anorm = m_band.abs ().sum ().row (0).max ();
 
           char job = 'L';
           F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -4490,8 +4490,8 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-              m_band(ridx(i) - j + n_lower + n_upper, j) = data(i);
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+              m_band(ridx (i) - j + n_lower + n_upper, j) = data (i);
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
@@ -4500,8 +4500,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -4632,17 +4632,17 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 octave_idx_type ri = ridx (i);
                 if (ri >= j)
-                  m_band(ri - j, j) = data(i);
+                  m_band(ri - j, j) = data (i);
               }
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
           if (calc_cond)
-            anorm = m_band.abs ().sum ().row(0).max ();
+            anorm = m_band.abs ().sum ().row (0).max ();
 
           char job = 'L';
           F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -4706,7 +4706,7 @@
                   volatile octave_idx_type ii = 0;
                   retval = SparseComplexMatrix (b_nr, b_nc, x_nz);
 
-                  retval.xcidx(0) = 0;
+                  retval.xcidx (0) = 0;
                   for (volatile octave_idx_type j = 0; j < b_nc; j++)
                     {
                       for (octave_idx_type i = 0; i < b_nr; i++)
@@ -4740,11 +4740,11 @@
                                   retval.change_capacity (sz);
                                   x_nz = sz;
                                 }
-                              retval.xdata(ii) = tmp;
-                              retval.xridx(ii++) = i;
+                              retval.xdata (ii) = tmp;
+                              retval.xridx (ii++) = i;
                             }
                         }
-                      retval.xcidx(j+1) = ii;
+                      retval.xcidx (j+1) = ii;
                     }
 
                   retval.maybe_compress ();
@@ -4772,8 +4772,8 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-              m_band(ridx(i) - j + n_lower + n_upper, j) = data(i);
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+              m_band(ridx (i) - j + n_lower + n_upper, j) = data (i);
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
@@ -4782,8 +4782,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -4855,7 +4855,7 @@
                   volatile octave_idx_type x_nz = b.nnz ();
                   octave_idx_type b_nc = b.cols ();
                   retval = SparseComplexMatrix (nr, b_nc, x_nz);
-                  retval.xcidx(0) = 0;
+                  retval.xcidx (0) = 0;
                   volatile octave_idx_type ii = 0;
 
                   OCTAVE_LOCAL_BUFFER (Complex, work, nr);
@@ -4864,9 +4864,9 @@
                     {
                       for (octave_idx_type i = 0; i < nr; i++)
                         work[i] = 0.;
-                      for (octave_idx_type i = b.cidx(j);
-                           i < b.cidx(j+1); i++)
-                        work[b.ridx(i)] = b.data(i);
+                      for (octave_idx_type i = b.cidx (j);
+                           i < b.cidx (j+1); i++)
+                        work[b.ridx (i)] = b.data (i);
 
                       F77_XFCN (zgbtrs, ZGBTRS,
                                 (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -4892,10 +4892,10 @@
                       for (octave_idx_type i = 0; i < nr; i++)
                         if (work[i] != 0.)
                           {
-                            retval.xridx(ii) = i;
-                            retval.xdata(ii++) = work[i];
+                            retval.xridx (ii) = i;
+                            retval.xdata (ii++) = work[i];
                           }
-                      retval.xcidx(j+1) = ii;
+                      retval.xcidx (j+1) = ii;
                     }
 
                   retval.maybe_compress ();
@@ -4950,17 +4950,17 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 octave_idx_type ri = ridx (i);
                 if (ri >= j)
-                  m_band(ri - j, j) = data(i);
+                  m_band(ri - j, j) = data (i);
               }
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
           if (calc_cond)
-            anorm = m_band.abs ().sum ().row(0).max ();
+            anorm = m_band.abs ().sum ().row (0).max ();
 
           char job = 'L';
           F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -5057,8 +5057,8 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-              m_band(ridx(i) - j + n_lower + n_upper, j) = data(i);
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+              m_band(ridx (i) - j + n_lower + n_upper, j) = data (i);
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
@@ -5067,8 +5067,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -5196,17 +5196,17 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 octave_idx_type ri = ridx (i);
                 if (ri >= j)
-                  m_band(ri - j, j) = data(i);
+                  m_band(ri - j, j) = data (i);
               }
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
           if (calc_cond)
-            anorm = m_band.abs ().sum ().row(0).max ();
+            anorm = m_band.abs ().sum ().row (0).max ();
 
           char job = 'L';
           F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -5273,7 +5273,7 @@
                   volatile octave_idx_type ii = 0;
                   retval = SparseComplexMatrix (b_nr, b_nc, x_nz);
 
-                  retval.xcidx(0) = 0;
+                  retval.xcidx (0) = 0;
                   for (volatile octave_idx_type j = 0; j < b_nc; j++)
                     {
 
@@ -5312,11 +5312,11 @@
                       for (octave_idx_type i = 0; i < nr; i++)
                         if (Bx[i] != 0.)
                           {
-                            retval.xridx(ii) = i;
-                            retval.xdata(ii++) = Bx[i];
+                            retval.xridx (ii) = i;
+                            retval.xdata (ii++) = Bx[i];
                           }
 
-                      retval.xcidx(j+1) = ii;
+                      retval.xcidx (j+1) = ii;
                     }
 
                   retval.maybe_compress ();
@@ -5344,8 +5344,8 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-              m_band(ridx(i) - j + n_lower + n_upper, j) = data(i);
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+              m_band(ridx (i) - j + n_lower + n_upper, j) = data (i);
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
@@ -5354,8 +5354,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += std::abs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += std::abs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -5427,7 +5427,7 @@
                   volatile octave_idx_type x_nz = b.nnz ();
                   octave_idx_type b_nc = b.cols ();
                   retval = SparseComplexMatrix (nr, b_nc, x_nz);
-                  retval.xcidx(0) = 0;
+                  retval.xcidx (0) = 0;
                   volatile octave_idx_type ii = 0;
 
                   OCTAVE_LOCAL_BUFFER (Complex, Bx, nr);
@@ -5437,9 +5437,9 @@
                       for (octave_idx_type i = 0; i < nr; i++)
                         Bx[i] = 0.;
 
-                      for (octave_idx_type i = b.cidx(j);
-                           i < b.cidx(j+1); i++)
-                        Bx[b.ridx(i)] = b.data(i);
+                      for (octave_idx_type i = b.cidx (j);
+                           i < b.cidx (j+1); i++)
+                        Bx[b.ridx (i)] = b.data (i);
 
                       F77_XFCN (zgbtrs, ZGBTRS,
                                 (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -5465,10 +5465,10 @@
                       for (octave_idx_type i = 0; i < nr; i++)
                         if (Bx[i] != 0.)
                           {
-                            retval.xridx(ii) = i;
-                            retval.xdata(ii++) = Bx[i];
+                            retval.xridx (ii) = i;
+                            retval.xdata (ii++) = Bx[i];
                           }
-                      retval.xcidx(j+1) = ii;
+                      retval.xcidx (j+1) = ii;
                     }
 
                   retval.maybe_compress ();
@@ -5736,7 +5736,7 @@
                 {
                   octave_idx_type jr = j * b.rows ();
                   for (octave_idx_type i = 0; i < b.rows (); i++)
-                    retval.xelem(i,j) = static_cast<Complex *>(X->x)[jr + i];
+                    retval.xelem (i,j) = static_cast<Complex *>(X->x)[jr + i];
                 }
 
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
@@ -5990,12 +5990,12 @@
                  static_cast<octave_idx_type>(X->nzmax));
               for (octave_idx_type j = 0;
                    j <= static_cast<octave_idx_type>(X->ncol); j++)
-                retval.xcidx(j) = static_cast<octave_idx_type *>(X->p)[j];
+                retval.xcidx (j) = static_cast<octave_idx_type *>(X->p)[j];
               for (octave_idx_type j = 0;
                    j < static_cast<octave_idx_type>(X->nzmax); j++)
                 {
-                  retval.xridx(j) = static_cast<octave_idx_type *>(X->i)[j];
-                  retval.xdata(j) = static_cast<Complex *>(X->x)[j];
+                  retval.xridx (j) = static_cast<octave_idx_type *>(X->i)[j];
+                  retval.xdata (j) = static_cast<Complex *>(X->x)[j];
                 }
 
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
@@ -6050,7 +6050,7 @@
 
               OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr);
 
-              retval.xcidx(0) = 0;
+              retval.xcidx (0) = 0;
               for (octave_idx_type j = 0; j < b_nc; j++)
                 {
 
@@ -6105,11 +6105,11 @@
                               retval.change_capacity (sz);
                               x_nz = sz;
                             }
-                          retval.xdata(ii) = tmp;
-                          retval.xridx(ii++) = i;
+                          retval.xdata (ii) = tmp;
+                          retval.xridx (ii++) = i;
                         }
                     }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -6270,7 +6270,7 @@
                 {
                   octave_idx_type jr = j * b.rows ();
                   for (octave_idx_type i = 0; i < b.rows (); i++)
-                    retval.xelem(i,j) = static_cast<Complex *>(X->x)[jr + i];
+                    retval.xelem (i,j) = static_cast<Complex *>(X->x)[jr + i];
                 }
 
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
@@ -6503,12 +6503,12 @@
                  static_cast<octave_idx_type>(X->nzmax));
               for (octave_idx_type j = 0;
                    j <= static_cast<octave_idx_type>(X->ncol); j++)
-                retval.xcidx(j) = static_cast<octave_idx_type *>(X->p)[j];
+                retval.xcidx (j) = static_cast<octave_idx_type *>(X->p)[j];
               for (octave_idx_type j = 0;
                    j < static_cast<octave_idx_type>(X->nzmax); j++)
                 {
-                  retval.xridx(j) = static_cast<octave_idx_type *>(X->i)[j];
-                  retval.xdata(j) = static_cast<Complex *>(X->x)[j];
+                  retval.xridx (j) = static_cast<octave_idx_type *>(X->i)[j];
+                  retval.xdata (j) = static_cast<Complex *>(X->x)[j];
                 }
 
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
@@ -6556,7 +6556,7 @@
 
               OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr);
 
-              retval.xcidx(0) = 0;
+              retval.xcidx (0) = 0;
               for (octave_idx_type j = 0; j < b_nc; j++)
                 {
                   for (octave_idx_type i = 0; i < b_nr; i++)
@@ -6596,11 +6596,11 @@
                               retval.change_capacity (sz);
                               x_nz = sz;
                             }
-                          retval.xdata(ii) = tmp;
-                          retval.xridx(ii++) = i;
+                          retval.xdata (ii) = tmp;
+                          retval.xridx (ii++) = i;
                         }
                     }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -6694,7 +6694,7 @@
       return ComplexMatrix ();
     }
 
-  if (singular_fallback && mattype.type(false) == MatrixType::Rectangular)
+  if (singular_fallback && mattype.type (false) == MatrixType::Rectangular)
     {
       rcond = 1.;
 #ifdef USE_QRSOLVE
@@ -6762,7 +6762,7 @@
       return SparseComplexMatrix ();
     }
 
-  if (singular_fallback && mattype.type(false) == MatrixType::Rectangular)
+  if (singular_fallback && mattype.type (false) == MatrixType::Rectangular)
     {
       rcond = 1.;
 #ifdef USE_QRSOLVE
@@ -6830,7 +6830,7 @@
       return ComplexMatrix ();
     }
 
-  if (singular_fallback && mattype.type(false) == MatrixType::Rectangular)
+  if (singular_fallback && mattype.type (false) == MatrixType::Rectangular)
     {
       rcond = 1.;
 #ifdef USE_QRSOLVE
@@ -6899,7 +6899,7 @@
       return SparseComplexMatrix ();
     }
 
-  if (singular_fallback && mattype.type(false) == MatrixType::Rectangular)
+  if (singular_fallback && mattype.type (false) == MatrixType::Rectangular)
     {
       rcond = 1.;
 #ifdef USE_QRSOLVE
@@ -7177,12 +7177,12 @@
     {
       for (octave_idx_type j = 0; j < nr; j++)
         {
-          if (jj < cidx(i+1) && ridx(jj) == j)
+          if (jj < cidx (i+1) && ridx (jj) == j)
             jj++;
           else
             {
-              r.data(ii) = true;
-              r.ridx(ii++) = j;
+              r.data (ii) = true;
+              r.ridx (ii++) = j;
             }
         }
       r.cidx (i+1) = ii;
@@ -7267,8 +7267,8 @@
   if (nel == 0)
     return false;
 
-  max_val = std::real(data (0));
-  min_val = std::real(data (0));
+  max_val = std::real (data (0));
+  min_val = std::real (data (0));
 
   for (octave_idx_type i = 0; i < nel; i++)
     {
@@ -7353,7 +7353,7 @@
   else
     {
       SPARSE_REDUCTION_OP (SparseComplexMatrix, Complex, *=,
-                           (cidx(j+1) - cidx(j) < nr ? 0.0 : 1.0), 1.0);
+                           (cidx (j+1) - cidx (j) < nr ? 0.0 : 1.0), 1.0);
     }
 }
 
@@ -7368,11 +7368,11 @@
 {
 #define ROW_EXPR \
   Complex d = data (i); \
-  tmp [ridx(i)] += d * conj (d)
+  tmp[ridx (i)] += d * conj (d)
 
 #define COL_EXPR \
   Complex d = data (i); \
-  tmp [j] += d * conj (d)
+  tmp[j] += d * conj (d)
 
   SPARSE_BASE_REDUCTION_OP (SparseComplexMatrix, Complex, ROW_EXPR,
                             COL_EXPR, 0.0, 0.0);
@@ -7416,10 +7416,10 @@
    for (octave_idx_type j = 0; j < nc; j++)
      {
        octave_quit ();
-       for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
+       for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
          {
-           os << a.ridx(i) + 1 << " "  << j + 1 << " ";
-           octave_write_complex (os, a.data(i));
+           os << a.ridx (i) + 1 << " "  << j + 1 << " ";
+           octave_write_complex (os, a.data (i));
            os << "\n";
          }
      }
@@ -7640,15 +7640,15 @@
 
   EMPTY_RETURN_CHECK (SparseComplexMatrix);
 
-  if (abs(c) == 0.)
+  if (abs (c) == 0.)
     return SparseComplexMatrix (nr, nc);
   else
     {
       result = SparseComplexMatrix (m);
 
       for (octave_idx_type j = 0; j < nc; j++)
-        for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
-          result.data(i) = xmin(c, m.data(i));
+        for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
+          result.data (i) = xmin (c, m.data (i));
     }
 
   return result;
@@ -7686,38 +7686,38 @@
           r.cidx (0) = 0;
           for (octave_idx_type i = 0 ; i < a_nc ; i++)
             {
-              octave_idx_type  ja = a.cidx(i);
-              octave_idx_type  ja_max = a.cidx(i+1);
+              octave_idx_type  ja = a.cidx (i);
+              octave_idx_type  ja_max = a.cidx (i+1);
               bool ja_lt_max= ja < ja_max;
 
-              octave_idx_type  jb = b.cidx(i);
-              octave_idx_type  jb_max = b.cidx(i+1);
+              octave_idx_type  jb = b.cidx (i);
+              octave_idx_type  jb_max = b.cidx (i+1);
               bool jb_lt_max = jb < jb_max;
 
               while (ja_lt_max || jb_lt_max )
                 {
                   octave_quit ();
                   if ((! jb_lt_max) ||
-                      (ja_lt_max && (a.ridx(ja) < b.ridx(jb))))
+                      (ja_lt_max && (a.ridx (ja) < b.ridx (jb))))
                     {
-                      Complex tmp = xmin (a.data(ja), 0.);
+                      Complex tmp = xmin (a.data (ja), 0.);
                       if (tmp != 0.)
                         {
-                          r.ridx(jx) = a.ridx(ja);
-                          r.data(jx) = tmp;
+                          r.ridx (jx) = a.ridx (ja);
+                          r.data (jx) = tmp;
                           jx++;
                         }
                       ja++;
                       ja_lt_max= ja < ja_max;
                     }
                   else if (( !ja_lt_max ) ||
-                           (jb_lt_max && (b.ridx(jb) < a.ridx(ja)) ) )
+                           (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) )
                     {
-                      Complex tmp = xmin (0., b.data(jb));
+                      Complex tmp = xmin (0., b.data (jb));
                       if (tmp != 0.)
                         {
-                          r.ridx(jx) = b.ridx(jb);
-                          r.data(jx) = tmp;
+                          r.ridx (jx) = b.ridx (jb);
+                          r.data (jx) = tmp;
                           jx++;
                         }
                       jb++;
@@ -7725,11 +7725,11 @@
                     }
                   else
                     {
-                      Complex tmp = xmin (a.data(ja), b.data(jb));
+                      Complex tmp = xmin (a.data (ja), b.data (jb));
                       if (tmp != 0.)
                         {
-                          r.data(jx) = tmp;
-                          r.ridx(jx) = a.ridx(ja);
+                          r.data (jx) = tmp;
+                          r.ridx (jx) = a.ridx (ja);
                           jx++;
                         }
                       ja++;
@@ -7738,7 +7738,7 @@
                       jb_lt_max= jb < jb_max;
                     }
                 }
-              r.cidx(i+1) = jx;
+              r.cidx (i+1) = jx;
             }
 
           r.maybe_compress ();
@@ -7761,12 +7761,12 @@
   EMPTY_RETURN_CHECK (SparseComplexMatrix);
 
   // Count the number of non-zero elements
-  if (xmax(c, 0.) != 0.)
+  if (xmax (c, 0.) != 0.)
     {
       result = SparseComplexMatrix (nr, nc, c);
       for (octave_idx_type j = 0; j < nc; j++)
-        for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
-          result.xdata(m.ridx(i) + j * nr) = xmax (c, m.data(i));
+        for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
+          result.xdata (m.ridx (i) + j * nr) = xmax (c, m.data (i));
     }
   else
     result = SparseComplexMatrix (m);
@@ -7810,38 +7810,38 @@
           r.cidx (0) = 0;
           for (octave_idx_type i = 0 ; i < a_nc ; i++)
             {
-              octave_idx_type  ja = a.cidx(i);
-              octave_idx_type  ja_max = a.cidx(i+1);
+              octave_idx_type  ja = a.cidx (i);
+              octave_idx_type  ja_max = a.cidx (i+1);
               bool ja_lt_max= ja < ja_max;
 
-              octave_idx_type  jb = b.cidx(i);
-              octave_idx_type  jb_max = b.cidx(i+1);
+              octave_idx_type  jb = b.cidx (i);
+              octave_idx_type  jb_max = b.cidx (i+1);
               bool jb_lt_max = jb < jb_max;
 
               while (ja_lt_max || jb_lt_max )
                 {
                   octave_quit ();
                   if ((! jb_lt_max) ||
-                      (ja_lt_max && (a.ridx(ja) < b.ridx(jb))))
+                      (ja_lt_max && (a.ridx (ja) < b.ridx (jb))))
                     {
-                      Complex tmp = xmax (a.data(ja), 0.);
+                      Complex tmp = xmax (a.data (ja), 0.);
                       if (tmp != 0.)
                         {
-                          r.ridx(jx) = a.ridx(ja);
-                          r.data(jx) = tmp;
+                          r.ridx (jx) = a.ridx (ja);
+                          r.data (jx) = tmp;
                           jx++;
                         }
                       ja++;
                       ja_lt_max= ja < ja_max;
                     }
                   else if (( !ja_lt_max ) ||
-                           (jb_lt_max && (b.ridx(jb) < a.ridx(ja)) ) )
+                           (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) )
                     {
-                      Complex tmp = xmax (0., b.data(jb));
+                      Complex tmp = xmax (0., b.data (jb));
                       if (tmp != 0.)
                         {
-                          r.ridx(jx) = b.ridx(jb);
-                          r.data(jx) = tmp;
+                          r.ridx (jx) = b.ridx (jb);
+                          r.data (jx) = tmp;
                           jx++;
                         }
                       jb++;
@@ -7849,11 +7849,11 @@
                     }
                   else
                     {
-                      Complex tmp = xmax (a.data(ja), b.data(jb));
+                      Complex tmp = xmax (a.data (ja), b.data (jb));
                       if (tmp != 0.)
                         {
-                          r.data(jx) = tmp;
-                          r.ridx(jx) = a.ridx(ja);
+                          r.data (jx) = tmp;
+                          r.ridx (jx) = a.ridx (ja);
                           jx++;
                         }
                       ja++;
@@ -7862,7 +7862,7 @@
                       jb_lt_max= jb < jb_max;
                     }
                 }
-              r.cidx(i+1) = jx;
+              r.cidx (i+1) = jx;
             }
 
           r.maybe_compress ();
--- a/liboctave/CmplxQR.cc
+++ b/liboctave/CmplxQR.cc
@@ -469,7 +469,7 @@
 
   if (u.length () == m && v.length () == n)
     {
-      init(q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (), get_type ());
+      init (q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (), get_type ());
     }
   else
     (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
@@ -485,7 +485,7 @@
 
   if (u.rows () == m && v.rows () == n && u.cols () == v.cols ())
     {
-      init(q*r + u * v.hermitian (), get_type ());
+      init (q*r + u * v.hermitian (), get_type ());
     }
   else
     (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
--- a/liboctave/CollocWt.cc
+++ b/liboctave/CollocWt.cc
@@ -212,7 +212,7 @@
               xn1 = xp1;
             }
 
-          double zc  = 1.0;
+          double zc = 1.0;
           double z = xn / xn1;
 
           if (i != 0)
--- a/liboctave/DASPK.cc
+++ b/liboctave/DASPK.cc
@@ -83,8 +83,8 @@
 
   for (octave_idx_type i = 0; i < nn; i++)
     {
-      tmp_deriv.elem (i) = deriv [i];
-      tmp_state.elem (i) = state [i];
+      tmp_deriv.elem (i) = deriv[i];
+      tmp_state.elem (i) = state[i];
     }
 
   tmp_delta = user_fun (tmp_state, tmp_deriv, time, ires);
@@ -96,7 +96,7 @@
       else
         {
           for (octave_idx_type i = 0; i < nn; i++)
-            delta [i] = tmp_delta.elem (i);
+            delta[i] = tmp_delta.elem (i);
         }
     }
 
@@ -137,15 +137,15 @@
 
   for (octave_idx_type i = 0; i < nn; i++)
     {
-      tmp_deriv.elem (i) = deriv [i];
-      tmp_state.elem (i) = state [i];
+      tmp_deriv.elem (i) = deriv[i];
+      tmp_state.elem (i) = state[i];
     }
 
   Matrix tmp_pd = user_jac (tmp_state, tmp_deriv, time, cj);
 
   for (octave_idx_type j = 0; j < nn; j++)
     for (octave_idx_type i = 0; i < nn; i++)
-      pd [nn * j + i] = tmp_pd.elem (i, j);
+      pd[nn * j + i] = tmp_pd.elem (i, j);
 
   END_INTERRUPT_WITH_EXCEPTIONS;
 
--- a/liboctave/DASRT.cc
+++ b/liboctave/DASRT.cc
@@ -113,15 +113,15 @@
 
   for (octave_idx_type i = 0; i < nn; i++)
     {
-      tmp_deriv.elem (i) = deriv [i];
-      tmp_state.elem (i) = state [i];
+      tmp_deriv.elem (i) = deriv[i];
+      tmp_state.elem (i) = state[i];
     }
 
   Matrix tmp_pd = (*user_jsub) (tmp_state, tmp_deriv, time, cj);
 
   for (octave_idx_type j = 0; j < nn; j++)
     for (octave_idx_type i = 0; i < nn; i++)
-      pd [nn * j + i] = tmp_pd.elem (i, j);
+      pd[nn * j + i] = tmp_pd.elem (i, j);
 
   END_INTERRUPT_WITH_EXCEPTIONS;
 
--- a/liboctave/DASSL.cc
+++ b/liboctave/DASSL.cc
@@ -76,8 +76,8 @@
 
   for (octave_idx_type i = 0; i < nn; i++)
     {
-      tmp_deriv.elem (i) = deriv [i];
-      tmp_state.elem (i) = state [i];
+      tmp_deriv.elem (i) = deriv[i];
+      tmp_state.elem (i) = state[i];
     }
 
   tmp_delta = user_fun (tmp_state, tmp_deriv, time, ires);
@@ -89,7 +89,7 @@
       else
         {
           for (octave_idx_type i = 0; i < nn; i++)
-            delta [i] = tmp_delta.elem (i);
+            delta[i] = tmp_delta.elem (i);
         }
     }
 
@@ -111,15 +111,15 @@
 
   for (octave_idx_type i = 0; i < nn; i++)
     {
-      tmp_deriv.elem (i) = deriv [i];
-      tmp_state.elem (i) = state [i];
+      tmp_deriv.elem (i) = deriv[i];
+      tmp_state.elem (i) = state[i];
     }
 
   Matrix tmp_pd = user_jac (tmp_state, tmp_deriv, time, cj);
 
   for (octave_idx_type j = 0; j < nn; j++)
     for (octave_idx_type i = 0; i < nn; i++)
-      pd [nn * j + i] = tmp_pd.elem (i, j);
+      pd[nn * j + i] = tmp_pd.elem (i, j);
 
   END_INTERRUPT_WITH_EXCEPTIONS;
 
--- a/liboctave/EIG.cc
+++ b/liboctave/EIG.cc
@@ -230,8 +230,8 @@
                   return -1;
                 }
 
-              lambda.elem(j) = Complex (wr.elem(j), wi.elem(j));
-              lambda.elem(j+1) = Complex (wr.elem(j+1), wi.elem(j+1));
+              lambda.elem (j) = Complex (wr.elem (j), wi.elem (j));
+              lambda.elem (j+1) = Complex (wr.elem (j+1), wi.elem (j+1));
 
               for (octave_idx_type i = 0; i < nvr; i++)
                 {
@@ -581,10 +581,10 @@
                   return -1;
                 }
 
-              lambda.elem(j) = Complex (ar.elem(j) / beta.elem (j),
-                                        ai.elem(j) / beta.elem (j));
-              lambda.elem(j+1) = Complex (ar.elem(j+1) / beta.elem (j+1),
-                                          ai.elem(j+1) / beta.elem (j+1));
+              lambda.elem (j) = Complex (ar.elem (j) / beta.elem (j),
+                                         ai.elem (j) / beta.elem (j));
+              lambda.elem (j+1) = Complex (ar.elem (j+1) / beta.elem (j+1),
+                                           ai.elem (j+1) / beta.elem (j+1));
 
               for (octave_idx_type i = 0; i < nvr; i++)
                 {
@@ -780,7 +780,7 @@
       lambda.resize (n);
 
       for (octave_idx_type j = 0; j < n; j++)
-        lambda.elem (j) = alpha.elem (j) / beta.elem(j);
+        lambda.elem (j) = alpha.elem (j) / beta.elem (j);
 
       v = vtmp;
     }
--- a/liboctave/LSODE.cc
+++ b/liboctave/LSODE.cc
@@ -79,7 +79,7 @@
   else
     {
       for (octave_idx_type i = 0; i < neq; i++)
-        deriv [i] = tmp_deriv.elem (i);
+        deriv[i] = tmp_deriv.elem (i);
     }
 
   END_INTERRUPT_WITH_EXCEPTIONS;
@@ -103,7 +103,7 @@
 
   for (octave_idx_type j = 0; j < neq; j++)
     for (octave_idx_type i = 0; i < neq; i++)
-      pd [nrowpd * j + i] = tmp_jac (i, j);
+      pd[nrowpd * j + i] = tmp_jac (i, j);
 
   END_INTERRUPT_WITH_EXCEPTIONS;
 
--- a/liboctave/MArray.h
+++ b/liboctave/MArray.h
@@ -39,6 +39,12 @@
 class
 MArray : public Array<T>
 {
+protected:
+
+  // For jit support
+  MArray (T *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep)
+    : Array<T> (sdata, slen, adims, arep) { }
+
 public:
 
   MArray (void) : Array<T> () {}
--- a/liboctave/MSparse.cc
+++ b/liboctave/MSparse.cc
@@ -60,41 +60,41 @@
         octave_idx_type jx = 0;
         for (octave_idx_type i = 0 ; i < a_nc ; i++)
           {
-            octave_idx_type  ja = a.cidx(i);
-            octave_idx_type  ja_max = a.cidx(i+1);
+            octave_idx_type  ja = a.cidx (i);
+            octave_idx_type  ja_max = a.cidx (i+1);
             bool ja_lt_max= ja < ja_max;
 
-            octave_idx_type  jb = b.cidx(i);
-            octave_idx_type  jb_max = b.cidx(i+1);
+            octave_idx_type  jb = b.cidx (i);
+            octave_idx_type  jb_max = b.cidx (i+1);
             bool jb_lt_max = jb < jb_max;
 
             while (ja_lt_max || jb_lt_max )
               {
                 octave_quit ();
                 if ((! jb_lt_max) ||
-                      (ja_lt_max && (a.ridx(ja) < b.ridx(jb))))
+                      (ja_lt_max && (a.ridx (ja) < b.ridx (jb))))
                   {
-                    r.ridx(jx) = a.ridx(ja);
-                    r.data(jx) = op (a.data(ja), 0.);
+                    r.ridx (jx) = a.ridx (ja);
+                    r.data (jx) = op (a.data (ja), 0.);
                     jx++;
                     ja++;
                     ja_lt_max= ja < ja_max;
                   }
                 else if (( !ja_lt_max ) ||
-                     (jb_lt_max && (b.ridx(jb) < a.ridx(ja)) ) )
+                     (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) )
                   {
-                    r.ridx(jx) = b.ridx(jb);
-                    r.data(jx) = op (0., b.data(jb));
+                    r.ridx (jx) = b.ridx (jb);
+                    r.data (jx) = op (0., b.data (jb));
                     jx++;
                     jb++;
                     jb_lt_max= jb < jb_max;
                   }
                 else
                   {
-                     if (op (a.data(ja), b.data(jb)) != 0.)
+                     if (op (a.data (ja), b.data (jb)) != 0.)
                        {
-                          r.data(jx) = op (a.data(ja), b.data(jb));
-                          r.ridx(jx) = a.ridx(ja);
+                          r.data (jx) = op (a.data (ja), b.data (jb));
+                          r.ridx (jx) = a.ridx (ja);
                           jx++;
                        }
                      ja++;
@@ -103,7 +103,7 @@
                      jb_lt_max= jb < jb_max;
                   }
               }
-            r.cidx(i+1) = jx;
+            r.cidx (i+1) = jx;
           }
 
         a = r.maybe_compress ();
@@ -139,7 +139,7 @@
   MArray<T> r (dim_vector (nr, nc), op (0.0, s));
 
   for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
+    for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
       r.elem (a.ridx (i), j) = op (a.data (i), s);
   return r;
 }
@@ -171,11 +171,11 @@
 
   for (octave_idx_type i = 0; i < nz; i++)
     {
-      r.data(i) = op (a.data(i), s);
-      r.ridx(i) = a.ridx(i);
+      r.data (i) = op (a.data (i), s);
+      r.ridx (i) = a.ridx (i);
     }
   for (octave_idx_type i = 0; i < nc + 1; i++)
-    r.cidx(i) = a.cidx(i);
+    r.cidx (i) = a.cidx (i);
   r.maybe_compress (true);
   return r;
 }
@@ -207,7 +207,7 @@
   MArray<T> r (dim_vector (nr, nc), op (s, 0.0));
 
   for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
+    for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
       r.elem (a.ridx (i), j) = op (s, a.data (i));
   return r;
 }
@@ -238,11 +238,11 @@
 
   for (octave_idx_type i = 0; i < nz; i++)
     {
-      r.data(i) = op (s, a.data(i));
-      r.ridx(i) = a.ridx(i);
+      r.data (i) = op (s, a.data (i));
+      r.ridx (i) = a.ridx (i);
     }
   for (octave_idx_type i = 0; i < nc + 1; i++)
-    r.cidx(i) = a.cidx(i);
+    r.cidx (i) = a.cidx (i);
   r.maybe_compress (true);
   return r;
 }
@@ -279,23 +279,23 @@
 
   if (a_nr == 1 && a_nc == 1)
     {
-      if (a.elem(0,0) == 0.)
+      if (a.elem (0,0) == 0.)
         if (negate)
           r = -MSparse<T> (b);
         else
           r = MSparse<T> (b);
       else
         {
-          r = MSparse<T> (b_nr, b_nc, op (a.data(0), 0.));
+          r = MSparse<T> (b_nr, b_nc, op (a.data (0), 0.));
 
           for (octave_idx_type j = 0 ; j < b_nc ; j++)
             {
               octave_quit ();
               octave_idx_type idxj = j * b_nr;
-              for (octave_idx_type i = b.cidx(j) ; i < b.cidx(j+1) ; i++)
+              for (octave_idx_type i = b.cidx (j) ; i < b.cidx (j+1) ; i++)
                 {
                   octave_quit ();
-                  r.data(idxj + b.ridx(i)) = op (a.data(0), b.data(i));
+                  r.data (idxj + b.ridx (i)) = op (a.data (0), b.data (i));
                 }
             }
           r.maybe_compress ();
@@ -303,20 +303,20 @@
     }
   else if (b_nr == 1 && b_nc == 1)
     {
-      if (b.elem(0,0) == 0.)
+      if (b.elem (0,0) == 0.)
         r = MSparse<T> (a);
       else
         {
-          r = MSparse<T> (a_nr, a_nc, op (0.0, b.data(0)));
+          r = MSparse<T> (a_nr, a_nc, op (0.0, b.data (0)));
 
           for (octave_idx_type j = 0 ; j < a_nc ; j++)
             {
               octave_quit ();
               octave_idx_type idxj = j * a_nr;
-              for (octave_idx_type i = a.cidx(j) ; i < a.cidx(j+1) ; i++)
+              for (octave_idx_type i = a.cidx (j) ; i < a.cidx (j+1) ; i++)
                 {
                   octave_quit ();
-                  r.data(idxj + a.ridx(i)) = op (a.data(i), b.data(0));
+                  r.data (idxj + a.ridx (i)) = op (a.data (i), b.data (0));
                 }
             }
           r.maybe_compress ();
@@ -332,41 +332,41 @@
       r.cidx (0) = 0;
       for (octave_idx_type i = 0 ; i < a_nc ; i++)
         {
-          octave_idx_type  ja = a.cidx(i);
-          octave_idx_type  ja_max = a.cidx(i+1);
+          octave_idx_type  ja = a.cidx (i);
+          octave_idx_type  ja_max = a.cidx (i+1);
           bool ja_lt_max= ja < ja_max;
 
-          octave_idx_type  jb = b.cidx(i);
-          octave_idx_type  jb_max = b.cidx(i+1);
+          octave_idx_type  jb = b.cidx (i);
+          octave_idx_type  jb_max = b.cidx (i+1);
           bool jb_lt_max = jb < jb_max;
 
           while (ja_lt_max || jb_lt_max )
             {
               octave_quit ();
               if ((! jb_lt_max) ||
-                  (ja_lt_max && (a.ridx(ja) < b.ridx(jb))))
+                  (ja_lt_max && (a.ridx (ja) < b.ridx (jb))))
                 {
-                  r.ridx(jx) = a.ridx(ja);
-                  r.data(jx) = op (a.data(ja), 0.);
+                  r.ridx (jx) = a.ridx (ja);
+                  r.data (jx) = op (a.data (ja), 0.);
                   jx++;
                   ja++;
                   ja_lt_max= ja < ja_max;
                 }
               else if (( !ja_lt_max ) ||
-                       (jb_lt_max && (b.ridx(jb) < a.ridx(ja)) ) )
+                       (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) )
                 {
-                  r.ridx(jx) = b.ridx(jb);
-                  r.data(jx) = op (0.,  b.data(jb));
+                  r.ridx (jx) = b.ridx (jb);
+                  r.data (jx) = op (0.,  b.data (jb));
                   jx++;
                   jb++;
                   jb_lt_max= jb < jb_max;
                 }
               else
                 {
-                  if (op (a.data(ja), b.data(jb)) != 0.)
+                  if (op (a.data (ja), b.data (jb)) != 0.)
                     {
-                      r.data(jx) = op (a.data(ja), b.data(jb));
-                      r.ridx(jx) = a.ridx(ja);
+                      r.data (jx) = op (a.data (ja), b.data (jb));
+                      r.ridx (jx) = a.ridx (ja);
                       jx++;
                     }
                   ja++;
@@ -375,7 +375,7 @@
                   jb_lt_max= jb < jb_max;
                 }
             }
-          r.cidx(i+1) = jx;
+          r.cidx (i+1) = jx;
         }
 
       r.maybe_compress ();
@@ -412,7 +412,7 @@
 
   if (a_nr == 1 && a_nc == 1)
     {
-      if (a.elem(0,0) == 0.)
+      if (a.elem (0,0) == 0.)
         r = MSparse<T> (b_nr, b_nc);
       else
         {
@@ -422,14 +422,14 @@
           for (octave_idx_type i = 0 ; i < b_nnz ; i++)
             {
               octave_quit ();
-              r.data (i) = a.data(0) * r.data(i);
+              r.data (i) = a.data (0) * r.data (i);
             }
           r.maybe_compress ();
         }
     }
   else if (b_nr == 1 && b_nc == 1)
     {
-      if (b.elem(0,0) == 0.)
+      if (b.elem (0,0) == 0.)
         r = MSparse<T> (a_nr, a_nc);
       else
         {
@@ -439,7 +439,7 @@
           for (octave_idx_type i = 0 ; i < a_nnz ; i++)
             {
               octave_quit ();
-              r.data (i) = r.data(i) * b.data(0);
+              r.data (i) = r.data (i) * b.data (0);
             }
           r.maybe_compress ();
         }
@@ -454,40 +454,40 @@
       r.cidx (0) = 0;
       for (octave_idx_type i = 0 ; i < a_nc ; i++)
         {
-          octave_idx_type  ja = a.cidx(i);
-          octave_idx_type  ja_max = a.cidx(i+1);
+          octave_idx_type  ja = a.cidx (i);
+          octave_idx_type  ja_max = a.cidx (i+1);
           bool ja_lt_max= ja < ja_max;
 
-          octave_idx_type  jb = b.cidx(i);
-          octave_idx_type  jb_max = b.cidx(i+1);
+          octave_idx_type  jb = b.cidx (i);
+          octave_idx_type  jb_max = b.cidx (i+1);
           bool jb_lt_max = jb < jb_max;
 
           while (ja_lt_max || jb_lt_max )
             {
               octave_quit ();
               if ((! jb_lt_max) ||
-                  (ja_lt_max && (a.ridx(ja) < b.ridx(jb))))
+                  (ja_lt_max && (a.ridx (ja) < b.ridx (jb))))
                 {
                   ja++; ja_lt_max= ja < ja_max;
                 }
               else if (( !ja_lt_max ) ||
-                       (jb_lt_max && (b.ridx(jb) < a.ridx(ja)) ) )
+                       (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) )
                 {
                   jb++; jb_lt_max= jb < jb_max;
                 }
               else
                 {
-                  if ((a.data(ja) * b.data(jb)) != 0.)
+                  if ((a.data (ja) * b.data (jb)) != 0.)
                     {
-                      r.data(jx) = a.data(ja) * b.data(jb);
-                      r.ridx(jx) = a.ridx(ja);
+                      r.data (jx) = a.data (ja) * b.data (jb);
+                      r.ridx (jx) = a.ridx (ja);
                       jx++;
                     }
                   ja++; ja_lt_max= ja < ja_max;
                   jb++; jb_lt_max= jb < jb_max;
                 }
             }
-          r.cidx(i+1) = jx;
+          r.cidx (i+1) = jx;
         }
 
       r.maybe_compress ();
@@ -518,7 +518,7 @@
           octave_idx_type b_nnz = b.nnz ();
           r = MSparse<T> (b);
           for (octave_idx_type i = 0 ; i < b_nnz ; i++)
-            r.data (i) = val / r.data(i);
+            r.data (i) = val / r.data (i);
           r.maybe_compress ();
         }
       else
@@ -528,10 +528,10 @@
             {
               octave_quit ();
               octave_idx_type idxj = j * b_nr;
-              for (octave_idx_type i = b.cidx(j) ; i < b.cidx(j+1) ; i++)
+              for (octave_idx_type i = b.cidx (j) ; i < b.cidx (j+1) ; i++)
                 {
                   octave_quit ();
-                  r.data(idxj + b.ridx(i)) = val / b.data(i);
+                  r.data (idxj + b.ridx (i)) = val / b.data (i);
                 }
             }
           r.maybe_compress ();
@@ -546,7 +546,7 @@
           octave_idx_type a_nnz = a.nnz ();
           r = MSparse<T> (a);
           for (octave_idx_type i = 0 ; i < a_nnz ; i++)
-            r.data (i) = r.data(i) / val;
+            r.data (i) = r.data (i) / val;
           r.maybe_compress ();
         }
       else
@@ -556,10 +556,10 @@
             {
               octave_quit ();
               octave_idx_type idxj = j * a_nr;
-              for (octave_idx_type i = a.cidx(j) ; i < a.cidx(j+1) ; i++)
+              for (octave_idx_type i = a.cidx (j) ; i < a.cidx (j+1) ; i++)
                 {
                   octave_quit ();
-                  r.data(idxj + a.ridx(i)) = a.data(i) / val;
+                  r.data (idxj + a.ridx (i)) = a.data (i) / val;
                 }
             }
           r.maybe_compress ();
@@ -573,32 +573,32 @@
 
       for (octave_idx_type i = 0 ; i < a_nc ; i++)
         {
-          octave_idx_type  ja = a.cidx(i);
-          octave_idx_type  ja_max = a.cidx(i+1);
+          octave_idx_type  ja = a.cidx (i);
+          octave_idx_type  ja_max = a.cidx (i+1);
           bool ja_lt_max= ja < ja_max;
 
-          octave_idx_type  jb = b.cidx(i);
-          octave_idx_type  jb_max = b.cidx(i+1);
+          octave_idx_type  jb = b.cidx (i);
+          octave_idx_type  jb_max = b.cidx (i+1);
           bool jb_lt_max = jb < jb_max;
 
           while (ja_lt_max || jb_lt_max )
             {
               octave_quit ();
               if ((! jb_lt_max) ||
-                  (ja_lt_max && (a.ridx(ja) < b.ridx(jb))))
+                  (ja_lt_max && (a.ridx (ja) < b.ridx (jb))))
                 {
-                  r.elem (a.ridx(ja),i) = a.data(ja) / Zero;
+                  r.elem (a.ridx (ja),i) = a.data (ja) / Zero;
                   ja++; ja_lt_max= ja < ja_max;
                 }
               else if (( !ja_lt_max ) ||
-                       (jb_lt_max && (b.ridx(jb) < a.ridx(ja)) ) )
+                       (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) )
                 {
-                  r.elem (b.ridx(jb),i) = Zero / b.data(jb);
+                  r.elem (b.ridx (jb),i) = Zero / b.data (jb);
                   jb++; jb_lt_max= jb < jb_max;
                 }
               else
                 {
-                  r.elem (a.ridx(ja),i) = a.data(ja) / b.data(jb);
+                  r.elem (a.ridx (ja),i) = a.data (ja) / b.data (jb);
                   ja++; ja_lt_max= ja < ja_max;
                   jb++; jb_lt_max= jb < jb_max;
                 }
@@ -629,6 +629,6 @@
   MSparse<T> retval (a);
   octave_idx_type nz = a.nnz ();
   for (octave_idx_type i = 0; i < nz; i++)
-    retval.data(i) = - retval.data(i);
+    retval.data (i) = - retval.data (i);
   return retval;
 }
--- a/liboctave/MatrixType.cc
+++ b/liboctave/MatrixType.cc
@@ -74,7 +74,7 @@
       bool hermitian = true;
 
       // do the checks for lower/upper/hermitian all in one pass.
-      OCTAVE_LOCAL_BUFFER(T, diag, ncols);
+      OCTAVE_LOCAL_BUFFER (T, diag, ncols);
 
       for (octave_idx_type j = 0;
            j < ncols && upper; j++)
@@ -132,7 +132,7 @@
       bool hermitian = true;
 
       // do the checks for lower/upper/hermitian all in one pass.
-      OCTAVE_LOCAL_BUFFER(T, diag, ncols);
+      OCTAVE_LOCAL_BUFFER (T, diag, ncols);
 
       for (octave_idx_type j = 0;
            j < ncols && upper; j++)
@@ -231,12 +231,12 @@
       // Maybe the matrix is diagonal
       for (i = 0; i < nm; i++)
         {
-          if (a.cidx(i+1) != a.cidx(i) + 1)
+          if (a.cidx (i+1) != a.cidx (i) + 1)
             {
               tmp_typ = MatrixType::Full;
               break;
             }
-          if (a.ridx(i) != i)
+          if (a.ridx (i) != i)
             {
               tmp_typ = MatrixType::Permuted_Diagonal;
               break;
@@ -248,19 +248,19 @@
           std::vector<bool> found (nrows);
 
           for (octave_idx_type j = 0; j < i; j++)
-            found [j] = true;
+            found[j] = true;
           for (octave_idx_type j = i; j < nrows; j++)
-            found [j] = false;
+            found[j] = false;
 
           for (octave_idx_type j = i; j < nm; j++)
             {
-              if ((a.cidx(j+1) > a.cidx(j) + 1)  ||
-                  ((a.cidx(j+1) == a.cidx(j) + 1) && found [a.ridx(j)]))
+              if ((a.cidx (j+1) > a.cidx (j) + 1)  ||
+                  ((a.cidx (j+1) == a.cidx (j) + 1) && found[a.ridx (j)]))
                 {
                   tmp_typ = MatrixType::Full;
                   break;
                 }
-              found [a.ridx(j)] = true;
+              found[a.ridx (j)] = true;
             }
         }
       typ = tmp_typ;
@@ -278,8 +278,8 @@
           if (j < nrows)
             {
               zero_on_diagonal = true;
-              for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
-                if (a.ridx(i) == j)
+              for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
+                if (a.ridx (i) == j)
                   {
                     zero_on_diagonal = false;
                     break;
@@ -292,10 +292,10 @@
               break;
             }
 
-          if (a.cidx(j+1) != a.cidx(j))
+          if (a.cidx (j+1) != a.cidx (j))
             {
-              octave_idx_type ru = a.ridx(a.cidx(j));
-              octave_idx_type rl = a.ridx(a.cidx(j+1)-1);
+              octave_idx_type ru = a.ridx (a.cidx (j));
+              octave_idx_type rl = a.ridx (a.cidx (j+1)-1);
 
               if (j - ru > upper_band)
                 upper_band = j - ru;
@@ -351,7 +351,7 @@
           perm = new octave_idx_type [ncols];
 
           for (octave_idx_type i = 0; i < ncols; i++)
-            perm [i] = -1;
+            perm[i] = -1;
 
           for (octave_idx_type i = 0; i < nm; i++)
             {
@@ -359,10 +359,10 @@
 
               for (octave_idx_type j = 0; j < ncols; j++)
                 {
-                  if ((a.cidx(j+1) - a.cidx(j)) > 0 &&
-                      (a.ridx(a.cidx(j+1)-1) == i))
+                  if ((a.cidx (j+1) - a.cidx (j)) > 0 &&
+                      (a.ridx (a.cidx (j+1)-1) == i))
                     {
-                      perm [i] = j;
+                      perm[i] = j;
                       found = true;
                       break;
                     }
@@ -379,11 +379,11 @@
                 {
                   octave_idx_type k = nrows;
                   for (octave_idx_type i = 0; i < ncols; i++)
-                    if (perm [i] == -1)
+                    if (perm[i] == -1)
                       perm[i] = k++;
                 }
             }
-          else if (a.cidx(nm) == a.cidx(ncols))
+          else if (a.cidx (nm) == a.cidx (ncols))
             {
               nperm = nrows;
               delete [] perm;
@@ -392,13 +392,13 @@
 
               for (octave_idx_type i = 0; i < nrows; i++)
                 {
-                  perm [i] = -1;
-                  tmp [i] = -1;
+                  perm[i] = -1;
+                  tmp[i] = -1;
                 }
 
               for (octave_idx_type j = 0; j < ncols; j++)
-                for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
-                    perm [a.ridx(i)] = j;
+                for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
+                    perm[a.ridx (i)] = j;
 
               found = true;
               for (octave_idx_type i = 0; i < nm; i++)
@@ -478,11 +478,11 @@
           for (octave_idx_type j = 0; is_herm && j < ncols; j++)
             {
               is_herm = false;
-              for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
+              for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
                 {
-                  if (a.ridx(i) == j)
+                  if (a.ridx (i) == j)
                     {
-                      double d = a.data(i);
+                      double d = a.data (i);
                       is_herm = d > 0.;
                       diag(j) = d;
                       break;
@@ -494,20 +494,20 @@
           // next, check symmetry and 2x2 positiveness
 
           for (octave_idx_type j = 0; is_herm && j < ncols; j++)
-            for (octave_idx_type i = a.cidx(j); is_herm && i < a.cidx(j+1); i++)
+            for (octave_idx_type i = a.cidx (j); is_herm && i < a.cidx (j+1); i++)
               {
-                octave_idx_type k = a.ridx(i);
+                octave_idx_type k = a.ridx (i);
                 is_herm = k == j;
                 if (is_herm)
                   continue;
-                double d = a.data(i);
+                double d = a.data (i);
                 if (d*d < diag(j)*diag(k))
                   {
-                    for (octave_idx_type l = a.cidx(k); l < a.cidx(k+1); l++)
+                    for (octave_idx_type l = a.cidx (k); l < a.cidx (k+1); l++)
                       {
-                        if (a.ridx(l) == j)
+                        if (a.ridx (l) == j)
                           {
-                            is_herm = a.data(l) == d;
+                            is_herm = a.data (l) == d;
                             break;
                           }
                       }
@@ -552,12 +552,12 @@
       // Maybe the matrix is diagonal
       for (i = 0; i < nm; i++)
         {
-          if (a.cidx(i+1) != a.cidx(i) + 1)
+          if (a.cidx (i+1) != a.cidx (i) + 1)
             {
               tmp_typ = MatrixType::Full;
               break;
             }
-          if (a.ridx(i) != i)
+          if (a.ridx (i) != i)
             {
               tmp_typ = MatrixType::Permuted_Diagonal;
               break;
@@ -569,19 +569,19 @@
           std::vector<bool> found (nrows);
 
           for (octave_idx_type j = 0; j < i; j++)
-            found [j] = true;
+            found[j] = true;
           for (octave_idx_type j = i; j < nrows; j++)
-            found [j] = false;
+            found[j] = false;
 
           for (octave_idx_type j = i; j < nm; j++)
             {
-              if ((a.cidx(j+1) > a.cidx(j) + 1)  ||
-                  ((a.cidx(j+1) == a.cidx(j) + 1) && found [a.ridx(j)]))
+              if ((a.cidx (j+1) > a.cidx (j) + 1)  ||
+                  ((a.cidx (j+1) == a.cidx (j) + 1) && found[a.ridx (j)]))
                 {
                   tmp_typ = MatrixType::Full;
                   break;
                 }
-              found [a.ridx(j)] = true;
+              found[a.ridx (j)] = true;
             }
         }
       typ = tmp_typ;
@@ -599,8 +599,8 @@
           if (j < nrows)
             {
               zero_on_diagonal = true;
-              for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
-                if (a.ridx(i) == j)
+              for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
+                if (a.ridx (i) == j)
                   {
                     zero_on_diagonal = false;
                     break;
@@ -613,10 +613,10 @@
               break;
             }
 
-          if (a.cidx(j+1) != a.cidx(j))
+          if (a.cidx (j+1) != a.cidx (j))
             {
-              octave_idx_type ru = a.ridx(a.cidx(j));
-              octave_idx_type rl = a.ridx(a.cidx(j+1)-1);
+              octave_idx_type ru = a.ridx (a.cidx (j));
+              octave_idx_type rl = a.ridx (a.cidx (j+1)-1);
 
               if (j - ru > upper_band)
                 upper_band = j - ru;
@@ -672,7 +672,7 @@
           perm = new octave_idx_type [ncols];
 
           for (octave_idx_type i = 0; i < ncols; i++)
-            perm [i] = -1;
+            perm[i] = -1;
 
           for (octave_idx_type i = 0; i < nm; i++)
             {
@@ -680,10 +680,10 @@
 
               for (octave_idx_type j = 0; j < ncols; j++)
                 {
-                  if ((a.cidx(j+1) - a.cidx(j)) > 0 &&
-                      (a.ridx(a.cidx(j+1)-1) == i))
+                  if ((a.cidx (j+1) - a.cidx (j)) > 0 &&
+                      (a.ridx (a.cidx (j+1)-1) == i))
                     {
-                      perm [i] = j;
+                      perm[i] = j;
                       found = true;
                       break;
                     }
@@ -700,11 +700,11 @@
                 {
                   octave_idx_type k = nrows;
                   for (octave_idx_type i = 0; i < ncols; i++)
-                    if (perm [i] == -1)
+                    if (perm[i] == -1)
                       perm[i] = k++;
                 }
             }
-          else if (a.cidx(nm) == a.cidx(ncols))
+          else if (a.cidx (nm) == a.cidx (ncols))
             {
               nperm = nrows;
               delete [] perm;
@@ -713,13 +713,13 @@
 
               for (octave_idx_type i = 0; i < nrows; i++)
                 {
-                  perm [i] = -1;
-                  tmp [i] = -1;
+                  perm[i] = -1;
+                  tmp[i] = -1;
                 }
 
               for (octave_idx_type j = 0; j < ncols; j++)
-                for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
-                    perm [a.ridx(i)] = j;
+                for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
+                    perm[a.ridx (i)] = j;
 
               found = true;
               for (octave_idx_type i = 0; i < nm; i++)
@@ -799,11 +799,11 @@
           for (octave_idx_type j = 0; is_herm && j < ncols; j++)
             {
               is_herm = false;
-              for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
+              for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
                 {
-                  if (a.ridx(i) == j)
+                  if (a.ridx (i) == j)
                     {
-                      Complex d = a.data(i);
+                      Complex d = a.data (i);
                       is_herm = d.real () > 0. && d.imag () == 0.;
                       diag(j) = d.real ();
                       break;
@@ -814,21 +814,21 @@
           // next, check symmetry and 2x2 positiveness
 
           for (octave_idx_type j = 0; is_herm && j < ncols; j++)
-            for (octave_idx_type i = a.cidx(j); is_herm && i < a.cidx(j+1); i++)
+            for (octave_idx_type i = a.cidx (j); is_herm && i < a.cidx (j+1); i++)
               {
-                octave_idx_type k = a.ridx(i);
+                octave_idx_type k = a.ridx (i);
                 is_herm = k == j;
                 if (is_herm)
                   continue;
-                Complex d = a.data(i);
+                Complex d = a.data (i);
                 if (std::norm (d) < diag(j)*diag(k))
                   {
                     d = std::conj (d);
-                    for (octave_idx_type l = a.cidx(k); l < a.cidx(k+1); l++)
+                    for (octave_idx_type l = a.cidx (k); l < a.cidx (k+1); l++)
                       {
-                        if (a.ridx(l) == j)
+                        if (a.ridx (l) == j)
                           {
-                            is_herm = a.data(l) == d;
+                            is_herm = a.data (l) == d;
                             break;
                           }
                       }
--- a/liboctave/Sparse-op-defs.h
+++ b/liboctave/Sparse-op-defs.h
@@ -74,11 +74,11 @@
  \
     for (octave_idx_type i = 0; i < nz; i++) \
       { \
-        r.xdata(i) = m.data(i) OP s; \
-        r.xridx(i) = m.ridx(i); \
+        r.xdata (i) = m.data (i) OP s; \
+        r.xridx (i) = m.ridx (i); \
       } \
     for (octave_idx_type i = 0; i < nc + 1; i++) \
-      r.xcidx(i) = m.cidx(i); \
+      r.xcidx (i) = m.cidx (i); \
     \
     r.maybe_compress (true); \
     return r; \
@@ -114,7 +114,7 @@
       { \
         r = SparseBoolMatrix (nr, nc, true); \
         for (octave_idx_type j = 0; j < nc; j++) \
-          for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \
+          for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \
             if (! (MC (m.data (i)) OP SC (s))) \
               r.data (m.ridx (i) + j * nr) = false; \
         r.maybe_compress (true); \
@@ -126,7 +126,7 @@
         octave_idx_type nel = 0; \
         for (octave_idx_type j = 0; j < nc; j++) \
           { \
-            for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \
+            for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \
               if (MC (m.data (i)) OP SC (s)) \
                 { \
                   r.ridx (nel) = m.ridx (i); \
@@ -169,8 +169,8 @@
           { \
             r = SparseBoolMatrix (nr, nc, true); \
             for (octave_idx_type j = 0; j < nc; j++) \
-              for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \
-                if (! ((m.data(i) != LHS_ZERO) OP (s != RHS_ZERO))) \
+              for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \
+                if (! ((m.data (i) != LHS_ZERO) OP (s != RHS_ZERO))) \
                   r.data (m.ridx (i) + j * nr) = false; \
             r.maybe_compress (true); \
           } \
@@ -181,8 +181,8 @@
             octave_idx_type nel = 0; \
             for (octave_idx_type j = 0; j < nc; j++) \
               { \
-                for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \
-                  if ((m.data(i) != LHS_ZERO) OP (s != RHS_ZERO)) \
+                for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \
+                  if ((m.data (i) != LHS_ZERO) OP (s != RHS_ZERO)) \
                     { \
                       r.ridx (nel) = m.ridx (i); \
                       r.data (nel++) = true; \
@@ -243,11 +243,11 @@
  \
     for (octave_idx_type i = 0; i < nz; i++) \
       { \
-        r.xdata(i) = s OP m.data(i); \
-        r.xridx(i) = m.ridx(i); \
+        r.xdata (i) = s OP m.data (i); \
+        r.xridx (i) = m.ridx (i); \
       } \
     for (octave_idx_type i = 0; i < nc + 1; i++) \
-      r.xcidx(i) = m.cidx(i); \
+      r.xcidx (i) = m.cidx (i); \
  \
     r.maybe_compress(true); \
     return r; \
@@ -283,7 +283,7 @@
       { \
         r = SparseBoolMatrix (nr, nc, true); \
         for (octave_idx_type j = 0; j < nc; j++) \
-          for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \
+          for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \
             if (! (SC (s) OP MC (m.data (i)))) \
               r.data (m.ridx (i) + j * nr) = false; \
         r.maybe_compress (true); \
@@ -295,7 +295,7 @@
         octave_idx_type nel = 0; \
         for (octave_idx_type j = 0; j < nc; j++) \
           { \
-            for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \
+            for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \
               if (SC (s) OP MC (m.data (i))) \
                 { \
                   r.ridx (nel) = m.ridx (i); \
@@ -338,8 +338,8 @@
           { \
             r = SparseBoolMatrix (nr, nc, true); \
             for (octave_idx_type j = 0; j < nc; j++) \
-              for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \
-                if (! ((s != LHS_ZERO) OP (m.data(i) != RHS_ZERO))) \
+              for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \
+                if (! ((s != LHS_ZERO) OP (m.data (i) != RHS_ZERO))) \
                   r.data (m.ridx (i) + j * nr) = false; \
             r.maybe_compress (true); \
           } \
@@ -350,8 +350,8 @@
             octave_idx_type nel = 0; \
             for (octave_idx_type j = 0; j < nc; j++) \
               { \
-                for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \
-                  if ((s != LHS_ZERO) OP (m.data(i) != RHS_ZERO)) \
+                for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \
+                  if ((s != LHS_ZERO) OP (m.data (i) != RHS_ZERO)) \
                     { \
                       r.ridx (nel) = m.ridx (i); \
                       r.data (nel++) = true; \
@@ -398,20 +398,20 @@
  \
     if (m1_nr == 1 && m1_nc == 1) \
       { \
-        if (m1.elem(0,0) == 0.) \
+        if (m1.elem (0,0) == 0.) \
           r = OP R (m2); \
         else \
           { \
-            r = R (m2_nr, m2_nc, m1.data(0) OP 0.); \
+            r = R (m2_nr, m2_nc, m1.data (0) OP 0.); \
             \
             for (octave_idx_type j = 0 ; j < m2_nc ; j++) \
               { \
                 octave_quit (); \
                 octave_idx_type idxj = j * m2_nr; \
-                for (octave_idx_type i = m2.cidx(j) ; i < m2.cidx(j+1) ; i++) \
+                for (octave_idx_type i = m2.cidx (j) ; i < m2.cidx (j+1) ; i++) \
                   { \
                     octave_quit (); \
-                    r.data(idxj + m2.ridx(i)) = m1.data(0) OP m2.data(i); \
+                    r.data (idxj + m2.ridx (i)) = m1.data (0) OP m2.data (i); \
                   } \
               } \
             r.maybe_compress (); \
@@ -419,20 +419,20 @@
       } \
     else if (m2_nr == 1 && m2_nc == 1) \
       { \
-        if (m2.elem(0,0) == 0.) \
+        if (m2.elem (0,0) == 0.) \
           r = R (m1); \
         else \
           { \
-            r = R (m1_nr, m1_nc, 0. OP m2.data(0)); \
+            r = R (m1_nr, m1_nc, 0. OP m2.data (0)); \
             \
             for (octave_idx_type j = 0 ; j < m1_nc ; j++) \
               { \
                 octave_quit (); \
                 octave_idx_type idxj = j * m1_nr; \
-                for (octave_idx_type i = m1.cidx(j) ; i < m1.cidx(j+1) ; i++) \
+                for (octave_idx_type i = m1.cidx (j) ; i < m1.cidx (j+1) ; i++) \
                   { \
                     octave_quit (); \
-                    r.data(idxj + m1.ridx(i)) = m1.data(i) OP m2.data(0); \
+                    r.data (idxj + m1.ridx (i)) = m1.data (i) OP m2.data (0); \
                   } \
               } \
             r.maybe_compress (); \
@@ -448,41 +448,41 @@
         r.cidx (0) = 0; \
         for (octave_idx_type i = 0 ; i < m1_nc ; i++) \
           { \
-            octave_idx_type  ja = m1.cidx(i); \
-            octave_idx_type  ja_max = m1.cidx(i+1); \
+            octave_idx_type  ja = m1.cidx (i); \
+            octave_idx_type  ja_max = m1.cidx (i+1); \
             bool ja_lt_max= ja < ja_max; \
             \
-            octave_idx_type  jb = m2.cidx(i); \
-            octave_idx_type  jb_max = m2.cidx(i+1); \
+            octave_idx_type  jb = m2.cidx (i); \
+            octave_idx_type  jb_max = m2.cidx (i+1); \
             bool jb_lt_max = jb < jb_max; \
             \
             while (ja_lt_max || jb_lt_max ) \
               { \
                 octave_quit (); \
                 if ((! jb_lt_max) || \
-                      (ja_lt_max && (m1.ridx(ja) < m2.ridx(jb)))) \
+                      (ja_lt_max && (m1.ridx (ja) < m2.ridx (jb)))) \
                   { \
-                    r.ridx(jx) = m1.ridx(ja); \
-                    r.data(jx) = m1.data(ja) OP 0.; \
+                    r.ridx (jx) = m1.ridx (ja); \
+                    r.data (jx) = m1.data (ja) OP 0.; \
                     jx++; \
                     ja++; \
                     ja_lt_max= ja < ja_max; \
                   } \
                 else if (( !ja_lt_max ) || \
-                     (jb_lt_max && (m2.ridx(jb) < m1.ridx(ja)) ) ) \
+                     (jb_lt_max && (m2.ridx (jb) < m1.ridx (ja)) ) ) \
                   { \
-                    r.ridx(jx) = m2.ridx(jb); \
-                    r.data(jx) = 0. OP m2.data(jb); \
+                    r.ridx (jx) = m2.ridx (jb); \
+                    r.data (jx) = 0. OP m2.data (jb); \
                     jx++; \
                     jb++; \
                     jb_lt_max= jb < jb_max; \
                   } \
                 else \
                   { \
-                     if ((m1.data(ja) OP m2.data(jb)) != 0.) \
+                     if ((m1.data (ja) OP m2.data (jb)) != 0.) \
                        { \
-                          r.data(jx) = m1.data(ja) OP m2.data(jb); \
-                          r.ridx(jx) = m1.ridx(ja); \
+                          r.data (jx) = m1.data (ja) OP m2.data (jb); \
+                          r.ridx (jx) = m1.ridx (ja); \
                           jx++; \
                        } \
                      ja++; \
@@ -491,7 +491,7 @@
                      jb_lt_max= jb < jb_max; \
                   } \
               } \
-            r.cidx(i+1) = jx; \
+            r.cidx (i+1) = jx; \
           } \
         \
         r.maybe_compress (); \
@@ -514,7 +514,7 @@
  \
     if (m1_nr == 1 && m1_nc == 1) \
       { \
-        if (m1.elem(0,0) == 0.) \
+        if (m1.elem (0,0) == 0.) \
           r = R (m2_nr, m2_nc); \
         else \
           { \
@@ -524,14 +524,14 @@
             for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \
               { \
                 octave_quit (); \
-                r.data (i) = m1.data(0) OP r.data(i); \
+                r.data (i) = m1.data (0) OP r.data (i); \
               } \
             r.maybe_compress (); \
           } \
       } \
     else if (m2_nr == 1 && m2_nc == 1) \
       { \
-        if (m2.elem(0,0) == 0.) \
+        if (m2.elem (0,0) == 0.) \
           r = R (m1_nr, m1_nc); \
         else \
           { \
@@ -541,7 +541,7 @@
             for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \
               { \
                 octave_quit (); \
-                r.data (i) = r.data(i) OP m2.data(0); \
+                r.data (i) = r.data (i) OP m2.data (0); \
               } \
             r.maybe_compress (); \
           } \
@@ -556,40 +556,40 @@
         r.cidx (0) = 0; \
         for (octave_idx_type i = 0 ; i < m1_nc ; i++) \
           { \
-            octave_idx_type  ja = m1.cidx(i); \
-            octave_idx_type  ja_max = m1.cidx(i+1); \
+            octave_idx_type  ja = m1.cidx (i); \
+            octave_idx_type  ja_max = m1.cidx (i+1); \
             bool ja_lt_max= ja < ja_max; \
             \
-            octave_idx_type  jb = m2.cidx(i); \
-            octave_idx_type  jb_max = m2.cidx(i+1); \
+            octave_idx_type  jb = m2.cidx (i); \
+            octave_idx_type  jb_max = m2.cidx (i+1); \
             bool jb_lt_max = jb < jb_max; \
             \
             while (ja_lt_max || jb_lt_max ) \
               { \
                 octave_quit (); \
                 if ((! jb_lt_max) || \
-                      (ja_lt_max && (m1.ridx(ja) < m2.ridx(jb)))) \
+                      (ja_lt_max && (m1.ridx (ja) < m2.ridx (jb)))) \
                   { \
                      ja++; ja_lt_max= ja < ja_max; \
                   } \
                 else if (( !ja_lt_max ) || \
-                     (jb_lt_max && (m2.ridx(jb) < m1.ridx(ja)) ) ) \
+                     (jb_lt_max && (m2.ridx (jb) < m1.ridx (ja)) ) ) \
                   { \
                      jb++; jb_lt_max= jb < jb_max; \
                   } \
                 else \
                   { \
-                     if ((m1.data(ja) OP m2.data(jb)) != 0.) \
+                     if ((m1.data (ja) OP m2.data (jb)) != 0.) \
                        { \
-                          r.data(jx) = m1.data(ja) OP m2.data(jb); \
-                          r.ridx(jx) = m1.ridx(ja); \
+                          r.data (jx) = m1.data (ja) OP m2.data (jb); \
+                          r.ridx (jx) = m1.ridx (ja); \
                           jx++; \
                        } \
                      ja++; ja_lt_max= ja < ja_max; \
                      jb++; jb_lt_max= jb < jb_max; \
                   } \
               } \
-            r.cidx(i+1) = jx; \
+            r.cidx (i+1) = jx; \
           } \
         \
         r.maybe_compress (); \
@@ -617,20 +617,20 @@
             octave_idx_type m2_nnz = m2.nnz (); \
             r = R (m2); \
             for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \
-              r.data (i) = m1.elem(0,0) OP r.data(i); \
+              r.data (i) = m1.elem (0,0) OP r.data (i); \
             r.maybe_compress (); \
           } \
         else \
           { \
-            r = R (m2_nr, m2_nc, m1.elem(0,0) OP Complex ()); \
+            r = R (m2_nr, m2_nc, m1.elem (0,0) OP Complex ()); \
             for (octave_idx_type j = 0 ; j < m2_nc ; j++) \
               { \
                 octave_quit (); \
                 octave_idx_type idxj = j * m2_nr; \
-                for (octave_idx_type i = m2.cidx(j) ; i < m2.cidx(j+1) ; i++) \
+                for (octave_idx_type i = m2.cidx (j) ; i < m2.cidx (j+1) ; i++) \
                   { \
                     octave_quit (); \
-                    r.data(idxj + m2.ridx(i)) = m1.elem(0,0) OP m2.data(i); \
+                    r.data (idxj + m2.ridx (i)) = m1.elem (0,0) OP m2.data (i); \
                   } \
               } \
             r.maybe_compress (); \
@@ -643,20 +643,20 @@
             octave_idx_type m1_nnz = m1.nnz (); \
             r = R (m1); \
             for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \
-              r.data (i) = r.data(i) OP m2.elem(0,0); \
+              r.data (i) = r.data (i) OP m2.elem (0,0); \
             r.maybe_compress (); \
           } \
         else \
           { \
-            r = R (m1_nr, m1_nc, Complex () OP m2.elem(0,0)); \
+            r = R (m1_nr, m1_nc, Complex () OP m2.elem (0,0)); \
             for (octave_idx_type j = 0 ; j < m1_nc ; j++) \
               { \
                 octave_quit (); \
                 octave_idx_type idxj = j * m1_nr; \
-                for (octave_idx_type i = m1.cidx(j) ; i < m1.cidx(j+1) ; i++) \
+                for (octave_idx_type i = m1.cidx (j) ; i < m1.cidx (j+1) ; i++) \
                   { \
                     octave_quit (); \
-                    r.data(idxj + m1.ridx(i)) = m1.data(i) OP m2.elem(0,0); \
+                    r.data (idxj + m1.ridx (i)) = m1.data (i) OP m2.elem (0,0); \
                   } \
               } \
             r.maybe_compress (); \
@@ -672,36 +672,36 @@
         \
         for (octave_idx_type i = 0 ; i < m1_nc ; i++) \
           { \
-            octave_idx_type  ja = m1.cidx(i); \
-            octave_idx_type  ja_max = m1.cidx(i+1); \
+            octave_idx_type  ja = m1.cidx (i); \
+            octave_idx_type  ja_max = m1.cidx (i+1); \
             bool ja_lt_max= ja < ja_max; \
             \
-            octave_idx_type  jb = m2.cidx(i); \
-            octave_idx_type  jb_max = m2.cidx(i+1); \
+            octave_idx_type  jb = m2.cidx (i); \
+            octave_idx_type  jb_max = m2.cidx (i+1); \
             bool jb_lt_max = jb < jb_max; \
             \
             while (ja_lt_max || jb_lt_max ) \
               { \
                 octave_quit (); \
                 if ((! jb_lt_max) || \
-                      (ja_lt_max && (m1.ridx(ja) < m2.ridx(jb)))) \
+                      (ja_lt_max && (m1.ridx (ja) < m2.ridx (jb)))) \
                   { \
                     /* keep those kludges coming */ \
-                    r.elem(m1.ridx(ja),i) = m1.data(ja) OP Complex (); \
+                    r.elem (m1.ridx (ja),i) = m1.data (ja) OP Complex (); \
                     ja++; \
                     ja_lt_max= ja < ja_max; \
                   } \
                 else if (( !ja_lt_max ) || \
-                     (jb_lt_max && (m2.ridx(jb) < m1.ridx(ja)) ) ) \
+                     (jb_lt_max && (m2.ridx (jb) < m1.ridx (ja)) ) ) \
                   { \
                     /* keep those kludges coming */ \
-                    r.elem(m2.ridx(jb),i) = Complex () OP m2.data(jb);  \
+                    r.elem (m2.ridx (jb),i) = Complex () OP m2.data (jb);  \
                     jb++; \
                     jb_lt_max= jb < jb_max; \
                   } \
                 else \
                   { \
-                    r.elem(m1.ridx(ja),i) = m1.data(ja) OP m2.data(jb); \
+                    r.elem (m1.ridx (ja),i) = m1.data (ja) OP m2.data (jb); \
                     ja++; \
                     ja_lt_max= ja < ja_max; \
                     jb++; \
@@ -755,12 +755,12 @@
     \
     if (m1_nr == 1 && m1_nc == 1) \
       { \
-    if (C1 (m1.elem(0,0)) OP C2 (Z2)) \
+    if (C1 (m1.elem (0,0)) OP C2 (Z2)) \
           { \
             r = SparseBoolMatrix (m2_nr, m2_nc, true); \
             for (octave_idx_type j = 0; j < m2_nc; j++) \
-              for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \
-                if (! (C1 (m1.elem (0,0)) OP C2 (m2.data(i)))) \
+              for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); i++) \
+                if (! (C1 (m1.elem (0,0)) OP C2 (m2.data (i)))) \
                   r.data (m2.ridx (i) + j * m2_nr) = false; \
             r.maybe_compress (true); \
           } \
@@ -771,8 +771,8 @@
             octave_idx_type nel = 0; \
             for (octave_idx_type j = 0; j < m2_nc; j++) \
               { \
-                for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \
-                  if (C1 (m1.elem (0,0)) OP C2 (m2.data(i))) \
+                for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); i++) \
+                  if (C1 (m1.elem (0,0)) OP C2 (m2.data (i))) \
                     { \
                       r.ridx (nel) = m2.ridx (i); \
                       r.data (nel++) = true; \
@@ -788,8 +788,8 @@
           { \
             r = SparseBoolMatrix (m1_nr, m1_nc, true); \
             for (octave_idx_type j = 0; j < m1_nc; j++) \
-              for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \
-                if (! (C1 (m1.data (i)) OP C2 (m2.elem(0,0)))) \
+              for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); i++) \
+                if (! (C1 (m1.data (i)) OP C2 (m2.elem (0,0)))) \
                   r.data (m1.ridx (i) + j * m1_nr) = false; \
             r.maybe_compress (true); \
           } \
@@ -800,8 +800,8 @@
             octave_idx_type nel = 0; \
             for (octave_idx_type j = 0; j < m1_nc; j++) \
               { \
-                for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \
-                  if (C1 (m1.data (i)) OP C2 (m2.elem(0,0))) \
+                for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); i++) \
+                  if (C1 (m1.data (i)) OP C2 (m2.elem (0,0))) \
                     { \
                       r.ridx (nel) = m1.ridx (i); \
                       r.data (nel++) = true; \
@@ -826,13 +826,13 @@
                      octave_idx_type e2 = m2.cidx (j+1); \
                      while (i1 < e1 || i2 < e2) \
                        { \
-                         if (i1 == e1 || (i2 < e2 && m1.ridx(i1) > m2.ridx(i2))) \
+                         if (i1 == e1 || (i2 < e2 && m1.ridx (i1) > m2.ridx (i2))) \
                            { \
                              if (! (C1 (Z1) OP C2 (m2.data (i2)))) \
                                r.data (m2.ridx (i2) + j * m1_nr) = false; \
                              i2++; \
                            } \
-                         else if (i2 == e2 || m1.ridx(i1) < m2.ridx(i2)) \
+                         else if (i2 == e2 || m1.ridx (i1) < m2.ridx (i2)) \
                            { \
                              if (! (C1 (m1.data (i1)) OP C2 (Z2))) \
                                r.data (m1.ridx (i1) + j * m1_nr) = false; \
@@ -862,7 +862,7 @@
                      octave_idx_type e2 = m2.cidx (j+1); \
                      while (i1 < e1 || i2 < e2) \
                        { \
-                         if (i1 == e1 || (i2 < e2 && m1.ridx(i1) > m2.ridx(i2))) \
+                         if (i1 == e1 || (i2 < e2 && m1.ridx (i1) > m2.ridx (i2))) \
                            { \
                              if (C1 (Z1) OP C2 (m2.data (i2))) \
                                { \
@@ -871,7 +871,7 @@
                                } \
                              i2++; \
                            } \
-                         else if (i2 == e2 || m1.ridx(i1) < m2.ridx(i2)) \
+                         else if (i2 == e2 || m1.ridx (i1) < m2.ridx (i2)) \
                            { \
                              if (C1 (m1.data (i1)) OP C2 (Z2)) \
                                { \
@@ -941,12 +941,12 @@
       { \
         if (m2_nr > 0 && m2_nc > 0) \
           { \
-            if ((m1.elem(0,0) != LHS_ZERO) OP RHS_ZERO) \
+            if ((m1.elem (0,0) != LHS_ZERO) OP RHS_ZERO) \
               { \
                 r = SparseBoolMatrix (m2_nr, m2_nc, true); \
                 for (octave_idx_type j = 0; j < m2_nc; j++) \
-                  for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \
-                    if (! ((m1.elem(0,0) != LHS_ZERO) OP (m2.data(i) != RHS_ZERO))) \
+                  for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); i++) \
+                    if (! ((m1.elem (0,0) != LHS_ZERO) OP (m2.data (i) != RHS_ZERO))) \
                       r.data (m2.ridx (i) + j * m2_nr) = false; \
                 r.maybe_compress (true); \
               } \
@@ -957,8 +957,8 @@
                 octave_idx_type nel = 0; \
                 for (octave_idx_type j = 0; j < m2_nc; j++) \
                   { \
-                    for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \
-                      if ((m1.elem(0,0) != LHS_ZERO) OP (m2.data(i) != RHS_ZERO)) \
+                    for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); i++) \
+                      if ((m1.elem (0,0) != LHS_ZERO) OP (m2.data (i) != RHS_ZERO)) \
                         { \
                           r.ridx (nel) = m2.ridx (i); \
                           r.data (nel++) = true; \
@@ -973,12 +973,12 @@
       { \
         if (m1_nr > 0 && m1_nc > 0) \
           { \
-            if (LHS_ZERO OP (m2.elem(0,0) != RHS_ZERO)) \
+            if (LHS_ZERO OP (m2.elem (0,0) != RHS_ZERO)) \
               { \
                 r = SparseBoolMatrix (m1_nr, m1_nc, true); \
                 for (octave_idx_type j = 0; j < m1_nc; j++) \
-                  for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \
-                    if (! ((m1.data(i) != LHS_ZERO) OP (m2.elem(0,0) != RHS_ZERO))) \
+                  for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); i++) \
+                    if (! ((m1.data (i) != LHS_ZERO) OP (m2.elem (0,0) != RHS_ZERO))) \
                       r.data (m1.ridx (i) + j * m1_nr) = false; \
                 r.maybe_compress (true); \
               } \
@@ -989,8 +989,8 @@
                 octave_idx_type nel = 0; \
                 for (octave_idx_type j = 0; j < m1_nc; j++) \
                   { \
-                    for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \
-                      if ((m1.data(i) != LHS_ZERO) OP (m2.elem(0,0) != RHS_ZERO)) \
+                    for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); i++) \
+                      if ((m1.data (i) != LHS_ZERO) OP (m2.elem (0,0) != RHS_ZERO)) \
                         { \
                           r.ridx (nel) = m1.ridx (i); \
                           r.data (nel++) = true; \
@@ -1016,7 +1016,7 @@
                 octave_idx_type e2 = m2.cidx (j+1); \
                 while (i1 < e1 || i2 < e2) \
                   { \
-                    if (i1 == e1 || (i2 < e2 && m1.ridx(i1) > m2.ridx(i2))) \
+                    if (i1 == e1 || (i2 < e2 && m1.ridx (i1) > m2.ridx (i2))) \
                       { \
                         if (LHS_ZERO OP m2.data (i2) != RHS_ZERO) \
                           { \
@@ -1025,7 +1025,7 @@
                           } \
                         i2++; \
                       } \
-                    else if (i2 == e2 || m1.ridx(i1) < m2.ridx(i2)) \
+                    else if (i2 == e2 || m1.ridx (i1) < m2.ridx (i2)) \
                       { \
                         if (m1.data (i1) != LHS_ZERO OP RHS_ZERO) \
                           { \
@@ -1036,7 +1036,7 @@
                       } \
                     else \
                       { \
-                        if (m1.data (i1) != LHS_ZERO OP m2.data(i2) != RHS_ZERO) \
+                        if (m1.data (i1) != LHS_ZERO OP m2.data (i2) != RHS_ZERO) \
                           { \
                             r.ridx (nel) = m1.ridx (i1); \
                             r.data (nel++) = true; \
@@ -1091,7 +1091,7 @@
     octave_idx_type m2_nc = m2.cols (); \
  \
     if (m2_nr == 1 && m2_nc == 1) \
-      r = R (m1 OP m2.elem(0,0)); \
+      r = R (m1 OP m2.elem (0,0)); \
     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
       gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
     else \
@@ -1114,7 +1114,7 @@
     octave_idx_type m2_nc = m2.cols (); \
  \
     if (m2_nr == 1 && m2_nc == 1) \
-      r = R (m1 OP m2.elem(0,0)); \
+      r = R (m1 OP m2.elem (0,0)); \
     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
       gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
     else \
@@ -1127,18 +1127,18 @@
             for (octave_idx_type j = 0, k = 0; j < m2_nc; j++) \
               { \
                 octave_quit (); \
-                for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \
+                for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); i++) \
                   { \
-                    octave_idx_type mri = m2.ridx(i); \
-                    R::element_type x = m1(mri, j) OP m2.data(i); \
+                    octave_idx_type mri = m2.ridx (i); \
+                    R::element_type x = m1(mri, j) OP m2.data (i); \
                     if (x != 0.0) \
                       { \
-                        r.xdata(k) = x; \
-                        r.xridx(k) = m2.ridx(i); \
+                        r.xdata (k) = x; \
+                        r.xridx (k) = m2.ridx (i); \
                         k++; \
                       } \
                   } \
-                r.xcidx(j+1) = k; \
+                r.xcidx (j+1) = k; \
               } \
             r.maybe_compress (false); \
             return r; \
@@ -1182,7 +1182,7 @@
     octave_idx_type m2_nc = m2.cols (); \
     \
     if (m2_nr == 1 && m2_nc == 1) \
-      r = SparseBoolMatrix (F (m1, m2.elem(0,0))); \
+      r = SparseBoolMatrix (F (m1, m2.elem (0,0))); \
     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
       { \
         if (m1_nr != 0 || m1_nc != 0) \
@@ -1191,7 +1191,7 @@
             octave_idx_type nel = 0; \
             for (octave_idx_type j = 0; j < m1_nc; j++) \
               for (octave_idx_type i = 0; i < m1_nr; i++) \
-                if (C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j))) \
+                if (C1 (m1.elem (i, j)) OP C2 (m2.elem (i, j))) \
                   nel++; \
             \
             r = SparseBoolMatrix (m1_nr, m1_nc, nel); \
@@ -1202,14 +1202,14 @@
               { \
                 for (octave_idx_type i = 0; i < m1_nr; i++) \
                   { \
-                    bool el = C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j)); \
+                    bool el = C1 (m1.elem (i, j)) OP C2 (m2.elem (i, j)); \
                     if (el) \
                       { \
-                        r.data(ii) = el; \
-                        r.ridx(ii++) = i; \
+                        r.data (ii) = el; \
+                        r.ridx (ii++) = i; \
                       } \
                   } \
-                r.cidx(j+1) = ii; \
+                r.cidx (j+1) = ii; \
               } \
           } \
       }       \
@@ -1250,7 +1250,7 @@
     octave_idx_type m2_nc = m2.cols (); \
     \
     if (m2_nr == 1 && m2_nc == 1) \
-      r = SparseBoolMatrix  (F (m1, m2.elem(0,0))); \
+      r = SparseBoolMatrix (F (m1, m2.elem (0,0))); \
     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
       { \
         if (m1_nr != 0 || m1_nc != 0) \
@@ -1259,8 +1259,8 @@
             octave_idx_type nel = 0; \
             for (octave_idx_type j = 0; j < m1_nc; j++) \
               for (octave_idx_type i = 0; i < m1_nr; i++) \
-                if ((m1.elem(i, j) != LHS_ZERO) \
-                    OP (m2.elem(i, j) != RHS_ZERO)) \
+                if ((m1.elem (i, j) != LHS_ZERO) \
+                    OP (m2.elem (i, j) != RHS_ZERO)) \
                   nel++; \
             \
             r = SparseBoolMatrix (m1_nr, m1_nc, nel); \
@@ -1271,15 +1271,15 @@
               { \
                 for (octave_idx_type i = 0; i < m1_nr; i++) \
                   { \
-                    bool el = (m1.elem(i, j) != LHS_ZERO) \
-                      OP (m2.elem(i, j) != RHS_ZERO);     \
+                    bool el = (m1.elem (i, j) != LHS_ZERO) \
+                      OP (m2.elem (i, j) != RHS_ZERO);     \
                     if (el) \
                       { \
-                        r.data(ii) = el; \
-                        r.ridx(ii++) = i; \
+                        r.data (ii) = el; \
+                        r.ridx (ii++) = i; \
                       } \
                   } \
-                r.cidx(j+1) = ii; \
+                r.cidx (j+1) = ii; \
               } \
           } \
       }       \
@@ -1324,7 +1324,7 @@
     octave_idx_type m2_nc = m2.cols (); \
  \
     if (m1_nr == 1 && m1_nc == 1) \
-      r = R (m1.elem(0,0) OP m2); \
+      r = R (m1.elem (0,0) OP m2); \
     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
       gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
     else \
@@ -1355,7 +1355,7 @@
     octave_idx_type m2_nc = m2.cols (); \
  \
     if (m1_nr == 1 && m1_nc == 1) \
-      r = R (m1.elem(0,0) OP m2); \
+      r = R (m1.elem (0,0) OP m2); \
     else if (m1_nr != m2_nr || m1_nc != m2_nc) \
       gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \
     else \
@@ -1368,18 +1368,18 @@
             for (octave_idx_type j = 0, k = 0; j < m1_nc; j++) \
               { \
                 octave_quit (); \
-                for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \
+                for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); i++) \
                   { \
-                    octave_idx_type mri = m1.ridx(i); \
-                    R::element_type x = m1.data(i) OP m2(mri, j); \
+                    octave_idx_type mri = m1.ridx (i); \
+                    R::element_type x = m1.data (i) OP m2 (mri, j); \
                     if (x != 0.0) \
                       { \
-                        r.xdata(k) = x; \
-                        r.xridx(k) = m1.ridx(i); \
+                        r.xdata (k) = x; \
+                        r.xridx (k) = m1.ridx (i); \
                         k++; \
                       } \
                   } \
-                r.xcidx(j+1) = k; \
+                r.xcidx (j+1) = k; \
               } \
             r.maybe_compress (false); \
             return r; \
@@ -1422,7 +1422,7 @@
     octave_idx_type m2_nc = m2.cols (); \
     \
     if (m1_nr == 1 && m1_nc == 1) \
-      r = SparseBoolMatrix (F (m1.elem(0,0), m2)); \
+      r = SparseBoolMatrix (F (m1.elem (0,0), m2)); \
     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
       { \
         if (m1_nr != 0 || m1_nc != 0) \
@@ -1431,7 +1431,7 @@
             octave_idx_type nel = 0; \
             for (octave_idx_type j = 0; j < m1_nc; j++) \
               for (octave_idx_type i = 0; i < m1_nr; i++) \
-                if (C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j))) \
+                if (C1 (m1.elem (i, j)) OP C2 (m2.elem (i, j))) \
                   nel++; \
             \
             r = SparseBoolMatrix (m1_nr, m1_nc, nel); \
@@ -1442,14 +1442,14 @@
               { \
                 for (octave_idx_type i = 0; i < m1_nr; i++) \
                   { \
-                    bool el = C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j)); \
+                    bool el = C1 (m1.elem (i, j)) OP C2 (m2.elem (i, j)); \
                     if (el) \
                       { \
-                        r.data(ii) = el; \
-                        r.ridx(ii++) = i; \
+                        r.data (ii) = el; \
+                        r.ridx (ii++) = i; \
                       } \
                   } \
-                r.cidx(j+1) = ii; \
+                r.cidx (j+1) = ii; \
               } \
           } \
       }       \
@@ -1490,7 +1490,7 @@
     octave_idx_type m2_nc = m2.cols (); \
     \
     if (m1_nr == 1 && m1_nc == 1) \
-      r = SparseBoolMatrix (F (m1.elem(0,0), m2)); \
+      r = SparseBoolMatrix (F (m1.elem (0,0), m2)); \
     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
       { \
         if (m1_nr != 0 || m1_nc != 0) \
@@ -1499,8 +1499,8 @@
             octave_idx_type nel = 0; \
             for (octave_idx_type j = 0; j < m1_nc; j++) \
               for (octave_idx_type i = 0; i < m1_nr; i++) \
-                if ((m1.elem(i, j) != LHS_ZERO) \
-                    OP (m2.elem(i, j) != RHS_ZERO)) \
+                if ((m1.elem (i, j) != LHS_ZERO) \
+                    OP (m2.elem (i, j) != RHS_ZERO)) \
                   nel++; \
             \
             r = SparseBoolMatrix (m1_nr, m1_nc, nel); \
@@ -1511,15 +1511,15 @@
               { \
                 for (octave_idx_type i = 0; i < m1_nr; i++) \
                   { \
-                    bool el = (m1.elem(i, j) != LHS_ZERO) \
-                      OP (m2.elem(i, j) != RHS_ZERO);     \
+                    bool el = (m1.elem (i, j) != LHS_ZERO) \
+                      OP (m2.elem (i, j) != RHS_ZERO);     \
                     if (el) \
                       { \
-                        r.data(ii) = el; \
-                        r.ridx(ii++) = i; \
+                        r.data (ii) = el; \
+                        r.ridx (ii++) = i; \
                       } \
                   } \
-                r.cidx(j+1) = ii; \
+                r.cidx (j+1) = ii; \
               } \
           } \
       }       \
@@ -1565,30 +1565,30 @@
               ELT_TYPE t = ELT_TYPE (); \
               for (octave_idx_type j = cidx (i); j < cidx (i+1); j++)   \
                 { \
-                  t += data(j); \
+                  t += data (j); \
                   if (t != ELT_TYPE ()) \
                     { \
-                      if (j == cidx(i+1) - 1) \
-                        nel += nr - ridx(j);  \
+                      if (j == cidx (i+1) - 1) \
+                        nel += nr - ridx (j);  \
                       else \
-                        nel += ridx(j+1) - ridx(j); \
+                        nel += ridx (j+1) - ridx (j); \
                     } \
                 } \
             } \
           retval = RET_TYPE (nr, nc, nel); \
-          retval.cidx(0) = 0; \
+          retval.cidx (0) = 0; \
           octave_idx_type ii = 0; \
           for (octave_idx_type i = 0; i < nc; i++) \
             { \
               ELT_TYPE t = ELT_TYPE (); \
               for (octave_idx_type j = cidx (i); j < cidx (i+1); j++)   \
                 { \
-                  t += data(j); \
+                  t += data (j); \
                   if (t != ELT_TYPE ()) \
                     { \
-                      if (j == cidx(i+1) - 1) \
+                      if (j == cidx (i+1) - 1) \
                         { \
-                          for (octave_idx_type k = ridx(j); k < nr; k++) \
+                          for (octave_idx_type k = ridx (j); k < nr; k++) \
                             { \
                                retval.data (ii) = t; \
                                retval.ridx (ii++) = k; \
@@ -1596,7 +1596,7 @@
                         } \
                       else \
                         { \
-                          for (octave_idx_type k = ridx(j); k < ridx(j+1); k++) \
+                          for (octave_idx_type k = ridx (j); k < ridx (j+1); k++) \
                             { \
                                retval.data (ii) = t; \
                                retval.ridx (ii++) = k; \
@@ -1604,7 +1604,7 @@
                         } \
                     } \
                 } \
-              retval.cidx(i+1) = ii; \
+              retval.cidx (i+1) = ii; \
             } \
         } \
     } \
@@ -1634,7 +1634,7 @@
               octave_idx_type jj = 0; \
               for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \
                 { \
-                  if (jj == ridx(j)) \
+                  if (jj == ridx (j)) \
                     { \
                       nel++; \
                       jj++; \
@@ -1644,7 +1644,7 @@
                 } \
             } \
           retval = RET_TYPE (nr, nc, nel); \
-          retval.cidx(0) = 0; \
+          retval.cidx (0) = 0; \
           octave_idx_type ii = 0; \
           for (octave_idx_type i = 0; i < nc; i++) \
             { \
@@ -1652,16 +1652,16 @@
               octave_idx_type jj = 0; \
               for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \
                 { \
-                  if (jj == ridx(j)) \
+                  if (jj == ridx (j)) \
                     { \
-                      t *= data(j); \
-                      retval.data(ii) = t; \
-                      retval.ridx(ii++) = jj++; \
+                      t *= data (j); \
+                      retval.data (ii) = t; \
+                      retval.ridx (ii++) = jj++; \
                     } \
                   else \
                     break; \
                 } \
-              retval.cidx(i+1) = ii; \
+              retval.cidx (i+1) = ii; \
             } \
         } \
     } \
@@ -1690,7 +1690,7 @@
             tmp[i] = INIT_VAL; \
           for (j = 0; j < nc; j++) \
             { \
-              for (octave_idx_type i = cidx(j); i < cidx(j + 1); i++) \
+              for (octave_idx_type i = cidx (j); i < cidx (j + 1); i++) \
                 { \
                   ROW_EXPR; \
                 } \
@@ -1700,14 +1700,14 @@
             if (tmp[i] != EL_TYPE ())  \
               nel++ ; \
           retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), nel); \
-          retval.cidx(0) = 0; \
-          retval.cidx(1) = nel; \
+          retval.cidx (0) = 0; \
+          retval.cidx (1) = nel; \
           nel = 0; \
           for (octave_idx_type i = 0; i < nr; i++) \
             if (tmp[i] != EL_TYPE ())  \
               { \
-                retval.data(nel) = tmp[i]; \
-                retval.ridx(nel++) = i; \
+                retval.data (nel) = tmp[i]; \
+                retval.ridx (nel++) = i; \
               } \
         } \
       else \
@@ -1717,7 +1717,7 @@
           for (octave_idx_type j = 0; j < nc; j++) \
             { \
               tmp[j] = INIT_VAL; \
-              for (octave_idx_type i = cidx(j); i < cidx(j + 1); i++) \
+              for (octave_idx_type i = cidx (j); i < cidx (j + 1); i++) \
                 { \
                   COL_EXPR; \
                 } \
@@ -1727,17 +1727,17 @@
             if (tmp[i] != EL_TYPE ())  \
               nel++ ; \
           retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, nel); \
-          retval.cidx(0) = 0; \
+          retval.cidx (0) = 0; \
           nel = 0; \
           for (octave_idx_type i = 0; i < nc; i++) \
             if (tmp[i] != EL_TYPE ())  \
               { \
-                retval.data(nel) = tmp[i]; \
-                retval.ridx(nel++) = 0; \
-                retval.cidx(i+1) = retval.cidx(i) + 1; \
+                retval.data (nel) = tmp[i]; \
+                retval.ridx (nel++) = 0; \
+                retval.cidx (i+1) = retval.cidx (i) + 1; \
               } \
             else \
-              retval.cidx(i+1) = retval.cidx(i); \
+              retval.cidx (i+1) = retval.cidx (i); \
         } \
     } \
   else if (nc == 0 && (nr == 0 || (nr == 1 && dim == -1))) \
@@ -1747,10 +1747,10 @@
           retval = RET_TYPE (static_cast<octave_idx_type> (1), \
                              static_cast<octave_idx_type> (1), \
                              static_cast<octave_idx_type> (1)); \
-          retval.cidx(0) = 0; \
-          retval.cidx(1) = 1; \
-          retval.ridx(0) = 0; \
-          retval.data(0) = MT_RESULT; \
+          retval.cidx (0) = 0; \
+          retval.cidx (1) = 1; \
+          retval.ridx (0) = 0; \
+          retval.data (0) = MT_RESULT; \
         } \
       else \
           retval = RET_TYPE (static_cast<octave_idx_type> (1), \
@@ -1779,12 +1779,12 @@
       if (MT_RESULT) \
         { \
           retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), nr); \
-          retval.cidx(0) = 0; \
-          retval.cidx(1) = nr; \
+          retval.cidx (0) = 0; \
+          retval.cidx (1) = nr; \
           for (octave_idx_type i = 0; i < nr; i++) \
             { \
-              retval.ridx(i) = i; \
-              retval.data(i) = MT_RESULT; \
+              retval.ridx (i) = i; \
+              retval.data (i) = MT_RESULT; \
             } \
         } \
       else \
@@ -1797,7 +1797,7 @@
   return retval
 
 #define SPARSE_REDUCTION_OP_ROW_EXPR(OP) \
-  tmp[ridx(i)] OP data (i)
+  tmp[ridx (i)] OP data (i)
 
 #define SPARSE_REDUCTION_OP_COL_EXPR(OP) \
   tmp[j] OP data (i)
@@ -1814,7 +1814,7 @@
 // loop.
 #define SPARSE_ANY_ALL_OP_ROW_CODE(TEST_OP, TEST_TRUE_VAL) \
   if (data (i) TEST_OP 0.0) \
-    tmp[ridx(i)] = TEST_TRUE_VAL; \
+    tmp[ridx (i)] = TEST_TRUE_VAL; \
 
 #define SPARSE_ANY_ALL_OP_COL_CODE(TEST_OP, TEST_TRUE_VAL) \
   if (data (i) TEST_OP 0.0) \
@@ -1834,7 +1834,7 @@
     return transpose (). all (0). transpose (); \
   else \
     { \
-      SPARSE_ANY_ALL_OP (DIM, (cidx(j+1) - cidx(j) < nr ? false : true), \
+      SPARSE_ANY_ALL_OP (DIM, (cidx (j+1) - cidx (j) < nr ? false : true), \
                          true, ==, false); \
     }
 
@@ -1849,20 +1849,20 @@
   \
   if (nr == 1 && nc == 1) \
    { \
-     RET_EL_TYPE s = m.elem(0,0); \
+     RET_EL_TYPE s = m.elem (0,0); \
      octave_idx_type nz = a.nnz (); \
      RET_TYPE r (a_nr, a_nc, nz); \
      \
      for (octave_idx_type i = 0; i < nz; i++) \
        { \
          octave_quit (); \
-         r.data(i) = s * a.data(i); \
-         r.ridx(i) = a.ridx(i); \
+         r.data (i) = s * a.data (i); \
+         r.ridx (i) = a.ridx (i); \
        } \
      for (octave_idx_type i = 0; i < a_nc + 1; i++) \
        { \
          octave_quit (); \
-         r.cidx(i) = a.cidx(i); \
+         r.cidx (i) = a.cidx (i); \
        } \
      \
      r.maybe_compress (true); \
@@ -1870,20 +1870,20 @@
    } \
   else if (a_nr == 1 && a_nc == 1) \
    { \
-     RET_EL_TYPE s = a.elem(0,0); \
+     RET_EL_TYPE s = a.elem (0,0); \
      octave_idx_type nz = m.nnz (); \
      RET_TYPE r (nr, nc, nz); \
      \
      for (octave_idx_type i = 0; i < nz; i++) \
        { \
          octave_quit (); \
-         r.data(i) = m.data(i) * s; \
-         r.ridx(i) = m.ridx(i); \
+         r.data (i) = m.data (i) * s; \
+         r.ridx (i) = m.ridx (i); \
        } \
      for (octave_idx_type i = 0; i < nc + 1; i++) \
        { \
          octave_quit (); \
-         r.cidx(i) = m.cidx(i); \
+         r.cidx (i) = m.cidx (i); \
        } \
      \
      r.maybe_compress (true); \
@@ -1900,26 +1900,26 @@
       RET_TYPE retval (nr, a_nc, static_cast<octave_idx_type> (0)); \
       for (octave_idx_type i = 0; i < nr; i++) \
         w[i] = 0; \
-      retval.xcidx(0) = 0; \
+      retval.xcidx (0) = 0; \
       \
       octave_idx_type nel = 0; \
       \
       for (octave_idx_type i = 0; i < a_nc; i++) \
         { \
-          for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \
+          for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++) \
             { \
-              octave_idx_type  col = a.ridx(j); \
-              for (octave_idx_type k = m.cidx(col) ; k < m.cidx(col+1); k++) \
+              octave_idx_type  col = a.ridx (j); \
+              for (octave_idx_type k = m.cidx (col) ; k < m.cidx (col+1); k++) \
                 { \
-                  if (w[m.ridx(k)] < i + 1) \
+                  if (w[m.ridx (k)] < i + 1) \
                     { \
-                      w[m.ridx(k)] = i + 1; \
+                      w[m.ridx (k)] = i + 1; \
                       nel++; \
                     } \
                   octave_quit (); \
                 } \
             } \
-          retval.xcidx(i+1) = nel; \
+          retval.xcidx (i+1) = nel; \
         } \
       \
       if (nel == 0) \
@@ -1951,57 +1951,57 @@
           \
           for (octave_idx_type i = 0; i < a_nc ; i++) \
             { \
-              if (retval.xcidx(i+1) - retval.xcidx(i) > n_per_col) \
+              if (retval.xcidx (i+1) - retval.xcidx (i) > n_per_col) \
                 { \
-                  for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \
+                  for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++) \
                     { \
-                      octave_idx_type col = a.ridx(j); \
-                      EL_TYPE tmpval = a.data(j); \
-                      for (octave_idx_type k = m.cidx(col) ; \
-                           k < m.cidx(col+1); k++) \
+                      octave_idx_type col = a.ridx (j); \
+                      EL_TYPE tmpval = a.data (j); \
+                      for (octave_idx_type k = m.cidx (col) ; \
+                           k < m.cidx (col+1); k++) \
                         { \
                           octave_quit (); \
-                          octave_idx_type row = m.ridx(k); \
+                          octave_idx_type row = m.ridx (k); \
                           if (w[row] < i + 1) \
                             { \
                               w[row] = i + 1; \
-                              Xcol[row] = tmpval * m.data(k); \
+                              Xcol[row] = tmpval * m.data (k); \
                             } \
                           else \
-                            Xcol[row] += tmpval * m.data(k); \
+                            Xcol[row] += tmpval * m.data (k); \
                         } \
                     } \
                   for (octave_idx_type k = 0; k < nr; k++) \
                     if (w[k] == i + 1) \
                       { \
-                        retval.xdata(ii) = Xcol[k]; \
-                        retval.xridx(ii++) = k; \
+                        retval.xdata (ii) = Xcol[k]; \
+                        retval.xridx (ii++) = k; \
                       } \
                 } \
               else \
                 { \
-                  for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \
+                  for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++) \
                     { \
-                      octave_idx_type col = a.ridx(j); \
-                      EL_TYPE tmpval = a.data(j); \
-                      for (octave_idx_type k = m.cidx(col) ; \
-                          k < m.cidx(col+1); k++) \
+                      octave_idx_type col = a.ridx (j); \
+                      EL_TYPE tmpval = a.data (j); \
+                      for (octave_idx_type k = m.cidx (col) ; \
+                          k < m.cidx (col+1); k++) \
                         { \
                           octave_quit (); \
-                          octave_idx_type row = m.ridx(k); \
+                          octave_idx_type row = m.ridx (k); \
                           if (w[row] < i + 1) \
                             { \
                               w[row] = i + 1; \
-                              retval.xridx(ii++) = row;\
-                              Xcol[row] = tmpval * m.data(k); \
+                              retval.xridx (ii++) = row;\
+                              Xcol[row] = tmpval * m.data (k); \
                             } \
                           else \
-                            Xcol[row] += tmpval * m.data(k); \
+                            Xcol[row] += tmpval * m.data (k); \
                         } \
                     } \
-                  sort.sort (ri + retval.xcidx(i), ii - retval.xcidx(i)); \
-                  for (octave_idx_type k = retval.xcidx(i); k < ii; k++) \
-                    retval.xdata(k) = Xcol[retval.xridx(k)]; \
+                  sort.sort (ri + retval.xcidx (i), ii - retval.xcidx (i)); \
+                  for (octave_idx_type k = retval.xcidx (i); k < ii; k++) \
+                    retval.xdata (k) = Xcol[retval.xridx (k)]; \
                 }  \
             } \
           retval.maybe_compress (true);\
@@ -2036,9 +2036,9 @@
             { \
               octave_quit (); \
               \
-              EL_TYPE tmpval = a.elem(j,i); \
-              for (octave_idx_type k = m.cidx(j) ; k < m.cidx(j+1); k++) \
-                retval.elem (m.ridx(k),i) += tmpval * m.data(k); \
+              EL_TYPE tmpval = a.elem (j,i); \
+              for (octave_idx_type k = m.cidx (j) ; k < m.cidx (j+1); k++) \
+                retval.elem (m.ridx (k),i) += tmpval * m.data (k); \
             } \
         } \
       return retval; \
@@ -2053,7 +2053,7 @@
   \
   if (nr == 1 && nc == 1) \
     { \
-      RET_TYPE retval = CONJ_OP (m.elem(0,0)) * a; \
+      RET_TYPE retval = CONJ_OP (m.elem (0,0)) * a; \
       return retval; \
     } \
   else if (nr != a_nr) \
@@ -2072,8 +2072,8 @@
               octave_quit (); \
               \
               EL_TYPE acc = ZERO; \
-              for (octave_idx_type k = m.cidx(j) ; k < m.cidx(j+1); k++) \
-                acc += a.elem (m.ridx(k),i) * CONJ_OP (m.data(k)); \
+              for (octave_idx_type k = m.cidx (j) ; k < m.cidx (j+1); k++) \
+                acc += a.elem (m.ridx (k),i) * CONJ_OP (m.data (k)); \
               retval.xelem (j,i) = acc; \
             } \
         } \
@@ -2104,13 +2104,13 @@
       for (octave_idx_type i = 0; i < a_nc ; i++) \
         { \
           octave_quit (); \
-          for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \
+          for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++) \
             { \
-              octave_idx_type col = a.ridx(j); \
-              EL_TYPE tmpval = a.data(j); \
+              octave_idx_type col = a.ridx (j); \
+              EL_TYPE tmpval = a.data (j); \
               \
               for (octave_idx_type k = 0 ; k < nr; k++) \
-                retval.xelem (k,i) += tmpval * m.elem(k,col); \
+                retval.xelem (k,i) += tmpval * m.elem (k,col); \
             } \
         } \
       return retval; \
@@ -2125,7 +2125,7 @@
   \
   if (a_nr == 1 && a_nc == 1) \
     { \
-      RET_TYPE retval = m * CONJ_OP (a.elem(0,0)); \
+      RET_TYPE retval = m * CONJ_OP (a.elem (0,0)); \
       return retval; \
     } \
   else if (nc != a_nc) \
@@ -2140,12 +2140,12 @@
       for (octave_idx_type i = 0; i < a_nc ; i++) \
         { \
           octave_quit (); \
-          for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \
+          for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++) \
             { \
-              octave_idx_type col = a.ridx(j); \
-              EL_TYPE tmpval = CONJ_OP (a.data(j)); \
+              octave_idx_type col = a.ridx (j); \
+              EL_TYPE tmpval = CONJ_OP (a.data (j)); \
               for (octave_idx_type k = 0 ; k < nr; k++) \
-                retval.xelem (k,col) += tmpval * m.elem(k,i); \
+                retval.xelem (k,col) += tmpval * m.elem (k,i); \
             } \
         } \
       return retval; \
--- a/liboctave/Sparse-perm-op-defs.h
+++ b/liboctave/Sparse-perm-op-defs.h
@@ -43,15 +43,15 @@
     {
       octave_quit ();
 
-      OCTAVE_LOCAL_BUFFER (octave_idx_type, sidx, r.xcidx(j+1) - r.xcidx(j));
-      for (octave_idx_type i = r.xcidx(j), ii = 0; i < r.xcidx(j+1); i++)
+      OCTAVE_LOCAL_BUFFER (octave_idx_type, sidx, r.xcidx (j+1) - r.xcidx (j));
+      for (octave_idx_type i = r.xcidx (j), ii = 0; i < r.xcidx (j+1); i++)
         {
           sidx[ii++]=i;
           r.xridx (i) = pcol[a.ridx (i)];
         }
-      sort.sort (r.xridx () + r.xcidx(j), sidx, r.xcidx(j+1) - r.xcidx(j));
-      for (octave_idx_type i = r.xcidx(j), ii = 0; i < r.xcidx(j+1); i++)
-        r.xdata(i) = a.data (sidx[ii++]);
+      sort.sort (r.xridx () + r.xcidx (j), sidx, r.xcidx (j+1) - r.xcidx (j));
+      for (octave_idx_type i = r.xcidx (j), ii = 0; i < r.xcidx (j+1); i++)
+        r.xdata (i) = a.data (sidx[ii++]);
     }
 
   return r;
@@ -71,7 +71,7 @@
     {
       // Form the column permutation and then call the colpm_sm routine.
       const octave_idx_type *prow = p.pvec ().data ();
-      OCTAVE_LOCAL_BUFFER(octave_idx_type, pcol, nr);
+      OCTAVE_LOCAL_BUFFER (octave_idx_type, pcol, nr);
       for (octave_idx_type i = 0; i < nr; ++i)
         pcol[prow[i]] = i;
       return octinternal_do_mul_colpm_sm (pcol, a);
--- a/liboctave/Sparse.cc
+++ b/liboctave/Sparse.cc
@@ -66,12 +66,12 @@
   if (a.is_row_perm ())
     {
       for (octave_idx_type i = 0; i < n; i++)
-        ridx (pv (i)) = i;
+        ridx (pv(i)) = i;
     }
   else
     {
       for (octave_idx_type i = 0; i < n; i++)
-        ridx (i) = pv (i);
+        ridx (i) = pv(i);
     }
 
   for (octave_idx_type i = 0; i < n; i++)
@@ -223,7 +223,7 @@
     {
       rep = new typename Sparse<T>::SparseRep (nr, nc, 0);
       for (octave_idx_type j = 0; j < nc+1; j++)
-        xcidx(j) = 0;
+        xcidx (j) = 0;
     }
 }
 
@@ -264,21 +264,21 @@
       rep = new typename Sparse<T>::SparseRep (new_nr, new_nc, new_nzmx);
 
       octave_idx_type kk = 0;
-      xcidx(0) = 0;
+      xcidx (0) = 0;
       for (octave_idx_type i = 0; i < old_nc; i++)
-        for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++)
+        for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++)
           {
-            octave_idx_type tmp = i * old_nr + a.ridx(j);
+            octave_idx_type tmp = i * old_nr + a.ridx (j);
             octave_idx_type ii = tmp % new_nr;
             octave_idx_type jj = (tmp - ii) / new_nr;
             for (octave_idx_type k = kk; k < jj; k++)
-              xcidx(k+1) = j;
+              xcidx (k+1) = j;
             kk = jj;
-            xdata(j) = a.data(j);
-            xridx(j) = ii;
+            xdata (j) = a.data (j);
+            xridx (j) = ii;
           }
       for (octave_idx_type k = kk; k < new_nc; k++)
-        xcidx(k+1) = new_nzmx;
+        xcidx (k+1) = new_nzmx;
     }
 }
 
@@ -323,11 +323,11 @@
       if (n == 1 && a(0) != T ())
         {
           change_capacity (nzm > 1 ? nzm : 1);
-          xcidx(0) = 0;
-          xridx(0) = r(0);
-          xdata(0) = a(0);
+          xcidx (0) = 0;
+          xridx (0) = r(0);
+          xdata (0) = a(0);
           for (octave_idx_type j = 0; j < nc; j++)
-            xcidx(j+1) = j >= c(0);
+            xcidx (j+1) = j >= c(0);
         }
     }
   else if (a_scalar)
@@ -419,7 +419,7 @@
               sidx[ci[cd[i]+1]++] = rd[i];
 
           // Subsorts. We don't need a stable sort, all values are equal.
-          xcidx(0) = 0;
+          xcidx (0) = 0;
           for (octave_idx_type j = 0; j < nc; j++)
             {
               std::sort (sidx + ci[j], sidx + ci[j+1]);
@@ -435,7 +435,7 @@
                     }
                 }
               // Set column pointer.
-              xcidx(j+1) = xcidx(j) + nzj;
+              xcidx (j+1) = xcidx (j) + nzj;
             }
 
           change_capacity (nzm > xcidx (nc) ? nzm : xcidx (nc));
@@ -495,8 +495,8 @@
         new_nz += rd[i-1] != rd[i];
       // Allocate result.
       change_capacity (nzm > new_nz ? nzm : new_nz);
-      xcidx(0) = 0;
-      xcidx(1) = new_nz;
+      xcidx (0) = 0;
+      xcidx (1) = new_nz;
       octave_idx_type *rri = ridx ();
       T *rrd = data ();
 
@@ -566,7 +566,7 @@
         }
 
       // Subsorts. We don't need a stable sort, the second index stabilizes it.
-      xcidx(0) = 0;
+      xcidx (0) = 0;
       for (octave_idx_type j = 0; j < nc; j++)
         {
           std::sort (spairs + ci[j], spairs + ci[j+1]);
@@ -582,7 +582,7 @@
                 }
             }
           // Set column pointer.
-          xcidx(j+1) = xcidx(j) + nzj;
+          xcidx (j+1) = xcidx (j) + nzj;
         }
 
       change_capacity (nzm > xcidx (nc) ? nzm : xcidx (nc));
@@ -652,16 +652,16 @@
       rep = new typename Sparse<T>::SparseRep (nr, nc, new_nzmx);
 
       octave_idx_type ii = 0;
-      xcidx(0) = 0;
+      xcidx (0) = 0;
       for (octave_idx_type j = 0; j < nc; j++)
         {
           for (octave_idx_type i = 0; i < nr; i++)
             if (a.elem (i,j) != T ())
               {
-                xdata(ii) = a.elem (i,j);
-                xridx(ii++) = i;
+                xdata (ii) = a.elem (i,j);
+                xridx (ii++) = i;
               }
-          xcidx(j+1) = ii;
+          xcidx (j+1) = ii;
         }
     }
 }
@@ -833,21 +833,21 @@
           retval = Sparse<T> (new_nr, new_nc, new_nnz);
 
           octave_idx_type kk = 0;
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           for (octave_idx_type i = 0; i < old_nc; i++)
-            for (octave_idx_type j = cidx(i); j < cidx(i+1); j++)
+            for (octave_idx_type j = cidx (i); j < cidx (i+1); j++)
               {
-                octave_idx_type tmp = i * old_nr + ridx(j);
+                octave_idx_type tmp = i * old_nr + ridx (j);
                 octave_idx_type ii = tmp % new_nr;
                 octave_idx_type jj = (tmp - ii) / new_nr;
                 for (octave_idx_type k = kk; k < jj; k++)
-                  retval.xcidx(k+1) = j;
+                  retval.xcidx (k+1) = j;
                 kk = jj;
-                retval.xdata(j) = data(j);
-                retval.xridx(j) = ii;
+                retval.xdata (j) = data (j);
+                retval.xridx (j) = ii;
               }
           for (octave_idx_type k = kk; k < new_nc; k++)
-            retval.xcidx(k+1) = new_nnz;
+            retval.xcidx (k+1) = new_nnz;
         }
       else
         {
@@ -949,14 +949,14 @@
       octave_idx_type i = 0, k = 0;
       for (octave_idx_type j = 1; j <= rep->ncols; j++)
         {
-          octave_idx_type u = xcidx(j);
+          octave_idx_type u = xcidx (j);
           for (i = i; i < u; i++)
-            if (xridx(i) < r)
+            if (xridx (i) < r)
               {
-                xdata(k) = xdata(i);
-                xridx(k++) = xridx(i);
+                xdata (k) = xdata (i);
+                xridx (k++) = xridx (i);
               }
-          xcidx(j) = k;
+          xcidx (j) = k;
         }
     }
 
@@ -994,69 +994,69 @@
     }
 
   // First count the number of elements in the final array
-  octave_idx_type nel = cidx(c) + a.nnz ();
+  octave_idx_type nel = cidx (c) + a.nnz ();
 
   if (c + a_cols < nc)
-    nel += cidx(nc) - cidx(c + a_cols);
+    nel += cidx (nc) - cidx (c + a_cols);
 
   for (octave_idx_type i = c; i < c + a_cols; i++)
-    for (octave_idx_type j = cidx(i); j < cidx(i+1); j++)
-      if (ridx(j) < r || ridx(j) >= r + a_rows)
+    for (octave_idx_type j = cidx (i); j < cidx (i+1); j++)
+      if (ridx (j) < r || ridx (j) >= r + a_rows)
         nel++;
 
   Sparse<T> tmp (*this);
   --rep->count;
   rep = new typename Sparse<T>::SparseRep (nr, nc, nel);
 
-  for (octave_idx_type i = 0; i < tmp.cidx(c); i++)
+  for (octave_idx_type i = 0; i < tmp.cidx (c); i++)
     {
-      data(i) = tmp.data(i);
-      ridx(i) = tmp.ridx(i);
+      data (i) = tmp.data (i);
+      ridx (i) = tmp.ridx (i);
     }
   for (octave_idx_type i = 0; i < c + 1; i++)
-    cidx(i) = tmp.cidx(i);
+    cidx (i) = tmp.cidx (i);
 
-  octave_idx_type ii = cidx(c);
+  octave_idx_type ii = cidx (c);
 
   for (octave_idx_type i = c; i < c + a_cols; i++)
     {
       octave_quit ();
 
-      for (octave_idx_type j = tmp.cidx(i); j < tmp.cidx(i+1); j++)
-        if (tmp.ridx(j) < r)
+      for (octave_idx_type j = tmp.cidx (i); j < tmp.cidx (i+1); j++)
+        if (tmp.ridx (j) < r)
           {
-            data(ii) = tmp.data(j);
-            ridx(ii++) = tmp.ridx(j);
+            data (ii) = tmp.data (j);
+            ridx (ii++) = tmp.ridx (j);
           }
 
       octave_quit ();
 
-      for (octave_idx_type j = a.cidx(i-c); j < a.cidx(i-c+1); j++)
+      for (octave_idx_type j = a.cidx (i-c); j < a.cidx (i-c+1); j++)
         {
-          data(ii) = a.data(j);
-          ridx(ii++) = r + a.ridx(j);
+          data (ii) = a.data (j);
+          ridx (ii++) = r + a.ridx (j);
         }
 
       octave_quit ();
 
-      for (octave_idx_type j = tmp.cidx(i); j < tmp.cidx(i+1); j++)
-        if (tmp.ridx(j) >= r + a_rows)
+      for (octave_idx_type j = tmp.cidx (i); j < tmp.cidx (i+1); j++)
+        if (tmp.ridx (j) >= r + a_rows)
           {
-            data(ii) = tmp.data(j);
-            ridx(ii++) = tmp.ridx(j);
+            data (ii) = tmp.data (j);
+            ridx (ii++) = tmp.ridx (j);
           }
 
-      cidx(i+1) = ii;
+      cidx (i+1) = ii;
     }
 
   for (octave_idx_type i = c + a_cols; i < nc; i++)
     {
-      for (octave_idx_type j = tmp.cidx(i); j < tmp.cidx(i+1); j++)
+      for (octave_idx_type j = tmp.cidx (i); j < tmp.cidx (i+1); j++)
         {
-          data(ii) = tmp.data(j);
-          ridx(ii++) = tmp.ridx(j);
+          data (ii) = tmp.data (j);
+          ridx (ii++) = tmp.ridx (j);
         }
-      cidx(i+1) = ii;
+      cidx (i+1) = ii;
     }
 
   return *this;
@@ -1100,7 +1100,7 @@
   // retval.xcidx[1:nr] holds row entry *start* offsets for rows 0:(nr-1)
 
   for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type k = cidx(j); k < cidx(j+1); k++)
+    for (octave_idx_type k = cidx (j); k < cidx (j+1); k++)
       {
         octave_idx_type q = retval.xcidx (ridx (k) + 1)++;
         retval.xridx (q) = j;
@@ -1170,7 +1170,7 @@
           copy_or_memcpy (li, tmp.ridx (), xridx ());
           copy_or_memcpy (nz - ui, tmp.data () + ui, xdata () + li);
           mx_inline_sub (nz - ui, xridx () + li, tmp.ridx () + ui, ub - lb);
-          xcidx(1) = nz_new;
+          xcidx (1) = nz_new;
         }
       else
         {
@@ -1181,11 +1181,11 @@
           octave_idx_type sl = sidx.length (nel), nz_new = 0, j = 0;
           for (octave_idx_type i = 0; i < nz; i++)
             {
-              octave_idx_type r = tmp.ridx(i);
+              octave_idx_type r = tmp.ridx (i);
               for (;j < sl && sj[j] < r; j++) ;
               if (j == sl || sj[j] > r)
                 {
-                  data_new[nz_new] = tmp.data(i);
+                  data_new[nz_new] = tmp.data (i);
                   ridx_new[nz_new++] = r - j;
                 }
             }
@@ -1193,7 +1193,7 @@
           *this = Sparse<T> (nr - sl, 1, nz_new);
           copy_or_memcpy (nz_new, ridx_new, ridx ());
           copy_or_memcpy (nz_new, data_new, xdata ());
-          xcidx(1) = nz_new;
+          xcidx (1) = nz_new;
         }
     }
   else if (nr == 1)
@@ -1203,7 +1203,7 @@
       if (idx.is_cont_range (nc, lb, ub))
         {
           const Sparse<T> tmp = *this;
-          octave_idx_type lbi = tmp.cidx(lb), ubi = tmp.cidx(ub), new_nz = nz - (ubi - lbi);
+          octave_idx_type lbi = tmp.cidx (lb), ubi = tmp.cidx (ub), new_nz = nz - (ubi - lbi);
           *this = Sparse<T> (1, nc - (ub - lb), new_nz);
           copy_or_memcpy (lbi, tmp.data (), data ());
           copy_or_memcpy (nz - ubi, tmp.data () + ubi, xdata () + lbi);
@@ -1253,7 +1253,7 @@
           else
             {
               const Sparse<T> tmp = *this;
-              octave_idx_type lbi = tmp.cidx(lb), ubi = tmp.cidx(ub),
+              octave_idx_type lbi = tmp.cidx (lb), ubi = tmp.cidx (ub),
                 new_nz = nz - (ubi - lbi);
 
               *this = Sparse<T> (nr, nc - (ub - lb), new_nz);
@@ -1296,20 +1296,20 @@
                                  tmpl.nnz () + tmpu.nnz ());
               for (octave_idx_type j = 0, k = 0; j < nc; j++)
                 {
-                  for (octave_idx_type i = tmpl.cidx(j); i < tmpl.cidx(j+1);
+                  for (octave_idx_type i = tmpl.cidx (j); i < tmpl.cidx (j+1);
                        i++)
                     {
-                      xdata(k) = tmpl.data(i);
-                      xridx(k++) = tmpl.ridx(i);
+                      xdata (k) = tmpl.data (i);
+                      xridx (k++) = tmpl.ridx (i);
                     }
-                  for (octave_idx_type i = tmpu.cidx(j); i < tmpu.cidx(j+1);
+                  for (octave_idx_type i = tmpu.cidx (j); i < tmpu.cidx (j+1);
                        i++)
                     {
-                      xdata(k) = tmpu.data(i);
-                      xridx(k++) = tmpu.ridx(i) + lb;
+                      xdata (k) = tmpu.data (i);
+                      xridx (k++) = tmpu.ridx (i) + lb;
                     }
 
-                  xcidx(j+1) = k;
+                  xcidx (j+1) = k;
                 }
             }
         }
@@ -1373,15 +1373,15 @@
 
           for (octave_idx_type i = 0; i < nc; i++)
             {
-              for (octave_idx_type j = cidx(i); j < cidx(i+1); j++)
+              for (octave_idx_type j = cidx (i); j < cidx (i+1); j++)
                 {
-                  retval.xdata(j) = data(j);
-                  retval.xridx(j) = ridx(j) + i * nr;
+                  retval.xdata (j) = data (j);
+                  retval.xridx (j) = ridx (j) + i * nr;
                 }
             }
 
-          retval.xcidx(0) = 0;
-          retval.xcidx(1) = nz;
+          retval.xcidx (0) = 0;
+          retval.xcidx (1) = nz;
         }
     }
   else if (idx.extent (nel) > nel)
@@ -1404,7 +1404,7 @@
       // then want to make a dense matrix with sparse
       // representation. Ok, we'll do it, but you deserve what
       // you get!!
-      retval = Sparse<T> (idx_dims(0), idx_dims(1), nz ? data(0) : T ());
+      retval = Sparse<T> (idx_dims(0), idx_dims(1), nz ? data (0) : T ());
     }
   else if (nc == 1)
     {
@@ -1415,8 +1415,8 @@
         {
           // Scalar index - just a binary lookup.
           octave_idx_type i = lblookup (ridx (), nz, idx(0));
-          if (i < nz && ridx(i) == idx(0))
-            retval = Sparse (1, 1, data(i));
+          if (i < nz && ridx (i) == idx(0))
+            retval = Sparse (1, 1, data (i));
           else
             retval = Sparse (1, 1);
         }
@@ -1431,7 +1431,7 @@
           retval = Sparse<T> (ub - lb, 1, nz_new);
           copy_or_memcpy (nz_new, data () + li, retval.data ());
           mx_inline_sub (nz_new, retval.xridx (), ridx () + li, lb);
-          retval.xcidx(1) = nz_new;
+          retval.xcidx (1) = nz_new;
         }
       else if (idx.is_permutation (nel) && idx.is_vector ())
         {
@@ -1477,15 +1477,15 @@
               for (octave_idx_type i = 0; i < new_nr; i++)
                 {
                   octave_idx_type l = lidx(i, j);
-                  if (l < nz && ridx(l) == idxa(i, j))
+                  if (l < nz && ridx (l) == idxa(i, j))
                     nzj++;
                   else
                     lidx(i, j) = nz;
                 }
-              retval.xcidx(j+1) = retval.xcidx(j) + nzj;
+              retval.xcidx (j+1) = retval.xcidx (j) + nzj;
             }
 
-          retval.change_capacity (retval.xcidx(new_nc));
+          retval.change_capacity (retval.xcidx (new_nc));
 
           // Copy data and set row indices.
           octave_idx_type k = 0;
@@ -1495,8 +1495,8 @@
                 octave_idx_type l = lidx(i, j);
                 if (l < nz)
                   {
-                    retval.data(k) = data(l);
-                    retval.xridx(k++) = i;
+                    retval.data (k) = data (l);
+                    retval.xridx (k++) = i;
                   }
               }
         }
@@ -1505,11 +1505,11 @@
     {
       octave_idx_type lb, ub;
       if (idx.is_scalar ())
-        retval = Sparse<T> (1, 1, elem(0, idx(0)));
+        retval = Sparse<T> (1, 1, elem (0, idx(0)));
       else if (idx.is_cont_range (nel, lb, ub))
         {
           // Special-case a contiguous range.
-          octave_idx_type lbi = cidx(lb), ubi = cidx(ub), new_nz = ubi - lbi;
+          octave_idx_type lbi = cidx (lb), ubi = cidx (ub), new_nz = ubi - lbi;
           retval = Sparse<T> (1, ub - lb, new_nz);
           copy_or_memcpy (new_nz, data () + lbi, retval.data ());
           fill_or_memset (new_nz, static_cast<octave_idx_type> (0), retval.ridx ());
@@ -1583,7 +1583,7 @@
       else if (idx_j.is_cont_range (nc, lb, ub))
         {
           // Special-case a contiguous range.
-          octave_idx_type lbi = cidx(lb), ubi = cidx(ub), new_nz = ubi - lbi;
+          octave_idx_type lbi = cidx (lb), ubi = cidx (ub), new_nz = ubi - lbi;
           retval = Sparse<T> (nr, ub - lb, new_nz);
           copy_or_memcpy (new_nz, data () + lbi, retval.data ());
           copy_or_memcpy (new_nz, ridx () + lbi, retval.ridx ());
@@ -1596,7 +1596,7 @@
           for (octave_idx_type j = 0; j < m; j++)
             {
               octave_idx_type jj = idx_j(j);
-              retval.xcidx(j+1) = retval.xcidx(j) + (cidx(jj+1) - cidx(jj));
+              retval.xcidx (j+1) = retval.xcidx (j) + (cidx (jj+1) - cidx (jj));
             }
 
           retval.change_capacity (retval.xcidx (m));
@@ -1604,8 +1604,8 @@
           // Copy data & indices.
           for (octave_idx_type j = 0; j < m; j++)
             {
-              octave_idx_type ljj = cidx(idx_j(j));
-              octave_idx_type lj = retval.xcidx(j), nzj = retval.xcidx(j+1) - lj;
+              octave_idx_type ljj = cidx (idx_j(j));
+              octave_idx_type lj = retval.xcidx (j), nzj = retval.xcidx (j+1) - lj;
               copy_or_memcpy (nzj, data () + ljj, retval.data () + lj);
               copy_or_memcpy (nzj, ridx () + ljj, retval.ridx () + lj);
             }
@@ -1628,28 +1628,28 @@
       for (octave_idx_type j = 0; j < m; j++)
         {
           octave_quit ();
-          octave_idx_type jj = idx_j(j), lj = cidx(jj), nzj = cidx(jj+1) - cidx(jj);
+          octave_idx_type jj = idx_j(j), lj = cidx (jj), nzj = cidx (jj+1) - cidx (jj);
           // Scalar index - just a binary lookup.
           octave_idx_type i = lblookup (ridx () + lj, nzj, ii);
-          if (i < nzj && ridx(i+lj) == ii)
+          if (i < nzj && ridx (i+lj) == ii)
             {
               ij[j] = i + lj;
-              retval.xcidx(j+1) = retval.xcidx(j) + 1;
+              retval.xcidx (j+1) = retval.xcidx (j) + 1;
             }
           else
-            retval.xcidx(j+1) = retval.xcidx(j);
+            retval.xcidx (j+1) = retval.xcidx (j);
         }
 
-      retval.change_capacity (retval.xcidx(m));
+      retval.change_capacity (retval.xcidx (m));
 
       // Copy data, adjust row indices.
       for (octave_idx_type j = 0; j < m; j++)
         {
-          octave_idx_type i = retval.xcidx(j);
-          if (retval.xcidx(j+1) > i)
+          octave_idx_type i = retval.xcidx (j);
+          if (retval.xcidx (j+1) > i)
             {
-              retval.xridx(i) = 0;
-              retval.xdata(i) = data(ij[j]);
+              retval.xridx (i) = 0;
+              retval.xdata (i) = data (ij[j]);
             }
         }
     }
@@ -1661,15 +1661,15 @@
       for (octave_idx_type j = 0; j < m; j++)
         {
           octave_quit ();
-          octave_idx_type jj = idx_j(j), lj = cidx(jj), nzj = cidx(jj+1) - cidx(jj);
+          octave_idx_type jj = idx_j(j), lj = cidx (jj), nzj = cidx (jj+1) - cidx (jj);
           octave_idx_type lij, uij;
           // Lookup indices.
           li[j] = lij = lblookup (ridx () + lj, nzj, lb) + lj;
           ui[j] = uij = lblookup (ridx () + lj, nzj, ub) + lj;
-          retval.xcidx(j+1) = retval.xcidx(j) + ui[j] - li[j];
+          retval.xcidx (j+1) = retval.xcidx (j) + ui[j] - li[j];
         }
 
-      retval.change_capacity (retval.xcidx(m));
+      retval.change_capacity (retval.xcidx (m));
 
       // Copy data, adjust row indices.
       for (octave_idx_type j = 0, k = 0; j < m; j++)
@@ -1677,8 +1677,8 @@
           octave_quit ();
           for (octave_idx_type i = li[j]; i < ui[j]; i++)
             {
-              retval.xdata(k) = data(i);
-              retval.xridx(k++) = ridx(i) - lb;
+              retval.xdata (k) = data (i);
+              retval.xridx (k++) = ridx (i) - lb;
             }
         }
     }
@@ -1690,7 +1690,7 @@
       for (octave_idx_type j = 0; j < m; j++)
         {
           octave_idx_type jj = idx_j(j);
-          retval.xcidx(j+1) = retval.xcidx(j) + (cidx(jj+1) - cidx(jj));
+          retval.xcidx (j+1) = retval.xcidx (j) + (cidx (jj+1) - cidx (jj));
         }
 
       retval.change_capacity (retval.xcidx (m));
@@ -1703,12 +1703,12 @@
           for (octave_idx_type j = 0; j < m; j++)
             {
               octave_quit ();
-              octave_idx_type jj = idx_j(j), lj = cidx(jj), nzj = cidx(jj+1) - cidx(jj);
-              octave_idx_type li = retval.xcidx(j), uj = lj + nzj - 1;
+              octave_idx_type jj = idx_j(j), lj = cidx (jj), nzj = cidx (jj+1) - cidx (jj);
+              octave_idx_type li = retval.xcidx (j), uj = lj + nzj - 1;
               for (octave_idx_type i = 0; i < nzj; i++)
                 {
-                  retval.xdata(li + i) = data(uj - i); // Copy in reverse order.
-                  retval.xridx(li + i) = nr - 1 - ridx(uj - i); // Ditto with transform.
+                  retval.xdata (li + i) = data (uj - i); // Copy in reverse order.
+                  retval.xridx (li + i) = nr - 1 - ridx (uj - i); // Ditto with transform.
                 }
             }
         }
@@ -1725,11 +1725,11 @@
           for (octave_idx_type j = 0; j < m; j++)
             {
               octave_quit ();
-              octave_idx_type jj = idx_j(j), lj = cidx(jj), nzj = cidx(jj+1) - cidx(jj);
-              octave_idx_type li = retval.xcidx(j);
+              octave_idx_type jj = idx_j(j), lj = cidx (jj), nzj = cidx (jj+1) - cidx (jj);
+              octave_idx_type li = retval.xcidx (j);
               // Scatter the column, transform indices.
               for (octave_idx_type i = 0; i < nzj; i++)
-                scb[rri[li + i] = iinv[ridx(lj + i)]] = data(lj + i);
+                scb[rri[li + i] = iinv[ridx (lj + i)]] = data (lj + i);
 
               octave_quit ();
 
@@ -1738,7 +1738,7 @@
 
               // Gather.
               for (octave_idx_type i = 0; i < nzj; i++)
-                retval.xdata(li + i) = scb[rri[li + i]];
+                retval.xdata (li + i) = scb[rri[li + i]];
             }
         }
 
@@ -1846,7 +1846,7 @@
                   copy_or_memcpy (nz - ui, tmp.ridx () + ui, ridx () + li + rnz);
                 }
 
-              cidx(1) = new_nz;
+              cidx (1) = new_nz;
             }
           else if (idx.is_range () && idx.increment () == -1)
             {
@@ -1866,7 +1866,7 @@
                   octave_idx_type iidx = idx(i);
                   octave_idx_type li = lblookup (ri, nz, iidx);
                   if (li != nz && ri[li] == iidx)
-                    xdata(li) = T ();
+                    xdata (li) = T ();
                 }
 
               maybe_compress (true);
@@ -1985,7 +1985,7 @@
           else if (idx_j.is_cont_range (nc, lb, ub))
             {
               // Special-case a contiguous range.
-              octave_idx_type li = cidx(lb), ui = cidx(ub);
+              octave_idx_type li = cidx (lb), ui = cidx (ub);
               octave_idx_type rnz = rhs.nnz (), new_nz = nz - (ui - li) + rnz;
 
               if (new_nz >= nz && new_nz <= capacity ())
@@ -2051,36 +2051,36 @@
 
               // Assemble column lengths.
               for (octave_idx_type i = 0; i < nc; i++)
-                xcidx(i+1) = tmp.cidx(i+1) - tmp.cidx(i);
+                xcidx (i+1) = tmp.cidx (i+1) - tmp.cidx (i);
 
               for (octave_idx_type i = 0; i < m; i++)
                 {
                   octave_idx_type j =idx_j(i);
                   jsav[j] = i;
-                  xcidx(j+1) = rhs.cidx(i+1) - rhs.cidx(i);
+                  xcidx (j+1) = rhs.cidx (i+1) - rhs.cidx (i);
                 }
 
               // Make cumulative.
               for (octave_idx_type i = 0; i < nc; i++)
-                xcidx(i+1) += xcidx(i);
+                xcidx (i+1) += xcidx (i);
 
               change_capacity (nnz ());
 
               // Merge columns.
               for (octave_idx_type i = 0; i < nc; i++)
                 {
-                  octave_idx_type l = xcidx(i), u = xcidx(i+1), j = jsav[i];
+                  octave_idx_type l = xcidx (i), u = xcidx (i+1), j = jsav[i];
                   if (j >= 0)
                     {
                       // from rhs
-                      octave_idx_type k = rhs.cidx(j);
+                      octave_idx_type k = rhs.cidx (j);
                       copy_or_memcpy (u - l, rhs.data () + k, xdata () + l);
                       copy_or_memcpy (u - l, rhs.ridx () + k, xridx () + l);
                     }
                   else
                     {
                       // original
-                      octave_idx_type k = tmp.cidx(i);
+                      octave_idx_type k = tmp.cidx (i);
                       copy_or_memcpy (u - l, tmp.data () + k, xdata () + l);
                       copy_or_memcpy (u - l, tmp.ridx () + k, xridx () + l);
                     }
@@ -2183,26 +2183,26 @@
 
   for (octave_idx_type j = 0; j < nc; j++)
     {
-      octave_idx_type ns = mcidx [j + 1] - mcidx [j];
+      octave_idx_type ns = mcidx[j + 1] - mcidx[j];
       lsort.sort (v, ns);
 
       octave_idx_type i;
       if (mode == ASCENDING)
         {
           for (i = 0; i < ns; i++)
-            if (sparse_ascending_compare<T> (static_cast<T> (0), v [i]))
+            if (sparse_ascending_compare<T> (static_cast<T> (0), v[i]))
               break;
         }
       else
         {
           for (i = 0; i < ns; i++)
-            if (sparse_descending_compare<T> (static_cast<T> (0), v [i]))
+            if (sparse_descending_compare<T> (static_cast<T> (0), v[i]))
               break;
         }
       for (octave_idx_type k = 0; k < i; k++)
-        mridx [k] = k;
+        mridx[k] = k;
       for (octave_idx_type k = i; k < ns; k++)
-        mridx [k] = k - ns + nr;
+        mridx[k] = k - ns + nr;
 
       v += ns;
       mridx += ns;
@@ -2255,7 +2255,7 @@
 
   for (octave_idx_type j = 0; j < nc; j++)
     {
-      octave_idx_type ns = mcidx [j + 1] - mcidx [j];
+      octave_idx_type ns = mcidx[j + 1] - mcidx[j];
       octave_idx_type offset = j * nr;
 
       if (ns == 0)
@@ -2296,14 +2296,14 @@
 
           for (octave_idx_type k = 0; k < i; k++)
             {
-              sidx (k + offset) = vi [k];
-              mridx [k] = k;
+              sidx (k + offset) = vi[k];
+              mridx[k] = k;
             }
 
           for (octave_idx_type k = i; k < ns; k++)
             {
-              sidx (k - ns + nr + offset) = vi [k];
-              mridx [k] = k - ns + nr;
+              sidx (k - ns + nr + offset) = vi[k];
+              mridx[k] = k - ns + nr;
             }
 
           v += ns;
@@ -2437,12 +2437,12 @@
 
               for (octave_idx_type j = 0; j < nnc; j++)
                 {
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                     {
                       d.xdata (i) = data (i);
                       d.xridx (i) = j + roff;
                     }
-                  d.xcidx (j + coff + 1) = cidx(j+1);
+                  d.xcidx (j + coff + 1) = cidx (j+1);
                 }
 
               for (octave_idx_type i = nnc + coff + 1; i < n + 1; i++)
@@ -2459,7 +2459,7 @@
           if (nnz () > 0)
             {
               octave_idx_type ii = 0;
-              octave_idx_type ir = ridx(0);
+              octave_idx_type ir = ridx (0);
 
               for (octave_idx_type i = 0; i < coff+1; i++)
                 d.xcidx (i) = 0;
@@ -2545,17 +2545,17 @@
                 if (spi.is_empty ())
                   continue;
 
-                octave_idx_type kl = spi.cidx(j), ku = spi.cidx(j+1);
+                octave_idx_type kl = spi.cidx (j), ku = spi.cidx (j+1);
                 for (octave_idx_type k = kl; k < ku; k++, l++)
                   {
-                    retval.xridx(l) = spi.ridx(k) + rcum;
-                    retval.xdata(l) = spi.data(k);
+                    retval.xridx (l) = spi.ridx (k) + rcum;
+                    retval.xdata (l) = spi.data (k);
                   }
 
                 rcum += spi.rows ();
               }
 
-            retval.xcidx(j+1) = l;
+            retval.xcidx (j+1) = l;
           }
 
         break;
@@ -2595,15 +2595,15 @@
       octave_idx_type i = 0;
       for (octave_idx_type j = 0, nc = cols (); j < nc; j++)
         {
-          if (cidx(j+1) > i)
+          if (cidx (j+1) > i)
             retval(j) = data (i++);
         }
     }
   else
     {
       for (octave_idx_type j = 0, nc = cols (); j < nc; j++)
-        for (octave_idx_type i = cidx(j), iu = cidx(j+1); i < iu; i++)
-          retval(ridx(i), j) = data (i);
+        for (octave_idx_type i = cidx (j), iu = cidx (j+1); i < iu; i++)
+          retval(ridx (i), j) = data (i);
     }
 
   return retval;
@@ -2643,12 +2643,12 @@
 %!  x = ones (size);
 %!  s = set_slice (sparse (x), dim, slice);
 %!  f = set_slice (x, dim, slice);
-%!  assert (nnz(s), nnz(f));
-%!  assert (full(s), f);
-%!  s = set_slice2 (sparse(x), dim, slice);
+%!  assert (nnz (s), nnz (f));
+%!  assert (full (s), f);
+%!  s = set_slice2 (sparse (x), dim, slice);
 %!  f = set_slice2 (x, dim, slice);
-%!  assert (nnz(s), nnz(f));
-%!  assert (full(s), f);
+%!  assert (nnz (s), nnz (f));
+%!  assert (full (s), f);
 %!endfunction
 
 #### 1d indexing
@@ -2780,7 +2780,7 @@
 %! assert (s, sparse (magic (5)(:, [1,5])));
 
 %!test
-%! s = sparse([], [], [], 1, 1);
+%! s = sparse ([], [], [], 1, 1);
 %! s(1,:) = [];
 %! assert (s, sparse ([], [], [], 0, 1));
 
--- a/liboctave/Sparse.h
+++ b/liboctave/Sparse.h
@@ -111,7 +111,7 @@
 
     octave_idx_type length (void) const { return nzmx; }
 
-    octave_idx_type nnz (void) const { return c [ncols]; }
+    octave_idx_type nnz (void) const { return c[ncols]; }
 
     T& elem (octave_idx_type _r, octave_idx_type _c);
 
@@ -268,7 +268,7 @@
   octave_idx_type get_col_index (octave_idx_type k)
   {
     octave_idx_type ret = 0;
-    while (cidx(ret+1) < k)
+    while (cidx (ret+1) < k)
       ret++;
     return ret;
   }
@@ -599,11 +599,11 @@
         result = Sparse<U> (nr, nc, f_zero);
 
         for (octave_idx_type j = 0; j < nc; j++)
-          for (octave_idx_type i = cidx(j); i < cidx (j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               octave_quit ();
               /* Use data instead of elem for better performance.  */
-              result.data (ridx (i) + j * nr) = fcn (data(i));
+              result.data (ridx (i) + j * nr) = fcn (data (i));
             }
 
         result.maybe_compress (true);
@@ -620,7 +620,7 @@
 
         for (octave_idx_type j = 0; j < nc; j++)
           {
-            for (octave_idx_type i = cidx(j); i < cidx (j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 U val = fcn (data (i));
                 if (val != 0.0)
@@ -709,7 +709,7 @@
           else if (jtmp > jold)
             {
               for (octave_idx_type j = jold; j < jtmp; j++)
-                a.cidx(j+1) = ii;
+                a.cidx (j+1) = ii;
             }
           else if (itmp < iold)
             {
@@ -734,7 +734,7 @@
         }
 
       for (octave_idx_type j = jold; j < nc; j++)
-        a.cidx(j+1) = ii;
+        a.cidx (j+1) = ii;
     }
 
  done:
--- a/liboctave/SparseCmplxCHOL.cc
+++ b/liboctave/SparseCmplxCHOL.cc
@@ -51,12 +51,12 @@
 
       if (typ == MatrixType::Upper)
         {
-          rinv = r.inverse(mattype, info, rcond, true, false);
+          rinv = r.inverse (mattype, info, rcond, true, false);
           retval = rinv.transpose () * rinv;
         }
       else if (typ == MatrixType::Lower)
         {
-          rinv = r.transpose ().inverse(mattype, info, rcond, true, false);
+          rinv = r.transpose ().inverse (mattype, info, rcond, true, false);
           retval = rinv.transpose () * rinv;
         }
       else
--- a/liboctave/SparseCmplxLU.cc
+++ b/liboctave/SparseCmplxLU.cc
@@ -326,7 +326,7 @@
         OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc);
 
         for (octave_idx_type i = 0; i < nc; i++)
-          qinit [i] = static_cast<octave_idx_type> (Qinit (i));
+          qinit[i] = static_cast<octave_idx_type> (Qinit (i));
 
         status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai,
                                        reinterpret_cast<const double *> (Ax),
--- a/liboctave/SparseCmplxQR.cc
+++ b/liboctave/SparseCmplxQR.cc
@@ -69,7 +69,7 @@
                                       (a.data ()));
   A.nz = -1;
   BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
   S = CXSPARSE_ZNAME (_sqr) (order, &A, 1);
 #else
   S = CXSPARSE_ZNAME (_sqr) (&A, order - 1, 1);
@@ -130,10 +130,10 @@
 #ifdef HAVE_CXSPARSE
   ColumnVector ret(N->L->m);
   for (octave_idx_type i = 0; i < N->L->m; i++)
-#if defined(CS_VER) && (CS_VER >= 2)
-    ret.xelem(i) = S->pinv[i];
+#if defined (CS_VER) && (CS_VER >= 2)
+    ret.xelem (i) = S->pinv[i];
 #else
-    ret.xelem(i) = S->Pinv[i];
+    ret.xelem (i) = S->Pinv[i];
 #endif
   return ret;
 #else
@@ -147,10 +147,10 @@
 #ifdef HAVE_CXSPARSE
   ColumnVector ret(N->L->m);
   for (octave_idx_type i = 0; i < N->L->m; i++)
-#if defined(CS_VER) && (CS_VER >= 2)
-    ret.xelem(S->pinv[i]) = i;
+#if defined (CS_VER) && (CS_VER >= 2)
+    ret.xelem (S->pinv[i]) = i;
 #else
-    ret.xelem(S->Pinv[i]) = i;
+    ret.xelem (S->Pinv[i]) = i;
 #endif
   return ret;
 #else
@@ -212,7 +212,7 @@
           octave_quit ();
           volatile octave_idx_type nm = (nr < nc ? nr : nc);
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec)
             (S->pinv, bvec + idx, reinterpret_cast<cs_complex_t *>(buf), b_nr);
 #else
@@ -262,7 +262,7 @@
           bvec[j] = OCTAVE_C99_ONE;
           volatile octave_idx_type nm = (nr < nc ? nr : nc);
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec)
             (S->pinv, bvec, reinterpret_cast<cs_complex_t *>(buf), nr);
 #else
@@ -290,7 +290,7 @@
 }
 
 ComplexMatrix
-qrsolve(const SparseComplexMatrix&a, const Matrix &b, octave_idx_type &info)
+qrsolve (const SparseComplexMatrix&a, const Matrix &b, octave_idx_type &info)
 {
   info = -1;
 #ifdef HAVE_CXSPARSE
@@ -310,7 +310,7 @@
       SparseComplexQR q (a, 2);
       if (! q.ok ())
         return ComplexMatrix ();
-      x.resize(nc, b_nc);
+      x.resize (nc, b_nc);
       cs_complex_t *vec = reinterpret_cast<cs_complex_t *>
         (x.fortran_vec ());
       OCTAVE_C99_COMPLEX (buf, q.S ()->m2);
@@ -319,11 +319,11 @@
         {
           octave_quit ();
           for (octave_idx_type j = 0; j < b_nr; j++)
-            Xx[j] = b.xelem(j,i);
+            Xx[j] = b.xelem (j,i);
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = OCTAVE_C99_ZERO;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec)
             (q.S ()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr);
 #else
@@ -340,7 +340,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_ZNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec) (q.S ()->q, buf, vec + idx, nc);
 #else
           CXSPARSE_ZNAME (_ipvec) (nc, q.S ()->Q, buf, vec + idx);
@@ -355,30 +355,30 @@
       SparseComplexQR q (at, 2);
       if (! q.ok ())
         return ComplexMatrix ();
-      x.resize(nc, b_nc);
+      x.resize (nc, b_nc);
       cs_complex_t *vec = reinterpret_cast<cs_complex_t *>
         (x.fortran_vec ());
       volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2);
       OCTAVE_C99_COMPLEX (buf, nbuf);
       OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr);
-#if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
+#if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
       OCTAVE_LOCAL_BUFFER (double, B, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        B[i] = q.N ()->B [i];
+        B[i] = q.N ()->B[i];
 #else
       OCTAVE_LOCAL_BUFFER (Complex, B, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B) [i]);
+        B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B)[i]);
 #endif
       for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc)
         {
           octave_quit ();
           for (octave_idx_type j = 0; j < b_nr; j++)
-            Xx[j] = b.xelem(j,i);
+            Xx[j] = b.xelem (j,i);
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = OCTAVE_C99_ZERO;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_pvec)
             (q.S ()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr);
 #else
@@ -392,7 +392,7 @@
               octave_quit ();
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
 
-#if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
+#if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
               CXSPARSE_ZNAME (_happly) (q.N ()->L, j, B[j], buf);
 #else
               CXSPARSE_ZNAME (_happly)
@@ -401,7 +401,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_pvec) (q.S ()->pinv, buf, vec + idx, nc);
 #else
           CXSPARSE_ZNAME (_pvec) (nc, q.S ()->Pinv, buf, vec + idx);
@@ -418,7 +418,7 @@
 }
 
 SparseComplexMatrix
-qrsolve(const SparseComplexMatrix&a, const SparseMatrix &b, octave_idx_type &info)
+qrsolve (const SparseComplexMatrix&a, const SparseMatrix &b, octave_idx_type &info)
 {
   info = -1;
 #ifdef HAVE_CXSPARSE
@@ -440,7 +440,7 @@
       if (! q.ok ())
         return SparseComplexMatrix ();
       x = SparseComplexMatrix (nc, b_nc, b.nnz ());
-      x.xcidx(0) = 0;
+      x.xcidx (0) = 0;
       x_nz = b.nnz ();
       ii = 0;
       OCTAVE_LOCAL_BUFFER (Complex, Xx, (b_nr > nc ? b_nr : nc));
@@ -449,11 +449,11 @@
         {
           octave_quit ();
           for (octave_idx_type j = 0; j < b_nr; j++)
-            Xx[j] = b.xelem(j,i);
+            Xx[j] = b.xelem (j,i);
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = OCTAVE_C99_ZERO;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec)
             (q.S ()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr);
 #else
@@ -470,7 +470,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_ZNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec)
             (q.S ()->q, buf, reinterpret_cast<cs_complex_t *>(Xx), nc);
 #else
@@ -492,11 +492,11 @@
                       x.change_capacity (sz);
                       x_nz = sz;
                     }
-                  x.xdata(ii) = tmp;
-                  x.xridx(ii++) = j;
+                  x.xdata (ii) = tmp;
+                  x.xridx (ii++) = j;
                 }
             }
-          x.xcidx(i+1) = ii;
+          x.xcidx (i+1) = ii;
         }
       info = 0;
     }
@@ -507,31 +507,31 @@
       if (! q.ok ())
         return SparseComplexMatrix ();
       x = SparseComplexMatrix (nc, b_nc, b.nnz ());
-      x.xcidx(0) = 0;
+      x.xcidx (0) = 0;
       x_nz = b.nnz ();
       ii = 0;
       volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2);
       OCTAVE_LOCAL_BUFFER (Complex, Xx, (b_nr > nc ? b_nr : nc));
       OCTAVE_C99_COMPLEX (buf, nbuf);
 
-#if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
+#if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
       OCTAVE_LOCAL_BUFFER (double, B, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        B[i] = q.N ()->B [i];
+        B[i] = q.N ()->B[i];
 #else
       OCTAVE_LOCAL_BUFFER (Complex, B, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B) [i]);
+        B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B)[i]);
 #endif
       for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc)
         {
           octave_quit ();
           for (octave_idx_type j = 0; j < b_nr; j++)
-            Xx[j] = b.xelem(j,i);
+            Xx[j] = b.xelem (j,i);
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = OCTAVE_C99_ZERO;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_pvec)
             (q.S ()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr);
 #else
@@ -544,7 +544,7 @@
             {
               octave_quit ();
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
+#if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
               CXSPARSE_ZNAME (_happly) (q.N ()->L, j, B[j], buf);
 #else
               CXSPARSE_ZNAME (_happly)
@@ -553,7 +553,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_pvec)
             (q.S ()->pinv, buf, reinterpret_cast<cs_complex_t *>(Xx), nc);
 #else
@@ -575,11 +575,11 @@
                       x.change_capacity (sz);
                       x_nz = sz;
                     }
-                  x.xdata(ii) = tmp;
-                  x.xridx(ii++) = j;
+                  x.xdata (ii) = tmp;
+                  x.xridx (ii++) = j;
                 }
             }
-          x.xcidx(i+1) = ii;
+          x.xcidx (i+1) = ii;
         }
       info = 0;
     }
@@ -592,7 +592,7 @@
 }
 
 ComplexMatrix
-qrsolve(const SparseComplexMatrix&a, const ComplexMatrix &b, octave_idx_type &info)
+qrsolve (const SparseComplexMatrix&a, const ComplexMatrix &b, octave_idx_type &info)
 {
   info = -1;
 #ifdef HAVE_CXSPARSE
@@ -614,7 +614,7 @@
       SparseComplexQR q (a, 2);
       if (! q.ok ())
         return ComplexMatrix ();
-      x.resize(nc, b_nc);
+      x.resize (nc, b_nc);
       cs_complex_t *vec = reinterpret_cast<cs_complex_t *>
         (x.fortran_vec ());
       OCTAVE_C99_COMPLEX (buf, q.S ()->m2);
@@ -625,7 +625,7 @@
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = OCTAVE_C99_ZERO;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec) (q.S ()->pinv, bvec + bidx, buf, nr);
 #else
           CXSPARSE_ZNAME (_ipvec) (nr, q.S ()->Pinv, bvec + bidx, buf);
@@ -640,7 +640,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_ZNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec) (q.S ()->q, buf, vec + idx, nc);
 #else
           CXSPARSE_ZNAME (_ipvec) (nc, q.S ()->Q, buf, vec + idx);
@@ -655,19 +655,19 @@
       SparseComplexQR q (at, 2);
       if (! q.ok ())
         return ComplexMatrix ();
-      x.resize(nc, b_nc);
+      x.resize (nc, b_nc);
       cs_complex_t *vec = reinterpret_cast<cs_complex_t *>
         (x.fortran_vec ());
       volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2);
       OCTAVE_C99_COMPLEX (buf, nbuf);
-#if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
+#if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
       OCTAVE_LOCAL_BUFFER (double, B, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        B[i] = q.N ()->B [i];
+        B[i] = q.N ()->B[i];
 #else
       OCTAVE_LOCAL_BUFFER (Complex, B, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B) [i]);
+        B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B)[i]);
 #endif
       for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc;
            i++, idx+=nc, bidx+=b_nr)
@@ -676,7 +676,7 @@
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = OCTAVE_C99_ZERO;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_pvec) (q.S ()->q, bvec + bidx, buf, nr);
 #else
           CXSPARSE_ZNAME (_pvec) (nr, q.S ()->Q, bvec + bidx, buf);
@@ -687,7 +687,7 @@
             {
               octave_quit ();
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
+#if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
               CXSPARSE_ZNAME (_happly) (q.N ()->L, j, B[j], buf);
 #else
               CXSPARSE_ZNAME (_happly)
@@ -696,7 +696,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_pvec) (q.S ()->pinv, buf, vec + idx, nc);
 #else
           CXSPARSE_ZNAME (_pvec) (nc, q.S ()->Pinv, buf, vec + idx);
@@ -713,7 +713,7 @@
 }
 
 SparseComplexMatrix
-qrsolve(const SparseComplexMatrix&a, const SparseComplexMatrix &b, octave_idx_type &info)
+qrsolve (const SparseComplexMatrix&a, const SparseComplexMatrix &b, octave_idx_type &info)
 {
   info = -1;
 #ifdef HAVE_CXSPARSE
@@ -735,7 +735,7 @@
       if (! q.ok ())
         return SparseComplexMatrix ();
       x = SparseComplexMatrix (nc, b_nc, b.nnz ());
-      x.xcidx(0) = 0;
+      x.xcidx (0) = 0;
       x_nz = b.nnz ();
       ii = 0;
       OCTAVE_LOCAL_BUFFER (Complex, Xx, (b_nr > nc ? b_nr : nc));
@@ -744,11 +744,11 @@
         {
           octave_quit ();
           for (octave_idx_type j = 0; j < b_nr; j++)
-            Xx[j] = b.xelem(j,i);
+            Xx[j] = b.xelem (j,i);
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = OCTAVE_C99_ZERO;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec)
             (q.S ()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr);
 #else
@@ -765,7 +765,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_ZNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_ipvec)
             (q.S ()->q, buf, reinterpret_cast<cs_complex_t *>(Xx), nc);
 #else
@@ -787,11 +787,11 @@
                       x.change_capacity (sz);
                       x_nz = sz;
                     }
-                  x.xdata(ii) = tmp;
-                  x.xridx(ii++) = j;
+                  x.xdata (ii) = tmp;
+                  x.xridx (ii++) = j;
                 }
             }
-          x.xcidx(i+1) = ii;
+          x.xcidx (i+1) = ii;
         }
       info = 0;
     }
@@ -802,30 +802,30 @@
       if (! q.ok ())
         return SparseComplexMatrix ();
       x = SparseComplexMatrix (nc, b_nc, b.nnz ());
-      x.xcidx(0) = 0;
+      x.xcidx (0) = 0;
       x_nz = b.nnz ();
       ii = 0;
       volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2);
       OCTAVE_LOCAL_BUFFER (Complex, Xx, (b_nr > nc ? b_nr : nc));
       OCTAVE_C99_COMPLEX (buf, nbuf);
-#if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
+#if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
       OCTAVE_LOCAL_BUFFER (double, B, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        B[i] = q.N ()->B [i];
+        B[i] = q.N ()->B[i];
 #else
       OCTAVE_LOCAL_BUFFER (Complex, B, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B) [i]);
+        B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B)[i]);
 #endif
       for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc)
         {
           octave_quit ();
           for (octave_idx_type j = 0; j < b_nr; j++)
-            Xx[j] = b.xelem(j,i);
+            Xx[j] = b.xelem (j,i);
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = OCTAVE_C99_ZERO;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_pvec)
             (q.S ()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr);
 #else
@@ -838,7 +838,7 @@
             {
               octave_quit ();
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
+#if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2))
               CXSPARSE_ZNAME (_happly) (q.N ()->L, j, B[j], buf);
 #else
               CXSPARSE_ZNAME (_happly)
@@ -847,7 +847,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_ZNAME (_pvec)
             (q.S ()->pinv, buf, reinterpret_cast<cs_complex_t *>(Xx), nc);
 #else
@@ -869,11 +869,11 @@
                       x.change_capacity (sz);
                       x_nz = sz;
                     }
-                  x.xdata(ii) = tmp;
-                  x.xridx(ii++) = j;
+                  x.xdata (ii) = tmp;
+                  x.xridx (ii++) = j;
                 }
             }
-          x.xcidx(i+1) = ii;
+          x.xcidx (i+1) = ii;
         }
       info = 0;
     }
--- a/liboctave/SparseQR.cc
+++ b/liboctave/SparseQR.cc
@@ -48,7 +48,7 @@
   A.x = const_cast<double *>(a.data ());
   A.nz = -1;
   BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
   S = CXSPARSE_DNAME (_sqr) (order, &A, 1);
 #else
   S = CXSPARSE_DNAME (_sqr) (&A, order - 1, 1);
@@ -110,10 +110,10 @@
 #ifdef HAVE_CXSPARSE
   ColumnVector ret(N->L->m);
   for (octave_idx_type i = 0; i < N->L->m; i++)
-#if defined(CS_VER) && (CS_VER >= 2)
-    ret.xelem(i) = S->pinv[i];
+#if defined (CS_VER) && (CS_VER >= 2)
+    ret.xelem (i) = S->pinv[i];
 #else
-    ret.xelem(i) = S->Pinv[i];
+    ret.xelem (i) = S->Pinv[i];
 #endif
   return ret;
 #else
@@ -127,10 +127,10 @@
 #ifdef HAVE_CXSPARSE
   ColumnVector ret(N->L->m);
   for (octave_idx_type i = 0; i < N->L->m; i++)
-#if defined(CS_VER) && (CS_VER >= 2)
-    ret.xelem(S->pinv[i]) = i;
+#if defined (CS_VER) && (CS_VER >= 2)
+    ret.xelem (S->pinv[i]) = i;
 #else
-    ret.xelem(S->Pinv[i]) = i;
+    ret.xelem (S->Pinv[i]) = i;
 #endif
   return ret;
 #else
@@ -195,7 +195,7 @@
             buf[i] = 0.;
           volatile octave_idx_type nm = (nr < nc ? nr : nc);
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (S->pinv, bvec + idx, buf, b_nr);
 #else
           CXSPARSE_DNAME (_ipvec) (b_nr, S->Pinv, bvec + idx, buf);
@@ -245,7 +245,7 @@
             buf[i] = 0.;
           volatile octave_idx_type nm = (nr < nc ? nr : nc);
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (S->pinv, bvec, buf, nr);
 #else
           CXSPARSE_DNAME (_ipvec) (nr, S->Pinv, bvec, buf);
@@ -271,7 +271,7 @@
 }
 
 Matrix
-qrsolve(const SparseMatrix&a, const Matrix &b, octave_idx_type& info)
+qrsolve (const SparseMatrix&a, const Matrix &b, octave_idx_type& info)
 {
   info = -1;
 #ifdef HAVE_CXSPARSE
@@ -292,7 +292,7 @@
       SparseQR q (a, 3);
       if (! q.ok ())
         return Matrix ();
-      x.resize(nc, b_nc);
+      x.resize (nc, b_nc);
       double *vec = x.fortran_vec ();
       OCTAVE_LOCAL_BUFFER (double, buf, q.S ()->m2);
       for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc;
@@ -302,7 +302,7 @@
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, bvec + bidx, buf, nr);
 #else
           CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, bvec + bidx, buf);
@@ -317,7 +317,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_DNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, vec + idx, nc);
 #else
           CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, vec + idx);
@@ -332,7 +332,7 @@
       SparseQR q (at, 3);
       if (! q.ok ())
         return Matrix ();
-      x.resize(nc, b_nc);
+      x.resize (nc, b_nc);
       double *vec = x.fortran_vec ();
       volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2);
       OCTAVE_LOCAL_BUFFER (double, buf, nbuf);
@@ -343,7 +343,7 @@
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->q, bvec + bidx, buf, nr);
 #else
           CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, bvec + bidx, buf);
@@ -358,7 +358,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, vec + idx, nc);
 #else
           CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, vec + idx);
@@ -375,7 +375,7 @@
 }
 
 SparseMatrix
-qrsolve(const SparseMatrix&a, const SparseMatrix &b, octave_idx_type &info)
+qrsolve (const SparseMatrix&a, const SparseMatrix &b, octave_idx_type &info)
 {
   info = -1;
 #ifdef HAVE_CXSPARSE
@@ -397,7 +397,7 @@
       if (! q.ok ())
         return SparseMatrix ();
       x = SparseMatrix (nc, b_nc, b.nnz ());
-      x.xcidx(0) = 0;
+      x.xcidx (0) = 0;
       x_nz = b.nnz ();
       ii = 0;
       OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc));
@@ -406,11 +406,11 @@
         {
           octave_quit ();
           for (octave_idx_type j = 0; j < b_nr; j++)
-            Xx[j] = b.xelem(j,i);
+            Xx[j] = b.xelem (j,i);
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xx, buf, nr);
 #else
           CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xx, buf);
@@ -425,7 +425,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_DNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xx, nc);
 #else
           CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xx);
@@ -445,11 +445,11 @@
                       x.change_capacity (sz);
                       x_nz = sz;
                     }
-                  x.xdata(ii) = tmp;
-                  x.xridx(ii++) = j;
+                  x.xdata (ii) = tmp;
+                  x.xridx (ii++) = j;
                 }
             }
-          x.xcidx(i+1) = ii;
+          x.xcidx (i+1) = ii;
         }
       info = 0;
     }
@@ -460,7 +460,7 @@
       if (! q.ok ())
         return SparseMatrix ();
       x = SparseMatrix (nc, b_nc, b.nnz ());
-      x.xcidx(0) = 0;
+      x.xcidx (0) = 0;
       x_nz = b.nnz ();
       ii = 0;
       volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2);
@@ -470,11 +470,11 @@
         {
           octave_quit ();
           for (octave_idx_type j = 0; j < b_nr; j++)
-            Xx[j] = b.xelem(j,i);
+            Xx[j] = b.xelem (j,i);
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->q, Xx, buf, nr);
 #else
           CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xx, buf);
@@ -489,7 +489,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xx, nc);
 #else
           CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xx);
@@ -509,11 +509,11 @@
                       x.change_capacity (sz);
                       x_nz = sz;
                     }
-                  x.xdata(ii) = tmp;
-                  x.xridx(ii++) = j;
+                  x.xdata (ii) = tmp;
+                  x.xridx (ii++) = j;
                 }
             }
-          x.xcidx(i+1) = ii;
+          x.xcidx (i+1) = ii;
         }
       info = 0;
     }
@@ -526,7 +526,7 @@
 }
 
 ComplexMatrix
-qrsolve(const SparseMatrix&a, const ComplexMatrix &b, octave_idx_type &info)
+qrsolve (const SparseMatrix&a, const ComplexMatrix &b, octave_idx_type &info)
 {
   info = -1;
 #ifdef HAVE_CXSPARSE
@@ -546,7 +546,7 @@
       SparseQR q (a, 3);
       if (! q.ok ())
         return ComplexMatrix ();
-      x.resize(nc, b_nc);
+      x.resize (nc, b_nc);
       Complex *vec = x.fortran_vec ();
       OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc));
       OCTAVE_LOCAL_BUFFER (double, Xz, (b_nr > nc ? b_nr : nc));
@@ -563,7 +563,7 @@
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xx, buf, nr);
 #else
           CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xx, buf);
@@ -578,14 +578,14 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_DNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xx, nc);
 #else
           CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xx);
 #endif
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = 0.;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xz, buf, nr);
 #else
           CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xz, buf);
@@ -600,7 +600,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_DNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xz, nc);
 #else
           CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xz);
@@ -617,7 +617,7 @@
       SparseQR q (at, 3);
       if (! q.ok ())
         return ComplexMatrix ();
-      x.resize(nc, b_nc);
+      x.resize (nc, b_nc);
       Complex *vec = x.fortran_vec ();
       volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2);
       OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc));
@@ -635,7 +635,7 @@
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->q, Xx, buf, nr);
 #else
           CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xx, buf);
@@ -650,7 +650,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xx, nc);
 #else
           CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xx);
@@ -659,7 +659,7 @@
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->q, Xz, buf, nr);
 #else
           CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xz, buf);
@@ -674,7 +674,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xz, nc);
 #else
           CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xz);
@@ -693,7 +693,7 @@
 }
 
 SparseComplexMatrix
-qrsolve(const SparseMatrix&a, const SparseComplexMatrix &b, octave_idx_type &info)
+qrsolve (const SparseMatrix&a, const SparseComplexMatrix &b, octave_idx_type &info)
 {
   info = -1;
 #ifdef HAVE_CXSPARSE
@@ -715,7 +715,7 @@
       if (! q.ok ())
         return SparseComplexMatrix ();
       x = SparseComplexMatrix (nc, b_nc, b.nnz ());
-      x.xcidx(0) = 0;
+      x.xcidx (0) = 0;
       x_nz = b.nnz ();
       ii = 0;
       OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc));
@@ -733,7 +733,7 @@
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xx, buf, nr);
 #else
           CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xx, buf);
@@ -748,7 +748,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_DNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xx, nc);
 #else
           CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xx);
@@ -757,7 +757,7 @@
           for (octave_idx_type j = nr; j < q.S ()->m2; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xz, buf, nr);
 #else
           CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xz, buf);
@@ -772,7 +772,7 @@
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
           CXSPARSE_DNAME (_usolve) (q.N ()->U, buf);
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xz, nc);
 #else
           CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xz);
@@ -792,11 +792,11 @@
                       x.change_capacity (sz);
                       x_nz = sz;
                     }
-                  x.xdata(ii) = tmp;
-                  x.xridx(ii++) = j;
+                  x.xdata (ii) = tmp;
+                  x.xridx (ii++) = j;
                 }
             }
-          x.xcidx(i+1) = ii;
+          x.xcidx (i+1) = ii;
         }
       info = 0;
     }
@@ -807,7 +807,7 @@
       if (! q.ok ())
         return SparseComplexMatrix ();
       x = SparseComplexMatrix (nc, b_nc, b.nnz ());
-      x.xcidx(0) = 0;
+      x.xcidx (0) = 0;
       x_nz = b.nnz ();
       ii = 0;
       volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2);
@@ -826,7 +826,7 @@
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->q, Xx, buf, nr);
 #else
           CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xx, buf);
@@ -841,7 +841,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xx, nc);
 #else
           CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xx);
@@ -850,7 +850,7 @@
           for (octave_idx_type j = nr; j < nbuf; j++)
             buf[j] = 0.;
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->q, Xz, buf, nr);
 #else
           CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xz, buf);
@@ -865,7 +865,7 @@
               END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
             }
           BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
           CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xz, nc);
 #else
           CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xz);
@@ -885,11 +885,11 @@
                       x.change_capacity (sz);
                       x_nz = sz;
                     }
-                  x.xdata(ii) = tmp;
-                  x.xridx(ii++) = j;
+                  x.xdata (ii) = tmp;
+                  x.xridx (ii++) = j;
                 }
             }
-          x.xcidx(i+1) = ii;
+          x.xcidx (i+1) = ii;
         }
       info = 0;
     }
@@ -902,15 +902,15 @@
 }
 
 Matrix
-qrsolve(const SparseMatrix &a, const MArray<double> &b,
-        octave_idx_type &info)
+qrsolve (const SparseMatrix &a, const MArray<double> &b,
+         octave_idx_type &info)
 {
   return qrsolve (a, Matrix (b), info);
 }
 
 ComplexMatrix
-qrsolve(const SparseMatrix &a, const MArray<Complex> &b,
-        octave_idx_type &info)
+qrsolve (const SparseMatrix &a, const MArray<Complex> &b,
+         octave_idx_type &info)
 {
   return qrsolve (a, ComplexMatrix (b), info);
 }
--- a/liboctave/SparsedbleCHOL.cc
+++ b/liboctave/SparsedbleCHOL.cc
@@ -51,12 +51,12 @@
 
       if (typ == MatrixType::Upper)
         {
-          rinv = r.inverse(mattype, info, rcond, true, false);
+          rinv = r.inverse (mattype, info, rcond, true, false);
           retval = rinv.transpose () * rinv;
         }
       else if (typ == MatrixType::Lower)
         {
-          rinv = r.transpose ().inverse(mattype, info, rcond, true, false);
+          rinv = r.transpose ().inverse (mattype, info, rcond, true, false);
           retval = rinv.transpose () * rinv;
         }
       else
--- a/liboctave/SparsedbleLU.cc
+++ b/liboctave/SparsedbleLU.cc
@@ -311,7 +311,7 @@
         OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc);
 
         for (octave_idx_type i = 0; i < nc; i++)
-          qinit [i] = static_cast<octave_idx_type> (Qinit (i));
+          qinit[i] = static_cast<octave_idx_type> (Qinit (i));
 
         status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, Ax,
                                        qinit, &Symbolic, control, info);
--- a/liboctave/boolSparse.cc
+++ b/liboctave/boolSparse.cc
@@ -55,11 +55,11 @@
     return false;
 
   for (octave_idx_type i = 0; i < nc + 1; i++)
-    if (cidx(i) != a.cidx(i))
+    if (cidx (i) != a.cidx (i))
         return false;
 
   for (octave_idx_type i = 0; i < nz; i++)
-    if (data(i) != a.data(i) || ridx(i) != a.ridx(i))
+    if (data (i) != a.data (i) || ridx (i) != a.ridx (i))
       return false;
 
   return true;
@@ -113,12 +113,12 @@
     {
       for (octave_idx_type j = 0; j < nr; j++)
         {
-          if (jj < cidx(i+1) && ridx(jj) == j)
+          if (jj < cidx (i+1) && ridx (jj) == j)
             jj++;
           else
             {
-              r.data(ii) = true;
-              r.ridx(ii++) = j;
+              r.data (ii) = true;
+              r.ridx (ii++) = j;
             }
         }
       r.cidx (i+1) = ii;
@@ -150,10 +150,10 @@
     {
       // Result is a row vector.
       retval = Sparse<bool> (1, nc);
-      retval.xcidx(0) = 0;
+      retval.xcidx (0) = 0;
       for (octave_idx_type i = 0; i < nc; i++)
-        retval.xcidx(i+1) = retval.xcidx(i) + (cidx(i+1) > cidx(i));
-      octave_idx_type new_nz = retval.xcidx(nc);
+        retval.xcidx (i+1) = retval.xcidx (i) + (cidx (i+1) > cidx (i));
+      octave_idx_type new_nz = retval.xcidx (nc);
       retval.change_capacity (new_nz);
       fill_or_memset (new_nz, static_cast<octave_idx_type> (0), retval.ridx ());
       fill_or_memset (new_nz, true, retval.data ());
@@ -166,7 +166,7 @@
           // We can use O(nr) memory.
           Array<bool> tmp (dim_vector (nr, 1), false);
           for (octave_idx_type i = 0; i < nz; i++)
-            tmp.xelem(ridx(i)) = true;
+            tmp.xelem (ridx (i)) = true;
           retval = tmp;
         }
       else
@@ -195,16 +195,16 @@
     {
       // Result is a row vector.
       retval = Sparse<double> (1, nc);
-      for(octave_idx_type i = 0; i < nc; i++)
-        retval.xcidx(i+1) = retval.xcidx(i) + (cidx(i+1) > cidx(i));
-      octave_idx_type new_nz = retval.xcidx(nc);
+      for (octave_idx_type i = 0; i < nc; i++)
+        retval.xcidx (i+1) = retval.xcidx (i) + (cidx (i+1) > cidx (i));
+      octave_idx_type new_nz = retval.xcidx (nc);
       retval.change_capacity (new_nz);
       fill_or_memset (new_nz, static_cast<octave_idx_type> (0), retval.ridx ());
-      for(octave_idx_type i = 0, k = 0; i < nc; i++)
+      for (octave_idx_type i = 0, k = 0; i < nc; i++)
         {
-          octave_idx_type c = cidx(i+1) - cidx(i);
+          octave_idx_type c = cidx (i+1) - cidx (i);
           if (c > 0)
-            retval.xdata(k++) = c;
+            retval.xdata (k++) = c;
         }
     }
   else if (dim == 1)
@@ -215,7 +215,7 @@
           // We can use O(nr) memory.
           Array<double> tmp (dim_vector (nr, 1), 0);
           for (octave_idx_type i = 0; i < nz; i++)
-            tmp.xelem(ridx(i)) += 1.0;
+            tmp.xelem (ridx (i)) += 1.0;
           retval = tmp;
         }
       else
@@ -246,8 +246,8 @@
 
   boolMatrix retval (nr, nc, false);
   for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-      retval.elem (ridx(i), j) = data (i);
+    for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+      retval.elem (ridx (i), j) = data (i);
 
   return retval;
 }
@@ -262,8 +262,8 @@
    for (octave_idx_type j = 0; j < nc; j++)
      {
        octave_quit ();
-       for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
-         os << a.ridx(i) + 1 << " "  << j + 1 << " " << a.data(i) << "\n";
+       for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
+         os << a.ridx (i) + 1 << " "  << j + 1 << " " << a.data (i) << "\n";
      }
 
   return os;
--- a/liboctave/cmd-hist.cc
+++ b/liboctave/cmd-hist.cc
@@ -535,7 +535,7 @@
 command_history::process_histcontrol (const std::string& control_arg)
 {
   if (instance_ok ())
-    instance->do_process_histcontrol(control_arg);
+    instance->do_process_histcontrol (control_arg);
 }
 
 std::string
--- a/liboctave/dDiagMatrix.cc
+++ b/liboctave/dDiagMatrix.cc
@@ -362,7 +362,7 @@
 double
 DiagMatrix::rcond (void) const
 {
-  ColumnVector av  = diag (0).map<double> (fabs);
+  ColumnVector av = diag (0).map<double> (fabs);
   double amx = av.max (), amn = av.min ();
   return amx == 0 ? 0.0 : amn / amx;
 }
--- a/liboctave/dMatrix.cc
+++ b/liboctave/dMatrix.cc
@@ -763,7 +763,7 @@
       // Calculate the norm of the matrix, for later use.
       double anorm = 0;
       if (calc_cond)
-        anorm = retval.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+        anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
       F77_XFCN (dgetrf, DGETRF, (nc, nc, tmp_data, nr, pipvt, info));
 
@@ -838,7 +838,7 @@
         }
 
       if (!mattype.is_hermitian ())
-        ret = finverse(mattype, info, rcon, force, calc_cond);
+        ret = finverse (mattype, info, rcon, force, calc_cond);
 
       if ((mattype.is_hermitian () || calc_cond) && rcon == 0.)
         ret = Matrix (rows (), columns (), octave_Inf);
@@ -1498,7 +1498,7 @@
               Array<octave_idx_type> ipvt (dim_vector (nr, 1));
               octave_idx_type *pipvt = ipvt.fortran_vec ();
 
-              if(anorm < 0.)
+              if (anorm < 0.)
                 anorm = atmp.abs ().sum ().
                   row(static_cast<octave_idx_type>(0)).max ();
 
@@ -1762,7 +1762,7 @@
           char job = 'L';
           Matrix atmp = *this;
           double *tmp_data = atmp.fortran_vec ();
-          anorm = atmp.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+          anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
           F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                      tmp_data, nr, info
@@ -1838,8 +1838,8 @@
 
           Matrix atmp = *this;
           double *tmp_data = atmp.fortran_vec ();
-          if(anorm < 0.)
-            anorm = atmp.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+          if (anorm < 0.)
+            anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
           Array<double> z (dim_vector (4 * nc, 1));
           double *pz = z.fortran_vec ();
@@ -2062,7 +2062,7 @@
 {
   Matrix tmp (b);
   tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt);
-  return tmp.column(static_cast<octave_idx_type> (0));
+  return tmp.column (static_cast<octave_idx_type> (0));
 }
 
 ComplexColumnVector
@@ -2094,7 +2094,7 @@
                solve_singularity_handler sing_handler, blas_trans_type transt) const
 {
   ComplexMatrix tmp (*this);
-  return tmp.solve(typ, b, info, rcon, sing_handler, transt);
+  return tmp.solve (typ, b, info, rcon, sing_handler, transt);
 }
 
 Matrix
--- a/liboctave/dNDArray.cc
+++ b/liboctave/dNDArray.cc
@@ -281,7 +281,7 @@
           octave_quit ();
 
           for (octave_idx_type i = 0; i < npts; i++)
-            tmp[i] = elem((i + k*npts)*stride + j*dist);
+            tmp[i] = elem ((i + k*npts)*stride + j*dist);
 
           F77_FUNC (zfftf, ZFFTF) (npts, tmp, pwsave);
 
@@ -328,7 +328,7 @@
           octave_quit ();
 
           for (octave_idx_type i = 0; i < npts; i++)
-            tmp[i] = elem((i + k*npts)*stride + j*dist);
+            tmp[i] = elem ((i + k*npts)*stride + j*dist);
 
           F77_FUNC (zfftb, ZFFTB) (npts, tmp, pwsave);
 
--- a/liboctave/dNDArray.h
+++ b/liboctave/dNDArray.h
@@ -64,6 +64,10 @@
 
   NDArray (const charNDArray&);
 
+  // For jit support only
+  NDArray (double *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep)
+    : MArray<double> (sdata, slen, adims, arep) { }
+
   NDArray& operator = (const NDArray& a)
     {
       MArray<double>::operator = (a);
--- a/liboctave/dSparse.cc
+++ b/liboctave/dSparse.cc
@@ -177,7 +177,7 @@
         }
     }
   for (octave_idx_type i = l; i <= a.cols (); i++)
-    cidx(i) = j;
+    cidx (i) = j;
 }
 
 bool
@@ -194,11 +194,11 @@
     return false;
 
   for (octave_idx_type i = 0; i < nc + 1; i++)
-    if (cidx(i) != a.cidx(i))
+    if (cidx (i) != a.cidx (i))
         return false;
 
   for (octave_idx_type i = 0; i < nz; i++)
-    if (data(i) != a.data(i) || ridx(i) != a.ridx(i))
+    if (data (i) != a.data (i) || ridx (i) != a.ridx (i))
       return false;
 
   return true;
@@ -220,19 +220,19 @@
     {
       for (octave_idx_type j = 0; j < nc; j++)
         {
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-            {
-              octave_idx_type ri = ridx(i);
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+            {
+              octave_idx_type ri = ridx (i);
 
               if (ri != j)
                 {
                   bool found = false;
 
-                  for (octave_idx_type k = cidx(ri); k < cidx(ri+1); k++)
+                  for (octave_idx_type k = cidx (ri); k < cidx (ri+1); k++)
                     {
-                      if (ridx(k) == j)
+                      if (ridx (k) == j)
                         {
-                          if (data(i) == data(k))
+                          if (data (i) == data (k))
                             found = true;
                           break;
                         }
@@ -294,9 +294,9 @@
         {
           double tmp_max = octave_NaN;
           octave_idx_type idx_j = 0;
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-            {
-              if (ridx(i) != idx_j)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+            {
+              if (ridx (i) != idx_j)
                 break;
               else
                 idx_j++;
@@ -305,7 +305,7 @@
           if (idx_j != nr)
             tmp_max = 0.;
 
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               double tmp = data (i);
 
@@ -344,30 +344,30 @@
     {
       idx_arg.resize (dim_vector  (nr, 1), 0);
 
-      for (octave_idx_type i = cidx(0); i < cidx(1); i++)
-        idx_arg.elem(ridx(i)) = -1;
+      for (octave_idx_type i = cidx (0); i < cidx (1); i++)
+        idx_arg.elem (ridx (i)) = -1;
 
       for (octave_idx_type j = 0; j < nc; j++)
         for (octave_idx_type i = 0; i < nr; i++)
           {
-            if (idx_arg.elem(i) != -1)
+            if (idx_arg.elem (i) != -1)
               continue;
             bool found = false;
-            for (octave_idx_type k = cidx(j); k < cidx(j+1); k++)
-              if (ridx(k) == i)
+            for (octave_idx_type k = cidx (j); k < cidx (j+1); k++)
+              if (ridx (k) == i)
                 {
                   found = true;
                   break;
                 }
 
             if (!found)
-              idx_arg.elem(i) = j;
+              idx_arg.elem (i) = j;
 
           }
 
       for (octave_idx_type j = 0; j < nc; j++)
         {
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               octave_idx_type ir = ridx (i);
               octave_idx_type ix = idx_arg.elem (ir);
@@ -382,7 +382,7 @@
 
       octave_idx_type nel = 0;
       for (octave_idx_type j = 0; j < nr; j++)
-        if (idx_arg.elem(j) == -1 || elem (j, idx_arg.elem (j)) != 0.)
+        if (idx_arg.elem (j) == -1 || elem (j, idx_arg.elem (j)) != 0.)
           nel++;
 
       result = SparseMatrix (nr, 1, nel);
@@ -443,9 +443,9 @@
         {
           double tmp_min = octave_NaN;
           octave_idx_type idx_j = 0;
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-            {
-              if (ridx(i) != idx_j)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+            {
+              if (ridx (i) != idx_j)
                 break;
               else
                 idx_j++;
@@ -454,7 +454,7 @@
           if (idx_j != nr)
             tmp_min = 0.;
 
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               double tmp = data (i);
 
@@ -493,30 +493,30 @@
     {
       idx_arg.resize (dim_vector (nr, 1), 0);
 
-      for (octave_idx_type i = cidx(0); i < cidx(1); i++)
-        idx_arg.elem(ridx(i)) = -1;
+      for (octave_idx_type i = cidx (0); i < cidx (1); i++)
+        idx_arg.elem (ridx (i)) = -1;
 
       for (octave_idx_type j = 0; j < nc; j++)
         for (octave_idx_type i = 0; i < nr; i++)
           {
-            if (idx_arg.elem(i) != -1)
+            if (idx_arg.elem (i) != -1)
               continue;
             bool found = false;
-            for (octave_idx_type k = cidx(j); k < cidx(j+1); k++)
-              if (ridx(k) == i)
+            for (octave_idx_type k = cidx (j); k < cidx (j+1); k++)
+              if (ridx (k) == i)
                 {
                   found = true;
                   break;
                 }
 
             if (!found)
-              idx_arg.elem(i) = j;
+              idx_arg.elem (i) = j;
 
           }
 
       for (octave_idx_type j = 0; j < nc; j++)
         {
-          for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+          for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
             {
               octave_idx_type ir = ridx (i);
               octave_idx_type ix = idx_arg.elem (ir);
@@ -531,7 +531,7 @@
 
       octave_idx_type nel = 0;
       for (octave_idx_type j = 0; j < nr; j++)
-        if (idx_arg.elem(j) == -1 || elem (j, idx_arg.elem (j)) != 0.)
+        if (idx_arg.elem (j) == -1 || elem (j, idx_arg.elem (j)) != 0.)
           nel++;
 
       result = SparseMatrix (nr, 1, nel);
@@ -620,12 +620,12 @@
   SparseMatrix r (nr, nc, nz);
 
   for (octave_idx_type i = 0; i < nc +1; i++)
-    r.cidx(i) = a.cidx(i);
+    r.cidx (i) = a.cidx (i);
 
   for (octave_idx_type i = 0; i < nz; i++)
     {
-      r.data(i) = std::real (a.data(i));
-      r.ridx(i) = a.ridx(i);
+      r.data (i) = std::real (a.data (i));
+      r.ridx (i) = a.ridx (i);
     }
 
   return r;
@@ -640,12 +640,12 @@
   SparseMatrix r (nr, nc, nz);
 
   for (octave_idx_type i = 0; i < nc +1; i++)
-    r.cidx(i) = a.cidx(i);
+    r.cidx (i) = a.cidx (i);
 
   for (octave_idx_type i = 0; i < nz; i++)
     {
-      r.data(i) = std::imag (a.data(i));
-      r.ridx(i) = a.ridx(i);
+      r.data (i) = std::imag (a.data (i));
+      r.ridx (i) = a.ridx (i);
     }
 
   return r;
@@ -667,7 +667,7 @@
 
       for (octave_idx_type j = 0; j < nc; j++)
         for (octave_idx_type i = y.cidx (j); i < y.cidx (j+1); i++)
-          tmp.elem (y.ridx(i), j) = atan2 (x, y.data(i));
+          tmp.elem (y.ridx (i), j) = atan2 (x, y.data (i));
 
       return SparseMatrix (tmp);
     }
@@ -683,12 +683,12 @@
   SparseMatrix retval (nr, nc, nz);
 
   octave_idx_type ii = 0;
-  retval.xcidx(0) = 0;
+  retval.xcidx (0) = 0;
   for (octave_idx_type i = 0; i < nc; i++)
     {
-      for (octave_idx_type j = x.cidx(i); j < x.cidx(i+1); j++)
+      for (octave_idx_type j = x.cidx (i); j < x.cidx (i+1); j++)
         {
-          double tmp = atan2 (x.data(j), y);
+          double tmp = atan2 (x.data (j), y);
           if (tmp != 0.)
             {
               retval.xdata (ii) = tmp;
@@ -737,39 +737,39 @@
           r.cidx (0) = 0;
           for (octave_idx_type i = 0 ; i < x_nc ; i++)
             {
-              octave_idx_type  ja = x.cidx(i);
-              octave_idx_type  ja_max = x.cidx(i+1);
+              octave_idx_type  ja = x.cidx (i);
+              octave_idx_type  ja_max = x.cidx (i+1);
               bool ja_lt_max= ja < ja_max;
 
-              octave_idx_type  jb = y.cidx(i);
-              octave_idx_type  jb_max = y.cidx(i+1);
+              octave_idx_type  jb = y.cidx (i);
+              octave_idx_type  jb_max = y.cidx (i+1);
               bool jb_lt_max = jb < jb_max;
 
               while (ja_lt_max || jb_lt_max )
                 {
                   octave_quit ();
                   if ((! jb_lt_max) ||
-                      (ja_lt_max && (x.ridx(ja) < y.ridx(jb))))
+                      (ja_lt_max && (x.ridx (ja) < y.ridx (jb))))
                     {
-                      r.ridx(jx) = x.ridx(ja);
-                      r.data(jx) = atan2 (x.data(ja), 0.);
+                      r.ridx (jx) = x.ridx (ja);
+                      r.data (jx) = atan2 (x.data (ja), 0.);
                       jx++;
                       ja++;
                       ja_lt_max= ja < ja_max;
                     }
                   else if (( !ja_lt_max ) ||
-                           (jb_lt_max && (y.ridx(jb) < x.ridx(ja)) ) )
+                           (jb_lt_max && (y.ridx (jb) < x.ridx (ja)) ) )
                     {
                       jb++;
                       jb_lt_max= jb < jb_max;
                     }
                   else
                     {
-                      double tmp = atan2 (x.data(ja), y.data(jb));
+                      double tmp = atan2 (x.data (ja), y.data (jb));
                       if (tmp != 0.)
                         {
-                          r.data(jx) = tmp;
-                          r.ridx(jx) = x.ridx(ja);
+                          r.data (jx) = tmp;
+                          r.ridx (jx) = x.ridx (ja);
                           jx++;
                         }
                       ja++;
@@ -778,7 +778,7 @@
                       jb_lt_max= jb < jb_max;
                     }
                 }
-              r.cidx(i+1) = jx;
+              r.cidx (i+1) = jx;
             }
 
           r.maybe_compress ();
@@ -849,7 +849,7 @@
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nr; i++)
                 {
-                  double tmp = fabs(v[i]);
+                  double tmp = fabs (v[i]);
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -899,8 +899,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -925,9 +925,9 @@
                       retval.change_capacity (nz2);
                     }
 
-                  retval.xcidx(i) = cx;
-                  retval.xridx(cx) = i;
-                  retval.xdata(cx) = 1.0;
+                  retval.xcidx (i) = cx;
+                  retval.xridx (cx) = i;
+                  retval.xdata (cx) = 1.0;
                   cx++;
 
                   // iterate accross columns of input matrix
@@ -935,11 +935,11 @@
                     {
                       double v = 0.;
                       // iterate to calculate sum
-                      octave_idx_type colXp = retval.xcidx(i);
-                      octave_idx_type colUp = cidx(j);
+                      octave_idx_type colXp = retval.xcidx (i);
+                      octave_idx_type colUp = cidx (j);
                       octave_idx_type rpX, rpU;
 
-                      if (cidx(j) == cidx(j+1))
+                      if (cidx (j) == cidx (j+1))
                         {
                           (*current_liboctave_error_handler)
                             ("division by zero");
@@ -949,8 +949,8 @@
                       do
                         {
                           octave_quit ();
-                          rpX = retval.xridx(colXp);
-                          rpU = ridx(colUp);
+                          rpX = retval.xridx (colXp);
+                          rpU = ridx (colUp);
 
                           if (rpX < rpU)
                             colXp++;
@@ -958,7 +958,7 @@
                             colUp++;
                           else
                             {
-                              v -= retval.xdata(colXp) * data(colUp);
+                              v -= retval.xdata (colXp) * data (colUp);
                               colXp++;
                               colUp++;
                             }
@@ -967,11 +967,11 @@
 
                       // get A(m,m)
                       if (typ == MatrixType::Upper)
-                        colUp = cidx(j+1) - 1;
+                        colUp = cidx (j+1) - 1;
                       else
-                        colUp = cidx(j);
-                      double pivot = data(colUp);
-                      if (pivot == 0. || ridx(colUp) != j)
+                        colUp = cidx (j);
+                      double pivot = data (colUp);
+                      if (pivot == 0. || ridx (colUp) != j)
                         {
                           (*current_liboctave_error_handler)
                             ("division by zero");
@@ -986,8 +986,8 @@
                               retval.change_capacity (nz2);
                             }
 
-                          retval.xridx(cx) = j;
-                          retval.xdata(cx) = v / pivot;
+                          retval.xridx (cx) = j;
+                          retval.xdata (cx) = v / pivot;
                           cx++;
                         }
                     }
@@ -995,11 +995,11 @@
                   // get A(m,m)
                   octave_idx_type colUp;
                   if (typ == MatrixType::Upper)
-                    colUp = cidx(i+1) - 1;
+                    colUp = cidx (i+1) - 1;
                   else
-                    colUp = cidx(i);
-                  double pivot = data(colUp);
-                  if (pivot == 0. || ridx(colUp) != i)
+                    colUp = cidx (i);
+                  double pivot = data (colUp);
+                  if (pivot == 0. || ridx (colUp) != i)
                     {
                       (*current_liboctave_error_handler) ("division by zero");
                       goto inverse_singular;
@@ -1007,9 +1007,9 @@
 
                   if (pivot != 1.0)
                     for (octave_idx_type j = cx_colstart; j < cx; j++)
-                      retval.xdata(j) /= pivot;
-                }
-              retval.xcidx(nr) = cx;
+                      retval.xdata (j) /= pivot;
+                }
+              retval.xcidx (nr) = cx;
               retval.maybe_compress ();
             }
           else
@@ -1053,19 +1053,19 @@
                       double v = 0.;
                       octave_idx_type jidx = perm[j];
                       // iterate to calculate sum
-                      for (octave_idx_type k = cidx(jidx);
-                           k < cidx(jidx+1); k++)
+                      for (octave_idx_type k = cidx (jidx);
+                           k < cidx (jidx+1); k++)
                         {
                           octave_quit ();
-                          v -= work[ridx(k)] * data(k);
+                          v -= work[ridx (k)] * data (k);
                         }
 
                       // get A(m,m)
                       double pivot;
                       if (typ == MatrixType::Permuted_Upper)
-                        pivot = data(cidx(jidx+1) - 1);
+                        pivot = data (cidx (jidx+1) - 1);
                       else
-                        pivot = data(cidx(jidx));
+                        pivot = data (cidx (jidx));
                       if (pivot == 0.)
                         {
                           (*current_liboctave_error_handler)
@@ -1079,11 +1079,11 @@
                   // get A(m,m)
                   octave_idx_type colUp;
                   if (typ == MatrixType::Permuted_Upper)
-                    colUp = cidx(perm[iidx]+1) - 1;
+                    colUp = cidx (perm[iidx]+1) - 1;
                   else
-                    colUp = cidx(perm[iidx]);
-
-                  double pivot = data(colUp);
+                    colUp = cidx (perm[iidx]);
+
+                  double pivot = data (colUp);
                   if (pivot == 0.)
                     {
                       (*current_liboctave_error_handler)
@@ -1106,16 +1106,16 @@
                       retval.change_capacity (nz2);
                     }
 
-                  retval.xcidx(i) = cx;
+                  retval.xcidx (i) = cx;
                   for (octave_idx_type j = iidx; j < nr; j++)
                     if (work[j] != 0.)
                       {
-                        retval.xridx(cx) = j;
-                        retval.xdata(cx++) = work[j];
+                        retval.xridx (cx) = j;
+                        retval.xdata (cx++) = work[j];
                       }
                 }
 
-              retval.xcidx(nr) = cx;
+              retval.xcidx (nr) = cx;
               retval.maybe_compress ();
             }
 
@@ -1125,9 +1125,9 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = retval.cidx(j);
-                       i < retval.cidx(j+1); i++)
-                    atmp += fabs(retval.data(i));
+                  for (octave_idx_type i = retval.cidx (j);
+                       i < retval.cidx (j+1); i++)
+                    atmp += fabs (retval.data (i));
                   if (atmp > ainvnorm)
                     ainvnorm = atmp;
                 }
@@ -1175,7 +1175,7 @@
             {
               double rcond2;
               SparseMatrix Q = fact.Q ();
-              SparseMatrix InvL = fact.L ().transpose ().tinverse(tmp_typ,
+              SparseMatrix InvL = fact.L ().transpose ().tinverse (tmp_typ,
                                            info, rcond2, true, false);
               ret = Q * InvL.transpose () * InvL * Q.transpose ();
             }
@@ -1198,9 +1198,9 @@
           SparseLU fact (*this, Qinit, Matrix (), false, false);
           rcond = fact.rcond ();
           double rcond2;
-          SparseMatrix InvL = fact.L ().transpose ().tinverse(tmp_typ,
+          SparseMatrix InvL = fact.L ().transpose ().tinverse (tmp_typ,
                                            info, rcond2, true, false);
-          SparseMatrix InvU = fact.U ().tinverse(tmp_typ, info, rcond2,
+          SparseMatrix InvU = fact.U ().tinverse (tmp_typ, info, rcond2,
                                            true, false).transpose ();
           ret = fact.Pc ().transpose () * InvU * InvL * fact.Pr ();
         }
@@ -1374,15 +1374,15 @@
           else
             for (octave_idx_type j = 0; j < b.cols (); j++)
               for (octave_idx_type k = 0; k < nc; k++)
-                for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                  retval(k,j) = b(ridx(i),j) / data (i);
+                for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                  retval(k,j) = b(ridx (i),j) / data (i);
 
           if (calc_cond)
             {
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nm; i++)
                 {
-                  double tmp = fabs(data(i));
+                  double tmp = fabs (data (i));
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -1430,30 +1430,30 @@
           octave_idx_type b_nz = b.nnz ();
           retval = SparseMatrix (nc, b_nc, b_nz);
 
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           if (typ == MatrixType::Diagonal)
             for (octave_idx_type j = 0; j < b_nc; j++)
               {
-                for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
+                for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
                   {
-                    if (b.ridx(i) >= nm)
+                    if (b.ridx (i) >= nm)
                       break;
-                    retval.xridx (ii) = b.ridx(i);
-                    retval.xdata (ii++) = b.data(i) / data (b.ridx (i));
+                    retval.xridx (ii) = b.ridx (i);
+                    retval.xdata (ii++) = b.data (i) / data (b.ridx (i));
                   }
-                retval.xcidx(j+1) = ii;
+                retval.xcidx (j+1) = ii;
               }
           else
             for (octave_idx_type j = 0; j < b_nc; j++)
               {
                 for (octave_idx_type l = 0; l < nc; l++)
-                  for (octave_idx_type i = cidx(l); i < cidx(l+1); i++)
+                  for (octave_idx_type i = cidx (l); i < cidx (l+1); i++)
                     {
                       bool found = false;
                       octave_idx_type k;
-                      for (k = b.cidx(j); k < b.cidx(j+1); k++)
-                        if (ridx(i) == b.ridx(k))
+                      for (k = b.cidx (j); k < b.cidx (j+1); k++)
+                        if (ridx (i) == b.ridx (k))
                           {
                             found = true;
                             break;
@@ -1461,10 +1461,10 @@
                       if (found)
                         {
                           retval.xridx (ii) = l;
-                          retval.xdata (ii++) = b.data(k) / data (i);
+                          retval.xdata (ii++) = b.data (k) / data (i);
                         }
                     }
-                retval.xcidx(j+1) = ii;
+                retval.xcidx (j+1) = ii;
               }
 
           if (calc_cond)
@@ -1472,7 +1472,7 @@
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nm; i++)
                 {
-                  double tmp = fabs(data(i));
+                  double tmp = fabs (data (i));
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -1524,15 +1524,15 @@
           else
             for (octave_idx_type j = 0; j < b.cols (); j++)
               for (octave_idx_type k = 0; k < nc; k++)
-                for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                  retval(k,j) = b(ridx(i),j) / data (i);
+                for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                  retval(k,j) = b(ridx (i),j) / data (i);
 
           if (calc_cond)
             {
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nm; i++)
                 {
-                  double tmp = fabs(data(i));
+                  double tmp = fabs (data (i));
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -1580,30 +1580,30 @@
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
 
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           if (typ == MatrixType::Diagonal)
             for (octave_idx_type j = 0; j < b.cols (); j++)
               {
-                for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
+                for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
                   {
-                    if (b.ridx(i) >= nm)
+                    if (b.ridx (i) >= nm)
                       break;
-                    retval.xridx (ii) = b.ridx(i);
-                    retval.xdata (ii++) = b.data(i) / data (b.ridx (i));
+                    retval.xridx (ii) = b.ridx (i);
+                    retval.xdata (ii++) = b.data (i) / data (b.ridx (i));
                   }
-                retval.xcidx(j+1) = ii;
+                retval.xcidx (j+1) = ii;
               }
           else
             for (octave_idx_type j = 0; j < b.cols (); j++)
               {
                 for (octave_idx_type l = 0; l < nc; l++)
-                  for (octave_idx_type i = cidx(l); i < cidx(l+1); i++)
+                  for (octave_idx_type i = cidx (l); i < cidx (l+1); i++)
                     {
                       bool found = false;
                       octave_idx_type k;
-                      for (k = b.cidx(j); k < b.cidx(j+1); k++)
-                        if (ridx(i) == b.ridx(k))
+                      for (k = b.cidx (j); k < b.cidx (j+1); k++)
+                        if (ridx (i) == b.ridx (k))
                           {
                             found = true;
                             break;
@@ -1611,10 +1611,10 @@
                       if (found)
                         {
                           retval.xridx (ii) = l;
-                          retval.xdata (ii++) = b.data(k) / data (i);
+                          retval.xdata (ii++) = b.data (k) / data (i);
                         }
                     }
-                retval.xcidx(j+1) = ii;
+                retval.xcidx (j+1) = ii;
               }
 
           if (calc_cond)
@@ -1622,7 +1622,7 @@
               double dmax = 0., dmin = octave_Inf;
               for (octave_idx_type i = 0; i < nm; i++)
                 {
-                  double tmp = fabs(data(i));
+                  double tmp = fabs (data (i));
                   if (tmp > dmax)
                     dmax = tmp;
                   if (tmp < dmin)
@@ -1678,8 +1678,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -1704,20 +1704,20 @@
 
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(kidx+1)-1) != k ||
-                              data(cidx(kidx+1)-1) == 0.)
+                          if (ridx (cidx (kidx+1)-1) != k ||
+                              data (cidx (kidx+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          double tmp = work[k] / data(cidx(kidx+1)-1);
+                          double tmp = work[k] / data (cidx (kidx+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(kidx);
-                               i < cidx(kidx+1)-1; i++)
+                          for (octave_idx_type i = cidx (kidx);
+                               i < cidx (kidx+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -1742,20 +1742,20 @@
 
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(iidx+1)-1);
+                              double tmp = work[k] / data (cidx (iidx+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(iidx);
-                                   i < cidx(iidx+1)-1; i++)
+                              for (octave_idx_type i = cidx (iidx);
+                                   i < cidx (iidx+1)-1; i++)
                                 {
-                                  octave_idx_type idx2 = ridx(i);
-                                  work[idx2] = work[idx2] - tmp * data(i);
+                                  octave_idx_type idx2 = ridx (i);
+                                  work[idx2] = work[idx2] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -1780,19 +1780,19 @@
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k+1)-1) != k ||
-                              data(cidx(k+1)-1) == 0.)
+                          if (ridx (cidx (k+1)-1) != k ||
+                              data (cidx (k+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          double tmp = work[k] / data(cidx(k+1)-1);
+                          double tmp = work[k] / data (cidx (k+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -1815,19 +1815,19 @@
                         {
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(k+1)-1);
+                              double tmp = work[k] / data (cidx (k+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                              for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -1912,8 +1912,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -1922,7 +1922,7 @@
           octave_idx_type b_nc = b.cols ();
           octave_idx_type b_nz = b.nnz ();
           retval = SparseMatrix (nc, b_nc, b_nz);
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           octave_idx_type x_nz = b_nz;
 
@@ -1939,8 +1939,8 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = nc-1; k >= 0; k--)
                     {
@@ -1948,20 +1948,20 @@
 
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(kidx+1)-1) != k ||
-                              data(cidx(kidx+1)-1) == 0.)
+                          if (ridx (cidx (kidx+1)-1) != k ||
+                              data (cidx (kidx+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          double tmp = work[k] / data(cidx(kidx+1)-1);
+                          double tmp = work[k] / data (cidx (kidx+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(kidx);
-                               i < cidx(kidx+1)-1; i++)
+                          for (octave_idx_type i = cidx (kidx);
+                               i < cidx (kidx+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -1984,10 +1984,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[rperm[i]] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[rperm[i]];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[rperm[i]];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -2008,20 +2008,20 @@
 
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(iidx+1)-1);
+                              double tmp = work[k] / data (cidx (iidx+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(iidx);
-                                   i < cidx(iidx+1)-1; i++)
+                              for (octave_idx_type i = cidx (iidx);
+                                   i < cidx (iidx+1)-1; i++)
                                 {
-                                  octave_idx_type idx2 = ridx(i);
-                                  work[idx2] = work[idx2] - tmp * data(i);
+                                  octave_idx_type idx2 = ridx (i);
+                                  work[idx2] = work[idx2] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2038,26 +2038,26 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = nc-1; k >= 0; k--)
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k+1)-1) != k ||
-                              data(cidx(k+1)-1) == 0.)
+                          if (ridx (cidx (k+1)-1) != k ||
+                              data (cidx (k+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          double tmp = work[k] / data(cidx(k+1)-1);
+                          double tmp = work[k] / data (cidx (k+1)-1);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2080,10 +2080,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -2102,20 +2102,20 @@
                         {
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(k+1)-1);
+                              double tmp = work[k] / data (cidx (k+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1)-1; i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1)-1; i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2200,8 +2200,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -2226,20 +2226,20 @@
 
                       if (cwork[k] != 0.)
                         {
-                          if (ridx(cidx(kidx+1)-1) != k ||
-                              data(cidx(kidx+1)-1) == 0.)
+                          if (ridx (cidx (kidx+1)-1) != k ||
+                              data (cidx (kidx+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = cwork[k] / data(cidx(kidx+1)-1);
+                          Complex tmp = cwork[k] / data (cidx (kidx+1)-1);
                           cwork[k] = tmp;
-                          for (octave_idx_type i = cidx(kidx);
-                               i < cidx(kidx+1)-1; i++)
+                          for (octave_idx_type i = cidx (kidx);
+                               i < cidx (kidx+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              cwork[iidx] = cwork[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              cwork[iidx] = cwork[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2265,20 +2265,20 @@
 
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(iidx+1)-1);
+                              double tmp = work[k] / data (cidx (iidx+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(iidx);
-                                   i < cidx(iidx+1)-1; i++)
+                              for (octave_idx_type i = cidx (iidx);
+                                   i < cidx (iidx+1)-1; i++)
                                 {
-                                  octave_idx_type idx2 = ridx(i);
-                                  work[idx2] = work[idx2] - tmp * data(i);
+                                  octave_idx_type idx2 = ridx (i);
+                                  work[idx2] = work[idx2] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2303,19 +2303,19 @@
                     {
                       if (cwork[k] != 0.)
                         {
-                          if (ridx(cidx(k+1)-1) != k ||
-                              data(cidx(k+1)-1) == 0.)
+                          if (ridx (cidx (k+1)-1) != k ||
+                              data (cidx (k+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = cwork[k] / data(cidx(k+1)-1);
+                          Complex tmp = cwork[k] / data (cidx (k+1)-1);
                           cwork[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              cwork[iidx] = cwork[iidx] - tmp  * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              cwork[iidx] = cwork[iidx] - tmp  * data (i);
                             }
                         }
                     }
@@ -2339,20 +2339,20 @@
                         {
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(k+1)-1);
+                              double tmp = work[k] / data (cidx (k+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1)-1; i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1)-1; i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2437,8 +2437,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -2447,7 +2447,7 @@
           octave_idx_type b_nc = b.cols ();
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           octave_idx_type x_nz = b_nz;
 
@@ -2464,8 +2464,8 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     cwork[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    cwork[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    cwork[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = nc-1; k >= 0; k--)
                     {
@@ -2473,20 +2473,20 @@
 
                       if (cwork[k] != 0.)
                         {
-                          if (ridx(cidx(kidx+1)-1) != k ||
-                              data(cidx(kidx+1)-1) == 0.)
+                          if (ridx (cidx (kidx+1)-1) != k ||
+                              data (cidx (kidx+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = cwork[k] / data(cidx(kidx+1)-1);
+                          Complex tmp = cwork[k] / data (cidx (kidx+1)-1);
                           cwork[k] = tmp;
-                          for (octave_idx_type i = cidx(kidx);
-                               i < cidx(kidx+1)-1; i++)
+                          for (octave_idx_type i = cidx (kidx);
+                               i < cidx (kidx+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              cwork[iidx] = cwork[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              cwork[iidx] = cwork[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2509,10 +2509,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (cwork[rperm[i]] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = cwork[rperm[i]];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = cwork[rperm[i]];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -2534,20 +2534,20 @@
 
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(iidx+1)-1);
+                              double tmp = work[k] / data (cidx (iidx+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(iidx);
-                                   i < cidx(iidx+1)-1; i++)
+                              for (octave_idx_type i = cidx (iidx);
+                                   i < cidx (iidx+1)-1; i++)
                                 {
-                                  octave_idx_type idx2 = ridx(i);
-                                  work[idx2] = work[idx2] - tmp * data(i);
+                                  octave_idx_type idx2 = ridx (i);
+                                  work[idx2] = work[idx2] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2564,26 +2564,26 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     cwork[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    cwork[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    cwork[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = nc-1; k >= 0; k--)
                     {
                       if (cwork[k] != 0.)
                         {
-                          if (ridx(cidx(k+1)-1) != k ||
-                              data(cidx(k+1)-1) == 0.)
+                          if (ridx (cidx (k+1)-1) != k ||
+                              data (cidx (k+1)-1) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = cwork[k] / data(cidx(k+1)-1);
+                          Complex tmp = cwork[k] / data (cidx (k+1)-1);
                           cwork[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1)-1; i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              cwork[iidx] = cwork[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              cwork[iidx] = cwork[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2606,10 +2606,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (cwork[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = cwork[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = cwork[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -2629,20 +2629,20 @@
                         {
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(k+1)-1);
+                              double tmp = work[k] / data (cidx (k+1)-1);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1)-1; i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1)-1; i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = 0; i < j+1; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2728,8 +2728,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -2756,28 +2756,28 @@
                           octave_idx_type minr = nr;
                           octave_idx_type mini = 0;
 
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                            if (perm[ridx(i)] < minr)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                            if (perm[ridx (i)] < minr)
                               {
-                                minr = perm[ridx(i)];
+                                minr = perm[ridx (i)];
                                 mini = i;
                               }
 
-                          if (minr != k || data(mini) == 0)
+                          if (minr != k || data (mini) == 0)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          double tmp = work[k] / data(mini);
+                          double tmp = work[k] / data (mini);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
                             {
                               if (i == mini)
                                 continue;
 
-                              octave_idx_type iidx = perm[ridx(i)];
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = perm[ridx (i)];
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2803,24 +2803,24 @@
                               octave_idx_type minr = nr;
                               octave_idx_type mini = 0;
 
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
-                                if (perm[ridx(i)] < minr)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
+                                if (perm[ridx (i)] < minr)
                                   {
-                                    minr = perm[ridx(i)];
+                                    minr = perm[ridx (i)];
                                     mini = i;
                                   }
 
-                              double tmp = work[k] / data(mini);
+                              double tmp = work[k] / data (mini);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
                                 {
                                   if (i == mini)
                                     continue;
 
-                                  octave_idx_type iidx = perm[ridx(i)];
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = perm[ridx (i)];
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
@@ -2828,7 +2828,7 @@
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2852,20 +2852,20 @@
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k)) != k ||
-                              data(cidx(k)) == 0.)
+                          if (ridx (cidx (k)) != k ||
+                              data (cidx (k)) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          double tmp = work[k] / data(cidx(k));
+                          double tmp = work[k] / data (cidx (k));
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k)+1;
-                               i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k)+1;
+                               i < cidx (k+1); i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -2889,20 +2889,20 @@
 
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(k));
+                              double tmp = work[k] / data (cidx (k));
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k)+1;
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k)+1;
+                                   i < cidx (k+1); i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -2987,8 +2987,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -2997,7 +2997,7 @@
           octave_idx_type b_nc = b.cols ();
           octave_idx_type b_nz = b.nnz ();
           retval = SparseMatrix (nc, b_nc, b_nz);
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           octave_idx_type x_nz = b_nz;
 
@@ -3010,8 +3010,8 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[perm[b.ridx(i)]] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[perm[b.ridx (i)]] = b.data (i);
 
                   for (octave_idx_type k = 0; k < nc; k++)
                     {
@@ -3020,28 +3020,28 @@
                           octave_idx_type minr = nr;
                           octave_idx_type mini = 0;
 
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                            if (perm[ridx(i)] < minr)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                            if (perm[ridx (i)] < minr)
                               {
-                                minr = perm[ridx(i)];
+                                minr = perm[ridx (i)];
                                 mini = i;
                               }
 
-                          if (minr != k || data(mini) == 0)
+                          if (minr != k || data (mini) == 0)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          double tmp = work[k] / data(mini);
+                          double tmp = work[k] / data (mini);
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
                             {
                               if (i == mini)
                                 continue;
 
-                              octave_idx_type iidx = perm[ridx(i)];
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = perm[ridx (i)];
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3064,10 +3064,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -3089,24 +3089,24 @@
                               octave_idx_type minr = nr;
                               octave_idx_type mini = 0;
 
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
-                                if (perm[ridx(i)] < minr)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
+                                if (perm[ridx (i)] < minr)
                                   {
-                                    minr = perm[ridx(i)];
+                                    minr = perm[ridx (i)];
                                     mini = i;
                                   }
 
-                              double tmp = work[k] / data(mini);
+                              double tmp = work[k] / data (mini);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
                                 {
                                   if (i == mini)
                                     continue;
 
-                                  octave_idx_type iidx = perm[ridx(i)];
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = perm[ridx (i)];
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
@@ -3114,7 +3114,7 @@
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nr; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3131,26 +3131,26 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = 0; k < nc; k++)
                     {
                       if (work[k] != 0.)
                         {
-                          if (ridx(cidx(k)) != k ||
-                              data(cidx(k)) == 0.)
+                          if (ridx (cidx (k)) != k ||
+                              data (cidx (k)) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          double tmp = work[k] / data(cidx(k));
+                          double tmp = work[k] / data (cidx (k));
                           work[k] = tmp;
-                          for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k)+1; i < cidx (k+1); i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              work[iidx] = work[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              work[iidx] = work[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3173,10 +3173,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -3196,20 +3196,20 @@
 
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(k));
+                              double tmp = work[k] / data (cidx (k));
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k)+1;
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k)+1;
+                                   i < cidx (k+1); i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3295,8 +3295,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -3322,28 +3322,28 @@
                           octave_idx_type minr = nr;
                           octave_idx_type mini = 0;
 
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                            if (perm[ridx(i)] < minr)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                            if (perm[ridx (i)] < minr)
                               {
-                                minr = perm[ridx(i)];
+                                minr = perm[ridx (i)];
                                 mini = i;
                               }
 
-                          if (minr != k || data(mini) == 0)
+                          if (minr != k || data (mini) == 0)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = cwork[k] / data(mini);
+                          Complex tmp = cwork[k] / data (mini);
                           cwork[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
                             {
                               if (i == mini)
                                 continue;
 
-                              octave_idx_type iidx = perm[ridx(i)];
-                              cwork[iidx] = cwork[iidx] - tmp * data(i);
+                              octave_idx_type iidx = perm[ridx (i)];
+                              cwork[iidx] = cwork[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3370,24 +3370,24 @@
                               octave_idx_type minr = nr;
                               octave_idx_type mini = 0;
 
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
-                                if (perm[ridx(i)] < minr)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
+                                if (perm[ridx (i)] < minr)
                                   {
-                                    minr = perm[ridx(i)];
+                                    minr = perm[ridx (i)];
                                     mini = i;
                                   }
 
-                              double tmp = work[k] / data(mini);
+                              double tmp = work[k] / data (mini);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
                                 {
                                   if (i == mini)
                                     continue;
 
-                                  octave_idx_type iidx = perm[ridx(i)];
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = perm[ridx (i)];
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
@@ -3395,7 +3395,7 @@
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3420,19 +3420,19 @@
                     {
                       if (cwork[k] != 0.)
                         {
-                          if (ridx(cidx(k)) != k ||
-                              data(cidx(k)) == 0.)
+                          if (ridx (cidx (k)) != k ||
+                              data (cidx (k)) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = cwork[k] / data(cidx(k));
+                          Complex tmp = cwork[k] / data (cidx (k));
                           cwork[k] = tmp;
-                          for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k)+1; i < cidx (k+1); i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              cwork[iidx] = cwork[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              cwork[iidx] = cwork[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3457,20 +3457,20 @@
 
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(k));
+                              double tmp = work[k] / data (cidx (k));
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k)+1;
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k)+1;
+                                   i < cidx (k+1); i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3555,8 +3555,8 @@
               for (octave_idx_type j = 0; j < nc; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -3565,7 +3565,7 @@
           octave_idx_type b_nc = b.cols ();
           octave_idx_type b_nz = b.nnz ();
           retval = SparseComplexMatrix (nc, b_nc, b_nz);
-          retval.xcidx(0) = 0;
+          retval.xcidx (0) = 0;
           octave_idx_type ii = 0;
           octave_idx_type x_nz = b_nz;
 
@@ -3578,8 +3578,8 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     cwork[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    cwork[perm[b.ridx(i)]] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    cwork[perm[b.ridx (i)]] = b.data (i);
 
                   for (octave_idx_type k = 0; k < nc; k++)
                     {
@@ -3588,28 +3588,28 @@
                           octave_idx_type minr = nr;
                           octave_idx_type mini = 0;
 
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
-                            if (perm[ridx(i)] < minr)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
+                            if (perm[ridx (i)] < minr)
                               {
-                                minr = perm[ridx(i)];
+                                minr = perm[ridx (i)];
                                 mini = i;
                               }
 
-                          if (minr != k || data(mini) == 0)
+                          if (minr != k || data (mini) == 0)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = cwork[k] / data(mini);
+                          Complex tmp = cwork[k] / data (mini);
                           cwork[k] = tmp;
-                          for (octave_idx_type i = cidx(k); i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k); i < cidx (k+1); i++)
                             {
                               if (i == mini)
                                 continue;
 
-                              octave_idx_type iidx = perm[ridx(i)];
-                              cwork[iidx] = cwork[iidx] - tmp * data(i);
+                              octave_idx_type iidx = perm[ridx (i)];
+                              cwork[iidx] = cwork[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3632,10 +3632,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (cwork[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = cwork[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = cwork[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -3658,24 +3658,24 @@
                               octave_idx_type minr = nr;
                               octave_idx_type mini = 0;
 
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
-                                if (perm[ridx(i)] < minr)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
+                                if (perm[ridx (i)] < minr)
                                   {
-                                    minr = perm[ridx(i)];
+                                    minr = perm[ridx (i)];
                                     mini = i;
                                   }
 
-                              double tmp = work[k] / data(mini);
+                              double tmp = work[k] / data (mini);
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k);
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k);
+                                   i < cidx (k+1); i++)
                                 {
                                   if (i == mini)
                                     continue;
 
-                                  octave_idx_type iidx = perm[ridx(i)];
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = perm[ridx (i)];
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
@@ -3683,7 +3683,7 @@
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3700,26 +3700,26 @@
                 {
                   for (octave_idx_type i = 0; i < nm; i++)
                     cwork[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    cwork[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    cwork[b.ridx (i)] = b.data (i);
 
                   for (octave_idx_type k = 0; k < nc; k++)
                     {
                       if (cwork[k] != 0.)
                         {
-                          if (ridx(cidx(k)) != k ||
-                              data(cidx(k)) == 0.)
+                          if (ridx (cidx (k)) != k ||
+                              data (cidx (k)) == 0.)
                             {
                               err = -2;
                               goto triangular_error;
                             }
 
-                          Complex tmp = cwork[k] / data(cidx(k));
+                          Complex tmp = cwork[k] / data (cidx (k));
                           cwork[k] = tmp;
-                          for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++)
+                          for (octave_idx_type i = cidx (k)+1; i < cidx (k+1); i++)
                             {
-                              octave_idx_type iidx = ridx(i);
-                              cwork[iidx] = cwork[iidx] - tmp * data(i);
+                              octave_idx_type iidx = ridx (i);
+                              cwork[iidx] = cwork[iidx] - tmp * data (i);
                             }
                         }
                     }
@@ -3742,10 +3742,10 @@
                   for (octave_idx_type i = 0; i < nc; i++)
                     if (cwork[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = cwork[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = cwork[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -3766,20 +3766,20 @@
 
                           if (work[k] != 0.)
                             {
-                              double tmp = work[k] / data(cidx(k));
+                              double tmp = work[k] / data (cidx (k));
                               work[k] = tmp;
-                              for (octave_idx_type i = cidx(k)+1;
-                                   i < cidx(k+1); i++)
+                              for (octave_idx_type i = cidx (k)+1;
+                                   i < cidx (k+1); i++)
                                 {
-                                  octave_idx_type iidx = ridx(i);
-                                  work[iidx] = work[iidx] - tmp * data(i);
+                                  octave_idx_type iidx = ridx (i);
+                                  work[iidx] = work[iidx] - tmp * data (i);
                                 }
                             }
                         }
                       double atmp = 0;
                       for (octave_idx_type i = j; i < nc; i++)
                         {
-                          atmp += fabs(work[i]);
+                          atmp += fabs (work[i]);
                           work[i] = 0.;
                         }
                       if (atmp > ainvnorm)
@@ -3864,11 +3864,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii);
                   ii += 2;
                 }
-              D[nc-1] = data(ii);
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -3880,12 +3880,12 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
                   }
             }
 
@@ -3918,11 +3918,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii++);
-                  DU[j] = data(ii++);
-                }
-              D[nc-1] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii++);
+                  DU[j] = data (ii++);
+                }
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -3935,14 +3935,14 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
-                    else if (ridx(i) == j - 1)
-                      DU[j-1] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
+                    else if (ridx (i) == j - 1)
+                      DU[j-1] = data (i);
                   }
             }
 
@@ -4021,11 +4021,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii++);
-                  DU[j] = data(ii++);
-                }
-              D[nc-1] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii++);
+                  DU[j] = data (ii++);
+                }
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -4038,14 +4038,14 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
-                    else if (ridx(i) == j - 1)
-                      DU[j-1] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
+                    else if (ridx (i) == j - 1)
+                      DU[j-1] = data (i);
                   }
             }
 
@@ -4073,7 +4073,7 @@
               volatile octave_idx_type x_nz = b.nnz ();
               octave_idx_type b_nc = b.cols ();
               retval = SparseMatrix (nr, b_nc, x_nz);
-              retval.xcidx(0) = 0;
+              retval.xcidx (0) = 0;
               volatile octave_idx_type ii = 0;
 
               OCTAVE_LOCAL_BUFFER (double, work, nr);
@@ -4082,8 +4082,8 @@
                 {
                   for (octave_idx_type i = 0; i < nr; i++)
                     work[i] = 0.;
-                  for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
-                    work[b.ridx(i)] = b.data(i);
+                  for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
+                    work[b.ridx (i)] = b.data (i);
 
                   F77_XFCN (dgttrs, DGTTRS,
                             (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -4109,10 +4109,10 @@
                   for (octave_idx_type i = 0; i < nr; i++)
                     if (work[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) = work[i];
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) = work[i];
                       }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -4162,11 +4162,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii);
                   ii += 2;
                 }
-              D[nc-1] = data(ii);
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -4178,12 +4178,12 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
                   }
             }
 
@@ -4217,11 +4217,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii++);
-                  DU[j] = data(ii++);
-                }
-              D[nc-1] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii++);
+                  DU[j] = data (ii++);
+                }
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -4234,14 +4234,14 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
-                    else if (ridx(i) == j - 1)
-                      DU[j-1] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
+                    else if (ridx (i) == j - 1)
+                      DU[j-1] = data (i);
                   }
             }
 
@@ -4320,11 +4320,11 @@
 
               for (octave_idx_type j = 0; j < nc-1; j++)
                 {
-                  D[j] = data(ii++);
-                  DL[j] = data(ii++);
-                  DU[j] = data(ii++);
-                }
-              D[nc-1] = data(ii);
+                  D[j] = data (ii++);
+                  DL[j] = data (ii++);
+                  DU[j] = data (ii++);
+                }
+              D[nc-1] = data (ii);
             }
           else
             {
@@ -4337,14 +4337,14 @@
                 }
 
               for (octave_idx_type j = 0; j < nc; j++)
-                for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+                for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
                   {
-                    if (ridx(i) == j)
-                      D[j] = data(i);
-                    else if (ridx(i) == j + 1)
-                      DL[j] = data(i);
-                    else if (ridx(i) == j - 1)
-                      DU[j-1] = data(i);
+                    if (ridx (i) == j)
+                      D[j] = data (i);
+                    else if (ridx (i) == j + 1)
+                      DL[j] = data (i);
+                    else if (ridx (i) == j - 1)
+                      DU[j-1] = data (i);
                   }
             }
 
@@ -4379,7 +4379,7 @@
               volatile octave_idx_type ii = 0;
               retval = SparseComplexMatrix (b_nr, b_nc, x_nz);
 
-              retval.xcidx(0) = 0;
+              retval.xcidx (0) = 0;
               for (volatile octave_idx_type j = 0; j < b_nc; j++)
                 {
 
@@ -4438,12 +4438,12 @@
                   for (octave_idx_type i = 0; i < nr; i++)
                     if (Bx[i] != 0. || Bz[i] != 0.)
                       {
-                        retval.xridx(ii) = i;
-                        retval.xdata(ii++) =
+                        retval.xridx (ii) = i;
+                        retval.xdata (ii++) =
                           Complex (Bx[i], Bz[i]);
                       }
 
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -4496,17 +4496,17 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 octave_idx_type ri = ridx (i);
                 if (ri >= j)
-                  m_band(ri - j, j) = data(i);
+                  m_band(ri - j, j) = data (i);
               }
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
           if (calc_cond)
-            anorm = m_band.abs ().sum ().row(0).max ();
+            anorm = m_band.abs ().sum ().row (0).max ();
 
           char job = 'L';
           F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -4603,8 +4603,8 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-              m_band(ridx(i) - j + n_lower + n_upper, j) = data(i);
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+              m_band(ridx (i) - j + n_lower + n_upper, j) = data (i);
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
@@ -4613,8 +4613,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -4746,17 +4746,17 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 octave_idx_type ri = ridx (i);
                 if (ri >= j)
-                  m_band(ri - j, j) = data(i);
+                  m_band(ri - j, j) = data (i);
               }
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
           if (calc_cond)
-            anorm = m_band.abs ().sum ().row(0).max ();
+            anorm = m_band.abs ().sum ().row (0).max ();
 
           char job = 'L';
           F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -4820,7 +4820,7 @@
                   volatile octave_idx_type ii = 0;
                   retval = SparseMatrix (b_nr, b_nc, x_nz);
 
-                  retval.xcidx(0) = 0;
+                  retval.xcidx (0) = 0;
                   for (volatile octave_idx_type j = 0; j < b_nc; j++)
                     {
                       for (octave_idx_type i = 0; i < b_nr; i++)
@@ -4854,11 +4854,11 @@
                                   retval.change_capacity (sz);
                                   x_nz = sz;
                                 }
-                              retval.xdata(ii) = tmp;
-                              retval.xridx(ii++) = i;
+                              retval.xdata (ii) = tmp;
+                              retval.xridx (ii++) = i;
                             }
                         }
-                      retval.xcidx(j+1) = ii;
+                      retval.xcidx (j+1) = ii;
                     }
 
                   retval.maybe_compress ();
@@ -4886,8 +4886,8 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-              m_band(ridx(i) - j + n_lower + n_upper, j) = data(i);
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+              m_band(ridx (i) - j + n_lower + n_upper, j) = data (i);
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
@@ -4896,8 +4896,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -4969,7 +4969,7 @@
                   volatile octave_idx_type x_nz = b.nnz ();
                   octave_idx_type b_nc = b.cols ();
                   retval = SparseMatrix (nr, b_nc, x_nz);
-                  retval.xcidx(0) = 0;
+                  retval.xcidx (0) = 0;
                   volatile octave_idx_type ii = 0;
 
                   OCTAVE_LOCAL_BUFFER (double, work, nr);
@@ -4978,9 +4978,9 @@
                     {
                       for (octave_idx_type i = 0; i < nr; i++)
                         work[i] = 0.;
-                      for (octave_idx_type i = b.cidx(j);
-                           i < b.cidx(j+1); i++)
-                        work[b.ridx(i)] = b.data(i);
+                      for (octave_idx_type i = b.cidx (j);
+                           i < b.cidx (j+1); i++)
+                        work[b.ridx (i)] = b.data (i);
 
                       F77_XFCN (dgbtrs, DGBTRS,
                                 (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -5006,10 +5006,10 @@
                       for (octave_idx_type i = 0; i < nr; i++)
                         if (work[i] != 0.)
                           {
-                            retval.xridx(ii) = i;
-                            retval.xdata(ii++) = work[i];
+                            retval.xridx (ii) = i;
+                            retval.xdata (ii++) = work[i];
                           }
-                      retval.xcidx(j+1) = ii;
+                      retval.xcidx (j+1) = ii;
                     }
 
                   retval.maybe_compress ();
@@ -5064,17 +5064,17 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 octave_idx_type ri = ridx (i);
                 if (ri >= j)
-                  m_band(ri - j, j) = data(i);
+                  m_band(ri - j, j) = data (i);
               }
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
           if (calc_cond)
-            anorm = m_band.abs ().sum ().row(0).max ();
+            anorm = m_band.abs ().sum ().row (0).max ();
 
           char job = 'L';
           F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -5202,8 +5202,8 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-              m_band(ridx(i) - j + n_lower + n_upper, j) = data(i);
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+              m_band(ridx (i) - j + n_lower + n_upper, j) = data (i);
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
@@ -5212,8 +5212,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -5363,17 +5363,17 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
               {
                 octave_idx_type ri = ridx (i);
                 if (ri >= j)
-                  m_band(ri - j, j) = data(i);
+                  m_band(ri - j, j) = data (i);
               }
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
           if (calc_cond)
-            anorm = m_band.abs ().sum ().row(0).max ();
+            anorm = m_band.abs ().sum ().row (0).max ();
 
           char job = 'L';
           F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1),
@@ -5441,7 +5441,7 @@
                   volatile octave_idx_type ii = 0;
                   retval = SparseComplexMatrix (b_nr, b_nc, x_nz);
 
-                  retval.xcidx(0) = 0;
+                  retval.xcidx (0) = 0;
                   for (volatile octave_idx_type j = 0; j < b_nc; j++)
                     {
 
@@ -5499,12 +5499,12 @@
                       for (octave_idx_type i = 0; i < nr; i++)
                         if (Bx[i] != 0. || Bz[i] != 0.)
                           {
-                            retval.xridx(ii) = i;
-                            retval.xdata(ii++) =
+                            retval.xridx (ii) = i;
+                            retval.xdata (ii++) =
                               Complex (Bx[i], Bz[i]);
                           }
 
-                      retval.xcidx(j+1) = ii;
+                      retval.xcidx (j+1) = ii;
                     }
 
                   retval.maybe_compress ();
@@ -5532,8 +5532,8 @@
             }
 
           for (octave_idx_type j = 0; j < nc; j++)
-            for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-              m_band(ridx(i) - j + n_lower + n_upper, j) = data(i);
+            for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+              m_band(ridx (i) - j + n_lower + n_upper, j) = data (i);
 
           // Calculate the norm of the matrix, for later use.
           double anorm;
@@ -5542,8 +5542,8 @@
               for (octave_idx_type j = 0; j < nr; j++)
                 {
                   double atmp = 0.;
-                  for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
-                    atmp += fabs(data(i));
+                  for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
+                    atmp += fabs (data (i));
                   if (atmp > anorm)
                     anorm = atmp;
                 }
@@ -5615,7 +5615,7 @@
                   volatile octave_idx_type x_nz = b.nnz ();
                   octave_idx_type b_nc = b.cols ();
                   retval = SparseComplexMatrix (nr, b_nc, x_nz);
-                  retval.xcidx(0) = 0;
+                  retval.xcidx (0) = 0;
                   volatile octave_idx_type ii = 0;
 
                   OCTAVE_LOCAL_BUFFER (double, Bx, nr);
@@ -5628,12 +5628,12 @@
                           Bx[i] = 0.;
                           Bz[i] = 0.;
                         }
-                      for (octave_idx_type i = b.cidx(j);
-                           i < b.cidx(j+1); i++)
+                      for (octave_idx_type i = b.cidx (j);
+                           i < b.cidx (j+1); i++)
                         {
-                          Complex c = b.data(i);
-                          Bx[b.ridx(i)] = std::real (c);
-                          Bz[b.ridx(i)] = std::imag (c);
+                          Complex c = b.data (i);
+                          Bx[b.ridx (i)] = std::real (c);
+                          Bz[b.ridx (i)] = std::imag (c);
                         }
 
                       F77_XFCN (dgbtrs, DGBTRS,
@@ -5666,11 +5666,11 @@
                       for (octave_idx_type i = 0; i < nr; i++)
                         if (Bx[i] != 0. || Bz[i] != 0.)
                           {
-                            retval.xridx(ii) = i;
-                            retval.xdata(ii++) =
+                            retval.xridx (ii) = i;
+                            retval.xdata (ii++) =
                               Complex (Bx[i], Bz[i]);
                           }
-                      retval.xcidx(j+1) = ii;
+                      retval.xcidx (j+1) = ii;
                     }
 
                   retval.maybe_compress ();
@@ -5935,7 +5935,7 @@
                 {
                   octave_idx_type jr = j * b.rows ();
                   for (octave_idx_type i = 0; i < b.rows (); i++)
-                    retval.xelem(i,j) = static_cast<double *>(X->x)[jr + i];
+                    retval.xelem (i,j) = static_cast<double *>(X->x)[jr + i];
                 }
 
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
@@ -6160,12 +6160,12 @@
                                      static_cast<octave_idx_type>(X->nzmax));
               for (octave_idx_type j = 0;
                    j <= static_cast<octave_idx_type>(X->ncol); j++)
-                retval.xcidx(j) = static_cast<octave_idx_type *>(X->p)[j];
+                retval.xcidx (j) = static_cast<octave_idx_type *>(X->p)[j];
               for (octave_idx_type j = 0;
                    j < static_cast<octave_idx_type>(X->nzmax); j++)
                 {
-                  retval.xridx(j) = static_cast<octave_idx_type *>(X->i)[j];
-                  retval.xdata(j) = static_cast<double *>(X->x)[j];
+                  retval.xridx (j) = static_cast<octave_idx_type *>(X->i)[j];
+                  retval.xdata (j) = static_cast<double *>(X->x)[j];
                 }
 
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
@@ -6212,7 +6212,7 @@
               octave_idx_type ii = 0;
               retval = SparseMatrix (b_nr, b_nc, x_nz);
 
-              retval.xcidx(0) = 0;
+              retval.xcidx (0) = 0;
               for (octave_idx_type j = 0; j < b_nc; j++)
                 {
 
@@ -6247,11 +6247,11 @@
                               retval.change_capacity (sz);
                               x_nz = sz;
                             }
-                          retval.xdata(ii) = tmp;
-                          retval.xridx(ii++) = i;
+                          retval.xdata (ii) = tmp;
+                          retval.xridx (ii++) = i;
                         }
                     }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -6412,7 +6412,7 @@
                 {
                   octave_idx_type jr = j * b.rows ();
                   for (octave_idx_type i = 0; i < b.rows (); i++)
-                    retval.xelem(i,j) = static_cast<Complex *>(X->x)[jr + i];
+                    retval.xelem (i,j) = static_cast<Complex *>(X->x)[jr + i];
                 }
 
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
@@ -6657,12 +6657,12 @@
                  static_cast<octave_idx_type>(X->nzmax));
               for (octave_idx_type j = 0;
                    j <= static_cast<octave_idx_type>(X->ncol); j++)
-                retval.xcidx(j) = static_cast<octave_idx_type *>(X->p)[j];
+                retval.xcidx (j) = static_cast<octave_idx_type *>(X->p)[j];
               for (octave_idx_type j = 0;
                    j < static_cast<octave_idx_type>(X->nzmax); j++)
                 {
-                  retval.xridx(j) = static_cast<octave_idx_type *>(X->i)[j];
-                  retval.xdata(j) = static_cast<Complex *>(X->x)[j];
+                  retval.xridx (j) = static_cast<octave_idx_type *>(X->i)[j];
+                  retval.xdata (j) = static_cast<Complex *>(X->x)[j];
                 }
 
               BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
@@ -6712,7 +6712,7 @@
               OCTAVE_LOCAL_BUFFER (double, Xx, b_nr);
               OCTAVE_LOCAL_BUFFER (double, Xz, b_nr);
 
-              retval.xcidx(0) = 0;
+              retval.xcidx (0) = 0;
               for (octave_idx_type j = 0; j < b_nc; j++)
                 {
                   for (octave_idx_type i = 0; i < b_nr; i++)
@@ -6754,11 +6754,11 @@
                               retval.change_capacity (sz);
                               x_nz = sz;
                             }
-                          retval.xdata(ii) = tmp;
-                          retval.xridx(ii++) = i;
+                          retval.xdata (ii) = tmp;
+                          retval.xridx (ii++) = i;
                         }
                     }
-                  retval.xcidx(j+1) = ii;
+                  retval.xcidx (j+1) = ii;
                 }
 
               retval.maybe_compress ();
@@ -6970,7 +6970,7 @@
       return ComplexMatrix ();
     }
 
-  if (singular_fallback && mattype.type(false) == MatrixType::Rectangular)
+  if (singular_fallback && mattype.type (false) == MatrixType::Rectangular)
     {
       rcond = 1.;
 #ifdef USE_QRSOLVE
@@ -7038,7 +7038,7 @@
       return SparseComplexMatrix ();
     }
 
-  if (singular_fallback && mattype.type(false) == MatrixType::Rectangular)
+  if (singular_fallback && mattype.type (false) == MatrixType::Rectangular)
     {
       rcond = 1.;
 #ifdef USE_QRSOLVE
@@ -7451,12 +7451,12 @@
     {
       for (octave_idx_type j = 0; j < nr; j++)
         {
-          if (jj < cidx(i+1) && ridx(jj) == j)
+          if (jj < cidx (i+1) && ridx (jj) == j)
             jj++;
           else
             {
-              r.data(ii) = true;
-              r.ridx(ii++) = j;
+              r.data (ii) = true;
+              r.ridx (ii++) = j;
             }
         }
       r.cidx (i+1) = ii;
@@ -7500,7 +7500,7 @@
   else
     {
       SPARSE_REDUCTION_OP (SparseMatrix, double, *=,
-                           (cidx(j+1) - cidx(j) < nr ? 0.0 : 1.0), 1.0);
+                           (cidx (j+1) - cidx (j) < nr ? 0.0 : 1.0), 1.0);
     }
 }
 
@@ -7515,7 +7515,7 @@
 {
 #define ROW_EXPR \
   double d = data (i); \
-  tmp[ridx(i)] += d * d
+  tmp[ridx (i)] += d * d
 
 #define COL_EXPR \
   double d = data (i); \
@@ -7536,7 +7536,7 @@
   SparseMatrix retval (*this);
 
   for (octave_idx_type i = 0; i < nz; i++)
-    retval.data(i) = fabs(retval.data(i));
+    retval.data (i) = fabs (retval.data (i));
 
   return retval;
 }
@@ -7563,10 +7563,10 @@
    for (octave_idx_type j = 0; j < nc; j++)
      {
        octave_quit ();
-       for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
+       for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
          {
-           os << a.ridx(i) + 1 << " "  << j + 1 << " ";
-           octave_write_double (os, a.data(i));
+           os << a.ridx (i) + 1 << " "  << j + 1 << " ";
+           octave_write_double (os, a.data (i));
            os << "\n";
          }
      }
@@ -7712,14 +7712,14 @@
     {
       result = SparseMatrix (nr, nc, d);
       for (octave_idx_type j = 0; j < nc; j++)
-        for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
+        for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
           {
             double tmp = xmin (d, m.data (i));
             if (tmp != 0.)
               {
-                octave_idx_type idx = m.ridx(i) + j * nr;
-                result.xdata(idx) = tmp;
-                result.xridx(idx) = m.ridx(i);
+                octave_idx_type idx = m.ridx (i) + j * nr;
+                result.xdata (idx) = tmp;
+                result.xridx (idx) = m.ridx (i);
               }
           }
     }
@@ -7727,27 +7727,27 @@
     {
       octave_idx_type nel = 0;
       for (octave_idx_type j = 0; j < nc; j++)
-        for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
+        for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
           if (xmin (d, m.data (i)) != 0.)
             nel++;
 
       result = SparseMatrix (nr, nc, nel);
 
       octave_idx_type ii = 0;
-      result.xcidx(0) = 0;
+      result.xcidx (0) = 0;
       for (octave_idx_type j = 0; j < nc; j++)
         {
-          for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
+          for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
             {
               double tmp = xmin (d, m.data (i));
 
               if (tmp != 0.)
                 {
-                  result.xdata(ii) = tmp;
-                  result.xridx(ii++) = m.ridx(i);
-                }
-            }
-          result.xcidx(j+1) = ii;
+                  result.xdata (ii) = tmp;
+                  result.xridx (ii++) = m.ridx (i);
+                }
+            }
+          result.xcidx (j+1) = ii;
         }
     }
 
@@ -7783,38 +7783,38 @@
           r.cidx (0) = 0;
           for (octave_idx_type i = 0 ; i < a_nc ; i++)
             {
-              octave_idx_type  ja = a.cidx(i);
-              octave_idx_type  ja_max = a.cidx(i+1);
+              octave_idx_type  ja = a.cidx (i);
+              octave_idx_type  ja_max = a.cidx (i+1);
               bool ja_lt_max= ja < ja_max;
 
-              octave_idx_type  jb = b.cidx(i);
-              octave_idx_type  jb_max = b.cidx(i+1);
+              octave_idx_type  jb = b.cidx (i);
+              octave_idx_type  jb_max = b.cidx (i+1);
               bool jb_lt_max = jb < jb_max;
 
               while (ja_lt_max || jb_lt_max )
                 {
                   octave_quit ();
                   if ((! jb_lt_max) ||
-                      (ja_lt_max && (a.ridx(ja) < b.ridx(jb))))
+                      (ja_lt_max && (a.ridx (ja) < b.ridx (jb))))
                     {
-                      double tmp = xmin (a.data(ja), 0.);
+                      double tmp = xmin (a.data (ja), 0.);
                       if (tmp != 0.)
                         {
-                          r.ridx(jx) = a.ridx(ja);
-                          r.data(jx) = tmp;
+                          r.ridx (jx) = a.ridx (ja);
+                          r.data (jx) = tmp;
                           jx++;
                         }
                       ja++;
                       ja_lt_max= ja < ja_max;
                     }
                   else if (( !ja_lt_max ) ||
-                           (jb_lt_max && (b.ridx(jb) < a.ridx(ja)) ) )
+                           (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) )
                     {
-                      double tmp = xmin (0., b.data(jb));
+                      double tmp = xmin (0., b.data (jb));
                       if (tmp != 0.)
                         {
-                          r.ridx(jx) = b.ridx(jb);
-                          r.data(jx) = tmp;
+                          r.ridx (jx) = b.ridx (jb);
+                          r.data (jx) = tmp;
                           jx++;
                         }
                       jb++;
@@ -7822,11 +7822,11 @@
                     }
                   else
                     {
-                      double tmp = xmin (a.data(ja), b.data(jb));
+                      double tmp = xmin (a.data (ja), b.data (jb));
                       if (tmp != 0.)
                         {
-                          r.data(jx) = tmp;
-                          r.ridx(jx) = a.ridx(ja);
+                          r.data (jx) = tmp;
+                          r.ridx (jx) = a.ridx (ja);
                           jx++;
                         }
                       ja++;
@@ -7835,7 +7835,7 @@
                       jb_lt_max= jb < jb_max;
                     }
                 }
-              r.cidx(i+1) = jx;
+              r.cidx (i+1) = jx;
             }
 
           r.maybe_compress ();
@@ -7862,15 +7862,15 @@
     {
       result = SparseMatrix (nr, nc, d);
       for (octave_idx_type j = 0; j < nc; j++)
-        for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
+        for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
           {
             double tmp = xmax (d, m.data (i));
 
             if (tmp != 0.)
               {
-                octave_idx_type idx = m.ridx(i) + j * nr;
-                result.xdata(idx) = tmp;
-                result.xridx(idx) = m.ridx(i);
+                octave_idx_type idx = m.ridx (i) + j * nr;
+                result.xdata (idx) = tmp;
+                result.xridx (idx) = m.ridx (i);
               }
           }
     }
@@ -7878,26 +7878,26 @@
     {
       octave_idx_type nel = 0;
       for (octave_idx_type j = 0; j < nc; j++)
-        for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
+        for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
           if (xmax (d, m.data (i)) != 0.)
             nel++;
 
       result = SparseMatrix (nr, nc, nel);
 
       octave_idx_type ii = 0;
-      result.xcidx(0) = 0;
+      result.xcidx (0) = 0;
       for (octave_idx_type j = 0; j < nc; j++)
         {
-          for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
+          for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
             {
               double tmp = xmax (d, m.data (i));
               if (tmp != 0.)
                 {
-                  result.xdata(ii) = tmp;
-                  result.xridx(ii++) = m.ridx(i);
-                }
-            }
-          result.xcidx(j+1) = ii;
+                  result.xdata (ii) = tmp;
+                  result.xridx (ii++) = m.ridx (i);
+                }
+            }
+          result.xcidx (j+1) = ii;
         }
     }
 
@@ -7933,38 +7933,38 @@
           r.cidx (0) = 0;
           for (octave_idx_type i = 0 ; i < a_nc ; i++)
             {
-              octave_idx_type  ja = a.cidx(i);
-              octave_idx_type  ja_max = a.cidx(i+1);
+              octave_idx_type  ja = a.cidx (i);
+              octave_idx_type  ja_max = a.cidx (i+1);
               bool ja_lt_max= ja < ja_max;
 
-              octave_idx_type  jb = b.cidx(i);
-              octave_idx_type  jb_max = b.cidx(i+1);
+              octave_idx_type  jb = b.cidx (i);
+              octave_idx_type  jb_max = b.cidx (i+1);
               bool jb_lt_max = jb < jb_max;
 
               while (ja_lt_max || jb_lt_max )
                 {
                   octave_quit ();
                   if ((! jb_lt_max) ||
-                      (ja_lt_max && (a.ridx(ja) < b.ridx(jb))))
+                      (ja_lt_max && (a.ridx (ja) < b.ridx (jb))))
                     {
-                      double tmp = xmax (a.data(ja), 0.);
+                      double tmp = xmax (a.data (ja), 0.);
                       if (tmp != 0.)
                         {
-                          r.ridx(jx) = a.ridx(ja);
-                          r.data(jx) = tmp;
+                          r.ridx (jx) = a.ridx (ja);
+                          r.data (jx) = tmp;
                           jx++;
                         }
                       ja++;
                       ja_lt_max= ja < ja_max;
                     }
                   else if (( !ja_lt_max ) ||
-                           (jb_lt_max && (b.ridx(jb) < a.ridx(ja)) ) )
+                           (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) )
                     {
-                      double tmp = xmax (0., b.data(jb));
+                      double tmp = xmax (0., b.data (jb));
                       if (tmp != 0.)
                         {
-                          r.ridx(jx) = b.ridx(jb);
-                          r.data(jx) = tmp;
+                          r.ridx (jx) = b.ridx (jb);
+                          r.data (jx) = tmp;
                           jx++;
                         }
                       jb++;
@@ -7972,11 +7972,11 @@
                     }
                   else
                     {
-                      double tmp = xmax (a.data(ja), b.data(jb));
+                      double tmp = xmax (a.data (ja), b.data (jb));
                       if (tmp != 0.)
                         {
-                          r.data(jx) = tmp;
-                          r.ridx(jx) = a.ridx(ja);
+                          r.data (jx) = tmp;
+                          r.ridx (jx) = a.ridx (ja);
                           jx++;
                         }
                       ja++;
@@ -7985,7 +7985,7 @@
                       jb_lt_max= jb < jb_max;
                     }
                 }
-              r.cidx(i+1) = jx;
+              r.cidx (i+1) = jx;
             }
 
           r.maybe_compress ();
--- a/liboctave/data-conv.cc
+++ b/liboctave/data-conv.cc
@@ -496,7 +496,7 @@
   while (0)
 
 // Have to use copy here to avoid writing over data accessed via
-// Matrix::data().
+// Matrix::data ().
 
 #define LS_DO_WRITE(TYPE, data, size, len, stream) \
   do \
--- a/liboctave/dbleQR.cc
+++ b/liboctave/dbleQR.cc
@@ -466,7 +466,7 @@
 
   if (u.length () == m && v.length () == n)
     {
-      init(q*r + Matrix (u) * Matrix (v).transpose (), get_type ());
+      init (q*r + Matrix (u) * Matrix (v).transpose (), get_type ());
     }
   else
     (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
@@ -482,7 +482,7 @@
 
   if (u.rows () == m && v.rows () == n && u.cols () == v.cols ())
     {
-      init(q*r + u * v.transpose (), get_type ());
+      init (q*r + u * v.transpose (), get_type ());
     }
   else
     (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
--- a/liboctave/dbleSVD.cc
+++ b/liboctave/dbleSVD.cc
@@ -135,7 +135,7 @@
   double *u = left_sm.fortran_vec ();
 
   sigma.resize (nrow_s, ncol_s);
-  double *s_vec  = sigma.fortran_vec ();
+  double *s_vec = sigma.fortran_vec ();
 
   if (! (jobv == 'N' || jobv == 'O'))
     right_sm.resize (nrow_vt, n);
--- a/liboctave/dim-vector.cc
+++ b/liboctave/dim-vector.cc
@@ -157,16 +157,16 @@
             }
         }
       else
-        new_dims.resize(k);
+        new_dims.resize (k);
     }
 
   return new_dims;
 }
 
-// This is the rule for cat(). cat(dim, A, B) works if one
+// This is the rule for cat(). cat (dim, A, B) works if one
 // of the following holds, in this order:
 //
-// 1. size(A, k) == size(B, k) for all k != dim.
+// 1. size (A, k) == size (B, k) for all k != dim.
 // In this case, size (C, dim) = size (A, dim) + size (B, dim) and
 // other sizes remain intact.
 //
@@ -230,7 +230,7 @@
 // horizontally (dim = 2) or vertically (dim = 1) if one of the
 // following holds, in this order:
 //
-// 1. cat(dim, A, B) works
+// 1. cat (dim, A, B) works
 //
 // 2. A, B are 2D and one of them is an empty vector, in which
 // case the result is the other one except if both of them
--- a/liboctave/dim-vector.h
+++ b/liboctave/dim-vector.h
@@ -66,7 +66,7 @@
 
   static octave_idx_type *newrep (int ndims)
   {
-    octave_idx_type *r = new octave_idx_type[ndims + 2];
+    octave_idx_type *r = new octave_idx_type [ndims + 2];
 
     *r++ = 1;
     *r++ = ndims;
@@ -80,7 +80,7 @@
   {
     int l = ndims ();
 
-    octave_idx_type *r = new octave_idx_type[l + 2];
+    octave_idx_type *r = new octave_idx_type [l + 2];
 
     *r++ = 1;
     *r++ = l;
@@ -100,7 +100,7 @@
     if (n < 2)
       n = 2;
 
-    octave_idx_type *r = new octave_idx_type[n + 2];
+    octave_idx_type *r = new octave_idx_type [n + 2];
 
     *r++ = 1;
     *r++ = n;
@@ -212,6 +212,12 @@
 
   void chop_all_singletons (void);
 
+  // WARNING: Only call by jit
+  octave_idx_type *to_jit (void) const
+  {
+    return rep;
+  }
+
 private:
 
   static octave_idx_type *nil_rep (void)
@@ -220,9 +226,6 @@
       return zv.rep;
     }
 
-  explicit dim_vector (octave_idx_type *r)
-    : rep (r) { }
-
 public:
 
   static octave_idx_type dim_max (void);
@@ -233,6 +236,10 @@
   dim_vector (const dim_vector& dv) : rep (dv.rep)
   { OCTREFCOUNT_ATOMIC_INCREMENT (&(count())); }
 
+  // FIXME: Should be private, but required by array constructor for jit
+  explicit dim_vector (octave_idx_type *r)
+    : rep (r) { }
+
   static dim_vector alloc (int n)
   {
     return dim_vector (newrep (n < 2 ? 2 : n));
--- a/liboctave/eigs-base.cc
+++ b/liboctave/eigs-base.cc
@@ -241,8 +241,8 @@
       for (octave_idx_type j = 0; j < b_nc; j++)
         {
           for (octave_idx_type i = 0; i < n; i++)
-            retval.elem(static_cast<octave_idx_type>(qv[i]), j)  =
-              tmp.elem(i,j);
+            retval.elem (static_cast<octave_idx_type>(qv[i]), j) =
+              tmp.elem (i,j);
         }
     }
 
@@ -264,7 +264,7 @@
   for (octave_idx_type j = 0; j < b_nc; j++)
     {
       for (octave_idx_type i = 0; i < n; i++)
-        retval.elem(i,j) = m.elem(static_cast<octave_idx_type>(qv[i]), j);
+        retval.elem (i,j) = m.elem (static_cast<octave_idx_type>(qv[i]), j);
     }
   return U.solve (utyp, retval, err, rcond, 0);
 }
@@ -278,8 +278,8 @@
     y[j] = 0.;
 
   for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
-      y[m.ridx(i)] += m.data(i) * x[j];
+    for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
+      y[m.ridx (i)] += m.data (i) * x[j];
 
   return true;
 }
@@ -315,8 +315,8 @@
     y[j] = 0.;
 
   for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
-      y[m.ridx(i)] += m.data(i) * x[j];
+    for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++)
+      y[m.ridx (i)] += m.data (i) * x[j];
 
   return true;
 }
@@ -354,8 +354,8 @@
   else
     {
       bt = fact.chol_matrix ();
-      b =  bt.transpose ();
-      permB = ColumnVector(n);
+      b = bt.transpose ();
+      permB = ColumnVector (n);
       for (octave_idx_type i = 0; i < n; i++)
         permB(i) = i;
       return true;
@@ -391,8 +391,8 @@
   else
     {
       bt = fact.chol_matrix ();
-      b =  bt.hermitian ();
-      permB = ColumnVector(n);
+      b = bt.hermitian ();
+      permB = ColumnVector (n);
       for (octave_idx_type i = 0; i < n; i++)
         permB(i) = i;
       return true;
@@ -438,12 +438,12 @@
               SparseMatrix tmp(n,n,n);
               for (octave_idx_type i = 0; i < n; i++)
                 {
-                  tmp.xcidx(i) = i;
-                  tmp.xridx(i) =
+                  tmp.xcidx (i) = i;
+                  tmp.xridx (i) =
                     static_cast<octave_idx_type>(permB(i));
-                  tmp.xdata(i) = 1;
+                  tmp.xdata (i) = 1;
                 }
-              tmp.xcidx(n) = n;
+              tmp.xcidx (n) = n;
 
               AminusSigmaB = AminusSigmaB - sigma * tmp *
                 b.transpose () * b * tmp.transpose ();
@@ -459,13 +459,13 @@
     {
       SparseMatrix sigmat (n, n, n);
 
-          // Create sigma * speye(n,n)
+          // Create sigma * speye (n,n)
           sigmat.xcidx (0) = 0;
           for (octave_idx_type i = 0; i < n; i++)
             {
-              sigmat.xdata(i) = sigma;
-              sigmat.xridx(i) = i;
-              sigmat.xcidx(i+1) = i + 1;
+              sigmat.xdata (i) = sigma;
+              sigmat.xridx (i) = i;
+              sigmat.xcidx (i+1) = i + 1;
             }
 
           AminusSigmaB = AminusSigmaB - sigmat;
@@ -490,9 +490,9 @@
   for (octave_idx_type j = 0; j < n; j++)
     {
       double d = 0.;
-      if (U.xcidx(j+1) > U.xcidx(j) &&
-          U.xridx (U.xcidx(j+1)-1) == j)
-        d = std::abs (U.xdata (U.xcidx(j+1)-1));
+      if (U.xcidx (j+1) > U.xcidx (j) &&
+          U.xridx (U.xcidx (j+1)-1) == j)
+        d = std::abs (U.xdata (U.xcidx (j+1)-1));
 
       if (xisnan (minU) || d < minU)
         minU = d;
@@ -541,8 +541,8 @@
                    j < b.cols (); j++)
                 for (octave_idx_type i = 0;
                      i < b.rows (); i++)
-                  *p++ -=  tmp.xelem (static_cast<octave_idx_type>(pB[i]),
-                                      static_cast<octave_idx_type>(pB[j]));
+                  *p++ -= tmp.xelem (static_cast<octave_idx_type>(pB[i]),
+                                     static_cast<octave_idx_type>(pB[j]));
             }
           else
             AminusSigmaB = AminusSigmaB - tmp;
@@ -570,7 +570,7 @@
   double maxU = octave_NaN;
   for (octave_idx_type j = 0; j < n; j++)
     {
-      double d = std::abs (U.xelem(j,j));
+      double d = std::abs (U.xelem (j,j));
       if (xisnan (minU) || d < minU)
         minU = d;
 
@@ -613,12 +613,12 @@
               SparseMatrix tmp(n,n,n);
               for (octave_idx_type i = 0; i < n; i++)
                 {
-                  tmp.xcidx(i) = i;
-                  tmp.xridx(i) =
+                  tmp.xcidx (i) = i;
+                  tmp.xridx (i) =
                     static_cast<octave_idx_type>(permB(i));
-                  tmp.xdata(i) = 1;
+                  tmp.xdata (i) = 1;
                 }
-              tmp.xcidx(n) = n;
+              tmp.xcidx (n) = n;
 
               AminusSigmaB = AminusSigmaB - tmp * b.hermitian () * b *
                 tmp.transpose () * sigma;
@@ -633,13 +633,13 @@
     {
       SparseComplexMatrix sigmat (n, n, n);
 
-      // Create sigma * speye(n,n)
+      // Create sigma * speye (n,n)
       sigmat.xcidx (0) = 0;
       for (octave_idx_type i = 0; i < n; i++)
         {
-          sigmat.xdata(i) = sigma;
-          sigmat.xridx(i) = i;
-          sigmat.xcidx(i+1) = i + 1;
+          sigmat.xdata (i) = sigma;
+          sigmat.xridx (i) = i;
+          sigmat.xcidx (i+1) = i + 1;
         }
 
       AminusSigmaB = AminusSigmaB - sigmat;
@@ -664,9 +664,9 @@
   for (octave_idx_type j = 0; j < n; j++)
     {
       double d = 0.;
-      if (U.xcidx(j+1) > U.xcidx(j) &&
-          U.xridx (U.xcidx(j+1)-1) == j)
-        d = std::abs (U.xdata (U.xcidx(j+1)-1));
+      if (U.xcidx (j+1) > U.xcidx (j) &&
+          U.xridx (U.xcidx (j+1)-1) == j)
+        d = std::abs (U.xdata (U.xcidx (j+1)-1));
 
       if (xisnan (minU) || d < minU)
         minU = d;
@@ -715,8 +715,8 @@
                    j < b.cols (); j++)
                 for (octave_idx_type i = 0;
                      i < b.rows (); i++)
-                  *p++ -=  tmp.xelem (static_cast<octave_idx_type>(pB[i]),
-                                      static_cast<octave_idx_type>(pB[j]));
+                  *p++ -= tmp.xelem (static_cast<octave_idx_type>(pB[i]),
+                                     static_cast<octave_idx_type>(pB[j]));
             }
           else
             AminusSigmaB = AminusSigmaB - tmp;
@@ -744,7 +744,7 @@
   double maxU = octave_NaN;
   for (octave_idx_type j = 0; j < n; j++)
     {
-      double d = std::abs (U.xelem(j,j));
+      double d = std::abs (U.xelem (j,j));
       if (xisnan (minU) || d < minU)
         minU = d;
 
@@ -800,9 +800,9 @@
   if (resid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      resid = ColumnVector (octave_rand::vector(n));
-      octave_rand::distribution(rand_dist);
+      octave_rand::distribution ("uniform");
+      resid = ColumnVector (octave_rand::vector (n));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -827,7 +827,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1-1).\n"
-         "      Use 'eig(full(A))' instead");
+         "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -891,14 +891,14 @@
           b = b.transpose ();
           if (permB.length () == 0)
             {
-              permB = ColumnVector(n);
+              permB = ColumnVector (n);
               for (octave_idx_type i = 0; i < n; i++)
                 permB(i) = i;
             }
         }
       else
         {
-          if (! make_cholb(b, bt, permB))
+          if (! make_cholb (b, bt, permB))
             {
               (*current_liboctave_error_handler)
                 ("eigs: The matrix B is not positive definite");
@@ -951,7 +951,7 @@
           return -1;
         }
 
-      if (disp > 0 && !xisnan(workl[iptr(5)-1]))
+      if (disp > 0 && !xisnan (workl[iptr (5)-1]))
         {
           if (iter++)
             {
@@ -979,7 +979,7 @@
               for (octave_idx_type i = 0; i < n; i++)
                 mtmp(i,0) = workd[i + iptr(0) - 1];
 
-              mtmp = utsolve(bt, permB, m * ltsolve(b, permB, mtmp));
+              mtmp = utsolve (bt, permB, m * ltsolve (b, permB, mtmp));
 
               for (octave_idx_type i = 0; i < n; i++)
                 workd[i+iptr(1)-1] = mtmp(i,0);
@@ -1073,7 +1073,7 @@
                 }
 
               if (note3)
-                eig_vec = ltsolve(b, permB, eig_vec);
+                eig_vec = ltsolve (b, permB, eig_vec);
             }
         }
       else
@@ -1124,9 +1124,9 @@
   if (resid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      resid = ColumnVector (octave_rand::vector(n));
-      octave_rand::distribution(rand_dist);
+      octave_rand::distribution ("uniform");
+      resid = ColumnVector (octave_rand::vector (n));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -1140,7 +1140,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1-1).\n"
-             "      Use 'eig(full(A))' instead");
+             "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -1218,7 +1218,7 @@
   OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ()));
   OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ()));
 
-  if (! LuAminusSigmaB(m, b, cholB, permB, sigma, L, U, P, Q))
+  if (! LuAminusSigmaB (m, b, cholB, permB, sigma, L, U, P, Q))
     return -1;
 
   octave_idx_type lwork = p * (p + 8);
@@ -1244,7 +1244,7 @@
           return -1;
         }
 
-      if (disp > 0 && !xisnan(workl[iptr(5)-1]))
+      if (disp > 0 && !xisnan (workl[iptr (5)-1]))
         {
           if (iter++)
             {
@@ -1433,9 +1433,9 @@
   if (resid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      resid = ColumnVector (octave_rand::vector(n));
-      octave_rand::distribution(rand_dist);
+      octave_rand::distribution ("uniform");
+      resid = ColumnVector (octave_rand::vector (n));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -1460,7 +1460,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n"
-             "      Use 'eig(full(A))' instead");
+             "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -1545,7 +1545,7 @@
           return -1;
         }
 
-      if (disp > 0 && !xisnan(workl[iptr(5)-1]))
+      if (disp > 0 && !xisnan (workl[iptr (5)-1]))
         {
           if (iter++)
             {
@@ -1714,9 +1714,9 @@
   if (resid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      resid = ColumnVector (octave_rand::vector(n));
-      octave_rand::distribution(rand_dist);
+      octave_rand::distribution ("uniform");
+      resid = ColumnVector (octave_rand::vector (n));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -1741,7 +1741,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n"
-         "      Use 'eig(full(A))' instead");
+         "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -1805,14 +1805,14 @@
           b = b.transpose ();
           if (permB.length () == 0)
             {
-              permB = ColumnVector(n);
+              permB = ColumnVector (n);
               for (octave_idx_type i = 0; i < n; i++)
                 permB(i) = i;
             }
         }
       else
         {
-          if (! make_cholb(b, bt, permB))
+          if (! make_cholb (b, bt, permB))
             {
               (*current_liboctave_error_handler)
                 ("eigs: The matrix B is not positive definite");
@@ -1893,7 +1893,7 @@
               for (octave_idx_type i = 0; i < n; i++)
                 mtmp(i,0) = workd[i + iptr(0) - 1];
 
-              mtmp = utsolve(bt, permB, m * ltsolve(b, permB, mtmp));
+              mtmp = utsolve (bt, permB, m * ltsolve (b, permB, mtmp));
 
               for (octave_idx_type i = 0; i < n; i++)
                 workd[i+iptr(1)-1] = mtmp(i,0);
@@ -1969,7 +1969,7 @@
               if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0)
                 jj++;
               else
-                d [i-jj] = Complex (dr[i], di[i]);
+                d[i-jj] = Complex (dr[i], di[i]);
             }
           if (jj == 0 && !rvec)
             for (octave_idx_type i = 0; i < k; i++)
@@ -1982,7 +1982,7 @@
               d[i] = d[k - i - 1];
               d[k - i - 1] = dtmp;
             }
-          eig_val.resize(k);
+          eig_val.resize (k);
 
           if (rvec)
             {
@@ -2012,11 +2012,11 @@
                 {
                   octave_idx_type off1 = i * n;
                   octave_idx_type off2 = (i+1) * n;
-                  if (std::imag(eig_val(i)) == 0)
+                  if (std::imag (eig_val(i)) == 0)
                     {
                       for (octave_idx_type j = 0; j < n; j++)
                         eig_vec(j,i) =
-                          Complex(z[j+off1],0.);
+                          Complex (z[j+off1],0.);
                       i++;
                     }
                   else
@@ -2024,17 +2024,17 @@
                       for (octave_idx_type j = 0; j < n; j++)
                         {
                           eig_vec(j,i) =
-                            Complex(z[j+off1],z[j+off2]);
+                            Complex (z[j+off1],z[j+off2]);
                           if (i < k - 1)
                             eig_vec(j,i+1) =
-                              Complex(z[j+off1],-z[j+off2]);
+                              Complex (z[j+off1],-z[j+off2]);
                         }
                       i+=2;
                     }
                 }
 
               if (note3)
-                eig_vec = ltsolve(M (b), permB, eig_vec);
+                eig_vec = ltsolve (M(b), permB, eig_vec);
             }
         }
       else
@@ -2087,9 +2087,9 @@
   if (resid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      resid = ColumnVector (octave_rand::vector(n));
-      octave_rand::distribution(rand_dist);
+      octave_rand::distribution ("uniform");
+      resid = ColumnVector (octave_rand::vector (n));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -2114,7 +2114,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n"
-             "      Use 'eig(full(A))' instead");
+             "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -2181,7 +2181,7 @@
   OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ()));
   OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ()));
 
-  if (! LuAminusSigmaB(m, b, cholB, permB, sigmar, L, U, P, Q))
+  if (! LuAminusSigmaB (m, b, cholB, permB, sigmar, L, U, P, Q))
     return -1;
 
   octave_idx_type lwork = 3 * p * (p + 2);
@@ -2207,7 +2207,7 @@
           return -1;
         }
 
-      if (disp > 0 && !xisnan(workl[iptr(5)-1]))
+      if (disp > 0 && !xisnan (workl[iptr (5)-1]))
         {
           if (iter++)
             {
@@ -2355,7 +2355,7 @@
               if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0)
                 jj++;
               else
-                d [i-jj] = Complex (dr[i], di[i]);
+                d[i-jj] = Complex (dr[i], di[i]);
             }
           if (jj == 0 && !rvec)
             for (octave_idx_type i = 0; i < k; i++)
@@ -2368,7 +2368,7 @@
               d[i] = d[k - i - 1];
               d[k - i - 1] = dtmp;
             }
-          eig_val.resize(k);
+          eig_val.resize (k);
 
           if (rvec)
             {
@@ -2398,11 +2398,11 @@
                 {
                   octave_idx_type off1 = i * n;
                   octave_idx_type off2 = (i+1) * n;
-                  if (std::imag(eig_val(i)) == 0)
+                  if (std::imag (eig_val(i)) == 0)
                     {
                       for (octave_idx_type j = 0; j < n; j++)
                         eig_vec(j,i) =
-                          Complex(z[j+off1],0.);
+                          Complex (z[j+off1],0.);
                       i++;
                     }
                   else
@@ -2410,10 +2410,10 @@
                       for (octave_idx_type j = 0; j < n; j++)
                         {
                           eig_vec(j,i) =
-                            Complex(z[j+off1],z[j+off2]);
+                            Complex (z[j+off1],z[j+off2]);
                           if (i < k - 1)
                             eig_vec(j,i+1) =
-                              Complex(z[j+off1],-z[j+off2]);
+                              Complex (z[j+off1],-z[j+off2]);
                         }
                       i+=2;
                     }
@@ -2450,9 +2450,9 @@
   if (resid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      resid = ColumnVector (octave_rand::vector(n));
-      octave_rand::distribution(rand_dist);
+      octave_rand::distribution ("uniform");
+      resid = ColumnVector (octave_rand::vector (n));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -2477,7 +2477,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n"
-             "      Use 'eig(full(A))' instead");
+             "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -2667,7 +2667,7 @@
               if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0)
                 jj++;
               else
-                d [i-jj] = Complex (dr[i], di[i]);
+                d[i-jj] = Complex (dr[i], di[i]);
             }
           if (jj == 0 && !rvec)
             for (octave_idx_type i = 0; i < k; i++)
@@ -2680,7 +2680,7 @@
               d[i] = d[k - i - 1];
               d[k - i - 1] = dtmp;
             }
-          eig_val.resize(k);
+          eig_val.resize (k);
 
           if (rvec)
             {
@@ -2710,11 +2710,11 @@
                 {
                   octave_idx_type off1 = i * n;
                   octave_idx_type off2 = (i+1) * n;
-                  if (std::imag(eig_val(i)) == 0)
+                  if (std::imag (eig_val(i)) == 0)
                     {
                       for (octave_idx_type j = 0; j < n; j++)
                         eig_vec(j,i) =
-                          Complex(z[j+off1],0.);
+                          Complex (z[j+off1],0.);
                       i++;
                     }
                   else
@@ -2722,10 +2722,10 @@
                       for (octave_idx_type j = 0; j < n; j++)
                         {
                           eig_vec(j,i) =
-                            Complex(z[j+off1],z[j+off2]);
+                            Complex (z[j+off1],z[j+off2]);
                           if (i < k - 1)
                             eig_vec(j,i+1) =
-                              Complex(z[j+off1],-z[j+off2]);
+                              Complex (z[j+off1],-z[j+off2]);
                         }
                       i+=2;
                     }
@@ -2778,13 +2778,13 @@
   if (cresid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      Array<double> rr (octave_rand::vector(n));
-      Array<double> ri (octave_rand::vector(n));
+      octave_rand::distribution ("uniform");
+      Array<double> rr (octave_rand::vector (n));
+      Array<double> ri (octave_rand::vector (n));
       cresid = ComplexColumnVector (n);
       for (octave_idx_type i = 0; i < n; i++)
-        cresid(i) = Complex(rr(i),ri(i));
-      octave_rand::distribution(rand_dist);
+        cresid(i) = Complex (rr(i),ri(i));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -2809,7 +2809,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n"
-         "      Use 'eig(full(A))' instead");
+         "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -2873,14 +2873,14 @@
           b = b.hermitian ();
           if (permB.length () == 0)
             {
-              permB = ColumnVector(n);
+              permB = ColumnVector (n);
               for (octave_idx_type i = 0; i < n; i++)
                 permB(i) = i;
             }
         }
       else
         {
-          if (! make_cholb(b, bt, permB))
+          if (! make_cholb (b, bt, permB))
             {
               (*current_liboctave_error_handler)
                 ("eigs: The matrix B is not positive definite");
@@ -2934,7 +2934,7 @@
           return -1;
         }
 
-      if (disp > 0 && !xisnan(workl[iptr(5)-1]))
+      if (disp > 0 && !xisnan (workl[iptr (5)-1]))
         {
           if (iter++)
             {
@@ -2961,7 +2961,7 @@
               ComplexMatrix mtmp (n,1);
               for (octave_idx_type i = 0; i < n; i++)
                 mtmp(i,0) = workd[i + iptr(0) - 1];
-              mtmp = utsolve(bt, permB, m * ltsolve(b, permB, mtmp));
+              mtmp = utsolve (bt, permB, m * ltsolve (b, permB, mtmp));
               for (octave_idx_type i = 0; i < n; i++)
                 workd[i+iptr(1)-1] = mtmp(i,0);
 
@@ -3026,7 +3026,7 @@
           d[i] = d[k - i - 1];
           d[k - i - 1] = ctmp;
         }
-      eig_val.resize(k);
+      eig_val.resize (k);
 
       if (rvec)
         {
@@ -3051,7 +3051,7 @@
             }
 
           if (note3)
-            eig_vec = ltsolve(b, permB, eig_vec);
+            eig_vec = ltsolve (b, permB, eig_vec);
         }
     }
   else
@@ -3103,13 +3103,13 @@
   if (cresid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      Array<double> rr (octave_rand::vector(n));
-      Array<double> ri (octave_rand::vector(n));
+      octave_rand::distribution ("uniform");
+      Array<double> rr (octave_rand::vector (n));
+      Array<double> ri (octave_rand::vector (n));
       cresid = ComplexColumnVector (n);
       for (octave_idx_type i = 0; i < n; i++)
-        cresid(i) = Complex(rr(i),ri(i));
-      octave_rand::distribution(rand_dist);
+        cresid(i) = Complex (rr(i),ri(i));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -3134,7 +3134,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n"
-             "      Use 'eig(full(A))' instead");
+             "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -3201,7 +3201,7 @@
   OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ()));
   OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ()));
 
-  if (! LuAminusSigmaB(m, b, cholB, permB, sigma, L, U, P, Q))
+  if (! LuAminusSigmaB (m, b, cholB, permB, sigma, L, U, P, Q))
     return -1;
 
   octave_idx_type lwork = p * (3 * p + 5);
@@ -3366,7 +3366,7 @@
           d[i] = d[k - i - 1];
           d[k - i - 1] = ctmp;
         }
-      eig_val.resize(k);
+      eig_val.resize (k);
 
       if (rvec)
         {
@@ -3412,7 +3412,7 @@
                              int disp, int maxit)
 {
   std::string typ (_typ);
-  bool have_sigma = (std::abs(sigma) ? true : false);
+  bool have_sigma = (std::abs (sigma) ? true : false);
   char bmat = 'I';
   octave_idx_type mode = 1;
   int err = 0;
@@ -3420,13 +3420,13 @@
   if (cresid.is_empty ())
     {
       std::string rand_dist = octave_rand::distribution ();
-      octave_rand::distribution("uniform");
-      Array<double> rr (octave_rand::vector(n));
-      Array<double> ri (octave_rand::vector(n));
+      octave_rand::distribution ("uniform");
+      Array<double> rr (octave_rand::vector (n));
+      Array<double> ri (octave_rand::vector (n));
       cresid = ComplexColumnVector (n);
       for (octave_idx_type i = 0; i < n; i++)
-        cresid(i) = Complex(rr(i),ri(i));
-      octave_rand::distribution(rand_dist);
+        cresid(i) = Complex (rr(i),ri(i));
+      octave_rand::distribution (rand_dist);
     }
 
   if (n < 3)
@@ -3451,7 +3451,7 @@
     {
       (*current_liboctave_error_handler)
         ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n"
-             "      Use 'eig(full(A))' instead");
+             "      Use 'eig (full (A))' instead");
       return -1;
     }
 
@@ -3630,7 +3630,7 @@
           d[i] = d[k - i - 1];
           d[k - i - 1] = ctmp;
         }
-      eig_val.resize(k);
+      eig_val.resize (k);
 
       if (rvec)
         {
--- a/liboctave/f2c-main.c
+++ b/liboctave/f2c-main.c
@@ -31,5 +31,5 @@
 #  ifdef __cplusplus
 extern "C"
 #  endif
-int F77_DUMMY_MAIN () { assert(0); return 1; }
+int F77_DUMMY_MAIN () { assert (0); return 1; }
 #endif
--- a/liboctave/fCMatrix.cc
+++ b/liboctave/fCMatrix.cc
@@ -1081,7 +1081,7 @@
       F77_XFCN (cgetri, CGETRI, (nc, tmp_data, nr, pipvt,
                                  z.fortran_vec (), lwork, info));
 
-      lwork = static_cast<octave_idx_type> (std::real(z(0)));
+      lwork = static_cast<octave_idx_type> (std::real (z(0)));
       lwork = (lwork <  2 *nc ? 2*nc : lwork);
       z.resize (dim_vector (lwork, 1));
       FloatComplex *pz = z.fortran_vec ();
@@ -1091,7 +1091,7 @@
       // Calculate the norm of the matrix, for later use.
       float anorm;
       if (calc_cond)
-        anorm  = retval.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+        anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
       F77_XFCN (cgetrf, CGETRF, (nc, nc, tmp_data, nr, pipvt, info));
 
@@ -1165,7 +1165,7 @@
         }
 
       if (!mattype.is_hermitian ())
-        ret = finverse(mattype, info, rcon, force, calc_cond);
+        ret = finverse (mattype, info, rcon, force, calc_cond);
 
       if ((mattype.is_hermitian () || calc_cond) && rcon == 0.)
         ret = FloatComplexMatrix (rows (), columns (), FloatComplex (octave_Float_Inf, 0.));
@@ -1828,7 +1828,7 @@
               Array<octave_idx_type> ipvt (dim_vector (nr, 1));
               octave_idx_type *pipvt = ipvt.fortran_vec ();
 
-              if(anorm < 0.)
+              if (anorm < 0.)
                 anorm = atmp.abs ().sum ().
                   row(static_cast<octave_idx_type>(0)).max ();
 
@@ -2096,7 +2096,7 @@
           char job = 'L';
           FloatComplexMatrix atmp = *this;
           FloatComplex *tmp_data = atmp.fortran_vec ();
-          anorm = atmp.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+          anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
           F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                      tmp_data, nr, info
@@ -2180,7 +2180,7 @@
 
           // Calculate the norm of the matrix, for later use.
           if (anorm < 0.)
-            anorm = atmp.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+            anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
           F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info));
 
@@ -2406,7 +2406,7 @@
 
   FloatComplexMatrix tmp (b);
   tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt);
-  return tmp.column(static_cast<octave_idx_type> (0));
+  return tmp.column (static_cast<octave_idx_type> (0));
 }
 
 FloatComplexMatrix
--- a/liboctave/fCNDArray.cc
+++ b/liboctave/fCNDArray.cc
@@ -237,7 +237,7 @@
           octave_quit ();
 
           for (octave_idx_type i = 0; i < npts; i++)
-            tmp[i] = elem((i + k*npts)*stride + j*dist);
+            tmp[i] = elem ((i + k*npts)*stride + j*dist);
 
           F77_FUNC (cfftf, CFFTF) (npts, tmp, pwsave);
 
@@ -284,7 +284,7 @@
           octave_quit ();
 
           for (octave_idx_type i = 0; i < npts; i++)
-            tmp[i] = elem((i + k*npts)*stride + j*dist);
+            tmp[i] = elem ((i + k*npts)*stride + j*dist);
 
           F77_FUNC (cfftb, CFFTB) (npts, tmp, pwsave);
 
--- a/liboctave/fCmplxQR.cc
+++ b/liboctave/fCmplxQR.cc
@@ -471,7 +471,7 @@
 
   if (u.length () == m && v.length () == n)
     {
-      init(q*r + FloatComplexMatrix (u) * FloatComplexMatrix (v).hermitian (), get_type ());
+      init (q*r + FloatComplexMatrix (u) * FloatComplexMatrix (v).hermitian (), get_type ());
     }
   else
     (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
@@ -487,7 +487,7 @@
 
   if (u.rows () == m && v.rows () == n && u.cols () == v.cols ())
     {
-      init(q*r + u * v.hermitian (), get_type ());
+      init (q*r + u * v.hermitian (), get_type ());
     }
   else
     (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
--- a/liboctave/fEIG.cc
+++ b/liboctave/fEIG.cc
@@ -226,8 +226,8 @@
                   return -1;
                 }
 
-              lambda.elem(j) = FloatComplex (wr.elem(j), wi.elem(j));
-              lambda.elem(j+1) = FloatComplex (wr.elem(j+1), wi.elem(j+1));
+              lambda.elem (j) = FloatComplex (wr.elem (j), wi.elem (j));
+              lambda.elem (j+1) = FloatComplex (wr.elem (j+1), wi.elem (j+1));
 
               for (octave_idx_type i = 0; i < nvr; i++)
                 {
@@ -576,10 +576,10 @@
                   return -1;
                 }
 
-              lambda.elem(j) = FloatComplex (ar.elem(j) / beta.elem (j),
-                                             ai.elem(j) / beta.elem (j));
-              lambda.elem(j+1) = FloatComplex (ar.elem(j+1) / beta.elem (j+1),
-                                               ai.elem(j+1) / beta.elem (j+1));
+              lambda.elem (j) = FloatComplex (ar.elem (j) / beta.elem (j),
+                                              ai.elem (j) / beta.elem (j));
+              lambda.elem (j+1) = FloatComplex (ar.elem (j+1) / beta.elem (j+1),
+                                                ai.elem (j+1) / beta.elem (j+1));
 
               for (octave_idx_type i = 0; i < nvr; i++)
                 {
@@ -775,7 +775,7 @@
       lambda.resize (n);
 
       for (octave_idx_type j = 0; j < n; j++)
-        lambda.elem (j) = alpha.elem (j) / beta.elem(j);
+        lambda.elem (j) = alpha.elem (j) / beta.elem (j);
 
       v = vtmp;
     }
--- a/liboctave/fMatrix.cc
+++ b/liboctave/fMatrix.cc
@@ -763,7 +763,7 @@
       // Calculate the norm of the matrix, for later use.
       float anorm = 0;
       if (calc_cond)
-        anorm = retval.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+        anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
       F77_XFCN (sgetrf, SGETRF, (nc, nc, tmp_data, nr, pipvt, info));
 
@@ -838,7 +838,7 @@
         }
 
       if (!mattype.is_hermitian ())
-        ret = finverse(mattype, info, rcon, force, calc_cond);
+        ret = finverse (mattype, info, rcon, force, calc_cond);
 
       if ((mattype.is_hermitian () || calc_cond) && rcon == 0.)
         ret = FloatMatrix (rows (), columns (), octave_Float_Inf);
@@ -1462,7 +1462,7 @@
               octave_idx_type info = 0;
               char job = 'L';
               anorm = atmp.abs ().sum ().
-                row(static_cast<octave_idx_type>(0)).max ();
+                row (static_cast<octave_idx_type>(0)).max ();
 
               F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                          tmp_data, nr, info
@@ -1498,7 +1498,7 @@
               Array<octave_idx_type> ipvt (dim_vector (nr, 1));
               octave_idx_type *pipvt = ipvt.fortran_vec ();
 
-              if(anorm < 0.)
+              if (anorm < 0.)
                 anorm = atmp.abs ().sum ().
                   row(static_cast<octave_idx_type>(0)).max ();
 
@@ -1762,7 +1762,7 @@
           char job = 'L';
           FloatMatrix atmp = *this;
           float *tmp_data = atmp.fortran_vec ();
-          anorm = atmp.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+          anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
           F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr,
                                      tmp_data, nr, info
@@ -1838,8 +1838,8 @@
 
           FloatMatrix atmp = *this;
           float *tmp_data = atmp.fortran_vec ();
-          if(anorm < 0.)
-            anorm = atmp.abs ().sum ().row(static_cast<octave_idx_type>(0)).max ();
+          if (anorm < 0.)
+            anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max ();
 
           Array<float> z (dim_vector (4 * nc, 1));
           float *pz = z.fortran_vec ();
@@ -2062,7 +2062,7 @@
 {
   FloatMatrix tmp (b);
   tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt);
-  return tmp.column(static_cast<octave_idx_type> (0));
+  return tmp.column (static_cast<octave_idx_type> (0));
 }
 
 FloatComplexColumnVector
@@ -2094,7 +2094,7 @@
                solve_singularity_handler sing_handler, blas_trans_type transt) const
 {
   FloatComplexMatrix tmp (*this);
-  return tmp.solve(typ, b, info, rcon, sing_handler, transt);
+  return tmp.solve (typ, b, info, rcon, sing_handler, transt);
 }
 
 FloatMatrix
--- a/liboctave/fNDArray.cc
+++ b/liboctave/fNDArray.cc
@@ -241,7 +241,7 @@
           octave_quit ();
 
           for (octave_idx_type i = 0; i < npts; i++)
-            tmp[i] = elem((i + k*npts)*stride + j*dist);
+            tmp[i] = elem ((i + k*npts)*stride + j*dist);
 
           F77_FUNC (cfftf, CFFTF) (npts, tmp, pwsave);
 
@@ -288,7 +288,7 @@
           octave_quit ();
 
           for (octave_idx_type i = 0; i < npts; i++)
-            tmp[i] = elem((i + k*npts)*stride + j*dist);
+            tmp[i] = elem ((i + k*npts)*stride + j*dist);
 
           F77_FUNC (cfftb, CFFTB) (npts, tmp, pwsave);
 
--- a/liboctave/floatQR.cc
+++ b/liboctave/floatQR.cc
@@ -464,7 +464,7 @@
 
   if (u.length () == m && v.length () == n)
     {
-      init(q*r + FloatMatrix (u) * FloatMatrix (v).transpose (), get_type ());
+      init (q*r + FloatMatrix (u) * FloatMatrix (v).transpose (), get_type ());
     }
   else
     (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
@@ -480,7 +480,7 @@
 
   if (u.rows () == m && v.rows () == n && u.cols () == v.cols ())
     {
-      init(q*r + u * v.transpose (), get_type ());
+      init (q*r + u * v.transpose (), get_type ());
     }
   else
     (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
--- a/liboctave/floatSVD.cc
+++ b/liboctave/floatSVD.cc
@@ -135,7 +135,7 @@
   float *u = left_sm.fortran_vec ();
 
   sigma.resize (nrow_s, ncol_s);
-  float *s_vec  = sigma.fortran_vec ();
+  float *s_vec = sigma.fortran_vec ();
 
   if (! (jobv == 'N' || jobv == 'O'))
     right_sm.resize (nrow_vt, n);
--- a/liboctave/idx-vector.cc
+++ b/liboctave/idx-vector.cc
@@ -108,7 +108,7 @@
 idx_vector::idx_range_rep::idx_range_rep (octave_idx_type _start,
                                           octave_idx_type _limit,
                                           octave_idx_type _step)
-  : start(_start), len (_step ? std::max((_limit - _start) / _step, static_cast<octave_idx_type> (0)) : -1), step (_step)
+  : start(_start), len (_step ? std::max ((_limit - _start) / _step, static_cast<octave_idx_type> (0)) : -1), step (_step)
 {
   if (len < 0)
     {
@@ -325,7 +325,7 @@
 {
   if (len != 0)
     {
-      octave_idx_type *d = new octave_idx_type[len];
+      octave_idx_type *d = new octave_idx_type [len];
       for (octave_idx_type i = 0; i < len; i++)
         d[i] = convert_index (nda.xelem (i), err, ext);
       data = d;
@@ -489,7 +489,7 @@
   if (ext > len*xlog2 (1.0 + len))
     {
       // Use standard sort via octave_sort.
-      octave_idx_type *new_data = new octave_idx_type[len];
+      octave_idx_type *new_data = new octave_idx_type [len];
       new_rep->data = new_data;
 
       std::copy (data, data + len, new_data);
@@ -524,7 +524,7 @@
       else
         new_rep->orig_dims = dim_vector (new_len, 1);
 
-      octave_idx_type *new_data = new octave_idx_type[new_len];
+      octave_idx_type *new_data = new octave_idx_type [new_len];
       new_rep->data = new_data;
 
       for (octave_idx_type i = 0, j = 0; i < ext; i++)
@@ -538,7 +538,7 @@
       for (octave_idx_type i = 0; i < len; i++)
         cnt[data[i]]++;
 
-      octave_idx_type *new_data = new octave_idx_type[len];
+      octave_idx_type *new_data = new octave_idx_type [len];
       new_rep->data = new_data;
 
       for (octave_idx_type i = 0, j = 0; i < ext; i++)
@@ -1145,7 +1145,7 @@
 
   if (is_colon_equiv (n))
     retval = true;
-  else if (length (n) == n && extent(n) == n)
+  else if (length(n) == n && extent(n) == n)
     {
       OCTAVE_LOCAL_BUFFER_INIT (bool, left, n, true);
 
@@ -1190,7 +1190,7 @@
         const octave_idx_type *ri = r->get_data ();
         Array<octave_idx_type> idx (orig_dimensions ());
         for (octave_idx_type i = 0; i < n; i++)
-          idx.xelem(ri[i]) = i;
+          idx.xelem (ri[i]) = i;
         retval = new idx_vector_rep (idx, r->extent (0), DIRECT);
         break;
       }
@@ -1330,7 +1330,7 @@
 
 /*
 
-%!error id=Octave:index-out-of-bounds 1(find([1,1] != 0))
-%!assert ((1:3)(find([1,0,1] != 0)), [1,3])
+%!error id=Octave:index-out-of-bounds 1(find ([1,1] != 0))
+%!assert ((1:3)(find ([1,0,1] != 0)), [1,3])
 
 */
--- a/liboctave/kpse.cc
+++ b/liboctave/kpse.cc
@@ -35,7 +35,7 @@
    myself; if you do, I'd be grateful for any changes. --kb@mail.tug.org */
 
 /* If we have either DOS or OS2, we are DOSISH.  */
-#if defined (DOS) || defined (OS2) || defined (WIN32) || defined(__MSDOS__)
+#if defined (DOS) || defined (OS2) || defined (WIN32) || defined (__MSDOS__)
 #define DOSISH
 #endif
 
@@ -44,11 +44,11 @@
 #endif
 
 extern "C" {
-#if defined(__MINGW32__)
+#if defined (__MINGW32__)
 #include <windows.h>
 #include <fcntl.h>
 #include <dirent.h>
-#elif defined(WIN32)
+#elif defined (WIN32)
 #ifndef _MSC_VER
 #define __STDC__ 1
 #include "win32lib.h"
@@ -76,7 +76,7 @@
 /* If you want to find subdirectories in a directory with non-Unix
    semantics (specifically, if a directory with no subdirectories does
    not have exactly two links), define this.  */
-#if defined(__DJGPP__) || ! defined (DOSISH)
+#if defined (__DJGPP__) || ! defined (DOSISH)
 /* Surprise!  DJGPP returns st_nlink exactly like on Unix.  */
 #define ST_NLINK_TRICK
 #endif /* either not DOSISH or __DJGPP__ */
@@ -99,7 +99,7 @@
 #define DIR_SEP '/'
 #define DIR_SEP_STRING "/"
 #define IS_DEVICE_SEP(ch) ((ch) == ':')
-#define NAME_BEGINS_WITH_DEVICE(name) ((name.length()>0) && IS_DEVICE_SEP((name)[1]))
+#define NAME_BEGINS_WITH_DEVICE(name) ((name.length ()>0) && IS_DEVICE_SEP((name)[1]))
 /* On DOS, it's good to allow both \ and / between directories.  */
 #define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
 #else
--- a/liboctave/lo-macros.h
+++ b/liboctave/lo-macros.h
@@ -92,4 +92,8 @@
 #define OCT_MAKE_DECL_LIST(TYPE, PREFIX, NUM) \
   OCT_ITERATE_PARAM_MACRO(OCT_MAKE_DECL_LIST_HELPER, TYPE PREFIX, NUM)
 
+// expands to PREFIX0, PREFIX1, ..., PREFIX ## (NUM-1)
+#define OCT_MAKE_ARG_LIST(PREFIX, NUM)          \
+  OCT_ITERATE_PARAM_MACRO(OCT_MAKE_DECL_LIST_HELPER, PREFIX, NUM)
+
 #endif
--- a/liboctave/lo-specfun.cc
+++ b/liboctave/lo-specfun.cc
@@ -454,7 +454,7 @@
 #endif
 
 Complex
-expm1(const Complex& x)
+expm1 (const Complex& x)
 {
   Complex retval;
 
@@ -509,7 +509,7 @@
 #endif
 
 FloatComplex
-expm1(const FloatComplex& x)
+expm1 (const FloatComplex& x)
 {
   FloatComplex retval;
 
@@ -565,7 +565,7 @@
                         atan2 (1 + r, i));
     }
   else
-    retval = std::log (Complex(1) + x);
+    retval = std::log (Complex (1) + x);
 
   return retval;
 }
@@ -624,7 +624,7 @@
                         atan2 (1 + r, i));
     }
   else
-    retval = std::log (FloatComplex(1) + x);
+    retval = std::log (FloatComplex (1) + x);
 
   return retval;
 }
@@ -873,7 +873,7 @@
           if (kode == 2)
             {
               // Compensate for different scaling factor of besk.
-              tmp2 *= exp(-z - std::abs(z.real ()));
+              tmp2 *= exp (-z - std::abs (z.real ()));
             }
 
           tmp += tmp2;
@@ -1483,7 +1483,7 @@
           if (kode == 2)
             {
               // Compensate for different scaling factor of besk.
-              tmp2 *= exp(-z - std::abs(z.real ()));
+              tmp2 *= exp (-z - std::abs (z.real ()));
             }
 
           tmp += tmp2;
@@ -1893,7 +1893,7 @@
 
   if (! scaled)
     {
-      Complex expz = exp (- 2.0 / 3.0 * z * sqrt(z));
+      Complex expz = exp (- 2.0 / 3.0 * z * sqrt (z));
 
       double rexpz = real (expz);
       double iexpz = imag (expz);
@@ -2023,7 +2023,7 @@
 
   if (! scaled)
     {
-      FloatComplex expz = exp (- static_cast<float> (2.0 / 3.0) * z * sqrt(z));
+      FloatComplex expz = exp (- static_cast<float> (2.0 / 3.0) * z * sqrt (z));
 
       float rexpz = real (expz);
       float iexpz = imag (expz);
@@ -3130,7 +3130,7 @@
       if (x < 0)
         {
           double y2 = ceil (x / 16.0) * 16.0, del = (x-y2)*(x+y2);
-          result = 2*(std::exp(y2*y2) * std::exp(del)) - result;
+          result = 2*(std::exp (y2*y2) * std::exp (del)) - result;
         }
     }
 
--- a/liboctave/mx-inlines.cc
+++ b/liboctave/mx-inlines.cc
@@ -483,12 +483,12 @@
 #define OP_RED_SUMSQ(ac, el) ac += el*el
 #define OP_RED_SUMSQC(ac, el) ac += cabsq (el)
 
-inline void op_dble_sum(double& ac, float el)
+inline void op_dble_sum (double& ac, float el)
 { ac += el; }
-inline void op_dble_sum(Complex& ac, const FloatComplex& el)
+inline void op_dble_sum (Complex& ac, const FloatComplex& el)
 { ac += el; } // FIXME: guaranteed?
 template <class T>
-inline void op_dble_sum(double& ac, const octave_int<T>& el)
+inline void op_dble_sum (double& ac, const octave_int<T>& el)
 { ac += el.double_value (); }
 
 // The following two implement a simple short-circuiting.
@@ -1177,7 +1177,7 @@
 {
   octave_idx_type l, n, u;
   dim_vector dims = src.dims ();
-  // M*b inconsistency: sum([]) = 0 etc.
+  // M*b inconsistency: sum ([]) = 0 etc.
   if (dims.length () == 2 && dims(0) == 0 && dims(1) == 0)
     dims (1) = 1;
 
--- a/liboctave/mx-op-defs.h
+++ b/liboctave/mx-op-defs.h
@@ -413,7 +413,7 @@
           octave_idx_type len = dm.length (); \
  \
           for (octave_idx_type i = 0; i < len; i++) \
-            r.elem(i, i) OPEQ dm.elem(i, i); \
+            r.elem (i, i) OPEQ dm.elem (i, i); \
         } \
     } \
  \
@@ -483,7 +483,7 @@
           octave_idx_type len = dm.length (); \
  \
           for (octave_idx_type i = 0; i < len; i++) \
-            r.elem(i, i) OPEQ dm.elem(i, i); \
+            r.elem (i, i) OPEQ dm.elem (i, i); \
         } \
       else \
         r.resize (m_nr, m_nc); \
--- a/liboctave/oct-binmap.h
+++ b/liboctave/oct-binmap.h
@@ -30,7 +30,7 @@
 #include "bsxfun.h"
 
 // This source file implements a general binary maping function for
-// arrays. The syntax is binmap<type> (a, b, f, [name]). type denotes
+// arrays. The syntax is binmap<type> (a, b, f,[name]). type denotes
 // the expected return type of the operation. a, b, should be one of
 // the 6 combinations:
 //
@@ -223,7 +223,7 @@
   for (octave_idx_type i = 0; i < nz; i++)
     {
       octave_quit ();
-      retval.xdata(i) = fcn (x, ys.data(i));
+      retval.xdata (i) = fcn (x, ys.data (i));
     }
 
   octave_quit ();
@@ -241,7 +241,7 @@
   for (octave_idx_type i = 0; i < nz; i++)
     {
       octave_quit ();
-      retval.xdata(i) = fcn (xs.data(i), y);
+      retval.xdata (i) = fcn (xs.data (i), y);
     }
 
   octave_quit ();
@@ -276,49 +276,49 @@
       for (octave_idx_type j = 0; j < nc; j++)
         {
           octave_quit ();
-          octave_idx_type ix = xs.cidx(j), iy = ys.cidx(j);
-          octave_idx_type ux = xs.cidx(j+1), uy = ys.cidx(j+1);
+          octave_idx_type ix = xs.cidx (j), iy = ys.cidx (j);
+          octave_idx_type ux = xs.cidx (j+1), uy = ys.cidx (j+1);
           while (ix != ux || iy != uy)
             {
-              octave_idx_type rx = xs.ridx(ix), ry = ys.ridx(ix);
+              octave_idx_type rx = xs.ridx (ix), ry = ys.ridx (ix);
               ix += rx <= ry;
               iy += ry <= rx;
               nz++;
             }
 
-          retval.xcidx(j+1) = nz;
+          retval.xcidx (j+1) = nz;
         }
 
       // Allocate space.
-      retval.change_capacity (retval.xcidx(nc));
+      retval.change_capacity (retval.xcidx (nc));
 
       // Fill.
       nz = 0;
       for (octave_idx_type j = 0; j < nc; j++)
         {
           octave_quit ();
-          octave_idx_type ix = xs.cidx(j), iy = ys.cidx(j);
-          octave_idx_type ux = xs.cidx(j+1), uy = ys.cidx(j+1);
+          octave_idx_type ix = xs.cidx (j), iy = ys.cidx (j);
+          octave_idx_type ux = xs.cidx (j+1), uy = ys.cidx (j+1);
           while (ix != ux || iy != uy)
             {
-              octave_idx_type rx = xs.ridx(ix), ry = ys.ridx(ix);
+              octave_idx_type rx = xs.ridx (ix), ry = ys.ridx (ix);
               if (rx == ry)
                 {
-                  retval.xridx(nz) = rx;
-                  retval.xdata(nz) = fcn (xs.data(ix), ys.data(iy));
+                  retval.xridx (nz) = rx;
+                  retval.xdata (nz) = fcn (xs.data (ix), ys.data (iy));
                   ix++;
                   iy++;
                 }
               else if (rx < ry)
                 {
-                  retval.xridx(nz) = rx;
-                  retval.xdata(nz) = fcn (xs.data(ix), yzero);
+                  retval.xridx (nz) = rx;
+                  retval.xdata (nz) = fcn (xs.data (ix), yzero);
                   ix++;
                 }
               else if (ry < rx)
                 {
-                  retval.xridx(nz) = ry;
-                  retval.xdata(nz) = fcn (xzero, ys.data(iy));
+                  retval.xridx (nz) = ry;
+                  retval.xdata (nz) = fcn (xzero, ys.data (iy));
                   iy++;
                 }
 
--- a/liboctave/oct-fftw.cc
+++ b/liboctave/oct-fftw.cc
@@ -723,7 +723,7 @@
 
   for (size_t i = 0; i < nr; i++)
     for (size_t j = nc/2+1; j < nc; j++)
-      out[j*stride + i*dist] = conj(out[(nc - j)*stride + i*dist]);
+      out[j*stride + i*dist] = conj (out[(nc - j)*stride + i*dist]);
 
   octave_quit ();
 }
@@ -758,10 +758,10 @@
     {
       for (size_t j = 1; j < nr; j++)
         for (size_t k = nc/2+1; k < nc; k++)
-          out[k + (j + i*nr)*nc] = conj(out[nc - k + ((i+1)*nr - j)*nc]);
+          out[k + (j + i*nr)*nc] = conj (out[nc - k + ((i+1)*nr - j)*nc]);
 
       for (size_t j = nc/2+1; j < nc; j++)
-        out[j + i*nr*nc] = conj(out[(i*nr+1)*nc - j]);
+        out[j + i*nr*nc] = conj (out[(i*nr+1)*nc - j]);
     }
 
   octave_quit ();
@@ -782,7 +782,7 @@
             for (size_t l = nc/2+1; l < nc; l++)
               {
                 T tmp = out[i+ j + k + l];
-                out[i + j + k + l] =  out[i + jj + k + l];
+                out[i + j + k + l] = out[i + jj + k + l];
                 out[i + jj + k + l] = tmp;
               }
       jstart = jmax;
--- a/liboctave/oct-group.h
+++ b/liboctave/oct-group.h
@@ -48,7 +48,7 @@
   {
     if (this != &gr)
       {
-        gr_name  = gr.gr_name;
+        gr_name = gr.gr_name;
         gr_passwd = gr.gr_passwd;
         gr_gid = gr.gr_gid;
         gr_mem = gr.gr_mem;
--- a/liboctave/oct-inttypes.cc
+++ b/liboctave/oct-inttypes.cc
@@ -272,7 +272,7 @@
 
 INT_DOUBLE_BINOP_DECL (+, uint64)
 {
-  return (y < 0) ? x - octave_uint64(-y) : x + octave_uint64(y);
+  return (y < 0) ? x - octave_uint64 (-y) : x + octave_uint64 (y);
 }
 
 DOUBLE_INT_BINOP_DECL (+, uint64)
@@ -288,7 +288,7 @@
       // probably), the above will work as expected. If not, it's more
       // complicated - as long as y is within _twice_ the signed range, the
       // result may still be an integer. An instance of such an operation is
-      // 3*2**62 + (1+intmin('int64')) that should yield int64(2**62) + 1.  So
+      // 3*2**62 + (1+intmin ('int64')) that should yield int64 (2**62) + 1.  So
       // what we do is to try to convert y/2 and add it twice. Note that if y/2
       // overflows, the result must overflow as well, and that y/2 cannot be a
       // fractional number.
@@ -310,12 +310,12 @@
 DOUBLE_INT_BINOP_DECL (-, uint64)
 {
   if (x <= static_cast<double> (octave_uint64::max ()))
-    return octave_uint64(x) - y;
+    return octave_uint64 (x) - y;
   else
     {
       // Again a trick to get the corner cases right. Things like
-      // 3**2**63 - intmax('uint64') should produce the correct result, i.e.
-      // int64(2**63) + 1.
+      // 3**2**63 - intmax ('uint64') should produce the correct result, i.e.
+      // int64 (2**63) + 1.
       const double p2_64 = std::pow (2.0, 64);
       if (y.bool_value ())
         {
@@ -340,7 +340,7 @@
   // be eliminated at compile time.
   if (twosc && y.value () == std::numeric_limits<int64_t>::min ())
     {
-      return octave_int64 (x + std::pow(2.0, 63));
+      return octave_int64 (x + std::pow (2.0, 63));
     }
   else
     return x + (-y);
--- a/liboctave/oct-inttypes.h
+++ b/liboctave/oct-inttypes.h
@@ -825,7 +825,7 @@
 
   static int nbits (void) { return std::numeric_limits<T>::digits; }
 
-  static int byte_size (void) { return sizeof(T); }
+  static int byte_size (void) { return sizeof (T); }
 
   static const char *type_name ();
 
--- a/liboctave/oct-locbuf.h
+++ b/liboctave/oct-locbuf.h
@@ -38,7 +38,7 @@
     : data (0)
     {
       if (size)
-        data = new T[size];
+        data = new T [size];
     }
   ~octave_local_buffer (void) { delete [] data; }
   operator T *() const { return data; }
@@ -204,7 +204,7 @@
 // about shadowed parameters.
 
 #define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value) \
-  OCTAVE_LOCAL_BUFFER(T, buf, size); \
+  OCTAVE_LOCAL_BUFFER (T, buf, size); \
   for (size_t _buf_iter = 0, _buf_size = size; \
         _buf_iter < _buf_size; _buf_iter++) \
     buf[_buf_iter] = value
--- a/liboctave/oct-md5.cc
+++ b/liboctave/oct-md5.cc
@@ -36,7 +36,7 @@
 static std::string
 oct_md5_result_to_str (const unsigned char *buf)
 {
-  char tmp [33];
+  char tmp[33];
 
   sprintf (tmp,
            "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
--- a/liboctave/oct-mem.h
+++ b/liboctave/oct-mem.h
@@ -128,7 +128,7 @@
   // Some systems let us allocate > 2GB memory even though size_t, which is either
   // buggy or completely cuckoo, so let's check here to stay safe.
   safe_size_comp (n, sizeof (T));
-  return new T[n];
+  return new T [n];
 }
 template <class T>
 inline void no_ctor_delete (T *ptr)
@@ -137,7 +137,7 @@
 #define DEFINE_POD_NEW_DELETE(T) \
 template <> \
 inline T *no_ctor_new<T > (size_t n) \
-{ return reinterpret_cast<T *> (new char[safe_size_comp (n, sizeof (T))]); } \
+{ return reinterpret_cast<T *> (new char [safe_size_comp (n, sizeof (T))]); } \
 template <> \
 inline void no_ctor_delete<T > (T *ptr) \
 { delete [] reinterpret_cast<char *> (ptr); }
--- a/liboctave/oct-rand.cc
+++ b/liboctave/oct-rand.cc
@@ -360,7 +360,7 @@
           break;
 
         case poisson_dist:
-          if (a < 0.0 || xisnan(a) || xisinf(a))
+          if (a < 0.0 || xisnan (a) || xisinf (a))
             retval = octave_NaN;
           else
             {
@@ -371,7 +371,7 @@
           break;
 
         case gamma_dist:
-          if (a <= 0.0 || xisnan(a) || xisinf(a))
+          if (a <= 0.0 || xisnan (a) || xisinf (a))
             retval = octave_NaN;
           else
             F77_FUNC (dgengam, DGENGAM) (1.0, a, retval);
@@ -443,7 +443,7 @@
           break;
 
         case poisson_dist:
-          if (da < 0.0 || xisnan(da) || xisinf(da))
+          if (da < 0.0 || xisnan (da) || xisinf (da))
             dretval = octave_NaN;
           else
             {
@@ -454,7 +454,7 @@
           break;
 
         case gamma_dist:
-          if (da <= 0.0 || xisnan(da) || xisinf(da))
+          if (da <= 0.0 || xisnan (da) || xisinf (da))
             retval = octave_NaN;
           else
             F77_FUNC (dgengam, DGENGAM) (1.0, da, dretval);
@@ -630,7 +630,7 @@
   oct_get_state (tmp);
 
   for (octave_idx_type i = 0; i <= MT_N; i++)
-    s.elem (i) = static_cast<double> (tmp [i]);
+    s.elem (i) = static_cast<double> (tmp[i]);
 
   return s;
 }
@@ -672,7 +672,7 @@
   OCTAVE_LOCAL_BUFFER (uint32_t, tmp, MT_N + 1);
 
   for (octave_idx_type i = 0; i < n; i++)
-    tmp[i] = static_cast<uint32_t> (s.elem(i));
+    tmp[i] = static_cast<uint32_t> (s.elem (i));
 
   if (len == MT_N + 1 && tmp[MT_N] <= MT_N && tmp[MT_N] > 0)
     oct_set_state (tmp);
@@ -748,7 +748,7 @@
     case poisson_dist:
       if (use_old_generators)
         {
-          if (a < 0.0 || xisnan(a) || xisinf(a))
+          if (a < 0.0 || xisnan (a) || xisinf (a))
 #define RAND_FUNC(x) x = octave_NaN;
             MAKE_RAND (len);
 #undef RAND_FUNC
@@ -769,7 +769,7 @@
     case gamma_dist:
       if (use_old_generators)
         {
-          if (a <= 0.0 || xisnan(a) || xisinf(a))
+          if (a <= 0.0 || xisnan (a) || xisinf (a))
 #define RAND_FUNC(x) x = octave_NaN;
             MAKE_RAND (len);
 #undef RAND_FUNC
@@ -838,7 +838,7 @@
       if (use_old_generators)
         {
           double da = a;
-          if (da < 0.0 || xisnan(da) || xisinf(da))
+          if (da < 0.0 || xisnan (da) || xisinf (da))
 #define RAND_FUNC(x) x = octave_NaN;
             MAKE_RAND (len);
 #undef RAND_FUNC
@@ -860,7 +860,7 @@
       if (use_old_generators)
         {
           double da = a;
-          if (da <= 0.0 || xisnan(da) || xisinf(da))
+          if (da <= 0.0 || xisnan (da) || xisinf (da))
 #define RAND_FUNC(x) x = octave_NaN;
             MAKE_RAND (len);
 #undef RAND_FUNC
--- a/liboctave/oct-refcount.h
+++ b/liboctave/oct-refcount.h
@@ -82,6 +82,11 @@
       return static_cast<count_type const volatile&> (count);
     }
 
+  count_type *get (void)
+    {
+      return &count;
+    }
+
 private:
   count_type count;
 };
--- a/liboctave/oct-sort.cc
+++ b/liboctave/oct-sort.cc
@@ -542,7 +542,7 @@
    */
   delete [] a;
   delete [] ia; // Must do this or fool possible next getmemi.
-  a = new T[need];
+  a = new T [need];
   alloced = need;
 
 }
@@ -561,8 +561,8 @@
   delete [] a;
   delete [] ia;
 
-  a = new T[need];
-  ia = new octave_idx_type[need];
+  a = new T [need];
+  ia = new octave_idx_type [need];
   alloced = need;
 }
 
@@ -1184,7 +1184,7 @@
     return nb;
 
   /* Merge what remains of the runs, using a temp array with
-   * min(na, nb) elements.
+   * min (na, nb) elements.
    */
   if (na <= nb)
     return merge_lo (pa, na, pb, nb, comp);
@@ -1238,7 +1238,7 @@
     return nb;
 
   /* Merge what remains of the runs, using a temp array with
-   * min(na, nb) elements.
+   * min (na, nb) elements.
    */
   if (na <= nb)
     return merge_lo (pa, ipa, na, pb, ipb, nb, comp);
@@ -1413,7 +1413,7 @@
             goto fail;
           if (descending)
             std::reverse (data + lo, data + lo + n);
-          /* If short, extend to min(minrun, nremaining). */
+          /* If short, extend to min (minrun, nremaining). */
           if (n < minrun)
             {
               const octave_idx_type force = nremaining <= minrun ? nremaining : minrun;
@@ -1475,7 +1475,7 @@
               std::reverse (data + lo, data + lo + n);
               std::reverse (idx + lo, idx + lo + n);
             }
-          /* If short, extend to min(minrun, nremaining). */
+          /* If short, extend to min (minrun, nremaining). */
           if (n < minrun)
             {
               const octave_idx_type force = nremaining <= minrun ? nremaining : minrun;
@@ -1610,9 +1610,9 @@
 
   while (! runs.empty ())
     {
-      octave_idx_type col  = runs.top ().col;
-      octave_idx_type ofs  = runs.top ().ofs;
-      octave_idx_type nel  = runs.top ().nel;
+      octave_idx_type col = runs.top ().col;
+      octave_idx_type ofs = runs.top ().ofs;
+      octave_idx_type nel = runs.top ().nel;
       runs.pop ();
       assert (nel > 1);
 
--- a/liboctave/oct-syscalls.cc
+++ b/liboctave/oct-syscalls.cc
@@ -358,7 +358,7 @@
 
               (*current_liboctave_error_handler)(child_msg.c_str ());
 
-              exit(0);
+              exit (0);
             }
           else
             {
@@ -372,8 +372,8 @@
               else
 #endif
                 {
-                  fildes[0] = child_stdin [1];
-                  fildes[1] = child_stdout [0];
+                  fildes[0] = child_stdin[1];
+                  fildes[1] = child_stdout[0];
                   return pid;
                 }
             }
--- a/liboctave/oct-time.cc
+++ b/liboctave/oct-time.cc
@@ -175,7 +175,7 @@
       while (chars_written == 0)
         {
           delete [] buf;
-          buf = new char[bufsize];
+          buf = new char [bufsize];
           buf[0] = '\0';
 
           chars_written = nstrftime (buf, bufsize, fmt_str, &t, 0, 0);
--- a/liboctave/randgamma.c
+++ b/liboctave/randgamma.c
@@ -25,8 +25,8 @@
 
 /*
 
-double randg(a)
-void fill_randg(a,n,x)
+double randg (a)
+void fill_randg (a,n,x)
 
 Generate a series of standard gamma distributions.
 
@@ -99,9 +99,9 @@
 oct_fill_randg (double a, octave_idx_type n, double *r)
 {
   octave_idx_type i;
-  /* If a < 1, start by generating gamma(1+a) */
+  /* If a < 1, start by generating gamma (1+a) */
   const double d =  (a < 1. ? 1.+a : a) - 1./3.;
-  const double c = 1./sqrt(9.*d);
+  const double c = 1./sqrt (9.*d);
 
   /* Handle invalid cases */
   if (a <= 0 || INFINITE(a))
@@ -122,7 +122,7 @@
         goto restart; /* rare, so don't bother moving up */
       u = RUNI;
       xsq = x*x;
-      if (u >= 1.-0.0331*xsq*xsq && log(u) >= 0.5*xsq + d*(1-v+log(v)))
+      if (u >= 1.-0.0331*xsq*xsq && log (u) >= 0.5*xsq + d*(1-v+log (v)))
         goto restart;
       r[i] = d*v;
     }
@@ -130,7 +130,7 @@
     { /* Use gamma(a) = gamma(1+a)*U^(1/a) */
       /* Given REXP = -log(U) then U^(1/a) = exp(-REXP/a) */
       for (i = 0; i < n; i++)
-        r[i] *= exp(-REXP/a);
+        r[i] *= exp (-REXP/a);
     }
 }
 
@@ -138,7 +138,7 @@
 oct_randg (double a)
 {
   double ret;
-  oct_fill_randg(a,1,&ret);
+  oct_fill_randg (a,1,&ret);
   return ret;
 }
 
@@ -157,7 +157,7 @@
   octave_idx_type i;
   /* If a < 1, start by generating gamma(1+a) */
   const float d =  (a < 1. ? 1.+a : a) - 1./3.;
-  const float c = 1./sqrt(9.*d);
+  const float c = 1./sqrt (9.*d);
 
   /* Handle invalid cases */
   if (a <= 0 || INFINITE(a))
@@ -178,7 +178,7 @@
         goto frestart; /* rare, so don't bother moving up */
       u = RUNI;
       xsq = x*x;
-      if (u >= 1.-0.0331*xsq*xsq && log(u) >= 0.5*xsq + d*(1-v+log(v)))
+      if (u >= 1.-0.0331*xsq*xsq && log (u) >= 0.5*xsq + d*(1-v+log (v)))
         goto frestart;
       r[i] = d*v;
     }
@@ -186,7 +186,7 @@
     { /* Use gamma(a) = gamma(1+a)*U^(1/a) */
       /* Given REXP = -log(U) then U^(1/a) = exp(-REXP/a) */
       for (i = 0; i < n; i++)
-        r[i] *= exp(-REXP/a);
+        r[i] *= exp (-REXP/a);
     }
 }
 
@@ -194,6 +194,6 @@
 oct_float_randg (float a)
 {
   float ret;
-  oct_fill_float_randg(a,1,&ret);
+  oct_fill_float_randg (a,1,&ret);
   return ret;
 }
--- a/liboctave/randmtzig.c
+++ b/liboctave/randmtzig.c
@@ -117,39 +117,39 @@
    All generators share the same state vector.
 
    === Mersenne Twister ===
-   void oct_init_by_int(uint32_t s)           32-bit initial state
-   void oct_init_by_array(uint32_t k[],int m) m*32-bit initial state
-   void oct_init_by_entropy(void)             random initial state
-   void oct_get_state(uint32_t save[MT_N+1])  saves state in array
-   void oct_set_state(uint32_t save[MT_N+1])  restores state from array
-   static uint32_t randmt(void)               returns 32-bit unsigned int
+   void oct_init_by_int (uint32_t s)           32-bit initial state
+   void oct_init_by_array (uint32_t k[],int m) m*32-bit initial state
+   void oct_init_by_entropy (void)             random initial state
+   void oct_get_state (uint32_t save[MT_N+1])  saves state in array
+   void oct_set_state (uint32_t save[MT_N+1])  restores state from array
+   static uint32_t randmt (void)               returns 32-bit unsigned int
 
    === inline generators ===
-   static uint32_t randi32(void)   returns 32-bit unsigned int
-   static uint64_t randi53(void)   returns 53-bit unsigned int
-   static uint64_t randi54(void)   returns 54-bit unsigned int
-   static float randu32(void)     returns 32-bit uniform in (0,1)
-   static double randu53(void)     returns 53-bit uniform in (0,1)
+   static uint32_t randi32 (void)   returns 32-bit unsigned int
+   static uint64_t randi53 (void)   returns 53-bit unsigned int
+   static uint64_t randi54 (void)   returns 54-bit unsigned int
+   static float randu32 (void)      returns 32-bit uniform in (0,1)
+   static double randu53 (void)     returns 53-bit uniform in (0,1)
 
-   double oct_randu(void)       returns M-bit uniform in (0,1)
-   double oct_randn(void)       returns M-bit standard normal
-   double oct_rande(void)       returns N-bit standard exponential
+   double oct_randu (void)       returns M-bit uniform in (0,1)
+   double oct_randn (void)       returns M-bit standard normal
+   double oct_rande (void)       returns N-bit standard exponential
 
-   float oct_float_randu(void)       returns M-bit uniform in (0,1)
-   float oct_float_randn(void)       returns M-bit standard normal
-   float oct_float_rande(void)       returns N-bit standard exponential
+   float oct_float_randu (void)       returns M-bit uniform in (0,1)
+   float oct_float_randn (void)       returns M-bit standard normal
+   float oct_float_rande (void)       returns N-bit standard exponential
 
    === Array generators ===
-   void oct_fill_randi32(octave_idx_type, uint32_t [])
-   void oct_fill_randi64(octave_idx_type, uint64_t [])
+   void oct_fill_randi32 (octave_idx_type, uint32_t [])
+   void oct_fill_randi64 (octave_idx_type, uint64_t [])
 
-   void oct_fill_randu(octave_idx_type, double [])
-   void oct_fill_randn(octave_idx_type, double [])
-   void oct_fill_rande(octave_idx_type, double [])
+   void oct_fill_randu (octave_idx_type, double [])
+   void oct_fill_randn (octave_idx_type, double [])
+   void oct_fill_rande (octave_idx_type, double [])
 
-   void oct_fill_float_randu(octave_idx_type, float [])
-   void oct_fill_float_randn(octave_idx_type, float [])
-   void oct_fill_float_rande(octave_idx_type, float [])
+   void oct_fill_float_randu (octave_idx_type, float [])
+   void oct_fill_float_randn (octave_idx_type, float [])
+   void oct_fill_float_rande (octave_idx_type, float [])
 */
 
 #if defined (HAVE_CONFIG_H)
@@ -166,9 +166,9 @@
 #include "lo-math.h"
 #include "randmtzig.h"
 
-/* FIXME may want to suppress X86 if sizeof(long)>4 */
-#if !defined(USE_X86_32)
-# if defined(i386) || defined(HAVE_X86_32)
+/* FIXME may want to suppress X86 if sizeof(long) > 4 */
+#if !defined (USE_X86_32)
+# if defined (i386) || defined (HAVE_X86_32)
 #  define USE_X86_32 1
 # else
 #  define USE_X86_32 0
@@ -260,34 +260,34 @@
     int n = 0;
 
     /* Look for entropy in /dev/urandom */
-    FILE* urandom =fopen("/dev/urandom", "rb");
+    FILE* urandom =fopen ("/dev/urandom", "rb");
     if (urandom)
       {
         while (n < MT_N)
           {
             unsigned char word[4];
-            if (fread(word, 4, 1, urandom) != 1)
+            if (fread (word, 4, 1, urandom) != 1)
               break;
             entropy[n++] = word[0]+(word[1]<<8)+(word[2]<<16)+(word[3]<<24);
           }
-        fclose(urandom);
+        fclose (urandom);
       }
 
     /* If there isn't enough entropy, gather some from various sources */
     if (n < MT_N)
-      entropy[n++] = time(NULL); /* Current time in seconds */
+      entropy[n++] = time (NULL); /* Current time in seconds */
     if (n < MT_N)
       entropy[n++] = clock ();    /* CPU time used (usec) */
 #ifdef HAVE_GETTIMEOFDAY
     if (n < MT_N)
       {
         struct timeval tv;
-        if (gettimeofday(&tv, NULL) != -1)
+        if (gettimeofday (&tv, NULL) != -1)
           entropy[n++] = tv.tv_usec;   /* Fractional part of current time */
       }
 #endif
     /* Send all the entropy into the initial state vector */
-    oct_init_by_array(entropy,n);
+    oct_init_by_array (entropy,n);
 }
 
 void
@@ -506,7 +506,7 @@
       /* New x is given by x = f^{-1}(v/x_{i+1} + f(x_{i+1})), thus
        * need inverse operator of y = exp(-0.5*x*x) -> x = sqrt(-2*ln(y))
        */
-      x = sqrt(-2. * log(NOR_SECTION_AREA / x1 + fi[i+1]));
+      x = sqrt (-2. * log (NOR_SECTION_AREA / x1 + fi[i+1]));
       ki[i+1] = (ZIGINT)(x / x1 * NMANTISSA);
       wi[i] = x / NMANTISSA;
       fi[i] = exp (-0.5 * x * x);
@@ -534,7 +534,7 @@
       /* New x is given by x = f^{-1}(v/x_{i+1} + f(x_{i+1})), thus
        * need inverse operator of y = exp(-x) -> x = -ln(y)
        */
-      x = - log(EXP_SECTION_AREA / x1 + fe[i+1]);
+      x = - log (EXP_SECTION_AREA / x1 + fe[i+1]);
       ke[i+1] = (ZIGINT)(x / x1 * EMANTISSA);
       we[i] = x / EMANTISSA;
       fe[i] = exp (-x);
@@ -620,7 +620,7 @@
           while ( yy+yy <= xx*xx);
           return (rabs&0x100 ? -ZIGGURAT_NOR_R-xx : ZIGGURAT_NOR_R+xx);
         }
-      else if ((fi[idx-1] - fi[idx]) * RANDU + fi[idx] < exp(-0.5*x*x))
+      else if ((fi[idx-1] - fi[idx]) * RANDU + fi[idx] < exp (-0.5*x*x))
         return x;
     }
 }
@@ -645,9 +645,9 @@
            * For the exponential tail, the method of Marsaglia[5] provides:
            * x = r - ln(U);
            */
-          return ZIGGURAT_EXP_R - log(RANDU);
+          return ZIGGURAT_EXP_R - log (RANDU);
         }
-      else if ((fe[idx-1] - fe[idx]) * RANDU + fe[idx] < exp(-x))
+      else if ((fe[idx-1] - fe[idx]) * RANDU + fe[idx] < exp (-x))
         return x;
     }
 }
@@ -697,7 +697,7 @@
       /* New x is given by x = f^{-1}(v/x_{i+1} + f(x_{i+1})), thus
        * need inverse operator of y = exp(-0.5*x*x) -> x = sqrt(-2*ln(y))
        */
-      x = sqrt(-2. * log(NOR_SECTION_AREA / x1 + ffi[i+1]));
+      x = sqrt (-2. * log (NOR_SECTION_AREA / x1 + ffi[i+1]));
       fki[i+1] = (ZIGINT)(x / x1 * NMANTISSA);
       fwi[i] = x / NMANTISSA;
       ffi[i] = exp (-0.5 * x * x);
@@ -725,7 +725,7 @@
       /* New x is given by x = f^{-1}(v/x_{i+1} + f(x_{i+1})), thus
        * need inverse operator of y = exp(-x) -> x = -ln(y)
        */
-      x = - log(EXP_SECTION_AREA / x1 + ffe[i+1]);
+      x = - log (EXP_SECTION_AREA / x1 + ffe[i+1]);
       fke[i+1] = (ZIGINT)(x / x1 * EMANTISSA);
       fwe[i] = x / EMANTISSA;
       ffe[i] = exp (-x);
@@ -787,7 +787,7 @@
           while ( yy+yy <= xx*xx);
           return (rabs&0x100 ? -ZIGGURAT_NOR_R-xx : ZIGGURAT_NOR_R+xx);
         }
-      else if ((ffi[idx-1] - ffi[idx]) * RANDU + ffi[idx] < exp(-0.5*x*x))
+      else if ((ffi[idx-1] - ffi[idx]) * RANDU + ffi[idx] < exp (-0.5*x*x))
         return x;
     }
 }
@@ -812,9 +812,9 @@
            * For the exponential tail, the method of Marsaglia[5] provides:
            * x = r - ln(U);
            */
-          return ZIGGURAT_EXP_R - log(RANDU);
+          return ZIGGURAT_EXP_R - log (RANDU);
         }
-      else if ((ffe[idx-1] - ffe[idx]) * RANDU + ffe[idx] < exp(-x))
+      else if ((ffe[idx-1] - ffe[idx]) * RANDU + ffe[idx] < exp (-x))
         return x;
     }
 }
--- a/liboctave/randpoisson.c
+++ b/liboctave/randpoisson.c
@@ -105,7 +105,7 @@
     {
       r  = 1.0 / k;
       rr = r * r;
-      return ((k + 0.5)*log(k) - k + C0 + r*(C1 + rr*(C3 + rr*(C5 + rr*C7))));
+      return ((k + 0.5)*log (k) - k + C0 + r*(C1 + rr*(C3 + rr*(C5 + rr*C7))));
     }
   else
     return (logfak[(int)k]);
@@ -146,7 +146,7 @@
 static double
 f (double k, double l_nu, double c_pm)
 {
-  return exp(k * l_nu - flogfak(k) - c_pm);
+  return exp (k * l_nu - flogfak (k) - c_pm);
 }
 
 static double
@@ -163,13 +163,13 @@
     {                               /* set-up           */
       my_last = my;
       /* approximate deviation of reflection points k2, k4 from my - 1/2 */
-      Ds = sqrt(my + 0.25);
+      Ds = sqrt (my + 0.25);
 
       /* mode m, reflection points k2 and k4, and points k1 and k5,      */
       /* which delimit the centre region of h(x)                         */
-      m  = floor(my);
-      k2 = ceil(my - 0.5 - Ds);
-      k4 = floor(my - 0.5 + Ds);
+      m  = floor (my);
+      k2 = ceil (my - 0.5 - Ds);
+      k4 = floor (my - 0.5 + Ds);
       k1 = k2 + k2 - m + 1L;
       k5 = k4 + k4 - m;
 
@@ -184,18 +184,18 @@
       r5 = my / (k5 + 1.0);
 
       /* reciprocal values of the scale parameters of exp. tail envelope */
-      ll =  log(r1);                                 /* expon. tail left */
-      lr = -log(r5);                                 /* expon. tail right*/
+      ll =  log (r1);                                /* expon. tail left */
+      lr = -log (r5);                                /* expon. tail right*/
 
       /* Poisson constants, necessary for computing function values f(k) */
-      l_my = log(my);
-      c_pm = m * l_my - flogfak(m);
+      l_my = log (my);
+      c_pm = m * l_my - flogfak (m);
 
       /* function values f(k) = p(k)/p(m) at k = k2, k4, k1, k5          */
-      f2 = f(k2, l_my, c_pm);
-      f4 = f(k4, l_my, c_pm);
-      f1 = f(k1, l_my, c_pm);
-      f5 = f(k5, l_my, c_pm);
+      f2 = f (k2, l_my, c_pm);
+      f4 = f (k4, l_my, c_pm);
+      f1 = f (k1, l_my, c_pm);
+      f5 = f (k5, l_my, c_pm);
 
       /* area of the two centre and the two exponential tail regions     */
       /* area of the two immediate acceptance regions between k2, k4     */
@@ -216,26 +216,26 @@
 
           /* immediate acceptance region
              R2 = [k2, m) *[0, f2),  X = k2, ... m -1 */
-          if ((V = U - p1) < 0.0)  return(k2 + floor(U/f2));
+          if ((V = U - p1) < 0.0)  return (k2 + floor (U/f2));
           /* immediate acceptance region
              R1 = [k1, k2)*[0, f1),  X = k1, ... k2-1 */
-          if ((W = V / dl) < f1 )  return(k1 + floor(V/f1));
+          if ((W = V / dl) < f1 )  return (k1 + floor (V/f1));
 
           /* computation of candidate X < k2, and its counterpart Y > k2 */
           /* either squeeze-acceptance of X or acceptance-rejection of Y */
-          Dk = floor(dl * RUNI) + 1.0;
+          Dk = floor (dl * RUNI) + 1.0;
           if (W <= f2 - Dk * (f2 - f2/r2))
             {                                        /* quick accept of  */
-              return(k2 - Dk);                       /* X = k2 - Dk      */
+              return (k2 - Dk);                      /* X = k2 - Dk      */
             }
           if ((V = f2 + f2 - W) < 1.0)
             {                                        /* quick reject of Y*/
               Y = k2 + Dk;
               if (V <= f2 + Dk * (1.0 - f2)/(dl + 1.0))
                 {                                    /* quick accept of  */
-                  return(Y);                         /* Y = k2 + Dk      */
+                  return (Y);                        /* Y = k2 + Dk      */
                 }
-              if (V <= f(Y, l_my, c_pm))  return(Y); /* final accept of Y*/
+              if (V <= f (Y, l_my, c_pm))  return (Y); /* final accept of Y*/
             }
           X = k2 - Dk;
         }
@@ -243,26 +243,26 @@
         {                                            /* centre right     */
           /*  immediate acceptance region
               R3 = [m, k4+1)*[0, f4), X = m, ... k4    */
-          if ((V = U - p3) < 0.0)  return(k4 - floor((U - p2)/f4));
+          if ((V = U - p3) < 0.0)  return (k4 - floor ((U - p2)/f4));
           /* immediate acceptance region
              R4 = [k4+1, k5+1)*[0, f5)                */
-          if ((W = V / dr) < f5 )  return(k5 - floor(V/f5));
+          if ((W = V / dr) < f5 )  return (k5 - floor (V/f5));
 
           /* computation of candidate X > k4, and its counterpart Y < k4 */
           /* either squeeze-acceptance of X or acceptance-rejection of Y */
-          Dk = floor(dr * RUNI) + 1.0;
+          Dk = floor (dr * RUNI) + 1.0;
           if (W <= f4 - Dk * (f4 - f4*r4))
             {                                        /* quick accept of  */
-              return(k4 + Dk);                       /* X = k4 + Dk      */
+              return (k4 + Dk);                      /* X = k4 + Dk      */
             }
           if ((V = f4 + f4 - W) < 1.0)
             {                                        /* quick reject of Y*/
               Y = k4 - Dk;
               if (V <= f4 + Dk * (1.0 - f4)/ dr)
                 {                                    /* quick accept of  */
-                  return(Y);                         /* Y = k4 - Dk      */
+                  return (Y);                        /* Y = k4 - Dk      */
                 }
-              if (V <= f(Y, l_my, c_pm))  return(Y); /* final accept of Y*/
+              if (V <= f (Y, l_my, c_pm))  return (Y); /* final accept of Y*/
             }
           X = k4 + Dk;
         }
@@ -271,26 +271,26 @@
           W = RUNI;
           if (U < p5)
             {                                        /* expon. tail left */
-              Dk = floor(1.0 - log(W)/ll);
+              Dk = floor (1.0 - log (W)/ll);
               if ((X = k1 - Dk) < 0L)  continue;     /* 0 <= X <= k1 - 1 */
               W *= (U - p4) * ll;                    /* W -- U(0, h(x))  */
               if (W <= f1 - Dk * (f1 - f1/r1))
-                return(X);                           /* quick accept of X*/
+                return (X);                          /* quick accept of X*/
             }
           else
             {                                        /* expon. tail right*/
-              Dk = floor(1.0 - log(W)/lr);
+              Dk = floor (1.0 - log (W)/lr);
               X  = k5 + Dk;                          /* X >= k5 + 1      */
               W *= (U - p5) * lr;                    /* W -- U(0, h(x))  */
               if (W <= f5 - Dk * (f5 - f5*r5))
-                return(X);                           /* quick accept of X*/
+                return (X);                          /* quick accept of X*/
             }
         }
 
       /* acceptance-rejection test of candidate X from the original area */
       /* test, whether  W <= f(k),    with  W = U*h(x)  and  U -- U(0, 1)*/
       /* log f(X) = (X - m)*log(my) - log X! + log m!                    */
-      if (log(W) <= X * l_my - flogfak(X) - c_pm)  return(X);
+      if (log (W) <= X * l_my - flogfak (X) - c_pm)  return (X);
     }
 }
 /* ---- pprsc.c end ------ */
@@ -300,7 +300,7 @@
 
 /* Given uniform u, find x such that CDF(L,x)==u.  Return x. */
 static void
-poisson_cdf_lookup(double lambda, double *p, size_t n)
+poisson_cdf_lookup (double lambda, double *p, size_t n)
 {
   /* Table size is predicated on the maximum value of lambda
    * we want to store in the table, and the maximum value of
@@ -316,12 +316,12 @@
 
   /* Precompute the table for the u up to and including 0.458.
    * We will almost certainly need it. */
-  int intlambda = (int)floor(lambda);
+  int intlambda = (int)floor (lambda);
   double P;
   int tableidx;
   size_t i = n;
 
-  t[0] = P = exp(-lambda);
+  t[0] = P = exp (-lambda);
   for (tableidx = 1; tableidx <= intlambda; tableidx++) {
     P = P*lambda/(double)tableidx;
     t[tableidx] = t[tableidx-1] + P;
@@ -369,18 +369,18 @@
 }
 
 static void
-poisson_cdf_lookup_float(double lambda, float *p, size_t n)
+poisson_cdf_lookup_float (double lambda, float *p, size_t n)
 {
   double t[TABLESIZE];
 
   /* Precompute the table for the u up to and including 0.458.
    * We will almost certainly need it. */
-  int intlambda = (int)floor(lambda);
+  int intlambda = (int)floor (lambda);
   double P;
   int tableidx;
   size_t i = n;
 
-  t[0] = P = exp(-lambda);
+  t[0] = P = exp (-lambda);
   for (tableidx = 1; tableidx <= intlambda; tableidx++) {
     P = P*lambda/(double)tableidx;
     t[tableidx] = t[tableidx-1] + P;
@@ -412,8 +412,8 @@
 static void
 poisson_rejection (double lambda, double *p, size_t n)
 {
-  double sq = sqrt(2.0*lambda);
-  double alxm = log(lambda);
+  double sq = sqrt (2.0*lambda);
+  double alxm = log (lambda);
   double g = lambda*alxm - LGAMMA(lambda+1.0);
   size_t i;
 
@@ -425,8 +425,8 @@
           y = tan(M_PI*RUNI);
           em = sq * y + lambda;
         } while (em < 0.0);
-        em = floor(em);
-        t = 0.9*(1.0+y*y)*exp(em*alxm-flogfak(em)-g);
+        em = floor (em);
+        t = 0.9*(1.0+y*y)*exp (em*alxm-flogfak (em)-g);
       } while (RUNI > t);
       p[i] = em;
     }
@@ -436,8 +436,8 @@
 static void
 poisson_rejection_float (double lambda, float *p, size_t n)
 {
-  double sq = sqrt(2.0*lambda);
-  double alxm = log(lambda);
+  double sq = sqrt (2.0*lambda);
+  double alxm = log (lambda);
   double g = lambda*alxm - LGAMMA(lambda+1.0);
   size_t i;
 
@@ -446,11 +446,11 @@
       double y, em, t;
       do {
         do {
-          y = tan(M_PI*RUNI);
+          y = tan (M_PI*RUNI);
           em = sq * y + lambda;
         } while (em < 0.0);
-        em = floor(em);
-        t = 0.9*(1.0+y*y)*exp(em*alxm-flogfak(em)-g);
+        em = floor (em);
+        t = 0.9*(1.0+y*y)*exp (em*alxm-flogfak (em)-g);
       } while (RUNI > t);
       p[i] = em;
     }
@@ -477,20 +477,20 @@
     }
   else if (L <= 10.0)
     {
-      poisson_cdf_lookup(L, p, n);
+      poisson_cdf_lookup (L, p, n);
     }
   else if (L <= 1e8)
     {
       for (i=0; i<n; i++)
-        p[i] = pprsc(L);
+        p[i] = pprsc (L);
     }
   else
     {
       /* normal approximation: from Phys. Rev. D (1994) v50 p1284 */
-      const double sqrtL = sqrt(L);
+      const double sqrtL = sqrt (L);
       for (i = 0; i < n; i++)
         {
-          p[i] = floor(RNOR*sqrtL + L + 0.5);
+          p[i] = floor (RNOR*sqrtL + L + 0.5);
           if (p[i] < 0.0)
             p[i] = 0.0; /* will probably never happen */
         }
@@ -505,7 +505,7 @@
   if (L < 0.0) ret = NAN;
   else if (L <= 12.0) {
     /* From Press, et al. Numerical recipes */
-    double g = exp(-L);
+    double g = exp (-L);
     int em = -1;
     double t = 1.0;
     do {
@@ -515,14 +515,14 @@
     ret = em;
   } else if (L <= 1e8) {
     /* numerical recipes */
-    poisson_rejection(L, &ret, 1);
+    poisson_rejection (L, &ret, 1);
   } else if (INFINITE(L)) {
     /* FIXME R uses NaN, but the normal approx. suggests that as
      * limit should be inf. Which is correct? */
     ret = NAN;
   } else {
     /* normal approximation: from Phys. Rev. D (1994) v50 p1284 */
-    ret = floor(RNOR*sqrt(L) + L + 0.5);
+    ret = floor (RNOR*sqrt (L) + L + 0.5);
     if (ret < 0.0) ret = 0.0; /* will probably never happen */
   }
   return ret;
@@ -541,20 +541,20 @@
     }
   else if (L <= 10.0)
     {
-      poisson_cdf_lookup_float(L, p, n);
+      poisson_cdf_lookup_float (L, p, n);
     }
   else if (L <= 1e8)
     {
       for (i=0; i<n; i++)
-        p[i] = pprsc(L);
+        p[i] = pprsc (L);
     }
   else
     {
       /* normal approximation: from Phys. Rev. D (1994) v50 p1284 */
-      const double sqrtL = sqrt(L);
+      const double sqrtL = sqrt (L);
       for (i = 0; i < n; i++)
         {
-          p[i] = floor(RNOR*sqrtL + L + 0.5);
+          p[i] = floor (RNOR*sqrtL + L + 0.5);
           if (p[i] < 0.0)
             p[i] = 0.0; /* will probably never happen */
         }
@@ -570,7 +570,7 @@
   if (L < 0.0) ret = NAN;
   else if (L <= 12.0) {
     /* From Press, et al. Numerical recipes */
-    double g = exp(-L);
+    double g = exp (-L);
     int em = -1;
     double t = 1.0;
     do {
@@ -580,14 +580,14 @@
     ret = em;
   } else if (L <= 1e8) {
     /* numerical recipes */
-    poisson_rejection_float(L, &ret, 1);
+    poisson_rejection_float (L, &ret, 1);
   } else if (INFINITE(L)) {
     /* FIXME R uses NaN, but the normal approx. suggests that as
      * limit should be inf. Which is correct? */
     ret = NAN;
   } else {
     /* normal approximation: from Phys. Rev. D (1994) v50 p1284 */
-    ret = floor(RNOR*sqrt(L) + L + 0.5);
+    ret = floor (RNOR*sqrt (L) + L + 0.5);
     if (ret < 0.0) ret = 0.0; /* will probably never happen */
   }
   return ret;
--- a/liboctave/sparse-base-chol.cc
+++ b/liboctave/sparse-base-chol.cc
@@ -56,24 +56,24 @@
 
   for (k = 0; k < ncol; k++)
     {
-      p = Sp [k];
-      pend = Sp [k+1];
-      Sp [k] = pdest;
+      p = Sp[k];
+      pend = Sp[k+1];
+      Sp[k] = pdest;
       for (; p < pend; p++)
         {
-          sik = Sx [p];
+          sik = Sx[p];
           if (CHOLMOD_IS_NONZERO (sik))
             {
               if (p != pdest)
                 {
-                  Si [pdest] = Si [p];
-                  Sx [pdest] = sik;
+                  Si[pdest] = Si[p];
+                  Sx[pdest] = sik;
                 }
               pdest++;
             }
         }
     }
-  Sp [ncol] = pdest;
+  Sp[ncol] = pdest;
 }
 #endif
 
@@ -157,7 +157,7 @@
   if (natural)
     {
       cm->nmethods = 1 ;
-      cm->method [0].ordering = CHOLMOD_NATURAL ;
+      cm->method[0].ordering = CHOLMOD_NATURAL ;
       cm->postorder = false ;
     }
 
@@ -229,11 +229,11 @@
   octave_idx_type nnz = m->nzmax;
   chol_type ret (m->nrow, nc, nnz);
   for (octave_idx_type j = 0; j < nc+1; j++)
-    ret.xcidx(j) = static_cast<octave_idx_type *>(m->p)[j];
+    ret.xcidx (j) = static_cast<octave_idx_type *>(m->p)[j];
   for (octave_idx_type i = 0; i < nnz; i++)
     {
-      ret.xridx(i) = static_cast<octave_idx_type *>(m->i)[i];
-      ret.xdata(i) = static_cast<chol_elt *>(m->x)[i];
+      ret.xridx (i) = static_cast<octave_idx_type *>(m->i)[i];
+      ret.xdata (i) = static_cast<chol_elt *>(m->x)[i];
     }
   return ret;
 #else
@@ -252,11 +252,11 @@
 
   for (octave_idx_type i = 0; i < n; i++)
     {
-      p.xcidx(i) = i;
-      p.xridx(i) = static_cast<octave_idx_type>(perms(i));
-      p.xdata(i) = 1;
+      p.xcidx (i) = i;
+      p.xridx (i) = static_cast<octave_idx_type>(perms (i));
+      p.xdata (i) = 1;
     }
-  p.xcidx(n) = n;
+  p.xcidx (n) = n;
 
   return p;
 #else
@@ -277,7 +277,7 @@
   double rcond2;
   octave_idx_type info;
   MatrixType mattype (MatrixType::Upper);
-  chol_type linv = L ().hermitian ().inverse(mattype, info, rcond2, 1, 0);
+  chol_type linv = L ().hermitian ().inverse (mattype, info, rcond2, 1, 0);
 
   if (perms.length () == n)
     {
--- a/liboctave/sparse-base-lu.cc
+++ b/liboctave/sparse-base-lu.cc
@@ -37,26 +37,26 @@
 
   lu_type Yout (nr, nc, Lfact.nnz () + Ufact.nnz ());
   octave_idx_type ii = 0;
-  Yout.xcidx(0) = 0;
+  Yout.xcidx (0) = 0;
 
   for (octave_idx_type j = 0; j < nc; j++)
     {
-      for (octave_idx_type i = Ufact.cidx (j); i < Ufact.cidx(j + 1); i++)
+      for (octave_idx_type i = Ufact.cidx (j); i < Ufact.cidx (j + 1); i++)
         {
-          Yout.xridx (ii) = Ufact.ridx(i);
-          Yout.xdata (ii++) = Ufact.data(i);
+          Yout.xridx (ii) = Ufact.ridx (i);
+          Yout.xdata (ii++) = Ufact.data (i);
         }
       if (j < rcmin)
         {
           // Note the +1 skips the 1.0 on the diagonal
           for (octave_idx_type i = Lfact.cidx (j) + 1;
-               i < Lfact.cidx(j +1); i++)
+               i < Lfact.cidx (j +1); i++)
             {
-              Yout.xridx (ii) = Lfact.ridx(i);
-              Yout.xdata (ii++) = Lfact.data(i);
+              Yout.xridx (ii) = Lfact.ridx (i);
+              Yout.xdata (ii++) = Lfact.data (i);
             }
         }
-      Yout.xcidx(j + 1) = ii;
+      Yout.xcidx (j + 1) = ii;
     }
 
   return Yout;
--- a/liboctave/sparse-dmsolve.cc
+++ b/liboctave/sparse-dmsolve.cc
@@ -33,6 +33,7 @@
 #include "MatrixType.h"
 #include "oct-sort.h"
 #include "oct-locbuf.h"
+#include "oct-inttypes.h"
 
 template <class T>
 static MSparse<T>
@@ -42,9 +43,17 @@
                 octave_idx_type cend, octave_idx_type maxnz = -1,
                 bool lazy = false)
 {
-  octave_idx_type nz = (rend - rst) * (cend - cst);
+  octave_idx_type nr = rend - rst, nc = cend - cst;
   maxnz = (maxnz < 0 ? A.nnz () : maxnz);
-  MSparse<T> B (rend - rst, cend - cst, (nz < maxnz ? nz : maxnz));
+  octave_idx_type nz;
+
+  // Cast to uint64 to handle overflow in this multiplication
+  if (octave_uint64 (nr)*octave_uint64 (nc) < octave_uint64 (maxnz))
+    nz = nr*nc;
+  else
+    nz = maxnz;
+
+  MSparse<T> B (nr, nc, (nz < maxnz ? nz : maxnz));
   // Some sparse functions can support lazy indexing (where elements
   // in the row are in no particular order), even though octave in
   // general can't. For those functions that can using it is a big
@@ -54,16 +63,16 @@
       nz = 0;
       for (octave_idx_type j = cst ; j < cend ; j++)
         {
-          octave_idx_type qq = (Q ? Q [j] : j);
+          octave_idx_type qq = (Q ? Q[j] : j);
           B.xcidx (j - cst) = nz;
-          for (octave_idx_type p = A.cidx(qq) ; p < A.cidx (qq+1) ; p++)
+          for (octave_idx_type p = A.cidx (qq) ; p < A.cidx (qq+1) ; p++)
             {
               octave_quit ();
-              octave_idx_type r = (Pinv ? Pinv [A.ridx (p)] : A.ridx (p));
+              octave_idx_type r = (Pinv ? Pinv[A.ridx (p)] : A.ridx (p));
               if (r >= rst && r < rend)
                 {
                   B.xdata (nz) = A.data (p);
-                  B.xridx (nz++) =  r - rst ;
+                  B.xridx (nz++) = r - rst ;
                 }
             }
         }
@@ -77,21 +86,21 @@
       nz = 0;
       for (octave_idx_type j = cst ; j < cend ; j++)
         {
-          octave_idx_type qq = (Q ? Q [j] : j);
+          octave_idx_type qq = (Q ? Q[j] : j);
           B.xcidx (j - cst) = nz;
-          for (octave_idx_type p = A.cidx(qq) ; p < A.cidx (qq+1) ; p++)
+          for (octave_idx_type p = A.cidx (qq) ; p < A.cidx (qq+1) ; p++)
             {
               octave_quit ();
-              octave_idx_type r = (Pinv ? Pinv [A.ridx (p)] : A.ridx (p));
+              octave_idx_type r = (Pinv ? Pinv[A.ridx (p)] : A.ridx (p));
               if (r >= rst && r < rend)
                 {
-                  X [r-rst] = A.data (p);
-                  B.xridx (nz++) =  r - rst ;
+                  X[r-rst] = A.data (p);
+                  B.xridx (nz++) = r - rst ;
                 }
             }
           sort.sort (ri + B.xcidx (j - cst), nz - B.xcidx (j - cst));
           for (octave_idx_type p = B.cidx (j - cst); p < nz; p++)
-            B.xdata (p) = X [B.xridx (p)];
+            B.xdata (p) = X[B.xridx (p)];
         }
       B.xcidx (cend - cst) = nz ;
     }
@@ -170,7 +179,7 @@
       for (octave_idx_type i = 0; i < nr; i++)
         {
           octave_quit ();
-          ax [Q [r + i] + aoff] = bx [i + boff];
+          ax[Q[r + i] + aoff] = bx[i + boff];
         }
     }
 }
@@ -197,17 +206,17 @@
 
   OCTAVE_LOCAL_BUFFER (octave_idx_type, Qinv, nr);
   for (octave_idx_type i = 0; i < nr; i++)
-    Qinv [Q [i]] = i;
+    Qinv[Q[i]] = i;
 
   // First count the number of elements in the final array
-  octave_idx_type nel = a.xcidx(c) + b.nnz ();
+  octave_idx_type nel = a.xcidx (c) + b.nnz ();
 
   if (c + b_cols < nc)
-    nel += a.xcidx(nc) - a.xcidx(c + b_cols);
+    nel += a.xcidx (nc) - a.xcidx (c + b_cols);
 
   for (octave_idx_type i = c; i < c + b_cols; i++)
-    for (octave_idx_type j = a.xcidx(i); j < a.xcidx(i+1); j++)
-      if (Qinv [a.xridx(j)] < r || Qinv [a.xridx(j)] >= r + b_rows)
+    for (octave_idx_type j = a.xcidx (i); j < a.xcidx (i+1); j++)
+      if (Qinv[a.xridx (j)] < r || Qinv[a.xridx (j)] >= r + b_rows)
         nel++;
 
   OCTAVE_LOCAL_BUFFER (T, X, nr);
@@ -216,49 +225,49 @@
   a = MSparse<T> (nr, nc, nel);
   octave_idx_type *ri = a.xridx ();
 
-  for (octave_idx_type i = 0; i < tmp.cidx(c); i++)
+  for (octave_idx_type i = 0; i < tmp.cidx (c); i++)
     {
-      a.xdata(i) = tmp.xdata(i);
-      a.xridx(i) = tmp.xridx(i);
+      a.xdata (i) = tmp.xdata (i);
+      a.xridx (i) = tmp.xridx (i);
     }
   for (octave_idx_type i = 0; i < c + 1; i++)
-    a.xcidx(i) = tmp.xcidx(i);
+    a.xcidx (i) = tmp.xcidx (i);
 
-  octave_idx_type ii = a.xcidx(c);
+  octave_idx_type ii = a.xcidx (c);
 
   for (octave_idx_type i = c; i < c + b_cols; i++)
     {
       octave_quit ();
 
-      for (octave_idx_type j = tmp.xcidx(i); j < tmp.xcidx(i+1); j++)
-        if (Qinv [tmp.xridx(j)] < r ||  Qinv [tmp.xridx(j)] >= r + b_rows)
+      for (octave_idx_type j = tmp.xcidx (i); j < tmp.xcidx (i+1); j++)
+        if (Qinv[tmp.xridx (j)] < r ||  Qinv[tmp.xridx (j)] >= r + b_rows)
           {
-            X [tmp.xridx(j)] = tmp.xdata(j);
-            a.xridx(ii++) = tmp.xridx(j);
+            X[tmp.xridx (j)] = tmp.xdata (j);
+            a.xridx (ii++) = tmp.xridx (j);
           }
 
       octave_quit ();
 
-      for (octave_idx_type j = b.cidx(i-c); j < b.cidx(i-c+1); j++)
+      for (octave_idx_type j = b.cidx (i-c); j < b.cidx (i-c+1); j++)
         {
-          X [Q [r + b.ridx(j)]] = b.data(j);
-          a.xridx(ii++) = Q [r + b.ridx(j)];
+          X[Q[r + b.ridx (j)]] = b.data (j);
+          a.xridx (ii++) = Q[r + b.ridx (j)];
         }
 
       sort.sort (ri + a.xcidx (i), ii - a.xcidx (i));
       for (octave_idx_type p = a.xcidx (i); p < ii; p++)
-        a.xdata (p) = X [a.xridx (p)];
-      a.xcidx(i+1) = ii;
+        a.xdata (p) = X[a.xridx (p)];
+      a.xcidx (i+1) = ii;
     }
 
   for (octave_idx_type i = c + b_cols; i < nc; i++)
     {
-      for (octave_idx_type j = tmp.xcidx(i); j < tmp.cidx(i+1); j++)
+      for (octave_idx_type j = tmp.xcidx (i); j < tmp.cidx (i+1); j++)
         {
-          a.xdata(ii) = tmp.xdata(j);
-          a.xridx(ii++) = tmp.xridx(j);
+          a.xdata (ii) = tmp.xdata (j);
+          a.xridx (ii++) = tmp.xridx (j);
         }
-      a.xcidx(i+1) = ii;
+      a.xcidx (i+1) = ii;
     }
 }
 
@@ -287,7 +296,7 @@
       for (octave_idx_type i = 0; i < b_nr; i++)
         {
           octave_quit ();
-          Btx [p [i] + off] = Bx [ i + off];
+          Btx[p[i] + off] = Bx[ i + off];
         }
     }
 }
@@ -318,23 +327,23 @@
   octave_sort<octave_idx_type> sort;
   octave_idx_type *ri = a.xridx ();
   OCTAVE_LOCAL_BUFFER (RT, X, b_nr);
-  a.xcidx(0) = 0;
+  a.xcidx (0) = 0;
   for (octave_idx_type j = 0; j < b_nc; j++)
     {
-      for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++)
+      for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++)
         {
           octave_quit ();
-          octave_idx_type r = p [b.ridx (i)];
-          X [r] = b.data (i);
-          a.xridx(nz++) = p [b.ridx (i)];
+          octave_idx_type r = p[b.ridx (i)];
+          X[r] = b.data (i);
+          a.xridx (nz++) = p[b.ridx (i)];
         }
       sort.sort (ri + a.xcidx (j), nz - a.xcidx (j));
       for (octave_idx_type i = a.cidx (j); i < nz; i++)
         {
           octave_quit ();
-          a.xdata (i) = X [a.xridx (i)];
+          a.xdata (i) = X[a.xridx (i)];
         }
-      a.xcidx(j+1) = nz;
+      a.xcidx (j+1) = nz;
     }
 }
 
@@ -389,7 +398,7 @@
       csm.p = const_cast<octave_idx_type *>(a.cidx ());
       csm.i = const_cast<octave_idx_type *>(a.ridx ());
 
-#if defined(CS_VER) && (CS_VER >= 2)
+#if defined (CS_VER) && (CS_VER >= 2)
       CXSPARSE_DNAME (d) *dm = CXSPARSE_DNAME(_dmperm) (&csm, 0);
       octave_idx_type *p = dm->p;
       octave_idx_type *q = dm->q;
@@ -400,26 +409,26 @@
 #endif
       OCTAVE_LOCAL_BUFFER (octave_idx_type, pinv, nr);
       for (octave_idx_type i = 0; i < nr; i++)
-        pinv [p [i]] = i;
+        pinv[p[i]] = i;
       RT btmp;
       dmsolve_permute (btmp, b, pinv);
       info = 0;
       retval.resize (nc, b_nc);
 
       // Leading over-determined block
-      if (dm->rr [2] < nr && dm->cc [3] < nc)
+      if (dm->rr[2] < nr && dm->cc[3] < nc)
         {
-          ST m = dmsolve_extract (a, pinv, q, dm->rr [2], nr, dm->cc [3], nc,
+          ST m = dmsolve_extract (a, pinv, q, dm->rr[2], nr, dm->cc[3], nc,
                                   nnz_remaining, true);
           nnz_remaining -= m.nnz ();
           RT mtmp =
             qrsolve (m, dmsolve_extract (btmp, 0, 0, dm->rr[2], b_nr, 0,
                                          b_nc), info);
-          dmsolve_insert (retval, mtmp, q, dm->cc [3], 0);
-          if (dm->rr [2] > 0 && !info)
+          dmsolve_insert (retval, mtmp, q, dm->cc[3], 0);
+          if (dm->rr[2] > 0 && !info)
             {
-              m = dmsolve_extract (a, pinv, q, 0, dm->rr [2],
-                                   dm->cc [3], nc, nnz_remaining, true);
+              m = dmsolve_extract (a, pinv, q, 0, dm->rr[2],
+                                   dm->cc[3], nc, nnz_remaining, true);
               nnz_remaining -= m.nnz ();
               RT ctmp = dmsolve_extract (btmp, 0, 0, 0,
                                          dm->rr[2], 0, b_nc);
@@ -429,12 +438,12 @@
 
       // Structurally non-singular blocks
       // FIXME Should use fine Dulmange-Mendelsohn decomposition here.
-      if (dm->rr [1] < dm->rr [2] && dm->cc [2] < dm->cc [3] && !info)
+      if (dm->rr[1] < dm->rr[2] && dm->cc[2] < dm->cc[3] && !info)
         {
-          ST m = dmsolve_extract (a, pinv, q, dm->rr [1], dm->rr [2],
-                                  dm->cc [2], dm->cc [3], nnz_remaining, false);
+          ST m = dmsolve_extract (a, pinv, q, dm->rr[1], dm->rr[2],
+                                  dm->cc[2], dm->cc[3], nnz_remaining, false);
           nnz_remaining -= m.nnz ();
-          RT btmp2 = dmsolve_extract (btmp, 0, 0, dm->rr [1], dm->rr [2],
+          RT btmp2 = dmsolve_extract (btmp, 0, 0, dm->rr[1], dm->rr[2],
                                       0, b_nc);
           double rcond = 0.0;
           MatrixType mtyp (MatrixType::Full);
@@ -446,11 +455,11 @@
               mtmp = qrsolve (m, btmp2, info);
             }
 
-          dmsolve_insert (retval, mtmp, q, dm->cc [2], 0);
-          if (dm->rr [1] > 0 && !info)
+          dmsolve_insert (retval, mtmp, q, dm->cc[2], 0);
+          if (dm->rr[1] > 0 && !info)
             {
-              m = dmsolve_extract (a, pinv, q, 0, dm->rr [1], dm->cc [2],
-                                   dm->cc [3], nnz_remaining, true);
+              m = dmsolve_extract (a, pinv, q, 0, dm->rr[1], dm->cc[2],
+                                   dm->cc[3], nnz_remaining, true);
               nnz_remaining -= m.nnz ();
               RT ctmp = dmsolve_extract (btmp, 0, 0, 0,
                                          dm->rr[1], 0, b_nc);
@@ -459,13 +468,13 @@
         }
 
       // Trailing under-determined block
-      if (dm->rr [1] > 0 && dm->cc [2] > 0 && !info)
+      if (dm->rr[1] > 0 && dm->cc[2] > 0 && !info)
         {
-          ST m = dmsolve_extract (a, pinv, q, 0, dm->rr [1], 0,
-                                  dm->cc [2], nnz_remaining, true);
+          ST m = dmsolve_extract (a, pinv, q, 0, dm->rr[1], 0,
+                                  dm->cc[2], nnz_remaining, true);
           RT mtmp =
-            qrsolve (m, dmsolve_extract(btmp, 0, 0, 0, dm->rr [1] , 0,
-                                        b_nc), info);
+            qrsolve (m, dmsolve_extract (btmp, 0, 0, 0, dm->rr[1] , 0,
+                                         b_nc), info);
           dmsolve_insert (retval, mtmp, q, 0, 0);
         }
 
--- a/liboctave/str-vec.cc
+++ b/liboctave/str-vec.cc
@@ -54,7 +54,7 @@
   for (std::list<std::string>::const_iterator p = lst.begin ();
        p != lst.end ();
        p++)
-    elem(i++) = *p;
+    elem (i++) = *p;
 }
 
 string_vector::string_vector (const std::set<std::string>& lst)
@@ -69,7 +69,7 @@
   for (std::set<std::string>::const_iterator p = lst.begin ();
        p != lst.end ();
        p++)
-    elem(i++) = *p;
+    elem (i++) = *p;
 }
 
 // Create a string vector from a NULL terminated list of C strings.
@@ -125,9 +125,9 @@
       octave_idx_type k = 0;
 
       for (octave_idx_type i = 1; i < len; i++)
-        if (elem(i) != elem(k))
+        if (elem (i) != elem (k))
           if (++k != i)
-            elem(k) = elem(i);
+            elem (k) = elem (i);
 
       if (len != ++k)
         resize (k);
@@ -143,7 +143,7 @@
 
   resize (len + 1);
 
-  elem(len) = s;
+  elem (len) = s;
 
   return *this;
 }
@@ -158,7 +158,7 @@
   resize (new_len);
 
   for (octave_idx_type i = 0; i < sv_len; i++)
-    elem(len + i) = sv[i];
+    elem (len + i) = sv[i];
 
   return *this;
 }
@@ -175,9 +175,9 @@
       octave_idx_type i;
 
       for (i = 0; i < len - 1; i++)
-        retval += elem(i) + sep;
+        retval += elem (i) + sep;
 
-      retval += elem(i);
+      retval += elem (i);
     }
 
   return retval;
@@ -190,10 +190,10 @@
 
   char **retval = new char * [len + 1];
 
-  retval [len] = 0;
+  retval[len] = 0;
 
   for (octave_idx_type i = 0; i < len; i++)
-    retval[i] = strsave (elem(i).c_str ());
+    retval[i] = strsave (elem (i).c_str ());
 
   return retval;
 }
--- a/liboctave/str-vec.h
+++ b/liboctave/str-vec.h
@@ -79,7 +79,7 @@
 
     for (octave_idx_type i = 0; i < n; i++)
       {
-        octave_idx_type tmp = elem(i).length ();
+        octave_idx_type tmp = elem (i).length ();
 
         if (tmp > longest)
           longest = tmp;
--- a/liboctave/tempnam.c
+++ b/liboctave/tempnam.c
@@ -43,16 +43,16 @@
 {
   size_t len;
   register char *s;
-  register char *t = __stdio_gen_tempname(dir, pfx, 1, &len, (FILE **) NULL);
+  register char *t = __stdio_gen_tempname (dir, pfx, 1, &len, (FILE **) NULL);
 
   if (t == NULL)
     return NULL;
 
-  s = (char *) malloc(len);
+  s = (char *) malloc (len);
   if (s == NULL)
     return NULL;
 
-  (void) memcpy(s, t, len);
+  (void) memcpy (s, t, len);
   return s;
 }
 
--- a/liboctave/tempname.c
+++ b/liboctave/tempname.c
@@ -112,14 +112,14 @@
 
   if (dir_search)
     {
-      register const char *d = getenv("TMPDIR");
-      if (d != NULL && !diraccess(d))
+      register const char *d = getenv ("TMPDIR");
+      if (d != NULL && !diraccess (d))
         d = NULL;
-      if (d == NULL && dir != NULL && diraccess(dir))
+      if (d == NULL && dir != NULL && diraccess (dir))
         d = dir;
-      if (d == NULL && diraccess(tmpdir))
+      if (d == NULL && diraccess (tmpdir))
         d = tmpdir;
-      if (d == NULL && diraccess("/tmp"))
+      if (d == NULL && diraccess ("/tmp"))
         d = "/tmp";
       if (d == NULL)
         {
@@ -139,14 +139,14 @@
 
   if (pfx != NULL && *pfx != '\0')
     {
-      plen = strlen(pfx);
+      plen = strlen (pfx);
       if (plen > 5)
         plen = 5;
     }
   else
     plen = 0;
 
-  if (dir != tmpdir && !strcmp(dir, tmpdir))
+  if (dir != tmpdir && !strcmp (dir, tmpdir))
     dir = tmpdir;
   idx = &indices[(plen == 0 && dir == tmpdir) ? 1 : 0];
 
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -286,7 +286,7 @@
 dnl
 dnl OCTAVE_CC_FLAG
 AC_DEFUN([OCTAVE_CC_FLAG], [
-  ac_safe=`echo "$1" | sed 'y%./+-:=%__p___%'`
+  ac_safe=`echo "$1" | sed 'y% ./+-:=%___p___%'`
   AC_MSG_CHECKING([whether ${CC-cc} accepts $1])
   AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [
     AC_LANG_PUSH(C)
@@ -628,15 +628,12 @@
 else
   AC_CHECK_PROGS(GNUPLOT, [$gp_names])
   if test -z "$GNUPLOT"; then
-    warn_gnuplot=yes
-
     GNUPLOT="$gp_default"
-    warn_gnuplot = "
+    warn_gnuplot="
 
 gnuplot not found. It isn't necessary to have gnuplot installed, but
 without native graphics or gnuplot you won't be able to use any of
 Octave's plotting commands.
-
 "
     OCTAVE_CONFIGURE_WARNING([warn_gnuplot])
   fi
--- a/scripts/help/help.m
+++ b/scripts/help/help.m
@@ -19,6 +19,7 @@
 ## -*- texinfo -*-
 ## @deftypefn  {Command} {} help @var{name}
 ## @deftypefnx {Command} {} help @code{--list}
+## @deftypefnx {Command} {} help @code{.}
 ## Display the help text for @var{name}.   For example, the command
 ## @kbd{help help} prints a short message describing the @code{help}
 ## command.
@@ -27,6 +28,9 @@
 ## keywords, built-in functions, and loadable functions available
 ## in the current session of Octave.
 ##
+## Given the single argument @code{.}, list all operators available
+## in the current session of Octave.
+##
 ## If invoked without any arguments, @code{help} display instructions
 ## on how to access help from the command line.
 ##
@@ -68,6 +72,16 @@
       return;
     endif
 
+    if (strcmp (name, "."))
+      tmp = do_list_operators ();
+      if (nargout == 0)
+        printf ("%s", tmp);
+      else
+        retval = tmp;
+      endif
+      return;
+    endif
+
     ## Get help text
     [text, format] = get_help_text (name);
 
@@ -106,10 +120,15 @@
 
 endfunction
 
+function retval = do_list_operators ()
+  
+  retval = sprintf ("*** operators:\n\n%s\n\n",
+                       list_in_columns (__operators__ ()));
+endfunction
+
 function retval = do_list_functions ()
 
-  operators = sprintf ("*** operators:\n\n%s\n\n",
-                       list_in_columns (__operators__ ()));
+  operators = do_list_operators ();
 
   keywords = sprintf ("*** keywords:\n\n%s\n\n",
                       list_in_columns (__keywords__ ()));
--- a/scripts/help/type.m
+++ b/scripts/help/type.m
@@ -118,7 +118,7 @@
 %! typestr = typestr{1}(1:17);
 %! assert (typestr, "var is a variable");
 
-%!assert (type ("dot"){1}, "dot is a dynamically-linked function")
+%!assert (type ("amd"){1}, "amd is a dynamically-linked function")
 %!assert (type ("cat"){1}, "cat is a built-in function")
 %!assert (type ("+"){1}, "+ is an operator")
 %!assert (type ("end"){1}, "end is a keyword")
--- a/scripts/help/unimplemented.m
+++ b/scripts/help/unimplemented.m
@@ -38,7 +38,7 @@
     txt = ["quad2d is not implemented.  Consider using dblquad."];
 
   case "gsvd"
-    txt = ["gsvd is not currently part of core Octave.  See the ",
+    txt = ["gsvd is not currently part of core Octave.  See the ",...
     "linear-algebra package at @url{http://octave.sf.net/linear-algebra/}."];
 
   case "linprog"
--- a/scripts/help/which.m
+++ b/scripts/help/which.m
@@ -59,8 +59,8 @@
 %! str = which ("ls");
 %! assert (str(end-17:end), strcat ("miscellaneous", filesep (), "ls.m"));
 %!test
-%! str = which ("dot");
-%! assert (str(end-6:end), "dot.oct");
+%! str = which ("amd");
+%! assert (str(end-6:end), "amd.oct");
 
 %!assert (which ("_NO_SUCH_NAME_"), "")
 
new file mode 100644
--- /dev/null
+++ b/scripts/image/cmpermute.m
@@ -0,0 +1,144 @@
+## Copyright (C) 2004 Josep Mones i Teixidor
+## Copyright (C) 2012 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} {[@var{Y}, @var{newmap}] =} cmpermute (@var{X}, @var{map})
+## @deftypefnx {Function File} {[@var{Y}, @var{newmap}] =} cmpermute (@var{X}, @var{map}, @var{index})
+## Reorder colors in a colormap.
+##
+## When called with only two arguments, @code{cmpermute} randomly rearranges
+## the colormap @var{map} and returns a new colormap @var{newmap}.  It also
+## returns the indexed image @var{Y} which is the equivalent of the original
+## input image @var{X} when displayed using @var{newmap}.  The input image
+## @var{X} must be an indexed image of class uint8 or double.
+##
+## When called with an optional third argument the order of colors in the
+## new colormap is defined by @var{index}.
+##
+## @strong{Caution:} @code{index} should not have repeated elements or the
+## function will fail.
+##
+## @end deftypefn
+
+## Author:  Josep Mones i Teixidor <jmones@puntbarra.com>
+
+function [Y, newmap] = cmpermute (X, map, index)
+
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+  endif
+
+  ## FIXME: Matlab only accepts 2 types.  Expand to uint16 & single??
+  if (! (isa (X, "uint8") || isa (X, "double")))
+    error ("cmpermute: X must be of class uint8 or double");
+  endif
+
+  if (! isreal (X) || issparse (X)
+      || (isfloat (X) && (any (X(:) < 1 || any (X(:) != fix (X(:)))))))
+    error ("cmpermute: X must be an indexed image");
+  endif
+
+  if (! isnumeric (map) || iscomplex (map)
+      || ndims (map) != 2 || columns (map) != 3
+      || any (map(:) < 0) || any (map(:) > 1))
+    error ("cmpermute: MAP must be a valid colormap");
+  endif
+
+  if (nargin < 3)
+    index = randperm (rows (map));
+  elseif (! isvector (index) || length (index) != rows (map))
+    error ("cmpermute: invalid parameter INDEX");
+  endif
+
+  ## new colormap
+  newmap = map(index,:);
+
+  ## build reverse index
+  rindex = zeros (size (index));
+  rindex(index) = 1:length (index);
+ 
+  ## adapt indices
+  if (isa (X, "uint8"))
+    rindex = uint8 (rindex-1);
+    ## 0-based indices
+    Y = rindex(double (X) + 1);
+  else
+    Y = rindex(X);
+  endif
+
+endfunction
+
+
+%!demo
+%! [Y, newmap] = cmpermute ([1:4], hot (4), 4:-1:1)
+%! ## colormap will be arranged in reverse order (so will image)
+
+%!shared X, map
+%! X = uint8 (magic (16));
+%! [X, map] = cmunique (X);
+
+%!test # random permutation, 0-based index
+%! [Y, newmap] = cmpermute (X, map);
+%! ## test we didn't lose colors
+%! assert (sort (map), sortrows (newmap)); 
+%! ## test if images are equal
+%! assert (map(double (X)+1), newmap(double (Y)+1));
+
+%!test # reverse map, 0-based index
+%! [Y, newmap] = cmpermute (X, map, rows (map):-1:1);
+%! ## we expect a reversed colormap
+%! assert (flipud (newmap), map);
+%! ## we expect reversed indices in image
+%! assert (X, max (Y(:)) - Y);
+
+%!shared X,map
+%! X = uint16 (magic (20));
+%! [X, map] = cmunique (X);
+
+%!test # random permutation, 1-based index
+%! [Y, newmap] = cmpermute (X, map);
+%! ## test we didn't lose colors
+%! assert (sort (map), sortrows (newmap)); 
+%! ## test if images are equal
+%! assert (map(X), newmap(Y));
+
+%!test # reverse map, 1-based index
+%! [Y, newmap] = cmpermute (X, map, rows (map):-1:1);
+%! ## we expect a reversed colormap
+%! assert (newmap (rows (newmap):-1:1,:), map);
+%! ## we expect reversed indices in image
+%! assert (X, max (Y(:)) + 1 - Y);
+
+## Test input validation
+%!error cmpermute ()
+%!error cmpermute (1,2,3,4)
+%!error <X must be of class uint8> cmpermute (uint16 (magic (16)), jet (256))
+%!error <X must be an indexed image> cmpermute (1+i, jet (256))
+%!error <X must be an indexed image> cmpermute (sparse (1), jet (256))
+%!error <X must be an indexed image> cmpermute (0, jet (256))
+%!error <X must be an indexed image> cmpermute (1.5, jet (256))
+%!error <MAP must be a valid colormap> cmpermute (1, "a")
+%!error <MAP must be a valid colormap> cmpermute (1, i)
+%!error <MAP must be a valid colormap> cmpermute (1, ones (3,3,3))
+%!error <MAP must be a valid colormap> cmpermute (1, ones (3,2))
+%!error <MAP must be a valid colormap> cmpermute (1, [-1 1 1])
+%!error <MAP must be a valid colormap> cmpermute (1, [2 1 1])
+%!error <invalid parameter INDEX> cmpermute (1, [0 1 0;1 0 1], ones (3))
+%!error <invalid parameter INDEX> cmpermute (1, [0 1 0;1 0 1], 1:3)
+
new file mode 100644
--- /dev/null
+++ b/scripts/image/cmunique.m
@@ -0,0 +1,204 @@
+## Copyright (C) 2004 Josep Mones i Teixidor
+## Copyright (C) 2012 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} {[@var{Y}, @var{newmap}] =} cmunique (@var{X}, @var{map})
+## @deftypefnx {Function File} {[@var{Y}, @var{newmap}] =} cmunique (@var{RGB})
+## @deftypefnx {Function File} {[@var{Y}, @var{newmap}] =} cmunique (@var{I})
+## Convert an input image @var{X} to an ouput indexed image @var{Y} which uses
+## the smallest colormap possible @var{newmap}.
+##
+## When the input is an indexed image (@var{X} with colormap @var{map}) the 
+## output is a colormap @var{newmap} from which any repeated rows have been
+## eliminated.  The output image, @var{Y}, is the original input image with
+## the indices adjusted to match the new, possibly smaller, colormap.
+##
+## When the input is an RGB image (an @nospell{MxNx3} array), the output
+## colormap will contain one entry for every unique color in the original image.
+## In the worst case the new map could have as many rows as the number of
+## pixels in the original image.
+##
+## When the input is a grayscale image @var{I}, the output colormap will
+## contain one entry for every unique intensity value in the original image.
+## In the worst case the new map could have as many rows as the number of
+## pixels in the original image.
+##
+## Implementation Details:
+##
+## @var{newmap} is always an Mx3 matrix, even if the input image is
+## an intensity grayscale image @var{I} (all three RGB planes are
+## assigned the same value).
+##
+## The output image is of class uint8 if the size of the new colormap is
+## less than or equal to 256.  Otherwise, the output image is of class double.
+##
+## @seealso{rgb2ind, gray2ind}
+## @end deftypefn
+
+
+## Author:  Josep Mones i Teixidor <jmones@puntbarra.com>
+
+function [Y, newmap] = cmunique (X, map)
+
+  if (nargin < 1 || nargin > 2)
+    print_usage ();
+  endif
+
+  cls = class (X);
+  ## FIXME: Documentation accepts only 3 classes.  Could easily add 'single'.
+  if (! any (isa (X, {"uint8", "uint16", "double"})))
+    error ("cmunique: X is of invalid data type '%s'", cls);
+  endif
+
+  if (nargin == 2)
+    ## (X, map) case
+    if (! isnumeric (map) || iscomplex (map)
+        || ndims (map) != 2 || columns (map) != 3
+        || any (map(:) < 0) || any (map(:) > 1))
+      error ("cmunique: MAP must be a valid colormap");
+    endif
+    [newmap,i,j] = unique (map, "rows");  # calculate unique colormap
+    if (isa (X, "double"))
+      Y = j(X);               # find new indices
+    else
+      Y = j(double (X) + 1);  # find new indices
+    endif
+  else
+    switch (size (X,3))
+      case (1)
+        ## I case
+        [newmap,i,j] = unique (X);               # calculate unique colormap
+        newmap = repmat (newmap,1,3);            # get a RGB colormap
+        Y = reshape (j, rows (X), columns (X));  # Y is j reshaped
+      case (3)
+        ## RGB case
+        ## build a map with all values
+        map = [X(:,:,1)(:), X(:,:,2)(:), X(:,:,3)(:)];
+        [newmap,i,j] = unique (map, "rows");     # calculate unique colormap
+        Y = reshape (j, rows (X), columns (X));  # Y is j reshaped
+      otherwise
+        error ("cmunique: X is not a valid image");
+    endswitch
+    
+    ## if image was uint8 or uint16 we have to convert newmap to [0,1] range
+    if (! isa (X, "double"))
+      newmap = double (newmap) / double (intmax (class (X)));
+    endif
+  endif
+
+  if (rows (newmap) <= 256)
+    ## convert Y to uint8 (0-based indices then)
+    Y = uint8 (Y-1);
+  endif
+
+endfunction
+
+
+%!demo
+%! [Y, newmap] = cmunique ([1:4;5:8], [hot(4);hot(4)])
+%! ## Both rows are equal since map maps colors to the same value
+%! ## cmunique will give the same indices to both
+
+## Check that output is uint8 in short colormaps
+%!test
+%! [Y, newmap] = cmunique ([1:4;5:8], [hot(4);hot(4)]);
+%! assert (Y, uint8 ([0:3;0:3]));
+%! assert (newmap, hot (4));
+
+## Check that output is double in bigger
+%!test
+%! [Y, newmap] = cmunique ([1:300;301:600], [hot(300);hot(300)]);
+%! assert (Y, [1:300;1:300]);
+%! assert (newmap, hot (300));
+
+## Check boundary case 256
+%!test
+%! [Y, newmap] = cmunique ([1:256;257:512], [hot(256);hot(256)]);
+%! assert (Y, uint8 ([0:255;0:255]));
+%! assert (newmap, hot (256));
+
+## Check boundary case 257
+%!test
+%! [Y, newmap] = cmunique ([1:257;258:514], [hot(257);hot(257)]);
+%! assert (Y, [1:257;1:257]);
+%! assert (newmap, hot (257));
+
+## Random RGB image
+%!test
+%! RGB = rand (10,10,3);
+%! [Y, newmap] = cmunique (RGB);
+%! assert (RGB(:,:,1), newmap(:,1)(Y+1));
+%! assert (RGB(:,:,2), newmap(:,2)(Y+1));
+%! assert (RGB(:,:,3), newmap(:,3)(Y+1));
+
+## Random uint8 RGB image
+%!test
+%! RGB = uint8 (rand (10,10,3)*255);
+%! RGBd = double (RGB) / 255;
+%! [Y, newmap] = cmunique (RGB);
+%! assert (RGBd(:,:,1), newmap(:,1)(Y+1));
+%! assert (RGBd(:,:,2), newmap(:,2)(Y+1));
+%! assert (RGBd(:,:,3), newmap(:,3)(Y+1));
+
+## Random uint16 RGB image
+%!test
+%! RGB = uint16 (rand (10,10,3)*65535);
+%! RGBd = double (RGB) / 65535;
+%! [Y, newmap] = cmunique (RGB);
+%! assert (RGBd(:,:,1), newmap(:,1)(Y+1));
+%! assert (RGBd(:,:,2), newmap(:,2)(Y+1));
+%! assert (RGBd(:,:,3), newmap(:,3)(Y+1));
+
+## Random I image
+%!test
+%! I = rand (10,10);
+%! [Y, newmap] = cmunique (I);
+%! assert (I, newmap(:,1)(Y+1));
+%! assert (I, newmap(:,2)(Y+1));
+%! assert (I, newmap(:,3)(Y+1));
+
+## Random uint8 I image
+%!test
+%! I = uint8 (rand (10,10)*256);
+%! Id = double (I) / 255;
+%! [Y, newmap] = cmunique (I);
+%! assert (Id, newmap(:,1)(Y+1));
+%! assert (Id, newmap(:,2)(Y+1));
+%! assert (Id, newmap(:,3)(Y+1));
+
+## Random uint16 I image
+%!test
+%! I = uint16 (rand (10,10)*65535);
+%! Id = double (I) / 65535;
+%! [Y,newmap] = cmunique (I);
+%! assert (Id,newmap (:,1)(Y+1));
+%! assert (Id,newmap (:,2)(Y+1));
+%! assert (Id,newmap (:,3)(Y+1));
+
+## Test input validation
+%!error cmpermute ()
+%!error cmpermute (1,2,3)
+%!error <X is of invalid data type> cmunique (single (magic (16)))
+%!error <MAP must be a valid colormap> cmunique (1, "a")
+%!error <MAP must be a valid colormap> cmunique (1, i)
+%!error <MAP must be a valid colormap> cmunique (1, ones (3,3,3))
+%!error <MAP must be a valid colormap> cmunique (1, ones (3,2))
+%!error <MAP must be a valid colormap> cmunique (1, [-1 1 1])
+%!error <MAP must be a valid colormap> cmunique (1, [2 1 1])
+
--- a/scripts/image/imshow.m
+++ b/scripts/image/imshow.m
@@ -25,7 +25,7 @@
 ## @deftypefnx {Function File} {} imshow (@dots{}, @var{string_param1}, @var{value1}, @dots{})
 ## @deftypefnx {Function File} {@var{h} =} imshow (@dots{})
 ## Display the image @var{im}, where @var{im} can be a 2-dimensional
-## (gray-scale image) or a 3-dimensional (RGB image) matrix.
+## (grayscale image) or a 3-dimensional (RGB image) matrix.
 ##
 ## If @var{limits} is a 2-element vector @code{[@var{low}, @var{high}]},
 ## the image is shown using a display range between @var{low} and
--- a/scripts/image/module.mk
+++ b/scripts/image/module.mk
@@ -4,6 +4,8 @@
   image/autumn.m \
   image/bone.m \
   image/brighten.m \
+  image/cmpermute.m \
+  image/cmunique.m \
   image/colorcube.m \
   image/colormap.m \
   image/contrast.m \
--- a/scripts/miscellaneous/fileattrib.m
+++ b/scripts/miscellaneous/fileattrib.m
@@ -57,6 +57,7 @@
 ## True if the user (group; other users) has execute permission for
 ## @var{file}.
 ## @end table
+##
 ## If an attribute does not apply (i.e., archive on a Unix system) then
 ## the field is set to NaN.
 ##
--- a/scripts/miscellaneous/gzip.m
+++ b/scripts/miscellaneous/gzip.m
@@ -51,10 +51,10 @@
 %!   mkdir (dirname);
 %!   entry = gzip (filename, dirname);
 %!   [path, basename, extension] = fileparts (filename);
-%!   if ! strcmp (entry, [dirname, filesep, basename, extension, ".gz"])
+%!   if (! strcmp (entry, [dirname, filesep, basename, extension, ".gz"]))
 %!     error ("gzipped file does not match expected name!");
 %!   endif
-%!   if ! exist (entry, "file")
+%!   if (! exist (entry, "file"))
 %!     error ("gzipped file cannot be found!");
 %!   endif
 %!   gunzip (entry);
--- a/scripts/optimization/fminbnd.m
+++ b/scripts/optimization/fminbnd.m
@@ -20,14 +20,13 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {[@var{x}, @var{fval}, @var{info}, @var{output}] =} fminbnd (@var{fun}, @var{a}, @var{b}, @var{options})
-## Find a minimum point of a univariate function.  @var{fun} should be a
-## function
-## handle or name.  @var{a}, @var{b} specify a starting interval.  @var{options}
-## is a
-## structure specifying additional options.  Currently, @code{fminbnd}
-## recognizes these options: @code{"FunValCheck"}, @code{"OutputFcn"},
-## @code{"TolX"}, @code{"MaxIter"}, @code{"MaxFunEvals"}.
-## For description of these options, see @ref{doc-optimset,,optimset}.
+## Find a minimum point of a univariate function.
+## 
+## @var{fun} should be a function handle or name.  @var{a}, @var{b} specify a
+## starting interval.  @var{options} is a structure specifying additional
+## options.  Currently, @code{fminbnd} recognizes these options:
+## "FunValCheck", "OutputFcn", "TolX", "MaxIter", "MaxFunEvals".  For a
+## description of these options, see @ref{doc-optimset,,optimset}.
 ##
 ## On exit, the function returns @var{x}, the approximate minimum point
 ## and @var{fval}, the function value thereof.
@@ -43,7 +42,13 @@
 ## @item -1
 ## The algorithm has been terminated from user output function.
 ## @end itemize
-## @seealso{optimset, fzero, fminunc}
+##
+## Notes: The search for a minimum is restricted to be in the interval
+## bound by @var{a} and @var{b}.  If you only have an initial point
+## to begin searching from you will need to use an unconstrained
+## minimization algorithm such as @code{fminunc} or @code{fminsearch}.
+## @code{fminbnd} internally uses a Golden Section search strategy.
+## @seealso{fzero, fminunc, fminsearch, optimset}
 ## @end deftypefn
 
 ## This is patterned after opt/fmin.f from Netlib, which in turn is taken from
new file mode 100644
--- /dev/null
+++ b/scripts/optimization/fminsearch.m
@@ -0,0 +1,352 @@
+## Copyright (C) 2003,2012 Andy Adler
+## Copyright (C) 2002 N.J.Higham
+##
+## 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{x} =} fminsearch (@var{fun}, @var{x0})
+## @deftypefnx {Function File} {@var{x} =} fminsearch (@var{fun}, @var{x0}, @var{options})
+## @deftypefnx {Function File} {[@var{x}, @var{fval}] =} fminsearch (@dots{})
+##
+## Find a value of @var{x} which minimizes the function @var{fun}.
+## The search begins at the point @var{x0} and iterates using the
+## Nelder & Mead Simplex algorithm (a derivative-free method).  This algorithm
+## is better-suited to functions which have discontinuities or for which
+## a gradient-based search such as @code{fminunc} fails.
+##
+## Options for the search are provided in the parameter @var{options} using 
+## the function @code{optimset}.  Currently, @code{fminsearch} accepts the
+## options: "TolX", "MaxFunEvals", "MaxIter", "Display".  For a description of
+## these options, see @code{optimset}.
+##
+## On exit, the function returns @var{x}, the minimum point,
+## and @var{fval}, the function value thereof.
+##
+## Example usages:
+##
+## @example
+## @group
+## fminsearch (@@(x) (x(1)-5).^2+(x(2)-8).^4, [0;0])
+##
+## fminsearch (inline ("(x(1)-5).^2+(x(2)-8).^4", "x"), [0;0])
+## @end group
+## @end example
+## @seealso{fminbnd, fminunc, optimset}
+## @end deftypefn
+
+## PKG_ADD: ## Discard result to avoid polluting workspace with ans at startup.
+## PKG_ADD: [~] = __all_opts__ ("fminsearch");
+
+## FIXME: Add support for "exitflag" output variable
+## FIXME: Add support for "output" output variable
+## FIXME: For Display option, add 'final' and 'notify' options.  Not too hard.
+## FIXME: Add support for OutputFcn.  See fminunc for a template
+## FIXME: Add support for exiting based on TolFun.  See fminunc for an idea.
+
+function [x, fval] = fminsearch (fun, x0, options = struct ())
+
+  ## Get default options if requested.
+  if (nargin == 1 && ischar (fun) && strcmp (fun, "defaults"))
+    x = optimset ("Display", "notify", "FunValCheck", "off",
+                  "MaxFunEvals", 400, "MaxIter", 400,
+                  "OutputFcn", [],
+                  "TolFun", 1e-7, "TolX", 1e-4);
+    return;
+  endif
+
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+  endif
+
+  x = nmsmax (fun, x0, options);
+
+  if (isargout (2))
+    fval = feval (fun, x);
+  endif
+
+endfunction
+
+##NMSMAX  Nelder-Mead simplex method for direct search optimization.
+##        [x, fmax, nf] = NMSMAX(FUN, x0, STOPIT, SAVIT) attempts to
+##        maximize the function FUN, using the starting vector x0.
+##        The Nelder-Mead direct search method is used.
+##        Output arguments:
+##               x    = vector yielding largest function value found,
+##               fmax = function value at x,
+##               nf   = number of function evaluations.
+##        The iteration is terminated when either
+##               - the relative size of the simplex is <= STOPIT(1)
+##                 (default 1e-3),
+##               - STOPIT(2) function evaluations have been performed
+##                 (default inf, i.e., no limit), or
+##               - a function value equals or exceeds STOPIT(3)
+##                 (default inf, i.e., no test on function values).
+##        The form of the initial simplex is determined by STOPIT(4):
+##           STOPIT(4) = 0: regular simplex (sides of equal length, the default)
+##           STOPIT(4) = 1: right-angled simplex.
+##        Progress of the iteration is not shown if STOPIT(5) = 0 (default 1).
+##           STOPIT(6) indicates the direction (ie. minimization or
+##                   maximization.) Default is 1, maximization.
+##                   set STOPIT(6)=-1 for minimization
+##        If a non-empty fourth parameter string SAVIT is present, then
+##        `SAVE SAVIT x fmax nf' is executed after each inner iteration.
+##        NB: x0 can be a matrix.  In the output argument, in SAVIT saves,
+##            and in function calls, x has the same shape as x0.
+##        NMSMAX(fun, x0, STOPIT, SAVIT, P1, P2,...) allows additional
+##        arguments to be passed to fun, via feval(fun,x,P1,P2,...).
+## References:
+## N. J. Higham, Optimization by direct search in matrix computations,
+##    SIAM J. Matrix Anal. Appl, 14(2): 317-333, 1993.
+## C. T. Kelley, Iterative Methods for Optimization, Society for Industrial
+##    and Applied Mathematics, Philadelphia, PA, 1999.
+
+## From Matrix Toolbox
+## Copyright (C) 2002 N.J.Higham
+## www.maths.man.ac.uk/~higham/mctoolbox
+##
+## Modifications for Octave by A.Adler 2003
+
+function [stopit, savit, dirn, trace, tol, maxiter] = parse_options (options, x );
+
+  ## Tolerance for cgce test based on relative size of simplex.
+  stopit(1) = tol = optimget (options, "TolX", 1e-4);
+
+  ## Max no. of f-evaluations.
+  stopit(2) = optimget (options, "MaxFunEvals", length (x) * 200);
+
+  ## Max no. of iterations
+  maxiter = optimget (options, "MaxIter", length (x) * 200);
+
+  ## Default target for f-values.
+  stopit(3) = Inf;  # FIXME: expose this parameter to the outside
+
+  ## Default initial simplex.
+  stopit(4) = 0;    # FIXME: expose this parameter to the outside
+
+  ## Default: show progress.
+  display = optimget (options, "Display", "notify");
+  if (strcmp (display, "iter"))
+    stopit(5) = 1;
+  else
+    stopit(5) = 0;
+  endif
+  trace = stopit(5);
+
+  ## Use function to minimize, not maximize
+  stopit(6) = dirn = -1;
+
+  ## File name for snapshots.
+  savit = [];  # FIXME: expose this parameter to the outside
+
+endfunction
+
+function [x, fmax, nf] = nmsmax (fun, x, options, savit, varargin)
+
+  [stopit, savit, dirn, trace, tol, maxiter] = parse_options (options, x);
+
+  if (strcmpi (optimget (options, "FunValCheck", "off"), "on"))
+    ## Replace fcn with a guarded version.
+    fun = @(x) guarded_eval (fun, x);
+  endif
+
+  x0 = x(:);  # Work with column vector internally.
+  n = length (x0);
+
+  V = [zeros(n,1) eye(n)];
+  f = zeros (n+1,1);
+  V(:,1) = x0;
+  f(1) = dirn * feval (fun,x,varargin{:});
+  fmax_old = f(1);
+
+  if (trace)
+    fprintf ("f(x0) = %9.4e\n", f(1));
+  endif
+
+  k = 0; m = 0;
+
+  ## Set up initial simplex.
+  scale = max (norm (x0,Inf), 1);
+  if (stopit(4) == 0)
+    ## Regular simplex - all edges have same length.
+    ## Generated from construction given in reference [18, pp. 80-81] of [1].
+    alpha = scale / (n*sqrt (2)) * [sqrt(n+1)-1+n, sqrt(n+1)-1];
+    V(:,2:n+1) = (x0 + alpha(2)*ones (n,1)) * ones (1,n);
+    for j = 2:n+1
+      V(j-1,j) = x0(j-1) + alpha(1);
+      x(:) = V(:,j);
+      f(j) = dirn * feval (fun,x,varargin{:});
+    endfor
+  else
+    ## Right-angled simplex based on co-ordinate axes.
+    alpha = scale * ones(n+1,1);
+    for j=2:n+1
+      V(:,j) = x0 + alpha(j)*V(:,j);
+      x(:) = V(:,j);
+      f(j) = dirn * feval (fun,x,varargin{:});
+    endfor
+  endif
+  nf = n+1;
+  how = "initial  ";
+
+  [~,j] = sort (f);
+  j = j(n+1:-1:1);
+  f = f(j);
+  V = V(:,j);
+
+  alpha = 1;  beta = 1/2;  gamma = 2;
+
+  while (1)   # Outer (and only) loop.
+    k++;
+
+    if (k > maxiter)
+      msg = "Exceeded maximum iterations...quitting\n";
+      break;
+    endif
+
+    fmax = f(1);
+    if (fmax > fmax_old)
+      if (! isempty (savit))
+        x(:) = V(:,1);
+        eval (["save " savit " x fmax nf"]);
+      endif
+    endif
+    if (trace)
+      fprintf ("Iter. %2.0f,", k);
+      fprintf (["  how = " how "  "]);
+      fprintf ("nf = %3.0f,  f = %9.4e  (%2.1f%%)\n", nf, fmax, ...
+               100*(fmax-fmax_old)/(abs(fmax_old)+eps));
+    endif
+    fmax_old = fmax;
+
+    ## Three stopping tests from MDSMAX.M
+
+    ## Stopping Test 1 - f reached target value?
+    if (fmax >= stopit(3))
+      msg = "Exceeded target...quitting\n";
+      break;
+    endif
+
+    ## Stopping Test 2 - too many f-evals?
+    if (nf >= stopit(2))
+      msg = "Max no. of function evaluations exceeded...quitting\n";
+      break;
+    endif
+
+    ## Stopping Test 3 - converged?   This is test (4.3) in [1].
+    v1 = V(:,1);
+    size_simplex = norm (V(:,2:n+1)-v1(:,ones (1,n)),1) / max (1, norm (v1,1));
+    if (size_simplex <= tol)
+      msg = sprintf ("Simplex size %9.4e <= %9.4e...quitting\n", ...
+                      size_simplex, tol);
+      break;
+    endif
+
+    ##  One step of the Nelder-Mead simplex algorithm
+    ##  NJH: Altered function calls and changed CNT to NF.
+    ##       Changed each `fr < f(1)' type test to `>' for maximization
+    ##       and re-ordered function values after sort.
+
+    vbar = (sum (V(:,1:n)')/n)';  # Mean value
+    vr = (1 + alpha)*vbar - alpha*V(:,n+1);
+    x(:) = vr;
+    fr = dirn * feval (fun,x,varargin{:});
+    nf = 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;
+        if (fe > f(1))
+          vk = ve;
+          fk = fe;
+          how = "expand,  ";
+        endif
+      endif
+    else
+      vt = V(:,n+1);
+      ft = f(n+1);
+      if (fr > ft)
+        vt = vr;
+        ft = fr;
+      endif
+      vc = beta*vt + (1-beta)*vbar;
+      x(:) = vc;
+      fc = dirn * feval (fun,x,varargin{:});
+      nf = nf + 1;
+      if (fc > f(n))
+        vk = vc; fk = fc;
+        how = "contract,";
+      else
+        for j = 2:n
+          V(:,j) = (V(:,1) + V(:,j))/2;
+          x(:) = V(:,j);
+          f(j) = dirn * feval (fun,x,varargin{:});
+        endfor
+        nf = nf + n-1;
+        vk = (V(:,1) + V(:,n+1))/2;
+        x(:) = vk;
+        fk = dirn * feval (fun,x,varargin{:});
+        nf = nf + 1;
+        how = "shrink,  ";
+      endif
+    endif
+    V(:,n+1) = vk;
+    f(n+1) = fk;
+    [~,j] = sort(f);
+    j = j(n+1:-1:1);
+    f = f(j);
+    V = V(:,j);
+
+  endwhile   # End of outer (and only) loop.
+
+  ## Finished.
+  if (trace)
+    fprintf (msg);
+  endif
+  x(:) = V(:,1);
+
+endfunction
+
+## A helper function that evaluates a function and checks for bad results.
+function y = guarded_eval (fun, x)
+
+  y = fun (x);
+
+  if (! (isreal (f)))
+    error ("fminsearch:notreal", "fminsearch: non-real value encountered");
+  elseif (any (isnan (f(:))))
+    error ("fminsearch:isnan", "fminsearch: NaN value encountered");
+  elseif (any (isinf (f(:))))
+    error ("fminsearch:isinf", "fminsearch: Inf value encountered");
+  endif
+
+endfunction
+
+
+%!demo
+%! fcn = @(x) (x(1)-5).^2 + (x(2)-8).^4
+%! x0 = [0;0];
+%! [xmin, fval] = fminsearch (fcn, x0)
+
+%!assert (fminsearch (@sin, 3, optimset ("MaxIter", 3)), 4.8750, 1e-4)
+%!assert (fminsearch (@sin, 3, optimset ("MaxIter", 30)), 4.7124, 1e-4)
+%!shared c
+%! c = 1.5;
+%!assert (fminsearch (@(x) x(1).^2+c*x(2).^2,[1;1]), [0;0], 1e-4)
+
--- a/scripts/optimization/fminunc.m
+++ b/scripts/optimization/fminunc.m
@@ -24,6 +24,7 @@
 ## @deftypefnx {Function File} {[@var{x}, @var{fvec}, @var{info}, @var{output}, @var{grad}, @var{hess}] =} fminunc (@var{fcn}, @dots{})
 ## Solve an unconstrained optimization problem defined by the function
 ## @var{fcn}.
+##
 ## @var{fcn} should accepts a vector (array) defining the unknown variables,
 ## and return the objective function value, optionally with gradient.
 ## In other words, this function attempts to determine a vector @var{x} such
@@ -72,9 +73,12 @@
 ## (@var{output}), the output gradient (@var{grad}) and approximate Hessian
 ## (@var{hess}).
 ##
-## Note: If you only have a single nonlinear equation of one variable, using
-## @code{fminbnd} is usually a much better idea.
-## @seealso{fminbnd, optimset}
+## Notes: If you only have a single nonlinear equation of one variable then
+## using @code{fminbnd} is usually a much better idea.  The algorithm used is a
+## gradient search which depends on the objective function being differentiable.
+## If the function has discontinuities it may be better to use a derivative-free
+## algorithm such as @code{fminsearch}.
+## @seealso{fminbnd, fminsearch, optimset}
 ## @end deftypefn
 
 ## PKG_ADD: ## Discard result to avoid polluting workspace with ans at startup.
--- a/scripts/optimization/glpk.m
+++ b/scripts/optimization/glpk.m
@@ -369,6 +369,7 @@
 ## @item 185 (@w{@code{LPX_UNDEF}})
 ## Solution status is undefined.
 ## @end table
+##
 ## Interior Point Method:
 ##
 ## @table @asis
@@ -378,6 +379,7 @@
 ## @item 151 (@w{@code{LPX_T_OPT}})
 ## The interior point method is optimal.
 ## @end table
+##
 ## Mixed Integer Method:
 ##
 ## @table @asis
@@ -393,6 +395,7 @@
 ## @item 173 (@w{@code{LPX_I_NOFEAS}})
 ## No integer feasible solution.
 ## @end table
+##
 ## @noindent
 ## If an error occurs, @var{status} will contain one of the following
 ## codes:
--- a/scripts/optimization/module.mk
+++ b/scripts/optimization/module.mk
@@ -6,6 +6,7 @@
 optimization_FCN_FILES = \
   optimization/__all_opts__.m \
   optimization/fminbnd.m \
+  optimization/fminsearch.m \
   optimization/fminunc.m \
   optimization/fsolve.m \
   optimization/fzero.m \
--- a/scripts/optimization/optimset.m
+++ b/scripts/optimization/optimset.m
@@ -26,16 +26,34 @@
 ##
 ## Valid parameters are:
 ##
-## @itemize @bullet
+## @table @asis
 ## @item AutoScaling
 ##
 ## @item ComplexEqn
 ##
+## @item Display
+## Request verbose display of results from optimizations.  Values are:
+##
+## @table @asis
+## @item "off" [default]
+## No display.
+##
+## @item "iter"
+## Display intermediate results for every loop iteration.
+##
+## @item "final"
+## Display the result of the final loop iteration.
+##
+## @item "notify"
+## Display the result of the final loop iteration if the function has
+## failed to converge.
+## @end table
+##
 ## @item FinDiffType
 ##
 ## @item FunValCheck
 ## When enabled, display an error if the objective function returns an invalid
-## value (a complex value, NaN, or Inf).  Must be set to "on" or "off"
+## value (a complex number, NaN, or Inf).  Must be set to "on" or "off"
 ## [default].  Note: the functions @code{fzero} and @code{fminbnd} correctly
 ## handle Inf values and only complex values or NaN will cause an error in this
 ## case. 
@@ -77,7 +95,7 @@
 ## @item TypicalX
 ##
 ## @item Updating
-## @end itemize
+## @end table
 ## @end deftypefn
 
 function retval = optimset (varargin)
--- a/scripts/pkg/module.mk
+++ b/scripts/pkg/module.mk
@@ -1,7 +1,6 @@
 FCN_FILE_DIRS += pkg
 
 pkg_PRIVATE_FCN_FILES = \
-  pkg/private/absolute_pathname.m \
   pkg/private/build.m \
   pkg/private/configure_make.m \
   pkg/private/copy_files.m \
--- a/scripts/pkg/pkg.m
+++ b/scripts/pkg/pkg.m
@@ -421,50 +421,46 @@
         global_packages = archprefix;
       elseif (length (files) >= 1 && nargout <= 2 && ischar (files{1}))
         prefix = files{1};
-        try
-          prefix = absolute_pathname (prefix);
-        catch
+        if (! exist (prefix, "dir"))
           [status, msg, msgid] = mkdir (prefix);
           if (status == 0)
             error("cannot create prefix %s: %s", prefix, msg);
           endif
           warning ("creating the directory %s\n", prefix);
-          prefix = absolute_pathname (prefix);
-        end_try_catch
-        prefix = absolute_pathname (prefix);
-        local_packages = prefix;
+        endif
+        local_packages = prefix = canonicalize_filename (prefix);
         user_prefix = true;
         if (length (files) >= 2 && ischar (files{2}))
           archprefix = files{2};
-          try
-            archprefix = absolute_pathname (archprefix);
-          catch
+          if (! exist (archprefix, "dir"))
             [status, msg, msgid] = mkdir (archprefix);
             if (status == 0)
               error("cannot create archprefix %s: %s", archprefix, msg);
             endif
             warning ("creating the directory %s\n", archprefix);
-            archprefix = absolute_pathname (archprefix);
-          end_try_catch
-          global_packages = archprefix;
+            global_packages = archprefix = canonicalize_file_name (archprefix);
+          endif
         endif
       else
         error ("you must specify a prefix directory, or request an output argument");
       endif
-
+      
     case "local_list"
       if (length (files) == 0 && nargout == 0)
         disp (local_list);
       elseif (length (files) == 0 && nargout == 1)
         local_packages = local_list;
       elseif (length (files) == 1 && nargout == 0 && ischar (files{1}))
-        try
-          local_list = absolute_pathname (files{1});
-        catch
-          ## Force file to be created
-          fclose (fopen (files{1}, "wt"));
-          local_list = absolute_pathname (files{1});
-        end_try_catch
+        local_list = files{1};
+        if (! exist (local_list, "file"))          
+          try
+            ## Force file to be created
+            fclose (fopen (local_list, "wt"));
+          catch
+            error ("cannot create file %s", local_list);
+          end_try_catch
+        endif
+        local_list = canonicalize_file_name (local_list);
       else
         error ("you must specify a local_list file, or request an output argument");
       endif
@@ -475,13 +471,16 @@
       elseif (length (files) == 0 && nargout == 1)
         local_packages = global_list;
       elseif (length (files) == 1 && nargout == 0 && ischar (files{1}))
-        try
-          global_list = absolute_pathname (files{1});
-        catch
-          ## Force file to be created
-          fclose (fopen (files{1}, "wt"));
-          global_list = absolute_pathname (files{1});
-        end_try_catch
+        global_list = files{1};
+        if (! exist (global_list, "file"))  
+          try
+            ## Force file to be created
+            fclose (fopen (files{1}, "wt"));
+          catch
+            error ("cannot create file %s", global_list);
+          end_try_catch
+        endif
+        global_list = canonicalize_file_name (global_list);
       else
         error ("you must specify a global_list file, or request an output argument");
       endif
deleted file mode 100644
--- a/scripts/pkg/private/absolute_pathname.m
+++ /dev/null
@@ -1,33 +0,0 @@
-## Copyright (C) 2005-2012 Søren Hauberg
-## Copyright (C) 2010 VZLU Prague, a.s.
-##
-## 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{pth} =} absolute_pathname (@var{pth})
-## Undocumented internal function.
-## @end deftypefn
-
-function pth = absolute_pathname (pth)
-  [status, msg, msgid] = fileattrib (pth);
-  if (status != 1)
-    error ("could not find the file or path %s", pth);
-  else
-    pth = msg.Name;
-  endif
-endfunction
-
--- a/scripts/pkg/private/build.m
+++ b/scripts/pkg/private/build.m
@@ -34,7 +34,10 @@
       error ("could not create installation directory: %s", msg);
     endif
   endif
-  builddir = absolute_pathname (builddir);
+  [builddir, status] = canonicalize_file_name (builddir);
+  if (! status)
+    error ("cannot find directory %s", builddir);
+  endif
   installdir = fullfile (builddir, "install");
   if (! exist (installdir, "dir"))
     [status, msg] = mkdir (installdir);
--- a/scripts/plot/axis.m
+++ b/scripts/plot/axis.m
@@ -109,6 +109,7 @@
 ## @item "nolabel"
 ## Turn tic labels off for all axes.
 ## @end table
+##
 ## Note, if there are no tic marks for an axis, there can be no labels.
 ##
 ## @noindent
--- a/scripts/plot/copyobj.m
+++ b/scripts/plot/copyobj.m
@@ -15,51 +15,89 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn   {Function File} {@var{hnew} =} copyobj (@var{horig})
-## @deftypefnx  {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
-## Constructs a copy of the object associated with handle @var{horig}
-## and returns a handle, @var{hnew}, to the new object.
-## If a parent handle @var{hparent} (root, figure, axes or hggroup) is specified,
-## the copied object will be created as a child to @var{hparent}.
+## @deftypefn  {Function File} {@var{hnew} =} copyobj (@var{horig})
+## @deftypefnx {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
+## Construct a copy of the object associated with handle @var{horig}
+## and return a handle @var{hnew} to the new object.
+## If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
+## specified, the copied object will be created as a child to @var{hparent}.
 ## @seealso{findobj, get, set, struct2hdl, hdl2struct}
 ## @end deftypefn
 
 ## Author: pdiribarne <pdiribarne@new-host.home>
 ## Created: 2012-04-01
 
-function hout = copyobj (hin, hpar = 0)
+function hnew = copyobj (horig, hparent = 0)
 
   partypes = {"root", "figure", "axes", "hggroup"};
   othertypes = {"line", "patch", "surface", "image", "text"};
   alltypes = [partypes othertypes];
 
-  if (! ishandle (hin) || nargin > 2)
+  if (! ishandle (horig) || nargin > 2)
     print_usage ();
-  elseif (! ishandle (hpar))
-    hpar = figure (floor (hpar));
-  elseif (! any (strcmpi (get (hpar).type, partypes)))
+  elseif (! ishandle (hparent))
+    hparent = figure (fix (hparent));
+  elseif (! any (strcmpi (get (hparent).type, partypes)))
     print_usage ();
   endif
 
   ## compatibility of input handles
-  kididx = find (strcmp (alltypes, get (hin).type));
-  paridx = find (strcmp (alltypes, get (hpar).type));
+  kididx = find (strcmp (alltypes, get (horig).type));
+  paridx = find (strcmp (alltypes, get (hparent).type));
 
   if (kididx <= paridx)
     error ("copyobj: %s object can't be children to %s.",
-           alltypes{kididx}, alltypes{paridx})
-  elseif nargin == 1
-    str = hdl2struct (hin);
-    hout = struct2hdl (str);
+           alltypes{kididx}, alltypes{paridx});
+  elseif (nargin == 1)
+    str = hdl2struct (horig);
+    hnew = struct2hdl (str);
   else
-    str = hdl2struct (hin);
-    hout = struct2hdl (str, hpar);
+    str = hdl2struct (horig);
+    hnew = struct2hdl (str, hparent);
   endif
+
 endfunction
 
+
+%!demo
+%! hdl = figure (1234);
+%! clf;
+%! hold on;
+%! x = 1:10;
+%! y = x.^2;
+%! dy = 2 * (.2 * x);
+%! y2 = (x - 3).^2;
+%! hg = errorbar (x, y, dy,'#~');
+%! set (hg, 'marker', '^', 'markerfacecolor', rand (1,3));
+%! plot (x, y2, 'ok-');
+%! legend ('errorbar', 'line');
+%! hnew = copyobj (hdl);
+
+%!demo
+%! ## FIXME: This demo fails occasionally for an obscure reason.
+%! ## It appears that there is something wrong with Octave code for patches.
+%! hdl = figure (1234);
+%! clf;
+%! subplot (2,2,1);
+%! hold on;
+%! contourf (rand (10, 10));
+%! colorbar;
+%! subplot (2,2,2);
+%! quiver (rand (10, 10), rand (10, 10));
+%! subplot (2,2,3);
+%! colormap (jet (64));
+%! hold on;
+%! sombrero;
+%! colorbar ('peer', gca, 'NorthOutside');
+%! subplot (2,2,4);
+%! imagesc (rand (30, 30));
+%! text (15, 15, 'Rotated text', ...
+%!      'HorizontAlalignment', 'Center', 'Rotation', 30);
+%! hnew = copyobj (hdl);
+
 %!test
 %! h1 = figure ();
-%! set (h1, "visible", "off")
+%! set (h1, "visible", "off");
 %! x = 0:0.1:2*pi;
 %! y1 = sin (x);
 %! y2 = exp (x - 1);
@@ -79,49 +117,14 @@
 %! png1 = strcat (tmpnam (), ".png");
 %! png2 = strcat (tmpnam (), ".png");
 %! unwind_protect
-%!   print (h1, png1)
+%!   print (h1, png1);
 %!   [img1, map1, alpha1] = imread (png1);
-%!   print (h2, png2)
+%!   print (h2, png2);
 %!   [img2, map2, alpha2] = imread (png2);
 %! unwind_protect_cleanup
 %!   unlink (png1);
 %!   unlink (png2);
 %! end_unwind_protect
-%! assert (img1, img2)
-%! assert (map1, map2)
-%! assert (alpha1, alpha2)
-
-%!demo
-%! hdl = figure (1234);
-%! clf ()
-%! hold on
-%! x = 1:10;
-%! y = x.^2;
-%! dy = 2 * (.2 * x);
-%! y2 = (x - 3).^2;
-%! hg = errorbar (x, y, dy,'#~');
-%! set (hg, 'marker', '^', 'markerfacecolor', rand(1,3))
-%! plot (x, y2, 'ok-')
-%! legend ('errorbar', 'line')
-%! hout = copyobj (1234);
-
-%!demo
-%! hdl = figure (1234);
-%! clf ()
-%! subplot (2, 2, 1);
-%! hold on
-%! [C, H] = contourf (rand(10, 10));
-%! colorbar
-%! subplot (2, 2, 2);
-%! hold on
-%! quiver (rand(10, 10), rand(10, 10))
-%! subplot (2, 2, 3);
-%! colormap (jet (64))
-%! sombrero;
-%! colorbar('peer', gca, 'NorthOutside')
-%! subplot (2, 2, 4);
-%! imagesc (rand (30, 30));
-%! text (15, 15, 'Rotated text', ...
-%!      'HorizontAlalignment', 'Center', 'Rotation', 30);
-%! hout = copyobj (1234);
-
+%! assert (img1, img2);
+%! assert (map1, map2);
+%! assert (alpha1, alpha2);
--- a/scripts/plot/findfigs.m
+++ b/scripts/plot/findfigs.m
@@ -47,7 +47,7 @@
   screensize(3:4) -= margin;
 
   for i = 1:numel (figh)
-    if strcmp (get (figh(i), "visible"), "on")
+    if (strcmp (get (figh(i), "visible"), "on"))
 
       units = get (figh(i), "units");
       unwind_protect
--- a/scripts/plot/gco.m
+++ b/scripts/plot/gco.m
@@ -20,18 +20,18 @@
 ## @deftypefn  {Function File} {@var{h} =} gco ()
 ## @deftypefnx {Function File} {@var{h} =} gco (@var{fig})
 ## Return a handle to the current object of the current figure, or a handle
-## to the current object of the figure with handle @var{fig}. The current
-## object of a figure is the object that was last clicked on. It is stored
+## to the current object of the figure with handle @var{fig}.  The current
+## object of a figure is the object that was last clicked on.  It is stored
 ## in the CurrentObject property of the target figure.
 ##
 ## If the last mouse click didn't occur on any child object of the figure,
 ## the current object is the figure itself.
 ##
-## If no mouse click occured in the target figure, this function returns and
+## If no mouse click occured in the target figure, this function returns an
 ## empty matrix.
 ##
 ## Note that the value returned by this function is not necessarily the same
-## as the one returned by gcbo during callback execution. An executing
+## as the one returned by gcbo during callback execution.  An executing
 ## callback can be interrupted by another callback and the current object
 ## can be modified.
 ##
--- a/scripts/plot/hdl2struct.m
+++ b/scripts/plot/hdl2struct.m
@@ -15,8 +15,8 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn  {Function File} {@var{s} =} hdl2struct (@var{h})
-## Returns a structure, @var{s}, whose fields describe the properties
+## @deftypefn {Function File} {@var{s} =} hdl2struct (@var{h})
+## Return a structure, @var{s}, whose fields describe the properties
 ## of the object, and its children, associated with the handle, @var{h}.
 ## The fields of the structure, @var{s}, are "type", "handle", "properties",
 ## "children" and "special".
@@ -26,23 +26,24 @@
 ## Author: pdiribarne <pdiribarne@new-host.home>
 ## Created: 2012-03-04
 
-function hgS = hdl2struct (h)
+function s = hdl2struct (h)
+
   if (nargin != 1 || !ishandle (h))
     print_usage ();
   endif
 
   hiddenh = get (0, "showhiddenhandles");
-  if strcmp (hiddenh, "on")
+  if (strcmp (hiddenh, "on"))
     set (0, "showhiddenhandles", "off");
   endif
 
   ## main object
   main = get (h);
-  hgS.handle = h;
-  hgS.type =  main.type;
-  hgS.properties  = getprops (h);
-  hgS.children = [];
-  hgS.special = [];
+  s.handle = h;
+  s.type =  main.type;
+  s.properties  = getprops (h);
+  s.children = [];
+  s.special = [];
 
   ## sweep all children but legends, colorbars, uimenu and hggroup children
   ## in reverse order
@@ -52,11 +53,11 @@
   ui = findobj (h, "-depth", 1, "type", "uimenu");
   nkids = length (kids);
   ii = 0;
-  while nkids
-    if (! any (kids (nkids) == lg) && !any (kids (nkids) == cb)
-          && ! any (kids (nkids) == ui) && !strcmpi (main.type, "hggroup"))
+  while (nkids)
+    if (! any (kids (nkids) == lg) && ! any (kids (nkids) == cb)
+          && ! any (kids (nkids) == ui) && ! strcmp (main.type, "hggroup"))
       ii++;
-      hgS.children(ii) = hdl2struct(kids(nkids));
+      s.children(ii) = hdl2struct (kids(nkids));
     endif
     nkids--;
   endwhile
@@ -64,31 +65,31 @@
   ## add non "children" children objects (title, xlabel, ...) and
   ## hggroup children and tag theim in "special"
   special = [];
-  if (strcmpi (main.type, "hggroup"))
+  if (strcmp (main.type, "hggroup"))
     special = main.children;
   endif
   special = [special getspecial(h)];
   nsp = length (special);
-  while nsp
+  while (nsp)
     ii++;
-    hgS.children(ii) = hdl2struct (special(nsp));
-    hgS.special(nsp) = ii;
+    s.children(ii) = hdl2struct (special(nsp));
+    s.special(nsp) = ii;
     nsp--;
   endwhile
 
   ## look for legends and colorbars among "main"'s brothers and add them
   ## to the children list
-  if (strcmpi (main.type, "axes"))
+  if (strcmp (main.type, "axes"))
     par = main.parent;
     lg = findobj (par, "-depth", 1, "tag", "legend");
-    if !isempty (lg)
+    if (! isempty (lg))
       idx = arrayfun (@(x) get(x).userdata.handle(end) == h, lg);
-      lg = lg(find(idx));
+      lg = lg(find (idx));
     endif
     nlg = length (lg);
-    if nlg == 1
+    if (nlg == 1)
       ii++;
-      hgS.children(ii) = hdl2struct (lg);
+      s.children(ii) = hdl2struct (lg);
     elseif (nlg > 1)
       error ("hdl2struct: more than one legend found")
     endif
@@ -96,13 +97,13 @@
     cb = findobj (par, "-depth", 1, "tag", "colorbar");
     if (! isempty (cb))
       idx = arrayfun (@(x) get(x).axes == h, cb);
-      cb = cb(find(idx));
+      cb = cb(find (idx));
     endif
 
     ncb = length (cb);
     if (ncb == 1)
       ii++;
-      hgS.children(ii) = hdl2struct(cb);
+      s.children(ii) = hdl2struct (cb);
     elseif (nlg > 1)
       error ("hdl2struct: more than one colorbar found")
     endif
@@ -149,7 +150,7 @@
     prop = fields{nflds};
     val = obj.(fields{nflds});
     ii++;
-    if !any (strcmp (prop, forbid))
+    if (! any (strcmp (prop, forbid)))
       prpstr.(prop) = val;
     endif
     nflds--;
@@ -162,5 +163,8 @@
       prpstr.(hidden{ii}) = get (h, hidden{ii});
     endif
   endfor
+
 endfunction
 
+
+## FIXME: need validation tests
--- a/scripts/plot/plot.m
+++ b/scripts/plot/plot.m
@@ -205,5 +205,20 @@
 endfunction
 
 
-%% FIXME: Need demo or test for function
+%!demo
+%! x = 1:5;  y = 1:5;
+%! plot (x,y,'g');
+%! title ('plot of green line at 45 degrees');
 
+%!demo
+%! x = 1:5;  y = 1:5;
+%! plot (x,y,'g*');
+%! title ('plot of green stars along a line at 45 degrees');
+
+%!demo
+%! x1 = 1:5;  y1 = 1:5;
+%! x2 = 5:9; y2 = 5:-1:1;
+%! plot (x1,y1,'bo-', x2,y2,'rs-');
+%! axis ('tight');
+%! title ('plot of blue circles ascending and red squares descending with connecting lines drawn'); 
+
--- a/scripts/plot/slice.m
+++ b/scripts/plot/slice.m
@@ -104,7 +104,7 @@
     x = varargin{1};
     y = varargin{2};
     z = varargin{3};
-    if (isvector (x) && isvector (y) && isvector (z)]))
+    if (isvector (x) && isvector (y) && isvector (z))
       [x, y, z] = meshgrid (x, y, z);
     elseif (ndims (x) == 3 && size_equal (x, y, z))
       ## Do nothing.
--- a/scripts/plot/struct2hdl.m
+++ b/scripts/plot/struct2hdl.m
@@ -18,188 +18,187 @@
 ## @deftypefn  {Function File} {@var{h} =} struct2hdl (@var{s})
 ## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p})
 ## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p}, @var{hilev})
-## Constructs an object from the structure @var{s}. The structure must
-## contain the fields "handle", "type", "children", "properties", and
+## Construct a handle object @var{h} from the structure @var{s}.  The structure
+## must contain the fields "handle", "type", "children", "properties", and
 ## "special".  If the handle of an existing figure or axes is specified,
-## @var{p}, the new object will be created as a child to that object.
-## If no object handle is provided, then a new figure and the necessary
+## @var{p}, the new object will be created as a child of that object.
+## If no object handle is provided then a new figure and the necessary
 ## children will be constructed using the default object values from
 ## the root figure.
 ##
-## A third boolean argument @var{hilev} can be passed to specify wether
-## the function should try to preserve listeners/calbacks e.g for
-## legends or hggroups. Default is false.
-## @seealso{findobj, get, hdl2struct, set}
+## A third boolean argument @var{hilev} can be passed to specify whether
+## the function should try to preserve listeners/callbacks, e.g., for
+## legends or hggroups.  The default is false.
+## @seealso{hdl2struct, findobj, get, set}
 ## @end deftypefn
 
 ## Author: pdiribarne <pdiribarne@new-host.home>
 ## Created: 2012-03-04
 
-function [ h, matchout ] = struct2hdl (hgS, matchin=[], hilev = false)
+function [h, pout] = struct2hdl (s, p=[], hilev = false)
 
-  fields = { "handle", "type", "children", "properties", "special"};
+  fields = {"handle", "type", "children", "properties", "special"};
   partypes = {"root", "figure", "axes", "hggroup"};
   othertypes = {"line", "patch", "surface", "image", "text"};
   alltypes = [partypes othertypes];
 
-  if (nargin > 3 || ! isstruct (hgS))
+  if (nargin > 3 || ! isstruct (s))
     print_usage ();
-  elseif (! all (isfield (hgS, fields)))
+  elseif (! all (isfield (s, fields)))
     print_usage ();
-  elseif (isscalar (matchin))
-    if (! ishandle (matchin))
-      error ("struct2hdl: argument #2 is not a handle to graphic object")
+  elseif (isscalar (p))
+    if (! ishandle (p))
+      error ("struct2hdl: P is not a handle to a graphic object");
     endif
-    if (any (strcmp (get (matchin).type, partypes)))
-      paridx = find (strcmp (get (matchin).type, alltypes));
-      kididx = find (strcmp (hgS.type, alltypes));
+    if (any (strcmp (get (p).type, partypes)))
+      paridx = find (strcmp (get (p).type, alltypes));
+      kididx = find (strcmp (s.type, alltypes));
       if (kididx <= paridx)
-        error ("struct2hdl: incompatible input handles")
+        error ("struct2hdl: incompatible input handles");
       endif
     else
-      error ("struct2hdl: %s object can't be parent object", get (matchin).type)
+      error ("struct2hdl: %s object can't be parent object", get (p).type);
     endif
-    hpar = matchin;
-    matchin = [NaN; hpar];
+    hpar = p;
+    p = [NaN; hpar];
     ## create appropriate parent if needed
-    if (any (strcmp (hgS.type, othertypes)))
+    if (any (strcmp (s.type, othertypes)))
       for ii = (paridx+1) : (numel (partypes)-1)
         eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
-        matchin = [matchin [NaN; hpar]];
+        p = [p [NaN; hpar]];
       endfor
-    elseif (any (strcmp (hgS.type, {"hggroup", "axes"})))
+    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
       for ii = (paridx+1) : (kididx-1)
         eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
-        matchin = [matchin [NaN; hpar]];
+        p = [p [NaN; hpar]];
       endfor
     else
       par = NaN;
     endif
-  elseif (isempty (matchin))
-    if (any (strcmp (hgS.type, othertypes)))
+  elseif (isempty (p))
+    if (any (strcmp (s.type, othertypes)))
       par = axes ();
-    elseif (any (strcmp (hgS.type, {"hggroup", "axes"})))
+    elseif (any (strcmp (s.type, {"hggroup", "axes"})))
       par = figure ();
     else
       par = NaN;
     endif
-    matchin = [NaN; par];
+    p = [NaN; par];
   endif
-  ## read parent (last column) in matchin and remove it if duplicate
-  par = matchin (2,end);
-  tst = find (matchin (2,:) == par);
+  ## read parent (last column) in p and remove it if duplicate
+  par = p(2,end);
+  tst = find (p(2,:) == par);
   if (numel (tst) > 1)
-    matchin = matchin (1:2, 1:(tst(end)-1));
+    p = p(1:2, 1:(tst(end)-1));
   endif
 
   ## create object
-  if (strcmpi (hgS.type, "root"))
+  if (strcmp (s.type, "root"))
     h = 0;
-    hgS.properties = rmfield (hgS.properties, ...
+    s.properties = rmfield (s.properties, ...
                               {"callbackobject", "commandwindowsize", ...
                                "screendepth", "screenpixelsperinch", ...
                                "screensize"});
-  elseif (strcmpi (hgS.type, "figure"))
+  elseif (strcmp (s.type, "figure"))
     h = figure ();
-  elseif (strcmpi (hgS.type, "axes"))
+  elseif (strcmp (s.type, "axes"))
     ## legends and colorbars are "transformed" in normal axes
     ## if hilev is not requested
     if (! hilev)
-      if (strcmp (hgS.properties.tag, "legend"))
-        hgS.properties.tag = "";
-        hgS.properties.userdata = [];
+      if (strcmp (s.properties.tag, "legend"))
+        s.properties.tag = "";
+        s.properties.userdata = [];
         par = gcf;
-      elseif (strcmp (hgS.properties.tag, "colorbar"))
-        hgS.properties.tag = "";
-        hgS.properties.userdata = [];
+      elseif (strcmp (s.properties.tag, "colorbar"))
+        s.properties.tag = "";
+        s.properties.userdata = [];
         par = gcf;
       endif
     endif
 
-    [h, hgS] = createaxes (hgS, matchin, par);
-  elseif (strcmpi (hgS.type, "line"))
-    h = createline (hgS, par);
-  elseif (strcmpi (hgS.type, "patch"))
-    [h, hgS] = createpatch (hgS, par);
-  elseif (strcmpi (hgS.type, "text"))
-    h = createtext (hgS, par);
-  elseif (strcmpi (hgS.type, "image"))
-    h = createimage (hgS, par);
-  elseif (strcmpi (hgS.type, "surface"))
-    h = createsurface (hgS, par);
-  elseif (strcmpi (hgS.type, "hggroup"))
-    [h, hgS, matchin] = createhg (hgS, matchin, par, hilev);
+    [h, s] = createaxes (s, p, par);
+  elseif (strcmp (s.type, "line"))
+    h = createline (s, par);
+  elseif (strcmp (s.type, "patch"))
+    [h, s] = createpatch (s, par);
+  elseif (strcmp (s.type, "text"))
+    h = createtext (s, par);
+  elseif (strcmp (s.type, "image"))
+    h = createimage (s, par);
+  elseif (strcmp (s.type, "surface"))
+    h = createsurface (s, par);
+  elseif (strcmp (s.type, "hggroup"))
+    [h, s, p] = createhg (s, p, par, hilev);
   endif
 
   ## children
-  matchin = [matchin [hgS.handle; h]]; # [original; new]
-  kids = hgS.children;
+  p = [p [s.handle; h]];  # [original; new]
+  kids = s.children;
   nkids = length (kids);
   ii = 0;
-  while nkids
+  while (nkids)
     ii++;
-    if (! any (ii == hgS.special))
-      [h2, matchin] = struct2hdl (hgS.children(ii),
-                                  [matchin [hgS.handle; h]], hilev);
+    if (! any (ii == s.special))
+      [h2, p] = struct2hdl (s.children(ii), [p [s.handle; h]], hilev);
     endif
     nkids--;
   endwhile
 
   ## paste properties
-  setprops (hgS, h, matchin, hilev);
+  setprops (s, h, p, hilev);
 
-  matchout = matchin;
+  pout = p;
 
 endfunction
 
-function [h, hgSout] = createaxes (hgS, matchin, par);
+function [h, sout] = createaxes (s, p, par)
   ## regular axes
-  if (strcmpi (hgS.properties.tag, ""))
-    propval = {"position", hgS.properties.position};
+  if (strcmp (s.properties.tag, ""))
+    propval = {"position", s.properties.position};
     hid = {"autopos_tag", "looseinset"};
     for ii = 1:numel (hid)
       prop = hid{ii};
-      if (isfield (hgS.properties, prop))
-        val = hgS.properties.(prop);
+      if (isfield (s.properties, prop))
+        val = s.properties.(prop);
         propval = [propval, prop, val];
       endif
     endfor
     h = axes (propval{:}, "parent", par);
 
-    if isfield (hgS.properties, "__plotyy_axes__")
-      plty = hgS.properties.__plotyy_axes__;
-      addproperty ("__plotyy_axes__", h, "any")
-      tmp = [matchin [hgS.handle; h]];
-      tst = arrayfun (@(x) any (plty == x), tmp (1:2:end));
-      if sum (tst) == numel (plty)
+    if (isfield (s.properties, "__plotyy_axes__"))
+      plty = s.properties.__plotyy_axes__;
+      addproperty ("__plotyy_axes__", h, "any");
+      tmp = [p [s.handle; h]];
+      tst = arrayfun (@(x) any (plty == x), tmp(1:2:end));
+      if (sum (tst) == numel (plty))
         for ii = 1:numel (plty)
-          plty(ii) = tmp (find (tmp == plty(ii)) + 1);
+          plty(ii) = tmp(find (tmp == plty(ii)) + 1);
         endfor
         for ii = 1:numel (plty)
           set (plty(ii), "__plotyy_axes__", plty);
         endfor
       endif
-      hgS.properties = rmfield (hgS.properties, "__plotyy_axes__");
+      s.properties = rmfield (s.properties, "__plotyy_axes__");
     endif
 
     ## delete non-default and already set properties
-    fields = fieldnames (hgS.properties);
+    fields = fieldnames (s.properties);
     tst = cellfun (@(x) isprop (h, x), fields);
-    hgS.properties = rmfield (hgS.properties,  fields(find (tst == 0)));
+    s.properties = rmfield (s.properties, fields(find (tst == 0)));
 
-  elseif (strcmpi (hgS.properties.tag, "legend"))
+  elseif (strcmp (s.properties.tag, "legend"))
     ## legends
-    oldax = hgS.properties.userdata.handle;
-    idx = find (matchin == oldax);
-    newax = matchin(idx+1);
+    oldax = s.properties.userdata.handle;
+    idx = find (p == oldax);
+    newax = p(idx+1);
     strings = {};
-    kids = hgS.children;
-    kids(hgS.special) = [];
+    kids = s.children;
+    kids(s.special) = [];
     oldh = unique (arrayfun (@(x) x.properties.userdata(end), kids));
     for ii = 1:length (oldh)
-      idx = find (matchin(1:2:end) == oldh(ii)) * 2;
+      idx = find (p(1:2:end) == oldh(ii)) * 2;
       if (! isempty (idx))
-        newh(ii) = matchin (idx);
+        newh(ii) = p(idx);
         if (! strcmp (get (newh(ii), "type"), "hggroup"))
           str = get (newh(ii), "displayname");
           strings = [strings str];
@@ -208,93 +207,93 @@
           strings = [strings str];
         endif
       else
-        error ("struct2hdl: didn't find a legend item")
+        error ("struct2hdl: didn't find a legend item");
       endif
     endfor
-    location = hgS.properties.location;
-    orientation = hgS.properties.orientation;
-    textpos = hgS.properties.textposition;
-    box = hgS.properties.box;
+    location = s.properties.location;
+    orientation = s.properties.orientation;
+    textpos = s.properties.textposition;
+    box = s.properties.box;
 
     h = legend (newax, newh, strings, "location", location, ...
                 "orientation", orientation);
     set (h, "textposition", textpos); # bug makes "textposition"
-                                # redefine the legend
+                                      # redefine the legend
     h = legend (newax, newh, strings, "location", location, ...
                 "orientation", orientation);
     ## box
     if (strcmp (box, "on"))
-      legend boxon
+      legend ("boxon");
     endif
 
     ## visibility
     tst = arrayfun (@(x) strcmp (x.properties.visible, "on"), kids);
-    if !any (tst)
+    if (! any (tst))
       legend ("hide");
     endif
 
     ## remove all properties such as "textposition" that redefines
     ## the entire legend. Also remove chidren
-    hgS.properties = rmfield (hgS.properties, ...
-                                {"userdata", "xlabel",...
-                                 "ylabel", "zlabel", "location", ...
-                                 "title", "string","orientation", ...
-                                 "visible", "textposition"});
+    s.properties = rmfield (s.properties, ...
+                              {"userdata", "xlabel",...
+                               "ylabel", "zlabel", "location", ...
+                               "title", "string","orientation", ...
+                               "visible", "textposition"});
 
-    hgS.children = [];
+    s.children = [];
 
-  elseif (strcmpi (hgS.properties.tag, "colorbar"))
+  elseif (strcmp (s.properties.tag, "colorbar"))
     ## colorbar
-    oldax = hgS.properties.axes;
-    if (! isempty (idx = find (oldax == matchin)))
-      ax = matchin(idx+1);
-      location = hgS.properties.location;
+    oldax = s.properties.axes;
+    if (! isempty (idx = find (oldax == p)))
+      ax = p(idx+1);
+      location = s.properties.location;
       h = colorbar ("peer", ax, location);
-      hgS.properties = rmfield (hgS.properties, ...
-                              {"userdata", "xlabel" ...
-                               "ylabel", "zlabel", ...
-                               "title", "axes"});
-      hgS.children= [];
+      s.properties = rmfield (s.properties, ...
+                                {"userdata", "xlabel" ...
+                                 "ylabel", "zlabel", ...
+                                 "title", "axes"});
+      s.children= [];
     else
-      error ("hdl2struct: didn't find an object")
+      error ("hdl2struct: didn't find an object");
     endif
   endif
-  hgSout = hgS;
+  sout = s;
 endfunction
 
-function [h] = createline (hgS, par);
+function h = createline (s, par)
   h = line ("parent", par);
-  addmissingprops (h, hgS.properties);
+  addmissingprops (h, s.properties);
 endfunction
 
-function [h, hgSout] = createpatch (hgS, par);
-  prp.faces = hgS.properties.faces;
-  prp.vertices = hgS.properties.vertices;
-  prp.facevertexcdata = hgS.properties.facevertexcdata;
+function [h, sout] = createpatch (s, par)
+  prp.faces = s.properties.faces;
+  prp.vertices = s.properties.vertices;
+  prp.facevertexcdata = s.properties.facevertexcdata;
   h = patch (prp);
   set (h, "parent", par);
-  hgS.properties = rmfield (hgS.properties,
+  s.properties = rmfield (s.properties,
                             {"faces", "vertices", "facevertexcdata"});
-  addmissingprops (h, hgS.properties);
-  hgSout = hgS;
+  addmissingprops (h, s.properties);
+  sout = s;
 endfunction
 
-function [h] = createtext (hgS, par);
+function h = createtext (s, par)
   h = text ("parent", par);
-  addmissingprops (h, hgS.properties)
+  addmissingprops (h, s.properties);
 endfunction
 
-function [h] = createimage (hgS, par);
+function h = createimage (s, par)
   h = image ("parent", par);
-  addmissingprops (h, hgS.properties)
+  addmissingprops (h, s.properties);
 endfunction
 
-function [h] = createsurface (hgS, par);
+function h = createsurface (s, par)
   h = surface ("parent", par);
-  addmissingprops (h, hgS.properties)
+  addmissingprops (h, s.properties);
 endfunction
 
-function [h, hgSout, matchout] = createhg (hgS, matchin, par, hilev)
+function [h, sout, pout] = createhg (s, p, par, hilev)
   ## Here we infer from properties the type of hggroup we should build
   ## an call corresponding high level functions
   ## We manually set "hold on" to avoid next hggroup be deleted
@@ -302,57 +301,57 @@
 
   hold on;
   if (hilev)
-    [h, hgS, matchin] = createhg_hilev (hgS, matchin, par);
-    if (numel (hgS.children) != numel (get (h).children))
-      warning (["struct2hdl: couldn't infer the hggroup type. ", ...
+    [h, s, p] = createhg_hilev (s, p, par);
+    if (numel (s.children) != numel (get (h).children))
+      warning (["struct2hdl: could not infer the hggroup type. ", ...
                 "Will build objects but listener/callback functions ", ...
                 "will be lost"]);
-      if isfield (h, "bargroup")
+      if (isfield (h, "bargroup"))
         delete (get (h).bargroup);
       else
         delete (h);
       endif
       h = hggroup ("parent", par);
-      addmissingprops (h, hgS.properties);
-      hgS.special = [];
+      addmissingprops (h, s.properties);
+      s.special = [];
     else
-      oldkids = hgS.children;
+      oldkids = s.children;
       newkids = get (h).children;
       nkids = numel (oldkids);
       ii = 1;
-      while nkids
-        matchin = [matchin [oldkids(ii++).handle; newkids(nkids--)]];
+      while (nkids)
+        p = [p [oldkids(ii++).handle; newkids(nkids--)]];
       endwhile
     endif
   else
     h = hggroup ("parent", par);
-    addmissingprops (h, hgS.properties);
-    hgS.special = [];
+    addmissingprops (h, s.properties);
+    s.special = [];
   endif
-  hgSout = hgS;
-  matchout = matchin;
+  sout = s;
+  pout = p;
 endfunction
 
-function [h, hgSout, matchout] = createhg_hilev (hgS, matchin, par)
-  fields = hgS.properties;
+function [h, sout, pout] = createhg_hilev (s, p, par)
+  fields = s.properties;
   if (isfield (fields, "contourmatrix"))
     ## contours
-    xdata = hgS.properties.xdata;
-    ydata = hgS.properties.ydata;
-    zdata = hgS.properties.zdata;
-    levellist = hgS.properties.levellist;
-    textlist = hgS.properties.textlist;
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    zdata = s.properties.zdata;
+    levellist = s.properties.levellist;
+    textlist = s.properties.textlist;
 
     ## contour creation
-    if (isempty (hgS.children(1).properties.zdata))
-      if (strcmpi (hgS.properties.fill, "on"))
+    if (isempty (s.children(1).properties.zdata))
+      if (strcmpi (s.properties.fill, "on"))
         [cm2, h] = contourf (xdata, ydata, zdata, levellist);
       else
         [cm2, h] = contour (xdata, ydata, zdata, levellist);
       endif
 
       ## labels
-      if (strcmpi (hgS.properties.showtext, "on"))
+      if (strcmpi (s.properties.showtext, "on"))
         clabel (cm2, h, textlist);
       endif
     else
@@ -360,7 +359,7 @@
     endif
 
     ## delete already set properties and children
-    hgS.properties = rmfield (hgS.properties, ...
+    s.properties = rmfield (s.properties, ...
                               {"xdata", "ydata", "zdata", ...
                                "contourmatrix", "levellist", ...
                                "fill", "labelspacing", ...
@@ -372,16 +371,16 @@
 
   elseif (isfield (fields, "udata") && isfield (fields, "vdata"))
     ## quiver
-    xdata = hgS.properties.xdata;
-    ydata = hgS.properties.ydata;
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
 
-    udata = hgS.properties.udata;
-    vdata = hgS.properties.vdata;
+    udata = s.properties.udata;
+    vdata = s.properties.vdata;
 
     h = quiver (xdata, ydata, udata, vdata);
 
     ## delete already set properties and children
-    hgS.properties = rmfield (hgS.properties, ...
+    s.properties = rmfield (s.properties, ...
                               {"xdata", "ydata", "zdata", ...
                                "xdatasource", "ydatasource", "zdatasource", ...
                                "udata", "vdata", "wdata", ...
@@ -389,13 +388,13 @@
 
   elseif (isfield (fields, "format"))
     ##errorbar
-    form = hgS.properties.format;
-    xdata = hgS.properties.xdata;
-    ydata = hgS.properties.ydata;
-    xldata = hgS.properties.xldata;
-    ldata = hgS.properties.ldata;
-    xudata = hgS.properties.xudata;
-    udata = hgS.properties.udata;
+    form = s.properties.format;
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    xldata = s.properties.xldata;
+    ldata = s.properties.ldata;
+    xudata = s.properties.xudata;
+    udata = s.properties.udata;
 
     switch form
       case "xerr"
@@ -411,10 +410,10 @@
       case "boxxy"
         h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "#~>");
       otherwise
-        error ("struct2hdl: couldn't guess the errorbar format")
+        error ("struct2hdl: couldn't guess the errorbar format");
     endswitch
     ## delete already set properties
-    hgS.properties = rmfield (hgS.properties, ...
+    s.properties = rmfield (s.properties, ...
                               {"xdata", "ydata", ...
                                "xldata", "ldata", ...
                                "xudata", "udata", ...
@@ -429,20 +428,20 @@
     ## and rebuild the whole bargroup.
     ## The duplicate are deleted after calling "setprops"
 
-    bargroup = hgS.properties.bargroup;
-    oldh = hgS.handle;
+    bargroup = s.properties.bargroup;
+    oldh = s.handle;
 
-    temp = arrayfun (@(x) any(x == bargroup), [matchin(1:2:end) oldh]);
+    temp = arrayfun (@(x) any(x == bargroup), [p(1:2:end) oldh]);
     tst = sum (temp) == length (bargroup);
 
     if (isscalar (bargroup) || !tst)
-      xdata = hgS.properties.xdata;
-      ydata = hgS.properties.ydata;
+      xdata = s.properties.xdata;
+      ydata = s.properties.ydata;
 
       h = bar (xdata, ydata);
 
       ## delete already set properties,
-      hgS.properties = rmfield (hgS.properties, ...
+      s.properties = rmfield (s.properties, ...
                                 {"xdata", "ydata", ...
                                  "xdatasource", "ydatasource", ...
                                  "bargroup", ...
@@ -453,18 +452,18 @@
 
       ##build x/y matrix
       nbar = length (bargroup);
-      tmp = struct ("handle", NaN,"type", "", "children", [], "special", []);
+      tmp = struct ("handle", NaN, "type", "", "children", [], "special", []);
       for ii = 1:(nbar - 1)
-        idx = find (matchin(1:2:end) == bargroup(ii)) * 2;
-        hdl = matchin (idx);
+        idx = find (p(1:2:end) == bargroup(ii)) * 2;
+        hdl = p (idx);
         xdata = [xdata get(hdl).xdata];
         ydata = [ydata get(hdl).ydata];
         tmp.children(ii) = hdl2struct (hdl);
       endfor
 
-      xdata = [xdata hgS.properties.xdata];
-      ydata = [ydata hgS.properties.ydata];
-      width = hgS.properties.barwidth;
+      xdata = [xdata s.properties.xdata];
+      ydata = [ydata s.properties.ydata];
+      width = s.properties.barwidth;
       h = bar (ydata, width);
 
       ## replace previous handles in "match", copy props and delete redundant
@@ -472,82 +471,82 @@
         props = tmp.children(ii).properties;
         bl = props.baseline;
         tmp.children(ii).properties = rmfield (props, {"baseline", "bargroup"});
-        setprops (tmp.children(ii), h(ii), matchin, 1);
+        setprops (tmp.children(ii), h(ii), p, 1);
         delete (tmp.children(ii).handle);
         delete (bl);
-        idxpar = find (matchin == tmp.children(ii).handle);
-        matchin (idxpar) = h(ii);
+        idxpar = find (p == tmp.children(ii).handle);
+        p(idxpar) = h(ii);
         idxkid = idxpar - 2;
-        matchin (idxkid) = get (h(ii), "children");
+        p(idxkid) = get (h(ii), "children");
       endfor
-      matchin (2,((end-nbar+2):end)) = h (1:(end-1));
-      h = h (end);
+      p(2,((end-nbar+2):end)) = h(1:(end-1));
+      h = h(end);
 
       ## delete already set properties ,
-      hgS.properties = rmfield (hgS.properties, ...
+      s.properties = rmfield (s.properties, ...
                                 {"xdata", "ydata", "bargroup"...
                                  "barwidth", "baseline"});
     endif
   elseif (isfield (fields, "baseline"))
     ## stem plot
-    xdata = hgS.properties.xdata;
-    ydata = hgS.properties.ydata;
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
 
     h = stem (xdata, ydata);
 
     ## delete already set properties,
-    hgS.properties = rmfield (hgS.properties, ...
+    s.properties = rmfield (s.properties, ...
                               {"xdata", "ydata", ...
                                "xdatasource", "ydatasource", ...
                                "baseline"});
   elseif (isfield (fields, "basevalue"))
     ## area plot
-    xdata = hgS.properties.xdata;
-    ydata = hgS.properties.ydata;
-    level = hgS.properties.basevalue;
+    xdata = s.properties.xdata;
+    ydata = s.properties.ydata;
+    level = s.properties.basevalue;
 
     h = area (xdata, ydata, level);
 
     ## delete already set properties,
-    hgS.properties = rmfield (hgS.properties, ...
+    s.properties = rmfield (s.properties, ...
                               {"xdata", "ydata", ...
                                "xdatasource", "ydatasource"});
   else
-    warning ("struct2hdl: couldn't infer the hggroup type. Will build objects but listener/callback functions will be lost");
+    warning ("struct2hdl: could not infer the hggroup type. Will build objects but listener/callback functions will be lost");
     h = hggroup ("parent", par);
-    addmissingprops (h, hgS.properties);
-    hgS.special = [];           # children will be treated as normal children
+    addmissingprops (h, s.properties);
+    s.special = [];           # children will be treated as normal children
   endif
-  hgSout = hgS;
-  matchout = matchin;
+  sout = s;
+  pout = p;
 endfunction
 
-function setprops (hgS, h, matchin, hilev)
-  more off
-  if (strcmpi (hgS.properties.tag, ""))
-    specs = hgS.children(hgS.special);
+function setprops (s, h, p, hilev)
+  more off;
+  if (strcmpi (s.properties.tag, ""))
+    specs = s.children(s.special);
     hdls = arrayfun (@(x) x.handle, specs);
-    nh = length(hdls);
+    nh = length (hdls);
     msg = "";
     if (! nh)
-      set (h, hgS.properties);
+      set (h, s.properties);
     else
       ## Specials are objects that where automatically constructed with
       ## current object. Among them are "x(yz)labels", "title", high
       ## level hggroup children
-      fields = fieldnames (hgS.properties);
-      vals = struct2cell (hgS.properties);
+      fields = fieldnames (s.properties);
+      vals = struct2cell (s.properties);
       idx = find (cellfun (@(x) valcomp(x, hdls) , vals));
-      hgS.properties = rmfield (hgS.properties, fields(idx));
+      s.properties = rmfield (s.properties, fields(idx));
 
       ## set all properties but special handles
-      set (h, hgS.properties);
+      set (h, s.properties);
 
       ## find  props with val == (one of special handles)
       nf = length (idx);
       fields = fields(idx);
       vals = vals(idx);
-      while nf
+      while (nf)
         field = fields{nf};
         idx = find (hdls == vals{nf});
         spec = specs(idx);
@@ -561,39 +560,39 @@
       ## If hggroup children  were created by high level functions,
       ## copy only usefull properties.
       if (hilev)
-        if (strcmpi (hgS.type, "hggroup"))
-          nold = numel (hgS.children);
-          nnew = numel (get(h).children);
+        if (strcmp (s.type, "hggroup"))
+          nold = numel (s.children);
+          nnew = numel (get (h).children);
 
           if (nold == nnew)
-            hnew = get(h).children;
+            hnew = get (h).children;
             ii = 1;
-            while ii <= nnew
+            while (ii <= nnew)
               try
                 set (hnew (ii), "displayname", ...
-                     hgS.children(ii).properties.displayname);
+                     s.children(ii).properties.displayname);
               catch
-                sprintf ("struct2hdl: couldn't set hggroup children #%d props.", ii)
+                sprintf ("struct2hdl: couldn't set hggroup children #%d props.", ii);
               end_try_catch
               ii ++;
             endwhile
 
           else
-            error ("struct2hdl: non-conformant number of children in hgggroup")
+            error ("struct2hdl: non-conformant number of children in hgggroup");
           endif
         endif
       endif
     endif
 
-  elseif (strcmpi (hgS.properties.tag, "legend")
-          || strcmpi (hgS.properties.tag, "colorbar"))
-    set (h, hgS.properties);
+  elseif (strcmpi (s.properties.tag, "legend")
+          || strcmpi (s.properties.tag, "colorbar"))
+    set (h, s.properties);
   endif
 
 endfunction
 
 function out = valcomp (x, hdls)
-  if (isfloat(x) && isscalar(x))
+  if (isfloat (x) && isscalar (x))
     out = any (x == hdls);
   else
     out = 0;
@@ -606,10 +605,13 @@
   curfields = fieldnames (get (h));
   missing = cellfun (@(x) !any (strcmp (x, curfields)), oldfields);
   idx = find (missing);
-  for ii = 1:length(idx)
+  for ii = 1:length (idx)
     prop = oldfields{idx(ii)};
     if (! any (strcmp (prop, hid)))
       addproperty (prop, h, "any");
     endif
   endfor
 endfunction
+
+
+## FIXME: Need validation tests
--- a/scripts/plot/uigetfile.m
+++ b/scripts/plot/uigetfile.m
@@ -81,7 +81,7 @@
     error ("uigetfile: number of input arguments must be less than eight");
   endif
 
-  defaultvals = {cell (0, 2),        # File Filter
+  defaultvals = {cell(0, 2),         # File Filter
                  "Open File",        # Dialog Title
                  "",                 # Default file name
                  [240, 120],         # Dialog Position (pixel x/y)
--- a/scripts/plot/uiputfile.m
+++ b/scripts/plot/uiputfile.m
@@ -72,7 +72,7 @@
     print_usage ();
   endif
 
-  defaultvals = {cell (0, 2),    # File Filter
+  defaultvals = {cell(0, 2),     # File Filter
                  "Save File",    # Dialog Title
                  "",             # Default file name
                  [240, 120],     # Dialog Position (pixel x/y)
--- a/scripts/testfun/test.m
+++ b/scripts/testfun/test.m
@@ -334,10 +334,6 @@
                          __signal_fail);
       end_try_catch
 
-      ## Clear shared function definitions.
-      eval (__clear, "");
-      __clear = "";
-
       ## Initialization code will be evaluated below.
 
 ### FUNCTION
@@ -555,6 +551,7 @@
     __tests += __istest;
     __successes += __success * __istest;
   endfor
+  ## Clear any test functions created
   eval (__clear, "");
 
   if (nargout == 0)
--- a/src/DLD-FUNCTIONS/ccolamd.cc
+++ b/src/DLD-FUNCTIONS/ccolamd.cc
@@ -164,53 +164,53 @@
           int nel_User_knobs = User_knobs.length ();
 
           if (nel_User_knobs > 0)
-            knobs [CCOLAMD_LU] = (User_knobs (0) != 0);
+            knobs[CCOLAMD_LU] = (User_knobs(0) != 0);
           if (nel_User_knobs > 1)
-            knobs [CCOLAMD_DENSE_ROW]  = User_knobs (1);
+            knobs[CCOLAMD_DENSE_ROW] = User_knobs(1);
           if (nel_User_knobs > 2)
-            knobs [CCOLAMD_DENSE_COL]  = User_knobs (2);
+            knobs[CCOLAMD_DENSE_COL] = User_knobs(2);
           if (nel_User_knobs > 3)
-            knobs [CCOLAMD_AGGRESSIVE] = (User_knobs (3) != 0);
+            knobs[CCOLAMD_AGGRESSIVE] = (User_knobs(3) != 0);
           if (nel_User_knobs > 4)
-            spumoni = (User_knobs (4) != 0);
+            spumoni = (User_knobs(4) != 0);
 
           // print knob settings if spumoni is set
           if (spumoni)
             {
               octave_stdout << "\nccolamd version " << CCOLAMD_MAIN_VERSION << "."
                             <<  CCOLAMD_SUB_VERSION << ", " << CCOLAMD_DATE
-                            << ":\nknobs(1): " << User_knobs (0) << ", order for ";
-              if ( knobs [CCOLAMD_LU] != 0)
+                            << ":\nknobs(1): " << User_knobs(0) << ", order for ";
+              if (knobs[CCOLAMD_LU] != 0)
                 octave_stdout << "lu (A)\n";
               else
                 octave_stdout << "chol (A'*A)\n";
 
-              if (knobs [CCOLAMD_DENSE_ROW] >= 0)
-                octave_stdout << "knobs(2): " << User_knobs (1)
+              if (knobs[CCOLAMD_DENSE_ROW] >= 0)
+                octave_stdout << "knobs(2): " << User_knobs(1)
                               << ", rows with > max (16,"
-                              << knobs [CCOLAMD_DENSE_ROW] << "*sqrt (size(A,2)))"
+                              << knobs[CCOLAMD_DENSE_ROW] << "*sqrt (size(A,2)))"
                               << " entries removed\n";
               else
-                octave_stdout << "knobs(2): " << User_knobs (1)
+                octave_stdout << "knobs(2): " << User_knobs(1)
                               << ", no dense rows removed\n";
 
-              if (knobs [CCOLAMD_DENSE_COL] >= 0)
-                octave_stdout << "knobs(3): " << User_knobs (2)
+              if (knobs[CCOLAMD_DENSE_COL] >= 0)
+                octave_stdout << "knobs(3): " << User_knobs(2)
                               << ", cols with > max (16,"
-                              << knobs [CCOLAMD_DENSE_COL] << "*sqrt (size(A)))"
+                              << knobs[CCOLAMD_DENSE_COL] << "*sqrt (size(A)))"
                               << " entries removed\n";
               else
-                octave_stdout << "knobs(3): " << User_knobs (2)
+                octave_stdout << "knobs(3): " << User_knobs(2)
                               << ", no dense columns removed\n";
 
-              if (knobs [CCOLAMD_AGGRESSIVE] != 0)
+              if (knobs[CCOLAMD_AGGRESSIVE] != 0)
                 octave_stdout << "knobs(4): " << User_knobs(3)
                               << ", aggressive absorption: yes";
               else
                 octave_stdout << "knobs(4): " << User_knobs(3)
                               << ", aggressive absorption: no";
 
-              octave_stdout << "knobs(5): " << User_knobs (4)
+              octave_stdout << "knobs(5): " << User_knobs(4)
                             << ", statistics and knobs printed\n";
             }
         }
@@ -259,12 +259,12 @@
       // Allocate workspace for ccolamd
       OCTAVE_LOCAL_BUFFER (octave_idx_type, p, n_col+1);
       for (octave_idx_type i = 0; i < n_col+1; i++)
-        p[i] = cidx [i];
+        p[i] = cidx[i];
 
       octave_idx_type Alen = CCOLAMD_NAME (_recommended) (nnz, n_row, n_col);
       OCTAVE_LOCAL_BUFFER (octave_idx_type, A, Alen);
       for (octave_idx_type i = 0; i < nnz; i++)
-        A[i] = ridx [i];
+        A[i] = ridx[i];
 
       OCTAVE_LOCAL_BUFFER (octave_idx_type, stats, CCOLAMD_STATS);
 
@@ -315,7 +315,7 @@
         {
           NDArray out_stats (dim_vector (1, CCOLAMD_STATS));
           for (octave_idx_type i = 0 ; i < CCOLAMD_STATS ; i++)
-            out_stats (i) = stats [i] ;
+            out_stats(i) = stats[i] ;
           retval(1) = out_stats;
 
           // fix stats (5) and (6), for 1-based information on
@@ -419,11 +419,11 @@
           int nel_User_knobs = User_knobs.length ();
 
           if (nel_User_knobs > 0)
-            knobs [CCOLAMD_DENSE_ROW] = User_knobs (0);
+            knobs[CCOLAMD_DENSE_ROW] = User_knobs(0);
           if (nel_User_knobs > 0)
-            knobs [CCOLAMD_AGGRESSIVE] = User_knobs (1);
+            knobs[CCOLAMD_AGGRESSIVE] = User_knobs(1);
           if (nel_User_knobs > 1)
-            spumoni = static_cast<int> (User_knobs (2));
+            spumoni = static_cast<int> (User_knobs(2));
 
           // print knob settings if spumoni is set
           if (spumoni)
@@ -431,16 +431,16 @@
               octave_stdout << "\ncsymamd version " << CCOLAMD_MAIN_VERSION << "."
                             <<  CCOLAMD_SUB_VERSION << ", " << CCOLAMD_DATE << "\n";
 
-              if (knobs [CCOLAMD_DENSE_ROW] >= 0)
-                octave_stdout << "knobs(1): " << User_knobs (0)
+              if (knobs[CCOLAMD_DENSE_ROW] >= 0)
+                octave_stdout << "knobs(1): " << User_knobs(0)
                               << ", rows/cols with > max (16,"
-                              << knobs [CCOLAMD_DENSE_ROW] << "*sqrt (size(A,2)))"
+                              << knobs[CCOLAMD_DENSE_ROW] << "*sqrt (size(A,2)))"
                               << " entries removed\n";
               else
-                octave_stdout << "knobs(1): " << User_knobs (0)
+                octave_stdout << "knobs(1): " << User_knobs(0)
                               << ", no dense rows/cols removed\n";
 
-              if (knobs [CCOLAMD_AGGRESSIVE] != 0)
+              if (knobs[CCOLAMD_AGGRESSIVE] != 0)
                 octave_stdout << "knobs(2): " << User_knobs(1)
                               << ", aggressive absorption: yes";
               else
@@ -448,7 +448,7 @@
                               << ", aggressive absorption: no";
 
 
-              octave_stdout << "knobs(3): " << User_knobs (2)
+              octave_stdout << "knobs(3): " << User_knobs(2)
                             << ", statistics and knobs printed\n";
             }
         }
@@ -543,7 +543,7 @@
         {
           NDArray out_stats (dim_vector (1, CCOLAMD_STATS));
           for (octave_idx_type i = 0 ; i < CCOLAMD_STATS ; i++)
-            out_stats (i) = stats [i] ;
+            out_stats(i) = stats[i] ;
           retval(1) = out_stats;
 
           // fix stats (5) and (6), for 1-based information on
@@ -562,7 +562,7 @@
         {
           NDArray out_stats (dim_vector (1, CCOLAMD_STATS));
           for (octave_idx_type i = 0 ; i < CCOLAMD_STATS ; i++)
-            out_stats (i) = stats [i] ;
+            out_stats(i) = stats[i] ;
           retval(1) = out_stats;
 
           // fix stats (5) and (6), for 1-based information on
--- a/src/DLD-FUNCTIONS/colamd.cc
+++ b/src/DLD-FUNCTIONS/colamd.cc
@@ -63,28 +63,28 @@
   if (P)
     // If P is present then compute Pinv, the inverse of P
     for (octave_idx_type k = 0 ; k < n ; k++)
-      Pinv [P [k]] = k ;
+      Pinv[P[k]] = k ;
 
   for (octave_idx_type k = 0 ; k < n ; k++)
     {
       // L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k)
-      Parent [k] = n ;                // parent of k is not yet known
-      Flag [k] = k ;                  // mark node k as visited
-      octave_idx_type kk = (P) ? (P [k]) : (k) ;  // kth original, or permuted, column
-      octave_idx_type p2 = cidx [kk+1] ;
-      for (octave_idx_type p = cidx [kk] ; p < p2 ; p++)
+      Parent[k] = n ;                // parent of k is not yet known
+      Flag[k] = k ;                  // mark node k as visited
+      octave_idx_type kk = (P) ? (P[k]) : (k) ;  // kth original, or permuted, column
+      octave_idx_type p2 = cidx[kk+1] ;
+      for (octave_idx_type p = cidx[kk] ; p < p2 ; p++)
         {
           // A (i,k) is nonzero (original or permuted A)
-          octave_idx_type i = (Pinv) ? (Pinv [ridx [p]]) : (ridx [p]) ;
+          octave_idx_type i = (Pinv) ? (Pinv[ridx[p]]) : (ridx[p]) ;
           if (i < k)
             {
               // follow path from i to root of etree, stop at flagged node
-              for ( ; Flag [i] != k ; i = Parent [i])
+              for ( ; Flag[i] != k ; i = Parent[i])
                 {
                   // find parent of i if not yet determined
-                  if (Parent [i] == n)
-                    Parent [i] = k ;
-                  Flag [i] = k ;        // mark i as visited
+                  if (Parent[i] == n)
+                    Parent[i] = k ;
+                  Flag[i] = k ;        // mark i as visited
                 }
             }
         }
@@ -299,11 +299,11 @@
           int nel_User_knobs = User_knobs.length ();
 
           if (nel_User_knobs > 0)
-            knobs [COLAMD_DENSE_ROW] = User_knobs (0);
+            knobs[COLAMD_DENSE_ROW] = User_knobs(0);
           if (nel_User_knobs > 1)
-            knobs [COLAMD_DENSE_COL] = User_knobs (1) ;
+            knobs[COLAMD_DENSE_COL] = User_knobs(1) ;
           if (nel_User_knobs > 2)
-            spumoni = static_cast<int> (User_knobs (2));
+            spumoni = static_cast<int> (User_knobs(2));
 
           // print knob settings if spumoni is set
           if (spumoni)
@@ -312,19 +312,19 @@
               octave_stdout << "\ncolamd version " << COLAMD_MAIN_VERSION << "."
                             <<  COLAMD_SUB_VERSION << ", " << COLAMD_DATE << ":\n";
 
-              if (knobs [COLAMD_DENSE_ROW] >= 0)
+              if (knobs[COLAMD_DENSE_ROW] >= 0)
                 octave_stdout << "knobs(1): " << User_knobs (0)
                               << ", rows with > max (16,"
-                              << knobs [COLAMD_DENSE_ROW] << "*sqrt (size(A,2)))"
+                              << knobs[COLAMD_DENSE_ROW] << "*sqrt (size(A,2)))"
                               << " entries removed\n";
               else
                 octave_stdout << "knobs(1): " << User_knobs (0)
                               << ", only completely dense rows removed\n";
 
-              if (knobs [COLAMD_DENSE_COL] >= 0)
+              if (knobs[COLAMD_DENSE_COL] >= 0)
                 octave_stdout << "knobs(2): " << User_knobs (1)
                               << ", cols with > max (16,"
-                              << knobs [COLAMD_DENSE_COL] << "*sqrt (size(A)))"
+                              << knobs[COLAMD_DENSE_COL] << "*sqrt (size(A)))"
                               << " entries removed\n";
               else
                 octave_stdout << "knobs(2): " << User_knobs (1)
@@ -380,12 +380,12 @@
       // Allocate workspace for colamd
       OCTAVE_LOCAL_BUFFER (octave_idx_type, p, n_col+1);
       for (octave_idx_type i = 0; i < n_col+1; i++)
-        p[i] = cidx [i];
+        p[i] = cidx[i];
 
       octave_idx_type Alen = COLAMD_NAME (_recommended) (nnz, n_row, n_col);
       OCTAVE_LOCAL_BUFFER (octave_idx_type, A, Alen);
       for (octave_idx_type i = 0; i < nnz; i++)
-        A[i] = ridx [i];
+        A[i] = ridx[i];
 
       // Order the columns (destroys A)
       OCTAVE_LOCAL_BUFFER (octave_idx_type, stats, COLAMD_STATS);
@@ -415,7 +415,7 @@
       // return the permutation vector
       NDArray out_perm (dim_vector (1, n_col));
       for (octave_idx_type i = 0; i < n_col; i++)
-        out_perm(i) = p[colbeg [i]] + 1;
+        out_perm(i) = p[colbeg[i]] + 1;
 
       retval(0) = out_perm;
 
@@ -428,7 +428,7 @@
         {
           NDArray out_stats (dim_vector (1, COLAMD_STATS));
           for (octave_idx_type i = 0 ; i < COLAMD_STATS ; i++)
-            out_stats (i) = stats [i] ;
+            out_stats(i) = stats[i] ;
           retval(1) = out_stats;
 
           // fix stats (5) and (6), for 1-based information on
@@ -534,7 +534,7 @@
           int nel_User_knobs = User_knobs.length ();
 
           if (nel_User_knobs > 0)
-            knobs [COLAMD_DENSE_ROW] = User_knobs (COLAMD_DENSE_ROW);
+            knobs[COLAMD_DENSE_ROW] = User_knobs(COLAMD_DENSE_ROW);
           if (nel_User_knobs > 1)
             spumoni = static_cast<int> (User_knobs (1));
         }
@@ -542,7 +542,7 @@
       // print knob settings if spumoni is set
       if (spumoni > 0)
         octave_stdout << "symamd: dense row/col fraction: "
-                      << knobs [COLAMD_DENSE_ROW] << std::endl;
+                      << knobs[COLAMD_DENSE_ROW] << std::endl;
 
       octave_idx_type n_row, n_col;
       octave_idx_type *ridx, *cidx;
@@ -608,7 +608,7 @@
       // return the permutation vector
       NDArray out_perm (dim_vector (1, n_col));
       for (octave_idx_type i = 0; i < n_col; i++)
-        out_perm(i) = perm[post [i]] + 1;
+        out_perm(i) = perm[post[i]] + 1;
 
       retval(0) = out_perm;
 
@@ -621,7 +621,7 @@
         {
           NDArray out_stats (dim_vector (1, COLAMD_STATS));
           for (octave_idx_type i = 0 ; i < COLAMD_STATS ; i++)
-            out_stats (i) = stats [i] ;
+            out_stats(i) = stats[i] ;
           retval(1) = out_stats;
 
           // fix stats (5) and (6), for 1-based information on
--- a/src/DLD-FUNCTIONS/config-module.awk
+++ b/src/DLD-FUNCTIONS/config-module.awk
@@ -52,7 +52,7 @@
   }
   print "else";
   print "";
-  print "noinst_LTLIBRARIES = $(DLD_FUNCTIONS_LIBS)";
+  print "noinst_LTLIBRARIES += $(DLD_FUNCTIONS_LIBS)";
   print "";
   print "endif";
 
--- a/src/DLD-FUNCTIONS/eigs.cc
+++ b/src/DLD-FUNCTIONS/eigs.cc
@@ -258,6 +258,7 @@
 default is @code{1:@var{n}}.\n\
 \n\
 @end table\n\
+\n\
 It is also possible to represent @var{A} by a function denoted @var{af}.\n\
 @var{af} must be followed by a scalar argument @var{n} defining the length\n\
 of the vector argument accepted by @var{af}.  @var{af} can be\n\
--- a/src/DLD-FUNCTIONS/module-files
+++ b/src/DLD-FUNCTIONS/module-files
@@ -1,83 +1,22 @@
 # FILE|CPPFLAGS|LDFLAGS|LIBRARIES
-__contourc__.cc
+chol.cc
 __delaunayn__.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS)
-__dispatch__.cc
 __dsearchn__.cc
 __fltk_uigetfile__.cc|$(GRAPHICS_CFLAGS) $(FT2_CPPFLAGS)|$(GRAPHICS_LDFLAGS) $(FT2_LDFLAGS)|$(GRAPHICS_LIBS) $(FT2_LIBS)
 __glpk__.cc|$(GLPK_CPPFLAGS)|$(GLPK_LDFLAGS)|$(GLPK_LIBS)
 __init_fltk__.cc|$(GRAPHICS_CFLAGS) $(FT2_CPPFLAGS)|$(GRAPHICS_LDFLAGS) $(FT2_LDFLAGS)|$(GRAPHICS_LIBS) $(FT2_LIBS)
 __init_gnuplot__.cc
-__lin_interpn__.cc
 __magick_read__.cc|$(MAGICK_CPPFLAGS)|$(MAGICK_LDFLAGS)|$(MAGICK_LIBS)
-__pchip_deriv__.cc
-__qp__.cc
 __voronoi__.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS)
 amd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
-balance.cc
-besselj.cc
-betainc.cc
-bsxfun.cc
 ccolamd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
-cellfun.cc
-chol.cc|$(QRUPDATE_CPPFLAGS) $(SPARSE_XCPPFLAGS)|$(QRUPDATE_LDFLAGS) $(SPARSE_XLDFLAGS)|$(QRUPDATE_LIBS) $(SPARSE_XLIBS)
 colamd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
-colloc.cc
-conv2.cc
 convhulln.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS)
-daspk.cc
-dasrt.cc
-dassl.cc
-det.cc
-dlmread.cc
 dmperm.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
-dot.cc
-eig.cc
 eigs.cc|$(ARPACK_CPPFLAGS) $(SPARSE_XCPPFLAGS)|$(ARPACK_LDFLAGS) $(SPARSE_XLDFLAGS)|$(ARPACK_LIBS) $(SPARSE_XLIBS) $(LAPACK_LIBS) $(BLAS_LIBS)
-fft.cc|$(FFTW_XCPPFLAGS)|$(FFTW_XLDFLAGS)|$(FFTW_XLIBS)
-fft2.cc|$(FFTW_XCPPFLAGS)|$(FFTW_XLDFLAGS)|$(FFTW_XLIBS)
-fftn.cc|$(FFTW_XCPPFLAGS)|$(FFTW_XLDFLAGS)|$(FFTW_XLIBS)
 fftw.cc|$(FFTW_XCPPFLAGS)|$(FFTW_XLDFLAGS)|$(FFTW_XLIBS)
-filter.cc
-find.cc
-gammainc.cc
-gcd.cc
-getgrent.cc
-getpwent.cc
-getrusage.cc
-givens.cc
-hess.cc
-hex2num.cc
-inv.cc
-kron.cc
-lookup.cc
-lsode.cc
-lu.cc
-luinc.cc
-matrix_type.cc
-max.cc
-md5sum.cc
-mgorth.cc
-nproc.cc
-pinv.cc
 qr.cc|$(QRUPDATE_CPPFLAGS) $(SPARSE_XCPPFLAGS)|$(QRUPDATE_LDFLAGS) $(SPARSE_XLDFLAGS)|$(QRUPDATE_LIBS) $(SPARSE_XLIBS)
-quad.cc
-quadcc.cc
-qz.cc|||$(LAPACK_LIBS) $(BLAS_LIBS)
-rand.cc
-rcond.cc
-regexp.cc|$(REGEX_CPPFLAGS)|$(REGEX_LDFLAGS)|$(REGEX_LIBS)
-schur.cc
-spparms.cc
-sqrtm.cc
-strfind.cc
-str2double.cc
-sub2ind.cc
-svd.cc
-syl.cc
 symbfact.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
 symrcm.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
-time.cc
-tril.cc
 tsearch.cc
-typecast.cc
 urlwrite.cc|$(CURL_CPPFLAGS)|$(CURL_LDFLAGS)|$(CURL_LIBS)
--- a/src/DLD-FUNCTIONS/symbfact.cc
+++ b/src/DLD-FUNCTIONS/symbfact.cc
@@ -270,7 +270,7 @@
           // count the total number of entries in L
           octave_idx_type lnz = 0 ;
           for (octave_idx_type j = 0 ; j < n ; j++)
-            lnz += ColCount [j] ;
+            lnz += ColCount[j];
 
 
           // allocate the output matrix L (pattern-only)
@@ -281,7 +281,7 @@
           for (octave_idx_type j = 0 ; j < n ; j++)
             {
               L.xcidx(j) = lnz;
-              lnz += ColCount [j];
+              lnz += ColCount[j];
             }
           L.xcidx(n) = lnz;
 
@@ -302,11 +302,11 @@
             {
               // get the kth row of L and store in the columns of L
               CHOLMOD_NAME (row_subtree) (A1, A2, k, Parent, R, cm) ;
-              for (octave_idx_type p = 0 ; p < Rp [1] ; p++)
-                L.xridx (W [Ri [p]]++) = k ;
+              for (octave_idx_type p = 0 ; p < Rp[1] ; p++)
+                L.xridx (W[Ri[p]]++) = k ;
 
               // add the diagonal entry
-              L.xridx (W [k]++) = k ;
+              L.xridx (W[k]++) = k ;
             }
 
           // free workspace
--- a/src/DLD-FUNCTIONS/symrcm.cc
+++ b/src/DLD-FUNCTIONS/symrcm.cc
@@ -405,7 +405,7 @@
     for (octave_idx_type k = cidx[j]; k < cidx[j + 1]; k++)
       {
         OCTAVE_QUIT;
-        octave_idx_type q = w [ridx[k]]++;
+        octave_idx_type q = w[ridx[k]]++;
         ridx2[q] = j;
       }
 }
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,7 @@
   -I../libgnu -I$(top_srcdir)/libgnu \
   -I$(top_srcdir)/libcruft/misc \
   -I../liboctave -I$(top_srcdir)/liboctave \
+  -Icorefcn -I$(srcdir)/corefcn \
   -I. -I$(srcdir) \
   @CPPFLAGS@
 
@@ -44,7 +45,7 @@
 
 octave_config_SOURCES =
 nodist_octave_config_SOURCES = octave-config.cc
-octave_config_LDADD = ../libgnu/libgnu.la $(LIBS)
+octave_config_LDADD = corefcn/libcorefcn.la ../libgnu/libgnu.la $(LIBS)
 
 BUILT_SOURCES_EXTRA = \
   mkoctfile.cc \
@@ -231,6 +232,12 @@
   pt-walk.h \
   pt.h
 
+JIT_INCLUDES = \
+  jit-util.h \
+  jit-typeinfo.h \
+  jit-ir.h \
+  pt-jit.h
+
 octinclude_HEADERS = \
   Cell.h \
   builtins.h \
@@ -309,7 +316,8 @@
   zfstream.h \
   $(OV_INCLUDES) \
   $(OV_SPARSE_INCLUDES) \
-  $(PT_INCLUDES)
+  $(PT_INCLUDES) \
+  $(JIT_INCLUDES)
 
 nodist_octinclude_HEADERS = \
   defaults.h \
@@ -402,6 +410,16 @@
   pt-unop.cc \
   pt.cc
 
+JIT_SRC = \
+  jit-util.cc \
+  jit-typeinfo.cc \
+  jit-ir.cc \
+  pt-jit.cc
+
+#noinst_LTLIBRARIES =
+#
+#include corefcn/module.mk
+#
 DIST_SRC = \
   Cell.cc \
   bitfcns.cc \
@@ -473,9 +491,14 @@
   xnorm.cc \
   xpow.cc \
   zfstream.cc \
+  $(corefcn_SRC) \
   $(OV_SRC) \
-  $(PT_SRC)
+  $(PT_SRC) \
+  $(JIT_SRC)
 
+noinst_LTLIBRARIES =
+
+include corefcn/module.mk
 include DLD-FUNCTIONS/module.mk
 
 $(srcdir)/DLD-FUNCTIONS/module.mk: $(srcdir)/DLD-FUNCTIONS/config-module.sh $(srcdir)/DLD-FUNCTIONS/config-module.awk $(srcdir)/DLD-FUNCTIONS/module-files
@@ -534,6 +557,9 @@
 
 display.df display.lo: CPPFLAGS += $(X11_FLAGS)
 
+## FIXME: Does this rule need to be uncommented?
+#fft.df fft.lo fft2.df fft2.lo fftn.df fftn.lo: CPPFLAGS += $(FFTW_XCPPFLAGS)
+
 octave_SOURCES = main.c
 
 octave_LDADD = \
new file mode 100644
--- /dev/null
+++ b/src/TEMPLATE-INST/Array-jit.cc
@@ -0,0 +1,40 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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
+
+#ifdef HAVE_LLVM
+
+#include "Array.h"
+#include "Array.cc"
+
+extern template class OCTAVE_API Array<octave_idx_type>;
+
+#include "pt-jit.h"
+
+NO_INSTANTIATE_ARRAY_SORT (jit_function);
+
+INSTANTIATE_ARRAY (jit_function, OCTINTERP_API);
+
+#endif
--- a/src/TEMPLATE-INST/module.mk
+++ b/src/TEMPLATE-INST/module.mk
@@ -2,4 +2,5 @@
 
 TEMPLATE_INST_SRC = \
   TEMPLATE-INST/Array-os.cc \
-  TEMPLATE-INST/Array-tc.cc
+  TEMPLATE-INST/Array-tc.cc \
+  TEMPLATE-INST/Array-jit.cc
rename from src/DLD-FUNCTIONS/__contourc__.cc
rename to src/corefcn/__contourc__.cc
--- a/src/DLD-FUNCTIONS/__contourc__.cc
+++ b/src/corefcn/__contourc__.cc
@@ -40,7 +40,7 @@
 
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 
@@ -299,9 +299,9 @@
         drawcn (X, Y, Z, lvl, r, c, 0.0, 0.0, 255, true, mark);
 }
 
-DEFUN_DLD (__contourc__, args, ,
+DEFUN (__contourc__, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __contourc__ (@var{x}, @var{y}, @var{z}, @var{levels})\n\
+@deftypefn {Built-in Function} {} __contourc__ (@var{x}, @var{y}, @var{z}, @var{levels})\n\
 Undocumented internal function.\n\
 @end deftypefn")
 {
rename from src/DLD-FUNCTIONS/__dispatch__.cc
rename to src/corefcn/__dispatch__.cc
--- a/src/DLD-FUNCTIONS/__dispatch__.cc
+++ b/src/corefcn/__dispatch__.cc
@@ -30,7 +30,7 @@
 
 #include "Cell.h"
 #include "oct-map.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "ov.h"
 #include "ov-fcn.h"
 #include "ov-typeinfo.h"
@@ -39,7 +39,7 @@
 #include "symtab.h"
 #include "variables.h"
 
-DEFUN_DLD (__dispatch__, args, nargout,
+DEFUN (__dispatch__, args, nargout,
   "Undocumented internal function")
 {
   octave_value retval;
rename from src/DLD-FUNCTIONS/__lin_interpn__.cc
rename to src/corefcn/__lin_interpn__.cc
--- a/src/DLD-FUNCTIONS/__lin_interpn__.cc
+++ b/src/corefcn/__lin_interpn__.cc
@@ -28,7 +28,7 @@
 #include "dNDArray.h"
 #include "oct-locbuf.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 
@@ -267,9 +267,9 @@
 //
 //This function only performs linear interpolation.
 
-DEFUN_DLD (__lin_interpn__, args, ,
+DEFUN (__lin_interpn__, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{vi} =} __lin_interpn__ (@var{x1}, @var{x2}, @dots{}, @var{xn}, @var{v}, @var{y1}, @var{y2}, @dots{}, @var{yn})\n\
+@deftypefn {Built-in Function} {@var{vi} =} __lin_interpn__ (@var{x1}, @var{x2}, @dots{}, @var{xn}, @var{v}, @var{y1}, @var{y2}, @dots{}, @var{yn})\n\
 Undocumented internal function.\n\
 @end deftypefn")
 {
rename from src/DLD-FUNCTIONS/__pchip_deriv__.cc
rename to src/corefcn/__pchip_deriv__.cc
--- a/src/DLD-FUNCTIONS/__pchip_deriv__.cc
+++ b/src/corefcn/__pchip_deriv__.cc
@@ -25,7 +25,7 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -50,9 +50,9 @@
 // Wrapper for SLATEC/PCHIP function DPCHIM to calculate the derivates
 // for piecewise polynomials.
 
-DEFUN_DLD (__pchip_deriv__, args, ,
+DEFUN (__pchip_deriv__, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} __pchip_deriv__ (@var{x}, @var{y}, @var{dim})\n\
+@deftypefn {Built-in Function} {} __pchip_deriv__ (@var{x}, @var{y}, @var{dim})\n\
 Undocumented internal function.\n\
 @end deftypefn")
 {
rename from src/DLD-FUNCTIONS/__qp__.cc
rename to src/corefcn/__qp__.cc
--- a/src/DLD-FUNCTIONS/__qp__.cc
+++ b/src/corefcn/__qp__.cc
@@ -31,7 +31,7 @@
 #include "mx-m-dm.h"
 #include "EIG.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -479,9 +479,9 @@
   return info;
 }
 
-DEFUN_DLD (__qp__, args, ,
+DEFUN (__qp__, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{x}, @var{lambda}, @var{info}, @var{iter}] =} __qp__ (@var{x0}, @var{H}, @var{q}, @var{Aeq}, @var{beq}, @var{Ain}, @var{bin}, @var{maxit})\n\
+@deftypefn {Built-in Function} {[@var{x}, @var{lambda}, @var{info}, @var{iter}] =} __qp__ (@var{x0}, @var{H}, @var{q}, @var{Aeq}, @var{beq}, @var{Ain}, @var{bin}, @var{maxit})\n\
 Undocumented internal function.\n\
 @end deftypefn")
 {
rename from src/DLD-FUNCTIONS/balance.cc
rename to src/corefcn/balance.cc
--- a/src/DLD-FUNCTIONS/balance.cc
+++ b/src/corefcn/balance.cc
@@ -39,20 +39,20 @@
 #include "floatGEPBAL.h"
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "f77-fcn.h"
 #include "gripes.h"
 #include "oct-obj.h"
 #include "utils.h"
 
-DEFUN_DLD (balance, args, nargout,
+DEFUN (balance, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{AA} =} balance (@var{A})\n\
-@deftypefnx {Loadable Function} {@var{AA} =} balance (@var{A}, @var{opt})\n\
-@deftypefnx {Loadable Function} {[@var{DD}, @var{AA}] =} balance (@var{A}, @var{opt})\n\
-@deftypefnx {Loadable Function} {[@var{D}, @var{P}, @var{AA}] =} balance (@var{A}, @var{opt})\n\
-@deftypefnx {Loadable Function} {[@var{CC}, @var{DD}, @var{AA}, @var{BB}] =} balance (@var{A}, @var{B}, @var{opt})\n\
+@deftypefn  {Built-in Function} {@var{AA} =} balance (@var{A})\n\
+@deftypefnx {Built-in Function} {@var{AA} =} balance (@var{A}, @var{opt})\n\
+@deftypefnx {Built-in Function} {[@var{DD}, @var{AA}] =} balance (@var{A}, @var{opt})\n\
+@deftypefnx {Built-in Function} {[@var{D}, @var{P}, @var{AA}] =} balance (@var{A}, @var{opt})\n\
+@deftypefnx {Built-in Function} {[@var{CC}, @var{DD}, @var{AA}, @var{BB}] =} balance (@var{A}, @var{B}, @var{opt})\n\
 \n\
 Compute @code{@var{AA} = @var{DD} \\ @var{A} * @var{DD}} in which @var{AA}\n\
 is a matrix whose row and column norms are roughly equal in magnitude, and\n\
rename from src/DLD-FUNCTIONS/besselj.cc
rename to src/corefcn/besselj.cc
--- a/src/DLD-FUNCTIONS/besselj.cc
+++ b/src/corefcn/besselj.cc
@@ -27,7 +27,7 @@
 #include "lo-specfun.h"
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -376,13 +376,13 @@
   return retval;
 }
 
-DEFUN_DLD (besselj, args, nargout,
+DEFUN (besselj, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{j}, @var{ierr}] =} besselj (@var{alpha}, @var{x}, @var{opt})\n\
-@deftypefnx {Loadable Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\
-@deftypefnx {Loadable Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\
-@deftypefnx {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\
-@deftypefnx {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\
+@deftypefn  {Built-in Function} {[@var{j}, @var{ierr}] =} besselj (@var{alpha}, @var{x}, @var{opt})\n\
+@deftypefnx {Built-in Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\
+@deftypefnx {Built-in Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\
+@deftypefnx {Built-in Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\
+@deftypefnx {Built-in Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\
 Compute Bessel or Hankel functions of various kinds:\n\
 \n\
 @table @code\n\
@@ -450,36 +450,36 @@
   return do_bessel (BESSEL_J, "besselj", args, nargout);
 }
 
-DEFUN_DLD (bessely, args, nargout,
+DEFUN (bessely, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\
+@deftypefn {Built-in Function} {[@var{y}, @var{ierr}] =} bessely (@var{alpha}, @var{x}, @var{opt})\n\
 See besselj.\n\
 @end deftypefn")
 {
   return do_bessel (BESSEL_Y, "bessely", args, nargout);
 }
 
-DEFUN_DLD (besseli, args, nargout,
+DEFUN (besseli, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\
+@deftypefn {Built-in Function} {[@var{i}, @var{ierr}] =} besseli (@var{alpha}, @var{x}, @var{opt})\n\
 See besselj.\n\
 @end deftypefn")
 {
   return do_bessel (BESSEL_I, "besseli", args, nargout);
 }
 
-DEFUN_DLD (besselk, args, nargout,
+DEFUN (besselk, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\
+@deftypefn {Built-in Function} {[@var{k}, @var{ierr}] =} besselk (@var{alpha}, @var{x}, @var{opt})\n\
 See besselj.\n\
 @end deftypefn")
 {
   return do_bessel (BESSEL_K, "besselk", args, nargout);
 }
 
-DEFUN_DLD (besselh, args, nargout,
+DEFUN (besselh, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\
+@deftypefn {Built-in Function} {[@var{h}, @var{ierr}] =} besselh (@var{alpha}, @var{k}, @var{x}, @var{opt})\n\
 See besselj.\n\
 @end deftypefn")
 {
@@ -521,9 +521,9 @@
   return retval;
 }
 
-DEFUN_DLD (airy, args, nargout,
+DEFUN (airy, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{a}, @var{ierr}] =} airy (@var{k}, @var{z}, @var{opt})\n\
+@deftypefn {Built-in Function} {[@var{a}, @var{ierr}] =} airy (@var{k}, @var{z}, @var{opt})\n\
 Compute Airy functions of the first and second kind, and their\n\
 derivatives.\n\
 \n\
rename from src/DLD-FUNCTIONS/betainc.cc
rename to src/corefcn/betainc.cc
--- a/src/DLD-FUNCTIONS/betainc.cc
+++ b/src/corefcn/betainc.cc
@@ -26,7 +26,7 @@
 
 #include "lo-specfun.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -35,7 +35,7 @@
 // FIXME: These functions do not need to be dynamically loaded.  They should
 //        be placed elsewhere in the Octave code hierarchy.
 
-DEFUN_DLD (betainc, args, ,
+DEFUN (betainc, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Mapping Function} {} betainc (@var{x}, @var{a}, @var{b})\n\
 Return the regularized incomplete Beta function,\n\
@@ -329,7 +329,7 @@
 %!error betainc (1,2,3,4)
 */
 
-DEFUN_DLD (betaincinv, args, ,
+DEFUN (betaincinv, args, ,
     "-*- texinfo -*-\n\
 @deftypefn {Mapping Function} {} betaincinv (@var{y}, @var{a}, @var{b})\n\
 Compute the inverse of the incomplete Beta function, i.e., @var{x} such that\n\
rename from src/DLD-FUNCTIONS/bsxfun.cc
rename to src/corefcn/bsxfun.cc
--- a/src/DLD-FUNCTIONS/bsxfun.cc
+++ b/src/corefcn/bsxfun.cc
@@ -32,7 +32,7 @@
 #include "lo-mappers.h"
 
 #include "oct-map.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "parse.h"
 #include "variables.h"
 #include "ov-colon.h"
@@ -309,9 +309,9 @@
     }
 }
 
-DEFUN_DLD (bsxfun, args, ,
+DEFUN (bsxfun, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} bsxfun (@var{f}, @var{A}, @var{B})\n\
+@deftypefn {Built-in Function} {} bsxfun (@var{f}, @var{A}, @var{B})\n\
 The binary singleton expansion function applier performs broadcasting,\n\
 that is, applies a binary function @var{f} element-by-element to two\n\
 array arguments @var{A} and @var{B}, and expands as necessary\n\
rename from src/DLD-FUNCTIONS/cellfun.cc
rename to src/corefcn/cellfun.cc
--- a/src/DLD-FUNCTIONS/cellfun.cc
+++ b/src/corefcn/cellfun.cc
@@ -38,7 +38,7 @@
 
 #include "Cell.h"
 #include "oct-map.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "parse.h"
 #include "variables.h"
 #include "ov-colon.h"
@@ -249,16 +249,16 @@
   nargin -= 1;
 }
 
-DEFUN_DLD (cellfun, args, nargout,
+DEFUN (cellfun, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} cellfun (@var{name}, @var{C})\n\
-@deftypefnx {Loadable Function} {} cellfun (\"size\", @var{C}, @var{k})\n\
-@deftypefnx {Loadable Function} {} cellfun (\"isclass\", @var{C}, @var{class})\n\
-@deftypefnx {Loadable Function} {} cellfun (@var{func}, @var{C})\n\
-@deftypefnx {Loadable Function} {} cellfun (@var{func}, @var{C}, @var{D})\n\
-@deftypefnx {Loadable Function} {[@var{a}, @dots{}] =} cellfun (@dots{})\n\
-@deftypefnx {Loadable Function} {} cellfun (@dots{}, \"ErrorHandler\", @var{errfunc})\n\
-@deftypefnx {Loadable Function} {} cellfun (@dots{}, \"UniformOutput\", @var{val})\n\
+@deftypefn  {Built-in Function} {} cellfun (@var{name}, @var{C})\n\
+@deftypefnx {Built-in Function} {} cellfun (\"size\", @var{C}, @var{k})\n\
+@deftypefnx {Built-in Function} {} cellfun (\"isclass\", @var{C}, @var{class})\n\
+@deftypefnx {Built-in Function} {} cellfun (@var{func}, @var{C})\n\
+@deftypefnx {Built-in Function} {} cellfun (@var{func}, @var{C}, @var{D})\n\
+@deftypefnx {Built-in Function} {[@var{a}, @dots{}] =} cellfun (@dots{})\n\
+@deftypefnx {Built-in Function} {} cellfun (@dots{}, \"ErrorHandler\", @var{errfunc})\n\
+@deftypefnx {Built-in Function} {} cellfun (@dots{}, \"UniformOutput\", @var{val})\n\
 \n\
 Evaluate the function named @var{name} on the elements of the cell array\n\
 @var{C}.  Elements in @var{C} are passed on to the named function\n\
@@ -1014,7 +1014,7 @@
 // Hajek.  It was converted to C++ by jwe so that it could properly
 // handle the nargout = 0 case.
 
-DEFUN_DLD (arrayfun, args, nargout,
+DEFUN (arrayfun, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn  {Function File} {} arrayfun (@var{func}, @var{A})\n\
 @deftypefnx {Function File} {@var{x} =} arrayfun (@var{func}, @var{A})\n\
@@ -1805,10 +1805,10 @@
   return retval;
 }
 
-DEFUN_DLD (num2cell, args, ,
+DEFUN (num2cell, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{C} =} num2cell (@var{A})\n\
-@deftypefnx {Loadable Function} {@var{C} =} num2cell (@var{A}, @var{dim})\n\
+@deftypefn  {Built-in Function} {@var{C} =} num2cell (@var{A})\n\
+@deftypefnx {Built-in Function} {@var{C} =} num2cell (@var{A}, @var{dim})\n\
 Convert the numeric matrix @var{A} to a cell array.  If @var{dim} is\n\
 defined, the value @var{C} is of dimension 1 in this dimension and the\n\
 elements of @var{A} are placed into @var{C} in slices.  For example:\n\
@@ -2134,11 +2134,11 @@
   return retval;
 }
 
-DEFUN_DLD (mat2cell, args, ,
+DEFUN (mat2cell, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{C} =} mat2cell (@var{A}, @var{m}, @var{n})\n\
-@deftypefnx {Loadable Function} {@var{C} =} mat2cell (@var{A}, @var{d1}, @var{d2}, @dots{})\n\
-@deftypefnx {Loadable Function} {@var{C} =} mat2cell (@var{A}, @var{r})\n\
+@deftypefn  {Built-in Function} {@var{C} =} mat2cell (@var{A}, @var{m}, @var{n})\n\
+@deftypefnx {Built-in Function} {@var{C} =} mat2cell (@var{A}, @var{d1}, @var{d2}, @dots{})\n\
+@deftypefnx {Built-in Function} {@var{C} =} mat2cell (@var{A}, @var{r})\n\
 Convert the matrix @var{A} to a cell array.  If @var{A} is 2-D, then\n\
 it is required that @code{sum (@var{m}) == size (@var{A}, 1)} and\n\
 @code{sum (@var{n}) == size (@var{A}, 2)}.  Similarly, if @var{A} is\n\
@@ -2304,9 +2304,9 @@
   return retval;
 }
 
-DEFUN_DLD (cellslices, args, ,
+DEFUN (cellslices, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{sl} =} cellslices (@var{x}, @var{lb}, @var{ub}, @var{dim})\n\
+@deftypefn {Built-in Function} {@var{sl} =} cellslices (@var{x}, @var{lb}, @var{ub}, @var{dim})\n\
 Given an array @var{x}, this function produces a cell array of slices from\n\
 the array determined by the index vectors @var{lb}, @var{ub}, for lower and\n\
 upper bounds, respectively.  In other words, it is equivalent to the\n\
@@ -2425,9 +2425,9 @@
 %! assert (c, {[1, 2; 5, 6; 9, 10], [2, 3; 6, 7; 10, 11]});
 */
 
-DEFUN_DLD (cellindexmat, args, ,
+DEFUN (cellindexmat, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{y} =} cellindexmat (@var{x}, @var{varargin})\n\
+@deftypefn {Built-in Function} {@var{y} =} cellindexmat (@var{x}, @var{varargin})\n\
 Given a cell array of matrices @var{x}, this function computes\n\
 \n\
 @example\n\
rename from src/DLD-FUNCTIONS/colloc.cc
rename to src/corefcn/colloc.cc
--- a/src/DLD-FUNCTIONS/colloc.cc
+++ b/src/corefcn/colloc.cc
@@ -29,14 +29,14 @@
 #include "CollocWt.h"
 #include "lo-mappers.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 #include "utils.h"
 
-DEFUN_DLD (colloc, args, ,
+DEFUN (colloc, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{r}, @var{amat}, @var{bmat}, @var{q}] =} colloc (@var{n}, \"left\", \"right\")\n\
+@deftypefn {Built-in Function} {[@var{r}, @var{amat}, @var{bmat}, @var{q}] =} colloc (@var{n}, \"left\", \"right\")\n\
 Compute derivative and integral weight matrices for orthogonal\n\
 collocation using the subroutines given in J. Villadsen and\n\
 M. L. Michelsen, @cite{Solution of Differential Equation Models by\n\
rename from src/DLD-FUNCTIONS/conv2.cc
rename to src/corefcn/conv2.cc
--- a/src/DLD-FUNCTIONS/conv2.cc
+++ b/src/corefcn/conv2.cc
@@ -27,18 +27,18 @@
 
 #include "oct-convn.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 #include "utils.h"
 
 enum Shape { SHAPE_FULL, SHAPE_SAME, SHAPE_VALID };
 
-DEFUN_DLD (conv2, args, ,
+DEFUN (conv2, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} conv2 (@var{A}, @var{B})\n\
-@deftypefnx {Loadable Function} {} conv2 (@var{v1}, @var{v2}, @var{m})\n\
-@deftypefnx {Loadable Function} {} conv2 (@dots{}, @var{shape})\n\
+@deftypefn  {Built-in Function} {} conv2 (@var{A}, @var{B})\n\
+@deftypefnx {Built-in Function} {} conv2 (@var{v1}, @var{v2}, @var{m})\n\
+@deftypefnx {Built-in Function} {} conv2 (@dots{}, @var{shape})\n\
 Return the 2-D convolution of @var{A} and @var{B}.  The size of the result\n\
 is determined by the optional @var{shape} argument which takes the following\n\
 values\n\
@@ -283,10 +283,10 @@
 %!error conv2 (1, ones (2), 1)
 */
 
-DEFUN_DLD (convn, args, ,
+DEFUN (convn, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{C} =} convn (@var{A}, @var{B})\n\
-@deftypefnx {Loadable Function} {@var{C} =} convn (@var{A}, @var{B}, @var{shape})\n\
+@deftypefn  {Built-in Function} {@var{C} =} convn (@var{A}, @var{B})\n\
+@deftypefnx {Built-in Function} {@var{C} =} convn (@var{A}, @var{B}, @var{shape})\n\
 Return the n-D convolution of @var{A} and @var{B}.  The size of the result\n\
 is determined by the optional @var{shape} argument which takes the following\n\
 values\n\
rename from src/DLD-FUNCTIONS/daspk.cc
rename to src/corefcn/daspk.cc
--- a/src/DLD-FUNCTIONS/daspk.cc
+++ b/src/corefcn/daspk.cc
@@ -31,7 +31,7 @@
 
 #include "DASPK.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -170,9 +170,9 @@
     } \
   while (0)
 
-DEFUN_DLD (daspk, args, nargout,
+DEFUN (daspk, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{x}, @var{xdot}, @var{istate}, @var{msg}] =} daspk (@var{fcn}, @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\
+@deftypefn {Built-in Function} {[@var{x}, @var{xdot}, @var{istate}, @var{msg}] =} daspk (@var{fcn}, @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\
 Solve the set of differential-algebraic equations\n\
 @tex\n\
 $$ 0 = f (x, \\dot{x}, t) $$\n\
rename from src/DLD-FUNCTIONS/dasrt.cc
rename to src/corefcn/dasrt.cc
--- a/src/DLD-FUNCTIONS/dasrt.cc
+++ b/src/corefcn/dasrt.cc
@@ -30,7 +30,7 @@
 #include "DASRT.h"
 #include "lo-mappers.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -206,12 +206,12 @@
     } \
   while (0)
 
-DEFUN_DLD (dasrt, args, nargout,
+DEFUN (dasrt, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{x}, @var{xdot}, @var{t_out}, @var{istat}, @var{msg}] =} dasrt (@var{fcn}, [], @var{x_0}, @var{xdot_0}, @var{t})\n\
-@deftypefnx {Loadable Function} {@dots{} =} dasrt (@var{fcn}, @var{g}, @var{x_0}, @var{xdot_0}, @var{t})\n\
-@deftypefnx {Loadable Function} {@dots{} =} dasrt (@var{fcn}, [], @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\
-@deftypefnx {Loadable Function} {@dots{} =} dasrt (@var{fcn}, @var{g}, @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\
+@deftypefn  {Built-in Function} {[@var{x}, @var{xdot}, @var{t_out}, @var{istat}, @var{msg}] =} dasrt (@var{fcn}, [], @var{x_0}, @var{xdot_0}, @var{t})\n\
+@deftypefnx {Built-in Function} {@dots{} =} dasrt (@var{fcn}, @var{g}, @var{x_0}, @var{xdot_0}, @var{t})\n\
+@deftypefnx {Built-in Function} {@dots{} =} dasrt (@var{fcn}, [], @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\
+@deftypefnx {Built-in Function} {@dots{} =} dasrt (@var{fcn}, @var{g}, @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\
 Solve the set of differential-algebraic equations\n\
 @tex\n\
 $$ 0 = f (x, \\dot{x}, t) $$\n\
rename from src/DLD-FUNCTIONS/dassl.cc
rename to src/corefcn/dassl.cc
--- a/src/DLD-FUNCTIONS/dassl.cc
+++ b/src/corefcn/dassl.cc
@@ -31,7 +31,7 @@
 
 #include "DASSL.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -170,9 +170,9 @@
     } \
   while (0)
 
-DEFUN_DLD (dassl, args, nargout,
+DEFUN (dassl, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{x}, @var{xdot}, @var{istate}, @var{msg}] =} dassl (@var{fcn}, @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\
+@deftypefn {Built-in Function} {[@var{x}, @var{xdot}, @var{istate}, @var{msg}] =} dassl (@var{fcn}, @var{x_0}, @var{xdot_0}, @var{t}, @var{t_crit})\n\
 Solve the set of differential-algebraic equations\n\
 @tex\n\
 $$ 0 = f (x, \\dot{x}, t) $$\n\
rename from src/DLD-FUNCTIONS/det.cc
rename to src/corefcn/det.cc
--- a/src/DLD-FUNCTIONS/det.cc
+++ b/src/corefcn/det.cc
@@ -26,7 +26,7 @@
 
 #include "DET.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -47,10 +47,10 @@
   const CLASS *VAR = arg.type_id () == CLASS::static_type_id () ? \
    dynamic_cast<const CLASS *> (&arg.get_rep ()) : 0
 
-DEFUN_DLD (det, args, nargout,
+DEFUN (det, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} det (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{d}, @var{rcond}] =} det (@var{A})\n\
+@deftypefn  {Built-in Function} {} det (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{d}, @var{rcond}] =} det (@var{A})\n\
 Compute the determinant of @var{A}.\n\
 \n\
 Return an estimate of the reciprocal condition number if requested.\n\
rename from src/DLD-FUNCTIONS/dlmread.cc
rename to src/corefcn/dlmread.cc
--- a/src/DLD-FUNCTIONS/dlmread.cc
+++ b/src/corefcn/dlmread.cc
@@ -35,7 +35,7 @@
 #include "file-ops.h"
 #include "lo-ieee.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "oct-stream.h"
 #include "error.h"
 #include "oct-obj.h"
@@ -155,13 +155,13 @@
   return stat;
 }
 
-DEFUN_DLD (dlmread, args, ,
+DEFUN (dlmread, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{data} =} dlmread (@var{file})\n\
-@deftypefnx {Loadable Function} {@var{data} =} dlmread (@var{file}, @var{sep})\n\
-@deftypefnx {Loadable Function} {@var{data} =} dlmread (@var{file}, @var{sep}, @var{r0}, @var{c0})\n\
-@deftypefnx {Loadable Function} {@var{data} =} dlmread (@var{file}, @var{sep}, @var{range})\n\
-@deftypefnx {Loadable Function} {@var{data} =} dlmread (@dots{}, \"emptyvalue\", @var{EMPTYVAL})\n\
+@deftypefn  {Built-in Function} {@var{data} =} dlmread (@var{file})\n\
+@deftypefnx {Built-in Function} {@var{data} =} dlmread (@var{file}, @var{sep})\n\
+@deftypefnx {Built-in Function} {@var{data} =} dlmread (@var{file}, @var{sep}, @var{r0}, @var{c0})\n\
+@deftypefnx {Built-in Function} {@var{data} =} dlmread (@var{file}, @var{sep}, @var{range})\n\
+@deftypefnx {Built-in Function} {@var{data} =} dlmread (@dots{}, \"emptyvalue\", @var{EMPTYVAL})\n\
 Read the matrix @var{data} from a text file.  If not defined the separator\n\
 between fields is determined from the file itself.  Otherwise the\n\
 separation character is defined by @var{sep}.\n\
rename from src/DLD-FUNCTIONS/dot.cc
rename to src/corefcn/dot.cc
--- a/src/DLD-FUNCTIONS/dot.cc
+++ b/src/corefcn/dot.cc
@@ -27,7 +27,7 @@
 #include "f77-fcn.h"
 #include "mx-base.h"
 #include "error.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "parse.h"
 
 extern "C"
@@ -103,9 +103,9 @@
     }
 }
 
-DEFUN_DLD (dot, args, ,
+DEFUN (dot, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} dot (@var{x}, @var{y}, @var{dim})\n\
+@deftypefn {Built-in Function} {} dot (@var{x}, @var{y}, @var{dim})\n\
 Compute the dot product of two vectors.  If @var{x} and @var{y}\n\
 are matrices, calculate the dot products along the first\n\
 non-singleton dimension.  If the optional argument @var{dim} is\n\
@@ -249,9 +249,9 @@
 %! assert (dot (x, x), [4, 20]);
 */
 
-DEFUN_DLD (blkmm, args, ,
+DEFUN (blkmm, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} blkmm (@var{A}, @var{B})\n\
+@deftypefn {Built-in Function} {} blkmm (@var{A}, @var{B})\n\
 Compute products of matrix blocks.  The blocks are given as\n\
 2-dimensional subarrays of the arrays @var{A}, @var{B}.\n\
 The size of @var{A} must have the form @code{[m,k,@dots{}]} and\n\
rename from src/DLD-FUNCTIONS/eig.cc
rename to src/corefcn/eig.cc
--- a/src/DLD-FUNCTIONS/eig.cc
+++ b/src/corefcn/eig.cc
@@ -27,24 +27,24 @@
 #include "EIG.h"
 #include "fEIG.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
 #include "utils.h"
 
-DEFUN_DLD (eig, args, nargout,
+DEFUN (eig, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{lambda} =} eig (@var{A})\n\
-@deftypefnx {Loadable Function} {@var{lambda} =} eig (@var{A}, @var{B})\n\
-@deftypefnx {Loadable Function} {[@var{V}, @var{lambda}] =} eig (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{V}, @var{lambda}] =} eig (@var{A}, @var{B})\n\
-Compute the eigenvalues and eigenvectors of a matrix.\n\
+@deftypefn  {Built-in Function} {@var{lambda} =} eig (@var{A})\n\
+@deftypefnx {Built-in Function} {@var{lambda} =} eig (@var{A}, @var{B})\n\
+@deftypefnx {Built-in Function} {[@var{V}, @var{lambda}] =} eig (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{V}, @var{lambda}] =} eig (@var{A}, @var{B})\n\
+Compute the eigenvalues (and optionally the eigenvectors) of a matrix\n\
+or a pair of matrices\n\
 \n\
-Eigenvalues are computed in a several step process which begins with a\n\
-Hessenberg decomposition, followed by a Schur@tie{}decomposition, from which\n\
-the eigenvalues are apparent.  The eigenvectors, when desired, are computed\n\
-by further manipulations of the Schur@tie{}decomposition.\n\
+The algorithm used depends on whether there are one or two input\n\
+matrices, if they are real or complex and if they are symmetric\n\
+(Hermitian if complex) or non-symmetric.\n\
 \n\
 The eigenvalues returned by @code{eig} are not ordered.\n\
 @seealso{eigs, svd}\n\
rename from src/DLD-FUNCTIONS/fft.cc
rename to src/corefcn/fft.cc
--- a/src/DLD-FUNCTIONS/fft.cc
+++ b/src/corefcn/fft.cc
@@ -27,7 +27,7 @@
 
 #include "lo-mappers.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -197,11 +197,11 @@
 */
 
 
-DEFUN_DLD (fft, args, ,
+DEFUN (fft, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} fft (@var{x})\n\
-@deftypefnx {Loadable Function} {} fft (@var{x}, @var{n})\n\
-@deftypefnx {Loadable Function} {} fft (@var{x}, @var{n}, @var{dim})\n\
+@deftypefn  {Built-in Function} {} fft (@var{x})\n\
+@deftypefnx {Built-in Function} {} fft (@var{x}, @var{n})\n\
+@deftypefnx {Built-in Function} {} fft (@var{x}, @var{n}, @var{dim})\n\
 Compute the discrete Fourier transform of @var{A} using\n\
 a Fast Fourier Transform (FFT) algorithm.\n\
 \n\
@@ -226,11 +226,11 @@
 }
 
 
-DEFUN_DLD (ifft, args, ,
+DEFUN (ifft, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} ifft (@var{x})\n\
-@deftypefnx {Loadable Function} {} ifft (@var{x}, @var{n})\n\
-@deftypefnx {Loadable Function} {} ifft (@var{x}, @var{n}, @var{dim})\n\
+@deftypefn  {Built-in Function} {} ifft (@var{x})\n\
+@deftypefnx {Built-in Function} {} ifft (@var{x}, @var{n})\n\
+@deftypefnx {Built-in Function} {} ifft (@var{x}, @var{n}, @var{dim})\n\
 Compute the inverse discrete Fourier transform of @var{A}\n\
 using a Fast Fourier Transform (FFT) algorithm.\n\
 \n\
rename from src/DLD-FUNCTIONS/fft2.cc
rename to src/corefcn/fft2.cc
--- a/src/DLD-FUNCTIONS/fft2.cc
+++ b/src/corefcn/fft2.cc
@@ -27,7 +27,7 @@
 
 #include "lo-mappers.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -167,10 +167,10 @@
   return retval;
 }
 
-DEFUN_DLD (fft2, args, ,
+DEFUN (fft2, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} fft2 (@var{A})\n\
-@deftypefnx {Loadable Function} {} fft2 (@var{A}, @var{m}, @var{n})\n\
+@deftypefn  {Built-in Function} {} fft2 (@var{A})\n\
+@deftypefnx {Built-in Function} {} fft2 (@var{A}, @var{m}, @var{n})\n\
 Compute the two-dimensional discrete Fourier transform of @var{A} using\n\
 a Fast Fourier Transform (FFT) algorithm.\n\
 \n\
@@ -188,10 +188,10 @@
 }
 
 
-DEFUN_DLD (ifft2, args, ,
+DEFUN (ifft2, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} ifft2 (@var{A})\n\
-@deftypefnx {Loadable Function} {} ifft2 (@var{A}, @var{m}, @var{n})\n\
+@deftypefn  {Built-in Function} {} ifft2 (@var{A})\n\
+@deftypefnx {Built-in Function} {} ifft2 (@var{A}, @var{m}, @var{n})\n\
 Compute the inverse two-dimensional discrete Fourier transform of @var{A}\n\
 using a Fast Fourier Transform (FFT) algorithm.\n\
 \n\
rename from src/DLD-FUNCTIONS/fftn.cc
rename to src/corefcn/fftn.cc
--- a/src/DLD-FUNCTIONS/fftn.cc
+++ b/src/corefcn/fftn.cc
@@ -26,7 +26,7 @@
 
 #include "lo-mappers.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -149,10 +149,10 @@
   return retval;
 }
 
-DEFUN_DLD (fftn, args, ,
+DEFUN (fftn, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} fftn (@var{A})\n\
-@deftypefnx {Loadable Function} {} fftn (@var{A}, @var{size})\n\
+@deftypefn  {Built-in Function} {} fftn (@var{A})\n\
+@deftypefnx {Built-in Function} {} fftn (@var{A}, @var{size})\n\
 Compute the N-dimensional discrete Fourier transform of @var{A} using\n\
 a Fast Fourier Transform (FFT) algorithm.\n\
 \n\
@@ -168,10 +168,10 @@
   return do_fftn (args, "fftn", 0);
 }
 
-DEFUN_DLD (ifftn, args, ,
+DEFUN (ifftn, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} ifftn (@var{A})\n\
-@deftypefnx {Loadable Function} {} ifftn (@var{A}, @var{size})\n\
+@deftypefn  {Built-in Function} {} ifftn (@var{A})\n\
+@deftypefnx {Built-in Function} {} ifftn (@var{A}, @var{size})\n\
 Compute the inverse N-dimensional discrete Fourier transform of @var{A}\n\
 using a Fast Fourier Transform (FFT) algorithm.\n\
 \n\
rename from src/DLD-FUNCTIONS/filter.cc
rename to src/corefcn/filter.cc
--- a/src/DLD-FUNCTIONS/filter.cc
+++ b/src/corefcn/filter.cc
@@ -34,7 +34,7 @@
 
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 
@@ -285,12 +285,12 @@
   return filter (b, a, x, si, dim);
 }
 
-DEFUN_DLD (filter, args, nargout,
+DEFUN (filter, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {y =} filter (@var{b}, @var{a}, @var{x})\n\
-@deftypefnx {Loadable Function} {[@var{y}, @var{sf}] =} filter (@var{b}, @var{a}, @var{x}, @var{si})\n\
-@deftypefnx {Loadable Function} {[@var{y}, @var{sf}] =} filter (@var{b}, @var{a}, @var{x}, [], @var{dim})\n\
-@deftypefnx {Loadable Function} {[@var{y}, @var{sf}] =} filter (@var{b}, @var{a}, @var{x}, @var{si}, @var{dim})\n\
+@deftypefn  {Built-in Function} {y =} filter (@var{b}, @var{a}, @var{x})\n\
+@deftypefnx {Built-in Function} {[@var{y}, @var{sf}] =} filter (@var{b}, @var{a}, @var{x}, @var{si})\n\
+@deftypefnx {Built-in Function} {[@var{y}, @var{sf}] =} filter (@var{b}, @var{a}, @var{x}, [], @var{dim})\n\
+@deftypefnx {Built-in Function} {[@var{y}, @var{sf}] =} filter (@var{b}, @var{a}, @var{x}, @var{si}, @var{dim})\n\
 Return the solution to the following linear, time-invariant difference\n\
 equation:\n\
 @tex\n\
rename from src/DLD-FUNCTIONS/find.cc
rename to src/corefcn/find.cc
--- a/src/DLD-FUNCTIONS/find.cc
+++ b/src/corefcn/find.cc
@@ -26,7 +26,7 @@
 
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -332,13 +332,13 @@
   return retval;
 }
 
-DEFUN_DLD (find, args, nargout,
+DEFUN (find, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{idx} =} find (@var{x})\n\
-@deftypefnx {Loadable Function} {@var{idx} =} find (@var{x}, @var{n})\n\
-@deftypefnx {Loadable Function} {@var{idx} =} find (@var{x}, @var{n}, @var{direction})\n\
-@deftypefnx {Loadable Function} {[i, j] =} find (@dots{})\n\
-@deftypefnx {Loadable Function} {[i, j, v] =} find (@dots{})\n\
+@deftypefn  {Built-in Function} {@var{idx} =} find (@var{x})\n\
+@deftypefnx {Built-in Function} {@var{idx} =} find (@var{x}, @var{n})\n\
+@deftypefnx {Built-in Function} {@var{idx} =} find (@var{x}, @var{n}, @var{direction})\n\
+@deftypefnx {Built-in Function} {[i, j] =} find (@dots{})\n\
+@deftypefnx {Built-in Function} {[i, j, v] =} find (@dots{})\n\
 Return a vector of indices of nonzero elements of a matrix, as a row if\n\
 @var{x} is a row vector or as a column otherwise.  To obtain a single index\n\
 for each matrix element, Octave pretends that the columns of a matrix form\n\
rename from src/DLD-FUNCTIONS/gammainc.cc
rename to src/corefcn/gammainc.cc
--- a/src/DLD-FUNCTIONS/gammainc.cc
+++ b/src/corefcn/gammainc.cc
@@ -26,13 +26,13 @@
 
 #include "lo-specfun.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
 #include "utils.h"
 
-DEFUN_DLD (gammainc, args, ,
+DEFUN (gammainc, args, ,
   "-*- texinfo -*-\n\
 @deftypefn  {Mapping Function} {} gammainc (@var{x}, @var{a})\n\
 @deftypefnx {Mapping Function} {} gammainc (@var{x}, @var{a}, \"lower\")\n\
rename from src/DLD-FUNCTIONS/gcd.cc
rename to src/corefcn/gcd.cc
--- a/src/DLD-FUNCTIONS/gcd.cc
+++ b/src/corefcn/gcd.cc
@@ -32,7 +32,7 @@
 #include "lo-mappers.h"
 #include "oct-binmap.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 
@@ -432,10 +432,10 @@
   return retval;
 }
 
-DEFUN_DLD (gcd, args, nargout,
+DEFUN (gcd, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{g} =} gcd (@var{a1}, @var{a2}, @dots{})\n\
-@deftypefnx {Loadable Function} {[@var{g}, @var{v1}, @dots{}] =} gcd (@var{a1}, @var{a2}, @dots{})\n\
+@deftypefn  {Built-in Function} {@var{g} =} gcd (@var{a1}, @var{a2}, @dots{})\n\
+@deftypefnx {Built-in Function} {[@var{g}, @var{v1}, @dots{}] =} gcd (@var{a1}, @var{a2}, @dots{})\n\
 \n\
 Compute the greatest common divisor of @var{a1}, @var{a2}, @dots{}.  If more\n\
 than one argument is given all arguments must be the same size or scalar.\n\
rename from src/DLD-FUNCTIONS/getgrent.cc
rename to src/corefcn/getgrent.cc
--- a/src/DLD-FUNCTIONS/getgrent.cc
+++ b/src/corefcn/getgrent.cc
@@ -30,7 +30,7 @@
 
 #include "oct-group.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-map.h"
@@ -62,9 +62,9 @@
   return retval;
 }
 
-DEFUN_DLD (getgrent, args, ,
+DEFUN (getgrent, args, ,
  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{grp_struct} =} getgrent ()\n\
+@deftypefn {Built-in Function} {@var{grp_struct} =} getgrent ()\n\
 Return an entry from the group database, opening it if necessary.\n\
 Once the end of data has been reached, @code{getgrent} returns 0.\n\
 @end deftypefn")
@@ -89,9 +89,9 @@
   return retval;
 }
 
-DEFUN_DLD (getgrgid, args, ,
+DEFUN (getgrgid, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{grp_struct} =} getgrgid (@var{gid}).\n\
+@deftypefn {Built-in Function} {@var{grp_struct} =} getgrgid (@var{gid}).\n\
 Return the first entry from the group database with the group ID\n\
 @var{gid}.  If the group ID does not exist in the database,\n\
 @code{getgrgid} returns 0.\n\
@@ -129,9 +129,9 @@
   return retval;
 }
 
-DEFUN_DLD (getgrnam, args, ,
+DEFUN (getgrnam, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{grp_struct} =} getgrnam (@var{name})\n\
+@deftypefn {Built-in Function} {@var{grp_struct} =} getgrnam (@var{name})\n\
 Return the first entry from the group database with the group name\n\
 @var{name}.  If the group name does not exist in the database,\n\
 @code{getgrnam} returns 0.\n\
@@ -162,9 +162,9 @@
   return retval;
 }
 
-DEFUN_DLD (setgrent, args, ,
+DEFUN (setgrent, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} setgrent ()\n\
+@deftypefn {Built-in Function} {} setgrent ()\n\
 Return the internal pointer to the beginning of the group database.\n\
 @end deftypefn")
 {
@@ -188,9 +188,9 @@
   return retval;
 }
 
-DEFUN_DLD (endgrent, args, ,
+DEFUN (endgrent, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} endgrent ()\n\
+@deftypefn {Built-in Function} {} endgrent ()\n\
 Close the group database.\n\
 @end deftypefn")
 {
rename from src/DLD-FUNCTIONS/getpwent.cc
rename to src/corefcn/getpwent.cc
--- a/src/DLD-FUNCTIONS/getpwent.cc
+++ b/src/corefcn/getpwent.cc
@@ -30,7 +30,7 @@
 
 #include "oct-passwd.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-map.h"
@@ -65,9 +65,9 @@
   return retval;
 }
 
-DEFUN_DLD (getpwent, args, ,
+DEFUN (getpwent, args, ,
  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{pw_struct} =} getpwent ()\n\
+@deftypefn {Built-in Function} {@var{pw_struct} =} getpwent ()\n\
 Return a structure containing an entry from the password database,\n\
 opening it if necessary.  Once the end of the data has been reached,\n\
 @code{getpwent} returns 0.\n\
@@ -93,9 +93,9 @@
   return retval;
 }
 
-DEFUN_DLD (getpwuid, args, ,
+DEFUN (getpwuid, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{pw_struct} =} getpwuid (@var{uid}).\n\
+@deftypefn {Built-in Function} {@var{pw_struct} =} getpwuid (@var{uid}).\n\
 Return a structure containing the first entry from the password database\n\
 with the user ID @var{uid}.  If the user ID does not exist in the\n\
 database, @code{getpwuid} returns 0.\n\
@@ -133,9 +133,9 @@
   return retval;
 }
 
-DEFUN_DLD (getpwnam, args, ,
+DEFUN (getpwnam, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{pw_struct} =} getpwnam (@var{name})\n\
+@deftypefn {Built-in Function} {@var{pw_struct} =} getpwnam (@var{name})\n\
 Return a structure containing the first entry from the password database\n\
 with the user name @var{name}.  If the user name does not exist in the\n\
 database, @code{getpwname} returns 0.\n\
@@ -166,9 +166,9 @@
   return retval;
 }
 
-DEFUN_DLD (setpwent, args, ,
+DEFUN (setpwent, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} setpwent ()\n\
+@deftypefn {Built-in Function} {} setpwent ()\n\
 Return the internal pointer to the beginning of the password database.\n\
 @end deftypefn")
 {
@@ -192,9 +192,9 @@
   return retval;
 }
 
-DEFUN_DLD (endpwent, args, ,
+DEFUN (endpwent, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} endpwent ()\n\
+@deftypefn {Built-in Function} {} endpwent ()\n\
 Close the password database.\n\
 @end deftypefn")
 {
rename from src/DLD-FUNCTIONS/getrusage.cc
rename to src/corefcn/getrusage.cc
--- a/src/DLD-FUNCTIONS/getrusage.cc
+++ b/src/corefcn/getrusage.cc
@@ -36,7 +36,7 @@
 #include <sys/param.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "oct-map.h"
 #include "sysdep.h"
 #include "ov.h"
@@ -59,9 +59,9 @@
 
 // System resource functions.
 
-DEFUN_DLD (getrusage, , ,
+DEFUN (getrusage, , ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} getrusage ()\n\
+@deftypefn {Built-in Function} {} getrusage ()\n\
 Return a structure containing a number of statistics about the current\n\
 Octave process.  Not all fields are available on all systems.  If it is\n\
 not possible to get CPU time statistics, the CPU time slots are set to\n\
rename from src/DLD-FUNCTIONS/givens.cc
rename to src/corefcn/givens.cc
--- a/src/DLD-FUNCTIONS/givens.cc
+++ b/src/corefcn/givens.cc
@@ -26,14 +26,14 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 
-DEFUN_DLD (givens, args, nargout,
+DEFUN (givens, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{g} =} givens (@var{x}, @var{y})\n\
-@deftypefnx {Loadable Function} {[@var{c}, @var{s}] =} givens (@var{x}, @var{y})\n\
+@deftypefn  {Built-in Function} {@var{g} =} givens (@var{x}, @var{y})\n\
+@deftypefnx {Built-in Function} {[@var{c}, @var{s}] =} givens (@var{x}, @var{y})\n\
 @tex\n\
 Return a $2\\times 2$ orthogonal matrix\n\
 $$\n\
rename from src/DLD-FUNCTIONS/hess.cc
rename to src/corefcn/hess.cc
--- a/src/DLD-FUNCTIONS/hess.cc
+++ b/src/corefcn/hess.cc
@@ -29,16 +29,16 @@
 #include "fCmplxHESS.h"
 #include "floatHESS.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
 #include "utils.h"
 
-DEFUN_DLD (hess, args, nargout,
+DEFUN (hess, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{H} =} hess (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{P}, @var{H}] =} hess (@var{A})\n\
+@deftypefn  {Built-in Function} {@var{H} =} hess (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{P}, @var{H}] =} hess (@var{A})\n\
 @cindex Hessenberg decomposition\n\
 Compute the Hessenberg decomposition of the matrix @var{A}.\n\
 \n\
rename from src/DLD-FUNCTIONS/hex2num.cc
rename to src/corefcn/hex2num.cc
--- a/src/DLD-FUNCTIONS/hex2num.cc
+++ b/src/corefcn/hex2num.cc
@@ -26,15 +26,15 @@
 
 #include <algorithm>
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
 #include "utils.h"
 
-DEFUN_DLD (hex2num, args, ,
+DEFUN (hex2num, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{n} =} hex2num (@var{s})\n\
+@deftypefn {Built-in Function} {@var{n} =} hex2num (@var{s})\n\
 Typecast the 16 character hexadecimal character string to an IEEE 754\n\
 double precision number.  If fewer than 16 characters are given the\n\
 strings are right padded with '0' characters.\n\
@@ -122,9 +122,9 @@
 %!assert (hex2num (["c00";"bff";"000";"3ff";"400"]), [-2:2]')
 */
 
-DEFUN_DLD (num2hex, args, ,
+DEFUN (num2hex, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{s} =} num2hex (@var{n})\n\
+@deftypefn {Built-in Function} {@var{s} =} num2hex (@var{n})\n\
 Typecast a double precision number or vector to a 16 character hexadecimal\n\
 string of the IEEE 754 representation of the number.  For example:\n\
 \n\
rename from src/DLD-FUNCTIONS/inv.cc
rename to src/corefcn/inv.cc
--- a/src/DLD-FUNCTIONS/inv.cc
+++ b/src/corefcn/inv.cc
@@ -24,7 +24,7 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -36,10 +36,10 @@
 #include "ov-perm.h"
 #include "utils.h"
 
-DEFUN_DLD (inv, args, nargout,
+DEFUN (inv, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{x} =} inv (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{x}, @var{rcond}] =} inv (@var{A})\n\
+@deftypefn  {Built-in Function} {@var{x} =} inv (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{x}, @var{rcond}] =} inv (@var{A})\n\
 Compute the inverse of the square matrix @var{A}.  Return an estimate\n\
 of the reciprocal condition number if requested, otherwise warn of an\n\
 ill-conditioned matrix if the reciprocal condition number is small.\n\
@@ -236,10 +236,10 @@
 // alias_builtin() won't do the right thing if we are actually using
 // dynamic linking.
 
-DEFUN_DLD (inverse, args, nargout,
+DEFUN (inverse, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{x} =} inverse (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{x}, @var{rcond}] =} inverse (@var{A})\n\
+@deftypefn  {Built-in Function} {@var{x} =} inverse (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{x}, @var{rcond}] =} inverse (@var{A})\n\
 Compute the inverse of the square matrix @var{A}.\n\
 \n\
 This is an alias for @code{inv}.\n\
rename from src/DLD-FUNCTIONS/kron.cc
rename to src/corefcn/kron.cc
--- a/src/DLD-FUNCTIONS/kron.cc
+++ b/src/corefcn/kron.cc
@@ -44,7 +44,7 @@
 #include "mx-inlines.cc"
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 
@@ -243,9 +243,9 @@
 }
 
 
-DEFUN_DLD (kron, args, , "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} kron (@var{A}, @var{B})\n\
-@deftypefnx {Loadable Function} {} kron (@var{A1}, @var{A2}, @dots{})\n\
+DEFUN (kron, args, , "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} kron (@var{A}, @var{B})\n\
+@deftypefnx {Built-in Function} {} kron (@var{A1}, @var{A2}, @dots{})\n\
 Form the Kronecker product of two or more matrices, defined block by \n\
 block as\n\
 \n\
rename from src/DLD-FUNCTIONS/lookup.cc
rename to src/corefcn/lookup.cc
--- a/src/DLD-FUNCTIONS/lookup.cc
+++ b/src/corefcn/lookup.cc
@@ -34,7 +34,7 @@
 #include "CNDArray.h"
 
 #include "Cell.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -186,10 +186,10 @@
   return retval;
 }
 
-DEFUN_DLD (lookup, args, ,
+DEFUN (lookup, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{idx} =} lookup (@var{table}, @var{y})\n\
-@deftypefnx {Loadable Function} {@var{idx} =} lookup (@var{table}, @var{y}, @var{opt})\n\
+@deftypefn  {Built-in Function} {@var{idx} =} lookup (@var{table}, @var{y})\n\
+@deftypefnx {Built-in Function} {@var{idx} =} lookup (@var{table}, @var{y}, @var{opt})\n\
 Lookup values in a sorted table.  Usually used as a prelude to\n\
 interpolation.\n\
 \n\
rename from src/DLD-FUNCTIONS/lsode.cc
rename to src/corefcn/lsode.cc
--- a/src/DLD-FUNCTIONS/lsode.cc
+++ b/src/corefcn/lsode.cc
@@ -32,7 +32,7 @@
 #include "LSODE.h"
 #include "lo-mappers.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -156,10 +156,10 @@
     } \
   while (0)
 
-DEFUN_DLD (lsode, args, nargout,
+DEFUN (lsode, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{x}, @var{istate}, @var{msg}] =} lsode (@var{fcn}, @var{x_0}, @var{t})\n\
-@deftypefnx {Loadable Function} {[@var{x}, @var{istate}, @var{msg}] =} lsode (@var{fcn}, @var{x_0}, @var{t}, @var{t_crit})\n\
+@deftypefn  {Built-in Function} {[@var{x}, @var{istate}, @var{msg}] =} lsode (@var{fcn}, @var{x_0}, @var{t})\n\
+@deftypefnx {Built-in Function} {[@var{x}, @var{istate}, @var{msg}] =} lsode (@var{fcn}, @var{x_0}, @var{t}, @var{t_crit})\n\
 Solve the set of differential equations\n\
 @tex\n\
 $$ {dx \\over dt} = f (x, t) $$\n\
rename from src/DLD-FUNCTIONS/lu.cc
rename to src/corefcn/lu.cc
--- a/src/DLD-FUNCTIONS/lu.cc
+++ b/src/corefcn/lu.cc
@@ -31,7 +31,7 @@
 #include "SparseCmplxLU.h"
 #include "SparsedbleLU.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -61,15 +61,15 @@
     return U;
 }
 
-DEFUN_DLD (lu, args, nargout,
+DEFUN (lu, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{L}, @var{U}] =} lu (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}] =} lu (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} lu (@var{S})\n\
-@deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}, @var{Q}, @var{R}] =} lu (@var{S})\n\
-@deftypefnx {Loadable Function} {[@dots{}] =} lu (@var{S}, @var{thres})\n\
-@deftypefnx {Loadable Function} {@var{y} =} lu (@dots{})\n\
-@deftypefnx {Loadable Function} {[@dots{}] =} lu (@dots{}, \"vector\")\n\
+@deftypefn  {Built-in Function} {[@var{L}, @var{U}] =} lu (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{L}, @var{U}, @var{P}] =} lu (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} lu (@var{S})\n\
+@deftypefnx {Built-in Function} {[@var{L}, @var{U}, @var{P}, @var{Q}, @var{R}] =} lu (@var{S})\n\
+@deftypefnx {Built-in Function} {[@dots{}] =} lu (@var{S}, @var{thres})\n\
+@deftypefnx {Built-in Function} {@var{y} =} lu (@dots{})\n\
+@deftypefnx {Built-in Function} {[@dots{}] =} lu (@dots{}, \"vector\")\n\
 @cindex LU decomposition\n\
 Compute the LU@tie{}decomposition of @var{A}.  If @var{A} is full\n\
 subroutines from\n\
@@ -593,10 +593,10 @@
             (p.is_undefined () || p.rows () == m));
 }
 
-DEFUN_DLD (luupdate, args, ,
+DEFUN (luupdate, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{L}, @var{U}] =} luupdate (@var{L}, @var{U}, @var{x}, @var{y})\n\
-@deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}] =} luupdate (@var{L}, @var{U}, @var{P}, @var{x}, @var{y})\n\
+@deftypefn  {Built-in Function} {[@var{L}, @var{U}] =} luupdate (@var{L}, @var{U}, @var{x}, @var{y})\n\
+@deftypefnx {Built-in Function} {[@var{L}, @var{U}, @var{P}] =} luupdate (@var{L}, @var{U}, @var{P}, @var{x}, @var{y})\n\
 Given an LU@tie{}factorization of a real or complex matrix\n\
 @w{@var{A} = @var{L}*@var{U}}, @var{L}@tie{}lower unit trapezoidal and\n\
 @var{U}@tie{}upper trapezoidal, return the LU@tie{}factorization\n\
rename from src/DLD-FUNCTIONS/luinc.cc
rename to src/corefcn/luinc.cc
--- a/src/DLD-FUNCTIONS/luinc.cc
+++ b/src/corefcn/luinc.cc
@@ -24,7 +24,7 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -37,11 +37,11 @@
 #include "ov-re-sparse.h"
 #include "ov-cx-sparse.h"
 
-DEFUN_DLD (luinc, args, nargout,
+DEFUN (luinc, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, '0')\n\
-@deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, @var{droptol})\n\
-@deftypefnx {Loadable Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, @var{opts})\n\
+@deftypefn  {Built-in Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, '0')\n\
+@deftypefnx {Built-in Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, @var{droptol})\n\
+@deftypefnx {Built-in Function} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, @var{opts})\n\
 @cindex LU decomposition\n\
 Produce the incomplete LU@tie{}factorization of the sparse matrix @var{A}.\n\
 Two types of incomplete factorization are possible, and the type\n\
rename from src/DLD-FUNCTIONS/matrix_type.cc
rename to src/corefcn/matrix_type.cc
--- a/src/DLD-FUNCTIONS/matrix_type.cc
+++ b/src/corefcn/matrix_type.cc
@@ -27,7 +27,7 @@
 #include <algorithm>
 
 #include "ov.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "ov-re-mat.h"
 #include "ov-cx-mat.h"
@@ -36,14 +36,14 @@
 #include "MatrixType.h"
 #include "oct-locbuf.h"
 
-DEFUN_DLD (matrix_type, args, ,
+DEFUN (matrix_type, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{type} =} matrix_type (@var{A})\n\
-@deftypefnx {Loadable Function} {@var{type} =} matrix_type (@var{A}, \"nocompute\")\n\
-@deftypefnx {Loadable Function} {@var{A} =} matrix_type (@var{A}, @var{type})\n\
-@deftypefnx {Loadable Function} {@var{A} =} matrix_type (@var{A}, \"upper\", @var{perm})\n\
-@deftypefnx {Loadable Function} {@var{A} =} matrix_type (@var{A}, \"lower\", @var{perm})\n\
-@deftypefnx {Loadable Function} {@var{A} =} matrix_type (@var{A}, \"banded\", @var{nl}, @var{nu})\n\
+@deftypefn  {Built-in Function} {@var{type} =} matrix_type (@var{A})\n\
+@deftypefnx {Built-in Function} {@var{type} =} matrix_type (@var{A}, \"nocompute\")\n\
+@deftypefnx {Built-in Function} {@var{A} =} matrix_type (@var{A}, @var{type})\n\
+@deftypefnx {Built-in Function} {@var{A} =} matrix_type (@var{A}, \"upper\", @var{perm})\n\
+@deftypefnx {Built-in Function} {@var{A} =} matrix_type (@var{A}, \"lower\", @var{perm})\n\
+@deftypefnx {Built-in Function} {@var{A} =} matrix_type (@var{A}, \"banded\", @var{nl}, @var{nu})\n\
 Identify the matrix type or mark a matrix as a particular type.  This allows\n\
 more rapid solutions of linear equations involving @var{A} to be performed.\n\
 Called with a single argument, @code{matrix_type} returns the type of the\n\
rename from src/DLD-FUNCTIONS/max.cc
rename to src/corefcn/max.cc
--- a/src/DLD-FUNCTIONS/max.cc
+++ b/src/corefcn/max.cc
@@ -32,7 +32,7 @@
 #include "CNDArray.h"
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -305,13 +305,13 @@
   return retval;
 }
 
-DEFUN_DLD (min, args, nargout,
+DEFUN (min, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} min (@var{x})\n\
-@deftypefnx {Loadable Function} {} min (@var{x}, @var{y})\n\
-@deftypefnx {Loadable Function} {} min (@var{x}, [], @var{dim})\n\
-@deftypefnx {Loadable Function} {} min (@var{x}, @var{y}, @var{dim})\n\
-@deftypefnx {Loadable Function} {[@var{w}, @var{iw}] =} min (@var{x})\n\
+@deftypefn  {Built-in Function} {} min (@var{x})\n\
+@deftypefnx {Built-in Function} {} min (@var{x}, @var{y})\n\
+@deftypefnx {Built-in Function} {} min (@var{x}, [], @var{dim})\n\
+@deftypefnx {Built-in Function} {} min (@var{x}, @var{y}, @var{dim})\n\
+@deftypefnx {Built-in Function} {[@var{w}, @var{iw}] =} min (@var{x})\n\
 For a vector argument, return the minimum value.  For a matrix\n\
 argument, return the minimum value from each column, as a row\n\
 vector, or over the dimension @var{dim} if defined, in which case @var{y} \n\
@@ -376,13 +376,13 @@
 %!error min (1, 2, 3, 4)
 */
 
-DEFUN_DLD (max, args, nargout,
+DEFUN (max, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} max (@var{x})\n\
-@deftypefnx {Loadable Function} {} max (@var{x}, @var{y})\n\
-@deftypefnx {Loadable Function} {} max (@var{x}, [], @var{dim})\n\
-@deftypefnx {Loadable Function} {} max (@var{x}, @var{y}, @var{dim})\n\
-@deftypefnx {Loadable Function} {[@var{w}, @var{iw}] =} max (@var{x})\n\
+@deftypefn  {Built-in Function} {} max (@var{x})\n\
+@deftypefnx {Built-in Function} {} max (@var{x}, @var{y})\n\
+@deftypefnx {Built-in Function} {} max (@var{x}, [], @var{dim})\n\
+@deftypefnx {Built-in Function} {} max (@var{x}, @var{y}, @var{dim})\n\
+@deftypefnx {Built-in Function} {[@var{w}, @var{iw}] =} max (@var{x})\n\
 For a vector argument, return the maximum value.  For a matrix\n\
 argument, return the maximum value from each column, as a row\n\
 vector, or over the dimension @var{dim} if defined, in which case @var{y} \n\
@@ -548,11 +548,11 @@
   return retval;
 }
 
-DEFUN_DLD (cummin, args, nargout,
+DEFUN (cummin, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} cummin (@var{x})\n\
-@deftypefnx {Loadable Function} {} cummin (@var{x}, @var{dim})\n\
-@deftypefnx {Loadable Function} {[@var{w}, @var{iw}] =} cummin (@var{x})\n\
+@deftypefn  {Built-in Function} {} cummin (@var{x})\n\
+@deftypefnx {Built-in Function} {} cummin (@var{x}, @var{dim})\n\
+@deftypefnx {Built-in Function} {[@var{w}, @var{iw}] =} cummin (@var{x})\n\
 Return the cumulative minimum values along dimension @var{dim}.  If @var{dim}\n\
 is unspecified it defaults to column-wise operation.  For example:\n\
 \n\
@@ -590,11 +590,11 @@
   return do_cumminmax_body (args, nargout, true);
 }
 
-DEFUN_DLD (cummax, args, nargout,
+DEFUN (cummax, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} cummax (@var{x})\n\
-@deftypefnx {Loadable Function} {} cummax (@var{x}, @var{dim})\n\
-@deftypefnx {Loadable Function} {[@var{w}, @var{iw}] =} cummax (@var{x})\n\
+@deftypefn  {Built-in Function} {} cummax (@var{x})\n\
+@deftypefnx {Built-in Function} {} cummax (@var{x}, @var{dim})\n\
+@deftypefnx {Built-in Function} {[@var{w}, @var{iw}] =} cummax (@var{x})\n\
 Return the cumulative maximum values along dimension @var{dim}.  If @var{dim}\n\
 is unspecified it defaults to column-wise operation.  For example:\n\
 \n\
rename from src/DLD-FUNCTIONS/md5sum.cc
rename to src/corefcn/md5sum.cc
--- a/src/DLD-FUNCTIONS/md5sum.cc
+++ b/src/corefcn/md5sum.cc
@@ -28,7 +28,7 @@
 #include <string>
 #include <vector>
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "file-stat.h"
 #include "file-ops.h"
 #include "gripes.h"
@@ -36,10 +36,10 @@
 #include "oct-env.h"
 #include "oct-md5.h"
 
-DEFUN_DLD (md5sum, args, ,
+DEFUN (md5sum, args, ,
    "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} md5sum (@var{file})\n\
-@deftypefnx {Loadable Function} {} md5sum (@var{str}, @var{opt})\n\
+@deftypefn  {Built-in Function} {} md5sum (@var{file})\n\
+@deftypefnx {Built-in Function} {} md5sum (@var{str}, @var{opt})\n\
 Calculate the MD5 sum of the file @var{file}.  If the second parameter\n\
 @var{opt} exists and is true, then calculate the MD5 sum of the\n\
 string @var{str}.\n\
rename from src/DLD-FUNCTIONS/mgorth.cc
rename to src/corefcn/mgorth.cc
--- a/src/DLD-FUNCTIONS/mgorth.cc
+++ b/src/corefcn/mgorth.cc
@@ -26,7 +26,7 @@
 #endif
 
 #include "oct-norm.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 
@@ -48,9 +48,9 @@
     x = x / h(Vc);
 }
 
-DEFUN_DLD (mgorth, args, nargout,
+DEFUN (mgorth, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{y}, @var{h}] =} mgorth (@var{x}, @var{v})\n\
+@deftypefn {Built-in Function} {[@var{y}, @var{h}] =} mgorth (@var{x}, @var{v})\n\
 Orthogonalize a given column vector @var{x} with respect to a given\n\
 orthonormal basis @var{v} using a modified Gram-Schmidt orthogonalization.  \n\
 On exit, @var{y} is a unit vector such that:\n\
new file mode 100644
--- /dev/null
+++ b/src/corefcn/module.mk
@@ -0,0 +1,70 @@
+EXTRA_DIST += \
+  corefcn/module.mk
+
+corefcn_SRC = \
+  corefcn/__contourc__.cc \
+  corefcn/__dispatch__.cc \
+  corefcn/__lin_interpn__.cc \
+  corefcn/__pchip_deriv__.cc \
+  corefcn/__qp__.cc \
+  corefcn/balance.cc \
+  corefcn/besselj.cc \
+  corefcn/betainc.cc \
+  corefcn/bsxfun.cc \
+  corefcn/cellfun.cc \
+  corefcn/colloc.cc \
+  corefcn/conv2.cc \
+  corefcn/daspk.cc \
+  corefcn/dasrt.cc \
+  corefcn/dassl.cc \
+  corefcn/det.cc \
+  corefcn/dlmread.cc \
+  corefcn/dot.cc \
+  corefcn/eig.cc \
+  corefcn/fft.cc \
+  corefcn/fft2.cc \
+  corefcn/fftn.cc \
+  corefcn/filter.cc \
+  corefcn/find.cc \
+  corefcn/gammainc.cc \
+  corefcn/gcd.cc \
+  corefcn/getgrent.cc \
+  corefcn/getpwent.cc \
+  corefcn/getrusage.cc \
+  corefcn/givens.cc \
+  corefcn/hess.cc \
+  corefcn/hex2num.cc \
+  corefcn/inv.cc \
+  corefcn/kron.cc \
+  corefcn/lookup.cc \
+  corefcn/lsode.cc \
+  corefcn/lu.cc \
+  corefcn/luinc.cc \
+  corefcn/matrix_type.cc \
+  corefcn/max.cc \
+  corefcn/md5sum.cc \
+  corefcn/mgorth.cc \
+  corefcn/nproc.cc \
+  corefcn/pinv.cc \
+  corefcn/quad.cc \
+  corefcn/quadcc.cc \
+  corefcn/qz.cc \
+  corefcn/rand.cc \
+  corefcn/rcond.cc \
+  corefcn/regexp.cc \
+  corefcn/schur.cc \
+  corefcn/spparms.cc \
+  corefcn/sqrtm.cc \
+  corefcn/str2double.cc \
+  corefcn/strfind.cc \
+  corefcn/sub2ind.cc \
+  corefcn/svd.cc \
+  corefcn/syl.cc \
+  corefcn/time.cc \
+  corefcn/tril.cc \
+  corefcn/typecast.cc
+
+noinst_LTLIBRARIES += corefcn/libcorefcn.la
+
+corefcn_libcorefcn_la_SOURCES = $(corefcn_SRC)
+
rename from src/DLD-FUNCTIONS/nproc.cc
rename to src/corefcn/nproc.cc
--- a/src/DLD-FUNCTIONS/nproc.cc
+++ b/src/corefcn/nproc.cc
@@ -24,13 +24,13 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "nproc.h"
 
-DEFUN_DLD (nproc, args, nargout,
+DEFUN (nproc, args, nargout,
    "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} nproc ()\n\
-@deftypefnx {Loadable Function} {} nproc (@var{query})\n\
+@deftypefn  {Built-in Function} {} nproc ()\n\
+@deftypefnx {Built-in Function} {} nproc (@var{query})\n\
 Return the current number of available processors.\n\
 \n\
 If called with the optional argument @var{query}, modify how processors\n\
rename from src/DLD-FUNCTIONS/pinv.cc
rename to src/corefcn/pinv.cc
--- a/src/DLD-FUNCTIONS/pinv.cc
+++ b/src/corefcn/pinv.cc
@@ -24,7 +24,7 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -36,10 +36,10 @@
 #include "ov-flt-cx-diag.h"
 #include "ov-perm.h"
 
-DEFUN_DLD (pinv, args, ,
+DEFUN (pinv, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} pinv (@var{x})\n\
-@deftypefnx {Loadable Function} {} pinv (@var{x}, @var{tol})\n\
+@deftypefn  {Built-in Function} {} pinv (@var{x})\n\
+@deftypefnx {Built-in Function} {} pinv (@var{x}, @var{tol})\n\
 Return the pseudoinverse of @var{x}.  Singular values less than\n\
 @var{tol} are ignored.\n\
 \n\
rename from src/DLD-FUNCTIONS/quad.cc
rename to src/corefcn/quad.cc
--- a/src/DLD-FUNCTIONS/quad.cc
+++ b/src/corefcn/quad.cc
@@ -32,7 +32,7 @@
 #include "Quad.h"
 #include "lo-mappers.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "pager.h"
@@ -172,12 +172,12 @@
     } \
   while (0)
 
-DEFUN_DLD (quad, args, nargout,
+DEFUN (quad, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{q} =} quad (@var{f}, @var{a}, @var{b})\n\
-@deftypefnx {Loadable Function} {@var{q} =} quad (@var{f}, @var{a}, @var{b}, @var{tol})\n\
-@deftypefnx {Loadable Function} {@var{q} =} quad (@var{f}, @var{a}, @var{b}, @var{tol}, @var{sing})\n\
-@deftypefnx {Loadable Function} {[@var{q}, @var{ier}, @var{nfun}, @var{err}] =} quad (@dots{})\n\
+@deftypefn  {Built-in Function} {@var{q} =} quad (@var{f}, @var{a}, @var{b})\n\
+@deftypefnx {Built-in Function} {@var{q} =} quad (@var{f}, @var{a}, @var{b}, @var{tol})\n\
+@deftypefnx {Built-in Function} {@var{q} =} quad (@var{f}, @var{a}, @var{b}, @var{tol}, @var{sing})\n\
+@deftypefnx {Built-in Function} {[@var{q}, @var{ier}, @var{nfun}, @var{err}] =} quad (@dots{})\n\
 Numerically evaluate the integral of @var{f} from @var{a} to @var{b} using\n\
 Fortran routines from @w{@sc{quadpack}}.  @var{f} is a function handle,\n\
 inline function, or a string containing the name of the function to\n\
rename from src/DLD-FUNCTIONS/quadcc.cc
rename to src/corefcn/quadcc.cc
--- a/src/DLD-FUNCTIONS/quadcc.cc
+++ b/src/corefcn/quadcc.cc
@@ -24,12 +24,17 @@
 #include <config.h>
 #endif
 
-#include <stdlib.h>
-#include "lo-math.h"
 #include "lo-ieee.h"
-#include "oct.h"
 #include "parse.h"
-#include "ov-fcn-handle.h"
+#include "variables.h"
+
+#include "defun.h"
+#include "error.h"
+#include "oct-obj.h"
+#include "utils.h"
+
+//#include "oct.h"
+//#include "defun.h"
 
 /* Define the size of the interval heap. */
 #define cquad_heapsize                  200
@@ -1469,7 +1474,7 @@
 
 /* The actual integration routine.  */
 
-DEFUN_DLD (quadcc, args, nargout,
+DEFUN (quadcc, args, nargout,
 "-*- texinfo -*-\n\
 @deftypefn  {Function File} {@var{q} =} quadcc (@var{f}, @var{a}, @var{b})\n\
 @deftypefnx {Function File} {@var{q} =} quadcc (@var{f}, @var{a}, @var{b}, @var{tol})\n\
rename from src/DLD-FUNCTIONS/qz.cc
rename to src/corefcn/qz.cc
--- a/src/DLD-FUNCTIONS/qz.cc
+++ b/src/corefcn/qz.cc
@@ -44,7 +44,7 @@
 #include "lo-math.h"
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -290,10 +290,10 @@
 
 //FIXME: Matlab does not produce lambda as the first output argument.
 //       Compatibility problem?
-DEFUN_DLD (qz, args, nargout,
+DEFUN (qz, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{lambda} =} qz (@var{A}, @var{B})\n\
-@deftypefnx {Loadable Function} {@var{lambda} =} qz (@var{A}, @var{B}, @var{opt})\n\
+@deftypefn  {Built-in Function} {@var{lambda} =} qz (@var{A}, @var{B})\n\
+@deftypefnx {Built-in Function} {@var{lambda} =} qz (@var{A}, @var{B}, @var{opt})\n\
 QZ@tie{}decomposition of the generalized eigenvalue problem\n\
 (@math{A x = s B x}).  There are three ways to call this function:\n\
 @enumerate\n\
rename from src/DLD-FUNCTIONS/rand.cc
rename to src/corefcn/rand.cc
--- a/src/DLD-FUNCTIONS/rand.cc
+++ b/src/corefcn/rand.cc
@@ -39,7 +39,7 @@
 #include "oct-rand.h"
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -363,19 +363,19 @@
     }
 }
 
-DEFUN_DLD (rand, args, ,
+DEFUN (rand, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} rand (@var{n})\n\
-@deftypefnx {Loadable Function} {} rand (@var{n}, @var{m}, @dots{})\n\
-@deftypefnx {Loadable Function} {} rand ([@var{n} @var{m} @dots{}])\n\
-@deftypefnx {Loadable Function} {@var{v} =} rand (\"state\")\n\
-@deftypefnx {Loadable Function} {} rand (\"state\", @var{v})\n\
-@deftypefnx {Loadable Function} {} rand (\"state\", \"reset\")\n\
-@deftypefnx {Loadable Function} {@var{v} =} rand (\"seed\")\n\
-@deftypefnx {Loadable Function} {} rand (\"seed\", @var{v})\n\
-@deftypefnx {Loadable Function} {} rand (\"seed\", \"reset\")\n\
-@deftypefnx {Loadable Function} {} rand (@dots{}, \"single\")\n\
-@deftypefnx {Loadable Function} {} rand (@dots{}, \"double\")\n\
+@deftypefn  {Built-in Function} {} rand (@var{n})\n\
+@deftypefnx {Built-in Function} {} rand (@var{n}, @var{m}, @dots{})\n\
+@deftypefnx {Built-in Function} {} rand ([@var{n} @var{m} @dots{}])\n\
+@deftypefnx {Built-in Function} {@var{v} =} rand (\"state\")\n\
+@deftypefnx {Built-in Function} {} rand (\"state\", @var{v})\n\
+@deftypefnx {Built-in Function} {} rand (\"state\", \"reset\")\n\
+@deftypefnx {Built-in Function} {@var{v} =} rand (\"seed\")\n\
+@deftypefnx {Built-in Function} {} rand (\"seed\", @var{v})\n\
+@deftypefnx {Built-in Function} {} rand (\"seed\", \"reset\")\n\
+@deftypefnx {Built-in Function} {} rand (@dots{}, \"single\")\n\
+@deftypefnx {Built-in Function} {} rand (@dots{}, \"double\")\n\
 Return a matrix with random elements uniformly distributed on the\n\
 interval (0, 1).  The arguments are handled the same as the arguments\n\
 for @code{eye}.\n\
@@ -535,19 +535,19 @@
 
 static std::string current_distribution = octave_rand::distribution ();
 
-DEFUN_DLD (randn, args, ,
+DEFUN (randn, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} randn (@var{n})\n\
-@deftypefnx {Loadable Function} {} randn (@var{n}, @var{m}, @dots{})\n\
-@deftypefnx {Loadable Function} {} randn ([@var{n} @var{m} @dots{}])\n\
-@deftypefnx {Loadable Function} {@var{v} =} randn (\"state\")\n\
-@deftypefnx {Loadable Function} {} randn (\"state\", @var{v})\n\
-@deftypefnx {Loadable Function} {} randn (\"state\", \"reset\")\n\
-@deftypefnx {Loadable Function} {@var{v} =} randn (\"seed\")\n\
-@deftypefnx {Loadable Function} {} randn (\"seed\", @var{v})\n\
-@deftypefnx {Loadable Function} {} randn (\"seed\", \"reset\")\n\
-@deftypefnx {Loadable Function} {} randn (@dots{}, \"single\")\n\
-@deftypefnx {Loadable Function} {} randn (@dots{}, \"double\")\n\
+@deftypefn  {Built-in Function} {} randn (@var{n})\n\
+@deftypefnx {Built-in Function} {} randn (@var{n}, @var{m}, @dots{})\n\
+@deftypefnx {Built-in Function} {} randn ([@var{n} @var{m} @dots{}])\n\
+@deftypefnx {Built-in Function} {@var{v} =} randn (\"state\")\n\
+@deftypefnx {Built-in Function} {} randn (\"state\", @var{v})\n\
+@deftypefnx {Built-in Function} {} randn (\"state\", \"reset\")\n\
+@deftypefnx {Built-in Function} {@var{v} =} randn (\"seed\")\n\
+@deftypefnx {Built-in Function} {} randn (\"seed\", @var{v})\n\
+@deftypefnx {Built-in Function} {} randn (\"seed\", \"reset\")\n\
+@deftypefnx {Built-in Function} {} randn (@dots{}, \"single\")\n\
+@deftypefnx {Built-in Function} {} randn (@dots{}, \"double\")\n\
 Return a matrix with normally distributed random\n\
 elements having zero mean and variance one.  The arguments are\n\
 handled the same as the arguments for @code{rand}.\n\
@@ -606,19 +606,19 @@
 %! endif
 */
 
-DEFUN_DLD (rande, args, ,
+DEFUN (rande, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} rande (@var{n})\n\
-@deftypefnx {Loadable Function} {} rande (@var{n}, @var{m}, @dots{})\n\
-@deftypefnx {Loadable Function} {} rande ([@var{n} @var{m} @dots{}])\n\
-@deftypefnx {Loadable Function} {@var{v} =} rande (\"state\")\n\
-@deftypefnx {Loadable Function} {} rande (\"state\", @var{v})\n\
-@deftypefnx {Loadable Function} {} rande (\"state\", \"reset\")\n\
-@deftypefnx {Loadable Function} {@var{v} =} rande (\"seed\")\n\
-@deftypefnx {Loadable Function} {} rande (\"seed\", @var{v})\n\
-@deftypefnx {Loadable Function} {} rande (\"seed\", \"reset\")\n\
-@deftypefnx {Loadable Function} {} rande (@dots{}, \"single\")\n\
-@deftypefnx {Loadable Function} {} rande (@dots{}, \"double\")\n\
+@deftypefn  {Built-in Function} {} rande (@var{n})\n\
+@deftypefnx {Built-in Function} {} rande (@var{n}, @var{m}, @dots{})\n\
+@deftypefnx {Built-in Function} {} rande ([@var{n} @var{m} @dots{}])\n\
+@deftypefnx {Built-in Function} {@var{v} =} rande (\"state\")\n\
+@deftypefnx {Built-in Function} {} rande (\"state\", @var{v})\n\
+@deftypefnx {Built-in Function} {} rande (\"state\", \"reset\")\n\
+@deftypefnx {Built-in Function} {@var{v} =} rande (\"seed\")\n\
+@deftypefnx {Built-in Function} {} rande (\"seed\", @var{v})\n\
+@deftypefnx {Built-in Function} {} rande (\"seed\", \"reset\")\n\
+@deftypefnx {Built-in Function} {} rande (@dots{}, \"single\")\n\
+@deftypefnx {Built-in Function} {} rande (@dots{}, \"double\")\n\
 Return a matrix with exponentially distributed random elements.  The\n\
 arguments are handled the same as the arguments for @code{rand}.\n\
 \n\
@@ -678,19 +678,19 @@
 %! endif
 */
 
-DEFUN_DLD (randg, args, ,
+DEFUN (randg, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} randg (@var{n})\n\
-@deftypefnx {Loadable Function} {} randg (@var{n}, @var{m}, @dots{})\n\
-@deftypefnx {Loadable Function} {} randg ([@var{n} @var{m} @dots{}])\n\
-@deftypefnx {Loadable Function} {@var{v} =} randg (\"state\")\n\
-@deftypefnx {Loadable Function} {} randg (\"state\", @var{v})\n\
-@deftypefnx {Loadable Function} {} randg (\"state\", \"reset\")\n\
-@deftypefnx {Loadable Function} {@var{v} =} randg (\"seed\")\n\
-@deftypefnx {Loadable Function} {} randg (\"seed\", @var{v})\n\
-@deftypefnx {Loadable Function} {} randg (\"seed\", \"reset\")\n\
-@deftypefnx {Loadable Function} {} randg (@dots{}, \"single\")\n\
-@deftypefnx {Loadable Function} {} randg (@dots{}, \"double\")\n\
+@deftypefn  {Built-in Function} {} randg (@var{n})\n\
+@deftypefnx {Built-in Function} {} randg (@var{n}, @var{m}, @dots{})\n\
+@deftypefnx {Built-in Function} {} randg ([@var{n} @var{m} @dots{}])\n\
+@deftypefnx {Built-in Function} {@var{v} =} randg (\"state\")\n\
+@deftypefnx {Built-in Function} {} randg (\"state\", @var{v})\n\
+@deftypefnx {Built-in Function} {} randg (\"state\", \"reset\")\n\
+@deftypefnx {Built-in Function} {@var{v} =} randg (\"seed\")\n\
+@deftypefnx {Built-in Function} {} randg (\"seed\", @var{v})\n\
+@deftypefnx {Built-in Function} {} randg (\"seed\", \"reset\")\n\
+@deftypefnx {Built-in Function} {} randg (@dots{}, \"single\")\n\
+@deftypefnx {Built-in Function} {} randg (@dots{}, \"double\")\n\
 Return a matrix with @code{gamma (@var{a},1)} distributed random elements.\n\
 The arguments are handled the same as the arguments for @code{rand},\n\
 except for the argument @var{a}.\n\
@@ -949,19 +949,19 @@
 %! endif
 */
 
-DEFUN_DLD (randp, args, ,
+DEFUN (randp, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} randp (@var{l}, @var{n})\n\
-@deftypefnx {Loadable Function} {} randp (@var{l}, @var{n}, @var{m}, @dots{})\n\
-@deftypefnx {Loadable Function} {} randp (@var{l}, [@var{n} @var{m} @dots{}])\n\
-@deftypefnx {Loadable Function} {@var{v} =} randp (\"state\")\n\
-@deftypefnx {Loadable Function} {} randp (\"state\", @var{v})\n\
-@deftypefnx {Loadable Function} {} randp (\"state\", \"reset\")\n\
-@deftypefnx {Loadable Function} {@var{v} =} randp (\"seed\")\n\
-@deftypefnx {Loadable Function} {} randp (\"seed\", @var{v})\n\
-@deftypefnx {Loadable Function} {} randp (\"seed\", \"reset\")\n\
-@deftypefnx {Loadable Function} {} randp (@dots{}, \"single\")\n\
-@deftypefnx {Loadable Function} {} randp (@dots{}, \"double\")\n\
+@deftypefn  {Built-in Function} {} randp (@var{l}, @var{n})\n\
+@deftypefnx {Built-in Function} {} randp (@var{l}, @var{n}, @var{m}, @dots{})\n\
+@deftypefnx {Built-in Function} {} randp (@var{l}, [@var{n} @var{m} @dots{}])\n\
+@deftypefnx {Built-in Function} {@var{v} =} randp (\"state\")\n\
+@deftypefnx {Built-in Function} {} randp (\"state\", @var{v})\n\
+@deftypefnx {Built-in Function} {} randp (\"state\", \"reset\")\n\
+@deftypefnx {Built-in Function} {@var{v} =} randp (\"seed\")\n\
+@deftypefnx {Built-in Function} {} randp (\"seed\", @var{v})\n\
+@deftypefnx {Built-in Function} {} randp (\"seed\", \"reset\")\n\
+@deftypefnx {Built-in Function} {} randp (@dots{}, \"single\")\n\
+@deftypefnx {Built-in Function} {} randp (@dots{}, \"double\")\n\
 Return a matrix with Poisson distributed random elements with mean value\n\
 parameter given by the first argument, @var{l}.  The arguments\n\
 are handled the same as the arguments for @code{rand}, except for the\n\
@@ -1096,10 +1096,10 @@
 %! endif
 */
 
-DEFUN_DLD (randperm, args, ,
+DEFUN (randperm, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} randperm (@var{n})\n\
-@deftypefnx {Loadable Function} {} randperm (@var{n}, @var{m})\n\
+@deftypefn  {Built-in Function} {} randperm (@var{n})\n\
+@deftypefnx {Built-in Function} {} randperm (@var{n}, @var{m})\n\
 Return a row vector containing a random permutation of @code{1:@var{n}}.\n\
 If @var{m} is supplied, return @var{m} unique entries, sampled without\n\
 replacement from @code{1:@var{n}}.  The complexity is O(@var{n}) in\n\
rename from src/DLD-FUNCTIONS/rcond.cc
rename to src/corefcn/rcond.cc
--- a/src/DLD-FUNCTIONS/rcond.cc
+++ b/src/corefcn/rcond.cc
@@ -24,15 +24,15 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
 #include "utils.h"
 
-DEFUN_DLD (rcond, args, ,
+DEFUN (rcond, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{c} =} rcond (@var{A})\n\
+@deftypefn {Built-in Function} {@var{c} =} rcond (@var{A})\n\
 Compute the 1-norm estimate of the reciprocal condition number as returned\n\
 by @sc{lapack}.  If the matrix is well-conditioned then @var{c} will be near\n\
 1 and if the matrix is poorly conditioned it will be close to zero.\n\
rename from src/DLD-FUNCTIONS/regexp.cc
rename to src/corefcn/regexp.cc
--- a/src/DLD-FUNCTIONS/regexp.cc
+++ b/src/corefcn/regexp.cc
@@ -36,7 +36,7 @@
 #include "regexp.h"
 #include "str-vec.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "Cell.h"
 #include "error.h"
 #include "gripes.h"
@@ -536,10 +536,10 @@
 
 }
 
-DEFUN_DLD (regexp, args, nargout,
+DEFUN (regexp, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{s}, @var{e}, @var{te}, @var{m}, @var{t}, @var{nm}, @var{sp}] =} regexp (@var{str}, @var{pat})\n\
-@deftypefnx {Loadable Function} {[@dots{}] =} regexp (@var{str}, @var{pat}, \"@var{opt1}\", @dots{})\n\
+@deftypefn  {Built-in Function} {[@var{s}, @var{e}, @var{te}, @var{m}, @var{t}, @var{nm}, @var{sp}] =} regexp (@var{str}, @var{pat})\n\
+@deftypefnx {Built-in Function} {[@dots{}] =} regexp (@var{str}, @var{pat}, \"@var{opt1}\", @dots{})\n\
 Regular expression string matching.  Search for @var{pat} in @var{str} and\n\
 return the positions and substrings of any matches, or empty values if there\n\
 are none.\n\
@@ -1016,10 +1016,10 @@
 %!assert (regexp ("\n", "\n"), 1);
 */
 
-DEFUN_DLD (regexpi, args, nargout,
+DEFUN (regexpi, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{s}, @var{e}, @var{te}, @var{m}, @var{t}, @var{nm}, @var{sp}] =} regexpi (@var{str}, @var{pat})\n\
-@deftypefnx {Loadable Function} {[@dots{}] =} regexpi (@var{str}, @var{pat}, \"@var{opt1}\", @dots{})\n\
+@deftypefn  {Built-in Function} {[@var{s}, @var{e}, @var{te}, @var{m}, @var{t}, @var{nm}, @var{sp}] =} regexpi (@var{str}, @var{pat})\n\
+@deftypefnx {Built-in Function} {[@dots{}] =} regexpi (@var{str}, @var{pat}, \"@var{opt1}\", @dots{})\n\
 \n\
 Case insensitive regular expression string matching.  Search for @var{pat} in\n\
 @var{str} and return the positions and substrings of any matches, or empty\n\
@@ -1228,10 +1228,10 @@
   return regexp_replace (pattern, buffer, replacement, options, who);
 }
 
-DEFUN_DLD (regexprep, args, ,
+DEFUN (regexprep, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{outstr} =} regexprep (@var{string}, @var{pat}, @var{repstr})\n\
-@deftypefnx {Loadable Function} {@var{outstr} =} regexprep (@var{string}, @var{pat}, @var{repstr}, \"@var{opt1}\", @dots{})\n\
+@deftypefn  {Built-in Function} {@var{outstr} =} regexprep (@var{string}, @var{pat}, @var{repstr})\n\
+@deftypefnx {Built-in Function} {@var{outstr} =} regexprep (@var{string}, @var{pat}, @var{repstr}, \"@var{opt1}\", @dots{})\n\
 Replace occurrences of pattern @var{pat} in @var{string} with @var{repstr}.\n\
 \n\
 The pattern is a regular expression as documented for @code{regexp}.\n\
rename from src/DLD-FUNCTIONS/schur.cc
rename to src/corefcn/schur.cc
--- a/src/DLD-FUNCTIONS/schur.cc
+++ b/src/corefcn/schur.cc
@@ -31,7 +31,7 @@
 #include "fCmplxSCHUR.h"
 #include "floatSCHUR.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -57,13 +57,13 @@
   return retval;
 }
 
-DEFUN_DLD (schur, args, nargout,
+DEFUN (schur, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{S} =} schur (@var{A})\n\
-@deftypefnx {Loadable Function} {@var{S} =} schur (@var{A}, \"real\")\n\
-@deftypefnx {Loadable Function} {@var{S} =} schur (@var{A}, \"complex\")\n\
-@deftypefnx {Loadable Function} {@var{S} =} schur (@var{A}, @var{opt})\n\
-@deftypefnx {Loadable Function} {[@var{U}, @var{S}] =} schur (@var{A}, @dots{})\n\
+@deftypefn  {Built-in Function} {@var{S} =} schur (@var{A})\n\
+@deftypefnx {Built-in Function} {@var{S} =} schur (@var{A}, \"real\")\n\
+@deftypefnx {Built-in Function} {@var{S} =} schur (@var{A}, \"complex\")\n\
+@deftypefnx {Built-in Function} {@var{S} =} schur (@var{A}, @var{opt})\n\
+@deftypefnx {Built-in Function} {[@var{U}, @var{S}] =} schur (@var{A}, @dots{})\n\
 @cindex Schur decomposition\n\
 Compute the Schur@tie{}decomposition of @var{A}\n\
 @tex\n\
@@ -292,7 +292,7 @@
 %!error <argument must be a square matrix> schur ([1, 2, 3; 4, 5, 6])
 */
 
-DEFUN_DLD (rsf2csf, args, nargout,
+DEFUN (rsf2csf, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn {Function File} {[@var{U}, @var{T}] =} rsf2csf (@var{UR}, @var{TR})\n\
 Convert a real, upper quasi-triangular Schur@tie{}form @var{TR} to a complex,\n\
rename from src/DLD-FUNCTIONS/spparms.cc
rename to src/corefcn/spparms.cc
--- a/src/DLD-FUNCTIONS/spparms.cc
+++ b/src/corefcn/spparms.cc
@@ -25,7 +25,7 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "ov.h"
 #include "pager.h"
 #include "error.h"
@@ -33,16 +33,16 @@
 
 #include "oct-spparms.h"
 
-DEFUN_DLD (spparms, args, nargout,
+DEFUN (spparms, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} { } spparms ()\n\
-@deftypefnx {Loadable Function} {@var{vals} =} spparms ()\n\
-@deftypefnx {Loadable Function} {[@var{keys}, @var{vals}] =} spparms ()\n\
-@deftypefnx {Loadable Function} {@var{val} =} spparms (@var{key})\n\
-@deftypefnx {Loadable Function} { } spparms (@var{vals})\n\
-@deftypefnx {Loadable Function} { } spparms (\"defaults\")\n\
-@deftypefnx {Loadable Function} { } spparms (\"tight\")\n\
-@deftypefnx {Loadable Function} { } spparms (@var{key}, @var{val})\n\
+@deftypefn  {Built-in Function} { } spparms ()\n\
+@deftypefnx {Built-in Function} {@var{vals} =} spparms ()\n\
+@deftypefnx {Built-in Function} {[@var{keys}, @var{vals}] =} spparms ()\n\
+@deftypefnx {Built-in Function} {@var{val} =} spparms (@var{key})\n\
+@deftypefnx {Built-in Function} { } spparms (@var{vals})\n\
+@deftypefnx {Built-in Function} { } spparms (\"defaults\")\n\
+@deftypefnx {Built-in Function} { } spparms (\"tight\")\n\
+@deftypefnx {Built-in Function} { } spparms (@var{key}, @var{val})\n\
 Query or set the parameters used by the sparse solvers and factorization\n\
 functions.  The first four calls above get information about the current\n\
 settings, while the others change the current settings.  The parameters are\n\
@@ -126,7 +126,7 @@
           std::string str = args(0).string_value ();
           int len = str.length ();
           for (int i = 0; i < len; i++)
-            str [i] = tolower (str [i]);
+            str[i] = tolower (str[i]);
 
           if (str == "defaults")
             octave_sparse_params::defaults ();
rename from src/DLD-FUNCTIONS/sqrtm.cc
rename to src/corefcn/sqrtm.cc
--- a/src/DLD-FUNCTIONS/sqrtm.cc
+++ b/src/corefcn/sqrtm.cc
@@ -33,7 +33,7 @@
 #include "lo-mappers.h"
 #include "oct-norm.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "utils.h"
@@ -199,10 +199,10 @@
   return retval;
 }
 
-DEFUN_DLD (sqrtm, args, nargout,
+DEFUN (sqrtm, args, nargout,
  "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{s} =} sqrtm (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{s}, @var{error_estimate}] =} sqrtm (@var{A})\n\
+@deftypefn  {Built-in Function} {@var{s} =} sqrtm (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{s}, @var{error_estimate}] =} sqrtm (@var{A})\n\
 Compute the matrix square root of the square matrix @var{A}.\n\
 \n\
 Ref: N.J. Higham.  @cite{A New sqrtm for @sc{matlab}}.  Numerical\n\
rename from src/DLD-FUNCTIONS/str2double.cc
rename to src/corefcn/str2double.cc
--- a/src/DLD-FUNCTIONS/str2double.cc
+++ b/src/corefcn/str2double.cc
@@ -34,7 +34,7 @@
 
 #include "Cell.h"
 #include "ov.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "gripes.h"
 #include "utils.h"
 
@@ -294,7 +294,7 @@
   return val;
 }
 
-DEFUN_DLD (str2double, args, ,
+DEFUN (str2double, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} str2double (@var{s})\n\
 Convert a string to a real or complex number.\n\
rename from src/DLD-FUNCTIONS/strfind.cc
rename to src/corefcn/strfind.cc
--- a/src/DLD-FUNCTIONS/strfind.cc
+++ b/src/corefcn/strfind.cc
@@ -32,7 +32,7 @@
 
 #include "Cell.h"
 #include "ov.h"
-#include "defun-dld.h"
+#include "defun.h"
 #include "unwind-prot.h"
 #include "gripes.h"
 #include "utils.h"
@@ -145,10 +145,10 @@
   return result;
 }
 
-DEFUN_DLD (strfind, args, ,
+DEFUN (strfind, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{idx} =} strfind (@var{str}, @var{pattern})\n\
-@deftypefnx {Loadable Function} {@var{idx} =} strfind (@var{cellstr}, @var{pattern})\n\
+@deftypefn  {Built-in Function} {@var{idx} =} strfind (@var{str}, @var{pattern})\n\
+@deftypefnx {Built-in Function} {@var{idx} =} strfind (@var{cellstr}, @var{pattern})\n\
 Search for @var{pattern} in the string @var{str} and return the\n\
 starting index of every such occurrence in the vector @var{idx}.\n\
 If there is no such occurrence, or if @var{pattern} is longer\n\
@@ -319,10 +319,10 @@
   return ret;
 }
 
-DEFUN_DLD (strrep, args, ,
+DEFUN (strrep, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} strrep (@var{s}, @var{ptn}, @var{rep})\n\
-@deftypefnx {Loadable Function} {} strrep (@var{s}, @var{ptn}, @var{rep}, \"overlaps\", @var{o})\n\
+@deftypefn  {Built-in Function} {} strrep (@var{s}, @var{ptn}, @var{rep})\n\
+@deftypefnx {Built-in Function} {} strrep (@var{s}, @var{ptn}, @var{rep}, \"overlaps\", @var{o})\n\
 Replace all occurrences of the substring @var{ptn} in the string @var{s}\n\
 with the string @var{rep} and return the result.  For example:\n\
 \n\
rename from src/DLD-FUNCTIONS/sub2ind.cc
rename to src/corefcn/sub2ind.cc
--- a/src/DLD-FUNCTIONS/sub2ind.cc
+++ b/src/corefcn/sub2ind.cc
@@ -26,7 +26,7 @@
 
 #include "quit.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -61,7 +61,7 @@
   return dv;
 }
 
-DEFUN_DLD (sub2ind, args, ,
+DEFUN (sub2ind, args, ,
   "-*- texinfo -*-\n\
 @deftypefn  {Function File} {@var{ind} =} sub2ind (@var{dims}, @var{i}, @var{j})\n\
 @deftypefnx {Function File} {@var{ind} =} sub2ind (@var{dims}, @var{s1}, @var{s2}, @dots{}, @var{sN})\n\
@@ -167,7 +167,7 @@
 %!error <subscript indices> sub2ind ([10 10], 1, 1.5)
 */
 
-DEFUN_DLD (ind2sub, args, nargout,
+DEFUN (ind2sub, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn {Function File} {[@var{s1}, @var{s2}, @dots{}, @var{sN}] =} ind2sub (@var{dims}, @var{ind})\n\
 Convert a linear index to subscripts.\n\
rename from src/DLD-FUNCTIONS/svd.cc
rename to src/corefcn/svd.cc
--- a/src/DLD-FUNCTIONS/svd.cc
+++ b/src/corefcn/svd.cc
@@ -29,7 +29,7 @@
 #include "fCmplxSVD.h"
 #include "floatSVD.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -39,11 +39,11 @@
 
 static int Vsvd_driver = SVD::GESVD;
 
-DEFUN_DLD (svd, args, nargout,
+DEFUN (svd, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{s} =} svd (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{U}, @var{S}, @var{V}] =} svd (@var{A})\n\
-@deftypefnx {Loadable Function} {[@var{U}, @var{S}, @var{V}] =} svd (@var{A}, @var{econ})\n\
+@deftypefn  {Built-in Function} {@var{s} =} svd (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{U}, @var{S}, @var{V}] =} svd (@var{A})\n\
+@deftypefnx {Built-in Function} {[@var{U}, @var{S}, @var{V}] =} svd (@var{A}, @var{econ})\n\
 @cindex singular value decomposition\n\
 Compute the singular value decomposition of @var{A}\n\
 @tex\n\
@@ -402,11 +402,11 @@
 %!error [u, v] = svd ([1, 2; 3, 4])
 */
 
-DEFUN_DLD (svd_driver, args, nargout,
+DEFUN (svd_driver, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{val} =} svd_driver ()\n\
-@deftypefnx {Loadable Function} {@var{old_val} =} svd_driver (@var{new_val})\n\
-@deftypefnx {Loadable Function} {} svd_driver (@var{new_val}, \"local\")\n\
+@deftypefn  {Built-in Function} {@var{val} =} svd_driver ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} svd_driver (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} svd_driver (@var{new_val}, \"local\")\n\
 Query or set the underlying @sc{lapack} driver used by @code{svd}.\n\
 Currently recognized values are \"gesvd\" and \"gesdd\".  The default\n\
 is \"gesvd\".\n\
rename from src/DLD-FUNCTIONS/syl.cc
rename to src/corefcn/syl.cc
--- a/src/DLD-FUNCTIONS/syl.cc
+++ b/src/corefcn/syl.cc
@@ -26,15 +26,15 @@
 #include <config.h>
 #endif
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
 #include "utils.h"
 
-DEFUN_DLD (syl, args, nargout,
+DEFUN (syl, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{x} =} syl (@var{A}, @var{B}, @var{C})\n\
+@deftypefn {Built-in Function} {@var{x} =} syl (@var{A}, @var{B}, @var{C})\n\
 Solve the Sylvester equation\n\
 @tex\n\
 $$\n\
rename from src/DLD-FUNCTIONS/time.cc
rename to src/corefcn/time.cc
--- a/src/DLD-FUNCTIONS/time.cc
+++ b/src/corefcn/time.cc
@@ -26,7 +26,7 @@
 
 #include <string>
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-map.h"
 #include "oct-time.h"
@@ -101,9 +101,9 @@
   return tm;
 }
 
-DEFUN_DLD (time, args, ,
+DEFUN (time, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{seconds} =} time ()\n\
+@deftypefn {Built-in Function} {@var{seconds} =} time ()\n\
 Return the current time as the number of seconds since the epoch.  The\n\
 epoch is referenced to 00:00:00 CUT (Coordinated Universal Time) 1 Jan\n\
 1970.  For example, on Monday February 17, 1997 at 07:15:06 CUT, the\n\
@@ -125,9 +125,9 @@
 %!assert (time () > 0)
 */
 
-DEFUN_DLD (gmtime, args, ,
+DEFUN (gmtime, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{tm_struct} =} gmtime (@var{t})\n\
+@deftypefn {Built-in Function} {@var{tm_struct} =} gmtime (@var{t})\n\
 Given a value returned from @code{time}, or any non-negative integer,\n\
 return a time structure corresponding to CUT (Coordinated Universal Time).\n\
 For example:\n\
@@ -187,9 +187,9 @@
 %!error gmtime (1, 2)
 */
 
-DEFUN_DLD (localtime, args, ,
+DEFUN (localtime, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{tm_struct} =} localtime (@var{t})\n\
+@deftypefn {Built-in Function} {@var{tm_struct} =} localtime (@var{t})\n\
 Given a value returned from @code{time}, or any non-negative integer,\n\
 return a time structure corresponding to the local time zone.\n\
 \n\
@@ -248,9 +248,9 @@
 %!error localtime (1, 2)
 */
 
-DEFUN_DLD (mktime, args, ,
+DEFUN (mktime, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{seconds} =} mktime (@var{tm_struct})\n\
+@deftypefn {Built-in Function} {@var{seconds} =} mktime (@var{tm_struct})\n\
 Convert a time structure corresponding to the local time to the number\n\
 of seconds since the epoch.  For example:\n\
 \n\
@@ -302,9 +302,9 @@
 %!error mktime (1, 2, 3)
 */
 
-DEFUN_DLD (strftime, args, ,
+DEFUN (strftime, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} strftime (@var{fmt}, @var{tm_struct})\n\
+@deftypefn {Built-in Function} {} strftime (@var{fmt}, @var{tm_struct})\n\
 Format the time structure @var{tm_struct} in a flexible way using the\n\
 format string @var{fmt} that contains @samp{%} substitutions\n\
 similar to those in @code{printf}.  Except where noted, substituted\n\
@@ -497,9 +497,9 @@
 %!error strftime ("foo", localtime (time ()), 1)
 */
 
-DEFUN_DLD (strptime, args, ,
+DEFUN (strptime, args, ,
  "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{tm_struct}, @var{nchars}] =} strptime (@var{str}, @var{fmt})\n\
+@deftypefn {Built-in Function} {[@var{tm_struct}, @var{nchars}] =} strptime (@var{str}, @var{fmt})\n\
 Convert the string @var{str} to the time structure @var{tm_struct} under\n\
 the control of the format string @var{fmt}.\n\
 \n\
rename from src/DLD-FUNCTIONS/tril.cc
rename to src/corefcn/tril.cc
--- a/src/DLD-FUNCTIONS/tril.cc
+++ b/src/corefcn/tril.cc
@@ -33,7 +33,7 @@
 #include "ov.h"
 #include "Cell.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "oct-obj.h"
 
@@ -339,7 +339,7 @@
   return retval;
 }
 
-DEFUN_DLD (tril, args, ,
+DEFUN (tril, args, ,
   "-*- texinfo -*-\n\
 @deftypefn  {Function File} {} tril (@var{A})\n\
 @deftypefnx {Function File} {} tril (@var{A}, @var{k})\n\
@@ -395,7 +395,7 @@
   return do_trilu ("tril", args);
 }
 
-DEFUN_DLD (triu, args, ,
+DEFUN (triu, args, ,
   "-*- texinfo -*-\n\
 @deftypefn  {Function File} {} triu (@var{A})\n\
 @deftypefnx {Function File} {} triu (@var{A}, @var{k})\n\
rename from src/DLD-FUNCTIONS/typecast.cc
rename to src/corefcn/typecast.cc
--- a/src/DLD-FUNCTIONS/typecast.cc
+++ b/src/corefcn/typecast.cc
@@ -27,7 +27,7 @@
 
 #include "mx-base.h"
 
-#include "defun-dld.h"
+#include "defun.h"
 #include "error.h"
 #include "gripes.h"
 #include "oct-obj.h"
@@ -86,9 +86,9 @@
 }
 
 
-DEFUN_DLD (typecast, args, ,
+DEFUN (typecast, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} typecast (@var{x}, @var{class})\n\
+@deftypefn {Built-in Function} {} typecast (@var{x}, @var{class})\n\
 Return a new array @var{y} resulting from interpreting the data of\n\
 @var{x} in memory as data of the numeric class @var{class}.  Both the class\n\
 of @var{x} and @var{class} must be one of the built-in numeric classes:\n\
@@ -271,9 +271,9 @@
     }
 }
 
-DEFUN_DLD (bitpack, args, ,
+DEFUN (bitpack, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{y} =} bitpack (@var{x}, @var{class})\n\
+@deftypefn {Built-in Function} {@var{y} =} bitpack (@var{x}, @var{class})\n\
 Return a new array @var{y} resulting from interpreting an array\n\
 @var{x} as raw bit patterns for data of the numeric class @var{class}.\n\
 @var{class} must be one of the built-in numeric classes:\n\
@@ -380,9 +380,9 @@
   return retval;
 }
 
-DEFUN_DLD (bitunpack, args, ,
+DEFUN (bitunpack, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{y} =} bitunpack (@var{x})\n\
+@deftypefn {Built-in Function} {@var{y} =} bitunpack (@var{x})\n\
 Return an array @var{y} corresponding to the raw bit patterns of\n\
 @var{x}.  @var{x} must belong to one of the built-in numeric classes:\n\
 \n\
--- a/src/data.cc
+++ b/src/data.cc
@@ -214,6 +214,7 @@
 Compute atan (@var{y} / @var{x}) for corresponding elements of @var{y}\n\
 and @var{x}.  Signal an error if @var{y} and @var{x} do not match in size\n\
 and orientation.\n\
+@seealso{tan, tand, tanh, atanh}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -2370,6 +2371,7 @@
 Return the \"length\" of the object @var{a}.  For matrix objects, the\n\
 length is the number of rows or columns, whichever is greater (this\n\
 odd definition is used for compatibility with @sc{matlab}).\n\
+@seealso{size}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -2395,6 +2397,7 @@
     @result{} 3\n\
 @end group\n\
 @end example\n\
+@seealso{size}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -2488,7 +2491,7 @@
 \n\
 @noindent\n\
 returns the number of columns in the given matrix.\n\
-@seealso{numel}\n\
+@seealso{numel, ndims, length, rows, columns}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -2551,7 +2554,7 @@
 Return true if the dimensions of all arguments agree.\n\
 Trailing singleton dimensions are ignored.\n\
 Called with a single or no argument, size_equal returns true.\n\
-@seealso{size, numel}\n\
+@seealso{size, numel, ndims}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -2583,7 +2586,7 @@
    "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {@var{scalar} =} nnz (@var{a})\n\
 Return the number of non zero elements in @var{a}.\n\
-@seealso{sparse}\n\
+@seealso{sparse, nzmax}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -2604,7 +2607,7 @@
 for sparse objects.  There are some cases of user created sparse objects\n\
 where the value returned by @dfn{nzmax} will not be the same as @dfn{nnz},\n\
 but in general they will give the same result.\n\
-@seealso{sparse, spalloc}\n\
+@seealso{nnz, spalloc, sparse}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -2882,7 +2885,7 @@
 \n\
 @noindent\n\
 but it uses less memory and avoids calling @code{conj} if @var{x} is real.\n\
-@seealso{sum}\n\
+@seealso{sum, prod}\n\
 @end deftypefn")
 {
   DATA_REDUCTION (sumsq);
@@ -2963,7 +2966,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} iscomplex (@var{x})\n\
 Return true if @var{x} is a complex-valued numeric object.\n\
-@seealso{isreal, isnumeric}\n\
+@seealso{isreal, isnumeric, islogical, ischar, isfloat, isa}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -3013,7 +3016,7 @@
   @result{} [ 1 + 3i   2 + 4i ]\n\
 @end group\n\
 @end example\n\
-@seealso{real, imag, iscomplex}\n\
+@seealso{real, imag, iscomplex, abs, arg}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -3292,7 +3295,7 @@
 Return true if @var{x} is a non-complex matrix or scalar.\n\
 For compatibility with @sc{matlab}, this includes logical and character\n\
 matrices.\n\
-@seealso{iscomplex, isnumeric}\n\
+@seealso{iscomplex, isnumeric, isa}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -3310,7 +3313,7 @@
 @deftypefn {Built-in Function} {} isempty (@var{a})\n\
 Return true if @var{a} is an empty matrix (any one of its dimensions is\n\
 zero).  Otherwise, return false.\n\
-@seealso{isnull}\n\
+@seealso{isnull, isa}\n\
 @end deftypefn")
 {
   octave_value retval = false;
@@ -3329,7 +3332,7 @@
 Return true if @var{x} is a numeric object, i.e., an integer, real, or\n\
 complex array.  Logical and character arrays are not considered to be\n\
 numeric.\n\
-@seealso{isinteger, isfloat, isreal, iscomplex, islogical, ischar, iscell, isstruct}\n\
+@seealso{isinteger, isfloat, isreal, iscomplex, islogical, ischar, iscell, isstruct, isa}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -3365,7 +3368,7 @@
 Scalars (1x1 matrices) and vectors (@nospell{1xN} or @nospell{Nx1} matrices)\n\
 are subsets of the more general N-dimensional matrix and @code{ismatrix}\n\
 will return true for these objects as well.\n\
-@seealso{isscalar, isvector, iscell, isstruct, issparse}\n\
+@seealso{isscalar, isvector, iscell, isstruct, issparse, isa}\n\
 @end deftypefn")
 {
   octave_value retval = false;
@@ -3947,7 +3950,7 @@
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
 either \"double\" or \"single\".\n\
-@seealso{isinf}\n\
+@seealso{isinf, NaN}\n\
 @end deftypefn")
 {
   return fill_matrix (args, lo_ieee_inf_value (),
@@ -4006,7 +4009,7 @@
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
 either \"double\" or \"single\".\n\
-@seealso{isnan}\n\
+@seealso{isnan, Inf}\n\
 @end deftypefn")
 {
   return fill_matrix (args, lo_ieee_nan_value (),
@@ -4055,6 +4058,7 @@
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
 either \"double\" or \"single\".\n\
+@seealso{log, exp, pi, i, j}\n\
 @end deftypefn")
 {
 #if defined (M_E)
@@ -4095,6 +4099,7 @@
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
 either \"double\" or \"single\".\n\
+@seealso{realmax, realmin, intmax, bitmax}\n\
 @end deftypefn")
 {
   int nargin = args.length ();
@@ -4210,6 +4215,7 @@
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
 either \"double\" or \"single\".\n\
+@seealso{e, i, j}\n\
 @end deftypefn")
 {
 #if defined (M_PI)
@@ -4248,7 +4254,7 @@
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
 either \"double\" or \"single\".\n\
-@seealso{realmin, intmax, bitmax}\n\
+@seealso{realmin, intmax, bitmax, eps}\n\
 @end deftypefn")
 {
   return fill_matrix (args, DBL_MAX, FLT_MAX, "realmax");
@@ -4281,7 +4287,7 @@
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
 either \"double\" or \"single\".\n\
-@seealso{realmax, intmin}\n\
+@seealso{realmax, intmin, eps}\n\
 @end deftypefn")
 {
   return fill_matrix (args, DBL_MIN, FLT_MIN, "realmin");
@@ -4307,7 +4313,8 @@
 @ifnottex\n\
 @code{sqrt (-1)}.\n\
 @end ifnottex\n\
- I, and its equivalents i, J, and j, are functions so any of the names may\n\
+\n\
+I, and its equivalents i, j, and J, are functions so any of the names may\n\
 be reused for other purposes (such as i for a counter variable).\n\
 \n\
 When called with no arguments, return a scalar with the value @math{i}.  When\n\
@@ -4317,6 +4324,7 @@
 arguments specify additional matrix dimensions.\n\
 The optional argument @var{class} specifies the return type and may be\n\
 either \"double\" or \"single\".\n\
+@seealso{e, pi, log, exp, i, j, J}\n\
 @end deftypefn")
 {
   return fill_matrix (args, Complex (0.0, 1.0), "I");
@@ -4549,7 +4557,7 @@
 Calling @code{eye} with no arguments is equivalent to calling it\n\
 with an argument of 1.  Any negative dimensions are treated as zero. \n\
 These odd definitions are for compatibility with @sc{matlab}.\n\
-@seealso{speye}\n\
+@seealso{speye, ones, zeros}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -4679,6 +4687,7 @@
 \n\
 For compatibility with @sc{matlab}, return the second argument (@var{limit})\n\
 if fewer than two values are requested.\n\
+@seealso{logspace}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -4786,7 +4795,7 @@
 An object can be resized to more dimensions than it has;\n\
 in such case the missing dimensions are assumed to be 1.\n\
 Resizing an object to fewer dimensions is not possible.\n\
-@seealso{reshape, postpad}\n\
+@seealso{reshape, postpad, prepad, cat}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -4861,7 +4870,7 @@
 A single dimension of the return matrix may be left unspecified and Octave\n\
 will determine its size automatically.  An empty matrix ([]) is used to flag\n\
 the unspecified dimension.\n\
-@seealso{resize}\n\
+@seealso{resize, vec, postpad, cat, squeeze}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -4979,7 +4988,7 @@
 @code{@var{x}(:)}.  If @var{dim} is supplied, the dimensions of @var{v}\n\
 are set to @var{dim} with all elements along the last dimension.\n\
 This is equivalent to @code{shiftdim (@var{x}(:), 1-@var{dim})}.\n\
-@seealso{vech}\n\
+@seealso{vech, resize, cat}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -5042,6 +5051,7 @@
 Remove singleton dimensions from @var{x} and return the result.\n\
 Note that for compatibility with @sc{matlab}, all objects have\n\
 a minimum of two dimensions and row vectors are left unchanged.\n\
+@seealso{reshape}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -5056,7 +5066,7 @@
 
 DEFUN (full, args, ,
     "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{FM} =} full (@var{SM})\n\
+@deftypefn {Built-in Function} {@var{FM} =} full (@var{SM})\n\
 Return a full storage matrix from a sparse, diagonal, permutation matrix\n\
 or a range.\n\
 @seealso{sparse}\n\
@@ -5281,6 +5291,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} uplus (@var{x})\n\
 This function and @w{@xcode{+ x}} are equivalent.\n\
+@seealso{uminus, plus, minus}\n\
 @end deftypefn")
 {
   return unary_op_defun_body (octave_value::op_uplus, args);
@@ -5290,6 +5301,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} uminus (@var{x})\n\
 This function and @w{@xcode{- x}} are equivalent.\n\
+@seealso{uplus, minus}\n\
 @end deftypefn")
 {
   return unary_op_defun_body (octave_value::op_uminus, args);
@@ -5413,7 +5425,7 @@
 @end example\n\
 \n\
 At least one argument is required.\n\
-@seealso{minus}\n\
+@seealso{minus, uplus}\n\
 @end deftypefn")
 {
   return binary_assoc_op_defun_body (octave_value::op_add,
@@ -5424,7 +5436,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} minus (@var{x}, @var{y})\n\
 This function and @w{@xcode{x - y}} are equivalent.\n\
-@seealso{plus}\n\
+@seealso{plus, uminus}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_sub, args);
@@ -5444,7 +5456,7 @@
 @end example\n\
 \n\
 At least one argument is required.\n\
-@seealso{times}\n\
+@seealso{times, plus, minus, rdivide, mrdivide, mldivide, mpower}\n\
 @end deftypefn")
 {
   return binary_assoc_op_defun_body (octave_value::op_mul,
@@ -5456,7 +5468,7 @@
 @deftypefn {Built-in Function} {} mrdivide (@var{x}, @var{y})\n\
 Return the matrix right division of @var{x} and @var{y}.\n\
 This function and @w{@xcode{x / y}} are equivalent.\n\
-@seealso{mldivide, rdivide}\n\
+@seealso{mldivide, rdivide, plus, minus}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_div, args);
@@ -5467,7 +5479,7 @@
 @deftypefn {Built-in Function} {} mpower (@var{x}, @var{y})\n\
 Return the matrix power operation of @var{x} raised to the @var{y} power.\n\
 This function and @w{@xcode{x ^ y}} are equivalent.\n\
-@seealso{power}\n\
+@seealso{power, mtimes, plus, minus}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_pow, args);
@@ -5478,7 +5490,7 @@
 @deftypefn {Built-in Function} {} mldivide (@var{x}, @var{y})\n\
 Return the matrix left division of @var{x} and @var{y}.\n\
 This function and @w{@xcode{x @xbackslashchar{} y}} are equivalent.\n\
-@seealso{mrdivide, ldivide}\n\
+@seealso{mrdivide, ldivide, rdivide}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_ldiv, args);
@@ -5488,6 +5500,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} lt (@var{x}, @var{y})\n\
 This function is equivalent to @w{@code{x < y}}.\n\
+@seealso{le, eq, ge, gt, ne}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_lt, args);
@@ -5497,6 +5510,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} le (@var{x}, @var{y})\n\
 This function is equivalent to @w{@code{x <= y}}.\n\
+@seealso{eq, ge, gt, ne, lt}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_le, args);
@@ -5507,7 +5521,7 @@
 @deftypefn {Built-in Function} {} eq (@var{x}, @var{y})\n\
 Return true if the two inputs are equal.\n\
 This function is equivalent to @w{@code{x == y}}.\n\
-@seealso{ne, isequal}\n\
+@seealso{ne, isequal, le, ge, gt, ne, lt}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_eq, args);
@@ -5517,6 +5531,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} ge (@var{x}, @var{y})\n\
 This function is equivalent to @w{@code{x >= y}}.\n\
+@seealso{le, eq, gt, ne, lt}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_ge, args);
@@ -5526,6 +5541,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} gt (@var{x}, @var{y})\n\
 This function is equivalent to @w{@code{x > y}}.\n\
+@seealso{le, eq, ge, ne, lt}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_gt, args);
@@ -5536,7 +5552,7 @@
 @deftypefn {Built-in Function} {} ne (@var{x}, @var{y})\n\
 Return true if the two inputs are not equal.\n\
 This function is equivalent to @w{@code{x != y}}.\n\
-@seealso{eq, isequal}\n\
+@seealso{eq, isequal, le, ge, lt}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_ne, args);
@@ -5556,7 +5572,7 @@
 @end example\n\
 \n\
 At least one argument is required.\n\
-@seealso{mtimes}\n\
+@seealso{mtimes, rdivide}\n\
 @end deftypefn")
 {
   return binary_assoc_op_defun_body (octave_value::op_el_mul,
@@ -5568,7 +5584,7 @@
 @deftypefn {Built-in Function} {} rdivide (@var{x}, @var{y})\n\
 Return the element-by-element right division of @var{x} and @var{y}.\n\
 This function and @w{@xcode{x ./ y}} are equivalent.\n\
-@seealso{ldivide, mrdivide}\n\
+@seealso{ldivide, mrdivide, times, plus}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_el_div, args);
@@ -5595,7 +5611,7 @@
 @deftypefn {Built-in Function} {} ldivide (@var{x}, @var{y})\n\
 Return the element-by-element left division of @var{x} and @var{y}.\n\
 This function and @w{@xcode{x .@xbackslashchar{} y}} are equivalent.\n\
-@seealso{rdivide, mldivide}\n\
+@seealso{rdivide, mldivide, times, plus}\n\
 @end deftypefn")
 {
   return binary_op_defun_body (octave_value::op_el_ldiv, args);
@@ -5686,6 +5702,7 @@
 @code{toc} functions report the actual wall clock time that elapsed\n\
 between the calls.  This may include time spent processing other jobs or\n\
 doing nothing at all.\n\
+@seealso{toc, cputime}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -5718,7 +5735,7 @@
 @deftypefn  {Built-in Function} {} toc ()\n\
 @deftypefnx {Built-in Function} {} toc (@var{id})\n\
 @deftypefnx {Built-in Function} {@var{val} =} toc (@dots{})\n\
-See tic.\n\
+@seealso{tic, cputime}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -5790,6 +5807,7 @@
 Note that because Octave used some CPU time to start, it is reasonable\n\
 to check to see if @code{cputime} works by checking to see if the total\n\
 CPU time used is nonzero.\n\
+@seealso{tic, toc}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -5847,10 +5865,10 @@
 
 DEFUN (sort, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x})\n\
-@deftypefnx {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim})\n\
-@deftypefnx {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{mode})\n\
-@deftypefnx {Loadable Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim}, @var{mode})\n\
+@deftypefn  {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x})\n\
+@deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim})\n\
+@deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{mode})\n\
+@deftypefnx {Built-in Function} {[@var{s}, @var{i}] =} sort (@var{x}, @var{dim}, @var{mode})\n\
 Return a copy of @var{x} with the elements arranged in increasing\n\
 order.  For matrices, @code{sort} orders the elements within columns\n\
 \n\
@@ -5910,6 +5928,7 @@
 \n\
 The algorithm used in @code{sort} is optimized for the sorting of partially\n\
 ordered lists.\n\
+@seealso{sortrows, issorted}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -6799,7 +6818,7 @@
 \n\
 @var{mask} can also be arbitrary numeric type, in which case\n\
 it is first converted to logical.\n\
-@seealso{logical}\n\
+@seealso{logical, diff}\n\
 @end deftypefn")
 {
   int nargin = args.length ();
@@ -7027,6 +7046,7 @@
 @var{k}-th order differences are calculated along this dimension.\n\
 In the case where @var{k} exceeds @code{size (@var{x}, @var{dim})}\n\
 an empty matrix is returned.\n\
+@seealso{sort, merge}\n\
 @end deftypefn")
 {
   int nargin = args.length ();
@@ -7137,7 +7157,7 @@
 endfor\n\
 @end group\n\
 @end example\n\
-@seealso{repmat}\n\
+@seealso{repmat, cat}\n\
 @end deftypefn")
 {
   octave_value retval;
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -504,8 +504,8 @@
 
 DEFUN (dbstop, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{rline} =} dbstop (\"@var{func}\")\n\
-@deftypefnx {Loadable Function} {@var{rline} =} dbstop (\"@var{func}\", @var{line}, @dots{})\n\
+@deftypefn  {Built-in Function} {@var{rline} =} dbstop (\"@var{func}\")\n\
+@deftypefnx {Built-in Function} {@var{rline} =} dbstop (\"@var{func}\", @var{line}, @dots{})\n\
 Set a breakpoint in function @var{func}.\n\
 \n\
 Arguments are\n\
@@ -548,8 +548,8 @@
 
 DEFUN (dbclear, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} dbclear (\"@var{func}\")\n\
-@deftypefnx {Loadable Function} {} dbclear (\"@var{func}\", @var{line}, @dots{})\n\
+@deftypefn  {Built-in Function} {} dbclear (\"@var{func}\")\n\
+@deftypefnx {Built-in Function} {} dbclear (\"@var{func}\", @var{line}, @dots{})\n\
 Delete a breakpoint in the function @var{func}.\n\
 \n\
 Arguments are\n\
@@ -585,9 +585,9 @@
 
 DEFUN (dbstatus, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} dbstatus ()\n\
-@deftypefnx {Loadable Function} {@var{brk_list} =} dbstatus ()\n\
-@deftypefnx {Loadable Function} {@var{brk_list} =} dbstatus (\"@var{func}\")\n\
+@deftypefn  {Built-in Function} {} dbstatus ()\n\
+@deftypefnx {Built-in Function} {@var{brk_list} =} dbstatus ()\n\
+@deftypefnx {Built-in Function} {@var{brk_list} =} dbstatus (\"@var{func}\")\n\
 Report the location of active breakpoints.\n\
 \n\
 When called with no input or output arguments, print the list of\n\
@@ -701,7 +701,7 @@
 
 DEFUN (dbwhere, , ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} dbwhere ()\n\
+@deftypefn {Built-in Function} {} dbwhere ()\n\
 In debugging mode, report the current file and line number where\n\
 execution is stopped.\n\
 @seealso{dbstatus, dbcont, dbstep, dbup}\n\
@@ -794,13 +794,13 @@
 
 DEFUN (dbtype, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} dbtype ()\n\
-@deftypefnx {Loadable Function} {} dbtype (\"startl:endl\")\n\
-@deftypefnx {Loadable Function} {} dbtype (\"startl:end\")\n\
-@deftypefnx {Loadable Function} {} dbtype (\"@var{func}\")\n\
-@deftypefnx {Loadable Function} {} dbtype (\"@var{func}\", \"startl\")\n\
-@deftypefnx {Loadable Function} {} dbtype (\"@var{func}\", \"startl:endl\")\n\
-@deftypefnx {Loadable Function} {} dbtype (\"@var{func}\", \"startl:end\")\n\
+@deftypefn  {Built-in Function} {} dbtype ()\n\
+@deftypefnx {Built-in Function} {} dbtype (\"startl:endl\")\n\
+@deftypefnx {Built-in Function} {} dbtype (\"startl:end\")\n\
+@deftypefnx {Built-in Function} {} dbtype (\"@var{func}\")\n\
+@deftypefnx {Built-in Function} {} dbtype (\"@var{func}\", \"startl\")\n\
+@deftypefnx {Built-in Function} {} dbtype (\"@var{func}\", \"startl:endl\")\n\
+@deftypefnx {Built-in Function} {} dbtype (\"@var{func}\", \"startl:end\")\n\
 When in debugging mode and called with no arguments, list the script file\n\
 being debugged with line numbers.  An optional range specification,\n\
 specified as a string, can be used to list only a portion of the file.\n\
@@ -1022,9 +1022,9 @@
 
 DEFUN (dbstack, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} dbstack ()\n\
-@deftypefnx {Loadable Function} {} dbstack (@var{n})\n\
-@deftypefnx {Loadable Function} {[@var{stack}, @var{idx}] =} dbstack (@dots{})\n\
+@deftypefn  {Built-in Function} {} dbstack ()\n\
+@deftypefnx {Built-in Function} {} dbstack (@var{n})\n\
+@deftypefnx {Built-in Function} {[@var{stack}, @var{idx}] =} dbstack (@dots{})\n\
 Display or return current debugging function stack information.\n\
 With optional argument @var{n}, omit the @var{n} innermost stack frames.\n\
 \n\
@@ -1090,8 +1090,8 @@
 
 DEFUN (dbup, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} dbup\n\
-@deftypefnx {Loadable Function} {} dbup (@var{n})\n\
+@deftypefn  {Built-in Function} {} dbup\n\
+@deftypefnx {Built-in Function} {} dbup (@var{n})\n\
 In debugging mode, move up the execution stack @var{n} frames.\n\
 If @var{n} is omitted, move up one frame.\n\
 @seealso{dbstack, dbdown}\n\
@@ -1106,8 +1106,8 @@
 
 DEFUN (dbdown, args, ,
   "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {} dbdown\n\
-@deftypefnx {Loadable Function} {} dbdown (@var{n})\n\
+@deftypefn  {Built-in Function} {} dbdown\n\
+@deftypefnx {Built-in Function} {} dbdown (@var{n})\n\
 In debugging mode, move down the execution stack @var{n} frames.\n\
 If @var{n} is omitted, move down one frame.\n\
 @seealso{dbstack, dbup}\n\
@@ -1252,7 +1252,7 @@
 
 DEFUN (isdebugmode, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} isdebugmode ()\n\
+@deftypefn {Built-in Function} {} isdebugmode ()\n\
 Return true if in debugging mode, otherwise false.\n\
 @seealso{dbwhere, dbstack, dbstatus}\n\
 @end deftypefn")
--- a/src/defun-int.h
+++ b/src/defun-int.h
@@ -39,7 +39,7 @@
 
 extern OCTINTERP_API void
 install_builtin_function (octave_builtin::fcn f, const std::string& name,
-                          const std::string& doc,
+                          const std::string& file, const std::string& doc,
                           bool can_hide_function = true);
 
 extern OCTINTERP_API void
--- a/src/defun.cc
+++ b/src/defun.cc
@@ -80,10 +80,10 @@
 
 void
 install_builtin_function (octave_builtin::fcn f, const std::string& name,
-                          const std::string& doc,
+                          const std::string& file, const std::string& doc,
                           bool /* can_hide_function -- not yet implemented */)
 {
-  octave_value fcn (new octave_builtin (f, name, doc));
+  octave_value fcn (new octave_builtin (f, name, file, doc));
 
   symbol_table::install_built_in_function (name, fcn);
 }
--- a/src/find-defun-files.sh
+++ b/src/find-defun-files.sh
@@ -21,6 +21,6 @@
     file="$srcdir/$arg"
   fi
   if [ "`$EGREP -l "$DEFUN_PATTERN" $file`" ]; then
-    echo "$file" | $SED 's,.*/,,; s/\.cc$/.df/; s/\.ll$/.df/; s/\.yy$/.df/';
+    echo "$file" | $SED "s,\\$srcdir/,," | $SED 's/\.cc$/.df/; s/\.ll$/.df/; s/\.yy$/.df/';
   fi
 done
--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -6833,9 +6833,9 @@
 
   v(1) += delta_el;
 
-  if(v(1) > 90)
+  if (v(1) > 90)
     v(1) = 90;
-  if(v(1) < -90)
+  if (v(1) < -90)
     v(1) = -90;
 
   v(0) = fmod (v(0) - delta_az + 720,360);
--- a/src/help.cc
+++ b/src/help.cc
@@ -762,7 +762,7 @@
   string_vector retval (lst.size ());
   int j = 0;
   for (map_iter iter = lst.begin (); iter != lst.end (); iter ++)
-    retval [j++] = iter->first;
+    retval[j++] = iter->first;
   return retval;
 }
 
@@ -954,7 +954,7 @@
 }
 
 DEFUN (get_help_text, args, , "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{text}, @var{format}] =} get_help_text (@var{name})\n\
+@deftypefn {Built-in Function} {[@var{text}, @var{format}] =} get_help_text (@var{name})\n\
 Return the raw help text of function @var{name}.\n\
 \n\
 The raw help text is returned in @var{text} and the format in @var{format}\n\
@@ -1023,7 +1023,7 @@
 
 DEFUN (get_help_text_from_file, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{text}, @var{format}] =} get_help_text_from_file (@var{fname})\n\
+@deftypefn {Built-in Function} {[@var{text}, @var{format}] =} get_help_text_from_file (@var{fname})\n\
 Return the raw help text from the file @var{fname}.\n\
 \n\
 The raw help text is returned in @var{text} and the format in @var{format}\n\
@@ -1118,7 +1118,10 @@
                   if (fcn->is_user_function ())
                     type = "command-line function";
                   else
-                    type = "built-in function";
+                    {
+                      file = fcn->src_file_name ();
+                      type = "built-in function";
+                    }
                 }
               else
                 type = val.is_user_script ()
@@ -1215,11 +1218,11 @@
     {
       const int dir_len = dir.size ();
       const int filename_len = filename.size ();
-      const int max_allowed_seps = file_ops::is_dir_sep (dir [dir_len-1]) ? 0 : 1;
+      const int max_allowed_seps = file_ops::is_dir_sep (dir[dir_len-1]) ? 0 : 1;
 
       int num_seps = 0;
       for (int i = dir_len; i < filename_len; i++)
-        if (file_ops::is_dir_sep (filename [i]))
+        if (file_ops::is_dir_sep (filename[i]))
           num_seps ++;
 
       return (num_seps <= max_allowed_seps);
new file mode 100644
--- /dev/null
+++ b/src/jit-ir.cc
@@ -0,0 +1,601 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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/>.
+
+*/
+
+// defines required by llvm
+#define __STDC_LIMIT_MACROS
+#define __STDC_CONSTANT_MACROS
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_LLVM
+
+#include "jit-ir.h"
+
+#include <llvm/BasicBlock.h>
+#include <llvm/Instructions.h>
+
+#include "error.h"
+#include "pt-jit.h"
+
+// -------------------- jit_use --------------------
+jit_block *
+jit_use::user_parent (void) const
+{
+  return muser->parent ();
+}
+
+// -------------------- jit_value --------------------
+jit_value::~jit_value (void)
+{}
+
+jit_block *
+jit_value::first_use_block (void)
+{
+  jit_use *use = first_use ();
+  while (use)
+    {
+      if (! isa<jit_error_check> (use->user ()))
+        return use->user_parent ();
+
+      use = use->next ();
+    }
+
+  return 0;
+}
+
+void
+jit_value::replace_with (jit_value *value)
+{
+  while (first_use ())
+    {
+      jit_instruction *user = first_use ()->user ();
+      size_t idx = first_use ()->index ();
+      user->stash_argument (idx, value);
+    }
+}
+
+#define JIT_METH(clname)                                \
+  void                                                  \
+  jit_ ## clname::accept (jit_ir_walker& walker)        \
+  {                                                     \
+    walker.visit (*this);                               \
+  }
+
+JIT_VISIT_IR_NOTEMPLATE
+#undef JIT_METH
+
+std::ostream&
+operator<< (std::ostream& os, const jit_value& value)
+{
+  return value.short_print (os);
+}
+
+std::ostream&
+jit_print (std::ostream& os, jit_value *avalue)
+{
+  if (avalue)
+    return avalue->print (os);
+  return os << "NULL";
+}
+
+// -------------------- jit_instruction --------------------
+void
+jit_instruction::remove (void)
+{
+  if (mparent)
+    mparent->remove (mlocation);
+  resize_arguments (0);
+}
+
+llvm::BasicBlock *
+jit_instruction::parent_llvm (void) const
+{
+  return mparent->to_llvm ();
+}
+
+std::ostream&
+jit_instruction::short_print (std::ostream& os) const
+{
+  if (type ())
+    jit_print (os, type ()) << ": ";
+  return os << "#" << mid;
+}
+
+void
+jit_instruction::do_construct_ssa (size_t start, size_t end)
+{
+  for (size_t i = start; i < end; ++i)
+    {
+      jit_value *arg = argument (i);
+      jit_variable *var = dynamic_cast<jit_variable *> (arg);
+      if (var && var->has_top ())
+        stash_argument (i, var->top ());
+    }
+}
+
+// -------------------- jit_block --------------------
+void
+jit_block::replace_with (jit_value *value)
+{
+  assert (isa<jit_block> (value));
+  jit_block *block = static_cast<jit_block *> (value);
+
+  jit_value::replace_with (block);
+
+  while (ILIST_T::first_use ())
+    {
+      jit_phi_incomming *incomming = ILIST_T::first_use ();
+      incomming->stash_value (block);
+    }
+}
+
+void
+jit_block::replace_in_phi (jit_block *ablock, jit_block *with)
+{
+  jit_phi_incomming *node = ILIST_T::first_use ();
+  while (node)
+    {
+      jit_phi_incomming *prev = node;
+      node = node->next ();
+
+      if (prev->user_parent () == ablock)
+        prev->stash_value (with);
+    }
+}
+
+jit_block *
+jit_block::maybe_merge ()
+{
+  if (successor_count () == 1 && successor (0) != this
+      && (successor (0)->use_count () == 1 || instructions.size () == 1))
+    {
+      jit_block *to_merge = successor (0);
+      merge (*to_merge);
+      return to_merge;
+    }
+
+  return 0;
+}
+
+void
+jit_block::merge (jit_block& block)
+{
+  // the merge block will contain a new terminator
+  jit_terminator *old_term = terminator ();
+  if (old_term)
+    old_term->remove ();
+
+  bool was_empty = end () == begin ();
+  iterator merge_begin = end ();
+  if (! was_empty)
+    --merge_begin;
+
+  instructions.splice (end (), block.instructions);
+  if (was_empty)
+    merge_begin = begin ();
+  else
+    ++merge_begin;
+
+  // now merge_begin points to the start of the new instructions, we must
+  // update their parent information
+  for (iterator iter = merge_begin; iter != end (); ++iter)
+    {
+      jit_instruction *instr = *iter;
+      instr->stash_parent (this, iter);
+    }
+
+  block.replace_with (this);
+}
+
+jit_instruction *
+jit_block::prepend (jit_instruction *instr)
+{
+  instructions.push_front (instr);
+  instr->stash_parent (this, instructions.begin ());
+  return instr;
+}
+
+jit_instruction *
+jit_block::prepend_after_phi (jit_instruction *instr)
+{
+  // FIXME: Make this O(1)
+  for (iterator iter = begin (); iter != end (); ++iter)
+    {
+      jit_instruction *temp = *iter;
+      if (! isa<jit_phi> (temp))
+        {
+          insert_before (iter, instr);
+          return instr;
+        }
+    }
+
+  return append (instr);
+}
+
+void
+jit_block::internal_append (jit_instruction *instr)
+{
+  instructions.push_back (instr);
+  instr->stash_parent (this, --instructions.end ());
+}
+
+jit_instruction *
+jit_block::insert_before (iterator loc, jit_instruction *instr)
+{
+  iterator iloc = instructions.insert (loc, instr);
+  instr->stash_parent (this, iloc);
+  return instr;
+}
+
+jit_instruction *
+jit_block::insert_after (iterator loc, jit_instruction *instr)
+{
+  ++loc;
+  iterator iloc = instructions.insert (loc, instr);
+  instr->stash_parent (this, iloc);
+  return instr;
+}
+
+jit_terminator *
+jit_block::terminator (void) const
+{
+  assert (this);
+  if (instructions.empty ())
+    return 0;
+
+  jit_instruction *last = instructions.back ();
+  return dynamic_cast<jit_terminator *> (last);
+}
+
+bool
+jit_block::branch_alive (jit_block *asucc) const
+{
+  return terminator ()->alive (asucc);
+}
+
+jit_block *
+jit_block::successor (size_t i) const
+{
+  jit_terminator *term = terminator ();
+  return term->successor (i);
+}
+
+size_t
+jit_block::successor_count (void) const
+{
+  jit_terminator *term = terminator ();
+  return term ? term->successor_count () : 0;
+}
+
+llvm::BasicBlock *
+jit_block::to_llvm (void) const
+{
+  return llvm::cast<llvm::BasicBlock> (llvm_value);
+}
+
+std::ostream&
+jit_block::print_dom (std::ostream& os) const
+{
+  short_print (os);
+  os << ":\n";
+  os << "  mid: " << mid << std::endl;
+  os << "  predecessors: ";
+  for (jit_use *use = first_use (); use; use = use->next ())
+    os << *use->user_parent () << " ";
+  os << std::endl;
+
+  os << "  successors: ";
+  for (size_t i = 0; i < successor_count (); ++i)
+    os << *successor (i) << " ";
+  os << std::endl;
+
+  os << "  idom: ";
+  if (idom)
+    os << *idom;
+  else
+    os << "NULL";
+  os << std::endl;
+  os << "  df: ";
+  for (df_iterator iter = df_begin (); iter != df_end (); ++iter)
+    os << **iter << " ";
+  os << std::endl;
+
+  os << "  dom_succ: ";
+  for (size_t i = 0; i < dom_succ.size (); ++i)
+    os << *dom_succ[i] << " ";
+
+  return os << std::endl;
+}
+
+void
+jit_block::compute_df (size_t avisit_count)
+{
+  if (visited (avisit_count))
+    return;
+
+  if (use_count () >= 2)
+    {
+      for (jit_use *use = first_use (); use; use = use->next ())
+        {
+          jit_block *runner = use->user_parent ();
+          while (runner != idom)
+            {
+              runner->mdf.insert (this);
+              runner = runner->idom;
+            }
+        }
+    }
+
+  for (size_t i = 0; i < successor_count (); ++i)
+    successor (i)->compute_df (avisit_count);
+}
+
+bool
+jit_block::update_idom (size_t avisit_count)
+{
+  if (visited (avisit_count) || ! use_count ())
+    return false;
+
+  bool changed = false;
+  for (jit_use *use = first_use (); use; use = use->next ())
+    {
+      jit_block *pred = use->user_parent ();
+      changed = pred->update_idom (avisit_count) || changed;
+    }
+
+  jit_use *use = first_use ();
+  jit_block *new_idom = use->user_parent ();
+  use = use->next ();
+
+  for (; use; use = use->next ())
+    {
+      jit_block *pred = use->user_parent ();
+      jit_block *pidom = pred->idom;
+      if (pidom)
+        new_idom = idom_intersect (pidom, new_idom);
+    }
+
+  if (idom != new_idom)
+    {
+      idom = new_idom;
+      return true;
+    }
+
+  return changed;
+}
+
+void
+jit_block::pop_all (void)
+{
+  for (iterator iter = begin (); iter != end (); ++iter)
+    {
+      jit_instruction *instr = *iter;
+      instr->pop_variable ();
+    }
+}
+
+jit_block *
+jit_block::maybe_split (jit_convert& convert, jit_block *asuccessor)
+{
+  if (successor_count () > 1)
+    {
+      jit_terminator *term = terminator ();
+      size_t idx = term->successor_index (asuccessor);
+      jit_block *split = convert.create<jit_block> ("phi_split", mvisit_count);
+
+      // try to place splits where they make sense
+      if (id () < asuccessor->id ())
+        convert.insert_before (asuccessor, split);
+      else
+        convert.insert_after (this, split);
+
+      term->stash_argument (idx, split);
+      jit_branch *br = split->append (convert.create<jit_branch> (asuccessor));
+      replace_in_phi (asuccessor, split);
+
+      if (alive ())
+        {
+          split->mark_alive ();
+          br->infer ();
+        }
+
+      return split;
+    }
+
+  return this;
+}
+
+void
+jit_block::create_dom_tree (size_t avisit_count)
+{
+  if (visited (avisit_count))
+    return;
+
+  if (idom != this)
+    idom->dom_succ.push_back (this);
+
+  for (size_t i = 0; i < successor_count (); ++i)
+    successor (i)->create_dom_tree (avisit_count);
+}
+
+jit_block *
+jit_block::idom_intersect (jit_block *i, jit_block *j)
+{
+  while (i && j && i != j)
+    {
+      while (i && i->id () > j->id ())
+        i = i->idom;
+
+      while (i && j && j->id () > i->id ())
+        j = j->idom;
+    }
+
+  return i ? i : j;
+}
+
+// -------------------- jit_phi_incomming --------------------
+
+jit_block *
+jit_phi_incomming::user_parent (void) const
+{ return muser->parent (); }
+
+// -------------------- jit_phi --------------------
+bool
+jit_phi::prune (void)
+{
+  jit_block *p = parent ();
+  size_t new_idx = 0;
+  jit_value *unique = argument (1);
+
+  for (size_t i = 0; i < argument_count (); ++i)
+    {
+      jit_block *inc = incomming (i);
+      if (inc->branch_alive (p))
+        {
+          if (unique != argument (i))
+            unique = 0;
+
+          if (new_idx != i)
+            {
+              stash_argument (new_idx, argument (i));
+              mincomming[new_idx].stash_value (inc);
+            }
+
+          ++new_idx;
+        }
+    }
+
+  if (new_idx != argument_count ())
+    {
+      resize_arguments (new_idx);
+      mincomming.resize (new_idx);
+    }
+
+  assert (argument_count () > 0);
+  if (unique)
+    {
+      replace_with (unique);
+      return true;
+    }
+
+  return false;
+}
+
+bool
+jit_phi::infer (void)
+{
+  jit_block *p = parent ();
+  if (! p->alive ())
+    return false;
+
+  jit_type *infered = 0;
+  for (size_t i = 0; i < argument_count (); ++i)
+    {
+      jit_block *inc = incomming (i);
+      if (inc->branch_alive (p))
+        infered = jit_typeinfo::join (infered, argument_type (i));
+    }
+
+  if (infered != type ())
+    {
+      stash_type (infered);
+      return true;
+    }
+
+  return false;
+}
+
+llvm::PHINode *
+jit_phi::to_llvm (void) const
+{
+  return llvm::cast<llvm::PHINode> (jit_value::to_llvm ());
+}
+
+// -------------------- jit_terminator --------------------
+size_t
+jit_terminator::successor_index (const jit_block *asuccessor) const
+{
+  size_t scount = successor_count ();
+  for (size_t i = 0; i < scount; ++i)
+    if (successor (i) == asuccessor)
+      return i;
+
+  panic_impossible ();
+}
+
+bool
+jit_terminator::infer (void)
+{
+  if (! parent ()->alive ())
+    return false;
+
+  bool changed = false;
+  for (size_t i = 0; i < malive.size (); ++i)
+    if (! malive[i] && check_alive (i))
+      {
+        changed = true;
+        malive[i] = true;
+        successor (i)->mark_alive ();
+      }
+
+  return changed;
+}
+
+llvm::TerminatorInst *
+jit_terminator::to_llvm (void) const
+{
+  return llvm::cast<llvm::TerminatorInst> (jit_value::to_llvm ());
+}
+
+// -------------------- jit_call --------------------
+bool
+jit_call::infer (void)
+{
+  // FIXME: explain algorithm
+  for (size_t i = 0; i < argument_count (); ++i)
+    {
+      already_infered[i] = argument_type (i);
+      if (! already_infered[i])
+        return false;
+    }
+
+  jit_type *infered = moperation.result (already_infered);
+  if (! infered && use_count ())
+    {
+      std::stringstream ss;
+      ss << "Missing overload in type inference for ";
+      print (ss, 0);
+      throw jit_fail_exception (ss.str ());
+    }
+
+  if (infered != type ())
+    {
+      stash_type (infered);
+      return true;
+    }
+
+  return false;
+}
+
+#endif
new file mode 100644
--- /dev/null
+++ b/src/jit-ir.h
@@ -0,0 +1,1247 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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_jit_ir_h)
+#define octave_jit_ir_h 1
+
+#ifdef HAVE_LLVM
+
+#include <list>
+#include <stack>
+#include <set>
+
+#include "jit-typeinfo.h"
+
+// The low level octave jit ir
+// this ir is close to llvm, but contains information for doing type inference.
+// We convert the octave parse tree to this IR directly.
+
+#define JIT_VISIT_IR_NOTEMPLATE                 \
+  JIT_METH(block);                              \
+  JIT_METH(branch);                             \
+  JIT_METH(cond_branch);                        \
+  JIT_METH(call);                               \
+  JIT_METH(extract_argument);                   \
+  JIT_METH(store_argument);                     \
+  JIT_METH(phi);                                \
+  JIT_METH(variable);                           \
+  JIT_METH(error_check);                        \
+  JIT_METH(assign)                              \
+  JIT_METH(argument)
+
+#define JIT_VISIT_IR_CONST                      \
+  JIT_METH(const_bool);                         \
+  JIT_METH(const_scalar);                       \
+  JIT_METH(const_complex);                      \
+  JIT_METH(const_index);                        \
+  JIT_METH(const_string);                       \
+  JIT_METH(const_range)
+
+#define JIT_VISIT_IR_CLASSES                    \
+  JIT_VISIT_IR_NOTEMPLATE                       \
+  JIT_VISIT_IR_CONST
+
+// forward declare all ir classes
+#define JIT_METH(cname)                         \
+  class jit_ ## cname;
+
+JIT_VISIT_IR_NOTEMPLATE
+
+#undef JIT_METH
+
+class jit_convert;
+
+// ABCs which aren't included in  JIT_VISIT_IR_ALL
+class jit_instruction;
+class jit_terminator;
+
+template <typename T, jit_type *(*EXTRACT_T)(void), typename PASS_T = T,
+          bool QUOTE=false>
+class jit_const;
+
+typedef jit_const<bool, jit_typeinfo::get_bool> jit_const_bool;
+typedef jit_const<double, jit_typeinfo::get_scalar> jit_const_scalar;
+typedef jit_const<Complex, jit_typeinfo::get_complex> jit_const_complex;
+typedef jit_const<octave_idx_type, jit_typeinfo::get_index> jit_const_index;
+
+typedef jit_const<std::string, jit_typeinfo::get_string, const std::string&,
+                  true> jit_const_string;
+typedef jit_const<jit_range, jit_typeinfo::get_range, const jit_range&>
+jit_const_range;
+
+class jit_ir_walker;
+class jit_use;
+
+class
+jit_value : public jit_internal_list<jit_value, jit_use>
+{
+public:
+  jit_value (void) : llvm_value (0), ty (0), mlast_use (0),
+                     min_worklist (false) {}
+
+  virtual ~jit_value (void);
+
+  bool in_worklist (void) const
+  {
+    return min_worklist;
+  }
+
+  void stash_in_worklist (bool ain_worklist)
+  {
+    min_worklist = ain_worklist;
+  }
+
+  // The block of the first use which is not a jit_error_check
+  // So this is not necessarily first_use ()->parent ().
+  jit_block *first_use_block (void);
+
+  // replace all uses with
+  virtual void replace_with (jit_value *value);
+
+  jit_type *type (void) const { return ty; }
+
+  llvm::Type *type_llvm (void) const
+  {
+    return ty ? ty->to_llvm () : 0;
+  }
+
+  const std::string& type_name (void) const
+  {
+    return ty->name ();
+  }
+
+  void stash_type (jit_type *new_ty) { ty = new_ty; }
+
+  std::string print_string (void)
+  {
+    std::stringstream ss;
+    print (ss);
+    return ss.str ();
+  }
+
+  jit_instruction *last_use (void) const { return mlast_use; }
+
+  void stash_last_use (jit_instruction *alast_use)
+  {
+    mlast_use = alast_use;
+  }
+
+  virtual bool needs_release (void) const { return false; }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const = 0;
+
+  virtual std::ostream& short_print (std::ostream& os) const
+  { return print (os); }
+
+  virtual void accept (jit_ir_walker& walker) = 0;
+
+  bool has_llvm (void) const
+  {
+    return llvm_value;
+  }
+
+  llvm::Value *to_llvm (void) const
+  {
+    assert (llvm_value);
+    return llvm_value;
+  }
+
+  void stash_llvm (llvm::Value *compiled)
+  {
+    llvm_value = compiled;
+  }
+
+protected:
+  std::ostream& print_indent (std::ostream& os, size_t indent = 0) const
+  {
+    for (size_t i = 0; i < indent * 8; ++i)
+      os << " ";
+    return os;
+  }
+
+  llvm::Value *llvm_value;
+private:
+  jit_type *ty;
+  jit_instruction *mlast_use;
+  bool min_worklist;
+};
+
+std::ostream& operator<< (std::ostream& os, const jit_value& value);
+std::ostream& jit_print (std::ostream& os, jit_value *avalue);
+
+class
+jit_use : public jit_internal_node<jit_value, jit_use>
+{
+public:
+  jit_use (void) : muser (0), mindex (0) {}
+
+  // we should really have a move operator, but not until c++11 :(
+  jit_use (const jit_use& use) : muser (0), mindex (0)
+  {
+    *this = use;
+  }
+
+  jit_use& operator= (const jit_use& use)
+  {
+    stash_value (use.value (), use.user (), use.index ());
+    return *this;
+  }
+
+  size_t index (void) const { return mindex; }
+
+  jit_instruction *user (void) const { return muser; }
+
+  jit_block *user_parent (void) const;
+
+  std::list<jit_block *> user_parent_location (void) const;
+
+  void stash_value (jit_value *avalue, jit_instruction *auser = 0,
+                    size_t aindex = -1)
+  {
+    jit_internal_node::stash_value (avalue);
+    mindex = aindex;
+    muser = auser;
+  }
+private:
+  jit_instruction *muser;
+  size_t mindex;
+};
+
+class
+jit_instruction : public jit_value
+{
+public:
+  // FIXME: this code could be so much pretier with varadic templates...
+  jit_instruction (void) : mid (next_id ()), mparent (0)
+  {}
+
+  jit_instruction (size_t nargs) : mid (next_id ()), mparent (0)
+  {
+    already_infered.reserve (nargs);
+    marguments.reserve (nargs);
+  }
+
+#define STASH_ARG(i) stash_argument (i, arg ## i);
+#define JIT_INSTRUCTION_CTOR(N)                                         \
+  jit_instruction (OCT_MAKE_DECL_LIST (jit_value *, arg, N))            \
+  : already_infered (N), marguments (N), mid (next_id ()), mparent (0)  \
+  {                                                                     \
+    OCT_ITERATE_MACRO (STASH_ARG, N);                                   \
+  }
+
+  JIT_INSTRUCTION_CTOR(1)
+  JIT_INSTRUCTION_CTOR(2)
+  JIT_INSTRUCTION_CTOR(3)
+  JIT_INSTRUCTION_CTOR(4)
+
+#undef STASH_ARG
+#undef JIT_INSTRUCTION_CTOR
+
+  static void reset_ids (void)
+  {
+    next_id (true);
+  }
+
+  jit_value *argument (size_t i) const
+  {
+    return marguments[i].value ();
+  }
+
+  llvm::Value *argument_llvm (size_t i) const
+  {
+    assert (argument (i));
+    return argument (i)->to_llvm ();
+  }
+
+  jit_type *argument_type (size_t i) const
+  {
+    return argument (i)->type ();
+  }
+
+  llvm::Type *argument_type_llvm (size_t i) const
+  {
+    assert (argument (i));
+    return argument_type (i)->to_llvm ();
+  }
+
+  std::ostream& print_argument (std::ostream& os, size_t i) const
+  {
+    if (argument (i))
+      return argument (i)->short_print (os);
+    else
+      return os << "NULL";
+  }
+
+  void stash_argument (size_t i, jit_value *arg)
+  {
+    marguments[i].stash_value (arg, this, i);
+  }
+
+  void push_argument (jit_value *arg)
+  {
+    marguments.push_back (jit_use ());
+    stash_argument (marguments.size () - 1, arg);
+    already_infered.push_back (0);
+  }
+
+  size_t argument_count (void) const
+  {
+    return marguments.size ();
+  }
+
+  void resize_arguments (size_t acount, jit_value *adefault = 0)
+  {
+    size_t old = marguments.size ();
+    marguments.resize (acount);
+    already_infered.resize (acount);
+
+    if (adefault)
+      for (size_t i = old; i < acount; ++i)
+        stash_argument (i, adefault);
+  }
+
+  const std::vector<jit_use>& arguments (void) const { return marguments; }
+
+  // argument types which have been infered already
+  const std::vector<jit_type *>& argument_types (void) const
+  { return already_infered; }
+
+  virtual void push_variable (void) {}
+
+  virtual void pop_variable (void) {}
+
+  virtual void construct_ssa (void)
+  {
+    do_construct_ssa (0, argument_count ());
+  }
+
+  virtual bool infer (void) { return false; }
+
+  void remove (void);
+
+  virtual std::ostream& short_print (std::ostream& os) const;
+
+  jit_block *parent (void) const { return mparent; }
+
+  std::list<jit_instruction *>::iterator location (void) const
+  {
+    return mlocation;
+  }
+
+  llvm::BasicBlock *parent_llvm (void) const;
+
+  void stash_parent (jit_block *aparent,
+                     std::list<jit_instruction *>::iterator alocation)
+  {
+    mparent = aparent;
+    mlocation = alocation;
+  }
+
+  size_t id (void) const { return mid; }
+protected:
+
+  // Do SSA replacement on arguments in [start, end)
+  void do_construct_ssa (size_t start, size_t end);
+
+  std::vector<jit_type *> already_infered;
+private:
+  static size_t next_id (bool reset = false)
+  {
+    static size_t ret = 0;
+    if (reset)
+      return ret = 0;
+
+    return ret++;
+  }
+
+  std::vector<jit_use> marguments;
+
+  size_t mid;
+  jit_block *mparent;
+  std::list<jit_instruction *>::iterator mlocation;
+};
+
+// defnie accept methods for subclasses
+#define JIT_VALUE_ACCEPT                        \
+  virtual void accept (jit_ir_walker& walker);
+
+// for use as a dummy argument during conversion to LLVM
+class
+jit_argument : public jit_value
+{
+public:
+  jit_argument (jit_type *atype, llvm::Value *avalue)
+  {
+    stash_type (atype);
+    stash_llvm (avalue);
+  }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent);
+    return jit_print (os, type ()) << ": DUMMY";
+  }
+
+  JIT_VALUE_ACCEPT;
+};
+
+template <typename T, jit_type *(*EXTRACT_T)(void), typename PASS_T,
+          bool QUOTE>
+class
+jit_const : public jit_value
+{
+public:
+  typedef PASS_T pass_t;
+
+  jit_const (PASS_T avalue) : mvalue (avalue)
+  {
+    stash_type (EXTRACT_T ());
+  }
+
+  PASS_T value (void) const { return mvalue; }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent);
+    jit_print (os, type ()) << ": ";
+    if (QUOTE)
+      os << "\"";
+    os << mvalue;
+    if (QUOTE)
+      os << "\"";
+    return os;
+  }
+
+  JIT_VALUE_ACCEPT;
+private:
+  T mvalue;
+};
+
+class jit_phi_incomming;
+
+class
+jit_block : public jit_value, public jit_internal_list<jit_block,
+                                                       jit_phi_incomming>
+{
+  typedef jit_internal_list<jit_block, jit_phi_incomming> ILIST_T;
+public:
+  typedef std::list<jit_instruction *> instruction_list;
+  typedef instruction_list::iterator iterator;
+  typedef instruction_list::const_iterator const_iterator;
+
+  typedef std::set<jit_block *> df_set;
+  typedef df_set::const_iterator df_iterator;
+
+  static const size_t NO_ID = static_cast<size_t> (-1);
+
+  jit_block (const std::string& aname, size_t avisit_count = 0)
+    : mvisit_count (avisit_count), mid (NO_ID), idom (0), mname (aname),
+      malive (false)
+  {}
+
+  virtual void replace_with (jit_value *value);
+
+  void replace_in_phi (jit_block *ablock, jit_block *with);
+
+  // we have a new internal list, but we want to stay compatable with jit_value
+  jit_use *first_use (void) const { return jit_value::first_use (); }
+
+  size_t use_count (void) const { return jit_value::use_count (); }
+
+  // if a block is alive, then it might be visited during execution
+  bool alive (void) const { return malive; }
+
+  void mark_alive (void) { malive = true; }
+
+  // If we can merge with a successor, do so and return the now empty block
+  jit_block *maybe_merge ();
+
+  // merge another block into this block, leaving the merge block empty
+  void merge (jit_block& merge);
+
+  const std::string& name (void) const { return mname; }
+
+  jit_instruction *prepend (jit_instruction *instr);
+
+  jit_instruction *prepend_after_phi (jit_instruction *instr);
+
+  template <typename T>
+  T *append (T *instr)
+  {
+    internal_append (instr);
+    return instr;
+  }
+
+  jit_instruction *insert_before (iterator loc, jit_instruction *instr);
+
+  jit_instruction *insert_before (jit_instruction *loc, jit_instruction *instr)
+  {
+    return insert_before (loc->location (), instr);
+  }
+
+  jit_instruction *insert_after (iterator loc, jit_instruction *instr);
+
+  jit_instruction *insert_after (jit_instruction *loc, jit_instruction *instr)
+  {
+    return insert_after (loc->location (), instr);
+  }
+
+  iterator remove (iterator iter)
+  {
+    jit_instruction *instr = *iter;
+    iter = instructions.erase (iter);
+    instr->stash_parent (0, instructions.end ());
+    return iter;
+  }
+
+  jit_terminator *terminator (void) const;
+
+  // is the jump from pred alive?
+  bool branch_alive (jit_block *asucc) const;
+
+  jit_block *successor (size_t i) const;
+
+  size_t successor_count (void) const;
+
+  iterator begin (void) { return instructions.begin (); }
+
+  const_iterator begin (void) const { return instructions.begin (); }
+
+  iterator end (void) { return instructions.end (); }
+
+  const_iterator end (void) const { return instructions.end (); }
+
+  iterator phi_begin (void);
+
+  iterator phi_end (void);
+
+  iterator nonphi_begin (void);
+
+  // must label before id is valid
+  size_t id (void) const { return mid; }
+
+  // dominance frontier
+  const df_set& df (void) const { return mdf; }
+
+  df_iterator df_begin (void) const { return mdf.begin (); }
+
+  df_iterator df_end (void) const { return mdf.end (); }
+
+  // label with a RPO walk
+  void label (void)
+  {
+    size_t number = 0;
+    label (mvisit_count, number);
+  }
+
+  void label (size_t avisit_count, size_t& number)
+  {
+    if (visited (avisit_count))
+      return;
+
+    for (jit_use *use = first_use (); use; use = use->next ())
+      {
+        jit_block *pred = use->user_parent ();
+        pred->label (avisit_count, number);
+      }
+
+    mid = number++;
+  }
+
+  // See for idom computation algorithm
+  // Cooper, Keith D.; Harvey, Timothy J; and Kennedy, Ken (2001).
+  // "A Simple, Fast Dominance Algorithm"
+  void compute_idom (jit_block *entry_block)
+  {
+    bool changed;
+    entry_block->idom = entry_block;
+    do
+      changed = update_idom (mvisit_count);
+    while (changed);
+  }
+
+  // compute dominance frontier
+  void compute_df (void)
+  {
+    compute_df (mvisit_count);
+  }
+
+  void create_dom_tree (void)
+  {
+    create_dom_tree (mvisit_count);
+  }
+
+  jit_block *dom_successor (size_t idx) const
+  {
+    return dom_succ[idx];
+  }
+
+  size_t dom_successor_count (void) const
+  {
+    return dom_succ.size ();
+  }
+
+  // call pop_varaible on all instructions
+  void pop_all (void);
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent);
+    short_print (os) << ":        %pred = ";
+    for (jit_use *use = first_use (); use; use = use->next ())
+      {
+        jit_block *pred = use->user_parent ();
+        os << *pred;
+        if (use->next ())
+          os << ", ";
+      }
+    os << std::endl;
+
+    for (const_iterator iter = begin (); iter != end (); ++iter)
+      {
+        jit_instruction *instr = *iter;
+        instr->print (os, indent + 1) << std::endl;
+      }
+    return os;
+  }
+
+  // ...
+  jit_block *maybe_split (jit_convert& convert, jit_block *asuccessor);
+
+  jit_block *maybe_split (jit_convert& convert, jit_block& asuccessor)
+  {
+    return maybe_split (convert, &asuccessor);
+  }
+
+  // print dominator infomration
+  std::ostream& print_dom (std::ostream& os) const;
+
+  virtual std::ostream& short_print (std::ostream& os) const
+  {
+    os << mname;
+    if (mid != NO_ID)
+      os << mid;
+    return os;
+  }
+
+  llvm::BasicBlock *to_llvm (void) const;
+
+  std::list<jit_block *>::iterator location (void) const
+  { return mlocation; }
+
+  void stash_location (std::list<jit_block *>::iterator alocation)
+  { mlocation = alocation; }
+
+  // used to prevent visiting the same node twice in the graph
+  size_t visit_count (void) const { return mvisit_count; }
+
+  // check if this node has been visited yet at the given visit count. If we
+  // have not been visited yet, mark us as visited.
+  bool visited (size_t avisit_count)
+  {
+    if (mvisit_count <= avisit_count)
+      {
+        mvisit_count = avisit_count + 1;
+        return false;
+      }
+
+    return true;
+  }
+
+  JIT_VALUE_ACCEPT;
+private:
+  void internal_append (jit_instruction *instr);
+
+  void compute_df (size_t avisit_count);
+
+  bool update_idom (size_t avisit_count);
+
+  void create_dom_tree (size_t avisit_count);
+
+  static jit_block *idom_intersect (jit_block *i, jit_block *j);
+
+  size_t mvisit_count;
+  size_t mid;
+  jit_block *idom;
+  df_set mdf;
+  std::vector<jit_block *> dom_succ;
+  std::string mname;
+  instruction_list instructions;
+  bool malive;
+  std::list<jit_block *>::iterator mlocation;
+};
+
+// keeps track of phi functions that use a block on incomming edges
+class
+jit_phi_incomming : public jit_internal_node<jit_block, jit_phi_incomming>
+{
+public:
+  jit_phi_incomming (void) : muser (0) {}
+
+  jit_phi_incomming (jit_phi *auser) : muser (auser) {}
+
+  jit_phi_incomming (const jit_phi_incomming& use) : jit_internal_node ()
+  {
+    *this = use;
+  }
+
+  jit_phi_incomming& operator= (const jit_phi_incomming& use)
+  {
+    stash_value (use.value ());
+    muser = use.muser;
+    return *this;
+  }
+
+  jit_phi *user (void) const { return muser; }
+
+  jit_block *user_parent (void) const;
+private:
+  jit_phi *muser;
+};
+
+// A non-ssa variable
+class
+jit_variable : public jit_value
+{
+public:
+  jit_variable (const std::string& aname) : mname (aname), mlast_use (0) {}
+
+  const std::string &name (void) const { return mname; }
+
+  // manipulate the value_stack, for use during SSA construction. The top of the
+  // value stack represents the current value for this variable
+  bool has_top (void) const
+  {
+    return ! value_stack.empty ();
+  }
+
+  jit_value *top (void) const
+  {
+    return value_stack.top ();
+  }
+
+  void push (jit_instruction *v)
+  {
+    value_stack.push (v);
+    mlast_use = v;
+  }
+
+  void pop (void)
+  {
+    value_stack.pop ();
+  }
+
+  jit_instruction *last_use (void) const
+  {
+    return mlast_use;
+  }
+
+  void stash_last_use (jit_instruction *instr)
+  {
+    mlast_use = instr;
+  }
+
+  // blocks in which we are used
+  void use_blocks (jit_block::df_set& result)
+  {
+    jit_use *use = first_use ();
+    while (use)
+      {
+        result.insert (use->user_parent ());
+        use = use->next ();
+      }
+  }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    return print_indent (os, indent) << mname;
+  }
+
+  JIT_VALUE_ACCEPT;
+private:
+  std::string mname;
+  std::stack<jit_value *> value_stack;
+  jit_instruction *mlast_use;
+};
+
+class
+jit_assign_base : public jit_instruction
+{
+public:
+  jit_assign_base (jit_variable *adest) : jit_instruction (), mdest (adest) {}
+
+  jit_assign_base (jit_variable *adest, size_t npred) : jit_instruction (npred),
+                                                        mdest (adest) {}
+
+  jit_assign_base (jit_variable *adest, jit_value *arg0, jit_value *arg1)
+    : jit_instruction (arg0, arg1), mdest (adest) {}
+
+  jit_variable *dest (void) const { return mdest; }
+
+  virtual void push_variable (void)
+  {
+    mdest->push (this);
+  }
+
+  virtual void pop_variable (void)
+  {
+    mdest->pop ();
+  }
+
+  virtual std::ostream& short_print (std::ostream& os) const
+  {
+    if (type ())
+      jit_print (os, type ()) << ": ";
+
+    dest ()->short_print (os);
+    return os << "#" << id ();
+  }
+private:
+  jit_variable *mdest;
+};
+
+class
+jit_assign : public jit_assign_base
+{
+public:
+  jit_assign (jit_variable *adest, jit_value *asrc)
+    : jit_assign_base (adest, adest, asrc), martificial (false) {}
+
+  jit_value *overwrite (void) const
+  {
+    return argument (0);
+  }
+
+  jit_value *src (void) const
+  {
+    return argument (1);
+  }
+
+  // variables don't get modified in an SSA, but COW requires we modify
+  // variables. An artificial assign is for when a variable gets modified. We
+  // need an assign in the SSA, but the reference counts shouldn't be updated.
+  bool artificial (void) const { return martificial; }
+
+  void mark_artificial (void) { martificial = true; }
+
+  virtual bool infer (void)
+  {
+    jit_type *stype = src ()->type ();
+    if (stype != type())
+      {
+        stash_type (stype);
+        return true;
+      }
+
+    return false;
+  }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent) << *this << " = " << *src ();
+
+    if (artificial ())
+      os << " [artificial]";
+
+    return os;
+  }
+
+  JIT_VALUE_ACCEPT;
+private:
+  bool martificial;
+};
+
+class
+jit_phi : public jit_assign_base
+{
+public:
+  jit_phi (jit_variable *adest, size_t npred)
+    : jit_assign_base (adest, npred)
+  {
+    mincomming.reserve (npred);
+  }
+
+  // removes arguments form dead incomming jumps
+  bool prune (void);
+
+  void add_incomming (jit_block *from, jit_value *value)
+  {
+    push_argument (value);
+    mincomming.push_back (jit_phi_incomming (this));
+    mincomming[mincomming.size () - 1].stash_value (from);
+  }
+
+  jit_block *incomming (size_t i) const
+  {
+    return mincomming[i].value ();
+  }
+
+  llvm::BasicBlock *incomming_llvm (size_t i) const
+  {
+    return incomming (i)->to_llvm ();
+  }
+
+  virtual void construct_ssa (void) {}
+
+  virtual bool infer (void);
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    std::stringstream ss;
+    print_indent (ss, indent);
+    short_print (ss) << " phi ";
+    std::string ss_str = ss.str ();
+    std::string indent_str (ss_str.size (), ' ');
+    os << ss_str;
+
+    for (size_t i = 0; i < argument_count (); ++i)
+      {
+        if (i > 0)
+          os << indent_str;
+        os << "| ";
+
+        os << *incomming (i) << " -> ";
+        os << *argument (i);
+
+        if (i + 1 < argument_count ())
+          os << std::endl;
+      }
+
+    return os;
+  }
+
+  llvm::PHINode *to_llvm (void) const;
+
+  JIT_VALUE_ACCEPT;
+private:
+  std::vector<jit_phi_incomming> mincomming;
+};
+
+class
+jit_terminator : public jit_instruction
+{
+public:
+#define JIT_TERMINATOR_CONST(N)                                         \
+  jit_terminator (size_t asuccessor_count,                              \
+                  OCT_MAKE_DECL_LIST (jit_value *, arg, N))             \
+    : jit_instruction (OCT_MAKE_ARG_LIST (arg, N)),                     \
+      malive (asuccessor_count, false) {}
+
+  JIT_TERMINATOR_CONST (1)
+  JIT_TERMINATOR_CONST (2)
+  JIT_TERMINATOR_CONST (3)
+
+#undef JIT_TERMINATOR_CONST
+
+  jit_block *successor (size_t idx = 0) const
+  {
+    return static_cast<jit_block *> (argument (idx));
+  }
+
+  llvm::BasicBlock *successor_llvm (size_t idx = 0) const
+  {
+    return successor (idx)->to_llvm ();
+  }
+
+  size_t successor_index (const jit_block *asuccessor) const;
+
+  std::ostream& print_successor (std::ostream& os, size_t idx = 0) const
+  {
+    if (alive (idx))
+      os << "[live] ";
+    else
+      os << "[dead] ";
+
+    return successor (idx)->short_print (os);
+  }
+
+  // Check if the jump to successor is live
+  bool alive (const jit_block *asuccessor) const
+  {
+    return alive (successor_index (asuccessor));
+  }
+
+  bool alive (size_t idx) const { return malive[idx]; }
+
+  bool alive (int idx) const { return malive[idx]; }
+
+  size_t successor_count (void) const { return malive.size (); }
+
+  virtual bool infer (void);
+
+  llvm::TerminatorInst *to_llvm (void) const;
+protected:
+  virtual bool check_alive (size_t) const { return true; }
+private:
+  std::vector<bool> malive;
+};
+
+class
+jit_branch : public jit_terminator
+{
+public:
+  jit_branch (jit_block *succ) : jit_terminator (1, succ) {}
+
+  virtual size_t successor_count (void) const { return 1; }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent) << "branch: ";
+    return print_successor (os);
+  }
+
+  JIT_VALUE_ACCEPT;
+};
+
+class
+jit_cond_branch : public jit_terminator
+{
+public:
+  jit_cond_branch (jit_value *c, jit_block *ctrue, jit_block *cfalse)
+    : jit_terminator (2, ctrue, cfalse, c) {}
+
+  jit_value *cond (void) const { return argument (2); }
+
+  std::ostream& print_cond (std::ostream& os) const
+  {
+    return cond ()->short_print (os);
+  }
+
+  llvm::Value *cond_llvm (void) const
+  {
+    return cond ()->to_llvm ();
+  }
+
+  virtual size_t successor_count (void) const { return 2; }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent) << "cond_branch: ";
+    print_cond (os) << ", ";
+    print_successor (os, 0) << ", ";
+    return print_successor (os, 1);
+  }
+
+  JIT_VALUE_ACCEPT;
+};
+
+class
+jit_call : public jit_instruction
+{
+public:
+#define JIT_CALL_CONST(N)                                               \
+  jit_call (const jit_operation& aoperation,                            \
+            OCT_MAKE_DECL_LIST (jit_value *, arg, N))                   \
+    : jit_instruction (OCT_MAKE_ARG_LIST (arg, N)), moperation (aoperation) {} \
+                                                                        \
+  jit_call (const jit_operation& (*aoperation) (void),                  \
+            OCT_MAKE_DECL_LIST (jit_value *, arg, N))                   \
+    : jit_instruction (OCT_MAKE_ARG_LIST (arg, N)), moperation (aoperation ()) \
+  {}
+
+  JIT_CALL_CONST (1)
+  JIT_CALL_CONST (2)
+  JIT_CALL_CONST (3)
+  JIT_CALL_CONST (4)
+
+#undef JIT_CALL_CONST
+
+
+  const jit_operation& operation (void) const { return moperation; }
+
+  bool can_error (void) const
+  {
+    return overload ().can_error ();
+  }
+
+  const jit_function& overload (void) const
+  {
+    return moperation.overload (argument_types ());
+  }
+
+  virtual bool needs_release (void) const
+  {
+    return type () && jit_typeinfo::get_release (type ()).valid ();
+  }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent);
+
+    if (use_count ())
+      short_print (os) << " = ";
+    os << "call " << moperation.name () << " (";
+
+    for (size_t i = 0; i < argument_count (); ++i)
+      {
+        print_argument (os, i);
+        if (i + 1 < argument_count ())
+          os << ", ";
+      }
+    return os << ")";
+  }
+
+  virtual bool infer (void);
+
+  JIT_VALUE_ACCEPT;
+private:
+  const jit_operation& moperation;
+};
+
+// FIXME: This is just ugly...
+// checks error_state, if error_state is false then goto the normal branche,
+// otherwise goto the error branch
+class
+jit_error_check : public jit_terminator
+{
+public:
+  jit_error_check (jit_call *acheck_for, jit_block *normal, jit_block *error)
+    : jit_terminator (2, error, normal, acheck_for) {}
+
+  jit_call *check_for (void) const
+  {
+    return static_cast<jit_call *> (argument (2));
+  }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent) << "error_check " << *check_for () << ", ";
+    print_successor (os, 1) << ", ";
+    return print_successor (os, 0);
+  }
+
+  JIT_VALUE_ACCEPT;
+protected:
+  virtual bool check_alive (size_t idx) const
+  {
+    return idx == 1 ? true : check_for ()->can_error ();
+  }
+};
+
+class
+jit_extract_argument : public jit_assign_base
+{
+public:
+  jit_extract_argument (jit_type *atype, jit_variable *adest)
+    : jit_assign_base (adest)
+  {
+    stash_type (atype);
+  }
+
+  const std::string& name (void) const
+  {
+    return dest ()->name ();
+  }
+
+  const jit_function& overload (void) const
+  {
+    return jit_typeinfo::cast (type (), jit_typeinfo::get_any ());
+  }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    print_indent (os, indent);
+
+    return short_print (os) << " = extract " << name ();
+  }
+
+  JIT_VALUE_ACCEPT;
+};
+
+class
+jit_store_argument : public jit_instruction
+{
+public:
+  jit_store_argument (jit_variable *var)
+  : jit_instruction (var), dest (var)
+  {}
+
+  const std::string& name (void) const
+  {
+    return dest->name ();
+  }
+
+  const jit_function& overload (void) const
+  {
+    return jit_typeinfo::cast (jit_typeinfo::get_any (), result_type ());
+  }
+
+  jit_value *result (void) const
+  {
+    return argument (0);
+  }
+
+  jit_type *result_type (void) const
+  {
+    return result ()->type ();
+  }
+
+  llvm::Value *result_llvm (void) const
+  {
+    return result ()->to_llvm ();
+  }
+
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
+  {
+    jit_value *res = result ();
+    print_indent (os, indent) << "store ";
+    dest->short_print (os);
+
+    if (! isa<jit_variable> (res))
+      {
+        os << " = ";
+        res->short_print (os);
+      }
+
+    return os;
+  }
+
+  JIT_VALUE_ACCEPT;
+private:
+  jit_variable *dest;
+};
+
+class
+jit_ir_walker
+{
+public:
+  virtual ~jit_ir_walker () {}
+
+#define JIT_METH(clname) \
+  virtual void visit (jit_ ## clname&) = 0;
+
+  JIT_VISIT_IR_CLASSES;
+
+#undef JIT_METH
+};
+
+template <typename T, jit_type *(*EXTRACT_T)(void), typename PASS_T, bool QUOTE>
+void
+jit_const<T, EXTRACT_T, PASS_T, QUOTE>::accept (jit_ir_walker& walker)
+{
+  walker.visit (*this);
+}
+
+#undef JIT_VALUE_ACCEPT
+
+#endif
+#endif
new file mode 100644
--- /dev/null
+++ b/src/jit-typeinfo.cc
@@ -0,0 +1,1819 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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/>.
+
+*/
+
+// defines required by llvm
+#define __STDC_LIMIT_MACROS
+#define __STDC_CONSTANT_MACROS
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_LLVM
+
+#include "jit-typeinfo.h"
+
+#include <llvm/Analysis/Verifier.h>
+#include <llvm/GlobalVariable.h>
+#include <llvm/ExecutionEngine/ExecutionEngine.h>
+#include <llvm/LLVMContext.h>
+#include <llvm/Function.h>
+#include <llvm/Instructions.h>
+#include <llvm/Intrinsics.h>
+#include <llvm/Support/IRBuilder.h>
+#include <llvm/Support/raw_os_ostream.h>
+
+#include "jit-ir.h"
+#include "ov.h"
+#include "ov-builtin.h"
+#include "ov-complex.h"
+#include "ov-scalar.h"
+#include "pager.h"
+
+static llvm::LLVMContext& context = llvm::getGlobalContext ();
+
+jit_typeinfo *jit_typeinfo::instance = 0;
+
+std::ostream& jit_print (std::ostream& os, jit_type *atype)
+{
+  if (! atype)
+    return os << "null";
+  return os << atype->name ();
+}
+
+// function that jit code calls
+extern "C" void
+octave_jit_print_any (const char *name, octave_base_value *obv)
+{
+  obv->print_with_name (octave_stdout, name, true);
+}
+
+extern "C" void
+octave_jit_print_scalar (const char *name, double value)
+{
+  // FIXME: We should avoid allocating a new octave_scalar each time
+  octave_value ov (value);
+  ov.print_with_name (octave_stdout, name);
+}
+
+extern "C" octave_base_value*
+octave_jit_binary_any_any (octave_value::binary_op op, octave_base_value *lhs,
+                           octave_base_value *rhs)
+{
+  octave_value olhs (lhs, true);
+  octave_value orhs (rhs, true);
+  octave_value result = do_binary_op (op, olhs, orhs);
+  octave_base_value *rep = result.internal_rep ();
+  rep->grab ();
+  return rep;
+}
+
+extern "C" octave_idx_type
+octave_jit_compute_nelem (double base, double limit, double inc)
+{
+  Range rng = Range (base, limit, inc);
+  return rng.nelem ();
+}
+
+extern "C" void
+octave_jit_release_any (octave_base_value *obv)
+{
+  obv->release ();
+}
+
+extern "C" void
+octave_jit_release_matrix (jit_matrix *m)
+{
+  delete m->array;
+}
+
+extern "C" octave_base_value *
+octave_jit_grab_any (octave_base_value *obv)
+{
+  obv->grab ();
+  return obv;
+}
+
+extern "C" void
+octave_jit_grab_matrix (jit_matrix *result, jit_matrix *m)
+{
+  *result = *m->array;
+}
+
+extern "C" octave_base_value *
+octave_jit_cast_any_matrix (jit_matrix *m)
+{
+  octave_value ret (*m->array);
+  octave_base_value *rep = ret.internal_rep ();
+  rep->grab ();
+  delete m->array;
+
+  return rep;
+}
+
+extern "C" void
+octave_jit_cast_matrix_any (jit_matrix *ret, octave_base_value *obv)
+{
+  NDArray m = obv->array_value ();
+  *ret = m;
+  obv->release ();
+}
+
+extern "C" octave_base_value *
+octave_jit_cast_any_range (jit_range *rng)
+{
+  Range temp (*rng);
+  octave_value ret (temp);
+  octave_base_value *rep = ret.internal_rep ();
+  rep->grab ();
+
+  return rep;
+}
+extern "C" void
+octave_jit_cast_range_any (jit_range *ret, octave_base_value *obv)
+{
+
+  jit_range r (obv->range_value ());
+  *ret = r;
+  obv->release ();
+}
+
+extern "C" double
+octave_jit_cast_scalar_any (octave_base_value *obv)
+{
+  double ret = obv->double_value ();
+  obv->release ();
+  return ret;
+}
+
+extern "C" octave_base_value *
+octave_jit_cast_any_scalar (double value)
+{
+  return new octave_scalar (value);
+}
+
+extern "C" Complex
+octave_jit_cast_complex_any (octave_base_value *obv)
+{
+  Complex ret = obv->complex_value ();
+  obv->release ();
+  return ret;
+}
+
+extern "C" octave_base_value *
+octave_jit_cast_any_complex (Complex c)
+{
+  if (c.imag () == 0)
+    return new octave_scalar (c.real ());
+  else
+    return new octave_complex (c);
+}
+
+extern "C" void
+octave_jit_gripe_nan_to_logical_conversion (void)
+{
+  try
+    {
+      gripe_nan_to_logical_conversion ();
+    }
+  catch (const octave_execution_exception&)
+    {
+      gripe_library_execution_error ();
+    }
+}
+
+extern "C" void
+octave_jit_ginvalid_index (void)
+{
+  try
+    {
+      gripe_invalid_index ();
+    }
+  catch (const octave_execution_exception&)
+    {
+      gripe_library_execution_error ();
+    }
+}
+
+extern "C" void
+octave_jit_gindex_range (int nd, int dim, octave_idx_type iext,
+                         octave_idx_type ext)
+{
+  try
+    {
+      gripe_index_out_of_range (nd, dim, iext, ext);
+    }
+  catch (const octave_execution_exception&)
+    {
+      gripe_library_execution_error ();
+    }
+}
+
+extern "C" void
+octave_jit_paren_subsasgn_impl (jit_matrix *ret, jit_matrix *mat,
+                                octave_idx_type index, double value)
+{
+  NDArray *array = mat->array;
+  if (array->nelem () < index)
+    array->resize1 (index);
+
+  double *data = array->fortran_vec ();
+  data[index - 1] = value;
+
+  mat->update ();
+  *ret = *mat;
+}
+
+extern "C" void
+octave_jit_paren_subsasgn_matrix_range (jit_matrix *result, jit_matrix *mat,
+                                        jit_range *index, double value)
+{
+  NDArray *array = mat->array;
+  bool done = false;
+
+  // optimize for the simple case (no resizing and no errors)
+  if (*array->jit_ref_count () == 1
+      && index->all_elements_are_ints ())
+    {
+      // this code is similar to idx_vector::fill, but we avoid allocating an
+      // idx_vector and its associated rep
+      octave_idx_type start = static_cast<octave_idx_type> (index->base) - 1;
+      octave_idx_type step = static_cast<octave_idx_type> (index->inc);
+      octave_idx_type nelem = index->nelem;
+      octave_idx_type final = start + nelem * step;
+      if (step < 0)
+        {
+          step = -step;
+          std::swap (final, start);
+        }
+
+      if (start >= 0 && final < mat->slice_len)
+        {
+          done = true;
+
+          double *data = array->jit_slice_data ();
+          if (step == 1)
+            std::fill (data + start, data + start + nelem, value);
+          else
+            {
+              for (octave_idx_type i = start; i < final; i += step)
+                data[i] = value;
+            }
+        }
+    }
+
+  if (! done)
+    {
+      idx_vector idx (*index);
+      NDArray avalue (dim_vector (1, 1));
+      avalue.xelem (0) = value;
+      array->assign (idx, avalue);
+    }
+
+  result->update (array);
+}
+
+extern "C" Complex
+octave_jit_complex_div (Complex lhs, Complex rhs)
+{
+  // see src/OPERATORS/op-cs-cs.cc
+  if (rhs == 0.0)
+    gripe_divide_by_zero ();
+
+  return lhs / rhs;
+}
+
+// FIXME: CP form src/xpow.cc
+static inline int
+xisint (double x)
+{
+  return (D_NINT (x) == x
+          && ((x >= 0 && x < INT_MAX)
+              || (x <= 0 && x > INT_MIN)));
+}
+
+extern "C" Complex
+octave_jit_pow_scalar_scalar (double lhs, double rhs)
+{
+  // FIXME: almost CP from src/xpow.cc
+  if (lhs < 0.0 && ! xisint (rhs))
+    return std::pow (Complex (lhs), rhs);
+  return std::pow (lhs, rhs);
+}
+
+extern "C" Complex
+octave_jit_pow_complex_complex (Complex lhs, Complex rhs)
+{
+  if (lhs.imag () == 0 && rhs.imag () == 0)
+    return octave_jit_pow_scalar_scalar (lhs.real (), rhs.real ());
+  return std::pow (lhs, rhs);
+}
+
+extern "C" Complex
+octave_jit_pow_complex_scalar (Complex lhs, double rhs)
+{
+  if (lhs.imag () == 0)
+    return octave_jit_pow_scalar_scalar (lhs.real (), rhs);
+  return std::pow (lhs, rhs);
+}
+
+extern "C" Complex
+octave_jit_pow_scalar_complex (double lhs, Complex rhs)
+{
+  if (rhs.imag () == 0)
+    return octave_jit_pow_scalar_scalar (lhs, rhs.real ());
+  return std::pow (lhs, rhs);
+}
+
+extern "C" void
+octave_jit_print_matrix (jit_matrix *m)
+{
+  std::cout << *m << std::endl;
+}
+
+static void
+gripe_bad_result (void)
+{
+  error ("incorrect type information given to the JIT compiler");
+}
+
+// FIXME: Add support for multiple outputs
+extern "C" octave_base_value *
+octave_jit_call (octave_builtin::fcn fn, size_t nargin,
+                 octave_base_value **argin, jit_type *result_type)
+{
+  octave_value_list ovl (nargin);
+  for (size_t i = 0; i < nargin; ++i)
+    ovl.xelem (i) = octave_value (argin[i]);
+
+  ovl = fn (ovl, 1);
+
+  // These type checks are not strictly required, but I'm guessing that
+  // incorrect types will be entered on occasion. This will be very difficult to
+  // debug unless we do the sanity check here.
+  if (result_type)
+    {
+      if (ovl.length () != 1)
+        {
+          gripe_bad_result ();
+          return 0;
+        }
+
+      octave_value& result = ovl.xelem (0);
+      jit_type *jtype = jit_typeinfo::join (jit_typeinfo::type_of (result),
+                                            result_type);
+      if (jtype != result_type)
+        {
+          gripe_bad_result ();
+          return 0;
+        }
+
+      octave_base_value *ret = result.internal_rep ();
+      ret->grab ();
+      return ret;
+    }
+
+  if (! (ovl.length () == 0
+         || (ovl.length () == 1 && ovl.xelem (0).is_undefined ())))
+    gripe_bad_result ();
+
+  return 0;
+}
+
+// -------------------- jit_range --------------------
+bool
+jit_range::all_elements_are_ints () const
+{
+  Range r (*this);
+  return r.all_elements_are_ints ();
+}
+
+std::ostream&
+operator<< (std::ostream& os, const jit_range& rng)
+{
+  return os << "Range[" << rng.base << ", " << rng.limit << ", " << rng.inc
+            << ", " << rng.nelem << "]";
+}
+
+// -------------------- jit_matrix --------------------
+
+std::ostream&
+operator<< (std::ostream& os, const jit_matrix& mat)
+{
+  return os << "Matrix[" << mat.ref_count << ", " << mat.slice_data << ", "
+            << mat.slice_len << ", " << mat.dimensions << ", "
+            << mat.array << "]";
+}
+
+// -------------------- jit_type --------------------
+jit_type::jit_type (const std::string& aname, jit_type *aparent,
+                    llvm::Type *allvm_type, int aid) :
+  mname (aname), mparent (aparent), llvm_type (allvm_type), mid (aid),
+  mdepth (aparent ? aparent->mdepth + 1 : 0)
+{
+  std::memset (msret, 0, sizeof (msret));
+  std::memset (mpointer_arg, 0, sizeof (mpointer_arg));
+  std::memset (mpack, 0, sizeof (mpack));
+  std::memset (munpack, 0, sizeof (munpack));
+
+  for (size_t i = 0; i < jit_convention::length; ++i)
+    mpacked_type[i] = llvm_type;
+}
+
+llvm::Type *
+jit_type::to_llvm_arg (void) const
+{
+  return llvm_type ? llvm_type->getPointerTo () : 0;
+}
+
+// -------------------- jit_function --------------------
+jit_function::jit_function () : module (0), llvm_function (0), mresult (0),
+                                call_conv (jit_convention::length),
+                                mcan_error (false)
+{}
+
+jit_function::jit_function (llvm::Module *amodule,
+                            jit_convention::type acall_conv,
+                            const llvm::Twine& aname, jit_type *aresult,
+                            const std::vector<jit_type *>& aargs)
+  : module (amodule), mresult (aresult), args (aargs), call_conv (acall_conv),
+    mcan_error (false)
+{
+  llvm::SmallVector<llvm::Type *, 15> llvm_args;
+
+  llvm::Type *rtype = llvm::Type::getVoidTy (context);
+  if (mresult)
+    {
+      rtype = mresult->packed_type (call_conv);
+      if (sret ())
+        {
+          llvm_args.push_back (rtype->getPointerTo ());
+          rtype = llvm::Type::getVoidTy (context);
+        }
+    }
+
+  for (std::vector<jit_type *>::const_iterator iter = args.begin ();
+       iter != args.end (); ++iter)
+    {
+      jit_type *ty = *iter;
+      assert (ty);
+      llvm::Type *argty = ty->packed_type (call_conv);
+      if (ty->pointer_arg (call_conv))
+        argty = argty->getPointerTo ();
+
+      llvm_args.push_back (argty);
+    }
+
+  // we mark all functinos as external linkage because this prevents llvm
+  // from getting rid of always inline functions
+  llvm::FunctionType *ft = llvm::FunctionType::get (rtype, llvm_args, false);
+  llvm_function = llvm::Function::Create (ft, llvm::Function::ExternalLinkage,
+                                          aname, module);
+  if (call_conv == jit_convention::internal)
+    llvm_function->addFnAttr (llvm::Attribute::AlwaysInline);
+}
+
+jit_function::jit_function (const jit_function& fn, jit_type *aresult,
+                            const std::vector<jit_type *>& aargs)
+  : module (fn.module), llvm_function (fn.llvm_function), mresult (aresult),
+    args (aargs), call_conv (fn.call_conv), mcan_error (fn.mcan_error)
+{
+}
+
+jit_function::jit_function (const jit_function& fn)
+  : module (fn.module), llvm_function (fn.llvm_function), mresult (fn.mresult),
+    args (fn.args), call_conv (fn.call_conv), mcan_error (fn.mcan_error)
+{}
+
+std::string
+jit_function::name (void) const
+{
+  return llvm_function->getName ();
+}
+
+llvm::BasicBlock *
+jit_function::new_block (const std::string& aname,
+                         llvm::BasicBlock *insert_before)
+{
+  return llvm::BasicBlock::Create (context, aname, llvm_function,
+                                   insert_before);
+}
+
+llvm::Value *
+jit_function::call (llvm::IRBuilderD& builder,
+                    const std::vector<jit_value *>& in_args) const
+{
+  assert (in_args.size () == args.size ());
+
+  std::vector<llvm::Value *> llvm_args (args.size ());
+  for (size_t i = 0; i < in_args.size (); ++i)
+    llvm_args[i] = in_args[i]->to_llvm ();
+
+  return call (builder, llvm_args);
+}
+
+llvm::Value *
+jit_function::call (llvm::IRBuilderD& builder,
+                    const std::vector<llvm::Value *>& in_args) const
+{
+  assert (valid ());
+  assert (in_args.size () == args.size ());
+  llvm::Function *stacksave
+    = llvm::Intrinsic::getDeclaration (module, llvm::Intrinsic::stacksave);
+  llvm::SmallVector<llvm::Value *, 10> llvm_args;
+  llvm_args.reserve (in_args.size () + sret ());
+
+  llvm::Value *sret_mem = 0;
+  llvm::Value *saved_stack = 0;
+  if (sret ())
+    {
+      saved_stack = builder.CreateCall (stacksave);
+      sret_mem = builder.CreateAlloca (mresult->packed_type (call_conv));
+      llvm_args.push_back (sret_mem);
+    }
+
+  for (size_t i = 0; i < in_args.size (); ++i)
+    {
+      llvm::Value *arg = in_args[i];
+      jit_type::convert_fn convert = args[i]->pack (call_conv);
+      if (convert)
+        arg = convert (builder, arg);
+
+      if (args[i]->pointer_arg (call_conv))
+        {
+          if (! saved_stack)
+            saved_stack = builder.CreateCall (stacksave);
+
+          arg = builder.CreateAlloca (args[i]->to_llvm ());
+          builder.CreateStore (in_args[i], arg);
+        }
+
+      llvm_args.push_back (arg);
+    }
+
+  llvm::Value *ret = builder.CreateCall (llvm_function, llvm_args);
+  if (sret_mem)
+    ret = builder.CreateLoad (sret_mem);
+
+  if (mresult)
+    {
+      jit_type::convert_fn unpack = mresult->unpack (call_conv);
+      if (unpack)
+        ret = unpack (builder, ret);
+    }
+
+  if (saved_stack)
+    {
+      llvm::Function *stackrestore
+        = llvm::Intrinsic::getDeclaration (module,
+                                           llvm::Intrinsic::stackrestore);
+      builder.CreateCall (stackrestore, saved_stack);
+    }
+
+  return ret;
+}
+
+llvm::Value *
+jit_function::argument (llvm::IRBuilderD& builder, size_t idx) const
+{
+  assert (idx < args.size ());
+
+  // FIXME: We should be treating arguments like a list, not a vector. Shouldn't
+  // matter much for now, as the number of arguments shouldn't be much bigger
+  // than 4
+  llvm::Function::arg_iterator iter = llvm_function->arg_begin ();
+  if (sret ())
+    ++iter;
+
+  for (size_t i = 0; i < idx; ++i, ++iter);
+
+  if (args[idx]->pointer_arg (call_conv))
+    return builder.CreateLoad (iter);
+
+  return iter;
+}
+
+void
+jit_function::do_return (llvm::IRBuilderD& builder, llvm::Value *rval)
+{
+  assert (! rval == ! mresult);
+
+  if (rval)
+    {
+      jit_type::convert_fn convert = mresult->pack (call_conv);
+      if (convert)
+        rval = convert (builder, rval);
+
+      if (sret ())
+        builder.CreateStore (rval, llvm_function->arg_begin ());
+      else
+        builder.CreateRet (rval);
+    }
+  else
+    builder.CreateRetVoid ();
+
+  llvm::verifyFunction (*llvm_function);
+}
+
+void
+jit_function::do_add_mapping (llvm::ExecutionEngine *engine, void *fn)
+{
+  assert (valid ());
+  engine->addGlobalMapping (llvm_function, fn);
+}
+
+std::ostream&
+operator<< (std::ostream& os, const jit_function& fn)
+{
+  llvm::Function *lfn = fn.to_llvm ();
+  os << "jit_function: cc=" << fn.call_conv;
+  llvm::raw_os_ostream llvm_out (os);
+  lfn->print (llvm_out);
+  llvm_out.flush ();
+  return os;
+}
+
+// -------------------- jit_operation --------------------
+void
+jit_operation::add_overload (const jit_function& func,
+                            const std::vector<jit_type*>& args)
+{
+  if (args.size () >= overloads.size ())
+    overloads.resize (args.size () + 1);
+
+  Array<jit_function>& over = overloads[args.size ()];
+  dim_vector dv (over.dims ());
+  Array<octave_idx_type> idx = to_idx (args);
+  bool must_resize = false;
+
+  if (dv.length () != idx.numel ())
+    {
+      dv.resize (idx.numel ());
+      must_resize = true;
+    }
+
+  for (octave_idx_type i = 0; i < dv.length (); ++i)
+    if (dv(i) <= idx(i))
+      {
+        must_resize = true;
+        dv(i) = idx(i) + 1;
+      }
+
+  if (must_resize)
+    over.resize (dv);
+
+  over(idx) = func;
+}
+
+const jit_function&
+jit_operation::overload (const std::vector<jit_type*>& types) const
+{
+  // FIXME: We should search for the next best overload on failure
+  static jit_function null_overload;
+  if (types.size () >= overloads.size ())
+    return null_overload;
+
+  for (size_t i  =0; i < types.size (); ++i)
+    if (! types[i])
+      return null_overload;
+
+  const Array<jit_function>& over = overloads[types.size ()];
+  dim_vector dv (over.dims ());
+  Array<octave_idx_type> idx = to_idx (types);
+  for (octave_idx_type i = 0; i < dv.length (); ++i)
+    if (idx(i) >= dv(i))
+      return null_overload;
+
+  return over(idx);
+}
+
+Array<octave_idx_type>
+jit_operation::to_idx (const std::vector<jit_type*>& types) const
+{
+  octave_idx_type numel = types.size ();
+  if (numel == 1)
+    numel = 2;
+
+  Array<octave_idx_type> idx (dim_vector (1, numel));
+  for (octave_idx_type i = 0; i < static_cast<octave_idx_type> (types.size ());
+       ++i)
+    idx(i) = types[i]->type_id ();
+
+  if (types.size () == 1)
+    {
+      idx(1) = idx(0);
+      idx(0) = 0;
+    }
+
+  return idx;
+}
+
+// -------------------- jit_typeinfo --------------------
+void
+jit_typeinfo::initialize (llvm::Module *m, llvm::ExecutionEngine *e)
+{
+  new jit_typeinfo (m, e);
+}
+
+jit_typeinfo::jit_typeinfo (llvm::Module *m, llvm::ExecutionEngine *e)
+  : module (m), engine (e), next_id (0),
+    builder (*new llvm::IRBuilderD (context))
+{
+  instance = this;
+
+  // FIXME: We should be registering types like in octave_value_typeinfo
+  llvm::Type *any_t = llvm::StructType::create (context, "octave_base_value");
+  any_t = any_t->getPointerTo ();
+
+  llvm::Type *scalar_t = llvm::Type::getDoubleTy (context);
+  llvm::Type *bool_t = llvm::Type::getInt1Ty (context);
+  llvm::Type *string_t = llvm::Type::getInt8Ty (context);
+  string_t = string_t->getPointerTo ();
+  llvm::Type *index_t = llvm::Type::getIntNTy (context,
+                                               sizeof(octave_idx_type) * 8);
+
+  llvm::StructType *range_t = llvm::StructType::create (context, "range");
+  std::vector<llvm::Type *> range_contents (4, scalar_t);
+  range_contents[3] = index_t;
+  range_t->setBody (range_contents);
+
+  llvm::Type *refcount_t = llvm::Type::getIntNTy (context, sizeof(int) * 8);
+
+  llvm::StructType *matrix_t = llvm::StructType::create (context, "matrix");
+  llvm::Type *matrix_contents[5];
+  matrix_contents[0] = refcount_t->getPointerTo ();
+  matrix_contents[1] = scalar_t->getPointerTo ();
+  matrix_contents[2] = index_t;
+  matrix_contents[3] = index_t->getPointerTo ();
+  matrix_contents[4] = string_t;
+  matrix_t->setBody (llvm::makeArrayRef (matrix_contents, 5));
+
+  llvm::Type *complex_t = llvm::VectorType::get (scalar_t, 2);
+
+  // complex_ret is what is passed to C functions in order to get calling
+  // convention right
+  complex_ret = llvm::StructType::create (context, "complex_ret");
+  llvm::Type *complex_ret_contents[] = {scalar_t, scalar_t};
+  complex_ret->setBody (complex_ret_contents);
+
+  // create types
+  any = new_type ("any", 0, any_t);
+  matrix = new_type ("matrix", any, matrix_t);
+  complex = new_type ("complex", any, complex_t);
+  scalar = new_type ("scalar", complex, scalar_t);
+  range = new_type ("range", any, range_t);
+  string = new_type ("string", any, string_t);
+  boolean = new_type ("bool", any, bool_t);
+  index = new_type ("index", any, index_t);
+
+  create_int (8);
+  create_int (16);
+  create_int (32);
+  create_int (64);
+
+  casts.resize (next_id + 1);
+  identities.resize (next_id + 1);
+
+  // specify calling conventions
+  // FIXME: We should detect architecture and do something sane based on that
+  // here we assume x86 or x86_64
+  matrix->mark_sret ();
+  matrix->mark_pointer_arg ();
+
+  range->mark_sret ();
+  range->mark_pointer_arg ();
+
+  complex->set_pack (jit_convention::external, &jit_typeinfo::pack_complex);
+  complex->set_unpack (jit_convention::external, &jit_typeinfo::unpack_complex);
+  complex->set_packed_type (jit_convention::external, complex_ret);
+
+  if (sizeof (void *) == 4)
+    complex->mark_sret ();
+
+  // bind global variables
+  lerror_state = new llvm::GlobalVariable (*module, bool_t, false,
+                                           llvm::GlobalValue::ExternalLinkage,
+                                           0, "error_state");
+  engine->addGlobalMapping (lerror_state,
+                            reinterpret_cast<void *> (&error_state));
+
+  // any with anything is an any op
+  jit_function fn;
+  jit_type *binary_op_type = intN (sizeof (octave_value::binary_op) * 8);
+  llvm::Type *llvm_bo_type = binary_op_type->to_llvm ();
+  jit_function any_binary = create_function (jit_convention::external,
+                                             "octave_jit_binary_any_any",
+                                             any, binary_op_type, any, any);
+  any_binary.add_mapping (engine, &octave_jit_binary_any_any);
+  any_binary.mark_can_error ();
+  binary_ops.resize (octave_value::num_binary_ops);
+  for (size_t i = 0; i < octave_value::num_binary_ops; ++i)
+    {
+      octave_value::binary_op op = static_cast<octave_value::binary_op> (i);
+      std::string op_name = octave_value::binary_op_as_string (op);
+      binary_ops[i].stash_name ("binary" + op_name);
+    }
+
+  for (int op = 0; op < octave_value::num_binary_ops; ++op)
+    {
+      llvm::Twine fn_name ("octave_jit_binary_any_any_");
+      fn_name = fn_name + llvm::Twine (op);
+
+      fn = create_function (jit_convention::internal, fn_name, any, any, any);
+      fn.mark_can_error ();
+      llvm::BasicBlock *block = fn.new_block ();
+      builder.SetInsertPoint (block);
+      llvm::APInt op_int(sizeof (octave_value::binary_op) * 8, op,
+                         std::numeric_limits<octave_value::binary_op>::is_signed);
+      llvm::Value *op_as_llvm = llvm::ConstantInt::get (llvm_bo_type, op_int);
+      llvm::Value *ret = any_binary.call (builder, op_as_llvm,
+                                          fn.argument (builder, 0),
+                                          fn.argument (builder, 1));
+      fn.do_return (builder, ret);
+      binary_ops[op].add_overload (fn);
+    }
+
+  // grab any
+  fn = create_function (jit_convention::external, "octave_jit_grab_any", any,
+                        any);
+  fn.add_mapping (engine, &octave_jit_grab_any);
+  grab_fn.add_overload (fn);
+  grab_fn.stash_name ("grab");
+
+  // grab matrix
+  fn = create_function (jit_convention::external, "octave_jit_grab_matrix",
+                        matrix, matrix);
+  fn.add_mapping (engine, &octave_jit_grab_matrix);
+  grab_fn.add_overload (fn);
+
+  // release any
+  fn = create_function (jit_convention::external, "octave_jit_release_any", 0,
+                        any);
+  fn.add_mapping (engine, &octave_jit_release_any);
+  release_fn.add_overload (fn);
+  release_fn.stash_name ("release");
+
+  // release matrix
+  fn = create_function (jit_convention::external, "octave_jit_release_matrix",
+                        0, matrix);
+  fn.add_mapping (engine, &octave_jit_release_matrix);
+  release_fn.add_overload (fn);
+
+  // release scalar
+  fn = create_identity (scalar);
+  release_fn.add_overload (fn);
+
+  // release complex
+  fn = create_identity (complex);
+  release_fn.add_overload (fn);
+
+  // release index
+  fn = create_identity (index);
+  release_fn.add_overload (fn);
+
+  // now for binary scalar operations
+  // FIXME: Finish all operations
+  add_binary_op (scalar, octave_value::op_add, llvm::Instruction::FAdd);
+  add_binary_op (scalar, octave_value::op_sub, llvm::Instruction::FSub);
+  add_binary_op (scalar, octave_value::op_mul, llvm::Instruction::FMul);
+  add_binary_op (scalar, octave_value::op_el_mul, llvm::Instruction::FMul);
+
+  add_binary_fcmp (scalar, octave_value::op_lt, llvm::CmpInst::FCMP_ULT);
+  add_binary_fcmp (scalar, octave_value::op_le, llvm::CmpInst::FCMP_ULE);
+  add_binary_fcmp (scalar, octave_value::op_eq, llvm::CmpInst::FCMP_UEQ);
+  add_binary_fcmp (scalar, octave_value::op_ge, llvm::CmpInst::FCMP_UGE);
+  add_binary_fcmp (scalar, octave_value::op_gt, llvm::CmpInst::FCMP_UGT);
+  add_binary_fcmp (scalar, octave_value::op_ne, llvm::CmpInst::FCMP_UNE);
+
+  jit_function gripe_div0 = create_function (jit_convention::external,
+                                             "gripe_divide_by_zero", 0);
+  gripe_div0.add_mapping (engine, &gripe_divide_by_zero);
+  gripe_div0.mark_can_error ();
+
+  // divide is annoying because it might error
+  fn = create_function (jit_convention::internal,
+                        "octave_jit_div_scalar_scalar", scalar, scalar, scalar);
+  fn.mark_can_error ();
+
+  llvm::BasicBlock *body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::BasicBlock *warn_block = fn.new_block ("warn");
+    llvm::BasicBlock *normal_block = fn.new_block ("normal");
+
+    llvm::Value *zero = llvm::ConstantFP::get (scalar_t, 0);
+    llvm::Value *check = builder.CreateFCmpUEQ (zero, fn.argument (builder, 0));
+    builder.CreateCondBr (check, warn_block, normal_block);
+
+    builder.SetInsertPoint (warn_block);
+    gripe_div0.call (builder);
+    builder.CreateBr (normal_block);
+
+    builder.SetInsertPoint (normal_block);
+    llvm::Value *ret = builder.CreateFDiv (fn.argument (builder, 0),
+                                           fn.argument (builder, 1));
+    fn.do_return (builder, ret);
+  }
+  binary_ops[octave_value::op_div].add_overload (fn);
+  binary_ops[octave_value::op_el_div].add_overload (fn);
+
+  // ldiv is the same as div with the operators reversed
+  fn = mirror_binary (fn);
+  binary_ops[octave_value::op_ldiv].add_overload (fn);
+  binary_ops[octave_value::op_el_ldiv].add_overload (fn);
+
+  // In general, the result of scalar ^ scalar is a complex number. We might be
+  // able to improve on this if we keep track of the range of values varaibles
+  // can take on.
+  fn = create_function (jit_convention::external,
+                        "octave_jit_pow_scalar_scalar", complex, scalar,
+                        scalar);
+  fn.add_mapping (engine, &octave_jit_pow_scalar_scalar);
+  binary_ops[octave_value::op_pow].add_overload (fn);
+  binary_ops[octave_value::op_el_pow].add_overload (fn);
+
+  // now for binary complex operations
+  add_binary_op (complex, octave_value::op_add, llvm::Instruction::FAdd);
+  add_binary_op (complex, octave_value::op_sub, llvm::Instruction::FSub);
+
+  fn = create_function (jit_convention::internal,
+                        "octave_jit_*_complex_complex", complex, complex,
+                        complex);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    // (x0*x1 - y0*y1, x0*y1 + y0*x1) = (x0,y0) * (x1,y1)
+    // We compute this in one vectorized multiplication, a subtraction, and an
+    // addition.
+    llvm::Value *lhs = fn.argument (builder, 0);
+    llvm::Value *rhs = fn.argument (builder, 1);
+
+    // FIXME: We need a better way of doing this, working with llvm's IR
+    // directly is sort of a pain.
+    llvm::Value *zero = builder.getInt32 (0);
+    llvm::Value *one = builder.getInt32 (1);
+    llvm::Value *two = builder.getInt32 (2);
+    llvm::Value *three = builder.getInt32 (3);
+
+    llvm::Type *vec4 = llvm::VectorType::get (scalar_t, 4);
+    llvm::Value *mlhs = llvm::UndefValue::get (vec4);
+    llvm::Value *mrhs = mlhs;
+
+    llvm::Value *temp = complex_real (lhs);
+    mlhs = builder.CreateInsertElement (mlhs, temp, zero);
+    mlhs = builder.CreateInsertElement (mlhs, temp, two);
+    temp = complex_imag (lhs);
+    mlhs = builder.CreateInsertElement (mlhs, temp, one);
+    mlhs = builder.CreateInsertElement (mlhs, temp, three);
+
+    temp = complex_real (rhs);
+    mrhs = builder.CreateInsertElement (mrhs, temp, zero);
+    mrhs = builder.CreateInsertElement (mrhs, temp, three);
+    temp = complex_imag (rhs);
+    mrhs = builder.CreateInsertElement (mrhs, temp, one);
+    mrhs = builder.CreateInsertElement (mrhs, temp, two);
+
+    llvm::Value *mres = builder.CreateFMul (mlhs, mrhs);
+    llvm::Value *tlhs = builder.CreateExtractElement (mres, zero);
+    llvm::Value *trhs = builder.CreateExtractElement (mres, one);
+    llvm::Value *ret_real = builder.CreateFSub (tlhs, trhs);
+
+    tlhs = builder.CreateExtractElement (mres, two);
+    trhs = builder.CreateExtractElement (mres, three);
+    llvm::Value *ret_imag = builder.CreateFAdd (tlhs, trhs);
+    fn.do_return (builder, complex_new (ret_real, ret_imag));
+  }
+
+  binary_ops[octave_value::op_mul].add_overload (fn);
+  binary_ops[octave_value::op_el_mul].add_overload (fn);
+
+  jit_function complex_div = create_function (jit_convention::external,
+                                              "octave_jit_complex_div",
+                                              complex, complex, complex);
+  complex_div.add_mapping (engine, &octave_jit_complex_div);
+  complex_div.mark_can_error ();
+  binary_ops[octave_value::op_div].add_overload (fn);
+  binary_ops[octave_value::op_ldiv].add_overload (fn);
+
+  fn = mirror_binary (complex_div);
+  binary_ops[octave_value::op_ldiv].add_overload (fn);
+  binary_ops[octave_value::op_el_ldiv].add_overload (fn);
+
+  fn = create_function (jit_convention::external,
+                        "octave_jit_pow_complex_complex", complex, complex,
+                        complex);
+  fn.add_mapping (engine, &octave_jit_pow_complex_complex);
+  binary_ops[octave_value::op_pow].add_overload (fn);
+  binary_ops[octave_value::op_el_pow].add_overload (fn);
+
+  fn = create_function (jit_convention::internal,
+                        "octave_jit_*_scalar_complex", complex, scalar,
+                        complex);
+  jit_function mul_scalar_complex = fn;
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *lhs = fn.argument (builder, 0);
+    llvm::Value *tlhs = complex_new (lhs, lhs);
+    llvm::Value *rhs = fn.argument (builder, 1);
+    fn.do_return (builder, builder.CreateFMul (tlhs, rhs));
+  }
+  binary_ops[octave_value::op_mul].add_overload (fn);
+  binary_ops[octave_value::op_el_mul].add_overload (fn);
+
+
+  fn = mirror_binary (mul_scalar_complex);
+  binary_ops[octave_value::op_mul].add_overload (fn);
+  binary_ops[octave_value::op_el_mul].add_overload (fn);
+
+  fn = create_function (jit_convention::internal, "octave_jit_+_scalar_complex",
+                        complex, scalar, complex);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *lhs = fn.argument (builder, 0);
+    llvm::Value *rhs = fn.argument (builder, 1);
+    llvm::Value *real = builder.CreateFAdd (lhs, complex_real (rhs));
+    fn.do_return (builder, complex_real (rhs, real));
+  }
+  binary_ops[octave_value::op_add].add_overload (fn);
+
+  fn = mirror_binary (fn);
+  binary_ops[octave_value::op_add].add_overload (fn);
+
+  fn = create_function (jit_convention::internal, "octave_jit_-_complex_scalar",
+                        complex, complex, scalar);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *lhs = fn.argument (builder, 0);
+    llvm::Value *rhs = fn.argument (builder, 1);
+    llvm::Value *real = builder.CreateFSub (complex_real (lhs), rhs);
+    fn.do_return (builder, complex_real (lhs, real));
+  }
+  binary_ops[octave_value::op_sub].add_overload (fn);
+
+  fn = create_function (jit_convention::internal, "octave_jit_-_scalar_complex",
+                        complex, scalar, complex);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *lhs = fn.argument (builder, 0);
+    llvm::Value *rhs = fn.argument (builder, 1);
+    llvm::Value *real = builder.CreateFSub (lhs, complex_real (rhs));
+    fn.do_return (builder, complex_real (rhs, real));
+  }
+  binary_ops[octave_value::op_sub].add_overload (fn);
+
+  fn = create_function (jit_convention::external,
+                        "octave_jit_pow_scalar_complex", complex, scalar,
+                        complex);
+  fn.add_mapping (engine, &octave_jit_pow_scalar_complex);
+  binary_ops[octave_value::op_pow].add_overload (fn);
+  binary_ops[octave_value::op_el_pow].add_overload (fn);
+
+  fn = create_function (jit_convention::external,
+                        "octave_jit_pow_complex_scalar", complex, complex,
+                        scalar);
+  fn.add_mapping (engine, &octave_jit_pow_complex_scalar);
+  binary_ops[octave_value::op_pow].add_overload (fn);
+  binary_ops[octave_value::op_el_pow].add_overload (fn);
+
+  // now for binary index operators
+  add_binary_op (index, octave_value::op_add, llvm::Instruction::Add);
+
+  // and binary bool operators
+  add_binary_op (boolean, octave_value::op_el_or, llvm::Instruction::Or);
+  add_binary_op (boolean, octave_value::op_el_and, llvm::Instruction::And);
+
+  // now for printing functions
+  print_fn.stash_name ("print");
+  add_print (any, reinterpret_cast<void *> (&octave_jit_print_any));
+  add_print (scalar, reinterpret_cast<void *> (&octave_jit_print_scalar));
+
+  // initialize for loop
+  for_init_fn.stash_name ("for_init");
+
+  fn = create_function (jit_convention::internal, "octave_jit_for_range_init",
+                        index, range);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *zero = llvm::ConstantInt::get (index_t, 0);
+    fn.do_return (builder, zero);
+  }
+  for_init_fn.add_overload (fn);
+
+  // bounds check for for loop
+  for_check_fn.stash_name ("for_check");
+
+  fn = create_function (jit_convention::internal, "octave_jit_for_range_check",
+                        boolean, range, index);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *nelem
+      = builder.CreateExtractValue (fn.argument (builder, 0), 3);
+    llvm::Value *idx = fn.argument (builder, 1);
+    llvm::Value *ret = builder.CreateICmpULT (idx, nelem);
+    fn.do_return (builder, ret);
+  }
+  for_check_fn.add_overload (fn);
+
+  // index variabe for for loop
+  for_index_fn.stash_name ("for_index");
+
+  fn = create_function (jit_convention::internal, "octave_jit_for_range_idx",
+                        scalar, range, index);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *idx = fn.argument (builder, 1);
+    llvm::Value *didx = builder.CreateSIToFP (idx, scalar_t);
+    llvm::Value *rng = fn.argument (builder, 0);
+    llvm::Value *base = builder.CreateExtractValue (rng, 0);
+    llvm::Value *inc = builder.CreateExtractValue (rng, 2);
+
+    llvm::Value *ret = builder.CreateFMul (didx, inc);
+    ret = builder.CreateFAdd (base, ret);
+    fn.do_return (builder, ret);
+  }
+  for_index_fn.add_overload (fn);
+
+  // logically true
+  logically_true_fn.stash_name ("logically_true");
+
+  jit_function gripe_nantl
+    = create_function (jit_convention::external,
+                       "octave_jit_gripe_nan_to_logical_conversion", 0);
+  gripe_nantl.add_mapping (engine, &octave_jit_gripe_nan_to_logical_conversion);
+  gripe_nantl.mark_can_error ();
+
+  fn = create_function (jit_convention::internal,
+                        "octave_jit_logically_true_scalar", boolean, scalar);
+  fn.mark_can_error ();
+
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::BasicBlock *error_block = fn.new_block ("error");
+    llvm::BasicBlock *normal_block = fn.new_block ("normal");
+
+    llvm::Value *check = builder.CreateFCmpUNE (fn.argument (builder, 0),
+                                                fn.argument (builder, 0));
+    builder.CreateCondBr (check, error_block, normal_block);
+
+    builder.SetInsertPoint (error_block);
+    gripe_nantl.call (builder);
+    builder.CreateBr (normal_block);
+    builder.SetInsertPoint (normal_block);
+
+    llvm::Value *zero = llvm::ConstantFP::get (scalar_t, 0);
+    llvm::Value *ret = builder.CreateFCmpONE (fn.argument (builder, 0), zero);
+    fn.do_return (builder, ret);
+  }
+  logically_true_fn.add_overload (fn);
+
+  // logically_true boolean
+  fn = create_identity (boolean);
+  logically_true_fn.add_overload (fn);
+
+  // make_range
+  // FIXME: May be benificial to implement all in LLVM
+  make_range_fn.stash_name ("make_range");
+  jit_function compute_nelem
+    = create_function (jit_convention::external, "octave_jit_compute_nelem",
+                       index, scalar, scalar, scalar);
+  compute_nelem.add_mapping (engine, &octave_jit_compute_nelem);
+
+  fn = create_function (jit_convention::internal, "octave_jit_make_range",
+                        range, scalar, scalar, scalar);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *base = fn.argument (builder, 0);
+    llvm::Value *limit = fn.argument (builder, 1);
+    llvm::Value *inc = fn.argument (builder, 2);
+    llvm::Value *nelem = compute_nelem.call (builder, base, limit, inc);
+
+    llvm::Value *dzero = llvm::ConstantFP::get (scalar_t, 0);
+    llvm::Value *izero = llvm::ConstantInt::get (index_t, 0);
+    llvm::Value *rng = llvm::ConstantStruct::get (range_t, dzero, dzero, dzero,
+                                                  izero, NULL);
+    rng = builder.CreateInsertValue (rng, base, 0);
+    rng = builder.CreateInsertValue (rng, limit, 1);
+    rng = builder.CreateInsertValue (rng, inc, 2);
+    rng = builder.CreateInsertValue (rng, nelem, 3);
+    fn.do_return (builder, rng);
+  }
+  make_range_fn.add_overload (fn);
+
+  // paren_subsref
+  jit_type *jit_int = intN (sizeof (int) * 8);
+  llvm::Type *int_t = jit_int->to_llvm ();
+  jit_function ginvalid_index
+    = create_function (jit_convention::external, "octave_jit_ginvalid_index",
+                       0);
+  ginvalid_index.add_mapping (engine, &octave_jit_ginvalid_index);
+  jit_function gindex_range = create_function (jit_convention::external,
+                                               "octave_jit_gindex_range",
+                                               0, jit_int, jit_int, index,
+                                               index);
+  gindex_range.add_mapping (engine, &octave_jit_gindex_range);
+
+  fn = create_function (jit_convention::internal, "()subsref", scalar, matrix,
+                        scalar);
+  fn.mark_can_error ();
+
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *one = llvm::ConstantInt::get (index_t, 1);
+    llvm::Value *ione;
+    if (index_t == int_t)
+      ione = one;
+    else
+      ione = llvm::ConstantInt::get (int_t, 1);
+
+    llvm::Value *undef = llvm::UndefValue::get (scalar_t);
+    llvm::Value *mat = fn.argument (builder, 0);
+    llvm::Value *idx = fn.argument (builder, 1);
+
+    // convert index to scalar to integer, and check index >= 1
+    llvm::Value *int_idx = builder.CreateFPToSI (idx, index_t);
+    llvm::Value *check_idx = builder.CreateSIToFP (int_idx, scalar_t);
+    llvm::Value *cond0 = builder.CreateFCmpUNE (idx, check_idx);
+    llvm::Value *cond1 = builder.CreateICmpSLT (int_idx, one);
+    llvm::Value *cond = builder.CreateOr (cond0, cond1);
+
+    llvm::BasicBlock *done = fn.new_block ("done");
+    llvm::BasicBlock *conv_error = fn.new_block ("conv_error", done);
+    llvm::BasicBlock *normal = fn.new_block ("normal", done);
+    builder.CreateCondBr (cond, conv_error, normal);
+
+    builder.SetInsertPoint (conv_error);
+    ginvalid_index.call (builder);
+    builder.CreateBr (done);
+
+    builder.SetInsertPoint (normal);
+    llvm::Value *len = builder.CreateExtractValue (mat,
+                                                   llvm::ArrayRef<unsigned> (2));
+    cond = builder.CreateICmpSGT (int_idx, len);
+
+
+    llvm::BasicBlock *bounds_error = fn.new_block ("bounds_error", done);
+    llvm::BasicBlock *success = fn.new_block ("success", done);
+    builder.CreateCondBr (cond, bounds_error, success);
+
+    builder.SetInsertPoint (bounds_error);
+    gindex_range.call (builder, ione, ione, int_idx, len);
+    builder.CreateBr (done);
+
+    builder.SetInsertPoint (success);
+    llvm::Value *data = builder.CreateExtractValue (mat,
+                                                    llvm::ArrayRef<unsigned> (1));
+    llvm::Value *gep = builder.CreateInBoundsGEP (data, int_idx);
+    llvm::Value *ret = builder.CreateLoad (gep);
+    builder.CreateBr (done);
+
+    builder.SetInsertPoint (done);
+
+    llvm::PHINode *merge = llvm::PHINode::Create (scalar_t, 3);
+    builder.Insert (merge);
+    merge->addIncoming (undef, conv_error);
+    merge->addIncoming (undef, bounds_error);
+    merge->addIncoming (ret, success);
+    fn.do_return (builder, merge);
+  }
+  paren_subsref_fn.add_overload (fn);
+
+  // paren subsasgn
+  paren_subsasgn_fn.stash_name ("()subsasgn");
+
+  jit_function resize_paren_subsasgn
+    = create_function (jit_convention::external,
+                       "octave_jit_paren_subsasgn_impl", matrix, matrix, index,
+                       scalar);
+  resize_paren_subsasgn.add_mapping (engine, &octave_jit_paren_subsasgn_impl);
+  fn = create_function (jit_convention::internal, "octave_jit_paren_subsasgn",
+                        matrix, matrix, scalar, scalar);
+  fn.mark_can_error ();
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *one = llvm::ConstantInt::get (index_t, 1);
+
+    llvm::Value *mat = fn.argument (builder, 0);
+    llvm::Value *idx = fn.argument (builder, 1);
+    llvm::Value *value = fn.argument (builder, 2);
+
+    llvm::Value *int_idx = builder.CreateFPToSI (idx, index_t);
+    llvm::Value *check_idx = builder.CreateSIToFP (int_idx, scalar_t);
+    llvm::Value *cond0 = builder.CreateFCmpUNE (idx, check_idx);
+    llvm::Value *cond1 = builder.CreateICmpSLT (int_idx, one);
+    llvm::Value *cond = builder.CreateOr (cond0, cond1);
+
+    llvm::BasicBlock *done = fn.new_block ("done");
+
+    llvm::BasicBlock *conv_error = fn.new_block ("conv_error", done);
+    llvm::BasicBlock *normal = fn.new_block ("normal", done);
+    builder.CreateCondBr (cond, conv_error, normal);
+    builder.SetInsertPoint (conv_error);
+    ginvalid_index.call (builder);
+    builder.CreateBr (done);
+
+    builder.SetInsertPoint (normal);
+    llvm::Value *len = builder.CreateExtractValue (mat,
+                                                   llvm::ArrayRef<unsigned> (2));
+    cond0 = builder.CreateICmpSGT (int_idx, len);
+
+    llvm::Value *rcount = builder.CreateExtractValue (mat, 0);
+    rcount = builder.CreateLoad (rcount);
+    cond1 = builder.CreateICmpSGT (rcount, one);
+    cond = builder.CreateOr (cond0, cond1);
+
+    llvm::BasicBlock *bounds_error = fn.new_block ("bounds_error", done);
+    llvm::BasicBlock *success = fn.new_block ("success", done);
+    builder.CreateCondBr (cond, bounds_error, success);
+
+    // resize on out of bounds access
+    builder.SetInsertPoint (bounds_error);
+    llvm::Value *resize_result = resize_paren_subsasgn.call (builder, mat,
+                                                             int_idx, value);
+    builder.CreateBr (done);
+
+    builder.SetInsertPoint (success);
+    llvm::Value *data = builder.CreateExtractValue (mat,
+                                                    llvm::ArrayRef<unsigned> (1));
+    llvm::Value *gep = builder.CreateInBoundsGEP (data, int_idx);
+    builder.CreateStore (value, gep);
+    builder.CreateBr (done);
+
+    builder.SetInsertPoint (done);
+
+    llvm::PHINode *merge = llvm::PHINode::Create (matrix_t, 3);
+    builder.Insert (merge);
+    merge->addIncoming (mat, conv_error);
+    merge->addIncoming (resize_result, bounds_error);
+    merge->addIncoming (mat, success);
+    fn.do_return (builder, merge);
+  }
+  paren_subsasgn_fn.add_overload (fn);
+
+  fn = create_function (jit_convention::external,
+                        "octave_jit_paren_subsasgn_matrix_range", matrix,
+                        matrix, range, scalar);
+  fn.add_mapping (engine, &octave_jit_paren_subsasgn_matrix_range);
+  fn.mark_can_error ();
+  paren_subsasgn_fn.add_overload (fn);
+
+  casts[any->type_id ()].stash_name ("(any)");
+  casts[scalar->type_id ()].stash_name ("(scalar)");
+  casts[complex->type_id ()].stash_name ("(complex)");
+  casts[matrix->type_id ()].stash_name ("(matrix)");
+  casts[any->type_id ()].stash_name ("(range)");
+
+  // cast any <- matrix
+  fn = create_function (jit_convention::external, "octave_jit_cast_any_matrix",
+                        any, matrix);
+  fn.add_mapping (engine, &octave_jit_cast_any_matrix);
+  casts[any->type_id ()].add_overload (fn);
+
+  // cast matrix <- any
+  fn = create_function (jit_convention::external, "octave_jit_cast_matrix_any",
+                        matrix, any);
+  fn.add_mapping (engine, &octave_jit_cast_matrix_any);
+  casts[matrix->type_id ()].add_overload (fn);
+
+  // cast any <- range
+  fn = create_function (jit_convention::external, "octave_jit_cast_any_range",
+                        any, range);
+  fn.add_mapping (engine, &octave_jit_cast_any_range);
+  casts[any->type_id ()].add_overload (fn);
+
+  // cast range <- any
+  fn = create_function (jit_convention::external, "octave_jit_cast_range_any",
+                        range, any);
+  fn.add_mapping (engine, &octave_jit_cast_range_any);
+  casts[range->type_id ()].add_overload (fn);
+
+  // cast any <- scalar
+  fn = create_function (jit_convention::external, "octave_jit_cast_any_scalar",
+                        any, scalar);
+  fn.add_mapping (engine, &octave_jit_cast_any_scalar);
+  casts[any->type_id ()].add_overload (fn);
+
+  // cast scalar <- any
+  fn = create_function (jit_convention::external, "octave_jit_cast_scalar_any",
+                        scalar, any);
+  fn.add_mapping (engine, &octave_jit_cast_scalar_any);
+  casts[scalar->type_id ()].add_overload (fn);
+
+  // cast any <- complex
+  fn = create_function (jit_convention::external, "octave_jit_cast_any_complex",
+                        any, complex);
+  fn.add_mapping (engine, &octave_jit_cast_any_complex);
+  casts[any->type_id ()].add_overload (fn);
+
+  // cast complex <- any
+  fn = create_function (jit_convention::external, "octave_jit_cast_complex_any",
+                        complex, any);
+  fn.add_mapping (engine, &octave_jit_cast_complex_any);
+  casts[complex->type_id ()].add_overload (fn);
+
+  // cast complex <- scalar
+  fn = create_function (jit_convention::internal,
+                        "octave_jit_cast_complex_scalar", complex, scalar);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  {
+    llvm::Value *zero = llvm::ConstantFP::get (scalar_t, 0);
+    fn.do_return (builder, complex_new (fn.argument (builder, 0), zero));
+  }
+  casts[complex->type_id ()].add_overload (fn);
+
+  // cast scalar <- complex
+  fn = create_function (jit_convention::internal,
+                        "octave_jit_cast_scalar_complex", scalar, complex);
+  body = fn.new_block ();
+  builder.SetInsertPoint (body);
+  fn.do_return (builder, complex_real (fn.argument (builder, 0)));
+  casts[scalar->type_id ()].add_overload (fn);
+
+  // cast any <- any
+  fn = create_identity (any);
+  casts[any->type_id ()].add_overload (fn);
+
+  // cast scalar <- scalar
+  fn = create_identity (scalar);
+  casts[scalar->type_id ()].add_overload (fn);
+
+  // cast complex <- complex
+  fn = create_identity (complex);
+  casts[complex->type_id ()].add_overload (fn);
+
+  // -------------------- builtin functions --------------------
+  add_builtin ("#unknown_function");
+  unknown_function = builtins["#unknown_function"];
+
+  add_builtin ("sin");
+  register_intrinsic ("sin", llvm::Intrinsic::sin, scalar, scalar);
+  register_generic ("sin", matrix, matrix);
+
+  add_builtin ("cos");
+  register_intrinsic ("cos", llvm::Intrinsic::cos, scalar, scalar);
+  register_generic ("cos", matrix, matrix);
+
+  add_builtin ("exp");
+  register_intrinsic ("exp", llvm::Intrinsic::cos, scalar, scalar);
+  register_generic ("exp", matrix, matrix);
+
+  casts.resize (next_id + 1);
+  jit_function any_id = create_identity (any);
+  jit_function release_any = get_release (any);
+  std::vector<jit_type *> args;
+  args.resize (1);
+
+  for (std::map<std::string, jit_type *>::iterator iter = builtins.begin ();
+       iter != builtins.end (); ++iter)
+    {
+      jit_type *btype = iter->second;
+      args[0] = btype;
+
+      release_fn.add_overload (jit_function (release_any, 0, args));
+      casts[any->type_id ()].add_overload (jit_function (any_id, any, args));
+
+      args[0] = any;
+      casts[btype->type_id ()].add_overload (jit_function (any_id, btype,
+                                                           args));
+    }
+}
+
+void
+jit_typeinfo::add_print (jit_type *ty, void *fptr)
+{
+  std::stringstream name;
+  name << "octave_jit_print_" << ty->name ();
+  jit_function fn = create_function (jit_convention::external, name.str (), 0,
+                                     intN (8), ty);
+  fn.add_mapping (engine, fptr);
+  print_fn.add_overload (fn);
+}
+
+// FIXME: cp between add_binary_op, add_binary_icmp, and add_binary_fcmp
+void
+jit_typeinfo::add_binary_op (jit_type *ty, int op, int llvm_op)
+{
+  std::stringstream fname;
+  octave_value::binary_op ov_op = static_cast<octave_value::binary_op>(op);
+  fname << "octave_jit_" << octave_value::binary_op_as_string (ov_op)
+        << "_" << ty->name ();
+
+  jit_function fn = create_function (jit_convention::internal, fname.str (),
+                                        ty, ty, ty);
+  llvm::BasicBlock *block = fn.new_block ();
+  builder.SetInsertPoint (block);
+  llvm::Instruction::BinaryOps temp
+    = static_cast<llvm::Instruction::BinaryOps>(llvm_op);
+
+  llvm::Value *ret = builder.CreateBinOp (temp, fn.argument (builder, 0),
+                                          fn.argument (builder, 1));
+  fn.do_return (builder, ret);
+  binary_ops[op].add_overload (fn);
+}
+
+void
+jit_typeinfo::add_binary_icmp (jit_type *ty, int op, int llvm_op)
+{
+  std::stringstream fname;
+  octave_value::binary_op ov_op = static_cast<octave_value::binary_op>(op);
+  fname << "octave_jit" << octave_value::binary_op_as_string (ov_op)
+        << "_" << ty->name ();
+
+  jit_function fn = create_function (jit_convention::internal, fname.str (),
+                                     boolean, ty, ty);
+  llvm::BasicBlock *block = fn.new_block ();
+  builder.SetInsertPoint (block);
+  llvm::CmpInst::Predicate temp
+    = static_cast<llvm::CmpInst::Predicate>(llvm_op);
+  llvm::Value *ret = builder.CreateICmp (temp, fn.argument (builder, 0),
+                                         fn.argument (builder, 1));
+  fn.do_return (builder, ret);
+  binary_ops[op].add_overload (fn);
+}
+
+void
+jit_typeinfo::add_binary_fcmp (jit_type *ty, int op, int llvm_op)
+{
+  std::stringstream fname;
+  octave_value::binary_op ov_op = static_cast<octave_value::binary_op>(op);
+  fname << "octave_jit" << octave_value::binary_op_as_string (ov_op)
+        << "_" << ty->name ();
+
+  jit_function fn = create_function (jit_convention::internal, fname.str (),
+                                     boolean, ty, ty);
+  llvm::BasicBlock *block = fn.new_block ();
+  builder.SetInsertPoint (block);
+  llvm::CmpInst::Predicate temp
+    = static_cast<llvm::CmpInst::Predicate>(llvm_op);
+  llvm::Value *ret = builder.CreateFCmp (temp, fn.argument (builder, 0),
+                                         fn.argument (builder, 1));
+  fn.do_return (builder, ret);
+  binary_ops[op].add_overload (fn);
+}
+
+jit_function
+jit_typeinfo::create_function (jit_convention::type cc, const llvm::Twine& name,
+                               jit_type *ret,
+                               const std::vector<jit_type *>& args)
+{
+  jit_function result (module, cc, name, ret, args);
+  return result;
+}
+
+jit_function
+jit_typeinfo::create_identity (jit_type *type)
+{
+  size_t id = type->type_id ();
+  if (id >= identities.size ())
+    identities.resize (id + 1);
+
+  if (! identities[id].valid ())
+    {
+      jit_function fn = create_function (jit_convention::internal, "id", type,
+                                         type);
+      llvm::BasicBlock *body = fn.new_block ();
+      builder.SetInsertPoint (body);
+      fn.do_return (builder, fn.argument (builder, 0));
+      return identities[id] = fn;
+    }
+
+  return identities[id];
+}
+
+llvm::Value *
+jit_typeinfo::do_insert_error_check (llvm::IRBuilderD& abuilder)
+{
+  return abuilder.CreateLoad (lerror_state);
+}
+
+void
+jit_typeinfo::add_builtin (const std::string& name)
+{
+  jit_type *btype = new_type (name, any, any->to_llvm ());
+  builtins[name] = btype;
+
+  octave_builtin *ov_builtin = find_builtin (name);
+  if (ov_builtin)
+    ov_builtin->stash_jit (*btype);
+}
+
+void
+jit_typeinfo::register_intrinsic (const std::string& name, size_t iid,
+                                  jit_type *result,
+                                  const std::vector<jit_type *>& args)
+{
+  jit_type *builtin_type = builtins[name];
+  size_t nargs = args.size ();
+  llvm::SmallVector<llvm::Type *, 5> llvm_args (nargs);
+  for (size_t i = 0; i < nargs; ++i)
+    llvm_args[i] = args[i]->to_llvm ();
+
+  llvm::Intrinsic::ID id = static_cast<llvm::Intrinsic::ID> (iid);
+  llvm::Function *ifun = llvm::Intrinsic::getDeclaration (module, id,
+                                                          llvm_args);
+  std::stringstream fn_name;
+  fn_name << "octave_jit_" << name;
+
+  std::vector<jit_type *> args1 (nargs + 1);
+  args1[0] = builtin_type;
+  std::copy (args.begin (), args.end (), args1.begin () + 1);
+
+  // The first argument will be the Octave function, but we already know that
+  // the function call is the equivalent of the intrinsic, so we ignore it and
+  // call the intrinsic with the remaining arguments.
+  jit_function fn = create_function (jit_convention::internal, fn_name.str (),
+                                     result, args1);
+  llvm::BasicBlock *body = fn.new_block ();
+  builder.SetInsertPoint (body);
+
+  llvm::SmallVector<llvm::Value *, 5> fargs (nargs);
+  for (size_t i = 0; i < nargs; ++i)
+    fargs[i] = fn.argument (builder, i + 1);
+
+  llvm::Value *ret = builder.CreateCall (ifun, fargs);
+  fn.do_return (builder, ret);
+  paren_subsref_fn.add_overload (fn);
+}
+
+octave_builtin *
+jit_typeinfo::find_builtin (const std::string& name)
+{
+  // FIXME: Finalize what we want to store in octave_builtin, then add functions
+  // to access these values in octave_value
+  octave_value ov_builtin = symbol_table::find (name);
+  return dynamic_cast<octave_builtin *> (ov_builtin.internal_rep ());
+}
+
+void
+jit_typeinfo::register_generic (const std::string&, jit_type *,
+                                const std::vector<jit_type *>&)
+{
+  // FIXME: Implement
+}
+
+jit_function
+jit_typeinfo::mirror_binary (const jit_function& fn)
+{
+  jit_function ret = create_function (jit_convention::internal,
+                                      fn.name () + "_reverse",
+                                      fn.result (), fn.argument_type (1),
+                                      fn.argument_type (0));
+  if (fn.can_error ())
+    ret.mark_can_error ();
+
+  llvm::BasicBlock *body = ret.new_block ();
+  builder.SetInsertPoint (body);
+  llvm::Value *result = fn.call (builder, ret.argument (builder, 1),
+                                 ret.argument (builder, 0));
+  if (ret.result ())
+    ret.do_return (builder, result);
+  else
+    ret.do_return (builder);
+
+  return ret;
+}
+
+llvm::Value *
+jit_typeinfo::pack_complex (llvm::IRBuilderD& bld, llvm::Value *cplx)
+{
+  llvm::Type *complex_ret = instance->complex_ret;
+  llvm::Value *real = bld.CreateExtractElement (cplx, bld.getInt32 (0));
+  llvm::Value *imag = bld.CreateExtractElement (cplx, bld.getInt32 (1));
+  llvm::Value *ret = llvm::UndefValue::get (complex_ret);
+  ret = bld.CreateInsertValue (ret, real, 0);
+  return bld.CreateInsertValue (ret, imag, 1);
+}
+
+llvm::Value *
+jit_typeinfo::unpack_complex (llvm::IRBuilderD& bld, llvm::Value *result)
+{
+  llvm::Type *complex_t = get_complex ()->to_llvm ();
+  llvm::Value *real = bld.CreateExtractValue (result, 0);
+  llvm::Value *imag = bld.CreateExtractValue (result, 1);
+  llvm::Value *ret = llvm::UndefValue::get (complex_t);
+  ret = bld.CreateInsertElement (ret, real, bld.getInt32 (0));
+  return bld.CreateInsertElement (ret, imag, bld.getInt32 (1));
+}
+
+llvm::Value *
+jit_typeinfo::complex_real (llvm::Value *cx)
+{
+  return builder.CreateExtractElement (cx, builder.getInt32 (0));
+}
+
+llvm::Value *
+jit_typeinfo::complex_real (llvm::Value *cx, llvm::Value *real)
+{
+  return builder.CreateInsertElement (cx, real, builder.getInt32 (0));
+}
+
+llvm::Value *
+jit_typeinfo::complex_imag (llvm::Value *cx)
+{
+  return builder.CreateExtractElement (cx, builder.getInt32 (1));
+}
+
+llvm::Value *
+jit_typeinfo::complex_imag (llvm::Value *cx, llvm::Value *imag)
+{
+  return builder.CreateInsertElement (cx, imag, builder.getInt32 (1));
+}
+
+llvm::Value *
+jit_typeinfo::complex_new (llvm::Value *real, llvm::Value *imag)
+{
+  llvm::Value *ret = llvm::UndefValue::get (complex->to_llvm ());
+  ret = complex_real (ret, real);
+  return complex_imag (ret, imag);
+}
+
+void
+jit_typeinfo::create_int (size_t nbits)
+{
+  std::stringstream tname;
+  tname << "int" << nbits;
+  ints[nbits] = new_type (tname.str (), any, llvm::Type::getIntNTy (context,
+                                                                    nbits));
+}
+
+jit_type *
+jit_typeinfo::intN (size_t nbits) const
+{
+  std::map<size_t, jit_type *>::const_iterator iter = ints.find (nbits);
+  if (iter != ints.end ())
+    return iter->second;
+
+  throw jit_fail_exception ("No such integer type");
+}
+
+jit_type *
+jit_typeinfo::do_type_of (const octave_value &ov) const
+{
+  if (ov.is_function ())
+    {
+      // FIXME: This is ugly, we need to finalize how we want to to this, then
+      // have octave_value fully support the needed functionality
+      octave_builtin *builtin
+        = dynamic_cast<octave_builtin *> (ov.internal_rep ());
+      return builtin && builtin->to_jit () ? builtin->to_jit ()
+        : unknown_function;
+    }
+
+  if (ov.is_range ())
+    return get_range ();
+
+  if (ov.is_double_type ())
+    {
+      if (ov.is_real_scalar ())
+        return get_scalar ();
+
+      if (ov.is_matrix_type ())
+        return get_matrix ();
+    }
+
+  if (ov.is_complex_scalar ())
+    return get_complex ();
+
+  return get_any ();
+}
+
+jit_type*
+jit_typeinfo::new_type (const std::string& name, jit_type *parent,
+                        llvm::Type *llvm_type)
+{
+  jit_type *ret = new jit_type (name, parent, llvm_type, next_id++);
+  id_to_type.push_back (ret);
+  return ret;
+}
+
+#endif
new file mode 100644
--- /dev/null
+++ b/src/jit-typeinfo.h
@@ -0,0 +1,669 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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_jit_typeinfo_h)
+#define octave_jit_typeinfo_h 1
+
+#ifdef HAVE_LLVM
+
+#include <map>
+#include <vector>
+
+#include "Range.h"
+#include "jit-util.h"
+
+// Defines the type system used by jit and a singleton class, jit_typeinfo, to
+// manage the types.
+//
+// FIXME:
+// Operations are defined and implemented in jit_typeinfo. Eventually they
+// should be moved elsewhere. (just like with octave_typeinfo)
+
+// jit_range is compatable with the llvm range structure
+struct
+jit_range
+{
+  jit_range (const Range& from) : base (from.base ()), limit (from.limit ()),
+                                  inc (from.inc ()), nelem (from.nelem ())
+  {}
+
+  operator Range () const
+  {
+    return Range (base, limit, inc);
+  }
+
+  bool all_elements_are_ints () const;
+
+  double base;
+  double limit;
+  double inc;
+  octave_idx_type nelem;
+};
+
+std::ostream& operator<< (std::ostream& os, const jit_range& rng);
+
+// jit_array is compatable with the llvm array/matrix structures
+template <typename T, typename U>
+struct
+jit_array
+{
+  jit_array (T& from) : array (new T (from))
+  {
+    update ();
+  }
+
+  void update (void)
+  {
+    ref_count = array->jit_ref_count ();
+    slice_data = array->jit_slice_data () - 1;
+    slice_len = array->capacity ();
+    dimensions = array->jit_dimensions ();
+  }
+
+  void update (T *aarray)
+  {
+    array = aarray;
+    update ();
+  }
+
+  operator T () const
+  {
+    return *array;
+  }
+
+  int *ref_count;
+
+  U *slice_data;
+  octave_idx_type slice_len;
+  octave_idx_type *dimensions;
+
+  T *array;
+};
+
+typedef jit_array<NDArray, double> jit_matrix;
+
+std::ostream& operator<< (std::ostream& os, const jit_matrix& mat);
+
+// calling convention
+namespace
+jit_convention
+{
+  enum
+  type
+  {
+    // internal to jit
+    internal,
+
+    // an external C call
+    external,
+
+    length
+  };
+}
+
+// Used to keep track of estimated (infered) types during JIT. This is a
+// hierarchical type system which includes both concrete and abstract types.
+//
+// The types form a lattice. Currently we only allow for one parent type, but
+// eventually we may allow for multiple predecessors.
+class
+jit_type
+{
+public:
+  typedef llvm::Value *(*convert_fn) (llvm::IRBuilderD&, llvm::Value *);
+
+  jit_type (const std::string& aname, jit_type *aparent, llvm::Type *allvm_type,
+            int aid);
+
+  // a user readable type name
+  const std::string& name (void) const { return mname; }
+
+  // a unique id for the type
+  int type_id (void) const { return mid; }
+
+  // An abstract base type, may be null
+  jit_type *parent (void) const { return mparent; }
+
+  // convert to an llvm type
+  llvm::Type *to_llvm (void) const { return llvm_type; }
+
+  // how this type gets passed as a function argument
+  llvm::Type *to_llvm_arg (void) const;
+
+  size_t depth (void) const { return mdepth; }
+
+  // -------------------- Calling Convention information --------------------
+
+  // A function declared like: mytype foo (int arg0, int arg1);
+  // Will be converted to: void foo (mytype *retval, int arg0, int arg1)
+  // if mytype is sret. The caller is responsible for allocating space for
+  // retval. (on the stack)
+  bool sret (jit_convention::type cc) const { return msret[cc]; }
+
+  void mark_sret (jit_convention::type cc = jit_convention::external)
+  { msret[cc] = true; }
+
+  // A function like: void foo (mytype arg0)
+  // Will be converted to: void foo (mytype *arg0)
+  // Basically just pass by reference.
+  bool pointer_arg (jit_convention::type cc) const { return mpointer_arg[cc]; }
+
+  void mark_pointer_arg (jit_convention::type cc = jit_convention::external)
+  { mpointer_arg[cc] = true; }
+
+  // Convert into an equivalent form before calling. For example, complex is
+  // represented as two values llvm vector, but we need to pass it as a two
+  // valued llvm structure to C functions.
+  convert_fn pack (jit_convention::type cc) { return mpack[cc]; }
+
+  void set_pack (jit_convention::type cc, convert_fn fn) { mpack[cc] = fn; }
+
+  // The inverse operation of pack.
+  convert_fn unpack (jit_convention::type cc) { return munpack[cc]; }
+
+  void set_unpack (jit_convention::type cc, convert_fn fn)
+  { munpack[cc] = fn; }
+
+  // The resulting type after pack is called.
+  llvm::Type *packed_type (jit_convention::type cc)
+  { return mpacked_type[cc]; }
+
+  void set_packed_type (jit_convention::type cc, llvm::Type *ty)
+  { mpacked_type[cc] = ty; }
+private:
+  std::string mname;
+  jit_type *mparent;
+  llvm::Type *llvm_type;
+  int mid;
+  size_t mdepth;
+
+  bool msret[jit_convention::length];
+  bool mpointer_arg[jit_convention::length];
+
+  convert_fn mpack[jit_convention::length];
+  convert_fn munpack[jit_convention::length];
+
+  llvm::Type *mpacked_type[jit_convention::length];
+};
+
+// seperate print function to allow easy printing if type is null
+std::ostream& jit_print (std::ostream& os, jit_type *atype);
+
+class jit_value;
+
+// An abstraction for calling llvm functions with jit_values. Deals with calling
+// convention details.
+class
+jit_function
+{
+  friend std::ostream& operator<< (std::ostream& os, const jit_function& fn);
+public:
+  // create a function in an invalid state
+  jit_function ();
+
+  jit_function (llvm::Module *amodule, jit_convention::type acall_conv,
+                const llvm::Twine& aname, jit_type *aresult,
+                const std::vector<jit_type *>& aargs);
+
+  // Use an existing function, but change the argument types. The new argument
+  // types must behave the same for the current calling convention.
+  jit_function (const jit_function& fn, jit_type *aresult,
+                const std::vector<jit_type *>& aargs);
+
+  jit_function (const jit_function& fn);
+
+  template <typename T>
+  void add_mapping (llvm::ExecutionEngine *engine, T fn)
+  {
+    do_add_mapping (engine, reinterpret_cast<void *> (fn));
+  }
+
+  bool valid (void) const { return llvm_function; }
+
+  std::string name (void) const;
+
+  llvm::BasicBlock *new_block (const std::string& aname = "body",
+                               llvm::BasicBlock *insert_before = 0);
+
+  llvm::Value *call (llvm::IRBuilderD& builder,
+                     const std::vector<jit_value *>& in_args) const;
+
+  llvm::Value *call (llvm::IRBuilderD& builder,
+                     const std::vector<llvm::Value *>& in_args
+                     = std::vector<llvm::Value *> ()) const;
+
+#define JIT_PARAM_ARGS llvm::IRBuilderD& builder,
+#define JIT_PARAMS builder,
+#define JIT_CALL(N) JIT_EXPAND (llvm::Value *, call, llvm::Value *, const, N)
+
+  JIT_CALL (1)
+  JIT_CALL (2)
+  JIT_CALL (3)
+  JIT_CALL (4)
+  JIT_CALL (5)
+
+#undef JIT_CALL
+
+#define JIT_CALL(N) JIT_EXPAND (llvm::Value *, call, jit_value *, const, N)
+
+  JIT_CALL (1);
+  JIT_CALL (2);
+
+#undef JIT_CALL
+#undef JIT_PARAMS
+#undef JIT_PARAM_ARGS
+
+  llvm::Value *argument (llvm::IRBuilderD& builder, size_t idx) const;
+
+  void do_return (llvm::IRBuilderD& builder, llvm::Value *rval = 0);
+
+  llvm::Function *to_llvm (void) const { return llvm_function; }
+
+  // If true, then the return value is passed as a pointer in the first argument
+  bool sret (void) const { return mresult && mresult->sret (call_conv); }
+
+  bool can_error (void) const { return mcan_error; }
+
+  void mark_can_error (void) { mcan_error = true; }
+
+  jit_type *result (void) const { return mresult; }
+
+  jit_type *argument_type (size_t idx) const
+  {
+    assert (idx < args.size ());
+    return args[idx];
+  }
+
+  const std::vector<jit_type *>& arguments (void) const { return args; }
+private:
+  void do_add_mapping (llvm::ExecutionEngine *engine, void *fn);
+
+  llvm::Module *module;
+  llvm::Function *llvm_function;
+  jit_type *mresult;
+  std::vector<jit_type *> args;
+  jit_convention::type call_conv;
+  bool mcan_error;
+};
+
+std::ostream& operator<< (std::ostream& os, const jit_function& fn);
+
+
+// Keeps track of information about how to implement operations (+, -, *, ect)
+// and their resulting types.
+class
+jit_operation
+{
+public:
+  void add_overload (const jit_function& func)
+  {
+    add_overload (func, func.arguments ());
+  }
+
+  void add_overload (const jit_function& func,
+                     const std::vector<jit_type*>& args);
+
+  const jit_function& overload (const std::vector<jit_type *>& types) const;
+
+  jit_type *result (const std::vector<jit_type *>& types) const
+  {
+    const jit_function& temp = overload (types);
+    return temp.result ();
+  }
+
+#define JIT_PARAMS
+#define JIT_PARAM_ARGS
+#define JIT_OVERLOAD(N)                                              \
+  JIT_EXPAND (const jit_function&, overload, jit_type *, const, N)   \
+  JIT_EXPAND (jit_type *, result, jit_type *, const, N)
+
+  JIT_OVERLOAD (1);
+  JIT_OVERLOAD (2);
+  JIT_OVERLOAD (3);
+
+#undef JIT_PARAMS
+#undef JIT_PARAM_ARGS
+
+  const std::string& name (void) const { return mname; }
+
+  void stash_name (const std::string& aname) { mname = aname; }
+private:
+  Array<octave_idx_type> to_idx (const std::vector<jit_type*>& types) const;
+
+  std::vector<Array<jit_function> > overloads;
+
+  std::string mname;
+};
+
+// A singleton class which handles the construction of jit_types and
+// jit_operations.
+class
+jit_typeinfo
+{
+public:
+  static void initialize (llvm::Module *m, llvm::ExecutionEngine *e);
+
+  static jit_type *join (jit_type *lhs, jit_type *rhs)
+  {
+    return instance->do_join (lhs, rhs);
+  }
+
+  static jit_type *get_any (void) { return instance->any; }
+
+  static jit_type *get_matrix (void) { return instance->matrix; }
+
+  static jit_type *get_scalar (void) { return instance->scalar; }
+
+  static llvm::Type *get_scalar_llvm (void)
+  { return instance->scalar->to_llvm (); }
+
+  static jit_type *get_range (void) { return instance->range; }
+
+  static jit_type *get_string (void) { return instance->string; }
+
+  static jit_type *get_bool (void) { return instance->boolean; }
+
+  static jit_type *get_index (void) { return instance->index; }
+
+  static llvm::Type *get_index_llvm (void)
+  { return instance->index->to_llvm (); }
+
+  static jit_type *get_complex (void) { return instance->complex; }
+
+  // Get the jit_type of an octave_value
+  static jit_type *type_of (const octave_value& ov)
+  {
+    return instance->do_type_of (ov);
+  }
+
+  static const jit_operation& binary_op (int op)
+  {
+    return instance->do_binary_op (op);
+  }
+
+  static const jit_operation& grab (void) { return instance->grab_fn; }
+
+  static const jit_function& get_grab (jit_type *type)
+  {
+    return instance->grab_fn.overload (type);
+  }
+
+  static const jit_operation& release (void)
+  {
+    return instance->release_fn;
+  }
+
+  static const jit_function& get_release (jit_type *type)
+  {
+    return instance->release_fn.overload (type);
+  }
+
+  static const jit_operation& print_value (void)
+  {
+    return instance->print_fn;
+  }
+
+  static const jit_operation& for_init (void)
+  {
+    return instance->for_init_fn;
+  }
+
+  static const jit_operation& for_check (void)
+  {
+    return instance->for_check_fn;
+  }
+
+  static const jit_operation& for_index (void)
+  {
+    return instance->for_index_fn;
+  }
+
+  static const jit_operation& make_range (void)
+  {
+    return instance->make_range_fn;
+  }
+
+  static const jit_operation& paren_subsref (void)
+  {
+    return instance->paren_subsref_fn;
+  }
+
+  static const jit_operation& paren_subsasgn (void)
+  {
+    return instance->paren_subsasgn_fn;
+  }
+
+  static const jit_operation& logically_true (void)
+  {
+    return instance->logically_true_fn;
+  }
+
+  static const jit_operation& cast (jit_type *result)
+  {
+    return instance->do_cast (result);
+  }
+
+  static const jit_function& cast (jit_type *to, jit_type *from)
+  {
+    return instance->do_cast (to, from);
+  }
+
+  static llvm::Value *insert_error_check (llvm::IRBuilderD& bld)
+  {
+    return instance->do_insert_error_check (bld);
+  }
+private:
+  jit_typeinfo (llvm::Module *m, llvm::ExecutionEngine *e);
+
+  // FIXME: Do these methods really need to be in jit_typeinfo?
+  jit_type *do_join (jit_type *lhs, jit_type *rhs)
+  {
+    // empty case
+    if (! lhs)
+      return rhs;
+
+    if (! rhs)
+      return lhs;
+
+    // check for a shared parent
+    while (lhs != rhs)
+      {
+        if (lhs->depth () > rhs->depth ())
+          lhs = lhs->parent ();
+        else if (lhs->depth () < rhs->depth ())
+          rhs = rhs->parent ();
+        else
+          {
+            // we MUST have depth > 0 as any is the base type of everything
+            do
+              {
+                lhs = lhs->parent ();
+                rhs = rhs->parent ();
+              }
+            while (lhs != rhs);
+          }
+      }
+
+    return lhs;
+  }
+
+  jit_type *do_difference (jit_type *lhs, jit_type *)
+  {
+    // FIXME: Maybe we can do something smarter?
+    return lhs;
+  }
+
+  jit_type *do_type_of (const octave_value &ov) const;
+
+  const jit_operation& do_binary_op (int op) const
+  {
+    assert (static_cast<size_t>(op) < binary_ops.size ());
+    return binary_ops[op];
+  }
+
+  const jit_operation& do_cast (jit_type *to)
+  {
+    static jit_operation null_function;
+    if (! to)
+      return null_function;
+
+    size_t id = to->type_id ();
+    if (id >= casts.size ())
+      return null_function;
+    return casts[id];
+  }
+
+  const jit_function& do_cast (jit_type *to, jit_type *from)
+  {
+    return do_cast (to).overload (from);
+  }
+
+  jit_type *new_type (const std::string& name, jit_type *parent,
+                      llvm::Type *llvm_type);
+
+
+  void add_print (jit_type *ty, void *fptr);
+
+  void add_binary_op (jit_type *ty, int op, int llvm_op);
+
+  void add_binary_icmp (jit_type *ty, int op, int llvm_op);
+
+  void add_binary_fcmp (jit_type *ty, int op, int llvm_op);
+
+  jit_function create_function (jit_convention::type cc,
+                                const llvm::Twine& name, jit_type *ret,
+                                const std::vector<jit_type *>& args
+                                = std::vector<jit_type *> ());
+
+#define JIT_PARAM_ARGS jit_convention::type cc, const llvm::Twine& name, \
+    jit_type *ret,
+#define JIT_PARAMS cc, name, ret,
+#define CREATE_FUNCTION(N) JIT_EXPAND(jit_function, create_function,    \
+                                      jit_type *, /* empty */, N)
+
+  CREATE_FUNCTION(1);
+  CREATE_FUNCTION(2);
+  CREATE_FUNCTION(3);
+  CREATE_FUNCTION(4);
+
+#undef JIT_PARAM_ARGS
+#undef JIT_PARAMS
+#undef CREATE_FUNCTION
+
+  jit_function create_identity (jit_type *type);
+
+  llvm::Value *do_insert_error_check (llvm::IRBuilderD& bld);
+
+  void add_builtin (const std::string& name);
+
+  void register_intrinsic (const std::string& name, size_t id,
+                           jit_type *result, jit_type *arg0)
+  {
+    std::vector<jit_type *> args (1, arg0);
+    register_intrinsic (name, id, result, args);
+  }
+
+  void register_intrinsic (const std::string& name, size_t id, jit_type *result,
+                           const std::vector<jit_type *>& args);
+
+  void register_generic (const std::string& name, jit_type *result,
+                         jit_type *arg0)
+  {
+    std::vector<jit_type *> args (1, arg0);
+    register_generic (name, result, args);
+  }
+
+  void register_generic (const std::string& name, jit_type *result,
+                         const std::vector<jit_type *>& args);
+
+  octave_builtin *find_builtin (const std::string& name);
+
+  jit_function mirror_binary (const jit_function& fn);
+
+  llvm::Function *wrap_complex (llvm::Function *wrap);
+
+  static llvm::Value *pack_complex (llvm::IRBuilderD& bld,
+                                    llvm::Value *cplx);
+
+  static llvm::Value *unpack_complex (llvm::IRBuilderD& bld,
+                                      llvm::Value *result);
+
+  llvm::Value *complex_real (llvm::Value *cx);
+
+  llvm::Value *complex_real (llvm::Value *cx, llvm::Value *real);
+
+  llvm::Value *complex_imag (llvm::Value *cx);
+
+  llvm::Value *complex_imag (llvm::Value *cx, llvm::Value *imag);
+
+  llvm::Value *complex_new (llvm::Value *real, llvm::Value *imag);
+
+  void create_int (size_t nbits);
+
+  jit_type *intN (size_t nbits) const;
+
+  static jit_typeinfo *instance;
+
+  llvm::Module *module;
+  llvm::ExecutionEngine *engine;
+  int next_id;
+
+  llvm::GlobalVariable *lerror_state;
+
+  std::vector<jit_type*> id_to_type;
+  jit_type *any;
+  jit_type *matrix;
+  jit_type *scalar;
+  jit_type *range;
+  jit_type *string;
+  jit_type *boolean;
+  jit_type *index;
+  jit_type *complex;
+  jit_type *unknown_function;
+  std::map<size_t, jit_type *> ints;
+  std::map<std::string, jit_type *> builtins;
+
+  llvm::StructType *complex_ret;
+
+  std::vector<jit_operation> binary_ops;
+  jit_operation grab_fn;
+  jit_operation release_fn;
+  jit_operation print_fn;
+  jit_operation for_init_fn;
+  jit_operation for_check_fn;
+  jit_operation for_index_fn;
+  jit_operation logically_true_fn;
+  jit_operation make_range_fn;
+  jit_operation paren_subsref_fn;
+  jit_operation paren_subsasgn_fn;
+
+  // type id -> cast function TO that type
+  std::vector<jit_operation> casts;
+
+  // type id -> identity function
+  std::vector<jit_function> identities;
+
+  llvm::IRBuilderD& builder;
+};
+
+#endif
+#endif
new file mode 100644
--- /dev/null
+++ b/src/jit-util.cc
@@ -0,0 +1,44 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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/>.
+
+*/
+
+// defines required by llvm
+#define __STDC_LIMIT_MACROS
+#define __STDC_CONSTANT_MACROS
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_LLVM
+
+#include <llvm/Value.h>
+#include <llvm/Support/raw_os_ostream.h>
+
+std::ostream&
+operator<< (std::ostream& os, const llvm::Value& v)
+{
+  llvm::raw_os_ostream llvm_out (os);
+  v.print (llvm_out);
+  return os;
+}
+
+#endif
new file mode 100644
--- /dev/null
+++ b/src/jit-util.h
@@ -0,0 +1,203 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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/>.
+
+*/
+
+// Some utility classes and functions used throughout jit
+
+#if !defined (octave_jit_util_h)
+#define octave_jit_util_h 1
+
+#ifdef HAVE_LLVM
+
+#include <stdexcept>
+
+// we don't want to include llvm headers here, as they require
+// __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS be defined in the entire
+// compilation unit
+namespace llvm
+{
+  class Value;
+  class Module;
+  class FunctionPassManager;
+  class PassManager;
+  class ExecutionEngine;
+  class Function;
+  class BasicBlock;
+  class LLVMContext;
+  class Type;
+  class StructType;
+  class Twine;
+  class GlobalVariable;
+  class TerminatorInst;
+  class PHINode;
+
+  class ConstantFolder;
+
+  template <bool preserveNames>
+  class IRBuilderDefaultInserter;
+
+  template <bool preserveNames, typename T, typename Inserter>
+  class IRBuilder;
+
+typedef IRBuilder<true, ConstantFolder, IRBuilderDefaultInserter<true> >
+IRBuilderD;
+}
+
+class octave_base_value;
+class octave_builtin;
+class octave_value;
+class tree;
+class tree_expression;
+
+// thrown when we should give up on JIT and interpret
+class jit_fail_exception : public std::runtime_error
+{
+public:
+  jit_fail_exception (void) : std::runtime_error ("unknown"), mknown (false) {}
+  jit_fail_exception (const std::string& reason) : std::runtime_error (reason),
+                                                   mknown (true)
+  {}
+
+  bool known (void) const { return mknown; }
+private:
+  bool mknown;
+};
+
+// llvm doesn't provide this, and it's really useful for debugging
+std::ostream& operator<< (std::ostream& os, const llvm::Value& v);
+
+template <typename HOLDER_T, typename SUB_T>
+class jit_internal_node;
+
+// jit_internal_list and jit_internal_node implement generic embedded doubly
+// linked lists. List items extend from jit_internal_list, and can be placed
+// in nodes of type jit_internal_node. We use CRTP twice.
+template <typename LIST_T, typename NODE_T>
+class
+jit_internal_list
+{
+  friend class jit_internal_node<LIST_T, NODE_T>;
+public:
+  jit_internal_list (void) : use_head (0), use_tail (0), muse_count (0) {}
+
+  virtual ~jit_internal_list (void)
+  {
+    while (use_head)
+      use_head->stash_value (0);
+  }
+
+  NODE_T *first_use (void) const { return use_head; }
+
+  size_t use_count (void) const { return muse_count; }
+private:
+  NODE_T *use_head;
+  NODE_T *use_tail;
+  size_t muse_count;
+};
+
+// a node for internal linked lists
+template <typename LIST_T, typename NODE_T>
+class
+jit_internal_node
+{
+public:
+  typedef jit_internal_list<LIST_T, NODE_T> jit_ilist;
+
+  jit_internal_node (void) : mvalue (0), mnext (0), mprev (0) {}
+
+  ~jit_internal_node (void) { remove (); }
+
+  LIST_T *value (void) const { return mvalue; }
+
+  void stash_value (LIST_T *avalue)
+  {
+    remove ();
+
+    mvalue = avalue;
+
+    if (mvalue)
+      {
+        jit_ilist *ilist = mvalue;
+        NODE_T *sthis = static_cast<NODE_T *> (this);
+        if (ilist->use_head)
+          {
+            ilist->use_tail->mnext = sthis;
+            mprev = ilist->use_tail;
+          }
+        else
+          ilist->use_head = sthis;
+
+        ilist->use_tail = sthis;
+        ++ilist->muse_count;
+      }
+  }
+
+  NODE_T *next (void) const { return mnext; }
+
+  NODE_T *prev (void) const { return mprev; }
+private:
+  void remove ()
+  {
+    if (mvalue)
+      {
+        jit_ilist *ilist = mvalue;
+        if (mprev)
+          mprev->mnext = mnext;
+        else
+          // we are the use_head
+          ilist->use_head = mnext;
+
+        if (mnext)
+          mnext->mprev = mprev;
+        else
+          // we are the use tail
+          ilist->use_tail = mprev;
+
+        mnext = mprev = 0;
+        --ilist->muse_count;
+        mvalue = 0;
+      }
+  }
+
+  LIST_T *mvalue;
+  NODE_T *mnext;
+  NODE_T *mprev;
+};
+
+// Use like: isa<jit_phi> (value)
+// basically just a short cut type typing dyanmic_cast.
+template <typename T, typename U>
+bool isa (U *value)
+{
+  return dynamic_cast<T *> (value);
+}
+
+#define JIT_ASSIGN_ARG(i) the_args[i] = arg ## i;
+#define JIT_EXPAND(ret, fname, type, isconst, N)                        \
+  ret fname (JIT_PARAM_ARGS OCT_MAKE_DECL_LIST (type, arg, N)) isconst  \
+  {                                                                     \
+    std::vector<type> the_args (N);                                     \
+    OCT_ITERATE_MACRO (JIT_ASSIGN_ARG, N);                              \
+    return fname (JIT_PARAMS the_args);                                 \
+  }
+
+#endif
+#endif
--- a/src/link-deps.mk
+++ b/src/link-deps.mk
@@ -11,16 +11,21 @@
   $(FT2_LIBS) \
   $(HDF5_LIBS) \
   $(Z_LIBS) \
+  $(FFTW_XLIBS) \
+  $(REGEX_LIBS) \
   $(OPENGL_LIBS) \
   $(X11_LIBS) \
-  $(CARBON_LIBS)
+  $(CARBON_LIBS) \
+  $(LLVM_LIBS)
 
 LIBOCTINTERP_LINK_OPTS = \
   $(GRAPHICS_LDFLAGS) \
   $(FT2_LDFLAGS) \
   $(HDF5_LDFLAGS) \
   $(Z_LDFLAGS) \
-  $(REGEX_LDFLAGS)
+  $(REGEX_LDFLAGS) \
+  $(FFTW_XLDFLAGS) \
+  $(LLVM_LDFLAGS)
 
 OCT_LINK_DEPS =
 
--- a/src/load-path.cc
+++ b/src/load-path.cc
@@ -523,36 +523,9 @@
 }
 
 void
-load_path::do_clear (std::set<std::string>& new_elts)
+load_path::do_clear (void)
 {
-  bool warn_default_path_clobbered = false;
-  for (dir_info_list_iterator i = dir_info_list.begin ();
-       i != dir_info_list.end ();
-       /* conditionally advance iterator in loop body */)
-    {
-      //Don't remove it if it's gonna be added again, but remove it from
-      //list of items to add, to avoid duplicates later on
-      std::set<std::string>::iterator j = new_elts.find (i->dir_name);
-      if (j != new_elts.end ())
-        {
-          new_elts.erase (j);
-          i++;
-        }
-      else
-        {
-          //Warn if removing a default directory and not immediately adding
-          //it back again
-          if (i->is_init)
-            warn_default_path_clobbered = true;
-          i = dir_info_list.erase (i);
-        }
-    }
-
-  if (warn_default_path_clobbered)
-    warning_with_id ("Octave:remove-init-dir",
-                     "default load path altered.  Some built-in functions may "
-                     "not be found.  Try restoredefaultpath() to recover it.");
-
+  dir_info_list.clear ();
   fcn_map.clear ();
   private_fcn_map.clear ();
   method_map.clear ();
@@ -594,8 +567,27 @@
 void
 load_path::do_set (const std::string& p, bool warn, bool is_init)
 {
-  std::list<std::string> elts_l = split_path (p);
-  std::set<std::string> elts(elts_l.begin (), elts_l.end ());
+  // Use a list when we need to preserve order.
+  std::list<std::string> elts = split_path (p);
+
+  // Use a set when we need to search and order is not important.
+  std::set<std::string> elts_set (elts.begin (), elts.end ());
+
+  if (is_init)
+    init_dirs = elts_set;
+  else
+    {
+      for (std::set<std::string>::const_iterator it = init_dirs.begin ();
+           it != init_dirs.end (); it++)
+        {
+          if (elts_set.find (*it) == elts_set.end ())
+            {
+              warning_with_id ("Octave:remove-init-dir",
+                               "default load path altered.  Some built-in functions may not be found.  Try restoredefaultpath() to recover it.");
+              break;
+            }
+        }
+    }
 
   // Temporarily disable add hook.
 
@@ -604,12 +596,11 @@
 
   add_hook = 0;
 
-  do_clear (elts);
-
-  for (std::set<std::string>::const_iterator i = elts.begin ();
-       i != elts.end ();
-       i++)
-    do_append (*i, warn, is_init);
+  do_clear ();
+
+  for (std::list<std::string>::const_iterator i = elts.begin ();
+       i != elts.end (); i++)
+    do_append (*i, warn);
 
   // Restore add hook and execute for all newly added directories.
   frame.run_top ();
@@ -627,10 +618,10 @@
 }
 
 void
-load_path::do_append (const std::string& dir, bool warn, bool is_init)
+load_path::do_append (const std::string& dir, bool warn)
 {
   if (! dir.empty ())
-    do_add (dir, true, warn, is_init);
+    do_add (dir, true, warn);
 }
 
 void
@@ -659,8 +650,7 @@
 }
 
 void
-load_path::do_add (const std::string& dir_arg, bool at_end, bool warn,
-                   bool is_init)
+load_path::do_add (const std::string& dir_arg, bool at_end, bool warn)
 {
   size_t len = dir_arg.length ();
 
@@ -685,7 +675,6 @@
           if (fs.is_dir ())
             {
               dir_info di (dir);
-              di.is_init = is_init;
 
               if (! error_state)
                 {
@@ -1798,7 +1787,11 @@
                   // way we look for old.dir_name in sys_path to avoid
                   // partial matches?
 
-                  if (sys_path.find (old.dir_name) != std::string::npos
+                  // Don't warn about Contents.m files since we expect
+                  // more than one to exist in the load path.
+
+                  if (fname != "Contents.m"
+                      && sys_path.find (old.dir_name) != std::string::npos
                       && in_path_list (sys_path, old.dir_name))
                     {
                       std::string fcn_path = file_ops::concat (dir_name, fname);
--- a/src/load-path.h
+++ b/src/load-path.h
@@ -39,7 +39,8 @@
 protected:
 
   load_path (void)
-    : dir_info_list (), fcn_map (), private_fcn_map (), method_map () { }
+    : dir_info_list (), fcn_map (), private_fcn_map (), method_map (),
+      init_dirs () { }
 
 public:
 
@@ -56,10 +57,7 @@
   static void clear (void)
   {
     if (instance_ok ())
-      {
-        std::set<std::string> no_new_elts;
-        instance->do_clear (no_new_elts);
-      }
+      instance->do_clear ();
   }
 
   static void set (const std::string& p, bool warn = false)
@@ -297,13 +295,13 @@
     // constructor for any other purpose.
     dir_info (void)
       : dir_name (), abs_dir_name (), is_relative (false),
-        is_init (false), dir_mtime (), dir_time_last_checked (),
+        dir_mtime (), dir_time_last_checked (),
         all_files (), fcn_files (), private_file_map (), method_file_map ()
       { }
 
     dir_info (const std::string& d)
       : dir_name (d), abs_dir_name (), is_relative (false),
-        is_init (false), dir_mtime (), dir_time_last_checked (),
+        dir_mtime (), dir_time_last_checked (),
         all_files (), fcn_files (), private_file_map (), method_file_map ()
     {
       initialize ();
@@ -312,7 +310,6 @@
     dir_info (const dir_info& di)
       : dir_name (di.dir_name), abs_dir_name (di.abs_dir_name),
         is_relative (di.is_relative),
-        is_init (di.is_init),
         dir_mtime (di.dir_mtime),
         dir_time_last_checked (di.dir_time_last_checked),
         all_files (di.all_files), fcn_files (di.fcn_files),
@@ -328,7 +325,6 @@
           dir_name = di.dir_name;
           abs_dir_name = di.abs_dir_name;
           is_relative = di.is_relative;
-          is_init = di.is_init;
           dir_mtime = di.dir_mtime;
           dir_time_last_checked = di.dir_time_last_checked;
           all_files = di.all_files;
@@ -345,7 +341,6 @@
     std::string dir_name;
     std::string abs_dir_name;
     bool is_relative;
-    bool is_init; //Was this directory set by init? Warn when clearing it.
     octave_time dir_mtime;
     octave_time dir_time_last_checked;
     string_vector all_files;
@@ -447,6 +442,8 @@
 
   mutable method_map_type method_map;
 
+  mutable std::set<std::string> init_dirs;
+
   static load_path *instance;
 
   static void cleanup_instance (void) { delete instance; instance = 0; }
@@ -477,16 +474,15 @@
 
   void do_initialize (bool set_initial_path);
 
-  void do_clear (std::set<std::string>& new_elts);
+  void do_clear (void);
 
-  void do_set (const std::string& p, bool warn, bool is_init=false);
+  void do_set (const std::string& p, bool warn, bool is_init = false);
 
-  void do_append (const std::string& dir, bool warn, bool is_init=false);
+  void do_append (const std::string& dir, bool warn);
 
   void do_prepend (const std::string& dir, bool warn);
 
-  void do_add (const std::string& dir, bool at_end, bool warn,
-               bool is_init=false);
+  void do_add (const std::string& dir, bool at_end, bool warn);
 
   void remove_fcn_map (const std::string& dir, const string_vector& fcn_files);
 
--- a/src/load-save.cc
+++ b/src/load-save.cc
@@ -91,7 +91,7 @@
 #include "zfstream.h"
 #endif
 
-// Write octave-core file if Octave crashes or is killed by a signal.
+// Write octave-workspace file if Octave crashes or is killed by a signal.
 static bool Vcrash_dumps_octave_core = true;
 
 // The maximum amount of memory (in kilobytes) that we will attempt to
@@ -99,7 +99,7 @@
 static double Voctave_core_file_limit = -1.0;
 
 // The name of the Octave core file.
-static std::string Voctave_core_file_name = "octave-core";
+static std::string Voctave_core_file_name = "octave-workspace";
 
 // The default output format.  May be one of "binary", "text",
 // "mat-binary", or "hdf5".
@@ -1751,7 +1751,7 @@
 @deftypefnx {Built-in Function} {@var{old_val} =} crash_dumps_octave_core (@var{new_val})\n\
 @deftypefnx {Built-in Function} {} crash_dumps_octave_core (@var{new_val}, \"local\")\n\
 Query or set the internal variable that controls whether Octave tries\n\
-to save all current variables to the file \"octave-core\" if it\n\
+to save all current variables to the file \"octave-workspace\" if it\n\
 crashes or receives a hangup, terminate or similar signal.\n\
 \n\
 When called from inside a function with the \"local\" option, the variable is\n\
@@ -1812,7 +1812,7 @@
 @deftypefnx {Built-in Function} {} octave_core_file_name (@var{new_val}, \"local\")\n\
 Query or set the internal variable that specifies the name of the file\n\
 used for saving data from the top-level workspace if Octave aborts.\n\
-The default value is @code{\"octave-core\"}\n\
+The default value is @code{\"octave-workspace\"}\n\
 \n\
 When called from inside a function with the \"local\" option, the variable is\n\
 changed locally for the function and any subroutines it calls.  The original\n\
--- a/src/ls-mat5.cc
+++ b/src/ls-mat5.cc
@@ -1936,7 +1936,7 @@
           bool too_large_for_float = false;
           for (octave_idx_type i = 0; i < nel; i++)
             {
-              double tmp = val [i];
+              double tmp = val[i];
 
               if (! (xisnan (tmp) || xisinf (tmp))
                   && fabs (tmp) > FLT_MAX)
--- a/src/mkbuiltins
+++ b/src/mkbuiltins
@@ -57,19 +57,20 @@
 
 #endif
 
-#define XDEFUN_FILE_NAME(name)
+#define XDEFUN_FILE_NAME(name) \
+  std::string file = name;
 
 #define XDEFUN_INTERNAL(name, args_name, nargout_name, doc) \
   extern DECLARE_FUN (name, args_name, nargout_name); \
-  install_builtin_function (F ## name, #name, doc); \
+  install_builtin_function (F ## name, #name, file, doc); \
 
 #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, doc) \
   extern DECLARE_FUN (name, args_name, nargout_name); \
-  install_builtin_function (F ## name, #name, doc, false); \
+  install_builtin_function (F ## name, #name, file, doc, false); \
 
 #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) \
   extern DECLARE_FUNX (fname, args_name, nargout_name); \
-  install_builtin_function (fname, name, doc); \
+  install_builtin_function (fname, name, file, doc); \
 
 #define XDEFALIAS_INTERNAL(alias, name) \
   alias_builtin (#alias, #name);
--- a/src/oct-conf.in.h
+++ b/src/oct-conf.in.h
@@ -384,6 +384,18 @@
 #define OCTAVE_CONF_MAGICK_LIBS %OCTAVE_CONF_MAGICK_LIBS%
 #endif
 
+#ifndef OCTAVE_CONF_LLVM_CPPFLAGS
+#define OCTAVE_CONF_LLVM_CPPFLAGS %OCTAVE_CONF_LLVM_CPPFLAGS%
+#endif
+
+#ifndef OCTAVE_CONF_LLVM_LDFLAGS
+#define OCTAVE_CONF_LLVM_LDFLAGS %OCTAVE_CONF_LLVM_LDFLAGS%
+#endif
+
+#ifndef OCTAVE_CONF_LLVM_LIBS
+#define OCTAVE_CONF_LLVM_LIBS %OCTAVE_CONF_LLVM_LIBS%
+#endif
+
 #ifndef OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS
 #define OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS %OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%
 #endif
--- a/src/ov-base.h
+++ b/src/ov-base.h
@@ -756,6 +756,21 @@
   virtual bool
   fast_elem_insert_self (void *where, builtin_type_t btyp) const;
 
+  // Grab the reference count. For use by jit.
+  void
+  grab (void)
+  {
+    ++count;
+  }
+
+  // Release the reference count. For use by jit.
+  void
+  release (void)
+  {
+    if (--count == 0)
+      delete this;
+  }
+
 protected:
 
   // This should only be called for derived types.
--- a/src/ov-builtin.cc
+++ b/src/ov-builtin.cc
@@ -152,5 +152,22 @@
   return retval;
 }
 
+jit_type *
+octave_builtin::to_jit (void) const
+{
+  return jtype;
+}
+
+void
+octave_builtin::stash_jit (jit_type &type)
+{
+  jtype = &type;
+}
+
+octave_builtin::fcn
+octave_builtin::function (void) const
+{
+  return f;
+}
 
 const std::list<octave_lvalue> *octave_builtin::curr_lvalue_list = 0;
--- a/src/ov-builtin.h
+++ b/src/ov-builtin.h
@@ -30,6 +30,7 @@
 
 class octave_value;
 class octave_value_list;
+class jit_type;
 
 // Builtin functions.
 
@@ -39,16 +40,22 @@
 {
 public:
 
-  octave_builtin (void) : octave_function (), f (0) { }
+  octave_builtin (void) : octave_function (), f (0), file (), jtype (0) { }
 
   typedef octave_value_list (*fcn) (const octave_value_list&, int);
 
   octave_builtin (fcn ff, const std::string& nm = std::string (),
                   const std::string& ds = std::string ())
-    : octave_function (nm, ds), f (ff) { }
+    : octave_function (nm, ds), f (ff), file (), jtype (0) { }
+
+  octave_builtin (fcn ff, const std::string& nm, const std::string& fnm,
+                  const std::string& ds)
+    : octave_function (nm, ds), f (ff), file (fnm), jtype (0) { }
 
   ~octave_builtin (void) { }
 
+  std::string src_file_name (void) const { return file; }
+
   octave_value subsref (const std::string& type,
                         const std::list<octave_value_list>& idx)
     {
@@ -75,6 +82,12 @@
   do_multi_index_op (int nargout, const octave_value_list& args,
                      const std::list<octave_lvalue>* lvalue_list);
 
+  jit_type *to_jit (void) const;
+
+  void stash_jit (jit_type& type);
+
+  fcn function (void) const;
+
   static const std::list<octave_lvalue> *curr_lvalue_list;
 
 protected:
@@ -82,6 +95,12 @@
   // A pointer to the actual function.
   fcn f;
 
+  // The name of the file where this function was defined.
+  std::string file;
+
+  // A pointer to the jit type that represents the function.
+  jit_type *jtype;
+
 private:
 
   // No copying!
--- a/src/ov-class.cc
+++ b/src/ov-class.cc
@@ -1277,7 +1277,7 @@
       if ( val(0).is_object () )
         {
           dbgstr = "blork";
-          if( key == val(0).class_name () )
+          if ( key == val(0).class_name () )
             {
               might_have_inheritance = true;
               dbgstr = "cork";
--- a/src/ov-fcn.h
+++ b/src/ov-fcn.h
@@ -61,6 +61,8 @@
 
   virtual std::string fcn_file_name (void) const { return std::string (); }
 
+  virtual std::string src_file_name (void) const { return std::string (); }
+
   // The name to show in the profiler (also used as map-key).
   virtual std::string profiler_name (void) const { return name (); }
 
--- a/src/ov-oncleanup.cc
+++ b/src/ov-oncleanup.cc
@@ -191,7 +191,7 @@
 
 DEFUN (onCleanup, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{c} =} onCleanup (@var{action})\n\
+@deftypefn {Built-in Function} {@var{c} =} onCleanup (@var{action})\n\
 Create a special object that executes a given function upon destruction.\n\
 If the object is copied to multiple variables (or cell or struct array\n\
 elements) or returned from a function, @var{action} will be executed after\n\
--- a/src/pt-eval.cc
+++ b/src/pt-eval.cc
@@ -44,6 +44,12 @@
 #include "symtab.h"
 #include "unwind-prot.h"
 
+#if HAVE_LLVM
+//FIXME: This should be part of tree_evaluator
+#include "pt-jit.h"
+static tree_jit jiter;
+#endif
+
 static tree_evaluator std_evaluator;
 
 tree_evaluator *current_evaluator = &std_evaluator;
@@ -303,6 +309,11 @@
 
   octave_value rhs = expr->rvalue1 ();
 
+#if HAVE_LLVM
+  if (jiter.execute (cmd, rhs))
+    return;
+#endif
+
   if (error_state || rhs.is_undefined ())
     return;
 
@@ -1023,6 +1034,11 @@
   if (error_state)
     return;
 
+#if HAVE_LLVM
+  if (jiter.execute (cmd))
+    return;
+#endif
+
   unwind_protect frame;
 
   frame.protect_var (in_loop_command);
--- a/src/pt-id.cc
+++ b/src/pt-id.cc
@@ -65,7 +65,7 @@
   if (error_state)
     return retval;
 
-  octave_value val = xsym ().find ();
+  octave_value val = sym->find ();
 
   if (val.is_defined ())
     {
@@ -116,7 +116,7 @@
 octave_lvalue
 tree_identifier::lvalue (void)
 {
-  return octave_lvalue (&(xsym ().varref ()));
+  return octave_lvalue (&(sym->varref ()));
 }
 
 tree_identifier *
--- a/src/pt-id.h
+++ b/src/pt-id.h
@@ -46,12 +46,12 @@
 public:
 
   tree_identifier (int l = -1, int c = -1)
-    : tree_expression (l, c), sym (), scope (-1) { }
+    : tree_expression (l, c) { }
 
   tree_identifier (const symbol_table::symbol_record& s,
                    int l = -1, int c = -1,
                    symbol_table::scope_id sc = symbol_table::current_scope ())
-    : tree_expression (l, c), sym (s), scope (sc) { }
+    : tree_expression (l, c), sym (s, sc) { }
 
   ~tree_identifier (void) { }
 
@@ -63,9 +63,9 @@
   // accessing it through sym so that this function may remain const.
   std::string name (void) const { return sym.name (); }
 
-  bool is_defined (void) { return xsym ().is_defined (); }
+  bool is_defined (void) { return sym->is_defined (); }
 
-  virtual bool is_variable (void) { return xsym ().is_variable (); }
+  virtual bool is_variable (void) { return sym->is_variable (); }
 
   virtual bool is_black_hole (void) { return false; }
 
@@ -87,14 +87,14 @@
   octave_value
   do_lookup (const octave_value_list& args = octave_value_list ())
   {
-    return xsym ().find (args);
+    return sym->find (args);
   }
 
-  void mark_global (void) { xsym ().mark_global (); }
+  void mark_global (void) { sym->mark_global (); }
 
-  void mark_as_static (void) { xsym ().init_persistent (); }
+  void mark_as_static (void) { sym->init_persistent (); }
 
-  void mark_as_formal_parameter (void) { xsym ().mark_formal (); }
+  void mark_as_formal_parameter (void) { sym->mark_formal (); }
 
   // We really need to know whether this symbol referst to a variable
   // or a function, but we may not know that yet.
@@ -114,28 +114,14 @@
 
   void accept (tree_walker& tw);
 
+  symbol_table::symbol_reference symbol (void) const
+  {
+    return sym;
+  }
 private:
 
   // The symbol record that this identifier references.
-  symbol_table::symbol_record sym;
-
-  symbol_table::scope_id scope;
-
-  // A script may be executed in multiple scopes.  If the last one was
-  // different from the one we are in now, update sym to be from the
-  // new scope.
-  symbol_table::symbol_record& xsym (void)
-  {
-    symbol_table::scope_id curr_scope = symbol_table::current_scope ();
-
-    if (scope != curr_scope || ! sym.is_valid ())
-      {
-        scope = curr_scope;
-        sym = symbol_table::insert (sym.name ());
-      }
-
-    return sym;
-  }
+  symbol_table::symbol_reference sym;
 
   // No copying!
 
--- a/src/pt-idx.cc
+++ b/src/pt-idx.cc
@@ -532,7 +532,7 @@
                                  && (tmp.is_matrix_type () || tmp.is_string ()
                                      || tmp.is_cell ()));
 
-                if (i > 0 && type [i-1] == '(')
+                if (i > 0 && type[i-1] == '(')
                   {
                     octave_value_list pidx = idx.back ();
 
new file mode 100644
--- /dev/null
+++ b/src/pt-jit.cc
@@ -0,0 +1,1826 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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/>.
+
+*/
+
+#define __STDC_LIMIT_MACROS
+#define __STDC_CONSTANT_MACROS
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_LLVM
+
+#include "pt-jit.h"
+
+#include <llvm/Analysis/CallGraph.h>
+#include <llvm/Analysis/Passes.h>
+#include <llvm/Analysis/Verifier.h>
+#include <llvm/LLVMContext.h>
+#include <llvm/ExecutionEngine/ExecutionEngine.h>
+#include <llvm/ExecutionEngine/JIT.h>
+#include <llvm/Module.h>
+#include <llvm/PassManager.h>
+#include <llvm/Support/IRBuilder.h>
+#include <llvm/Support/raw_os_ostream.h>
+#include <llvm/Support/TargetSelect.h>
+#include <llvm/Target/TargetData.h>
+#include <llvm/Transforms/IPO.h>
+#include <llvm/Transforms/Scalar.h>
+
+#ifdef OCTAVE_JIT_DEBUG
+#include <llvm/Bitcode/ReaderWriter.h>
+#endif
+
+#include "symtab.h"
+#include "pt-all.h"
+
+static llvm::IRBuilder<> builder (llvm::getGlobalContext ());
+
+static llvm::LLVMContext& context = llvm::getGlobalContext ();
+
+// -------------------- jit_convert --------------------
+jit_convert::jit_convert (llvm::Module *module, tree &tee,
+                          jit_type *for_bounds)
+  : iterator_count (0), for_bounds_count (0), short_count (0), breaking (false)
+{
+  jit_instruction::reset_ids ();
+
+  entry_block = create<jit_block> ("body");
+  final_block = create<jit_block> ("final");
+  append (entry_block);
+  entry_block->mark_alive ();
+  block = entry_block;
+
+  if (for_bounds)
+    create_variable (next_for_bounds (false), for_bounds);
+
+  visit (tee);
+
+  // FIXME: Remove if we no longer only compile loops
+  assert (! breaking);
+  assert (breaks.empty ());
+  assert (continues.empty ());
+
+  block->append (create<jit_branch> (final_block));
+  append (final_block);
+
+  for (vmap_t::iterator iter = vmap.begin (); iter != vmap.end (); ++iter)
+    {
+      jit_variable *var = iter->second;
+      const std::string& name = var->name ();
+      if (name.size () && name[0] != '#')
+        final_block->append (create<jit_store_argument> (var));
+    }
+
+  construct_ssa ();
+
+  // initialize the worklist to instructions derived from constants
+  for (std::list<jit_value *>::iterator iter = constants.begin ();
+       iter != constants.end (); ++iter)
+    append_users (*iter);
+
+  // the entry block terminator may be a regular branch statement
+  if (entry_block->terminator ())
+    push_worklist (entry_block->terminator ());
+
+  // FIXME: Describe algorithm here
+  while (worklist.size ())
+    {
+      jit_instruction *next = worklist.front ();
+      worklist.pop_front ();
+      next->stash_in_worklist (false);
+
+      if (next->infer ())
+        {
+          // terminators need to be handles specially
+          if (jit_terminator *term = dynamic_cast<jit_terminator *> (next))
+            append_users_term (term);
+          else
+            append_users (next);
+        }
+    }
+
+  remove_dead ();
+  merge_blocks ();
+  final_block->label ();
+  place_releases ();
+  simplify_phi ();
+
+#ifdef OCTAVE_JIT_DEBUG
+  final_block->label ();
+  std::cout << "-------------------- Compiling tree --------------------\n";
+  std::cout << tee.str_print_code () << std::endl;
+  print_blocks ("octave jit ir");
+#endif
+
+  // for now just init arguments from entry, later we will have to do something
+  // more interesting
+  for (jit_block::iterator iter = entry_block->begin ();
+       iter != entry_block->end (); ++iter)
+    if (jit_extract_argument *extract
+        = dynamic_cast<jit_extract_argument *> (*iter))
+      arguments.push_back (std::make_pair (extract->name (), true));
+
+  convert_llvm to_llvm (*this);
+  function = to_llvm.convert (module, arguments, blocks, constants);
+
+#ifdef OCTAVE_JIT_DEBUG
+  std::cout << "-------------------- llvm ir --------------------";
+  llvm::raw_os_ostream llvm_cout (std::cout);
+  function->print (llvm_cout);
+  std::cout << std::endl;
+  llvm::verifyFunction (*function);
+#endif
+}
+
+jit_convert::~jit_convert (void)
+{
+  for (std::list<jit_value *>::iterator iter = all_values.begin ();
+       iter != all_values.end (); ++iter)
+    delete *iter;
+}
+
+void
+jit_convert::visit_anon_fcn_handle (tree_anon_fcn_handle&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_argument_list (tree_argument_list&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_binary_expression (tree_binary_expression& be)
+{
+  if (be.op_type () >= octave_value::num_binary_ops)
+    {
+      tree_boolean_expression *boole;
+      boole = dynamic_cast<tree_boolean_expression *> (&be);
+      assert (boole);
+      bool is_and = boole->op_type () == tree_boolean_expression::bool_and;
+
+      std::string short_name = next_shortcircut_result ();
+      jit_variable *short_result = create<jit_variable> (short_name);
+      vmap[short_name] = short_result;
+
+      jit_block *done = create<jit_block> (block->name ());
+      tree_expression *lhs = be.lhs ();
+      jit_value *lhsv = visit (lhs);
+      lhsv = create_checked (&jit_typeinfo::logically_true, lhsv);
+
+      jit_block *short_early = create<jit_block> ("short_early");
+      append (short_early);
+
+      jit_block *short_cont = create<jit_block> ("short_cont");
+
+      if (is_and)
+        block->append (create<jit_cond_branch> (lhsv, short_cont, short_early));
+      else
+        block->append (create<jit_cond_branch> (lhsv, short_early, short_cont));
+
+      block = short_early;
+
+      jit_value *early_result = create<jit_const_bool> (! is_and);
+      block->append (create<jit_assign> (short_result, early_result));
+      block->append (create<jit_branch> (done));
+
+      append (short_cont);
+      block = short_cont;
+
+      tree_expression *rhs = be.rhs ();
+      jit_value *rhsv = visit (rhs);
+      rhsv = create_checked (&jit_typeinfo::logically_true, rhsv);
+      block->append (create<jit_assign> (short_result, rhsv));
+      block->append (create<jit_branch> (done));
+
+      append (done);
+      block = done;
+      result = short_result;
+    }
+  else
+    {
+      tree_expression *lhs = be.lhs ();
+      jit_value *lhsv = visit (lhs);
+
+      tree_expression *rhs = be.rhs ();
+      jit_value *rhsv = visit (rhs);
+
+      const jit_operation& fn = jit_typeinfo::binary_op (be.op_type ());
+      result = create_checked (fn, lhsv, rhsv);
+    }
+}
+
+void
+jit_convert::visit_break_command (tree_break_command&)
+{
+  breaks.push_back (block);
+  breaking = true;
+}
+
+void
+jit_convert::visit_colon_expression (tree_colon_expression& expr)
+{
+  // in the futher we need to add support for classes and deal with rvalues
+  jit_value *base = visit (expr.base ());
+  jit_value *limit = visit (expr.limit ());
+  jit_value *increment;
+  tree_expression *tinc = expr.increment ();
+
+  if (tinc)
+    increment = visit (tinc);
+  else
+    increment = create<jit_const_scalar> (1);
+
+  result = block->append (create<jit_call> (jit_typeinfo::make_range, base,
+                                            limit, increment));
+}
+
+void
+jit_convert::visit_continue_command (tree_continue_command&)
+{
+  continues.push_back (block);
+  breaking = true;
+}
+
+void
+jit_convert::visit_global_command (tree_global_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_persistent_command (tree_persistent_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_decl_elt (tree_decl_elt&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_decl_init_list (tree_decl_init_list&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_simple_for_command (tree_simple_for_command& cmd)
+{
+  // Note we do an initial check to see if the loop will run atleast once.
+  // This allows us to get better type inference bounds on variables defined
+  // and used only inside the for loop (e.g. the index variable)
+
+  // If we are a nested for loop we need to store the previous breaks
+  assert (! breaking);
+  unwind_protect prot;
+  prot.protect_var (breaks);
+  prot.protect_var (continues);
+  prot.protect_var (breaking);
+  breaks.clear ();
+  continues.clear ();
+
+  // we need a variable for our iterator, because it is used in multiple blocks
+  std::string iter_name = next_iterator ();
+  jit_variable *iterator = create<jit_variable> (iter_name);
+  create<jit_variable> (iter_name);
+  vmap[iter_name] = iterator;
+
+  jit_block *body = create<jit_block> ("for_body");
+  append (body);
+
+  jit_block *tail = create<jit_block> ("for_tail");
+
+  // do control expression, iter init, and condition check in prev_block (block)
+  // if we are the top level for loop, the bounds is an input argument.
+  jit_value *control = find_variable (next_for_bounds ());
+  if (! control)
+    control = visit (cmd.control_expr ());
+  jit_call *init_iter = create<jit_call> (jit_typeinfo::for_init, control);
+  block->append (init_iter);
+  block->append (create<jit_assign> (iterator, init_iter));
+
+  jit_value *check = block->append (create<jit_call> (jit_typeinfo::for_check,
+                                                      control, iterator));
+  block->append (create<jit_cond_branch> (check, body, tail));
+  block = body;
+
+  // compute the syntactical iterator
+  jit_call *idx_rhs = create<jit_call> (jit_typeinfo::for_index, control,
+                                        iterator);
+  block->append (idx_rhs);
+  do_assign (cmd.left_hand_side (), idx_rhs);
+
+  // do loop
+  tree_statement_list *pt_body = cmd.body ();
+  pt_body->accept (*this);
+
+  if (breaking && continues.empty ())
+    {
+      // WTF are you doing user? Every branch was a continue, why did you have
+      // a loop??? Users are silly people...
+      finish_breaks (tail, breaks);
+      append (tail);
+      block = tail;
+      return;
+    }
+
+  // check our condition, continues jump to this block
+  jit_block *check_block = create<jit_block> ("for_check");
+  append (check_block);
+
+  if (! breaking)
+    block->append (create<jit_branch> (check_block));
+  finish_breaks (check_block, continues);
+
+  block = check_block;
+  const jit_operation& add_fn = jit_typeinfo::binary_op (octave_value::op_add);
+  jit_value *one = create<jit_const_index> (1);
+  jit_call *iter_inc = create<jit_call> (add_fn, iterator, one);
+  block->append (iter_inc);
+  block->append (create<jit_assign> (iterator, iter_inc));
+  check = block->append (create<jit_call> (jit_typeinfo::for_check, control,
+                                           iterator));
+  block->append (create<jit_cond_branch> (check, body, tail));
+
+  // breaks will go to our tail
+  append (tail);
+  finish_breaks (tail, breaks);
+  block = tail;
+}
+
+void
+jit_convert::visit_complex_for_command (tree_complex_for_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_octave_user_script (octave_user_script&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_octave_user_function (octave_user_function&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_octave_user_function_header (octave_user_function&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_octave_user_function_trailer (octave_user_function&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_function_def (tree_function_def&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_identifier (tree_identifier& ti)
+{
+  result = get_variable (ti.name ());
+}
+
+void
+jit_convert::visit_if_clause (tree_if_clause&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_if_command (tree_if_command& cmd)
+{
+  tree_if_command_list *lst = cmd.cmd_list ();
+  assert (lst); // jwe: Can this be null?
+  lst->accept (*this);
+}
+
+void
+jit_convert::visit_if_command_list (tree_if_command_list& lst)
+{
+  tree_if_clause *last = lst.back ();
+  size_t last_else = static_cast<size_t> (last->is_else_clause ());
+
+  // entry_blocks represents the block you need to enter in order to execute
+  // the condition check for the ith clause. For the else, it is simple the
+  // else body. If there is no else body, then it is padded with the tail
+  std::vector<jit_block *> entry_blocks (lst.size () + 1 - last_else);
+  std::vector<jit_block *> branch_blocks (lst.size (), 0); // final blocks
+  entry_blocks[0] = block;
+
+  // we need to construct blocks first, because they have jumps to eachother
+  tree_if_command_list::iterator iter = lst.begin ();
+  ++iter;
+  for (size_t i = 1; iter != lst.end (); ++iter, ++i)
+    {
+      tree_if_clause *tic = *iter;
+      if (tic->is_else_clause ())
+        entry_blocks[i] = create<jit_block> ("else");
+      else
+        entry_blocks[i] = create<jit_block> ("ifelse_cond");
+    }
+
+  jit_block *tail = create<jit_block> ("if_tail");
+  if (! last_else)
+    entry_blocks[entry_blocks.size () - 1] = tail;
+
+  size_t num_incomming = 0; // number of incomming blocks to our tail
+  iter = lst.begin ();
+  for (size_t i = 0; iter != lst.end (); ++iter, ++i)
+    {
+      tree_if_clause *tic = *iter;
+      block = entry_blocks[i];
+      assert (block);
+
+      if (i) // the first block is prev_block, so it has already been added
+        append (entry_blocks[i]);
+
+      if (! tic->is_else_clause ())
+        {
+          tree_expression *expr = tic->condition ();
+          jit_value *cond = visit (expr);
+          jit_call *check = create_checked (&jit_typeinfo::logically_true,
+                                            cond);
+          jit_block *body = create<jit_block> (i == 0 ? "if_body"
+                                               : "ifelse_body");
+          append (body);
+
+          jit_instruction *br = create<jit_cond_branch> (check, body,
+                                                        entry_blocks[i + 1]);
+          block->append (br);
+          block = body;
+        }
+
+      tree_statement_list *stmt_lst = tic->commands ();
+      assert (stmt_lst); // jwe: Can this be null?
+      stmt_lst->accept (*this);
+
+      if (breaking)
+        breaking = false;
+      else
+        {
+          ++num_incomming;
+          block->append (create<jit_branch> (tail));
+        }
+    }
+
+  if (num_incomming || ! last_else)
+    {
+      append (tail);
+      block = tail;
+    }
+  else
+    // every branch broke, so we don't have a tail
+    breaking = true;
+}
+
+void
+jit_convert::visit_index_expression (tree_index_expression& exp)
+{
+  std::pair<jit_value *, jit_value *> res = resolve (exp);
+  jit_value *object = res.first;
+  jit_value *index = res.second;
+
+  result = create_checked (jit_typeinfo::paren_subsref, object, index);
+}
+
+void
+jit_convert::visit_matrix (tree_matrix&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_cell (tree_cell&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_multi_assignment (tree_multi_assignment&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_no_op_command (tree_no_op_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_constant (tree_constant& tc)
+{
+  octave_value v = tc.rvalue1 ();
+  if (v.is_real_scalar () && v.is_double_type ())
+    {
+      double dv = v.double_value ();
+      result = create<jit_const_scalar> (dv);
+    }
+  else if (v.is_range ())
+    {
+      Range rv = v.range_value ();
+      result = create<jit_const_range> (rv);
+    }
+  else if (v.is_complex_scalar ())
+    {
+      Complex cv = v.complex_value ();
+      result = create<jit_const_complex> (cv);
+    }
+  else
+    throw jit_fail_exception ("Unknown constant");
+}
+
+void
+jit_convert::visit_fcn_handle (tree_fcn_handle&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_parameter_list (tree_parameter_list&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_postfix_expression (tree_postfix_expression&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_prefix_expression (tree_prefix_expression&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_return_command (tree_return_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_return_list (tree_return_list&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_simple_assignment (tree_simple_assignment& tsa)
+{
+  if (tsa.op_type () != octave_value::op_asn_eq)
+    throw jit_fail_exception ("Unsupported assign");
+
+  // resolve rhs
+  tree_expression *rhs = tsa.right_hand_side ();
+  jit_value *rhsv = visit (rhs);
+
+  result = do_assign (tsa.left_hand_side (), rhsv);
+}
+
+void
+jit_convert::visit_statement (tree_statement& stmt)
+{
+  tree_command *cmd = stmt.command ();
+  tree_expression *expr = stmt.expression ();
+
+  if (cmd)
+    visit (cmd);
+  else
+    {
+      // stolen from tree_evaluator::visit_statement
+      bool do_bind_ans = false;
+
+      if (expr->is_identifier ())
+        {
+          tree_identifier *id = dynamic_cast<tree_identifier *> (expr);
+
+          do_bind_ans = (! id->is_variable ());
+        }
+      else
+        do_bind_ans = (! expr->is_assignment_expression ());
+
+      jit_value *expr_result = visit (expr);
+
+      if (do_bind_ans)
+        do_assign ("ans", expr_result, expr->print_result ());
+      else if (expr->is_identifier () && expr->print_result ())
+        {
+          // FIXME: ugly hack, we need to come up with a way to pass
+          // nargout to visit_identifier
+          const jit_operation& fn = jit_typeinfo::print_value ();
+          jit_const_string *name = create<jit_const_string> (expr->name ());
+          block->append (create<jit_call> (fn, name, expr_result));
+        }
+    }
+}
+
+void
+jit_convert::visit_statement_list (tree_statement_list& lst)
+{
+  for (tree_statement_list::iterator iter = lst.begin (); iter != lst.end();
+       ++iter)
+    {
+      tree_statement *elt = *iter;
+      // jwe: Can this ever be null?
+      assert (elt);
+      elt->accept (*this);
+
+      if (breaking)
+        break;
+    }
+}
+
+void
+jit_convert::visit_switch_case (tree_switch_case&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_switch_case_list (tree_switch_case_list&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_switch_command (tree_switch_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_try_catch_command (tree_try_catch_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_unwind_protect_command (tree_unwind_protect_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::visit_while_command (tree_while_command& wc)
+{
+  assert (! breaking);
+  unwind_protect prot;
+  prot.protect_var (breaks);
+  prot.protect_var (continues);
+  prot.protect_var (breaking);
+  breaks.clear ();
+  continues.clear ();
+
+  jit_block *cond_check = create<jit_block> ("while_cond_check");
+  block->append (create<jit_branch> (cond_check));
+  append (cond_check);
+  block = cond_check;
+
+  tree_expression *expr = wc.condition ();
+  assert (expr && "While expression can not be null");
+  jit_value *check = visit (expr);
+  check = create_checked (&jit_typeinfo::logically_true, check);
+
+  jit_block *body = create<jit_block> ("while_body");
+  append (body);
+
+  jit_block *tail = create<jit_block> ("while_tail");
+  block->append (create<jit_cond_branch> (check, body, tail));
+  block = body;
+
+  tree_statement_list *loop_body = wc.body ();
+  if (loop_body)
+    loop_body->accept (*this);
+
+  finish_breaks (tail, breaks);
+  finish_breaks (cond_check, continues);
+
+  if (! breaking)
+    block->append (create<jit_branch> (cond_check));
+
+  append (tail);
+  block = tail;
+}
+
+void
+jit_convert::visit_do_until_command (tree_do_until_command&)
+{
+  throw jit_fail_exception ();
+}
+
+void
+jit_convert::append (jit_block *ablock)
+{
+  blocks.push_back (ablock);
+  ablock->stash_location (--blocks.end ());
+}
+
+void
+jit_convert::insert_before (block_iterator iter, jit_block *ablock)
+{
+  iter = blocks.insert (iter, ablock);
+  ablock->stash_location (iter);
+}
+
+void
+jit_convert::insert_after (block_iterator iter, jit_block *ablock)
+{
+  ++iter;
+  insert_before (iter, ablock);
+}
+
+jit_variable *
+jit_convert::find_variable (const std::string& vname) const
+{
+  vmap_t::const_iterator iter;
+  iter = vmap.find (vname);
+  return iter != vmap.end () ? iter->second : 0;
+}
+
+jit_variable *
+jit_convert::get_variable (const std::string& vname)
+{
+  jit_variable *ret = find_variable (vname);
+  if (ret)
+    return ret;
+
+  octave_value val = symbol_table::find (vname);
+  jit_type *type = jit_typeinfo::type_of (val);
+  return create_variable (vname, type);
+}
+
+jit_variable *
+jit_convert::create_variable (const std::string& vname, jit_type *type)
+{
+  jit_variable *var = create<jit_variable> (vname);
+  jit_extract_argument *extract;
+  extract = create<jit_extract_argument> (type, var);
+  entry_block->prepend (extract);
+  return vmap[vname] = var;
+}
+
+std::string
+jit_convert::next_name (const char *prefix, size_t& count, bool inc)
+{
+  std::stringstream ss;
+  ss << prefix << count;
+  if (inc)
+    ++count;
+  return ss.str ();
+}
+
+std::pair<jit_value *, jit_value *>
+jit_convert::resolve (tree_index_expression& exp)
+{
+  std::string type = exp.type_tags ();
+  if (! (type.size () == 1 && type[0] == '('))
+    throw jit_fail_exception ("Unsupported index operation");
+
+  std::list<tree_argument_list *> args = exp.arg_lists ();
+  if (args.size () != 1)
+    throw jit_fail_exception ("Bad number of arguments in tree_index_expression");
+
+  tree_argument_list *arg_list = args.front ();
+  if (! arg_list)
+    throw jit_fail_exception ("null argument list");
+
+  if (arg_list->size () != 1)
+    throw jit_fail_exception ("Bad number of arguments in arg_list");
+
+  tree_expression *tree_object = exp.expression ();
+  jit_value *object = visit (tree_object);
+  tree_expression *arg0 = arg_list->front ();
+  jit_value *index = visit (arg0);
+
+  return std::make_pair (object, index);
+}
+
+jit_value *
+jit_convert::do_assign (tree_expression *exp, jit_value *rhs, bool artificial)
+{
+  if (! exp)
+    throw jit_fail_exception ("NULL lhs in assign");
+
+  if (isa<tree_identifier> (exp))
+    return do_assign (exp->name (), rhs, exp->print_result (), artificial);
+  else if (tree_index_expression *idx
+           = dynamic_cast<tree_index_expression *> (exp))
+    {
+      std::pair<jit_value *, jit_value *> res = resolve (*idx);
+      jit_value *object = res.first;
+      jit_value *index = res.second;
+      jit_call *new_object = create<jit_call> (&jit_typeinfo::paren_subsasgn,
+                                               object, index, rhs);
+      block->append (new_object);
+      do_assign (idx->expression (), new_object, true);
+      create_check (new_object);
+
+      // FIXME: Will not work for values that must be release/grabed
+      return rhs;
+    }
+  else
+    throw jit_fail_exception ("Unsupported assignment");
+}
+
+jit_value *
+jit_convert::do_assign (const std::string& lhs, jit_value *rhs,
+                        bool print, bool artificial)
+{
+  jit_variable *var = get_variable (lhs);
+  jit_assign *assign = block->append (create<jit_assign> (var, rhs));
+
+  if (artificial)
+    assign->mark_artificial ();
+
+  if (print)
+    {
+      const jit_operation& print_fn = jit_typeinfo::print_value ();
+      jit_const_string *name = create<jit_const_string> (lhs);
+      block->append (create<jit_call> (print_fn, name, var));
+    }
+
+  return var;
+}
+
+jit_value *
+jit_convert::visit (tree& tee)
+{
+  result = 0;
+  tee.accept (*this);
+
+  jit_value *ret = result;
+  result = 0;
+  return ret;
+}
+
+void
+jit_convert::append_users_term (jit_terminator *term)
+{
+  for (size_t i = 0; i < term->successor_count (); ++i)
+    {
+      if (term->alive (i))
+        {
+          jit_block *succ = term->successor (i);
+          for (jit_block::iterator iter = succ->begin (); iter != succ->end ()
+                 && isa<jit_phi> (*iter); ++iter)
+            push_worklist (*iter);
+
+          jit_terminator *sterm = succ->terminator ();
+          if (sterm)
+            push_worklist (sterm);
+        }
+    }
+}
+
+void
+jit_convert::merge_blocks (void)
+{
+  std::vector<jit_block *> dead;
+  for (block_list::iterator iter = blocks.begin (); iter != blocks.end ();
+       ++iter)
+    {
+      jit_block *b = *iter;
+      jit_block *merged = b->maybe_merge ();
+
+      if (merged)
+        {
+          if (merged == final_block)
+            final_block = b;
+
+          if (merged == entry_block)
+            entry_block = b;
+
+          dead.push_back (merged);
+        }
+    }
+
+  for (size_t i = 0; i < dead.size (); ++i)
+    blocks.erase (dead[i]->location ());
+}
+
+void
+jit_convert::construct_ssa (void)
+{
+  merge_blocks ();
+  final_block->label ();
+  final_block->compute_idom (entry_block);
+  entry_block->compute_df ();
+  entry_block->create_dom_tree ();
+
+  // insert phi nodes where needed, this is done on a per variable basis
+  for (vmap_t::iterator iter = vmap.begin (); iter != vmap.end (); ++iter)
+    {
+      jit_block::df_set visited, added_phi;
+      std::list<jit_block *> ssa_worklist;
+      iter->second->use_blocks (visited);
+      ssa_worklist.insert (ssa_worklist.begin (), visited.begin (),
+                           visited.end ());
+
+      while (ssa_worklist.size ())
+        {
+          jit_block *b = ssa_worklist.front ();
+          ssa_worklist.pop_front ();
+
+          for (jit_block::df_iterator diter = b->df_begin ();
+               diter != b->df_end (); ++diter)
+            {
+              jit_block *dblock = *diter;
+              if (! added_phi.count (dblock))
+                {
+                  jit_phi *phi = create<jit_phi> (iter->second,
+                                                  dblock->use_count ());
+                  dblock->prepend (phi);
+                  added_phi.insert (dblock);
+                }
+
+              if (! visited.count (dblock))
+                {
+                  ssa_worklist.push_back (dblock);
+                  visited.insert (dblock);
+                }
+            }
+        }
+    }
+
+  do_construct_ssa (*entry_block, entry_block->visit_count ());
+}
+
+void
+jit_convert::do_construct_ssa (jit_block& ablock, size_t avisit_count)
+{
+  if (ablock.visited (avisit_count))
+    return;
+
+  // replace variables with their current SSA value
+  for (jit_block::iterator iter = ablock.begin (); iter != ablock.end (); ++iter)
+    {
+      jit_instruction *instr = *iter;
+      instr->construct_ssa ();
+      instr->push_variable ();
+    }
+
+  // finish phi nodes of successors
+  for (size_t i = 0; i < ablock.successor_count (); ++i)
+    {
+      jit_block *finish = ablock.successor (i);
+
+      for (jit_block::iterator iter = finish->begin (); iter != finish->end ()
+             && isa<jit_phi> (*iter);)
+        {
+          jit_phi *phi = static_cast<jit_phi *> (*iter);
+          jit_variable *var = phi->dest ();
+          if (var->has_top ())
+            {
+              phi->add_incomming (&ablock, var->top ());
+              ++iter;
+            }
+          else
+            {
+              // temporaries may have extranious phi nodes which can be removed
+              assert (! phi->use_count ());
+              assert (var->name ().size () && var->name ()[0] == '#');
+              iter = finish->remove (iter);
+            }
+        }
+    }
+
+  for (size_t i = 0; i < ablock.dom_successor_count (); ++i)
+    do_construct_ssa (*ablock.dom_successor (i), avisit_count);
+
+  ablock.pop_all ();
+}
+
+void
+jit_convert::remove_dead ()
+{
+  block_list::iterator biter;
+  for (biter = blocks.begin (); biter != blocks.end (); ++biter)
+    {
+      jit_block *b = *biter;
+      if (b->alive ())
+        {
+          for (jit_block::iterator iter = b->begin (); iter != b->end ()
+                 && isa<jit_phi> (*iter);)
+            {
+              jit_phi *phi = static_cast<jit_phi *> (*iter);
+              if (phi->prune ())
+                iter = b->remove (iter);
+              else
+                ++iter;
+            }
+        }
+    }
+
+  for (biter = blocks.begin (); biter != blocks.end ();)
+    {
+      jit_block *b = *biter;
+      if (b->alive ())
+        {
+          // FIXME: A special case for jit_error_check, if we generalize to
+          // we will need to change!
+          jit_terminator *term = b->terminator ();
+          if (term && term->successor_count () == 2 && ! term->alive (0))
+            {
+              jit_block *succ = term->successor (1);
+              term->remove ();
+              jit_branch *abreak = b->append (create<jit_branch> (succ));
+              abreak->infer ();
+            }
+
+          ++biter;
+        }
+      else
+        {
+          jit_terminator *term = b->terminator ();
+          if (term)
+            term->remove ();
+          biter = blocks.erase (biter);
+        }
+    }
+}
+
+void
+jit_convert::place_releases (void)
+{
+  std::set<jit_value *> temporaries;
+  for (block_list::iterator iter = blocks.begin (); iter != blocks.end ();
+       ++iter)
+    {
+      jit_block& ablock = **iter;
+      if (ablock.id () != jit_block::NO_ID)
+        {
+          release_temp (ablock, temporaries);
+          release_dead_phi (ablock);
+        }
+    }
+}
+
+void
+jit_convert::release_temp (jit_block& ablock, std::set<jit_value *>& temp)
+{
+  for (jit_block::iterator iter = ablock.begin (); iter != ablock.end ();
+       ++iter)
+    {
+      jit_instruction *instr = *iter;
+
+      // check for temporaries that require release and live across
+      // multiple blocks
+      if (instr->needs_release ())
+        {
+          jit_block *fu_block = instr->first_use_block ();
+          if (fu_block && fu_block != &ablock)
+            temp.insert (instr);
+        }
+
+      if (isa<jit_call> (instr))
+        {
+          // place releases for temporary arguments
+          for (size_t i = 0; i < instr->argument_count (); ++i)
+            {
+              jit_value *arg = instr->argument (i);
+              if (arg->needs_release ())
+                {
+                  jit_call *release = create<jit_call> (&jit_typeinfo::release,
+                                                        arg);
+                  release->infer ();
+                  ablock.insert_after (iter, release);
+                  ++iter;
+                  temp.erase (arg);
+                }
+            }
+        }
+    }
+
+  if (! temp.size () || ! isa<jit_error_check> (ablock.terminator ()))
+    return;
+
+  // FIXME: If we support try/catch or unwind_protect final_block may not be the
+  // destination
+  jit_block *split = ablock.maybe_split (*this, final_block);
+  jit_terminator *term = split->terminator ();
+  for (std::set<jit_value *>::const_iterator iter = temp.begin ();
+       iter != temp.end (); ++iter)
+    {
+      jit_value *value = *iter;
+      jit_call *release = create<jit_call> (&jit_typeinfo::release, value);
+      split->insert_before (term, release);
+      release->infer ();
+    }
+}
+
+void
+jit_convert::release_dead_phi (jit_block& ablock)
+{
+  jit_block::iterator iter = ablock.begin ();
+  while (iter != ablock.end () && isa<jit_phi> (*iter))
+    {
+      jit_phi *phi = static_cast<jit_phi *> (*iter);
+      ++iter;
+
+      jit_use *use = phi->first_use ();
+      if (phi->use_count () == 1 && isa<jit_assign> (use->user ()))
+        {
+          // instead of releasing on assign, release on all incomming branches,
+          // this can get rid of casts inside loops
+          for (size_t i = 0; i < phi->argument_count (); ++i)
+            {
+              jit_value *arg = phi->argument (i);
+              jit_block *inc = phi->incomming (i);
+              jit_block *split = inc->maybe_split (*this, ablock);
+              jit_terminator *term = split->terminator ();
+              jit_call *release = create<jit_call> (jit_typeinfo::release, arg);
+              release->infer ();
+              split->insert_before (term, release);
+            }
+
+          phi->replace_with (0);
+          phi->remove ();
+        }
+    }
+}
+
+void
+jit_convert::simplify_phi (void)
+{
+  for (block_list::iterator biter = blocks.begin (); biter != blocks.end ();
+       ++biter)
+    {
+      jit_block &ablock = **biter;
+      for (jit_block::iterator iter = ablock.begin (); iter != ablock.end ()
+             && isa<jit_phi> (*iter); ++iter)
+        simplify_phi (*static_cast<jit_phi *> (*iter));
+    }
+}
+
+void
+jit_convert::simplify_phi (jit_phi& phi)
+{
+  jit_block& pblock = *phi.parent ();
+  const jit_operation& cast_fn = jit_typeinfo::cast (phi.type ());
+  jit_variable *dest = phi.dest ();
+  for (size_t i = 0; i < phi.argument_count (); ++i)
+    {
+      jit_value *arg = phi.argument (i);
+      if (arg->type () != phi.type ())
+        {
+          jit_block *pred = phi.incomming (i);
+          jit_block *split = pred->maybe_split (*this, pblock);
+          jit_terminator *term = split->terminator ();
+          jit_instruction *cast = create<jit_call> (cast_fn, arg);
+          jit_assign *assign = create<jit_assign> (dest, cast);
+
+          split->insert_before (term, cast);
+          split->insert_before (term, assign);
+          cast->infer ();
+          assign->infer ();
+          phi.stash_argument (i, assign);
+        }
+    }
+}
+
+void
+jit_convert::finish_breaks (jit_block *dest, const block_list& lst)
+{
+  for (block_list::const_iterator iter = lst.begin (); iter != lst.end ();
+       ++iter)
+    {
+      jit_block *b = *iter;
+      b->append (create<jit_branch> (dest));
+    }
+}
+
+// -------------------- jit_convert::convert_llvm --------------------
+llvm::Function *
+jit_convert::convert_llvm::convert (llvm::Module *module,
+                                    const std::vector<std::pair< std::string, bool> >& args,
+                                    const std::list<jit_block *>& blocks,
+                                    const std::list<jit_value *>& constants)
+{
+  jit_type *any = jit_typeinfo::get_any ();
+
+  // argument is an array of octave_base_value*, or octave_base_value**
+  llvm::Type *arg_type = any->to_llvm (); // this is octave_base_value*
+  arg_type = arg_type->getPointerTo ();
+  llvm::FunctionType *ft = llvm::FunctionType::get (llvm::Type::getVoidTy (context),
+                                                    arg_type, false);
+  function = llvm::Function::Create (ft, llvm::Function::ExternalLinkage,
+                                     "foobar", module);
+
+  try
+    {
+      prelude = llvm::BasicBlock::Create (context, "prelude", function);
+      builder.SetInsertPoint (prelude);
+
+      llvm::Value *arg = function->arg_begin ();
+      for (size_t i = 0; i < args.size (); ++i)
+        {
+          llvm::Value *loaded_arg = builder.CreateConstInBoundsGEP1_32 (arg, i);
+          arguments[args[i].first] = loaded_arg;
+        }
+
+      std::list<jit_block *>::const_iterator biter;
+      for (biter = blocks.begin (); biter != blocks.end (); ++biter)
+        {
+          jit_block *jblock = *biter;
+          llvm::BasicBlock *block = llvm::BasicBlock::Create (context,
+                                                              jblock->name (),
+                                                              function);
+          jblock->stash_llvm (block);
+        }
+
+      jit_block *first = *blocks.begin ();
+      builder.CreateBr (first->to_llvm ());
+
+      // constants aren't in the IR, we visit those first
+      for (std::list<jit_value *>::const_iterator iter = constants.begin ();
+           iter != constants.end (); ++iter)
+        if (! isa<jit_instruction> (*iter))
+          visit (*iter);
+
+      // convert all instructions
+      for (biter = blocks.begin (); biter != blocks.end (); ++biter)
+        visit (*biter);
+
+      // now finish phi nodes
+      for (biter = blocks.begin (); biter != blocks.end (); ++biter)
+        {
+          jit_block& block = **biter;
+          for (jit_block::iterator piter = block.begin ();
+               piter != block.end () && isa<jit_phi> (*piter); ++piter)
+            {
+              jit_instruction *phi = *piter;
+              finish_phi (static_cast<jit_phi *> (phi));
+            }
+        }
+
+      jit_block *last = blocks.back ();
+      builder.SetInsertPoint (last->to_llvm ());
+      builder.CreateRetVoid ();
+    } catch (const jit_fail_exception& e)
+    {
+      function->eraseFromParent ();
+      throw;
+    }
+
+  return function;
+}
+
+void
+jit_convert::convert_llvm::finish_phi (jit_phi *phi)
+{
+  llvm::PHINode *llvm_phi = phi->to_llvm ();
+  for (size_t i = 0; i < phi->argument_count (); ++i)
+    {
+      llvm::BasicBlock *pred = phi->incomming_llvm (i);
+      llvm_phi->addIncoming (phi->argument_llvm (i), pred);
+    }
+}
+
+void
+jit_convert::convert_llvm::visit (jit_const_string& cs)
+{
+  cs.stash_llvm (builder.CreateGlobalStringPtr (cs.value ()));
+}
+
+void
+jit_convert::convert_llvm::visit (jit_const_bool& cb)
+{
+  cb.stash_llvm (llvm::ConstantInt::get (cb.type_llvm (), cb.value ()));
+}
+
+void
+jit_convert::convert_llvm::visit (jit_const_scalar& cs)
+{
+  cs.stash_llvm (llvm::ConstantFP::get (cs.type_llvm (), cs.value ()));
+}
+
+void
+jit_convert::convert_llvm::visit (jit_const_complex& cc)
+{
+  llvm::Type *scalar_t = jit_typeinfo::get_scalar_llvm ();
+  llvm::Constant *values[2];
+  Complex value = cc.value ();
+  values[0] = llvm::ConstantFP::get (scalar_t, value.real ());
+  values[1] = llvm::ConstantFP::get (scalar_t, value.imag ());
+  cc.stash_llvm (llvm::ConstantVector::get (values));
+}
+
+void jit_convert::convert_llvm::visit (jit_const_index& ci)
+{
+  ci.stash_llvm (llvm::ConstantInt::get (ci.type_llvm (), ci.value ()));
+}
+
+void
+jit_convert::convert_llvm::visit (jit_const_range& cr)
+{
+  llvm::StructType *stype = llvm::cast<llvm::StructType>(cr.type_llvm ());
+  llvm::Type *scalar_t = jit_typeinfo::get_scalar_llvm ();
+  llvm::Type *idx = jit_typeinfo::get_index_llvm ();
+  const jit_range& rng = cr.value ();
+
+  llvm::Constant *constants[4];
+  constants[0] = llvm::ConstantFP::get (scalar_t, rng.base);
+  constants[1] = llvm::ConstantFP::get (scalar_t, rng.limit);
+  constants[2] = llvm::ConstantFP::get (scalar_t, rng.inc);
+  constants[3] = llvm::ConstantInt::get (idx, rng.nelem);
+
+  llvm::Value *as_llvm;
+  as_llvm = llvm::ConstantStruct::get (stype,
+                                       llvm::makeArrayRef (constants, 4));
+  cr.stash_llvm (as_llvm);
+}
+
+void
+jit_convert::convert_llvm::visit (jit_block& b)
+{
+  llvm::BasicBlock *block = b.to_llvm ();
+  builder.SetInsertPoint (block);
+  for (jit_block::iterator iter = b.begin (); iter != b.end (); ++iter)
+    visit (*iter);
+}
+
+void
+jit_convert::convert_llvm::visit (jit_branch& b)
+{
+  b.stash_llvm (builder.CreateBr (b.successor_llvm ()));
+}
+
+void
+jit_convert::convert_llvm::visit (jit_cond_branch& cb)
+{
+  llvm::Value *cond = cb.cond_llvm ();
+  llvm::Value *br;
+  br = builder.CreateCondBr (cond, cb.successor_llvm (0),
+                             cb.successor_llvm (1));
+  cb.stash_llvm (br);
+}
+
+void
+jit_convert::convert_llvm::visit (jit_call& call)
+{
+  const jit_function& ol = call.overload ();
+
+  std::vector<jit_value *> args (call.arguments ().size ());
+  for (size_t i = 0; i < args.size (); ++i)
+    args[i] = call.argument (i);
+
+  llvm::Value *ret = ol.call (builder, args);
+  call.stash_llvm (ret);
+}
+
+void
+jit_convert::convert_llvm::visit (jit_extract_argument& extract)
+{
+  llvm::Value *arg = arguments[extract.name ()];
+  assert (arg);
+  arg = builder.CreateLoad (arg);
+
+  const jit_function& ol = extract.overload ();
+  extract.stash_llvm (ol.call (builder, arg));
+}
+
+void
+jit_convert::convert_llvm::visit (jit_store_argument& store)
+{
+  const jit_function& ol = store.overload ();
+  llvm::Value *arg_value = ol.call (builder, store.result ());
+  llvm::Value *arg = arguments[store.name ()];
+  store.stash_llvm (builder.CreateStore (arg_value, arg));
+}
+
+void
+jit_convert::convert_llvm::visit (jit_phi& phi)
+{
+  // we might not have converted all incoming branches, so we don't
+  // set incomming branches now
+  llvm::PHINode *node = llvm::PHINode::Create (phi.type_llvm (),
+                                               phi.argument_count ());
+  builder.Insert (node);
+  phi.stash_llvm (node);
+}
+
+void
+jit_convert::convert_llvm::visit (jit_variable&)
+{
+  throw jit_fail_exception ("ERROR: SSA construction should remove all variables");
+}
+
+void
+jit_convert::convert_llvm::visit (jit_error_check& check)
+{
+  llvm::Value *cond = jit_typeinfo::insert_error_check (builder);
+  llvm::Value *br = builder.CreateCondBr (cond, check.successor_llvm (0),
+                                          check.successor_llvm (1));
+  check.stash_llvm (br);
+}
+
+void
+jit_convert::convert_llvm::visit (jit_assign& assign)
+{
+  jit_value *new_value = assign.src ();
+  assign.stash_llvm (new_value->to_llvm ());
+
+  if (assign.artificial ())
+    return;
+
+  if (isa<jit_assign_base> (new_value))
+    {
+      const jit_function& ol =  jit_typeinfo::get_grab (new_value->type ());
+      if (ol.valid ())
+        assign.stash_llvm (ol.call (builder, new_value));
+    }
+
+  jit_value *overwrite = assign.overwrite ();
+  if (isa<jit_assign_base> (overwrite))
+    {
+      const jit_function& ol = jit_typeinfo::get_release (overwrite->type ());
+      ol.call (builder, overwrite);
+    }
+}
+
+void
+jit_convert::convert_llvm::visit (jit_argument&)
+{}
+
+// -------------------- tree_jit --------------------
+
+tree_jit::tree_jit (void) : module (0), engine (0)
+{
+}
+
+tree_jit::~tree_jit (void)
+{}
+
+bool
+tree_jit::execute (tree_simple_for_command& cmd, const octave_value& bounds)
+{
+  const size_t MIN_TRIP_COUNT = 1000;
+
+  size_t tc = trip_count (bounds);
+  if (! tc || ! initialize ())
+    return false;
+
+  jit_info::vmap extra_vars;
+  extra_vars["#for_bounds0"] = &bounds;
+
+  jit_info *info = cmd.get_info ();
+  if (! info || ! info->match (extra_vars))
+    {
+      if (tc < MIN_TRIP_COUNT)
+        return false;
+
+      delete info;
+      info = new jit_info (*this, cmd, bounds);
+      cmd.stash_info (info);
+    }
+
+  return info->execute (extra_vars);
+}
+
+bool
+tree_jit::execute (tree_while_command& cmd)
+{
+  if (! initialize ())
+    return false;
+
+  jit_info *info = cmd.get_info ();
+  if (! info || ! info->match ())
+    {
+      delete info;
+      info = new jit_info (*this, cmd);
+      cmd.stash_info (info);
+    }
+
+  return info->execute ();
+}
+
+bool
+tree_jit::initialize (void)
+{
+  if (engine)
+    return true;
+
+  if (! module)
+    {
+      llvm::InitializeNativeTarget ();
+      module = new llvm::Module ("octave", context);
+    }
+
+  // sometimes this fails pre main
+  engine = llvm::ExecutionEngine::createJIT (module);
+
+  if (! engine)
+    return false;
+
+  module_pass_manager = new llvm::PassManager ();
+  module_pass_manager->add (llvm::createAlwaysInlinerPass ());
+
+  pass_manager = new llvm::FunctionPassManager (module);
+  pass_manager->add (new llvm::TargetData(*engine->getTargetData ()));
+  pass_manager->add (llvm::createBasicAliasAnalysisPass ());
+  pass_manager->add (llvm::createPromoteMemoryToRegisterPass ());
+  pass_manager->add (llvm::createInstructionCombiningPass ());
+  pass_manager->add (llvm::createReassociatePass ());
+  pass_manager->add (llvm::createGVNPass ());
+  pass_manager->add (llvm::createCFGSimplificationPass ());
+  pass_manager->doInitialization ();
+
+  jit_typeinfo::initialize (module, engine);
+
+  return true;
+}
+
+size_t
+tree_jit::trip_count (const octave_value& bounds) const
+{
+  if (bounds.is_range ())
+    {
+      Range rng = bounds.range_value ();
+      return rng.nelem ();
+    }
+
+  // unsupported type
+  return 0;
+}
+
+
+void
+tree_jit::optimize (llvm::Function *fn)
+{
+  module_pass_manager->run (*module);
+  pass_manager->run (*fn);
+
+#ifdef OCTAVE_JIT_DEBUG
+  std::string error;
+  llvm::raw_fd_ostream fout ("test.bc", error,
+                             llvm::raw_fd_ostream::F_Binary);
+  llvm::WriteBitcodeToFile (module, fout);
+#endif
+}
+
+// -------------------- jit_info --------------------
+jit_info::jit_info (tree_jit& tjit, tree& tee)
+  : engine (tjit.get_engine ()), function (0), llvm_function (0)
+{
+  try
+    {
+      jit_convert conv (tjit.get_module (), tee);
+      initialize (tjit, conv);
+    }
+  catch (const jit_fail_exception& e)
+    {
+#ifdef OCTAVE_JIT_DEBUG
+      if (e.known ())
+        std::cout << "jit fail: " << e.what () << std::endl;
+#endif
+    }
+}
+
+jit_info::jit_info (tree_jit& tjit, tree& tee, const octave_value& for_bounds)
+  : engine (tjit.get_engine ()), function (0), llvm_function (0)
+{
+  try
+    {
+      jit_convert conv (tjit.get_module (), tee,
+                        jit_typeinfo::type_of (for_bounds));
+      initialize (tjit, conv);
+    }
+  catch (const jit_fail_exception& e)
+    {
+#ifdef OCTAVE_JIT_DEBUG
+      if (e.known ())
+        std::cout << "jit fail: " << e.what () << std::endl;
+#endif
+    }
+}
+
+jit_info::~jit_info (void)
+{
+  if (llvm_function)
+    llvm_function->eraseFromParent ();
+}
+
+bool
+jit_info::execute (const vmap& extra_vars) const
+{
+  if (! function)
+    return false;
+
+  std::vector<octave_base_value *> real_arguments (arguments.size ());
+  for (size_t i = 0; i < arguments.size (); ++i)
+    {
+      if (arguments[i].second)
+        {
+          octave_value current = find (extra_vars, arguments[i].first);
+          octave_base_value *obv = current.internal_rep ();
+          obv->grab ();
+          real_arguments[i] = obv;
+        }
+    }
+
+  function (&real_arguments[0]);
+
+  for (size_t i = 0; i < arguments.size (); ++i)
+    {
+      const std::string& name = arguments[i].first;
+
+      // do not store for loop bounds temporary
+      if (name.size () && name[0] != '#')
+        symbol_table::varref (arguments[i].first) = real_arguments[i];
+    }
+
+  return true;
+}
+
+bool
+jit_info::match (const vmap& extra_vars) const
+{
+  if (! function)
+    return true;
+
+  for (size_t i = 0; i < bounds.size (); ++i)
+    {
+      const std::string& arg_name = bounds[i].second;
+      octave_value value = find (extra_vars, arg_name);
+      jit_type *type = jit_typeinfo::type_of (value);
+
+      // FIXME: Check for a parent relationship
+      if (type != bounds[i].first)
+        return false;
+    }
+
+  return true;
+}
+
+void
+jit_info::initialize (tree_jit& tjit, jit_convert& conv)
+{
+  llvm_function = conv.get_function ();
+  arguments = conv.get_arguments ();
+  bounds = conv.get_bounds ();
+
+  if (llvm_function)
+    {
+      tjit.optimize (llvm_function);
+
+#ifdef OCTAVE_JIT_DEBUG
+      std::cout << "-------------------- optimized llvm ir "
+                << "--------------------\n";
+      llvm::raw_os_ostream llvm_cout (std::cout);
+      llvm_function->print (llvm_cout);
+      llvm_cout.flush ();
+      std::cout << std::endl;
+#endif
+
+      void *void_fn = engine->getPointerToFunction (llvm_function);
+      function = reinterpret_cast<jited_function> (void_fn);
+    }
+}
+
+octave_value
+jit_info::find (const vmap& extra_vars, const std::string& vname) const
+{
+  vmap::const_iterator iter = extra_vars.find (vname);
+  return iter == extra_vars.end () ? symbol_table::varval (vname)
+    : *iter->second;
+}
+
+#endif
+
+
+/*
+Test some simple cases that compile.
+
+%!test
+%! inc = 1e-5;
+%! result = 0;
+%! for ii = 0:inc:1
+%!   result = result + inc * (1/3 * ii * ii);
+%! endfor
+%! assert (abs (result - 1/9) < 1e-5);
+
+%!test
+%! inc = 1e-5;
+%! result = 0;
+%! for ii = 0:inc:1
+%!   # the ^ operator's result is complex
+%!   result = result + inc * (1/3 * ii ^ 2);
+%! endfor
+%! assert (abs (result - 1/9) < 1e-5);
+
+%!test
+%! nr = 1001;
+%! mat = zeros (1, nr);
+%! for i = 1:nr
+%!   mat(i) = i;
+%! endfor
+%! assert (mat == 1:nr);
+
+%!test
+%! nr = 1001;
+%! mat = 1:nr;
+%! mat(end) = 0; # force mat to a matrix
+%! total = 0;
+%! for i = 1:nr
+%!   total = mat(i) + total;
+%! endfor
+%! assert (sum (mat) == total);
+
+%!test
+%! nr = 1001;
+%! mat = [3 1 5];
+%! try
+%!   for i = 1:nr
+%!     if i > 500
+%!       result = mat(100);
+%!     else
+%!       result = i;
+%!     endif
+%!   endfor
+%! catch
+%! end
+%! assert (result == 500);
+
+%!function result = gen_test (n)
+%!  result = double (rand (1, n) > .01);
+%!endfunction
+
+%!function z = vectorized (A, K)
+%!  temp = ones (1, K);
+%!  z = conv (A, temp);
+%!  z = z > K-1;
+%!  z = conv (z, temp);
+%!  z = z(K:end-K+1);
+%!  z = z >= 1;
+%!endfunction
+
+%!function z = loopy (A, K)
+%!  z = A;
+%!  n = numel (A);
+%!  counter = 0;
+%!  for ii=1:n
+%!    if z(ii)
+%!      counter = counter + 1;
+%!    else
+%!      if counter > 0 && counter < K
+%!        z(ii-counter:ii-1) = 0;
+%!      endif
+%!      counter = 0;
+%!    endif
+%!  endfor
+%!
+%!  if counter > 0 && counter < K
+%!    z(end-counter+1:end) = 0;
+%!  endif
+%!endfunction
+
+%!test
+%! test_set = gen_test (10000);
+%! assert (all (vectorized (test_set, 3) == loopy (test_set, 3)));
+
+%!test
+%! niter = 1001;
+%! i = 0;
+%! while (i < niter)
+%!   i = i + 1;
+%! endwhile
+%! assert (i == niter);
+
+*/
new file mode 100644
--- /dev/null
+++ b/src/pt-jit.h
@@ -0,0 +1,487 @@
+/*
+
+Copyright (C) 2012 Max Brister <max@2bass.com>
+
+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_tree_jit_h)
+#define octave_tree_jit_h 1
+
+#ifdef HAVE_LLVM
+
+#include "jit-ir.h"
+
+#include "pt-walk.h"
+
+// -------------------- Current status --------------------
+// Simple binary operations (+-*/) on octave_scalar's (doubles) are optimized.
+// a = 5;
+// b = a * 5 + a;
+//
+// Indexing matrices with scalars works.
+//
+// if, elseif, else, break, continue, and for compile. Compilation is triggered
+// at the start of a simple for loop.
+//
+// The octave low level IR is a linear IR, it works by converting everything to
+// calls to jit_operations. This turns expressions like c = a + b into
+// c = call binary+ (a, b)
+// The jit_operations contain information about overloads for different types.
+// For, example, if we know a and b are scalars, then c must also be a scalar.
+//
+// Support for function calls is in progress. Currently, calls to sin with a
+// scalar argument will compile.
+//
+// TODO:
+// 1. Function calls (In progress)
+// 2. Cleanup/documentation
+// 3. ...
+// ---------------------------------------------------------
+
+// convert between IRs
+// FIXME: Class relationships are messy from here on down. They need to be
+// cleaned up.
+class
+jit_convert : public tree_walker
+{
+public:
+  typedef std::pair<jit_type *, std::string> type_bound;
+  typedef std::vector<type_bound> type_bound_vector;
+
+  jit_convert (llvm::Module *module, tree &tee, jit_type *for_bounds = 0);
+
+  ~jit_convert (void);
+
+  llvm::Function *get_function (void) const { return function; }
+
+  const std::vector<std::pair<std::string, bool> >& get_arguments(void) const
+  { return arguments; }
+
+  const type_bound_vector& get_bounds (void) const { return bounds; }
+
+  void visit_anon_fcn_handle (tree_anon_fcn_handle&);
+
+  void visit_argument_list (tree_argument_list&);
+
+  void visit_binary_expression (tree_binary_expression&);
+
+  void visit_break_command (tree_break_command&);
+
+  void visit_colon_expression (tree_colon_expression&);
+
+  void visit_continue_command (tree_continue_command&);
+
+  void visit_global_command (tree_global_command&);
+
+  void visit_persistent_command (tree_persistent_command&);
+
+  void visit_decl_elt (tree_decl_elt&);
+
+  void visit_decl_init_list (tree_decl_init_list&);
+
+  void visit_simple_for_command (tree_simple_for_command&);
+
+  void visit_complex_for_command (tree_complex_for_command&);
+
+  void visit_octave_user_script (octave_user_script&);
+
+  void visit_octave_user_function (octave_user_function&);
+
+  void visit_octave_user_function_header (octave_user_function&);
+
+  void visit_octave_user_function_trailer (octave_user_function&);
+
+  void visit_function_def (tree_function_def&);
+
+  void visit_identifier (tree_identifier&);
+
+  void visit_if_clause (tree_if_clause&);
+
+  void visit_if_command (tree_if_command&);
+
+  void visit_if_command_list (tree_if_command_list&);
+
+  void visit_index_expression (tree_index_expression&);
+
+  void visit_matrix (tree_matrix&);
+
+  void visit_cell (tree_cell&);
+
+  void visit_multi_assignment (tree_multi_assignment&);
+
+  void visit_no_op_command (tree_no_op_command&);
+
+  void visit_constant (tree_constant&);
+
+  void visit_fcn_handle (tree_fcn_handle&);
+
+  void visit_parameter_list (tree_parameter_list&);
+
+  void visit_postfix_expression (tree_postfix_expression&);
+
+  void visit_prefix_expression (tree_prefix_expression&);
+
+  void visit_return_command (tree_return_command&);
+
+  void visit_return_list (tree_return_list&);
+
+  void visit_simple_assignment (tree_simple_assignment&);
+
+  void visit_statement (tree_statement&);
+
+  void visit_statement_list (tree_statement_list&);
+
+  void visit_switch_case (tree_switch_case&);
+
+  void visit_switch_case_list (tree_switch_case_list&);
+
+  void visit_switch_command (tree_switch_command&);
+
+  void visit_try_catch_command (tree_try_catch_command&);
+
+  void visit_unwind_protect_command (tree_unwind_protect_command&);
+
+  void visit_while_command (tree_while_command&);
+
+  void visit_do_until_command (tree_do_until_command&);
+
+  // this would be easier with variadic templates
+  template <typename T>
+  T *create (void)
+  {
+    T *ret = new T();
+    track_value (ret);
+    return ret;
+  }
+
+#define DECL_ARG(n) const ARG ## n& arg ## n
+#define JIT_CREATE(N)                                           \
+  template <typename T, OCT_MAKE_DECL_LIST (typename, ARG, N)>  \
+  T *create (OCT_MAKE_LIST (DECL_ARG, N))                       \
+  {                                                             \
+    T *ret = new T (OCT_MAKE_ARG_LIST (arg, N));                \
+    track_value (ret);                                          \
+    return ret;                                                 \
+  }
+
+  JIT_CREATE (1)
+  JIT_CREATE (2)
+  JIT_CREATE (3)
+  JIT_CREATE (4)
+
+#undef JIT_CREATE
+
+#define JIT_CREATE_CHECKED(N)                                           \
+  template <OCT_MAKE_DECL_LIST (typename, ARG, N)>                      \
+  jit_call *create_checked (OCT_MAKE_LIST (DECL_ARG, N))                \
+  {                                                                     \
+    jit_call *ret = create<jit_call> (OCT_MAKE_ARG_LIST (arg, N));      \
+    return create_checked_impl (ret);                                   \
+  }
+
+  JIT_CREATE_CHECKED (1)
+  JIT_CREATE_CHECKED (2)
+  JIT_CREATE_CHECKED (3)
+  JIT_CREATE_CHECKED (4)
+
+#undef JIT_CREATE_CHECKED
+#undef DECL_ARG
+
+  typedef std::list<jit_block *> block_list;
+  typedef block_list::iterator block_iterator;
+
+  void append (jit_block *ablock);
+
+  void insert_before (block_iterator iter, jit_block *ablock);
+
+  void insert_before (jit_block *loc, jit_block *ablock)
+  {
+    insert_before (loc->location (), ablock);
+  }
+
+  void insert_after (block_iterator iter, jit_block *ablock);
+
+  void insert_after (jit_block *loc, jit_block *ablock)
+  {
+    insert_after (loc->location (), ablock);
+  }
+private:
+  std::vector<std::pair<std::string, bool> > arguments;
+  type_bound_vector bounds;
+
+  // used instead of return values from visit_* functions
+  jit_value *result;
+
+  jit_block *entry_block;
+
+  jit_block *final_block;
+
+  jit_block *block;
+
+  llvm::Function *function;
+
+  std::list<jit_block *> blocks;
+
+  std::list<jit_instruction *> worklist;
+
+  std::list<jit_value *> constants;
+
+  std::list<jit_value *> all_values;
+
+  size_t iterator_count;
+  size_t for_bounds_count;
+  size_t short_count;
+
+  typedef std::map<std::string, jit_variable *> vmap_t;
+  vmap_t vmap;
+
+  jit_call *create_checked_impl (jit_call *ret)
+  {
+    block->append (ret);
+    create_check (ret);
+    return ret;
+  }
+
+  jit_error_check *create_check (jit_call *call)
+  {
+    jit_block *normal = create<jit_block> (block->name ());
+    jit_error_check *ret
+      = block->append (create<jit_error_check> (call, normal, final_block));
+    append (normal);
+    block = normal;
+
+    return ret;
+  }
+
+  // get an existing vairable. If the variable does not exist, it will not be
+  // created
+  jit_variable *find_variable (const std::string& vname) const;
+
+  // get a variable, create it if it does not exist. The type will default to
+  // the variable's current type in the symbol table.
+  jit_variable *get_variable (const std::string& vname);
+
+  // create a variable of the given name and given type. Will also insert an
+  // extract statement
+  jit_variable *create_variable (const std::string& vname, jit_type *type);
+
+  // The name of the next for loop iterator. If inc is false, then the iterator
+  // counter will not be incremented.
+  std::string next_iterator (bool inc = true)
+  { return next_name ("#iter", iterator_count, inc); }
+
+  std::string next_for_bounds (bool inc = true)
+  { return next_name ("#for_bounds", for_bounds_count, inc); }
+
+  std::string next_shortcircut_result (bool inc = true)
+  { return next_name ("#shortcircut_result", short_count, inc); }
+
+  std::string next_name (const char *prefix, size_t& count, bool inc);
+
+  std::pair<jit_value *, jit_value *> resolve (tree_index_expression& exp);
+
+  jit_value *do_assign (tree_expression *exp, jit_value *rhs,
+                        bool artificial = false);
+
+  jit_value *do_assign (const std::string& lhs, jit_value *rhs, bool print,
+                        bool artificial = false);
+
+  jit_value *visit (tree *tee) { return visit (*tee); }
+
+  jit_value *visit (tree& tee);
+
+  void push_worklist (jit_instruction *instr)
+  {
+    if (! instr->in_worklist ())
+      {
+        instr->stash_in_worklist (true);
+        worklist.push_back (instr);
+      }
+  }
+
+  void append_users (jit_value *v)
+  {
+    for (jit_use *use = v->first_use (); use; use = use->next ())
+      push_worklist (use->user ());
+  }
+
+  void append_users_term (jit_terminator *term);
+
+  void track_value (jit_value *value)
+  {
+    if (value->type ())
+      constants.push_back (value);
+    all_values.push_back (value);
+  }
+
+  void merge_blocks (void);
+
+  void construct_ssa (void);
+
+  void do_construct_ssa (jit_block& block, size_t avisit_count);
+
+  void remove_dead ();
+
+  void place_releases (void);
+
+  void release_temp (jit_block& ablock, std::set<jit_value *>& temp);
+
+  void release_dead_phi (jit_block& ablock);
+
+  void simplify_phi (void);
+
+  void simplify_phi (jit_phi& phi);
+
+  void print_blocks (const std::string& header)
+  {
+    std::cout << "-------------------- " << header << " --------------------\n";
+    for (std::list<jit_block *>::iterator iter = blocks.begin ();
+         iter != blocks.end (); ++iter)
+      {
+        assert (*iter);
+        (*iter)->print (std::cout, 0);
+      }
+    std::cout << std::endl;
+  }
+
+  void print_dom (void)
+  {
+    std::cout << "-------------------- dom info --------------------\n";
+    for (std::list<jit_block *>::iterator iter = blocks.begin ();
+         iter != blocks.end (); ++iter)
+      {
+        assert (*iter);
+        (*iter)->print_dom (std::cout);
+      }
+    std::cout << std::endl;
+  }
+
+  bool breaking; // true if we are breaking OR continuing
+  block_list breaks;
+  block_list continues;
+
+  void finish_breaks (jit_block *dest, const block_list& lst);
+
+  // this case is much simpler, just convert from the jit ir to llvm
+  class
+  convert_llvm : public jit_ir_walker
+  {
+  public:
+    convert_llvm (jit_convert& jc) : jthis (jc) {}
+
+    llvm::Function *convert (llvm::Module *module,
+                             const std::vector<std::pair<std::string, bool> >& args,
+                             const std::list<jit_block *>& blocks,
+                             const std::list<jit_value *>& constants);
+
+#define JIT_METH(clname)                        \
+    virtual void visit (jit_ ## clname&);
+
+    JIT_VISIT_IR_CLASSES;
+
+#undef JIT_METH
+  private:
+    // name -> llvm argument
+    std::map<std::string, llvm::Value *> arguments;
+
+    void finish_phi (jit_phi *phi);
+
+    void visit (jit_value *jvalue)
+    {
+      return visit (*jvalue);
+    }
+
+    void visit (jit_value &jvalue)
+    {
+      jvalue.accept (*this);
+    }
+  private:
+    jit_convert &jthis;
+    llvm::Function *function;
+    llvm::BasicBlock *prelude;
+  };
+};
+
+class jit_info;
+
+class
+tree_jit
+{
+public:
+  tree_jit (void);
+
+  ~tree_jit (void);
+
+  bool execute (tree_simple_for_command& cmd, const octave_value& bounds);
+
+  bool execute (tree_while_command& cmd);
+
+  llvm::ExecutionEngine *get_engine (void) const { return engine; }
+
+  llvm::Module *get_module (void) const { return module; }
+
+  void optimize (llvm::Function *fn);
+ private:
+  bool initialize (void);
+
+  size_t trip_count (const octave_value& bounds) const;
+
+  // FIXME: Temorary hack to test
+  typedef std::map<tree *, jit_info *> compiled_map;
+  llvm::Module *module;
+  llvm::PassManager *module_pass_manager;
+  llvm::FunctionPassManager *pass_manager;
+  llvm::ExecutionEngine *engine;
+};
+
+class
+jit_info
+{
+public:
+  // we use a pointer here so we don't have to include ov.h
+  typedef std::map<std::string, const octave_value *> vmap;
+
+  jit_info (tree_jit& tjit, tree& tee);
+
+  jit_info (tree_jit& tjit, tree& tee, const octave_value& for_bounds);
+
+  ~jit_info (void);
+
+  bool execute (const vmap& extra_vars = vmap ()) const;
+
+  bool match (const vmap& extra_vars = vmap ()) const;
+private:
+  typedef jit_convert::type_bound type_bound;
+  typedef jit_convert::type_bound_vector type_bound_vector;
+  typedef void (*jited_function)(octave_base_value**);
+
+  void initialize (tree_jit& tjit, jit_convert& conv);
+
+  octave_value find (const vmap& extra_vars, const std::string& vname) const;
+
+  llvm::ExecutionEngine *engine;
+  jited_function function;
+  llvm::Function *llvm_function;
+
+  std::vector<std::pair<std::string, bool> > arguments;
+  type_bound_vector bounds;
+};
+
+#endif
+#endif
--- a/src/pt-loop.cc
+++ b/src/pt-loop.cc
@@ -35,6 +35,7 @@
 #include "pt-bp.h"
 #include "pt-cmd.h"
 #include "pt-exp.h"
+#include "pt-jit.h"
 #include "pt-jump.h"
 #include "pt-loop.h"
 #include "pt-stmt.h"
@@ -49,6 +50,9 @@
   delete list;
   delete lead_comm;
   delete trail_comm;
+#ifdef HAVE_LLVM
+  delete compiled;
+#endif
 }
 
 tree_command *
@@ -97,6 +101,9 @@
   delete list;
   delete lead_comm;
   delete trail_comm;
+#ifdef HAVE_LLVM
+  delete compiled;
+#endif
 }
 
 tree_command *
--- a/src/pt-loop.h
+++ b/src/pt-loop.h
@@ -36,6 +36,8 @@
 #include "pt-cmd.h"
 #include "symtab.h"
 
+class jit_info;
+
 // While.
 
 class
@@ -45,21 +47,33 @@
 
   tree_while_command (int l = -1, int c = -1)
     : tree_command (l, c), expr (0), list (0), lead_comm (0),
-      trail_comm (0) { }
+      trail_comm (0)
+#ifdef HAVE_LLVM
+    , compiled (0)
+#endif
+  { }
 
   tree_while_command (tree_expression *e,
                       octave_comment_list *lc = 0,
                       octave_comment_list *tc = 0,
                       int l = -1, int c = -1)
     : tree_command (l, c), expr (e), list (0), lead_comm (lc),
-      trail_comm (tc) { }
+      trail_comm (tc)
+#ifdef HAVE_LLVM
+    , compiled (0)
+#endif
+  { }
 
   tree_while_command (tree_expression *e, tree_statement_list *lst,
                       octave_comment_list *lc = 0,
                       octave_comment_list *tc = 0,
                       int l = -1, int c = -1)
     : tree_command (l, c), expr (e), list (lst), lead_comm (lc),
-      trail_comm (tc) { }
+      trail_comm (tc)
+#ifdef HAVE_LLVM
+    , compiled (0)
+#endif
+  { }
 
   ~tree_while_command (void);
 
@@ -76,6 +90,19 @@
 
   void accept (tree_walker& tw);
 
+#ifdef HAVE_LLVM
+  // some functions use by tree_jit
+  jit_info *get_info (void) const
+  {
+    return compiled;
+  }
+
+  void stash_info (jit_info *jinfo)
+  {
+    compiled = jinfo;
+  }
+#endif
+
 protected:
 
   // Expression to test.
@@ -92,6 +119,11 @@
 
 private:
 
+#ifdef HAVE_LLVM
+  // compiled version of the loop
+  jit_info *compiled;
+#endif
+
   // No copying!
 
   tree_while_command (const tree_while_command&);
@@ -146,7 +178,11 @@
 
   tree_simple_for_command (int l = -1, int c = -1)
     : tree_command (l, c), parallel (false), lhs (0), expr (0),
-      maxproc (0), list (0), lead_comm (0), trail_comm (0) { }
+      maxproc (0), list (0), lead_comm (0), trail_comm (0)
+#ifdef HAVE_LLVM
+    , compiled (0)
+#endif
+  { }
 
   tree_simple_for_command (bool parallel_arg, tree_expression *le,
                            tree_expression *re,
@@ -157,7 +193,11 @@
                            int l = -1, int c = -1)
     : tree_command (l, c), parallel (parallel_arg), lhs (le),
       expr (re), maxproc (maxproc_arg), list (lst),
-      lead_comm (lc), trail_comm (tc) { }
+      lead_comm (lc), trail_comm (tc)
+#ifdef HAVE_LLVM
+    , compiled (0)
+#endif
+  { }
 
   ~tree_simple_for_command (void);
 
@@ -180,8 +220,20 @@
 
   void accept (tree_walker& tw);
 
+#ifdef HAVE_LLVM
+  // some functions use by tree_jit
+  jit_info *get_info (void) const
+  {
+    return compiled;
+  }
+
+  void stash_info (jit_info *jinfo)
+  {
+    compiled = jinfo;
+  }
+#endif
+
 private:
-
   // TRUE means operate in parallel (subject to the value of the
   // maxproc expression).
   bool parallel;
@@ -205,6 +257,9 @@
   // Comment preceding ENDFOR token.
   octave_comment_list *trail_comm;
 
+  // compiled version of the loop
+  jit_info *compiled;
+
   // No copying!
 
   tree_simple_for_command (const tree_simple_for_command&);
--- a/src/pt-stmt.h
+++ b/src/pt-stmt.h
@@ -35,12 +35,13 @@
 #include "base-list.h"
 #include "comment-list.h"
 #include "symtab.h"
+#include "pt.h"
 
 // A statement is either a command to execute or an expression to
 // evaluate.
 
 class
-tree_statement
+tree_statement : public tree
 {
 public:
 
--- a/src/sighandlers.cc
+++ b/src/sighandlers.cc
@@ -63,7 +63,7 @@
 // TRUE means we should try to enter the debugger on SIGINT.
 static bool Vdebug_on_interrupt = false;
 
-// Allow users to avoid writing octave-core for SIGHUP (sent by
+// Allow users to avoid writing octave-workspace for SIGHUP (sent by
 // closing gnome-terminal, for example).  Note that this variable has
 // no effect if Vcrash_dumps_octave_core is FALSE.
 static bool Vsighup_dumps_octave_core = true;
@@ -147,12 +147,12 @@
 #endif
 
             case SIGFPE:
-              std::cerr << "warning: floating point exception -- trying to return to prompt" << std::endl;
+              std::cerr << "warning: floating point exception" << std::endl;
               break;
 
 #ifdef SIGPIPE
             case SIGPIPE:
-              std::cerr << "warning: broken pipe -- some output may be lost" << std::endl;
+              std::cerr << "warning: broken pipe" << std::endl;
               break;
 #endif
             }
@@ -1001,7 +1001,7 @@
 @deftypefnx {Built-in Function} {@var{old_val} =} sighup_dumps_octave_core (@var{new_val})\n\
 @deftypefnx {Built-in Function} {} sighup_dumps_octave_core (@var{new_val}, \"local\")\n\
 Query or set the internal variable that controls whether Octave tries\n\
-to save all current variables to the file \"octave-core\" if it receives\n\
+to save all current variables to the file \"octave-workspace\" if it receives\n\
 a hangup signal.\n\
 \n\
 When called from inside a function with the \"local\" option, the variable is\n\
@@ -1030,7 +1030,7 @@
 @deftypefnx {Built-in Function} {@var{old_val} =} sigterm_dumps_octave_core (@var{new_val})\n\
 @deftypefnx {Built-in Function} {} sigterm_dumps_octave_core (@var{new_val}, \"local\")\n\
 Query or set the internal variable that controls whether Octave tries\n\
-to save all current variables to the file \"octave-core\" if it receives\n\
+to save all current variables to the file \"octave-workspace\" if it receives\n\
 a terminate signal.\n\
 \n\
 When called from inside a function with the \"local\" option, the variable is\n\
--- a/src/sparse.cc
+++ b/src/sparse.cc
@@ -43,7 +43,7 @@
 
 DEFUN (issparse, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {} issparse (@var{x})\n\
+@deftypefn {Built-in Function} {} issparse (@var{x})\n\
 Return true if @var{x} is a sparse matrix.\n\
 @seealso{ismatrix}\n\
 @end deftypefn")
@@ -59,11 +59,11 @@
 
 DEFUN (sparse, args, ,
     "-*- texinfo -*-\n\
-@deftypefn  {Loadable Function} {@var{s} =} sparse (@var{a})\n\
-@deftypefnx {Loadable Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, @var{nzmax})\n\
-@deftypefnx {Loadable Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{sv})\n\
-@deftypefnx {Loadable Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{s}, @var{m}, @var{n}, \"unique\")\n\
-@deftypefnx {Loadable Function} {@var{s} =} sparse (@var{m}, @var{n})\n\
+@deftypefn  {Built-in Function} {@var{s} =} sparse (@var{a})\n\
+@deftypefnx {Built-in Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, @var{nzmax})\n\
+@deftypefnx {Built-in Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{sv})\n\
+@deftypefnx {Built-in Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{s}, @var{m}, @var{n}, \"unique\")\n\
+@deftypefnx {Built-in Function} {@var{s} =} sparse (@var{m}, @var{n})\n\
 Create a sparse matrix from the full matrix or row, column, value triplets.\n\
 If @var{a} is a full matrix, convert it to a sparse matrix representation,\n\
 removing all zero values in the process.\n\
@@ -209,7 +209,7 @@
 
 DEFUN (spalloc, args, ,
     "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {@var{s} =} spalloc (@var{m}, @var{n}, @var{nz})\n\
+@deftypefn {Built-in Function} {@var{s} =} spalloc (@var{m}, @var{n}, @var{nz})\n\
 Create an @var{m}-by-@var{n} sparse matrix with pre-allocated space for at\n\
 most @var{nz} nonzero elements.  This is useful for building the matrix\n\
 incrementally by a sequence of indexed assignments.  Subsequent indexed\n\
--- a/src/symtab.cc
+++ b/src/symtab.cc
@@ -1713,3 +1713,32 @@
   return retval;
 }
 #endif
+
+
+/*
+bug #34497: 'clear -f' does not work for command line functions
+
+This test relies on bar being a core function that is implemented in an m-file.
+If the first assert fails, this is no longer the case and the tests need to be
+updated to use some other function.
+
+%!assert (! strcmp (which ("bar"), ""));
+
+%!function x = bar ()
+%!  x = 5;
+%!endfunction
+%!test
+%! assert (bar == 5);
+%! assert (strcmp (which ("bar"), ""));
+%! clear -f bar;
+%! assert (! strcmp (which ("bar"), ""));
+
+%!function x = bar ()
+%!  x = 5;
+%!endfunction
+%!test
+%! assert (bar == 5);
+%! assert (strcmp (which ("bar"), ""));
+%! clear bar;
+%! assert (! strcmp (which ("bar"), ""));
+ */
--- a/src/symtab.h
+++ b/src/symtab.h
@@ -484,7 +484,7 @@
       return symbol_record (rep->dup (new_scope));
     }
 
-    std::string name (void) const { return rep->name; }
+    const std::string& name (void) const { return rep->name; }
 
     octave_value
     find (const octave_value_list& args = octave_value_list ()) const;
@@ -581,6 +581,66 @@
     symbol_record (symbol_record_rep *new_rep) : rep (new_rep) { }
   };
 
+  // Always access a symbol from the current scope.
+  // Useful for scripts, as they may be executed in more than one scope.
+  class
+  symbol_reference
+  {
+  public:
+    symbol_reference (void) : scope (-1) {}
+
+    symbol_reference (symbol_record record,
+                       scope_id curr_scope = symbol_table::current_scope ())
+      : scope (curr_scope), sym (record)
+    {}
+
+    symbol_reference& operator = (const symbol_reference& ref)
+    {
+      scope = ref.scope;
+      sym = ref.sym;
+      return *this;
+    }
+
+    // The name is the same regardless of scope.
+    const std::string& name (void) const { return sym.name (); }
+
+    symbol_record *operator-> (void)
+    {
+      update ();
+      return &sym;
+    }
+
+    symbol_record *operator-> (void) const
+    {
+      update ();
+      return &sym;
+    }
+
+    // can be used to place symbol_reference in maps, we don't overload < as
+    // it doesn't make any sense for symbol_reference
+    struct comparator
+    {
+      bool operator ()(const symbol_reference& lhs,
+                       const symbol_reference& rhs) const
+      {
+        return lhs.name () < rhs.name ();
+      }
+    };
+  private:
+    void update (void) const
+    {
+      scope_id curr_scope = symbol_table::current_scope ();
+      if (scope != curr_scope || ! sym.is_valid ())
+        {
+          scope = curr_scope;
+          sym = symbol_table::insert (sym.name ());
+        }
+    }
+
+    mutable scope_id scope;
+    mutable symbol_record sym;
+  };
+
   class
   fcn_info
   {
@@ -708,20 +768,14 @@
           }
       }
 
-      void clear_cmdline_function (void)
-      {
-        if (! cmdline_function.islocked ())
-          cmdline_function = octave_value ();
-      }
-
       void clear_autoload_function (void)
       {
         if (! autoload_function.islocked ())
           autoload_function = octave_value ();
       }
 
-      // FIXME -- should this also clear the cmdline and other "user
-      // defined" functions?
+      // We also clear command line functions here, as these are both
+      // "user defined"
       void clear_user_function (void)
       {
         if (! function_on_path.islocked ())
@@ -730,6 +784,9 @@
 
             function_on_path = octave_value ();
           }
+
+        if (! cmdline_function.islocked ())
+          cmdline_function = octave_value ();
       }
 
       void clear_mex_function (void)
@@ -744,7 +801,6 @@
         clear_unlocked (private_functions);
         clear_unlocked (class_constructors);
         clear_unlocked (class_methods);
-        clear_cmdline_function ();
         clear_autoload_function ();
         clear_user_function ();
       }
--- a/src/toplev.cc
+++ b/src/toplev.cc
@@ -1325,6 +1325,9 @@
       { false, "MAGICK_CPPFLAGS", OCTAVE_CONF_MAGICK_CPPFLAGS },
       { false, "MAGICK_LDFLAGS", OCTAVE_CONF_MAGICK_LDFLAGS },
       { false, "MAGICK_LIBS", OCTAVE_CONF_MAGICK_LIBS },
+      { false, "LLVM_CPPFLAGS", OCTAVE_CONF_LLVM_CPPFLAGS },
+      { false, "LLVM_LDFLAGS", OCTAVE_CONF_LLVM_LDFLAGS },
+      { false, "LLVM_LIBS", OCTAVE_CONF_LLVM_LIBS },
       { false, "MKOCTFILE_DL_LDFLAGS", OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS },
       { false, "OCTAVE_LINK_DEPS", OCTAVE_CONF_OCTAVE_LINK_DEPS },
       { false, "OCTAVE_LINK_OPTS", OCTAVE_CONF_OCTAVE_LINK_OPTS },
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -470,7 +470,7 @@
           if (fs.exists ())
             retval = name;
         }
-      else if (len > 2 && name [len - 2] == '.' && name [len - 1] == 'm')
+      else if (len > 2 && name[len - 2] == '.' && name[len - 1] == 'm')
         retval = load_path::find_fcn_file (name.substr (0, len-2));
       else
         {
@@ -527,8 +527,8 @@
           if (fs.exists ())
             retval = name;
         }
-      else if (len > 4 && name [len - 4] == '.' && name [len - 3] == 'o'
-               && name [len - 2] == 'c' && name [len - 1] == 't')
+      else if (len > 4 && name[len - 4] == '.' && name[len - 3] == 'o'
+               && name[len - 2] == 'c' && name[len - 1] == 't')
         retval = load_path::find_oct_file (name.substr (0, len-4));
       else
         retval = load_path::find_oct_file (name);
@@ -556,8 +556,8 @@
           if (fs.exists ())
             retval = name;
         }
-      else if (len > 4 && name [len - 4] == '.' && name [len - 3] == 'm'
-               && name [len - 2] == 'e' && name [len - 1] == 'x')
+      else if (len > 4 && name[len - 4] == '.' && name[len - 3] == 'm'
+               && name[len - 2] == 'e' && name[len - 1] == 'x')
         retval = load_path::find_mex_file (name.substr (0, len-4));
       else
         retval = load_path::find_mex_file (name);
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -548,6 +548,7 @@
 @item \"dir\"\n\
 Check only for directories.\n\
 @end table\n\
+\n\
 @seealso{file_in_loadpath}\n\
 @end deftypefn")
 {
@@ -1558,7 +1559,7 @@
             error ("whos: -file argument must be followed by a file name");
           else
             {
-              std::string nm = argv [i + 1];
+              std::string nm = argv[i + 1];
 
               unwind_protect frame;
 
@@ -2324,6 +2325,7 @@
 The arguments are treated as regular expressions as any variables that\n\
 match will be cleared.\n\
 @end table\n\
+\n\
 With the exception of @code{exclusive}, all long options can be used\n\
 without the dash as well.\n\
 @end deftypefn")
--- a/src/zfstream.cc
+++ b/src/zfstream.cc
@@ -403,7 +403,7 @@
     if (buffer_size > 0)
     {
       // Allocate internal buffer
-      buffer = new char_type[buffer_size];
+      buffer = new char_type [buffer_size];
       // Get area starts empty and will be expanded by underflow as need arises
       this->setg (buffer, buffer, buffer);
       // Setup entire internal buffer as put area.
@@ -416,7 +416,7 @@
     {
       // Even in "unbuffered" case, (small?) get buffer is still required
       buffer_size = SMALLBUFSIZE;
-      buffer = new char_type[buffer_size];
+      buffer = new char_type [buffer_size];
       this->setg (buffer, buffer, buffer);
       // "Unbuffered" means no put buffer
       this->setp (0, 0);