changeset 15057:46b19589b593

maint: Partition src/ directory with more code in subdirs. Create new octave-value dir for ov* code. Create new parse-tre dir for pt* code. Move OPERATORS and TEMPLATE-INST directories to lowercase names * octave-value/module.mk: Hook code in octave-value dir into build system. * octave-value/ov-base-diag.cc, octave-value/ov-base-diag.h, octave-value/ov-base-int.cc, octave-value/ov-base-int.h, octave-value/ov-base-mat.cc, octave-value/ov-base-mat.h, octave-value/ov-base-scalar.cc, octave-value/ov-base-scalar.h, octave-value/ov-base-sparse.cc, octave-value/ov-base-sparse.h, octave-value/ov-base.cc, octave-value/ov-base.h, octave-value/ov-bool-mat.cc, octave-value/ov-bool-mat.h, octave-value/ov-bool-sparse.cc, octave-value/ov-bool-sparse.h, octave-value/ov-bool.cc, octave-value/ov-bool.h, octave-value/ov-builtin.cc, octave-value/ov-builtin.h, octave-value/ov-cell.cc, octave-value/ov-cell.h, octave-value/ov-ch-mat.cc, octave-value/ov-ch-mat.h, octave-value/ov-class.cc, octave-value/ov-class.h, octave-value/ov-colon.cc, octave-value/ov-colon.h, octave-value/ov-complex.cc, octave-value/ov-complex.h, octave-value/ov-cs-list.cc, octave-value/ov-cs-list.h, octave-value/ov-cx-diag.cc, octave-value/ov-cx-diag.h, octave-value/ov-cx-mat.cc, octave-value/ov-cx-mat.h, octave-value/ov-cx-sparse.cc, octave-value/ov-cx-sparse.h, octave-value/ov-dld-fcn.cc, octave-value/ov-dld-fcn.h, octave-value/ov-fcn-handle.cc, octave-value/ov-fcn-handle.h, octave-value/ov-fcn-inline.cc, octave-value/ov-fcn-inline.h, octave-value/ov-fcn.cc, octave-value/ov-fcn.h, octave-value/ov-float.cc, octave-value/ov-float.h, octave-value/ov-flt-complex.cc, octave-value/ov-flt-complex.h, octave-value/ov-flt-cx-diag.cc, octave-value/ov-flt-cx-diag.h, octave-value/ov-flt-cx-mat.cc, octave-value/ov-flt-cx-mat.h, octave-value/ov-flt-re-diag.cc, octave-value/ov-flt-re-diag.h, octave-value/ov-flt-re-mat.cc, octave-value/ov-flt-re-mat.h, octave-value/ov-int-traits.h, octave-value/ov-int16.cc, octave-value/ov-int16.h, octave-value/ov-int32.cc, octave-value/ov-int32.h, octave-value/ov-int64.cc, octave-value/ov-int64.h, octave-value/ov-int8.cc, octave-value/ov-int8.h, octave-value/ov-intx.h, octave-value/ov-lazy-idx.cc, octave-value/ov-lazy-idx.h, octave-value/ov-mex-fcn.cc, octave-value/ov-mex-fcn.h, octave-value/ov-null-mat.cc, octave-value/ov-null-mat.h, octave-value/ov-oncleanup.cc, octave-value/ov-oncleanup.h, octave-value/ov-perm.cc, octave-value/ov-perm.h, octave-value/ov-range.cc, octave-value/ov-range.h, octave-value/ov-re-diag.cc, octave-value/ov-re-diag.h, octave-value/ov-re-mat.cc, octave-value/ov-re-mat.h, octave-value/ov-re-sparse.cc, octave-value/ov-re-sparse.h, octave-value/ov-scalar.cc, octave-value/ov-scalar.h, octave-value/ov-str-mat.cc, octave-value/ov-str-mat.h, octave-value/ov-struct.cc, octave-value/ov-struct.h, octave-value/ov-type-conv.h, octave-value/ov-typeinfo.cc, octave-value/ov-typeinfo.h, octave-value/ov-uint16.cc, octave-value/ov-uint16.h, octave-value/ov-uint32.cc, octave-value/ov-uint32.h, octave-value/ov-uint64.cc, octave-value/ov-uint64.h, octave-value/ov-uint8.cc, octave-value/ov-uint8.h, octave-value/ov-usr-fcn.cc, octave-value/ov-usr-fcn.h, octave-value/ov.cc, octave-value/ov.h: Moved from src/ dir to octave-value dir. * operators/module.mk, operators/op-b-b.cc, operators/op-b-bm.cc, operators/op-b-sbm.cc, operators/op-bm-b.cc, operators/op-bm-bm.cc, operators/op-bm-sbm.cc, operators/op-cdm-cdm.cc, operators/op-cdm-cm.cc, operators/op-cdm-cs.cc, operators/op-cdm-dm.cc, operators/op-cdm-m.cc, operators/op-cdm-s.cc, operators/op-cell.cc, operators/op-chm.cc, operators/op-class.cc, operators/op-cm-cdm.cc, operators/op-cm-cm.cc, operators/op-cm-cs.cc, operators/op-cm-dm.cc, operators/op-cm-m.cc, operators/op-cm-pm.cc, operators/op-cm-s.cc, operators/op-cm-scm.cc, operators/op-cm-sm.cc, operators/op-cs-cm.cc, operators/op-cs-cs.cc, operators/op-cs-m.cc, operators/op-cs-s.cc, operators/op-cs-scm.cc, operators/op-cs-sm.cc, operators/op-dm-cdm.cc, operators/op-dm-cm.cc, operators/op-dm-cs.cc, operators/op-dm-dm.cc, operators/op-dm-m.cc, operators/op-dm-s.cc, operators/op-dm-scm.cc, operators/op-dm-sm.cc, operators/op-dm-template.cc, operators/op-dms-template.cc, operators/op-double-conv.cc, operators/op-fcdm-fcdm.cc, operators/op-fcdm-fcm.cc, operators/op-fcdm-fcs.cc, operators/op-fcdm-fdm.cc, operators/op-fcdm-fm.cc, operators/op-fcdm-fs.cc, operators/op-fcm-fcdm.cc, operators/op-fcm-fcm.cc, operators/op-fcm-fcs.cc, operators/op-fcm-fdm.cc, operators/op-fcm-fm.cc, operators/op-fcm-fs.cc, operators/op-fcm-pm.cc, operators/op-fcn.cc, operators/op-fcs-fcm.cc, operators/op-fcs-fcs.cc, operators/op-fcs-fm.cc, operators/op-fcs-fs.cc, operators/op-fdm-fcdm.cc, operators/op-fdm-fcm.cc, operators/op-fdm-fcs.cc, operators/op-fdm-fdm.cc, operators/op-fdm-fm.cc, operators/op-fdm-fs.cc, operators/op-float-conv.cc, operators/op-fm-fcdm.cc, operators/op-fm-fcm.cc, operators/op-fm-fcs.cc, operators/op-fm-fdm.cc, operators/op-fm-fm.cc, operators/op-fm-fs.cc, operators/op-fm-pm.cc, operators/op-fs-fcm.cc, operators/op-fs-fcs.cc, operators/op-fs-fm.cc, operators/op-fs-fs.cc, operators/op-i16-i16.cc, operators/op-i32-i32.cc, operators/op-i64-i64.cc, operators/op-i8-i8.cc, operators/op-int-concat.cc, operators/op-int-conv.cc, operators/op-int.h, operators/op-m-cdm.cc, operators/op-m-cm.cc, operators/op-m-cs.cc, operators/op-m-dm.cc, operators/op-m-m.cc, operators/op-m-pm.cc, operators/op-m-s.cc, operators/op-m-scm.cc, operators/op-m-sm.cc, operators/op-pm-cm.cc, operators/op-pm-fcm.cc, operators/op-pm-fm.cc, operators/op-pm-m.cc, operators/op-pm-pm.cc, operators/op-pm-scm.cc, operators/op-pm-sm.cc, operators/op-pm-template.cc, operators/op-range.cc, operators/op-s-cm.cc, operators/op-s-cs.cc, operators/op-s-m.cc, operators/op-s-s.cc, operators/op-s-scm.cc, operators/op-s-sm.cc, operators/op-sbm-b.cc, operators/op-sbm-bm.cc, operators/op-sbm-sbm.cc, operators/op-scm-cm.cc, operators/op-scm-cs.cc, operators/op-scm-m.cc, operators/op-scm-s.cc, operators/op-scm-scm.cc, operators/op-scm-sm.cc, operators/op-sm-cm.cc, operators/op-sm-cs.cc, operators/op-sm-m.cc, operators/op-sm-s.cc, operators/op-sm-scm.cc, operators/op-sm-sm.cc, operators/op-str-m.cc, operators/op-str-s.cc, operators/op-str-str.cc, operators/op-struct.cc, operators/op-ui16-ui16.cc, operators/op-ui32-ui32.cc, operators/op-ui64-ui64.cc, operators/op-ui8-ui8.cc: Moved from OPERATORS/ dir to operators/ directory. * mkops: Correctly print comment in generated file ops.cc that it is made by mkops. Change sed expression for OPERATORS/ to operators/. * parse-tree/module.mk: Hook code in parse-tree dir into build system. * parse-tree/pt-all.h, parse-tree/pt-arg-list.cc, parse-tree/pt-arg-list.h, parse-tree/pt-assign.cc, parse-tree/pt-assign.h, parse-tree/pt-binop.cc, parse-tree/pt-binop.h, parse-tree/pt-bp.cc, parse-tree/pt-bp.h, parse-tree/pt-cbinop.cc, parse-tree/pt-cbinop.h, parse-tree/pt-cell.cc, parse-tree/pt-cell.h, parse-tree/pt-check.cc, parse-tree/pt-check.h, parse-tree/pt-cmd.cc, parse-tree/pt-cmd.h, parse-tree/pt-colon.cc, parse-tree/pt-colon.h, parse-tree/pt-const.cc, parse-tree/pt-const.h, parse-tree/pt-decl.cc, parse-tree/pt-decl.h, parse-tree/pt-eval.cc, parse-tree/pt-eval.h, parse-tree/pt-except.cc, parse-tree/pt-except.h, parse-tree/pt-exp.cc, parse-tree/pt-exp.h, parse-tree/pt-fcn-handle.cc, parse-tree/pt-fcn-handle.h, parse-tree/pt-id.cc, parse-tree/pt-id.h, parse-tree/pt-idx.cc, parse-tree/pt-idx.h, parse-tree/pt-jump.cc, parse-tree/pt-jump.h, parse-tree/pt-loop.cc, parse-tree/pt-loop.h, parse-tree/pt-mat.cc, parse-tree/pt-mat.h, parse-tree/pt-misc.cc, parse-tree/pt-misc.h, parse-tree/pt-pr-code.cc, parse-tree/pt-pr-code.h, parse-tree/pt-select.cc, parse-tree/pt-select.h, parse-tree/pt-stmt.cc, parse-tree/pt-stmt.h, parse-tree/pt-unop.cc, parse-tree/pt-unop.h, parse-tree/pt-walk.h, parse-tree/pt.cc, parse-tree/pt.h: Moved from src/ dir to parse-tree dir. * template-inst/Array-jit.cc, template-inst/Array-os.cc, template-inst/Array-sym.cc, template-inst/Array-tc.cc, template-inst/module.mk: Moved from TEMPLATE-INST dir to template-inst/ directory. * src/Makefile.am: Add new directories to build system. * corefcn/module.mk: Use COREFCN_SRC with all capitals to indicate it is not an Automake special target.
author Rik <rik@octave.org>
date Mon, 30 Jul 2012 15:29:19 -0700
parents bc32288f4a42
children 3691a606283e 069c552587a0
files src/Makefile.am src/OPERATORS/module.mk src/OPERATORS/op-b-b.cc src/OPERATORS/op-b-bm.cc src/OPERATORS/op-b-sbm.cc src/OPERATORS/op-bm-b.cc src/OPERATORS/op-bm-bm.cc src/OPERATORS/op-bm-sbm.cc src/OPERATORS/op-cdm-cdm.cc src/OPERATORS/op-cdm-cm.cc src/OPERATORS/op-cdm-cs.cc src/OPERATORS/op-cdm-dm.cc src/OPERATORS/op-cdm-m.cc src/OPERATORS/op-cdm-s.cc src/OPERATORS/op-cell.cc src/OPERATORS/op-chm.cc src/OPERATORS/op-class.cc src/OPERATORS/op-cm-cdm.cc src/OPERATORS/op-cm-cm.cc src/OPERATORS/op-cm-cs.cc src/OPERATORS/op-cm-dm.cc src/OPERATORS/op-cm-m.cc src/OPERATORS/op-cm-pm.cc src/OPERATORS/op-cm-s.cc src/OPERATORS/op-cm-scm.cc src/OPERATORS/op-cm-sm.cc src/OPERATORS/op-cs-cm.cc src/OPERATORS/op-cs-cs.cc src/OPERATORS/op-cs-m.cc src/OPERATORS/op-cs-s.cc src/OPERATORS/op-cs-scm.cc src/OPERATORS/op-cs-sm.cc src/OPERATORS/op-dm-cdm.cc src/OPERATORS/op-dm-cm.cc src/OPERATORS/op-dm-cs.cc src/OPERATORS/op-dm-dm.cc src/OPERATORS/op-dm-m.cc src/OPERATORS/op-dm-s.cc src/OPERATORS/op-dm-scm.cc src/OPERATORS/op-dm-sm.cc src/OPERATORS/op-dm-template.cc src/OPERATORS/op-dms-template.cc src/OPERATORS/op-double-conv.cc src/OPERATORS/op-fcdm-fcdm.cc src/OPERATORS/op-fcdm-fcm.cc src/OPERATORS/op-fcdm-fcs.cc src/OPERATORS/op-fcdm-fdm.cc src/OPERATORS/op-fcdm-fm.cc src/OPERATORS/op-fcdm-fs.cc src/OPERATORS/op-fcm-fcdm.cc src/OPERATORS/op-fcm-fcm.cc src/OPERATORS/op-fcm-fcs.cc src/OPERATORS/op-fcm-fdm.cc src/OPERATORS/op-fcm-fm.cc src/OPERATORS/op-fcm-fs.cc src/OPERATORS/op-fcm-pm.cc src/OPERATORS/op-fcn.cc src/OPERATORS/op-fcs-fcm.cc src/OPERATORS/op-fcs-fcs.cc src/OPERATORS/op-fcs-fm.cc src/OPERATORS/op-fcs-fs.cc src/OPERATORS/op-fdm-fcdm.cc src/OPERATORS/op-fdm-fcm.cc src/OPERATORS/op-fdm-fcs.cc src/OPERATORS/op-fdm-fdm.cc src/OPERATORS/op-fdm-fm.cc src/OPERATORS/op-fdm-fs.cc src/OPERATORS/op-float-conv.cc src/OPERATORS/op-fm-fcdm.cc src/OPERATORS/op-fm-fcm.cc src/OPERATORS/op-fm-fcs.cc src/OPERATORS/op-fm-fdm.cc src/OPERATORS/op-fm-fm.cc src/OPERATORS/op-fm-fs.cc src/OPERATORS/op-fm-pm.cc src/OPERATORS/op-fs-fcm.cc src/OPERATORS/op-fs-fcs.cc src/OPERATORS/op-fs-fm.cc src/OPERATORS/op-fs-fs.cc src/OPERATORS/op-i16-i16.cc src/OPERATORS/op-i32-i32.cc src/OPERATORS/op-i64-i64.cc src/OPERATORS/op-i8-i8.cc src/OPERATORS/op-int-concat.cc src/OPERATORS/op-int-conv.cc src/OPERATORS/op-int.h src/OPERATORS/op-m-cdm.cc src/OPERATORS/op-m-cm.cc src/OPERATORS/op-m-cs.cc src/OPERATORS/op-m-dm.cc src/OPERATORS/op-m-m.cc src/OPERATORS/op-m-pm.cc src/OPERATORS/op-m-s.cc src/OPERATORS/op-m-scm.cc src/OPERATORS/op-m-sm.cc src/OPERATORS/op-pm-cm.cc src/OPERATORS/op-pm-fcm.cc src/OPERATORS/op-pm-fm.cc src/OPERATORS/op-pm-m.cc src/OPERATORS/op-pm-pm.cc src/OPERATORS/op-pm-scm.cc src/OPERATORS/op-pm-sm.cc src/OPERATORS/op-pm-template.cc src/OPERATORS/op-range.cc src/OPERATORS/op-s-cm.cc src/OPERATORS/op-s-cs.cc src/OPERATORS/op-s-m.cc src/OPERATORS/op-s-s.cc src/OPERATORS/op-s-scm.cc src/OPERATORS/op-s-sm.cc src/OPERATORS/op-sbm-b.cc src/OPERATORS/op-sbm-bm.cc src/OPERATORS/op-sbm-sbm.cc src/OPERATORS/op-scm-cm.cc src/OPERATORS/op-scm-cs.cc src/OPERATORS/op-scm-m.cc src/OPERATORS/op-scm-s.cc src/OPERATORS/op-scm-scm.cc src/OPERATORS/op-scm-sm.cc src/OPERATORS/op-sm-cm.cc src/OPERATORS/op-sm-cs.cc src/OPERATORS/op-sm-m.cc src/OPERATORS/op-sm-s.cc src/OPERATORS/op-sm-scm.cc src/OPERATORS/op-sm-sm.cc src/OPERATORS/op-str-m.cc src/OPERATORS/op-str-s.cc src/OPERATORS/op-str-str.cc src/OPERATORS/op-struct.cc src/OPERATORS/op-ui16-ui16.cc src/OPERATORS/op-ui32-ui32.cc src/OPERATORS/op-ui64-ui64.cc src/OPERATORS/op-ui8-ui8.cc src/TEMPLATE-INST/Array-jit.cc src/TEMPLATE-INST/Array-os.cc src/TEMPLATE-INST/Array-sym.cc src/TEMPLATE-INST/Array-tc.cc src/TEMPLATE-INST/module.mk src/corefcn/module.mk src/mkops src/octave-value/module.mk src/octave-value/ov-base-diag.cc src/octave-value/ov-base-diag.h src/octave-value/ov-base-int.cc src/octave-value/ov-base-int.h src/octave-value/ov-base-mat.cc src/octave-value/ov-base-mat.h src/octave-value/ov-base-scalar.cc src/octave-value/ov-base-scalar.h src/octave-value/ov-base-sparse.cc src/octave-value/ov-base-sparse.h src/octave-value/ov-base.cc src/octave-value/ov-base.h src/octave-value/ov-bool-mat.cc src/octave-value/ov-bool-mat.h src/octave-value/ov-bool-sparse.cc src/octave-value/ov-bool-sparse.h src/octave-value/ov-bool.cc src/octave-value/ov-bool.h src/octave-value/ov-builtin.cc src/octave-value/ov-builtin.h src/octave-value/ov-cell.cc src/octave-value/ov-cell.h src/octave-value/ov-ch-mat.cc src/octave-value/ov-ch-mat.h src/octave-value/ov-class.cc src/octave-value/ov-class.h src/octave-value/ov-colon.cc src/octave-value/ov-colon.h src/octave-value/ov-complex.cc src/octave-value/ov-complex.h src/octave-value/ov-cs-list.cc src/octave-value/ov-cs-list.h src/octave-value/ov-cx-diag.cc src/octave-value/ov-cx-diag.h src/octave-value/ov-cx-mat.cc src/octave-value/ov-cx-mat.h src/octave-value/ov-cx-sparse.cc src/octave-value/ov-cx-sparse.h src/octave-value/ov-dld-fcn.cc src/octave-value/ov-dld-fcn.h src/octave-value/ov-fcn-handle.cc src/octave-value/ov-fcn-handle.h src/octave-value/ov-fcn-inline.cc src/octave-value/ov-fcn-inline.h src/octave-value/ov-fcn.cc src/octave-value/ov-fcn.h src/octave-value/ov-float.cc src/octave-value/ov-float.h src/octave-value/ov-flt-complex.cc src/octave-value/ov-flt-complex.h src/octave-value/ov-flt-cx-diag.cc src/octave-value/ov-flt-cx-diag.h src/octave-value/ov-flt-cx-mat.cc src/octave-value/ov-flt-cx-mat.h src/octave-value/ov-flt-re-diag.cc src/octave-value/ov-flt-re-diag.h src/octave-value/ov-flt-re-mat.cc src/octave-value/ov-flt-re-mat.h src/octave-value/ov-int-traits.h src/octave-value/ov-int16.cc src/octave-value/ov-int16.h src/octave-value/ov-int32.cc src/octave-value/ov-int32.h src/octave-value/ov-int64.cc src/octave-value/ov-int64.h src/octave-value/ov-int8.cc src/octave-value/ov-int8.h src/octave-value/ov-intx.h src/octave-value/ov-lazy-idx.cc src/octave-value/ov-lazy-idx.h src/octave-value/ov-mex-fcn.cc src/octave-value/ov-mex-fcn.h src/octave-value/ov-null-mat.cc src/octave-value/ov-null-mat.h src/octave-value/ov-oncleanup.cc src/octave-value/ov-oncleanup.h src/octave-value/ov-perm.cc src/octave-value/ov-perm.h src/octave-value/ov-range.cc src/octave-value/ov-range.h src/octave-value/ov-re-diag.cc src/octave-value/ov-re-diag.h src/octave-value/ov-re-mat.cc src/octave-value/ov-re-mat.h src/octave-value/ov-re-sparse.cc src/octave-value/ov-re-sparse.h src/octave-value/ov-scalar.cc src/octave-value/ov-scalar.h src/octave-value/ov-str-mat.cc src/octave-value/ov-str-mat.h src/octave-value/ov-struct.cc src/octave-value/ov-struct.h src/octave-value/ov-type-conv.h src/octave-value/ov-typeinfo.cc src/octave-value/ov-typeinfo.h src/octave-value/ov-uint16.cc src/octave-value/ov-uint16.h src/octave-value/ov-uint32.cc src/octave-value/ov-uint32.h src/octave-value/ov-uint64.cc src/octave-value/ov-uint64.h src/octave-value/ov-uint8.cc src/octave-value/ov-uint8.h src/octave-value/ov-usr-fcn.cc src/octave-value/ov-usr-fcn.h src/octave-value/ov.cc src/octave-value/ov.h src/operators/module.mk src/operators/op-b-b.cc src/operators/op-b-bm.cc src/operators/op-b-sbm.cc src/operators/op-bm-b.cc src/operators/op-bm-bm.cc src/operators/op-bm-sbm.cc src/operators/op-cdm-cdm.cc src/operators/op-cdm-cm.cc src/operators/op-cdm-cs.cc src/operators/op-cdm-dm.cc src/operators/op-cdm-m.cc src/operators/op-cdm-s.cc src/operators/op-cell.cc src/operators/op-chm.cc src/operators/op-class.cc src/operators/op-cm-cdm.cc src/operators/op-cm-cm.cc src/operators/op-cm-cs.cc src/operators/op-cm-dm.cc src/operators/op-cm-m.cc src/operators/op-cm-pm.cc src/operators/op-cm-s.cc src/operators/op-cm-scm.cc src/operators/op-cm-sm.cc src/operators/op-cs-cm.cc src/operators/op-cs-cs.cc src/operators/op-cs-m.cc src/operators/op-cs-s.cc src/operators/op-cs-scm.cc src/operators/op-cs-sm.cc src/operators/op-dm-cdm.cc src/operators/op-dm-cm.cc src/operators/op-dm-cs.cc src/operators/op-dm-dm.cc src/operators/op-dm-m.cc src/operators/op-dm-s.cc src/operators/op-dm-scm.cc src/operators/op-dm-sm.cc src/operators/op-dm-template.cc src/operators/op-dms-template.cc src/operators/op-double-conv.cc src/operators/op-fcdm-fcdm.cc src/operators/op-fcdm-fcm.cc src/operators/op-fcdm-fcs.cc src/operators/op-fcdm-fdm.cc src/operators/op-fcdm-fm.cc src/operators/op-fcdm-fs.cc src/operators/op-fcm-fcdm.cc src/operators/op-fcm-fcm.cc src/operators/op-fcm-fcs.cc src/operators/op-fcm-fdm.cc src/operators/op-fcm-fm.cc src/operators/op-fcm-fs.cc src/operators/op-fcm-pm.cc src/operators/op-fcn.cc src/operators/op-fcs-fcm.cc src/operators/op-fcs-fcs.cc src/operators/op-fcs-fm.cc src/operators/op-fcs-fs.cc src/operators/op-fdm-fcdm.cc src/operators/op-fdm-fcm.cc src/operators/op-fdm-fcs.cc src/operators/op-fdm-fdm.cc src/operators/op-fdm-fm.cc src/operators/op-fdm-fs.cc src/operators/op-float-conv.cc src/operators/op-fm-fcdm.cc src/operators/op-fm-fcm.cc src/operators/op-fm-fcs.cc src/operators/op-fm-fdm.cc src/operators/op-fm-fm.cc src/operators/op-fm-fs.cc src/operators/op-fm-pm.cc src/operators/op-fs-fcm.cc src/operators/op-fs-fcs.cc src/operators/op-fs-fm.cc src/operators/op-fs-fs.cc src/operators/op-i16-i16.cc src/operators/op-i32-i32.cc src/operators/op-i64-i64.cc src/operators/op-i8-i8.cc src/operators/op-int-concat.cc src/operators/op-int-conv.cc src/operators/op-int.h src/operators/op-m-cdm.cc src/operators/op-m-cm.cc src/operators/op-m-cs.cc src/operators/op-m-dm.cc src/operators/op-m-m.cc src/operators/op-m-pm.cc src/operators/op-m-s.cc src/operators/op-m-scm.cc src/operators/op-m-sm.cc src/operators/op-pm-cm.cc src/operators/op-pm-fcm.cc src/operators/op-pm-fm.cc src/operators/op-pm-m.cc src/operators/op-pm-pm.cc src/operators/op-pm-scm.cc src/operators/op-pm-sm.cc src/operators/op-pm-template.cc src/operators/op-range.cc src/operators/op-s-cm.cc src/operators/op-s-cs.cc src/operators/op-s-m.cc src/operators/op-s-s.cc src/operators/op-s-scm.cc src/operators/op-s-sm.cc src/operators/op-sbm-b.cc src/operators/op-sbm-bm.cc src/operators/op-sbm-sbm.cc src/operators/op-scm-cm.cc src/operators/op-scm-cs.cc src/operators/op-scm-m.cc src/operators/op-scm-s.cc src/operators/op-scm-scm.cc src/operators/op-scm-sm.cc src/operators/op-sm-cm.cc src/operators/op-sm-cs.cc src/operators/op-sm-m.cc src/operators/op-sm-s.cc src/operators/op-sm-scm.cc src/operators/op-sm-sm.cc src/operators/op-str-m.cc src/operators/op-str-s.cc src/operators/op-str-str.cc src/operators/op-struct.cc src/operators/op-ui16-ui16.cc src/operators/op-ui32-ui32.cc src/operators/op-ui64-ui64.cc src/operators/op-ui8-ui8.cc src/ov-base-diag.cc src/ov-base-diag.h src/ov-base-int.cc src/ov-base-int.h src/ov-base-mat.cc src/ov-base-mat.h src/ov-base-scalar.cc src/ov-base-scalar.h src/ov-base-sparse.cc src/ov-base-sparse.h src/ov-base.cc src/ov-base.h src/ov-bool-mat.cc src/ov-bool-mat.h src/ov-bool-sparse.cc src/ov-bool-sparse.h src/ov-bool.cc src/ov-bool.h src/ov-builtin.cc src/ov-builtin.h src/ov-cell.cc src/ov-cell.h src/ov-ch-mat.cc src/ov-ch-mat.h src/ov-class.cc src/ov-class.h src/ov-colon.cc src/ov-colon.h src/ov-complex.cc src/ov-complex.h src/ov-cs-list.cc src/ov-cs-list.h src/ov-cx-diag.cc src/ov-cx-diag.h src/ov-cx-mat.cc src/ov-cx-mat.h src/ov-cx-sparse.cc src/ov-cx-sparse.h src/ov-dld-fcn.cc src/ov-dld-fcn.h src/ov-fcn-handle.cc src/ov-fcn-handle.h src/ov-fcn-inline.cc src/ov-fcn-inline.h src/ov-fcn.cc src/ov-fcn.h src/ov-float.cc src/ov-float.h src/ov-flt-complex.cc src/ov-flt-complex.h src/ov-flt-cx-diag.cc src/ov-flt-cx-diag.h src/ov-flt-cx-mat.cc src/ov-flt-cx-mat.h src/ov-flt-re-diag.cc src/ov-flt-re-diag.h src/ov-flt-re-mat.cc src/ov-flt-re-mat.h src/ov-int-traits.h src/ov-int16.cc src/ov-int16.h src/ov-int32.cc src/ov-int32.h src/ov-int64.cc src/ov-int64.h src/ov-int8.cc src/ov-int8.h src/ov-intx.h src/ov-lazy-idx.cc src/ov-lazy-idx.h src/ov-mex-fcn.cc src/ov-mex-fcn.h src/ov-null-mat.cc src/ov-null-mat.h src/ov-oncleanup.cc src/ov-oncleanup.h src/ov-perm.cc src/ov-perm.h src/ov-range.cc src/ov-range.h src/ov-re-diag.cc src/ov-re-diag.h src/ov-re-mat.cc src/ov-re-mat.h src/ov-re-sparse.cc src/ov-re-sparse.h src/ov-scalar.cc src/ov-scalar.h src/ov-str-mat.cc src/ov-str-mat.h src/ov-struct.cc src/ov-struct.h src/ov-type-conv.h src/ov-typeinfo.cc src/ov-typeinfo.h src/ov-uint16.cc src/ov-uint16.h src/ov-uint32.cc src/ov-uint32.h src/ov-uint64.cc src/ov-uint64.h src/ov-uint8.cc src/ov-uint8.h src/ov-usr-fcn.cc src/ov-usr-fcn.h src/ov.cc src/ov.h src/parse-tree/module.mk src/parse-tree/pt-all.h src/parse-tree/pt-arg-list.cc src/parse-tree/pt-arg-list.h src/parse-tree/pt-assign.cc src/parse-tree/pt-assign.h src/parse-tree/pt-binop.cc src/parse-tree/pt-binop.h src/parse-tree/pt-bp.cc src/parse-tree/pt-bp.h src/parse-tree/pt-cbinop.cc src/parse-tree/pt-cbinop.h src/parse-tree/pt-cell.cc src/parse-tree/pt-cell.h src/parse-tree/pt-check.cc src/parse-tree/pt-check.h src/parse-tree/pt-cmd.cc src/parse-tree/pt-cmd.h src/parse-tree/pt-colon.cc src/parse-tree/pt-colon.h src/parse-tree/pt-const.cc src/parse-tree/pt-const.h src/parse-tree/pt-decl.cc src/parse-tree/pt-decl.h src/parse-tree/pt-eval.cc src/parse-tree/pt-eval.h src/parse-tree/pt-except.cc src/parse-tree/pt-except.h src/parse-tree/pt-exp.cc src/parse-tree/pt-exp.h src/parse-tree/pt-fcn-handle.cc src/parse-tree/pt-fcn-handle.h src/parse-tree/pt-id.cc src/parse-tree/pt-id.h src/parse-tree/pt-idx.cc src/parse-tree/pt-idx.h src/parse-tree/pt-jump.cc src/parse-tree/pt-jump.h src/parse-tree/pt-loop.cc src/parse-tree/pt-loop.h src/parse-tree/pt-mat.cc src/parse-tree/pt-mat.h src/parse-tree/pt-misc.cc src/parse-tree/pt-misc.h src/parse-tree/pt-pr-code.cc src/parse-tree/pt-pr-code.h src/parse-tree/pt-select.cc src/parse-tree/pt-select.h src/parse-tree/pt-stmt.cc src/parse-tree/pt-stmt.h src/parse-tree/pt-unop.cc src/parse-tree/pt-unop.h src/parse-tree/pt-walk.h src/parse-tree/pt.cc src/parse-tree/pt.h src/pt-all.h src/pt-arg-list.cc src/pt-arg-list.h src/pt-assign.cc src/pt-assign.h src/pt-binop.cc src/pt-binop.h src/pt-bp.cc src/pt-bp.h src/pt-cbinop.cc src/pt-cbinop.h src/pt-cell.cc src/pt-cell.h src/pt-check.cc src/pt-check.h src/pt-cmd.cc src/pt-cmd.h src/pt-colon.cc src/pt-colon.h src/pt-const.cc src/pt-const.h src/pt-decl.cc src/pt-decl.h src/pt-eval.cc src/pt-eval.h src/pt-except.cc src/pt-except.h src/pt-exp.cc src/pt-exp.h src/pt-fcn-handle.cc src/pt-fcn-handle.h src/pt-id.cc src/pt-id.h src/pt-idx.cc src/pt-idx.h src/pt-jump.cc src/pt-jump.h src/pt-loop.cc src/pt-loop.h src/pt-mat.cc src/pt-mat.h src/pt-misc.cc src/pt-misc.h src/pt-pr-code.cc src/pt-pr-code.h src/pt-select.cc src/pt-select.h src/pt-stmt.cc src/pt-stmt.h src/pt-unop.cc src/pt-unop.h src/pt-walk.h src/pt.cc src/pt.h src/template-inst/Array-jit.cc src/template-inst/Array-os.cc src/template-inst/Array-sym.cc src/template-inst/Array-tc.cc src/template-inst/module.mk
diffstat 601 files changed, 74447 insertions(+), 74438 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.am	Mon Jul 30 13:05:29 2012 -0500
+++ b/src/Makefile.am	Mon Jul 30 15:29:19 2012 -0700
@@ -25,6 +25,8 @@
   -I../libgnu -I$(top_srcdir)/libgnu \
   -I$(top_srcdir)/libcruft/misc \
   -I../liboctave -I$(top_srcdir)/liboctave \
+  -Ioctave-value -I$(srcdir)/octave-value \
+  -Iparse-tree -I$(srcdir)/parse-tree \
   -Icorefcn -I$(srcdir)/corefcn \
   -I. -I$(srcdir) \
   @CPPFLAGS@
@@ -135,103 +137,6 @@
   ../liboctave/LSODE-opts.h \
   ../liboctave/Quad-opts.h
 
-OV_INTTYPE_INC = \
-  ov-base-int.h \
-  ov-base-int.cc \
-  ov-int-traits.h \
-  ov-int16.h \
-  ov-int32.h \
-  ov-int64.h \
-  ov-int8.h \
-  ov-intx.h \
-  ov-uint16.h \
-  ov-uint32.h \
-  ov-uint64.h \
-  ov-uint8.h
-
-OV_INCLUDES = \
-  ov-base-diag.h \
-  ov-base-diag.cc \
-  ov-base-mat.h \
-  ov-base-mat.cc \
-  ov-base-scalar.h \
-  ov-base-scalar.cc \
-  ov-base.h \
-  ov-bool-mat.h \
-  ov-bool-mat.cc \
-  ov-bool.h \
-  ov-builtin.h \
-  ov-cell.h \
-  ov-ch-mat.h \
-  ov-class.h \
-  ov-colon.h \
-  ov-complex.h \
-  ov-cs-list.h \
-  ov-cx-diag.h \
-  ov-cx-mat.h \
-  ov-dld-fcn.h \
-  ov-fcn-handle.h \
-  ov-fcn-inline.h \
-  ov-fcn.h \
-  ov-float.h \
-  ov-flt-complex.h \
-  ov-flt-cx-diag.h \
-  ov-flt-cx-mat.h \
-  ov-flt-re-diag.h \
-  ov-flt-re-mat.h \
-  ov-lazy-idx.h \
-  ov-mex-fcn.h \
-  ov-null-mat.h \
-  ov-oncleanup.h \
-  ov-perm.h \
-  ov-range.h \
-  ov-re-diag.h \
-  ov-re-mat.h \
-  ov-scalar.h \
-  ov-str-mat.h \
-  ov-struct.h \
-  ov-type-conv.h \
-  ov-typeinfo.h \
-  ov-usr-fcn.h \
-  ov.h \
-  $(OV_INTTYPE_INC)
-
-OV_SPARSE_INCLUDES = \
-  ov-base-sparse.h \
-  ov-bool-sparse.h \
-  ov-cx-sparse.h \
-  ov-re-sparse.h
-
-PT_INCLUDES = \
-  pt-all.h \
-  pt-arg-list.h \
-  pt-assign.h \
-  pt-binop.h \
-  pt-bp.h \
-  pt-cbinop.h \
-  pt-cell.h \
-  pt-check.h \
-  pt-cmd.h \
-  pt-colon.h \
-  pt-const.h \
-  pt-decl.h \
-  pt-eval.h \
-  pt-except.h \
-  pt-exp.h \
-  pt-fcn-handle.h \
-  pt-id.h \
-  pt-idx.h \
-  pt-jump.h \
-  pt-loop.h \
-  pt-mat.h \
-  pt-misc.h \
-  pt-pr-code.h \
-  pt-select.h \
-  pt-stmt.h \
-  pt-unop.h \
-  pt-walk.h \
-  pt.h
-
 JIT_INCLUDES = \
   jit-util.h \
   jit-typeinfo.h \
@@ -326,90 +231,6 @@
   mxarray.h \
   version.h
 
-OV_INTTYPE_SRC = \
-  ov-int16.cc \
-  ov-int32.cc \
-  ov-int64.cc \
-  ov-int8.cc \
-  ov-uint16.cc \
-  ov-uint32.cc \
-  ov-uint64.cc \
-  ov-uint8.cc
-
-OV_SPARSE_SRC = \
-  ov-base-sparse.cc \
-  ov-bool-sparse.cc \
-  ov-cx-sparse.cc \
-  ov-re-sparse.cc
-
-OV_SRC = \
-  ov-base.cc \
-  ov-bool-mat.cc \
-  ov-bool.cc \
-  ov-builtin.cc \
-  ov-cell.cc \
-  ov-ch-mat.cc \
-  ov-class.cc \
-  ov-colon.cc \
-  ov-complex.cc \
-  ov-cs-list.cc \
-  ov-cx-diag.cc \
-  ov-cx-mat.cc \
-  ov-dld-fcn.cc \
-  ov-fcn-handle.cc \
-  ov-fcn-inline.cc \
-  ov-fcn.cc \
-  ov-float.cc \
-  ov-flt-complex.cc \
-  ov-flt-cx-diag.cc \
-  ov-flt-cx-mat.cc \
-  ov-flt-re-diag.cc \
-  ov-flt-re-mat.cc \
-  ov-lazy-idx.cc \
-  ov-mex-fcn.cc \
-  ov-null-mat.cc \
-  ov-oncleanup.cc \
-  ov-perm.cc \
-  ov-range.cc \
-  ov-re-diag.cc \
-  ov-re-mat.cc \
-  ov-scalar.cc \
-  ov-str-mat.cc \
-  ov-struct.cc \
-  ov-typeinfo.cc \
-  ov-usr-fcn.cc \
-  ov.cc \
-  $(OV_INTTYPE_SRC) \
-  $(OV_SPARSE_SRC)
-
-PT_SRC = \
-  pt-arg-list.cc \
-  pt-assign.cc \
-  pt-binop.cc \
-  pt-bp.cc \
-  pt-cbinop.cc \
-  pt-cell.cc \
-  pt-check.cc \
-  pt-cmd.cc \
-  pt-colon.cc \
-  pt-const.cc \
-  pt-decl.cc \
-  pt-eval.cc \
-  pt-except.cc \
-  pt-exp.cc \
-  pt-fcn-handle.cc \
-  pt-id.cc \
-  pt-idx.cc \
-  pt-jump.cc \
-  pt-loop.cc \
-  pt-mat.cc \
-  pt-misc.cc \
-  pt-pr-code.cc \
-  pt-select.cc \
-  pt-stmt.cc \
-  pt-unop.cc \
-  pt.cc
-
 JIT_SRC = \
   jit-util.cc \
   jit-typeinfo.cc \
@@ -487,22 +308,23 @@
   xnorm.cc \
   xpow.cc \
   zfstream.cc \
-  $(corefcn_SRC) \
-  $(OV_SRC) \
-  $(PT_SRC) \
+  $(COREFCN_SRC) \
+  $(OCTAVE_VALUE_SRC) \
+  $(PARSE_TREE_SRC) \
   $(JIT_SRC)
 
 noinst_LTLIBRARIES =
 
+include parse-tree/module.mk
+include octave-value/module.mk
+include operators/module.mk
+include template-inst/module.mk
 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
 	$(srcdir)/DLD-FUNCTIONS/config-module.sh $(top_srcdir)
 
-include OPERATORS/module.mk
-include TEMPLATE-INST/module.mk
-
 if AMCOND_ENABLE_DYNAMIC_LINKING
   OCT_FILES = $(DLD_FUNCTIONS_LIBS:.la=.oct)
   OCT_STAMP_FILES = $(subst DLD-FUNCTIONS/,DLD-FUNCTIONS/$(am__leading_dot),$(DLD_FUNCTIONS_LIBS:.la=.oct-stamp))
--- a/src/OPERATORS/module.mk	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-EXTRA_DIST += OPERATORS/module.mk
-
-OPERATORS_SRC = \
-  OPERATORS/op-b-b.cc \
-  OPERATORS/op-b-bm.cc \
-  OPERATORS/op-b-sbm.cc \
-  OPERATORS/op-bm-b.cc \
-  OPERATORS/op-bm-bm.cc \
-  OPERATORS/op-bm-sbm.cc \
-  OPERATORS/op-cdm-cdm.cc \
-  OPERATORS/op-cdm-cm.cc \
-  OPERATORS/op-cdm-cs.cc \
-  OPERATORS/op-cdm-dm.cc \
-  OPERATORS/op-cdm-m.cc \
-  OPERATORS/op-cdm-s.cc \
-  OPERATORS/op-cell.cc \
-  OPERATORS/op-chm.cc \
-  OPERATORS/op-class.cc \
-  OPERATORS/op-cm-cdm.cc \
-  OPERATORS/op-cm-cm.cc \
-  OPERATORS/op-cm-cs.cc \
-  OPERATORS/op-cm-dm.cc \
-  OPERATORS/op-cm-m.cc \
-  OPERATORS/op-cm-pm.cc \
-  OPERATORS/op-cm-s.cc \
-  OPERATORS/op-cm-scm.cc \
-  OPERATORS/op-cm-sm.cc \
-  OPERATORS/op-cs-cm.cc \
-  OPERATORS/op-cs-cs.cc \
-  OPERATORS/op-cs-m.cc \
-  OPERATORS/op-cs-s.cc \
-  OPERATORS/op-cs-scm.cc \
-  OPERATORS/op-cs-sm.cc \
-  OPERATORS/op-dm-cdm.cc \
-  OPERATORS/op-dm-cm.cc \
-  OPERATORS/op-dm-cs.cc \
-  OPERATORS/op-dm-dm.cc \
-  OPERATORS/op-dm-m.cc \
-  OPERATORS/op-dm-s.cc \
-  OPERATORS/op-dm-scm.cc \
-  OPERATORS/op-dm-sm.cc \
-  OPERATORS/op-double-conv.cc \
-  OPERATORS/op-fcdm-fcdm.cc \
-  OPERATORS/op-fcdm-fcm.cc \
-  OPERATORS/op-fcdm-fcs.cc \
-  OPERATORS/op-fcdm-fdm.cc \
-  OPERATORS/op-fcdm-fm.cc \
-  OPERATORS/op-fcdm-fs.cc \
-  OPERATORS/op-fcm-fcdm.cc \
-  OPERATORS/op-fcm-fcm.cc \
-  OPERATORS/op-fcm-fcs.cc \
-  OPERATORS/op-fcm-fdm.cc \
-  OPERATORS/op-fcm-fm.cc \
-  OPERATORS/op-fcm-fs.cc \
-  OPERATORS/op-fcm-pm.cc \
-  OPERATORS/op-fcn.cc \
-  OPERATORS/op-fcs-fcm.cc \
-  OPERATORS/op-fcs-fcs.cc \
-  OPERATORS/op-fcs-fm.cc \
-  OPERATORS/op-fcs-fs.cc \
-  OPERATORS/op-fdm-fcdm.cc \
-  OPERATORS/op-fdm-fcm.cc \
-  OPERATORS/op-fdm-fcs.cc \
-  OPERATORS/op-fdm-fdm.cc \
-  OPERATORS/op-fdm-fm.cc \
-  OPERATORS/op-fdm-fs.cc \
-  OPERATORS/op-float-conv.cc \
-  OPERATORS/op-fm-fcdm.cc \
-  OPERATORS/op-fm-fcm.cc \
-  OPERATORS/op-fm-fcs.cc \
-  OPERATORS/op-fm-fdm.cc \
-  OPERATORS/op-fm-fm.cc \
-  OPERATORS/op-fm-fs.cc \
-  OPERATORS/op-fm-pm.cc \
-  OPERATORS/op-fs-fcm.cc \
-  OPERATORS/op-fs-fcs.cc \
-  OPERATORS/op-fs-fm.cc \
-  OPERATORS/op-fs-fs.cc \
-  OPERATORS/op-i16-i16.cc \
-  OPERATORS/op-i32-i32.cc \
-  OPERATORS/op-i64-i64.cc \
-  OPERATORS/op-i8-i8.cc \
-  OPERATORS/op-int-concat.cc \
-  OPERATORS/op-int-conv.cc \
-  OPERATORS/op-m-cdm.cc \
-  OPERATORS/op-m-cm.cc \
-  OPERATORS/op-m-cs.cc \
-  OPERATORS/op-m-dm.cc \
-  OPERATORS/op-m-m.cc \
-  OPERATORS/op-m-pm.cc \
-  OPERATORS/op-m-s.cc \
-  OPERATORS/op-m-scm.cc \
-  OPERATORS/op-m-sm.cc \
-  OPERATORS/op-pm-cm.cc \
-  OPERATORS/op-pm-fcm.cc \
-  OPERATORS/op-pm-fm.cc \
-  OPERATORS/op-pm-m.cc \
-  OPERATORS/op-pm-pm.cc \
-  OPERATORS/op-pm-scm.cc \
-  OPERATORS/op-pm-sm.cc \
-  OPERATORS/op-range.cc \
-  OPERATORS/op-s-cm.cc \
-  OPERATORS/op-s-cs.cc \
-  OPERATORS/op-s-m.cc \
-  OPERATORS/op-s-s.cc \
-  OPERATORS/op-s-scm.cc \
-  OPERATORS/op-s-sm.cc \
-  OPERATORS/op-sbm-b.cc \
-  OPERATORS/op-sbm-bm.cc \
-  OPERATORS/op-sbm-sbm.cc \
-  OPERATORS/op-scm-cm.cc \
-  OPERATORS/op-scm-cs.cc \
-  OPERATORS/op-scm-m.cc \
-  OPERATORS/op-scm-s.cc \
-  OPERATORS/op-scm-scm.cc \
-  OPERATORS/op-scm-sm.cc \
-  OPERATORS/op-sm-cm.cc \
-  OPERATORS/op-sm-cs.cc \
-  OPERATORS/op-sm-m.cc \
-  OPERATORS/op-sm-s.cc \
-  OPERATORS/op-sm-scm.cc \
-  OPERATORS/op-sm-sm.cc \
-  OPERATORS/op-str-m.cc \
-  OPERATORS/op-str-s.cc \
-  OPERATORS/op-str-str.cc \
-  OPERATORS/op-struct.cc \
-  OPERATORS/op-ui16-ui16.cc \
-  OPERATORS/op-ui32-ui32.cc \
-  OPERATORS/op-ui64-ui64.cc \
-  OPERATORS/op-ui8-ui8.cc
-
-octinclude_HEADERS += \
-  OPERATORS/op-dm-template.cc \
-  OPERATORS/op-dms-template.cc \
-  OPERATORS/op-int.h \
-  OPERATORS/op-pm-template.cc
--- a/src/OPERATORS/op-b-b.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// bool unary ops.
-
-// scalar unary ops.
-
-DEFUNOP_OP (not, bool, !)
-
-UNOPDECL (uplus, a)
-{
-  CAST_UNOP_ARG (const octave_bool&);
-  return octave_value (v.double_value ());
-}
-
-UNOPDECL (uminus, a)
-{
-  CAST_UNOP_ARG (const octave_bool&);
-  return octave_value (- v.double_value ());
-}
-
-DEFUNOP_OP (transpose, bool, /* no-op */)
-DEFUNOP_OP (hermitian, bool, /* no-op */)
-
-// bool by bool ops.
-
-DEFBINOP_OP (eq, bool, bool, ==)
-DEFBINOP_OP (ne, bool, bool, !=)
-DEFBINOP_OP (el_and, bool, bool, &&)
-DEFBINOP_OP (el_or, bool, bool, ||)
-
-DEFNDCATOP_FN (b_b, bool, bool, bool_array, bool_array, concat)
-DEFNDCATOP_FN (b_s, bool, scalar, array, array, concat)
-DEFNDCATOP_FN (s_b, scalar, bool, array, array, concat)
-DEFNDCATOP_FN (b_f, bool, float_scalar, float_array, float_array, concat)
-DEFNDCATOP_FN (f_b, float_scalar, bool, float_array, float_array, concat)
-
-void
-install_b_b_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_bool, not);
-  INSTALL_UNOP (op_uplus, octave_bool, uplus);
-  INSTALL_UNOP (op_uminus, octave_bool, uminus);
-  INSTALL_UNOP (op_transpose, octave_bool, transpose);
-  INSTALL_UNOP (op_hermitian, octave_bool, hermitian);
-
-  INSTALL_BINOP (op_eq, octave_bool, octave_bool, eq);
-  INSTALL_BINOP (op_ne, octave_bool, octave_bool, ne);
-  INSTALL_BINOP (op_el_and, octave_bool, octave_bool, el_and);
-  INSTALL_BINOP (op_el_or, octave_bool, octave_bool, el_or);
-
-  INSTALL_CATOP (octave_bool, octave_bool, b_b);
-  INSTALL_CATOP (octave_bool, octave_scalar, b_s);
-  INSTALL_CATOP (octave_scalar, octave_bool, s_b);
-  INSTALL_CATOP (octave_bool, octave_float_scalar, b_f);
-  INSTALL_CATOP (octave_float_scalar, octave_bool, f_b);
-
-  INSTALL_ASSIGNCONV (octave_bool, octave_bool, octave_bool_matrix);
-}
--- a/src/OPERATORS/op-b-bm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-
-Copyright (C) 2003-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// bool matrix by bool ops.
-
-DEFNDBINOP_FN (el_and, bool, bool_matrix, bool, bool_array, mx_el_and)
-DEFNDBINOP_FN (el_or, bool, bool_matrix, bool, bool_array, mx_el_or)
-
-DEFNDBINOP_FN (el_and_not, bool, bool_matrix, bool, bool_array, mx_el_and_not)
-DEFNDBINOP_FN (el_or_not, bool, bool_matrix, bool, bool_array, mx_el_or_not)
-
-DEFNDCATOP_FN (b_bm, bool, bool_matrix, bool_array, bool_array, concat)
-DEFNDCATOP_FN (b_m, bool, matrix, array, array, concat)
-DEFNDCATOP_FN (s_bm, scalar, bool_matrix, array, array, concat)
-
-DEFNDCATOP_FN (b_fm, bool, float_matrix, float_array, float_array, concat)
-DEFNDCATOP_FN (f_bm, float_scalar, bool_matrix, float_array, float_array, concat)
-
-DEFCONV (bool_matrix_conv, bool, bool_matrix)
-{
-  CAST_CONV_ARG (const octave_bool&);
-
-  return new octave_bool_matrix (v.bool_matrix_value ());
-}
-
-void
-install_b_bm_ops (void)
-{
-  INSTALL_BINOP (op_el_and, octave_bool, octave_bool_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_bool, octave_bool_matrix, el_or);
-  INSTALL_BINOP (op_el_and_not, octave_bool, octave_bool_matrix, el_and_not);
-  INSTALL_BINOP (op_el_or_not, octave_bool, octave_bool_matrix, el_or_not);
-
-  INSTALL_CATOP (octave_bool, octave_bool_matrix, b_bm);
-  INSTALL_CATOP (octave_bool, octave_matrix, b_m);
-  INSTALL_CATOP (octave_scalar, octave_bool_matrix, s_bm);
-  INSTALL_CATOP (octave_bool, octave_float_matrix, b_fm);
-  INSTALL_CATOP (octave_float_scalar, octave_bool_matrix, f_bm);
-
-  INSTALL_ASSIGNCONV (octave_bool, octave_bool_matrix, octave_bool_matrix);
-
-  INSTALL_WIDENOP (octave_bool, octave_bool_matrix, bool_matrix_conv);
-}
--- a/src/OPERATORS/op-b-sbm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ops.h"
-
-#include "ov-re-sparse.h"
-#include "ov-bool-sparse.h"
-
-// bool by sparse bool matrix ops.
-
-DEFBINOP_FN (ne, bool, sparse_bool_matrix, mx_el_ne)
-DEFBINOP_FN (eq, bool, sparse_bool_matrix, mx_el_eq)
-
-DEFBINOP_FN (el_and, bool, sparse_bool_matrix, mx_el_and)
-DEFBINOP_FN (el_or, bool, sparse_bool_matrix, mx_el_or)
-
-DEFCATOP (b_sbm, bool, sparse_bool_matrix)
-{
-  CAST_BINOP_ARGS (octave_bool&, const octave_sparse_bool_matrix&);
-  SparseBoolMatrix tmp (1, 1, v1.bool_value ());
-  return octave_value (tmp. concat (v2.sparse_bool_matrix_value (),
-                                    ra_idx));
-}
-
-DEFCATOP (b_sm, bool, sparse_matrix)
-{
-  CAST_BINOP_ARGS (octave_bool&, const octave_sparse_matrix&);
-  SparseMatrix tmp (1, 1, v1.scalar_value ());
-  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
-}
-
-DEFCATOP (s_sbm, scalar, sparse_bool_matrix)
-{
-  CAST_BINOP_ARGS (octave_scalar&, const octave_sparse_bool_matrix&);
-  SparseMatrix tmp (1, 1, v1.scalar_value ());
-  return octave_value(tmp. concat (v2.sparse_matrix_value (), ra_idx));
-}
-
-DEFCONV (sparse_bool_matrix_conv, bool, sparse_bool_matrix)
-{
-  CAST_CONV_ARG (const octave_bool&);
-
-  return new octave_sparse_bool_matrix
-    (SparseBoolMatrix (1, 1, v.bool_value ()));
-}
-
-void
-install_b_sbm_ops (void)
-{
-  INSTALL_BINOP (op_eq, octave_bool, octave_sparse_bool_matrix, eq);
-  INSTALL_BINOP (op_ne, octave_bool, octave_sparse_bool_matrix, ne);
-
-  INSTALL_BINOP (op_el_and, octave_bool, octave_sparse_bool_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_bool, octave_sparse_bool_matrix, el_or);
-
-  INSTALL_CATOP (octave_bool, octave_sparse_bool_matrix, b_sbm);
-  INSTALL_CATOP (octave_bool, octave_sparse_matrix, b_sm);
-  INSTALL_CATOP (octave_scalar, octave_sparse_bool_matrix, s_sbm);
-
-  INSTALL_ASSIGNCONV (octave_bool, octave_sparse_bool_matrix,
-                      octave_bool_matrix);
-
-  INSTALL_WIDENOP (octave_bool, octave_sparse_bool_matrix, sparse_bool_matrix_conv);
-}
--- a/src/OPERATORS/op-bm-b.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-
-Copyright (C) 2001-2012 Cai Jianming
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-str-mat.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// bool matrix by bool ops.
-
-DEFNDBINOP_FN (el_and, bool_matrix, bool, bool_array, bool, mx_el_and)
-DEFNDBINOP_FN (el_or, bool_matrix, bool, bool_array, bool, mx_el_or)
-
-DEFNDBINOP_FN (el_not_and, bool_matrix, bool, bool_array, bool, mx_el_not_and)
-DEFNDBINOP_FN (el_not_or, bool_matrix, bool, bool_array, bool, mx_el_not_or)
-
-DEFNDCATOP_FN (bm_b, bool_matrix, bool, bool_array, bool_array, concat)
-DEFNDCATOP_FN (bm_s, bool_matrix, scalar, array, array, concat)
-DEFNDCATOP_FN (m_b, matrix, bool, array, array, concat)
-DEFNDCATOP_FN (bm_f, bool_matrix, float_scalar, float_array, float_array, concat)
-DEFNDCATOP_FN (fm_b, float_matrix, bool, float_array, float_array, concat)
-
-DEFNDASSIGNOP_FN (assign, bool_matrix, bool, bool_array, assign)
-
-static octave_value
-oct_assignop_conv_and_assign (octave_base_value& a1,
-                              const octave_value_list& idx,
-                              const octave_base_value& a2)
-{
-  octave_bool_matrix& v1 = dynamic_cast<octave_bool_matrix&> (a1);
-
-  // FIXME -- perhaps add a warning for this conversion if the values
-  // are not all 0 or 1?
-
-  boolNDArray v2 = a2.bool_array_value (true);
-
-  if (! error_state)
-    v1.assign (idx, v2);
-
-  return octave_value ();
-}
-
-void
-install_bm_b_ops (void)
-{
-  INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool, el_and);
-  INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool, el_or);
-  INSTALL_BINOP (op_el_not_and, octave_bool_matrix, octave_bool, el_not_and);
-  INSTALL_BINOP (op_el_not_or, octave_bool_matrix, octave_bool, el_not_or);
-
-  INSTALL_CATOP (octave_bool_matrix, octave_bool, bm_b);
-  INSTALL_CATOP (octave_bool_matrix, octave_scalar, bm_s);
-  INSTALL_CATOP (octave_matrix, octave_bool, m_b);
-  INSTALL_CATOP (octave_bool_matrix, octave_float_scalar, bm_f);
-  INSTALL_CATOP (octave_float_matrix, octave_bool, fm_b);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool, assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_scalar, conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int8_scalar, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int16_scalar, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int32_scalar, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int64_scalar, conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint8_scalar, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint16_scalar, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint32_scalar, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint64_scalar, conv_and_assign);
-}
--- a/src/OPERATORS/op-bm-bm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ov-range.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-re-sparse.h"
-#include "ov-str-mat.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// unary bool matrix ops.
-
-DEFNDUNOP_OP (not, bool_matrix, bool_array, !)
-DEFNDUNOP_OP (uplus, bool_matrix, array, +)
-DEFNDUNOP_OP (uminus, bool_matrix, array, -)
-
-DEFNCUNOP_METHOD (invert, bool_matrix, invert)
-
-DEFUNOP (transpose, bool_matrix)
-{
-  CAST_UNOP_ARG (const octave_bool_matrix&);
-
-  if (v.ndims () > 2)
-    {
-      error ("transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.bool_matrix_value ().transpose ());
-}
-
-// bool matrix by bool matrix ops.
-
-DEFNDBINOP_FN (eq, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_eq)
-DEFNDBINOP_FN (ne, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_ne)
-
-DEFNDBINOP_FN (el_and, bool_matrix, bool_matrix, bool_array, bool_array,
-               mx_el_and)
-
-DEFNDBINOP_FN (el_or,  bool_matrix, bool_matrix, bool_array, bool_array,
-               mx_el_or)
-
-DEFNDBINOP_FN (el_not_and, bool_matrix, bool_matrix, bool_array, bool_array,
-               mx_el_not_and)
-
-DEFNDBINOP_FN (el_not_or,  bool_matrix, bool_matrix, bool_array, bool_array,
-               mx_el_not_or)
-
-DEFNDBINOP_FN (el_and_not, bool_matrix, bool_matrix, bool_array, bool_array,
-               mx_el_and_not)
-
-DEFNDBINOP_FN (el_or_not,  bool_matrix, bool_matrix, bool_array, bool_array,
-               mx_el_or_not)
-
-DEFNDCATOP_FN (bm_bm, bool_matrix, bool_matrix, bool_array, bool_array, concat)
-DEFNDCATOP_FN (bm_m, bool_matrix, matrix, array, array, concat)
-DEFNDCATOP_FN (m_bm, matrix, bool_matrix, array, array, concat)
-DEFNDCATOP_FN (bm_fm, bool_matrix, float_matrix, float_array, float_array, concat)
-DEFNDCATOP_FN (fm_bm, float_matrix, bool_matrix, float_array, float_array, concat)
-
-DEFNDASSIGNOP_FN (assign, bool_matrix, bool_matrix, bool_array, assign)
-DEFNDASSIGNOP_FNOP (assign_and, bool_matrix, bool_matrix, bool_array, mx_el_and_assign)
-DEFNDASSIGNOP_FNOP (assign_or, bool_matrix, bool_matrix, bool_array, mx_el_or_assign)
-
-DEFNULLASSIGNOP_FN (null_assign, bool_matrix, delete_elements)
-
-static octave_value
-oct_assignop_conv_and_assign (octave_base_value& a1,
-                              const octave_value_list& idx,
-                              const octave_base_value& a2)
-{
-  octave_bool_matrix& v1 = dynamic_cast<octave_bool_matrix&> (a1);
-
-  // FIXME -- perhaps add a warning for this conversion if the values
-  // are not all 0 or 1?
-
-  boolNDArray v2 = a2.bool_array_value (true);
-
-  if (! error_state)
-    v1.assign (idx, v2);
-
-  return octave_value ();
-}
-
-DEFCONVFN (matrix_to_bool_matrix, matrix, bool)
-DEFCONVFN (scalar_to_bool_matrix, scalar, bool)
-
-void
-install_bm_bm_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_bool_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_bool_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_bool_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_bool_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_bool_matrix, transpose);
-
-  INSTALL_NCUNOP (op_not, octave_bool_matrix, invert);
-
-  INSTALL_BINOP (op_eq, octave_bool_matrix, octave_bool_matrix, eq);
-  INSTALL_BINOP (op_ne, octave_bool_matrix, octave_bool_matrix, ne);
-
-  INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool_matrix, el_or);
-  INSTALL_BINOP (op_el_not_and, octave_bool_matrix, octave_bool_matrix, el_not_and);
-  INSTALL_BINOP (op_el_not_or, octave_bool_matrix, octave_bool_matrix, el_not_or);
-  INSTALL_BINOP (op_el_and_not, octave_bool_matrix, octave_bool_matrix, el_and_not);
-  INSTALL_BINOP (op_el_or_not, octave_bool_matrix, octave_bool_matrix, el_or_not);
-
-  INSTALL_CATOP (octave_bool_matrix, octave_bool_matrix, bm_bm);
-  INSTALL_CATOP (octave_bool_matrix, octave_matrix, bm_m);
-  INSTALL_CATOP (octave_matrix, octave_bool_matrix, m_bm);
-  INSTALL_CATOP (octave_bool_matrix, octave_float_matrix, bm_fm);
-  INSTALL_CATOP (octave_float_matrix, octave_bool_matrix, fm_bm);
-
-  INSTALL_CONVOP (octave_matrix, octave_bool_matrix, matrix_to_bool_matrix);
-  INSTALL_CONVOP (octave_scalar, octave_bool_matrix, scalar_to_bool_matrix);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool_matrix, assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_matrix, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_char_matrix_str, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_char_matrix_sq_str, conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_range, conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_sparse_matrix, conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int8_matrix, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int16_matrix, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int32_matrix, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int64_matrix, conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint8_matrix, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint16_matrix, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint32_matrix, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint64_matrix, conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_sq_str, null_assign);
-
-  INSTALL_ASSIGNOP (op_el_and_eq, octave_bool_matrix, octave_bool_matrix, assign_and);
-  INSTALL_ASSIGNOP (op_el_or_eq, octave_bool_matrix, octave_bool_matrix, assign_or);
-}
--- a/src/OPERATORS/op-bm-sbm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-bool-mat.h"
-#include "boolMatrix.h"
-#include "ov-scalar.h"
-#include "ops.h"
-
-#include "ov-re-sparse.h"
-#include "ov-bool-sparse.h"
-#include "smx-bm-sbm.h"
-#include "smx-sbm-bm.h"
-
-// bool matrix by sparse bool matrix ops.
-
-DEFBINOP_FN (eq, bool_matrix, sparse_bool_matrix, mx_el_eq)
-DEFBINOP_FN (ne, bool_matrix, sparse_bool_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_and, bool_matrix, sparse_bool_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  bool_matrix, sparse_bool_matrix, mx_el_or)
-
-DEFCATOP (bm_sbm, bool_matrix, sparse_bool_matrix)
-{
-  CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_bool_matrix&);
-  SparseBoolMatrix tmp (v1.bool_matrix_value ());
-  return octave_value (tmp. concat (v2.sparse_bool_matrix_value (),
-                                    ra_idx));
-}
-
-DEFCATOP (m_sbm, matrix, sparse_bool_matrix)
-{
-  CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_bool_matrix&);
-  SparseMatrix tmp (v1.matrix_value ());
-  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
-}
-
-DEFCATOP (bm_sm, bool_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_matrix&);
-  SparseMatrix tmp (v1.matrix_value ());
-  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
-}
-
-DEFCONV (sparse_bool_matrix_conv, bool_matrix, sparse_bool_matrix)
-{
-  CAST_CONV_ARG (const octave_bool_matrix&);
-  return new octave_sparse_bool_matrix
-    (SparseBoolMatrix (v.bool_matrix_value ()));
-}
-
-DEFNDASSIGNOP_FN (assign, bool_matrix, sparse_bool_matrix, bool_array, assign)
-
-void
-install_bm_sbm_ops (void)
-{
-  INSTALL_BINOP (op_eq, octave_bool_matrix, octave_sparse_bool_matrix, eq);
-  INSTALL_BINOP (op_ne, octave_bool_matrix, octave_sparse_bool_matrix, ne);
-
-  INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_sparse_bool_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_sparse_bool_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_bool_matrix, octave_sparse_bool_matrix, bm_sbm);
-  INSTALL_CATOP (octave_bool_matrix, octave_sparse_matrix, bm_sm);
-  INSTALL_CATOP (octave_matrix, octave_sparse_bool_matrix, m_sbm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_sparse_bool_matrix,
-                    assign)
-  INSTALL_ASSIGNCONV (octave_bool_matrix, octave_sparse_bool_matrix,
-                      octave_bool_matrix);
-
-  INSTALL_WIDENOP (octave_bool_matrix, octave_sparse_bool_matrix,
-                   sparse_bool_matrix_conv);
-}
--- a/src/OPERATORS/op-cdm-cdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-cx-diag.h"
-#include "ov-flt-cx-diag.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix unary ops.
-
-DEFUNOP_OP (uplus, complex_diag_matrix, /* no-op */)
-DEFUNOP_OP (uminus, complex_diag_matrix, -)
-
-DEFUNOP (transpose, complex_diag_matrix)
-{
-  CAST_UNOP_ARG (const octave_complex_diag_matrix&);
-  return octave_value (v.complex_diag_matrix_value ().transpose ());
-}
-
-DEFUNOP (hermitian, complex_diag_matrix)
-{
-  CAST_UNOP_ARG (const octave_complex_diag_matrix&);
-  return octave_value (v.complex_diag_matrix_value ().hermitian ());
-}
-
-// matrix by matrix ops.
-
-DEFBINOP_OP (add, complex_diag_matrix, complex_diag_matrix, +)
-DEFBINOP_OP (sub, complex_diag_matrix, complex_diag_matrix, -)
-DEFBINOP_OP (mul, complex_diag_matrix, complex_diag_matrix, *)
-
-DEFBINOP (div, complex_diag_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_complex_diag_matrix&);
-
-  return xdiv (v1.complex_diag_matrix_value (),
-               v2.complex_diag_matrix_value ());
-}
-
-DEFBINOP (ldiv, complex_diag_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_complex_diag_matrix&);
-
-  return xleftdiv (v1.complex_diag_matrix_value (),
-                   v2.complex_diag_matrix_value ());
-}
-
-CONVDECL (complex_diag_matrix_to_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_complex_diag_matrix&);
-
-  return new octave_complex_matrix (v.complex_matrix_value ());
-}
-
-CONVDECL (complex_diag_matrix_to_float_complex_diag_matrix)
-{
-  CAST_CONV_ARG (const octave_complex_diag_matrix&);
-
-  return new octave_float_complex_diag_matrix (v.float_complex_diag_matrix_value ());
-}
-
-void
-install_cdm_cdm_ops (void)
-{
-  INSTALL_UNOP (op_uplus, octave_complex_diag_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_complex_diag_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_complex_diag_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_complex_diag_matrix, hermitian);
-
-  INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_complex_diag_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_complex_diag_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_complex_diag_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex_diag_matrix, octave_complex_diag_matrix, div);
-  INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_complex_diag_matrix, ldiv);
-
-  INSTALL_CONVOP (octave_complex_diag_matrix, octave_complex_matrix, complex_diag_matrix_to_complex_matrix);
-  INSTALL_CONVOP (octave_complex_diag_matrix, octave_float_complex_diag_matrix,
-                  complex_diag_matrix_to_float_complex_diag_matrix);
-  INSTALL_ASSIGNCONV (octave_complex_diag_matrix, octave_complex_matrix, octave_complex_matrix);
-  INSTALL_WIDENOP (octave_complex_diag_matrix, octave_complex_matrix, complex_diag_matrix_to_complex_matrix);
-}
--- a/src/OPERATORS/op-cdm-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-cx-diag.h"
-#define RINCLUDE "ov-cx-mat.h"
-
-#define LMATRIX complex_diag_matrix
-#define RMATRIX complex_matrix
-
-#define LSHORT cdm
-#define RSHORT cm
-
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-cdm-cs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 SINCLUDE "ov-complex.h"
-#define MINCLUDE "ov-cx-diag.h"
-
-#define SCALAR complex
-#define MATRIX complex_diag_matrix
-
-#define SSHORT cs
-#define MSHORT cdm
-
-#include "op-dms-template.cc"
-
--- a/src/OPERATORS/op-cdm-dm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-cx-diag.h"
-#define RINCLUDE "ov-re-diag.h"
-
-#define LMATRIX complex_diag_matrix
-#define RMATRIX diag_matrix
-#define RDMATRIX LMATRIX
-
-#define LSHORT cdm
-#define RSHORT dm
-
-#define DEFINEDIV
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-cdm-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-cx-diag.h"
-#define RINCLUDE "ov-re-mat.h"
-
-#define LMATRIX complex_diag_matrix
-#define LDMATRIX complex_matrix
-#define RMATRIX matrix
-#define RDMATRIX complex_matrix
-
-#define LSHORT cdm
-#define RSHORT m
-
-#define DEFINELDIV
-#define DEFINENULLASSIGNCONV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-cdm-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 SINCLUDE "ov-scalar.h"
-#define MINCLUDE "ov-cx-diag.h"
-
-#define SCALAR scalar
-#define SCALARV complex
-#define MATRIX complex_diag_matrix
-
-#define SSHORT s
-#define MSHORT cdm
-
-#include "op-dms-template.cc"
-
--- a/src/OPERATORS/op-cell.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cell.h"
-#include "ov-scalar.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-
-// cell ops.
-
-DEFUNOP (transpose, cell)
-{
-  CAST_UNOP_ARG (const octave_cell&);
-
-  if (v.ndims () > 2)
-    {
-      error ("transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (Cell (v.cell_value ().transpose ()));
-}
-
-DEFCATOP_FN (c_c, cell, cell, concat)
-
-DEFASSIGNANYOP_FN (assign, cell, assign);
-
-DEFNULLASSIGNOP_FN (null_assign, cell, delete_elements)
-
-void
-install_cell_ops (void)
-{
-  INSTALL_UNOP (op_transpose, octave_cell, transpose);
-  INSTALL_UNOP (op_hermitian, octave_cell, transpose);
-
-  INSTALL_CATOP (octave_cell, octave_cell, c_c);
-
-  INSTALL_ASSIGNANYOP (op_asn_eq, octave_cell, assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_cell, octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_cell, octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_cell, octave_null_sq_str, null_assign);
-}
--- a/src/OPERATORS/op-chm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-ch-mat.h"
-#include "ov-scalar.h"
-#include "ov-re-mat.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-// char matrix unary ops.
-
-DEFUNOP (transpose, char_matrix)
-{
-  CAST_UNOP_ARG (const octave_char_matrix&);
-
-  return octave_value (v.matrix_value ().transpose ());
-}
-
-DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array,
-               concat)
-
-DEFCATOP (chm_s, char_matrix, scalar)
-{
-  CAST_BINOP_ARGS (octave_char_matrix&, const octave_scalar&);
-
-  gripe_implicit_conversion ("Octave:num-to-str",
-                             v2.type_name (), v1.type_name ());
-
-  return octave_value (v1.char_array_value (). concat(v2.array_value (),
-                               ra_idx));
-}
-
-DEFCATOP (chm_m, char_matrix, matrix)
-{
-  CAST_BINOP_ARGS (octave_char_matrix&, const octave_matrix&);
-
-  gripe_implicit_conversion ("Octave:num-to-str",
-                             v2.type_name (), v1.type_name ());
-
-  return octave_value (v1.char_array_value (). concat (v2.array_value (),
-                               ra_idx));
-}
-
-DEFCATOP (s_chm, scalar, char_matrix)
-{
-  CAST_BINOP_ARGS (octave_scalar&, const octave_char_matrix&);
-
-  gripe_implicit_conversion ("Octave:num-to-str",
-                             v1.type_name (), v2.type_name ());
-
-  return octave_value (v1.array_value (). concat (v2.char_array_value (),
-                               ra_idx));
-}
-
-DEFCATOP (m_chm, matrix, char_matrix)
-{
-  CAST_BINOP_ARGS (octave_matrix&, const octave_char_matrix&);
-
-  gripe_implicit_conversion ("Octave:num-to-str",
-                             v1.type_name (), v2.type_name ());
-
-  return octave_value (v1.array_value (). concat (v2.char_array_value (),
-                               ra_idx));
-}
-
-void
-install_chm_ops (void)
-{
-  INSTALL_UNOP (op_transpose, octave_char_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_char_matrix, transpose);
-
-  INSTALL_CATOP (octave_char_matrix, octave_char_matrix, chm_chm);
-  INSTALL_CATOP (octave_char_matrix, octave_scalar, chm_s);
-  INSTALL_CATOP (octave_char_matrix, octave_matrix, chm_m);
-  INSTALL_CATOP (octave_scalar, octave_char_matrix, s_chm);
-  INSTALL_CATOP (octave_matrix, octave_char_matrix, m_chm);
-}
--- a/src/OPERATORS/op-class.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
-
-Copyright (C) 2007-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "oct-time.h"
-
-#include "gripes.h"
-#include "load-path.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-class.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "symtab.h"
-#include "parse.h"
-
-// class ops.
-
-#define DEF_CLASS_UNOP(name) \
-  static octave_value \
-  oct_unop_ ## name (const octave_value& a) \
-  { \
-    octave_value retval; \
- \
-    std::string class_name = a.class_name (); \
- \
-    octave_value meth = symbol_table::find_method (#name, class_name); \
- \
-    if (meth.is_defined ()) \
-      { \
-        octave_value_list args; \
- \
-        args(0) = a; \
- \
-        octave_value_list tmp = feval (meth.function_value (), args, 1); \
- \
-        if (tmp.length () > 0) \
-          retval = tmp(0); \
-      } \
-    else \
-      error ("%s method not defined for %s class", \
-             #name, class_name.c_str ()); \
- \
-    return retval; \
-  }
-
-DEF_CLASS_UNOP (not)
-DEF_CLASS_UNOP (uplus)
-DEF_CLASS_UNOP (uminus)
-DEF_CLASS_UNOP (transpose)
-DEF_CLASS_UNOP (ctranspose)
-
-// FIXME -- we need to handle precedence in the binop function.
-
-#define DEF_CLASS_BINOP(name) \
-  static octave_value \
-  oct_binop_ ## name (const octave_value& a1, const octave_value& a2) \
-  { \
-    octave_value retval; \
- \
-    std::string dispatch_type \
-      = a1.is_object () ? a1.class_name () : a2.class_name (); \
- \
-    octave_value meth = symbol_table::find_method (#name, dispatch_type); \
- \
-    if (meth.is_defined ()) \
-      { \
-        octave_value_list args; \
- \
-        args(1) = a2; \
-        args(0) = a1; \
- \
-        octave_value_list tmp = feval (meth.function_value (), args, 1); \
- \
-        if (tmp.length () > 0) \
-          retval = tmp(0); \
-      } \
-    else \
-      error ("%s method not defined for %s class", \
-             #name, dispatch_type.c_str ()); \
- \
-    return retval; \
-  }
-
-DEF_CLASS_BINOP (plus)
-DEF_CLASS_BINOP (minus)
-DEF_CLASS_BINOP (mtimes)
-DEF_CLASS_BINOP (mrdivide)
-DEF_CLASS_BINOP (mpower)
-DEF_CLASS_BINOP (mldivide)
-DEF_CLASS_BINOP (lt)
-DEF_CLASS_BINOP (le)
-DEF_CLASS_BINOP (eq)
-DEF_CLASS_BINOP (ge)
-DEF_CLASS_BINOP (gt)
-DEF_CLASS_BINOP (ne)
-DEF_CLASS_BINOP (times)
-DEF_CLASS_BINOP (rdivide)
-DEF_CLASS_BINOP (power)
-DEF_CLASS_BINOP (ldivide)
-DEF_CLASS_BINOP (and)
-DEF_CLASS_BINOP (or)
-
-#define INSTALL_CLASS_UNOP(op, f) \
-  octave_value_typeinfo::register_unary_class_op \
-    (octave_value::op, oct_unop_ ## f)
-
-#define INSTALL_CLASS_BINOP(op, f) \
-  octave_value_typeinfo::register_binary_class_op \
-    (octave_value::op, oct_binop_ ## f)
-
-void
-install_class_ops (void)
-{
-  INSTALL_CLASS_UNOP (op_not, not);
-  INSTALL_CLASS_UNOP (op_uplus, uplus);
-  INSTALL_CLASS_UNOP (op_uminus, uminus);
-  INSTALL_CLASS_UNOP (op_transpose, transpose);
-  INSTALL_CLASS_UNOP (op_hermitian, ctranspose);
-
-  INSTALL_CLASS_BINOP (op_add, plus);
-  INSTALL_CLASS_BINOP (op_sub, minus);
-  INSTALL_CLASS_BINOP (op_mul, mtimes);
-  INSTALL_CLASS_BINOP (op_div, mrdivide);
-  INSTALL_CLASS_BINOP (op_pow, mpower);
-  INSTALL_CLASS_BINOP (op_ldiv, mldivide);
-  INSTALL_CLASS_BINOP (op_lt, lt);
-  INSTALL_CLASS_BINOP (op_le, le);
-  INSTALL_CLASS_BINOP (op_eq, eq);
-  INSTALL_CLASS_BINOP (op_ge, ge);
-  INSTALL_CLASS_BINOP (op_gt, gt);
-  INSTALL_CLASS_BINOP (op_ne, ne);
-  INSTALL_CLASS_BINOP (op_el_mul, times);
-  INSTALL_CLASS_BINOP (op_el_div, rdivide);
-  INSTALL_CLASS_BINOP (op_el_pow, power);
-  INSTALL_CLASS_BINOP (op_el_ldiv, ldivide);
-  INSTALL_CLASS_BINOP (op_el_and, and);
-  INSTALL_CLASS_BINOP (op_el_or, or);
-}
--- a/src/OPERATORS/op-cm-cdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-cx-mat.h"
-#define RINCLUDE "ov-cx-diag.h"
-
-#define LMATRIX complex_matrix
-#define RMATRIX complex_diag_matrix
-
-#define LSHORT cm
-#define RSHORT cdm
-
-#define DEFINEDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-cm-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// unary complex matrix ops.
-
-DEFNDUNOP_OP (not, complex_matrix, complex_array, !)
-DEFNDUNOP_OP (uplus, complex_matrix, complex_array, /* no-op */)
-DEFNDUNOP_OP (uminus, complex_matrix, complex_array, -)
-
-DEFUNOP (transpose, complex_matrix)
-{
-  CAST_UNOP_ARG (const octave_complex_matrix&);
-
-  if (v.ndims () > 2)
-    {
-      error ("transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.complex_matrix_value ().transpose ());
-}
-
-DEFUNOP (hermitian, complex_matrix)
-{
-  CAST_UNOP_ARG (const octave_complex_matrix&);
-
-  if (v.ndims () > 2)
-    {
-      error ("complex-conjugate transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.complex_matrix_value ().hermitian ());
-}
-
-DEFNCUNOP_METHOD (incr, complex_matrix, increment)
-DEFNCUNOP_METHOD (decr, complex_matrix, decrement)
-DEFNCUNOP_METHOD (changesign, complex_matrix, changesign)
-
-// complex matrix by complex matrix ops.
-
-DEFNDBINOP_OP (add, complex_matrix, complex_matrix, complex_array, complex_array, +)
-DEFNDBINOP_OP (sub, complex_matrix, complex_matrix, complex_array, complex_array, -)
-
-DEFBINOP_OP (mul, complex_matrix, complex_matrix, *)
-
-DEFBINOP (div, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
-                            v2.complex_matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, complex_matrix, complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
-                                v2.complex_matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP (trans_mul, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-  return octave_value(xgemm (v1.complex_matrix_value (),
-                             v2.complex_matrix_value (),
-                             blas_trans, blas_no_trans));
-}
-
-DEFBINOP (mul_trans, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-  return octave_value(xgemm (v1.complex_matrix_value (),
-                             v2.complex_matrix_value (),
-                             blas_no_trans, blas_trans));
-}
-
-DEFBINOP (herm_mul, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-  return octave_value(xgemm (v1.complex_matrix_value (),
-                             v2.complex_matrix_value (),
-                             blas_conj_trans, blas_no_trans));
-}
-
-DEFBINOP (mul_herm, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-  return octave_value(xgemm (v1.complex_matrix_value (),
-                             v2.complex_matrix_value (),
-                             blas_no_trans, blas_conj_trans));
-}
-
-DEFBINOP (trans_ldiv, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
-                                v2.complex_matrix_value (), typ, blas_trans);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP (herm_ldiv, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
-                                v2.complex_matrix_value (), typ, blas_conj_trans);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_ne)
-
-DEFNDBINOP_FN (el_mul, complex_matrix, complex_matrix, complex_array, complex_array, product)
-DEFNDBINOP_FN (el_div, complex_matrix, complex_matrix, complex_array, complex_array, quotient)
-DEFNDBINOP_FN (el_pow, complex_matrix, complex_matrix, complex_array, complex_array, elem_xpow)
-
-DEFBINOP (el_ldiv, complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
-
-  return octave_value (quotient (v2.complex_array_value (), v1.complex_array_value ()));
-}
-
-DEFNDBINOP_FN (el_and, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  complex_matrix, complex_matrix, complex_array, complex_array, mx_el_or)
-
-DEFNDCATOP_FN (cm_cm, complex_matrix, complex_matrix, complex_array, complex_array, concat)
-
-DEFNDASSIGNOP_FN (assign, complex_matrix, complex_matrix, complex_array, assign)
-
-DEFNULLASSIGNOP_FN (null_assign, complex_matrix, delete_elements)
-
-DEFNDASSIGNOP_OP (assign_add, complex_matrix, complex_matrix, complex_array, +=)
-DEFNDASSIGNOP_OP (assign_sub, complex_matrix, complex_matrix, complex_array, -=)
-DEFNDASSIGNOP_FNOP (assign_el_mul, complex_matrix, complex_matrix, complex_array, product_eq)
-DEFNDASSIGNOP_FNOP (assign_el_div, complex_matrix, complex_matrix, complex_array, quotient_eq)
-
-CONVDECL (complex_matrix_to_float_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_complex_matrix&);
-
-  return new octave_float_complex_matrix (FloatComplexNDArray (v.complex_array_value ()));
-}
-
-void
-install_cm_cm_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_complex_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_complex_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_complex_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_complex_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_complex_matrix, hermitian);
-
-  INSTALL_NCUNOP (op_incr, octave_complex_matrix, incr);
-  INSTALL_NCUNOP (op_decr, octave_complex_matrix, decr);
-  INSTALL_NCUNOP (op_uminus, octave_complex_matrix, changesign);
-
-  INSTALL_BINOP (op_add, octave_complex_matrix, octave_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex_matrix, octave_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_complex_matrix, ldiv);
-  INSTALL_BINOP (op_trans_mul, octave_complex_matrix, octave_complex_matrix, trans_mul);
-  INSTALL_BINOP (op_mul_trans, octave_complex_matrix, octave_complex_matrix, mul_trans);
-  INSTALL_BINOP (op_herm_mul, octave_complex_matrix, octave_complex_matrix, herm_mul);
-  INSTALL_BINOP (op_mul_herm, octave_complex_matrix, octave_complex_matrix, mul_herm);
-  INSTALL_BINOP (op_trans_ldiv, octave_complex_matrix, octave_complex_matrix, trans_ldiv);
-  INSTALL_BINOP (op_herm_ldiv, octave_complex_matrix, octave_complex_matrix, herm_ldiv);
-
-  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_complex_matrix, octave_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_complex_matrix, octave_complex_matrix, cm_cm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_complex_matrix, assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_null_sq_str, null_assign);
-
-  INSTALL_ASSIGNOP (op_add_eq, octave_complex_matrix, octave_complex_matrix, assign_add);
-  INSTALL_ASSIGNOP (op_sub_eq, octave_complex_matrix, octave_complex_matrix, assign_sub);
-  INSTALL_ASSIGNOP (op_el_mul_eq, octave_complex_matrix, octave_complex_matrix, assign_el_mul);
-  INSTALL_ASSIGNOP (op_el_div_eq, octave_complex_matrix, octave_complex_matrix, assign_el_div);
-
-  INSTALL_CONVOP (octave_complex_matrix, octave_float_complex_matrix,
-                  complex_matrix_to_float_complex_matrix);
-}
--- a/src/OPERATORS/op-cm-cs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-complex.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex matrix by complex scalar ops.
-
-DEFNDBINOP_OP (add, complex_matrix, complex, complex_array, complex, +)
-DEFNDBINOP_OP (sub, complex_matrix, complex, complex_array, complex, -)
-DEFNDBINOP_OP (mul, complex_matrix, complex, complex_array, complex, *)
-
-DEFBINOP (div, complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.complex_array_value () / d);
-}
-
-DEFBINOP_FN (pow, complex_matrix, complex, xpow)
-
-DEFBINOP (ldiv, complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
-
-  ComplexMatrix m1 = v1.complex_matrix_value ();
-  ComplexMatrix m2 = v2.complex_matrix_value ();
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (m1, m2, typ);
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, complex_matrix, complex, complex_array, complex, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, complex_matrix, complex, complex_array, complex, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, complex_matrix, complex, complex_array, complex, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, complex_matrix, complex, complex_array, complex, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, complex_matrix, complex, complex_array, complex, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, complex_matrix, complex, complex_array, complex, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, complex_matrix, complex, complex_array, complex, *)
-
-DEFBINOP (el_div, complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.complex_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_pow, complex_matrix, complex, complex_array, complex, elem_xpow)
-
-DEFBINOP (el_ldiv, complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
-
-  return x_el_div (v2.complex_value (), v1.complex_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, complex_matrix, complex, complex_array, complex, mx_el_and)
-DEFNDBINOP_FN (el_or,  complex_matrix, complex, complex_array, complex, mx_el_or)
-
-DEFNDCATOP_FN (cm_cs, complex_matrix, complex, complex_array, complex_array, concat)
-
-DEFNDASSIGNOP_FN (assign, complex_matrix, complex, complex, assign)
-DEFNDASSIGNOP_FN (sgl_assign, float_complex_matrix, complex, float_complex, assign)
-
-DEFNDASSIGNOP_OP (assign_add, complex_matrix, complex_scalar, complex, +=)
-DEFNDASSIGNOP_OP (assign_sub, complex_matrix, complex_scalar, complex, -=)
-DEFNDASSIGNOP_OP (assign_mul, complex_matrix, complex_scalar, complex, *=)
-DEFNDASSIGNOP_OP (assign_div, complex_matrix, complex_scalar, complex, /=)
-
-void
-install_cm_cs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex_matrix, octave_complex, add);
-  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_complex, sub);
-  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_complex, mul);
-  INSTALL_BINOP (op_div, octave_complex_matrix, octave_complex, div);
-  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_complex, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_complex, lt);
-  INSTALL_BINOP (op_le, octave_complex_matrix, octave_complex, le);
-  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_complex, eq);
-  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_complex, ge);
-  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_complex, gt);
-  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_complex, el_or);
-
-  INSTALL_CATOP (octave_complex_matrix, octave_complex, cm_cs);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_complex, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_complex, sgl_assign);
-
-  INSTALL_ASSIGNOP (op_add_eq, octave_complex_matrix, octave_complex_scalar, assign_add);
-  INSTALL_ASSIGNOP (op_sub_eq, octave_complex_matrix, octave_complex_scalar, assign_sub);
-  INSTALL_ASSIGNOP (op_mul_eq, octave_complex_matrix, octave_complex_scalar, assign_mul);
-  INSTALL_ASSIGNOP (op_div_eq, octave_complex_matrix, octave_complex_scalar, assign_div);
-}
--- a/src/OPERATORS/op-cm-dm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-cx-mat.h"
-#define RINCLUDE "ov-re-diag.h"
-
-#define LMATRIX complex_matrix
-#define RMATRIX diag_matrix
-
-#define LSHORT cm
-#define RSHORT dm
-
-#define DEFINEDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-cm-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-cm-m.h"
-#include "mx-m-cm.h"
-#include "mx-cnda-nda.h"
-#include "mx-nda-cnda.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex matrix by matrix ops.
-
-DEFNDBINOP_OP (add, complex_matrix, matrix, complex_array, array, +)
-DEFNDBINOP_OP (sub, complex_matrix, matrix, complex_array, array, -)
-
-DEFBINOP_OP (mul, complex_matrix, matrix, *)
-
-DEFBINOP (mul_trans, complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
-
-  ComplexMatrix m1 = v1.complex_matrix_value ();
-  Matrix m2 = v2.matrix_value ();
-
-  return ComplexMatrix (xgemm (real (m1), m2, blas_no_trans, blas_trans),
-                        xgemm (imag (m1), m2, blas_no_trans, blas_trans));
-}
-
-DEFBINOP (div, complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
-                            v2.matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-
-DEFBINOPX (pow, complex_matrix, matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
-                                v2.matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, complex_matrix, matrix, complex_array, array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, complex_matrix, matrix, complex_array, array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, complex_matrix, matrix, complex_array, array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, complex_matrix, matrix, complex_array, array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, complex_matrix, matrix, complex_array, array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, complex_matrix, matrix, complex_array, array, mx_el_ne)
-
-DEFNDBINOP_FN (el_mul, complex_matrix, matrix, complex_array, array, product)
-DEFNDBINOP_FN (el_div, complex_matrix, matrix, complex_array, array, quotient)
-DEFNDBINOP_FN (el_pow, complex_matrix, matrix, complex_array, array, elem_xpow)
-
-DEFBINOP (el_ldiv, complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
-
-  return quotient (v2.array_value (), v1.complex_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, complex_matrix, matrix, complex_array, array, mx_el_and)
-DEFNDBINOP_FN (el_or,  complex_matrix, matrix, complex_array, array, mx_el_or)
-
-DEFNDCATOP_FN (cm_m, complex_matrix, matrix, complex_array, array, concat)
-
-DEFNDASSIGNOP_FN (assign, complex_matrix, matrix, complex_array, assign)
-
-void
-install_cm_m_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex_matrix, octave_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex_matrix, octave_matrix, div);
-  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_matrix, lt);
-  INSTALL_BINOP (op_le, octave_complex_matrix, octave_matrix, le);
-  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_matrix, el_or);
-  INSTALL_BINOP (op_mul_trans, octave_complex_matrix, octave_matrix, mul_trans);
-  INSTALL_BINOP (op_mul_herm, octave_complex_matrix, octave_matrix, mul_trans);
-
-  INSTALL_CATOP (octave_complex_matrix, octave_matrix, cm_m);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_matrix, assign);
-}
--- a/src/OPERATORS/op-cm-pm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 MINCLUDE "ov-cx-mat.h"
-
-#define LMATRIX complex_matrix
-#define RMATRIX perm_matrix
-
-#define LSHORT cm
-#define RSHORT pm
-
-#define RIGHT
-
-#include "op-pm-template.cc"
--- a/src/OPERATORS/op-cm-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-cm-s.h"
-#include "mx-cnda-s.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex matrix by scalar ops.
-
-DEFNDBINOP_OP (add, complex_matrix, scalar, complex_array, scalar, +)
-DEFNDBINOP_OP (sub, complex_matrix, scalar, complex_array, scalar, -)
-DEFNDBINOP_OP (mul, complex_matrix, scalar, complex_array, scalar, *)
-
-DEFBINOP (div, complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
-
-  double d = v2.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.complex_array_value () / d);
-}
-
-DEFBINOP_FN (pow, complex_matrix, scalar, xpow)
-
-DEFBINOP (ldiv, complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
-
-  ComplexMatrix m1 = v1.complex_matrix_value ();
-  Matrix m2 = v2.matrix_value ();
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (m1, m2, typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, complex_matrix, scalar, complex_array, scalar, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, complex_matrix, scalar, complex_array, scalar, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, complex_matrix, scalar, complex_array, scalar, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, complex_matrix, scalar, complex_array, scalar, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, complex_matrix, scalar, complex_array, scalar, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, complex_matrix, scalar, complex_array, scalar, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, complex_matrix, scalar, complex_array, scalar, *)
-
-DEFBINOP (el_div, complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
-
-  double d = v2.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.complex_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_pow, complex_matrix, scalar, complex_array, scalar, elem_xpow)
-
-DEFBINOP (el_ldiv, complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
-
-  return x_el_div (v2.double_value (), v1.complex_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, complex_matrix, scalar, complex_array, scalar, mx_el_and)
-DEFNDBINOP_FN (el_or,  complex_matrix, scalar, complex_array, scalar, mx_el_or)
-
-DEFNDCATOP_FN (cm_s, complex_matrix, scalar, complex_array, array, concat)
-
-DEFNDASSIGNOP_FN (assign, complex_matrix, scalar, complex_array, assign)
-
-DEFNDASSIGNOP_OP (assign_mul, complex_matrix, scalar, scalar, *=)
-DEFNDASSIGNOP_OP (assign_div, complex_matrix, scalar, scalar, /=)
-
-void
-install_cm_s_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex_matrix, octave_scalar, add);
-  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_scalar, mul);
-  INSTALL_BINOP (op_div, octave_complex_matrix, octave_scalar, div);
-  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_scalar, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_scalar, lt);
-  INSTALL_BINOP (op_le, octave_complex_matrix, octave_scalar, le);
-  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_scalar, el_or);
-
-  INSTALL_CATOP (octave_complex_matrix, octave_scalar, cm_s);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_scalar, assign);
-
-  INSTALL_ASSIGNOP (op_mul_eq, octave_complex_matrix, octave_scalar, assign_mul);
-  INSTALL_ASSIGNOP (op_div_eq, octave_complex_matrix, octave_scalar, assign_div);
-}
--- a/src/OPERATORS/op-cm-scm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-cx-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-scm-cm.h"
-#include "smx-cm-scm.h"
-#include "ov-cx-sparse.h"
-
-// complex matrix by sparse complex matrix ops.
-
-DEFBINOP_OP (add, complex_matrix, sparse_complex_matrix, +)
-DEFBINOP_OP (sub, complex_matrix, sparse_complex_matrix, -)
-
-DEFBINOP_OP (mul, complex_matrix, sparse_complex_matrix, *)
-
-DEFBINOP (div, complex_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      Complex d = v2.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.complex_array_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-
-      ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
-                                v2.sparse_complex_matrix_value (), typ);
-
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOPX (pow, complex_matrix, sparse_complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, complex_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&,
-                   const octave_sparse_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
-                                v2.complex_matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (mul_trans, complex_matrix, sparse_complex_matrix, mul_trans);
-DEFBINOP_FN (mul_herm, complex_matrix, sparse_complex_matrix, mul_herm);
-
-DEFBINOP_FN (lt, complex_matrix, sparse_complex_matrix, mx_el_lt)
-DEFBINOP_FN (le, complex_matrix, sparse_complex_matrix, mx_el_le)
-DEFBINOP_FN (eq, complex_matrix, sparse_complex_matrix, mx_el_eq)
-DEFBINOP_FN (ge, complex_matrix, sparse_complex_matrix, mx_el_ge)
-DEFBINOP_FN (gt, complex_matrix, sparse_complex_matrix, mx_el_gt)
-DEFBINOP_FN (ne, complex_matrix, sparse_complex_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, complex_matrix, sparse_complex_matrix, product)
-DEFBINOP_FN (el_div, complex_matrix, sparse_complex_matrix, quotient)
-
-DEFBINOP (el_pow, complex_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  return octave_value
-    (elem_xpow (SparseComplexMatrix (v1.complex_matrix_value ()),
-                v2.sparse_complex_matrix_value ()));
-}
-
-DEFBINOP (el_ldiv, sparse_complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  return octave_value (quotient (v2.sparse_complex_matrix_value (),
-                                 v1.complex_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, complex_matrix, sparse_complex_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  complex_matrix, sparse_complex_matrix, mx_el_or)
-
-DEFCATOP (cm_scm, complex_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (octave_complex_matrix&,
-                   const octave_sparse_complex_matrix&);
-  SparseComplexMatrix tmp (v1.complex_matrix_value ());
-  return octave_value (tmp. concat (v2.sparse_complex_matrix_value (),
-                                    ra_idx));
-}
-
-DEFCONV (sparse_complex_matrix_conv, complex_matrix,
-         sparse_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_complex_matrix&);
-  return new octave_sparse_complex_matrix
-    (SparseComplexMatrix (v.complex_matrix_value ()));
-}
-
-DEFNDASSIGNOP_FN (assign, complex_matrix, sparse_complex_matrix,
-                  complex_array, assign)
-
-void
-install_cm_scm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex_matrix,
-                 octave_sparse_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex_matrix,
-                 octave_sparse_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex_matrix,
-                 octave_sparse_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex_matrix,
-                 octave_sparse_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_complex_matrix,
-                 octave_sparse_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex_matrix,
-                 octave_sparse_complex_matrix, ldiv);
-  INSTALL_BINOP (op_mul_trans, octave_complex_matrix,
-                 octave_sparse_complex_matrix, mul_trans);
-  INSTALL_BINOP (op_mul_herm, octave_complex_matrix,
-                 octave_sparse_complex_matrix, mul_herm);
-  INSTALL_BINOP (op_lt, octave_complex_matrix,
-                 octave_sparse_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_complex_matrix,
-                 octave_sparse_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_complex_matrix,
-                 octave_sparse_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_complex_matrix,
-                 octave_sparse_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_complex_matrix,
-                 octave_sparse_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_complex_matrix,
-                 octave_sparse_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex_matrix,
-                 octave_sparse_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex_matrix,
-                 octave_sparse_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex_matrix,
-                 octave_sparse_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix,
-                 octave_sparse_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex_matrix,
-                 octave_sparse_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex_matrix,
-                 octave_sparse_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_complex_matrix,
-                 octave_sparse_complex_matrix, cm_scm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
-                    octave_sparse_complex_matrix, assign)
-  INSTALL_ASSIGNCONV (octave_complex_matrix, octave_sparse_complex_matrix,
-                      octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_complex_matrix, octave_sparse_complex_matrix,
-                   sparse_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-cm-sm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-cx-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-sm-cm.h"
-#include "smx-cm-sm.h"
-#include "ov-re-sparse.h"
-
-// complex matrix by sparse matrix ops.
-
-DEFBINOP_OP (add, complex_matrix, sparse_matrix, +)
-DEFBINOP_OP (sub, complex_matrix, sparse_matrix, -)
-
-DEFBINOP_OP (mul, complex_matrix, sparse_matrix, *)
-
-DEFBINOP (div, complex_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.complex_array_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-
-      ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
-                                v2.sparse_matrix_value (), typ);
-
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOPX (pow, complex_matrix, sparse_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, complex_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&,
-                   const octave_sparse_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
-                                v2.matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (lt, complex_matrix, sparse_matrix, mx_el_lt)
-DEFBINOP_FN (le, complex_matrix, sparse_matrix, mx_el_le)
-DEFBINOP_FN (eq, complex_matrix, sparse_matrix, mx_el_eq)
-DEFBINOP_FN (ge, complex_matrix, sparse_matrix, mx_el_ge)
-DEFBINOP_FN (gt, complex_matrix, sparse_matrix, mx_el_gt)
-DEFBINOP_FN (ne, complex_matrix, sparse_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, complex_matrix, sparse_matrix, product)
-DEFBINOP_FN (el_div, complex_matrix, sparse_matrix, quotient)
-
-DEFBINOP (el_pow, complex_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&,
-                   const octave_sparse_matrix&);
-
-  return octave_value
-    (elem_xpow ( SparseComplexMatrix (v1.complex_matrix_value ()),
-                 v2.sparse_matrix_value ()));
-}
-
-DEFBINOP (el_ldiv, complex_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_matrix&,
-                   const octave_sparse_matrix&);
-  return octave_value
-    (quotient (v2.sparse_matrix_value (), v1.complex_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, complex_matrix, sparse_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  complex_matrix, sparse_matrix, mx_el_or)
-
-DEFCATOP (cm_sm, complex_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (octave_complex_matrix&, const octave_sparse_matrix&);
-  SparseComplexMatrix tmp (v1.complex_matrix_value ());
-  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
-}
-
-DEFNDASSIGNOP_FN (assign, complex_matrix, sparse_matrix, complex_array, assign)
-
-void
-install_cm_sm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex_matrix, octave_sparse_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_sparse_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_sparse_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex_matrix, octave_sparse_matrix, div);
-  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_sparse_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_sparse_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_sparse_matrix, lt);
-  INSTALL_BINOP (op_le, octave_complex_matrix, octave_sparse_matrix, le);
-  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_sparse_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_sparse_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_sparse_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_sparse_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_sparse_matrix,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_sparse_matrix,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_sparse_matrix,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_sparse_matrix,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_sparse_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_sparse_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_complex_matrix, octave_sparse_matrix, cm_sm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_sparse_matrix,
-                    assign);
-  INSTALL_ASSIGNCONV (octave_complex_matrix, octave_sparse_matrix,
-                      octave_complex_matrix)
-
-}
--- a/src/OPERATORS/op-cs-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex scalar by complex matrix ops.
-
-DEFNDBINOP_OP (add, complex, complex_matrix, complex, complex_array, +)
-DEFNDBINOP_OP (sub, complex, complex_matrix, complex, complex_array, -)
-DEFNDBINOP_OP (mul, complex, complex_matrix, complex, complex_array, *)
-
-DEFBINOP (div, complex, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
-
-  ComplexMatrix m1 = v1.complex_matrix_value ();
-  ComplexMatrix m2 = v2.complex_matrix_value ();
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (m1, m2, typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (pow, complex, complex_matrix, xpow)
-
-DEFBINOP (ldiv, complex, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.complex_array_value () / d);
-}
-
-DEFNDCMPLXCMPOP_FN (lt, complex, complex_matrix, complex, complex_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, complex, complex_matrix, complex, complex_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, complex, complex_matrix, complex, complex_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, complex, complex_matrix, complex, complex_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, complex, complex_matrix, complex, complex_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, complex, complex_matrix, complex, complex_array, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, complex, complex_matrix, complex, complex_array, *)
-DEFNDBINOP_FN (el_div, complex, complex_matrix, complex, complex_array, x_el_div)
-DEFNDBINOP_FN (el_pow, complex, complex_matrix, complex, complex_array, elem_xpow)
-
-DEFBINOP (el_ldiv, complex, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.complex_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_and, complex, complex_matrix, complex, complex_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  complex, complex_matrix, complex, complex_array, mx_el_or)
-
-DEFNDCATOP_FN (cs_cm, complex, complex_matrix, complex_array, complex_array, concat)
-
-DEFCONV (complex_matrix_conv, complex, complex_matrix)
-{
-  CAST_CONV_ARG (const octave_complex&);
-
-  return new octave_complex_matrix (v.complex_matrix_value ());
-}
-
-void
-install_cs_cm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex, octave_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex, octave_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex, octave_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex, octave_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_complex, octave_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex, octave_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex, octave_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_complex, octave_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_complex, octave_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_complex, octave_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_complex, octave_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_complex, octave_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex, octave_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex, octave_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex, octave_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex, octave_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex, octave_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_complex, octave_complex_matrix, cs_cm);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_complex_matrix, octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv);
-}
--- a/src/OPERATORS/op-cs-cs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Array-util.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// unary complex scalar ops.
-
-DEFUNOP (not, complex)
-{
-  CAST_UNOP_ARG (const octave_complex&);
-  Complex x = v.complex_value ();
-  if (xisnan (x))
-    gripe_nan_to_logical_conversion ();
-  return octave_value (x == 0.0);
-}
-
-DEFUNOP_OP (uplus, complex, /* no-op */)
-DEFUNOP_OP (uminus, complex, -)
-DEFUNOP_OP (transpose, complex, /* no-op */)
-
-DEFUNOP (hermitian, complex)
-{
-  CAST_UNOP_ARG (const octave_complex&);
-
-  return octave_value (conj (v.complex_value ()));
-}
-
-DEFNCUNOP_METHOD (incr, complex, increment)
-DEFNCUNOP_METHOD (decr, complex, decrement)
-
-// complex scalar by complex scalar ops.
-
-DEFBINOP_OP (add, complex, complex, +)
-DEFBINOP_OP (sub, complex, complex, -)
-DEFBINOP_OP (mul, complex, complex, *)
-
-DEFBINOP (div, complex, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.complex_value () / d);
-}
-
-DEFBINOP_FN (pow, complex, complex, xpow)
-
-DEFBINOP (ldiv, complex, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.complex_value () / d);
-}
-
-DEFCMPLXCMPOP_OP (lt, complex, complex, <)
-DEFCMPLXCMPOP_OP (le, complex, complex, <=)
-DEFCMPLXCMPOP_OP (eq, complex, complex, ==)
-DEFCMPLXCMPOP_OP (ge, complex, complex, >=)
-DEFCMPLXCMPOP_OP (gt, complex, complex, >)
-DEFCMPLXCMPOP_OP (ne, complex, complex, !=)
-
-DEFBINOP_OP (el_mul, complex, complex, *)
-
-DEFBINOP (el_div, complex, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.complex_value () / d);
-}
-
-DEFBINOP_FN (el_pow, complex, complex, xpow)
-
-DEFBINOP (el_ldiv, complex, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.complex_value () / d);
-}
-
-DEFBINOP (el_and, complex, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
-
-  return v1.complex_value () != 0.0 && v2.complex_value () != 0.0;
-}
-
-DEFBINOP (el_or, complex, complex)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
-
-  return v1.complex_value () != 0.0 || v2.complex_value () != 0.0;
-}
-
-DEFNDCATOP_FN (cs_cs, complex, complex, complex_array, complex_array, concat)
-
-CONVDECL (complex_to_float_complex)
-{
-  CAST_CONV_ARG (const octave_complex&);
-
-  return new octave_float_complex_matrix (FloatComplexMatrix (1, 1, static_cast<FloatComplex>(v.complex_value ())));
-}
-
-void
-install_cs_cs_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_complex, not);
-  INSTALL_UNOP (op_uplus, octave_complex, uplus);
-  INSTALL_UNOP (op_uminus, octave_complex, uminus);
-  INSTALL_UNOP (op_transpose, octave_complex, transpose);
-  INSTALL_UNOP (op_hermitian, octave_complex, hermitian);
-
-  INSTALL_NCUNOP (op_incr, octave_complex, incr);
-  INSTALL_NCUNOP (op_decr, octave_complex, decr);
-
-  INSTALL_BINOP (op_add, octave_complex, octave_complex, add);
-  INSTALL_BINOP (op_sub, octave_complex, octave_complex, sub);
-  INSTALL_BINOP (op_mul, octave_complex, octave_complex, mul);
-  INSTALL_BINOP (op_div, octave_complex, octave_complex, div);
-  INSTALL_BINOP (op_pow, octave_complex, octave_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex, octave_complex, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex, octave_complex, lt);
-  INSTALL_BINOP (op_le, octave_complex, octave_complex, le);
-  INSTALL_BINOP (op_eq, octave_complex, octave_complex, eq);
-  INSTALL_BINOP (op_ge, octave_complex, octave_complex, ge);
-  INSTALL_BINOP (op_gt, octave_complex, octave_complex, gt);
-  INSTALL_BINOP (op_ne, octave_complex, octave_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex, octave_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex, octave_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex, octave_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex, octave_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex, octave_complex, el_or);
-
-  INSTALL_CATOP (octave_complex, octave_complex, cs_cs);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_complex, octave_complex_matrix);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_null_matrix, octave_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_complex, octave_null_str, octave_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_complex, octave_null_sq_str, octave_complex_matrix);
-
-  INSTALL_CONVOP (octave_complex, octave_float_complex_matrix,
-                  complex_to_float_complex);
-}
--- a/src/OPERATORS/op-cs-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-cs-nda.h"
-#include "mx-nda-cs.h"
-#include "mx-cs-nda.h"
-#include "mx-nda-cs.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex scalar by matrix ops.
-
-DEFNDBINOP_OP (add, complex, matrix, complex, array, +)
-DEFNDBINOP_OP (sub, complex, matrix, complex, array, -)
-DEFNDBINOP_OP (mul, complex, matrix, complex, array, *)
-
-DEFBINOP (div, complex, matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&);
-
-  ComplexMatrix m1 = v1.complex_matrix_value ();
-  Matrix m2 = v2.matrix_value ();
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (m1, m2, typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (pow, complex, matrix, xpow)
-
-DEFBINOP (ldiv, complex, matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.array_value () / d);
-}
-
-DEFNDCMPLXCMPOP_FN (lt, complex, matrix, complex, array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, complex, matrix, complex, array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, complex, matrix, complex, array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, complex, matrix, complex, array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, complex, matrix, complex, array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, complex, matrix, complex, array, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, complex, matrix, complex, array, *)
-DEFNDBINOP_FN (el_div, complex, matrix, complex, array, x_el_div)
-DEFNDBINOP_FN (el_pow, complex, matrix, complex, array, elem_xpow)
-
-DEFBINOP (el_ldiv, complex, matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.array_value () / d);
-}
-
-DEFNDBINOP_FN (el_and, complex, matrix, complex, array, mx_el_and)
-DEFNDBINOP_FN (el_or,  complex, matrix, complex, array, mx_el_or)
-
-DEFNDCATOP_FN (cs_m, complex, matrix, complex_array, array, concat)
-
-void
-install_cs_m_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex, octave_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex, octave_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex, octave_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex, octave_matrix, div);
-  INSTALL_BINOP (op_pow, octave_complex, octave_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex, octave_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex, octave_matrix, lt);
-  INSTALL_BINOP (op_le, octave_complex, octave_matrix, le);
-  INSTALL_BINOP (op_eq, octave_complex, octave_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_complex, octave_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_complex, octave_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_complex, octave_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex, octave_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex, octave_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex, octave_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex, octave_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex, octave_matrix, el_or);
-
-  INSTALL_CATOP (octave_complex, octave_matrix, cs_m);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_matrix, octave_complex_matrix);
-}
--- a/src/OPERATORS/op-cs-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex scalar by scalar ops.
-
-DEFBINOP_OP (add, complex, scalar, +)
-DEFBINOP_OP (sub, complex, scalar, -)
-DEFBINOP_OP (mul, complex, scalar, *)
-
-DEFBINOP (div, complex, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
-
-  double d = v2.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.complex_value () / d);
-}
-
-DEFBINOP_FN (pow, complex, scalar, xpow)
-
-DEFBINOP (ldiv, complex, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.double_value () / d);
-}
-
-DEFCMPLXCMPOP_OP (lt, complex, scalar, <)
-DEFCMPLXCMPOP_OP (le, complex, scalar, <=)
-DEFCMPLXCMPOP_OP (eq, complex, scalar, ==)
-DEFCMPLXCMPOP_OP (ge, complex, scalar, >=)
-DEFCMPLXCMPOP_OP (gt, complex, scalar, >)
-DEFCMPLXCMPOP_OP (ne, complex, scalar, !=)
-
-DEFBINOP_OP (el_mul, complex, scalar, *)
-
-DEFBINOP (el_div, complex, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
-
-  double d = v2.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.complex_value () / d);
-}
-
-DEFBINOP_FN (el_pow, complex, scalar, xpow)
-
-DEFBINOP (el_ldiv, complex, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.double_value () / d);
-}
-
-DEFBINOP (el_and, complex, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
-
-  return v1.complex_value () != 0.0 && v2.double_value ();
-}
-
-DEFBINOP (el_or, complex, scalar)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
-
-  return v1.complex_value () != 0.0 || v2.double_value ();
-}
-
-DEFNDCATOP_FN (cs_s, complex, scalar, complex_array, array, concat)
-
-void
-install_cs_s_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex, octave_scalar, add);
-  INSTALL_BINOP (op_sub, octave_complex, octave_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_complex, octave_scalar, mul);
-  INSTALL_BINOP (op_div, octave_complex, octave_scalar, div);
-  INSTALL_BINOP (op_pow, octave_complex, octave_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex, octave_scalar, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex, octave_scalar, lt);
-  INSTALL_BINOP (op_le, octave_complex, octave_scalar, le);
-  INSTALL_BINOP (op_eq, octave_complex, octave_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_complex, octave_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_complex, octave_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_complex, octave_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex, octave_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex, octave_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex, octave_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex, octave_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex, octave_scalar, el_or);
-
-  INSTALL_CATOP (octave_complex, octave_scalar, cs_s);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_scalar, octave_complex_matrix);
-}
--- a/src/OPERATORS/op-cs-scm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-cx-mat.h"
-#include "ov-complex.h"
-#include "ops.h"
-#include "xpow.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "ov-cx-sparse.h"
-
-// complex scalar by sparse complex matrix ops.
-
-DEFBINOP_OP (add, complex, sparse_complex_matrix, +)
-DEFBINOP_OP (sub, complex, sparse_complex_matrix, -)
-DEFBINOP_OP (mul, complex, sparse_complex_matrix, *)
-
-DEFBINOP (div, complex, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      Complex d = v2.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / d));
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
-      SparseComplexMatrix m2 = v2.sparse_complex_matrix_value ();
-      ComplexMatrix ret = xdiv (m1, m2, typ);
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP (pow, complex, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&,
-                   const octave_sparse_complex_matrix&);
-  return xpow (v1.complex_value (), v2.complex_matrix_value ());
-}
-
-DEFBINOP (ldiv, complex, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&);
-
-  Complex d = v1.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.sparse_complex_matrix_value () / d);
-}
-
-DEFBINOP_FN (lt, complex, sparse_complex_matrix, mx_el_lt)
-DEFBINOP_FN (le, complex, sparse_complex_matrix, mx_el_le)
-DEFBINOP_FN (eq, complex, sparse_complex_matrix, mx_el_eq)
-DEFBINOP_FN (ge, complex, sparse_complex_matrix, mx_el_ge)
-DEFBINOP_FN (gt, complex, sparse_complex_matrix, mx_el_gt)
-DEFBINOP_FN (ne, complex, sparse_complex_matrix, mx_el_ne)
-
-DEFBINOP_OP (el_mul, complex, sparse_complex_matrix, *)
-DEFBINOP_FN (el_div, complex, sparse_complex_matrix, x_el_div)
-
-DEFBINOP_FN (el_pow, complex, sparse_complex_matrix, elem_xpow)
-
-DEFBINOP (el_ldiv, complex, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&);
-
-  Complex d = v1.complex_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v2.sparse_complex_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (el_and, complex, sparse_complex_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  complex, sparse_complex_matrix, mx_el_or)
-
-DEFCATOP (cs_scm, complex, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (octave_complex&, const octave_sparse_complex_matrix&);
-  SparseComplexMatrix tmp (1, 1, v1.complex_value ());
-  return octave_value (tmp. concat (v2.sparse_complex_matrix_value (),
-                                    ra_idx));
-}
-
-DEFCONV (sparse_complex_matrix_conv, complex, sparse_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_complex&);
-
-  return new octave_sparse_complex_matrix
-    (SparseComplexMatrix (v.complex_matrix_value ()));
-}
-
-void
-install_cs_scm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex, octave_sparse_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex, octave_sparse_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex, octave_sparse_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex, octave_sparse_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_complex, octave_sparse_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex, octave_sparse_complex_matrix,
-                 ldiv);
-  INSTALL_BINOP (op_lt, octave_complex, octave_sparse_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_complex, octave_sparse_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_complex, octave_sparse_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_complex, octave_sparse_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_complex, octave_sparse_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_complex, octave_sparse_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex, octave_sparse_complex_matrix,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex, octave_sparse_complex_matrix,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex, octave_sparse_complex_matrix,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_sparse_complex_matrix,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex, octave_sparse_complex_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_complex, octave_sparse_complex_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_complex, octave_sparse_complex_matrix, cs_scm);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_sparse_complex_matrix,
-                      octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_complex, octave_sparse_complex_matrix,
-                   sparse_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-cs-sm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-complex.h"
-#include "ops.h"
-#include "xpow.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-#include "smx-cs-sm.h"
-#include "smx-sm-cs.h"
-
-// complex by sparse matrix ops.
-
-DEFBINOP_OP (add, complex, sparse_matrix, +)
-DEFBINOP_OP (sub, complex, sparse_matrix, -)
-DEFBINOP_OP (mul, complex, sparse_matrix, *)
-
-DEFBINOP (div, complex, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / d));
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
-      SparseMatrix m2 = v2.sparse_matrix_value ();
-      ComplexMatrix ret = xdiv (m1, m2, typ);
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP (pow, complex, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
-  return xpow (v1.complex_value (), v2.matrix_value ());
-}
-
-DEFBINOP (ldiv, complex, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
-
-  Complex d = v1.complex_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v2.sparse_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (lt, complex, sparse_matrix, mx_el_lt)
-DEFBINOP_FN (le, complex, sparse_matrix, mx_el_le)
-DEFBINOP_FN (eq, complex, sparse_matrix, mx_el_eq)
-DEFBINOP_FN (ge, complex, sparse_matrix, mx_el_ge)
-DEFBINOP_FN (gt, complex, sparse_matrix, mx_el_gt)
-DEFBINOP_FN (ne, complex, sparse_matrix, mx_el_ne)
-
-DEFBINOP_OP (el_mul, complex, sparse_matrix, *)
-DEFBINOP_FN (el_div, complex, sparse_matrix, x_el_div)
-DEFBINOP_FN (el_pow, complex, sparse_matrix, elem_xpow)
-
-DEFBINOP (el_ldiv, complex, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
-
-  Complex d = v1.complex_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v2.sparse_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (el_and, complex, sparse_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  complex, sparse_matrix, mx_el_or)
-
-DEFCATOP (cs_sm, sparse_matrix, complex)
-{
-  CAST_BINOP_ARGS (octave_complex&, const octave_sparse_matrix&);
-  SparseComplexMatrix tmp (1, 1, v1.complex_value ());
-  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
-}
-
-DEFCONV (sparse_matrix_conv, complex, sparse_matrix)
-{
-  CAST_CONV_ARG (const octave_complex&);
-
-  return new octave_sparse_matrix
-    (SparseMatrix (v.matrix_value ()));
-}
-
-void
-install_cs_sm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_complex, octave_sparse_matrix, add);
-  INSTALL_BINOP (op_sub, octave_complex, octave_sparse_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_complex, octave_sparse_matrix, mul);
-  INSTALL_BINOP (op_div, octave_complex, octave_sparse_matrix, div);
-  INSTALL_BINOP (op_pow, octave_complex, octave_sparse_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_complex, octave_sparse_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_complex, octave_sparse_matrix, lt);
-  INSTALL_BINOP (op_le, octave_complex, octave_sparse_matrix, le);
-  INSTALL_BINOP (op_eq, octave_complex, octave_sparse_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_complex, octave_sparse_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_complex, octave_sparse_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_complex, octave_sparse_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_complex, octave_sparse_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_complex, octave_sparse_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_complex, octave_sparse_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_sparse_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_complex, octave_sparse_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_complex, octave_sparse_matrix, el_or);
-
-  INSTALL_CATOP (octave_complex, octave_sparse_matrix, cs_sm);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_sparse_matrix,
-                      octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_complex, octave_sparse_matrix, sparse_matrix_conv);
-}
--- a/src/OPERATORS/op-dm-cdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-re-diag.h"
-#define RINCLUDE "ov-cx-diag.h"
-
-#define LMATRIX diag_matrix
-#define RMATRIX complex_diag_matrix
-#define LDMATRIX RMATRIX
-
-#define LSHORT dm
-#define RSHORT cdm
-
-#define DEFINEDIV
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-dm-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-re-diag.h"
-#define RINCLUDE "ov-cx-mat.h"
-
-#define LMATRIX diag_matrix
-#define RMATRIX complex_matrix
-
-#define LSHORT dm
-#define RSHORT cm
-
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-dm-cs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 SINCLUDE "ov-complex.h"
-#define MINCLUDE "ov-re-diag.h"
-
-#define SCALAR complex
-#define MATRIX diag_matrix
-#define MATRIXV complex_diag_matrix
-
-#define SSHORT cs
-#define MSHORT dm
-
-#include "op-dms-template.cc"
-
--- a/src/OPERATORS/op-dm-dm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-re-diag.h"
-#include "ov-flt-re-diag.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix unary ops.
-
-DEFUNOP_OP (uplus, diag_matrix, /* no-op */)
-DEFUNOP_OP (uminus, diag_matrix, -)
-
-DEFUNOP (transpose, diag_matrix)
-{
-  CAST_UNOP_ARG (const octave_diag_matrix&);
-  return octave_value (v.diag_matrix_value ().transpose ());
-}
-
-// matrix by matrix ops.
-
-DEFBINOP_OP (add, diag_matrix, diag_matrix, +)
-DEFBINOP_OP (sub, diag_matrix, diag_matrix, -)
-DEFBINOP_OP (mul, diag_matrix, diag_matrix, *)
-
-DEFBINOP (div, diag_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_diag_matrix&);
-
-  return xdiv (v1.diag_matrix_value (),
-               v2.diag_matrix_value ());
-}
-
-DEFBINOP (ldiv, diag_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_diag_matrix&);
-
-  return xleftdiv (v1.diag_matrix_value (),
-                   v2.diag_matrix_value ());
-}
-
-CONVDECL (diag_matrix_to_matrix)
-{
-  CAST_CONV_ARG (const octave_diag_matrix&);
-
-  return new octave_matrix (v.matrix_value ());
-}
-
-CONVDECL (diag_matrix_to_float_diag_matrix)
-{
-  CAST_CONV_ARG (const octave_diag_matrix&);
-
-  return new octave_float_diag_matrix (v.float_diag_matrix_value ());
-}
-
-void
-install_dm_dm_ops (void)
-{
-  INSTALL_UNOP (op_uplus, octave_diag_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_diag_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_diag_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_diag_matrix, transpose);
-
-  INSTALL_BINOP (op_add, octave_diag_matrix, octave_diag_matrix, add);
-  INSTALL_BINOP (op_sub, octave_diag_matrix, octave_diag_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_diag_matrix, octave_diag_matrix, mul);
-  INSTALL_BINOP (op_div, octave_diag_matrix, octave_diag_matrix, div);
-  INSTALL_BINOP (op_ldiv, octave_diag_matrix, octave_diag_matrix, ldiv);
-
-  INSTALL_CONVOP (octave_diag_matrix, octave_matrix, diag_matrix_to_matrix);
-  INSTALL_CONVOP (octave_diag_matrix, octave_float_diag_matrix, diag_matrix_to_float_diag_matrix);
-  INSTALL_ASSIGNCONV (octave_diag_matrix, octave_matrix, octave_matrix);
-  INSTALL_WIDENOP (octave_diag_matrix, octave_matrix, diag_matrix_to_matrix);
-}
--- a/src/OPERATORS/op-dm-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-re-diag.h"
-#define RINCLUDE "ov-re-mat.h"
-
-#define LMATRIX diag_matrix
-#define LDMATRIX matrix
-#define RMATRIX matrix
-
-#define LSHORT dm
-#define RSHORT m
-
-#define DEFINELDIV
-#define DEFINENULLASSIGNCONV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-dm-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 SINCLUDE "ov-scalar.h"
-#define MINCLUDE "ov-re-diag.h"
-
-#define SCALAR scalar
-#define MATRIX diag_matrix
-
-#define SSHORT s
-#define MSHORT dm
-
-#include "op-dms-template.cc"
-
--- a/src/OPERATORS/op-dm-scm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,511 +0,0 @@
-/*
-
-Copyright (C) 2009-2012 Jason Riedy, Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-#include "ov-re-diag.h"
-#include "ov-cx-diag.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-
-#include "sparse-xdiv.h"
-
-// diagonal matrix by sparse matrix ops
-
-DEFBINOP (mul_dm_scm, diag_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.diag_matrix_value () * d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      SparseComplexMatrix ret = v1.diag_matrix_value () * v2.sparse_complex_matrix_value ();
-      octave_value out = octave_value (ret);
-      typ.mark_as_unsymmetric ();
-      out.matrix_type (typ);
-      return out;
-    }
-}
-
-DEFBINOP (mul_cdm_sm, complex_diag_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.scalar_value ();
-
-      return octave_value (v1.complex_diag_matrix_value () * d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      SparseComplexMatrix ret = v1.complex_diag_matrix_value () * v2.sparse_matrix_value ();
-      octave_value out = octave_value (ret);
-      typ.mark_as_unsymmetric ();
-      out.matrix_type (typ);
-      return out;
-    }
-}
-
-DEFBINOP (mul_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.complex_diag_matrix_value () * d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      SparseComplexMatrix ret = v1.complex_diag_matrix_value () * v2.sparse_complex_matrix_value ();
-      octave_value out = octave_value (ret);
-      typ.mark_as_unsymmetric ();
-      out.matrix_type (typ);
-      return out;
-    }
-}
-
-DEFBINOP (ldiv_dm_scm, diag_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  MatrixType typ = v2.matrix_type ();
-  return xleftdiv (v1.diag_matrix_value (), v2.sparse_complex_matrix_value (),
-                   typ);
-}
-
-DEFBINOP (ldiv_cdm_sm, complex_diag_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&,
-                   const octave_sparse_matrix&);
-
-  MatrixType typ = v2.matrix_type ();
-  return xleftdiv (v1.complex_diag_matrix_value (), v2.sparse_matrix_value (),
-                   typ);
-}
-
-DEFBINOP (ldiv_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  MatrixType typ = v2.matrix_type ();
-  return xleftdiv (v1.complex_diag_matrix_value (), v2.sparse_complex_matrix_value (),
-                   typ);
-}
-
-DEFBINOP (add_dm_scm, diag_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.matrix_value () + d);
-    }
-  else
-    return v1.diag_matrix_value () + v2.sparse_complex_matrix_value ();
-}
-
-DEFBINOP (add_cdm_sm, complex_diag_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v2.scalar_value ();
-
-      return octave_value (v1.complex_matrix_value () + d);
-    }
-  else
-    return v1.complex_diag_matrix_value () + v2.sparse_matrix_value ();
-}
-
-DEFBINOP (add_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.complex_matrix_value () + d);
-    }
-  else
-    return v1.complex_diag_matrix_value () + v2.sparse_complex_matrix_value ();
-}
-
-DEFBINOP (sub_dm_scm, diag_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.matrix_value () + (-d));
-    }
-  else
-    return v1.diag_matrix_value () - v2.sparse_complex_matrix_value ();
-}
-
-DEFBINOP (sub_cdm_sm, complex_diag_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v2.scalar_value ();
-
-      return octave_value (v1.complex_matrix_value () + (-d));
-    }
-  else
-    return v1.complex_diag_matrix_value () - v2.sparse_matrix_value ();
-}
-
-DEFBINOP (sub_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.complex_matrix_value () + (-d));
-    }
-  else
-    return v1.complex_diag_matrix_value () - v2.sparse_complex_matrix_value ();
-}
-
-// sparse matrix by diagonal matrix ops
-
-DEFBINOP (mul_scm_dm, sparse_complex_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    // If v1 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v1.complex_value ();
-
-      return octave_value (d * v2.diag_matrix_value ());
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-      SparseComplexMatrix ret = v1.sparse_complex_matrix_value () * v2.diag_matrix_value ();
-      octave_value out = octave_value (ret);
-      typ.mark_as_unsymmetric ();
-      out.matrix_type (typ);
-      return out;
-    }
-}
-
-DEFBINOP (mul_sm_cdm, sparse_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    // If v1 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v1.complex_value ();
-
-      return octave_value (d * v2.complex_diag_matrix_value ());
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-      SparseComplexMatrix ret = v1.sparse_matrix_value () * v2.complex_diag_matrix_value ();
-      octave_value out = octave_value (ret);
-      typ.mark_as_unsymmetric ();
-      out.matrix_type (typ);
-      return out;
-    }
-}
-
-DEFBINOP (mul_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    // If v1 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v1.complex_value ();
-
-      return octave_value (d * v2.complex_diag_matrix_value ());
-    }
-  else if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, don't bother with further dispatching.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.sparse_complex_matrix_value () * d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-      SparseComplexMatrix ret = v1.sparse_complex_matrix_value () * v2.complex_diag_matrix_value ();
-      octave_value out = octave_value (ret);
-      typ.mark_as_unsymmetric ();
-      out.matrix_type (typ);
-      return out;
-    }
-}
-
-DEFBINOP (div_scm_dm, sparse_complex_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.sparse_complex_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      return xdiv (v1.sparse_complex_matrix_value (), v2.diag_matrix_value (), typ);
-    }
-}
-
-DEFBINOP (div_sm_cdm, sparse_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.sparse_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      return xdiv (v1.sparse_matrix_value (), v2.complex_diag_matrix_value (), typ);
-    }
-}
-
-DEFBINOP (div_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.sparse_complex_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      return xdiv (v1.sparse_complex_matrix_value (), v2.complex_diag_matrix_value (), typ);
-    }
-}
-
-DEFBINOP (add_sm_cdm, sparse_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.sparse_matrix_value () + d);
-    }
-  else
-    return v1.sparse_matrix_value () + v2.complex_diag_matrix_value ();
-}
-
-DEFBINOP (add_scm_dm, sparse_complex_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v2.scalar_value ();
-
-      return octave_value (v1.sparse_complex_matrix_value () + d);
-    }
-  else
-    return v1.sparse_complex_matrix_value () + v2.diag_matrix_value ();
-}
-
-DEFBINOP (add_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.sparse_complex_matrix_value () + d);
-    }
-  else
-    return v1.sparse_complex_matrix_value () + v2.complex_diag_matrix_value ();
-}
-
-DEFBINOP (sub_sm_cdm, sparse_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.sparse_matrix_value () + (-d));
-    }
-  else
-    return v1.sparse_matrix_value () - v2.complex_diag_matrix_value ();
-}
-
-DEFBINOP (sub_scm_dm, sparse_complex_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v2.scalar_value ();
-
-      return octave_value (v1.sparse_complex_matrix_value () + (-d));
-    }
-  else
-    return v1.sparse_complex_matrix_value () - v2.diag_matrix_value ();
-}
-
-DEFBINOP (sub_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.sparse_complex_matrix_value () + (-d));
-    }
-  else
-    return v1.sparse_complex_matrix_value () - v2.complex_diag_matrix_value ();
-}
-
-void
-install_dm_scm_ops (void)
-{
-  INSTALL_BINOP (op_mul, octave_diag_matrix, octave_sparse_complex_matrix,
-                 mul_dm_scm);
-  INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_sparse_matrix,
-                 mul_cdm_sm);
-  INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_sparse_complex_matrix,
-                 mul_cdm_scm);
-  INSTALL_BINOP (op_ldiv, octave_diag_matrix, octave_sparse_complex_matrix, ldiv_dm_scm);
-  INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_sparse_matrix, ldiv_cdm_sm);
-  INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_sparse_complex_matrix,
-                 ldiv_cdm_scm);
-
-  INSTALL_BINOP (op_add, octave_diag_matrix, octave_sparse_complex_matrix, add_dm_scm);
-  INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_sparse_matrix, add_cdm_sm);
-  INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_sparse_complex_matrix,
-                 add_cdm_scm);
-  INSTALL_BINOP (op_sub, octave_diag_matrix, octave_sparse_complex_matrix, sub_dm_scm);
-  INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_sparse_matrix, sub_cdm_sm);
-  INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_sparse_complex_matrix,
-                 sub_cdm_scm);
-
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_diag_matrix,
-                 mul_scm_dm);
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_complex_diag_matrix,
-                 mul_sm_cdm);
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_complex_diag_matrix,
-                 mul_scm_cdm);
-
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_diag_matrix, div_scm_dm);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_complex_diag_matrix, div_sm_cdm);
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_complex_diag_matrix, div_scm_cdm);
-
-  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_diag_matrix, add_scm_dm);
-  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_complex_diag_matrix, add_sm_cdm);
-  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_complex_diag_matrix, add_scm_cdm);
-  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_diag_matrix, sub_scm_dm);
-  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_complex_diag_matrix, sub_sm_cdm);
-  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_complex_diag_matrix, sub_scm_cdm);
-}
--- a/src/OPERATORS/op-dm-sm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-
-Copyright (C) 2009-2012 Jason Riedy, Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-#include "ov-re-diag.h"
-#include "ov-re-sparse.h"
-
-#include "sparse-xdiv.h"
-
-// diagonal matrix by sparse matrix ops
-
-DEFBINOP (mul_dm_sm, diag_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v2.scalar_value ();
-
-      return octave_value (v1.diag_matrix_value () * d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      SparseMatrix ret = v1.diag_matrix_value () * v2.sparse_matrix_value ();
-      octave_value out = octave_value (ret);
-      typ.mark_as_unsymmetric ();
-      out.matrix_type (typ);
-      return out;
-    }
-}
-
-DEFBINOP (ldiv_dm_sm, diag_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&);
-
-  MatrixType typ = v2.matrix_type ();
-  return xleftdiv (v1.diag_matrix_value (), v2.sparse_matrix_value (), typ);
-}
-
-DEFBINOP (add_dm_sm, diag_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v2.scalar_value ();
-
-      return octave_value (v1.matrix_value () + d);
-    }
-  else
-    return v1.diag_matrix_value () + v2.sparse_matrix_value ();
-}
-
-DEFBINOP (sub_dm_sm, diag_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    // If v2 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v2.scalar_value ();
-
-      return octave_value (v1.matrix_value () - d);
-    }
-  else
-    return v1.diag_matrix_value () - v2.sparse_matrix_value ();
-}
-
-// sparse matrix by diagonal matrix ops
-
-DEFBINOP (mul_sm_dm, sparse_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    // If v1 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v1.scalar_value ();
-
-      return octave_value (d * v2.diag_matrix_value ());
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-      SparseMatrix ret = v1.sparse_matrix_value () * v2.diag_matrix_value ();
-      octave_value out = octave_value (ret);
-      typ.mark_as_unsymmetric ();
-      out.matrix_type (typ);
-      return out;
-    }
-}
-
-DEFBINOP (div_sm_dm, sparse_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.sparse_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      return xdiv (v1.sparse_matrix_value (), v2.diag_matrix_value (), typ);
-    }
-}
-
-DEFBINOP (add_sm_dm, sparse_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    // If v1 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v1.scalar_value ();
-
-      return octave_value (d + v2.matrix_value ());
-    }
-  else
-    return v1.sparse_matrix_value () + v2.diag_matrix_value ();
-}
-
-DEFBINOP (sub_sm_dm, sparse_matrix, diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    // If v1 is a scalar in disguise, return a diagonal matrix rather than
-    // a sparse matrix.
-    {
-      double d = v1.scalar_value ();
-
-      return octave_value (d - v2.matrix_value ());
-    }
-  else
-    return v1.sparse_matrix_value () - v2.diag_matrix_value ();
-}
-
-void
-install_dm_sm_ops (void)
-{
-  INSTALL_BINOP (op_mul, octave_diag_matrix, octave_sparse_matrix,
-                 mul_dm_sm);
-
-  INSTALL_BINOP (op_add, octave_diag_matrix, octave_sparse_matrix, add_dm_sm);
-  INSTALL_BINOP (op_sub, octave_diag_matrix, octave_sparse_matrix, sub_dm_sm);
-  INSTALL_BINOP (op_ldiv, octave_diag_matrix, octave_sparse_matrix, ldiv_dm_sm);
-
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_diag_matrix,
-                 mul_sm_dm);
-
-  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_diag_matrix, add_sm_dm);
-  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_diag_matrix, sub_sm_dm);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_diag_matrix, div_sm_dm);
-}
--- a/src/OPERATORS/op-dm-template.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ops.h"
-#include "xdiv.h"
-#include LINCLUDE
-#include RINCLUDE
-#ifdef DEFINENULLASSIGNCONV
-#include "ov-null-mat.h"
-#endif
-
-// matrix by diag matrix ops.
-
-DEFBINOP_OP (add, LMATRIX, RMATRIX, +)
-DEFBINOP_OP (sub, LMATRIX, RMATRIX, -)
-DEFBINOP_OP (mul, LMATRIX, RMATRIX, *)
-
-#ifndef LDMATRIX
-#define LDMATRIX LMATRIX
-#endif
-
-#ifndef RDMATRIX
-#define RDMATRIX RMATRIX
-#endif
-
-#define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
-#define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
-#define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
-#define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
-#define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
-#define LDMATRIX_VALUE CONCAT2(LDMATRIX, _value)
-#define RDMATRIX_VALUE CONCAT2(RDMATRIX, _value)
-
-#ifdef DEFINEDIV
-DEFBINOP (div, LMATRIX, RMATRIX)
-{
-  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
-
-  return xdiv (v1.LDMATRIX_VALUE (), v2.RMATRIX_VALUE ());
-}
-#endif
-
-#ifdef DEFINELDIV
-DEFBINOP (ldiv, LMATRIX, RMATRIX)
-{
-  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
-
-  return xleftdiv (v1.LMATRIX_VALUE (), v2.RDMATRIX_VALUE ());
-}
-#endif
-
-#define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
-#define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
-
-void
-INST_NAME (void)
-{
-  INSTALL_BINOP (op_add, OCTAVE_LMATRIX, OCTAVE_RMATRIX, add);
-  INSTALL_BINOP (op_sub, OCTAVE_LMATRIX, OCTAVE_RMATRIX, sub);
-  INSTALL_BINOP (op_mul, OCTAVE_LMATRIX, OCTAVE_RMATRIX, mul);
-#ifdef DEFINEDIV
-  INSTALL_BINOP (op_div, OCTAVE_LMATRIX, OCTAVE_RMATRIX, div);
-#endif
-#ifdef DEFINELDIV
-  INSTALL_BINOP (op_ldiv, OCTAVE_LMATRIX, OCTAVE_RMATRIX, ldiv);
-#endif
-#ifdef DEFINENULLASSIGNCONV
-  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_matrix, OCTAVE_LDMATRIX);
-  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_str, OCTAVE_LDMATRIX);
-  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_sq_str, OCTAVE_LDMATRIX);
-#endif
-}
--- a/src/OPERATORS/op-dms-template.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ops.h"
-#include "gripes.h"
-#include "xpow.h"
-#include SINCLUDE
-#include MINCLUDE
-
-// matrix by diag matrix ops.
-
-#ifndef SCALARV
-#define SCALARV SCALAR
-#endif
-
-#ifndef MATRIXV
-#define MATRIXV MATRIX
-#endif
-
-DEFNDBINOP_OP (sdmmul, SCALAR, MATRIX, SCALARV, MATRIXV, *)
-DEFNDBINOP_OP (dmsmul, MATRIX, SCALAR, MATRIXV, SCALARV, *)
-
-#define OCTAVE_MATRIX CONCAT2(octave_, MATRIX)
-#define OCTAVE_SCALAR CONCAT2(octave_, SCALAR)
-#define MATRIX_VALUE CONCAT2(MATRIXV, _value)
-#define SCALAR_VALUE CONCAT2(SCALARV, _value)
-
-template <class T>
-static T
-gripe_if_zero (T x)
-{
-  if (x == T ())
-    gripe_divide_by_zero ();
-  return x;
-}
-
-DEFBINOP (dmsdiv, MATRIX, SCALAR)
-{
-  CAST_BINOP_ARGS (const OCTAVE_MATRIX&, const OCTAVE_SCALAR&);
-
-  return v1.MATRIX_VALUE () / gripe_if_zero (v2.SCALAR_VALUE ());
-}
-
-DEFBINOP (sdmldiv, SCALAR, MATRIX)
-{
-  CAST_BINOP_ARGS (const OCTAVE_SCALAR&, const OCTAVE_MATRIX&);
-
-  return v2.MATRIX_VALUE () / gripe_if_zero (v1.SCALAR_VALUE ());
-}
-
-DEFBINOP (dmspow, MATRIX, SCALAR)
-{
-  CAST_BINOP_ARGS (const OCTAVE_MATRIX&, const OCTAVE_SCALAR&);
-
-  return xpow (v1.MATRIX_VALUE (), v2.SCALAR_VALUE ());
-}
-
-#define SHORT_NAME CONCAT3(MSHORT, _, SSHORT)
-#define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
-
-void
-INST_NAME (void)
-{
-  INSTALL_BINOP (op_mul, OCTAVE_MATRIX, OCTAVE_SCALAR, dmsmul);
-  INSTALL_BINOP (op_div, OCTAVE_MATRIX, OCTAVE_SCALAR, dmsdiv);
-  INSTALL_BINOP (op_mul, OCTAVE_SCALAR, OCTAVE_MATRIX, sdmmul);
-  INSTALL_BINOP (op_ldiv, OCTAVE_SCALAR, OCTAVE_MATRIX, sdmldiv);
-  INSTALL_BINOP (op_pow, OCTAVE_MATRIX, OCTAVE_SCALAR, dmspow);
-}
--- a/src/OPERATORS/op-double-conv.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-re-sparse.h"
-#include "ov-bool-sparse.h"
-#include "ov-range.h"
-#include "ov-scalar.h"
-#include "ov-re-mat.h"
-#include "ov-str-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-// conversion ops
-
-DEFDBLCONVFN (int8_matrix_to_double_matrix, int8_matrix, int8_array)
-DEFDBLCONVFN (int16_matrix_to_double_matrix, int16_matrix, int16_array)
-DEFDBLCONVFN (int32_matrix_to_double_matrix, int32_matrix, int32_array)
-DEFDBLCONVFN (int64_matrix_to_double_matrix, int64_matrix, int64_array)
-
-DEFDBLCONVFN (uint8_matrix_to_double_matrix, uint8_matrix, uint8_array)
-DEFDBLCONVFN (uint16_matrix_to_double_matrix, uint16_matrix, uint16_array)
-DEFDBLCONVFN (uint32_matrix_to_double_matrix, uint32_matrix, uint32_array)
-DEFDBLCONVFN (uint64_matrix_to_double_matrix, uint64_matrix, uint64_array)
-
-DEFDBLCONVFN (int8_scalar_to_double_matrix, int8_scalar, int8_array)
-DEFDBLCONVFN (int16_scalar_to_double_matrix, int16_scalar, int16_array)
-DEFDBLCONVFN (int32_scalar_to_double_matrix, int32_scalar, int32_array)
-DEFDBLCONVFN (int64_scalar_to_double_matrix, int64_scalar, int64_array)
-
-DEFDBLCONVFN (uint8_scalar_to_double_matrix, uint8_scalar, uint8_array)
-DEFDBLCONVFN (uint16_scalar_to_double_matrix, uint16_scalar, uint16_array)
-DEFDBLCONVFN (uint32_scalar_to_double_matrix, uint32_scalar, uint32_array)
-DEFDBLCONVFN (uint64_scalar_to_double_matrix, uint64_scalar, uint64_array)
-
-DEFDBLCONVFN (bool_matrix_to_double_matrix, bool_matrix, bool_array)
-DEFDBLCONVFN (bool_scalar_to_double_matrix, bool, bool_array)
-
-DEFDBLCONVFN (sparse_matrix_to_double_matrix, sparse_matrix, array)
-DEFDBLCONVFN (sparse_bool_matrix_to_double_matrix, sparse_bool_matrix, array)
-
-DEFDBLCONVFN (range_to_double_matrix, range, array)
-
-DEFSTRDBLCONVFN(char_matrix_str_to_double_matrix, char_matrix_str)
-DEFSTRDBLCONVFN(char_matrix_sq_str_to_double_matrix, char_matrix_sq_str)
-
-DEFDBLCONVFN (double_scalar_to_double_matrix, scalar, array)
-
-void
-install_double_conv_ops (void)
-{
-  INSTALL_CONVOP (octave_int8_matrix, octave_matrix, int8_matrix_to_double_matrix);
-  INSTALL_CONVOP (octave_int16_matrix, octave_matrix, int16_matrix_to_double_matrix);
-  INSTALL_CONVOP (octave_int32_matrix, octave_matrix, int32_matrix_to_double_matrix);
-  INSTALL_CONVOP (octave_int64_matrix, octave_matrix, int64_matrix_to_double_matrix);
-
-  INSTALL_CONVOP (octave_uint8_matrix, octave_matrix, uint8_matrix_to_double_matrix);
-  INSTALL_CONVOP (octave_uint16_matrix, octave_matrix, uint16_matrix_to_double_matrix);
-  INSTALL_CONVOP (octave_uint32_matrix, octave_matrix, uint32_matrix_to_double_matrix);
-  INSTALL_CONVOP (octave_uint64_matrix, octave_matrix, uint64_matrix_to_double_matrix);
-
-  INSTALL_CONVOP (octave_int8_scalar, octave_matrix, int8_scalar_to_double_matrix);
-  INSTALL_CONVOP (octave_int16_scalar, octave_matrix, int16_scalar_to_double_matrix);
-  INSTALL_CONVOP (octave_int32_scalar, octave_matrix, int32_scalar_to_double_matrix);
-  INSTALL_CONVOP (octave_int64_scalar, octave_matrix, int64_scalar_to_double_matrix);
-
-  INSTALL_CONVOP (octave_uint8_scalar, octave_matrix, uint8_scalar_to_double_matrix);
-  INSTALL_CONVOP (octave_uint16_scalar, octave_matrix, uint16_scalar_to_double_matrix);
-  INSTALL_CONVOP (octave_uint32_scalar, octave_matrix, uint32_scalar_to_double_matrix);
-  INSTALL_CONVOP (octave_uint64_scalar, octave_matrix, uint64_scalar_to_double_matrix);
-
-  INSTALL_CONVOP (octave_bool_matrix, octave_matrix, bool_matrix_to_double_matrix);
-  INSTALL_CONVOP (octave_bool, octave_matrix, bool_scalar_to_double_matrix);
-
-  INSTALL_CONVOP (octave_sparse_matrix, octave_matrix, sparse_matrix_to_double_matrix);
-  INSTALL_CONVOP (octave_sparse_bool_matrix, octave_matrix, sparse_bool_matrix_to_double_matrix);
-
-  INSTALL_CONVOP (octave_range, octave_matrix, range_to_double_matrix);
-
-  INSTALL_CONVOP (octave_char_matrix_str, octave_matrix, char_matrix_str_to_double_matrix);
-  INSTALL_CONVOP (octave_char_matrix_sq_str, octave_matrix, char_matrix_sq_str_to_double_matrix);
-
-  INSTALL_CONVOP (octave_scalar, octave_matrix, double_scalar_to_double_matrix);
-}
--- a/src/OPERATORS/op-fcdm-fcdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-flt-cx-diag.h"
-#include "ov-cx-diag.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix unary ops.
-
-DEFUNOP_OP (uplus, float_complex_diag_matrix, /* no-op */)
-DEFUNOP_OP (uminus, float_complex_diag_matrix, -)
-
-DEFUNOP (transpose, float_complex_diag_matrix)
-{
-  CAST_UNOP_ARG (const octave_float_complex_diag_matrix&);
-  return octave_value (v.float_complex_diag_matrix_value ().transpose ());
-}
-
-DEFUNOP (hermitian, float_complex_diag_matrix)
-{
-  CAST_UNOP_ARG (const octave_float_complex_diag_matrix&);
-  return octave_value (v.float_complex_diag_matrix_value ().hermitian ());
-}
-
-// matrix by matrix ops.
-
-DEFBINOP_OP (add, float_complex_diag_matrix, float_complex_diag_matrix, +)
-DEFBINOP_OP (sub, float_complex_diag_matrix, float_complex_diag_matrix, -)
-DEFBINOP_OP (mul, float_complex_diag_matrix, float_complex_diag_matrix, *)
-
-DEFBINOP (div, float_complex_diag_matrix, float_complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_diag_matrix&, const octave_float_complex_diag_matrix&);
-
-  return xdiv (v1.float_complex_diag_matrix_value (),
-               v2.float_complex_diag_matrix_value ());
-}
-
-DEFBINOP (ldiv, float_complex_diag_matrix, float_complex_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_diag_matrix&, const octave_float_complex_diag_matrix&);
-
-  return xleftdiv (v1.float_complex_diag_matrix_value (),
-                   v2.float_complex_diag_matrix_value ());
-}
-
-CONVDECL (float_complex_diag_matrix_to_float_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_float_complex_diag_matrix&);
-
-  return new octave_float_complex_matrix (v.float_complex_matrix_value ());
-}
-
-CONVDECL (float_complex_diag_matrix_to_complex_diag_matrix)
-{
-  CAST_CONV_ARG (const octave_float_complex_diag_matrix&);
-
-  return new octave_complex_diag_matrix (v.complex_diag_matrix_value ());
-}
-
-void
-install_fcdm_fcdm_ops (void)
-{
-  INSTALL_UNOP (op_uplus, octave_float_complex_diag_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_float_complex_diag_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_float_complex_diag_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_float_complex_diag_matrix, hermitian);
-
-  INSTALL_BINOP (op_add, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, div);
-  INSTALL_BINOP (op_ldiv, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, ldiv);
-
-  INSTALL_CONVOP (octave_float_complex_diag_matrix, octave_complex_diag_matrix,
-                  float_complex_diag_matrix_to_complex_diag_matrix);
-  INSTALL_CONVOP (octave_float_complex_diag_matrix, octave_float_complex_matrix,
-                  float_complex_diag_matrix_to_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_float_complex_diag_matrix, octave_float_complex_matrix, octave_float_complex_matrix);
-  INSTALL_WIDENOP (octave_float_complex_diag_matrix, octave_complex_diag_matrix,
-                   float_complex_diag_matrix_to_complex_diag_matrix);
-}
--- a/src/OPERATORS/op-fcdm-fcm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-cx-diag.h"
-#define RINCLUDE "ov-flt-cx-mat.h"
-
-#define LMATRIX float_complex_diag_matrix
-#define RMATRIX float_complex_matrix
-
-#define LSHORT fcdm
-#define RSHORT fcm
-
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fcdm-fcs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 SINCLUDE "ov-flt-complex.h"
-#define MINCLUDE "ov-flt-cx-diag.h"
-
-#define SCALAR float_complex
-#define MATRIX float_complex_diag_matrix
-
-#define SSHORT fcs
-#define MSHORT fcdm
-
-#include "op-dms-template.cc"
-
--- a/src/OPERATORS/op-fcdm-fdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-flt-cx-diag.h"
-#include "ov-flt-re-diag.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#define LINCLUDE "ov-flt-cx-diag.h"
-#define RINCLUDE "ov-flt-re-diag.h"
-
-#define LMATRIX float_complex_diag_matrix
-#define RMATRIX float_diag_matrix
-#define RDMATRIX LMATRIX
-
-#define LSHORT fcdm
-#define RSHORT fdm
-
-#define DEFINEDIV
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fcdm-fm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-cx-diag.h"
-#define RINCLUDE "ov-flt-re-mat.h"
-
-#define LMATRIX float_complex_diag_matrix
-#define RMATRIX float_matrix
-#define RDMATRIX float_complex_matrix
-
-#define LSHORT fcdm
-#define RSHORT fm
-
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fcdm-fs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 SINCLUDE "ov-float.h"
-#define MINCLUDE "ov-flt-cx-diag.h"
-
-#define SCALAR float_scalar
-#define SCALARV float_complex
-#define MATRIX float_complex_diag_matrix
-
-#define SSHORT fs
-#define MSHORT fcdm
-
-#include "op-dms-template.cc"
-
--- a/src/OPERATORS/op-fcm-fcdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-cx-mat.h"
-#define RINCLUDE "ov-flt-cx-diag.h"
-
-#define LMATRIX float_complex_matrix
-#define RMATRIX float_complex_diag_matrix
-
-#define LSHORT fcm
-#define RSHORT fcdm
-
-#define DEFINEDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fcm-fcm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,335 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// unary complex matrix ops.
-
-DEFNDUNOP_OP (not, float_complex_matrix, float_complex_array, !)
-DEFNDUNOP_OP (uplus, float_complex_matrix, float_complex_array, /* no-op */)
-DEFNDUNOP_OP (uminus, float_complex_matrix, float_complex_array, -)
-
-DEFUNOP (transpose, float_complex_matrix)
-{
-  CAST_UNOP_ARG (const octave_float_complex_matrix&);
-
-  if (v.ndims () > 2)
-    {
-      error ("transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.float_complex_matrix_value ().transpose ());
-}
-
-DEFUNOP (hermitian, float_complex_matrix)
-{
-  CAST_UNOP_ARG (const octave_float_complex_matrix&);
-
-  if (v.ndims () > 2)
-    {
-      error ("complex-conjugate transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.float_complex_matrix_value ().hermitian ());
-}
-
-DEFNCUNOP_METHOD (incr, float_complex_matrix, increment)
-DEFNCUNOP_METHOD (decr, float_complex_matrix, decrement)
-DEFNCUNOP_METHOD (changesign, float_complex_matrix, changesign)
-
-// complex matrix by complex matrix ops.
-
-DEFNDBINOP_OP (add, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, +)
-DEFNDBINOP_OP (sub, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, -)
-
-DEFBINOP_OP (mul, float_complex_matrix, float_complex_matrix, *)
-
-DEFBINOP (div, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (),
-                            v2.float_complex_matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, float_complex_matrix, float_complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
-                                     v2.float_complex_matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP (trans_mul, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&);
-  return octave_value(xgemm (v1.float_complex_matrix_value (),
-                             v2.float_complex_matrix_value (),
-                             blas_trans, blas_no_trans));
-}
-
-DEFBINOP (mul_trans, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&);
-  return octave_value(xgemm (v1.float_complex_matrix_value (),
-                             v2.float_complex_matrix_value (),
-                             blas_no_trans, blas_trans));
-}
-
-DEFBINOP (herm_mul, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&);
-  return octave_value(xgemm (v1.float_complex_matrix_value (),
-                             v2.float_complex_matrix_value (),
-                             blas_conj_trans, blas_no_trans));
-}
-
-DEFBINOP (mul_herm, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&);
-  return octave_value(xgemm (v1.float_complex_matrix_value (),
-                             v2.float_complex_matrix_value (),
-                             blas_no_trans, blas_conj_trans));
-}
-
-DEFBINOP (trans_ldiv, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
-                                     v2.float_complex_matrix_value (), typ, blas_trans);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP (herm_ldiv, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
-                                     v2.float_complex_matrix_value (), typ, blas_conj_trans);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, mx_el_ne)
-
-DEFNDBINOP_FN (el_mul, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, product)
-DEFNDBINOP_FN (el_div, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, quotient)
-DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, elem_xpow)
-
-DEFBINOP (el_ldiv, float_complex_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex_matrix&);
-
-  return octave_value (quotient (v2.float_complex_array_value (), v1.float_complex_array_value ()));
-}
-
-DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, mx_el_or)
-
-DEFNDCATOP_FN (fcm_fcm, float_complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, concat)
-
-DEFNDCATOP_FN (cm_fcm, complex_matrix, float_complex_matrix,
-               float_complex_array, float_complex_array, concat)
-
-DEFNDCATOP_FN (fcm_cm, float_complex_matrix, complex_matrix,
-               float_complex_array, float_complex_array, concat)
-
-DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex_matrix,
-                  float_complex_array, assign)
-DEFNDASSIGNOP_FN (dbl_clx_assign, float_complex_matrix, complex_matrix,
-                  float_complex_array, assign)
-DEFNDASSIGNOP_FN (dbl_assign, float_complex_matrix, matrix,
-                  float_complex_array, assign)
-
-DEFNULLASSIGNOP_FN (null_assign, float_complex_matrix, delete_elements)
-
-DEFNDASSIGNOP_OP (assign_add, float_complex_matrix,
-                  float_complex_matrix, float_complex_array, +=)
-DEFNDASSIGNOP_OP (assign_sub, float_complex_matrix,
-                  float_complex_matrix, float_complex_array, -=)
-DEFNDASSIGNOP_FNOP (assign_el_mul, float_complex_matrix, float_complex_matrix,
-                    float_complex_array, product_eq)
-DEFNDASSIGNOP_FNOP (assign_el_div, float_complex_matrix, float_complex_matrix,
-                    float_complex_array, quotient_eq)
-
-CONVDECL (float_complex_matrix_to_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_float_complex_matrix&);
-
-  return new octave_complex_matrix (ComplexNDArray (v.float_complex_array_value ()));
-}
-
-void
-install_fcm_fcm_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_float_complex_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_float_complex_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_float_complex_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_float_complex_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_float_complex_matrix, hermitian);
-
-  INSTALL_NCUNOP (op_incr, octave_float_complex_matrix, incr);
-  INSTALL_NCUNOP (op_decr, octave_float_complex_matrix, decr);
-  INSTALL_NCUNOP (op_uminus, octave_float_complex_matrix, changesign);
-
-  INSTALL_BINOP (op_add, octave_float_complex_matrix,
-                 octave_float_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_complex_matrix,
-                 octave_float_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex_matrix,
-                 octave_float_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_complex_matrix,
-                 octave_float_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_float_complex_matrix,
-                 octave_float_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_complex_matrix,
-                 octave_float_complex_matrix, ldiv);
-  INSTALL_BINOP (op_trans_mul, octave_float_complex_matrix,
-                 octave_float_complex_matrix, trans_mul);
-  INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix,
-                 octave_float_complex_matrix, mul_trans);
-  INSTALL_BINOP (op_herm_mul, octave_float_complex_matrix,
-                 octave_float_complex_matrix, herm_mul);
-  INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix,
-                 octave_float_complex_matrix, mul_herm);
-  INSTALL_BINOP (op_trans_ldiv, octave_float_complex_matrix,
-                 octave_float_complex_matrix, trans_ldiv);
-  INSTALL_BINOP (op_herm_ldiv, octave_float_complex_matrix,
-                 octave_float_complex_matrix, herm_ldiv);
-
-  INSTALL_BINOP (op_lt, octave_float_complex_matrix,
-                 octave_float_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_float_complex_matrix,
-                 octave_float_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_float_complex_matrix,
-                 octave_float_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_float_complex_matrix,
-                 octave_float_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_float_complex_matrix,
-                 octave_float_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_float_complex_matrix,
-                 octave_float_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_complex_matrix,
-                 octave_float_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_complex_matrix,
-                 octave_float_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_complex_matrix,
-                 octave_float_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix,
-                 octave_float_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_complex_matrix,
-                 octave_float_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_complex_matrix,
-                 octave_float_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_float_complex_matrix,
-                 octave_float_complex_matrix, fcm_fcm);
-  INSTALL_CATOP (octave_complex_matrix,
-                 octave_float_complex_matrix, cm_fcm);
-  INSTALL_CATOP (octave_float_complex_matrix,
-                 octave_complex_matrix, fcm_cm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_float_complex_matrix, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_complex_matrix, dbl_clx_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_matrix, dbl_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_null_sq_str, null_assign);
-
-  INSTALL_ASSIGNOP (op_add_eq, octave_float_complex_matrix,
-                    octave_float_complex_matrix, assign_add);
-  INSTALL_ASSIGNOP (op_sub_eq, octave_float_complex_matrix,
-                    octave_float_complex_matrix, assign_sub);
-  INSTALL_ASSIGNOP (op_el_mul_eq, octave_float_complex_matrix,
-                    octave_float_complex_matrix, assign_el_mul);
-  INSTALL_ASSIGNOP (op_el_div_eq, octave_float_complex_matrix,
-                    octave_float_complex_matrix, assign_el_div);
-
-  INSTALL_CONVOP (octave_float_complex_matrix, octave_complex_matrix,
-                  float_complex_matrix_to_complex_matrix);
-}
--- a/src/OPERATORS/op-fcm-fcs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-flt-complex.h"
-#include "ov-complex.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex matrix by complex scalar ops.
-
-DEFNDBINOP_OP (add, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, +)
-DEFNDBINOP_OP (sub, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, -)
-DEFNDBINOP_OP (mul, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, *)
-
-DEFBINOP (div, float_complex_matrix, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex&);
-
-  FloatComplex d = v2.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_complex_array_value () / d);
-}
-
-DEFBINOP_FN (pow, float_complex_matrix, float_complex, xpow)
-
-DEFBINOP (ldiv, float_complex_matrix, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex&);
-
-  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
-  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (m1, m2, typ);
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, *)
-
-DEFBINOP (el_div, float_complex_matrix, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex&);
-
-  FloatComplex d = v2.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_complex_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, elem_xpow)
-
-DEFBINOP (el_ldiv, float_complex_matrix, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_complex&);
-
-  return x_el_div (v2.float_complex_value (), v1.float_complex_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex,
-               float_complex_array, float_complex, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_complex_matrix, float_complex,
-               float_complex_array, float_complex, mx_el_or)
-
-DEFNDCATOP_FN (fcm_fcs, float_complex_matrix, float_complex,
-               float_complex_array, float_complex_array, concat)
-
-DEFNDCATOP_FN (cm_fcs, complex_matrix, float_complex,
-               float_complex_array, float_complex_array, concat)
-
-DEFNDCATOP_FN (fcm_cs, float_complex_matrix, complex,
-               float_complex_array, float_complex_array, concat)
-
-DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex,
-                  float_complex, assign)
-DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_complex,
-                  complex, assign)
-
-DEFNDASSIGNOP_OP (assign_add, float_complex_matrix, float_complex_scalar,
-                  float_complex, +=)
-DEFNDASSIGNOP_OP (assign_sub, float_complex_matrix, float_complex_scalar,
-                  float_complex, -=)
-DEFNDASSIGNOP_OP (assign_mul, float_complex_matrix, float_complex_scalar,
-                  float_complex, *=)
-DEFNDASSIGNOP_OP (assign_div, float_complex_matrix, float_complex_scalar,
-                  float_complex, /=)
-
-void
-install_fcm_fcs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_complex_matrix,
-                 octave_float_complex, add);
-  INSTALL_BINOP (op_sub, octave_float_complex_matrix,
-                 octave_float_complex, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex_matrix,
-                 octave_float_complex, mul);
-  INSTALL_BINOP (op_div, octave_float_complex_matrix,
-                 octave_float_complex, div);
-  INSTALL_BINOP (op_pow, octave_float_complex_matrix,
-                 octave_float_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_complex_matrix,
-                 octave_float_complex, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_complex, lt);
-  INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_complex, le);
-  INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_complex, eq);
-  INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_complex, ge);
-  INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_complex, gt);
-  INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_complex_matrix,
-                 octave_float_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_complex_matrix,
-                 octave_float_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_complex_matrix,
-                 octave_float_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix,
-                 octave_float_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_complex_matrix,
-                 octave_float_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_complex_matrix,
-                 octave_float_complex, el_or);
-
-  INSTALL_CATOP (octave_float_complex_matrix, octave_float_complex, fcm_fcs);
-  INSTALL_CATOP (octave_complex_matrix, octave_float_complex, cm_fcs);
-  INSTALL_CATOP (octave_float_complex_matrix, octave_complex, fcm_cs);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_float_complex, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
-                    octave_float_complex, dbl_assign);
-
-  INSTALL_ASSIGNOP (op_add_eq, octave_float_complex_matrix,
-                    octave_float_complex_scalar, assign_add);
-  INSTALL_ASSIGNOP (op_sub_eq, octave_float_complex_matrix,
-                    octave_float_complex_scalar, assign_sub);
-  INSTALL_ASSIGNOP (op_mul_eq, octave_float_complex_matrix,
-                    octave_float_complex_scalar, assign_mul);
-  INSTALL_ASSIGNOP (op_div_eq, octave_float_complex_matrix,
-                    octave_float_complex_scalar, assign_div);
-}
--- a/src/OPERATORS/op-fcm-fdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-cx-mat.h"
-#define RINCLUDE "ov-flt-re-diag.h"
-
-#define LMATRIX float_complex_matrix
-#define RMATRIX float_diag_matrix
-
-#define LSHORT fcm
-#define RSHORT fdm
-
-#define DEFINEDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fcm-fm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-fcm-fm.h"
-#include "mx-fm-fcm.h"
-#include "mx-fcnda-fnda.h"
-#include "mx-fnda-fcnda.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex matrix by matrix ops.
-
-DEFNDBINOP_OP (add, float_complex_matrix, float_matrix, float_complex_array, float_array, +)
-DEFNDBINOP_OP (sub, float_complex_matrix, float_matrix, float_complex_array, float_array, -)
-
-DEFBINOP_OP (mul, float_complex_matrix, float_matrix, *)
-
-DEFBINOP (mul_trans, float_complex_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_matrix&);
-
-  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
-  FloatMatrix m2 = v2.float_matrix_value ();
-
-  return FloatComplexMatrix (xgemm (real (m1), m2, blas_no_trans, blas_trans),
-                             xgemm (imag (m1), m2, blas_no_trans, blas_trans));
-}
-
-DEFBINOP (div, float_complex_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (),
-                                 v2.float_matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-
-DEFBINOPX (pow, float_complex_matrix, float_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, float_complex_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
-                                     v2.float_matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, mx_el_ne)
-
-DEFNDBINOP_FN (el_mul, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, product)
-DEFNDBINOP_FN (el_div, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, quotient)
-DEFNDBINOP_FN (el_pow, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, elem_xpow)
-
-DEFBINOP (el_ldiv, float_complex_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
-                   const octave_float_matrix&);
-
-  return quotient (v2.float_array_value (), v1.float_complex_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_complex_matrix, float_matrix,
-               float_complex_array, float_array, mx_el_or)
-
-DEFNDCATOP_FN (fcm_fm, float_complex_matrix, float_matrix,
-               float_complex_array, float_array, concat)
-
-DEFNDCATOP_FN (cm_fm, complex_matrix, float_matrix,
-               float_complex_array, float_array, concat)
-
-DEFNDCATOP_FN (fcm_m, float_complex_matrix, matrix,
-               float_complex_array, float_array, concat)
-
-DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_matrix,
-                  float_complex_array, assign)
-DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_matrix,
-                  complex_array, assign)
-
-void
-install_fcm_fm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_complex_matrix, octave_float_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_complex_matrix, octave_float_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_matrix, div);
-  INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_complex_matrix,
-                 octave_float_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_matrix, lt);
-  INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_matrix, le);
-  INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_complex_matrix,
-                 octave_float_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_complex_matrix,
-                 octave_float_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_complex_matrix,
-                 octave_float_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix,
-                 octave_float_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_complex_matrix,
-                 octave_float_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_complex_matrix,
-                 octave_float_matrix, el_or);
-  INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix,
-                 octave_float_matrix, mul_trans);
-  INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix,
-                 octave_float_matrix, mul_trans);
-
-  INSTALL_CATOP (octave_float_complex_matrix, octave_float_matrix, fcm_fm);
-  INSTALL_CATOP (octave_complex_matrix, octave_float_matrix, cm_fm);
-  INSTALL_CATOP (octave_float_complex_matrix, octave_matrix, fcm_m);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_float_matrix, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
-                    octave_float_matrix, dbl_assign);
-}
--- a/src/OPERATORS/op-fcm-fs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-cm-s.h"
-#include "mx-cnda-s.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-float.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex matrix by scalar ops.
-
-DEFNDBINOP_OP (add, float_complex_matrix, float_scalar, float_complex_array, float_scalar, +)
-DEFNDBINOP_OP (sub, float_complex_matrix, float_scalar, float_complex_array, float_scalar, -)
-DEFNDBINOP_OP (mul, float_complex_matrix, float_scalar, float_complex_array, float_scalar, *)
-
-DEFBINOP (div, float_complex_matrix, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_scalar&);
-
-  float d = v2.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_complex_array_value () / d);
-}
-
-DEFBINOP_FN (pow, float_complex_matrix, float_scalar, xpow)
-
-DEFBINOP (ldiv, float_complex_matrix, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_scalar&);
-
-  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
-  FloatMatrix m2 = v2.float_matrix_value ();
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (m1, m2, typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, *)
-
-DEFBINOP (el_div, float_complex_matrix, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_scalar&);
-
-  float d = v2.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_complex_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_pow, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, elem_xpow)
-
-DEFBINOP (el_ldiv, float_complex_matrix, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_scalar&);
-
-  return x_el_div (v2.float_value (), v1.float_complex_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_complex_matrix, float_scalar, float_complex_array,
-               float_scalar, mx_el_or)
-
-DEFNDCATOP_FN (fcm_fs, float_complex_matrix, float_scalar, float_complex_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (cm_fs, complex_matrix, float_scalar, float_complex_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (fcm_s, float_complex_matrix, scalar, float_complex_array,
-               float_array, concat)
-
-DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_scalar, float_complex_array, assign)
-DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_scalar, complex_array, assign)
-
-DEFNDASSIGNOP_OP (assign_mul, float_complex_matrix, float_scalar,
-                  float_scalar, *=)
-DEFNDASSIGNOP_OP (assign_div, float_complex_matrix, float_scalar,
-                  float_scalar, /=)
-
-void
-install_fcm_fs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_complex_matrix, octave_float_scalar, add);
-  INSTALL_BINOP (op_sub, octave_float_complex_matrix, octave_float_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_scalar, mul);
-  INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_scalar, div);
-  INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_complex_matrix, octave_float_scalar, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_scalar, lt);
-  INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_scalar, le);
-  INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_complex_matrix, octave_float_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_complex_matrix, octave_float_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_complex_matrix, octave_float_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix, octave_float_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_complex_matrix, octave_float_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_complex_matrix, octave_float_scalar, el_or);
-
-  INSTALL_CATOP (octave_float_complex_matrix, octave_float_scalar, fcm_fs);
-  INSTALL_CATOP (octave_complex_matrix, octave_float_scalar, cm_fs);
-  INSTALL_CATOP (octave_float_complex_matrix, octave_scalar, fcm_s);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
-                    octave_float_scalar, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
-                    octave_float_scalar, dbl_assign);
-
-  INSTALL_ASSIGNOP (op_mul_eq, octave_float_complex_matrix,
-                    octave_float_scalar, assign_mul);
-  INSTALL_ASSIGNOP (op_div_eq, octave_float_complex_matrix,
-                    octave_float_scalar, assign_div);
-}
--- a/src/OPERATORS/op-fcm-pm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 MINCLUDE "ov-flt-cx-mat.h"
-
-#define LMATRIX float_complex_matrix
-#define RMATRIX perm_matrix
-
-#define LSHORT fcm
-#define RSHORT pm
-
-#define RIGHT
-
-#include "op-pm-template.cc"
--- a/src/OPERATORS/op-fcn.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-
-Copyright (C) 2010-2012 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-fcn-handle.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-DEFBINOP (eq, fcn_handle, fcn_handle)
-{
-  CAST_BINOP_ARGS (const octave_fcn_handle&, const octave_fcn_handle&);
-
-  return v1.is_equal_to (v2);
-}
-
-DEFBINOP (ne, fcn_handle, fcn_handle)
-{
-  CAST_BINOP_ARGS (const octave_fcn_handle&, const octave_fcn_handle&);
-
-  return ! v1.is_equal_to (v2);
-}
-
-void
-install_fcn_ops (void)
-{
-  INSTALL_BINOP (op_eq, octave_fcn_handle, octave_fcn_handle, eq);
-  INSTALL_BINOP (op_ne, octave_fcn_handle, octave_fcn_handle, ne);
-}
--- a/src/OPERATORS/op-fcs-fcm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex scalar by complex matrix ops.
-
-DEFNDBINOP_OP (add, float_complex, float_complex_matrix, float_complex, float_complex_array, +)
-DEFNDBINOP_OP (sub, float_complex, float_complex_matrix, float_complex, float_complex_array, -)
-DEFNDBINOP_OP (mul, float_complex, float_complex_matrix, float_complex, float_complex_array, *)
-
-DEFBINOP (div, float_complex, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
-
-  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
-  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
-  MatrixType typ = v2.matrix_type ();
-
-  FloatComplexMatrix ret = xdiv (m1, m2, typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (pow, float_complex, float_complex_matrix, xpow)
-
-DEFBINOP (ldiv, float_complex, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
-
-  FloatComplex d = v1.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_complex_array_value () / d);
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, *)
-DEFNDBINOP_FN (el_div, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, x_el_div)
-DEFNDBINOP_FN (el_pow, float_complex, float_complex_matrix, float_complex,
-               float_complex_array, elem_xpow)
-
-DEFBINOP (el_ldiv, float_complex, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
-
-  FloatComplex d = v1.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_complex_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_and, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_or)
-
-DEFNDCATOP_FN (fcs_fcm, float_complex, float_complex_matrix, float_complex_array, float_complex_array, concat)
-
-DEFNDCATOP_FN (cs_fcm, complex, float_complex_matrix, float_complex_array, float_complex_array, concat)
-
-DEFNDCATOP_FN (fcs_cm, float_complex, complex_matrix, float_complex_array, float_complex_array, concat)
-
-DEFCONV (float_complex_matrix_conv, float_complex, float_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_float_complex&);
-
-  return new octave_float_complex_matrix (v.float_complex_matrix_value ());
-}
-
-void
-install_fcs_fcm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_complex, octave_float_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_complex, octave_float_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex, octave_float_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_complex, octave_float_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_float_complex, octave_float_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_complex, octave_float_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_float_complex, octave_float_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_float_complex, octave_float_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_float_complex, octave_float_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_float_complex, octave_float_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_float_complex, octave_float_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_float_complex, octave_float_complex_matrix, fcs_fcm);
-  INSTALL_CATOP (octave_complex, octave_float_complex_matrix, cs_fcm);
-  INSTALL_CATOP (octave_float_complex, octave_complex_matrix, fcs_cm);
-
-  INSTALL_ASSIGNCONV (octave_float_complex, octave_float_complex_matrix, octave_float_complex_matrix);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_float_complex_matrix, octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_float_complex, octave_float_complex_matrix, float_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-fcs-fcs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// unary complex scalar ops.
-
-DEFUNOP (not, float_complex)
-{
-  CAST_UNOP_ARG (const octave_float_complex&);
-  FloatComplex x = v.float_complex_value ();
-  if (xisnan (x))
-    gripe_nan_to_logical_conversion ();
-  return octave_value (x == 0.0f);
-}
-
-DEFUNOP_OP (uplus, float_complex, /* no-op */)
-DEFUNOP_OP (uminus, float_complex, -)
-DEFUNOP_OP (transpose, float_complex, /* no-op */)
-
-DEFUNOP (hermitian, float_complex)
-{
-  CAST_UNOP_ARG (const octave_float_complex&);
-
-  return octave_value (conj (v.float_complex_value ()));
-}
-
-DEFNCUNOP_METHOD (incr, float_complex, increment)
-DEFNCUNOP_METHOD (decr, float_complex, decrement)
-
-// complex scalar by complex scalar ops.
-
-DEFBINOP_OP (add, float_complex, float_complex, +)
-DEFBINOP_OP (sub, float_complex, float_complex, -)
-DEFBINOP_OP (mul, float_complex, float_complex, *)
-
-DEFBINOP (div, float_complex, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
-
-  FloatComplex d = v2.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_complex_value () / d);
-}
-
-DEFBINOP_FN (pow, float_complex, float_complex, xpow)
-
-DEFBINOP (ldiv, float_complex, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
-
-  FloatComplex d = v1.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_complex_value () / d);
-}
-
-DEFCMPLXCMPOP_OP (lt, float_complex, float_complex, <)
-DEFCMPLXCMPOP_OP (le, float_complex, float_complex, <=)
-DEFCMPLXCMPOP_OP (eq, float_complex, float_complex, ==)
-DEFCMPLXCMPOP_OP (ge, float_complex, float_complex, >=)
-DEFCMPLXCMPOP_OP (gt, float_complex, float_complex, >)
-DEFCMPLXCMPOP_OP (ne, float_complex, float_complex, !=)
-
-DEFBINOP_OP (el_mul, float_complex, float_complex, *)
-
-DEFBINOP (el_div, float_complex, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
-
-  FloatComplex d = v2.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_complex_value () / d);
-}
-
-DEFBINOP_FN (el_pow, float_complex, float_complex, xpow)
-
-DEFBINOP (el_ldiv, float_complex, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
-
-  FloatComplex d = v1.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_complex_value () / d);
-}
-
-DEFBINOP (el_and, float_complex, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
-
-  return (v1.float_complex_value () != static_cast<float>(0.0) &&
-          v2.float_complex_value () != static_cast<float>(0.0));
-}
-
-DEFBINOP (el_or, float_complex, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
-
-  return (v1.float_complex_value () != static_cast<float>(0.0) ||
-          v2.float_complex_value () != static_cast<float>(0.0));
-}
-
-DEFNDCATOP_FN (fcs_fcs, float_complex, float_complex, float_complex_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (cs_fcs, complex, float_complex, float_complex_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (fcs_cs, float_complex, complex, float_complex_array,
-               float_complex_array, concat)
-
-CONVDECL (float_complex_to_complex)
-{
-  CAST_CONV_ARG (const octave_float_complex&);
-
-  return new octave_complex_matrix (ComplexMatrix (1, 1, static_cast<Complex>(v.float_complex_value ())));
-}
-
-void
-install_fcs_fcs_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_float_complex, not);
-  INSTALL_UNOP (op_uplus, octave_float_complex, uplus);
-  INSTALL_UNOP (op_uminus, octave_float_complex, uminus);
-  INSTALL_UNOP (op_transpose, octave_float_complex, transpose);
-  INSTALL_UNOP (op_hermitian, octave_float_complex, hermitian);
-
-  INSTALL_NCUNOP (op_incr, octave_float_complex, incr);
-  INSTALL_NCUNOP (op_decr, octave_float_complex, decr);
-
-  INSTALL_BINOP (op_add, octave_float_complex, octave_float_complex, add);
-  INSTALL_BINOP (op_sub, octave_float_complex, octave_float_complex, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex, octave_float_complex, mul);
-  INSTALL_BINOP (op_div, octave_float_complex, octave_float_complex, div);
-  INSTALL_BINOP (op_pow, octave_float_complex, octave_float_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_complex, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_complex, octave_float_complex, lt);
-  INSTALL_BINOP (op_le, octave_float_complex, octave_float_complex, le);
-  INSTALL_BINOP (op_eq, octave_float_complex, octave_float_complex, eq);
-  INSTALL_BINOP (op_ge, octave_float_complex, octave_float_complex, ge);
-  INSTALL_BINOP (op_gt, octave_float_complex, octave_float_complex, gt);
-  INSTALL_BINOP (op_ne, octave_float_complex, octave_float_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_complex, el_or);
-
-  INSTALL_CATOP (octave_float_complex, octave_float_complex, fcs_fcs);
-  INSTALL_CATOP (octave_complex, octave_float_complex, cs_fcs);
-  INSTALL_CATOP (octave_float_complex, octave_complex, fcs_cs);
-
-  INSTALL_ASSIGNCONV (octave_float_complex, octave_float_complex, octave_float_complex_matrix);
-
-  INSTALL_ASSIGNCONV (octave_complex, octave_float_complex, octave_complex_matrix);
-
-  INSTALL_ASSIGNCONV (octave_float_complex, octave_null_matrix, octave_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_float_complex, octave_null_str, octave_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_float_complex, octave_null_sq_str, octave_float_complex_matrix);
-
-  INSTALL_CONVOP (octave_float_complex, octave_complex_matrix,
-                  float_complex_to_complex);
-}
--- a/src/OPERATORS/op-fcs-fm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-cs-nda.h"
-#include "mx-nda-cs.h"
-#include "mx-cs-nda.h"
-#include "mx-nda-cs.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex scalar by matrix ops.
-
-DEFNDBINOP_OP (add, float_complex, float_matrix, float_complex, float_array, +)
-DEFNDBINOP_OP (sub, float_complex, float_matrix, float_complex, float_array, -)
-DEFNDBINOP_OP (mul, float_complex, float_matrix, float_complex, float_array, *)
-
-DEFBINOP (div, float_complex, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_matrix&);
-
-  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
-  FloatMatrix m2 = v2.float_matrix_value ();
-  MatrixType typ = v2.matrix_type ();
-
-  FloatComplexMatrix ret = xdiv (m1, m2, typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (pow, float_complex, float_matrix, xpow)
-
-DEFBINOP (ldiv, float_complex, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_matrix&);
-
-  FloatComplex d = v1.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_array_value () / d);
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_complex, float_matrix, float_complex,
-               float_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_complex, float_matrix, float_complex,
-               float_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_complex, float_matrix, float_complex,
-               float_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_complex, float_matrix, float_complex,
-               float_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_complex, float_matrix, float_complex,
-               float_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_complex, float_matrix, float_complex,
-               float_array, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, float_complex, float_matrix, float_complex,
-               float_array, *)
-DEFNDBINOP_FN (el_div, float_complex, float_matrix, float_complex,
-               float_array, x_el_div)
-DEFNDBINOP_FN (el_pow, float_complex, float_matrix, float_complex,
-               float_array, elem_xpow)
-
-DEFBINOP (el_ldiv, float_complex, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_matrix&);
-
-  FloatComplex d = v1.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_and, float_complex, float_matrix, float_complex,
-               float_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_complex, float_matrix, float_complex,
-               float_array, mx_el_or)
-
-DEFNDCATOP_FN (fcs_fm, float_complex, float_matrix, float_complex_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (cs_fm, complex, float_matrix, float_complex_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (fcs_m, float_complex, matrix, float_complex_array,
-               float_array, concat)
-
-void
-install_fcs_fm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_complex, octave_float_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_complex, octave_float_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex, octave_float_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_complex, octave_float_matrix, div);
-  INSTALL_BINOP (op_pow, octave_float_complex, octave_float_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_complex, octave_float_matrix, lt);
-  INSTALL_BINOP (op_le, octave_float_complex, octave_float_matrix, le);
-  INSTALL_BINOP (op_eq, octave_float_complex, octave_float_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_float_complex, octave_float_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_float_complex, octave_float_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_float_complex, octave_float_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_matrix, el_or);
-
-  INSTALL_CATOP (octave_float_complex, octave_float_matrix, fcs_fm);
-  INSTALL_CATOP (octave_complex, octave_float_matrix, cs_fm);
-  INSTALL_CATOP (octave_float_complex, octave_matrix, fcs_m);
-
-  INSTALL_ASSIGNCONV (octave_float_complex, octave_float_matrix,
-                      octave_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_complex, octave_float_matrix,
-                      octave_complex_matrix);
-}
--- a/src/OPERATORS/op-fcs-fs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-float.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// complex scalar by scalar ops.
-
-DEFBINOP_OP (add, float_complex, float_scalar, +)
-DEFBINOP_OP (sub, float_complex, float_scalar, -)
-DEFBINOP_OP (mul, float_complex, float_scalar, *)
-
-DEFBINOP (div, float_complex, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
-
-  float d = v2.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_complex_value () / d);
-}
-
-DEFBINOP_FN (pow, float_complex, float_scalar, xpow)
-
-DEFBINOP (ldiv, float_complex, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
-
-  FloatComplex d = v1.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_value () / d);
-}
-
-DEFCMPLXCMPOP_OP (lt, float_complex, float_scalar, <)
-DEFCMPLXCMPOP_OP (le, float_complex, float_scalar, <=)
-DEFCMPLXCMPOP_OP (eq, float_complex, float_scalar, ==)
-DEFCMPLXCMPOP_OP (ge, float_complex, float_scalar, >=)
-DEFCMPLXCMPOP_OP (gt, float_complex, float_scalar, >)
-DEFCMPLXCMPOP_OP (ne, float_complex, float_scalar, !=)
-
-DEFBINOP_OP (el_mul, float_complex, float_scalar, *)
-
-DEFBINOP (el_div, float_complex, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
-
-  float d = v2.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_complex_value () / d);
-}
-
-DEFBINOP_FN (el_pow, float_complex, float_scalar, xpow)
-
-DEFBINOP (el_ldiv, float_complex, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
-
-  FloatComplex d = v1.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_value () / d);
-}
-
-DEFBINOP (el_and, float_complex, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
-
-  return (v1.float_complex_value () != static_cast<float>(0.0) &&
-          v2.float_value ());
-}
-
-DEFBINOP (el_or, float_complex, float)
-{
-  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
-
-  return (v1.float_complex_value () != static_cast<float>(0.0) ||
-          v2.float_value ());
-}
-
-DEFNDCATOP_FN (fcs_fs, float_complex, float_scalar, float_complex_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (cs_fs, complex, float_scalar, float_complex_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (fcs_s, float_complex, scalar, float_complex_array,
-               float_array, concat)
-
-void
-install_fcs_fs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_complex, octave_float_scalar, add);
-  INSTALL_BINOP (op_sub, octave_float_complex, octave_float_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_float_complex, octave_float_scalar, mul);
-  INSTALL_BINOP (op_div, octave_float_complex, octave_float_scalar, div);
-  INSTALL_BINOP (op_pow, octave_float_complex, octave_float_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_scalar, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_complex, octave_float_scalar, lt);
-  INSTALL_BINOP (op_le, octave_float_complex, octave_float_scalar, le);
-  INSTALL_BINOP (op_eq, octave_float_complex, octave_float_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_float_complex, octave_float_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_float_complex, octave_float_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_float_complex, octave_float_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_scalar, el_or);
-
-  INSTALL_CATOP (octave_float_complex, octave_float_scalar, fcs_fs);
-  INSTALL_CATOP (octave_complex, octave_float_scalar, cs_fs);
-  INSTALL_CATOP (octave_float_complex, octave_scalar, fcs_s);
-
-  INSTALL_ASSIGNCONV (octave_float_complex, octave_float_scalar,
-                      octave_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_complex, octave_float_scalar,
-                      octave_complex_matrix);
-}
--- a/src/OPERATORS/op-fdm-fcdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-re-diag.h"
-#define RINCLUDE "ov-flt-cx-diag.h"
-
-#define LMATRIX float_diag_matrix
-#define RMATRIX float_complex_diag_matrix
-#define LDMATRIX RMATRIX
-
-#define LSHORT fdm
-#define RSHORT fcdm
-
-#define DEFINEDIV
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fdm-fcm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-re-diag.h"
-#define RINCLUDE "ov-flt-cx-mat.h"
-
-#define LMATRIX float_diag_matrix
-#define RMATRIX float_complex_matrix
-
-#define LSHORT fdm
-#define RSHORT fcm
-
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fdm-fcs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 SINCLUDE "ov-flt-complex.h"
-#define MINCLUDE "ov-flt-re-diag.h"
-
-#define SCALAR float_complex
-#define MATRIX float_diag_matrix
-#define MATRIXV float_complex_diag_matrix
-
-#define SSHORT fcs
-#define MSHORT fdm
-
-#include "op-dms-template.cc"
-
--- a/src/OPERATORS/op-fdm-fdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-flt-re-mat.h"
-#include "ov-flt-re-diag.h"
-#include "ov-re-diag.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix unary ops.
-
-DEFUNOP_OP (uplus, float_diag_matrix, /* no-op */)
-DEFUNOP_OP (uminus, float_diag_matrix, -)
-
-DEFUNOP (transpose, float_diag_matrix)
-{
-  CAST_UNOP_ARG (const octave_float_diag_matrix&);
-  return octave_value (v.float_diag_matrix_value ().transpose ());
-}
-
-// matrix by matrix ops.
-
-DEFBINOP_OP (add, float_diag_matrix, float_diag_matrix, +)
-DEFBINOP_OP (sub, float_diag_matrix, float_diag_matrix, -)
-DEFBINOP_OP (mul, float_diag_matrix, float_diag_matrix, *)
-
-DEFBINOP (div, float_diag_matrix, float_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_diag_matrix&, const octave_float_diag_matrix&);
-
-  return xdiv (v1.float_diag_matrix_value (),
-               v2.float_diag_matrix_value ());
-}
-
-DEFBINOP (ldiv, float_diag_matrix, float_diag_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_diag_matrix&, const octave_float_diag_matrix&);
-
-  return xleftdiv (v1.float_diag_matrix_value (),
-                   v2.float_diag_matrix_value ());
-}
-
-CONVDECL (float_diag_matrix_to_diag_matrix)
-{
-  CAST_CONV_ARG (const octave_float_diag_matrix&);
-
-  return new octave_diag_matrix (v.diag_matrix_value ());
-}
-
-CONVDECL (float_diag_matrix_to_float_matrix)
-{
-  CAST_CONV_ARG (const octave_float_diag_matrix&);
-
-  return new octave_float_matrix (v.float_matrix_value ());
-}
-
-void
-install_fdm_fdm_ops (void)
-{
-  INSTALL_UNOP (op_uplus, octave_float_diag_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_float_diag_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_float_diag_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_float_diag_matrix, transpose);
-
-  INSTALL_BINOP (op_add, octave_float_diag_matrix, octave_float_diag_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_diag_matrix, octave_float_diag_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_diag_matrix, octave_float_diag_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_diag_matrix, octave_float_diag_matrix, div);
-  INSTALL_BINOP (op_ldiv, octave_float_diag_matrix, octave_float_diag_matrix, ldiv);
-
-  INSTALL_CONVOP (octave_float_diag_matrix, octave_float_matrix, float_diag_matrix_to_float_matrix);
-  INSTALL_CONVOP (octave_float_diag_matrix, octave_diag_matrix, float_diag_matrix_to_diag_matrix);
-  INSTALL_ASSIGNCONV (octave_float_diag_matrix, octave_float_matrix, octave_float_matrix);
-  INSTALL_WIDENOP (octave_float_diag_matrix, octave_float_matrix, float_diag_matrix_to_float_matrix);
-}
--- a/src/OPERATORS/op-fdm-fm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-re-diag.h"
-#define RINCLUDE "ov-flt-re-mat.h"
-
-#define LMATRIX float_diag_matrix
-#define RMATRIX float_matrix
-
-#define LSHORT fdm
-#define RSHORT fm
-
-#define DEFINELDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fdm-fs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 SINCLUDE "ov-float.h"
-#define MINCLUDE "ov-flt-re-diag.h"
-
-#define SCALAR float_scalar
-#define MATRIX float_diag_matrix
-
-#define SSHORT fs
-#define MSHORT fdm
-
-#include "op-dms-template.cc"
-
--- a/src/OPERATORS/op-float-conv.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-range.h"
-#include "ov-float.h"
-#include "ov-flt-re-mat.h"
-#include "ov-str-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-// conversion ops
-
-DEFFLTCONVFN (int8_matrix_to_float_matrix, int8_matrix, int8_array)
-DEFFLTCONVFN (int16_matrix_to_float_matrix, int16_matrix, int16_array)
-DEFFLTCONVFN (int32_matrix_to_float_matrix, int32_matrix, int32_array)
-DEFFLTCONVFN (int64_matrix_to_float_matrix, int64_matrix, int64_array)
-
-DEFFLTCONVFN (uint8_matrix_to_float_matrix, uint8_matrix, uint8_array)
-DEFFLTCONVFN (uint16_matrix_to_float_matrix, uint16_matrix, uint16_array)
-DEFFLTCONVFN (uint32_matrix_to_float_matrix, uint32_matrix, uint32_array)
-DEFFLTCONVFN (uint64_matrix_to_float_matrix, uint64_matrix, uint64_array)
-
-DEFFLTCONVFN (int8_scalar_to_float_matrix, int8_scalar, int8_array)
-DEFFLTCONVFN (int16_scalar_to_float_matrix, int16_scalar, int16_array)
-DEFFLTCONVFN (int32_scalar_to_float_matrix, int32_scalar, int32_array)
-DEFFLTCONVFN (int64_scalar_to_float_matrix, int64_scalar, int64_array)
-
-DEFFLTCONVFN (uint8_scalar_to_float_matrix, uint8_scalar, uint8_array)
-DEFFLTCONVFN (uint16_scalar_to_float_matrix, uint16_scalar, uint16_array)
-DEFFLTCONVFN (uint32_scalar_to_float_matrix, uint32_scalar, uint32_array)
-DEFFLTCONVFN (uint64_scalar_to_float_matrix, uint64_scalar, uint64_array)
-
-DEFFLTCONVFN (bool_matrix_to_float_matrix, bool_matrix, bool_array)
-DEFFLTCONVFN (bool_scalar_to_float_matrix, bool, bool_array)
-
-DEFFLTCONVFN (range_to_float_matrix, range, array)
-
-DEFSTRFLTCONVFN(char_matrix_str_to_float_matrix, char_matrix_str)
-DEFSTRFLTCONVFN(char_matrix_sq_str_to_float_matrix, char_matrix_sq_str)
-
-DEFFLTCONVFN (float_scalar_to_float_matrix, scalar, array)
-
-void
-install_float_conv_ops (void)
-{
-  INSTALL_CONVOP (octave_int8_matrix, octave_float_matrix, int8_matrix_to_float_matrix);
-  INSTALL_CONVOP (octave_int16_matrix, octave_float_matrix, int16_matrix_to_float_matrix);
-  INSTALL_CONVOP (octave_int32_matrix, octave_float_matrix, int32_matrix_to_float_matrix);
-  INSTALL_CONVOP (octave_int64_matrix, octave_float_matrix, int64_matrix_to_float_matrix);
-
-  INSTALL_CONVOP (octave_uint8_matrix, octave_float_matrix, uint8_matrix_to_float_matrix);
-  INSTALL_CONVOP (octave_uint16_matrix, octave_float_matrix, uint16_matrix_to_float_matrix);
-  INSTALL_CONVOP (octave_uint32_matrix, octave_float_matrix, uint32_matrix_to_float_matrix);
-  INSTALL_CONVOP (octave_uint64_matrix, octave_float_matrix, uint64_matrix_to_float_matrix);
-
-  INSTALL_CONVOP (octave_int8_scalar, octave_float_matrix, int8_scalar_to_float_matrix);
-  INSTALL_CONVOP (octave_int16_scalar, octave_float_matrix, int16_scalar_to_float_matrix);
-  INSTALL_CONVOP (octave_int32_scalar, octave_float_matrix, int32_scalar_to_float_matrix);
-  INSTALL_CONVOP (octave_int64_scalar, octave_float_matrix, int64_scalar_to_float_matrix);
-
-  INSTALL_CONVOP (octave_uint8_scalar, octave_float_matrix, uint8_scalar_to_float_matrix);
-  INSTALL_CONVOP (octave_uint16_scalar, octave_float_matrix, uint16_scalar_to_float_matrix);
-  INSTALL_CONVOP (octave_uint32_scalar, octave_float_matrix, uint32_scalar_to_float_matrix);
-  INSTALL_CONVOP (octave_uint64_scalar, octave_float_matrix, uint64_scalar_to_float_matrix);
-
-  INSTALL_CONVOP (octave_bool_matrix, octave_float_matrix, bool_matrix_to_float_matrix);
-  INSTALL_CONVOP (octave_bool, octave_float_matrix, bool_scalar_to_float_matrix);
-
-  INSTALL_CONVOP (octave_range, octave_float_matrix, range_to_float_matrix);
-
-  INSTALL_CONVOP (octave_char_matrix_str, octave_float_matrix, char_matrix_str_to_float_matrix);
-  INSTALL_CONVOP (octave_char_matrix_sq_str, octave_float_matrix, char_matrix_sq_str_to_float_matrix);
-
-  INSTALL_CONVOP (octave_scalar, octave_float_matrix, float_scalar_to_float_matrix);
-}
--- a/src/OPERATORS/op-fm-fcdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-re-mat.h"
-#define RINCLUDE "ov-flt-cx-diag.h"
-
-#define LMATRIX float_matrix
-#define RMATRIX float_complex_diag_matrix
-#define LDMATRIX float_complex_matrix
-
-#define LSHORT fm
-#define RSHORT fcdm
-
-#define DEFINEDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fm-fcm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-fm-fcm.h"
-#include "mx-fcm-fm.h"
-#include "mx-fnda-fcnda.h"
-#include "mx-fcnda-fnda.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix by complex matrix ops.
-
-DEFNDBINOP_OP (add, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, +)
-DEFNDBINOP_OP (sub, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, -)
-
-DEFBINOP_OP (mul, float_matrix, float_complex_matrix, *)
-
-DEFBINOP (trans_mul, float_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex_matrix&);
-
-  FloatMatrix m1 = v1.float_matrix_value ();
-  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
-
-  return FloatComplexMatrix (xgemm (m1, real (m2), blas_trans, blas_no_trans),
-                             xgemm (m1, imag (m2), blas_trans, blas_no_trans));
-}
-
-DEFBINOP (div, float_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&,
-                   const octave_float_complex_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  FloatComplexMatrix ret = xdiv (v1.float_matrix_value (),
-                                 v2.float_complex_matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, float_matrix, float_complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, float_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&,
-                   const octave_float_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (v1.float_matrix_value (),
-                                v2.float_complex_matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP (trans_ldiv, float_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&,
-                   const octave_float_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (v1.float_matrix_value (),
-                         v2.float_complex_matrix_value (), typ, blas_trans);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, mx_el_ne)
-
-DEFNDBINOP_FN (el_mul, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, product)
-DEFNDBINOP_FN (el_div, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, quotient)
-DEFNDBINOP_FN (el_pow, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, elem_xpow)
-
-DEFBINOP (el_ldiv, float_matrix, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&,
-                   const octave_float_complex_matrix&);
-
-  return quotient (v2.float_complex_array_value (), v1.float_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_matrix, float_complex_matrix, float_array,
-               float_complex_array, mx_el_or)
-
-DEFNDCATOP_FN (fm_fcm, float_matrix, float_complex_matrix, float_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (m_fcm, matrix, float_complex_matrix, float_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (fm_cm, float_matrix, complex_matrix, float_array,
-               float_complex_array, concat)
-
-DEFCONV (float_complex_matrix_conv, float_matrix, float_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_float_matrix&);
-
-  return new octave_float_complex_matrix (FloatComplexNDArray (v.float_array_value ()));
-}
-
-void
-install_fm_fcm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_matrix, octave_float_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_matrix, octave_float_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_matrix,
-                 octave_float_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_float_matrix, octave_float_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_matrix,
-                 octave_float_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_matrix,
-                 octave_float_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_matrix,
-                 octave_float_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_matrix,
-                 octave_float_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_matrix,
-                 octave_float_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_matrix,
-                 octave_float_complex_matrix, el_or);
-  INSTALL_BINOP (op_trans_mul, octave_float_matrix,
-                 octave_float_complex_matrix, trans_mul);
-  INSTALL_BINOP (op_herm_mul, octave_float_matrix,
-                 octave_float_complex_matrix, trans_mul);
-  INSTALL_BINOP (op_trans_ldiv, octave_float_matrix,
-                 octave_float_complex_matrix, trans_ldiv);
-  INSTALL_BINOP (op_herm_ldiv, octave_float_matrix,
-                 octave_float_complex_matrix, trans_ldiv);
-
-  INSTALL_CATOP (octave_float_matrix, octave_float_complex_matrix, fm_fcm);
-  INSTALL_CATOP (octave_matrix, octave_float_complex_matrix, m_fcm);
-  INSTALL_CATOP (octave_float_matrix, octave_complex_matrix, fm_cm);
-
-  INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex_matrix,
-                      octave_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex_matrix,
-                      octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_float_matrix, octave_float_complex_matrix,
-                   float_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-fm-fcs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-fm-fcs.h"
-#include "mx-fcs-fm.h"
-#include "mx-fnda-fcs.h"
-#include "mx-fcs-fnda.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-flt-complex.h"
-#include "ov-complex.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix by complex scalar ops.
-
-DEFNDBINOP_OP (add, float_matrix, float_complex, float_array, float_complex, +)
-DEFNDBINOP_OP (sub, float_matrix, float_complex, float_array, float_complex, -)
-DEFNDBINOP_OP (mul, float_matrix, float_complex, float_array, float_complex, *)
-
-DEFBINOP (div, float_matrix, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&);
-
-  FloatComplex d = v2.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_array_value () / d);
-}
-
-DEFBINOP_FN (pow, float_matrix, float_complex, xpow)
-
-DEFBINOP (ldiv, float_matrix, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&);
-
-  FloatMatrix m1 = v1.float_matrix_value ();
-  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
-  MatrixType typ = v1.matrix_type ();
-
-  FloatComplexMatrix ret = xleftdiv (m1, m2, typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_matrix, float_complex, float_array,
-               float_complex, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_matrix, float_complex, float_array,
-               float_complex, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_matrix, float_complex, float_array,
-               float_complex, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_matrix, float_complex, float_array,
-               float_complex, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_matrix, float_complex, float_array,
-               float_complex, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_matrix, float_complex, float_array,
-               float_complex, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, float_matrix, float_complex, float_array,
-               float_complex, *)
-
-DEFBINOP (el_div, float_matrix, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&);
-
-  FloatComplex d = v2.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_pow, float_matrix, float_complex, float_array,
-               float_complex, elem_xpow)
-
-DEFBINOP (el_ldiv, float_matrix, flaot_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&);
-
-  return x_el_div (v2.float_complex_value (), v1.float_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, float_matrix, float_complex, float_array,
-               float_complex, mx_el_and)
-DEFNDBINOP_FN (el_or, float_matrix, float_complex, float_array,
-               float_complex, mx_el_or)
-
-DEFNDCATOP_FN (fm_fcs, float_matrix, float_complex, float_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (m_fcs, matrix, float_complex, float_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (fm_cs, float_matrix, complex, float_array,
-               float_complex_array, concat)
-
-void
-install_fm_fcs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_matrix, octave_float_complex, add);
-  INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_complex, sub);
-  INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_complex, mul);
-  INSTALL_BINOP (op_div, octave_float_matrix, octave_float_complex, div);
-  INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_matrix, octave_float_complex, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_complex, lt);
-  INSTALL_BINOP (op_le, octave_float_matrix, octave_float_complex, le);
-  INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_complex, eq);
-  INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_complex, ge);
-  INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_complex, gt);
-  INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_matrix, octave_float_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_matrix, octave_float_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_matrix, octave_float_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_matrix, octave_float_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_matrix, octave_float_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_matrix, octave_float_complex, el_or);
-
-  INSTALL_CATOP (octave_float_matrix, octave_float_complex, fm_fcs);
-  INSTALL_CATOP (octave_matrix, octave_float_complex, m_fcs);
-  INSTALL_CATOP (octave_float_matrix, octave_complex, fm_cs);
-
-  INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex,
-                      octave_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex,
-                      octave_complex_matrix);
-}
--- a/src/OPERATORS/op-fm-fdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-flt-re-mat.h"
-#define RINCLUDE "ov-flt-re-diag.h"
-
-#define LMATRIX float_matrix
-#define RMATRIX float_diag_matrix
-
-#define LSHORT fm
-#define RSHORT fdm
-
-#define DEFINEDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-fm-fm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix unary ops.
-
-DEFNDUNOP_OP (not, float_matrix, float_array, !)
-DEFNDUNOP_OP (uplus, float_matrix, float_array, /* no-op */)
-DEFNDUNOP_OP (uminus, float_matrix, float_array, -)
-
-DEFUNOP (transpose, float_matrix)
-{
-  CAST_UNOP_ARG (const octave_float_matrix&);
-
-  if (v.ndims () > 2)
-    {
-      error ("transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.float_matrix_value ().transpose ());
-}
-
-DEFNCUNOP_METHOD (incr, float_matrix, increment)
-DEFNCUNOP_METHOD (decr, float_matrix, decrement)
-DEFNCUNOP_METHOD (changesign, float_matrix, changesign)
-
-// matrix by matrix ops.
-
-DEFNDBINOP_OP (add, float_matrix, float_matrix, float_array, float_array, +)
-DEFNDBINOP_OP (sub, float_matrix, float_matrix, float_array, float_array, -)
-
-DEFBINOP_OP (mul, float_matrix, float_matrix, *)
-
-DEFBINOP (div, float_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  FloatMatrix ret = xdiv (v1.float_matrix_value (),
-                          v2.float_matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, float_matrix, float_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, float_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  FloatMatrix ret = xleftdiv (v1.float_matrix_value (),
-                              v2.float_matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP (trans_mul, float_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
-  return octave_value(xgemm (v1.float_matrix_value (),
-                             v2.float_matrix_value (),
-                             blas_trans, blas_no_trans));
-}
-
-DEFBINOP (mul_trans, float_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
-  return octave_value(xgemm (v1.float_matrix_value (),
-                             v2.float_matrix_value (),
-                             blas_no_trans, blas_trans));
-}
-
-DEFBINOP (trans_ldiv, float_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  FloatMatrix ret = xleftdiv (v1.float_matrix_value (),
-                              v2.float_matrix_value (), typ, blas_trans);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDBINOP_FN (lt, float_matrix, float_matrix, float_array,
-               float_array, mx_el_lt)
-DEFNDBINOP_FN (le, float_matrix, float_matrix, float_array,
-               float_array, mx_el_le)
-DEFNDBINOP_FN (eq, float_matrix, float_matrix, float_array,
-               float_array, mx_el_eq)
-DEFNDBINOP_FN (ge, float_matrix, float_matrix, float_array,
-               float_array, mx_el_ge)
-DEFNDBINOP_FN (gt, float_matrix, float_matrix, float_array,
-               float_array, mx_el_gt)
-DEFNDBINOP_FN (ne, float_matrix, float_matrix, float_array,
-               float_array, mx_el_ne)
-
-DEFNDBINOP_FN (el_mul, float_matrix, float_matrix, float_array,
-               float_array, product)
-DEFNDBINOP_FN (el_div, float_matrix, float_matrix, float_array,
-               float_array, quotient)
-DEFNDBINOP_FN (el_pow, float_matrix, float_matrix, float_array,
-               float_array, elem_xpow)
-
-DEFBINOP (el_ldiv, float_matrix, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
-
-  return octave_value (quotient (v2.float_array_value (),
-                                 v1.float_array_value ()));
-}
-
-DEFNDBINOP_FN (el_and, float_matrix, float_matrix, float_array,
-               float_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_matrix, float_matrix, float_array,
-               float_array, mx_el_or)
-DEFNDBINOP_FN (el_not_and, float_matrix, float_matrix, float_array,
-               float_array, mx_el_not_and)
-DEFNDBINOP_FN (el_not_or,  float_matrix, float_matrix, float_array,
-               float_array, mx_el_not_or)
-DEFNDBINOP_FN (el_and_not, float_matrix, float_matrix, float_array,
-               float_array, mx_el_and_not)
-DEFNDBINOP_FN (el_or_not,  float_matrix, float_matrix, float_array,
-               float_array, mx_el_or_not)
-
-
-
-DEFNDCATOP_FN (fm_fm, float_matrix, float_matrix, float_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (m_fm, matrix, float_matrix, float_array, float_array, concat)
-
-DEFNDCATOP_FN (fm_m, float_matrix, matrix, float_array, float_array, concat)
-
-DEFNDASSIGNOP_FN (assign, float_matrix, float_matrix, float_array, assign)
-
-DEFNDASSIGNOP_FN (dbl_assign, matrix, float_matrix, array, assign)
-
-DEFNULLASSIGNOP_FN (null_assign, float_matrix, delete_elements)
-
-DEFNDASSIGNOP_OP (assign_add, float_matrix, float_matrix, float_array, +=)
-DEFNDASSIGNOP_OP (assign_sub, float_matrix, float_matrix, float_array, -=)
-DEFNDASSIGNOP_FNOP (assign_el_mul, float_matrix, float_matrix, float_array, product_eq)
-DEFNDASSIGNOP_FNOP (assign_el_div, float_matrix, float_matrix, float_array, quotient_eq)
-
-CONVDECL (float_matrix_to_matrix)
-{
-  CAST_CONV_ARG (const octave_float_matrix&);
-
-  return new octave_matrix (v.array_value ());
-}
-
-void
-install_fm_fm_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_float_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_float_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_float_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_float_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_float_matrix, transpose);
-
-  INSTALL_NCUNOP (op_incr, octave_float_matrix, incr);
-  INSTALL_NCUNOP (op_decr, octave_float_matrix, decr);
-  INSTALL_NCUNOP (op_uminus, octave_float_matrix, changesign);
-
-  INSTALL_BINOP (op_add, octave_float_matrix, octave_float_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_matrix, octave_float_matrix, div);
-  INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_matrix, octave_float_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_matrix, lt);
-  INSTALL_BINOP (op_le, octave_float_matrix, octave_float_matrix, le);
-  INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_matrix, octave_float_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_matrix, octave_float_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_matrix, octave_float_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_matrix, octave_float_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_matrix, octave_float_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_matrix, octave_float_matrix, el_or);
-  INSTALL_BINOP (op_el_and_not, octave_float_matrix, octave_float_matrix, el_and_not);
-  INSTALL_BINOP (op_el_or_not, octave_float_matrix, octave_float_matrix, el_or_not);
-  INSTALL_BINOP (op_el_not_and, octave_float_matrix, octave_float_matrix, el_not_and);
-  INSTALL_BINOP (op_el_not_or, octave_float_matrix, octave_float_matrix, el_not_or);
-  INSTALL_BINOP (op_trans_mul, octave_float_matrix, octave_float_matrix, trans_mul);
-  INSTALL_BINOP (op_mul_trans, octave_float_matrix, octave_float_matrix, mul_trans);
-  INSTALL_BINOP (op_herm_mul, octave_float_matrix, octave_float_matrix, trans_mul);
-  INSTALL_BINOP (op_mul_herm, octave_float_matrix, octave_float_matrix, mul_trans);
-  INSTALL_BINOP (op_trans_ldiv, octave_float_matrix, octave_float_matrix, trans_ldiv);
-  INSTALL_BINOP (op_herm_ldiv, octave_float_matrix, octave_float_matrix, trans_ldiv);
-
-  INSTALL_CATOP (octave_float_matrix, octave_float_matrix, fm_fm);
-  INSTALL_CATOP (octave_matrix, octave_float_matrix, m_fm);
-  INSTALL_CATOP (octave_float_matrix, octave_matrix, fm_m);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix,
-                    octave_float_matrix, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix,
-                    octave_float_matrix, dbl_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_null_sq_str, null_assign);
-
-  INSTALL_ASSIGNOP (op_add_eq, octave_float_matrix, octave_float_matrix, assign_add);
-  INSTALL_ASSIGNOP (op_sub_eq, octave_float_matrix, octave_float_matrix, assign_sub);
-  INSTALL_ASSIGNOP (op_el_mul_eq, octave_float_matrix, octave_float_matrix, assign_el_mul);
-  INSTALL_ASSIGNOP (op_el_div_eq, octave_float_matrix, octave_float_matrix, assign_el_div);
-
-  INSTALL_CONVOP (octave_float_matrix, octave_matrix, float_matrix_to_matrix);
-}
--- a/src/OPERATORS/op-fm-fs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-flt-re-mat.h"
-#include "ov-float.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix by scalar ops.
-
-DEFNDBINOP_OP (add, float_matrix, float_scalar, float_array, float_scalar, +)
-DEFNDBINOP_OP (sub, float_matrix, float_scalar, float_array, float_scalar, -)
-DEFNDBINOP_OP (mul, float_matrix, float_scalar, float_array, float_scalar, *)
-
-DEFBINOP (div, float_matrix, float)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_scalar&);
-
-  float d = v2.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_array_value () / d);
-}
-
-DEFBINOP_FN (pow, float_matrix, float_scalar, xpow)
-
-DEFBINOP (ldiv, float_matrix, float)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_scalar&);
-
-  FloatMatrix m1 = v1.float_matrix_value ();
-  FloatMatrix m2 = v2.float_matrix_value ();
-  MatrixType typ = v1.matrix_type ();
-
-  FloatMatrix ret = xleftdiv (m1, m2, typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDBINOP_FN (lt, float_matrix, float_scalar, float_array,
-               float_scalar, mx_el_lt)
-DEFNDBINOP_FN (le, float_matrix, float_scalar, float_array,
-               float_scalar, mx_el_le)
-DEFNDBINOP_FN (eq, float_matrix, float_scalar, float_array,
-               float_scalar, mx_el_eq)
-DEFNDBINOP_FN (ge, float_matrix, float_scalar, float_array,
-               float_scalar, mx_el_ge)
-DEFNDBINOP_FN (gt, float_matrix, float_scalar, float_array,
-               float_scalar, mx_el_gt)
-DEFNDBINOP_FN (ne, float_matrix, float_scalar, float_array,
-               float_scalar, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, float_matrix, float_scalar, float_array, float_scalar, *)
-
-DEFBINOP (el_div, float_matrix, float)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_scalar&);
-
-  float d = v2.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_pow, float_matrix, float_scalar, float_array,
-               float_scalar, elem_xpow)
-
-DEFBINOP (el_ldiv, float_matrix, float)
-{
-  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_scalar&);
-
-  return x_el_div (v2.float_value (), v1.float_array_value ());
-}
-
-DEFNDBINOP_FN (el_and, float_matrix, float_scalar, float_array,
-               float_scalar, mx_el_and)
-DEFNDBINOP_FN (el_or, float_matrix, float_scalar, float_array,
-               float_scalar, mx_el_or)
-
-DEFNDCATOP_FN (fm_fs, float_matrix, float_scalar, float_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (m_fs, matrix, float_scalar, float_array, float_array, concat)
-
-DEFNDCATOP_FN (fm_s, float_matrix, scalar, float_array, float_array, concat)
-
-DEFNDASSIGNOP_FN (assign, float_matrix, float_scalar, float_scalar, assign)
-DEFNDASSIGNOP_FN (dbl_assign, matrix, float_scalar, scalar, assign)
-
-DEFNDASSIGNOP_OP (assign_add, float_matrix, float_scalar, float_scalar, +=)
-DEFNDASSIGNOP_OP (assign_sub, float_matrix, float_scalar, float_scalar, -=)
-DEFNDASSIGNOP_OP (assign_mul, float_matrix, float_scalar, float_scalar, *=)
-DEFNDASSIGNOP_OP (assign_div, float_matrix, float_scalar, float_scalar, /=)
-
-void
-install_fm_fs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_matrix, octave_float_scalar, add);
-  INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_scalar, mul);
-  INSTALL_BINOP (op_div, octave_float_matrix, octave_float_scalar, div);
-  INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_matrix, octave_float_scalar, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_scalar, lt);
-  INSTALL_BINOP (op_le, octave_float_matrix, octave_float_scalar, le);
-  INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_matrix, octave_float_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_matrix, octave_float_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_matrix, octave_float_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_matrix, octave_float_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_matrix, octave_float_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_matrix, octave_float_scalar, el_or);
-
-  INSTALL_CATOP (octave_float_matrix, octave_float_scalar, fm_fs);
-  INSTALL_CATOP (octave_matrix, octave_float_scalar, m_fs);
-  INSTALL_CATOP (octave_float_matrix, octave_scalar, fm_s);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_float_scalar, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_float_scalar, dbl_assign);
-
-  INSTALL_ASSIGNOP (op_add_eq, octave_float_matrix, octave_float_scalar, assign_add);
-  INSTALL_ASSIGNOP (op_sub_eq, octave_float_matrix, octave_float_scalar, assign_sub);
-  INSTALL_ASSIGNOP (op_mul_eq, octave_float_matrix, octave_float_scalar, assign_mul);
-  INSTALL_ASSIGNOP (op_div_eq, octave_float_matrix, octave_float_scalar, assign_div);
-}
--- a/src/OPERATORS/op-fm-pm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 MINCLUDE "ov-flt-re-mat.h"
-
-#define LMATRIX float_matrix
-#define RMATRIX perm_matrix
-
-#define LSHORT fm
-#define RSHORT pm
-
-#define RIGHT
-
-#include "op-pm-template.cc"
--- a/src/OPERATORS/op-fs-fcm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-fs-fcm.h"
-#include "mx-fcm-fs.h"
-#include "mx-fs-fcnda.h"
-#include "mx-fcnda-fs.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// scalar by complex matrix ops.
-
-DEFNDBINOP_OP (add, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, +)
-DEFNDBINOP_OP (sub, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, -)
-DEFNDBINOP_OP (mul, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, *)
-
-DEFBINOP (div, float_scalar, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&,
-                   const octave_float_complex_matrix&);
-
-  FloatMatrix m1 = v1.float_matrix_value ();
-  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
-  MatrixType typ = v2.matrix_type ();
-
-  FloatComplexMatrix ret = xdiv (m1, m2, typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (pow, float_scalar, float_complex_matrix, xpow)
-
-DEFBINOP (ldiv, float_scalar, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&,
-                   const octave_float_complex_matrix&);
-
-  float d = v1.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_complex_array_value () / d);
-}
-
-DEFNDCMPLXCMPOP_FN (lt, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, *)
-DEFNDBINOP_FN (el_div, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, x_el_div)
-DEFNDBINOP_FN (el_pow, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, elem_xpow)
-
-DEFBINOP (el_ldiv, float_scalar, float_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&,
-                   const octave_float_complex_matrix&);
-
-  float d = v1.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_complex_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_and, float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_scalar, float_complex_matrix, float_scalar,
-               float_complex_array, mx_el_or)
-
-DEFNDCATOP_FN (fs_fcm, float_scalar, float_complex_matrix, float_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (s_fcm, scalar, float_complex_matrix, float_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (fs_cm, float_scalar, complex_matrix, float_array,
-               float_complex_array, concat)
-
-DEFCONV (float_complex_matrix_conv, float_scalar, float_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_float_scalar&);
-
-  return new octave_float_complex_matrix (FloatComplexMatrix (v.float_matrix_value ()));
-}
-
-void
-install_fs_fcm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_scalar, octave_float_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_scalar, octave_float_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_scalar,
-                 octave_float_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_float_scalar, octave_float_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_scalar,
-                 octave_float_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_scalar,
-                 octave_float_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_scalar,
-                 octave_float_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_scalar,
-                 octave_float_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_scalar,
-                 octave_float_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_scalar,
-                 octave_float_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_float_scalar, octave_float_complex_matrix, fs_fcm);
-  INSTALL_CATOP (octave_scalar, octave_float_complex_matrix, s_fcm);
-  INSTALL_CATOP (octave_float_scalar, octave_complex_matrix, fs_cm);
-
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex_matrix,
-                      octave_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex_matrix,
-                      octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_float_scalar, octave_float_complex_matrix,
-                   float_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-fs-fcs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-flt-complex.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// scalar by complex scalar ops.
-
-DEFBINOP_OP (add, float_scalar, float_complex, +)
-DEFBINOP_OP (sub, float_scalar, float_complex, -)
-DEFBINOP_OP (mul, float_scalar, float_complex, *)
-
-DEFBINOP (div, float_scalar, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
-
-  FloatComplex d = v2.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_value () / d);
-}
-
-DEFBINOP_FN (pow, float_scalar, float_complex, xpow)
-
-DEFBINOP (ldiv, float_scalar, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
-
-  float d = v1.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_complex_value () / d);
-}
-
-DEFCMPLXCMPOP_OP (lt, float_scalar, float_complex, <)
-DEFCMPLXCMPOP_OP (le, float_scalar, float_complex, <=)
-DEFCMPLXCMPOP_OP (eq, float_scalar, float_complex, ==)
-DEFCMPLXCMPOP_OP (ge, float_scalar, float_complex, >=)
-DEFCMPLXCMPOP_OP (gt, float_scalar, float_complex, >)
-DEFCMPLXCMPOP_OP (ne, float_scalar, float_complex, !=)
-
-DEFBINOP_OP (el_mul, float_scalar, float_complex, *)
-
-DEFBINOP (el_div, float_scalar, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
-
-  FloatComplex d = v2.float_complex_value ();
-
-  if (d == static_cast<float>(0.0))
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_value () / d);
-}
-
-DEFBINOP_FN (el_pow, float_scalar, float_complex, xpow)
-
-DEFBINOP (el_ldiv, float_scalar, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
-
-  float d = v1.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_complex_value () / d);
-}
-
-DEFBINOP (el_and, float_scalar, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
-
-  return octave_value (v1.float_scalar_value () && (v2.float_complex_value () != static_cast<float>(0.0)));
-}
-
-DEFBINOP (el_or, float_scalar, float_complex)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
-
-  return octave_value (v1.float_scalar_value () || (v2.float_complex_value () != static_cast<float>(0.0)));
-}
-
-DEFNDCATOP_FN (fs_fcs, float_scalar, float_complex, float_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (s_fcs, scalar, float_complex, float_array,
-               float_complex_array, concat)
-
-DEFNDCATOP_FN (fs_cs, float_scalar, complex, float_array,
-               float_complex_array, concat)
-
-void
-install_fs_fcs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_scalar, octave_float_complex, add);
-  INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_complex, sub);
-  INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_complex, mul);
-  INSTALL_BINOP (op_div, octave_float_scalar, octave_float_complex, div);
-  INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_scalar, octave_float_complex, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_complex, lt);
-  INSTALL_BINOP (op_le, octave_float_scalar, octave_float_complex, le);
-  INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_complex, eq);
-  INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_complex, ge);
-  INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_complex, gt);
-  INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_scalar, octave_float_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_scalar, octave_float_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_scalar, octave_float_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_scalar, octave_float_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_scalar, octave_float_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_scalar, octave_float_complex, el_or);
-
-  INSTALL_CATOP (octave_float_scalar, octave_float_complex, fs_fcs);
-  INSTALL_CATOP (octave_scalar, octave_float_complex, s_fcs);
-  INSTALL_CATOP (octave_float_scalar, octave_complex, fs_cs);
-
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex,
-                      octave_float_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex,
-                      octave_complex_matrix);
-}
--- a/src/OPERATORS/op-fs-fm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// scalar by matrix ops.
-
-DEFNDBINOP_OP (add, float_scalar, float_matrix, float_scalar, float_array, +)
-DEFNDBINOP_OP (sub, float_scalar, float_matrix, float_scalar, float_array, -)
-DEFNDBINOP_OP (mul, float_scalar, float_matrix, float_scalar, float_array, *)
-
-DEFBINOP (div, float_scalar, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_matrix&);
-
-  FloatMatrix m1 = v1.float_matrix_value ();
-  FloatMatrix m2 = v2.float_matrix_value ();
-  MatrixType typ = v2.matrix_type ();
-
-  FloatMatrix ret = xdiv (m1, m2, typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (pow, float_scalar, float_matrix, xpow)
-
-DEFBINOP (ldiv, float_scalar, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_matrix&);
-
-  float d = v1.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_array_value () / d);
-}
-
-DEFNDBINOP_FN (lt, float_scalar, float_matrix, float_scalar,
-               float_array, mx_el_lt)
-DEFNDBINOP_FN (le, float_scalar, float_matrix, float_scalar,
-               float_array, mx_el_le)
-DEFNDBINOP_FN (eq, float_scalar, float_matrix, float_scalar,
-               float_array, mx_el_eq)
-DEFNDBINOP_FN (ge, float_scalar, float_matrix, float_scalar,
-               float_array, mx_el_ge)
-DEFNDBINOP_FN (gt, float_scalar, float_matrix, float_scalar,
-float_array, mx_el_gt)
-DEFNDBINOP_FN (ne, float_scalar, float_matrix, float_scalar,
-               float_array, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, float_scalar, float_matrix, float_scalar,
-               float_array, *)
-DEFNDBINOP_FN (el_div, float_scalar, float_matrix, float_scalar,
-               float_array, x_el_div)
-DEFNDBINOP_FN (el_pow, float_scalar, float_matrix, float_scalar,
-               float_array, elem_xpow)
-
-DEFBINOP (el_ldiv, float_scalar, float_matrix)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_matrix&);
-
-  float d = v1.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_and, float_scalar, float_matrix, float_scalar,
-               float_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  float_scalar, float_matrix, float_scalar,
-               float_array, mx_el_or)
-
-DEFNDCATOP_FN (fs_fm, float_scalar, float_matrix, float_array,
-               float_array, concat)
-
-DEFNDCATOP_FN (s_fm, scalar, float_matrix, float_array, float_array, concat)
-
-DEFNDCATOP_FN (fs_m, float_scalar, matrix, float_array, float_array, concat)
-
-DEFCONV (matrix_conv, float_scalar, float_matrix)
-{
-  CAST_CONV_ARG (const octave_float_scalar&);
-
-  return new octave_float_matrix (v.float_matrix_value ());
-}
-
-void
-install_fs_fm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_float_scalar, octave_float_matrix, add);
-  INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_matrix, mul);
-  INSTALL_BINOP (op_div, octave_float_scalar, octave_float_matrix, div);
-  INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_scalar, octave_float_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_matrix, lt);
-  INSTALL_BINOP (op_le, octave_float_scalar, octave_float_matrix, le);
-  INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_scalar, octave_float_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_scalar, octave_float_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_scalar, octave_float_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_scalar, octave_float_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_scalar, octave_float_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_scalar, octave_float_matrix, el_or);
-
-  INSTALL_CATOP (octave_float_scalar, octave_float_matrix, fs_fm);
-  INSTALL_CATOP (octave_scalar, octave_float_matrix, s_fm);
-  INSTALL_CATOP (octave_float_scalar, octave_matrix, fs_m);
-
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_matrix, octave_float_matrix);
-  INSTALL_ASSIGNCONV (octave_scalar, octave_float_matrix, octave_matrix);
-
-  INSTALL_WIDENOP (octave_float_scalar, octave_float_matrix, matrix_conv);
-}
--- a/src/OPERATORS/op-fs-fs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Array-util.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// scalar unary ops.
-
-DEFUNOP (not, float_scalar)
-{
-  CAST_UNOP_ARG (const octave_float_scalar&);
-  float x = v.float_value ();
-  if (xisnan (x))
-    gripe_nan_to_logical_conversion ();
-  return octave_value (x == 0.0f);
-}
-
-DEFUNOP_OP (uplus, float_scalar, /* no-op */)
-DEFUNOP_OP (uminus, float_scalar, -)
-DEFUNOP_OP (transpose, float_scalar, /* no-op */)
-DEFUNOP_OP (hermitian, float_scalar, /* no-op */)
-
-DEFNCUNOP_METHOD (incr, float_scalar, increment)
-DEFNCUNOP_METHOD (decr, float_scalar, decrement)
-
-// float by float ops.
-
-DEFBINOP_OP (add, float_scalar, float_scalar, +)
-DEFBINOP_OP (sub, float_scalar, float_scalar, -)
-DEFBINOP_OP (mul, float_scalar, float_scalar, *)
-
-DEFBINOP (div, float_scalar, float_scalar)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_scalar&);
-
-  float d = v2.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_value () / d);
-}
-
-DEFBINOP_FN (pow, float_scalar, float_scalar, xpow)
-
-DEFBINOP (ldiv, float_scalar, float_scalar)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_scalar&);
-
-  float d = v1.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_value () / d);
-}
-
-DEFBINOP_OP (lt, float_scalar, float_scalar, <)
-DEFBINOP_OP (le, float_scalar, float_scalar, <=)
-DEFBINOP_OP (eq, float_scalar, float_scalar, ==)
-DEFBINOP_OP (ge, float_scalar, float_scalar, >=)
-DEFBINOP_OP (gt, float_scalar, float_scalar, >)
-DEFBINOP_OP (ne, float_scalar, float_scalar, !=)
-
-DEFBINOP_OP (el_mul, float_scalar, float_scalar, *)
-
-DEFBINOP (el_div, float_scalar, float_scalar)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_scalar&);
-
-  float d = v2.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.float_value () / d);
-}
-
-DEFBINOP_FN (el_pow, float_scalar, float_scalar, xpow)
-
-DEFBINOP (el_ldiv, float_scalar, float_scalar)
-{
-  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_scalar&);
-
-  float d = v1.float_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.float_value () / d);
-}
-
-DEFSCALARBOOLOP_OP (el_and, float_scalar, float_scalar, &&)
-DEFSCALARBOOLOP_OP (el_or, float_scalar, float_scalar, ||)
-
-DEFNDCATOP_FN (fs_fs, float_scalar, float_scalar, float_array, float_array, concat)
-DEFNDCATOP_FN (s_fs, scalar, float_scalar, float_array, float_array, concat)
-DEFNDCATOP_FN (fs_s, float_scalar, scalar, float_array, float_array, concat)
-
-CONVDECL (float_to_scalar)
-{
-  CAST_CONV_ARG (const octave_float_scalar&);
-
-  return new octave_matrix (Matrix (1, 1, static_cast<double>(v.float_value ())));
-}
-
-void
-install_fs_fs_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_float_scalar, not);
-  INSTALL_UNOP (op_uplus, octave_float_scalar, uplus);
-  INSTALL_UNOP (op_uminus, octave_float_scalar, uminus);
-  INSTALL_UNOP (op_transpose, octave_float_scalar, transpose);
-  INSTALL_UNOP (op_hermitian, octave_float_scalar, hermitian);
-
-  INSTALL_NCUNOP (op_incr, octave_float_scalar, incr);
-  INSTALL_NCUNOP (op_decr, octave_float_scalar, decr);
-
-  INSTALL_BINOP (op_add, octave_float_scalar, octave_float_scalar, add);
-  INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_scalar, mul);
-  INSTALL_BINOP (op_div, octave_float_scalar, octave_float_scalar, div);
-  INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_float_scalar, octave_float_scalar, ldiv);
-  INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_scalar, lt);
-  INSTALL_BINOP (op_le, octave_float_scalar, octave_float_scalar, le);
-  INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_float_scalar, octave_float_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_float_scalar, octave_float_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_float_scalar, octave_float_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_float_scalar, octave_float_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_float_scalar, octave_float_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_float_scalar, octave_float_scalar, el_or);
-
-  INSTALL_CATOP (octave_float_scalar, octave_float_scalar, fs_fs);
-  INSTALL_CATOP (octave_scalar, octave_float_scalar, s_fs);
-  INSTALL_CATOP (octave_float_scalar, octave_scalar, fs_s);
-
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_scalar, octave_float_matrix);
-  INSTALL_ASSIGNCONV (octave_scalar, octave_float_scalar, octave_matrix);
-
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_null_matrix, octave_float_matrix);
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_null_str, octave_float_matrix);
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_null_sq_str, octave_float_matrix);
-
-  INSTALL_CONVOP (octave_float_scalar, octave_matrix, float_to_scalar);
-}
--- a/src/OPERATORS/op-i16-i16.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-i16nda-i8.h"
-#include "mx-i16nda-ui8.h"
-#include "mx-i16nda-ui16.h"
-#include "mx-i16nda-i32.h"
-#include "mx-i16nda-ui32.h"
-#include "mx-i16nda-i64.h"
-#include "mx-i16nda-ui64.h"
-
-#include "mx-i16nda-i8nda.h"
-#include "mx-i16nda-ui8nda.h"
-#include "mx-i16nda-ui16nda.h"
-#include "mx-i16nda-i32nda.h"
-#include "mx-i16nda-ui32nda.h"
-#include "mx-i16nda-i64nda.h"
-#include "mx-i16nda-ui64nda.h"
-
-#include "mx-i16-i8nda.h"
-#include "mx-i16-ui8nda.h"
-#include "mx-i16-ui16nda.h"
-#include "mx-i16-i32nda.h"
-#include "mx-i16-ui32nda.h"
-#include "mx-i16-i64nda.h"
-#include "mx-i16-ui64nda.h"
-
-#include "mx-i16nda-s.h"
-#include "mx-s-i16nda.h"
-
-#include "mx-i16nda-nda.h"
-#include "mx-nda-i16nda.h"
-
-#include "mx-i16-nda.h"
-#include "mx-nda-i16.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-int8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-uint8.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#include "op-int.h"
-
-OCTAVE_INT_OPS (int16)
-
-OCTAVE_MS_INT_ASSIGN_OPS (mi8, int16_, int8_, int8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui8, int16_, uint8_, uint8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui16, int16_, uint16_, uint16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi32, int16_, int32_, int32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui32, int16_, uint32_, uint32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi64, int16_, int64_, int64_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui64, int16_, uint64_, uint64_)
-
-OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int16_, int8_, int8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int16_, uint8_, uint8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int16_, uint16_, uint16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int16_, int32_, int32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int16_, uint32_, uint32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int16_, int64_, int64_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int16_, uint64_, uint64_)
-
-OCTAVE_MIXED_INT_CMP_OPS (int16, int8)
-OCTAVE_MIXED_INT_CMP_OPS (int16, uint8)
-OCTAVE_MIXED_INT_CMP_OPS (int16, uint16)
-OCTAVE_MIXED_INT_CMP_OPS (int16, int32)
-OCTAVE_MIXED_INT_CMP_OPS (int16, uint32)
-OCTAVE_MIXED_INT_CMP_OPS (int16, int64)
-OCTAVE_MIXED_INT_CMP_OPS (int16, uint64)
-
-void
-install_i16_i16_ops (void)
-{
-  OCTAVE_INSTALL_INT_OPS (int16);
-
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int16_, int8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int16_, uint8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int16_, uint16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int16_, int32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int16_, uint32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int16_, int64_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int16_, uint64_);
-
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int16_, int8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int16_, uint8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int16_, uint16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int16_, int32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int16_, uint32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int16_, int64_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int16_, uint64_);
-
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, int8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, uint8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, uint16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, int32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, uint32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, int64);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, uint64);
-
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, int8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, uint8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, uint16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, int32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, uint32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, int64);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, uint64);
-}
--- a/src/OPERATORS/op-i32-i32.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-i32nda-i8.h"
-#include "mx-i32nda-ui8.h"
-#include "mx-i32nda-i16.h"
-#include "mx-i32nda-ui16.h"
-#include "mx-i32nda-ui32.h"
-#include "mx-i32nda-i64.h"
-#include "mx-i32nda-ui64.h"
-
-#include "mx-i32nda-i8nda.h"
-#include "mx-i32nda-ui8nda.h"
-#include "mx-i32nda-i16nda.h"
-#include "mx-i32nda-ui16nda.h"
-#include "mx-i32nda-ui32nda.h"
-#include "mx-i32nda-i64nda.h"
-#include "mx-i32nda-ui64nda.h"
-
-#include "mx-i32-i8nda.h"
-#include "mx-i32-ui8nda.h"
-#include "mx-i32-i16nda.h"
-#include "mx-i32-ui16nda.h"
-#include "mx-i32-ui32nda.h"
-#include "mx-i32-i64nda.h"
-#include "mx-i32-ui64nda.h"
-
-#include "mx-i32nda-s.h"
-#include "mx-s-i32nda.h"
-
-#include "mx-i32nda-nda.h"
-#include "mx-nda-i32nda.h"
-
-#include "mx-i32-nda.h"
-#include "mx-nda-i32.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-int8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-uint8.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#include "op-int.h"
-
-OCTAVE_INT_OPS (int32)
-
-OCTAVE_MS_INT_ASSIGN_OPS (mi8, int32_, int8_, int8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui8, int32_, uint8_, uint8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi16, int32_, int16_, int16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui16, int32_, uint16_, uint16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui32, int32_, uint32_, uint32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi64, int32_, int64_, int64_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui64, int32_, uint64_, uint64_)
-
-OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int32_, int8_, int8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int32_, uint8_, uint8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int32_, int16_, int16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int32_, uint16_, uint16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int32_, uint32_, uint32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int32_, int64_, int64_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int32_, uint64_, uint64_)
-
-OCTAVE_MIXED_INT_CMP_OPS (int32, int8)
-OCTAVE_MIXED_INT_CMP_OPS (int32, uint8)
-OCTAVE_MIXED_INT_CMP_OPS (int32, int16)
-OCTAVE_MIXED_INT_CMP_OPS (int32, uint16)
-OCTAVE_MIXED_INT_CMP_OPS (int32, uint32)
-OCTAVE_MIXED_INT_CMP_OPS (int32, int64)
-OCTAVE_MIXED_INT_CMP_OPS (int32, uint64)
-
-void
-install_i32_i32_ops (void)
-{
-  OCTAVE_INSTALL_INT_OPS (int32);
-
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int32_, int8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int32_, uint8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int32_, int16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int32_, uint16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int32_, uint32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int32_, int64_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int32_, uint64_);
-
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int32_, int8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int32_, uint8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int32_, int16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int32_, uint16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int32_, uint32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int32_, int64_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int32_, uint64_);
-
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, int8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, uint8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, int16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, uint16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, uint32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, int64);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, uint64);
-
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, int8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, uint8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, int16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, uint16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, uint32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, int64);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, uint64);
-}
--- a/src/OPERATORS/op-i64-i64.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-i64nda-i8.h"
-#include "mx-i64nda-ui8.h"
-#include "mx-i64nda-i16.h"
-#include "mx-i64nda-ui16.h"
-#include "mx-i64nda-i32.h"
-#include "mx-i64nda-ui32.h"
-#include "mx-i64nda-ui64.h"
-
-#include "mx-i64nda-i8nda.h"
-#include "mx-i64nda-ui8nda.h"
-#include "mx-i64nda-i16nda.h"
-#include "mx-i64nda-ui16nda.h"
-#include "mx-i64nda-i32nda.h"
-#include "mx-i64nda-ui32nda.h"
-#include "mx-i64nda-ui64nda.h"
-
-#include "mx-i64-i8nda.h"
-#include "mx-i64-ui8nda.h"
-#include "mx-i64-i16nda.h"
-#include "mx-i64-ui16nda.h"
-#include "mx-i64-i32nda.h"
-#include "mx-i64-ui32nda.h"
-#include "mx-i64-ui64nda.h"
-
-#include "mx-i64nda-s.h"
-#include "mx-s-i64nda.h"
-
-#include "mx-i64nda-nda.h"
-#include "mx-nda-i64nda.h"
-
-#include "mx-i64-nda.h"
-#include "mx-nda-i64.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-int8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-uint8.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#include "op-int.h"
-
-OCTAVE_INT_OPS (int64)
-
-OCTAVE_MS_INT_ASSIGN_OPS (mi8, int64_, int8_, int8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui8, int64_, uint8_, uint8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi16, int64_, int16_, int16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui16, int64_, uint16_, uint16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi32, int64_, int32_, int32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui32, int64_, uint32_, uint32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui64, int64_, uint64_, uint64_)
-
-OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int64_, int8_, int8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int64_, uint8_, uint8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int64_, int16_, int16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int64_, uint16_, uint16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int64_, int32_, int32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int64_, uint32_, uint32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int64_, uint64_, uint64_)
-
-OCTAVE_MIXED_INT_CMP_OPS (int64, int8)
-OCTAVE_MIXED_INT_CMP_OPS (int64, uint8)
-OCTAVE_MIXED_INT_CMP_OPS (int64, int16)
-OCTAVE_MIXED_INT_CMP_OPS (int64, uint16)
-OCTAVE_MIXED_INT_CMP_OPS (int64, int32)
-OCTAVE_MIXED_INT_CMP_OPS (int64, uint32)
-OCTAVE_MIXED_INT_CMP_OPS (int64, uint64)
-
-void
-install_i64_i64_ops (void)
-{
-  OCTAVE_INSTALL_INT_OPS (int64);
-
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int64_, int8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int64_, uint8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int64_, int16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int64_, uint16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int64_, int32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int64_, uint32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int64_, uint64_);
-
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int64_, int8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int64_, uint8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int64_, int16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int64_, uint16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int64_, int32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int64_, uint32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int64_, uint64_);
-
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, int8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, uint8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, int16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, uint16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, int32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, uint32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, uint64);
-
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, int8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, uint8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, int16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, uint16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, int32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, uint32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, uint64);
-}
--- a/src/OPERATORS/op-i8-i8.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-i8nda-ui8.h"
-#include "mx-i8nda-i16.h"
-#include "mx-i8nda-ui16.h"
-#include "mx-i8nda-i32.h"
-#include "mx-i8nda-ui32.h"
-#include "mx-i8nda-i64.h"
-#include "mx-i8nda-ui64.h"
-
-#include "mx-i8nda-ui8nda.h"
-#include "mx-i8nda-i16nda.h"
-#include "mx-i8nda-ui16nda.h"
-#include "mx-i8nda-i32nda.h"
-#include "mx-i8nda-ui32nda.h"
-#include "mx-i8nda-i64nda.h"
-#include "mx-i8nda-ui64nda.h"
-
-#include "mx-i8-ui8nda.h"
-#include "mx-i8-i16nda.h"
-#include "mx-i8-ui16nda.h"
-#include "mx-i8-i32nda.h"
-#include "mx-i8-ui32nda.h"
-#include "mx-i8-i64nda.h"
-#include "mx-i8-ui64nda.h"
-
-#include "mx-i8nda-s.h"
-#include "mx-s-i8nda.h"
-
-#include "mx-i8nda-nda.h"
-#include "mx-nda-i8nda.h"
-
-#include "mx-i8-nda.h"
-#include "mx-nda-i8.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-int8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-uint8.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#include "op-int.h"
-
-OCTAVE_INT_OPS (int8)
-
-OCTAVE_MS_INT_ASSIGN_OPS (mui8, int8_, uint8_, uint8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi16, int8_, int16_, int16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui16, int8_, uint16_, uint16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi32, int8_, int32_, int32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui32, int8_, uint32_, uint32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi64, int8_, int64_, int64_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui64, int8_, uint64_, uint64_)
-
-OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int8_, uint8_, uint8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int8_, int16_, int16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int8_, uint16_, uint16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int8_, int32_, int32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int8_, uint32_, uint32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int8_, int64_, int64_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int8_, uint64_, uint64_)
-
-OCTAVE_MIXED_INT_CMP_OPS (int8, uint8)
-OCTAVE_MIXED_INT_CMP_OPS (int8, int16)
-OCTAVE_MIXED_INT_CMP_OPS (int8, uint16)
-OCTAVE_MIXED_INT_CMP_OPS (int8, int32)
-OCTAVE_MIXED_INT_CMP_OPS (int8, uint32)
-OCTAVE_MIXED_INT_CMP_OPS (int8, int64)
-OCTAVE_MIXED_INT_CMP_OPS (int8, uint64)
-
-void
-install_i8_i8_ops (void)
-{
-  OCTAVE_INSTALL_INT_OPS (int8);
-
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int8_, uint8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int8_, int16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int8_, uint16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int8_, int32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int8_, uint32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int8_, int64_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int8_, uint64_);
-
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int8_, uint8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int8_, int16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int8_, uint16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int8_, int32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int8_, uint32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int8_, int64_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int8_, uint64_);
-
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, uint8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, int16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, uint16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, int32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, uint32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, int64);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, uint64);
-
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, uint8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, int16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, uint16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, int32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, uint32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, int64);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, uint64);
-}
--- a/src/OPERATORS/op-int-concat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-range.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-str-mat.h"
-#include "ov-typeinfo.h"
-#include "op-int.h"
-#include "ops.h"
-
-// Concatentation of mixed integer types:
-
-OCTAVE_CONCAT_FN2 (int8, int16)
-OCTAVE_CONCAT_FN2 (int8, int32)
-OCTAVE_CONCAT_FN2 (int8, int64)
-
-OCTAVE_CONCAT_FN2 (int8, uint8)
-OCTAVE_CONCAT_FN2 (int8, uint16)
-OCTAVE_CONCAT_FN2 (int8, uint32)
-OCTAVE_CONCAT_FN2 (int8, uint64)
-
-OCTAVE_CONCAT_FN2 (int16, int8)
-OCTAVE_CONCAT_FN2 (int16, int32)
-OCTAVE_CONCAT_FN2 (int16, int64)
-
-OCTAVE_CONCAT_FN2 (int16, uint8)
-OCTAVE_CONCAT_FN2 (int16, uint16)
-OCTAVE_CONCAT_FN2 (int16, uint32)
-OCTAVE_CONCAT_FN2 (int16, uint64)
-
-OCTAVE_CONCAT_FN2 (int32, int8)
-OCTAVE_CONCAT_FN2 (int32, int16)
-OCTAVE_CONCAT_FN2 (int32, int64)
-
-OCTAVE_CONCAT_FN2 (int32, uint8)
-OCTAVE_CONCAT_FN2 (int32, uint16)
-OCTAVE_CONCAT_FN2 (int32, uint32)
-OCTAVE_CONCAT_FN2 (int32, uint64)
-
-OCTAVE_CONCAT_FN2 (int64, int8)
-OCTAVE_CONCAT_FN2 (int64, int16)
-OCTAVE_CONCAT_FN2 (int64, int32)
-
-OCTAVE_CONCAT_FN2 (int64, uint8)
-OCTAVE_CONCAT_FN2 (int64, uint16)
-OCTAVE_CONCAT_FN2 (int64, uint32)
-OCTAVE_CONCAT_FN2 (int64, uint64)
-
-OCTAVE_CONCAT_FN2 (uint8, int8)
-OCTAVE_CONCAT_FN2 (uint8, int16)
-OCTAVE_CONCAT_FN2 (uint8, int32)
-OCTAVE_CONCAT_FN2 (uint8, int64)
-
-OCTAVE_CONCAT_FN2 (uint8, uint16)
-OCTAVE_CONCAT_FN2 (uint8, uint32)
-OCTAVE_CONCAT_FN2 (uint8, uint64)
-
-OCTAVE_CONCAT_FN2 (uint16, int8)
-OCTAVE_CONCAT_FN2 (uint16, int16)
-OCTAVE_CONCAT_FN2 (uint16, int32)
-OCTAVE_CONCAT_FN2 (uint16, int64)
-
-OCTAVE_CONCAT_FN2 (uint16, uint8)
-OCTAVE_CONCAT_FN2 (uint16, uint32)
-OCTAVE_CONCAT_FN2 (uint16, uint64)
-
-OCTAVE_CONCAT_FN2 (uint32, int8)
-OCTAVE_CONCAT_FN2 (uint32, int16)
-OCTAVE_CONCAT_FN2 (uint32, int32)
-OCTAVE_CONCAT_FN2 (uint32, int64)
-
-OCTAVE_CONCAT_FN2 (uint32, uint8)
-OCTAVE_CONCAT_FN2 (uint32, uint16)
-OCTAVE_CONCAT_FN2 (uint32, uint64)
-
-OCTAVE_CONCAT_FN2 (uint64, int8)
-OCTAVE_CONCAT_FN2 (uint64, int16)
-OCTAVE_CONCAT_FN2 (uint64, int32)
-OCTAVE_CONCAT_FN2 (uint64, int64)
-
-OCTAVE_CONCAT_FN2 (uint64, uint8)
-OCTAVE_CONCAT_FN2 (uint64, uint16)
-OCTAVE_CONCAT_FN2 (uint64, uint32)
-
-OCTAVE_INT_DOUBLE_CONCAT_FN (int8)
-OCTAVE_INT_DOUBLE_CONCAT_FN (int16)
-OCTAVE_INT_DOUBLE_CONCAT_FN (int32)
-OCTAVE_INT_DOUBLE_CONCAT_FN (int64)
-
-OCTAVE_INT_DOUBLE_CONCAT_FN (uint8)
-OCTAVE_INT_DOUBLE_CONCAT_FN (uint16)
-OCTAVE_INT_DOUBLE_CONCAT_FN (uint32)
-OCTAVE_INT_DOUBLE_CONCAT_FN (uint64)
-
-OCTAVE_DOUBLE_INT_CONCAT_FN (int8)
-OCTAVE_DOUBLE_INT_CONCAT_FN (int16)
-OCTAVE_DOUBLE_INT_CONCAT_FN (int32)
-OCTAVE_DOUBLE_INT_CONCAT_FN (int64)
-
-OCTAVE_DOUBLE_INT_CONCAT_FN (uint8)
-OCTAVE_DOUBLE_INT_CONCAT_FN (uint16)
-OCTAVE_DOUBLE_INT_CONCAT_FN (uint32)
-OCTAVE_DOUBLE_INT_CONCAT_FN (uint64)
-
-OCTAVE_INT_FLOAT_CONCAT_FN (int8)
-OCTAVE_INT_FLOAT_CONCAT_FN (int16)
-OCTAVE_INT_FLOAT_CONCAT_FN (int32)
-OCTAVE_INT_FLOAT_CONCAT_FN (int64)
-
-OCTAVE_INT_FLOAT_CONCAT_FN (uint8)
-OCTAVE_INT_FLOAT_CONCAT_FN (uint16)
-OCTAVE_INT_FLOAT_CONCAT_FN (uint32)
-OCTAVE_INT_FLOAT_CONCAT_FN (uint64)
-
-OCTAVE_FLOAT_INT_CONCAT_FN (int8)
-OCTAVE_FLOAT_INT_CONCAT_FN (int16)
-OCTAVE_FLOAT_INT_CONCAT_FN (int32)
-OCTAVE_FLOAT_INT_CONCAT_FN (int64)
-
-OCTAVE_FLOAT_INT_CONCAT_FN (uint8)
-OCTAVE_FLOAT_INT_CONCAT_FN (uint16)
-OCTAVE_FLOAT_INT_CONCAT_FN (uint32)
-OCTAVE_FLOAT_INT_CONCAT_FN (uint64)
-
-OCTAVE_INT_CHAR_CONCAT_FN (int8)
-OCTAVE_INT_CHAR_CONCAT_FN (int16)
-OCTAVE_INT_CHAR_CONCAT_FN (int32)
-OCTAVE_INT_CHAR_CONCAT_FN (int64)
-
-OCTAVE_INT_CHAR_CONCAT_FN (uint8)
-OCTAVE_INT_CHAR_CONCAT_FN (uint16)
-OCTAVE_INT_CHAR_CONCAT_FN (uint32)
-OCTAVE_INT_CHAR_CONCAT_FN (uint64)
-
-OCTAVE_CHAR_INT_CONCAT_FN (int8)
-OCTAVE_CHAR_INT_CONCAT_FN (int16)
-OCTAVE_CHAR_INT_CONCAT_FN (int32)
-OCTAVE_CHAR_INT_CONCAT_FN (int64)
-
-OCTAVE_CHAR_INT_CONCAT_FN (uint8)
-OCTAVE_CHAR_INT_CONCAT_FN (uint16)
-OCTAVE_CHAR_INT_CONCAT_FN (uint32)
-OCTAVE_CHAR_INT_CONCAT_FN (uint64)
-
-void
-install_int_concat_ops (void)
-{
-  OCTAVE_INSTALL_CONCAT_FN2 (int8, int16);
-  OCTAVE_INSTALL_CONCAT_FN2 (int8, int32);
-  OCTAVE_INSTALL_CONCAT_FN2 (int8, int64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (int8, uint8);
-  OCTAVE_INSTALL_CONCAT_FN2 (int8, uint16);
-  OCTAVE_INSTALL_CONCAT_FN2 (int8, uint32);
-  OCTAVE_INSTALL_CONCAT_FN2 (int8, uint64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (int16, int8);
-  OCTAVE_INSTALL_CONCAT_FN2 (int16, int32);
-  OCTAVE_INSTALL_CONCAT_FN2 (int16, int64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (int16, uint8);
-  OCTAVE_INSTALL_CONCAT_FN2 (int16, uint16);
-  OCTAVE_INSTALL_CONCAT_FN2 (int16, uint32);
-  OCTAVE_INSTALL_CONCAT_FN2 (int16, uint64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (int32, int8);
-  OCTAVE_INSTALL_CONCAT_FN2 (int32, int16);
-  OCTAVE_INSTALL_CONCAT_FN2 (int32, int64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (int32, uint8);
-  OCTAVE_INSTALL_CONCAT_FN2 (int32, uint16);
-  OCTAVE_INSTALL_CONCAT_FN2 (int32, uint32);
-  OCTAVE_INSTALL_CONCAT_FN2 (int32, uint64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (int64, int8);
-  OCTAVE_INSTALL_CONCAT_FN2 (int64, int16);
-  OCTAVE_INSTALL_CONCAT_FN2 (int64, int32);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (int64, uint8);
-  OCTAVE_INSTALL_CONCAT_FN2 (int64, uint16);
-  OCTAVE_INSTALL_CONCAT_FN2 (int64, uint32);
-  OCTAVE_INSTALL_CONCAT_FN2 (int64, uint64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (uint8, int8);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint8, int16);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint8, int32);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint8, int64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint16);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint32);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (uint16, int8);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint16, int16);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint16, int32);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint16, int64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint8);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint32);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (uint32, int8);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint32, int16);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint32, int32);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint32, int64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint8);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint16);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (uint64, int8);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint64, int16);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint64, int32);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint64, int64);
-
-  OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint8);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint16);
-  OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint32);
-
-  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int8);
-  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int16);
-  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int32);
-  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int64);
-
-  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint8);
-  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint16);
-  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint32);
-  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint64);
-
-  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int8);
-  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int16);
-  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int32);
-  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int64);
-
-  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint8);
-  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint16);
-  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint32);
-  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint64);
-
-  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int8);
-  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int16);
-  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int32);
-  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int64);
-
-  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint8);
-  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint16);
-  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint32);
-  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint64);
-
-  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int8);
-  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int16);
-  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int32);
-  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int64);
-
-  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint8);
-  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint16);
-  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint32);
-  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint64);
-
-  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int8);
-  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int16);
-  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int32);
-  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int64);
-
-  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint8);
-  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint16);
-  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint32);
-  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint64);
-
-  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int8);
-  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int16);
-  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int32);
-  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int64);
-
-  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint8);
-  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint16);
-  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint32);
-  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint64);
-}
--- a/src/OPERATORS/op-int-conv.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-range.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-str-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-#define DEFINTCONVFN(name, tfrom, tto) \
-  CONVDECL (name) \
-  { \
-    CAST_CONV_ARG (const octave_ ## tfrom&); \
- \
-    octave_ ## tto ## _matrix v2 = v.tto ## _array_value (); \
-    return new octave_ ## tto ## _matrix (v2); \
-  }
-
-// conversion ops
-
-DEFINTCONVFN (scalar_to_int8, scalar, int8)
-DEFINTCONVFN (scalar_to_int16, scalar, int16)
-DEFINTCONVFN (scalar_to_int32, scalar, int32)
-DEFINTCONVFN (scalar_to_int64, scalar, int64)
-
-DEFINTCONVFN (scalar_to_uint8, scalar, uint8)
-DEFINTCONVFN (scalar_to_uint16, scalar, uint16)
-DEFINTCONVFN (scalar_to_uint32, scalar, uint32)
-DEFINTCONVFN (scalar_to_uint64, scalar, uint64)
-
-DEFINTCONVFN (matrix_to_int8, matrix, int8)
-DEFINTCONVFN (matrix_to_int16, matrix, int16)
-DEFINTCONVFN (matrix_to_int32, matrix, int32)
-DEFINTCONVFN (matrix_to_int64, matrix, int64)
-
-DEFINTCONVFN (matrix_to_uint8, matrix, uint8)
-DEFINTCONVFN (matrix_to_uint16, matrix, uint16)
-DEFINTCONVFN (matrix_to_uint32, matrix, uint32)
-DEFINTCONVFN (matrix_to_uint64, matrix, uint64)
-
-DEFINTCONVFN (float_scalar_to_int8, float_scalar, int8)
-DEFINTCONVFN (float_scalar_to_int16, float_scalar, int16)
-DEFINTCONVFN (float_scalar_to_int32, float_scalar, int32)
-DEFINTCONVFN (float_scalar_to_int64, float_scalar, int64)
-
-DEFINTCONVFN (float_scalar_to_uint8, float_scalar, uint8)
-DEFINTCONVFN (float_scalar_to_uint16, float_scalar, uint16)
-DEFINTCONVFN (float_scalar_to_uint32, float_scalar, uint32)
-DEFINTCONVFN (float_scalar_to_uint64, float_scalar, uint64)
-
-DEFINTCONVFN (float_matrix_to_int8, float_matrix, int8)
-DEFINTCONVFN (float_matrix_to_int16, float_matrix, int16)
-DEFINTCONVFN (float_matrix_to_int32, float_matrix, int32)
-DEFINTCONVFN (float_matrix_to_int64, float_matrix, int64)
-
-DEFINTCONVFN (float_matrix_to_uint8, float_matrix, uint8)
-DEFINTCONVFN (float_matrix_to_uint16, float_matrix, uint16)
-DEFINTCONVFN (float_matrix_to_uint32, float_matrix, uint32)
-DEFINTCONVFN (float_matrix_to_uint64, float_matrix, uint64)
-
-DEFCONVFN (bool_to_int8, bool, int8)
-DEFCONVFN (bool_to_int16, bool, int16)
-DEFCONVFN (bool_to_int32, bool, int32)
-DEFCONVFN (bool_to_int64, bool, int64)
-
-DEFCONVFN (bool_to_uint8, bool, uint8)
-DEFCONVFN (bool_to_uint16, bool, uint16)
-DEFCONVFN (bool_to_uint32, bool, uint32)
-DEFCONVFN (bool_to_uint64, bool, uint64)
-
-DEFCONVFN (bool_matrix_to_int8, bool_matrix, int8)
-DEFCONVFN (bool_matrix_to_int16, bool_matrix, int16)
-DEFCONVFN (bool_matrix_to_int32, bool_matrix, int32)
-DEFCONVFN (bool_matrix_to_int64, bool_matrix, int64)
-
-DEFCONVFN (bool_matrix_to_uint8, bool_matrix, uint8)
-DEFCONVFN (bool_matrix_to_uint16, bool_matrix, uint16)
-DEFCONVFN (bool_matrix_to_uint32, bool_matrix, uint32)
-DEFCONVFN (bool_matrix_to_uint64, bool_matrix, uint64)
-
-DEFSTRINTCONVFN (char_matrix_sq_str_to_int8, int8)
-DEFSTRINTCONVFN (char_matrix_sq_str_to_int16, int16)
-DEFSTRINTCONVFN (char_matrix_sq_str_to_int32, int32)
-DEFSTRINTCONVFN (char_matrix_sq_str_to_int64, int64)
-
-DEFSTRINTCONVFN (char_matrix_sq_str_to_uint8, uint8)
-DEFSTRINTCONVFN (char_matrix_sq_str_to_uint16, uint16)
-DEFSTRINTCONVFN (char_matrix_sq_str_to_uint32, uint32)
-DEFSTRINTCONVFN (char_matrix_sq_str_to_uint64, uint64)
-
-DEFSTRINTCONVFN (char_matrix_dq_str_to_int8, int8)
-DEFSTRINTCONVFN (char_matrix_dq_str_to_int16, int16)
-DEFSTRINTCONVFN (char_matrix_dq_str_to_int32, int32)
-DEFSTRINTCONVFN (char_matrix_dq_str_to_int64, int64)
-
-DEFSTRINTCONVFN (char_matrix_dq_str_to_uint8, uint8)
-DEFSTRINTCONVFN (char_matrix_dq_str_to_uint16, uint16)
-DEFSTRINTCONVFN (char_matrix_dq_str_to_uint32, uint32)
-DEFSTRINTCONVFN (char_matrix_dq_str_to_uint64, uint64)
-
-DEFINTCONVFN (range_to_int8, range, int8)
-DEFINTCONVFN (range_to_int16, range, int16)
-DEFINTCONVFN (range_to_int32, range, int32)
-DEFINTCONVFN (range_to_int64, range, int64)
-
-DEFINTCONVFN (range_to_uint8, range, uint8)
-DEFINTCONVFN (range_to_uint16, range, uint16)
-DEFINTCONVFN (range_to_uint32, range, uint32)
-DEFINTCONVFN (range_to_uint64, range, uint64)
-
-#define INT_CONV_FUNCTIONS(tfrom) \
-  DEFCONVFN2 (tfrom ## _scalar_to_int8, tfrom, scalar, int8) \
-  DEFCONVFN2 (tfrom ## _scalar_to_int16, tfrom, scalar, int16) \
-  DEFCONVFN2 (tfrom ## _scalar_to_int32, tfrom, scalar, int32) \
-  DEFCONVFN2 (tfrom ## _scalar_to_int64, tfrom, scalar, int64) \
- \
-  DEFCONVFN2 (tfrom ## _scalar_to_uint8, tfrom, scalar, uint8) \
-  DEFCONVFN2 (tfrom ## _scalar_to_uint16, tfrom, scalar, uint16) \
-  DEFCONVFN2 (tfrom ## _scalar_to_uint32, tfrom, scalar, uint32) \
-  DEFCONVFN2 (tfrom ## _scalar_to_uint64, tfrom, scalar, uint64) \
- \
-  DEFCONVFN2 (tfrom ## _matrix_to_int8, tfrom, matrix, int8) \
-  DEFCONVFN2 (tfrom ## _matrix_to_int16, tfrom, matrix, int16) \
-  DEFCONVFN2 (tfrom ## _matrix_to_int32, tfrom, matrix, int32) \
-  DEFCONVFN2 (tfrom ## _matrix_to_int64, tfrom, matrix, int64) \
- \
-  DEFCONVFN2 (tfrom ## _matrix_to_uint8, tfrom, matrix, uint8) \
-  DEFCONVFN2 (tfrom ## _matrix_to_uint16, tfrom, matrix, uint16) \
-  DEFCONVFN2 (tfrom ## _matrix_to_uint32, tfrom, matrix, uint32) \
-  DEFCONVFN2 (tfrom ## _matrix_to_uint64, tfrom, matrix, uint64)
-
-INT_CONV_FUNCTIONS (int8)
-INT_CONV_FUNCTIONS (int16)
-INT_CONV_FUNCTIONS (int32)
-INT_CONV_FUNCTIONS (int64)
-
-INT_CONV_FUNCTIONS (uint8)
-INT_CONV_FUNCTIONS (uint16)
-INT_CONV_FUNCTIONS (uint32)
-INT_CONV_FUNCTIONS (uint64)
-
-#define INSTALL_INT_CONV_FUNCTIONS(tfrom) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_int8_matrix, tfrom ## _scalar_to_int8) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_int16_matrix, tfrom ## _scalar_to_int16) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_int32_matrix, tfrom ## _scalar_to_int32) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_int64_matrix, tfrom ## _scalar_to_int64) \
- \
-  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_uint8_matrix, tfrom ## _scalar_to_uint8) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_uint16_matrix, tfrom ## _scalar_to_uint16) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_uint32_matrix, tfrom ## _scalar_to_uint32) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_uint64_matrix, tfrom ## _scalar_to_uint64) \
- \
-  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_int8_matrix, tfrom ## _matrix_to_int8) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_int16_matrix, tfrom ## _matrix_to_int16) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_int32_matrix, tfrom ## _matrix_to_int32) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_int64_matrix, tfrom ## _matrix_to_int64) \
- \
-  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_uint8_matrix, tfrom ## _matrix_to_uint8) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_uint16_matrix, tfrom ## _matrix_to_uint16) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_uint32_matrix, tfrom ## _matrix_to_uint32) \
-  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_uint64_matrix, tfrom ## _matrix_to_uint64)
-
-#define INSTALL_CONVOPS(tfrom) \
-  INSTALL_CONVOP (octave_ ## tfrom, octave_int8_matrix, tfrom ## _to_int8) \
-  INSTALL_CONVOP (octave_ ## tfrom, octave_int16_matrix, tfrom ## _to_int16) \
-  INSTALL_CONVOP (octave_ ## tfrom, octave_int32_matrix, tfrom ## _to_int32) \
-  INSTALL_CONVOP (octave_ ## tfrom, octave_int64_matrix, tfrom ## _to_int64) \
- \
-  INSTALL_CONVOP (octave_ ## tfrom, octave_uint8_matrix, tfrom ## _to_uint8) \
-  INSTALL_CONVOP (octave_ ## tfrom, octave_uint16_matrix, tfrom ## _to_uint16) \
-  INSTALL_CONVOP (octave_ ## tfrom, octave_uint32_matrix, tfrom ## _to_uint32) \
-  INSTALL_CONVOP (octave_ ## tfrom, octave_uint64_matrix, tfrom ## _to_uint64)
-
-void
-install_int_conv_ops (void)
-{
-  INSTALL_CONVOPS (scalar)
-  INSTALL_CONVOPS (matrix)
-  INSTALL_CONVOPS (float_scalar)
-  INSTALL_CONVOPS (float_matrix)
-  INSTALL_CONVOPS (bool)
-  INSTALL_CONVOPS (bool_matrix)
-  INSTALL_CONVOPS (range)
-  INSTALL_CONVOPS (char_matrix_sq_str)
-  INSTALL_CONVOPS (char_matrix_dq_str)
-
-  INSTALL_INT_CONV_FUNCTIONS (int8)
-  INSTALL_INT_CONV_FUNCTIONS (int16)
-  INSTALL_INT_CONV_FUNCTIONS (int32)
-  INSTALL_INT_CONV_FUNCTIONS (int64)
-
-  INSTALL_INT_CONV_FUNCTIONS (uint8)
-  INSTALL_INT_CONV_FUNCTIONS (uint16)
-  INSTALL_INT_CONV_FUNCTIONS (uint32)
-  INSTALL_INT_CONV_FUNCTIONS (uint64)
-}
--- a/src/OPERATORS/op-int.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1191 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#include "quit.h"
-#include "bsxfun.h"
-
-#define DEFINTBINOP_OP(name, t1, t2, op, t3) \
-  BINOPDECL (name, a1, a2) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
-    octave_value retval = octave_value \
-      (v1.t1 ## _value () op v2.t2 ## _value ()); \
-    return retval; \
-  }
-
-#define DEFINTNDBINOP_OP(name, t1, t2, e1, e2, op, t3) \
-  BINOPDECL (name, a1, a2) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
-    octave_value retval = octave_value \
-      (v1.e1 ## _value () op v2.e2 ## _value ()); \
-    return retval; \
-  }
-
-#define DEFINTBINOP_FN(name, t1, t2, f, t3, op) \
-  BINOPDECL (name, a1, a2) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
-    octave_value retval = octave_value (f (v1.t1 ## _value (), v2.t2 ## _value ())); \
-    return retval; \
-  }
-
-#define DEFINTNDBINOP_FN(name, t1, t2, e1, e2, f, t3, op)       \
-  BINOPDECL (name, a1, a2) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
-    octave_value retval = octave_value (f (v1.e1 ## _value (), v2.e2 ## _value ())); \
-    return retval; \
-  }
-
-#define OCTAVE_CONCAT_FN2(T1, T2) \
-  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _s_s, T1 ## _scalar, T2 ## _scalar, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
-  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _s_m, T1 ## _scalar, T2 ## _matrix, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
-  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _m_s, T1 ## _matrix, T2 ## _scalar, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
-  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _m_m, T1 ## _matrix, T2 ## _matrix, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat)
-
-#define OCTAVE_INSTALL_CONCAT_FN2(T1, T2) \
-  INSTALL_CATOP (octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, T1 ## _ ## T2 ## _s_s) \
-  INSTALL_CATOP (octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, T1 ## _ ## T2 ## _s_m) \
-  INSTALL_CATOP (octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, T1 ## _ ## T2 ## _m_s) \
-  INSTALL_CATOP (octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, T1 ## _ ## T2 ## _m_m)
-
-#define OCTAVE_DOUBLE_INT_CONCAT_FN(TYPE) \
-  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _s_s, scalar, TYPE ## _scalar, TYPE ## NDArray, , array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _s_m, scalar, TYPE ## _matrix, TYPE ## NDArray, , array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _m_s, matrix, TYPE ## _scalar, TYPE ## NDArray, , array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _m_m, matrix, TYPE ## _matrix, TYPE ## NDArray, , array, TYPE ## _array, concat)
-
-#define OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN(TYPE) \
-  INSTALL_CATOP (octave_scalar, octave_ ## TYPE ## _scalar, double ## _ ## TYPE ## _s_s) \
-  INSTALL_CATOP (octave_scalar, octave_ ## TYPE ## _matrix, double ## _ ## TYPE ## _s_m) \
-  INSTALL_CATOP (octave_matrix, octave_ ## TYPE ## _scalar, double ## _ ## TYPE ## _m_s) \
-  INSTALL_CATOP (octave_matrix, octave_ ## TYPE ## _matrix, double ## _ ## TYPE ## _m_m)
-
-#define OCTAVE_INT_DOUBLE_CONCAT_FN(TYPE) \
-  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _s_s, TYPE ## _scalar, scalar, , TYPE ## NDArray, TYPE ## _array, array, concat) \
-  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _s_m, TYPE ## _scalar, matrix, , TYPE ## NDArray, TYPE ## _array, array, concat) \
-  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _m_s, TYPE ## _matrix, scalar, , TYPE ## NDArray, TYPE ## _array, array, concat) \
-  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _m_m, TYPE ## _matrix, matrix, , TYPE ## NDArray, TYPE ## _array, array, concat)
-
-#define OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN(TYPE) \
-  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_scalar, TYPE ## _ ## double ## _s_s) \
-  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_matrix, TYPE ## _ ## double ## _s_m) \
-  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_scalar, TYPE ## _ ## double ## _m_s) \
-  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_matrix, TYPE ## _ ## double ## _m_m)
-
-#define OCTAVE_FLOAT_INT_CONCAT_FN(TYPE) \
-  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _s_s, float_scalar, TYPE ## _scalar, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _s_m, float_scalar, TYPE ## _matrix, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _m_s, float_matrix, TYPE ## _scalar, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _m_m, float_matrix, TYPE ## _matrix, TYPE ## NDArray, , float_array, TYPE ## _array, concat)
-
-#define OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN(TYPE) \
-  INSTALL_CATOP (octave_float_scalar, octave_ ## TYPE ## _scalar, float ## _ ## TYPE ## _s_s) \
-  INSTALL_CATOP (octave_float_scalar, octave_ ## TYPE ## _matrix, float ## _ ## TYPE ## _s_m) \
-  INSTALL_CATOP (octave_float_matrix, octave_ ## TYPE ## _scalar, float ## _ ## TYPE ## _m_s) \
-  INSTALL_CATOP (octave_float_matrix, octave_ ## TYPE ## _matrix, float ## _ ## TYPE ## _m_m)
-
-#define OCTAVE_INT_FLOAT_CONCAT_FN(TYPE) \
-  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _s_s, TYPE ## _scalar, float_scalar, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
-  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _s_m, TYPE ## _scalar, float_matrix, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
-  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _m_s, TYPE ## _matrix, float_scalar, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
-  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _m_m, TYPE ## _matrix, float_matrix, , TYPE ## NDArray, TYPE ## _array, float_array, concat)
-
-#define OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN(TYPE) \
-  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_float_scalar, TYPE ## _ ## float ## _s_s) \
-  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_float_matrix, TYPE ## _ ## float ## _s_m) \
-  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_float_scalar, TYPE ## _ ## float ## _m_s) \
-  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_float_matrix, TYPE ## _ ## float ## _m_m)
-
-// For compatibility, concatenation with a character always returns a
-// character.
-
-#define OCTAVE_CHAR_INT_CONCAT_FN(TYPE) \
-  DEFNDCHARCATOP_FN (char ## _ ## TYPE ## _m_s, char_matrix, TYPE ## _scalar, concat) \
-  DEFNDCHARCATOP_FN (char ## _ ## TYPE ## _m_m, char_matrix, TYPE ## _matrix, concat)
-
-#define OCTAVE_INSTALL_CHAR_INT_CONCAT_FN(TYPE) \
-  INSTALL_CATOP (octave_char_matrix_str, octave_ ## TYPE ## _scalar, char ## _ ## TYPE ## _m_s) \
-  INSTALL_CATOP (octave_char_matrix_str, octave_ ## TYPE ## _matrix, char ## _ ## TYPE ## _m_m) \
-  INSTALL_CATOP (octave_char_matrix_sq_str, octave_ ## TYPE ## _scalar, char ## _ ## TYPE ## _m_s) \
-  INSTALL_CATOP (octave_char_matrix_sq_str, octave_ ## TYPE ## _matrix, char ## _ ## TYPE ## _m_m)
-
-#define OCTAVE_INT_CHAR_CONCAT_FN(TYPE) \
-  DEFNDCHARCATOP_FN (TYPE ## _ ## char ## _s_m, TYPE ## _scalar, char_matrix, concat) \
-  DEFNDCHARCATOP_FN (TYPE ## _ ## char ## _m_m, TYPE ## _matrix, char_matrix, concat)
-
-#define OCTAVE_INSTALL_INT_CHAR_CONCAT_FN(TYPE) \
-  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_char_matrix_str, TYPE ## _ ## char ## _s_m) \
-  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_char_matrix_str, TYPE ## _ ## char ## _m_m) \
-  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_char_matrix_sq_str, TYPE ## _ ## char ## _s_m) \
-  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_char_matrix_sq_str, TYPE ## _ ## char ## _m_m)
-
-#define OCTAVE_CONCAT_FN(TYPE) \
-  DEFNDCATOP_FN (TYPE ## _s_s, TYPE ## _scalar, TYPE ## _scalar, TYPE ## _array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN (TYPE ## _s_m, TYPE ## _scalar, TYPE ## _matrix, TYPE ## _array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN (TYPE ## _m_s, TYPE ## _matrix, TYPE ## _scalar, TYPE ## _array, TYPE ## _array, concat) \
-  DEFNDCATOP_FN (TYPE ## _m_m, TYPE ## _matrix, TYPE ## _matrix, TYPE ## _array, TYPE ## _array, concat)
-
-#define OCTAVE_INSTALL_CONCAT_FN(TYPE) \
-  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, TYPE ## _s_s) \
-  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _s_m) \
-  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _scalar, TYPE ## _m_s) \
-  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix, TYPE ## _m_m)
-
-#define OCTAVE_S_INT_UNOPS(TYPE) \
-  /* scalar unary ops. */  \
- \
-  DEFUNOP_OP (s_not, TYPE ## _scalar, !) \
-  DEFUNOP_OP (s_uplus, TYPE ## _scalar, /* no-op */) \
-  DEFUNOP (s_uminus, TYPE ## _scalar) \
-  { \
-    CAST_UNOP_ARG (const octave_ ## TYPE ## _scalar &); \
-    octave_value retval = octave_value (- v. TYPE ## _scalar_value ()); \
-    return retval; \
-  } \
-  DEFUNOP_OP (s_transpose, TYPE ## _scalar, /* no-op */) \
-  DEFUNOP_OP (s_hermitian, TYPE ## _scalar, /* no-op */) \
- \
-  DEFNCUNOP_METHOD (s_incr, TYPE ## _scalar, increment) \
-  DEFNCUNOP_METHOD (s_decr, TYPE ## _scalar, decrement)
-
-#define OCTAVE_SS_INT_ARITH_OPS(PFX, T1, T2, T3)        \
-  /* scalar by scalar ops. */ \
- \
-  DEFINTBINOP_OP (PFX ## _add, T1 ## scalar, T2 ## scalar, +, T3) \
-  DEFINTBINOP_OP (PFX ## _sub, T1 ## scalar, T2 ## scalar, -, T3) \
-  DEFINTBINOP_OP (PFX ## _mul, T1 ## scalar, T2 ## scalar, *, T3) \
- \
-  DEFBINOP (PFX ## _div, T1 ## scalar, T2 ## scalar) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
- \
-    if (! v2.T2 ## scalar_value ()) \
-      gripe_divide_by_zero (); \
- \
-    octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
-    return retval; \
-  } \
- \
-  DEFINTBINOP_FN (PFX ## _pow, T1 ## scalar, T2 ## scalar, xpow, T3, ^) \
- \
-  DEFBINOP (PFX ## _ldiv, T1 ## scalar, T2 ## scalar) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
- \
-    if (! v1.T1 ## scalar_value ()) \
-      gripe_divide_by_zero (); \
- \
-    octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
-    return retval; \
-  } \
- \
-  DEFINTBINOP_OP (PFX ## _el_mul, T1 ## scalar, T2 ## scalar, *, T3)    \
- \
-  DEFBINOP (PFX ## _el_div, T1 ## scalar, T2 ## scalar) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
- \
-    if (! v2.T2 ## scalar_value ()) \
-      gripe_divide_by_zero (); \
- \
-    octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
-    return retval; \
-  } \
- \
-  DEFINTBINOP_FN (PFX ## _el_pow, T1 ## scalar, T2 ## scalar, xpow, T3, .^) \
- \
-  DEFBINOP (PFX ## _el_ldiv, T1 ## scalar, T2 ## scalar) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
- \
-    if (! v1.T1 ## scalar_value ()) \
-      gripe_divide_by_zero (); \
- \
-    octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
-    return retval; \
-  } \
-
-#define OCTAVE_SS_INT_BOOL_OPS(PFX, T1, T2, Z1, Z2) \
-  DEFBINOP (PFX ## _el_and, T2, T2) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
- \
-    return v1.T1 ## scalar_value () != Z1 && v2.T2 ## scalar_value () != Z2; \
-  } \
- \
-  DEFBINOP (PFX ## _el_or, T1, T2) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
- \
-    return v1.T1 ## scalar_value () != Z1 || v2.T2 ## scalar_value () != Z2; \
-  }
-
-#define OCTAVE_SS_INT_CMP_OPS(PFX, T1, T2) \
-  DEFBINOP_OP (PFX ## _lt, T1 ## scalar, T2 ## scalar, <) \
-  DEFBINOP_OP (PFX ## _le, T1 ## scalar, T2 ## scalar, <=) \
-  DEFBINOP_OP (PFX ## _eq, T1 ## scalar, T2 ## scalar, ==) \
-  DEFBINOP_OP (PFX ## _ge, T1 ## scalar, T2 ## scalar, >=) \
-  DEFBINOP_OP (PFX ## _gt, T1 ## scalar, T2 ## scalar, >) \
-  DEFBINOP_OP (PFX ## _ne, T1 ## scalar, T2 ## scalar, !=)
-
-#define OCTAVE_SS_POW_OPS(T1, T2) \
-  octave_value \
-  xpow (const octave_ ## T1& a, const octave_ ## T2& b) \
-  { \
-    return pow (a, b); \
-  } \
- \
-  octave_value \
-  xpow (const octave_ ## T1& a, double b) \
-  { \
-    return pow (a, b); \
-  } \
- \
-  octave_value \
-  xpow (double a, const octave_ ## T1& b) \
-  { \
-    return pow (a, b); \
-  } \
- \
-  octave_value \
-  xpow (const octave_ ## T1& a, float b) \
-  { \
-    return powf (a, b); \
-  } \
- \
-  octave_value \
-  xpow (float a, const octave_ ## T1& b) \
-  { \
-    return powf (a, b); \
-  }
-
-#define OCTAVE_SS_INT_OPS(TYPE) \
-  OCTAVE_S_INT_UNOPS (TYPE) \
-  OCTAVE_SS_POW_OPS (TYPE, TYPE) \
-  OCTAVE_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _, TYPE) \
-  OCTAVE_SS_INT_ARITH_OPS (ssx, TYPE ## _, , TYPE) \
-  OCTAVE_SS_INT_ARITH_OPS (sxs, , TYPE ## _, TYPE) \
-  OCTAVE_SS_INT_ARITH_OPS (ssfx, TYPE ## _, float_, TYPE) \
-  OCTAVE_SS_INT_ARITH_OPS (sfxs, float_, TYPE ## _, TYPE) \
-  OCTAVE_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \
-  OCTAVE_SS_INT_CMP_OPS (sx, TYPE ## _, ) \
-  OCTAVE_SS_INT_CMP_OPS (xs, , TYPE ## _) \
-  OCTAVE_SS_INT_CMP_OPS (sfx, TYPE ## _, float_) \
-  OCTAVE_SS_INT_CMP_OPS (fxs, float_, TYPE ## _) \
-  OCTAVE_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _, octave_ ## TYPE (0), octave_ ## TYPE (0)) \
-  OCTAVE_SS_INT_BOOL_OPS (sx, TYPE ## _, , octave_ ## TYPE (0), 0) \
-  OCTAVE_SS_INT_BOOL_OPS (xs, , TYPE ## _, 0, octave_ ## TYPE (0)) \
-  OCTAVE_SS_INT_BOOL_OPS (sfx, TYPE ## _, float_, octave_ ## TYPE (0), 0) \
-  OCTAVE_SS_INT_BOOL_OPS (fxs, float_, TYPE ## _, 0, octave_ ## TYPE (0))
-
-#define OCTAVE_SM_INT_ARITH_OPS(PFX, TS, TM, TI) \
-  /* scalar by matrix ops. */ \
- \
-  DEFINTNDBINOP_OP (PFX ## _add, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, +, TI) \
-  DEFINTNDBINOP_OP (PFX ## _sub, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, -, TI) \
-  DEFINTNDBINOP_OP (PFX ## _mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \
- \
-  /* DEFBINOP (PFX ## _div, TS ## scalar, TM ## matrix) */ \
-  /* { */ \
-  /* CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); */ \
-  /* */ \
-  /* Matrix m1 = v1.TM ## matrix_value (); */ \
-  /* Matrix m2 = v2.TM ## matrix_value (); */ \
-  /* */ \
-  /* return octave_value (xdiv (m1, m2)); */ \
-  /* } */ \
- \
-  /* DEFBINOP_FN (PFX ## _pow, TS ## scalar, TM ## matrix, xpow) */ \
- \
-  DEFBINOP (PFX ## _ldiv, TS ## scalar, TM ## matrix) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
- \
-    if (! v1.TS ## scalar_value ()) \
-      gripe_divide_by_zero (); \
- \
-    octave_value retval = octave_value (v2.TS ## scalar_value () / v1.TS ## scalar_value ()); \
-    return retval; \
-  } \
- \
-  DEFINTNDBINOP_OP (PFX ## _el_mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \
-  DEFBINOP (PFX ## _el_div, TS ## scalar, TM ## matrix) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
- \
-    octave_value retval = octave_value (v1.TS ## scalar_value () / v2.TM ## array_value ()); \
-    return retval; \
-  } \
- \
-  DEFINTNDBINOP_FN (PFX ## _el_pow, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, elem_xpow, TI, .^) \
- \
-  DEFBINOP (PFX ## _el_ldiv, TS ## scalar, TM ## matrix) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
- \
-    if (! v1.TS ## scalar_value ()) \
-      gripe_divide_by_zero (); \
- \
-    octave_value retval = octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \
-    return retval; \
-  }
-
-#define OCTAVE_SM_INT_CMP_OPS(PFX, TS, TM) \
-  DEFNDBINOP_FN (PFX ## _lt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_lt) \
-  DEFNDBINOP_FN (PFX ## _le, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_le) \
-  DEFNDBINOP_FN (PFX ## _eq, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_eq) \
-  DEFNDBINOP_FN (PFX ## _ge, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ge) \
-  DEFNDBINOP_FN (PFX ## _gt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_gt) \
-  DEFNDBINOP_FN (PFX ## _ne, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ne)
-
-#define OCTAVE_SM_INT_BOOL_OPS(PFX, TS, TM) \
-  DEFNDBINOP_FN (PFX ## _el_and, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_and) \
-  DEFNDBINOP_FN (PFX ## _el_or,  TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_or) \
-  DEFNDBINOP_FN (PFX ## _el_and_not, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_and_not) \
-  DEFNDBINOP_FN (PFX ## _el_or_not,  TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_or_not)
-
-#define OCTAVE_SM_POW_OPS(T1, T2) \
-  octave_value \
-  elem_xpow (const octave_ ## T1& a, const T2 ## NDArray& b) \
-  { \
-    T2 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = pow (a, b(i)); \
-      } \
-    return octave_value (result); \
-  } \
-\
-  octave_value \
-  elem_xpow (const octave_ ## T1& a, const NDArray& b) \
-  { \
-    T1 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = pow (a, b(i)); \
-      } \
-    return octave_value (result); \
-  } \
- \
-  octave_value \
-  elem_xpow (double a, const T2 ## NDArray& b) \
-  { \
-    T2 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = pow (a, b(i)); \
-      } \
-    return octave_value (result); \
-  } \
-\
-  octave_value \
-  elem_xpow (const octave_ ## T1& a, const FloatNDArray& b) \
-  { \
-    T1 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = powf (a, b(i)); \
-      } \
-    return octave_value (result); \
-  } \
- \
-  octave_value \
-  elem_xpow (float a, const T2 ## NDArray& b) \
-  { \
-    T2 ## NDArray result (b.dims ()); \
-    for (int i = 0; i < b.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = powf (a, b(i)); \
-      } \
-    return octave_value (result); \
-  }
-
-
-#define OCTAVE_SM_CONV(TS, TM) \
-  DEFCONV (TS ## s_ ## TM ## m_conv, TM ## scalar, TM ## matrix) \
-  { \
-    CAST_CONV_ARG (const octave_ ## TS ## scalar&); \
- \
-    return new octave_ ## TM ## matrix (v.TM ## array_value ()); \
-  }
-
-#define OCTAVE_SM_INT_OPS(TYPE) \
-  OCTAVE_SM_POW_OPS (TYPE, TYPE) \
-  OCTAVE_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _, TYPE) \
-  OCTAVE_SM_INT_ARITH_OPS (smx, TYPE ## _, , TYPE) \
-  OCTAVE_SM_INT_ARITH_OPS (sxm, , TYPE ## _, TYPE) \
-  OCTAVE_SM_INT_ARITH_OPS (smfx, TYPE ## _, float_, TYPE) \
-  OCTAVE_SM_INT_ARITH_OPS (sfxm, float_, TYPE ## _, TYPE) \
-  OCTAVE_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \
-  OCTAVE_SM_INT_CMP_OPS (xm, , TYPE ## _) \
-  OCTAVE_SM_INT_CMP_OPS (smx, TYPE ## _, ) \
-  OCTAVE_SM_INT_CMP_OPS (fxm, float_, TYPE ## _) \
-  OCTAVE_SM_INT_CMP_OPS (smfx, TYPE ## _, float_) \
-  OCTAVE_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \
-  OCTAVE_SM_INT_BOOL_OPS (xm, , TYPE ## _) \
-  OCTAVE_SM_INT_BOOL_OPS (smx, TYPE ## _, ) \
-  OCTAVE_SM_INT_BOOL_OPS (fxm, float_, TYPE ## _) \
-  OCTAVE_SM_INT_BOOL_OPS (smfx, TYPE ## _, float_) \
-  OCTAVE_SM_CONV (TYPE ## _, TYPE ## _) \
-  OCTAVE_SM_CONV (TYPE ## _, complex_) \
-  OCTAVE_SM_CONV (TYPE ## _, float_complex_)
-
-#define OCTAVE_MS_INT_ARITH_OPS(PFX, TM, TS, TI) \
-  /* matrix by scalar ops. */ \
- \
-  DEFINTNDBINOP_OP (PFX ## _add, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, +, TI) \
-  DEFINTNDBINOP_OP (PFX ## _sub, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, -, TI) \
-  DEFINTNDBINOP_OP (PFX ## _mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *, TI) \
- \
-  DEFBINOP (PFX ## _div, TM ## matrix, TS ## scalar) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
- \
-    if (! v2.TS ## scalar_value ()) \
-      gripe_divide_by_zero (); \
- \
-    octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
-    return retval; \
-  } \
- \
-  /* DEFBINOP_FN (PFX ## _pow, TM ## matrix, TS ## scalar, xpow) */ \
- \
-  /* DEFBINOP (PFX ## _ldiv, TM ## matrix, TS ## scalar) */ \
-  /* { */ \
-  /* CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); */ \
-  /* */ \
-  /* Matrix m1 = v1.TM ## matrix_value (); */ \
-  /* Matrix m2 = v2.TM ## matrix_value (); */ \
-  /* */ \
-  /* return octave_value (xleftdiv (m1, m2)); */ \
-  /* } */ \
- \
-  DEFINTNDBINOP_OP (PFX ## _el_mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *, TI) \
- \
-  DEFBINOP (PFX ## _el_div, TM ## matrix, TS ## scalar) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
- \
-    if (! v2.TS ## scalar_value ()) \
-      gripe_divide_by_zero (); \
- \
-    octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
-    return retval; \
-  } \
- \
-  DEFINTNDBINOP_FN (PFX ## _el_pow, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, elem_xpow, TI, .^) \
- \
-  DEFBINOP (PFX ## _el_ldiv, TM ## matrix, TS ## scalar) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
-    \
-    octave_value retval = v2.TS ## scalar_value () / v1.TM ## array_value (); \
-    return retval; \
-  }
-
-#define OCTAVE_MS_INT_CMP_OPS(PFX, TM, TS) \
-  DEFNDBINOP_FN (PFX ## _lt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_lt) \
-  DEFNDBINOP_FN (PFX ## _le, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_le) \
-  DEFNDBINOP_FN (PFX ## _eq, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_eq) \
-  DEFNDBINOP_FN (PFX ## _ge, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ge) \
-  DEFNDBINOP_FN (PFX ## _gt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_gt) \
-  DEFNDBINOP_FN (PFX ## _ne, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ne)
-
-#define OCTAVE_MS_INT_BOOL_OPS(PFX, TM, TS) \
-  DEFNDBINOP_FN (PFX ## _el_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_and) \
-  DEFNDBINOP_FN (PFX ## _el_or, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_or) \
-  DEFNDBINOP_FN (PFX ## _el_not_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_not_and) \
-  DEFNDBINOP_FN (PFX ## _el_not_or,  TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_not_or)
-
-#define OCTAVE_MS_INT_ASSIGN_OPS(PFX, TM, TS, TE) \
-  DEFNDASSIGNOP_FN (PFX ## _assign, TM ## matrix, TS ## scalar, TM ## scalar, assign)
-
-#define OCTAVE_MS_INT_ASSIGNEQ_OPS(PFX, TM) \
-  DEFNDASSIGNOP_OP (PFX ## _assign_add, TM ## matrix, TM ## scalar, TM ## scalar, +=) \
-  DEFNDASSIGNOP_OP (PFX ## _assign_sub, TM ## matrix, TM ## scalar, TM ## scalar, -=) \
-  DEFNDASSIGNOP_OP (PFX ## _assign_mul, TM ## matrix, TM ## scalar, TM ## scalar, *=) \
-  DEFNDASSIGNOP_OP (PFX ## _assign_div, TM ## matrix, TM ## scalar, TM ## scalar, /=)
-
-#define OCTAVE_MS_POW_OPS(T1, T2) \
-octave_value elem_xpow (T1 ## NDArray a, octave_ ## T2  b) \
-{ \
-  T1 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
-    { \
-      OCTAVE_QUIT; \
-      result (i) = pow (a(i), b);               \
-    } \
-  return octave_value (result); \
-} \
-\
-octave_value elem_xpow (T1 ## NDArray a, double  b) \
-{ \
-  T1 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
-    { \
-      OCTAVE_QUIT; \
-      result (i) = pow (a(i), b);               \
-    } \
-  return octave_value (result); \
-} \
-\
-octave_value elem_xpow (NDArray a, octave_ ## T2  b) \
-{ \
-  T2 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
-    { \
-      OCTAVE_QUIT; \
-      result (i) = pow (a(i), b);               \
-    } \
-  return octave_value (result); \
-} \
-\
-octave_value elem_xpow (T1 ## NDArray a, float  b) \
-{ \
-  T1 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
-    { \
-      OCTAVE_QUIT; \
-      result (i) = powf (a(i), b);              \
-    } \
-  return octave_value (result); \
-} \
-\
-octave_value elem_xpow (FloatNDArray a, octave_ ## T2  b) \
-{ \
-  T2 ## NDArray result (a.dims ()); \
-  for (int i = 0; i < a.length (); i++) \
-    { \
-      OCTAVE_QUIT; \
-      result (i) = powf (a(i), b);              \
-    } \
-  return octave_value (result); \
-}
-
-
-#define OCTAVE_MS_INT_OPS(TYPE) \
-  OCTAVE_MS_POW_OPS (TYPE, TYPE) \
-  OCTAVE_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _, TYPE) \
-  OCTAVE_MS_INT_ARITH_OPS (msx, TYPE ## _, , TYPE) \
-  OCTAVE_MS_INT_ARITH_OPS (mxs, , TYPE ## _, TYPE) \
-  OCTAVE_MS_INT_ARITH_OPS (msfx, TYPE ## _, float_, TYPE) \
-  OCTAVE_MS_INT_ARITH_OPS (mfxs, float_, TYPE ## _, TYPE) \
-  OCTAVE_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \
-  OCTAVE_MS_INT_CMP_OPS (mx, TYPE ## _, ) \
-  OCTAVE_MS_INT_CMP_OPS (mxs, , TYPE ## _) \
-  OCTAVE_MS_INT_CMP_OPS (mfx, TYPE ## _, float_) \
-  OCTAVE_MS_INT_CMP_OPS (mfxs, float_, TYPE ## _) \
-  OCTAVE_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \
-  OCTAVE_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \
-  OCTAVE_MS_INT_BOOL_OPS (mxs, , TYPE ## _) \
-  OCTAVE_MS_INT_BOOL_OPS (mfx, TYPE ## _, float_) \
-  OCTAVE_MS_INT_BOOL_OPS (mfxs, float_, TYPE ## _) \
-  OCTAVE_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _, TYPE ## _) \
-  OCTAVE_MS_INT_ASSIGNEQ_OPS (mse, TYPE ## _) \
-  OCTAVE_MS_INT_ASSIGN_OPS (mx, TYPE ## _, , ) \
-  OCTAVE_MS_INT_ASSIGN_OPS (mfx, TYPE ## _, float_, float_)
-
-#define OCTAVE_M_INT_UNOPS(TYPE) \
-  /* matrix unary ops. */ \
- \
-  DEFNDUNOP_OP (m_not, TYPE ## _matrix, TYPE ## _array, !) \
-  DEFNDUNOP_OP (m_uplus, TYPE ## _matrix, TYPE ## _array, /* no-op */) \
-  DEFUNOP (m_uminus, TYPE ## _matrix) \
-  { \
-    CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix &); \
-    octave_value retval = octave_value (- v. TYPE ## _array_value ()); \
-    return retval; \
-  } \
- \
-  DEFUNOP (m_transpose, TYPE ## _matrix) \
-  { \
-    CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix&); \
- \
-    if (v.ndims () > 2) \
-      { \
-        error ("transpose not defined for N-d objects"); \
-        return octave_value (); \
-      } \
-    else \
-      return octave_value (v.TYPE ## _array_value ().transpose ()); \
-  } \
- \
-  DEFNCUNOP_METHOD (m_incr, TYPE ## _matrix, increment) \
-  DEFNCUNOP_METHOD (m_decr, TYPE ## _matrix, decrement) \
-  DEFNCUNOP_METHOD (m_changesign, TYPE ## _matrix, changesign)
-
-#define OCTAVE_MM_INT_ARITH_OPS(PFX, T1, T2, T3)        \
-  /* matrix by matrix ops. */ \
- \
-  DEFINTNDBINOP_OP (PFX ## _add, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, +, T3) \
-  DEFINTNDBINOP_OP (PFX ## _sub, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, -, T3) \
- \
-  /* DEFBINOP_OP (PFX ## _mul, T1 ## matrix, T2 ## matrix, *) */ \
-  /* DEFBINOP_FN (PFX ## _div, T1 ## matrix, T2 ## matrix, xdiv) */ \
- \
-  DEFBINOPX (PFX ## _pow, T1 ## matrix, T2 ## matrix) \
-  { \
-    error ("can't do A ^ B for A and B both matrices"); \
-    return octave_value (); \
-  } \
- \
-  /* DEFBINOP_FN (PFX ## _ldiv, T1 ## matrix, T2 ## matrix, xleftdiv) */ \
- \
-  DEFINTNDBINOP_FN (PFX ## _el_mul, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, product, T3, .*) \
- \
-  DEFINTNDBINOP_FN (PFX ## _el_div, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, quotient, T3, ./) \
- \
-  DEFINTNDBINOP_FN (PFX ## _el_pow, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, elem_xpow, T3, .^) \
- \
-  DEFBINOP (PFX ## _el_ldiv, T1 ## matrix, T2 ## matrix) \
-  { \
-    CAST_BINOP_ARGS (const octave_ ## T1 ## matrix&, const octave_ ## T2 ## matrix&); \
-    \
-    octave_value retval = octave_value (quotient (v2.T2 ## array_value (), v1.T1 ## array_value ())); \
-    return retval; \
-  }
-
-#define OCTAVE_MM_INT_CMP_OPS(PFX, T1, T2) \
-  DEFNDBINOP_FN (PFX ## _lt, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_lt) \
-  DEFNDBINOP_FN (PFX ## _le, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_le) \
-  DEFNDBINOP_FN (PFX ## _eq, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_eq) \
-  DEFNDBINOP_FN (PFX ## _ge, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_ge) \
-  DEFNDBINOP_FN (PFX ## _gt, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_gt) \
-  DEFNDBINOP_FN (PFX ## _ne, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_ne)
-
-#define OCTAVE_MM_INT_BOOL_OPS(PFX, T1, T2) \
-  DEFNDBINOP_FN (PFX ## _el_and, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_and) \
-  DEFNDBINOP_FN (PFX ## _el_or,  T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_or) \
-  DEFNDBINOP_FN (PFX ## _el_not_and, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_not_and) \
-  DEFNDBINOP_FN (PFX ## _el_not_or,  T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_not_or) \
-  DEFNDBINOP_FN (PFX ## _el_and_not, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_and_not) \
-  DEFNDBINOP_FN (PFX ## _el_or_not,  T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_or_not)
-
-#define OCTAVE_MM_INT_ASSIGN_OPS(PFX, TLHS, TRHS, TE) \
-  DEFNDASSIGNOP_FN (PFX ## _assign, TLHS ## matrix, TRHS ## matrix, TLHS ## array, assign)
-
-#define OCTAVE_MM_INT_ASSIGNEQ_OPS(PFX, TM) \
-  DEFNDASSIGNOP_OP (PFX ## _assign_add, TM ## matrix, TM ## matrix, TM ## array, +=) \
-  DEFNDASSIGNOP_OP (PFX ## _assign_sub, TM ## matrix, TM ## matrix, TM ## array, -=) \
-  DEFNDASSIGNOP_FNOP (PFX ## _assign_el_mul, TM ## matrix, TM ## matrix, TM ## array, product_eq) \
-  DEFNDASSIGNOP_FNOP (PFX ## _assign_el_div, TM ## matrix, TM ## matrix, TM ## array, quotient_eq)
-
-#define OCTAVE_MM_POW_OPS(T1, T2) \
-  octave_value \
-  elem_xpow (const T1 ## NDArray& a, const T2 ## NDArray& b) \
-  { \
-    dim_vector a_dims = a.dims (); \
-    dim_vector b_dims = b.dims (); \
-    if (a_dims != b_dims) \
-      { \
-        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
-          { \
-            return bsxfun_pow (a, b); \
-          } \
-        else \
-          { \
-            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
-            return octave_value (); \
-          } \
-      } \
-    T1 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = pow (a(i), b(i)); \
-      } \
-    return octave_value (result); \
-  } \
-\
-  octave_value \
-  elem_xpow (const T1 ## NDArray& a, const NDArray& b) \
-  { \
-    dim_vector a_dims = a.dims (); \
-    dim_vector b_dims = b.dims (); \
-    if (a_dims != b_dims) \
-      { \
-        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
-          { \
-            return bsxfun_pow (a, b); \
-          } \
-        else \
-          { \
-            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
-            return octave_value (); \
-          } \
-      } \
-    T1 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = pow (a(i), b(i)); \
-      } \
-    return octave_value (result); \
-  } \
-\
-  octave_value \
-  elem_xpow (const NDArray& a, const T2 ## NDArray& b) \
-  { \
-    dim_vector a_dims = a.dims (); \
-    dim_vector b_dims = b.dims (); \
-    if (a_dims != b_dims) \
-      { \
-        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
-          { \
-            return bsxfun_pow (a, b); \
-          } \
-        else \
-          { \
-            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
-            return octave_value (); \
-          } \
-      } \
-    T2 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = pow (a(i), b(i)); \
-      } \
-    return octave_value (result); \
-  } \
-\
-  octave_value \
-  elem_xpow (const T1 ## NDArray& a, const FloatNDArray& b) \
-  { \
-    dim_vector a_dims = a.dims (); \
-    dim_vector b_dims = b.dims (); \
-    if (a_dims != b_dims) \
-      { \
-        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
-          { \
-            return bsxfun_pow (a, b); \
-          } \
-        else \
-          { \
-            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
-            return octave_value (); \
-          } \
-      } \
-    T1 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = powf (a(i), b(i)); \
-      } \
-    return octave_value (result); \
-  } \
-\
-  octave_value \
-  elem_xpow (const FloatNDArray& a, const T2 ## NDArray& b) \
-  { \
-    dim_vector a_dims = a.dims (); \
-    dim_vector b_dims = b.dims (); \
-    if (a_dims != b_dims) \
-      { \
-        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
-          { \
-            return bsxfun_pow (a, b); \
-          } \
-        else \
-          { \
-            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
-            return octave_value (); \
-          } \
-      } \
-    T2 ## NDArray result (a_dims); \
-    for (int i = 0; i < a.length (); i++) \
-      { \
-        OCTAVE_QUIT; \
-        result (i) = powf (a(i), b(i)); \
-      } \
-    return octave_value (result); \
-  }
-
-
-#define OCTAVE_MM_CONV(T1, T2) \
-  DEFCONV (T1 ## m_ ## T2 ## m_conv, T1 ## matrix, T2 ## matrix) \
-  { \
-    CAST_CONV_ARG (const octave_ ## T1 ## matrix&); \
- \
-    return new octave_ ## T2 ## matrix (v.T2 ## array_value ()); \
-  }
-
-#define OCTAVE_MM_INT_OPS(TYPE) \
-  OCTAVE_M_INT_UNOPS (TYPE) \
-  OCTAVE_MM_POW_OPS (TYPE, TYPE) \
-  OCTAVE_MM_INT_ARITH_OPS (mm, TYPE ## _, TYPE ## _, TYPE) \
-  OCTAVE_MM_INT_ARITH_OPS (mmx, TYPE ## _, , TYPE) \
-  OCTAVE_MM_INT_ARITH_OPS (mxm, , TYPE ## _, TYPE) \
-  OCTAVE_MM_INT_ARITH_OPS (mmfx, TYPE ## _, float_, TYPE) \
-  OCTAVE_MM_INT_ARITH_OPS (mfxm, float_, TYPE ## _, TYPE) \
-  OCTAVE_MM_INT_CMP_OPS (mm, TYPE ## _, TYPE ## _) \
-  OCTAVE_MM_INT_CMP_OPS (mmx, TYPE ## _, ) \
-  OCTAVE_MM_INT_CMP_OPS (mfxm, float_, TYPE ## _) \
-  OCTAVE_MM_INT_CMP_OPS (mmfx, TYPE ## _, float_) \
-  OCTAVE_MM_INT_CMP_OPS (mxm, , TYPE ## _) \
-  OCTAVE_MM_INT_BOOL_OPS (mm, TYPE ## _, TYPE ## _) \
-  OCTAVE_MM_INT_BOOL_OPS (mmx, TYPE ## _, ) \
-  OCTAVE_MM_INT_BOOL_OPS (mxm, , TYPE ## _) \
-  OCTAVE_MM_INT_BOOL_OPS (mmfx, TYPE ## _, float_) \
-  OCTAVE_MM_INT_BOOL_OPS (mfxm, float_, TYPE ## _) \
-  OCTAVE_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _, TYPE ## _) \
-  OCTAVE_MM_INT_ASSIGNEQ_OPS (mme, TYPE ## _) \
-  OCTAVE_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, , ) \
-  OCTAVE_MM_INT_ASSIGN_OPS (mmfx, TYPE ## _, float_, float_) \
-  OCTAVE_MM_CONV(TYPE ## _, complex_) \
-  OCTAVE_MM_CONV(TYPE ## _, float_complex_)
-
-#define OCTAVE_RE_INT_ASSIGN_OPS(TYPE) \
-  DEFNDASSIGNOP_FN (TYPE ## ms_assign, matrix, TYPE ## _scalar, array, assign) \
-  DEFNDASSIGNOP_FN (TYPE ## mm_assign, matrix, TYPE ## _matrix, array, assign)
-
-#define OCTAVE_FLT_RE_INT_ASSIGN_OPS(TYPE) \
-  DEFNDASSIGNOP_FN (TYPE ## fms_assign, float_matrix, TYPE ## _scalar, float_array, assign) \
-  DEFNDASSIGNOP_FN (TYPE ## fmm_assign, float_matrix, TYPE ## _matrix, float_array, assign)
-
-#define OCTAVE_CX_INT_ASSIGN_OPS(TYPE) \
-  DEFNDASSIGNOP_FN (TYPE ## cms_assign, complex_matrix, TYPE ## _scalar, complex_array, assign) \
-  DEFNDASSIGNOP_FN (TYPE ## cmm_assign, complex_matrix, TYPE ## _matrix, complex_array, assign)
-
-#define OCTAVE_FLT_CX_INT_ASSIGN_OPS(TYPE) \
-  DEFNDASSIGNOP_FN (TYPE ## fcms_assign, float_complex_matrix, TYPE ## _scalar, float_complex_array, assign) \
-  DEFNDASSIGNOP_FN (TYPE ## fcmm_assign, float_complex_matrix, TYPE ## _matrix, float_complex_array, assign)
-
-#define OCTAVE_INT_NULL_ASSIGN_OPS(TYPE) \
-  DEFNULLASSIGNOP_FN (TYPE ## null_assign, TYPE ## _matrix, delete_elements)
-
-#define OCTAVE_INT_OPS(TYPE) \
-  OCTAVE_SS_INT_OPS (TYPE) \
-  OCTAVE_SM_INT_OPS (TYPE) \
-  OCTAVE_MS_INT_OPS (TYPE) \
-  OCTAVE_MM_INT_OPS (TYPE) \
-  OCTAVE_CONCAT_FN (TYPE) \
-  OCTAVE_RE_INT_ASSIGN_OPS (TYPE) \
-  OCTAVE_FLT_RE_INT_ASSIGN_OPS (TYPE) \
-  OCTAVE_CX_INT_ASSIGN_OPS (TYPE) \
-  OCTAVE_FLT_CX_INT_ASSIGN_OPS (TYPE) \
-  OCTAVE_INT_NULL_ASSIGN_OPS(TYPE)
-
-#define OCTAVE_INSTALL_S_INT_UNOPS(TYPE) \
-  INSTALL_UNOP (op_not, octave_ ## TYPE ## _scalar, s_not); \
-  INSTALL_UNOP (op_uplus, octave_ ## TYPE ## _scalar, s_uplus); \
-  INSTALL_UNOP (op_uminus, octave_ ## TYPE ## _scalar, s_uminus); \
-  INSTALL_UNOP (op_transpose, octave_ ## TYPE ## _scalar, s_transpose); \
-  INSTALL_UNOP (op_hermitian, octave_ ## TYPE ## _scalar, s_hermitian); \
- \
-  INSTALL_NCUNOP (op_incr, octave_ ## TYPE ## _scalar, s_incr); \
-  INSTALL_NCUNOP (op_decr, octave_ ## TYPE ## _scalar, s_decr);
-
-#define OCTAVE_INSTALL_SS_INT_ARITH_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _add); \
-  INSTALL_BINOP (op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _sub); \
-  INSTALL_BINOP (op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _mul); \
-  INSTALL_BINOP (op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _div); \
-  INSTALL_BINOP (op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _pow); \
-  INSTALL_BINOP (op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ldiv); \
-  INSTALL_BINOP (op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_mul); \
-  INSTALL_BINOP (op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_div); \
-  INSTALL_BINOP (op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_pow); \
-  INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_ldiv);
-
-#define OCTAVE_INSTALL_SS_INT_CMP_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _lt); \
-  INSTALL_BINOP (op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _le); \
-  INSTALL_BINOP (op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _eq); \
-  INSTALL_BINOP (op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ge); \
-  INSTALL_BINOP (op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _gt); \
-  INSTALL_BINOP (op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ne);
-
-#define OCTAVE_INSTALL_SS_INT_BOOL_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_and); \
-  INSTALL_BINOP (op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_or);
-
-#define OCTAVE_INSTALL_SS_INT_OPS(TYPE) \
-  OCTAVE_INSTALL_S_INT_UNOPS (TYPE) \
-  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ssx, TYPE ## _, )         \
-  OCTAVE_INSTALL_SS_INT_ARITH_OPS (sxs,  , TYPE ## _)        \
-  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ssfx, TYPE ## _, float_)          \
-  OCTAVE_INSTALL_SS_INT_ARITH_OPS (sfxs,  float_, TYPE ## _)         \
-  OCTAVE_INSTALL_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_SS_INT_CMP_OPS (sx, TYPE ## _, ) \
-  OCTAVE_INSTALL_SS_INT_CMP_OPS (xs, , TYPE ## _) \
-  OCTAVE_INSTALL_SS_INT_CMP_OPS (sfx, TYPE ## _, float_) \
-  OCTAVE_INSTALL_SS_INT_CMP_OPS (fxs, float_, TYPE ## _) \
-  OCTAVE_INSTALL_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_SS_INT_BOOL_OPS (sx, TYPE ## _, ) \
-  OCTAVE_INSTALL_SS_INT_BOOL_OPS (xs, , TYPE ## _) \
-  OCTAVE_INSTALL_SS_INT_BOOL_OPS (sfx, TYPE ## _, float_) \
-  OCTAVE_INSTALL_SS_INT_BOOL_OPS (fxs, float_, TYPE ## _) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_scalar, octave_ ## TYPE ## _matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_scalar, octave_ ## TYPE ## _matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_complex_scalar, octave_complex_matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_complex_scalar, octave_float_complex_matrix)
-
-#define OCTAVE_INSTALL_SM_INT_ARITH_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _add); \
-  INSTALL_BINOP (op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _sub); \
-  INSTALL_BINOP (op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _mul); \
-  /* INSTALL_BINOP (op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _div); */ \
-  /* INSTALL_BINOP (op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _pow); */ \
-  INSTALL_BINOP (op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ldiv); \
-  INSTALL_BINOP (op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_mul); \
-  INSTALL_BINOP (op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_div); \
-  INSTALL_BINOP (op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_pow); \
-  INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_ldiv);
-
-#define OCTAVE_INSTALL_SM_INT_CMP_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _lt); \
-  INSTALL_BINOP (op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _le); \
-  INSTALL_BINOP (op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _eq); \
-  INSTALL_BINOP (op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ge); \
-  INSTALL_BINOP (op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _gt); \
-  INSTALL_BINOP (op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ne);
-
-#define OCTAVE_INSTALL_SM_INT_BOOL_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and); \
-  INSTALL_BINOP (op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_or); \
-  INSTALL_BINOP (op_el_and_not, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and_not); \
-  INSTALL_BINOP (op_el_or_not, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_or_not);
-
-#define OCTAVE_INSTALL_SM_INT_OPS(TYPE) \
-  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_SM_INT_ARITH_OPS (smx, TYPE ## _, )         \
-  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sxm, , TYPE ## _)         \
-  OCTAVE_INSTALL_SM_INT_ARITH_OPS (smfx, TYPE ## _, float_)          \
-  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sfxm, float_, TYPE ## _)          \
-  OCTAVE_INSTALL_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_SM_INT_CMP_OPS (xm, , TYPE ## _) \
-  OCTAVE_INSTALL_SM_INT_CMP_OPS (smx, TYPE ## _, ) \
-  OCTAVE_INSTALL_SM_INT_CMP_OPS (fxm, float_, TYPE ## _) \
-  OCTAVE_INSTALL_SM_INT_CMP_OPS (smfx, TYPE ## _, float_) \
-  OCTAVE_INSTALL_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_SM_INT_BOOL_OPS (xm, , TYPE ## _) \
-  OCTAVE_INSTALL_SM_INT_BOOL_OPS (smx, TYPE ## _, ) \
-  OCTAVE_INSTALL_SM_INT_BOOL_OPS (fxm, float_, TYPE ## _) \
-  OCTAVE_INSTALL_SM_INT_BOOL_OPS (smfx, TYPE ## _, float_) \
-  INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _s_ ## TYPE ## _m_conv) \
-  INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_complex_matrix, TYPE ## _s_complex_m_conv) \
-  INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_float_complex_matrix, TYPE ## _s_float_complex_m_conv) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_matrix, octave_ ## TYPE ## _matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_matrix, octave_ ## TYPE ## _matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_complex_matrix, octave_complex_matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_complex_matrix, octave_float_complex_matrix)
-
-#define OCTAVE_INSTALL_MS_INT_ARITH_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _add); \
-  INSTALL_BINOP (op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _sub); \
-  INSTALL_BINOP (op_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _mul); \
-  INSTALL_BINOP (op_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _div); \
-  /* INSTALL_BINOP (op_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _pow); */ \
-  /* INSTALL_BINOP (op_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ldiv); */ \
- \
-  INSTALL_BINOP (op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_mul); \
-  INSTALL_BINOP (op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_div); \
-  INSTALL_BINOP (op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_pow); \
-  INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_ldiv);
-
-#define OCTAVE_INSTALL_MS_INT_CMP_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _lt); \
-  INSTALL_BINOP (op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _le); \
-  INSTALL_BINOP (op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _eq); \
-  INSTALL_BINOP (op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ge); \
-  INSTALL_BINOP (op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _gt); \
-  INSTALL_BINOP (op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ne);
-
-#define OCTAVE_INSTALL_MS_INT_BOOL_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_and); \
-  INSTALL_BINOP (op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_or); \
-  INSTALL_BINOP (op_el_not_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_not_and); \
-  INSTALL_BINOP (op_el_not_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_not_or);
-
-#define OCTAVE_INSTALL_MS_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign)
-
-#define OCTAVE_INSTALL_MS_INT_ASSIGNEQ_OPS(PFX, TLHS, TRHS) \
-  INSTALL_ASSIGNOP (op_add_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_add) \
-  INSTALL_ASSIGNOP (op_sub_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_sub) \
-  INSTALL_ASSIGNOP (op_mul_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_mul) \
-  INSTALL_ASSIGNOP (op_div_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_div)
-
-#define OCTAVE_INSTALL_MS_INT_OPS(TYPE) \
-  OCTAVE_INSTALL_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_ARITH_OPS (msx, TYPE ## _, ) \
-  OCTAVE_INSTALL_MS_INT_ARITH_OPS (mxs, , TYPE ## _)       \
-  OCTAVE_INSTALL_MS_INT_ARITH_OPS (msfx, TYPE ## _, float_) \
-  OCTAVE_INSTALL_MS_INT_ARITH_OPS (mfxs, float_, TYPE ## _)        \
-  OCTAVE_INSTALL_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_CMP_OPS (mx, TYPE ## _, ) \
-  OCTAVE_INSTALL_MS_INT_CMP_OPS (mxs, , TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_CMP_OPS (mfx, TYPE ## _, float_) \
-  OCTAVE_INSTALL_MS_INT_CMP_OPS (mfxs, float_, TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \
-  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mxs, , TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mfx, TYPE ## _, float_) \
-  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mfxs, float_, TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_ASSIGNEQ_OPS (mse, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mx, TYPE ## _, ) \
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mfx, TYPE ## _, float_) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_complex_scalar, octave_complex_matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_float_complex_scalar, octave_float_complex_matrix)
-
-#define OCTAVE_INSTALL_M_INT_UNOPS(TYPE) \
-  INSTALL_UNOP (op_not, octave_ ## TYPE ## _matrix, m_not); \
-  INSTALL_UNOP (op_uplus, octave_ ## TYPE ## _matrix, m_uplus); \
-  INSTALL_UNOP (op_uminus, octave_ ## TYPE ## _matrix, m_uminus); \
-  INSTALL_UNOP (op_transpose, octave_ ## TYPE ## _matrix, m_transpose); \
-  INSTALL_UNOP (op_hermitian, octave_ ## TYPE ## _matrix, m_transpose); \
- \
-  INSTALL_NCUNOP (op_incr, octave_ ## TYPE ## _matrix, m_incr); \
-  INSTALL_NCUNOP (op_decr, octave_ ## TYPE ## _matrix, m_decr); \
-  INSTALL_NCUNOP (op_uminus, octave_ ## TYPE ## _matrix, m_changesign);
-
-#define OCTAVE_INSTALL_MM_INT_ARITH_OPS(PFX, T1, T2)                    \
-  INSTALL_BINOP (op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _add); \
-  INSTALL_BINOP (op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _sub); \
-  /* INSTALL_BINOP (op_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _mul); */ \
-  /* INSTALL_BINOP (op_div, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _div); */ \
-  INSTALL_BINOP (op_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _pow); \
-  /* INSTALL_BINOP (op_ldiv, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_ldiv); */ \
-  INSTALL_BINOP (op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_mul); \
-  INSTALL_BINOP (op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_div); \
-  INSTALL_BINOP (op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_pow); \
-  INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_ldiv);
-
-#define OCTAVE_INSTALL_MM_INT_CMP_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _lt); \
-  INSTALL_BINOP (op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _le); \
-  INSTALL_BINOP (op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _eq); \
-  INSTALL_BINOP (op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _ge); \
-  INSTALL_BINOP (op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _gt); \
-  INSTALL_BINOP (op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _ne);
-
-#define OCTAVE_INSTALL_MM_INT_BOOL_OPS(PFX, T1, T2) \
-  INSTALL_BINOP (op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_and); \
-  INSTALL_BINOP (op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_or); \
-  INSTALL_BINOP (op_el_not_and, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_not_and); \
-  INSTALL_BINOP (op_el_not_or, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_not_or); \
-  INSTALL_BINOP (op_el_and_not, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_and_not); \
-  INSTALL_BINOP (op_el_or_not, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_or_not);
-
-#define OCTAVE_INSTALL_MM_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign)
-
-#define OCTAVE_INSTALL_MM_INT_ASSIGNEQ_OPS(PFX, TLHS, TRHS) \
-  INSTALL_ASSIGNOP (op_add_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_add) \
-  INSTALL_ASSIGNOP (op_sub_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_sub) \
-  INSTALL_ASSIGNOP (op_el_mul_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_el_mul) \
-  INSTALL_ASSIGNOP (op_el_div_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_el_div)
-
-#define OCTAVE_INSTALL_MM_INT_OPS(TYPE) \
-  OCTAVE_INSTALL_M_INT_UNOPS (TYPE) \
-  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mm, TYPE ##_, TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mmx, TYPE ##_, ) \
-  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mxm, , TYPE ##_)        \
-  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mmfx, TYPE ##_, float_) \
-  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mfxm, float_, TYPE ##_)         \
-  OCTAVE_INSTALL_MM_INT_CMP_OPS (mm, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_CMP_OPS (mmx, TYPE ## _, ) \
-  OCTAVE_INSTALL_MM_INT_CMP_OPS (mxm, , TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_CMP_OPS (mmfx, TYPE ## _, float_) \
-  OCTAVE_INSTALL_MM_INT_CMP_OPS (mfxm, float_, TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mm, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mmx, TYPE ## _, ) \
-  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mxm, , TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mmfx, TYPE ## _, float_) \
-  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mfxm, float_, TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_ASSIGNEQ_OPS (mme, TYPE ## _, TYPE ## _) \
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, ) \
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmfx, TYPE ## _, float_) \
-  INSTALL_WIDENOP (octave_ ## TYPE ## _matrix, octave_complex_matrix, TYPE ## _m_complex_m_conv) \
-  INSTALL_WIDENOP (octave_ ## TYPE ## _matrix, octave_float_complex_matrix, TYPE ## _m_float_complex_m_conv) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_complex_matrix, octave_complex_matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_float_complex_matrix, octave_float_complex_matrix)
-
-#define OCTAVE_INSTALL_RE_INT_ASSIGN_OPS(TYPE) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_ ## TYPE ## _scalar, TYPE ## ms_assign) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_ ## TYPE ## _matrix, TYPE ## mm_assign) \
-  INSTALL_ASSIGNCONV (octave_scalar, octave_ ## TYPE ## _scalar, octave_matrix) \
-  INSTALL_ASSIGNCONV (octave_matrix, octave_ ## TYPE ## _matrix, octave_matrix)
-
-#define OCTAVE_INSTALL_FLT_RE_INT_ASSIGN_OPS(TYPE) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_ ## TYPE ## _scalar, TYPE ## fms_assign) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_ ## TYPE ## _matrix, TYPE ## fmm_assign) \
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_ ## TYPE ## _scalar, octave_float_matrix) \
-  INSTALL_ASSIGNCONV (octave_float_matrix, octave_ ## TYPE ## _matrix, octave_float_matrix)
-
-#define OCTAVE_INSTALL_CX_INT_ASSIGN_OPS(TYPE) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_ ## TYPE ## _scalar, TYPE ## cms_assign) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_ ## TYPE ## _matrix, TYPE ## cmm_assign) \
-  INSTALL_ASSIGNCONV (octave_complex_scalar, octave_ ## TYPE ## _scalar, octave_complex_matrix) \
-  INSTALL_ASSIGNCONV (octave_complex_matrix, octave_ ## TYPE ## _matrix, octave_complex_matrix)
-
-#define OCTAVE_INSTALL_FLT_CX_INT_ASSIGN_OPS(TYPE) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_ ## TYPE ## _scalar, TYPE ## fcms_assign) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_ ## TYPE ## _matrix, TYPE ## fcmm_assign) \
-  INSTALL_ASSIGNCONV (octave_float_complex_scalar, octave_ ## TYPE ## _scalar, octave_complex_matrix) \
-  INSTALL_ASSIGNCONV (octave_float_complex_matrix, octave_ ## TYPE ## _matrix, octave_complex_matrix)
-
-#define OCTAVE_INSTALL_INT_NULL_ASSIGN_OPS(TYPE) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_matrix, TYPE ## null_assign) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_str, TYPE ## null_assign) \
-  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_sq_str, TYPE ## null_assign)
-
-#define OCTAVE_INSTALL_INT_OPS(TYPE) \
-  OCTAVE_INSTALL_SS_INT_OPS (TYPE) \
-  OCTAVE_INSTALL_SM_INT_OPS (TYPE) \
-  OCTAVE_INSTALL_MS_INT_OPS (TYPE) \
-  OCTAVE_INSTALL_MM_INT_OPS (TYPE) \
-  OCTAVE_INSTALL_CONCAT_FN (TYPE) \
-  OCTAVE_INSTALL_RE_INT_ASSIGN_OPS (TYPE) \
-  OCTAVE_INSTALL_FLT_RE_INT_ASSIGN_OPS (TYPE) \
-  OCTAVE_INSTALL_CX_INT_ASSIGN_OPS (TYPE) \
-  OCTAVE_INSTALL_FLT_CX_INT_ASSIGN_OPS (TYPE) \
-  OCTAVE_INSTALL_INT_NULL_ASSIGN_OPS(TYPE)
-
-#define OCTAVE_INSTALL_SM_INT_ASSIGNCONV(TLHS, TRHS) \
-  INSTALL_ASSIGNCONV (octave_ ## TLHS ## _scalar, octave_ ## TRHS ## _scalar, octave_ ## TLHS ## _matrix) \
-  INSTALL_ASSIGNCONV (octave_ ## TLHS ## _scalar, octave_ ## TRHS ## _matrix, octave_ ## TLHS ## _matrix)
-
-#define OCTAVE_MIXED_INT_CMP_OPS(T1, T2) \
-  OCTAVE_SS_INT_CMP_OPS (T1 ## _ ## T2 ## _ss, T1 ## _, T2 ## _) \
-  OCTAVE_SM_INT_CMP_OPS (T1 ## _ ## T2 ## _sm, T1 ## _, T2 ## _) \
-  OCTAVE_MS_INT_CMP_OPS (T1 ## _ ## T2 ## _ms, T1 ## _, T2 ## _) \
-  OCTAVE_MM_INT_CMP_OPS (T1 ## _ ## T2 ## _mm, T1 ## _, T2 ## _)
-
-#define OCTAVE_INSTALL_MIXED_INT_CMP_OPS(T1, T2) \
-  OCTAVE_INSTALL_SS_INT_CMP_OPS (T1 ## _ ## T2 ## _ss, T1 ## _, T2 ## _) \
-  OCTAVE_INSTALL_SM_INT_CMP_OPS (T1 ## _ ## T2 ## _sm, T1 ## _, T2 ## _) \
-  OCTAVE_INSTALL_MS_INT_CMP_OPS (T1 ## _ ## T2 ## _ms, T1 ## _, T2 ## _) \
-  OCTAVE_INSTALL_MM_INT_CMP_OPS (T1 ## _ ## T2 ## _mm, T1 ## _, T2 ## _)
--- a/src/OPERATORS/op-m-cdm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-re-mat.h"
-#define RINCLUDE "ov-cx-diag.h"
-
-#define LMATRIX matrix
-#define RMATRIX complex_diag_matrix
-#define LDMATRIX complex_matrix
-
-#define LSHORT m
-#define RSHORT cdm
-
-#define DEFINEDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-m-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-m-cm.h"
-#include "mx-cm-m.h"
-#include "mx-nda-cnda.h"
-#include "mx-cnda-nda.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix by complex matrix ops.
-
-DEFNDBINOP_OP (add, matrix, complex_matrix, array, complex_array, +)
-DEFNDBINOP_OP (sub, matrix, complex_matrix, array, complex_array, -)
-
-DEFBINOP_OP (mul, matrix, complex_matrix, *)
-
-DEFBINOP (trans_mul, matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
-
-  Matrix m1 = v1.matrix_value ();
-  ComplexMatrix m2 = v2.complex_matrix_value ();
-
-  return ComplexMatrix (xgemm (m1, real (m2), blas_trans, blas_no_trans),
-                        xgemm (m1, imag (m2), blas_trans, blas_no_trans));
-}
-
-DEFBINOP (div, matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (v1.matrix_value (),
-                            v2.complex_matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, matrix, complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.matrix_value (),
-                                v2.complex_matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP (trans_ldiv, matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.matrix_value (),
-                         v2.complex_matrix_value (), typ, blas_trans);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, matrix, complex_matrix, array, complex_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, matrix, complex_matrix, array, complex_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, matrix, complex_matrix, array, complex_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, matrix, complex_matrix, array, complex_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, matrix, complex_matrix, array, complex_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, matrix, complex_matrix, array, complex_array, mx_el_ne)
-
-DEFNDBINOP_FN (el_mul, matrix, complex_matrix, array, complex_array, product)
-DEFNDBINOP_FN (el_div, matrix, complex_matrix, array, complex_array, quotient)
-DEFNDBINOP_FN (el_pow, matrix, complex_matrix, array, complex_array, elem_xpow)
-
-DEFBINOP (el_ldiv, matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
-
-  return quotient (v2.complex_array_value (), v1.array_value ());
-}
-
-DEFNDBINOP_FN (el_and, matrix, complex_matrix, array, complex_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  matrix, complex_matrix, array, complex_array, mx_el_or)
-
-DEFNDCATOP_FN (m_cm, matrix, complex_matrix, array, complex_array, concat)
-
-DEFCONV (complex_matrix_conv, matrix, complex_matrix)
-{
-  CAST_CONV_ARG (const octave_matrix&);
-
-  return new octave_complex_matrix (ComplexNDArray (v.array_value ()));
-}
-
-void
-install_m_cm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_matrix, octave_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_matrix, octave_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_matrix, octave_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_matrix, octave_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_matrix, octave_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_matrix, octave_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_matrix, octave_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_matrix, octave_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_matrix, octave_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_matrix, octave_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_matrix, octave_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_matrix, octave_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_matrix, octave_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_matrix, octave_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_matrix, octave_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_matrix, octave_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_matrix, octave_complex_matrix, el_or);
-  INSTALL_BINOP (op_trans_mul, octave_matrix, octave_complex_matrix, trans_mul);
-  INSTALL_BINOP (op_herm_mul, octave_matrix, octave_complex_matrix, trans_mul);
-  INSTALL_BINOP (op_trans_ldiv, octave_matrix, octave_complex_matrix, trans_ldiv);
-  INSTALL_BINOP (op_herm_ldiv, octave_matrix, octave_complex_matrix, trans_ldiv);
-
-  INSTALL_CATOP (octave_matrix, octave_complex_matrix, m_cm);
-
-  INSTALL_ASSIGNCONV (octave_matrix, octave_complex_matrix, octave_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_float_matrix, octave_complex_matrix, octave_float_complex_matrix);
-
-  INSTALL_WIDENOP (octave_matrix, octave_complex_matrix, complex_matrix_conv);
-}
--- a/src/OPERATORS/op-m-cs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-m-cs.h"
-#include "mx-cs-m.h"
-#include "mx-nda-cs.h"
-#include "mx-cs-nda.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-complex.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix by complex scalar ops.
-
-DEFNDBINOP_OP (add, matrix, complex, array, complex, +)
-DEFNDBINOP_OP (sub, matrix, complex, array, complex, -)
-DEFNDBINOP_OP (mul, matrix, complex, array, complex, *)
-
-DEFBINOP (div, matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.array_value () / d);
-}
-
-DEFBINOP_FN (pow, matrix, complex, xpow)
-
-DEFBINOP (ldiv, matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
-
-  Matrix m1 = v1.matrix_value ();
-  ComplexMatrix m2 = v2.complex_matrix_value ();
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (m1, m2, typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDCMPLXCMPOP_FN (lt, matrix, complex, array, complex, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, matrix, complex, array, complex, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, matrix, complex, array, complex, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, matrix, complex, array, complex, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, matrix, complex, array, complex, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, matrix, complex, array, complex, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, matrix, complex, array, complex, *)
-
-DEFBINOP (el_div, matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.array_value () / d);
-}
-
-DEFNDBINOP_FN (el_pow, matrix, complex, array, complex, elem_xpow)
-
-DEFBINOP (el_ldiv, matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
-
-  return x_el_div (v2.complex_value (), v1.array_value ());
-}
-
-DEFNDBINOP_FN (el_and, matrix, complex, array, complex, mx_el_and)
-DEFNDBINOP_FN (el_or, matrix, complex, array, complex, mx_el_or)
-
-DEFNDCATOP_FN (m_cs, matrix, complex, array, complex_array, concat)
-
-void
-install_m_cs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_matrix, octave_complex, add);
-  INSTALL_BINOP (op_sub, octave_matrix, octave_complex, sub);
-  INSTALL_BINOP (op_mul, octave_matrix, octave_complex, mul);
-  INSTALL_BINOP (op_div, octave_matrix, octave_complex, div);
-  INSTALL_BINOP (op_pow, octave_matrix, octave_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_matrix, octave_complex, ldiv);
-  INSTALL_BINOP (op_lt, octave_matrix, octave_complex, lt);
-  INSTALL_BINOP (op_le, octave_matrix, octave_complex, le);
-  INSTALL_BINOP (op_eq, octave_matrix, octave_complex, eq);
-  INSTALL_BINOP (op_ge, octave_matrix, octave_complex, ge);
-  INSTALL_BINOP (op_gt, octave_matrix, octave_complex, gt);
-  INSTALL_BINOP (op_ne, octave_matrix, octave_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_matrix, octave_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_matrix, octave_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_matrix, octave_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_matrix, octave_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_matrix, octave_complex, el_or);
-
-  INSTALL_CATOP (octave_matrix, octave_complex, m_cs);
-
-  INSTALL_ASSIGNCONV (octave_matrix, octave_complex, octave_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_float_matrix, octave_complex, octave_float_complex_matrix);
-}
--- a/src/OPERATORS/op-m-dm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 LINCLUDE "ov-re-mat.h"
-#define RINCLUDE "ov-re-diag.h"
-
-#define LMATRIX matrix
-#define RMATRIX diag_matrix
-
-#define LSHORT m
-#define RSHORT dm
-
-#define DEFINEDIV
-
-#include "op-dm-template.cc"
-
--- a/src/OPERATORS/op-m-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix unary ops.
-
-DEFNDUNOP_OP (not, matrix, array, !)
-DEFNDUNOP_OP (uplus, matrix, array, /* no-op */)
-DEFNDUNOP_OP (uminus, matrix, array, -)
-
-DEFUNOP (transpose, matrix)
-{
-  CAST_UNOP_ARG (const octave_matrix&);
-
-  if (v.ndims () > 2)
-    {
-      error ("transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.matrix_value ().transpose ());
-}
-
-DEFNCUNOP_METHOD (incr, matrix, increment)
-DEFNCUNOP_METHOD (decr, matrix, decrement)
-DEFNCUNOP_METHOD (changesign, matrix, changesign)
-
-// matrix by matrix ops.
-
-DEFNDBINOP_OP (add, matrix, matrix, array, array, +)
-DEFNDBINOP_OP (sub, matrix, matrix, array, array, -)
-
-DEFBINOP_OP (mul, matrix, matrix, *)
-
-DEFBINOP (div, matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  Matrix ret = xdiv (v1.matrix_value (), v2.matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, matrix, matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP (trans_mul, matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
-  return octave_value(xgemm (v1.matrix_value (), v2.matrix_value (),
-                             blas_trans, blas_no_trans));
-}
-
-DEFBINOP (mul_trans, matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
-  return octave_value(xgemm (v1.matrix_value (), v2.matrix_value (),
-                             blas_no_trans, blas_trans));
-}
-
-DEFBINOP (trans_ldiv, matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ, blas_trans);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDBINOP_FN (lt, matrix, matrix, array, array, mx_el_lt)
-DEFNDBINOP_FN (le, matrix, matrix, array, array, mx_el_le)
-DEFNDBINOP_FN (eq, matrix, matrix, array, array, mx_el_eq)
-DEFNDBINOP_FN (ge, matrix, matrix, array, array, mx_el_ge)
-DEFNDBINOP_FN (gt, matrix, matrix, array, array, mx_el_gt)
-DEFNDBINOP_FN (ne, matrix, matrix, array, array, mx_el_ne)
-
-DEFNDBINOP_FN (el_mul, matrix, matrix, array, array, product)
-DEFNDBINOP_FN (el_div, matrix, matrix, array, array, quotient)
-DEFNDBINOP_FN (el_pow, matrix, matrix, array, array, elem_xpow)
-
-DEFBINOP (el_ldiv, matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
-
-  return octave_value (quotient (v2.array_value (), v1.array_value ()));
-}
-
-DEFNDBINOP_FN (el_and, matrix, matrix, array, array, mx_el_and)
-DEFNDBINOP_FN (el_or,  matrix, matrix, array, array, mx_el_or)
-DEFNDBINOP_FN (el_not_and, matrix, matrix, array, array, mx_el_not_and)
-DEFNDBINOP_FN (el_not_or,  matrix, matrix, array, array, mx_el_not_or)
-DEFNDBINOP_FN (el_and_not, matrix, matrix, array, array, mx_el_and_not)
-DEFNDBINOP_FN (el_or_not,  matrix, matrix, array, array, mx_el_or_not)
-
-
-DEFNDCATOP_FN (m_m, matrix, matrix, array, array, concat)
-
-DEFNDASSIGNOP_FN (assign, matrix, matrix, array, assign)
-DEFNDASSIGNOP_FN (sgl_assign, float_matrix, matrix, float_array, assign)
-
-DEFNULLASSIGNOP_FN (null_assign, matrix, delete_elements)
-
-DEFNDASSIGNOP_OP (assign_add, matrix, matrix, array, +=)
-DEFNDASSIGNOP_OP (assign_sub, matrix, matrix, array, -=)
-DEFNDASSIGNOP_FNOP (assign_el_mul, matrix, matrix, array, product_eq)
-DEFNDASSIGNOP_FNOP (assign_el_div, matrix, matrix, array, quotient_eq)
-
-CONVDECL (matrix_to_float_matrix)
-{
-  CAST_CONV_ARG (const octave_matrix&);
-
-  return new octave_float_matrix (FloatNDArray (v.array_value ()));
-}
-
-void
-install_m_m_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_matrix, transpose);
-
-  INSTALL_NCUNOP (op_incr, octave_matrix, incr);
-  INSTALL_NCUNOP (op_decr, octave_matrix, decr);
-  INSTALL_NCUNOP (op_uminus, octave_matrix, changesign);
-
-  INSTALL_BINOP (op_add, octave_matrix, octave_matrix, add);
-  INSTALL_BINOP (op_sub, octave_matrix, octave_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_matrix, octave_matrix, mul);
-  INSTALL_BINOP (op_div, octave_matrix, octave_matrix, div);
-  INSTALL_BINOP (op_pow, octave_matrix, octave_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_matrix, octave_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_matrix, octave_matrix, lt);
-  INSTALL_BINOP (op_le, octave_matrix, octave_matrix, le);
-  INSTALL_BINOP (op_eq, octave_matrix, octave_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_matrix, octave_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_matrix, octave_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_matrix, octave_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_matrix, octave_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_matrix, octave_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_matrix, octave_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_matrix, octave_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_matrix, octave_matrix, el_or);
-  INSTALL_BINOP (op_el_and_not, octave_matrix, octave_matrix, el_and_not);
-  INSTALL_BINOP (op_el_or_not, octave_matrix, octave_matrix, el_or_not);
-  INSTALL_BINOP (op_el_not_and, octave_matrix, octave_matrix, el_not_and);
-  INSTALL_BINOP (op_el_not_or, octave_matrix, octave_matrix, el_not_or);
-  INSTALL_BINOP (op_trans_mul, octave_matrix, octave_matrix, trans_mul);
-  INSTALL_BINOP (op_mul_trans, octave_matrix, octave_matrix, mul_trans);
-  INSTALL_BINOP (op_herm_mul, octave_matrix, octave_matrix, trans_mul);
-  INSTALL_BINOP (op_mul_herm, octave_matrix, octave_matrix, mul_trans);
-  INSTALL_BINOP (op_trans_ldiv, octave_matrix, octave_matrix, trans_ldiv);
-  INSTALL_BINOP (op_herm_ldiv, octave_matrix, octave_matrix, trans_ldiv);
-
-  INSTALL_CATOP (octave_matrix, octave_matrix, m_m);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_matrix, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_matrix, sgl_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_null_sq_str, null_assign);
-
-  INSTALL_ASSIGNOP (op_add_eq, octave_matrix, octave_matrix, assign_add);
-  INSTALL_ASSIGNOP (op_sub_eq, octave_matrix, octave_matrix, assign_sub);
-  INSTALL_ASSIGNOP (op_el_mul_eq, octave_matrix, octave_matrix, assign_el_mul);
-  INSTALL_ASSIGNOP (op_el_div_eq, octave_matrix, octave_matrix, assign_el_div);
-
-  INSTALL_CONVOP (octave_matrix, octave_float_matrix, matrix_to_float_matrix);
-}
--- a/src/OPERATORS/op-m-pm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 MINCLUDE "ov-re-mat.h"
-
-#define LMATRIX matrix
-#define RMATRIX perm_matrix
-
-#define LSHORT m
-#define RSHORT pm
-
-#define RIGHT
-
-#include "op-pm-template.cc"
--- a/src/OPERATORS/op-m-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// matrix by scalar ops.
-
-DEFNDBINOP_OP (add, matrix, scalar, array, scalar, +)
-DEFNDBINOP_OP (sub, matrix, scalar, array, scalar, -)
-DEFNDBINOP_OP (mul, matrix, scalar, array, scalar, *)
-
-DEFBINOP (div, matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
-
-  double d = v2.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.array_value () / d);
-}
-
-DEFBINOP_FN (pow, matrix, scalar, xpow)
-
-DEFBINOP (ldiv, matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
-
-  Matrix m1 = v1.matrix_value ();
-  Matrix m2 = v2.matrix_value ();
-  MatrixType typ = v1.matrix_type ();
-
-  Matrix ret = xleftdiv (m1, m2, typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFNDBINOP_FN (lt, matrix, scalar, array, scalar, mx_el_lt)
-DEFNDBINOP_FN (le, matrix, scalar, array, scalar, mx_el_le)
-DEFNDBINOP_FN (eq, matrix, scalar, array, scalar, mx_el_eq)
-DEFNDBINOP_FN (ge, matrix, scalar, array, scalar, mx_el_ge)
-DEFNDBINOP_FN (gt, matrix, scalar, array, scalar, mx_el_gt)
-DEFNDBINOP_FN (ne, matrix, scalar, array, scalar, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, matrix, scalar, array, scalar, *)
-
-DEFBINOP (el_div, matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
-
-  double d = v2.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.array_value () / d);
-}
-
-DEFNDBINOP_FN (el_pow, matrix, scalar, array, scalar, elem_xpow)
-
-DEFBINOP (el_ldiv, matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
-
-  return x_el_div (v2.double_value (), v1.array_value ());
-}
-
-DEFNDBINOP_FN (el_and, matrix, scalar, array, scalar, mx_el_and)
-DEFNDBINOP_FN (el_or, matrix, scalar, array, scalar, mx_el_or)
-
-DEFNDCATOP_FN (m_s, matrix, scalar, array, array, concat)
-
-DEFNDASSIGNOP_FN (assign, matrix, scalar, scalar, assign)
-DEFNDASSIGNOP_FN (sgl_assign, float_matrix, scalar, float_scalar, assign)
-DEFNDASSIGNOP_FN (clx_sgl_assign, float_complex_matrix, scalar, float_complex, assign)
-
-DEFNDASSIGNOP_OP (assign_add, matrix, scalar, scalar, +=)
-DEFNDASSIGNOP_OP (assign_sub, matrix, scalar, scalar, -=)
-DEFNDASSIGNOP_OP (assign_mul, matrix, scalar, scalar, *=)
-DEFNDASSIGNOP_OP (assign_div, matrix, scalar, scalar, /=)
-
-void
-install_m_s_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_matrix, octave_scalar, add);
-  INSTALL_BINOP (op_sub, octave_matrix, octave_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_matrix, octave_scalar, mul);
-  INSTALL_BINOP (op_div, octave_matrix, octave_scalar, div);
-  INSTALL_BINOP (op_pow, octave_matrix, octave_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_matrix, octave_scalar, ldiv);
-
-  //  INSTALL_BINOP (op_lt, octave_matrix, octave_scalar, lt);
-
-  octave_value_typeinfo::register_binary_op
-    (octave_value::op_lt, octave_matrix::static_type_id (),
-     octave_scalar::static_type_id (), oct_binop_lt);
-
-  INSTALL_BINOP (op_le, octave_matrix, octave_scalar, le);
-  INSTALL_BINOP (op_eq, octave_matrix, octave_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_matrix, octave_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_matrix, octave_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_matrix, octave_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_matrix, octave_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_matrix, octave_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_matrix, octave_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_matrix, octave_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_matrix, octave_scalar, el_or);
-
-  INSTALL_CATOP (octave_matrix, octave_scalar, m_s);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_scalar, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_scalar, sgl_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_scalar, clx_sgl_assign);
-
-  INSTALL_ASSIGNOP (op_add_eq, octave_matrix, octave_scalar, assign_add);
-  INSTALL_ASSIGNOP (op_sub_eq, octave_matrix, octave_scalar, assign_sub);
-  INSTALL_ASSIGNOP (op_mul_eq, octave_matrix, octave_scalar, assign_mul);
-  INSTALL_ASSIGNOP (op_div_eq, octave_matrix, octave_scalar, assign_div);
-}
--- a/src/OPERATORS/op-m-scm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-scm-m.h"
-#include "smx-m-scm.h"
-#include "ov-cx-sparse.h"
-
-// matrix by sparse complex matrix ops.
-
-DEFBINOP_OP (add, matrix, sparse_complex_matrix, +)
-DEFBINOP_OP (sub, matrix, sparse_complex_matrix, -)
-
-DEFBINOP_OP (mul, matrix, sparse_complex_matrix, *)
-
-DEFBINOP (div, matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      Complex d = v2.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.array_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-
-      ComplexMatrix ret = xdiv (v1.matrix_value (),
-                                v2.sparse_complex_matrix_value (), typ);
-
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOPX (pow, matrix, sparse_complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&,
-                   const octave_sparse_complex_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  ComplexMatrix ret = xleftdiv (v1.matrix_value (),
-                                v2.complex_matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (lt, matrix, sparse_complex_matrix, mx_el_lt)
-DEFBINOP_FN (le, matrix, sparse_complex_matrix, mx_el_le)
-DEFBINOP_FN (eq, matrix, sparse_complex_matrix, mx_el_eq)
-DEFBINOP_FN (ge, matrix, sparse_complex_matrix, mx_el_ge)
-DEFBINOP_FN (gt, matrix, sparse_complex_matrix, mx_el_gt)
-DEFBINOP_FN (ne, matrix, sparse_complex_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, matrix, sparse_complex_matrix, product)
-DEFBINOP_FN (el_div, matrix, sparse_complex_matrix, quotient)
-
-DEFBINOP (el_pow, matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  return octave_value
-    (elem_xpow (SparseMatrix (v1.matrix_value ()),
-                v2.sparse_complex_matrix_value ()));
-}
-
-DEFBINOP (el_ldiv, matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&,
-                   const octave_sparse_complex_matrix&);
-  return octave_value
-    (quotient (v2.sparse_complex_matrix_value (), v1.matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, matrix, sparse_complex_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  matrix, sparse_complex_matrix, mx_el_or)
-
-DEFCATOP (m_scm, matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_complex_matrix&);
-  SparseMatrix tmp (v1.matrix_value ());
-  return octave_value (tmp. concat (v2.sparse_complex_matrix_value (),
-                                    ra_idx));
-}
-
-DEFCONV (sparse_complex_matrix_conv, matrix, sparse_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_matrix&);
-  return new octave_sparse_complex_matrix
-    (SparseComplexMatrix (v.complex_matrix_value ()));
-}
-
-void
-install_m_scm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_matrix, octave_sparse_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_matrix, octave_sparse_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_matrix, octave_sparse_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_matrix, octave_sparse_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_matrix, octave_sparse_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_matrix, octave_sparse_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_matrix, octave_sparse_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_matrix, octave_sparse_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_matrix, octave_sparse_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_matrix, octave_sparse_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_matrix, octave_sparse_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_matrix, octave_sparse_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_matrix, octave_sparse_complex_matrix,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_matrix, octave_sparse_complex_matrix,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_matrix, octave_sparse_complex_matrix,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_sparse_complex_matrix,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_matrix, octave_sparse_complex_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_matrix, octave_sparse_complex_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_matrix, octave_sparse_complex_matrix, m_scm);
-
-  INSTALL_ASSIGNCONV (octave_matrix, octave_sparse_complex_matrix,
-                      octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_matrix, octave_sparse_complex_matrix,
-                   sparse_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-m-sm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-re-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-sm-m.h"
-#include "smx-m-sm.h"
-#include "ov-re-sparse.h"
-
-// matrix by sparse matrix ops.
-
-DEFBINOP_OP (add, matrix, sparse_matrix, +)
-DEFBINOP_OP (sub, matrix, sparse_matrix, -)
-
-DEFBINOP_OP (mul, matrix, sparse_matrix, *)
-
-DEFBINOP (div, matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.array_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-
-      Matrix ret = xdiv (v1.matrix_value (), v2.sparse_matrix_value (), typ);
-
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOPX (pow, matrix, sparse_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
-  MatrixType typ = v1.matrix_type ();
-
-  Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ);
-
-  v1.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (mul_trans, matrix, sparse_matrix, mul_trans);
-
-DEFBINOP_FN (lt, matrix, sparse_matrix, mx_el_lt)
-DEFBINOP_FN (le, matrix, sparse_matrix, mx_el_le)
-DEFBINOP_FN (eq, matrix, sparse_matrix, mx_el_eq)
-DEFBINOP_FN (ge, matrix, sparse_matrix, mx_el_ge)
-DEFBINOP_FN (gt, matrix, sparse_matrix, mx_el_gt)
-DEFBINOP_FN (ne, matrix, sparse_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, matrix, sparse_matrix, product)
-DEFBINOP_FN (el_div, matrix, sparse_matrix, quotient)
-
-DEFBINOP (el_pow, matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
-
-  return octave_value (elem_xpow (SparseMatrix (v1.matrix_value ()),
-                                  v2.sparse_matrix_value ()));
-}
-
-DEFBINOP (el_ldiv, matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
-
-  return octave_value
-    (quotient (v2.sparse_matrix_value (), v1.matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, matrix, sparse_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  matrix, sparse_matrix, mx_el_or)
-
-DEFCATOP (m_sm, matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_matrix&);
-  SparseMatrix tmp (v1.matrix_value ());
-  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
-}
-
-DEFCONV (sparse_matrix_conv, matrix, sparse_matrix)
-{
-  CAST_CONV_ARG (const octave_matrix&);
-  return new octave_sparse_matrix (SparseMatrix (v.matrix_value ()));
-}
-
-DEFNDASSIGNOP_FN (assign, matrix, sparse_matrix, array, assign)
-
-void
-install_m_sm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_matrix, octave_sparse_matrix, add);
-  INSTALL_BINOP (op_sub, octave_matrix, octave_sparse_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_matrix, octave_sparse_matrix, mul);
-  INSTALL_BINOP (op_div, octave_matrix, octave_sparse_matrix, div);
-  INSTALL_BINOP (op_pow, octave_matrix, octave_sparse_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_matrix, octave_sparse_matrix, ldiv);
-  INSTALL_BINOP (op_mul_trans, octave_matrix, octave_sparse_matrix, mul_trans);
-  INSTALL_BINOP (op_mul_herm, octave_matrix, octave_sparse_matrix, mul_trans);
-  INSTALL_BINOP (op_lt, octave_matrix, octave_sparse_matrix, lt);
-  INSTALL_BINOP (op_le, octave_matrix, octave_sparse_matrix, le);
-  INSTALL_BINOP (op_eq, octave_matrix, octave_sparse_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_matrix, octave_sparse_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_matrix, octave_sparse_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_matrix, octave_sparse_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_matrix, octave_sparse_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_matrix, octave_sparse_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_matrix, octave_sparse_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_sparse_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_matrix, octave_sparse_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_matrix, octave_sparse_matrix,  el_or);
-
-  INSTALL_CATOP (octave_matrix, octave_sparse_matrix, m_sm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_sparse_matrix, assign)
-  INSTALL_ASSIGNCONV (octave_matrix, octave_sparse_matrix, octave_matrix)
-
-  INSTALL_WIDENOP (octave_matrix, octave_sparse_matrix,
-                   sparse_matrix_conv);
-}
--- a/src/OPERATORS/op-pm-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 MINCLUDE "ov-cx-mat.h"
-
-#define LMATRIX perm_matrix
-#define RMATRIX complex_matrix
-
-#define LSHORT pm
-#define RSHORT cm
-
-#define LEFT
-
-#include "op-pm-template.cc"
--- a/src/OPERATORS/op-pm-fcm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 MINCLUDE "ov-flt-cx-mat.h"
-
-#define LMATRIX perm_matrix
-#define RMATRIX float_complex_matrix
-
-#define LSHORT pm
-#define RSHORT fcm
-
-#define LEFT
-
-#include "op-pm-template.cc"
--- a/src/OPERATORS/op-pm-fm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 MINCLUDE "ov-flt-re-mat.h"
-
-#define LMATRIX perm_matrix
-#define RMATRIX float_matrix
-
-#define LSHORT pm
-#define RSHORT fm
-
-#define LEFT
-
-#include "op-pm-template.cc"
--- a/src/OPERATORS/op-pm-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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 MINCLUDE "ov-re-mat.h"
-
-#define LMATRIX perm_matrix
-#define LDMATRIX matrix
-#define RMATRIX matrix
-
-#define LSHORT pm
-#define RSHORT m
-
-#define LEFT
-#define DEFINENULLASSIGNCONV
-
-#include "op-pm-template.cc"
--- a/src/OPERATORS/op-pm-pm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-perm.h"
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xpow.h"
-
-DEFUNOP (transpose, perm_matrix)
-{
-  CAST_UNOP_ARG (const octave_perm_matrix&);
-  return octave_value (v.perm_matrix_value ().transpose ());
-}
-
-DEFBINOP_OP (mul, perm_matrix, perm_matrix, *)
-
-DEFBINOP (div, perm_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
-
-  return (v1.perm_matrix_value () * v2.perm_matrix_value ().inverse ());
-}
-
-DEFBINOP (ldiv, perm_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
-
-  return (v1.perm_matrix_value ().inverse () * v2.perm_matrix_value ());
-}
-
-DEFBINOP (pow, perm_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_scalar&);
-
-  return xpow (v1.perm_matrix_value (), v2.scalar_value ());
-}
-
-CONVDECL (perm_matrix_to_matrix)
-{
-  CAST_CONV_ARG (const octave_perm_matrix&);
-
-  return new octave_matrix (v.matrix_value ());
-}
-
-void
-install_pm_pm_ops (void)
-{
-  INSTALL_UNOP (op_transpose, octave_perm_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_perm_matrix, transpose);
-
-  INSTALL_BINOP (op_mul, octave_perm_matrix, octave_perm_matrix, mul);
-  INSTALL_BINOP (op_div, octave_perm_matrix, octave_perm_matrix, div);
-  INSTALL_BINOP (op_ldiv, octave_perm_matrix, octave_perm_matrix, ldiv);
-  INSTALL_BINOP (op_pow, octave_perm_matrix, octave_scalar, pow);
-
-  INSTALL_CONVOP (octave_perm_matrix, octave_matrix, perm_matrix_to_matrix);
-  INSTALL_ASSIGNCONV (octave_perm_matrix, octave_matrix, octave_matrix);
-  INSTALL_WIDENOP (octave_perm_matrix, octave_matrix, perm_matrix_to_matrix);
-}
--- a/src/OPERATORS/op-pm-scm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-
-Copyright (C) 2009-2012 Jason Riedy
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-#include "ov-perm.h"
-#include "ov-cx-sparse.h"
-
-// permutation matrix by sparse matrix ops
-
-DEFBINOP (mul_pm_scm, perm_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      std::complex<double> d = v2.complex_value ();
-
-      return octave_value (v1.sparse_matrix_value () * d);
-    }
-  else if (v1.rows () == 1 && v1.columns () == 1)
-    return octave_value (v2.sparse_complex_matrix_value ());
-  else
-    return v1.perm_matrix_value  () * v2.sparse_complex_matrix_value ();
-}
-
-DEFBINOP (ldiv_pm_scm, perm_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_complex_matrix&);
-
-  return v1.perm_matrix_value ().inverse () * v2.sparse_complex_matrix_value ();
-}
-
-// sparse matrix by diagonal matrix ops
-
-DEFBINOP (mul_scm_pm, sparse_complex_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_perm_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      std::complex<double> d = v1.scalar_value ();
-
-      return octave_value (d * v2.sparse_matrix_value ());
-    }
-  else if (v2.rows () == 1 && v2.columns () == 1)
-    return octave_value (v1.sparse_complex_matrix_value ());
-  else
-    return v1.sparse_complex_matrix_value  () * v2.perm_matrix_value ();
-}
-
-DEFBINOP (div_scm_pm, sparse_complex_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_perm_matrix&);
-
-  return v1.sparse_complex_matrix_value () * v2.perm_matrix_value ().inverse ();
-}
-
-void
-install_pm_scm_ops (void)
-{
-  INSTALL_BINOP (op_mul, octave_perm_matrix, octave_sparse_complex_matrix,
-                 mul_pm_scm);
-  INSTALL_BINOP (op_ldiv, octave_perm_matrix, octave_sparse_complex_matrix,
-                 ldiv_pm_scm);
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_perm_matrix,
-                 mul_scm_pm);
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_perm_matrix,
-                 div_scm_pm);
-}
--- a/src/OPERATORS/op-pm-sm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
-
-Copyright (C) 2009-2012 Jason Riedy
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-#include "ov-perm.h"
-#include "ov-re-sparse.h"
-#include "ov-bool-sparse.h"
-
-// Unary permutation ops, some cast to sparse
-
-//Avoid casting to a full matrix
-DEFUNOP_OP (uplus, perm_matrix, /* no-op */)
-
-// Not calling standard CAST_UNOP_ARG for these next two because a
-// dynamic_cast would fail.
-DEFUNOP (not, perm_matrix)
-{
-  // Obviously negation of a permutation matrix destroys sparsity
-  return octave_value ( ! a.bool_array_value ());
-}
-
-DEFUNOP (uminus, perm_matrix)
-{
-  return octave_value ( - a.sparse_matrix_value ());
-}
-
-// Most other logical operations cast to SparseBoolMatrix
-DEFBINOP (eq_pm, perm_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
-  return v1.sparse_bool_matrix_value () == v2.sparse_bool_matrix_value ();
-}
-DEFBINOP (ne_pm, perm_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
-  return v1.sparse_bool_matrix_value () != v2.sparse_bool_matrix_value ();
-}
-DEFBINOP (el_and_pm, perm_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
-  return mx_el_and(v1.sparse_bool_matrix_value (),
-                   v2.sparse_bool_matrix_value ());
-}
-DEFBINOP (el_or_pm,  perm_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
-  return mx_el_or(v1.sparse_bool_matrix_value (),
-                  v2.sparse_bool_matrix_value ());
-}
-
-// permutation matrix by sparse matrix ops
-
-DEFBINOP (mul_pm_sm, perm_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      return octave_value (v1.sparse_matrix_value () * d);
-    }
-  else if (v1.rows () == 1 && v1.columns () == 1)
-    return octave_value (v2.sparse_matrix_value ());
-  else
-    return v1.perm_matrix_value  () * v2.sparse_matrix_value ();
-}
-
-DEFBINOP (ldiv_pm_sm, perm_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_matrix&);
-
-  return v1.perm_matrix_value ().inverse () * v2.sparse_matrix_value ();
-}
-
-// sparse matrix by diagonal matrix ops
-
-DEFBINOP (mul_sm_pm, sparse_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_perm_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      double d = v1.scalar_value ();
-
-      return octave_value (d * v2.sparse_matrix_value ());
-    }
-  else if (v2.rows () == 1 && v2.columns () == 1)
-    return octave_value (v1.sparse_matrix_value ());
-  else
-    return v1.sparse_matrix_value  () * v2.perm_matrix_value ();
-}
-
-DEFBINOP (div_sm_pm, sparse_matrix, perm_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_perm_matrix&);
-
-  return v1.sparse_matrix_value () * v2.perm_matrix_value ().inverse ();
-}
-
-void
-install_pm_sm_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_perm_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_perm_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_perm_matrix, uminus);
-
-
-  INSTALL_BINOP (op_mul, octave_perm_matrix, octave_sparse_matrix,
-                 mul_pm_sm);
-  INSTALL_BINOP (op_ldiv, octave_perm_matrix, octave_sparse_matrix,
-                 ldiv_pm_sm);
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_perm_matrix,
-                 mul_sm_pm);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_perm_matrix,
-                 div_sm_pm);
-
-  INSTALL_BINOP (op_eq, octave_perm_matrix, octave_perm_matrix, eq_pm);
-  INSTALL_BINOP (op_ne, octave_perm_matrix, octave_perm_matrix, ne_pm);
-  INSTALL_BINOP (op_el_and, octave_perm_matrix, octave_perm_matrix, el_and_pm);
-  INSTALL_BINOP (op_el_or,  octave_perm_matrix, octave_perm_matrix, el_or_pm);
-}
--- a/src/OPERATORS/op-pm-template.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ov-perm.h"
-#include MINCLUDE
-#include "ops.h"
-#ifdef DEFINENULLASSIGNCONV
-#include "ov-null-mat.h"
-#endif
-
-#ifndef LDMATRIX
-#define LDMATRIX LMATRIX
-#endif
-
-#define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
-#define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
-#define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
-#ifdef LEFT
-#define LMATRIX_VALUE perm_matrix_value
-#define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
-#else
-#define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
-#define RMATRIX_VALUE perm_matrix_value
-#endif
-
-DEFBINOP (mul, LMATRIX, RMATRIX)
-{
-  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
-
-  return v1.LMATRIX_VALUE () * v2.RMATRIX_VALUE ();
-}
-
-#ifdef LEFT
-DEFBINOP (ldiv, LMATRIX, RMATRIX)
-{
-  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
-
-  return v1.perm_matrix_value ().inverse () * v2.RMATRIX_VALUE ();
-}
-#else
-DEFBINOP (div, LMATRIX, RMATRIX)
-{
-  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
-
-  return v1.LMATRIX_VALUE () * v2.perm_matrix_value ().inverse ();
-}
-#endif
-
-
-#define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
-#define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
-
-void
-INST_NAME (void)
-{
-  INSTALL_BINOP (op_mul, OCTAVE_LMATRIX, OCTAVE_RMATRIX, mul);
-#ifdef LEFT
-  INSTALL_BINOP (op_ldiv, OCTAVE_LMATRIX, OCTAVE_RMATRIX, ldiv);
-#else
-  INSTALL_BINOP (op_div, OCTAVE_LMATRIX, OCTAVE_RMATRIX, div);
-#endif
-#ifdef DEFINENULLASSIGNCONV
-  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_matrix, OCTAVE_LDMATRIX);
-  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_str, OCTAVE_LDMATRIX);
-  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_sq_str, OCTAVE_LDMATRIX);
-#endif
-}
--- a/src/OPERATORS/op-range.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-range.h"
-#include "ov-ch-mat.h"
-#include "ov-scalar.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xpow.h"
-
-// range unary ops.
-
-DEFUNOP (not, range)
-{
-  CAST_UNOP_ARG (const octave_range&);
-
-  return octave_value (! v.matrix_value ());
-}
-
-DEFUNOP_OP (uplus, range, /* no-op */)
-DEFUNOP_OP (uminus, range, -)
-
-DEFUNOP (transpose, range)
-{
-  CAST_UNOP_ARG (const octave_range&);
-
-  return octave_value (v.matrix_value ().transpose ());
-}
-
-DEFBINOP_OP (addrs, range, scalar, +)
-DEFBINOP_OP (addsr, scalar, range, +)
-DEFBINOP_OP (subrs, range, scalar, -)
-DEFBINOP_OP (subsr, scalar, range, -)
-DEFBINOP_OP (mulrs, range, scalar, *)
-DEFBINOP_OP (mulsr, scalar, range, *)
-
-DEFBINOP_FN (el_powsr, scalar, range, elem_xpow)
-DEFBINOP_FN (el_powcsr, complex, range, elem_xpow)
-
-DEFNDCATOP_FN (r_r, range, range, array, array, concat)
-DEFNDCATOP_FN (r_s, range, scalar, array, array, concat)
-DEFNDCATOP_FN (r_m, range, matrix, array, array, concat)
-DEFNDCATOP_FN (r_cs, range, complex, array, complex_array, concat)
-DEFNDCATOP_FN (r_cm, range, complex_matrix, array, complex_array, concat)
-DEFNDCATOP_FN (r_b, range, bool, array, array, concat)
-DEFNDCATOP_FN (r_bm, range, bool_matrix, array, array, concat)
-DEFNDCATOP_FN (r_chm, range, char_matrix, array, char_array, concat)
-DEFNDCATOP_FN (s_r, scalar, range, array, array, concat)
-DEFNDCATOP_FN (m_r, matrix, range, array, array, concat)
-DEFNDCATOP_FN (cs_r, complex, range, complex_array, array, concat)
-DEFNDCATOP_FN (cm_r, complex_matrix, range, complex_array, array, concat)
-DEFNDCATOP_FN (b_r, bool, range, array, array, concat)
-DEFNDCATOP_FN (bm_r, bool_matrix, range, array, array, concat)
-DEFNDCATOP_FN (chm_r, char_matrix, range, char_array, array, concat)
-
-CONVDECL (range_to_matrix)
-{
-  CAST_CONV_ARG (const octave_range&);
-
-  return new octave_matrix (v.array_value ());
-}
-
-void
-install_range_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_range, not);
-  INSTALL_UNOP (op_uplus, octave_range, uplus);
-  INSTALL_UNOP (op_uminus, octave_range, uminus);
-  INSTALL_UNOP (op_transpose, octave_range, transpose);
-  INSTALL_UNOP (op_hermitian, octave_range, transpose);
-
-  INSTALL_BINOP (op_add, octave_range, octave_scalar, addrs);
-  INSTALL_BINOP (op_add, octave_scalar, octave_range, addsr);
-  INSTALL_BINOP (op_sub, octave_range, octave_scalar, subrs);
-  INSTALL_BINOP (op_sub, octave_scalar, octave_range, subsr);
-  INSTALL_BINOP (op_mul, octave_range, octave_scalar, mulrs);
-  INSTALL_BINOP (op_mul, octave_scalar, octave_range, mulsr);
-
-  INSTALL_BINOP (op_el_pow, octave_scalar, octave_range, el_powsr);
-  INSTALL_BINOP (op_el_pow, octave_complex, octave_range, el_powcsr);
-
-  INSTALL_CATOP (octave_range, octave_range, r_r);
-  INSTALL_CATOP (octave_range, octave_scalar, r_s);
-  INSTALL_CATOP (octave_range, octave_matrix, r_m);
-  INSTALL_CATOP (octave_range, octave_complex, r_cs);
-  INSTALL_CATOP (octave_range, octave_complex_matrix, r_cm);
-  INSTALL_CATOP (octave_range, octave_bool, r_b);
-  INSTALL_CATOP (octave_range, octave_bool_matrix, r_bm);
-  INSTALL_CATOP (octave_range, octave_char_matrix, r_chm);
-  INSTALL_CATOP (octave_scalar, octave_range, s_r);
-  INSTALL_CATOP (octave_matrix, octave_range, m_r);
-  INSTALL_CATOP (octave_complex, octave_range, cs_r);
-  INSTALL_CATOP (octave_complex_matrix, octave_range, cm_r);
-  INSTALL_CATOP (octave_bool, octave_range, b_r);
-  INSTALL_CATOP (octave_bool_matrix, octave_range, bm_r);
-  INSTALL_CATOP (octave_char_matrix, octave_range, chm_r);
-
-  // FIXME -- this would be unneccessary if
-  // octave_base_value::numeric_assign always tried converting lhs
-  // before rhs.
-
-  INSTALL_ASSIGNCONV (octave_range, octave_null_matrix, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_range, octave_null_str, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_range, octave_null_sq_str, octave_matrix);
-
-  // However, this should probably be here just in case we need it.
-
-  INSTALL_WIDENOP (octave_range, octave_matrix, range_to_matrix);
-}
--- a/src/OPERATORS/op-s-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-s-cm.h"
-#include "mx-cm-s.h"
-#include "mx-s-cnda.h"
-#include "mx-cnda-s.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// scalar by complex matrix ops.
-
-DEFNDBINOP_OP (add, scalar, complex_matrix, scalar, complex_array, +)
-DEFNDBINOP_OP (sub, scalar, complex_matrix, scalar, complex_array, -)
-DEFNDBINOP_OP (mul, scalar, complex_matrix, scalar, complex_array, *)
-
-DEFBINOP (div, scalar, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
-
-  Matrix m1 = v1.matrix_value ();
-  ComplexMatrix m2 = v2.complex_matrix_value ();
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (m1, m2, typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (pow, scalar, complex_matrix, xpow)
-
-DEFBINOP (ldiv, scalar, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
-
-  double d = v1.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.complex_array_value () / d);
-}
-
-DEFNDCMPLXCMPOP_FN (lt, scalar, complex_matrix, scalar, complex_array, mx_el_lt)
-DEFNDCMPLXCMPOP_FN (le, scalar, complex_matrix, scalar, complex_array, mx_el_le)
-DEFNDCMPLXCMPOP_FN (eq, scalar, complex_matrix, scalar, complex_array, mx_el_eq)
-DEFNDCMPLXCMPOP_FN (ge, scalar, complex_matrix, scalar, complex_array, mx_el_ge)
-DEFNDCMPLXCMPOP_FN (gt, scalar, complex_matrix, scalar, complex_array, mx_el_gt)
-DEFNDCMPLXCMPOP_FN (ne, scalar, complex_matrix, scalar, complex_array, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, scalar, complex_matrix, scalar, complex_array, *)
-DEFNDBINOP_FN (el_div, scalar, complex_matrix, scalar, complex_array, x_el_div)
-DEFNDBINOP_FN (el_pow, scalar, complex_matrix, scalar, complex_array, elem_xpow)
-
-DEFBINOP (el_ldiv, scalar, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
-
-  double d = v1.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.complex_array_value () / d);
-}
-
-DEFNDBINOP_FN (el_and, scalar, complex_matrix, scalar, complex_array, mx_el_and)
-DEFNDBINOP_FN (el_or,  scalar, complex_matrix, scalar, complex_array, mx_el_or)
-
-DEFNDCATOP_FN (s_cm, scalar, complex_matrix, array, complex_array, concat)
-
-DEFCONV (complex_matrix_conv, scalar, complex_matrix)
-{
-  CAST_CONV_ARG (const octave_scalar&);
-
-  return new octave_complex_matrix (ComplexMatrix (v.matrix_value ()));
-}
-
-void
-install_s_cm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_scalar, octave_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_scalar, octave_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_scalar, octave_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_scalar, octave_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_scalar, octave_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_scalar, octave_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_scalar, octave_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_scalar, octave_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_scalar, octave_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_scalar, octave_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_scalar, octave_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_scalar, octave_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_scalar, octave_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_scalar, octave_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_scalar, octave_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_scalar, octave_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_scalar, octave_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_scalar, octave_complex_matrix, s_cm);
-
-  INSTALL_ASSIGNCONV (octave_scalar, octave_complex_matrix, octave_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_complex_matrix, octave_float_complex_matrix);
-
-  INSTALL_WIDENOP (octave_scalar, octave_complex_matrix, complex_matrix_conv);
-}
--- a/src/OPERATORS/op-s-cs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// scalar by complex scalar ops.
-
-DEFBINOP_OP (add, scalar, complex, +)
-DEFBINOP_OP (sub, scalar, complex, -)
-DEFBINOP_OP (mul, scalar, complex, *)
-
-DEFBINOP (div, scalar, complex)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.double_value () / d);
-}
-
-DEFBINOP_FN (pow, scalar, complex, xpow)
-
-DEFBINOP (ldiv, scalar, complex)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
-
-  double d = v1.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.complex_value () / d);
-}
-
-DEFCMPLXCMPOP_OP (lt, scalar, complex, <)
-DEFCMPLXCMPOP_OP (le, scalar, complex, <=)
-DEFCMPLXCMPOP_OP (eq, scalar, complex, ==)
-DEFCMPLXCMPOP_OP (ge, scalar, complex, >=)
-DEFCMPLXCMPOP_OP (gt, scalar, complex, >)
-DEFCMPLXCMPOP_OP (ne, scalar, complex, !=)
-
-DEFBINOP_OP (el_mul, scalar, complex, *)
-
-DEFBINOP (el_div, scalar, complex)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.double_value () / d);
-}
-
-DEFBINOP_FN (el_pow, scalar, complex, xpow)
-
-DEFBINOP (el_ldiv, scalar, complex)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
-
-  double d = v1.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.complex_value () / d);
-}
-
-DEFBINOP (el_and, scalar, complex)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
-
-  return octave_value (v1.double_value () && (v2.complex_value () != 0.0));
-}
-
-DEFBINOP (el_or, scalar, complex)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
-
-  return octave_value (v1.double_value () || (v2.complex_value () != 0.0));
-}
-
-DEFNDCATOP_FN (s_cs, scalar, complex, array, complex_array, concat)
-
-void
-install_s_cs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_scalar, octave_complex, add);
-  INSTALL_BINOP (op_sub, octave_scalar, octave_complex, sub);
-  INSTALL_BINOP (op_mul, octave_scalar, octave_complex, mul);
-  INSTALL_BINOP (op_div, octave_scalar, octave_complex, div);
-  INSTALL_BINOP (op_pow, octave_scalar, octave_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_scalar, octave_complex, ldiv);
-  INSTALL_BINOP (op_lt, octave_scalar, octave_complex, lt);
-  INSTALL_BINOP (op_le, octave_scalar, octave_complex, le);
-  INSTALL_BINOP (op_eq, octave_scalar, octave_complex, eq);
-  INSTALL_BINOP (op_ge, octave_scalar, octave_complex, ge);
-  INSTALL_BINOP (op_gt, octave_scalar, octave_complex, gt);
-  INSTALL_BINOP (op_ne, octave_scalar, octave_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_scalar, octave_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_scalar, octave_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_scalar, octave_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_scalar, octave_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_scalar, octave_complex, el_or);
-
-  INSTALL_CATOP (octave_scalar, octave_complex, s_cs);
-
-  INSTALL_ASSIGNCONV (octave_scalar, octave_complex, octave_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_complex, octave_float_complex_matrix);
-}
--- a/src/OPERATORS/op-s-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// scalar by matrix ops.
-
-DEFNDBINOP_OP (add, scalar, matrix, scalar, array, +)
-DEFNDBINOP_OP (sub, scalar, matrix, scalar, array, -)
-DEFNDBINOP_OP (mul, scalar, matrix, scalar, array, *)
-
-DEFBINOP (div, scalar, matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&);
-
-  Matrix m1 = v1.matrix_value ();
-  Matrix m2 = v2.matrix_value ();
-  MatrixType typ = v2.matrix_type ();
-
-  Matrix ret = xdiv (m1, m2, typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOP_FN (pow, scalar, matrix, xpow)
-
-DEFBINOP (ldiv, scalar, matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&);
-
-  double d = v1.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.array_value () / d);
-}
-
-DEFNDBINOP_FN (lt, scalar, matrix, scalar, array, mx_el_lt)
-DEFNDBINOP_FN (le, scalar, matrix, scalar, array, mx_el_le)
-DEFNDBINOP_FN (eq, scalar, matrix, scalar, array, mx_el_eq)
-DEFNDBINOP_FN (ge, scalar, matrix, scalar, array, mx_el_ge)
-DEFNDBINOP_FN (gt, scalar, matrix, scalar, array, mx_el_gt)
-DEFNDBINOP_FN (ne, scalar, matrix, scalar, array, mx_el_ne)
-
-DEFNDBINOP_OP (el_mul, scalar, matrix, scalar, array, *)
-DEFNDBINOP_FN (el_div, scalar, matrix, scalar, array, x_el_div)
-DEFNDBINOP_FN (el_pow, scalar, matrix, scalar, array, elem_xpow)
-
-DEFBINOP (el_ldiv, scalar, matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&);
-
-  double d = v1.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.array_value () / d);
-}
-
-DEFNDBINOP_FN (el_and, scalar, matrix, scalar, array, mx_el_and)
-DEFNDBINOP_FN (el_or,  scalar, matrix, scalar, array, mx_el_or)
-
-DEFNDCATOP_FN (s_m, scalar, matrix, array, array, concat)
-
-DEFCONV (matrix_conv, scalar, matrix)
-{
-  CAST_CONV_ARG (const octave_scalar&);
-
-  return new octave_matrix (v.matrix_value ());
-}
-
-void
-install_s_m_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_scalar, octave_matrix, add);
-  INSTALL_BINOP (op_sub, octave_scalar, octave_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_scalar, octave_matrix, mul);
-  INSTALL_BINOP (op_div, octave_scalar, octave_matrix, div);
-  INSTALL_BINOP (op_pow, octave_scalar, octave_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_scalar, octave_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_scalar, octave_matrix, lt);
-  INSTALL_BINOP (op_le, octave_scalar, octave_matrix, le);
-  INSTALL_BINOP (op_eq, octave_scalar, octave_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_scalar, octave_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_scalar, octave_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_scalar, octave_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_scalar, octave_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_scalar, octave_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_scalar, octave_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_scalar, octave_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_scalar, octave_matrix, el_or);
-
-  INSTALL_CATOP (octave_scalar, octave_matrix, s_m);
-
-  INSTALL_ASSIGNCONV (octave_scalar, octave_matrix, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_matrix, octave_float_matrix);
-
-  INSTALL_WIDENOP (octave_scalar, octave_matrix, matrix_conv);
-}
--- a/src/OPERATORS/op-s-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Array-util.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// scalar unary ops.
-
-DEFUNOP (not, scalar)
-{
-  CAST_UNOP_ARG (const octave_scalar&);
-  double x = v.scalar_value ();
-  if (xisnan (x))
-    gripe_nan_to_logical_conversion ();
-  return octave_value (x == 0.0);
-}
-
-DEFUNOP_OP (uplus, scalar, /* no-op */)
-DEFUNOP_OP (uminus, scalar, -)
-DEFUNOP_OP (transpose, scalar, /* no-op */)
-DEFUNOP_OP (hermitian, scalar, /* no-op */)
-
-DEFNCUNOP_METHOD (incr, scalar, increment)
-DEFNCUNOP_METHOD (decr, scalar, decrement)
-
-// scalar by scalar ops.
-
-DEFBINOP_OP (add, scalar, scalar, +)
-DEFBINOP_OP (sub, scalar, scalar, -)
-DEFBINOP_OP (mul, scalar, scalar, *)
-
-DEFBINOP (div, scalar, scalar)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&);
-
-  double d = v2.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.double_value () / d);
-}
-
-DEFBINOP_FN (pow, scalar, scalar, xpow)
-
-DEFBINOP (ldiv, scalar, scalar)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&);
-
-  double d = v1.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.double_value () / d);
-}
-
-DEFBINOP_OP (lt, scalar, scalar, <)
-DEFBINOP_OP (le, scalar, scalar, <=)
-DEFBINOP_OP (eq, scalar, scalar, ==)
-DEFBINOP_OP (ge, scalar, scalar, >=)
-DEFBINOP_OP (gt, scalar, scalar, >)
-DEFBINOP_OP (ne, scalar, scalar, !=)
-
-DEFBINOP_OP (el_mul, scalar, scalar, *)
-
-DEFBINOP (el_div, scalar, scalar)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&);
-
-  double d = v2.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v1.double_value () / d);
-}
-
-DEFBINOP_FN (el_pow, scalar, scalar, xpow)
-
-DEFBINOP (el_ldiv, scalar, scalar)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&);
-
-  double d = v1.double_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  return octave_value (v2.double_value () / d);
-}
-
-DEFSCALARBOOLOP_OP (el_and, scalar, scalar, &&)
-DEFSCALARBOOLOP_OP (el_or, scalar, scalar, ||)
-
-DEFNDCATOP_FN (s_s, scalar, scalar, array, array, concat)
-
-void
-install_s_s_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_scalar, not);
-  INSTALL_UNOP (op_uplus, octave_scalar, uplus);
-  INSTALL_UNOP (op_uminus, octave_scalar, uminus);
-  INSTALL_UNOP (op_transpose, octave_scalar, transpose);
-  INSTALL_UNOP (op_hermitian, octave_scalar, hermitian);
-
-  INSTALL_NCUNOP (op_incr, octave_scalar, incr);
-  INSTALL_NCUNOP (op_decr, octave_scalar, decr);
-
-  INSTALL_BINOP (op_add, octave_scalar, octave_scalar, add);
-  INSTALL_BINOP (op_sub, octave_scalar, octave_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_scalar, octave_scalar, mul);
-  INSTALL_BINOP (op_div, octave_scalar, octave_scalar, div);
-  INSTALL_BINOP (op_pow, octave_scalar, octave_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_scalar, octave_scalar, ldiv);
-  INSTALL_BINOP (op_lt, octave_scalar, octave_scalar, lt);
-  INSTALL_BINOP (op_le, octave_scalar, octave_scalar, le);
-  INSTALL_BINOP (op_eq, octave_scalar, octave_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_scalar, octave_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_scalar, octave_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_scalar, octave_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_scalar, octave_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_scalar, octave_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_scalar, octave_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_scalar, octave_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_scalar, octave_scalar, el_or);
-
-  INSTALL_CATOP (octave_scalar, octave_scalar, s_s);
-
-  INSTALL_ASSIGNCONV (octave_scalar, octave_scalar, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_float_scalar, octave_scalar, octave_float_matrix);
-
-  INSTALL_ASSIGNCONV (octave_scalar, octave_null_matrix, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_scalar, octave_null_str, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_scalar, octave_null_sq_str, octave_matrix);
-}
--- a/src/OPERATORS/op-s-scm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-cx-mat.h"
-#include "ov-scalar.h"
-#include "ops.h"
-#include "xpow.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-s-scm.h"
-#include "smx-scm-s.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-
-// scalar by sparse complex matrix ops.
-
-DEFBINOP_OP (add, scalar, sparse_complex_matrix, +)
-DEFBINOP_OP (sub, scalar, sparse_complex_matrix, -)
-DEFBINOP_OP (mul, scalar, sparse_complex_matrix, *)
-
-DEFBINOP (div, scalar, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      Complex d = v2.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (SparseComplexMatrix (1, 1, v1.scalar_value () / d));
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      Matrix m1 = Matrix (1, 1, v1.scalar_value ());
-      SparseComplexMatrix m2 = v2.sparse_complex_matrix_value ();
-      ComplexMatrix ret = xdiv (m1, m2, typ);
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP (pow, scalar, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&,
-                   const octave_sparse_complex_matrix&);
-  return xpow (v1.scalar_value (), v2.complex_matrix_value ());
-}
-
-DEFBINOP (ldiv, scalar, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&,
-                   const octave_sparse_complex_matrix&);
-
-  double d = v1.double_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v2.sparse_complex_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (lt, scalar, sparse_complex_matrix, mx_el_lt)
-DEFBINOP_FN (le, scalar, sparse_complex_matrix, mx_el_le)
-DEFBINOP_FN (eq, scalar, sparse_complex_matrix, mx_el_eq)
-DEFBINOP_FN (ge, scalar, sparse_complex_matrix, mx_el_ge)
-DEFBINOP_FN (gt, scalar, sparse_complex_matrix, mx_el_gt)
-DEFBINOP_FN (ne, scalar, sparse_complex_matrix, mx_el_ne)
-
-DEFBINOP_OP (el_mul, scalar, sparse_complex_matrix, *)
-DEFBINOP_FN (el_div, scalar, sparse_complex_matrix, x_el_div)
-DEFBINOP_FN (el_pow, scalar, sparse_complex_matrix, elem_xpow)
-
-DEFBINOP (el_ldiv, scalar, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&,
-                   const octave_sparse_complex_matrix&);
-
-  double d = v1.double_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v2.sparse_complex_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (el_and, scalar, sparse_complex_matrix, mx_el_and)
-DEFBINOP_FN (el_or, scalar, sparse_complex_matrix, mx_el_or)
-
-DEFCATOP (s_scm, scalar, sparse_compelx_matrix)
-{
-  CAST_BINOP_ARGS (octave_scalar&, const octave_sparse_complex_matrix&);
-  SparseMatrix tmp (1, 1, v1.scalar_value ());
-  return octave_value
-    (tmp.concat (v2.sparse_complex_matrix_value (), ra_idx));
-}
-
-DEFCONV (sparse_complex_matrix_conv, scalar, sparse_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_scalar&);
-
-  return new octave_sparse_complex_matrix
-    (SparseComplexMatrix (v.complex_matrix_value ()));
-}
-
-void
-install_s_scm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_scalar, octave_sparse_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_scalar, octave_sparse_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_scalar, octave_sparse_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_scalar, octave_sparse_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_scalar, octave_sparse_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_scalar, octave_sparse_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_scalar, octave_sparse_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_scalar, octave_sparse_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_scalar, octave_sparse_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_scalar, octave_sparse_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_scalar, octave_sparse_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_scalar, octave_sparse_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_scalar, octave_sparse_complex_matrix,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_scalar, octave_sparse_complex_matrix,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_scalar, octave_sparse_complex_matrix,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_sparse_complex_matrix,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_scalar, octave_sparse_complex_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_scalar, octave_sparse_complex_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_scalar, octave_sparse_complex_matrix, s_scm);
-
-  INSTALL_ASSIGNCONV (octave_scalar, octave_sparse_complex_matrix,
-                      octave_complex_matrix);
-
-  INSTALL_WIDENOP (octave_scalar, octave_sparse_complex_matrix,
-                   sparse_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-s-sm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-scalar.h"
-#include "ops.h"
-#include "xpow.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "ov-re-sparse.h"
-
-// scalar by sparse matrix ops.
-
-DEFBINOP_OP (add, scalar, sparse_matrix, +)
-DEFBINOP_OP (sub, scalar, sparse_matrix, -)
-DEFBINOP_OP (mul, scalar, sparse_matrix, *)
-
-DEFBINOP (div, scalar, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (SparseMatrix (1, 1, v1.scalar_value () / d));
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      Matrix m1 = Matrix (1, 1, v1.double_value ());
-      SparseMatrix m2 = v2.sparse_matrix_value ();
-      Matrix ret = xdiv (m1, m2, typ);
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP (pow, scalar, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
-  return xpow (v1.scalar_value (), v2.matrix_value ());
-}
-
-DEFBINOP (ldiv, scalar, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
-
-  double d = v1.double_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v2.sparse_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (lt, scalar, sparse_matrix, mx_el_lt)
-DEFBINOP_FN (le, scalar, sparse_matrix, mx_el_le)
-DEFBINOP_FN (eq, scalar, sparse_matrix, mx_el_eq)
-DEFBINOP_FN (ge, scalar, sparse_matrix, mx_el_ge)
-DEFBINOP_FN (gt, scalar, sparse_matrix, mx_el_gt)
-DEFBINOP_FN (ne, scalar, sparse_matrix, mx_el_ne)
-
-DEFBINOP_OP (el_mul, scalar, sparse_matrix, *)
-DEFBINOP_FN (el_div, scalar, sparse_matrix, x_el_div)
-DEFBINOP_FN (el_pow, scalar, sparse_matrix, elem_xpow)
-
-DEFBINOP (el_ldiv, scalar, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
-
-  double d = v1.double_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v2.sparse_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (el_and, scalar, sparse_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  scalar, sparse_matrix, mx_el_or)
-
-DEFCATOP (s_sm, scalar, sparse_matrix)
-{
-  CAST_BINOP_ARGS (octave_scalar&, const octave_sparse_matrix&);
-  SparseMatrix tmp (1, 1, v1.scalar_value ());
-  return octave_value (tmp.concat (v2.sparse_matrix_value (), ra_idx));
-}
-
-DEFCONV (sparse_matrix_conv, scalar, sparse_matrix)
-{
-  CAST_CONV_ARG (const octave_scalar&);
-
-  return new octave_sparse_matrix (SparseMatrix (v.matrix_value ()));
-}
-
-void
-install_s_sm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_scalar, octave_sparse_matrix, add);
-  INSTALL_BINOP (op_sub, octave_scalar, octave_sparse_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_scalar, octave_sparse_matrix, mul);
-  INSTALL_BINOP (op_div, octave_scalar, octave_sparse_matrix, div);
-  INSTALL_BINOP (op_pow, octave_scalar, octave_sparse_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_scalar, octave_sparse_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_scalar, octave_sparse_matrix, lt);
-  INSTALL_BINOP (op_le, octave_scalar, octave_sparse_matrix, le);
-  INSTALL_BINOP (op_eq, octave_scalar, octave_sparse_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_scalar, octave_sparse_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_scalar, octave_sparse_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_scalar, octave_sparse_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_scalar, octave_sparse_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_scalar, octave_sparse_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_scalar, octave_sparse_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_sparse_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_scalar, octave_sparse_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_scalar, octave_sparse_matrix, el_or);
-
-  INSTALL_CATOP (octave_scalar, octave_sparse_matrix, s_sm);
-
-  INSTALL_ASSIGNCONV (octave_scalar, octave_sparse_matrix, octave_matrix);
-
-  INSTALL_WIDENOP (octave_scalar, octave_sparse_matrix, sparse_matrix_conv);
-}
--- a/src/OPERATORS/op-sbm-b.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-bool.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-scalar.h"
-#include "ops.h"
-
-#include "ov-re-sparse.h"
-#include "ov-bool-sparse.h"
-
-// sparse bool matrix by bool ops.
-
-DEFBINOP_FN (ne, sparse_bool_matrix, bool, mx_el_ne)
-DEFBINOP_FN (eq, sparse_bool_matrix, bool, mx_el_eq)
-
-DEFBINOP_FN (el_and, sparse_bool_matrix, bool, mx_el_and)
-DEFBINOP_FN (el_or, sparse_bool_matrix, bool, mx_el_or)
-
-DEFCATOP (sbm_b, sparse_bool_matrix, bool)
-{
-  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool&);
-
-  SparseBoolMatrix tmp (1, 1, v2.bool_value ());
-  return octave_value (v1.sparse_bool_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFCATOP (sm_b, sparse_matrix, bool)
-{
-  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool&);
-
-  SparseMatrix tmp (1, 1, v2.scalar_value ());
-  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFCATOP (sbm_s, sparse_bool_matrix, scalar)
-{
-  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_scalar&);
-
-  SparseMatrix tmp (1, 1, v2.scalar_value ());
-  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFASSIGNOP (assign, sparse_bool_matrix, bool)
-{
-  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool&);
-
-  SparseBoolMatrix tmp (1, 1, v2.bool_value ());
-  v1.assign (idx, tmp);
-  return octave_value ();
-}
-
-static octave_value
-oct_assignop_conv_and_assign (octave_base_value& a1,
-                              const octave_value_list& idx,
-                              const octave_base_value& a2)
-{
-  octave_sparse_bool_matrix& v1 = dynamic_cast<octave_sparse_bool_matrix&> (a1);
-
-  // FIXME -- perhaps add a warning for this conversion if the values
-  // are not all 0 or 1?
-
-  SparseBoolMatrix v2 (1, 1, a2.bool_value ());
-
-  if (! error_state)
-    v1.assign (idx, v2);
-
-  return octave_value ();
-}
-
-void
-install_sbm_b_ops (void)
-{
-  INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, octave_bool, eq);
-  INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, octave_bool, ne);
-
-  INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_bool, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_bool, el_or);
-
-  INSTALL_CATOP (octave_sparse_bool_matrix, octave_bool, sbm_b);
-  INSTALL_CATOP (octave_sparse_bool_matrix, octave_scalar, sbm_s);
-  INSTALL_CATOP (octave_sparse_matrix, octave_bool, sm_b);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_bool, assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_scalar,
-                    conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int8_scalar,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int16_scalar,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int32_scalar,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int64_scalar,
-                    conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint8_scalar,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint16_scalar,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint32_scalar,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint64_scalar,
-                    conv_and_assign);
-}
--- a/src/OPERATORS/op-sbm-bm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-bool-mat.h"
-#include "boolMatrix.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-range.h"
-#include "ov-scalar.h"
-#include "ov-str-mat.h"
-#include "ops.h"
-#include "ov-null-mat.h"
-#include "ov-re-sparse.h"
-#include "ov-bool-sparse.h"
-#include "smx-bm-sbm.h"
-#include "smx-sbm-bm.h"
-
-// sparse bool matrix by bool matrix ops.
-
-DEFBINOP_FN (eq, sparse_bool_matrix, bool_matrix, mx_el_eq)
-DEFBINOP_FN (ne, sparse_bool_matrix, bool_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_and, sparse_bool_matrix, bool_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_bool_matrix, bool_matrix, mx_el_or)
-
-DEFCATOP (sbm_bm, sparse_bool_matrix, bool_matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&);
-
-  SparseBoolMatrix tmp (v2.bool_matrix_value ());
-  return octave_value (v1.sparse_bool_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFCATOP (sbm_m, sparse_bool_matrix, matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_matrix&);
-
-  SparseMatrix tmp (v2.matrix_value ());
-  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFCATOP (sm_bm, sparse_matrix, bool_matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool_matrix&);
-
-  SparseMatrix tmp (v2.matrix_value ());
-  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFASSIGNOP (assign, sparse_bool_matrix, bool_matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&);
-
-  v1.assign (idx, SparseBoolMatrix (v2.bool_matrix_value ()));
-  return octave_value ();
-}
-
-DEFNULLASSIGNOP_FN (null_assign, sparse_bool_matrix, delete_elements)
-
-static octave_value
-oct_assignop_conv_and_assign (octave_base_value& a1,
-                              const octave_value_list& idx,
-                              const octave_base_value& a2)
-{
-  octave_sparse_bool_matrix& v1 = dynamic_cast<octave_sparse_bool_matrix&> (a1);
-
-  // FIXME -- perhaps add a warning for this conversion if the values
-  // are not all 0 or 1?
-
-  SparseBoolMatrix v2 (a2.bool_array_value ());
-
-  if (! error_state)
-    v1.assign (idx, v2);
-
-  return octave_value ();
-}
-
-void
-install_sbm_bm_ops (void)
-{
-  INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, octave_bool_matrix, eq);
-  INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, octave_bool_matrix, ne);
-
-  INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_bool_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_bool_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_sparse_bool_matrix, octave_bool_matrix, sbm_bm);
-  INSTALL_CATOP (octave_sparse_matrix, octave_bool_matrix, sm_bm);
-  INSTALL_CATOP (octave_sparse_bool_matrix, octave_matrix, sbm_m);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
-                    octave_bool_matrix, assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_matrix,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
-                    octave_char_matrix_str, conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
-                    octave_char_matrix_sq_str, conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_range,
-                    conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_sparse_matrix,
-                    conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int8_matrix,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int16_matrix,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int32_matrix,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int64_matrix,
-                    conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint8_matrix,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint16_matrix,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint32_matrix,
-                    conv_and_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint64_matrix,
-                    conv_and_assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_null_matrix,
-                    null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_null_str,
-                    null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_null_sq_str,
-                    null_assign);
-}
--- a/src/OPERATORS/op-sbm-sbm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ops.h"
-
-#include "ov-re-sparse.h"
-#include "ov-bool-sparse.h"
-
-// unary sparse bool matrix ops.
-
-DEFUNOP_OP (not, sparse_bool_matrix, !)
-
-DEFUNOP (uplus, sparse_bool_matrix)
-{
-  CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
-  return octave_value (v.sparse_matrix_value ());
-}
-
-DEFUNOP (uminus, sparse_bool_matrix)
-{
-  CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
-  return octave_value ( - v.sparse_matrix_value ());
-}
-
-DEFUNOP (transpose, sparse_bool_matrix)
-{
-  CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
-  return octave_value (v.sparse_bool_matrix_value ().transpose ());
-}
-
-// sparse bool matrix by sparse bool matrix ops.
-
-DEFBINOP_FN (eq, sparse_bool_matrix, sparse_bool_matrix, mx_el_eq)
-DEFBINOP_FN (ne, sparse_bool_matrix, sparse_bool_matrix, mx_el_ne)
-DEFBINOP_FN (el_and, sparse_bool_matrix, sparse_bool_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_bool_matrix, sparse_bool_matrix, mx_el_or)
-
-DEFNDCATOP_FN (sbm_sbm, sparse_bool_matrix, sparse_bool_matrix,
-               sparse_bool_matrix, sparse_bool_matrix, concat)
-DEFNDCATOP_FN (sbm_sm, sparse_bool_matrix, sparse_matrix, sparse_matrix,
-               sparse_matrix, concat)
-DEFNDCATOP_FN (sm_sbm, sparse_matrix, sparse_bool_matrix, sparse_matrix,
-               sparse_matrix, concat)
-
-DEFASSIGNOP_FN (assign, sparse_bool_matrix, sparse_bool_matrix,
-                assign)
-
-CONVDECL (bool_matrix_to_double_matrix)
-{
-  CAST_CONV_ARG (const octave_sparse_bool_matrix&);
-
-  return new octave_sparse_matrix (SparseMatrix (v.sparse_bool_matrix_value ()));
-}
-
-void
-install_sbm_sbm_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_sparse_bool_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_sparse_bool_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_sparse_bool_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_sparse_bool_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_sparse_bool_matrix, transpose);
-
-  INSTALL_BINOP (op_eq, octave_sparse_bool_matrix,
-                 octave_sparse_bool_matrix, eq);
-  INSTALL_BINOP (op_ne, octave_sparse_bool_matrix,
-                 octave_sparse_bool_matrix, ne);
-
-  INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix,
-                 octave_sparse_bool_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix,
-                 octave_sparse_bool_matrix, el_or);
-
-  INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_bool_matrix,
-                 sbm_sbm);
-  INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_matrix, sbm_sm);
-  INSTALL_CATOP (octave_sparse_matrix, octave_sparse_bool_matrix, sm_sbm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
-                    octave_sparse_bool_matrix, assign);
-
-  INSTALL_CONVOP (octave_sparse_bool_matrix, octave_sparse_matrix,
-                  bool_matrix_to_double_matrix);
-}
--- a/src/OPERATORS/op-scm-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-cx-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-scm-cm.h"
-#include "smx-cm-scm.h"
-#include "ov-cx-sparse.h"
-
-// sparse complex matrix by complex matrix ops.
-
-DEFBINOP_OP (add, sparse_complex_matrix, complex_matrix, +)
-DEFBINOP_OP (sub, sparse_complex_matrix, complex_matrix, -)
-
-DEFBINOP_OP (mul, sparse_complex_matrix, complex_matrix, *)
-
-DEFBINOP (div, sparse_complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_complex_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
-                            v2.complex_matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, sparse_complex_matrix, complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, sparse_complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      Complex d = v1.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v2.complex_array_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-
-      ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (),
-                      v2.complex_matrix_value (), typ);
-
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (trans_mul, sparse_complex_matrix, complex_matrix, trans_mul);
-DEFBINOP_FN (herm_mul, sparse_complex_matrix, complex_matrix, herm_mul);
-
-DEFBINOP_FN (lt, sparse_complex_matrix, complex_matrix, mx_el_lt)
-DEFBINOP_FN (le, sparse_complex_matrix, complex_matrix, mx_el_le)
-DEFBINOP_FN (eq, sparse_complex_matrix, complex_matrix, mx_el_eq)
-DEFBINOP_FN (ge, sparse_complex_matrix, complex_matrix, mx_el_ge)
-DEFBINOP_FN (gt, sparse_complex_matrix, complex_matrix, mx_el_gt)
-DEFBINOP_FN (ne, sparse_complex_matrix, complex_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, sparse_complex_matrix, complex_matrix, product)
-DEFBINOP_FN (el_div, sparse_complex_matrix, complex_matrix, quotient)
-
-DEFBINOP (el_pow, sparse_complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_complex_matrix&);
-
-  return octave_value
-    (elem_xpow (v1.sparse_complex_matrix_value (), SparseComplexMatrix
-                (v2.complex_matrix_value ())));
-}
-
-DEFBINOP (el_ldiv, sparse_complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_complex_matrix&);
-
-  return octave_value (quotient (v2.complex_matrix_value (),
-                                 v1.sparse_complex_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_complex_matrix, complex_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_complex_matrix, complex_matrix, mx_el_or)
-
-DEFCATOP (scm_cm, sparse_complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_complex_matrix&,
-                   const octave_complex_matrix&);
-  SparseComplexMatrix tmp (v2.complex_matrix_value ());
-  return octave_value
-    (v1.sparse_complex_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFASSIGNOP (assign, sparse_complex_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_complex_matrix&,
-                   const octave_complex_matrix&);
-
-  SparseComplexMatrix tmp (v2.complex_matrix_value ());
-  v1.assign (idx, tmp);
-  return octave_value ();
-}
-
-void
-install_scm_cm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_complex_matrix,
-                 octave_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix,
-                 octave_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix,
-                 octave_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix,
-                 octave_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix,
-                 octave_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix,
-                 octave_complex_matrix, ldiv);
-  INSTALL_BINOP (op_trans_mul, octave_sparse_complex_matrix,
-                 octave_complex_matrix, trans_mul);
-  INSTALL_BINOP (op_herm_mul, octave_sparse_complex_matrix,
-                 octave_complex_matrix, herm_mul);
-  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix,
-                 octave_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_sparse_complex_matrix,
-                 octave_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix,
-                 octave_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix,
-                 octave_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix,
-                 octave_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix,
-                 octave_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix,
-                 octave_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix,
-                 octave_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix,
-                 octave_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix,
-                 octave_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix,
-                 octave_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix,
-                 octave_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_sparse_complex_matrix,
-                 octave_complex_matrix, scm_cm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
-                    octave_complex_matrix, assign);
-}
--- a/src/OPERATORS/op-scm-cs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-cx-mat.h"
-#include "ov-complex.h"
-#include "ops.h"
-#include "xpow.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "ov-cx-sparse.h"
-
-// sparse complex matrix by complex scalar ops.
-
-DEFBINOP_OP (add, sparse_complex_matrix, complex, +)
-DEFBINOP_OP (sub, sparse_complex_matrix, complex, -)
-DEFBINOP_OP (mul, sparse_complex_matrix, complex, *)
-
-DEFBINOP (div, sparse_complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_complex&);
-
-  Complex d = v2.complex_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v1.sparse_complex_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP (pow, sparse_complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_complex&);
-  return xpow (v1.complex_matrix_value (), v2.complex_value ());
-}
-
-DEFBINOP (ldiv, sparse_complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      Complex d = v1.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (SparseComplexMatrix (1, 1, v2.complex_value () / d));
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-      SparseComplexMatrix m1 = v1.sparse_complex_matrix_value ();
-      ComplexMatrix m2 = ComplexMatrix (1, 1, v2.complex_value ());
-      ComplexMatrix ret = xleftdiv (m1, m2, typ);
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_complex_matrix, complex, mx_el_lt)
-DEFBINOP_FN (le, sparse_complex_matrix, complex, mx_el_le)
-DEFBINOP_FN (eq, sparse_complex_matrix, complex, mx_el_eq)
-DEFBINOP_FN (ge, sparse_complex_matrix, complex, mx_el_ge)
-DEFBINOP_FN (gt, sparse_complex_matrix, complex, mx_el_gt)
-DEFBINOP_FN (ne, sparse_complex_matrix, complex, mx_el_ne)
-
-DEFBINOP_OP (el_mul, sparse_complex_matrix, complex, *)
-
-DEFBINOP (el_div, sparse_complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_complex&);
-
-  octave_value retval;
-
-  Complex d = v2.complex_value ();
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval =  octave_value (v1.sparse_complex_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (el_pow, sparse_complex_matrix, complex, elem_xpow)
-
-DEFBINOP (el_ldiv, sparse_complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_complex&);
-
-  return octave_value
-    (x_el_div (v2.complex_value (), v1.sparse_complex_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_complex_matrix, complex, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_complex_matrix, complex, mx_el_or)
-
-DEFCATOP (scm_cs, sparse_complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_complex&);
-  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
-  return octave_value
-    (v1.sparse_complex_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFASSIGNOP (assign, sparse_complex_matrix, complex)
-{
-  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_complex&);
-
-  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
-  v1.assign (idx, tmp);
-  return octave_value ();
-}
-
-void
-install_scm_cs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_complex, add);
-  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_complex, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_complex, mul);
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_complex, div);
-  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_complex,
-                 ldiv);
-  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_complex, lt);
-  INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_complex, le);
-  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_complex, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_complex, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_complex, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_complex,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_complex,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_complex,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_complex,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_complex,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_complex,
-                 el_or);
-
-  INSTALL_CATOP (octave_sparse_complex_matrix, octave_complex, scm_cs);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_complex,
-                    assign);
-}
--- a/src/OPERATORS/op-scm-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-scm-m.h"
-#include "smx-m-scm.h"
-#include "ov-cx-sparse.h"
-
-// sparse complex matrix by matrix ops.
-
-DEFBINOP_OP (add, sparse_complex_matrix, matrix, +)
-DEFBINOP_OP (sub, sparse_complex_matrix, matrix, -)
-
-DEFBINOP_OP (mul, sparse_complex_matrix, matrix, *)
-
-DEFBINOP (div, sparse_complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
-                            v2.matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, sparse_complex_matrix, matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, sparse_complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      Complex d = v1.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v2.array_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-
-      ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (),
-                                    v2.matrix_value (), typ);
-
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_complex_matrix, matrix, mx_el_lt)
-DEFBINOP_FN (le, sparse_complex_matrix, matrix, mx_el_le)
-DEFBINOP_FN (eq, sparse_complex_matrix, matrix, mx_el_eq)
-DEFBINOP_FN (ge, sparse_complex_matrix, matrix, mx_el_ge)
-DEFBINOP_FN (gt, sparse_complex_matrix, matrix, mx_el_gt)
-DEFBINOP_FN (ne, sparse_complex_matrix, matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, sparse_complex_matrix, matrix, product)
-DEFBINOP_FN (el_div, sparse_complex_matrix, matrix, quotient)
-
-DEFBINOP (el_pow, sparse_complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_matrix&);
-
-  return octave_value
-    (elem_xpow (v1.sparse_complex_matrix_value (), SparseMatrix
-                (v2.matrix_value ())));
-}
-
-DEFBINOP (el_ldiv, sparse_complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_matrix&);
-
-  return octave_value
-    (quotient (v2.matrix_value (), v1.sparse_complex_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_complex_matrix, matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_complex_matrix, matrix, mx_el_or)
-
-DEFCATOP (scm_m, sparse_complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_matrix&);
-  SparseMatrix tmp (v2.matrix_value ());
-  return octave_value
-    (v1.sparse_complex_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFASSIGNOP (assign, sparse_complex_matrix, matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_matrix&);
-
-  SparseComplexMatrix tmp (v2.complex_matrix_value ());
-  v1.assign (idx, tmp);
-  return octave_value ();
-}
-
-void
-install_scm_m_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_matrix, add);
-  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_matrix, mul);
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_matrix, div);
-  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_matrix, lt);
-  INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_matrix, le);
-  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_matrix,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_matrix,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_matrix,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_matrix,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_sparse_complex_matrix, octave_matrix, scm_m);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_matrix,
-                    assign);
-}
--- a/src/OPERATORS/op-scm-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-cx-mat.h"
-#include "ov-scalar.h"
-#include "ops.h"
-#include "xpow.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-scm-s.h"
-#include "smx-s-scm.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-
-// sparse complex matrix by scalar ops.
-
-DEFBINOP_OP (add, sparse_complex_matrix, scalar, +)
-DEFBINOP_OP (sub, sparse_complex_matrix, scalar, -)
-DEFBINOP_OP (mul, sparse_complex_matrix, scalar, *)
-
-DEFBINOP (div, sparse_complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_scalar&);
-
-  double d = v2.double_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v1.sparse_complex_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP (pow, sparse_complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_scalar&);
-
-  double tmp = v2.scalar_value ();
-  if (static_cast<int> (tmp) == tmp)
-    return xpow (v1.sparse_complex_matrix_value (), tmp);
-  else
-    return xpow (v1.complex_matrix_value (), tmp);
-}
-
-DEFBINOP (ldiv, sparse_complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      Complex d = v1.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (SparseComplexMatrix (1, 1, v2.scalar_value () / d));
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-      SparseComplexMatrix m1 = v1.sparse_complex_matrix_value ();
-      Matrix m2 = Matrix (1, 1, v2.scalar_value ());
-      ComplexMatrix ret = xleftdiv (m1, m2, typ);
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_complex_matrix, scalar, mx_el_lt)
-DEFBINOP_FN (le, sparse_complex_matrix, scalar, mx_el_le)
-DEFBINOP_FN (eq, sparse_complex_matrix, scalar, mx_el_eq)
-DEFBINOP_FN (ge, sparse_complex_matrix, scalar, mx_el_ge)
-DEFBINOP_FN (gt, sparse_complex_matrix, scalar, mx_el_gt)
-DEFBINOP_FN (ne, sparse_complex_matrix, scalar, mx_el_ne)
-
-DEFBINOP_OP (el_mul, sparse_complex_matrix, scalar, *)
-
-DEFBINOP (el_div, sparse_complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_scalar&);
-
-  double d = v2.double_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v1.sparse_complex_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (el_pow, sparse_complex_matrix, scalar, elem_xpow)
-
-DEFBINOP (el_ldiv, sparse_complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&);
-
-  return octave_value
-    (x_el_div (v2.double_value (), v1.sparse_complex_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_complex_matrix, scalar, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_complex_matrix, scalar, mx_el_or)
-
-DEFCATOP (scm_s, sparse_complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_scalar&);
-  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
-  return octave_value
-    (v1.sparse_complex_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFASSIGNOP (assign, sparse_complex_matrix, scalar)
-{
-  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_scalar&);
-
-  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
-  v1.assign (idx, tmp);
-  return octave_value ();
-}
-
-void
-install_scm_s_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_scalar, add);
-  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_scalar, mul);
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_scalar, div);
-  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_scalar, ldiv);
-  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_scalar, lt);
-  INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_scalar, le);
-  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_scalar,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_scalar,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_scalar,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_scalar,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_scalar,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_scalar,
-                 el_or);
-
-  INSTALL_CATOP (octave_sparse_complex_matrix, octave_scalar, scm_s);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_scalar,
-                    assign);
-}
--- a/src/OPERATORS/op-scm-scm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-
-#include "sparse-xdiv.h"
-#include "sparse-xpow.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-// unary sparse complex matrix ops.
-
-DEFUNOP_OP (not, sparse_complex_matrix, !)
-DEFUNOP_OP (uplus, sparse_complex_matrix, /* no-op */)
-DEFUNOP_OP (uminus, sparse_complex_matrix, -)
-
-DEFUNOP (transpose, sparse_complex_matrix)
-{
-  CAST_UNOP_ARG (const octave_sparse_complex_matrix&);
-  return octave_value
-    (v.sparse_complex_matrix_value ().transpose (),
-     v.matrix_type ().transpose ());
-}
-
-DEFUNOP (hermitian, sparse_complex_matrix)
-{
-  CAST_UNOP_ARG (const octave_sparse_complex_matrix&);
-  return octave_value
-    (v.sparse_complex_matrix_value ().hermitian (),
-     v.matrix_type ().transpose ());
-}
-
-#if 0
-DEFUNOP (incr, sparse_complex_matrix)
-{
-  CAST_UNOP_ARG (const octave_sparse_complex_matrix&);
-
-  return octave_value (v.complex_matrix_value () .increment ());
-}
-
-DEFUNOP (decr, sparse_complex_matrix)
-{
-  CAST_UNOP_ARG (const octave_sparse_complex_matrix&);
-
-  return octave_value (v.complex_matrix_value () .decrement ());
-}
-#endif
-
-// complex matrix by complex matrix ops.
-
-DEFBINOP_OP (add, sparse_complex_matrix, sparse_complex_matrix, +)
-DEFBINOP_OP (sub, sparse_complex_matrix, sparse_complex_matrix, -)
-
-DEFBINOP_OP (mul, sparse_complex_matrix, sparse_complex_matrix, *)
-
-DEFBINOP (div, sparse_complex_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      Complex d = v2.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.sparse_complex_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (),
-                                      v2.sparse_complex_matrix_value (), typ);
-
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOPX (pow, sparse_complex_matrix, sparse_complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, sparse_complex_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      Complex d = v1.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v2.sparse_complex_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-
-      SparseComplexMatrix ret =
-        xleftdiv (v1.sparse_complex_matrix_value (),
-                  v2.sparse_complex_matrix_value (), typ);
-
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_complex_matrix, sparse_complex_matrix, mx_el_lt)
-DEFBINOP_FN (le, sparse_complex_matrix, sparse_complex_matrix, mx_el_le)
-DEFBINOP_FN (eq, sparse_complex_matrix, sparse_complex_matrix, mx_el_eq)
-DEFBINOP_FN (ge, sparse_complex_matrix, sparse_complex_matrix, mx_el_ge)
-DEFBINOP_FN (gt, sparse_complex_matrix, sparse_complex_matrix, mx_el_gt)
-DEFBINOP_FN (ne, sparse_complex_matrix, sparse_complex_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, sparse_complex_matrix, sparse_complex_matrix, product)
-DEFBINOP_FN (el_div, sparse_complex_matrix, sparse_complex_matrix, quotient)
-DEFBINOP_FN (el_pow, sparse_complex_matrix, sparse_complex_matrix, elem_xpow)
-
-DEFBINOP (el_ldiv, sparse_complex_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  return octave_value (quotient (v2.sparse_complex_matrix_value (),
-                                 v1.sparse_complex_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_complex_matrix, sparse_complex_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_complex_matrix, sparse_complex_matrix, mx_el_or)
-
-DEFCATOP_FN (scm_scm, sparse_complex_matrix, sparse_complex_matrix, concat)
-
-DEFASSIGNOP_FN (assign, sparse_complex_matrix, sparse_complex_matrix, assign)
-
-DEFNULLASSIGNOP_FN (null_assign, sparse_complex_matrix, delete_elements)
-
-void
-install_scm_scm_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_sparse_complex_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_sparse_complex_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_sparse_complex_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_sparse_complex_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_sparse_complex_matrix, hermitian);
-
-#if 0
-  INSTALL_NCUNOP (op_incr, octave_sparse_complex_matrix, incr);
-  INSTALL_NCUNOP (op_decr, octave_sparse_complex_matrix, decr);
-#endif
-
-  INSTALL_BINOP (op_add, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_sparse_complex_matrix,
-                 octave_sparse_complex_matrix, scm_scm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
-                    octave_sparse_complex_matrix, assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
-                    octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
-                    octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
-                    octave_null_sq_str, null_assign);
-}
--- a/src/OPERATORS/op-scm-sm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-#include "sparse-xdiv.h"
-#include "sparse-xpow.h"
-#include "smx-sm-scm.h"
-#include "smx-scm-sm.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-
-// sparse complex matrix by sparse matrix ops.
-
-DEFBINOP_OP (add, sparse_complex_matrix, sparse_matrix, +)
-DEFBINOP_OP (sub, sparse_complex_matrix, sparse_matrix, -)
-
-DEFBINOP_OP (mul, sparse_complex_matrix, sparse_matrix, *)
-
-DEFBINOP (div, sparse_complex_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.sparse_complex_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (),
-                                      v2.sparse_matrix_value (), typ);
-
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOPX (pow, sparse_complex_matrix, sparse_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, sparse_complex_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      Complex d = v1.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v2.sparse_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-
-      SparseComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (),
-                                          v2.sparse_matrix_value (), typ);
-
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_complex_matrix, sparse_matrix, mx_el_lt)
-DEFBINOP_FN (le, sparse_complex_matrix, sparse_matrix, mx_el_le)
-DEFBINOP_FN (eq, sparse_complex_matrix, sparse_matrix, mx_el_eq)
-DEFBINOP_FN (ge, sparse_complex_matrix, sparse_matrix, mx_el_ge)
-DEFBINOP_FN (gt, sparse_complex_matrix, sparse_matrix, mx_el_gt)
-DEFBINOP_FN (ne, sparse_complex_matrix, sparse_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, sparse_complex_matrix, sparse_matrix, product)
-DEFBINOP_FN (el_div, sparse_complex_matrix, sparse_matrix, quotient)
-DEFBINOP_FN (el_pow, sparse_complex_matrix, sparse_matrix, elem_xpow)
-
-DEFBINOP (el_ldiv, sparse_complex_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
-                   const octave_sparse_matrix&);
-
-  return octave_value
-    (quotient (v2.sparse_matrix_value (), v1.sparse_complex_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_complex_matrix, sparse_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_complex_matrix, sparse_matrix, mx_el_or)
-
-DEFCATOP_FN (scm_sm, sparse_complex_matrix, sparse_matrix, concat)
-
-DEFASSIGNOP_FN (assign, sparse_complex_matrix, sparse_matrix, assign)
-
-void
-install_scm_sm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 add);
-  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 sub);
-  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 mul);
-  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 div);
-  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 ldiv);
-  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 lt);
-  INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 le);
-  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 eq);
-  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 ge);
-  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 gt);
-  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_sparse_matrix,
-                 ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix,
-                 octave_sparse_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix,
-                 octave_sparse_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix,
-                 octave_sparse_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix,
-                 octave_sparse_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix,
-                 octave_sparse_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix,
-                 octave_sparse_matrix, el_or);
-
-  INSTALL_CATOP (octave_sparse_complex_matrix, octave_sparse_matrix, scm_sm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
-                    octave_sparse_matrix, assign);
-}
--- a/src/OPERATORS/op-sm-cm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-cx-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-sm-cm.h"
-#include "smx-cm-sm.h"
-#include "ov-re-sparse.h"
-
-// sparse matrix by complex matrix ops.
-
-DEFBINOP_OP (add, sparse_matrix, complex_matrix, +)
-DEFBINOP_OP (sub, sparse_matrix, complex_matrix, -)
-
-DEFBINOP_OP (mul, sparse_matrix, complex_matrix, *)
-
-DEFBINOP (div, sparse_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&,
-                   const octave_complex_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  ComplexMatrix ret = xdiv (v1.matrix_value (),
-                            v2.complex_matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, sparse_matrix, complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, sparse_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      double d = v1.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v2.complex_array_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-
-      ComplexMatrix ret = xleftdiv (v1.sparse_matrix_value (),
-                                    v2.complex_matrix_value (), typ);
-
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_matrix, complex_matrix, mx_el_lt)
-DEFBINOP_FN (le, sparse_matrix, complex_matrix, mx_el_le)
-DEFBINOP_FN (eq, sparse_matrix, complex_matrix, mx_el_eq)
-DEFBINOP_FN (ge, sparse_matrix, complex_matrix, mx_el_ge)
-DEFBINOP_FN (gt, sparse_matrix, complex_matrix, mx_el_gt)
-DEFBINOP_FN (ne, sparse_matrix, complex_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, sparse_matrix, complex_matrix, product)
-DEFBINOP_FN (el_div, sparse_matrix, complex_matrix, quotient)
-
-DEFBINOP (el_pow, sparse_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&,
-                   const octave_complex_matrix&);
-
-  return octave_value
-    (elem_xpow (v1.sparse_matrix_value (), SparseComplexMatrix
-                (v2.complex_matrix_value ())));
-}
-
-DEFBINOP (el_ldiv, sparse_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&,
-                   const octave_complex_matrix&);
-
-  return octave_value
-    (quotient (v2.complex_matrix_value (), v1.sparse_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_matrix, complex_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_matrix, complex_matrix, mx_el_or)
-
-DEFCATOP (sm_cm, sparse_matrix, complex_matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_complex_matrix&);
-  SparseComplexMatrix tmp (v2.complex_matrix_value ());
-  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFCONV (sparse_complex_matrix_conv, sparse_matrix, sparse_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_sparse_matrix&);
-  return new octave_complex_matrix (v.complex_matrix_value ());
-}
-
-void
-install_sm_cm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_complex_matrix, add);
-  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_complex_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_complex_matrix, mul);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_complex_matrix, div);
-  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_complex_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_complex_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_complex_matrix, lt);
-  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_complex_matrix, le);
-  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_complex_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_complex_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_complex_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_complex_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_complex_matrix,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_complex_matrix,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_complex_matrix,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_complex_matrix,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_complex_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_complex_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_sparse_matrix, octave_complex_matrix, sm_cm);
-
-  INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_complex_matrix,
-                      octave_sparse_complex_matrix);
-
-  INSTALL_WIDENOP (octave_sparse_matrix, octave_complex_matrix,
-                   sparse_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-sm-cs.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-complex.h"
-#include "ops.h"
-#include "xpow.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-#include "smx-sm-cs.h"
-#include "smx-cs-sm.h"
-
-// sparse matrix by scalar ops.
-
-DEFBINOP_OP (add, sparse_matrix, complex, +)
-DEFBINOP_OP (sub, sparse_matrix, complex, -)
-DEFBINOP_OP (mul, sparse_matrix, complex, *)
-
-DEFBINOP (div, sparse_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v1.sparse_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP (pow, sparse_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
-  return xpow (v1.matrix_value (), v2.complex_value ());
-}
-
-DEFBINOP (ldiv, sparse_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      double d = v1.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (SparseComplexMatrix (1, 1, v2.complex_value () / d));
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-      SparseMatrix m1 = v1.sparse_matrix_value ();
-      ComplexMatrix m2 = ComplexMatrix (1, 1, v2.complex_value ());
-      ComplexMatrix ret = xleftdiv (m1, m2, typ);
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_matrix, complex, mx_el_lt)
-DEFBINOP_FN (le, sparse_matrix, complex, mx_el_le)
-DEFBINOP_FN (eq, sparse_matrix, complex, mx_el_eq)
-DEFBINOP_FN (ge, sparse_matrix, complex, mx_el_ge)
-DEFBINOP_FN (gt, sparse_matrix, complex, mx_el_gt)
-DEFBINOP_FN (ne, sparse_matrix, complex, mx_el_ne)
-
-DEFBINOP_OP (el_mul, sparse_matrix, complex, *)
-
-DEFBINOP (el_div, sparse_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
-
-  Complex d = v2.complex_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v1.sparse_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (el_pow, sparse_matrix, complex, elem_xpow)
-
-DEFBINOP (el_ldiv, sparse_matrix, complex)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
-
-  return octave_value (x_el_div (v2.complex_value (),
-                                 v1.sparse_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_matrix, complex, mx_el_and)
-DEFBINOP_FN (el_or, sparse_matrix, complex, mx_el_or)
-
-DEFCATOP (sm_cs, sparse_matrix, complex)
-{
-  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_complex&);
-  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
-  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
-}
-
-void
-install_sm_cs_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_complex, add);
-  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_complex, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_complex, mul);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_complex, div);
-  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_complex, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_complex, ldiv);
-
-  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_complex, lt);
-  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_complex, le);
-  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_complex, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_complex, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_complex, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_complex, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_complex, el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_complex, el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_complex, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_complex, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_complex, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_complex, el_or);
-
-  INSTALL_CATOP (octave_sparse_matrix, octave_complex, sm_cs);
-
-  INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_complex,
-                      octave_sparse_complex_matrix);
-}
--- a/src/OPERATORS/op-sm-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-re-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "smx-sm-m.h"
-#include "smx-m-sm.h"
-#include "ov-re-sparse.h"
-
-// sparse matrix by matrix ops.
-
-DEFBINOP_OP (add, sparse_matrix, matrix, +)
-DEFBINOP_OP (sub, sparse_matrix, matrix, -)
-
-DEFBINOP_OP (mul, sparse_matrix, matrix, *)
-
-DEFBINOP (div, sparse_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
-  MatrixType typ = v2.matrix_type ();
-
-  Matrix ret = xdiv (v1.matrix_value (), v2.matrix_value (), typ);
-
-  v2.matrix_type (typ);
-  return ret;
-}
-
-DEFBINOPX (pow, sparse_matrix, matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, sparse_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      double d = v1.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v2.array_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-
-      Matrix ret = xleftdiv (v1.sparse_matrix_value (),
-                             v2.matrix_value (), typ);
-
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (trans_mul, sparse_matrix, matrix, trans_mul);
-
-DEFBINOP_FN (lt, sparse_matrix, matrix, mx_el_lt)
-DEFBINOP_FN (le, sparse_matrix, matrix, mx_el_le)
-DEFBINOP_FN (eq, sparse_matrix, matrix, mx_el_eq)
-DEFBINOP_FN (ge, sparse_matrix, matrix, mx_el_ge)
-DEFBINOP_FN (gt, sparse_matrix, matrix, mx_el_gt)
-DEFBINOP_FN (ne, sparse_matrix, matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, sparse_matrix, matrix, product)
-DEFBINOP_FN (el_div, sparse_matrix, matrix, quotient)
-
-DEFBINOP (el_pow, sparse_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
-
-  return octave_value (elem_xpow (v1.sparse_matrix_value (),
-                                  SparseMatrix (v2.matrix_value ())));
-}
-
-DEFBINOP (el_ldiv, sparse_matrix, matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
-
-  return octave_value
-    (quotient (v2.matrix_value (), v1.sparse_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_matrix, matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_matrix, matrix, mx_el_or)
-
-DEFCATOP (sm_m, sparse_matrix, matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_matrix&);
-  SparseMatrix tmp (v2.matrix_value ());
-  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFASSIGNOP (assign, sparse_matrix, matrix)
-{
-  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_matrix&);
-
-  SparseMatrix tmp (v2.matrix_value ());
-  v1.assign (idx, tmp);
-  return octave_value ();
-}
-
-void
-install_sm_m_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_matrix, add);
-  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_matrix, mul);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_matrix, div);
-  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_matrix, ldiv);
-  INSTALL_BINOP (op_trans_mul, octave_sparse_matrix, octave_matrix, trans_mul);
-  INSTALL_BINOP (op_herm_mul, octave_sparse_matrix, octave_matrix, trans_mul);
-  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_matrix, lt);
-  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_matrix, le);
-  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_matrix,  el_or);
-
-  INSTALL_CATOP (octave_sparse_matrix, octave_matrix, sm_m);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_matrix, assign);
-}
--- a/src/OPERATORS/op-sm-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-scalar.h"
-#include "ops.h"
-#include "xpow.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "ov-re-sparse.h"
-
-// sparse matrix by scalar ops.
-
-DEFBINOP_OP (add, sparse_matrix, scalar, +)
-DEFBINOP_OP (sub, sparse_matrix, scalar, -)
-DEFBINOP_OP (mul, sparse_matrix, scalar, *)
-
-DEFBINOP (div, sparse_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
-
-  double d = v2.double_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v1.sparse_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP (pow, sparse_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
-
-  double tmp = v2.scalar_value ();
-  if (static_cast<int> (tmp) == tmp)
-    return xpow (v1.sparse_matrix_value (), tmp);
-  else
-    return xpow (v1.matrix_value (), tmp);
-}
-
-DEFBINOP (ldiv, sparse_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      double d = v1.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (SparseMatrix(1, 1, v2.scalar_value () / d));
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-      SparseMatrix m1 = v1.sparse_matrix_value ();
-      Matrix m2 = Matrix (1, 1, v2.scalar_value ());
-      Matrix ret = xleftdiv (m1, m2, typ);
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_matrix, scalar, mx_el_lt)
-DEFBINOP_FN (le, sparse_matrix, scalar, mx_el_le)
-DEFBINOP_FN (eq, sparse_matrix, scalar, mx_el_eq)
-DEFBINOP_FN (ge, sparse_matrix, scalar, mx_el_ge)
-DEFBINOP_FN (gt, sparse_matrix, scalar, mx_el_gt)
-DEFBINOP_FN (ne, sparse_matrix, scalar, mx_el_ne)
-
-DEFBINOP_OP (el_mul, sparse_matrix, scalar, *)
-
-DEFBINOP (el_div, sparse_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
-
-  double d = v2.double_value ();
-  octave_value retval;
-
-  if (d == 0.0)
-    gripe_divide_by_zero ();
-
-  retval = octave_value (v1.sparse_matrix_value () / d);
-
-  return retval;
-}
-
-DEFBINOP_FN (el_pow, sparse_matrix, scalar, elem_xpow)
-
-DEFBINOP (el_ldiv, sparse_matrix, scalar)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
-
-  return octave_value
-    (x_el_div (v2.complex_value (), v1.sparse_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_matrix, scalar, mx_el_and)
-DEFBINOP_FN (el_or, sparse_matrix, scalar, mx_el_or)
-
-DEFCATOP (sm_s, sparse_matrix, scalar)
-{
-  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_scalar&);
-  SparseMatrix tmp (1, 1, v2.scalar_value ());
-  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
-}
-
-DEFASSIGNOP (assign, sparse_matrix, scalar)
-{
-  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_scalar&);
-
-  SparseMatrix tmp (1, 1, v2.scalar_value ());
-  v1.assign (idx, tmp);
-  return octave_value ();
-}
-
-void
-install_sm_s_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_scalar, add);
-  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_scalar, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_scalar, mul);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_scalar, div);
-  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_scalar, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_scalar, ldiv);
-
-  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_scalar, lt);
-  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_scalar, le);
-  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_scalar, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_scalar, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_scalar, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_scalar, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_scalar, el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_scalar, el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_scalar, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_scalar, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_scalar, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_scalar, el_or);
-
-  INSTALL_CATOP (octave_sparse_matrix, octave_scalar, sm_s);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_scalar, assign);
-}
--- a/src/OPERATORS/op-sm-scm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-#include "sparse-xdiv.h"
-#include "sparse-xpow.h"
-#include "smx-sm-scm.h"
-#include "smx-scm-sm.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-
-// sparse matrix by sparse complex matrix ops.
-
-DEFBINOP_OP (add, sparse_matrix, sparse_complex_matrix, +)
-DEFBINOP_OP (sub, sparse_matrix, sparse_complex_matrix, -)
-
-DEFBINOP_OP (mul, sparse_matrix, sparse_complex_matrix, *)
-
-DEFBINOP (div, sparse_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      Complex d = v2.complex_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.sparse_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      SparseComplexMatrix ret = xdiv (v1.sparse_matrix_value (),
-                                  v2.sparse_complex_matrix_value (), typ);
-
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOPX (pow, sparse_matrix, sparse_complex_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, sparse_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      double d = v1.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v2.sparse_complex_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-
-      SparseComplexMatrix ret =
-        xleftdiv (v1.sparse_matrix_value (),
-                  v2.sparse_complex_matrix_value (), typ);
-
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_matrix, sparse_complex_matrix, mx_el_lt)
-DEFBINOP_FN (le, sparse_matrix, sparse_complex_matrix, mx_el_le)
-DEFBINOP_FN (eq, sparse_matrix, sparse_complex_matrix, mx_el_eq)
-DEFBINOP_FN (ge, sparse_matrix, sparse_complex_matrix, mx_el_ge)
-DEFBINOP_FN (gt, sparse_matrix, sparse_complex_matrix, mx_el_gt)
-DEFBINOP_FN (ne, sparse_matrix, sparse_complex_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, sparse_matrix, sparse_complex_matrix, product)
-DEFBINOP_FN (el_div, sparse_matrix, sparse_complex_matrix, quotient)
-DEFBINOP_FN (el_pow, sparse_matrix, sparse_complex_matrix, elem_xpow)
-
-DEFBINOP (el_ldiv, sparse_matrix, sparse_complex_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&,
-                   const octave_sparse_complex_matrix&);
-
-  return octave_value
-    (quotient (v2.sparse_complex_matrix_value (), v1.sparse_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_matrix, sparse_complex_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_matrix, sparse_complex_matrix, mx_el_or)
-
-DEFCATOP_FN (sm_scm, sparse_matrix, sparse_complex_matrix, concat)
-
-DEFCONV (sparse_complex_matrix_conv, sparse_matrix, sparse_complex_matrix)
-{
-  CAST_CONV_ARG (const octave_sparse_matrix&);
-  return new octave_sparse_complex_matrix (v.sparse_complex_matrix_value ());
-}
-
-void
-install_sm_scm_ops (void)
-{
-  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 add);
-  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 sub);
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 mul);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 div);
-  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 ldiv);
-  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 lt);
-  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 le);
-  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 eq);
-  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 ge);
-  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 gt);
-  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_complex_matrix,
-                 ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_matrix,
-                 octave_sparse_complex_matrix, el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_matrix,
-                 octave_sparse_complex_matrix, el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_matrix,
-                 octave_sparse_complex_matrix, el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix,
-                 octave_sparse_complex_matrix, el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_matrix,
-                 octave_sparse_complex_matrix, el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_matrix,
-                 octave_sparse_complex_matrix, el_or);
-
-  INSTALL_CATOP (octave_sparse_matrix, octave_sparse_complex_matrix, sm_scm);
-
-  INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_sparse_complex_matrix,
-                      octave_sparse_complex_matrix);
-
-  INSTALL_WIDENOP (octave_sparse_matrix, octave_sparse_complex_matrix,
-                   sparse_complex_matrix_conv);
-}
--- a/src/OPERATORS/op-sm-sm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-typeinfo.h"
-#include "ov-re-mat.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-
-#include "sparse-xpow.h"
-#include "sparse-xdiv.h"
-#include "ov-re-sparse.h"
-
-// sparse matrix unary ops.
-
-DEFUNOP_OP (not, sparse_matrix, !)
-DEFUNOP_OP (uplus, sparse_matrix, /* no-op */)
-DEFUNOP_OP (uminus, sparse_matrix, -)
-
-DEFUNOP (transpose, sparse_matrix)
-{
-  CAST_UNOP_ARG (const octave_sparse_matrix&);
-  return octave_value (v.sparse_matrix_value ().transpose (),
-                       v.matrix_type ().transpose ());
-}
-
-// sparse matrix by sparse matrix ops.
-
-DEFBINOP_OP (add, sparse_matrix, sparse_matrix, +)
-
-// DEFBINOP_OP (sub, sparse_matrix, sparse_matrix, -)
-
-  static octave_value
-  oct_binop_sub (const octave_base_value& a1, const octave_base_value& a2)
-  {
-    const octave_sparse_matrix& v1 = dynamic_cast<const octave_sparse_matrix&> (a1);
-    const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2);
-    SparseMatrix m = v1.sparse_matrix_value () - v2.sparse_matrix_value ();
-
-    return octave_value (m);
-  }
-
-DEFBINOP_OP (mul, sparse_matrix, sparse_matrix, *)
-
-DEFBINOP (div, sparse_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
-
-  if (v2.rows () == 1 && v2.columns () == 1)
-    {
-      double d = v2.scalar_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v1.sparse_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v2.matrix_type ();
-      SparseMatrix ret = xdiv (v1.sparse_matrix_value (),
-                               v2.sparse_matrix_value (), typ);
-
-      v2.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOPX (pow, sparse_matrix, sparse_matrix)
-{
-  error ("can't do A ^ B for A and B both matrices");
-  return octave_value ();
-}
-
-DEFBINOP (ldiv, sparse_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
-
-  if (v1.rows () == 1 && v1.columns () == 1)
-    {
-      double d = v1.double_value ();
-
-      if (d == 0.0)
-        gripe_divide_by_zero ();
-
-      return octave_value (v2.sparse_matrix_value () / d);
-    }
-  else
-    {
-      MatrixType typ = v1.matrix_type ();
-
-      SparseMatrix ret = xleftdiv (v1.sparse_matrix_value (),
-                                   v2.sparse_matrix_value (), typ);
-
-      v1.matrix_type (typ);
-      return ret;
-    }
-}
-
-DEFBINOP_FN (lt, sparse_matrix, sparse_matrix, mx_el_lt)
-DEFBINOP_FN (le, sparse_matrix, sparse_matrix, mx_el_le)
-DEFBINOP_FN (eq, sparse_matrix, sparse_matrix, mx_el_eq)
-DEFBINOP_FN (ge, sparse_matrix, sparse_matrix, mx_el_ge)
-DEFBINOP_FN (gt, sparse_matrix, sparse_matrix, mx_el_gt)
-DEFBINOP_FN (ne, sparse_matrix, sparse_matrix, mx_el_ne)
-
-DEFBINOP_FN (el_mul, sparse_matrix, sparse_matrix, product)
-DEFBINOP_FN (el_div, sparse_matrix, sparse_matrix, quotient)
-
-DEFBINOP_FN (el_pow, sparse_matrix, sparse_matrix, elem_xpow)
-
-DEFBINOP (el_ldiv, sparse_matrix, sparse_matrix)
-{
-  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
-  return octave_value
-    (quotient (v2.sparse_matrix_value (), v1.sparse_matrix_value ()));
-}
-
-DEFBINOP_FN (el_and, sparse_matrix, sparse_matrix, mx_el_and)
-DEFBINOP_FN (el_or,  sparse_matrix, sparse_matrix, mx_el_or)
-
-DEFCATOP_FN (sm_sm, sparse_matrix, sparse_matrix, concat)
-
-DEFASSIGNOP_FN (assign, sparse_matrix, sparse_matrix, assign)
-
-DEFNULLASSIGNOP_FN (null_assign, sparse_matrix, delete_elements)
-
-void
-install_sm_sm_ops (void)
-{
-  INSTALL_UNOP (op_not, octave_sparse_matrix, not);
-  INSTALL_UNOP (op_uplus, octave_sparse_matrix, uplus);
-  INSTALL_UNOP (op_uminus, octave_sparse_matrix, uminus);
-  INSTALL_UNOP (op_transpose, octave_sparse_matrix, transpose);
-  INSTALL_UNOP (op_hermitian, octave_sparse_matrix, transpose);
-
-  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_sparse_matrix, add);
-  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_sparse_matrix, sub);
-  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_sparse_matrix, mul);
-  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_sparse_matrix, div);
-  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_sparse_matrix, pow);
-  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_sparse_matrix, ldiv);
-  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_sparse_matrix, lt);
-  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_sparse_matrix, le);
-  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_sparse_matrix, eq);
-  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_matrix, ge);
-  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_matrix, gt);
-  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_matrix, ne);
-  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_sparse_matrix,
-                 el_mul);
-  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_sparse_matrix,
-                 el_div);
-  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_sparse_matrix,
-                 el_pow);
-  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_sparse_matrix,
-                 el_ldiv);
-  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_sparse_matrix,
-                 el_and);
-  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_sparse_matrix,
-                 el_or);
-
-  INSTALL_CATOP (octave_sparse_matrix, octave_sparse_matrix, sm_sm);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_sparse_matrix,
-                    assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_null_sq_str, null_assign);
-}
--- a/src/OPERATORS/op-str-m.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-
-Copyright (C) 2003-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-str-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-DEFASSIGNOP (assign, char_matrix_str, octave_matrix)
-{
-  CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_matrix&);
-
-  octave_value tmp
-    = v2.convert_to_str_internal (false, false,
-                                  a1.is_sq_string () ? '\'' : '"');
-
-  if (! error_state)
-    v1.assign (idx, tmp.char_array_value ());
-
-  return octave_value ();
-}
-
-DEFNDCHARCATOP_FN (str_m, char_matrix_str, matrix, concat)
-
-DEFNDCHARCATOP_FN (m_str, matrix, char_matrix_str, concat)
-
-void
-install_str_m_ops (void)
-{
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_matrix, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_matrix, assign);
-
-  INSTALL_CATOP (octave_char_matrix_str, octave_matrix, str_m);
-  INSTALL_CATOP (octave_char_matrix_sq_str, octave_matrix, str_m);
-
-  INSTALL_CATOP (octave_matrix, octave_char_matrix_str, m_str);
-  INSTALL_CATOP (octave_matrix, octave_char_matrix_sq_str, m_str);
-}
--- a/src/OPERATORS/op-str-s.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
-
-Copyright (C) 2003-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-scalar.h"
-#include "ov-str-mat.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-DEFASSIGNOP (assign, char_matrix_str, octave_scalar)
-{
-  CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_scalar&);
-
-  octave_value tmp
-    = v2.convert_to_str_internal (false, false,
-                                  a1.is_sq_string () ? '\'' : '"');
-
-  if (! error_state)
-    v1.assign (idx, tmp.char_array_value ());
-
-  return octave_value ();
-}
-
-DEFNDCHARCATOP_FN (str_s, char_matrix_str, scalar, concat)
-
-DEFNDCHARCATOP_FN (s_str, scalar, char_matrix_str, concat)
-
-void
-install_str_s_ops (void)
-{
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_scalar, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_scalar, assign);
-
-  INSTALL_CATOP (octave_char_matrix_str, octave_scalar, str_s);
-  INSTALL_CATOP (octave_char_matrix_sq_str, octave_scalar, str_s);
-
-  INSTALL_CATOP (octave_scalar, octave_char_matrix_str, s_str);
-  INSTALL_CATOP (octave_scalar, octave_char_matrix_sq_str, s_str);
-}
--- a/src/OPERATORS/op-str-str.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-str-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-
-// string unary ops.
-
-DEFUNOP (transpose, char_matrix_str)
-{
-  CAST_UNOP_ARG (const octave_char_matrix_str&);
-
-  if (v.ndims () > 2)
-    {
-      error ("transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.char_matrix_value ().transpose (),
-                         a.is_sq_string () ? '\'' : '"');
-}
-
-// string by string ops.
-
-#define DEFCHARNDBINOP_FN(name, op, t1, t2, e1, e2, f)  \
-  BINOPDECL (name, a1, a2) \
-  { \
-    dim_vector a1_dims = a1.dims (); \
-    dim_vector a2_dims = a2.dims (); \
- \
-    bool a1_is_scalar = a1_dims.all_ones (); \
-    bool a2_is_scalar = a2_dims.all_ones (); \
- \
-    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
- \
-    if (a1_is_scalar) \
-      { \
-        if (a2_is_scalar) \
-          return octave_value ((v1.e1 ## _value ())(0) op (v2.e2 ## _value ())(0)); \
-        else \
-          return octave_value (f ((v1.e1 ## _value ())(0), v2.e2 ## _value ())); \
-      } \
-    else \
-      { \
-        if (a2_is_scalar) \
-          return octave_value (f (v1.e1 ## _value (), (v2.e2 ## _value ())(0))); \
-        else \
-          return octave_value (f (v1.e1 ## _value (), v2.e2 ## _value ())); \
-      } \
-  }
-
-DEFCHARNDBINOP_FN (lt, <, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_lt)
-DEFCHARNDBINOP_FN (le, <=, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_le)
-DEFCHARNDBINOP_FN (eq, ==, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_eq)
-DEFCHARNDBINOP_FN (ge, >=, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_ge)
-DEFCHARNDBINOP_FN (gt, >, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_gt)
-DEFCHARNDBINOP_FN (ne, !=, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_ne)
-
-DEFASSIGNOP (assign, char_matrix_str, char_matrix_str)
-{
-  CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_char_matrix_str&);
-
-  v1.assign (idx, v2.char_array_value ());
-  return octave_value ();
-}
-
-DEFNULLASSIGNOP_FN (null_assign, char_matrix_str, delete_elements)
-
-DEFNDCHARCATOP_FN (str_str, char_matrix_str, char_matrix_str, concat)
-
-void
-install_str_str_ops (void)
-{
-  INSTALL_UNOP (op_transpose, octave_char_matrix_str, transpose);
-  INSTALL_UNOP (op_transpose, octave_char_matrix_sq_str, transpose);
-
-  INSTALL_UNOP (op_hermitian, octave_char_matrix_str, transpose);
-  INSTALL_UNOP (op_hermitian, octave_char_matrix_sq_str, transpose);
-
-  INSTALL_BINOP (op_lt, octave_char_matrix_str, octave_char_matrix_str, lt);
-  INSTALL_BINOP (op_lt, octave_char_matrix_str, octave_char_matrix_sq_str, lt);
-  INSTALL_BINOP (op_lt, octave_char_matrix_sq_str, octave_char_matrix_str, lt);
-  INSTALL_BINOP (op_lt, octave_char_matrix_sq_str, octave_char_matrix_sq_str, lt);
-
-  INSTALL_BINOP (op_le, octave_char_matrix_str, octave_char_matrix_str, le);
-  INSTALL_BINOP (op_le, octave_char_matrix_str, octave_char_matrix_sq_str, le);
-  INSTALL_BINOP (op_le, octave_char_matrix_sq_str, octave_char_matrix_str, le);
-  INSTALL_BINOP (op_le, octave_char_matrix_sq_str, octave_char_matrix_sq_str, le);
-
-  INSTALL_BINOP (op_eq, octave_char_matrix_str, octave_char_matrix_str, eq);
-  INSTALL_BINOP (op_eq, octave_char_matrix_str, octave_char_matrix_sq_str, eq);
-  INSTALL_BINOP (op_eq, octave_char_matrix_sq_str, octave_char_matrix_str, eq);
-  INSTALL_BINOP (op_eq, octave_char_matrix_sq_str, octave_char_matrix_sq_str, eq);
-
-  INSTALL_BINOP (op_ge, octave_char_matrix_str, octave_char_matrix_str, ge);
-  INSTALL_BINOP (op_ge, octave_char_matrix_str, octave_char_matrix_sq_str, ge);
-  INSTALL_BINOP (op_ge, octave_char_matrix_sq_str, octave_char_matrix_str, ge);
-  INSTALL_BINOP (op_ge, octave_char_matrix_sq_str, octave_char_matrix_sq_str, ge);
-
-  INSTALL_BINOP (op_gt, octave_char_matrix_str, octave_char_matrix_str, gt);
-  INSTALL_BINOP (op_gt, octave_char_matrix_str, octave_char_matrix_sq_str, gt);
-  INSTALL_BINOP (op_gt, octave_char_matrix_sq_str, octave_char_matrix_str, gt);
-  INSTALL_BINOP (op_gt, octave_char_matrix_sq_str, octave_char_matrix_sq_str, gt);
-
-  INSTALL_BINOP (op_ne, octave_char_matrix_str, octave_char_matrix_str, ne);
-  INSTALL_BINOP (op_ne, octave_char_matrix_str, octave_char_matrix_sq_str, ne);
-  INSTALL_BINOP (op_ne, octave_char_matrix_sq_str, octave_char_matrix_str, ne);
-  INSTALL_BINOP (op_ne, octave_char_matrix_sq_str, octave_char_matrix_sq_str, ne);
-
-  INSTALL_CATOP (octave_char_matrix_str, octave_char_matrix_str, str_str);
-  INSTALL_CATOP (octave_char_matrix_str, octave_char_matrix_sq_str, str_str);
-  INSTALL_CATOP (octave_char_matrix_sq_str, octave_char_matrix_str, str_str);
-  INSTALL_CATOP (octave_char_matrix_sq_str, octave_char_matrix_sq_str, str_str);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_char_matrix_str, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_char_matrix_sq_str, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_char_matrix_str, assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_char_matrix_sq_str, assign);
-
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_null_sq_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_null_matrix, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_null_str, null_assign);
-  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_null_sq_str, null_assign);
-
-}
--- a/src/OPERATORS/op-struct.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-struct.h"
-#include "ov-typeinfo.h"
-#include "ops.h"
-
-// struct ops.
-
-DEFUNOP (transpose, struct)
-{
-  CAST_UNOP_ARG (const octave_struct&);
-
-  if (v.ndims () > 2)
-    {
-      error ("transpose not defined for N-d objects");
-      return octave_value ();
-    }
-  else
-    return octave_value (v.map_value ().transpose ());
-}
-
-DEFUNOP (scalar_transpose, scalar_struct)
-{
-  CAST_UNOP_ARG (const octave_scalar_struct&);
-
-  return octave_value (v.scalar_map_value ());
-}
-
-DEFNDCATOP_FN (s_s_concat, struct, struct, map, map, concat)
-DEFNDCATOP_FN (s_ss_concat, struct, scalar_struct, map, map, concat)
-DEFNDCATOP_FN (ss_s_concat, scalar_struct, struct, map, map, concat)
-DEFNDCATOP_FN (ss_ss_concat, scalar_struct, scalar_struct, map, map, concat)
-
-static octave_value
-oct_catop_struct_matrix (octave_base_value& a1, const octave_base_value& a2,
-                         const Array<octave_idx_type>&)
-{
-  octave_value retval;
-  CAST_BINOP_ARGS (const octave_struct&, const octave_matrix&);
-  NDArray tmp = v2.array_value ();
-  dim_vector dv = tmp.dims ();
-  if (dv.all_zero ())
-    retval = octave_value (v1.map_value ());
-  else
-    error ("invalid concatenation of structure with matrix");
-  return retval;
-}
-
-static octave_value
-oct_catop_matrix_struct (octave_base_value& a1, const octave_base_value& a2,
-                         const Array<octave_idx_type>&)
-{
-  octave_value retval;
-  CAST_BINOP_ARGS (const octave_matrix&, const octave_struct&);
-  NDArray tmp = v1.array_value ();
-  dim_vector dv = tmp.dims ();
-  if (dv.all_zero ())
-    retval = octave_value (v2.map_value ());
-  else
-    error ("invalid concatenation of structure with matrix");
-  return retval;
-}
-
-void
-install_struct_ops (void)
-{
-  INSTALL_UNOP (op_transpose, octave_struct, transpose);
-  INSTALL_UNOP (op_hermitian, octave_struct, transpose);
-
-  INSTALL_UNOP (op_transpose, octave_scalar_struct, scalar_transpose);
-  INSTALL_UNOP (op_hermitian, octave_scalar_struct, scalar_transpose);
-
-  INSTALL_CATOP (octave_struct, octave_struct, s_s_concat);
-  INSTALL_CATOP (octave_struct, octave_scalar_struct, s_ss_concat)
-  INSTALL_CATOP (octave_scalar_struct, octave_struct, ss_s_concat)
-  INSTALL_CATOP (octave_scalar_struct, octave_scalar_struct, ss_ss_concat)
-
-  INSTALL_CATOP (octave_struct, octave_matrix, struct_matrix);
-  INSTALL_CATOP (octave_matrix, octave_struct, matrix_struct);
-}
--- a/src/OPERATORS/op-ui16-ui16.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-ui16nda-i8.h"
-#include "mx-ui16nda-ui8.h"
-#include "mx-ui16nda-i16.h"
-#include "mx-ui16nda-i32.h"
-#include "mx-ui16nda-ui32.h"
-#include "mx-ui16nda-i64.h"
-#include "mx-ui16nda-ui64.h"
-
-#include "mx-ui16nda-i8nda.h"
-#include "mx-ui16nda-ui8nda.h"
-#include "mx-ui16nda-i16nda.h"
-#include "mx-ui16nda-i32nda.h"
-#include "mx-ui16nda-ui32nda.h"
-#include "mx-ui16nda-i64nda.h"
-#include "mx-ui16nda-ui64nda.h"
-
-#include "mx-ui16-i8nda.h"
-#include "mx-ui16-ui8nda.h"
-#include "mx-ui16-i16nda.h"
-#include "mx-ui16-i32nda.h"
-#include "mx-ui16-ui32nda.h"
-#include "mx-ui16-i64nda.h"
-#include "mx-ui16-ui64nda.h"
-
-#include "mx-ui16nda-s.h"
-#include "mx-s-ui16nda.h"
-
-#include "mx-ui16nda-nda.h"
-#include "mx-nda-ui16nda.h"
-
-#include "mx-ui16-nda.h"
-#include "mx-nda-ui16.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-int8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-uint8.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#include "op-int.h"
-
-OCTAVE_INT_OPS (uint16)
-
-OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint16_, int8_, int8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint16_, uint8_, uint8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint16_, int16_, int16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint16_, int32_, int32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint16_, uint32_, uint32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint16_, int64_, int64_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint16_, uint64_, uint64_)
-
-OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint16_, int8_, int8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint16_, uint8_, uint8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint16_, int16_, int16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint16_, int32_, int32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint16_, uint32_, uint32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint16_, int64_, int64_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint16_, uint64_, uint64_)
-
-OCTAVE_MIXED_INT_CMP_OPS (uint16, int8)
-OCTAVE_MIXED_INT_CMP_OPS (uint16, uint8)
-OCTAVE_MIXED_INT_CMP_OPS (uint16, int16)
-OCTAVE_MIXED_INT_CMP_OPS (uint16, int32)
-OCTAVE_MIXED_INT_CMP_OPS (uint16, uint32)
-OCTAVE_MIXED_INT_CMP_OPS (uint16, int64)
-OCTAVE_MIXED_INT_CMP_OPS (uint16, uint64)
-
-void
-install_ui16_ui16_ops (void)
-{
-  OCTAVE_INSTALL_INT_OPS (uint16);
-
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint16_, int8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint16_, uint8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint16_, int16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint16_, int32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint16_, uint32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint16_, int64_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint16_, uint64_);
-
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint16_, int8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint16_, uint8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint16_, int16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint16_, int32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint16_, uint32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint16_, int64_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint16_, uint64_);
-
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, int8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, uint8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, int16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, int32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, uint32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, int64);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, uint64);
-
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, int8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, uint8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, int16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, int32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, uint32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, int64);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, uint64);
-}
--- a/src/OPERATORS/op-ui32-ui32.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-ui32nda-i8.h"
-#include "mx-ui32nda-ui8.h"
-#include "mx-ui32nda-i16.h"
-#include "mx-ui32nda-ui16.h"
-#include "mx-ui32nda-i32.h"
-#include "mx-ui32nda-i64.h"
-#include "mx-ui32nda-ui64.h"
-
-#include "mx-ui32nda-i8nda.h"
-#include "mx-ui32nda-ui8nda.h"
-#include "mx-ui32nda-i16nda.h"
-#include "mx-ui32nda-ui16nda.h"
-#include "mx-ui32nda-i32nda.h"
-#include "mx-ui32nda-i64nda.h"
-#include "mx-ui32nda-ui64nda.h"
-
-#include "mx-ui32-i8nda.h"
-#include "mx-ui32-ui8nda.h"
-#include "mx-ui32-i16nda.h"
-#include "mx-ui32-ui16nda.h"
-#include "mx-ui32-i32nda.h"
-#include "mx-ui32-i64nda.h"
-#include "mx-ui32-ui64nda.h"
-
-#include "mx-ui32nda-s.h"
-#include "mx-s-ui32nda.h"
-
-#include "mx-ui32nda-nda.h"
-#include "mx-nda-ui32nda.h"
-
-#include "mx-ui32-nda.h"
-#include "mx-nda-ui32.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-int8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-uint8.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#include "op-int.h"
-
-OCTAVE_INT_OPS (uint32)
-
-OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint32_, int8_, int8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint32_, uint8_, uint8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint32_, int16_, int16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint32_, uint16_, uint16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint32_, int32_, int32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint32_, int64_, int64_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint32_, uint64_, uint64_)
-
-OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint32_, int8_, int8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint32_, uint8_, uint8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint32_, int16_, int16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint32_, uint16_, uint16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint32_, int32_, int32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint32_, int64_, int64_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint32_, uint64_, uint64_)
-
-OCTAVE_MIXED_INT_CMP_OPS (uint32, int8)
-OCTAVE_MIXED_INT_CMP_OPS (uint32, uint8)
-OCTAVE_MIXED_INT_CMP_OPS (uint32, int16)
-OCTAVE_MIXED_INT_CMP_OPS (uint32, uint16)
-OCTAVE_MIXED_INT_CMP_OPS (uint32, int32)
-OCTAVE_MIXED_INT_CMP_OPS (uint32, int64)
-OCTAVE_MIXED_INT_CMP_OPS (uint32, uint64)
-void
-install_ui32_ui32_ops (void)
-{
-  OCTAVE_INSTALL_INT_OPS (uint32);
-
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint32_, int8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint32_, uint8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint32_, int16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint32_, uint16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint32_, int32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint32_, int64_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint32_, uint64_);
-
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint32_, int8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint32_, uint8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint32_, int16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint32_, uint16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint32_, int32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint32_, int64_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint32_, uint64_);
-
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, int8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, uint8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, int16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, uint16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, int32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, int64);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, uint64);
-
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, int8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, uint8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, int16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, uint16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, int32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, int64);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, uint64);
-}
--- a/src/OPERATORS/op-ui64-ui64.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-ui64nda-i8.h"
-#include "mx-ui64nda-ui8.h"
-#include "mx-ui64nda-i16.h"
-#include "mx-ui64nda-ui16.h"
-#include "mx-ui64nda-i32.h"
-#include "mx-ui64nda-ui32.h"
-#include "mx-ui64nda-i64.h"
-
-#include "mx-ui64nda-i8nda.h"
-#include "mx-ui64nda-ui8nda.h"
-#include "mx-ui64nda-i16nda.h"
-#include "mx-ui64nda-ui16nda.h"
-#include "mx-ui64nda-i32nda.h"
-#include "mx-ui64nda-ui32nda.h"
-#include "mx-ui64nda-i64nda.h"
-
-#include "mx-ui64-i8nda.h"
-#include "mx-ui64-ui8nda.h"
-#include "mx-ui64-i16nda.h"
-#include "mx-ui64-ui16nda.h"
-#include "mx-ui64-i32nda.h"
-#include "mx-ui64-ui32nda.h"
-#include "mx-ui64-i64nda.h"
-
-#include "mx-ui64nda-s.h"
-#include "mx-s-ui64nda.h"
-
-#include "mx-ui64nda-nda.h"
-#include "mx-nda-ui64nda.h"
-
-#include "mx-ui64-nda.h"
-#include "mx-nda-ui64.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-int8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-uint8.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#include "op-int.h"
-
-OCTAVE_INT_OPS (uint64)
-
-OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint64_, int8_, int8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint64_, uint8_, uint8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint64_, int16_, int16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint64_, uint16_, uint16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint64_, int32_, int32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint64_, uint32_, uint32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint64_, int64_, int64_)
-
-OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint64_, int8_, int8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint64_, uint8_, uint8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint64_, int16_, int16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint64_, uint16_, uint16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint64_, int32_, int32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint64_, uint32_, uint32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint64_, int64_, int64_)
-
-OCTAVE_MIXED_INT_CMP_OPS (uint64, int8)
-OCTAVE_MIXED_INT_CMP_OPS (uint64, uint8)
-OCTAVE_MIXED_INT_CMP_OPS (uint64, int16)
-OCTAVE_MIXED_INT_CMP_OPS (uint64, uint16)
-OCTAVE_MIXED_INT_CMP_OPS (uint64, int32)
-OCTAVE_MIXED_INT_CMP_OPS (uint64, uint32)
-OCTAVE_MIXED_INT_CMP_OPS (uint64, int64)
-
-void
-install_ui64_ui64_ops (void)
-{
-  OCTAVE_INSTALL_INT_OPS (uint64);
-
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint64_, int8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint64_, uint8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint64_, int16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint64_, uint16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint64_, int32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint64_, uint32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint64_, int64_);
-
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint64_, int8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint64_, uint8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint64_, int16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint64_, uint16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint64_, int32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint64_, uint32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint64_, int64_);
-
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, int8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, uint8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, int16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, uint16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, int32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, uint32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, int64);
-
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, int8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, uint8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, int16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, uint16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, int32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, uint32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, int64);
-}
--- a/src/OPERATORS/op-ui8-ui8.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "mx-ui8nda-i8.h"
-#include "mx-ui8nda-i16.h"
-#include "mx-ui8nda-ui16.h"
-#include "mx-ui8nda-i32.h"
-#include "mx-ui8nda-ui32.h"
-#include "mx-ui8nda-i64.h"
-#include "mx-ui8nda-ui64.h"
-
-#include "mx-ui8nda-i8nda.h"
-#include "mx-ui8nda-i16nda.h"
-#include "mx-ui8nda-ui16nda.h"
-#include "mx-ui8nda-i32nda.h"
-#include "mx-ui8nda-ui32nda.h"
-#include "mx-ui8nda-i64nda.h"
-#include "mx-ui8nda-ui64nda.h"
-
-#include "mx-ui8-i8nda.h"
-#include "mx-ui8-i16nda.h"
-#include "mx-ui8-ui16nda.h"
-#include "mx-ui8-i32nda.h"
-#include "mx-ui8-ui32nda.h"
-#include "mx-ui8-i64nda.h"
-#include "mx-ui8-ui64nda.h"
-
-#include "mx-ui8nda-s.h"
-#include "mx-s-ui8nda.h"
-
-#include "mx-ui8nda-nda.h"
-#include "mx-nda-ui8nda.h"
-
-#include "mx-ui8-nda.h"
-#include "mx-nda-ui8.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-int8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-uint8.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "xdiv.h"
-#include "xpow.h"
-
-#include "op-int.h"
-
-OCTAVE_INT_OPS (uint8)
-
-OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint8_, int8_, int8_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint8_, int16_, int16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint8_, uint16_, uint16_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint8_, int32_, int32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint8_, uint32_, uint32_)
-OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint8_, int64_, int64_)
-OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint8_, uint64_, uint64_)
-
-OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint8_, int8_, int8_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint8_, int16_, int16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint8_, uint16_, uint16_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint8_, int32_, int32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint8_, uint32_, uint32_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint8_, int64_, int64_)
-OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint8_, uint64_, uint64_)
-
-OCTAVE_MIXED_INT_CMP_OPS (uint8, int8)
-OCTAVE_MIXED_INT_CMP_OPS (uint8, int16)
-OCTAVE_MIXED_INT_CMP_OPS (uint8, uint16)
-OCTAVE_MIXED_INT_CMP_OPS (uint8, int32)
-OCTAVE_MIXED_INT_CMP_OPS (uint8, uint32)
-OCTAVE_MIXED_INT_CMP_OPS (uint8, int64)
-OCTAVE_MIXED_INT_CMP_OPS (uint8, uint64)
-
-void
-install_ui8_ui8_ops (void)
-{
-  OCTAVE_INSTALL_INT_OPS (uint8)
-
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint8_, int8_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint8_, int16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint8_, uint16_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint8_, int32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint8_, uint32_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint8_, int64_);
-  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint8_, uint64_);
-
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint8_, int8_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint8_, int16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint8_, uint16_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint8_, int32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint8_, uint32_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint8_, int64_);
-  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint8_, uint64_);
-
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, int8);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, int16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, uint16);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, int32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, uint32);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, int64);
-  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, uint64);
-
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, int8);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, int16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, uint16);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, int32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, uint32);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, int64);
-  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, uint64);
-}
--- a/src/TEMPLATE-INST/Array-jit.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
-
-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/Array-os.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-// Instantiate Arrays of octave_stream objects.
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Array.h"
-#include "Array.cc"
-
-extern template class OCTAVE_API Array<bool>;
-extern template class OCTAVE_API Array<octave_idx_type>;
-
-#include "oct-stream.h"
-
-typedef scanf_format_elt* scanf_format_elt_ptr;
-typedef printf_format_elt* printf_format_elt_ptr;
-
-NO_INSTANTIATE_ARRAY_SORT (scanf_format_elt_ptr);
-INSTANTIATE_ARRAY (scanf_format_elt_ptr, OCTINTERP_API);
-
-NO_INSTANTIATE_ARRAY_SORT (printf_format_elt_ptr);
-INSTANTIATE_ARRAY (printf_format_elt_ptr, OCTINTERP_API);
-
-NO_INSTANTIATE_ARRAY_SORT (octave_stream);
-INSTANTIATE_ARRAY (octave_stream, OCTINTERP_API);
--- a/src/TEMPLATE-INST/Array-sym.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-// Instantiate Arrays of octave_child objects.
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Array.h"
-#include "Array.cc"
-
-#include "oct-obj.h"
-#include "symtab.h"
-
-typedef symbol_record* symbol_record_ptr;
-
-NO_INSTANTIATE_ARRAY_SORT (symbol_record_ptr);
-
-INSTANTIATE_ARRAY (symbol_record_ptr, OCTINTERP_API);
--- a/src/TEMPLATE-INST/Array-tc.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-// Instantiate Arrays of octave_values.
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Array.h"
-#include "Array.cc"
-
-#include "ov.h"
-
-#include "oct-sort.cc"
-
-NO_INSTANTIATE_ARRAY_SORT (octave_value);
-
-INSTANTIATE_ARRAY (octave_value, OCTINTERP_API);
--- a/src/TEMPLATE-INST/module.mk	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-EXTRA_DIST += TEMPLATE-INST/module.mk
-
-TEMPLATE_INST_SRC = \
-  TEMPLATE-INST/Array-os.cc \
-  TEMPLATE-INST/Array-tc.cc \
-  TEMPLATE-INST/Array-jit.cc
--- a/src/corefcn/module.mk	Mon Jul 30 13:05:29 2012 -0500
+++ b/src/corefcn/module.mk	Mon Jul 30 15:29:19 2012 -0700
@@ -1,7 +1,7 @@
 EXTRA_DIST += \
   corefcn/module.mk
 
-corefcn_SRC = \
+COREFCN_SRC = \
   corefcn/__contourc__.cc \
   corefcn/__dispatch__.cc \
   corefcn/__lin_interpn__.cc \
@@ -66,5 +66,5 @@
 
 noinst_LTLIBRARIES += corefcn/libcorefcn.la
 
-corefcn_libcorefcn_la_SOURCES = $(corefcn_SRC)
+corefcn_libcorefcn_la_SOURCES = $(COREFCN_SRC)
 
--- a/src/mkops	Mon Jul 30 13:05:29 2012 -0500
+++ b/src/mkops	Mon Jul 30 15:29:19 2012 -0700
@@ -21,7 +21,7 @@
 SED=${SED:-'sed'}
 
 cat << \EOF
-// DO NOT EDIT!  Generated automatically by mkbuiltins.
+// DO NOT EDIT!  Generated automatically by mkops.
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -32,7 +32,7 @@
 EOF
 
 for file in "$@"; do
-  f=`echo $file | $SED 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
+  f=`echo $file | $SED 's,^\./,,; s%^operators/op-%%; s%\.cc%%; s%-%_%g'`
   echo "extern void install_${f}_ops (void);"
 done
 
@@ -46,7 +46,7 @@
 EOF
 
 for file in "$@"; do
-  f=`echo $file | $SED 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
+  f=`echo $file | $SED 's,^\./,,; s%^operators/op-%%; s%\.cc%%; s%-%_%g'`
   echo "  install_${f}_ops ();"
 done
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/module.mk	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,126 @@
+EXTRA_DIST += \
+  octave-value/module.mk
+
+OV_INTTYPE_INCLUDES = \
+  octave-value/ov-base-int.h \
+  octave-value/ov-base-int.cc \
+  octave-value/ov-int-traits.h \
+  octave-value/ov-int16.h \
+  octave-value/ov-int32.h \
+  octave-value/ov-int64.h \
+  octave-value/ov-int8.h \
+  octave-value/ov-intx.h \
+  octave-value/ov-uint16.h \
+  octave-value/ov-uint32.h \
+  octave-value/ov-uint64.h \
+  octave-value/ov-uint8.h
+
+OV_SPARSE_INCLUDES = \
+  octave-value/ov-base-sparse.h \
+  octave-value/ov-bool-sparse.h \
+  octave-value/ov-cx-sparse.h \
+  octave-value/ov-re-sparse.h
+
+OV_INCLUDES = \
+  octave-value/ov-base-diag.h \
+  octave-value/ov-base-diag.cc \
+  octave-value/ov-base-mat.h \
+  octave-value/ov-base-mat.cc \
+  octave-value/ov-base-scalar.h \
+  octave-value/ov-base-scalar.cc \
+  octave-value/ov-base.h \
+  octave-value/ov-bool-mat.h \
+  octave-value/ov-bool-mat.cc \
+  octave-value/ov-bool.h \
+  octave-value/ov-builtin.h \
+  octave-value/ov-cell.h \
+  octave-value/ov-ch-mat.h \
+  octave-value/ov-class.h \
+  octave-value/ov-colon.h \
+  octave-value/ov-complex.h \
+  octave-value/ov-cs-list.h \
+  octave-value/ov-cx-diag.h \
+  octave-value/ov-cx-mat.h \
+  octave-value/ov-dld-fcn.h \
+  octave-value/ov-fcn-handle.h \
+  octave-value/ov-fcn-inline.h \
+  octave-value/ov-fcn.h \
+  octave-value/ov-float.h \
+  octave-value/ov-flt-complex.h \
+  octave-value/ov-flt-cx-diag.h \
+  octave-value/ov-flt-cx-mat.h \
+  octave-value/ov-flt-re-diag.h \
+  octave-value/ov-flt-re-mat.h \
+  octave-value/ov-lazy-idx.h \
+  octave-value/ov-mex-fcn.h \
+  octave-value/ov-null-mat.h \
+  octave-value/ov-oncleanup.h \
+  octave-value/ov-perm.h \
+  octave-value/ov-range.h \
+  octave-value/ov-re-diag.h \
+  octave-value/ov-re-mat.h \
+  octave-value/ov-scalar.h \
+  octave-value/ov-str-mat.h \
+  octave-value/ov-struct.h \
+  octave-value/ov-type-conv.h \
+  octave-value/ov-typeinfo.h \
+  octave-value/ov-usr-fcn.h \
+  octave-value/ov.h \
+  $(OV_INTTYPE_INCLUDES)
+
+OV_INTTYPE_SRC = \
+  octave-value/ov-int16.cc \
+  octave-value/ov-int32.cc \
+  octave-value/ov-int64.cc \
+  octave-value/ov-int8.cc \
+  octave-value/ov-uint16.cc \
+  octave-value/ov-uint32.cc \
+  octave-value/ov-uint64.cc \
+  octave-value/ov-uint8.cc
+
+OV_SPARSE_SRC = \
+  octave-value/ov-base-sparse.cc \
+  octave-value/ov-bool-sparse.cc \
+  octave-value/ov-cx-sparse.cc \
+  octave-value/ov-re-sparse.cc
+
+OCTAVE_VALUE_SRC = \
+  octave-value/ov-base.cc \
+  octave-value/ov-bool-mat.cc \
+  octave-value/ov-bool.cc \
+  octave-value/ov-builtin.cc \
+  octave-value/ov-cell.cc \
+  octave-value/ov-ch-mat.cc \
+  octave-value/ov-class.cc \
+  octave-value/ov-colon.cc \
+  octave-value/ov-complex.cc \
+  octave-value/ov-cs-list.cc \
+  octave-value/ov-cx-diag.cc \
+  octave-value/ov-cx-mat.cc \
+  octave-value/ov-dld-fcn.cc \
+  octave-value/ov-fcn-handle.cc \
+  octave-value/ov-fcn-inline.cc \
+  octave-value/ov-fcn.cc \
+  octave-value/ov-float.cc \
+  octave-value/ov-flt-complex.cc \
+  octave-value/ov-flt-cx-diag.cc \
+  octave-value/ov-flt-cx-mat.cc \
+  octave-value/ov-flt-re-diag.cc \
+  octave-value/ov-flt-re-mat.cc \
+  octave-value/ov-lazy-idx.cc \
+  octave-value/ov-mex-fcn.cc \
+  octave-value/ov-null-mat.cc \
+  octave-value/ov-oncleanup.cc \
+  octave-value/ov-perm.cc \
+  octave-value/ov-range.cc \
+  octave-value/ov-re-diag.cc \
+  octave-value/ov-re-mat.cc \
+  octave-value/ov-scalar.cc \
+  octave-value/ov-str-mat.cc \
+  octave-value/ov-struct.cc \
+  octave-value/ov-typeinfo.cc \
+  octave-value/ov-usr-fcn.cc \
+  octave-value/ov.cc \
+  $(OV_INTTYPE_SRC) \
+  $(OV_SPARSE_SRC)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-diag.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,506 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "mach-info.h"
+#include "lo-ieee.h"
+
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "pr-output.h"
+#include "error.h"
+#include "gripes.h"
+#include "oct-stream.h"
+#include "ops.h"
+
+#include "ls-oct-ascii.h"
+
+template <class DMT, class MT>
+octave_value
+octave_base_diag<DMT, MT>::subsref (const std::string& type,
+                                    const std::list<octave_value_list>& idx)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      retval = do_index_op (idx.front ());
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval.next_subsref (type, idx);
+}
+
+template <class DMT, class MT>
+octave_value
+octave_base_diag<DMT, MT>::do_index_op (const octave_value_list& idx,
+                                        bool resize_ok)
+{
+  octave_value retval;
+  typedef typename DMT::element_type el_type;
+
+  if (idx.length () == 2 && ! resize_ok)
+    {
+      idx_vector idx0 = idx(0).index_vector ();
+      idx_vector idx1 = idx(1).index_vector ();
+
+      if (idx0.is_scalar () && idx1.is_scalar ())
+        {
+          retval = matrix.elem (idx0(0), idx1(0));
+        }
+      else
+        {
+          octave_idx_type m = idx0.length (matrix.rows ());
+          octave_idx_type n = idx1.length (matrix.columns ());
+          if (idx0.is_colon_equiv (m) && idx1.is_colon_equiv (n)
+              && m <= matrix.rows () && n <= matrix.rows ())
+            {
+              DMT rm (matrix);
+              rm.resize (m, n);
+              retval = rm;
+            }
+          else
+            retval = to_dense ().do_index_op (idx, resize_ok);
+        }
+    }
+  else
+    retval = to_dense ().do_index_op (idx, resize_ok);
+
+  return retval;
+}
+
+template <class DMT, class MT>
+octave_value
+octave_base_diag<DMT, MT>::subsasgn (const std::string& type,
+                                     const std::list<octave_value_list>& idx,
+                                     const octave_value& rhs)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        if (type.length () == 1)
+          {
+            octave_value_list jdx = idx.front ();
+            // Check for a simple element assignment. That means, if D is a diagonal matrix,
+            // `D(i,i) = x' will not destroy its diagonality (provided i is a valid index).
+            if (jdx.length () == 2 && jdx(0).is_scalar_type () && jdx(1).is_scalar_type ())
+              {
+                typename DMT::element_type val;
+                idx_vector i0 = jdx(0).index_vector (), i1 = jdx(1).index_vector ();
+                if (! error_state  && i0(0) == i1(0)
+                    && i0(0) < matrix.rows () && i1(0) < matrix.cols ()
+                    && chk_valid_scalar (rhs, val))
+                  {
+                    matrix.dgelem (i0(0)) = val;
+                    retval = this;
+                    this->count++;
+                    // invalidate cache
+                    dense_cache = octave_value ();
+                  }
+              }
+
+            if (! error_state && ! retval.is_defined ())
+              retval = numeric_assign (type, idx, rhs);
+          }
+        else
+          {
+            std::string nm = type_name ();
+            error ("in indexed assignment of %s, last lhs index must be ()",
+                   nm.c_str ());
+          }
+      }
+      break;
+
+    case '{':
+    case '.':
+      {
+        if (is_empty ())
+          {
+            octave_value tmp = octave_value::empty_conv (type, rhs);
+
+            retval = tmp.subsasgn (type, idx, rhs);
+          }
+        else
+          {
+            std::string nm = type_name ();
+            error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+          }
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval;
+}
+
+template <class DMT, class MT>
+octave_value
+octave_base_diag<DMT, MT>::resize (const dim_vector& dv, bool fill) const
+{
+  octave_value retval;
+  if (dv.length () == 2)
+    {
+      DMT rm (matrix);
+      rm.resize (dv(0), dv(1));
+      retval = rm;
+    }
+  else
+    retval = to_dense ().resize (dv, fill);
+  return retval;
+}
+
+template <class DMT, class MT>
+bool
+octave_base_diag<DMT, MT>::is_true (void) const
+{
+  return to_dense ().is_true ();
+}
+
+// FIXME: this should be achieveable using ::real
+template <class T> inline T helper_getreal (T x) { return x; }
+template <class T> inline T helper_getreal (std::complex<T> x) { return x.real (); }
+// FIXME: we really need some traits so that ad hoc hooks like this are not necessary
+template <class T> inline T helper_iscomplex (T) { return false; }
+template <class T> inline T helper_iscomplex (std::complex<T>) { return true; }
+
+template <class DMT, class MT>
+double
+octave_base_diag<DMT, MT>::double_value (bool force_conversion) const
+{
+  double retval = lo_ieee_nan_value ();
+  typedef typename DMT::element_type el_type;
+
+  if (helper_iscomplex (el_type ()) && ! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real scalar");
+
+  if (numel () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 type_name (), "real scalar");
+
+      retval = helper_getreal (el_type (matrix (0, 0)));
+    }
+  else
+    gripe_invalid_conversion (type_name (), "real scalar");
+
+  return retval;
+}
+
+template <class DMT, class MT>
+float
+octave_base_diag<DMT, MT>::float_value (bool force_conversion) const
+{
+  float retval = lo_ieee_float_nan_value ();
+  typedef typename DMT::element_type el_type;
+
+  if (helper_iscomplex (el_type ()) && ! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real scalar");
+
+  if (numel () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 type_name (), "real scalar");
+
+      retval = helper_getreal (el_type (matrix (0, 0)));
+    }
+  else
+    gripe_invalid_conversion (type_name (), "real scalar");
+
+  return retval;
+}
+
+template <class DMT, class MT>
+Complex
+octave_base_diag<DMT, MT>::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 type_name (), "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion (type_name (), "complex scalar");
+
+  return retval;
+}
+
+template <class DMT, class MT>
+FloatComplex
+octave_base_diag<DMT, MT>::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 type_name (), "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion (type_name (), "complex scalar");
+
+  return retval;
+}
+
+template <class DMT, class MT>
+Matrix
+octave_base_diag<DMT, MT>::matrix_value (bool) const
+{
+  return Matrix (diag_matrix_value ());
+}
+
+template <class DMT, class MT>
+FloatMatrix
+octave_base_diag<DMT, MT>::float_matrix_value (bool) const
+{
+  return FloatMatrix (float_diag_matrix_value ());
+}
+
+template <class DMT, class MT>
+ComplexMatrix
+octave_base_diag<DMT, MT>::complex_matrix_value (bool) const
+{
+  return ComplexMatrix (complex_diag_matrix_value ());
+}
+
+template <class DMT, class MT>
+FloatComplexMatrix
+octave_base_diag<DMT, MT>::float_complex_matrix_value (bool) const
+{
+  return FloatComplexMatrix (float_complex_diag_matrix_value ());
+}
+
+template <class DMT, class MT>
+NDArray
+octave_base_diag<DMT, MT>::array_value (bool) const
+{
+  return NDArray (matrix_value ());
+}
+
+template <class DMT, class MT>
+FloatNDArray
+octave_base_diag<DMT, MT>::float_array_value (bool) const
+{
+  return FloatNDArray (float_matrix_value ());
+}
+
+template <class DMT, class MT>
+ComplexNDArray
+octave_base_diag<DMT, MT>::complex_array_value (bool) const
+{
+  return ComplexNDArray (complex_matrix_value ());
+}
+
+template <class DMT, class MT>
+FloatComplexNDArray
+octave_base_diag<DMT, MT>::float_complex_array_value (bool) const
+{
+  return FloatComplexNDArray (float_complex_matrix_value ());
+}
+
+template <class DMT, class MT>
+boolNDArray
+octave_base_diag<DMT, MT>::bool_array_value (bool warn) const
+{
+  return to_dense ().bool_array_value (warn);
+}
+
+template <class DMT, class MT>
+charNDArray
+octave_base_diag<DMT, MT>::char_array_value (bool warn) const
+{
+  return to_dense ().char_array_value (warn);
+}
+
+template <class DMT, class MT>
+SparseMatrix
+octave_base_diag<DMT, MT>::sparse_matrix_value (bool) const
+{
+  return SparseMatrix (diag_matrix_value ());
+}
+
+template <class DMT, class MT>
+SparseComplexMatrix
+octave_base_diag<DMT, MT>::sparse_complex_matrix_value (bool) const
+{
+  return SparseComplexMatrix (complex_diag_matrix_value ());
+}
+
+template <class DMT, class MT>
+idx_vector
+octave_base_diag<DMT, MT>::index_vector (void) const
+{
+  return to_dense ().index_vector ();
+}
+
+template <class DMT, class MT>
+octave_value
+octave_base_diag<DMT, MT>::convert_to_str_internal (bool pad, bool force, char type) const
+{
+  return to_dense ().convert_to_str_internal (pad, force, type);
+}
+
+template <class DMT, class MT>
+bool
+octave_base_diag<DMT, MT>::save_ascii (std::ostream& os)
+{
+  os << "# rows: " << matrix.rows () << "\n"
+    << "# columns: " << matrix.columns () << "\n";
+
+  os << matrix.diag ();
+
+  return true;
+}
+
+template <class DMT, class MT>
+bool
+octave_base_diag<DMT, MT>::load_ascii (std::istream& is)
+{
+  octave_idx_type r = 0, c = 0;
+  bool success = true;
+
+  if (extract_keyword (is, "rows", r, true)
+      && extract_keyword (is, "columns", c, true))
+    {
+      octave_idx_type l = r < c ? r : c;
+      MT tmp (l, 1);
+      is >> tmp;
+
+      if (!is)
+        {
+          error ("load: failed to load diagonal matrix constant");
+          success = false;
+        }
+      else
+        {
+          // This is a little tricky, as we have the Matrix type, but
+          // not ColumnVector type. We need to help the compiler get
+          // through the inheritance tree.
+          typedef typename DMT::element_type el_type;
+          matrix = DMT (MDiagArray2<el_type> (MArray<el_type> (tmp)));
+          matrix.resize (r, c);
+
+          // Invalidate cache. Probably not necessary, but safe.
+          dense_cache = octave_value ();
+        }
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+template <class DMT, class MT>
+void
+octave_base_diag<DMT, MT>::print_raw (std::ostream& os,
+                                      bool pr_as_read_syntax) const
+{
+  return octave_print_internal (os, matrix, pr_as_read_syntax,
+                                current_print_indent_level ());
+}
+
+template <class DMT, class MT>
+mxArray *
+octave_base_diag<DMT, MT>::as_mxArray (void) const
+{
+  return to_dense ().as_mxArray ();
+}
+
+template <class DMT, class MT>
+bool
+octave_base_diag<DMT, MT>::print_as_scalar (void) const
+{
+  dim_vector dv = dims ();
+
+  return (dv.all_ones () || dv.any_zero ());
+}
+
+template <class DMT, class MT>
+void
+octave_base_diag<DMT, MT>::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+template <class DMT, class MT>
+int
+octave_base_diag<DMT, MT>::write (octave_stream& os, int block_size,
+                                  oct_data_conv::data_type output_type, int skip,
+                                  oct_mach_info::float_format flt_fmt) const
+{
+  return to_dense ().write (os, block_size, output_type, skip, flt_fmt);
+}
+
+template <class DMT, class MT>
+void
+octave_base_diag<DMT, MT>::print_info (std::ostream& os,
+                                       const std::string& prefix) const
+{
+  matrix.print_info (os, prefix);
+}
+
+template <class DMT, class MT>
+octave_value
+octave_base_diag<DMT, MT>::to_dense (void) const
+{
+  if (! dense_cache.is_defined ())
+    dense_cache = MT (matrix);
+
+  return dense_cache;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-diag.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,226 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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_base_diag_h)
+#define octave_base_diag_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "str-vec.h"
+
+#include "oct-obj.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+class tree_walker;
+
+// Real matrix values.
+
+template <class DMT, class MT>
+class
+octave_base_diag : public octave_base_value
+{
+
+public:
+
+  octave_base_diag (void)
+    : octave_base_value (), matrix (), dense_cache () { }
+
+  octave_base_diag (const DMT& m)
+    : octave_base_value (), matrix (m), dense_cache ()
+  { }
+
+  octave_base_diag (const octave_base_diag& m)
+    : octave_base_value (), matrix (m.matrix), dense_cache () { }
+
+  ~octave_base_diag (void) { }
+
+  size_t byte_size (void) const { return matrix.byte_size (); }
+
+  octave_value squeeze (void) const { return matrix; }
+
+  octave_value full_value (void) const { return to_dense (); }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int)
+    { return subsref (type, idx); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  octave_value subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs);
+
+  dim_vector dims (void) const { return matrix.dims (); }
+
+  octave_idx_type nnz (void) const { return to_dense ().nnz (); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return to_dense ().reshape (new_dims); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return to_dense ().permute (vec, inv); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+  octave_value all (int dim = 0) const { return MT (matrix).all (dim); }
+  octave_value any (int dim = 0) const { return MT (matrix).any (dim); }
+
+  MatrixType matrix_type (void) const { return MatrixType::Diagonal; }
+  MatrixType matrix_type (const MatrixType&) const
+    { return matrix_type (); }
+
+  octave_value diag (octave_idx_type k = 0) const
+    { return octave_value (matrix.diag (k)); }
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
+    { return to_dense ().sort (dim, mode); }
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const
+    { return to_dense ().sort (sidx, dim, mode); }
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const
+    { return to_dense ().is_sorted (mode); }
+
+  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
+    { return to_dense ().sort_rows_idx (mode); }
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
+    { return to_dense ().is_sorted_rows (mode); }
+
+  bool is_matrix_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return true; }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_true (void) const;
+
+  bool is_diag_matrix (void) const { return true; }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  idx_vector index_vector (void) const;
+
+  Matrix matrix_value (bool = false) const;
+
+  FloatMatrix float_matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool warn = false) const;
+
+  charNDArray char_array_value (bool = false) const;
+
+  NDArray array_value (bool = false) const;
+
+  FloatNDArray float_array_value (bool = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const;
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
+
+  int8NDArray
+  int8_array_value (void) const { return to_dense ().int8_array_value (); }
+
+  int16NDArray
+  int16_array_value (void) const { return to_dense ().int16_array_value (); }
+
+  int32NDArray
+  int32_array_value (void) const { return to_dense ().int32_array_value (); }
+
+  int64NDArray
+  int64_array_value (void) const { return to_dense ().int64_array_value (); }
+
+  uint8NDArray
+  uint8_array_value (void) const { return to_dense ().uint8_array_value (); }
+
+  uint16NDArray
+  uint16_array_value (void) const { return to_dense ().uint16_array_value (); }
+
+  uint32NDArray
+  uint32_array_value (void) const { return to_dense ().uint32_array_value (); }
+
+  uint64NDArray
+  uint64_array_value (void) const { return to_dense ().uint64_array_value (); }
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const;
+
+  mxArray *as_mxArray (void) const;
+
+  bool print_as_scalar (void) const;
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_info (std::ostream& os, const std::string& prefix) const;
+
+protected:
+
+  DMT matrix;
+
+  octave_value to_dense (void) const;
+
+  virtual bool chk_valid_scalar (const octave_value&,
+                                 typename DMT::element_type&) const = 0;
+
+private:
+
+  mutable octave_value dense_cache;
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-int.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,608 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+#include <vector>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+#include "oct-locbuf.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-mat.cc"
+#include "ov-base-scalar.h"
+#include "ov-base-scalar.cc"
+#include "ov-base-int.h"
+#include "ov-int-traits.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+// We have all the machinery below (octave_base_int_helper and
+// octave_base_int_helper_traits) to avoid a few warnings from GCC
+// about comparisons always false due to limited range of data types.
+// Ugh.  The cure may be worse than the disease.
+
+template <class T, bool is_signed = true, bool can_be_too_big = true>
+struct octave_base_int_helper
+{
+  static bool
+  char_value_out_of_range (T val) { return val < 0 || val > UCHAR_MAX; }
+};
+
+template <class T>
+struct octave_base_int_helper<T, false, false>
+{
+  static bool char_value_out_of_range (T) { return false; }
+};
+
+template <class T>
+struct octave_base_int_helper<T, false, true>
+{
+  static bool char_value_out_of_range (T val) { return val > UCHAR_MAX; }
+};
+
+template <class T>
+struct octave_base_int_helper<T, true, false>
+{
+  static bool char_value_out_of_range (T val) { return val < 0; }
+};
+
+// For all types other than char, signed char, and unsigned char, we
+// assume that the upper limit for the range of allowable values is
+// larger than the range for unsigned char.  If that's not true, we
+// are still OK, but will see the warnings again for any other types
+// that do not meet this assumption.
+
+template <class T>
+struct octave_base_int_helper_traits
+{
+  static const bool can_be_larger_than_uchar_max = true;
+};
+
+template <>
+struct octave_base_int_helper_traits<char>
+{
+  static const bool can_be_larger_than_uchar_max = false;
+};
+
+template <>
+struct octave_base_int_helper_traits<signed char>
+{
+  static const bool can_be_larger_than_uchar_max = false;
+};
+
+template <>
+struct octave_base_int_helper_traits<unsigned char>
+{
+  static const bool can_be_larger_than_uchar_max = false;
+};
+
+
+template <class T>
+octave_base_value *
+octave_base_int_matrix<T>::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (this->matrix.nelem () == 1)
+    retval = new typename octave_value_int_traits<T>::scalar_type (this->matrix (0));
+
+  return retval;
+}
+
+template <class T>
+octave_value
+octave_base_int_matrix<T>::convert_to_str_internal (bool, bool, char type) const
+{
+  octave_value retval;
+  dim_vector dv = this->dims ();
+  octave_idx_type nel = dv.numel ();
+
+  charNDArray chm (dv);
+
+  bool warned = false;
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      octave_quit ();
+
+      typename T::element_type tmp = this->matrix(i);
+
+      typedef typename T::element_type::val_type val_type;
+
+      val_type ival = tmp.value ();
+
+      static const bool is_signed = std::numeric_limits<val_type>::is_signed;
+      static const bool can_be_larger_than_uchar_max
+        = octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar_max;
+
+      if (octave_base_int_helper<val_type, is_signed,
+          can_be_larger_than_uchar_max>::char_value_out_of_range (ival))
+        {
+          // FIXME -- is there something better we could do?
+
+          ival = 0;
+
+          if (! warned)
+            {
+              ::warning ("range error for conversion to character value");
+              warned = true;
+            }
+        }
+      else
+        chm (i) = static_cast<char> (ival);
+    }
+
+  retval = octave_value (chm, type);
+
+  return retval;
+}
+
+template <class T>
+bool
+octave_base_int_matrix<T>::save_ascii (std::ostream& os)
+{
+  dim_vector d = this->dims ();
+
+  os << "# ndims: " << d.length () << "\n";
+
+  for (int i = 0; i < d.length (); i++)
+    os << " " << d (i);
+
+  os << "\n" << this->matrix;
+
+  return true;
+}
+
+template <class T>
+bool
+octave_base_int_matrix<T>::load_ascii (std::istream& is)
+{
+  int mdims = 0;
+  bool success = true;
+
+  if (extract_keyword (is, "ndims", mdims, true))
+    {
+      if (mdims >= 0)
+        {
+          dim_vector dv;
+          dv.resize (mdims);
+
+          for (int i = 0; i < mdims; i++)
+            is >> dv(i);
+
+          T tmp(dv);
+
+          is >> tmp;
+
+          if (!is)
+            {
+              error ("load: failed to load matrix constant");
+              success = false;
+            }
+
+          this->matrix = tmp;
+        }
+      else
+        {
+          error ("load: failed to extract number of rows and columns");
+          success = false;
+        }
+    }
+  else
+    error ("load: failed to extract number of dimensions");
+
+  return success;
+}
+
+template <class T>
+bool
+octave_base_int_matrix<T>::save_binary (std::ostream& os, bool&)
+{
+  dim_vector d = this->dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims to differentiate with old format!!
+  int32_t tmp = - d.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  for (int i=0; i < d.length (); i++)
+    {
+      tmp = d(i);
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+    }
+
+  os.write (reinterpret_cast<const char *> (this->matrix.data ()), this->byte_size ());
+
+  return true;
+}
+
+template <class T>
+bool
+octave_base_int_matrix<T>::load_binary (std::istream& is, bool swap,
+                                        oct_mach_info::float_format )
+{
+  int32_t mdims;
+  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&mdims);
+  if (mdims >= 0)
+    return false;
+
+  mdims = - mdims;
+  int32_t di;
+  dim_vector dv;
+  dv.resize (mdims);
+
+  for (int i = 0; i < mdims; i++)
+    {
+      if (! is.read (reinterpret_cast<char *> (&di), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&di);
+      dv(i) = di;
+    }
+
+  // Convert an array with a single dimension to be a row vector.
+  // Octave should never write files like this, other software
+  // might.
+
+  if (mdims == 1)
+    {
+      mdims = 2;
+      dv.resize (mdims);
+      dv(1) = dv(0);
+      dv(0) = 1;
+    }
+
+  T m (dv);
+
+  if (! is.read (reinterpret_cast<char *> (m.fortran_vec ()), m.byte_size ()))
+    return false;
+
+  if (swap)
+    {
+      int nel = dv.numel ();
+      int bytes = nel / m.byte_size ();
+      for (int i = 0; i < nel; i++)
+        switch (bytes)
+          {
+          case 8:
+            swap_bytes<8> (&m(i));
+            break;
+          case 4:
+            swap_bytes<4> (&m(i));
+            break;
+          case 2:
+            swap_bytes<2> (&m(i));
+            break;
+          case 1:
+          default:
+            break;
+          }
+    }
+
+  this->matrix = m;
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+template <class T>
+bool
+octave_base_int_matrix<T>::save_hdf5 (hid_t loc_id, const char *name, bool)
+{
+  hid_t save_type_hid = HDF5_SAVE_TYPE;
+  bool retval = true;
+  dim_vector dv = this->dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  int rank = dv.length ();
+  hid_t space_hid = -1, data_hid = -1;
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  for (int i = 0; i < rank; i++)
+    hdims[i] = dv (rank-i-1);
+
+  space_hid = H5Screate_simple (rank, hdims, 0);
+
+  if (space_hid < 0) return false;
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, this->matrix.data ()) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+template <class T>
+bool
+octave_base_int_matrix<T>::load_hdf5 (hid_t loc_id, const char *name)
+{
+  hid_t save_type_hid = HDF5_SAVE_TYPE;
+  bool retval = false;
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    this->matrix.resize (dv);
+  if (empty)
+      return (empty > 0);
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank < 1)
+    {
+      H5Sclose (space_id);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  if (rank == 1)
+    {
+      dv.resize (2);
+      dv(0) = 1;
+      dv(1) = hdims[0];
+    }
+  else
+    {
+      dv.resize (rank);
+      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
+        dv(j) = hdims[i];
+    }
+
+  T m (dv);
+  if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, m.fortran_vec ()) >= 0)
+    {
+      retval = true;
+      this->matrix = m;
+    }
+
+  H5Sclose (space_id);
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+template <class T>
+void
+octave_base_int_matrix<T>::print_raw (std::ostream& os,
+                                      bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, this->matrix, pr_as_read_syntax,
+                         this->current_print_indent_level ());
+}
+
+template <class T>
+octave_value
+octave_base_int_scalar<T>::convert_to_str_internal (bool, bool, char type) const
+{
+  octave_value retval;
+
+  T tmp = this->scalar;
+
+  typedef typename T::val_type val_type;
+
+  val_type ival = tmp.value ();
+
+  static const bool is_signed = std::numeric_limits<val_type>::is_signed;
+  static const bool can_be_larger_than_uchar_max
+    = octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar_max;
+
+  if (octave_base_int_helper<val_type, is_signed,
+      can_be_larger_than_uchar_max>::char_value_out_of_range (ival))
+    {
+      // FIXME -- is there something better we could do?
+
+      ival = 0;
+
+      ::warning ("range error for conversion to character value");
+    }
+  else
+    retval = octave_value (std::string (1, static_cast<char> (ival)), type);
+
+  return retval;
+}
+
+template <class T>
+bool
+octave_base_int_scalar<T>::save_ascii (std::ostream& os)
+{
+  os << this->scalar << "\n";
+  return true;
+}
+
+template <class T>
+bool
+octave_base_int_scalar<T>::load_ascii (std::istream& is)
+{
+  is >> this->scalar;
+  if (!is)
+    {
+      error ("load: failed to load scalar constant");
+      return false;
+    }
+  return true;
+}
+
+template <class T>
+bool
+octave_base_int_scalar<T>::save_binary (std::ostream& os, bool&)
+{
+  os.write (reinterpret_cast<char *> (&(this->scalar)), this->byte_size ());
+  return true;
+}
+
+template <class T>
+bool
+octave_base_int_scalar<T>::load_binary (std::istream& is, bool swap,
+                                        oct_mach_info::float_format)
+{
+  T tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), this->byte_size ()))
+    return false;
+
+  if (swap)
+    switch (this->byte_size ())
+      {
+      case 8:
+        swap_bytes<8> (&tmp);
+        break;
+      case 4:
+        swap_bytes<4> (&tmp);
+        break;
+      case 2:
+        swap_bytes<2> (&tmp);
+        break;
+      case 1:
+      default:
+        break;
+      }
+  this->scalar = tmp;
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+template <class T>
+bool
+octave_base_int_scalar<T>::save_hdf5 (hid_t loc_id, const char *name, bool)
+{
+  hid_t save_type_hid = HDF5_SAVE_TYPE;
+  bool retval = true;
+  hsize_t dimens[3];
+  hid_t space_hid = -1, data_hid = -1;
+
+  space_hid = H5Screate_simple (0, dimens, 0);
+  if (space_hid < 0) return false;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &(this->scalar)) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+template <class T>
+bool
+octave_base_int_scalar<T>::load_hdf5 (hid_t loc_id, const char *name)
+{
+  hid_t save_type_hid = HDF5_SAVE_TYPE;
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  T tmp;
+  if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, &tmp) < 0)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  this->scalar = tmp;
+
+  H5Dclose (data_hid);
+
+  return true;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-int.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,129 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_base_int_matrix_h)
+#define octave_base_int_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-scalar.h"
+#include "ov-typeinfo.h"
+
+// base int matrix values.
+
+template <class T>
+class
+octave_base_int_matrix : public octave_base_matrix<T>
+{
+public:
+
+  octave_base_int_matrix (void) : octave_base_matrix<T> () { }
+
+  octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { }
+
+  ~octave_base_int_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_base_int_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_base_int_matrix (); }
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  bool is_real_type (void) const { return true; }
+
+  //  void increment (void) { matrix += 1; }
+
+  //  void decrement (void) { matrix -= 1; }
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  octave_value convert_to_str_internal (bool, bool, char type) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& );
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format );
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+};
+
+// base int scalar values.
+
+template <class T>
+class
+octave_base_int_scalar : public octave_base_scalar<T>
+{
+public:
+
+  octave_base_int_scalar (void) : octave_base_scalar<T> () { }
+
+  octave_base_int_scalar (const T& s) : octave_base_scalar<T> (s) { }
+
+  ~octave_base_int_scalar (void) { }
+
+  octave_base_value *clone (void) const { return new octave_base_int_scalar (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_base_int_scalar (); }
+
+  octave_base_value *try_narrowing_conversion (void) { return 0; }
+
+  bool is_real_type (void) const { return true; }
+
+  //  void increment (void) { scalar += 1; }
+
+  //  void decrement (void) { scalar -= 1; }
+
+  octave_value convert_to_str_internal (bool, bool, char type) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& );
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format );
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool );
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,482 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "Cell.h"
+#include "oct-obj.h"
+#include "oct-map.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-scalar.h"
+#include "pr-output.h"
+
+template <class MT>
+octave_value
+octave_base_matrix<MT>::subsref (const std::string& type,
+                                 const std::list<octave_value_list>& idx)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      retval = do_index_op (idx.front ());
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval.next_subsref (type, idx);
+}
+
+template <class MT>
+octave_value
+octave_base_matrix<MT>::subsasgn (const std::string& type,
+                                  const std::list<octave_value_list>& idx,
+                                  const octave_value& rhs)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        if (type.length () == 1)
+          retval = numeric_assign (type, idx, rhs);
+        else if (is_empty ())
+          {
+            // Allow conversion of empty matrix to some other type in
+            // cases like
+            //
+            //  x = []; x(i).f = rhs
+
+            if (type[1] == '.')
+              {
+                octave_value tmp = octave_value::empty_conv (type, rhs);
+
+                retval = tmp.subsasgn (type, idx, rhs);
+              }
+            else
+              error ("invalid assignment expression");
+          }
+        else
+          {
+            std::string nm = type_name ();
+            error ("in indexed assignment of %s, last lhs index must be ()",
+                   nm.c_str ());
+          }
+      }
+      break;
+
+    case '{':
+    case '.':
+      {
+        if (is_empty ())
+          {
+            octave_value tmp = octave_value::empty_conv (type, rhs);
+
+            retval = tmp.subsasgn (type, idx, rhs);
+          }
+        else
+          {
+            std::string nm = type_name ();
+            error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+          }
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval;
+}
+
+template <class MT>
+octave_value
+octave_base_matrix<MT>::do_index_op (const octave_value_list& idx,
+                                     bool resize_ok)
+{
+  octave_value retval;
+
+  octave_idx_type n_idx = idx.length ();
+
+  int nd = matrix.ndims ();
+  const MT& cmatrix = matrix;
+
+  switch (n_idx)
+    {
+    case 0:
+      retval = matrix;
+      break;
+
+    case 1:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          {
+            // optimize single scalar index.
+            if (! resize_ok && i.is_scalar ())
+              retval = cmatrix.checkelem (i(0));
+            else
+              retval = MT (matrix.index (i, resize_ok));
+          }
+      }
+      break;
+
+    case 2:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          {
+            idx_vector j = idx (1).index_vector ();
+
+            if (! error_state)
+              {
+                // optimize two scalar indices.
+                if (! resize_ok && i.is_scalar () && j.is_scalar ())
+                  retval = cmatrix.checkelem (i(0), j(0));
+                else
+                  retval = MT (matrix.index (i, j, resize_ok));
+              }
+          }
+      }
+      break;
+
+    default:
+      {
+        Array<idx_vector> idx_vec (dim_vector (n_idx, 1));
+        bool scalar_opt = n_idx == nd && ! resize_ok;
+        const dim_vector dv = matrix.dims ();
+
+        for (octave_idx_type i = 0; i < n_idx; i++)
+          {
+            idx_vec(i) = idx(i).index_vector ();
+
+            if (error_state)
+              break;
+
+            scalar_opt = (scalar_opt && idx_vec(i).is_scalar ());
+          }
+
+        if (! error_state)
+          {
+            if (scalar_opt)
+              retval = cmatrix.checkelem (conv_to_int_array (idx_vec));
+            else
+              retval = MT (matrix.index (idx_vec, resize_ok));
+          }
+      }
+      break;
+    }
+
+  return retval;
+}
+
+template <class MT>
+void
+octave_base_matrix<MT>::assign (const octave_value_list& idx, const MT& rhs)
+{
+  octave_idx_type n_idx = idx.length ();
+
+  switch (n_idx)
+    {
+    case 0:
+      panic_impossible ();
+      break;
+
+    case 1:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          matrix.assign (i, rhs);
+      }
+      break;
+
+    case 2:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          {
+            idx_vector j = idx (1).index_vector ();
+
+            if (! error_state)
+              matrix.assign (i, j, rhs);
+          }
+      }
+      break;
+
+    default:
+      {
+        Array<idx_vector> idx_vec (dim_vector (n_idx, 1));
+
+        for (octave_idx_type i = 0; i < n_idx; i++)
+          {
+            idx_vec(i) = idx(i).index_vector ();
+
+            if (error_state)
+              break;
+          }
+
+        if (! error_state)
+          matrix.assign (idx_vec, rhs);
+      }
+      break;
+    }
+
+  // Clear cache.
+  clear_cached_info ();
+}
+
+template <class MT>
+MatrixType
+octave_base_matrix<MT>::matrix_type (const MatrixType& _typ) const
+{
+  delete typ;
+  typ = new MatrixType (_typ);
+  return *typ;
+}
+
+template <class MT>
+void
+octave_base_matrix<MT>::assign (const octave_value_list& idx,
+                                typename MT::element_type rhs)
+{
+  octave_idx_type n_idx = idx.length ();
+
+  int nd = matrix.ndims ();
+
+  MT mrhs (dim_vector (1, 1), rhs);
+
+  switch (n_idx)
+    {
+    case 0:
+      panic_impossible ();
+      break;
+
+    case 1:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          {
+            // optimize single scalar index.
+            if (i.is_scalar () && i(0) < matrix.numel ())
+              matrix(i(0)) = rhs;
+            else
+              matrix.assign (i, mrhs);
+          }
+      }
+      break;
+
+    case 2:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          {
+            idx_vector j = idx (1).index_vector ();
+
+            if (! error_state)
+              {
+                // optimize two scalar indices.
+                if (i.is_scalar () && j.is_scalar () && nd == 2
+                    && i(0) < matrix.rows () && j(0) < matrix.columns ())
+                  matrix(i(0), j(0)) = rhs;
+                else
+                  matrix.assign (i, j, mrhs);
+              }
+          }
+      }
+      break;
+
+    default:
+      {
+        Array<idx_vector> idx_vec (dim_vector (n_idx, 1));
+        bool scalar_opt = n_idx == nd;
+        const dim_vector dv = matrix.dims ().redim (n_idx);
+
+        for (octave_idx_type i = 0; i < n_idx; i++)
+          {
+            idx_vec(i) = idx(i).index_vector ();
+
+            if (error_state)
+              break;
+
+            scalar_opt = (scalar_opt && idx_vec(i).is_scalar ()
+                          && idx_vec(i)(0) < dv(i));
+          }
+
+        if (! error_state)
+          {
+            if (scalar_opt)
+              {
+                // optimize all scalar indices. Don't construct an index array,
+                // but rather calc a scalar index directly.
+                octave_idx_type k = 1, j = 0;
+                for (octave_idx_type i = 0; i < n_idx; i++)
+                  {
+                    j += idx_vec(i)(0) * k;
+                    k *= dv (i);
+                  }
+                matrix(j) = rhs;
+              }
+            else
+              matrix.assign (idx_vec, mrhs);
+          }
+      }
+      break;
+    }
+
+  // Clear cache.
+  clear_cached_info ();
+}
+
+template <class MT>
+void
+octave_base_matrix<MT>::delete_elements (const octave_value_list& idx)
+{
+  octave_idx_type len = idx.length ();
+
+  Array<idx_vector> ra_idx (dim_vector (len, 1));
+
+  for (octave_idx_type i = 0; i < len; i++)
+    ra_idx(i) = idx(i).index_vector ();
+
+  matrix.delete_elements (ra_idx);
+
+  // Clear cache.
+  clear_cached_info ();
+}
+
+template <class MT>
+octave_value
+octave_base_matrix<MT>::resize (const dim_vector& dv, bool fill) const
+{
+  MT retval (matrix);
+  if (fill)
+    retval.resize (dv, 0);
+  else
+    retval.resize (dv);
+  return retval;
+}
+
+template <class MT>
+bool
+octave_base_matrix<MT>::is_true (void) const
+{
+  bool retval = false;
+  dim_vector dv = matrix.dims ();
+  int nel = dv.numel ();
+
+  if (nel > 0)
+    {
+      MT t1 (matrix.reshape (dim_vector (nel, 1)));
+
+      if (t1.any_element_is_nan ())
+        gripe_nan_to_logical_conversion ();
+      else
+        {
+          boolNDArray t2 = t1.all ();
+
+          retval = t2(0);
+        }
+    }
+
+  return retval;
+}
+
+template <class MT>
+bool
+octave_base_matrix<MT>::print_as_scalar (void) const
+{
+  dim_vector dv = dims ();
+
+  return (dv.all_ones () || dv.any_zero ());
+}
+
+template <class MT>
+void
+octave_base_matrix<MT>::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+
+template <class MT>
+void
+octave_base_matrix<MT>::print_info (std::ostream& os,
+                                    const std::string& prefix) const
+{
+  matrix.print_info (os, prefix);
+}
+
+template <class MT>
+octave_value
+octave_base_matrix<MT>::fast_elem_extract (octave_idx_type n) const
+{
+  if (n < matrix.numel ())
+    return matrix(n);
+  else
+    return octave_value ();
+}
+
+template <class MT>
+bool
+octave_base_matrix<MT>::fast_elem_insert (octave_idx_type n,
+                                          const octave_value& x)
+{
+  if (n < matrix.numel ())
+    {
+      // Don't use builtin_type () here to avoid an extra VM call.
+      typedef typename MT::element_type ET;
+      const builtin_type_t btyp = class_to_btyp<ET>::btyp;
+      if (btyp == btyp_unknown) // Dead branch?
+        return false;
+
+      // Set up the pointer to the proper place.
+      void *here = reinterpret_cast<void *> (&matrix(n));
+      // Ask x to store there if it can.
+      return x.get_rep ().fast_elem_insert_self (here, btyp);
+    }
+  else
+    return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,204 @@
+/*
+
+Copyright (C) 1998-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_base_matrix_h)
+#define octave_base_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "str-vec.h"
+#include "MatrixType.h"
+
+#include "error.h"
+#include "oct-obj.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+class tree_walker;
+
+// Real matrix values.
+
+template <class MT>
+class
+octave_base_matrix : public octave_base_value
+{
+public:
+
+  octave_base_matrix (void)
+    : octave_base_value (), matrix (), typ (), idx_cache () { }
+
+  octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ())
+    : octave_base_value (), matrix (m),
+      typ (t.is_known () ? new MatrixType (t) : 0), idx_cache ()
+  {
+    if (matrix.ndims () == 0)
+      matrix.resize (dim_vector (0, 0));
+  }
+
+  octave_base_matrix (const octave_base_matrix& m)
+    : octave_base_value (), matrix (m.matrix),
+      typ (m.typ ? new MatrixType (*m.typ) : 0),
+      idx_cache (m.idx_cache ? new idx_vector (*m.idx_cache) : 0)
+    { }
+
+  ~octave_base_matrix (void) { clear_cached_info (); }
+
+  size_t byte_size (void) const { return matrix.byte_size (); }
+
+  octave_value squeeze (void) const { return MT (matrix.squeeze ()); }
+
+  octave_value full_value (void) const { return matrix; }
+
+  void maybe_economize (void) { matrix.maybe_economize (); }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int)
+    { return subsref (type, idx); }
+
+  octave_value subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs);
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  octave_value_list do_multi_index_op (int, const octave_value_list& idx)
+    { return do_index_op (idx); }
+
+  void assign (const octave_value_list& idx, const MT& rhs);
+
+  void assign (const octave_value_list& idx, typename MT::element_type rhs);
+
+  void delete_elements (const octave_value_list& idx);
+
+  dim_vector dims (void) const { return matrix.dims (); }
+
+  octave_idx_type numel (void) const { return matrix.numel (); }
+
+  int ndims (void) const { return matrix.ndims (); }
+
+  octave_idx_type nnz (void) const { return matrix.nnz (); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return MT (matrix.reshape (new_dims)); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return MT (matrix.permute (vec, inv)); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+  octave_value all (int dim = 0) const { return matrix.all (dim); }
+  octave_value any (int dim = 0) const { return matrix.any (dim); }
+
+  MatrixType matrix_type (void) const { return typ ? *typ : MatrixType (); }
+  MatrixType matrix_type (const MatrixType& _typ) const;
+
+  octave_value diag (octave_idx_type k = 0) const
+    { return octave_value (matrix.diag (k)); }
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const
+    { return octave_value (matrix.diag (m, n)); }
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
+    { return octave_value (matrix.sort (dim, mode)); }
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const
+    { return octave_value (matrix.sort (sidx, dim, mode)); }
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const
+    { return matrix.is_sorted (mode); }
+
+  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
+    { return matrix.sort_rows_idx (mode); }
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
+    { return matrix.is_sorted_rows (mode); }
+
+  bool is_matrix_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return true; }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_true (void) const;
+
+  bool print_as_scalar (void) const;
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_info (std::ostream& os, const std::string& prefix) const;
+
+  MT& matrix_ref (void)
+    {
+      clear_cached_info ();
+      return matrix;
+    }
+
+  const MT& matrix_ref (void) const
+    {
+      return matrix;
+    }
+
+  octave_value
+  fast_elem_extract (octave_idx_type n) const;
+
+  bool
+  fast_elem_insert (octave_idx_type n, const octave_value& x);
+
+protected:
+
+  MT matrix;
+
+  idx_vector set_idx_cache (const idx_vector& idx) const
+    {
+      delete idx_cache;
+      idx_cache = idx ? new idx_vector (idx) : 0;
+      return idx;
+    }
+
+  void clear_cached_info (void) const
+    {
+      delete typ; typ = 0;
+      delete idx_cache; idx_cache = 0;
+    }
+
+  mutable MatrixType *typ;
+  mutable idx_vector *idx_cache;
+
+private:
+
+  // No assignment.
+
+  octave_base_matrix& operator = (const octave_base_matrix&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-scalar.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,184 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "oct-obj.h"
+#include "ov-base.h"
+#include "ov-cx-mat.h"
+#include "ov-re-mat.h"
+#include "ov-base-scalar.h"
+#include "pr-output.h"
+
+template <class ST>
+octave_value
+octave_base_scalar<ST>::subsref (const std::string& type,
+                                 const std::list<octave_value_list>& idx)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      retval = do_index_op (idx.front ());
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval.next_subsref (type, idx);
+}
+
+template <class ST>
+octave_value
+octave_base_scalar<ST>::subsasgn (const std::string& type,
+                                  const std::list<octave_value_list>& idx,
+                                  const octave_value& rhs)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        if (type.length () == 1)
+          retval = numeric_assign (type, idx, rhs);
+        else
+          {
+            std::string nm = type_name ();
+            error ("in indexed assignment of %s, last rhs index must be ()",
+                   nm.c_str ());
+          }
+      }
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval;
+}
+
+template <class ST>
+octave_value
+octave_base_scalar<ST>::permute (const Array<int>& vec, bool inv) const
+{
+  return Array<ST> (dim_vector (1, 1), scalar).permute (vec, inv);
+}
+
+template <class ST>
+octave_value
+octave_base_scalar<ST>::reshape (const dim_vector& new_dims) const
+{
+  return Array<ST> (dim_vector (1, 1), scalar).reshape (new_dims);
+}
+
+template <class ST>
+octave_value
+octave_base_scalar<ST>::diag (octave_idx_type k) const
+{
+  return Array<ST> (dim_vector (1, 1), scalar).diag (k);
+}
+
+template <class ST>
+octave_value
+octave_base_scalar<ST>::diag (octave_idx_type m, octave_idx_type n) const
+{
+  return Array<ST> (dim_vector (1, 1), scalar).diag (m, n);
+}
+
+template <class ST>
+bool
+octave_base_scalar<ST>::is_true (void) const
+{
+  bool retval = false;
+
+  if (xisnan (scalar))
+    gripe_nan_to_logical_conversion ();
+  else
+    retval = (scalar != ST ());
+
+  return retval;
+}
+
+template <class ST>
+void
+octave_base_scalar<ST>::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+
+template <class ST>
+void
+octave_base_scalar<ST>::print_raw (std::ostream& os,
+                                   bool pr_as_read_syntax) const
+{
+  indent (os);
+  octave_print_internal (os, scalar, pr_as_read_syntax);
+}
+
+template <class ST>
+bool
+octave_base_scalar<ST>::print_name_tag (std::ostream& os,
+                                        const std::string& name) const
+{
+  indent (os);
+  os << name << " = ";
+  return false;
+}
+
+template <class ST>
+bool
+octave_base_scalar<ST>::fast_elem_insert_self (void *where, builtin_type_t btyp) const
+{
+
+  // Don't use builtin_type () here to avoid an extra VM call.
+  if (btyp == class_to_btyp<ST>::btyp)
+    {
+      *(reinterpret_cast<ST *>(where)) = scalar;
+      return true;
+    }
+  else
+    return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-scalar.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,157 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_base_scalar_h)
+#define octave_base_scalar_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "lo-mappers.h"
+#include "lo-utils.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+#include "MatrixType.h"
+
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+// Real scalar values.
+
+template <class ST>
+class
+octave_base_scalar : public octave_base_value
+{
+public:
+
+  octave_base_scalar (void)
+    : octave_base_value (), scalar () { }
+
+  octave_base_scalar (const ST& s)
+    : octave_base_value (), scalar (s) { }
+
+  octave_base_scalar (const octave_base_scalar& s)
+    : octave_base_value (), scalar (s.scalar) { }
+
+  ~octave_base_scalar (void) { }
+
+  octave_value squeeze (void) const { return scalar; }
+
+  octave_value full_value (void) const { return scalar; }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int)
+    { return subsref (type, idx); }
+
+  octave_value subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs);
+
+  octave_value_list do_multi_index_op (int, const octave_value_list& idx)
+    { return do_index_op (idx); }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_defined (void) const { return true; }
+
+  dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; }
+
+  octave_idx_type numel (void) const { return 1; }
+
+  int ndims (void) const { return 2; }
+
+  octave_idx_type nnz (void) const { return (scalar != ST ()) ? 1 : 0; }
+
+  octave_value permute (const Array<int>&, bool = false) const;
+
+  octave_value reshape (const dim_vector& new_dims) const;
+
+  size_t byte_size (void) const { return sizeof (ST); }
+
+  octave_value all (int = 0) const { return (scalar != ST ()); }
+
+  octave_value any (int = 0) const { return (scalar != ST ()); }
+
+  octave_value diag (octave_idx_type k = 0) const;
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  octave_value sort (octave_idx_type, sortmode) const
+    { return octave_value (scalar); }
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type,
+                     sortmode) const
+    {
+      sidx.resize (dim_vector (1, 1));
+      sidx(0) = 0;
+      return octave_value (scalar);
+    }
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const
+    { return mode ? mode : ASCENDING; }
+
+  Array<octave_idx_type> sort_rows_idx (sortmode) const
+    {
+      return Array<octave_idx_type> (dim_vector (1, 1),
+                                     static_cast<octave_idx_type> (0));
+    }
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
+    { return mode ? mode : ASCENDING; }
+
+  MatrixType matrix_type (void) const { return MatrixType::Diagonal; }
+  MatrixType matrix_type (const MatrixType&) const
+    { return matrix_type (); }
+
+  bool is_scalar_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return true; }
+
+  bool is_true (void) const;
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool print_name_tag (std::ostream& os, const std::string& name) const;
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const { return const_cast<ST *> (&scalar); }
+
+  const ST& scalar_ref (void) const { return scalar; }
+
+  ST& scalar_ref (void) { return scalar; }
+
+  bool fast_elem_insert_self (void *where, builtin_type_t btyp) const;
+
+protected:
+
+  // The value of this scalar.
+  ST scalar;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-sparse.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,465 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+Copyright (C) 2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iomanip>
+#include <iostream>
+
+#include "oct-obj.h"
+#include "ov-base.h"
+#include "quit.h"
+#include "pr-output.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+#include "boolSparse.h"
+#include "ov-base-sparse.h"
+#include "pager.h"
+
+template <class T>
+octave_value
+octave_base_sparse<T>::do_index_op (const octave_value_list& idx,
+                                    bool resize_ok)
+{
+  octave_value retval;
+
+  octave_idx_type n_idx = idx.length ();
+
+  switch (n_idx)
+    {
+    case 0:
+      retval = matrix;
+      break;
+
+    case 1:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          retval = octave_value (matrix.index (i, resize_ok));
+      }
+      break;
+
+    case 2:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          {
+            idx_vector j = idx (1).index_vector ();
+
+            if (! error_state)
+              retval = octave_value (matrix.index (i, j, resize_ok));
+          }
+      }
+      break;
+    default:
+      error ("sparse indexing needs 1 or 2 indices");
+    }
+
+  return retval;
+}
+
+template <class T>
+octave_value
+octave_base_sparse<T>::subsref (const std::string& type,
+                                const std::list<octave_value_list>& idx)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      retval = do_index_op (idx.front ());
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval.next_subsref (type, idx);
+}
+
+template <class T>
+octave_value
+octave_base_sparse<T>::subsasgn (const std::string& type,
+                                 const std::list<octave_value_list>& idx,
+                                 const octave_value& rhs)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        if (type.length () == 1)
+          retval = numeric_assign (type, idx, rhs);
+        else
+          {
+            std::string nm = type_name ();
+            error ("in indexed assignment of %s, last lhs index must be ()",
+                   nm.c_str ());
+          }
+      }
+      break;
+
+    case '{':
+    case '.':
+      {
+        if (is_empty ())
+          {
+            octave_value tmp = octave_value::empty_conv (type, rhs);
+
+            retval = tmp.subsasgn (type, idx, rhs);
+          }
+        else
+          {
+            std::string nm = type_name ();
+            error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+          }
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval;
+}
+
+template <class T>
+void
+octave_base_sparse<T>::assign (const octave_value_list& idx, const T& rhs)
+{
+
+  octave_idx_type len = idx.length ();
+
+  switch (len)
+    {
+    case 1:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          matrix.assign (i, rhs);
+
+        break;
+      }
+
+    case 2:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          {
+            idx_vector j = idx (1).index_vector ();
+
+            if (! error_state)
+              matrix.assign (i, j, rhs);
+          }
+
+        break;
+      }
+
+    default:
+      error ("sparse indexing needs 1 or 2 indices");
+    }
+
+
+  // Invalidate matrix type.
+  typ.invalidate_type ();
+}
+
+template <class MT>
+void
+octave_base_sparse<MT>::delete_elements (const octave_value_list& idx)
+{
+  octave_idx_type len = idx.length ();
+
+  switch (len)
+    {
+    case 1:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          matrix.delete_elements (i);
+
+        break;
+      }
+
+    case 2:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          {
+            idx_vector j = idx (1).index_vector ();
+
+            if (! error_state)
+              matrix.delete_elements (i, j);
+          }
+
+        break;
+      }
+
+    default:
+      error ("sparse indexing needs 1 or 2 indices");
+    }
+
+  // Invalidate the matrix type
+  typ.invalidate_type ();
+}
+
+template <class T>
+octave_value
+octave_base_sparse<T>::resize (const dim_vector& dv, bool) const
+{
+  T retval (matrix);
+  retval.resize (dv);
+  return retval;
+}
+
+template <class T>
+bool
+octave_base_sparse<T>::is_true (void) const
+{
+  bool retval = false;
+  dim_vector dv = matrix.dims ();
+  octave_idx_type nel = dv.numel ();
+  octave_idx_type nz = nnz ();
+
+  if (nz == nel && nel > 0)
+    {
+      T t1 (matrix.reshape (dim_vector (nel, 1)));
+
+      SparseBoolMatrix t2 = t1.all ();
+
+      retval = t2(0);
+    }
+
+  return retval;
+}
+
+template <class T>
+bool
+octave_base_sparse<T>::print_as_scalar (void) const
+{
+  dim_vector dv = dims ();
+
+  return (dv.all_ones () || dv.any_zero ());
+}
+
+template <class T>
+void
+octave_base_sparse<T>::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+
+template <class T>
+void
+octave_base_sparse<T>::print_info (std::ostream& os,
+                                   const std::string& prefix) const
+{
+  matrix.print_info (os, prefix);
+}
+
+template <class T>
+void
+octave_base_sparse<T>::print_raw (std::ostream& os,
+                                  bool pr_as_read_syntax) const
+{
+  octave_idx_type nr = matrix.rows ();
+  octave_idx_type nc = matrix.cols ();
+  octave_idx_type nz = nnz ();
+
+  // FIXME -- this should probably all be handled by a
+  // separate octave_print_internal function that can handle format
+  // compact, loose, etc.
+
+  os << "Compressed Column Sparse (rows = " << nr
+     << ", cols = " << nc
+     << ", nnz = " << nz;
+
+  // Avoid calling numel here since it can easily overflow
+  // octave_idx_type even when there is no real problem storing the
+  // sparse array.
+
+  double dnr = nr;
+  double dnc = nc;
+  double dnel = dnr * dnc;
+
+  if (dnel > 0)
+    {
+      double pct = (nz / dnel * 100);
+
+      int prec = 2;
+
+      // Display at least 2 significant figures and up to 4 as we
+      // approach 100%.  Avoid having limited precision of the display
+      // result in reporting 100% for matrices that are not actually
+      // 100% full.
+
+      if (pct == 100)
+        prec = 3;
+      else
+        {
+          if (pct > 99.9)
+            prec = 4;
+          else if (pct > 99)
+            prec = 3;
+
+          if (pct > 99.99)
+            pct = 99.99;
+        }
+
+      os << " [" << std::setprecision (prec) << pct << "%]";
+    }
+
+  os << ")\n";
+
+  // add one to the printed indices to go from
+  //  zero-based to one-based arrays
+
+  if (nz != 0)
+    {
+      for (octave_idx_type j = 0; j < nc; j++)
+        {
+          octave_quit ();
+
+          // FIXME -- is there an easy way to get the max row
+          // and column indices so we can set the width appropriately
+          // and line up the columns here?  Similarly, we should look
+          // at all the nonzero values and display them with the same
+          // formatting rules that apply to columns of a matrix.
+
+          for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
+            {
+              os << "\n";
+              os << "  (" << matrix.ridx (i)+1 <<
+                ", "  << j+1 << ") -> ";
+
+              octave_print_internal (os, matrix.data (i), pr_as_read_syntax);
+            }
+        }
+    }
+}
+
+template <class T>
+bool
+octave_base_sparse<T>::save_ascii (std::ostream& os)
+{
+  dim_vector dv = this->dims ();
+
+  // Ensure that additional memory is deallocated
+  matrix.maybe_compress ();
+
+  os << "# nnz: "      << nnz () << "\n";
+  os << "# rows: "     << dv (0) << "\n";
+  os << "# columns: "  << dv (1) << "\n";
+
+  os << this->matrix;
+
+  return true;
+}
+
+template <class T>
+bool
+octave_base_sparse<T>::load_ascii (std::istream& is)
+{
+  octave_idx_type nz = 0;
+  octave_idx_type nr = 0;
+  octave_idx_type nc = 0;
+  bool success = true;
+
+  if (extract_keyword (is, "nnz", nz, true) &&
+      extract_keyword (is, "rows", nr, true) &&
+      extract_keyword (is, "columns", nc, true))
+    {
+      T tmp (nr, nc, nz);
+
+      is >> tmp;
+
+      if (!is)
+        {
+          error ("load: failed to load matrix constant");
+          success = false;
+        }
+
+      matrix = tmp;
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+template <class T>
+octave_value
+octave_base_sparse<T>::map (octave_base_value::unary_mapper_t umap) const
+{
+  // Try the map on the dense value.
+  octave_value retval = this->full_value ().map (umap);
+
+  // Sparsify the result if possible.
+  // FIXME: intentionally skip this step for string mappers. Is this wanted?
+  if (umap >= umap_xisalnum && umap <= umap_xtoupper)
+    return retval;
+
+  switch (retval.builtin_type ())
+    {
+    case btyp_double:
+      retval = retval.sparse_matrix_value ();
+      break;
+    case btyp_complex:
+      retval = retval.sparse_complex_matrix_value ();
+      break;
+    case btyp_bool:
+      retval = retval.sparse_bool_matrix_value ();
+      break;
+    default:
+      break;
+    }
+
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base-sparse.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,175 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+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_base_sparse_h)
+#define octave_base_sparse_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-obj.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+#include "boolSparse.h"
+#include "MatrixType.h"
+
+class tree_walker;
+
+class octave_sparse_bool_matrix;
+
+template <class T>
+class
+octave_base_sparse : public octave_base_value
+{
+ public:
+
+  octave_base_sparse (void)
+    : octave_base_value (), matrix (), typ (MatrixType ())
+  { }
+
+  octave_base_sparse (const T& a) : octave_base_value (), matrix (a),
+                                    typ (MatrixType ())
+  {
+    if (matrix.ndims () == 0)
+      matrix.resize (dim_vector (0, 0));
+  }
+
+  octave_base_sparse (const T& a, const MatrixType& t) : octave_base_value (),
+                                matrix (a), typ (t)
+  {
+    if (matrix.ndims () == 0)
+      matrix.resize (dim_vector (0, 0));
+  }
+
+  octave_base_sparse (const octave_base_sparse& a) :
+    octave_base_value (), matrix (a.matrix), typ (a.typ) { }
+
+  ~octave_base_sparse (void) { }
+
+  octave_idx_type nnz (void) const { return matrix.nnz (); }
+
+  octave_idx_type nzmax (void) const { return matrix.nzmax (); }
+
+  size_t byte_size (void) const { return matrix.byte_size (); }
+
+  octave_value squeeze (void) const { return matrix.squeeze (); }
+
+  octave_value full_value (void) const { return matrix.matrix_value (); }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int)
+    { return subsref (type, idx); }
+
+  octave_value subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs);
+
+  void assign (const octave_value_list& idx, const T& rhs);
+
+  void delete_elements (const octave_value_list& idx);
+
+  dim_vector dims (void) const { return matrix.dims (); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return T (matrix.reshape (new_dims)); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return T (matrix.permute (vec, inv)); }
+
+  octave_value resize (const dim_vector& dv, bool = false) const;
+
+  octave_value all (int dim = 0) const { return matrix.all (dim); }
+  octave_value any (int dim = 0) const { return matrix.any (dim); }
+
+  octave_value diag (octave_idx_type k = 0) const
+    { return octave_value (matrix.diag (k)); }
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
+    { return octave_value (matrix.sort (dim, mode)); }
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const
+    { return octave_value (matrix.sort (sidx, dim, mode)); }
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const
+    { return full_value ().is_sorted (mode); }
+
+  MatrixType matrix_type (void) const { return typ; }
+  MatrixType matrix_type (const MatrixType& _typ) const
+    { MatrixType ret = typ; typ = _typ; return ret; }
+
+  bool is_matrix_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return true; }
+
+  bool is_sparse_type (void) const { return true; }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_true (void) const;
+
+  octave_idx_type capacity (void) const { return matrix.capacity (); }
+
+  bool print_as_scalar (void) const;
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_info (std::ostream& os, const std::string& prefix) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  // Unsafe.  These functions exists to support the MEX interface.
+  // You should not use them anywhere else.
+  void *mex_get_data (void) const { return matrix.mex_get_data (); }
+
+  octave_idx_type *mex_get_ir (void) const { return matrix.mex_get_ir (); }
+
+  octave_idx_type *mex_get_jc (void) const { return matrix.mex_get_jc (); }
+
+protected:
+
+  octave_value map (octave_base_value::unary_mapper_t umap) const;
+
+  T matrix;
+
+  mutable MatrixType typ;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1579 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-mappers.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-map.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-base.h"
+#include "ov-cell.h"
+#include "ov-ch-mat.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-range.h"
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+#include "ov-str-mat.h"
+#include "ov-fcn-handle.h"
+#include "parse.h"
+#include "pr-output.h"
+#include "utils.h"
+#include "variables.h"
+
+builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y)
+{
+  builtin_type_t retval = btyp_unknown;
+
+  if (x == btyp_bool)
+    x = btyp_double;
+  if (y == btyp_bool)
+    y = btyp_double;
+
+  if (x <= btyp_float_complex && y <= btyp_float_complex)
+    retval = static_cast<builtin_type_t> (x | y);
+  else if (x <= btyp_uint64 && y <= btyp_float)
+    retval = x;
+  else if (x <= btyp_float && y <= btyp_uint64)
+    retval = y;
+  else if ((x >= btyp_int8 && x <= btyp_int64
+            && y >= btyp_int8 && y <= btyp_int64)
+           || (x >= btyp_uint8 && x <= btyp_uint64
+               && y >= btyp_uint8 && y <= btyp_uint64))
+    retval = (x > y) ? x : y;
+
+  return retval;
+}
+
+std::string btyp_class_name[btyp_num_types] =
+{
+  "double", "single", "double", "single",
+  "int8", "int16", "int32", "int64",
+  "uint8", "uint16", "uint32", "uint64",
+  "logical", "char",
+  "struct", "cell", "function_handle"
+};
+
+string_vector
+get_builtin_classes (void)
+{
+  static string_vector retval;
+
+  if (retval.is_empty ())
+    {
+      int n = btyp_num_types - 2;
+      retval = string_vector (n);
+      int j = 0;
+      for (int i = 0; i < btyp_num_types; i++)
+        {
+          builtin_type_t ityp = static_cast<builtin_type_t> (i);
+          if (ityp != btyp_complex && ityp != btyp_float_complex)
+            retval(j++) = btyp_class_name[i];
+        }
+    }
+
+  return retval;
+}
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value,
+                                     "<unknown type>", "unknown");
+
+// TRUE means to perform automatic sparse to real mutation if there
+// is memory to be saved
+bool Vsparse_auto_mutate = false;
+
+octave_base_value *
+octave_base_value::empty_clone (void) const
+{
+  return resize (dim_vector ()).clone ();
+}
+
+octave_value
+octave_base_value::squeeze (void) const
+{
+  std::string nm = type_name ();
+  error ("squeeze: invalid operation for %s type", nm.c_str ());
+  return octave_value ();
+}
+
+octave_value
+octave_base_value::full_value (void) const
+{
+  gripe_wrong_type_arg ("full: invalid operation for %s type", type_name ());
+  return octave_value ();
+}
+
+Matrix
+octave_base_value::size (void)
+{
+  const dim_vector dv = dims ();
+  Matrix mdv (1, dv.length ());
+  for (octave_idx_type i = 0; i < dv.length (); i++)
+    mdv(i) = dv(i);
+  return mdv;
+}
+
+octave_idx_type
+octave_base_value::numel (const octave_value_list& idx)
+{
+  return dims_to_numel (dims (), idx);
+}
+
+octave_value
+octave_base_value::subsref (const std::string&,
+                            const std::list<octave_value_list>&)
+{
+  std::string nm = type_name ();
+  error ("can't perform indexing operations for %s type", nm.c_str ());
+  return octave_value ();
+}
+
+octave_value_list
+octave_base_value::subsref (const std::string&,
+                            const std::list<octave_value_list>&, int)
+{
+  std::string nm = type_name ();
+  error ("can't perform indexing operations for %s type", nm.c_str ());
+  return octave_value ();
+}
+
+octave_value
+octave_base_value::subsref (const std::string& type,
+                            const std::list<octave_value_list>& idx,
+                            bool /* auto_add */)
+{
+  // This way we may get a more meaningful error message.
+  return subsref (type, idx);
+}
+
+octave_value_list
+octave_base_value::subsref (const std::string& type,
+                            const std::list<octave_value_list>& idx,
+                            int nargout,
+                            const std::list<octave_lvalue> *)
+{
+  // Fall back to call without passing lvalue list.
+  return subsref (type, idx, nargout);
+}
+
+octave_value
+octave_base_value::do_index_op (const octave_value_list&, bool)
+{
+  std::string nm = type_name ();
+  error ("can't perform indexing operations for %s type", nm.c_str ());
+  return octave_value ();
+}
+
+octave_value_list
+octave_base_value::do_multi_index_op (int, const octave_value_list&)
+{
+  std::string nm = type_name ();
+  error ("can't perform indexing operations for %s type", nm.c_str ());
+  return octave_value ();
+}
+
+octave_value_list
+octave_base_value::do_multi_index_op (int nargout, const octave_value_list& idx,
+                                      const std::list<octave_lvalue> *)
+{
+  // Fall back.
+  return do_multi_index_op (nargout, idx);
+}
+
+idx_vector
+octave_base_value::index_vector (void) const
+{
+  std::string nm = type_name ();
+  error ("%s type invalid as index value", nm.c_str ());
+  return idx_vector ();
+}
+
+octave_value
+octave_base_value::subsasgn (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             const octave_value& rhs)
+{
+  octave_value retval;
+
+  if (is_defined ())
+    {
+      if (is_numeric_type ())
+        {
+          switch (type[0])
+            {
+            case '(':
+              {
+                if (type.length () == 1)
+                  retval = numeric_assign (type, idx, rhs);
+                else if (is_empty ())
+                  {
+                    // Allow conversion of empty matrix to some other
+                    // type in cases like
+                    //
+                    //  x = []; x(i).f = rhs
+
+                    octave_value tmp = octave_value::empty_conv (type, rhs);
+
+                    retval = tmp.subsasgn (type, idx, rhs);
+                  }
+                else
+                  {
+                    std::string nm = type_name ();
+                    error ("in indexed assignment of %s, last rhs index must be ()",
+                           nm.c_str ());
+                  }
+              }
+              break;
+
+            case '{':
+            case '.':
+              {
+                std::string nm = type_name ();
+                error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+              }
+              break;
+
+            default:
+              panic_impossible ();
+            }
+        }
+      else
+        {
+          std::string nm = type_name ();
+          error ("can't perform indexed assignment for %s type", nm.c_str ());
+        }
+    }
+  else
+    {
+      // Create new object of appropriate type for given index and rhs
+      // types and then call undef_subsasgn for that object.
+
+      octave_value tmp = octave_value::empty_conv (type, rhs);
+
+      retval = tmp.undef_subsasgn (type, idx, rhs);
+    }
+
+  return retval;
+}
+
+octave_value
+octave_base_value::undef_subsasgn (const std::string& type,
+                                   const std::list<octave_value_list>& idx,
+                                   const octave_value& rhs)
+{
+  // In most cases, undef_subsasgn is handled the sams as subsasgn.  One
+  // exception is octave_class objects.
+
+  return subsasgn (type, idx, rhs);
+}
+
+octave_idx_type
+octave_base_value::nnz (void) const
+{
+  gripe_wrong_type_arg ("octave_base_value::nnz ()", type_name ());
+  return -1;
+}
+
+octave_idx_type
+octave_base_value::nzmax (void) const
+{
+  return numel ();
+}
+
+octave_idx_type
+octave_base_value::nfields (void) const
+{
+  gripe_wrong_type_arg ("octave_base_value::nfields ()", type_name ());
+  return -1;
+}
+
+octave_value
+octave_base_value::reshape (const dim_vector&) const
+{
+  gripe_wrong_type_arg ("octave_base_value::reshape ()", type_name ());
+  return octave_value ();
+}
+
+octave_value
+octave_base_value::permute (const Array<int>&, bool) const
+{
+  gripe_wrong_type_arg ("octave_base_value::permute ()", type_name ());
+  return octave_value ();
+}
+
+octave_value
+octave_base_value::resize (const dim_vector&, bool) const
+{
+  gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ());
+  return octave_value ();
+}
+
+MatrixType
+octave_base_value::matrix_type (void) const
+{
+  gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
+  return MatrixType ();
+}
+
+MatrixType
+octave_base_value::matrix_type (const MatrixType&) const
+{
+  gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
+  return MatrixType ();
+}
+
+octave_value
+octave_base_value::all (int) const
+{
+  return 0.0;
+}
+
+octave_value
+octave_base_value::any (int) const
+{
+  return 0.0;
+}
+
+octave_value
+octave_base_value::convert_to_str (bool pad, bool force, char type) const
+{
+  octave_value retval = convert_to_str_internal (pad, force, type);
+
+  if (! force && is_numeric_type ())
+    gripe_implicit_conversion ("Octave:num-to-str",
+                               type_name (), retval.type_name ());
+
+  return retval;
+}
+
+octave_value
+octave_base_value::convert_to_str_internal (bool, bool, char) const
+{
+  gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()",
+                        type_name ());
+  return octave_value ();
+}
+
+void
+octave_base_value::convert_to_row_or_column_vector (void)
+{
+  gripe_wrong_type_arg
+    ("octave_base_value::convert_to_row_or_column_vector ()",
+     type_name ());
+}
+
+void
+octave_base_value::print (std::ostream&, bool) const
+{
+  gripe_wrong_type_arg ("octave_base_value::print ()", type_name ());
+}
+
+void
+octave_base_value::print_raw (std::ostream&, bool) const
+{
+  gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ());
+}
+
+bool
+octave_base_value::print_name_tag (std::ostream& os, const std::string& name) const
+{
+  bool retval = false;
+
+  indent (os);
+
+  if (print_as_scalar ())
+    os << name << " = ";
+  else
+    {
+      os << name << " =";
+      newline (os);
+      if (! Vcompact_format)
+        newline (os);
+
+      retval = true;
+    }
+
+  return retval;
+}
+
+void
+octave_base_value::print_with_name (std::ostream& output_buf,
+                                    const std::string& name,
+                                    bool print_padding)
+{
+  bool pad_after = print_name_tag (output_buf, name);
+
+  print (output_buf);
+
+  if (print_padding  && pad_after && ! Vcompact_format)
+    newline (output_buf);
+}
+
+void
+octave_base_value::print_info (std::ostream& os,
+                               const std::string& /* prefix */) const
+{
+  os << "no info for type: " << type_name () << "\n";
+}
+
+#define INT_CONV_METHOD(T, F, MIN_LIMIT, MAX_LIMIT) \
+  T \
+  octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
+  { \
+    T retval = 0; \
+ \
+    double d = double_value (frc_str_conv); \
+ \
+    if (! error_state) \
+      { \
+        if (require_int && D_NINT (d) != d) \
+          error_with_cfn ("conversion of %g to " #T " value failed", d); \
+        else if (d < MIN_LIMIT) \
+          retval = MIN_LIMIT; \
+        else if (d > MAX_LIMIT) \
+          retval = MAX_LIMIT; \
+        else \
+          retval = static_cast<T> (::fix (d));  \
+      } \
+    else \
+      gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \
+                            type_name ()); \
+ \
+    return retval; \
+  }
+
+INT_CONV_METHOD (short int, short, SHRT_MIN, SHRT_MAX)
+INT_CONV_METHOD (unsigned short int, ushort, 0, USHRT_MAX)
+
+INT_CONV_METHOD (int, int, INT_MIN, INT_MAX)
+INT_CONV_METHOD (unsigned int, uint, 0, UINT_MAX)
+
+INT_CONV_METHOD (long int, long, LONG_MIN, LONG_MAX)
+INT_CONV_METHOD (unsigned long int, ulong, 0, ULONG_MAX)
+
+int
+octave_base_value::nint_value (bool frc_str_conv) const
+{
+  int retval = 0;
+
+  double d = double_value (frc_str_conv);
+
+  if (! error_state)
+    {
+      if (xisnan (d))
+        {
+          error ("conversion of NaN to integer value failed");
+          return retval;
+        }
+
+      retval = static_cast<int> (::fix (d));
+    }
+  else
+    gripe_wrong_type_arg ("octave_base_value::nint_value ()", type_name ());
+
+  return retval;
+}
+
+double
+octave_base_value::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+  gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
+  return retval;
+}
+
+float
+octave_base_value::float_value (bool) const
+{
+  float retval = lo_ieee_float_nan_value ();
+  gripe_wrong_type_arg ("octave_base_value::float_value ()", type_name ());
+  return retval;
+}
+
+Cell
+octave_base_value::cell_value () const
+{
+  Cell retval;
+  gripe_wrong_type_arg ("octave_base_value::cell_value()", type_name ());
+  return retval;
+}
+
+Matrix
+octave_base_value::matrix_value (bool) const
+{
+  Matrix retval;
+  gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
+  return retval;
+}
+
+FloatMatrix
+octave_base_value::float_matrix_value (bool) const
+{
+  FloatMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::float_matrix_value()", type_name ());
+  return retval;
+}
+
+NDArray
+octave_base_value::array_value (bool) const
+{
+  FloatNDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ());
+  return retval;
+}
+
+FloatNDArray
+octave_base_value::float_array_value (bool) const
+{
+  FloatNDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::float_array_value()", type_name ());
+  return retval;
+}
+
+Complex
+octave_base_value::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+  Complex retval (tmp, tmp);
+  gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
+  return retval;
+}
+
+FloatComplex
+octave_base_value::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+  FloatComplex retval (tmp, tmp);
+  gripe_wrong_type_arg ("octave_base_value::float_complex_value()", type_name ());
+  return retval;
+}
+
+ComplexMatrix
+octave_base_value::complex_matrix_value (bool) const
+{
+  ComplexMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()",
+                        type_name ());
+  return retval;
+}
+
+FloatComplexMatrix
+octave_base_value::float_complex_matrix_value (bool) const
+{
+  FloatComplexMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::float_complex_matrix_value()",
+                        type_name ());
+  return retval;
+}
+
+ComplexNDArray
+octave_base_value::complex_array_value (bool) const
+{
+  ComplexNDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::complex_array_value()",
+                        type_name ());
+  return retval;
+}
+
+FloatComplexNDArray
+octave_base_value::float_complex_array_value (bool) const
+{
+  FloatComplexNDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::float_complex_array_value()",
+                        type_name ());
+  return retval;
+}
+
+bool
+octave_base_value::bool_value (bool) const
+{
+  bool retval = false;
+  gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ());
+  return retval;
+}
+
+boolMatrix
+octave_base_value::bool_matrix_value (bool) const
+{
+  boolMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()",
+                        type_name ());
+  return retval;
+}
+
+boolNDArray
+octave_base_value::bool_array_value (bool) const
+{
+  boolNDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::bool_array_value()",
+                        type_name ());
+  return retval;
+}
+
+charMatrix
+octave_base_value::char_matrix_value (bool force) const
+{
+  charMatrix retval;
+
+  octave_value tmp = convert_to_str (false, force);
+
+  if (! error_state)
+    retval = tmp.char_matrix_value ();
+
+  return retval;
+}
+
+charNDArray
+octave_base_value::char_array_value (bool) const
+{
+  charNDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::char_array_value()",
+                        type_name ());
+  return retval;
+}
+
+SparseMatrix
+octave_base_value::sparse_matrix_value (bool) const
+{
+  SparseMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ());
+  return retval;
+}
+
+SparseComplexMatrix
+octave_base_value::sparse_complex_matrix_value (bool) const
+{
+  SparseComplexMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()", type_name ());
+  return retval;
+}
+
+SparseBoolMatrix
+octave_base_value::sparse_bool_matrix_value (bool) const
+{
+  SparseBoolMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()", type_name ());
+  return retval;
+}
+
+DiagMatrix
+octave_base_value::diag_matrix_value (bool) const
+{
+  DiagMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ());
+  return retval;
+}
+
+FloatDiagMatrix
+octave_base_value::float_diag_matrix_value (bool) const
+{
+  FloatDiagMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::float_diag_matrix_value()", type_name ());
+  return retval;
+}
+
+ComplexDiagMatrix
+octave_base_value::complex_diag_matrix_value (bool) const
+{
+  ComplexDiagMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()", type_name ());
+  return retval;
+}
+
+FloatComplexDiagMatrix
+octave_base_value::float_complex_diag_matrix_value (bool) const
+{
+  FloatComplexDiagMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()", type_name ());
+  return retval;
+}
+
+PermMatrix
+octave_base_value::perm_matrix_value (void) const
+{
+  PermMatrix retval;
+  gripe_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ());
+  return retval;
+}
+
+octave_int8
+octave_base_value::int8_scalar_value (void) const
+{
+  octave_int8 retval;
+  gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()",
+                        type_name ());
+  return retval;
+}
+
+octave_int16
+octave_base_value::int16_scalar_value (void) const
+{
+  octave_int16 retval;
+  gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()",
+                        type_name ());
+  return retval;
+}
+
+octave_int32
+octave_base_value::int32_scalar_value (void) const
+{
+  octave_int32 retval;
+  gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()",
+                        type_name ());
+  return retval;
+}
+
+octave_int64
+octave_base_value::int64_scalar_value (void) const
+{
+  octave_int64 retval;
+  gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()",
+                        type_name ());
+  return retval;
+}
+
+octave_uint8
+octave_base_value::uint8_scalar_value (void) const
+{
+  octave_uint8 retval;
+  gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()",
+                        type_name ());
+  return retval;
+}
+
+octave_uint16
+octave_base_value::uint16_scalar_value (void) const
+{
+  octave_uint16 retval;
+  gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()",
+                        type_name ());
+  return retval;
+}
+
+octave_uint32
+octave_base_value::uint32_scalar_value (void) const
+{
+  octave_uint32 retval;
+  gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()",
+                        type_name ());
+  return retval;
+}
+
+octave_uint64
+octave_base_value::uint64_scalar_value (void) const
+{
+  octave_uint64 retval;
+  gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()",
+                        type_name ());
+  return retval;
+}
+
+int8NDArray
+octave_base_value::int8_array_value (void) const
+{
+  int8NDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::int8_array_value()",
+                        type_name ());
+  return retval;
+}
+
+int16NDArray
+octave_base_value::int16_array_value (void) const
+{
+  int16NDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::int16_array_value()",
+                        type_name ());
+  return retval;
+}
+
+int32NDArray
+octave_base_value::int32_array_value (void) const
+{
+  int32NDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::int32_array_value()",
+                        type_name ());
+  return retval;
+}
+
+int64NDArray
+octave_base_value::int64_array_value (void) const
+{
+  int64NDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::int64_array_value()",
+                        type_name ());
+  return retval;
+}
+
+uint8NDArray
+octave_base_value::uint8_array_value (void) const
+{
+  uint8NDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::uint8_array_value()",
+                        type_name ());
+  return retval;
+}
+
+uint16NDArray
+octave_base_value::uint16_array_value (void) const
+{
+  uint16NDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::uint16_array_value()",
+                        type_name ());
+  return retval;
+}
+
+uint32NDArray
+octave_base_value::uint32_array_value (void) const
+{
+  uint32NDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::uint32_array_value()",
+                        type_name ());
+  return retval;
+}
+
+uint64NDArray
+octave_base_value::uint64_array_value (void) const
+{
+  uint64NDArray retval;
+  gripe_wrong_type_arg ("octave_base_value::uint64_array_value()",
+                        type_name ());
+  return retval;
+}
+
+string_vector
+octave_base_value::all_strings (bool pad) const
+{
+  string_vector retval;
+
+  octave_value tmp = convert_to_str (pad, true);
+
+  if (! error_state)
+    retval = tmp.all_strings ();
+
+  return retval;
+}
+
+std::string
+octave_base_value::string_value (bool force) const
+{
+  std::string retval;
+
+  octave_value tmp = convert_to_str (force);
+
+  if (! error_state)
+    retval = tmp.string_value ();
+
+  return retval;
+}
+
+Array<std::string>
+octave_base_value::cellstr_value (void) const
+{
+  Array<std::string> retval;
+  gripe_wrong_type_arg ("octave_base_value::cellstry_value()",
+                        type_name ());
+  return retval;
+}
+
+Range
+octave_base_value::range_value (void) const
+{
+  Range retval;
+  gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ());
+  return retval;
+}
+
+octave_map
+octave_base_value::map_value (void) const
+{
+  octave_map retval;
+  gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ());
+  return retval;
+}
+
+octave_scalar_map
+octave_base_value::scalar_map_value (void) const
+{
+  octave_map tmp = map_value ();
+
+  if (tmp.numel () == 1)
+    return tmp.checkelem (0);
+  else
+    {
+      if (! error_state)
+        error ("invalid conversion of multi-dimensional struct to scalar struct");
+
+      return octave_scalar_map ();
+    }
+}
+
+string_vector
+octave_base_value::map_keys (void) const
+{
+  string_vector retval;
+  gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ());
+  return retval;
+}
+
+size_t
+octave_base_value::nparents (void) const
+{
+  size_t retval = 0;
+  gripe_wrong_type_arg ("octave_base_value::nparents()", type_name ());
+  return retval;
+}
+
+std::list<std::string>
+octave_base_value::parent_class_name_list (void) const
+{
+  std::list<std::string> retval;
+  gripe_wrong_type_arg ("octave_base_value::parent_class_name_list()",
+                        type_name ());
+  return retval;
+}
+
+string_vector
+octave_base_value::parent_class_names (void) const
+{
+  string_vector retval;
+  gripe_wrong_type_arg ("octave_base_value::parent_class_names()",
+                        type_name ());
+  return retval;
+}
+
+octave_function *
+octave_base_value::function_value (bool silent)
+{
+  octave_function *retval = 0;
+
+  if (! silent)
+    gripe_wrong_type_arg ("octave_base_value::function_value()",
+                          type_name ());
+  return retval;
+}
+
+octave_user_function *
+octave_base_value::user_function_value (bool silent)
+{
+  octave_user_function *retval = 0;
+
+  if (! silent)
+    gripe_wrong_type_arg ("octave_base_value::user_function_value()",
+                          type_name ());
+  return retval;
+}
+
+octave_user_script *
+octave_base_value::user_script_value (bool silent)
+{
+  octave_user_script *retval = 0;
+
+  if (! silent)
+    gripe_wrong_type_arg ("octave_base_value::user_script_value()",
+                          type_name ());
+  return retval;
+}
+
+octave_user_code *
+octave_base_value::user_code_value (bool silent)
+{
+  octave_user_code *retval = 0;
+
+  if (! silent)
+    gripe_wrong_type_arg ("octave_base_value::user_code_value()",
+                          type_name ());
+  return retval;
+}
+
+octave_fcn_handle *
+octave_base_value::fcn_handle_value (bool silent)
+{
+  octave_fcn_handle *retval = 0;
+
+  if (! silent)
+    gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()",
+                          type_name ());
+  return retval;
+}
+
+octave_fcn_inline *
+octave_base_value::fcn_inline_value (bool silent)
+{
+  octave_fcn_inline *retval = 0;
+
+  if (! silent)
+    gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()",
+                          type_name ());
+  return retval;
+}
+
+octave_value_list
+octave_base_value::list_value (void) const
+{
+  octave_value_list retval;
+  gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ());
+  return retval;
+}
+
+bool
+octave_base_value::save_ascii (std::ostream&)
+{
+  gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ());
+  return false;
+}
+
+bool
+octave_base_value::load_ascii (std::istream&)
+{
+  gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ());
+  return false;
+}
+
+bool
+octave_base_value::save_binary (std::ostream&, bool&)
+{
+  gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
+  return false;
+}
+
+bool
+octave_base_value::load_binary (std::istream&, bool,
+                                oct_mach_info::float_format)
+{
+  gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
+  return false;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_base_value::save_hdf5 (hid_t, const char *, bool)
+{
+  gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
+
+  return false;
+}
+
+bool
+octave_base_value::load_hdf5 (hid_t, const char *)
+{
+  gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
+
+  return false;
+}
+
+#endif
+
+int
+octave_base_value::write (octave_stream&, int, oct_data_conv::data_type,
+                          int, oct_mach_info::float_format) const
+{
+  gripe_wrong_type_arg ("octave_base_value::write()", type_name ());
+
+  return false;
+}
+
+mxArray *
+octave_base_value::as_mxArray (void) const
+{
+  return 0;
+}
+
+octave_value
+octave_base_value::diag (octave_idx_type) const
+{
+  gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ());
+
+  return octave_value ();
+}
+
+octave_value
+octave_base_value::diag (octave_idx_type, octave_idx_type) const
+{
+  gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ());
+
+  return octave_value ();
+}
+
+octave_value
+octave_base_value::sort (octave_idx_type, sortmode) const
+{
+  gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ());
+
+  return octave_value ();
+}
+
+octave_value
+octave_base_value::sort (Array<octave_idx_type> &,
+                         octave_idx_type, sortmode) const
+{
+  gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ());
+
+  return octave_value ();
+}
+
+sortmode
+octave_base_value::is_sorted (sortmode) const
+{
+  gripe_wrong_type_arg ("octave_base_value::is_sorted ()", type_name ());
+
+  return UNSORTED;
+}
+
+Array<octave_idx_type>
+octave_base_value::sort_rows_idx (sortmode) const
+{
+  gripe_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ());
+
+  return Array<octave_idx_type> ();
+}
+
+sortmode
+octave_base_value::is_sorted_rows (sortmode) const
+{
+  gripe_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ());
+
+  return UNSORTED;
+}
+
+
+const char *
+octave_base_value::get_umap_name (unary_mapper_t umap)
+{
+  static const char *names[num_unary_mappers] =
+    {
+      "abs",
+      "acos",
+      "acosh",
+      "angle",
+      "arg",
+      "asin",
+      "asinh",
+      "atan",
+      "atanh",
+      "cbrt",
+      "ceil",
+      "conj",
+      "cos",
+      "cosh",
+      "erf",
+      "erfinv",
+      "erfcinv",
+      "erfc",
+      "exp",
+      "expm1",
+      "finite",
+      "fix",
+      "floor",
+      "gamma",
+      "imag",
+      "isinf",
+      "isna",
+      "isnan",
+      "lgamma",
+      "log",
+      "log2",
+      "log10",
+      "log1p",
+      "real",
+      "round",
+      "roundb",
+      "signum",
+      "sin",
+      "sinh",
+      "sqrt",
+      "tan",
+      "tanh",
+      "isalnum",
+      "isalpha",
+      "isascii",
+      "iscntrl",
+      "isdigit",
+      "isgraph",
+      "islower",
+      "isprint",
+      "ispunct",
+      "isspace",
+      "isupper",
+      "isxdigit",
+      "toascii",
+      "tolower",
+      "toupper"
+    };
+
+  if (umap < 0 || umap >= num_unary_mappers)
+    return "unknown";
+  else
+    return names[umap];
+}
+
+octave_value
+octave_base_value::map (unary_mapper_t umap) const
+{
+  error ("%s: not defined for %s", get_umap_name (umap), type_name ().c_str ());
+  return octave_value ();
+}
+
+void
+octave_base_value::lock (void)
+{
+  gripe_wrong_type_arg ("octave_base_value::lock ()", type_name ());
+}
+
+void
+octave_base_value::unlock (void)
+{
+  gripe_wrong_type_arg ("octave_base_value::unlock ()", type_name ());
+}
+
+void
+octave_base_value::dump (std::ostream& os) const
+{
+  dim_vector dv = this->dims ();
+
+  os << "class: " << this->class_name ()
+     << " type: " << this->type_name ()
+     << " dims: " << dv.str ();
+}
+
+static void
+gripe_indexed_assignment (const std::string& tn1, const std::string& tn2)
+{
+  error ("assignment of `%s' to indexed `%s' not implemented",
+         tn2.c_str (), tn1.c_str ());
+}
+
+static void
+gripe_assign_conversion_failed (const std::string& tn1,
+                                const std::string& tn2)
+{
+  error ("type conversion for assignment of `%s' to indexed `%s' failed",
+         tn2.c_str (), tn1.c_str ());
+}
+
+static void
+gripe_no_conversion (const std::string& on, const std::string& tn1,
+                     const std::string& tn2)
+{
+  error ("operator %s: no conversion for assignment of `%s' to indexed `%s'",
+         on.c_str (), tn2.c_str (), tn1.c_str ());
+}
+
+octave_value
+octave_base_value::numeric_assign (const std::string& type,
+                                   const std::list<octave_value_list>& idx,
+                                   const octave_value& rhs)
+{
+  octave_value retval;
+
+  if (idx.front ().empty ())
+    {
+      error ("missing index in indexed assignment");
+      return retval;
+    }
+
+  int t_lhs = type_id ();
+  int t_rhs = rhs.type_id ();
+
+  octave_value_typeinfo::assign_op_fcn f
+    = octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
+                                               t_lhs, t_rhs);
+
+  bool done = false;
+
+  if (f)
+    {
+      f (*this, idx.front (), rhs.get_rep ());
+
+      done = (! error_state);
+    }
+
+  if (done)
+    {
+      count++;
+      retval = octave_value (this);
+    }
+  else
+    {
+      int t_result
+        = octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, t_rhs);
+
+      if (t_result >= 0)
+        {
+          octave_base_value::type_conv_fcn cf
+            = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result);
+
+          if (cf)
+            {
+              octave_base_value *tmp = cf (*this);
+
+              if (tmp)
+                {
+                  octave_value val (tmp);
+
+                  retval = val.subsasgn (type, idx, rhs);
+
+                  done = (! error_state);
+                }
+              else
+                gripe_assign_conversion_failed (type_name (),
+                                                rhs.type_name ());
+            }
+          else
+            gripe_indexed_assignment (type_name (), rhs.type_name ());
+        }
+
+      if (! (done || error_state))
+        {
+          octave_value tmp_rhs;
+
+          octave_base_value::type_conv_info cf_rhs
+            = rhs.numeric_conversion_function ();
+
+          octave_base_value::type_conv_info cf_this
+            = numeric_conversion_function ();
+
+          // Try biased (one-sided) conversions first.
+          if (cf_rhs.type_id () >= 0
+              && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
+                                                           t_lhs, cf_rhs.type_id ())
+                  || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs,
+                                                                     cf_rhs.type_id ()) >= 0))
+            cf_this = 0;
+          else if (cf_this.type_id () >= 0
+                   && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
+                                                                cf_this.type_id (), t_rhs)
+                       || octave_value_typeinfo::lookup_pref_assign_conv (cf_this.type_id (),
+                                                                          t_rhs) >= 0))
+            cf_rhs = 0;
+
+          if (cf_rhs)
+            {
+              octave_base_value *tmp = cf_rhs (rhs.get_rep ());
+
+              if (tmp)
+                tmp_rhs = octave_value (tmp);
+              else
+                {
+                  gripe_assign_conversion_failed (type_name (),
+                                                  rhs.type_name ());
+                  return octave_value ();
+                }
+            }
+          else
+            tmp_rhs = rhs;
+
+          count++;
+          octave_value tmp_lhs = octave_value (this);
+
+          if (cf_this)
+            {
+              octave_base_value *tmp = cf_this (*this);
+
+              if (tmp)
+                tmp_lhs = octave_value (tmp);
+              else
+                {
+                  gripe_assign_conversion_failed (type_name (),
+                                                  rhs.type_name ());
+                  return octave_value ();
+                }
+            }
+
+          if (cf_this || cf_rhs)
+            {
+              retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
+
+              done = (! error_state);
+            }
+          else
+            gripe_no_conversion (octave_value::assign_op_as_string (octave_value::op_asn_eq),
+                                 type_name (), rhs.type_name ());
+        }
+    }
+
+  // The assignment may have converted to a type that is wider than
+  // necessary.
+
+  retval.maybe_mutate ();
+
+  return retval;
+}
+
+// Current indentation.
+int octave_base_value::curr_print_indent_level = 0;
+
+// TRUE means we are at the beginning of a line.
+bool octave_base_value::beginning_of_line = true;
+
+// Each print() function should call this before printing anything.
+//
+// This doesn't need to be fast, but isn't there a better way?
+
+void
+octave_base_value::indent (std::ostream& os) const
+{
+  assert (curr_print_indent_level >= 0);
+
+  if (beginning_of_line)
+    {
+      // FIXME -- do we need this?
+      // os << prefix;
+
+      for (int i = 0; i < curr_print_indent_level; i++)
+        os << " ";
+
+      beginning_of_line = false;
+    }
+}
+
+// All print() functions should use this to print new lines.
+
+void
+octave_base_value::newline (std::ostream& os) const
+{
+  os << "\n";
+
+  beginning_of_line = true;
+}
+
+// For ressetting print state.
+
+void
+octave_base_value::reset (void) const
+{
+  beginning_of_line = true;
+  curr_print_indent_level = 0;
+}
+
+
+octave_value
+octave_base_value::fast_elem_extract (octave_idx_type) const
+{
+  return octave_value ();
+}
+
+bool
+octave_base_value::fast_elem_insert (octave_idx_type, const octave_value&)
+{
+  return false;
+}
+
+bool
+octave_base_value::fast_elem_insert_self (void *, builtin_type_t) const
+{
+  return false;
+}
+
+CONVDECLX (matrix_conv)
+{
+  return new octave_matrix ();
+}
+
+CONVDECLX (complex_matrix_conv)
+{
+  return new octave_complex_matrix ();
+}
+
+CONVDECLX (string_conv)
+{
+  return new octave_char_matrix_str ();
+}
+
+CONVDECLX (cell_conv)
+{
+  return new octave_cell ();
+}
+
+void
+install_base_type_conversions (void)
+{
+  INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str);
+  INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell);
+
+  INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv);
+  INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv);
+  INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv);
+  INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv);
+}
+
+DEFUN (sparse_auto_mutate, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} sparse_auto_mutate ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} sparse_auto_mutate (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} sparse_auto_mutate (@var{new_val}, \"local\")\n\
+Query or set the internal variable that controls whether Octave will\n\
+automatically mutate sparse matrices to full matrices to save memory.\n\
+For example:\n\
+\n\
+@example\n\
+@group\n\
+s = speye (3);\n\
+sparse_auto_mutate (false);\n\
+s(:, 1) = 1;\n\
+typeinfo (s)\n\
+@result{} sparse matrix\n\
+sparse_auto_mutate (true);\n\
+s(1, :) = 1;\n\
+typeinfo (s)\n\
+@result{} matrix\n\
+@end group\n\
+@end example\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (sparse_auto_mutate);
+}
+
+/*
+%!test
+%! s = speye (3);
+%! sparse_auto_mutate (false);
+%! s(:, 1) = 1;
+%! assert (typeinfo (s), "sparse matrix");
+%! sparse_auto_mutate (true);
+%! s(1, :) = 1;
+%! assert (typeinfo (s), "matrix");
+%! sparse_auto_mutate (false);
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-base.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,820 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_base_value_h)
+#define octave_base_value_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <list>
+#include <string>
+
+#include "Range.h"
+#include "data-conv.h"
+#include "mxarray.h"
+#include "mx-base.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-hdf5.h"
+
+class Cell;
+class octave_map;
+class octave_scalar_map;
+class octave_value;
+class octave_value_list;
+class octave_stream;
+class octave_function;
+class octave_user_function;
+class octave_user_script;
+class octave_user_code;
+class octave_fcn_handle;
+class octave_fcn_inline;
+class octave_value_list;
+class octave_lvalue;
+
+class tree_walker;
+
+enum builtin_type_t
+{
+  btyp_double,
+  btyp_float,
+  btyp_complex,
+  btyp_float_complex,
+  btyp_int8,
+  btyp_int16,
+  btyp_int32,
+  btyp_int64,
+  btyp_uint8,
+  btyp_uint16,
+  btyp_uint32,
+  btyp_uint64,
+  btyp_bool,
+  btyp_char,
+  btyp_struct,
+  btyp_cell,
+  btyp_func_handle,
+  btyp_unknown,
+  btyp_num_types = btyp_unknown
+};
+
+extern OCTINTERP_API std::string
+btyp_class_name [btyp_num_types];
+
+extern OCTINTERP_API string_vector
+get_builtin_classes (void);
+
+inline bool btyp_isnumeric (builtin_type_t btyp)
+{ return btyp <= btyp_uint64; }
+
+inline bool btyp_isinteger (builtin_type_t btyp)
+{ return btyp >= btyp_int8 && btyp <= btyp_uint64; }
+
+inline bool btyp_isfloat (builtin_type_t btyp)
+{ return btyp <= btyp_float_complex; }
+
+inline bool btyp_isarray (builtin_type_t btyp)
+{ return btyp <= btyp_char; }
+
+// Compute a numeric type for a possibly mixed-type operation, using these rules:
+// bool -> double
+// single + double -> single
+// real + complex -> complex
+// integer + real -> integer
+// uint + uint -> uint (the bigger one)
+// sint + sint -> sint (the bigger one)
+//
+// failing otherwise.
+
+extern OCTINTERP_API
+builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y);
+
+template <class T>
+struct class_to_btyp
+{
+  static const builtin_type_t btyp = btyp_unknown;
+};
+
+#define DEF_CLASS_TO_BTYP(CLASS,BTYP) \
+template <> \
+struct class_to_btyp<CLASS> \
+{ static const builtin_type_t btyp = BTYP; }
+
+DEF_CLASS_TO_BTYP (double, btyp_double);
+DEF_CLASS_TO_BTYP (float, btyp_float);
+DEF_CLASS_TO_BTYP (Complex, btyp_complex);
+DEF_CLASS_TO_BTYP (FloatComplex, btyp_float_complex);
+DEF_CLASS_TO_BTYP (octave_int8, btyp_int8);
+DEF_CLASS_TO_BTYP (octave_int16, btyp_int16);
+DEF_CLASS_TO_BTYP (octave_int32, btyp_int32);
+DEF_CLASS_TO_BTYP (octave_int64, btyp_int64);
+DEF_CLASS_TO_BTYP (octave_uint8, btyp_uint8);
+DEF_CLASS_TO_BTYP (octave_uint16, btyp_uint16);
+DEF_CLASS_TO_BTYP (octave_uint32, btyp_uint32);
+DEF_CLASS_TO_BTYP (octave_uint64, btyp_uint64);
+DEF_CLASS_TO_BTYP (bool, btyp_bool);
+DEF_CLASS_TO_BTYP (char, btyp_char);
+
+// T_ID is the type id of struct objects, set by register_type().
+// T_NAME is the type name of struct objects.
+
+#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG)
+
+#define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual)
+
+#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \
+  public: \
+    VIRTUAL int type_id (void) const { return t_id; } \
+    VIRTUAL std::string type_name (void) const { return t_name; } \
+    VIRTUAL std::string class_name (void) const { return c_name; } \
+    static int static_type_id (void) { return t_id; } \
+    static std::string static_type_name (void) { return t_name; } \
+    static std::string static_class_name (void) { return c_name; } \
+    static void register_type (void); \
+ \
+  private: \
+    static int t_id; \
+    static const std::string t_name; \
+    static const std::string c_name;
+
+
+#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \
+  int t::t_id (-1); \
+  const std::string t::t_name (n); \
+  const std::string t::c_name (c); \
+  void t::register_type (void) \
+    { \
+      static t exemplar; \
+      octave_value v (&exemplar, true); \
+      t_id = octave_value_typeinfo::register_type (t::t_name, t::c_name, v); \
+    }
+
+// A base value type, so that derived types only have to redefine what
+// they need (if they are derived from octave_base_value instead of
+// octave_value).
+
+class
+OCTINTERP_API
+octave_base_value
+{
+public:
+
+  typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&);
+
+  // type conversion, including result type information
+  class type_conv_info
+  {
+  public:
+    type_conv_info (type_conv_fcn f = 0, int t = -1) : _fcn (f), _type_id (t) { }
+
+    operator type_conv_fcn (void) const { return _fcn; }
+
+    octave_base_value * operator () (const octave_base_value &v) const
+      { return (*_fcn) (v); }
+
+    int type_id (void) const { return _type_id; }
+
+  private:
+    type_conv_fcn _fcn;
+    int _type_id;
+  };
+
+  friend class octave_value;
+
+  octave_base_value (void) : count (1) { }
+
+  octave_base_value (const octave_base_value&) : count (1) { }
+
+  virtual ~octave_base_value (void) { }
+
+  // Unconditional clone. Always clones.
+  virtual octave_base_value *
+  clone (void) const { return new octave_base_value (*this); }
+
+  // Empty clone.
+  virtual octave_base_value *
+  empty_clone (void) const;
+
+  // Unique clone. Usually clones, but may be overriden to fake the
+  // cloning when sharing copies is to be controlled from within an
+  // instance (see octave_class).
+  virtual octave_base_value *
+  unique_clone (void) { return clone (); }
+
+  virtual type_conv_info
+  numeric_conversion_function (void) const
+    { return type_conv_info (); }
+
+  virtual type_conv_info
+  numeric_demotion_function (void) const
+    { return type_conv_info (); }
+
+  virtual octave_value squeeze (void) const;
+
+  virtual octave_value full_value (void) const;
+
+  virtual octave_base_value *try_narrowing_conversion (void) { return 0; }
+
+  virtual void maybe_economize (void) { }
+
+  virtual Matrix size (void);
+
+  virtual octave_idx_type numel (const octave_value_list&);
+
+  virtual octave_value
+  subsref (const std::string& type,
+           const std::list<octave_value_list>& idx);
+
+  virtual octave_value_list
+  subsref (const std::string& type,
+           const std::list<octave_value_list>& idx,
+           int nargout);
+
+  virtual octave_value
+  subsref (const std::string& type,
+           const std::list<octave_value_list>& idx,
+           bool auto_add);
+
+  virtual octave_value_list
+  subsref (const std::string& type,
+           const std::list<octave_value_list>& idx,
+           int nargout,
+           const std::list<octave_lvalue> *lvalue_list);
+
+  virtual octave_value
+  do_index_op (const octave_value_list& idx, bool resize_ok = false);
+
+  virtual octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& idx);
+
+  virtual octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& idx,
+                     const std::list<octave_lvalue> *lvalue_list);
+
+  virtual void assign (const std::string&, const octave_value&) { }
+
+  virtual octave_value
+  subsasgn (const std::string& type,
+            const std::list<octave_value_list>& idx,
+            const octave_value& rhs);
+
+  virtual octave_value
+  undef_subsasgn (const std::string& type,
+                  const std::list<octave_value_list>& idx,
+                  const octave_value& rhs);
+
+  virtual idx_vector index_vector (void) const;
+
+  virtual dim_vector dims (void) const { return dim_vector (); }
+
+  octave_idx_type rows (void) const
+    {
+      const dim_vector dv = dims ();
+
+      return dv(0);
+    }
+
+  octave_idx_type columns (void) const
+    {
+      const dim_vector dv = dims ();
+
+      return dv(1);
+    }
+
+  virtual int ndims (void) const
+    { return dims ().length (); }
+
+  virtual octave_idx_type numel (void) const { return dims ().numel (); }
+
+  virtual octave_idx_type capacity (void) const { return numel (); }
+
+  virtual size_t byte_size (void) const { return 0; }
+
+  virtual octave_idx_type nnz (void) const;
+
+  virtual octave_idx_type nzmax (void) const;
+
+  virtual octave_idx_type nfields (void) const;
+
+  virtual octave_value reshape (const dim_vector&) const;
+
+  virtual octave_value permute (const Array<int>& vec, bool = false) const;
+
+  virtual octave_value resize (const dim_vector&, bool fill = false) const;
+
+  virtual MatrixType matrix_type (void) const;
+
+  virtual MatrixType matrix_type (const MatrixType& typ) const;
+
+  virtual bool is_defined (void) const { return false; }
+
+  bool is_empty (void) const { return numel () == 0; }
+
+  virtual bool is_cell (void) const { return false; }
+
+  virtual bool is_cellstr (void) const { return false; }
+
+  virtual bool is_real_scalar (void) const { return false; }
+
+  virtual bool is_real_matrix (void) const { return false; }
+
+  virtual bool is_real_nd_array (void) const { return false; }
+
+  virtual bool is_complex_scalar (void) const { return false; }
+
+  virtual bool is_complex_matrix (void) const { return false; }
+
+  virtual bool is_bool_scalar (void) const { return false; }
+
+  virtual bool is_bool_matrix (void) const { return false; }
+
+  virtual bool is_char_matrix (void) const { return false; }
+
+  virtual bool is_diag_matrix (void) const { return false; }
+
+  virtual bool is_perm_matrix (void) const { return false; }
+
+  virtual bool is_string (void) const { return false; }
+
+  virtual bool is_sq_string (void) const { return false; }
+
+  virtual bool is_range (void) const { return false; }
+
+  virtual bool is_map (void) const { return false; }
+
+  virtual bool is_object (void) const { return false; }
+
+  virtual bool is_cs_list (void) const { return false; }
+
+  virtual bool is_magic_colon (void) const { return false; }
+
+  virtual bool is_all_va_args (void) const { return false; }
+
+  virtual octave_value all (int = 0) const;
+
+  virtual octave_value any (int = 0) const;
+
+  virtual builtin_type_t builtin_type (void) const { return btyp_unknown; }
+
+  virtual bool is_double_type (void) const { return false; }
+
+  virtual bool is_single_type (void) const { return false; }
+
+  virtual bool is_float_type (void) const { return false; }
+
+  virtual bool is_int8_type (void) const { return false; }
+
+  virtual bool is_int16_type (void) const { return false; }
+
+  virtual bool is_int32_type (void) const { return false; }
+
+  virtual bool is_int64_type (void) const { return false; }
+
+  virtual bool is_uint8_type (void) const { return false; }
+
+  virtual bool is_uint16_type (void) const { return false; }
+
+  virtual bool is_uint32_type (void) const { return false; }
+
+  virtual bool is_uint64_type (void) const { return false; }
+
+  virtual bool is_bool_type (void) const { return false; }
+
+  virtual bool is_integer_type (void) const { return false; }
+
+  virtual bool is_real_type (void) const { return false; }
+
+  virtual bool is_complex_type (void) const { return false; }
+
+  // Would be nice to get rid of the next four functions:
+
+  virtual bool is_scalar_type (void) const { return false; }
+
+  virtual bool is_matrix_type (void) const { return false; }
+
+  virtual bool is_numeric_type (void) const { return false; }
+
+  virtual bool is_sparse_type (void) const { return false; }
+
+  virtual bool is_true (void) const { return false; }
+
+  virtual bool is_null_value (void) const { return false; }
+
+  virtual bool is_constant (void) const { return false; }
+
+  virtual bool is_function_handle (void) const { return false; }
+
+  virtual bool is_anonymous_function (void) const { return false; }
+
+  virtual bool is_inline_function (void) const { return false; }
+
+  virtual bool is_function (void) const { return false; }
+
+  virtual bool is_user_script (void) const { return false; }
+
+  virtual bool is_user_function (void) const { return false; }
+
+  virtual bool is_user_code (void) const { return false; }
+
+  virtual bool is_builtin_function (void) const { return false; }
+
+  virtual bool is_dld_function (void) const { return false; }
+
+  virtual bool is_mex_function (void) const { return false; }
+
+  virtual void erase_subfunctions (void) { }
+
+  virtual short int short_value (bool = false, bool = false) const;
+
+  virtual unsigned short int ushort_value (bool = false, bool = false) const;
+
+  virtual int int_value (bool = false, bool = false) const;
+
+  virtual unsigned int uint_value (bool = false, bool = false) const;
+
+  virtual int nint_value (bool = false) const;
+
+  virtual long int long_value (bool = false, bool = false) const;
+
+  virtual unsigned long int ulong_value (bool = false, bool = false) const;
+
+  virtual double double_value (bool = false) const;
+
+  virtual float float_value (bool = false) const;
+
+  virtual double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  virtual float float_scalar_value (bool frc_str_conv = false) const
+    { return float_value (frc_str_conv); }
+
+  virtual Cell cell_value (void) const;
+
+  virtual Matrix matrix_value (bool = false) const;
+
+  virtual FloatMatrix float_matrix_value (bool = false) const;
+
+  virtual NDArray array_value (bool = false) const;
+
+  virtual FloatNDArray float_array_value (bool = false) const;
+
+  virtual Complex complex_value (bool = false) const;
+
+  virtual FloatComplex float_complex_value (bool = false) const;
+
+  virtual ComplexMatrix complex_matrix_value (bool = false) const;
+
+  virtual FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  virtual ComplexNDArray complex_array_value (bool = false) const;
+
+  virtual FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  virtual bool bool_value (bool = false) const;
+
+  virtual boolMatrix bool_matrix_value (bool = false) const;
+
+  virtual boolNDArray bool_array_value (bool = false) const;
+
+  virtual charMatrix char_matrix_value (bool force = false) const;
+
+  virtual charNDArray char_array_value (bool = false) const;
+
+  virtual SparseMatrix sparse_matrix_value (bool = false) const;
+
+  virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
+
+  virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const;
+
+  virtual DiagMatrix diag_matrix_value (bool = false) const;
+
+  virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const;
+
+  virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
+
+  virtual FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
+
+  virtual PermMatrix perm_matrix_value (void) const;
+
+  virtual octave_int8 int8_scalar_value (void) const;
+
+  virtual octave_int16 int16_scalar_value (void) const;
+
+  virtual octave_int32 int32_scalar_value (void) const;
+
+  virtual octave_int64 int64_scalar_value (void) const;
+
+  virtual octave_uint8 uint8_scalar_value (void) const;
+
+  virtual octave_uint16 uint16_scalar_value (void) const;
+
+  virtual octave_uint32 uint32_scalar_value (void) const;
+
+  virtual octave_uint64 uint64_scalar_value (void) const;
+
+  virtual int8NDArray int8_array_value (void) const;
+
+  virtual int16NDArray int16_array_value (void) const;
+
+  virtual int32NDArray int32_array_value (void) const;
+
+  virtual int64NDArray int64_array_value (void) const;
+
+  virtual uint8NDArray uint8_array_value (void) const;
+
+  virtual uint16NDArray uint16_array_value (void) const;
+
+  virtual uint32NDArray uint32_array_value (void) const;
+
+  virtual uint64NDArray uint64_array_value (void) const;
+
+  virtual string_vector all_strings (bool pad = false) const;
+
+  virtual std::string string_value (bool force = false) const;
+
+  virtual Array<std::string> cellstr_value (void) const;
+
+  virtual Range range_value (void) const;
+
+  virtual octave_map map_value (void) const;
+
+  virtual octave_scalar_map scalar_map_value (void) const;
+
+  virtual string_vector map_keys (void) const;
+
+  virtual size_t nparents (void) const;
+
+  virtual std::list<std::string> parent_class_name_list (void) const;
+
+  virtual string_vector parent_class_names (void) const;
+
+  virtual octave_base_value *find_parent_class (const std::string&)
+    { return 0; }
+
+  virtual octave_base_value *unique_parent_class (const std::string&)
+    { return 0; }
+
+  virtual octave_function *function_value (bool silent = false);
+
+  virtual octave_user_function *user_function_value (bool silent = false);
+
+  virtual octave_user_script *user_script_value (bool silent = false);
+
+  virtual octave_user_code *user_code_value (bool silent = false);
+
+  virtual octave_fcn_handle *fcn_handle_value (bool silent = false);
+
+  virtual octave_fcn_inline *fcn_inline_value (bool silent = false);
+
+  virtual octave_value_list list_value (void) const;
+
+  virtual octave_value convert_to_str (bool pad = false, bool force = false,
+                                       char type = '\'') const;
+  virtual octave_value
+  convert_to_str_internal (bool pad, bool force, char type) const;
+
+  virtual void convert_to_row_or_column_vector (void);
+
+  virtual bool print_as_scalar (void) const { return false; }
+
+  virtual void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  virtual void
+  print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  virtual bool
+  print_name_tag (std::ostream& os, const std::string& name) const;
+
+  virtual void
+  print_with_name (std::ostream& output_buf, const std::string& name,
+                   bool print_padding = true);
+
+  virtual void print_info (std::ostream& os, const std::string& prefix) const;
+
+  virtual bool save_ascii (std::ostream& os);
+
+  virtual bool load_ascii (std::istream& is);
+
+  virtual bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  virtual bool load_binary (std::istream& is, bool swap,
+                            oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  virtual bool
+  save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  virtual bool
+  load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  virtual int
+  write (octave_stream& os, int block_size,
+         oct_data_conv::data_type output_type, int skip,
+         oct_mach_info::float_format flt_fmt) const;
+
+  virtual void *mex_get_data (void) const { return 0; }
+
+  virtual octave_idx_type *mex_get_ir (void) const { return 0; }
+
+  virtual octave_idx_type *mex_get_jc (void) const { return 0; }
+
+  virtual mxArray *as_mxArray (void) const;
+
+  virtual octave_value diag (octave_idx_type k = 0) const;
+
+  virtual octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  virtual octave_value sort (octave_idx_type dim = 0,
+                             sortmode mode = ASCENDING) const;
+  virtual octave_value sort (Array<octave_idx_type> &sidx,
+                             octave_idx_type dim = 0,
+                             sortmode mode = ASCENDING) const;
+
+  virtual sortmode is_sorted (sortmode mode = UNSORTED) const;
+
+  virtual Array<octave_idx_type>
+  sort_rows_idx (sortmode mode = ASCENDING) const;
+
+  virtual sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
+
+  virtual void lock (void);
+
+  virtual void unlock (void);
+
+  virtual bool islocked (void) const { return false; }
+
+  virtual void dump (std::ostream& os) const;
+
+  // Standard mappers. Register new ones here.
+  enum unary_mapper_t
+    {
+      umap_abs,
+      umap_acos,
+      umap_acosh,
+      umap_angle,
+      umap_arg,
+      umap_asin,
+      umap_asinh,
+      umap_atan,
+      umap_atanh,
+      umap_cbrt,
+      umap_ceil,
+      umap_conj,
+      umap_cos,
+      umap_cosh,
+      umap_erf,
+      umap_erfinv,
+      umap_erfcinv,
+      umap_erfc,
+      umap_erfcx,
+      umap_exp,
+      umap_expm1,
+      umap_finite,
+      umap_fix,
+      umap_floor,
+      umap_gamma,
+      umap_imag,
+      umap_isinf,
+      umap_isna,
+      umap_isnan,
+      umap_lgamma,
+      umap_log,
+      umap_log2,
+      umap_log10,
+      umap_log1p,
+      umap_real,
+      umap_round,
+      umap_roundb,
+      umap_signum,
+      umap_sin,
+      umap_sinh,
+      umap_sqrt,
+      umap_tan,
+      umap_tanh,
+      umap_xisalnum,
+      umap_xisalpha,
+      umap_xisascii,
+      umap_xiscntrl,
+      umap_xisdigit,
+      umap_xisgraph,
+      umap_xislower,
+      umap_xisprint,
+      umap_xispunct,
+      umap_xisspace,
+      umap_xisupper,
+      umap_xisxdigit,
+      umap_xtoascii,
+      umap_xtolower,
+      umap_xtoupper,
+      umap_unknown,
+      num_unary_mappers = umap_unknown
+    };
+
+  virtual octave_value map (unary_mapper_t) const;
+
+  // These are fast indexing & assignment shortcuts for extracting
+  // or inserting a single scalar from/to an array.
+
+  // Extract the n-th element, aka val(n). Result is undefined if val is not an
+  // array type or n is out of range. Never error.
+  virtual octave_value
+  fast_elem_extract (octave_idx_type n) const;
+
+  // Assign the n-th element, aka val(n) = x. Returns false if val is not an
+  // array type, x is not a matching scalar type, or n is out of range.
+  // Never error.
+  virtual bool
+  fast_elem_insert (octave_idx_type n, const octave_value& x);
+
+  // This is a helper for the above, to be overriden in scalar types.  The
+  // whole point is to handle the insertion efficiently with just *two* VM
+  // calls, which is basically the theoretical minimum.
+  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.
+
+  octave_value numeric_assign (const std::string& type,
+                               const std::list<octave_value_list>& idx,
+                               const octave_value& rhs);
+
+  void reset_indent_level (void) const
+    { curr_print_indent_level = 0; }
+
+  void increment_indent_level (void) const
+    { curr_print_indent_level += 2; }
+
+  void decrement_indent_level (void) const
+    { curr_print_indent_level -= 2; }
+
+  int current_print_indent_level (void) const
+    { return curr_print_indent_level; }
+
+  void indent (std::ostream& os) const;
+
+  void newline (std::ostream& os) const;
+
+  void reset (void) const;
+
+  // A reference count.
+  // NOTE: the declaration is octave_idx_type because with 64-bit indexing,
+  // it is well possible to have more than MAX_INT copies of a single value
+  // (think of an empty cell array with >2G elements).
+  octave_refcount<octave_idx_type> count;
+
+private:
+
+  static const char *get_umap_name (unary_mapper_t);
+
+  static int curr_print_indent_level;
+  static bool beginning_of_line;
+
+  DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA
+};
+
+// TRUE means to perform automatic sparse to real mutation if there
+// is memory to be saved
+extern OCTINTERP_API bool Vsparse_auto_mutate;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-bool-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,588 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <vector>
+
+#include "lo-ieee.h"
+#include "mx-base.h"
+#include "oct-locbuf.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ops.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-mat.cc"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-re-mat.h"
+#include "pr-output.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+#include "ls-utils.h"
+
+template class octave_base_matrix<boolNDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_bool_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_bool_matrix,
+                                     "bool matrix", "logical");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_bool_matrix&);
+
+  return new octave_matrix (NDArray (v.bool_array_value ()));
+}
+
+octave_base_value::type_conv_info
+octave_bool_matrix::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_bool_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.ndims () == 2)
+    {
+      boolMatrix bm = matrix.matrix_value ();
+
+      octave_idx_type nr = bm.rows ();
+      octave_idx_type nc = bm.cols ();
+
+      if (nr == 1 && nc == 1)
+        retval = new octave_bool (bm (0, 0));
+    }
+
+  return retval;
+}
+
+double
+octave_bool_matrix::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "bool matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("bool matrix", "real scalar");
+
+  return retval;
+}
+
+float
+octave_bool_matrix::float_value (bool) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "bool matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("bool matrix", "real scalar");
+
+  return retval;
+}
+
+Complex
+octave_bool_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "bool matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("bool matrix", "complex scalar");
+
+  return retval;
+}
+
+FloatComplex
+octave_bool_matrix::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "bool matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("bool matrix", "complex scalar");
+
+  return retval;
+}
+
+octave_value
+octave_bool_matrix::convert_to_str_internal (bool pad, bool force,
+                                             char type) const
+{
+  octave_value tmp = octave_value (array_value ());
+  return tmp.convert_to_str (pad, force, type);
+}
+
+void
+octave_bool_matrix::print_raw (std::ostream& os,
+                               bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, matrix, pr_as_read_syntax,
+                         current_print_indent_level ());
+}
+
+bool
+octave_bool_matrix::save_ascii (std::ostream& os)
+{
+  dim_vector d = dims ();
+  if (d.length () > 2)
+    {
+      NDArray tmp = array_value ();
+      os << "# ndims: " << d.length () << "\n";
+
+      for (int i = 0; i < d.length (); i++)
+        os << " " << d (i);
+
+      os << "\n" << tmp;
+    }
+  else
+    {
+      // Keep this case, rather than use generic code above for backward
+      // compatiability. Makes load_ascii much more complex!!
+      os << "# rows: " << rows () << "\n"
+         << "# columns: " << columns () << "\n";
+
+      Matrix tmp = matrix_value ();
+
+      os << tmp;
+    }
+
+  return true;
+}
+
+bool
+octave_bool_matrix::load_ascii (std::istream& is)
+{
+  bool success = true;
+
+  string_vector keywords (2);
+
+  keywords[0] = "ndims";
+  keywords[1] = "rows";
+
+  std::string kw;
+  octave_idx_type val = 0;
+
+  if (extract_keyword (is, keywords, kw, val, true))
+    {
+      if (kw == "ndims")
+        {
+          int mdims = static_cast<int> (val);
+
+          if (mdims >= 0)
+            {
+              dim_vector dv;
+              dv.resize (mdims);
+
+              for (int i = 0; i < mdims; i++)
+                is >> dv(i);
+
+              if (is)
+                {
+                  boolNDArray btmp (dv);
+
+                  if (btmp.is_empty ())
+                    matrix = btmp;
+                  else
+                    {
+                      NDArray tmp(dv);
+                      is >> tmp;
+
+                      if (is)
+                        {
+                          for (octave_idx_type i = 0; i < btmp.nelem (); i++)
+                            btmp.elem (i) = (tmp.elem (i) != 0.);
+
+                          matrix = btmp;
+                        }
+                      else
+                        {
+                          error ("load: failed to load matrix constant");
+                          success = false;
+                        }
+                    }
+                }
+              else
+                {
+                  error ("load: failed to extract dimensions");
+                  success = false;
+                }
+            }
+          else
+            {
+              error ("load: failed to extract number of dimensions");
+              success = false;
+            }
+        }
+      else if (kw == "rows")
+        {
+          octave_idx_type nr = val;
+          octave_idx_type nc = 0;
+
+          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
+            {
+              if (nr > 0 && nc > 0)
+                {
+                  Matrix tmp (nr, nc);
+                  is >> tmp;
+                  if (is)
+                    {
+                      boolMatrix btmp (nr, nc);
+                      for (octave_idx_type j = 0; j < nc; j++)
+                        for (octave_idx_type i = 0; i < nr; i++)
+                          btmp.elem (i,j) = (tmp.elem (i, j) != 0.);
+
+                      matrix = btmp;
+                    }
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else if (nr == 0 || nc == 0)
+                matrix = boolMatrix (nr, nc);
+              else
+                panic_impossible ();
+            }
+          else
+            {
+              error ("load: failed to extract number of rows and columns");
+              success = false;
+            }
+        }
+      else
+        panic_impossible ();
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_bool_matrix::save_binary (std::ostream& os, bool& /* save_as_floats */)
+{
+
+  dim_vector d = dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims to differentiate with old format!!
+  int32_t tmp = - d.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  for (int i = 0; i < d.length (); i++)
+    {
+      tmp = d(i);
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+    }
+
+  boolNDArray m = bool_array_value ();
+  bool *mtmp = m.fortran_vec ();
+  octave_idx_type nel = m.nelem ();
+  OCTAVE_LOCAL_BUFFER (char, htmp, nel);
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    htmp[i] = (mtmp[i] ? 1 : 0);
+
+  os.write (htmp, nel);
+
+  return true;
+}
+
+bool
+octave_bool_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format /* fmt */)
+{
+  int32_t mdims;
+  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&mdims);
+  if (mdims >= 0)
+    return false;
+
+  // mdims is negative for consistency with other matrices, where it is
+  // negative to allow the positive value to be used for rows/cols for
+  // backward compatibility
+  mdims = - mdims;
+  int32_t di;
+  dim_vector dv;
+  dv.resize (mdims);
+
+  for (int i = 0; i < mdims; i++)
+    {
+      if (! is.read (reinterpret_cast<char *> (&di), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&di);
+      dv(i) = di;
+    }
+
+  // Convert an array with a single dimension to be a row vector.
+  // Octave should never write files like this, other software
+  // might.
+
+  if (mdims == 1)
+    {
+      mdims = 2;
+      dv.resize (mdims);
+      dv(1) = dv(0);
+      dv(0) = 1;
+    }
+
+  octave_idx_type nel = dv.numel ();
+  OCTAVE_LOCAL_BUFFER (char, htmp, nel);
+  if (! is.read (htmp, nel))
+    return false;
+  boolNDArray m(dv);
+  bool *mtmp = m.fortran_vec ();
+  for (octave_idx_type i = 0; i < nel; i++)
+    mtmp[i] = (htmp[i] ? 1 : 0);
+  matrix = m;
+
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_bool_matrix::save_hdf5 (hid_t loc_id, const char *name,
+                               bool /* save_as_floats */)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  int rank = dv.length ();
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+  boolNDArray m = bool_array_value ();
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  for (int i = 0; i < rank; i++)
+    hdims[i] = dv (rank-i-1);
+
+  space_hid = H5Screate_simple (rank, hdims, 0);
+  if (space_hid < 0) return false;
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  octave_idx_type nel = m.nelem ();
+  bool *mtmp = m.fortran_vec ();
+  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel);
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    htmp[i] = mtmp[i];
+
+  retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, htmp) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_bool_matrix::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+    return (empty > 0);
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank < 1)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  if (rank == 1)
+    {
+      dv.resize (2);
+      dv(0) = 1;
+      dv(1) = hdims[0];
+    }
+  else
+    {
+      dv.resize (rank);
+      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
+        dv(j) = hdims[i];
+    }
+
+  octave_idx_type nel = dv.numel ();
+  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel);
+  if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, htmp) >= 0)
+    {
+      retval = true;
+
+      boolNDArray btmp (dv);
+      for (octave_idx_type i = 0; i < nel; i++)
+          btmp.elem (i) = htmp[i];
+
+      matrix = btmp;
+    }
+
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_bool_matrix::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxLOGICAL_CLASS, dims (), mxREAL);
+
+  bool *pr = static_cast<bool *> (retval->get_data ());
+
+  mwSize nel = numel ();
+
+  const bool *p = matrix.data ();
+
+  for (mwIndex i = 0; i < nel; i++)
+    pr[i] = p[i];
+
+  return retval;
+}
+
+DEFUN (logical, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} logical (@var{x})\n\
+Convert @var{x} to logical type.\n\
+@seealso{double, single, char}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    {
+      octave_value arg = args(0);
+      if (arg.is_bool_type ())
+        retval = arg;
+      else if (arg.is_numeric_type ())
+        {
+          if (arg.is_sparse_type ())
+            retval = arg.sparse_bool_matrix_value ();
+          else if (arg.is_scalar_type ())
+            retval = arg.bool_value ();
+          else
+            retval = arg.bool_array_value ();
+        }
+      else
+        gripe_wrong_type_arg ("logical", arg);
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!test
+%! m = eye (2) != 0;
+%! s = !0;
+%! c = {"double", "single", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "logical"};
+%! for i = 1:numel (c)
+%!   assert (logical (eye (2, c{i})), m)
+%!   assert (logical (eye (1, c{i})), s)
+%! endfor
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-bool-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,235 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_bool_matrix_h)
+#define octave_bool_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+
+#include "MatrixType.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Character matrix values.
+
+class
+octave_bool_matrix : public octave_base_matrix<boolNDArray>
+{
+public:
+
+  octave_bool_matrix (void)
+    : octave_base_matrix<boolNDArray> () { }
+
+  octave_bool_matrix (const boolNDArray& bnda)
+    : octave_base_matrix<boolNDArray> (bnda) { }
+
+  octave_bool_matrix (const Array<bool>& bnda)
+    : octave_base_matrix<boolNDArray> (bnda) { }
+
+  octave_bool_matrix (const boolMatrix& bm)
+    : octave_base_matrix<boolNDArray> (bm) { }
+
+  octave_bool_matrix (const boolMatrix& bm, const MatrixType& t)
+    : octave_base_matrix<boolNDArray> (bm, t) { }
+
+  octave_bool_matrix (const boolNDArray& bm, const idx_vector& cache)
+    : octave_base_matrix<boolNDArray> (bm)
+    {
+      set_idx_cache (cache);
+    }
+
+  octave_bool_matrix (const octave_bool_matrix& bm)
+    : octave_base_matrix<boolNDArray> (bm) { }
+
+  ~octave_bool_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_bool_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_bool_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  idx_vector index_vector (void) const
+    { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
+
+  builtin_type_t builtin_type (void) const { return btyp_bool; }
+
+  bool is_bool_matrix (void) const { return true; }
+
+  bool is_bool_type (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return false; }
+
+  int8NDArray
+  int8_array_value (void) const { return int8NDArray (matrix); }
+
+  int16NDArray
+  int16_array_value (void) const { return int16NDArray (matrix); }
+
+  int32NDArray
+  int32_array_value (void) const { return int32NDArray (matrix); }
+
+  int64NDArray
+  int64_array_value (void) const { return int64NDArray (matrix); }
+
+  uint8NDArray
+  uint8_array_value (void) const { return uint8NDArray (matrix); }
+
+  uint16NDArray
+  uint16_array_value (void) const { return uint16NDArray (matrix); }
+
+  uint32NDArray
+  uint32_array_value (void) const { return uint32NDArray (matrix); }
+
+  uint64NDArray
+  uint64_array_value (void) const { return uint64NDArray (matrix); }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const
+    { return Matrix (matrix.matrix_value ()); }
+
+  FloatMatrix float_matrix_value (bool = false) const
+    { return FloatMatrix (matrix.matrix_value ()); }
+
+  NDArray array_value (bool = false) const
+    { return NDArray (matrix); }
+
+  FloatNDArray float_array_value (bool = false) const
+    { return FloatNDArray (matrix); }
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return ComplexMatrix (matrix.matrix_value ( )); }
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const
+    { return FloatComplexMatrix (matrix.matrix_value ( )); }
+
+  ComplexNDArray complex_array_value (bool = false) const
+    { return ComplexNDArray (matrix); }
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const
+    { return FloatComplexNDArray (matrix); }
+
+  charNDArray
+  char_array_value (bool = false) const
+  {
+    charNDArray retval (dims ());
+
+    octave_idx_type nel = numel ();
+
+    for (octave_idx_type i = 0; i < nel; i++)
+      retval(i) = static_cast<char>(matrix(i));
+
+    return retval;
+  }
+
+  boolMatrix bool_matrix_value (bool = false) const
+    { return matrix.matrix_value (); }
+
+  boolNDArray bool_array_value (bool = false) const
+    { return matrix; }
+
+  SparseMatrix sparse_matrix_value (bool = false) const
+  { return SparseMatrix (Matrix (matrix.matrix_value ())); }
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+  { return SparseComplexMatrix (ComplexMatrix (matrix.matrix_value ())); }
+
+  SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
+  { return SparseBoolMatrix (matrix.matrix_value ()); }
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  // Use matrix_ref here to clear index cache.
+  void invert (void) { matrix_ref ().invert (); }
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const { return matrix.mex_get_data (); }
+
+  mxArray *as_mxArray (void) const;
+
+  // Mapper functions are converted to double for treatment
+  octave_value map (unary_mapper_t umap) const
+    {
+      octave_matrix m (array_value ());
+      return m.map (umap);
+    }
+
+protected:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-bool-sparse.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,793 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+#include <vector>
+
+#include "ov-base.h"
+#include "ov-scalar.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "gripes.h"
+#include "ops.h"
+#include "oct-locbuf.h"
+
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+#include "ov-bool-sparse.h"
+
+#include "ov-base-sparse.h"
+#include "ov-base-sparse.cc"
+
+template class OCTINTERP_API octave_base_sparse<SparseBoolMatrix>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_sparse_bool_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_bool_matrix, "sparse bool matrix", "logical");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_sparse_bool_matrix&);
+
+  return new octave_sparse_matrix (SparseMatrix (v.sparse_bool_matrix_value ()));
+}
+
+octave_base_value::type_conv_info
+octave_sparse_bool_matrix::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_sparse_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_sparse_bool_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (Vsparse_auto_mutate)
+    {
+      // Don't use numel, since it can overflow for very large matrices
+      // Note that for the second test, this means it becomes approximative
+      // since it involves a cast to double to avoid issues of overflow
+      if (matrix.rows () == 1 && matrix.cols () == 1)
+        {
+          // Const copy of the matrix, so the right version of () operator used
+          const SparseBoolMatrix tmp (matrix);
+
+          retval = new octave_bool (tmp (0));
+        }
+      else if (matrix.cols () > 0 && matrix.rows () > 0
+               && (double (matrix.byte_size ()) > double (matrix.rows ())
+                   * double (matrix.cols ()) * sizeof (bool)))
+        retval = new octave_bool_matrix (matrix.matrix_value ());
+    }
+
+  return retval;
+}
+
+double
+octave_sparse_bool_matrix::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (numel () > 0)
+    {
+      if (numel () > 1)
+        gripe_implicit_conversion ("Octave:array-to-scalar",
+                                   "bool sparse matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("bool sparse matrix", "real scalar");
+
+  return retval;
+}
+
+Complex
+octave_sparse_bool_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      if (numel () > 1)
+        gripe_implicit_conversion ("Octave:array-to-scalar",
+                                   "bool sparse matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("bool sparse matrix", "complex scalar");
+
+  return retval;
+}
+
+octave_value
+octave_sparse_bool_matrix::convert_to_str_internal (bool pad, bool force,
+                                                    char type) const
+{
+  octave_value tmp = octave_value (array_value ());
+  return tmp.convert_to_str (pad, force, type);
+}
+
+// FIXME These are inefficient ways of creating full matrices
+
+Matrix
+octave_sparse_bool_matrix::matrix_value (bool) const
+{
+  return Matrix (matrix.matrix_value ());
+}
+
+ComplexMatrix
+octave_sparse_bool_matrix::complex_matrix_value (bool) const
+{
+  return ComplexMatrix (matrix.matrix_value ());
+}
+
+ComplexNDArray
+octave_sparse_bool_matrix::complex_array_value (bool) const
+{
+  return ComplexNDArray (ComplexMatrix (matrix.matrix_value ()));
+}
+
+NDArray
+octave_sparse_bool_matrix::array_value (bool) const
+{
+  return NDArray (Matrix (matrix.matrix_value ()));
+}
+
+charNDArray
+octave_sparse_bool_matrix::char_array_value (bool) const
+{
+  charNDArray retval (dims (), 0);
+  octave_idx_type nc = matrix.cols ();
+  octave_idx_type nr = matrix.rows ();
+
+  for (octave_idx_type j = 0; j < nc; j++)
+    for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
+      retval(matrix.ridx (i) + nr * j) = static_cast<char>(matrix.data (i));
+
+  return retval;
+}
+
+boolMatrix
+octave_sparse_bool_matrix::bool_matrix_value (bool) const
+{
+  return matrix.matrix_value ();
+}
+
+boolNDArray
+octave_sparse_bool_matrix::bool_array_value (bool) const
+{
+  return boolNDArray (matrix.matrix_value ());
+}
+
+
+SparseMatrix
+octave_sparse_bool_matrix::sparse_matrix_value (bool) const
+{
+  return SparseMatrix (this->matrix);
+}
+
+SparseComplexMatrix
+octave_sparse_bool_matrix::sparse_complex_matrix_value (bool) const
+{
+  return SparseComplexMatrix (this->matrix);
+}
+
+bool
+octave_sparse_bool_matrix::save_binary (std::ostream& os, bool&)
+{
+  dim_vector d = this->dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Ensure that additional memory is deallocated
+  matrix.maybe_compress ();
+
+  int nr = d(0);
+  int nc = d(1);
+  int nz = nnz ();
+
+  int32_t itmp;
+  // Use negative value for ndims to be consistent with other formats
+  itmp= -2;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nr;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nc;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nz;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  // add one to the printed indices to go from
+  // zero-based to one-based arrays
+  for (int i = 0; i < nc+1; i++)
+    {
+      octave_quit ();
+      itmp = matrix.cidx (i);
+      os.write (reinterpret_cast<char *> (&itmp), 4);
+    }
+
+  for (int i = 0; i < nz; i++)
+    {
+      octave_quit ();
+      itmp = matrix.ridx (i);
+      os.write (reinterpret_cast<char *> (&itmp), 4);
+    }
+
+  OCTAVE_LOCAL_BUFFER (char, htmp, nz);
+
+  for (int i = 0; i < nz; i++)
+    htmp[i] = (matrix.data (i) ? 1 : 0);
+
+  os.write (htmp, nz);
+
+  return true;
+}
+
+bool
+octave_sparse_bool_matrix::load_binary (std::istream& is, bool swap,
+                                        oct_mach_info::float_format /* fmt */)
+{
+  int32_t nz, nc, nr, tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+    return false;
+
+  if (swap)
+    swap_bytes<4> (&tmp);
+
+  if (tmp != -2) {
+    error ("load: only 2D sparse matrices are supported");
+    return false;
+  }
+
+  if (! is.read (reinterpret_cast<char *> (&nr), 4))
+    return false;
+  if (! is.read (reinterpret_cast<char *> (&nc), 4))
+    return false;
+  if (! is.read (reinterpret_cast<char *> (&nz), 4))
+    return false;
+
+  if (swap)
+    {
+      swap_bytes<4> (&nr);
+      swap_bytes<4> (&nc);
+      swap_bytes<4> (&nz);
+    }
+
+  SparseBoolMatrix m (static_cast<octave_idx_type> (nr),
+                      static_cast<octave_idx_type> (nc),
+                      static_cast<octave_idx_type> (nz));
+
+  for (int i = 0; i < nc+1; i++)
+    {
+      octave_quit ();
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+      m.cidx (i) = tmp;
+    }
+
+  for (int i = 0; i < nz; i++)
+    {
+      octave_quit ();
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+      m.ridx (i) = tmp;
+    }
+
+  if (error_state || ! is)
+    return false;
+
+  OCTAVE_LOCAL_BUFFER (char, htmp, nz);
+
+  if (! is.read (htmp, nz))
+    return false;
+
+  for (int i = 0; i < nz; i++)
+    m.data(i) = (htmp[i] ? 1 : 0);
+
+  if (! m.indices_ok ())
+    return false;
+
+  matrix = m;
+
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_sparse_bool_matrix::save_hdf5 (hid_t loc_id, const char *name, bool)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  // Ensure that additional memory is deallocated
+  matrix.maybe_compress ();
+#if HAVE_HDF5_18
+  hid_t group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  hid_t group_hid = H5Gcreate (loc_id, name, 0);
+#endif
+  if (group_hid < 0)
+    return false;
+
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+  SparseBoolMatrix m = sparse_bool_matrix_value ();
+  octave_idx_type tmp;
+  hsize_t hdims[2];
+
+  space_hid = H5Screate_simple (0, hdims, 0);
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.rows ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.cols ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.nnz ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+
+  hdims[0] = m.cols () + 1;
+  hdims[1] = 1;
+
+  space_hid = H5Screate_simple (2, hdims, 0);
+
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  octave_idx_type * itmp = m.xcidx ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, itmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+
+  hdims[0] = m.nnz ();
+  hdims[1] = 1;
+
+  space_hid = H5Screate_simple (2, hdims, 0);
+
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  itmp = m.xridx ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, itmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, m.nnz ());
+  for (int i = 0; i < m.nnz (); i++)
+    htmp[i] = m.xdata(i);
+
+  retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, htmp) >= 0;
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+  H5Gclose (group_hid);
+
+  return retval;
+}
+
+bool
+octave_sparse_bool_matrix::load_hdf5 (hid_t loc_id, const char *name)
+{
+  octave_idx_type nr, nc, nz;
+  hid_t group_hid, data_hid, space_hid;
+  hsize_t rank;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+    return (empty > 0);
+
+#if HAVE_HDF5_18
+  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  group_hid = H5Gopen (loc_id, name);
+#endif
+  if (group_hid < 0 ) return false;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nr", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nr");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nr) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nc", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nc");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nc) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nz", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nz");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nz) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+  SparseBoolMatrix m (static_cast<octave_idx_type> (nr),
+                      static_cast<octave_idx_type> (nc),
+                      static_cast<octave_idx_type> (nz));
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "cidx", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "cidx");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nc + 1
+      || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  octave_idx_type *itmp = m.xcidx ();
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "ridx", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "ridx");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nz
+      || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  itmp = m.xridx ();
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, itmp) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "data", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "data");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nz
+      || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nz);
+  bool retval = false;
+  if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, htmp) >= 0
+      && m.indices_ok ())
+    {
+      retval = true;
+
+      for (int i = 0; i < nz; i++)
+        m.xdata(i) = htmp[i];
+
+      matrix = m;
+    }
+
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+  H5Gclose (group_hid);
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_sparse_bool_matrix::as_mxArray (void) const
+{
+  mwSize nz = nzmax ();
+  mxArray *retval = new mxArray (mxLOGICAL_CLASS, rows (), columns (),
+                                 nz, mxREAL);
+  bool *pr = static_cast<bool *> (retval->get_data ());
+  mwIndex *ir = retval->get_ir ();
+  mwIndex *jc = retval->get_jc ();
+
+  for (mwIndex i = 0; i < nz; i++)
+    {
+      pr[i] = matrix.data (i);
+      ir[i] = matrix.ridx (i);
+    }
+
+  for (mwIndex i = 0; i < columns () + 1; i++)
+    jc[i] = matrix.cidx (i);
+
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-bool-sparse.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,157 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+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_sparse_bool_matrix_h)
+#define octave_sparse_bool_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+#include "boolSparse.h"
+#include "ov-base-sparse.h"
+#include "ov-re-sparse.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+class
+OCTINTERP_API
+octave_sparse_bool_matrix : public octave_base_sparse<SparseBoolMatrix>
+{
+public:
+
+  octave_sparse_bool_matrix (void)
+    : octave_base_sparse<SparseBoolMatrix> () { }
+
+  octave_sparse_bool_matrix (const SparseBoolMatrix& bnda)
+    : octave_base_sparse<SparseBoolMatrix> (bnda) { }
+
+  octave_sparse_bool_matrix (const SparseBoolMatrix& bnda,
+                             const MatrixType& t)
+    : octave_base_sparse<SparseBoolMatrix> (bnda, t) { }
+
+  octave_sparse_bool_matrix (const boolNDArray& m)
+    : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { }
+
+  octave_sparse_bool_matrix (const boolMatrix& m)
+    : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { }
+
+  octave_sparse_bool_matrix (const Sparse<bool>& a)
+    : octave_base_sparse<SparseBoolMatrix> (a) { }
+
+  octave_sparse_bool_matrix (const octave_sparse_bool_matrix& bm)
+    : octave_base_sparse<SparseBoolMatrix> (bm) { }
+
+  ~octave_sparse_bool_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_sparse_bool_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_sparse_bool_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  // FIXME Adapt idx_vector to allow sparse logical indexing!!
+  idx_vector index_vector (void) const
+    { return idx_vector (bool_array_value ()); }
+
+  builtin_type_t builtin_type (void) const { return btyp_bool; }
+
+  bool is_bool_matrix (void) const { return true; }
+
+  bool is_bool_type (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return false; }
+
+  double double_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  NDArray array_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  charNDArray char_array_value (bool = false) const;
+
+  boolMatrix bool_matrix_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const;
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
+
+  SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
+    { return matrix; }
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  mxArray *as_mxArray (void) const;
+
+  // Mapper functions are converted to double for treatment
+  octave_value map (unary_mapper_t umap) const
+    {
+      octave_sparse_matrix m (sparse_matrix_value ());
+      return m.map (umap);
+    }
+
+protected:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-bool.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,240 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "mx-base.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ops.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-base.h"
+#include "ov-base-scalar.h"
+#include "ov-base-scalar.cc"
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+#include "pr-output.h"
+
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+
+template class octave_base_scalar<bool>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_bool);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_bool, "bool", "logical");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_bool&);
+
+  return new octave_scalar (v.bool_value ());
+}
+
+octave_base_value::type_conv_info
+octave_bool::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_scalar::static_type_id ());
+
+}
+
+octave_value
+octave_bool::do_index_op (const octave_value_list& idx, bool resize_ok)
+{
+  // FIXME -- this doesn't solve the problem of
+  //
+  //   a = 1; a([1,1], [1,1], [1,1])
+  //
+  // and similar constructions.  Hmm...
+
+  // FIXME -- using this constructor avoids narrowing the
+  // 1x1 matrix back to a scalar value.  Need a better solution
+  // to this problem.
+
+  octave_value tmp (new octave_bool_matrix (bool_matrix_value ()));
+
+  return tmp.do_index_op (idx, resize_ok);
+}
+
+octave_value
+octave_bool::resize (const dim_vector& dv, bool fill) const
+{
+  if (fill)
+    {
+      boolNDArray retval (dv, false);
+      if (dv.numel ())
+        retval(0) = scalar;
+      return retval;
+    }
+  else
+    {
+      boolNDArray retval (dv);
+      if (dv.numel ())
+        retval(0) = scalar;
+      return retval;
+    }
+}
+
+octave_value
+octave_bool::convert_to_str_internal (bool, bool, char type) const
+{
+  char s[2];
+  s[0] = static_cast<char> (scalar);
+  s[1] = '\0';
+
+  return octave_value (s, type);
+}
+
+bool
+octave_bool::save_ascii (std::ostream& os)
+{
+  double d = double_value ();
+
+  octave_write_double (os, d);
+  os << "\n";
+
+  return true;
+}
+
+bool
+octave_bool::load_ascii (std::istream& is)
+{
+  scalar = (octave_read_value<double> (is) != 0.);
+
+  if (!is)
+    {
+      error ("load: failed to load scalar constant");
+      return false;
+    }
+
+  return true;
+}
+
+bool
+octave_bool::save_binary (std::ostream& os, bool& /* save_as_floats */)
+{
+  char tmp = (scalar ? 1 : 0);
+  os.write (reinterpret_cast<char *> (&tmp), 1);
+
+  return true;
+}
+
+bool
+octave_bool::load_binary (std::istream& is, bool /* swap */,
+                          oct_mach_info::float_format /* fmt */)
+{
+  char tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+    return false;
+  scalar = (tmp ? 1 : 0);
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_bool::save_hdf5 (hid_t loc_id, const char *name,
+                        bool /* save_as_floats */)
+{
+  hsize_t dimens[3];
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+
+  space_hid = H5Screate_simple (0, dimens, 0);
+  if (space_hid < 0) return false;
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  double tmp = double_value ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &tmp) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_bool::load_hdf5 (hid_t loc_id, const char *name)
+{
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  double dtmp;
+  if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, &dtmp) < 0)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  scalar = (dtmp != 0.);
+
+  H5Dclose (data_hid);
+
+  return true;
+}
+
+#endif
+
+mxArray *
+octave_bool::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxLOGICAL_CLASS, 1, 1, mxREAL);
+
+  bool *pr = static_cast<bool *> (retval->get_data ());
+
+  pr[0] = scalar;
+
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-bool.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,251 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_bool_h)
+#define octave_bool_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-base-scalar.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Real scalar values.
+
+class
+OCTINTERP_API
+octave_bool : public octave_base_scalar<bool>
+{
+public:
+
+  octave_bool (void)
+    : octave_base_scalar<bool> (false) { }
+
+  octave_bool (bool b)
+    : octave_base_scalar<bool> (b) { }
+
+  octave_bool (const octave_bool& s)
+    : octave_base_scalar<bool> (s) { }
+
+  ~octave_bool (void) { }
+
+  octave_base_value *clone (void) const { return new octave_bool (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_bool_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  idx_vector index_vector (void) const { return idx_vector (scalar); }
+
+  builtin_type_t builtin_type (void) const { return btyp_bool; }
+
+  bool is_real_scalar (void) const { return true; }
+
+  bool is_bool_scalar (void) const { return true; }
+
+  bool is_bool_type (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return false; }
+
+  bool is_true (void) const { return scalar; }
+
+  int8NDArray
+  int8_array_value (void) const
+    { return int8NDArray (dim_vector (1, 1), scalar); }
+
+  int16NDArray
+  int16_array_value (void) const
+    { return int16NDArray (dim_vector (1, 1), scalar); }
+
+  int32NDArray
+  int32_array_value (void) const
+    { return int32NDArray (dim_vector (1, 1), scalar); }
+
+  int64NDArray
+  int64_array_value (void) const
+    { return int64NDArray (dim_vector (1, 1), scalar); }
+
+  uint8NDArray
+  uint8_array_value (void) const
+    { return uint8NDArray (dim_vector (1, 1), scalar); }
+
+  uint16NDArray
+  uint16_array_value (void) const
+    { return uint16NDArray (dim_vector (1, 1), scalar); }
+
+  uint32NDArray
+  uint32_array_value (void) const
+    { return uint32NDArray (dim_vector (1, 1), scalar); }
+
+  uint64NDArray
+  uint64_array_value (void) const
+    { return uint64NDArray (dim_vector (1, 1), scalar); }
+
+  octave_int8
+  int8_scalar_value (void) const { return octave_int8 (scalar); }
+
+  octave_int16
+  int16_scalar_value (void) const { return octave_int16 (scalar); }
+
+  octave_int32
+  int32_scalar_value (void) const { return octave_int32 (scalar); }
+
+  octave_int64
+  int64_scalar_value (void) const { return octave_int64 (scalar); }
+
+  octave_uint8
+  uint8_scalar_value (void) const { return octave_uint8 (scalar); }
+
+  octave_uint16
+  uint16_scalar_value (void) const { return octave_uint16 (scalar); }
+
+  octave_uint32
+  uint32_scalar_value (void) const { return octave_uint32 (scalar); }
+
+  octave_uint64
+  uint64_scalar_value (void) const { return octave_uint64 (scalar); }
+
+  double double_value (bool = false) const { return scalar; }
+
+  float float_value (bool = false) const { return scalar; }
+
+  double scalar_value (bool = false) const { return scalar; }
+
+  float float_scalar_value (bool = false) const { return scalar; }
+
+  Matrix matrix_value (bool = false) const
+    { return Matrix (1, 1, scalar); }
+
+  FloatMatrix float_matrix_value (bool = false) const
+    { return FloatMatrix (1, 1, scalar); }
+
+  NDArray array_value (bool = false) const
+    { return NDArray (dim_vector (1, 1), static_cast<double> (scalar)); }
+
+  FloatNDArray float_array_value (bool = false) const
+    { return FloatNDArray (dim_vector (1, 1), static_cast<double> (scalar)); }
+
+  Complex complex_value (bool = false) const { return scalar; }
+
+  FloatComplex float_complex_value (bool = false) const { return scalar; }
+
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return ComplexMatrix (1, 1, Complex (scalar)); }
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const
+    { return FloatComplexMatrix (1, 1, FloatComplex (scalar)); }
+
+  ComplexNDArray complex_array_value (bool = false) const
+    { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); }
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const
+    { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); }
+
+  SparseMatrix sparse_matrix_value (bool = false) const
+    { return SparseMatrix (Matrix (1, 1, scalar)); }
+
+  // FIXME Need SparseComplexMatrix (Matrix) constructor!!!
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+    { return SparseComplexMatrix (sparse_matrix_value ()); }
+
+  SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
+    { return SparseBoolMatrix (boolMatrix (1, 1, scalar)); }
+
+  charNDArray
+  char_array_value (bool = false) const
+  {
+    charNDArray retval (dim_vector (1, 1));
+    retval(0) = static_cast<char> (scalar);
+    return retval;
+  }
+
+  bool bool_value (bool = false) const { return scalar; }
+
+  boolMatrix bool_matrix_value (bool = false) const
+    { return boolMatrix (1, 1, scalar); }
+
+  boolNDArray bool_array_value (bool = false) const
+    { return boolNDArray (dim_vector (1, 1), scalar); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      return os.write (bool_array_value (), block_size, output_type,
+                       skip, flt_fmt);
+    }
+
+  mxArray *as_mxArray (void) const;
+
+  // Mapper functions are converted to double for treatment
+  octave_value map (unary_mapper_t umap) const
+    {
+      octave_scalar m (scalar_value ());
+      return m.map (umap);
+    }
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-builtin.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,173 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov-builtin.h"
+#include "ov.h"
+#include "profiler.h"
+#include "toplev.h"
+#include "unwind-prot.h"
+
+DEFINE_OCTAVE_ALLOCATOR (octave_builtin);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_builtin,
+                                     "built-in function",
+                                     "built-in function");
+
+octave_value_list
+octave_builtin::subsref (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         int nargout)
+{
+  return octave_builtin::subsref (type, idx, nargout, 0);
+}
+
+octave_value_list
+octave_builtin::subsref (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         int nargout, const std::list<octave_lvalue>* lvalue_list)
+{
+  octave_value_list retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
+
+        retval = do_multi_index_op (tmp_nargout, idx.front (),
+                                    idx.size () == 1 ? lvalue_list : 0);
+      }
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // FIXME -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_user_function::subsref.
+  //
+  // FIXME -- Note that if a function call returns multiple
+  // values, and there is further indexing to perform, then we are
+  // ignoring all but the first value.  Is this really what we want to
+  // do?  If it is not, then what should happen for stat("file").size,
+  // for exmaple?
+
+  if (idx.size () > 1)
+    retval = retval(0).next_subsref (nargout, type, idx);
+
+  return retval;
+}
+
+octave_value_list
+octave_builtin::do_multi_index_op (int nargout, const octave_value_list& args)
+{
+  return octave_builtin::do_multi_index_op (nargout, args, 0);
+}
+
+octave_value_list
+octave_builtin::do_multi_index_op (int nargout, const octave_value_list& args,
+                                   const std::list<octave_lvalue> *lvalue_list)
+{
+  octave_value_list retval;
+
+  if (error_state)
+    return retval;
+
+  if (args.has_magic_colon ())
+    ::error ("invalid use of colon in function argument list");
+  else
+    {
+      unwind_protect frame;
+
+      octave_call_stack::push (this);
+
+      frame.add_fcn (octave_call_stack::pop);
+
+      if (lvalue_list || curr_lvalue_list)
+        {
+          frame.protect_var (curr_lvalue_list);
+          curr_lvalue_list = lvalue_list;
+        }
+
+      try
+        {
+          BEGIN_PROFILER_BLOCK (profiler_name ())
+
+          retval = (*f) (args, nargout);
+          // Do not allow null values to be returned from functions.
+          // FIXME -- perhaps true builtins should be allowed?
+          retval.make_storable_values ();
+          // Fix the case of a single undefined value.
+          // This happens when a compiled function uses
+          //   octave_value retval;
+          // instead of
+          //   octave_value_list retval;
+          // the idiom is very common, so we solve that here.
+          if (retval.length () == 1 && retval.xelem (0).is_undefined ())
+            retval.clear ();
+
+          END_PROFILER_BLOCK
+        }
+      catch (octave_execution_exception)
+        {
+          gripe_library_execution_error ();
+        }
+    }
+
+  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;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-builtin.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,117 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_builtin_h)
+#define octave_builtin_h 1
+
+#include <string>
+
+#include "ov-fcn.h"
+#include "ov-typeinfo.h"
+
+class octave_value;
+class octave_value_list;
+class jit_type;
+
+// Builtin functions.
+
+class
+OCTINTERP_API
+octave_builtin : public octave_function
+{
+public:
+
+  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), 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)
+    {
+      octave_value_list tmp = subsref (type, idx, 1);
+      return tmp.length () > 0 ? tmp(0) : octave_value ();
+    }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout, const std::list<octave_lvalue>* lvalue_list);
+
+  octave_function *function_value (bool = false) { return this; }
+
+  bool is_builtin_function (void) const { return true; }
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args);
+
+  octave_value_list
+  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:
+
+  // 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!
+
+  octave_builtin (const octave_builtin& ob);
+
+  octave_builtin& operator = (const octave_builtin& ob);
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cell.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1528 @@
+/*
+
+Copyright (C) 1999-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <vector>
+#include <queue>
+
+#include "Array-util.h"
+#include "byte-swap.h"
+#include "lo-utils.h"
+#include "quit.h"
+#include "oct-locbuf.h"
+
+#include "defun.h"
+#include "error.h"
+#include "ov-cell.h"
+#include "oct-obj.h"
+#include "unwind-prot.h"
+#include "utils.h"
+#include "ov-base-mat.h"
+#include "ov-base-mat.cc"
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+#include "pr-output.h"
+#include "ov-scalar.h"
+#include "gripes.h"
+
+#include "ls-oct-ascii.h"
+#include "ls-oct-binary.h"
+#include "ls-hdf5.h"
+#include "ls-utils.h"
+
+// Cell is able to handle octave_value indexing by itself, so just forward
+// everything.
+
+template <>
+octave_value
+octave_base_matrix<Cell>::do_index_op (const octave_value_list& idx,
+                                       bool resize_ok)
+{
+  return matrix.index (idx, resize_ok);
+}
+
+template <>
+void
+octave_base_matrix<Cell>::assign (const octave_value_list& idx, const Cell& rhs)
+{
+  matrix.assign (idx, rhs);
+}
+
+template <>
+void
+octave_base_matrix<Cell>::assign (const octave_value_list& idx, octave_value rhs)
+{
+  // FIXME: Really?
+  if (rhs.is_cell ())
+    matrix.assign (idx, rhs.cell_value ());
+  else
+    matrix.assign (idx, Cell (rhs));
+}
+
+template <>
+void
+octave_base_matrix<Cell>::delete_elements (const octave_value_list& idx)
+{
+  matrix.delete_elements (idx);
+}
+
+// FIXME: this list of specializations is becoming so long that we should really ask
+// whether octave_cell should inherit from octave_base_matrix at all.
+
+template <>
+octave_value
+octave_base_matrix<Cell>::fast_elem_extract (octave_idx_type n) const
+{
+  if (n < matrix.numel ())
+    return Cell (matrix(n));
+  else
+    return octave_value ();
+}
+
+template <>
+bool
+octave_base_matrix<Cell>::fast_elem_insert (octave_idx_type n,
+                                            const octave_value& x)
+{
+  const octave_cell *xrep =
+    dynamic_cast<const octave_cell *> (&x.get_rep ());
+
+  bool retval = xrep && xrep->matrix.numel () == 1 && n < matrix.numel ();
+  if (retval)
+    matrix(n) = xrep->matrix(0);
+
+  return retval;
+}
+
+template class octave_base_matrix<Cell>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_cell);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cell, "cell", "cell");
+
+static void
+gripe_failed_assignment (void)
+{
+  error ("assignment to cell array failed");
+}
+
+octave_value_list
+octave_cell::subsref (const std::string& type,
+                      const std::list<octave_value_list>& idx,
+                      int nargout)
+{
+  octave_value_list retval;
+
+  switch (type[0])
+    {
+    case '(':
+      retval(0) = do_index_op (idx.front ());
+      break;
+
+    case '{':
+      {
+        octave_value tmp = do_index_op (idx.front ());
+
+        if (! error_state)
+          {
+            Cell tcell = tmp.cell_value ();
+
+            if (tcell.length () == 1)
+              retval(0) = tcell(0,0);
+            else
+              retval = octave_value (octave_value_list (tcell), true);
+          }
+      }
+      break;
+
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // FIXME -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_user_function::subsref.
+
+  if (idx.size () > 1)
+    retval = retval(0).next_subsref (nargout, type, idx);
+
+  return retval;
+}
+
+octave_value
+octave_cell::subsref (const std::string& type,
+                      const std::list<octave_value_list>& idx,
+                      bool auto_add)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      retval = do_index_op (idx.front (), auto_add);
+      break;
+
+    case '{':
+      {
+        octave_value tmp = do_index_op (idx.front (), auto_add);
+
+        if (! error_state)
+          {
+            const Cell tcell = tmp.cell_value ();
+
+            if (tcell.length () == 1)
+              retval = tcell(0,0);
+            else
+              retval = octave_value (octave_value_list (tcell), true);
+          }
+      }
+      break;
+
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // FIXME -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_user_function::subsref.
+
+  if (idx.size () > 1)
+    retval = retval.next_subsref (auto_add, type, idx);
+
+  return retval;
+}
+
+octave_value
+octave_cell::subsasgn (const std::string& type,
+                       const std::list<octave_value_list>& idx,
+                       const octave_value& rhs)
+{
+  octave_value retval;
+
+  int n = type.length ();
+
+  octave_value t_rhs = rhs;
+
+  clear_cellstr_cache ();
+
+  if (idx.front ().empty ())
+    {
+      error ("missing index in indexed assignment");
+      return retval;
+    }
+
+  if (n > 1)
+    {
+      switch (type[0])
+        {
+        case '(':
+          {
+            if (is_empty () && type[1] == '.')
+              {
+                // Allow conversion of empty cell array to some other
+                // type in cases like
+                //
+                //  x = {}; x(i).f = rhs
+
+                octave_value tmp = octave_value::empty_conv (type, rhs);
+
+                return tmp.subsasgn (type, idx, rhs);
+              }
+            else
+              {
+                octave_value tmp = do_index_op (idx.front (), true);
+
+                if (! tmp.is_defined ())
+                  tmp = octave_value::empty_conv (type.substr (1), rhs);
+
+                if (! error_state)
+                  {
+                    std::list<octave_value_list> next_idx (idx);
+
+                    next_idx.erase (next_idx.begin ());
+
+                    tmp.make_unique ();
+
+                    t_rhs = tmp.subsasgn (type.substr (1), next_idx, rhs);
+                  }
+              }
+          }
+          break;
+
+        case '{':
+          {
+            matrix.make_unique ();
+            Cell tmpc = matrix.index (idx.front (), true);
+
+            if (! error_state)
+              {
+                std::list<octave_value_list> next_idx (idx);
+
+                next_idx.erase (next_idx.begin ());
+
+                std::string next_type = type.substr (1);
+
+                if (tmpc.numel () == 1)
+                  {
+                    octave_value tmp = tmpc(0);
+                    tmpc = Cell ();
+
+                    if (! tmp.is_defined () || tmp.is_zero_by_zero ())
+                      {
+                        tmp = octave_value::empty_conv (type.substr (1), rhs);
+                        tmp.make_unique (); // probably a no-op.
+                      }
+                    else
+                      // optimization: ignore the copy still stored inside our array.
+                      tmp.make_unique (1);
+
+                    if (! error_state)
+                      t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
+                  }
+                else
+                  gripe_indexed_cs_list ();
+              }
+          }
+          break;
+
+        case '.':
+          {
+            if (is_empty ())
+              {
+                // Do nothing; the next branch will handle it.
+              }
+            else
+              {
+                std::string nm = type_name ();
+                error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+              }
+          }
+          break;
+
+        default:
+          panic_impossible ();
+        }
+    }
+
+  if (! error_state)
+    {
+      switch (type[0])
+        {
+        case '(':
+          {
+            octave_value_list i = idx.front ();
+
+            if (t_rhs.is_cell ())
+              octave_base_matrix<Cell>::assign (i, t_rhs.cell_value ());
+            else
+              if (t_rhs.is_null_value ())
+                octave_base_matrix<Cell>::delete_elements (i);
+              else
+                octave_base_matrix<Cell>::assign (i, Cell (t_rhs));
+
+            if (! error_state)
+              {
+                count++;
+                retval = octave_value (this);
+              }
+            else
+              gripe_failed_assignment ();
+          }
+          break;
+
+        case '{':
+          {
+            octave_value_list idxf = idx.front ();
+
+            if (t_rhs.is_cs_list ())
+              {
+                Cell tmp_cell = Cell (t_rhs.list_value ());
+
+                // Inquire the proper shape of the RHS.
+
+                dim_vector didx = dims ().redim (idxf.length ());
+                for (octave_idx_type k = 0; k < idxf.length (); k++)
+                  if (! idxf(k).is_magic_colon ()) didx(k) = idxf(k).numel ();
+
+                if (didx.numel () == tmp_cell.numel ())
+                  tmp_cell = tmp_cell.reshape (didx);
+
+
+                octave_base_matrix<Cell>::assign (idxf, tmp_cell);
+              }
+            else if (idxf.all_scalars () || do_index_op (idxf, true).numel () == 1)
+              // Regularize a null matrix if stored into a cell.
+              octave_base_matrix<Cell>::assign (idxf, Cell (t_rhs.storable_value ()));
+            else if (! error_state)
+              gripe_nonbraced_cs_list_assignment ();
+
+            if (! error_state)
+              {
+                count++;
+                retval = octave_value (this);
+              }
+            else
+              gripe_failed_assignment ();
+          }
+          break;
+
+        case '.':
+          {
+            if (is_empty ())
+              {
+                // Allow conversion of empty cell array to some other
+                // type in cases like
+                //
+                //  x = {}; x.f = rhs
+
+                octave_value tmp = octave_value::empty_conv (type, rhs);
+
+                return tmp.subsasgn (type, idx, rhs);
+              }
+            else
+              {
+                std::string nm = type_name ();
+                error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+              }
+          }
+          break;
+
+        default:
+          panic_impossible ();
+        }
+    }
+
+  return retval;
+}
+
+bool
+octave_cell::is_cellstr (void) const
+{
+  bool retval;
+  if (cellstr_cache.get ())
+    retval = true;
+  else
+    {
+      retval = matrix.is_cellstr ();
+      // Allocate empty cache to mark that this is indeed a cellstr.
+      if (retval)
+        cellstr_cache.reset (new Array<std::string> ());
+    }
+
+  return retval;
+}
+
+void
+octave_cell::assign (const octave_value_list& idx, const Cell& rhs)
+{
+  clear_cellstr_cache ();
+  octave_base_matrix<Cell>::assign (idx, rhs);
+}
+
+void
+octave_cell::assign (const octave_value_list& idx, const octave_value& rhs)
+{
+  clear_cellstr_cache ();
+  octave_base_matrix<Cell>::assign (idx, rhs);
+}
+
+
+void
+octave_cell::delete_elements (const octave_value_list& idx)
+{
+  clear_cellstr_cache ();
+  octave_base_matrix<Cell>::delete_elements (idx);
+}
+
+size_t
+octave_cell::byte_size (void) const
+{
+  size_t retval = 0;
+
+  for (octave_idx_type i = 0; i < numel (); i++)
+    retval += matrix(i).byte_size ();
+
+  return retval;
+}
+
+octave_value
+octave_cell::sort (octave_idx_type dim, sortmode mode) const
+{
+  octave_value retval;
+
+  if (is_cellstr ())
+    {
+      Array<std::string> tmp = cellstr_value ();
+
+      tmp = tmp.sort (dim, mode);
+
+      // We already have the cache.
+      retval = new octave_cell (tmp);
+    }
+  else
+    error ("sort: only cell arrays of character strings may be sorted");
+
+  return retval;
+}
+
+octave_value
+octave_cell::sort (Array<octave_idx_type> &sidx, octave_idx_type dim,
+                   sortmode mode) const
+{
+  octave_value retval;
+
+  if (is_cellstr ())
+    {
+      Array<std::string> tmp = cellstr_value ();
+
+      tmp = tmp.sort (sidx, dim, mode);
+
+      // We already have the cache.
+      retval = new octave_cell (tmp);
+    }
+  else
+    error ("sort: only cell arrays of character strings may be sorted");
+
+  return retval;
+}
+
+sortmode
+octave_cell::is_sorted (sortmode mode) const
+{
+  sortmode retval = UNSORTED;
+
+  if (is_cellstr ())
+    {
+      Array<std::string> tmp = cellstr_value ();
+
+      retval = tmp.is_sorted (mode);
+    }
+  else
+    error ("issorted: A is not a cell array of strings");
+
+  return retval;
+}
+
+
+Array<octave_idx_type>
+octave_cell::sort_rows_idx (sortmode mode) const
+{
+  Array<octave_idx_type> retval;
+
+  if (is_cellstr ())
+    {
+      Array<std::string> tmp = cellstr_value ();
+
+      retval = tmp.sort_rows_idx (mode);
+    }
+  else
+    error ("sortrows: only cell arrays of character strings may be sorted");
+
+  return retval;
+}
+
+sortmode
+octave_cell::is_sorted_rows (sortmode mode) const
+{
+  sortmode retval = UNSORTED;
+
+  if (is_cellstr ())
+    {
+      Array<std::string> tmp = cellstr_value ();
+
+      retval = tmp.is_sorted_rows (mode);
+    }
+  else
+    error ("issorted: A is not a cell array of strings");
+
+  return retval;
+}
+
+bool
+octave_cell::is_true (void) const
+{
+  error ("invalid conversion from cell array to logical value");
+  return false;
+}
+
+octave_value_list
+octave_cell::list_value (void) const
+{
+  return octave_value_list (matrix);
+}
+
+string_vector
+octave_cell::all_strings (bool pad) const
+{
+  string_vector retval;
+
+  octave_idx_type nel = numel ();
+
+  int n_elts = 0;
+
+  octave_idx_type max_len = 0;
+
+  std::queue<string_vector> strvec_queue;
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      string_vector s = matrix(i).all_strings ();
+
+      if (error_state)
+        return retval;
+
+      octave_idx_type s_len = s.length ();
+
+      n_elts += s_len ? s_len : 1;
+
+      octave_idx_type s_max_len = s.max_length ();
+
+      if (s_max_len > max_len)
+        max_len = s_max_len;
+
+      strvec_queue.push (s);
+    }
+
+  retval = string_vector (n_elts);
+
+  octave_idx_type k = 0;
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      const string_vector s = strvec_queue.front ();
+      strvec_queue.pop ();
+
+      octave_idx_type s_len = s.length ();
+
+      if (s_len)
+        {
+          for (octave_idx_type j = 0; j < s_len; j++)
+            {
+              std::string t = s[j];
+              int t_len = t.length ();
+
+              if (pad && max_len > t_len)
+                t += std::string (max_len - t_len, ' ');
+
+              retval[k++] = t;
+            }
+        }
+      else if (pad)
+        retval[k++] = std::string (max_len, ' ');
+      else
+        retval[k++] = std::string ();
+    }
+
+  return retval;
+}
+
+Array<std::string>
+octave_cell::cellstr_value (void) const
+{
+  Array<std::string> retval;
+
+  if (is_cellstr ())
+    {
+      if (cellstr_cache->is_empty ())
+        *cellstr_cache = matrix.cellstr_value ();
+
+      return *cellstr_cache;
+    }
+  else
+    error ("invalid conversion from cell array to array of strings");
+
+  return retval;
+}
+
+bool
+octave_cell::print_as_scalar (void) const
+{
+  return true;
+}
+
+void
+octave_cell::print (std::ostream& os, bool) const
+{
+  print_raw (os);
+}
+
+void
+octave_cell::print_raw (std::ostream& os, bool) const
+{
+  int nd = matrix.ndims ();
+
+  if (nd == 2)
+    {
+      octave_idx_type nr = rows ();
+      octave_idx_type nc = columns ();
+
+      if (nr > 0 && nc > 0)
+        {
+          newline (os);
+          indent (os);
+          os << "{";
+          newline (os);
+
+          increment_indent_level ();
+
+          for (octave_idx_type j = 0; j < nc; j++)
+            {
+              for (octave_idx_type i = 0; i < nr; i++)
+                {
+                  octave_quit ();
+
+                  std::ostringstream buf;
+                  buf << "[" << i+1 << "," << j+1 << "]";
+
+                  octave_value val = matrix(i,j);
+
+                  val.print_with_name (os, buf.str ());
+                }
+            }
+
+          decrement_indent_level ();
+
+          indent (os);
+          os << "}";
+          newline (os);
+        }
+      else
+        {
+          indent (os);
+          os << "{}";
+          if (Vprint_empty_dimensions)
+            os << "(" << nr << "x" << nc << ")";
+          newline (os);
+        }
+    }
+  else
+    {
+      indent (os);
+      dim_vector dv = matrix.dims ();
+      os << "{" << dv.str () << " Cell Array}";
+      newline (os);
+    }
+}
+
+#define CELL_ELT_TAG "<cell-element>"
+
+bool
+octave_cell::save_ascii (std::ostream& os)
+{
+  dim_vector d = dims ();
+  if (d.length () > 2)
+    {
+      os << "# ndims: " << d.length () << "\n";
+
+      for (int i = 0; i < d.length (); i++)
+        os << " " << d (i);
+      os << "\n";
+
+      Cell tmp = cell_value ();
+
+      for (octave_idx_type i = 0; i < d.numel (); i++)
+        {
+          octave_value o_val = tmp.elem (i);
+
+          // Recurse to print sub-value.
+          bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, false, 0);
+
+          if (! b)
+            return os;
+        }
+    }
+  else
+    {
+      // Keep this case, rather than use generic code above for backward
+      // compatiability. Makes load_ascii much more complex!!
+      os << "# rows: " << rows () << "\n"
+         << "# columns: " << columns () << "\n";
+
+      Cell tmp = cell_value ();
+
+      for (octave_idx_type j = 0; j < tmp.cols (); j++)
+        {
+          for (octave_idx_type i = 0; i < tmp.rows (); i++)
+            {
+              octave_value o_val = tmp.elem (i, j);
+
+              // Recurse to print sub-value.
+              bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, false, 0);
+
+              if (! b)
+                return os;
+            }
+
+          os << "\n";
+        }
+    }
+
+  return true;
+}
+
+bool
+octave_cell::load_ascii (std::istream& is)
+{
+  bool success = true;
+
+  clear_cellstr_cache ();
+
+  string_vector keywords(2);
+
+  keywords[0] = "ndims";
+  keywords[1] = "rows";
+
+  std::string kw;
+  octave_idx_type val = 0;
+
+  if (extract_keyword (is, keywords, kw, val, true))
+    {
+      if (kw == "ndims")
+        {
+          int mdims = static_cast<int> (val);
+
+          if (mdims >= 0)
+            {
+              dim_vector dv;
+              dv.resize (mdims);
+
+              for (int i = 0; i < mdims; i++)
+                is >> dv(i);
+
+              Cell tmp(dv);
+
+              for (octave_idx_type i = 0; i < dv.numel (); i++)
+                {
+                  octave_value t2;
+                  bool dummy;
+
+                  // recurse to read cell elements
+                  std::string nm = read_ascii_data (is, std::string (),
+                                                    dummy, t2, i);
+
+                  if (nm == CELL_ELT_TAG)
+                    {
+                      if (is)
+                        tmp.elem (i) = t2;
+                    }
+                  else
+                    {
+                      error ("load: cell array element had unexpected name");
+                      success = false;
+                      break;
+                    }
+                }
+
+              if (is)
+                matrix = tmp;
+              else
+                {
+                  error ("load: failed to load matrix constant");
+                  success = false;
+                }
+            }
+          else
+            {
+              error ("load: failed to extract number of rows and columns");
+              success = false;
+            }
+        }
+      else if (kw == "rows")
+        {
+          octave_idx_type nr = val;
+          octave_idx_type nc = 0;
+
+          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
+            {
+              if (nr > 0 && nc > 0)
+                {
+                  Cell tmp (nr, nc);
+
+                  for (octave_idx_type j = 0; j < nc; j++)
+                    {
+                      for (octave_idx_type i = 0; i < nr; i++)
+                        {
+                          octave_value t2;
+                          bool dummy;
+
+                          // recurse to read cell elements
+                          std::string nm = read_ascii_data (is, std::string (),
+                                                            dummy, t2, i);
+
+                          if (nm == CELL_ELT_TAG)
+                            {
+                              if (is)
+                                tmp.elem (i, j) = t2;
+                            }
+                          else
+                            {
+                              error ("load: cell array element had unexpected name");
+                              success = false;
+                              goto cell_read_error;
+                            }
+                        }
+                    }
+
+                cell_read_error:
+
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load cell element");
+                      success = false;
+                    }
+                }
+              else if (nr == 0 || nc == 0)
+                matrix = Cell (nr, nc);
+              else
+                panic_impossible ();
+            }
+          else
+            {
+              error ("load: failed to extract number of rows and columns for cell array");
+              success = false;
+            }
+        }
+      else
+        panic_impossible ();
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_cell::save_binary (std::ostream& os, bool& save_as_floats)
+{
+  dim_vector d = dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims
+  int32_t di = - d.length ();
+  os.write (reinterpret_cast<char *> (&di), 4);
+  for (int i = 0; i < d.length (); i++)
+    {
+      di = d(i);
+      os.write (reinterpret_cast<char *> (&di), 4);
+    }
+
+  Cell tmp = cell_value ();
+
+  for (octave_idx_type i = 0; i < d.numel (); i++)
+    {
+      octave_value o_val = tmp.elem (i);
+
+      // Recurse to print sub-value.
+      bool b = save_binary_data (os, o_val, CELL_ELT_TAG, "", 0,
+                                 save_as_floats);
+
+      if (! b)
+        return false;
+    }
+
+  return true;
+}
+
+bool
+octave_cell::load_binary (std::istream& is, bool swap,
+                          oct_mach_info::float_format fmt)
+{
+  clear_cellstr_cache ();
+
+  bool success = true;
+  int32_t mdims;
+  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&mdims);
+  if (mdims >= 0)
+    return false;
+
+  mdims = -mdims;
+  int32_t di;
+  dim_vector dv;
+  dv.resize (mdims);
+
+  for (int i = 0; i < mdims; i++)
+    {
+      if (! is.read (reinterpret_cast<char *> (&di), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&di);
+      dv(i) = di;
+    }
+
+  // Convert an array with a single dimension to be a row vector.
+  // Octave should never write files like this, other software
+  // might.
+
+  if (mdims == 1)
+    {
+      mdims = 2;
+      dv.resize (mdims);
+      dv(1) = dv(0);
+      dv(0) = 1;
+    }
+
+  octave_idx_type nel = dv.numel ();
+  Cell tmp(dv);
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      octave_value t2;
+      bool dummy;
+      std::string doc;
+
+      // recurse to read cell elements
+      std::string nm = read_binary_data (is, swap, fmt, std::string (),
+                                         dummy, t2, doc);
+
+      if (nm == CELL_ELT_TAG)
+        {
+          if (is)
+            tmp.elem (i) = t2;
+        }
+      else
+        {
+          error ("load: cell array element had unexpected name");
+          success = false;
+          break;
+        }
+    }
+
+  if (is)
+    matrix = tmp;
+  else
+    {
+      error ("load: failed to load matrix constant");
+      success = false;
+    }
+
+  return success;
+}
+
+void *
+octave_cell::mex_get_data (void) const
+{
+  clear_cellstr_cache ();
+  return matrix.mex_get_data ();
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_cell::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  hsize_t rank = dv.length ();
+  hid_t space_hid = -1, data_hid = -1, size_hid = -1;
+
+#if HAVE_HDF5_18
+  data_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Gcreate (loc_id, name, 0);
+#endif
+
+  if (data_hid < 0)
+    return false;
+
+  // Have to save cell array shape, since can't have a
+  // dataset of groups....
+
+  space_hid = H5Screate_simple (1, &rank, 0);
+
+  if (space_hid < 0)
+    {
+      H5Gclose (data_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (octave_idx_type, hdims, rank);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  for (hsize_t i = 0; i < rank; i++)
+    hdims[i] = dv(rank-i-1);
+
+#if HAVE_HDF5_18
+  size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (size_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (data_hid);
+      return false;
+    }
+
+  if (H5Dwrite (size_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                H5P_DEFAULT, hdims) < 0)
+    {
+      H5Dclose (size_hid);
+      H5Sclose (space_hid);
+      H5Gclose (data_hid);
+      return false;
+    }
+
+  H5Dclose (size_hid);
+  H5Sclose (space_hid);
+
+  // Recursively add each element of the cell to this group.
+
+  Cell tmp = cell_value ();
+
+  octave_idx_type nel = dv.numel ();
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      std::ostringstream buf;
+      int digits = static_cast<int> (gnulib::floor (::log10 (static_cast<double> (nel)) + 1.0));
+      buf << "_" << std::setw (digits) << std::setfill ('0') << i;
+      std::string s = buf.str ();
+
+      if (! add_hdf5_data (data_hid, tmp.elem (i), s.c_str (), "", false,
+                           save_as_floats))
+        {
+          H5Gclose (data_hid);
+          return false;
+        }
+    }
+
+  H5Gclose (data_hid);
+
+  return true;
+}
+
+bool
+octave_cell::load_hdf5 (hid_t loc_id, const char *name)
+{
+  clear_cellstr_cache ();
+
+  bool retval = false;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+    return (empty > 0);
+
+#if HAVE_HDF5_18
+  hid_t group_id = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t group_id = H5Gopen (loc_id, name);
+#endif
+
+  if (group_id < 0)
+    return false;
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (group_id, "dims", H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (group_id, "dims");
+#endif
+  hid_t space_hid = H5Dget_space (data_hid);
+  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
+  if (rank != 1)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_id);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering.
+
+  dv.resize (hdims[0]);
+
+  OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, hdims[0]);
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, tmp) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_id);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+  H5Gclose (group_id);
+
+  for (hsize_t i = 0, j = hdims[0] - 1; i < hdims[0]; i++, j--)
+    dv(j) = tmp[i];
+
+  hdf5_callback_data dsub;
+
+  herr_t retval2 = -1;
+
+  Cell m (dv);
+
+  int current_item = 0;
+
+  hsize_t num_obj = 0;
+#if HAVE_HDF5_18
+  group_id = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  group_id = H5Gopen (loc_id, name);
+#endif
+  H5Gget_num_objs (group_id, &num_obj);
+  H5Gclose (group_id);
+
+  for (octave_idx_type i = 0; i < dv.numel (); i++)
+    {
+
+      if (current_item >= static_cast<int> (num_obj))
+        retval2 = -1;
+      else
+        retval2 = H5Giterate (loc_id, name, &current_item,
+                              hdf5_read_next_data, &dsub);
+
+      if (retval2 <= 0)
+        break;
+
+      octave_value ov = dsub.tc;
+      m.elem (i) = ov;
+
+    }
+
+  if (retval2 >= 0)
+    {
+      matrix = m;
+      retval = true;
+    }
+
+  return retval;
+}
+
+#endif
+
+DEFUN (iscell, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} iscell (@var{x})\n\
+Return true if @var{x} is a cell array object.\n\
+@seealso{ismatrix, isstruct, iscellstr, isa}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = args(0).is_cell ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (cell, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} cell (@var{n})\n\
+@deftypefnx {Built-in Function} {} cell (@var{m}, @var{n})\n\
+@deftypefnx {Built-in Function} {} cell (@var{m}, @var{n}, @var{k}, @dots{})\n\
+@deftypefnx {Built-in Function} {} cell ([@var{m} @var{n} @dots{}])\n\
+Create a new cell array object.\n\
+If invoked with a single scalar integer argument, return a square\n\
+@nospell{NxN} cell array.  If invoked with two or more scalar\n\
+integer arguments, or a vector of integer values, return an array with\n\
+the given dimensions.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  dim_vector dims;
+
+  switch (nargin)
+    {
+    case 0:
+      dims = dim_vector (0, 0);
+      break;
+
+    case 1:
+      get_dimensions (args(0), "cell", dims);
+      break;
+
+    default:
+      {
+        dims.resize (nargin);
+
+        for (int i = 0; i < nargin; i++)
+          {
+            dims(i) = args(i).is_empty () ? 0 : args(i).nint_value ();
+
+            if (error_state)
+              {
+                error ("cell: expecting scalar arguments");
+                break;
+              }
+          }
+      }
+      break;
+    }
+
+  if (! error_state)
+    {
+      dims.chop_trailing_singletons ();
+
+      check_dimensions (dims, "cell");
+
+      if (! error_state)
+        retval = Cell (dims, Matrix ());
+    }
+
+  return retval;
+}
+
+DEFUN (iscellstr, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} iscellstr (@var{cell})\n\
+Return true if every element of the cell array @var{cell} is a\n\
+character string.\n\
+@seealso{ischar}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = args(0).is_cellstr ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+// Note that since Fcellstr calls Fiscellstr, we need to have
+// Fiscellstr defined first (to provide a declaration) and also we
+// should keep it in the same file (so we don't have to provide a
+// declaration) and so we don't have to use feval to call it.
+
+DEFUN (cellstr, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} cellstr (@var{string})\n\
+Create a new cell array object from the elements of the string\n\
+array @var{string}.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    {
+      octave_value_list tmp = Fiscellstr (args, 1);
+
+      if (tmp(0).is_true ())
+        retval = args(0);
+      else
+        {
+          string_vector s = args(0).all_strings ();
+
+          if (! error_state)
+            retval = (s.is_empty ()
+                      ? Cell (octave_value (std::string ()))
+                      : Cell (s, true));
+          else
+            error ("cellstr: argument STRING must be a 2-D character array");
+        }
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (struct2cell, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} struct2cell (@var{S})\n\
+Create a new cell array from the objects stored in the struct object.\n\
+If @var{f} is the number of fields in the structure, the resulting\n\
+cell array will have a dimension vector corresponding to\n\
+@code{[@var{F} size(@var{S})]}.  For example:\n\
+\n\
+@example\n\
+@group\n\
+s = struct (\"name\", @{\"Peter\", \"Hannah\", \"Robert\"@},\n\
+           \"age\", @{23, 16, 3@});\n\
+c = struct2cell (s)\n\
+   @result{} c = @{1x1x3 Cell Array@}\n\
+c(1,1,:)(:)\n\
+   @result{}\n\
+      @{\n\
+        [1,1] = Peter\n\
+        [2,1] = Hannah\n\
+        [3,1] = Robert\n\
+      @}\n\
+c(2,1,:)(:)\n\
+   @result{}\n\
+      @{\n\
+        [1,1] = 23\n\
+        [2,1] = 16\n\
+        [3,1] = 3\n\
+      @}\n\
+@end group\n\
+@end example\n\
+\n\
+@seealso{cell2struct, fieldnames}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    {
+      const octave_map m = args(0).map_value ();
+
+      if (! error_state)
+        {
+          const dim_vector m_dv = m.dims ();
+
+          octave_idx_type num_fields = m.nfields ();
+
+          // The resulting dim_vector should have dimensions:
+          // [numel(fields) size(struct)]
+          // except if the struct is a column vector.
+
+          dim_vector result_dv;
+          if (m_dv (m_dv.length () - 1) == 1)
+              result_dv.resize (m_dv.length ());
+          else
+              result_dv.resize (m_dv.length () + 1); // Add 1 for the fields.
+
+          result_dv(0) = num_fields;
+
+          for (int i = 1; i < result_dv.length (); i++)
+            result_dv(i) = m_dv(i-1);
+
+          NoAlias<Cell> c (result_dv);
+
+          octave_idx_type n_elts = m.numel ();
+
+          // Fill c in one sweep. Note that thanks to octave_map structure,
+          // we don't need a key lookup at all.
+          for (octave_idx_type j = 0; j < n_elts; j++)
+            for (octave_idx_type i = 0; i < num_fields; i++)
+              c(i,j) = m.contents(i)(j);
+
+          retval = c;
+        }
+      else
+        error ("struct2cell: argument S must be a structure");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!test
+%! keys = cellstr (char (floor (rand (11,10)*24+65)))';
+%! vals = cellfun (@(x) mat2cell (rand (19,1), ones (19,1), 1), ...
+%!          mat2cell ([1:11]', ones (11,1), 1), "uniformoutput", false)';
+%! s = struct ([keys; vals]{:});
+%! t = cell2struct ([vals{:}], keys, 2);
+%! assert (s, t);
+%! assert (struct2cell (s), [vals{:}]');
+%! assert (fieldnames (s), keys');
+*/
+
+mxArray *
+octave_cell::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (dims ());
+
+  mxArray **elts = static_cast<mxArray **> (retval->get_data ());
+
+  mwSize nel = numel ();
+
+  const octave_value *p = matrix.data ();
+
+  for (mwIndex i = 0; i < nel; i++)
+    elts[i] = new mxArray (p[i]);
+
+  return retval;
+}
+
+octave_value
+octave_cell::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+#define FORWARD_MAPPER(UMAP) \
+    case umap_ ## UMAP: \
+      return matrix.UMAP ()
+    FORWARD_MAPPER (xisalnum);
+    FORWARD_MAPPER (xisalpha);
+    FORWARD_MAPPER (xisascii);
+    FORWARD_MAPPER (xiscntrl);
+    FORWARD_MAPPER (xisdigit);
+    FORWARD_MAPPER (xisgraph);
+    FORWARD_MAPPER (xislower);
+    FORWARD_MAPPER (xisprint);
+    FORWARD_MAPPER (xispunct);
+    FORWARD_MAPPER (xisspace);
+    FORWARD_MAPPER (xisupper);
+    FORWARD_MAPPER (xisxdigit);
+    FORWARD_MAPPER (xtoascii);
+    FORWARD_MAPPER (xtolower);
+    FORWARD_MAPPER (xtoupper);
+
+    default:
+      return octave_base_value::map (umap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cell.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,180 @@
+/*
+
+Copyright (C) 1999-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_cell_h)
+#define octave_cell_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+#include <memory>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "Cell.h"
+#include "error.h"
+#include "ov-base-mat.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Cells.
+
+class
+octave_cell : public octave_base_matrix<Cell>
+{
+public:
+
+  octave_cell (void)
+    : octave_base_matrix<Cell> (), cellstr_cache () { }
+
+  octave_cell (const Cell& c)
+    : octave_base_matrix<Cell> (c), cellstr_cache () { }
+
+  octave_cell (const Array<std::string>& str)
+    : octave_base_matrix<Cell> (Cell (str)), cellstr_cache (new Array<std::string> (str)) { }
+
+  octave_cell (const octave_cell& c)
+    : octave_base_matrix<Cell> (c), cellstr_cache () { }
+
+  ~octave_cell (void) { }
+
+  octave_base_value *clone (void) const { return new octave_cell (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_cell (); }
+
+#if 0
+  octave_base_value *try_narrowing_conversion (void);
+#endif
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    {
+      octave_value_list tmp = subsref (type, idx, 1);
+      return tmp.length () > 0 ? tmp(0) : octave_value ();
+    }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int);
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx,
+                        bool auto_add);
+
+  octave_value subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs);
+
+  void assign (const octave_value_list& idx, const Cell& rhs);
+
+  void assign (const octave_value_list& idx, const octave_value& rhs);
+
+  void delete_elements (const octave_value_list& idx);
+
+  size_t byte_size (void) const;
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
+
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const;
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const;
+
+  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const;
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
+
+  bool is_matrix_type (void) const { return false; }
+
+  bool is_numeric_type (void) const { return false; }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_cell (void) const { return true; }
+
+  builtin_type_t builtin_type (void) const { return btyp_cell; }
+
+  bool is_cellstr (void) const;
+
+  bool is_true (void) const;
+
+  Cell cell_value (void) const { return matrix; }
+
+  octave_value_list list_value (void) const;
+
+  octave_value convert_to_str_internal (bool pad, bool, char type) const
+    { return octave_value (all_strings (pad), type); }
+
+  string_vector all_strings (bool pad = false) const;
+
+  Array<std::string> cellstr_value (void) const;
+
+  bool print_as_scalar (void) const;
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  octave_value map (unary_mapper_t umap) const;
+
+  mxArray *as_mxArray (void) const;
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const;
+
+private:
+
+  void clear_cellstr_cache (void) const
+    { cellstr_cache.reset (); }
+
+  mutable std::auto_ptr<Array<std::string> > cellstr_cache;
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-ch-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,197 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cctype>
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "mx-base.h"
+
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-mat.cc"
+#include "ov-ch-mat.h"
+#include "gripes.h"
+#include "pr-output.h"
+
+template class octave_base_matrix<charNDArray>;
+
+idx_vector
+octave_char_matrix::index_vector (void) const
+{
+  const char *p = matrix.data ();
+  if (numel () == 1 && *p == ':')
+    return idx_vector (':');
+  else
+    return idx_vector (array_value (true));
+}
+
+double
+octave_char_matrix::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "character matrix", "real scalar");
+
+      retval = static_cast<unsigned char> (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("character matrix", "real scalar");
+
+  return retval;
+}
+
+float
+octave_char_matrix::float_value (bool) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "character matrix", "real scalar");
+
+      retval = static_cast<unsigned char> (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("character matrix", "real scalar");
+
+  return retval;
+}
+
+Complex
+octave_char_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "character matrix", "complex scalar");
+
+      retval = static_cast<unsigned char> (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("character matrix", "complex scalar");
+
+  return retval;
+}
+
+FloatComplex
+octave_char_matrix::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "character matrix", "complex scalar");
+
+      retval = static_cast<unsigned char> (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("character matrix", "complex scalar");
+
+  return retval;
+}
+
+void
+octave_char_matrix::print_raw (std::ostream& os,
+                               bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, matrix, pr_as_read_syntax,
+                         current_print_indent_level ());
+}
+
+mxArray *
+octave_char_matrix::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxCHAR_CLASS, dims (), mxREAL);
+
+  mxChar *pr = static_cast<mxChar *> (retval->get_data ());
+
+  mwSize nel = numel ();
+
+  const char *p = matrix.data ();
+
+  for (mwIndex i = 0; i < nel; i++)
+    pr[i] = p[i];
+
+  return retval;
+}
+
+// The C++ standard guarantees cctype defines functions, not macros (and hence macros *CAN'T*
+// be defined if only cctype is included)
+// so there's no need to f*ck around. The exceptions are isascii and toascii,
+// which are not C++.
+// Oddly enough, all those character functions are int (*) (int), even
+// in C++. Wicked!
+static inline int xisascii (int c)
+{ return isascii (c); }
+
+static inline int xtoascii (int c)
+{ return toascii (c); }
+
+octave_value
+octave_char_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+#define STRING_MAPPER(UMAP,FCN,TYPE) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.map<TYPE, int (&) (int)> (FCN))
+
+    STRING_MAPPER (xisalnum, std::isalnum, bool);
+    STRING_MAPPER (xisalpha, std::isalpha, bool);
+    STRING_MAPPER (xisascii, xisascii, bool);
+    STRING_MAPPER (xiscntrl, std::iscntrl, bool);
+    STRING_MAPPER (xisdigit, std::isdigit, bool);
+    STRING_MAPPER (xisgraph, std::isgraph, bool);
+    STRING_MAPPER (xislower, std::islower, bool);
+    STRING_MAPPER (xisprint, std::isprint, bool);
+    STRING_MAPPER (xispunct, std::ispunct, bool);
+    STRING_MAPPER (xisspace, std::isspace, bool);
+    STRING_MAPPER (xisupper, std::isupper, bool);
+    STRING_MAPPER (xisxdigit, std::isxdigit, bool);
+    STRING_MAPPER (xtoascii, xtoascii, double);
+    STRING_MAPPER (xtolower, std::tolower, char);
+    STRING_MAPPER (xtoupper, std::toupper, char);
+
+    default:
+      {
+        octave_matrix m (array_value (true));
+        return m.map (umap);
+      }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-ch-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,155 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_char_matrix_h)
+#define octave_char_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "ov.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Character matrix values.
+
+class
+octave_char_matrix : public octave_base_matrix<charNDArray>
+{
+protected:
+
+  octave_char_matrix (void)
+    : octave_base_matrix<charNDArray> () { }
+
+  octave_char_matrix (const charMatrix& chm)
+    : octave_base_matrix<charNDArray> (chm) { }
+
+  octave_char_matrix (const charNDArray& chm)
+    : octave_base_matrix<charNDArray> (chm) { }
+
+  octave_char_matrix (const Array<char>& chm)
+    : octave_base_matrix<charNDArray> (chm) { }
+
+  octave_char_matrix (char c)
+    : octave_base_matrix<charNDArray> (c) { }
+
+  octave_char_matrix (const char *s)
+    : octave_base_matrix<charNDArray> (s) { }
+
+  octave_char_matrix (const std::string& s)
+    : octave_base_matrix<charNDArray> (s) { }
+
+  octave_char_matrix (const string_vector& s)
+    : octave_base_matrix<charNDArray> (s) { }
+
+  octave_char_matrix (const octave_char_matrix& chm)
+    : octave_base_matrix<charNDArray> (chm) { }
+
+public:
+
+  ~octave_char_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_char_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_char_matrix (); }
+
+  idx_vector index_vector (void) const;
+
+  builtin_type_t builtin_type (void) const { return btyp_char; }
+
+  bool is_char_matrix (void) const { return true; }
+  bool is_real_matrix (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  float float_scalar_value (bool frc_str_conv = false) const
+    { return float_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const
+    { return Matrix (matrix.matrix_value ()); }
+
+  FloatMatrix float_matrix_value (bool = false) const
+    { return FloatMatrix (matrix.matrix_value ()); }
+
+  NDArray array_value (bool = false) const
+    { return NDArray (matrix); }
+
+  FloatNDArray float_array_value (bool = false) const
+    { return FloatNDArray (matrix); }
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return ComplexMatrix (matrix.matrix_value ()); }
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const
+    { return FloatComplexMatrix (matrix.matrix_value ()); }
+
+  ComplexNDArray complex_array_value (bool = false) const
+    { return ComplexNDArray (matrix); }
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const
+    { return FloatComplexNDArray (matrix); }
+
+  charMatrix char_matrix_value (bool = false) const
+    { return matrix.matrix_value (); }
+
+  charNDArray char_array_value (bool = false) const
+    { return matrix; }
+
+  octave_value convert_to_str_internal (bool, bool, char type) const
+    { return octave_value (matrix, type); }
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const { return matrix.mex_get_data (); }
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-class.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,2282 @@
+/*
+
+Copyright (C) 2007-2012 John W. Eaton
+Copyright (C) 2009 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "Array-util.h"
+#include "byte-swap.h"
+#include "oct-locbuf.h"
+#include "lo-mappers.h"
+
+#include "Cell.h"
+#include "defun.h"
+#include "error.h"
+#include "file-ops.h"
+#include "gripes.h"
+#include "load-path.h"
+#include "ls-hdf5.h"
+#include "ls-oct-ascii.h"
+#include "ls-oct-binary.h"
+#include "ls-utils.h"
+#include "oct-lvalue.h"
+#include "ov-class.h"
+#include "ov-fcn.h"
+#include "ov-usr-fcn.h"
+#include "pager.h"
+#include "parse.h"
+#include "pr-output.h"
+#include "toplev.h"
+#include "unwind-prot.h"
+#include "variables.h"
+
+DEFINE_OCTAVE_ALLOCATOR(octave_class);
+
+int octave_class::t_id (-1);
+
+const std::string octave_class::t_name ("class");
+
+void
+octave_class::register_type (void)
+{
+  t_id = octave_value_typeinfo::register_type
+    (octave_class::t_name, "<unknown>", octave_value (new octave_class ()));
+}
+
+octave_class::octave_class (const octave_map& m, const std::string& id,
+                            const octave_value_list& parents)
+  : octave_base_value (), map (m), c_name (id), obsolete_copies (0)
+{
+  octave_idx_type n = parents.length ();
+
+  for (octave_idx_type idx = 0; idx < n; idx++)
+    {
+      octave_value parent = parents(idx);
+
+      if (! parent.is_object ())
+        error ("parents must be objects");
+      else
+        {
+          std::string pcnm = parent.class_name ();
+
+          if (find_parent_class (pcnm))
+            error ("duplicate class in parent tree");
+          else
+            {
+              parent_list.push_back (pcnm);
+
+              octave_idx_type nel = map.numel ();
+              octave_idx_type p_nel = parent.numel ();
+
+              if (nel == 0)
+                {
+                  if (p_nel == 0)
+                    {
+                      // No elements in MAP or the parent class object,
+                      // so just add the field name.
+
+                      map.assign (pcnm, Cell (map.dims ()));
+                    }
+                  else if (p_nel == 1)
+                    {
+                      if (map.nfields () == 0)
+                        {
+                          // No elements or fields in MAP, but the
+                          // parent is class object with one element.
+                          // Resize to match size of parent class and
+                          // make the parent a field in MAP.
+
+                          map.resize (parent.dims ());
+
+                          map.assign (pcnm, parent);
+                        }
+                      else
+                        {
+                          // No elements in MAP, but we have at least
+                          // one field.  So don't resize, just add the
+                          // field name.
+
+                          map.assign (pcnm, Cell (map.dims ()));
+                        }
+                    }
+                  else if (map.nfields () == 0)
+                    {
+                      // No elements or fields in MAP and more than one
+                      // element in the parent class object, so we can
+                      // resize MAP to match parent dimsenions, then
+                      // distribute the elements of the parent object to
+                      // the elements of MAP.
+
+                      dim_vector parent_dims = parent.dims ();
+
+                      map.resize (parent_dims);
+
+                      Cell c (parent_dims);
+
+                      octave_map pmap = parent.map_value ();
+
+                      std::list<std::string> plist
+                        = parent.parent_class_name_list ();
+
+                      for (octave_idx_type i = 0; i < p_nel; i++)
+                        c(i) = octave_value (pmap.index (i), pcnm, plist);
+
+                      map.assign (pcnm, c);
+                    }
+                  else
+                    error ("class: parent class dimension mismatch");
+                }
+              else if (nel == 1 && p_nel == 1)
+                {
+                  // Simple assignment.
+
+                  map.assign (pcnm, parent);
+                }
+              else
+                {
+                  if (p_nel == 1)
+                    {
+                      // Broadcast the scalar parent class object to
+                      // each element of MAP.
+
+                      Cell pcell (map.dims (), parent);
+
+                      map.assign (pcnm, pcell);
+                    }
+
+                  else if (nel == p_nel)
+                    {
+                      // FIXME -- is there a better way to do this?
+
+                      // The parent class object has the same number of
+                      // elements as the map we are using to create the
+                      // new object, so distribute those elements to
+                      // each element of the new object by first
+                      // splitting the elements of the parent class
+                      // object into a cell array with one element per
+                      // cell.  Then do the assignment all at once.
+
+                      Cell c (parent.dims ());
+
+                      octave_map pmap = parent.map_value ();
+
+                      std::list<std::string> plist
+                        = parent.parent_class_name_list ();
+
+                      for (octave_idx_type i = 0; i < p_nel; i++)
+                        c(i) = octave_value (pmap.index (i), pcnm, plist);
+
+                      map.assign (pcnm, c);
+                    }
+                  else
+                    error ("class: parent class dimension mismatch");
+                }
+            }
+        }
+    }
+
+  if (! error_state)
+    symbol_table::add_to_parent_map (id, parent_list);
+}
+
+octave_base_value *
+octave_class::unique_clone (void)
+{
+  if (count == obsolete_copies)
+    {
+      // All remaining copies are obsolete. We don't actually need to clone.
+      count++;
+      return this;
+    }
+  else
+    {
+      // In theory, this shouldn't be happening, but it's here just in case.
+      if (count < obsolete_copies)
+        obsolete_copies = 0;
+
+      return clone ();
+    }
+}
+
+std::string
+octave_class::get_current_method_class (void)
+{
+  std::string retval = class_name ();
+
+  if (nparents () > 0)
+    {
+      octave_function *fcn = octave_call_stack::current ();
+
+      // Here we are just looking to see if FCN is a method or constructor
+      // for any class, not specifically this one.
+      if (fcn && (fcn->is_class_method () || fcn->is_class_constructor ()))
+        retval = fcn->dispatch_class ();
+    }
+
+  return retval;
+}
+
+static void
+gripe_invalid_index1 (void)
+{
+  error ("invalid index for class");
+}
+
+static void
+gripe_invalid_index_for_assignment (void)
+{
+  error ("invalid index for class assignment");
+}
+
+static void
+gripe_invalid_index_type (const std::string& nm, char t)
+{
+  error ("%s cannot be indexed with %c", nm.c_str (), t);
+}
+
+static void
+gripe_failed_assignment (void)
+{
+  error ("assignment to class element failed");
+}
+
+static inline octave_value_list
+sanitize (const octave_value_list& ovl)
+{
+  octave_value_list retval = ovl;
+
+  for (octave_idx_type i = 0; i < ovl.length (); i++)
+    {
+      if (retval(i).is_magic_colon ())
+        retval(i) = ":";
+    }
+
+  return retval;
+}
+
+static inline octave_value
+make_idx_args (const std::string& type,
+               const std::list<octave_value_list>& idx,
+               const std::string& who)
+{
+  octave_value retval;
+
+  size_t len = type.length ();
+
+  if (len == idx.size ())
+    {
+      Cell type_field (1, len);
+      Cell subs_field (1, len);
+
+      std::list<octave_value_list>::const_iterator p = idx.begin ();
+
+      for (size_t i = 0; i < len; i++)
+        {
+          char t = type[i];
+
+          switch (t)
+            {
+            case '(':
+              type_field(i) = "()";
+              subs_field(i) = Cell (sanitize (*p++));
+              break;
+
+            case '{':
+              type_field(i) = "{}";
+              subs_field(i) = Cell (sanitize (*p++));
+              break;
+
+            case '.':
+              {
+                type_field(i) = ".";
+
+                octave_value_list vlist = *p++;
+
+                if (vlist.length () == 1)
+                  {
+                    octave_value val = vlist(0);
+
+                    if (val.is_string ())
+                      subs_field(i) = val;
+                    else
+                      {
+                        error ("expecting character string argument for `.' index");
+                        return retval;
+                      }
+                  }
+                else
+                  {
+                    error ("expecting single argument for `.' index");
+                    return retval;
+                  }
+              }
+              break;
+
+            default:
+              panic_impossible ();
+              break;
+            }
+        }
+
+      octave_map m;
+
+      m.assign ("type", type_field);
+      m.assign ("subs", subs_field);
+
+      retval = m;
+    }
+  else
+    error ("invalid index for %s", who.c_str ());
+
+  return retval;
+}
+
+Cell
+octave_class::dotref (const octave_value_list& idx)
+{
+  Cell retval;
+
+  assert (idx.length () == 1);
+
+  std::string method_class = get_current_method_class ();
+
+  // Find the class in which this method resides before attempting to access
+  // the requested field.
+
+  octave_base_value *obvp = find_parent_class (method_class);
+
+  if (obvp == 0)
+    {
+      error ("malformed class");
+      return retval;
+    }
+
+  octave_map my_map = (obvp != this) ? obvp->map_value () : map;
+
+  std::string nm = idx(0).string_value ();
+
+  if (! error_state)
+    {
+      octave_map::const_iterator p = my_map.seek (nm);
+
+      if (p != my_map.end ())
+        retval = my_map.contents (p);
+      else
+        error ("class has no member `%s'", nm.c_str ());
+    }
+  else
+    gripe_invalid_index1 ();
+
+  return retval;
+}
+
+static bool
+called_from_builtin (void)
+{
+  octave_function *fcn = octave_call_stack::caller ();
+
+  // FIXME -- we probably need a better check here, or some other
+  // mechanism to avoid overloaded functions when builtin is used.
+  // For example, what if someone overloads the builtin function?
+  // Also, are there other places where using builtin is not properly
+  // avoiding dispatch?
+
+  return (fcn && fcn->name () == "builtin");
+}
+
+Matrix
+octave_class::size (void)
+{
+  if (in_class_method () || called_from_builtin ())
+    return octave_base_value::size ();
+
+  Matrix retval (1, 2, 1.0);
+  octave_value meth = symbol_table::find_method ("size", class_name ());
+
+  if (meth.is_defined ())
+    {
+      count++;
+      octave_value_list args (1, octave_value (this));
+
+      octave_value_list lv = feval (meth.function_value (), args, 1);
+      if (lv.length () > 0 && lv(0).is_matrix_type () && lv(0).dims ().is_vector ())
+        retval = lv(0).matrix_value ();
+      else
+        error ("@%s/size: invalid return value", class_name ().c_str ());
+    }
+  else
+    {
+      dim_vector dv = dims ();
+
+      int nd = dv.length ();
+
+      retval.resize (1, nd);
+
+      for (int i = 0; i < nd; i++)
+        retval(i) = dv(i);
+    }
+
+  return retval;
+}
+
+octave_idx_type
+octave_class::numel (const octave_value_list& idx)
+{
+  if (in_class_method () || called_from_builtin ())
+    return octave_base_value::numel (idx);
+
+  octave_idx_type retval = -1;
+  const std::string cn = class_name ();
+
+  octave_value meth = symbol_table::find_method ("numel", cn);
+
+  if (meth.is_defined ())
+    {
+      octave_value_list args (idx.length () + 1, octave_value ());
+
+      count++;
+      args(0) = octave_value (this);
+
+      for (octave_idx_type i = 0; i < idx.length (); i++)
+        args(i+1) = idx(i);
+
+      octave_value_list lv = feval (meth.function_value (), args, 1);
+      if (lv.length () == 1 && lv(0).is_scalar_type ())
+        retval = lv(0).idx_type_value (true);
+      else
+        error ("@%s/numel: invalid return value", cn.c_str ());
+    }
+  else
+    retval = octave_base_value::numel (idx);
+
+  return retval;
+}
+
+octave_value_list
+octave_class::subsref (const std::string& type,
+                       const std::list<octave_value_list>& idx,
+                       int nargout)
+{
+  octave_value_list retval;
+
+  if (in_class_method () || called_from_builtin ())
+    {
+      // FIXME -- this block of code is the same as the body of
+      // octave_struct::subsref.  Maybe it could be shared instead of
+      // duplicated.
+
+      int skip = 1;
+
+      switch (type[0])
+        {
+        case '(':
+          {
+            if (type.length () > 1 && type[1] == '.')
+              {
+                std::list<octave_value_list>::const_iterator p = idx.begin ();
+                octave_value_list key_idx = *++p;
+
+                Cell tmp = dotref (key_idx);
+
+                if (! error_state)
+                  {
+                    Cell t = tmp.index (idx.front ());
+
+                    retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
+
+                    // We handled two index elements, so tell
+                    // next_subsref to skip both of them.
+
+                    skip++;
+                  }
+              }
+            else
+              retval(0) = octave_value (map.index (idx.front ()),
+                                        c_name, parent_list);
+          }
+          break;
+
+        case '.':
+          {
+            if (map.numel () > 0)
+              {
+                Cell t = dotref (idx.front ());
+
+                retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
+              }
+          }
+          break;
+
+        case '{':
+          gripe_invalid_index_type (type_name (), type[0]);
+          break;
+
+        default:
+          panic_impossible ();
+        }
+
+      // FIXME -- perhaps there should be an
+      // octave_value_list::next_subsref member function?  See also
+      // octave_user_function::subsref.
+
+      if (idx.size () > 1)
+        retval = retval(0).next_subsref (nargout, type, idx, skip);
+    }
+  else
+    {
+      octave_value meth = symbol_table::find_method ("subsref", class_name ());
+
+      if (meth.is_defined ())
+        {
+          octave_value_list args;
+
+          args(1) = make_idx_args (type, idx, "subsref");
+
+          if (error_state)
+            return octave_value_list ();
+
+          count++;
+          args(0) = octave_value (this);
+
+          // FIXME: for Matlab compatibility, let us attempt to set up a proper
+          // value for nargout at least in the simple case where the
+          // cs-list-type expression - i.e., {} or ().x, is the leading one.
+          // Note that Octave does not actually need this, since it will
+          // be able to properly react to varargout a posteriori.
+          bool maybe_cs_list_query = (type[0] == '.' || type[0] == '{'
+                                      || (type.length () > 1 && type[0] == '('
+                                          && type[1] == '.'));
+
+          int true_nargout = nargout;
+
+          if (maybe_cs_list_query)
+            {
+              // Set up a proper nargout for the subsref call by calling numel.
+              octave_value_list tmp;
+              if (type[0] != '.') tmp = idx.front ();
+              true_nargout = numel (tmp);
+            }
+
+          retval = feval (meth.function_value (), args, true_nargout);
+
+          // Since we're handling subsref, return the list in the first value
+          // if it has more than one element, to be able to pass through
+          // rvalue1 calls.
+          if (retval.length () > 1)
+            retval = octave_value (retval, true);
+        }
+      else
+        {
+          if (type.length () == 1 && type[0] == '(')
+            retval(0) = octave_value (map.index (idx.front ()), c_name,
+                                      parent_list);
+          else
+            gripe_invalid_index1 ();
+        }
+    }
+
+  return retval;
+}
+
+octave_value
+octave_class::numeric_conv (const Cell& val, const std::string& type)
+{
+  octave_value retval;
+
+  if (val.length () == 1)
+    {
+      retval = val(0);
+
+      if (type.length () > 0 && type[0] == '.' && ! retval.is_map ())
+        retval = octave_map ();
+    }
+  else
+    gripe_invalid_index_for_assignment ();
+
+  return retval;
+}
+
+octave_value
+octave_class::subsasgn (const std::string& type,
+                        const std::list<octave_value_list>& idx,
+                        const octave_value& rhs)
+{
+  count++;
+  return subsasgn_common (octave_value (this), type, idx, rhs);
+}
+
+octave_value
+octave_class::undef_subsasgn (const std::string& type,
+                              const std::list<octave_value_list>& idx,
+                              const octave_value& rhs)
+{
+  // For compatibility with Matlab, pass [] as the first argument to the
+  // the subsasgn function when the LHS of an indexed assignment is
+  // undefined.
+
+  return subsasgn_common (Matrix (), type, idx, rhs);
+}
+
+octave_value
+octave_class::subsasgn_common (const octave_value& obj,
+                               const std::string& type,
+                               const std::list<octave_value_list>& idx,
+                               const octave_value& rhs)
+{
+  octave_value retval;
+
+  if (! (in_class_method () || called_from_builtin ()))
+    {
+      octave_value meth = symbol_table::find_method ("subsasgn", class_name ());
+
+      if (meth.is_defined ())
+        {
+          octave_value_list args;
+
+          if (rhs.is_cs_list ())
+            {
+              octave_value_list lrhs = rhs.list_value ();
+              args.resize (2 + lrhs.length ());
+              for (octave_idx_type i = 0; i < lrhs.length (); i++)
+                args(2+i) = lrhs(i);
+            }
+          else
+            args(2) = rhs;
+
+          args(1) = make_idx_args (type, idx, "subsasgn");
+
+          if (error_state)
+            return octave_value_list ();
+
+          args(0) = obj;
+
+          // Now comes the magic. Count copies with me:
+          // 1. myself (obsolete)
+          // 2. the copy inside args (obsolete)
+          // 3. the copy in method's symbol table (working)
+          // ... possibly more (not obsolete).
+          //
+          // So we mark 2 copies as obsolete and hold our fingers crossed.
+          // But prior to doing that, check whether the routine is amenable
+          // to the optimization.
+          // It is essential that the handling function doesn't store extra
+          // copies anywhere. If it does, things will not break but the
+          // optimization won't work.
+
+          octave_value_list tmp;
+
+          if (obsolete_copies == 0 && meth.is_user_function ()
+              && meth.user_function_value ()->subsasgn_optimization_ok ())
+            {
+              unwind_protect frame;
+              frame.protect_var (obsolete_copies);
+              obsolete_copies = 2;
+
+              tmp = feval (meth.function_value (), args);
+            }
+          else
+            tmp = feval (meth.function_value (), args);
+
+          // FIXME -- should the subsasgn method be able to return
+          // more than one value?
+
+          if (tmp.length () > 1)
+            error ("expecting single return value from @%s/subsasgn",
+                   class_name ().c_str ());
+
+          else
+            retval = tmp(0);
+
+          return retval;
+        }
+    }
+
+  // Find the class in which this method resides before
+  // attempting to do the indexed assignment.
+
+  std::string method_class = get_current_method_class ();
+
+  octave_base_value *obvp = unique_parent_class (method_class);
+  if (obvp != this)
+    {
+
+      if (obvp)
+        {
+          obvp->subsasgn (type, idx, rhs);
+          if (! error_state)
+            {
+              count++;
+              retval = octave_value (this);
+            }
+          else
+            gripe_failed_assignment ();
+        }
+      else
+        error ("malformed class");
+
+      return retval;
+    }
+
+  // FIXME -- this block of code is the same as the body of
+  // octave_struct::subsasgn.  Maybe it could be shared instead of
+  // duplicated.
+
+  int n = type.length ();
+
+  octave_value t_rhs = rhs;
+
+  if (n > 1 && ! (type.length () == 2 && type[0] == '(' && type[1] == '.'))
+    {
+      switch (type[0])
+        {
+        case '(':
+          {
+            if (type.length () > 1 && type[1] == '.')
+              {
+                std::list<octave_value_list>::const_iterator p = idx.begin ();
+                octave_value_list t_idx = *p;
+
+                octave_value_list key_idx = *++p;
+
+                assert (key_idx.length () == 1);
+
+                std::string key = key_idx(0).string_value ();
+
+                if (! error_state)
+                  {
+                    octave_value u;
+
+                    if (! map.contains (key))
+                      u = octave_value::empty_conv (type.substr (2), rhs);
+                    else
+                      {
+                        Cell map_val = map.contents (key);
+
+                        Cell map_elt = map_val.index (idx.front (), true);
+
+                        u = numeric_conv (map_elt, type.substr (2));
+                      }
+
+                    if (! error_state)
+                      {
+                        std::list<octave_value_list> next_idx (idx);
+
+                        // We handled two index elements, so subsasgn to
+                        // needs to skip both of them.
+
+                        next_idx.erase (next_idx.begin ());
+                        next_idx.erase (next_idx.begin ());
+
+                        u.make_unique ();
+
+                        t_rhs = u.subsasgn (type.substr (2), next_idx, rhs);
+                      }
+                  }
+                else
+                  gripe_invalid_index_for_assignment ();
+              }
+            else
+              gripe_invalid_index_for_assignment ();
+          }
+          break;
+
+        case '.':
+          {
+            octave_value_list key_idx = idx.front ();
+
+            assert (key_idx.length () == 1);
+
+            std::string key = key_idx(0).string_value ();
+
+            std::list<octave_value_list> next_idx (idx);
+
+            next_idx.erase (next_idx.begin ());
+
+            std::string next_type = type.substr (1);
+
+            Cell tmpc (1, 1);
+            octave_map::iterator pkey = map.seek (key);
+            if (pkey != map.end ())
+              {
+                map.contents (pkey).make_unique ();
+                tmpc = map.contents (pkey);
+              }
+
+            // FIXME: better code reuse?
+            if (! error_state)
+              {
+                if (tmpc.numel () == 1)
+                  {
+                    octave_value& tmp = tmpc(0);
+
+                    if (! tmp.is_defined () || tmp.is_zero_by_zero ())
+                      {
+                        tmp = octave_value::empty_conv (next_type, rhs);
+                        tmp.make_unique (); // probably a no-op.
+                      }
+                    else
+                      // optimization: ignore the copy still stored inside our map.
+                      tmp.make_unique (1);
+
+                    if (! error_state)
+                      t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
+                  }
+                else
+                  gripe_indexed_cs_list ();
+              }
+          }
+          break;
+
+        case '{':
+          gripe_invalid_index_type (type_name (), type[0]);
+          break;
+
+        default:
+          panic_impossible ();
+        }
+    }
+
+  if (! error_state)
+    {
+      switch (type[0])
+        {
+        case '(':
+          {
+            if (n > 1 && type[1] == '.')
+              {
+                std::list<octave_value_list>::const_iterator p = idx.begin ();
+                octave_value_list key_idx = *++p;
+
+                assert (key_idx.length () == 1);
+
+                std::string key = key_idx(0).string_value ();
+
+                if (! error_state)
+                  {
+                    map.assign (idx.front (), key, t_rhs);
+
+                    if (! error_state)
+                      {
+                        count++;
+                        retval = octave_value (this);
+                      }
+                    else
+                      gripe_failed_assignment ();
+                  }
+                else
+                  gripe_failed_assignment ();
+              }
+            else
+              {
+                if (t_rhs.is_object () || t_rhs.is_map ())
+                  {
+                    octave_map rhs_map = t_rhs.map_value ();
+
+                    if (! error_state)
+                      {
+                        map.assign (idx.front (), rhs_map);
+
+                        if (! error_state)
+                          {
+                            count++;
+                            retval = octave_value (this);
+                          }
+                        else
+                          gripe_failed_assignment ();
+                      }
+                    else
+                      error ("invalid class assignment");
+                  }
+                else
+                  {
+                    if (t_rhs.is_empty ())
+                      {
+                        map.delete_elements (idx.front ());
+
+                        if (! error_state)
+                          {
+                            count++;
+                            retval = octave_value (this);
+                          }
+                        else
+                          gripe_failed_assignment ();
+                      }
+                    else
+                      error ("invalid class assignment");
+                  }
+              }
+          }
+          break;
+
+        case '.':
+          {
+            octave_value_list key_idx = idx.front ();
+
+            assert (key_idx.length () == 1);
+
+            std::string key = key_idx(0).string_value ();
+
+            if (t_rhs.is_cs_list ())
+              {
+                Cell tmp_cell = Cell (t_rhs.list_value ());
+
+                // The shape of the RHS is irrelevant, we just want
+                // the number of elements to agree and to preserve the
+                // shape of the left hand side of the assignment.
+
+                if (numel () == tmp_cell.numel ())
+                  tmp_cell = tmp_cell.reshape (dims ());
+
+                map.setfield (key, tmp_cell);
+              }
+            else
+              {
+                Cell tmp_cell(1, 1);
+                tmp_cell(0) = t_rhs.storable_value ();
+                map.setfield (key, tmp_cell);
+              }
+
+            if (! error_state)
+              {
+                count++;
+                retval = octave_value (this);
+              }
+            else
+              gripe_failed_assignment ();
+          }
+          break;
+
+        case '{':
+          gripe_invalid_index_type (type_name (), type[0]);
+          break;
+
+        default:
+          panic_impossible ();
+        }
+    }
+  else
+    gripe_failed_assignment ();
+
+  return retval;
+}
+
+idx_vector
+octave_class::index_vector (void) const
+{
+  idx_vector retval;
+
+  octave_value meth = symbol_table::find_method ("subsindex", class_name ());
+
+  if (meth.is_defined ())
+    {
+      octave_value_list args;
+      args(0) = octave_value (new octave_class (map, c_name, parent_list));
+
+      octave_value_list tmp = feval (meth.function_value (), args, 1);
+
+      if (!error_state && tmp.length () >= 1)
+        {
+          if (tmp(0).is_object ())
+            error ("subsindex function must return a valid index vector");
+          else
+            // Index vector returned by subsindex is zero based
+            // (why this inconsistency Mathworks?), and so we must
+            // add one to the value returned as the index_vector method
+            // expects it to be one based.
+            retval = do_binary_op (octave_value::op_add, tmp (0),
+                                   octave_value (1.0)).index_vector ();
+        }
+    }
+  else
+    error ("no subsindex method defined for class %s",
+           class_name ().c_str ());
+
+  return retval;
+}
+
+size_t
+octave_class::byte_size (void) const
+{
+  // Neglect the size of the fieldnames.
+
+  size_t retval = 0;
+
+  for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
+    {
+      std::string key = map.key (p);
+
+      octave_value val = octave_value (map.contents (p));
+
+      retval += val.byte_size ();
+    }
+
+  return retval;
+}
+
+string_vector
+octave_class::map_keys (void) const
+{
+  string_vector retval;
+  gripe_wrong_type_arg ("octave_class::map_keys()", type_name ());
+  return retval;
+}
+
+octave_base_value *
+octave_class::find_parent_class (const std::string& parent_class_name)
+{
+  octave_base_value* retval = 0;
+
+  if (parent_class_name == class_name ())
+    retval = this;
+  else
+    {
+      for (std::list<std::string>::iterator pit = parent_list.begin ();
+           pit != parent_list.end ();
+           pit++)
+        {
+          octave_map::const_iterator smap = map.seek (*pit);
+
+          const Cell& tmp = map.contents (smap);
+
+          octave_value vtmp = tmp(0);
+
+          octave_base_value *obvp = vtmp.internal_rep ();
+
+          retval = obvp->find_parent_class (parent_class_name);
+
+          if (retval)
+            break;
+        }
+    }
+
+  return retval;
+}
+
+octave_base_value *
+octave_class::unique_parent_class (const std::string& parent_class_name)
+{
+  octave_base_value* retval = 0;
+
+  if (parent_class_name == class_name ())
+    retval = this;
+  else
+    {
+      for (std::list<std::string>::iterator pit = parent_list.begin ();
+           pit != parent_list.end ();
+           pit++)
+        {
+          octave_map::iterator smap = map.seek (*pit);
+
+          Cell& tmp = map.contents (smap);
+
+          octave_value& vtmp = tmp(0);
+
+          octave_base_value *obvp = vtmp.internal_rep ();
+
+          // Use find_parent_class first to avoid uniquifying if not necessary.
+          retval = obvp->find_parent_class (parent_class_name);
+
+          if (retval)
+            {
+              vtmp.make_unique ();
+              obvp = vtmp.internal_rep ();
+              retval = obvp->unique_parent_class (parent_class_name);
+
+              break;
+            }
+        }
+    }
+
+  return retval;
+}
+
+string_vector
+octave_class::all_strings (bool pad) const
+{
+  string_vector retval;
+
+  octave_value meth = symbol_table::find_method ("char", class_name ());
+
+  if (meth.is_defined ())
+    {
+      octave_value_list args;
+      args(0) = octave_value (new octave_class (map, c_name, parent_list));
+
+      octave_value_list tmp = feval (meth.function_value (), args, 1);
+
+      if (!error_state && tmp.length () >= 1)
+        {
+          if (tmp(0).is_string ())
+            retval = tmp(0).all_strings (pad);
+          else
+            error ("cname/char method did not return a character string");
+        }
+    }
+  else
+    error ("no char method defined for class %s", class_name ().c_str ());
+
+  return retval;
+}
+
+
+void
+octave_class::print (std::ostream& os, bool) const
+{
+  print_raw (os);
+}
+
+void
+octave_class::print_raw (std::ostream& os, bool) const
+{
+  unwind_protect frame;
+
+  indent (os);
+  os << "  <class " << class_name () << ">";
+  newline (os);
+}
+
+bool
+octave_class::print_name_tag (std::ostream& os, const std::string& name) const
+{
+  bool retval = false;
+
+  indent (os);
+  os << name << " =";
+  newline (os);
+  if (! Vcompact_format)
+    newline (os);
+
+  return retval;
+}
+
+void
+octave_class::print_with_name (std::ostream& os, const std::string& name,
+                               bool)
+{
+  octave_value fcn = symbol_table::find_method ("display", class_name ());
+
+  if (fcn.is_defined ())
+    {
+      octave_value_list args;
+
+      count++;
+      args(0) = octave_value (this);
+
+      string_vector arg_names (1);
+
+      arg_names[0] = name;
+
+      args.stash_name_tags (arg_names);
+
+      feval (fcn.function_value (), args);
+    }
+  else
+    {
+      indent (os);
+      os << name << " = <class " << class_name () << ">";
+      newline (os);
+    }
+}
+
+// Loading a class properly requires an exemplar map entry for success.
+// If we don't have one, we attempt to create one by calling the constructor
+// with no arguments.
+bool
+octave_class::reconstruct_exemplar (void)
+{
+  bool retval = false;
+
+  octave_class::exemplar_const_iterator it
+    = octave_class::exemplar_map.find (c_name);
+
+  if (it != octave_class::exemplar_map.end ())
+    retval = true;
+  else
+    {
+      octave_value ctor = symbol_table::find_method (c_name, c_name);
+
+      bool have_ctor = false;
+
+      if (ctor.is_defined () && ctor.is_function ())
+        {
+          octave_function *fcn = ctor.function_value ();
+
+          if (fcn && fcn->is_class_constructor (c_name))
+            have_ctor = true;
+
+          // Something has gone terribly wrong if
+          // symbol_table::find_method (c_name, c_name) does not return
+          // a class constructor for the class c_name...
+          assert (have_ctor);
+        }
+
+      if (have_ctor)
+        {
+          octave_value_list result
+            = ctor.do_multi_index_op (1, octave_value_list ());
+
+          if (result.length () == 1)
+            retval = true;
+          else
+            warning ("call to constructor for class %s failed", c_name.c_str ());
+        }
+      else
+        warning ("no constructor for class %s", c_name.c_str ());
+    }
+
+  return retval;
+}
+
+void
+octave_class::clear_exemplar_map (void)
+{
+  exemplar_map.clear ();
+}
+
+//  Load/save does not provide enough information to reconstruct the
+//  class inheritance structure.  reconstruct_parents () attempts to
+//  do so.  If successful, a "true" value is returned.
+//
+//  Note that we don't check the loaded object structure against the
+//  class structure here so the user's loadobj method has a chance
+//  to do its magic.
+bool
+octave_class::reconstruct_parents (void)
+{
+  bool retval = true, might_have_inheritance = false;
+  std::string dbgstr = "dork";
+
+  // First, check to see if there might be an issue with inheritance.
+  for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
+    {
+      std::string  key = map.key (p);
+      Cell         val = map.contents (p);
+      if ( val(0).is_object () )
+        {
+          dbgstr = "blork";
+          if ( key == val(0).class_name () )
+            {
+              might_have_inheritance = true;
+              dbgstr = "cork";
+              break;
+            }
+        }
+    }
+
+  if (might_have_inheritance)
+    {
+      octave_class::exemplar_const_iterator it
+        = octave_class::exemplar_map.find (c_name);
+
+      if (it == octave_class::exemplar_map.end ())
+        retval = false;
+      else
+        {
+          octave_class::exemplar_info exmplr = it->second;
+          parent_list = exmplr.parents ();
+          for (std::list<std::string>::iterator pit = parent_list.begin ();
+               pit != parent_list.end ();
+               pit++)
+            {
+              dbgstr = *pit;
+              bool dbgbool = map.contains (*pit);
+              if (!dbgbool)
+                {
+                  retval = false;
+                  break;
+                }
+            }
+        }
+    }
+
+  return retval;
+}
+
+bool
+octave_class::save_ascii (std::ostream& os)
+{
+  os << "# classname: " << class_name () << "\n";
+  octave_map m;
+  if (load_path::find_method (class_name (), "saveobj") != std::string ())
+    {
+      octave_value in = new octave_class (*this);
+      octave_value_list tmp = feval ("saveobj", in, 1);
+      if (! error_state)
+        m = tmp(0).map_value ();
+      else
+        return false;
+    }
+  else
+    m = map_value ();
+
+  os << "# length: " << m.nfields () << "\n";
+
+  octave_map::iterator i = m.begin ();
+  while (i != m.end ())
+    {
+      octave_value val = map.contents (i);
+
+      bool b = save_ascii_data (os, val, m.key (i), false, 0);
+
+      if (! b)
+        return os;
+
+      i++;
+    }
+
+  return true;
+}
+
+bool
+octave_class::load_ascii (std::istream& is)
+{
+  octave_idx_type len = 0;
+  std::string classname;
+  bool success = true;
+
+  if (extract_keyword (is, "classname", classname) && classname != "")
+    {
+      if (extract_keyword (is, "length", len) && len >= 0)
+        {
+          if (len > 0)
+            {
+              octave_map m (map);
+
+              for (octave_idx_type j = 0; j < len; j++)
+                {
+                  octave_value t2;
+                  bool dummy;
+
+                  // recurse to read cell elements
+                  std::string nm
+                    = read_ascii_data (is, std::string (), dummy, t2, j);
+
+                  if (! is)
+                    break;
+
+                  Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+
+                  if (error_state)
+                    {
+                      error ("load: internal error loading class elements");
+                      return false;
+                    }
+
+                  m.assign (nm, tcell);
+                }
+
+              if (is)
+                {
+                  c_name = classname;
+                  reconstruct_exemplar ();
+
+                  map = m;
+
+                  if (! reconstruct_parents ())
+                    warning ("load: unable to reconstruct object inheritance");
+                  else
+                    {
+                      if (load_path::find_method (classname, "loadobj")
+                          != std::string ())
+                        {
+                          octave_value in = new octave_class (*this);
+                          octave_value_list tmp = feval ("loadobj", in, 1);
+
+                          if (! error_state)
+                            map = tmp(0).map_value ();
+                          else
+                            success = false;
+                        }
+                    }
+                }
+              else
+                {
+                  error ("load: failed to load class");
+                  success = false;
+                }
+            }
+          else if (len == 0 )
+            {
+              map = octave_map (dim_vector (1, 1));
+              c_name = classname;
+            }
+          else
+            panic_impossible ();
+        }
+      else
+        {
+          error ("load: failed to extract number of elements in class");
+          success = false;
+        }
+    }
+  else
+    {
+      error ("load: failed to extract name of class");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_class::save_binary (std::ostream& os, bool& save_as_floats)
+{
+  int32_t classname_len = class_name ().length ();
+
+  os.write (reinterpret_cast<char *> (&classname_len), 4);
+  os << class_name ();
+
+  octave_map m;
+  if (load_path::find_method (class_name (), "saveobj") != std::string ())
+    {
+      octave_value in = new octave_class (*this);
+      octave_value_list tmp = feval ("saveobj", in, 1);
+      if (! error_state)
+        m = tmp(0).map_value ();
+      else
+        return false;
+    }
+  else
+    m = map_value ();
+
+  int32_t len = m.nfields ();
+  os.write (reinterpret_cast<char *> (&len), 4);
+
+  octave_map::iterator i = m.begin ();
+  while (i != m.end ())
+    {
+      octave_value val = map.contents (i);
+
+      bool b = save_binary_data (os, val, m.key (i), "", 0, save_as_floats);
+
+      if (! b)
+        return os;
+
+      i++;
+    }
+
+  return true;
+}
+
+bool
+octave_class::load_binary (std::istream& is, bool swap,
+                            oct_mach_info::float_format fmt)
+{
+  bool success = true;
+
+  int32_t classname_len;
+
+  is.read (reinterpret_cast<char *> (&classname_len), 4);
+  if (! is)
+    return false;
+  else if (swap)
+    swap_bytes<4> (&classname_len);
+
+  {
+    OCTAVE_LOCAL_BUFFER (char, classname, classname_len+1);
+    classname[classname_len] = '\0';
+    if (! is.read (reinterpret_cast<char *> (classname), classname_len))
+      return false;
+    c_name = classname;
+  }
+  reconstruct_exemplar ();
+
+  int32_t len;
+  if (! is.read (reinterpret_cast<char *> (&len), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&len);
+
+  if (len > 0)
+    {
+      octave_map m (map);
+
+      for (octave_idx_type j = 0; j < len; j++)
+        {
+          octave_value t2;
+          bool dummy;
+          std::string doc;
+
+          // recurse to read cell elements
+          std::string nm = read_binary_data (is, swap, fmt, std::string (),
+                                             dummy, t2, doc);
+
+          if (! is)
+            break;
+
+          Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+
+          if (error_state)
+            {
+              error ("load: internal error loading class elements");
+              return false;
+            }
+
+          m.assign (nm, tcell);
+        }
+
+      if (is)
+        {
+          map = m;
+
+          if (! reconstruct_parents ())
+            warning ("load: unable to reconstruct object inheritance");
+          else
+            {
+              if (load_path::find_method (c_name, "loadobj") != std::string ())
+                {
+                  octave_value in = new octave_class (*this);
+                  octave_value_list tmp = feval ("loadobj", in, 1);
+
+                  if (! error_state)
+                    map = tmp(0).map_value ();
+                  else
+                    success = false;
+                }
+            }
+        }
+      else
+        {
+          warning ("load: failed to load class");
+          success = false;
+        }
+    }
+  else if (len == 0 )
+    map = octave_map (dim_vector (1, 1));
+  else
+    panic_impossible ();
+
+  return success;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_class::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
+{
+  hsize_t hdims[3];
+  hid_t group_hid = -1;
+  hid_t type_hid = -1;
+  hid_t space_hid = -1;
+  hid_t class_hid = -1;
+  hid_t data_hid = -1;
+  octave_map m;
+  octave_map::iterator i;
+
+#if HAVE_HDF5_18
+  group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  group_hid = H5Gcreate (loc_id, name, 0);
+#endif
+  if (group_hid < 0)
+    goto error_cleanup;
+
+  // Add the class name to the group
+  type_hid = H5Tcopy (H5T_C_S1); H5Tset_size (type_hid, c_name.length () + 1);
+  if (type_hid < 0)
+    goto error_cleanup;
+
+  hdims[0] = 0;
+  space_hid = H5Screate_simple (0 , hdims, 0);
+  if (space_hid < 0)
+    goto error_cleanup;
+#if HAVE_HDF5_18
+  class_hid = H5Dcreate (group_hid, "classname",  type_hid, space_hid,
+                         H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  class_hid = H5Dcreate (group_hid, "classname",  type_hid, space_hid,
+                         H5P_DEFAULT);
+#endif
+  if (class_hid < 0 || H5Dwrite (class_hid, type_hid, H5S_ALL, H5S_ALL,
+                                    H5P_DEFAULT, c_name.c_str ()) < 0)
+    goto error_cleanup;
+
+#if HAVE_HDF5_18
+  data_hid = H5Gcreate (group_hid, "value", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Gcreate (group_hid, "value", 0);
+#endif
+  if (data_hid < 0)
+    goto error_cleanup;
+
+  if (load_path::find_method (class_name (), "saveobj") != std::string ())
+    {
+      octave_value in = new octave_class (*this);
+      octave_value_list tmp = feval ("saveobj", in, 1);
+      if (! error_state)
+        m = tmp(0).map_value ();
+      else
+        goto error_cleanup;
+    }
+  else
+    m = map_value ();
+
+  // recursively add each element of the class to this group
+  i = m.begin ();
+  while (i != m.end ())
+    {
+      octave_value val = map.contents (i);
+
+      bool retval2 = add_hdf5_data (data_hid, val, m.key (i), "", false,
+                                    save_as_floats);
+
+      if (! retval2)
+        break;
+
+      i++;
+    }
+
+ error_cleanup:
+
+  if (data_hid > 0)
+    H5Gclose (data_hid);
+
+  if (class_hid > 0)
+    H5Dclose (class_hid);
+
+  if (space_hid > 0)
+    H5Sclose (space_hid);
+
+  if (type_hid > 0)
+    H5Tclose (type_hid);
+
+  if (group_hid > 0)
+    H5Gclose (group_hid);
+
+  return true;
+}
+
+bool
+octave_class::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  hid_t group_hid = -1;
+  hid_t data_hid = -1;
+  hid_t type_hid = -1;
+  hid_t type_class_hid = -1;
+  hid_t space_hid = -1;
+  hid_t subgroup_hid = -1;
+  hid_t st_id = -1;
+
+  hdf5_callback_data dsub;
+
+  herr_t retval2 = 0;
+  octave_map m (dim_vector (1, 1));
+  int current_item = 0;
+  hsize_t num_obj = 0;
+  int slen = 0;
+  hsize_t rank = 0;
+
+#if HAVE_HDF5_18
+  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  group_hid = H5Gopen (loc_id, name);
+#endif
+  if (group_hid < 0)
+    goto error_cleanup;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "classname", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "classname");
+#endif
+
+  if (data_hid < 0)
+    goto error_cleanup;
+
+  type_hid = H5Dget_type (data_hid);
+
+  type_class_hid = H5Tget_class (type_hid);
+
+  if (type_class_hid != H5T_STRING)
+    goto error_cleanup;
+
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    goto error_cleanup;
+
+  slen = H5Tget_size (type_hid);
+  if (slen < 0)
+    goto error_cleanup;
+
+  // do-while loop here to prevent goto crossing initialization of classname
+  do
+    {
+      OCTAVE_LOCAL_BUFFER (char, classname, slen);
+
+      // create datatype for (null-terminated) string to read into:
+      st_id = H5Tcopy (H5T_C_S1);
+      H5Tset_size (st_id, slen);
+
+      if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                   classname) < 0)
+        {
+          H5Tclose (st_id);
+          H5Dclose (data_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      H5Tclose (st_id);
+      H5Dclose (data_hid);
+      data_hid = -1;
+
+      c_name = classname;
+    }
+  while (0);
+  reconstruct_exemplar ();
+
+#if HAVE_HDF5_18
+  subgroup_hid = H5Gopen (group_hid, name, H5P_DEFAULT);
+#else
+  subgroup_hid = H5Gopen (group_hid, name);
+#endif
+  H5Gget_num_objs (subgroup_hid, &num_obj);
+  H5Gclose (subgroup_hid);
+
+  while (current_item < static_cast<int> (num_obj)
+         && (retval2 = H5Giterate (group_hid, name, &current_item,
+                                   hdf5_read_next_data, &dsub)) > 0)
+    {
+      octave_value t2 = dsub.tc;
+
+      Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+
+      if (error_state)
+        {
+          error ("load: internal error loading class elements");
+          return false;
+        }
+
+      m.assign (dsub.name, tcell);
+
+    }
+
+  if (retval2 >= 0)
+    {
+      map = m;
+
+      if (!reconstruct_parents ())
+        warning ("load: unable to reconstruct object inheritance");
+      else
+        {
+          if (load_path::find_method (c_name, "loadobj") != std::string ())
+            {
+              octave_value in = new octave_class (*this);
+              octave_value_list tmp = feval ("loadobj", in, 1);
+
+              if (! error_state)
+                {
+                  map = tmp(0).map_value ();
+                  retval = true;
+                }
+              else
+                retval = false;
+            }
+          else
+            retval = true;
+        }
+    }
+
+ error_cleanup:
+  if (data_hid > 0)
+    H5Dclose (data_hid);
+
+  if (data_hid > 0)
+    H5Gclose (group_hid);
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_class::as_mxArray (void) const
+{
+  gripe_wrong_type_arg ("octave_class::as_mxArray ()", type_name ());
+
+  return 0;
+}
+
+bool
+octave_class::in_class_method (void)
+{
+  octave_function *fcn = octave_call_stack::current ();
+
+  return (fcn
+          && (fcn->is_class_method ()
+              || fcn->is_class_constructor ()
+              || fcn->is_anonymous_function_of_class ()
+              || fcn->is_private_function_of_class (class_name ()))
+          && find_parent_class (fcn->dispatch_class ()));
+}
+
+octave_class::exemplar_info::exemplar_info (const octave_value& obj)
+  : field_names (), parent_class_names ()
+{
+  if (obj.is_object ())
+    {
+      octave_map m = obj.map_value ();
+      field_names = m.keys ();
+
+      parent_class_names = obj.parent_class_name_list ();
+    }
+  else
+    error ("invalid call to exemplar_info constructor");
+}
+
+
+// A map from class names to lists of fields.
+std::map<std::string, octave_class::exemplar_info> octave_class::exemplar_map;
+
+bool
+octave_class::exemplar_info::compare (const octave_value& obj) const
+{
+  bool retval = true;
+
+  if (obj.is_object ())
+    {
+      if (nfields () == obj.nfields ())
+        {
+          octave_map obj_map = obj.map_value ();
+          string_vector obj_fnames = obj_map.keys ();
+          string_vector fnames = fields ();
+
+          for (octave_idx_type i = 0; i < nfields (); i++)
+            {
+              if (obj_fnames[i] != fnames[i])
+                {
+                  retval = false;
+                  error ("mismatch in field names");
+                  break;
+                }
+            }
+
+          if (nparents () == obj.nparents ())
+            {
+              std::list<std::string> obj_parents
+                = obj.parent_class_name_list ();
+              std::list<std::string> pnames = parents ();
+
+              std::list<std::string>::const_iterator p = obj_parents.begin ();
+              std::list<std::string>::const_iterator q = pnames.begin ();
+
+              while (p != obj_parents.end ())
+                {
+                  if (*p++ != *q++)
+                    {
+                      retval = false;
+                      error ("mismatch in parent classes");
+                      break;
+                    }
+                }
+            }
+          else
+            {
+              retval = false;
+              error ("mismatch in number of parent classes");
+            }
+        }
+      else
+        {
+          retval = false;
+          error ("mismatch in number of fields");
+        }
+    }
+  else
+    {
+      retval = false;
+      error ("invalid comparison of class exemplar to non-class object");
+    }
+
+  return retval;
+}
+
+DEFUN (class, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} class (@var{expr})\n\
+@deftypefnx {Built-in Function} {} class (@var{s}, @var{id})\n\
+@deftypefnx {Built-in Function} {} class (@var{s}, @var{id}, @var{p}, @dots{})\n\
+Return the class of the expression @var{expr} or create a class with\n\
+fields from structure @var{s} and name (string) @var{id}.  Additional\n\
+arguments name a list of parent classes from which the new class is\n\
+derived.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 0)
+    print_usage ();
+  else if (nargin == 1)
+    retval = args(0).class_name ();
+  else
+    {
+      octave_function *fcn = octave_call_stack::caller ();
+
+      std::string id = args(1).string_value ();
+
+      if (! error_state)
+        {
+          if (fcn)
+            {
+              if (fcn->is_class_constructor (id) || fcn->is_class_method (id))
+                {
+                  octave_map m = args(0).map_value ();
+
+                  if (! error_state)
+                    {
+                      if (nargin == 2)
+                        retval
+                          = octave_value (new octave_class
+                                          (m, id, std::list<std::string> ()));
+                      else
+                        {
+                          octave_value_list parents = args.slice (2, nargin-2);
+
+                          retval
+                            = octave_value (new octave_class (m, id, parents));
+                        }
+
+                      if (! error_state)
+                        {
+                          octave_class::exemplar_const_iterator it
+                            = octave_class::exemplar_map.find (id);
+
+                          if (it == octave_class::exemplar_map.end ())
+                            octave_class::exemplar_map[id]
+                              = octave_class::exemplar_info (retval);
+                          else if (! it->second.compare (retval))
+                            error ("class: object of class `%s' does not match previously constructed objects",
+                                   id.c_str ());
+                        }
+                    }
+                  else
+                    error ("class: expecting structure S as first argument");
+                }
+              else
+                error ("class: `%s' is invalid as a class name in this context",
+                       id.c_str ());
+            }
+          else
+            error ("class: invalid call from outside class constructor or method");
+        }
+      else
+        error ("class: ID (class name) must be a character string");
+    }
+
+  return retval;
+}
+
+DEFUN (__isa_parent__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} __isa_parent__ (@var{class}, @var{name})\n\
+Undocumented internal function.\n\
+@end deftypefn")
+{
+  octave_value retval = false;
+
+  if (args.length () == 2)
+    {
+      octave_value cls = args(0);
+      octave_value nm = args(1);
+
+      if (! error_state)
+        {
+          if (cls.find_parent_class (nm.string_value ()))
+            retval = true;
+        }
+      else
+        error ("__isa_parent__: expecting arguments to be character strings");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (__parent_classes__, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} __parent_classes__ (@var{x})\n\
+Undocumented internal function.\n\
+@end deftypefn")
+{
+  octave_value retval = Cell ();
+
+  if (args.length () == 1)
+    {
+      octave_value arg = args(0);
+
+      if (arg.is_object ())
+        retval = Cell (arg.parent_class_names ());
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (isobject, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} isobject (@var{x})\n\
+Return true if @var{x} is a class object.\n\
+@seealso{class, typeinfo, isa, ismethod}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = args(0).is_object ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (ismethod, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} ismethod (@var{x}, @var{method})\n\
+Return true if @var{x} is a class object and the string @var{method}\n\
+is a method of this class.\n\
+@seealso{isobject}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 2)
+    {
+      octave_value arg = args(0);
+
+      std::string class_name;
+
+      if (arg.is_object ())
+        class_name = arg.class_name ();
+      else if (arg.is_string ())
+        class_name = arg.string_value ();
+      else
+        error ("ismethod: expecting object or class name as first argument");
+
+      if (! error_state)
+        {
+          std::string method = args(1).string_value ();
+
+          if (! error_state)
+            {
+              if (load_path::find_method (class_name, method) != std::string ())
+                retval = true;
+              else
+                retval = false;
+            }
+        }
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (methods, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} methods (@var{x})\n\
+@deftypefnx {Built-in Function} {} methods (\"classname\")\n\
+Return a cell array containing the names of the methods for the\n\
+object @var{x} or the named class.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    {
+      octave_value arg = args(0);
+
+      std::string class_name;
+
+      if (arg.is_object ())
+        class_name = arg.class_name ();
+      else if (arg.is_string ())
+        class_name = arg.string_value ();
+      else
+        error ("methods: expecting object or class name as argument");
+
+      if (! error_state)
+        {
+          string_vector sv = load_path::methods (class_name);
+
+          if (nargout == 0)
+            {
+              octave_stdout << "Methods for class " << class_name << ":\n\n";
+
+              sv.list_in_columns (octave_stdout);
+
+              octave_stdout << std::endl;
+            }
+          else
+            retval = Cell (sv);
+        }
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+static bool
+is_built_in_class (const std::string& cn)
+{
+  static std::set<std::string> built_in_class_names;
+
+  if (built_in_class_names.empty ())
+    {
+      built_in_class_names.insert ("double");
+      built_in_class_names.insert ("single");
+      built_in_class_names.insert ("cell");
+      built_in_class_names.insert ("struct");
+      built_in_class_names.insert ("logical");
+      built_in_class_names.insert ("char");
+      built_in_class_names.insert ("function handle");
+      built_in_class_names.insert ("int8");
+      built_in_class_names.insert ("uint8");
+      built_in_class_names.insert ("int16");
+      built_in_class_names.insert ("uint16");
+      built_in_class_names.insert ("int32");
+      built_in_class_names.insert ("uint32");
+      built_in_class_names.insert ("int64");
+      built_in_class_names.insert ("uint64");
+    }
+
+  return built_in_class_names.find (cn) != built_in_class_names.end ();
+}
+
+DEFUN (superiorto, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} superiorto (@var{class_name}, @dots{})\n\
+When called from a class constructor, mark the object currently\n\
+constructed as having a higher precedence than @var{class_name}.\n\
+More that one such class can be specified in a single call.\n\
+This function may only be called from a class constructor.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  octave_function *fcn = octave_call_stack::caller ();
+
+  if (fcn && fcn->is_class_constructor ())
+    {
+      for (int i = 0; i < args.length (); i++)
+        {
+          std::string class_name = args(i).string_value ();
+
+          if (! error_state)
+            {
+              if (! is_built_in_class (class_name))
+                {
+                  std::string this_class_name = fcn->name ();
+
+                  if (! symbol_table::set_class_relationship (this_class_name,
+                                                              class_name))
+                    {
+                      error ("superiorto: precedence already set for %s and %s",
+                             this_class_name.c_str (), class_name.c_str ());
+                      break;
+                    }
+                }
+              else
+                {
+                  // User defined classes always have higher precedence
+                  // than built-in classes.
+                }
+            }
+          else
+            {
+              error ("superiorto: expecting argument to be class name");
+              break;
+            }
+        }
+    }
+  else
+    error ("superiorto: invalid call from outside class constructor");
+
+  return retval;
+}
+
+DEFUN (inferiorto, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} inferiorto (@var{class_name}, @dots{})\n\
+When called from a class constructor, mark the object currently\n\
+constructed as having a lower precedence than @var{class_name}.\n\
+More that one such class can be specified in a single call.\n\
+This function may only be called from a class constructor.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  octave_function *fcn = octave_call_stack::caller ();
+
+  if (fcn && fcn->is_class_constructor ())
+    {
+      for (int i = 0; i < args.length (); i++)
+        {
+          std::string class_name = args(i).string_value ();
+
+          if (! error_state)
+            {
+              if (! is_built_in_class (class_name))
+                {
+                  std::string this_class_name = fcn->name ();
+
+                  symbol_table::set_class_relationship (class_name,
+                                                        this_class_name);
+
+                  if (! symbol_table::set_class_relationship (this_class_name,
+                                                              class_name))
+                    {
+                      error ("inferiorto: precedence already set for %s and %s",
+                             this_class_name.c_str (), class_name.c_str ());
+                      break;
+                    }
+                }
+              else
+                {
+                  error ("inferiorto: cannot give user-defined class lower precedence than built-in class");
+                  break;
+                }
+            }
+          else
+            {
+              error ("inferiorto: expecting argument to be class name");
+              break;
+            }
+        }
+    }
+  else
+    error ("inferiorto: invalid call from outside class constructor");
+
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-class.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,285 @@
+/*
+
+Copyright (C) 2007-2012 John W. Eaton
+Copyright (C) 2009 VZLU Prague
+
+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_class_h)
+#define octave_class_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-alloc.h"
+#include "oct-map.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Data structures.
+
+class
+octave_class : public octave_base_value
+{
+public:
+
+  octave_class (void)
+    : octave_base_value (), map (), c_name (),
+      parent_list (), obsolete_copies (0)
+    { }
+
+  octave_class (const octave_map& m, const std::string& id,
+                const std::list<std::string>& plist)
+    : octave_base_value (), map (m), c_name (id),
+      parent_list (plist), obsolete_copies (0)
+    { }
+
+  octave_class (const octave_map& m, const std::string& id,
+                const octave_value_list& parents);
+
+  octave_class (const octave_class& s)
+    : octave_base_value (s), map (s.map), c_name (s.c_name),
+      parent_list (s.parent_list), obsolete_copies (0)  { }
+
+  ~octave_class (void) { }
+
+  octave_base_value *clone (void) const { return new octave_class (*this); }
+
+  octave_base_value *unique_clone (void);
+
+  octave_base_value *empty_clone (void) const
+  {
+    return new octave_class (octave_map (map.keys ()), c_name, parent_list);
+  }
+
+  Cell dotref (const octave_value_list& idx);
+
+  Matrix size (void);
+
+  octave_idx_type numel (const octave_value_list&);
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    {
+      octave_value_list tmp = subsref (type, idx, 1);
+      return tmp.length () > 0 ? tmp(0) : octave_value ();
+    }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& idx)
+  {
+    return subsref ("(", std::list<octave_value_list> (1, idx), nargout);
+  }
+
+  static octave_value numeric_conv (const Cell& val,
+                                    const std::string& type);
+
+  void assign(const std::string& k, const octave_value& rhs)
+  { map.assign (k, rhs); };
+
+  octave_value subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs);
+
+  octave_value undef_subsasgn (const std::string& type,
+                               const std::list<octave_value_list>& idx,
+                               const octave_value& rhs);
+
+  idx_vector index_vector (void) const;
+
+  dim_vector dims (void) const { return map.dims (); }
+
+  size_t byte_size (void) const;
+
+  // This is the number of elements in each field.  The total number
+  // of elements is numel () * nfields ().
+  octave_idx_type numel (void) const
+  {
+    dim_vector dv = dims ();
+    return dv.numel ();
+  }
+
+  octave_idx_type nfields (void) const { return map.nfields (); }
+
+  size_t nparents (void) const { return parent_list.size (); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    {
+      octave_class retval = octave_class (*this);
+      retval.map = retval.map_value ().reshape (new_dims);
+      return octave_value (new octave_class (retval));
+    }
+
+  octave_value resize (const dim_vector& dv, bool = false) const
+    {
+      octave_class retval = octave_class (*this);
+      retval.map.resize (dv);
+      return octave_value (new octave_class (retval));
+    }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_map (void) const { return false; }
+
+  bool is_object (void) const { return true; }
+
+  octave_map map_value (void) const { return map; }
+
+  string_vector map_keys (void) const;
+
+  std::list<std::string> parent_class_name_list (void) const
+    { return parent_list; }
+
+  string_vector parent_class_names (void) const
+    { return string_vector (parent_list); }
+
+  octave_base_value *find_parent_class (const std::string&);
+
+  octave_base_value *unique_parent_class (const std::string&);
+
+  string_vector all_strings (bool pad) const;
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool print_name_tag (std::ostream& os, const std::string& name) const;
+
+  void print_with_name (std::ostream& os, const std::string& name,
+                        bool print_padding = true);
+
+  bool reconstruct_exemplar (void);
+
+  static void clear_exemplar_map (void);
+
+  bool reconstruct_parents (void);
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  mxArray *as_mxArray (void) const;
+
+private:
+
+  octave_map map;
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+public:
+  int type_id (void) const { return t_id; }
+  std::string type_name (void) const { return t_name; }
+  std::string class_name (void) const { return c_name; }
+
+  static int static_type_id (void) { return t_id; }
+  static std::string static_type_name (void) { return t_name; }
+  static std::string static_class_name (void) { return "<unknown>"; }
+  static void register_type (void);
+
+private:
+  static int t_id;
+
+  static const std::string t_name;
+  std::string c_name;
+  std::list<std::string> parent_list;
+
+  bool in_class_method (void);
+  std::string get_current_method_class (void);
+
+  octave_value subsasgn_common (const octave_value& obj,
+                                const std::string& type,
+                                const std::list<octave_value_list>& idx,
+                                const octave_value& rhs);
+
+  int obsolete_copies;
+
+public:
+  // The list of field names and parent classes defines a class.  We
+  // keep track of each class that has been created so that we know
+  class exemplar_info
+  {
+  public:
+
+    exemplar_info (void) : field_names (), parent_class_names () { }
+
+    exemplar_info (const octave_value& obj);
+
+    exemplar_info (const exemplar_info& x)
+      : field_names (x.field_names),
+        parent_class_names (x.parent_class_names) { }
+
+    exemplar_info& operator = (const exemplar_info& x)
+    {
+      if (&x != this)
+        {
+          field_names = x.field_names;
+          parent_class_names = x.parent_class_names;
+        }
+      return *this;
+    }
+
+    octave_idx_type nfields (void) const { return field_names.length (); }
+
+    size_t nparents (void) const { return parent_class_names.size (); }
+
+    string_vector fields (void) const { return field_names; }
+
+    std::list<std::string> parents (void) const { return parent_class_names; }
+
+    bool compare (const octave_value& obj) const;
+
+  private:
+
+    string_vector field_names;
+    std::list<std::string> parent_class_names;
+  };
+
+  // A map from class names to lists of fields.
+  static std::map<std::string, exemplar_info> exemplar_map;
+
+  typedef std::map<std::string, exemplar_info>::iterator exemplar_iterator;
+  typedef std::map<std::string, exemplar_info>::const_iterator exemplar_const_iterator;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-colon.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,48 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "error.h"
+#include "pr-output.h"
+#include "oct-obj.h"
+#include "ov-colon.h"
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_magic_colon,
+                                     "magic-colon", "magic-colon");
+
+void
+octave_magic_colon::print (std::ostream& os, bool) const
+{
+  indent (os);
+  print_raw (os);
+}
+
+void
+octave_magic_colon::print_raw (std::ostream& os, bool) const
+{
+  os << ":";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-colon.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,77 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_magic_colon_h)
+#define octave_magic_colon_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// A type to represent `:' as used for indexing.
+
+class
+octave_magic_colon : public octave_base_value
+{
+public:
+
+  octave_magic_colon (void)
+    : octave_base_value () { }
+
+  octave_magic_colon (const octave_magic_colon&)
+    : octave_base_value () { }
+
+  ~octave_magic_colon (void) { }
+
+  octave_base_value *clone (void) const { return new octave_magic_colon (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_magic_colon (); }
+
+  idx_vector index_vector (void) const { return idx_vector (':'); }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_magic_colon (void) const { return true; }
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+private:
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-complex.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,463 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+
+#include "oct-obj.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-base.h"
+#include "ov-base-scalar.h"
+#include "ov-base-scalar.cc"
+#include "ov-cx-mat.h"
+#include "ov-scalar.h"
+#include "gripes.h"
+#include "pr-output.h"
+#include "ops.h"
+
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+
+template class octave_base_scalar<Complex>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_complex);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex,
+                                     "complex scalar", "double");
+
+static octave_base_value *
+default_numeric_demotion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_complex&);
+
+  return new octave_float_complex (v.float_complex_value ());
+}
+
+octave_base_value::type_conv_info
+octave_complex::numeric_demotion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_demotion_function,
+                                            octave_float_complex::static_type_id ());
+}
+
+octave_base_value *
+octave_complex::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  double im = std::imag (scalar);
+
+  if (im == 0.0)
+    retval = new octave_scalar (std::real (scalar));
+
+  return retval;
+}
+
+octave_value
+octave_complex::do_index_op (const octave_value_list& idx, bool resize_ok)
+{
+  // FIXME -- this doesn't solve the problem of
+  //
+  //   a = i; a([1,1], [1,1], [1,1])
+  //
+  // and similar constructions.  Hmm...
+
+  // FIXME -- using this constructor avoids narrowing the
+  // 1x1 matrix back to a scalar value.  Need a better solution
+  // to this problem.
+
+  octave_value tmp (new octave_complex_matrix (complex_matrix_value ()));
+
+  return tmp.do_index_op (idx, resize_ok);
+}
+
+double
+octave_complex::double_value (bool force_conversion) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real scalar");
+
+  retval = std::real (scalar);
+
+  return retval;
+}
+
+float
+octave_complex::float_value (bool force_conversion) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real scalar");
+
+  retval = std::real (scalar);
+
+  return retval;
+}
+
+Matrix
+octave_complex::matrix_value (bool force_conversion) const
+{
+  Matrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real matrix");
+
+  retval = Matrix (1, 1, std::real (scalar));
+
+  return retval;
+}
+
+FloatMatrix
+octave_complex::float_matrix_value (bool force_conversion) const
+{
+  FloatMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real matrix");
+
+  retval = FloatMatrix (1, 1, std::real (scalar));
+
+  return retval;
+}
+
+NDArray
+octave_complex::array_value (bool force_conversion) const
+{
+  NDArray retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real matrix");
+
+  retval = NDArray (dim_vector (1, 1), std::real (scalar));
+
+  return retval;
+}
+
+FloatNDArray
+octave_complex::float_array_value (bool force_conversion) const
+{
+  FloatNDArray retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real matrix");
+
+  retval = FloatNDArray (dim_vector (1, 1), std::real (scalar));
+
+  return retval;
+}
+
+Complex
+octave_complex::complex_value (bool) const
+{
+  return scalar;
+}
+
+FloatComplex
+octave_complex::float_complex_value (bool) const
+{
+  return static_cast<FloatComplex> (scalar);
+}
+
+ComplexMatrix
+octave_complex::complex_matrix_value (bool) const
+{
+  return ComplexMatrix (1, 1, scalar);
+}
+
+FloatComplexMatrix
+octave_complex::float_complex_matrix_value (bool) const
+{
+  return FloatComplexMatrix (1, 1, static_cast<FloatComplex> (scalar));
+}
+
+ComplexNDArray
+octave_complex::complex_array_value (bool /* force_conversion */) const
+{
+  return ComplexNDArray (dim_vector (1, 1), scalar);
+}
+
+FloatComplexNDArray
+octave_complex::float_complex_array_value (bool /* force_conversion */) const
+{
+  return FloatComplexNDArray (dim_vector (1, 1), static_cast<FloatComplex> (scalar));
+}
+
+octave_value
+octave_complex::resize (const dim_vector& dv, bool fill) const
+{
+  if (fill)
+    {
+      ComplexNDArray retval (dv, Complex (0));
+
+      if (dv.numel ())
+        retval(0) = scalar;
+
+      return retval;
+    }
+  else
+    {
+      ComplexNDArray retval (dv);
+
+      if (dv.numel ())
+        retval(0) = scalar;
+
+      return retval;
+    }
+}
+
+octave_value
+octave_complex::diag (octave_idx_type m, octave_idx_type n) const
+{
+  return ComplexDiagMatrix (Array<Complex> (dim_vector (1, 1), scalar), m, n);
+}
+
+bool
+octave_complex::save_ascii (std::ostream& os)
+{
+  Complex c = complex_value ();
+
+  octave_write_complex (os, c);
+
+  os << "\n";
+
+  return true;
+}
+
+bool
+octave_complex::load_ascii (std::istream& is)
+{
+  scalar = octave_read_value<Complex> (is);
+
+  if (!is)
+    {
+      error ("load: failed to load complex scalar constant");
+      return false;
+    }
+
+  return true;
+}
+
+
+bool
+octave_complex::save_binary (std::ostream& os, bool& /* save_as_floats */)
+{
+  char tmp = static_cast<char> (LS_DOUBLE);
+  os.write (reinterpret_cast<char *> (&tmp), 1);
+  Complex ctmp = complex_value ();
+  os.write (reinterpret_cast<char *> (&ctmp), 16);
+
+  return true;
+}
+
+bool
+octave_complex::load_binary (std::istream& is, bool swap,
+                             oct_mach_info::float_format fmt)
+{
+  char tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+    return false;
+
+  Complex ctmp;
+  read_doubles (is, reinterpret_cast<double *> (&ctmp),
+                static_cast<save_type> (tmp), 2, swap, fmt);
+  if (error_state || ! is)
+    return false;
+
+  scalar = ctmp;
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_complex::save_hdf5 (hid_t loc_id, const char *name,
+                           bool /* save_as_floats */)
+{
+  hsize_t dimens[3];
+  hid_t space_hid = -1, type_hid = -1, data_hid = -1;
+  bool retval = true;
+
+  space_hid = H5Screate_simple (0, dimens, 0);
+  if (space_hid < 0)
+    return false;
+
+  type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
+  if (type_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      return false;
+    }
+
+  Complex tmp = complex_value ();
+  retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                     &tmp) >= 0;
+
+  H5Dclose (data_hid);
+  H5Tclose (type_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_complex::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t type_hid = H5Dget_type (data_hid);
+
+  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
+
+  if (! hdf5_types_compatible (type_hid, complex_type))
+    {
+      H5Tclose (complex_type);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  hid_t space_id = H5Dget_space (data_hid);
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank != 0)
+    {
+      H5Tclose (complex_type);
+      H5Sclose (space_id);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  // complex scalar:
+  Complex ctmp;
+  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+               &ctmp) >= 0)
+    {
+      retval = true;
+      scalar = ctmp;
+    }
+
+  H5Tclose (complex_type);
+  H5Sclose (space_id);
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_complex::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxDOUBLE_CLASS, 1, 1, mxCOMPLEX);
+
+  double *pr = static_cast<double *> (retval->get_data ());
+  double *pi = static_cast<double *> (retval->get_imag_data ());
+
+  pr[0] = std::real (scalar);
+  pi[0] = std::imag (scalar);
+
+  return retval;
+}
+
+octave_value
+octave_complex::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+#define SCALAR_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (FCN (scalar))
+
+      SCALAR_MAPPER (abs, std::abs);
+      SCALAR_MAPPER (acos, ::acos);
+      SCALAR_MAPPER (acosh, ::acosh);
+      SCALAR_MAPPER (angle, std::arg);
+      SCALAR_MAPPER (arg, std::arg);
+      SCALAR_MAPPER (asin, ::asin);
+      SCALAR_MAPPER (asinh, ::asinh);
+      SCALAR_MAPPER (atan, ::atan);
+      SCALAR_MAPPER (atanh, ::atanh);
+      SCALAR_MAPPER (ceil, ::ceil);
+      SCALAR_MAPPER (conj, std::conj);
+      SCALAR_MAPPER (cos, std::cos);
+      SCALAR_MAPPER (cosh, std::cosh);
+      SCALAR_MAPPER (exp, std::exp);
+      SCALAR_MAPPER (expm1, ::expm1);
+      SCALAR_MAPPER (fix, ::fix);
+      SCALAR_MAPPER (floor, ::floor);
+      SCALAR_MAPPER (imag, std::imag);
+      SCALAR_MAPPER (log, std::log);
+      SCALAR_MAPPER (log2, xlog2);
+      SCALAR_MAPPER (log10, std::log10);
+      SCALAR_MAPPER (log1p, ::log1p);
+      SCALAR_MAPPER (real, std::real);
+      SCALAR_MAPPER (round, xround);
+      SCALAR_MAPPER (roundb, xroundb);
+      SCALAR_MAPPER (signum, ::signum);
+      SCALAR_MAPPER (sin, std::sin);
+      SCALAR_MAPPER (sinh, std::sinh);
+      SCALAR_MAPPER (sqrt, std::sqrt);
+      SCALAR_MAPPER (tan, std::tan);
+      SCALAR_MAPPER (tanh, std::tanh);
+      SCALAR_MAPPER (finite, xfinite);
+      SCALAR_MAPPER (isinf, xisinf);
+      SCALAR_MAPPER (isna, octave_is_NA);
+      SCALAR_MAPPER (isnan, xisnan);
+
+    default:
+      return octave_base_value::map (umap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-complex.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,209 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_complex_h)
+#define octave_complex_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "lo-ieee.h"
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "gripes.h"
+#include "error.h"
+#include "ov-base.h"
+#include "ov-cx-mat.h"
+#include "ov-base-scalar.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Complex scalar values.
+
+class
+OCTINTERP_API
+octave_complex : public octave_base_scalar<Complex>
+{
+public:
+
+  octave_complex (void)
+    : octave_base_scalar<Complex> () { }
+
+  octave_complex (const Complex& c)
+    : octave_base_scalar<Complex> (c) { }
+
+  octave_complex (const octave_complex& c)
+    : octave_base_scalar<Complex> (c) { }
+
+  ~octave_complex (void) { }
+
+  octave_base_value *clone (void) const { return new octave_complex (*this); }
+
+  // We return an octave_complex_matrix object here instead of an
+  // octave_complex object so that in expressions like A(2,2,2) = 2
+  // (for A previously undefined), A will be empty instead of a 1x1
+  // object.
+  octave_base_value *empty_clone (void) const
+    { return new octave_complex_matrix (); }
+
+  type_conv_info numeric_demotion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  // Use this to give a more specific error message
+  idx_vector index_vector (void) const
+  {
+    error (
+           "attempted to use a complex scalar as an index\n"
+           "       (forgot to initialize i or j?)");
+    return idx_vector ();
+  }
+
+  octave_value any (int = 0) const
+    {
+      return (scalar != Complex (0, 0)
+              && ! (lo_ieee_isnan (std::real (scalar))
+                    || lo_ieee_isnan (std::imag (scalar))));
+    }
+
+  builtin_type_t builtin_type (void) const { return btyp_complex; }
+
+  bool is_complex_scalar (void) const { return true; }
+
+  bool is_complex_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  float float_scalar_value (bool frc_str_conv = false) const
+    { return float_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  FloatMatrix float_matrix_value (bool = false) const;
+
+  NDArray array_value (bool = false) const;
+
+  FloatNDArray float_array_value (bool = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const
+    { return SparseMatrix (matrix_value ()); }
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+    { return SparseComplexMatrix (complex_matrix_value ()); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  bool bool_value (bool warn = false) const
+  {
+    if (xisnan (scalar))
+      gripe_nan_to_logical_conversion ();
+    else if (warn && scalar != 0.0 && scalar != 1.0)
+      gripe_logical_conversion ();
+
+    return scalar != 0.0;
+  }
+
+  boolNDArray bool_array_value (bool warn = false) const
+  {
+    if (xisnan (scalar))
+      gripe_nan_to_logical_conversion ();
+    else if (warn && scalar != 0.0 && scalar != 1.0)
+      gripe_logical_conversion ();
+
+    return boolNDArray (dim_vector (1, 1), scalar != 0.0);
+  }
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  void increment (void) { scalar += 1.0; }
+
+  void decrement (void) { scalar -= 1.0; }
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      // Yes, for compatibility, we drop the imaginary part here.
+      return os.write (array_value (true), block_size, output_type,
+                       skip, flt_fmt);
+    }
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+typedef octave_complex octave_complex_scalar;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cs-list.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,62 @@
+/*
+
+Copyright (C) 2002-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <sstream>
+
+#include "lo-utils.h"
+
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "ov-cs-list.h"
+#include "unwind-prot.h"
+
+DEFINE_OCTAVE_ALLOCATOR (octave_cs_list);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cs_list, "cs-list", "cs-list");
+
+octave_cs_list::octave_cs_list (const Cell& c)
+  : octave_base_value (), lst (c)
+{
+}
+
+octave_value
+octave_cs_list::subsref (const std::string&,
+                         const std::list<octave_value_list>&)
+{
+  gripe_indexed_cs_list ();
+  return octave_value ();
+}
+
+octave_value_list
+octave_cs_list::subsref (const std::string&,
+                         const std::list<octave_value_list>&, int)
+{
+  gripe_indexed_cs_list ();
+  return octave_value_list ();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cs-list.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,91 @@
+/*
+
+Copyright (C) 2002-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_cs_list_h)
+#define octave_cs_list_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "str-vec.h"
+
+#include "Cell.h"
+#include "error.h"
+#include "oct-alloc.h"
+#include "oct-obj.h"
+#include "ov-typeinfo.h"
+
+class tree_walker;
+
+// Lists.
+
+class
+octave_cs_list : public octave_base_value
+{
+public:
+
+  octave_cs_list (void)
+    : octave_base_value (), lst () { }
+
+  octave_cs_list (const octave_value_list& l)
+    : octave_base_value (), lst (l) { }
+
+  octave_cs_list (const Cell& c);
+
+  octave_cs_list (const octave_cs_list& l)
+    : octave_base_value (), lst (l.lst) { }
+
+  ~octave_cs_list (void) { }
+
+  octave_base_value *clone (void) const { return new octave_cs_list (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_cs_list (); }
+
+  dim_vector dims (void) const { return dim_vector (1, lst.length ()); }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_cs_list (void) const { return true; }
+
+  octave_value_list list_value (void) const { return lst; }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int);
+
+private:
+
+  // The list of Octave values.
+  octave_value_list lst;
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cx-diag.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,238 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "byte-swap.h"
+
+#include "ov-cx-diag.h"
+#include "ov-flt-cx-diag.h"
+#include "ov-re-diag.h"
+#include "ov-base-diag.cc"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ls-utils.h"
+
+template class octave_base_diag<ComplexDiagMatrix, ComplexMatrix>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_complex_diag_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_diag_matrix,
+                                     "complex diagonal matrix", "double");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_complex_diag_matrix&);
+
+  return new octave_complex_matrix (v.complex_matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_complex_diag_matrix::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_complex_matrix::static_type_id ());
+}
+
+static octave_base_value *
+default_numeric_demotion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_complex_diag_matrix&);
+
+  return new octave_float_complex_diag_matrix (v.float_complex_diag_matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_complex_diag_matrix::numeric_demotion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_demotion_function,
+                                            octave_float_complex_diag_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_complex_diag_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.nelem () == 1)
+    {
+      retval = new octave_complex (matrix (0, 0));
+      octave_base_value *rv2 = retval->try_narrowing_conversion ();
+      if (rv2)
+        {
+          delete retval;
+          retval = rv2;
+        }
+    }
+  else if (matrix.all_elements_are_real ())
+    {
+      return new octave_diag_matrix (::real (matrix));
+    }
+
+  return retval;
+}
+
+DiagMatrix
+octave_complex_diag_matrix::diag_matrix_value (bool force_conversion) const
+{
+  DiagMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               type_name (), "real matrix");
+
+  retval = ::real (matrix);
+
+  return retval;
+}
+
+FloatDiagMatrix
+octave_complex_diag_matrix::float_diag_matrix_value (bool force_conversion) const
+{
+  DiagMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               type_name (), "real matrix");
+
+  retval = ::real (matrix);
+
+  return retval;
+}
+
+ComplexDiagMatrix
+octave_complex_diag_matrix::complex_diag_matrix_value (bool) const
+{
+  return matrix;
+}
+
+FloatComplexDiagMatrix
+octave_complex_diag_matrix::float_complex_diag_matrix_value (bool) const
+{
+  return FloatComplexDiagMatrix (matrix);
+}
+
+octave_value
+octave_complex_diag_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_abs:
+      return matrix.abs ();
+    case umap_real:
+      return ::real (matrix);
+    case umap_conj:
+      return ::conj (matrix);
+    case umap_imag:
+      return ::imag (matrix);
+    case umap_sqrt:
+      {
+        ComplexColumnVector tmp = matrix.diag ().map<Complex> (std::sqrt);
+        ComplexDiagMatrix retval (tmp);
+        retval.resize (matrix.rows (), matrix.columns ());
+        return retval;
+      }
+    default:
+      return to_dense ().map (umap);
+    }
+}
+
+bool
+octave_complex_diag_matrix::save_binary (std::ostream& os, bool& save_as_floats)
+{
+
+  int32_t r = matrix.rows (), c = matrix.cols ();
+  os.write (reinterpret_cast<char *> (&r), 4);
+  os.write (reinterpret_cast<char *> (&c), 4);
+
+  ComplexMatrix m = ComplexMatrix (matrix.diag ());
+  save_type st = LS_DOUBLE;
+  if (save_as_floats)
+    {
+      if (m.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        st = LS_FLOAT;
+    }
+  else if (matrix.length () > 4096) // FIXME -- make this configurable.
+    {
+      double max_val, min_val;
+      if (m.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  const Complex *mtmp = m.data ();
+  write_doubles (os, reinterpret_cast<const double *> (mtmp), st, 2 * m.numel ());
+
+  return true;
+}
+
+bool
+octave_complex_diag_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format fmt)
+{
+  int32_t r, c;
+  char tmp;
+  if (! (is.read (reinterpret_cast<char *> (&r), 4)
+         && is.read (reinterpret_cast<char *> (&c), 4)
+         && is.read (reinterpret_cast<char *> (&tmp), 1)))
+    return false;
+  if (swap)
+    {
+      swap_bytes<4> (&r);
+      swap_bytes<4> (&c);
+    }
+
+  ComplexDiagMatrix m (r, c);
+  Complex *im = m.fortran_vec ();
+  octave_idx_type len = m.length ();
+  read_doubles (is, reinterpret_cast<double *> (im),
+                static_cast<save_type> (tmp), 2 * len, swap, fmt);
+  if (error_state || ! is)
+    return false;
+  matrix = m;
+
+  return true;
+}
+
+bool
+octave_complex_diag_matrix::chk_valid_scalar (const octave_value& val,
+                                              Complex& x) const
+{
+  bool retval = val.is_complex_scalar () || val.is_real_scalar ();
+  if (retval)
+    x = val.complex_value ();
+  return retval;
+}
+
+/*
+
+%% bug #36368
+%!assert (diag ([1+i, 1-i])^2 , diag ([2i, -2i]), 4*eps);
+
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cx-diag.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,95 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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_complex_diag_matrix_h)
+#define octave_complex_diag_matrix_h 1
+
+#include "ov-base.h"
+#include "ov-base-diag.h"
+#include "ov-cx-mat.h"
+#include "ov-typeinfo.h"
+
+// Real diagonal matrix values.
+
+class
+OCTINTERP_API
+octave_complex_diag_matrix
+  : public octave_base_diag<ComplexDiagMatrix, ComplexMatrix>
+{
+public:
+
+  octave_complex_diag_matrix (void)
+    : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> () { }
+
+  octave_complex_diag_matrix (const ComplexDiagMatrix& m)
+    : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> (m) { }
+
+  octave_complex_diag_matrix (const octave_complex_diag_matrix& m)
+    : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> (m) { }
+
+  ~octave_complex_diag_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_complex_diag_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_complex_diag_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  type_conv_info numeric_demotion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  builtin_type_t builtin_type (void) const { return btyp_complex; }
+
+  bool is_complex_matrix (void) const { return true; }
+
+  bool is_complex_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  DiagMatrix diag_matrix_value (bool = false) const;
+
+  FloatDiagMatrix float_diag_matrix_value (bool = false) const;
+
+  ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
+
+  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  bool chk_valid_scalar (const octave_value&,
+                         Complex&) const;
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cx-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,803 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <vector>
+
+#include "data-conv.h"
+#include "lo-ieee.h"
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+#include "mx-base.h"
+#include "mach-info.h"
+#include "oct-locbuf.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-mat.cc"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+#include "pr-output.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+#include "ls-utils.h"
+
+template class octave_base_matrix<ComplexNDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_complex_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_matrix,
+                                     "complex matrix", "double");
+
+static octave_base_value *
+default_numeric_demotion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_complex_matrix&);
+
+  return new octave_float_complex_matrix (v.float_complex_matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_complex_matrix::numeric_demotion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_demotion_function,
+                                            octave_float_complex_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_complex_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.numel () == 1)
+    {
+      Complex c = matrix (0);
+
+      if (std::imag (c) == 0.0)
+        retval = new octave_scalar (std::real (c));
+      else
+        retval = new octave_complex (c);
+    }
+  else if (matrix.all_elements_are_real ())
+    retval = new octave_matrix (::real (matrix));
+
+  return retval;
+}
+
+double
+octave_complex_matrix::double_value (bool force_conversion) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real scalar");
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "complex matrix", "real scalar");
+
+      retval = std::real (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("complex matrix", "real scalar");
+
+  return retval;
+}
+
+float
+octave_complex_matrix::float_value (bool force_conversion) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real scalar");
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "complex matrix", "real scalar");
+
+      retval = std::real (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("complex matrix", "real scalar");
+
+  return retval;
+}
+
+Matrix
+octave_complex_matrix::matrix_value (bool force_conversion) const
+{
+  Matrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real matrix");
+
+  retval = ::real (matrix.matrix_value ());
+
+  return retval;
+}
+
+FloatMatrix
+octave_complex_matrix::float_matrix_value (bool force_conversion) const
+{
+  FloatMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real matrix");
+
+  retval = ::real (matrix.matrix_value ());
+
+  return retval;
+}
+
+Complex
+octave_complex_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "complex matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("complex matrix", "complex scalar");
+
+  return retval;
+}
+
+FloatComplex
+octave_complex_matrix::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "complex matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("complex matrix", "complex scalar");
+
+  return retval;
+}
+
+ComplexMatrix
+octave_complex_matrix::complex_matrix_value (bool) const
+{
+  return matrix.matrix_value ();
+}
+
+FloatComplexMatrix
+octave_complex_matrix::float_complex_matrix_value (bool) const
+{
+  return FloatComplexMatrix (matrix.matrix_value ());
+}
+
+boolNDArray
+octave_complex_matrix::bool_array_value (bool warn) const
+{
+  if (matrix.any_element_is_nan ())
+    gripe_nan_to_logical_conversion ();
+  else if (warn && (! matrix.all_elements_are_real ()
+                    || real (matrix).any_element_not_one_or_zero ()))
+    gripe_logical_conversion ();
+
+  return mx_el_ne (matrix, Complex (0.0));
+}
+
+charNDArray
+octave_complex_matrix::char_array_value (bool frc_str_conv) const
+{
+  charNDArray retval;
+
+  if (! frc_str_conv)
+    gripe_implicit_conversion ("Octave:num-to-str",
+                               "complex matrix", "string");
+  else
+    {
+      retval = charNDArray (dims ());
+      octave_idx_type nel = numel ();
+
+      for (octave_idx_type i = 0; i < nel; i++)
+        retval.elem (i) = static_cast<char>(std::real (matrix.elem (i)));
+    }
+
+  return retval;
+}
+
+FloatComplexNDArray
+octave_complex_matrix::float_complex_array_value (bool) const
+{
+  return FloatComplexNDArray (matrix);
+}
+
+SparseMatrix
+octave_complex_matrix::sparse_matrix_value (bool force_conversion) const
+{
+  SparseMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real matrix");
+
+  retval = SparseMatrix (::real (matrix.matrix_value ()));
+
+  return retval;
+}
+
+SparseComplexMatrix
+octave_complex_matrix::sparse_complex_matrix_value (bool) const
+{
+  return SparseComplexMatrix (matrix.matrix_value ());
+}
+
+octave_value
+octave_complex_matrix::diag (octave_idx_type k) const
+{
+  octave_value retval;
+  if (k == 0 && matrix.ndims () == 2
+      && (matrix.rows () == 1 || matrix.columns () == 1))
+    retval = ComplexDiagMatrix (DiagArray2<Complex> (matrix));
+  else
+    retval = octave_base_matrix<ComplexNDArray>::diag (k);
+
+  return retval;
+}
+
+octave_value
+octave_complex_matrix::diag (octave_idx_type m, octave_idx_type n) const
+{
+  octave_value retval;
+
+  if (matrix.ndims () == 2
+      && (matrix.rows () == 1 || matrix.columns () == 1))
+    {
+      ComplexMatrix mat = matrix.matrix_value ();
+
+      retval = mat.diag (m, n);
+    }
+  else
+    error ("diag: expecting vector argument");
+
+  return retval;
+}
+
+bool
+octave_complex_matrix::save_ascii (std::ostream& os)
+{
+  dim_vector d = dims ();
+  if (d.length () > 2)
+    {
+      ComplexNDArray tmp = complex_array_value ();
+
+      os << "# ndims: " << d.length () << "\n";
+
+      for (int i = 0; i < d.length (); i++)
+        os << " " << d (i);
+
+      os << "\n" << tmp;
+    }
+  else
+    {
+      // Keep this case, rather than use generic code above for backward
+      // compatiability. Makes load_ascii much more complex!!
+      os << "# rows: " << rows () << "\n"
+         << "# columns: " << columns () << "\n";
+
+      os << complex_matrix_value ();
+    }
+
+  return true;
+}
+
+bool
+octave_complex_matrix::load_ascii (std::istream& is)
+{
+  bool success = true;
+
+  string_vector keywords(2);
+
+  keywords[0] = "ndims";
+  keywords[1] = "rows";
+
+  std::string kw;
+  octave_idx_type val = 0;
+
+  if (extract_keyword (is, keywords, kw, val, true))
+    {
+      if (kw == "ndims")
+        {
+          int mdims = static_cast<int> (val);
+
+          if (mdims >= 0)
+            {
+              dim_vector dv;
+              dv.resize (mdims);
+
+              for (int i = 0; i < mdims; i++)
+                is >> dv(i);
+
+              if (is)
+                {
+                  ComplexNDArray tmp(dv);
+
+                  is >> tmp;
+
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else
+                {
+                  error ("load: failed to read dimensions");
+                  success = false;
+                }
+            }
+          else
+            {
+              error ("load: failed to extract number of dimensions");
+              success = false;
+            }
+        }
+      else if (kw == "rows")
+        {
+          octave_idx_type nr = val;
+          octave_idx_type nc = 0;
+
+          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
+            {
+              if (nr > 0 && nc > 0)
+                {
+                  ComplexMatrix tmp (nr, nc);
+                  is >> tmp;
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else if (nr == 0 || nc == 0)
+                matrix = ComplexMatrix (nr, nc);
+              else
+                panic_impossible ();
+            }
+          else
+            {
+              error ("load: failed to extract number of rows and columns");
+              success = false;
+            }
+        }
+      else
+        panic_impossible ();
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_complex_matrix::save_binary (std::ostream& os, bool& save_as_floats)
+{
+  dim_vector d = dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims to differentiate with old format!!
+  int32_t tmp = - d.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  for (int i = 0; i < d.length (); i++)
+    {
+      tmp = d(i);
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+    }
+
+  ComplexNDArray m = complex_array_value ();
+  save_type st = LS_DOUBLE;
+  if (save_as_floats)
+    {
+      if (m.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        st = LS_FLOAT;
+    }
+  else if (d.numel () > 4096) // FIXME -- make this configurable.
+    {
+      double max_val, min_val;
+      if (m.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+
+  const Complex *mtmp = m.data ();
+  write_doubles (os, reinterpret_cast<const double *> (mtmp), st, 2 * d.numel ());
+
+  return true;
+}
+
+bool
+octave_complex_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format fmt)
+{
+  char tmp;
+  int32_t mdims;
+  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&mdims);
+  if (mdims < 0)
+    {
+      mdims = - mdims;
+      int32_t di;
+      dim_vector dv;
+      dv.resize (mdims);
+
+      for (int i = 0; i < mdims; i++)
+        {
+          if (! is.read (reinterpret_cast<char *> (&di), 4))
+            return false;
+          if (swap)
+            swap_bytes<4> (&di);
+          dv(i) = di;
+        }
+
+      // Convert an array with a single dimension to be a row vector.
+      // Octave should never write files like this, other software
+      // might.
+
+      if (mdims == 1)
+        {
+          mdims = 2;
+          dv.resize (mdims);
+          dv(1) = dv(0);
+          dv(0) = 1;
+        }
+
+      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+        return false;
+
+      ComplexNDArray m(dv);
+      Complex *im = m.fortran_vec ();
+      read_doubles (is, reinterpret_cast<double *> (im),
+                    static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  else
+    {
+      int32_t nr, nc;
+      nr = mdims;
+      if (! is.read (reinterpret_cast<char *> (&nc), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&nc);
+      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+        return false;
+      ComplexMatrix m (nr, nc);
+      Complex *im = m.fortran_vec ();
+      octave_idx_type len = nr * nc;
+      read_doubles (is, reinterpret_cast<double *> (im),
+                    static_cast<save_type> (tmp), 2*len, swap, fmt);
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_complex_matrix::save_hdf5 (hid_t loc_id, const char *name,
+                                  bool save_as_floats)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  int rank = dv.length ();
+  hid_t space_hid = -1, data_hid = -1, type_hid = -1;
+  bool retval = true;
+  ComplexNDArray m = complex_array_value ();
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  for (int i = 0; i < rank; i++)
+    hdims[i] = dv (rank-i-1);
+
+  space_hid = H5Screate_simple (rank, hdims, 0);
+  if (space_hid < 0) return false;
+
+  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
+
+  if (save_as_floats)
+    {
+      if (m.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        save_type_hid = H5T_NATIVE_FLOAT;
+    }
+#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
+  // hdf5 currently doesn't support float/integer conversions
+  else
+    {
+      double max_val, min_val;
+
+      if (m.all_integers (max_val, min_val))
+        save_type_hid
+          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+    }
+#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
+
+  type_hid = hdf5_make_complex_type (save_type_hid);
+  if (type_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      return false;
+    }
+
+  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
+  if (complex_type_hid < 0) retval = false;
+
+  if (retval)
+    {
+      Complex *mtmp = m.fortran_vec ();
+      if (H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                    mtmp) < 0)
+        {
+          H5Tclose (complex_type_hid);
+          retval = false;
+        }
+    }
+
+  H5Tclose (complex_type_hid);
+  H5Dclose (data_hid);
+  H5Tclose (type_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_complex_matrix::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+      return (empty > 0);
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t type_hid = H5Dget_type (data_hid);
+
+  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
+
+  if (! hdf5_types_compatible (type_hid, complex_type))
+    {
+      H5Tclose (complex_type);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank < 1)
+    {
+      H5Tclose (complex_type);
+      H5Sclose (space_id);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  if (rank == 1)
+    {
+      dv.resize (2);
+      dv(0) = 1;
+      dv(1) = hdims[0];
+    }
+  else
+    {
+      dv.resize (rank);
+      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
+        dv(j) = hdims[i];
+    }
+
+  ComplexNDArray m (dv);
+  Complex *reim = m.fortran_vec ();
+  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+               reim) >= 0)
+    {
+      retval = true;
+      matrix = m;
+    }
+
+  H5Tclose (complex_type);
+  H5Sclose (space_id);
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+void
+octave_complex_matrix::print_raw (std::ostream& os,
+                                  bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, matrix, pr_as_read_syntax,
+                         current_print_indent_level ());
+}
+
+mxArray *
+octave_complex_matrix::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxCOMPLEX);
+
+  double *pr = static_cast<double *> (retval->get_data ());
+  double *pi = static_cast<double *> (retval->get_imag_data ());
+
+  mwSize nel = numel ();
+
+  const Complex *p = matrix.data ();
+
+  for (mwIndex i = 0; i < nel; i++)
+    {
+      pr[i] = std::real (p[i]);
+      pi[i] = std::imag (p[i]);
+    }
+
+  return retval;
+}
+
+octave_value
+octave_complex_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    // Mappers handled specially.
+    case umap_real:
+      return ::real (matrix);
+    case umap_imag:
+      return ::imag (matrix);
+    case umap_conj:
+      return ::conj (matrix);
+
+#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.FCN ())
+
+      ARRAY_METHOD_MAPPER (abs, abs);
+      ARRAY_METHOD_MAPPER (isnan, isnan);
+      ARRAY_METHOD_MAPPER (isinf, isinf);
+      ARRAY_METHOD_MAPPER (finite, isfinite);
+
+#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.map<TYPE> (FCN))
+
+      ARRAY_MAPPER (acos, Complex, ::acos);
+      ARRAY_MAPPER (acosh, Complex, ::acosh);
+      ARRAY_MAPPER (angle, double, std::arg);
+      ARRAY_MAPPER (arg, double, std::arg);
+      ARRAY_MAPPER (asin, Complex, ::asin);
+      ARRAY_MAPPER (asinh, Complex, ::asinh);
+      ARRAY_MAPPER (atan, Complex, ::atan);
+      ARRAY_MAPPER (atanh, Complex, ::atanh);
+      ARRAY_MAPPER (ceil, Complex, ::ceil);
+      ARRAY_MAPPER (cos, Complex, std::cos);
+      ARRAY_MAPPER (cosh, Complex, std::cosh);
+      ARRAY_MAPPER (exp, Complex, std::exp);
+      ARRAY_MAPPER (expm1, Complex, ::expm1);
+      ARRAY_MAPPER (fix, Complex, ::fix);
+      ARRAY_MAPPER (floor, Complex, ::floor);
+      ARRAY_MAPPER (log, Complex, std::log);
+      ARRAY_MAPPER (log2, Complex, xlog2);
+      ARRAY_MAPPER (log10, Complex, std::log10);
+      ARRAY_MAPPER (log1p, Complex, ::log1p);
+      ARRAY_MAPPER (round, Complex, xround);
+      ARRAY_MAPPER (roundb, Complex, xroundb);
+      ARRAY_MAPPER (signum, Complex, ::signum);
+      ARRAY_MAPPER (sin, Complex, std::sin);
+      ARRAY_MAPPER (sinh, Complex, std::sinh);
+      ARRAY_MAPPER (sqrt, Complex, std::sqrt);
+      ARRAY_MAPPER (tan, Complex, std::tan);
+      ARRAY_MAPPER (tanh, Complex, std::tanh);
+      ARRAY_MAPPER (isna, bool, octave_is_NA);
+
+    default:
+      return octave_base_value::map (umap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cx-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,183 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_complex_matrix_h)
+#define octave_complex_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-typeinfo.h"
+
+#include "MatrixType.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Complex matrix values.
+
+class
+OCTINTERP_API
+octave_complex_matrix : public octave_base_matrix<ComplexNDArray>
+{
+public:
+
+  octave_complex_matrix (void)
+    : octave_base_matrix<ComplexNDArray> () { }
+
+  octave_complex_matrix (const ComplexNDArray& m)
+    : octave_base_matrix<ComplexNDArray> (m) { }
+
+  octave_complex_matrix (const ComplexMatrix& m)
+    : octave_base_matrix<ComplexNDArray> (m) { }
+
+  octave_complex_matrix (const ComplexMatrix& m, const MatrixType& t)
+    : octave_base_matrix<ComplexNDArray> (m, t) { }
+
+  octave_complex_matrix (const Array<Complex>& m)
+    : octave_base_matrix<ComplexNDArray> (ComplexNDArray (m)) { }
+
+  octave_complex_matrix (const ComplexDiagMatrix& d)
+    : octave_base_matrix<ComplexNDArray> (ComplexMatrix (d)) { }
+
+  octave_complex_matrix (const ComplexRowVector& v)
+    : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { }
+
+  octave_complex_matrix (const ComplexColumnVector& v)
+    : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { }
+
+  octave_complex_matrix (const octave_complex_matrix& cm)
+    : octave_base_matrix<ComplexNDArray> (cm) { }
+
+  ~octave_complex_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_complex_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_complex_matrix (); }
+
+  type_conv_info numeric_demotion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  builtin_type_t builtin_type (void) const { return btyp_complex; }
+
+  bool is_complex_matrix (void) const { return true; }
+
+  bool is_complex_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  float float_scalar_value (bool frc_str_conv = false) const
+    { return float_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  FloatMatrix float_matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const { return matrix; }
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool warn = false) const;
+
+  charNDArray char_array_value (bool frc_str_conv = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const;
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
+
+  octave_value diag (octave_idx_type k = 0) const;
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  void increment (void) { matrix += Complex (1.0); }
+
+  void decrement (void) { matrix -= Complex (1.0); }
+
+  void changesign (void) { matrix.changesign (); }
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      // Yes, for compatibility, we drop the imaginary part here.
+      return os.write (matrix_value (true), block_size, output_type,
+                       skip, flt_fmt);
+    }
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cx-sparse.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,934 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+#include <vector>
+
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+#include "oct-locbuf.h"
+
+#include "ov-base.h"
+#include "ov-scalar.h"
+#include "ov-complex.h"
+#include "gripes.h"
+
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+
+#include "ov-base-sparse.h"
+#include "ov-base-sparse.cc"
+
+#include "ov-bool-sparse.h"
+
+template class OCTINTERP_API octave_base_sparse<SparseComplexMatrix>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_sparse_complex_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_complex_matrix, "sparse complex matrix", "double");
+
+octave_base_value *
+octave_sparse_complex_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (Vsparse_auto_mutate)
+    {
+      int nr = matrix.rows ();
+      int nc = matrix.cols ();
+
+      // Don't use numel, since it can overflow for very large matrices
+      // Note that for the tests on matrix size, they become approximative
+      // since they involves a cast to double to avoid issues of overflow
+      if (matrix.rows () == 1 && matrix.cols () == 1)
+        {
+          // Const copy of the matrix, so the right version of () operator used
+          const SparseComplexMatrix tmp (matrix);
+
+          Complex c = tmp (0, 0);
+
+          if (std::imag (c) == 0.0)
+            retval = new octave_scalar (std::real (c));
+          else
+            retval = new octave_complex (c);
+        }
+      else if (nr == 0 || nc == 0)
+        retval = new octave_matrix (Matrix (nr, nc));
+      else if (matrix.all_elements_are_real ())
+        if (matrix.cols () > 0 && matrix.rows () > 0
+            && (double (matrix.byte_size ()) > double (matrix.rows ())
+                * double (matrix.cols ()) * sizeof (double)))
+          retval = new octave_matrix (::real (matrix.matrix_value ()));
+        else
+          retval = new octave_sparse_matrix (::real (matrix));
+      else if (matrix.cols () > 0 && matrix.rows () > 0
+               && (double (matrix.byte_size ()) > double (matrix.rows ())
+                   * double (matrix.cols ()) * sizeof (Complex)))
+        retval = new octave_complex_matrix (matrix.matrix_value ());
+    }
+  else
+    {
+      if (matrix.all_elements_are_real ())
+        retval = new octave_sparse_matrix (::real (matrix));
+    }
+
+  return retval;
+}
+
+double
+octave_sparse_complex_matrix::double_value (bool force_conversion) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex sparse matrix", "real scalar");
+
+  // FIXME -- maybe this should be a function, valid_as_scalar()
+  if (numel () > 0)
+    {
+      if (numel () > 1)
+        gripe_implicit_conversion ("Octave:array-to-scalar",
+                                   "complex sparse matrix", "real scalar");
+
+      retval = std::real (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("complex sparse matrix", "real scalar");
+
+  return retval;
+}
+
+Matrix
+octave_sparse_complex_matrix::matrix_value (bool force_conversion) const
+{
+  Matrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex sparse matrix", "real matrix");
+
+  retval = ::real (matrix.matrix_value ());
+
+  return retval;
+}
+
+Complex
+octave_sparse_complex_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  // FIXME -- maybe this should be a function, valid_as_scalar()
+  if (numel () > 0)
+    {
+      if (numel () > 1)
+        gripe_implicit_conversion ("Octave:array-to-scalar",
+                                   "complex sparse matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("complex sparse matrix", "real scalar");
+
+  return retval;
+}
+
+ComplexMatrix
+octave_sparse_complex_matrix::complex_matrix_value (bool) const
+{
+  return matrix.matrix_value ();
+}
+
+ComplexNDArray
+octave_sparse_complex_matrix::complex_array_value (bool) const
+{
+  return ComplexNDArray (matrix.matrix_value ());
+}
+
+charNDArray
+octave_sparse_complex_matrix::char_array_value (bool frc_str_conv) const
+{
+  charNDArray retval;
+
+  if (! frc_str_conv)
+    gripe_implicit_conversion ("Octave:num-to-str",
+                               "sparse complex matrix", "string");
+  else
+    {
+      retval = charNDArray (dims (), 0);
+      octave_idx_type nc = matrix.cols ();
+      octave_idx_type nr = matrix.rows ();
+
+      for (octave_idx_type j = 0; j < nc; j++)
+        for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
+          retval(matrix.ridx (i) + nr * j) =
+            static_cast<char>(std::real (matrix.data (i)));
+    }
+
+  return retval;
+}
+
+SparseMatrix
+octave_sparse_complex_matrix::sparse_matrix_value (bool force_conversion) const
+{
+  SparseMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex sparse matrix",
+                               "real sparse matrix");
+
+  retval = ::real (matrix);
+
+  return retval;
+}
+
+SparseBoolMatrix
+octave_sparse_complex_matrix::sparse_bool_matrix_value (bool warn) const
+{
+  if (matrix.any_element_is_nan ())
+    gripe_nan_to_logical_conversion ();
+  else if (warn && (! matrix.all_elements_are_real ()
+                    || real (matrix).any_element_not_one_or_zero ()))
+    gripe_logical_conversion ();
+
+  return mx_el_ne (matrix, Complex (0.0));
+}
+
+bool
+octave_sparse_complex_matrix::save_binary (std::ostream& os,
+                                           bool&save_as_floats)
+{
+  dim_vector d = this->dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Ensure that additional memory is deallocated
+  matrix.maybe_compress ();
+
+  int nr = d(0);
+  int nc = d(1);
+  int nz = nnz ();
+
+  int32_t itmp;
+  // Use negative value for ndims to be consistent with other formats
+  itmp= -2;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nr;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nc;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nz;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  save_type st = LS_DOUBLE;
+  if (save_as_floats)
+    {
+      if (matrix.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        st = LS_FLOAT;
+    }
+  else if (matrix.nnz () > 8192) // FIXME -- make this configurable.
+    {
+      double max_val, min_val;
+      if (matrix.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  // add one to the printed indices to go from
+  // zero-based to one-based arrays
+   for (int i = 0; i < nc+1; i++)
+     {
+       octave_quit ();
+       itmp = matrix.cidx (i);
+       os.write (reinterpret_cast<char *> (&itmp), 4);
+     }
+
+   for (int i = 0; i < nz; i++)
+     {
+       octave_quit ();
+       itmp = matrix.ridx (i);
+       os.write (reinterpret_cast<char *> (&itmp), 4);
+     }
+
+   write_doubles (os, reinterpret_cast<const double *> (matrix.data ()), st, 2 * nz);
+
+  return true;
+}
+
+bool
+octave_sparse_complex_matrix::load_binary (std::istream& is, bool swap,
+                                   oct_mach_info::float_format fmt)
+{
+  int32_t nz, nc, nr, tmp;
+  char ctmp;
+
+  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+    return false;
+
+  if (swap)
+    swap_bytes<4> (&tmp);
+
+  if (tmp != -2) {
+    error ("load: only 2D sparse matrices are supported");
+    return false;
+  }
+
+  if (! is.read (reinterpret_cast<char *> (&nr), 4))
+    return false;
+  if (! is.read (reinterpret_cast<char *> (&nc), 4))
+    return false;
+  if (! is.read (reinterpret_cast<char *> (&nz), 4))
+    return false;
+
+  if (swap)
+    {
+      swap_bytes<4> (&nr);
+      swap_bytes<4> (&nc);
+      swap_bytes<4> (&nz);
+    }
+
+  SparseComplexMatrix m (static_cast<octave_idx_type> (nr),
+                         static_cast<octave_idx_type> (nc),
+                         static_cast<octave_idx_type> (nz));
+
+  for (int i = 0; i < nc+1; i++)
+    {
+      octave_quit ();
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+      m.cidx (i) = tmp;
+    }
+
+  for (int i = 0; i < nz; i++)
+    {
+      octave_quit ();
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+      m.ridx (i) = tmp;
+    }
+
+  if (! is.read (reinterpret_cast<char *> (&ctmp), 1))
+    return false;
+
+  read_doubles (is, reinterpret_cast<double *> (m.data ()),
+                static_cast<save_type> (ctmp), 2 * nz, swap, fmt);
+
+  if (error_state || ! is)
+    return false;
+
+  if (! m.indices_ok ())
+    return false;
+
+  matrix = m;
+
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_sparse_complex_matrix::save_hdf5 (hid_t loc_id, const char *name,
+                                         bool save_as_floats)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  // Ensure that additional memory is deallocated
+  matrix.maybe_compress ();
+
+#if HAVE_HDF5_18
+  hid_t group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  hid_t group_hid = H5Gcreate (loc_id, name, 0);
+#endif
+  if (group_hid < 0)
+    return false;
+
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+  SparseComplexMatrix m = sparse_complex_matrix_value ();
+  octave_idx_type tmp;
+  hsize_t hdims[2];
+
+  space_hid = H5Screate_simple (0, hdims, 0);
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.rows ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.cols ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.nnz ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+
+  hdims[0] = m.cols () + 1;
+  hdims[1] = 1;
+
+  space_hid = H5Screate_simple (2, hdims, 0);
+
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  octave_idx_type * itmp = m.xcidx ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, itmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+
+  hdims[0] = m.nnz ();
+  hdims[1] = 1;
+
+  space_hid = H5Screate_simple (2, hdims, 0);
+
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  itmp = m.xridx ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
+
+  if (save_as_floats)
+    {
+      if (m.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        save_type_hid = H5T_NATIVE_FLOAT;
+    }
+#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
+  // hdf5 currently doesn't support float/integer conversions
+  else
+    {
+      double max_val, min_val;
+
+      if (m.all_integers (max_val, min_val))
+        save_type_hid
+          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+    }
+#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
+
+  hid_t type_hid = hdf5_make_complex_type (save_type_hid);
+  if (type_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
+  retval = false;
+  if (complex_type_hid >= 0)
+    {
+      Complex * ctmp = m.xdata ();
+
+      retval = H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL,
+                         H5P_DEFAULT, ctmp) >= 0;
+    }
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+  H5Tclose (type_hid);
+  H5Gclose (group_hid);
+
+  return retval;
+}
+
+bool
+octave_sparse_complex_matrix::load_hdf5 (hid_t loc_id, const char *name)
+{
+  octave_idx_type nr, nc, nz;
+  hid_t group_hid, data_hid, space_hid;
+  hsize_t rank;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+    return (empty > 0);
+
+#if HAVE_HDF5_18
+  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  group_hid = H5Gopen (loc_id, name);
+#endif
+  if (group_hid < 0 ) return false;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nr", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nr");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nr) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nc", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nc");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nc) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nz", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nz");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nz) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+  SparseComplexMatrix m (static_cast<octave_idx_type> (nr),
+                         static_cast<octave_idx_type> (nc),
+                         static_cast<octave_idx_type> (nz));
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "cidx", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "cidx");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nc + 1
+      || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  octave_idx_type *itmp = m.xcidx ();
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "ridx", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "ridx");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nz
+      || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  itmp = m.xridx ();
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "data", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "data");
+#endif
+  hid_t type_hid = H5Dget_type (data_hid);
+
+  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
+
+  if (! hdf5_types_compatible (type_hid, complex_type))
+    {
+      H5Tclose (complex_type);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nz
+      || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  Complex *ctmp = m.xdata ();
+  bool retval = false;
+  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, ctmp) >= 0
+      && m.indices_ok ())
+    {
+      retval = true;
+      matrix = m;
+    }
+
+  H5Tclose (complex_type);
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+  H5Gclose (group_hid);
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_sparse_complex_matrix::as_mxArray (void) const
+{
+  mwSize nz = nzmax ();
+  mxArray *retval = new mxArray (mxDOUBLE_CLASS, rows (), columns (),
+                                 nz, mxCOMPLEX);
+  double *pr = static_cast<double *> (retval->get_data ());
+  double *pi = static_cast<double *> (retval->get_imag_data ());
+  mwIndex *ir = retval->get_ir ();
+  mwIndex *jc = retval->get_jc ();
+
+  for (mwIndex i = 0; i < nz; i++)
+    {
+      Complex val = matrix.data (i);
+      pr[i] = std::real (val);
+      pi[i] = std::imag (val);
+      ir[i] = matrix.ridx (i);
+    }
+
+  for (mwIndex i = 0; i < columns () + 1; i++)
+    jc[i] = matrix.cidx (i);
+
+  return retval;
+}
+
+octave_value
+octave_sparse_complex_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    // Mappers handled specially.
+    case umap_real:
+      return ::real (matrix);
+    case umap_imag:
+      return ::imag (matrix);
+
+#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.FCN ())
+
+      ARRAY_METHOD_MAPPER (abs, abs);
+
+#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.map<TYPE> (FCN))
+
+      ARRAY_MAPPER (acos, Complex, ::acos);
+      ARRAY_MAPPER (acosh, Complex, ::acosh);
+      ARRAY_MAPPER (angle, double, std::arg);
+      ARRAY_MAPPER (arg, double, std::arg);
+      ARRAY_MAPPER (asin, Complex, ::asin);
+      ARRAY_MAPPER (asinh, Complex, ::asinh);
+      ARRAY_MAPPER (atan, Complex, ::atan);
+      ARRAY_MAPPER (atanh, Complex, ::atanh);
+      ARRAY_MAPPER (ceil, Complex, ::ceil);
+      ARRAY_MAPPER (conj, Complex, std::conj<double>);
+      ARRAY_MAPPER (cos, Complex, std::cos);
+      ARRAY_MAPPER (cosh, Complex, std::cosh);
+      ARRAY_MAPPER (exp, Complex, std::exp);
+      ARRAY_MAPPER (expm1, Complex, ::expm1);
+      ARRAY_MAPPER (fix, Complex, ::fix);
+      ARRAY_MAPPER (floor, Complex, ::floor);
+      ARRAY_MAPPER (log, Complex, std::log);
+      ARRAY_MAPPER (log2, Complex, xlog2);
+      ARRAY_MAPPER (log10, Complex, std::log10);
+      ARRAY_MAPPER (log1p, Complex, ::log1p);
+      ARRAY_MAPPER (round, Complex, xround);
+      ARRAY_MAPPER (roundb, Complex, xroundb);
+      ARRAY_MAPPER (signum, Complex, ::signum);
+      ARRAY_MAPPER (sin, Complex, std::sin);
+      ARRAY_MAPPER (sinh, Complex, std::sinh);
+      ARRAY_MAPPER (sqrt, Complex, std::sqrt);
+      ARRAY_MAPPER (tan, Complex, std::tan);
+      ARRAY_MAPPER (tanh, Complex, std::tanh);
+      ARRAY_MAPPER (isnan, bool, xisnan);
+      ARRAY_MAPPER (isna, bool, octave_is_NA);
+      ARRAY_MAPPER (isinf, bool, xisinf);
+      ARRAY_MAPPER (finite, bool, xfinite);
+
+    default: // Attempt to go via dense matrix.
+      return octave_base_sparse<SparseComplexMatrix>::map (umap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-cx-sparse.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,160 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+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_sparse_complex_matrix_h)
+#define octave_sparse_complex_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+#include "CSparse.h"
+#include "ov-base-sparse.h"
+#include "ov-re-sparse.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+class
+OCTINTERP_API
+octave_sparse_complex_matrix : public octave_base_sparse<SparseComplexMatrix>
+{
+public:
+
+  octave_sparse_complex_matrix (void)
+    : octave_base_sparse<SparseComplexMatrix> () { }
+
+  octave_sparse_complex_matrix (const ComplexNDArray& m)
+    : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
+
+  octave_sparse_complex_matrix (const ComplexMatrix& m)
+    : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
+
+  octave_sparse_complex_matrix (const SparseComplexMatrix& m)
+    : octave_base_sparse<SparseComplexMatrix> (m) { }
+
+  octave_sparse_complex_matrix (const SparseComplexMatrix& m,
+                                const MatrixType &t)
+    : octave_base_sparse<SparseComplexMatrix> (m, t) { }
+
+  octave_sparse_complex_matrix (const MSparse<Complex>& m)
+    : octave_base_sparse<SparseComplexMatrix> (m) { }
+
+  octave_sparse_complex_matrix (const MSparse<Complex>& m,
+                                const MatrixType &t)
+    : octave_base_sparse<SparseComplexMatrix> (m, t) { }
+
+  octave_sparse_complex_matrix (const Sparse<Complex>& m,
+                                const MatrixType &t)
+    : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m), t) { }
+
+  octave_sparse_complex_matrix (const Sparse<Complex>& m)
+    : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
+
+  octave_sparse_complex_matrix (const octave_sparse_complex_matrix& cm)
+    : octave_base_sparse<SparseComplexMatrix> (cm) { }
+
+  ~octave_sparse_complex_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_sparse_complex_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_sparse_complex_matrix (); }
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  builtin_type_t builtin_type (void) const { return btyp_complex; }
+
+  bool is_complex_matrix (void) const { return true; }
+
+  bool is_complex_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  double double_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  charNDArray char_array_value (bool frc_str_conv = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const;
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+    { return matrix; }
+
+  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
+
+#if 0
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      // Yes, for compatibility, we drop the imaginary part here.
+      return os.write (matrix_value (true), block_size, output_type,
+                       skip, flt_fmt);
+    }
+#endif
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-dld-fcn.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,90 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "oct-shlib.h"
+
+#include <defaults.h>
+#include "dynamic-ld.h"
+#include "error.h"
+#include "oct-obj.h"
+#include "ov-dld-fcn.h"
+#include "ov.h"
+
+DEFINE_OCTAVE_ALLOCATOR (octave_dld_function);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_dld_function,
+                                     "dynamically-linked function",
+                                     "dynamically-linked function");
+
+
+octave_dld_function::octave_dld_function
+  (octave_builtin::fcn ff, const octave_shlib& shl,
+   const std::string& nm, const std::string& ds)
+  : octave_builtin (ff, nm, ds), sh_lib (shl)
+{
+  mark_fcn_file_up_to_date (time_parsed ());
+
+  std::string file_name = fcn_file_name ();
+
+  system_fcn_file
+    = (! file_name.empty ()
+       && Voct_file_dir == file_name.substr (0, Voct_file_dir.length ()));
+}
+
+octave_dld_function::~octave_dld_function (void)
+{
+  octave_dynamic_loader::remove_oct (my_name, sh_lib);
+}
+
+std::string
+octave_dld_function::fcn_file_name (void) const
+{
+  return sh_lib.file_name ();
+}
+
+octave_time
+octave_dld_function::time_parsed (void) const
+{
+  return sh_lib.time_loaded ();
+}
+
+// Note: this wrapper around the octave_dld_function constructor is
+//       necessary to work around a MSVC limitation handling in
+//       virtual destructors that prevents unloading a dynamic module
+//       before *all* objects (of class using a virtual dtor) have
+//       been fully deleted; indeed, MSVC attaches auto-generated code
+//       (scalar deleting destructor) to objects created in a dynamic
+//       module, and this code will be executed in the dynamic module
+//       context at object deletion; unloading the dynamic module
+//       before objects have been deleted will make the "delete" code
+//       of objects to point to an invalid code segment.
+
+octave_dld_function*
+octave_dld_function::create (octave_builtin::fcn ff, const octave_shlib& shl,
+                             const std::string& nm, const std::string& ds)
+{
+  return new octave_dld_function (ff, shl, nm, ds);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-dld-fcn.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,103 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_dld_function_h)
+#define octave_dld_function_h 1
+
+#include <string>
+
+#include "oct-shlib.h"
+
+#include "ov-fcn.h"
+#include "ov-builtin.h"
+#include "ov-typeinfo.h"
+
+class octave_shlib;
+
+class octave_value;
+class octave_value_list;
+
+// Dynamically-linked functions.
+
+class
+OCTINTERP_API
+octave_dld_function : public octave_builtin
+{
+public:
+
+  octave_dld_function (void)
+    : sh_lib (), t_checked (), system_fcn_file ()
+  { }
+
+  octave_dld_function (octave_builtin::fcn ff, const octave_shlib& shl,
+                       const std::string& nm = std::string (),
+                       const std::string& ds = std::string ());
+
+  ~octave_dld_function (void);
+
+  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
+
+  std::string fcn_file_name (void) const;
+
+  octave_time time_parsed (void) const;
+
+  octave_time time_checked (void) const { return t_checked; }
+
+  bool is_system_fcn_file (void) const { return system_fcn_file; }
+
+  bool is_builtin_function (void) const { return false; }
+
+  bool is_dld_function (void) const { return true; }
+
+  static octave_dld_function* create (octave_builtin::fcn ff,
+      const octave_shlib& shl,
+      const std::string& nm = std::string (),
+      const std::string& ds = std::string ());
+
+  octave_shlib get_shlib (void) const
+    { return sh_lib; }
+
+private:
+
+  octave_shlib sh_lib;
+
+  // The time the file was last checked to see if it needs to be
+  // parsed again.
+  mutable octave_time t_checked;
+
+  // True if this function came from a file that is considered to be a
+  // system function.  This affects whether we check the time stamp
+  // on the file to see if it has changed.
+  bool system_fcn_file;
+
+  // No copying!
+
+  octave_dld_function (const octave_dld_function& fn);
+
+  octave_dld_function& operator = (const octave_dld_function& fn);
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-fcn-handle.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,2000 @@
+/*
+
+Copyright (C) 2003-2012 John W. Eaton
+Copyright (C) 2009 VZLU Prague, a.s.
+Copyright (C) 2010 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <sstream>
+#include <vector>
+
+#include "file-ops.h"
+#include "oct-locbuf.h"
+
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "input.h"
+#include "oct-map.h"
+#include "ov-base.h"
+#include "ov-fcn-handle.h"
+#include "ov-usr-fcn.h"
+#include "pr-output.h"
+#include "pt-pr-code.h"
+#include "pt-misc.h"
+#include "pt-stmt.h"
+#include "pt-cmd.h"
+#include "pt-exp.h"
+#include "pt-assign.h"
+#include "pt-arg-list.h"
+#include "variables.h"
+#include "parse.h"
+#include "unwind-prot.h"
+#include "defaults.h"
+#include "file-stat.h"
+#include "load-path.h"
+#include "oct-env.h"
+
+#include "byte-swap.h"
+#include "ls-ascii-helper.h"
+#include "ls-hdf5.h"
+#include "ls-oct-ascii.h"
+#include "ls-oct-binary.h"
+#include "ls-utils.h"
+
+DEFINE_OCTAVE_ALLOCATOR (octave_fcn_handle);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_fcn_handle,
+                                     "function handle",
+                                     "function_handle");
+
+const std::string octave_fcn_handle::anonymous ("@<anonymous>");
+
+octave_fcn_handle::octave_fcn_handle (const octave_value& f,
+                                      const std::string& n)
+  : fcn (f), nm (n), has_overloads (false)
+{
+  octave_user_function *uf = fcn.user_function_value (true);
+
+  if (uf && nm != anonymous)
+    symbol_table::cache_name (uf->scope (), nm);
+
+  if (uf && uf->is_nested_function ())
+    ::error ("handles to nested functions are not yet supported");
+}
+
+octave_value_list
+octave_fcn_handle::subsref (const std::string& type,
+                            const std::list<octave_value_list>& idx,
+                            int nargout)
+{
+  return octave_fcn_handle::subsref (type, idx, nargout, 0);
+}
+
+octave_value_list
+octave_fcn_handle::subsref (const std::string& type,
+                            const std::list<octave_value_list>& idx,
+                            int nargout, const std::list<octave_lvalue>* lvalue_list)
+{
+  octave_value_list retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
+
+        retval = do_multi_index_op (tmp_nargout, idx.front (),
+                                    idx.size () == 1 ? lvalue_list : 0);
+      }
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string tnm = type_name ();
+        error ("%s cannot be indexed with %c", tnm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // FIXME -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_builtin::subsref.
+
+  if (idx.size () > 1)
+    retval = retval(0).next_subsref (nargout, type, idx);
+
+  return retval;
+}
+
+octave_value_list
+octave_fcn_handle::do_multi_index_op (int nargout,
+                                      const octave_value_list& args)
+{
+  return do_multi_index_op (nargout, args, 0);
+}
+
+octave_value_list
+octave_fcn_handle::do_multi_index_op (int nargout,
+                                      const octave_value_list& args,
+                                      const std::list<octave_lvalue>* lvalue_list)
+{
+  octave_value_list retval;
+
+  out_of_date_check (fcn, std::string (), false);
+
+  if (has_overloads)
+    {
+      // Possibly overloaded function.
+      octave_value ov_fcn;
+
+      // Compute dispatch type.
+      builtin_type_t btyp;
+      std::string dispatch_type = get_dispatch_type (args, btyp);
+
+      // Retrieve overload.
+      if (btyp != btyp_unknown)
+        {
+          out_of_date_check (builtin_overloads[btyp], dispatch_type, false);
+          ov_fcn = builtin_overloads[btyp];
+        }
+      else
+        {
+          str_ov_map::iterator it = overloads.find (dispatch_type);
+
+          if (it == overloads.end ())
+            {
+              // Try parent classes too.
+
+              std::list<std::string> plist
+                = symbol_table::parent_classes (dispatch_type);
+
+              std::list<std::string>::const_iterator pit = plist.begin ();
+
+              while (pit != plist.end ())
+                {
+                  std::string pname = *pit;
+
+                  std::string fnm = fcn_name ();
+
+                  octave_value ftmp = symbol_table::find_method (fnm, pname);
+
+                  if (ftmp.is_defined ())
+                    {
+                      set_overload (pname, ftmp);
+
+                      out_of_date_check (ftmp, pname, false);
+                      ov_fcn = ftmp;
+
+                      break;
+                    }
+
+                  pit++;
+                }
+            }
+          else
+            {
+              out_of_date_check (it->second, dispatch_type, false);
+              ov_fcn = it->second;
+            }
+        }
+
+      if (ov_fcn.is_defined ())
+        retval = ov_fcn.do_multi_index_op (nargout, args, lvalue_list);
+      else if (fcn.is_defined ())
+        retval = fcn.do_multi_index_op (nargout, args, lvalue_list);
+      else
+        error ("%s: no method for class %s", nm.c_str (), dispatch_type.c_str ());
+    }
+  else
+    {
+      // Non-overloaded function (anonymous, subfunction, private function).
+      if (fcn.is_defined ())
+        retval = fcn.do_multi_index_op (nargout, args, lvalue_list);
+      else
+        error ("%s: no longer valid function handle", nm.c_str ());
+    }
+
+  return retval;
+}
+
+bool
+octave_fcn_handle::is_equal_to (const octave_fcn_handle& h) const
+{
+  bool retval = fcn.is_copy_of (h.fcn) && (has_overloads == h.has_overloads);
+  retval = retval && (overloads.size () == h.overloads.size ());
+
+  if (retval && has_overloads)
+    {
+      for (int i = 0; i < btyp_num_types && retval; i++)
+        retval = builtin_overloads[i].is_copy_of (h.builtin_overloads[i]);
+
+      str_ov_map::const_iterator iter = overloads.begin (), hiter = h.overloads.begin ();
+      for (; iter != overloads.end () && retval; iter++, hiter++)
+        retval = (iter->first == hiter->first) && (iter->second.is_copy_of (hiter->second));
+    }
+
+  return retval;
+}
+
+bool
+octave_fcn_handle::set_fcn (const std::string &octaveroot,
+                            const std::string& fpath)
+{
+  bool success = true;
+
+  if (octaveroot.length () != 0
+      && fpath.length () >= octaveroot.length ()
+      && fpath.substr (0, octaveroot.length ()) == octaveroot
+      && OCTAVE_EXEC_PREFIX != octaveroot)
+    {
+      // First check if just replacing matlabroot is enough
+      std::string str = OCTAVE_EXEC_PREFIX +
+        fpath.substr (octaveroot.length ());
+      file_stat fs (str);
+
+      if (fs.exists ())
+        {
+          size_t xpos = str.find_last_of (file_ops::dir_sep_chars ());
+
+          std::string dir_name = str.substr (0, xpos);
+
+          octave_function *xfcn
+            = load_fcn_from_file (str, dir_name, "", nm);
+
+          if (xfcn)
+            {
+              octave_value tmp (xfcn);
+
+              fcn = octave_value (new octave_fcn_handle (tmp, nm));
+            }
+          else
+            {
+              error ("function handle points to non-existent function");
+              success = false;
+            }
+        }
+      else
+        {
+          // Next just search for it anywhere in the system path
+          string_vector names(3);
+          names(0) = nm + ".oct";
+          names(1) = nm + ".mex";
+          names(2) = nm + ".m";
+
+          dir_path p (load_path::system_path ());
+
+          str = octave_env::make_absolute (p.find_first_of (names));
+
+          size_t xpos = str.find_last_of (file_ops::dir_sep_chars ());
+
+          std::string dir_name = str.substr (0, xpos);
+
+          octave_function *xfcn = load_fcn_from_file (str, dir_name, "", nm);
+
+          if (xfcn)
+            {
+              octave_value tmp (xfcn);
+
+              fcn = octave_value (new octave_fcn_handle (tmp, nm));
+            }
+          else
+            {
+              error ("function handle points to non-existent function");
+              success = false;
+            }
+        }
+    }
+  else
+    {
+      if (fpath.length () > 0)
+        {
+          size_t xpos = fpath.find_last_of (file_ops::dir_sep_chars ());
+
+          std::string dir_name = fpath.substr (0, xpos);
+
+          octave_function *xfcn = load_fcn_from_file (fpath, dir_name, "", nm);
+
+          if (xfcn)
+            {
+              octave_value tmp (xfcn);
+
+              fcn = octave_value (new octave_fcn_handle (tmp, nm));
+            }
+          else
+            {
+              error ("function handle points to non-existent function");
+              success = false;
+            }
+        }
+      else
+        {
+          fcn = symbol_table::find_function (nm);
+
+          if (! fcn.is_function ())
+            {
+              error ("function handle points to non-existent function");
+              success = false;
+            }
+        }
+    }
+
+  return success;
+}
+
+bool
+octave_fcn_handle::save_ascii (std::ostream& os)
+{
+  if (nm == anonymous)
+    {
+      os << nm << "\n";
+
+      print_raw (os, true);
+      os << "\n";
+
+      if (fcn.is_undefined ())
+        return false;
+
+      octave_user_function *f = fcn.user_function_value ();
+
+      std::list<symbol_table::symbol_record> vars
+        = symbol_table::all_variables (f->scope (), 0);
+
+      size_t varlen = vars.size ();
+
+      if (varlen > 0)
+        {
+          os << "# length: " << varlen << "\n";
+
+          for (std::list<symbol_table::symbol_record>::const_iterator p = vars.begin ();
+               p != vars.end (); p++)
+            {
+              if (! save_ascii_data (os, p->varval (), p->name (), false, 0))
+                return os;
+            }
+        }
+    }
+  else
+    {
+      octave_function *f = function_value ();
+      std::string fnm = f ? f->fcn_file_name () : std::string ();
+
+      os << "# octaveroot: " << OCTAVE_EXEC_PREFIX << "\n";
+      if (! fnm.empty ())
+        os << "# path: " << fnm << "\n";
+      os << nm << "\n";
+    }
+
+  return true;
+}
+
+bool
+octave_fcn_handle::load_ascii (std::istream& is)
+{
+  bool success = true;
+
+  std::streampos pos = is.tellg ();
+  std::string octaveroot = extract_keyword (is, "octaveroot", true);
+  if (octaveroot.length () == 0)
+    {
+      is.seekg (pos);
+      is.clear ();
+    }
+  pos = is.tellg ();
+  std::string fpath = extract_keyword (is, "path", true);
+  if (fpath.length () == 0)
+    {
+      is.seekg (pos);
+      is.clear ();
+    }
+
+  is >> nm;
+
+  if (nm == anonymous)
+    {
+      skip_preceeding_newline (is);
+
+      std::string buf;
+
+      if (is)
+        {
+
+          // Get a line of text whitespace characters included, leaving
+          // newline in the stream.
+          buf = read_until_newline (is, true);
+
+        }
+
+      pos = is.tellg ();
+
+      unwind_protect_safe frame;
+
+      // Set up temporary scope to use for evaluating the text that
+      // defines the anonymous function.
+
+      symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
+      frame.add_fcn (symbol_table::erase_scope, local_scope);
+
+      symbol_table::set_scope (local_scope);
+
+      octave_call_stack::push (local_scope, 0);
+      frame.add_fcn (octave_call_stack::pop);
+
+      octave_idx_type len = 0;
+
+      if (extract_keyword (is, "length", len, true) && len >= 0)
+        {
+          if (len > 0)
+            {
+              for (octave_idx_type i = 0; i < len; i++)
+                {
+                  octave_value t2;
+                  bool dummy;
+
+                  std::string name
+                    = read_ascii_data (is, std::string (), dummy, t2, i);
+
+                  if (!is)
+                    {
+                      error ("load: failed to load anonymous function handle");
+                      break;
+                    }
+
+                  symbol_table::varref (name, local_scope, 0) = t2;
+                }
+            }
+        }
+      else
+        {
+          is.seekg (pos);
+          is.clear ();
+        }
+
+      if (is && success)
+        {
+          int parse_status;
+          octave_value anon_fcn_handle =
+            eval_string (buf, true, parse_status);
+
+          if (parse_status == 0)
+            {
+              octave_fcn_handle *fh =
+                anon_fcn_handle.fcn_handle_value ();
+
+              if (fh)
+                {
+                  fcn = fh->fcn;
+
+                  octave_user_function *uf = fcn.user_function_value (true);
+
+                  if (uf)
+                    symbol_table::cache_name (uf->scope (), nm);
+                }
+              else
+                success = false;
+            }
+          else
+            success = false;
+        }
+      else
+        success = false;
+    }
+  else
+    success = set_fcn (octaveroot, fpath);
+
+  return success;
+}
+
+bool
+octave_fcn_handle::save_binary (std::ostream& os, bool& save_as_floats)
+{
+  if (nm == anonymous)
+    {
+      std::ostringstream nmbuf;
+
+      if (fcn.is_undefined ())
+        return false;
+
+      octave_user_function *f = fcn.user_function_value ();
+
+      std::list<symbol_table::symbol_record> vars
+        = symbol_table::all_variables (f->scope (), 0);
+
+      size_t varlen = vars.size ();
+
+      if (varlen > 0)
+        nmbuf << nm << " " << varlen;
+      else
+        nmbuf << nm;
+
+      std::string buf_str = nmbuf.str ();
+      int32_t tmp = buf_str.length ();
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+      os.write (buf_str.c_str (), buf_str.length ());
+
+      std::ostringstream buf;
+      print_raw (buf, true);
+      std::string stmp = buf.str ();
+      tmp = stmp.length ();
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+      os.write (stmp.c_str (), stmp.length ());
+
+      if (varlen > 0)
+        {
+          for (std::list<symbol_table::symbol_record>::const_iterator p = vars.begin ();
+               p != vars.end (); p++)
+            {
+              if (! save_binary_data (os, p->varval (), p->name (),
+                                      "", 0, save_as_floats))
+                return os;
+            }
+        }
+    }
+  else
+    {
+      std::ostringstream nmbuf;
+
+      octave_function *f = function_value ();
+      std::string fnm = f ? f->fcn_file_name () : std::string ();
+
+      nmbuf << nm << "\n" << OCTAVE_EXEC_PREFIX << "\n" << fnm;
+
+      std::string buf_str = nmbuf.str ();
+      int32_t tmp = buf_str.length ();
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+      os.write (buf_str.c_str (), buf_str.length ());
+    }
+
+  return true;
+}
+
+bool
+octave_fcn_handle::load_binary (std::istream& is, bool swap,
+                                oct_mach_info::float_format fmt)
+{
+  bool success = true;
+
+  int32_t tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&tmp);
+
+  OCTAVE_LOCAL_BUFFER (char, ctmp1, tmp+1);
+  // is.get (ctmp1, tmp+1, 0); caused is.eof () to be true though
+  // effectively not reading over file end
+  is.read (ctmp1, tmp);
+  ctmp1[tmp] = 0;
+  nm = std::string (ctmp1);
+
+  if (! is)
+    return false;
+
+  size_t anl = anonymous.length ();
+
+  if (nm.length () >= anl && nm.substr (0, anl) == anonymous)
+    {
+      octave_idx_type len = 0;
+
+      if (nm.length () > anl)
+        {
+          std::istringstream nm_is (nm.substr (anl));
+          nm_is >> len;
+          nm = nm.substr (0, anl);
+        }
+
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+
+      OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1);
+      // is.get (ctmp2, tmp+1, 0); caused is.eof () to be true though
+      // effectively not reading over file end
+      is.read (ctmp2, tmp);
+      ctmp2[tmp] = 0;
+
+      unwind_protect_safe frame;
+
+      // Set up temporary scope to use for evaluating the text that
+      // defines the anonymous function.
+
+      symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
+      frame.add_fcn (symbol_table::erase_scope, local_scope);
+
+      symbol_table::set_scope (local_scope);
+
+      octave_call_stack::push (local_scope, 0);
+      frame.add_fcn (octave_call_stack::pop);
+
+      if (len > 0)
+        {
+          for (octave_idx_type i = 0; i < len; i++)
+            {
+              octave_value t2;
+              bool dummy;
+              std::string doc;
+
+              std::string name =
+                read_binary_data (is, swap, fmt, std::string (),
+                                  dummy, t2, doc);
+
+              if (!is)
+                {
+                  error ("load: failed to load anonymous function handle");
+                  break;
+                }
+
+              symbol_table::varref (name, local_scope) = t2;
+            }
+        }
+
+      if (is && success)
+        {
+          int parse_status;
+          octave_value anon_fcn_handle =
+            eval_string (ctmp2, true, parse_status);
+
+          if (parse_status == 0)
+            {
+              octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
+
+              if (fh)
+                {
+                  fcn = fh->fcn;
+
+                  octave_user_function *uf = fcn.user_function_value (true);
+
+                  if (uf)
+                    symbol_table::cache_name (uf->scope (), nm);
+                }
+              else
+                success = false;
+            }
+          else
+            success = false;
+        }
+    }
+  else
+    {
+      std::string octaveroot;
+      std::string fpath;
+
+      if (nm.find_first_of ("\n") != std::string::npos)
+        {
+          size_t pos1 = nm.find_first_of ("\n");
+          size_t pos2 = nm.find_first_of ("\n", pos1 + 1);
+          octaveroot = nm.substr (pos1 + 1, pos2 - pos1 - 1);
+          fpath = nm.substr (pos2 + 1);
+          nm = nm.substr (0, pos1);
+        }
+
+      success = set_fcn (octaveroot, fpath);
+     }
+
+  return success;
+}
+
+#if defined (HAVE_HDF5)
+bool
+octave_fcn_handle::save_hdf5 (hid_t loc_id, const char *name,
+                              bool save_as_floats)
+{
+  bool retval = true;
+
+  hid_t group_hid = -1;
+#if HAVE_HDF5_18
+  group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  group_hid = H5Gcreate (loc_id, name, 0);
+#endif
+  if (group_hid < 0)
+    return false;
+
+  hid_t space_hid = -1, data_hid = -1, type_hid = -1;;
+
+  // attach the type of the variable
+  type_hid = H5Tcopy (H5T_C_S1);
+  H5Tset_size (type_hid, nm.length () + 1);
+  if (type_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, 2);
+  hdims[0] = 0;
+  hdims[1] = 0;
+  space_hid = H5Screate_simple (0 , hdims, 0);
+  if (space_hid < 0)
+    {
+      H5Tclose (type_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid, H5P_DEFAULT);
+#endif
+  if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
+                                H5P_DEFAULT, nm.c_str ()) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+  H5Dclose (data_hid);
+
+  if (nm == anonymous)
+    {
+      std::ostringstream buf;
+      print_raw (buf, true);
+      std::string stmp = buf.str ();
+
+      // attach the type of the variable
+      H5Tset_size (type_hid, stmp.length () + 1);
+      if (type_hid < 0)
+        {
+          H5Sclose (space_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+#if HAVE_HDF5_18
+      data_hid = H5Dcreate (group_hid, "fcn",  type_hid, space_hid,
+                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+      data_hid = H5Dcreate (group_hid, "fcn",  type_hid, space_hid,
+                            H5P_DEFAULT);
+#endif
+      if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
+                                    H5P_DEFAULT, stmp.c_str ()) < 0)
+        {
+          H5Sclose (space_hid);
+          H5Tclose (type_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      H5Dclose (data_hid);
+
+      octave_user_function *f = fcn.user_function_value ();
+
+      std::list<symbol_table::symbol_record> vars
+        = symbol_table::all_variables (f->scope (), 0);
+
+      size_t varlen = vars.size ();
+
+      if (varlen > 0)
+        {
+          hid_t as_id = H5Screate (H5S_SCALAR);
+
+          if (as_id >= 0)
+            {
+#if HAVE_HDF5_18
+              hid_t a_id = H5Acreate (group_hid, "SYMBOL_TABLE",
+                                      H5T_NATIVE_IDX, as_id,
+                                      H5P_DEFAULT, H5P_DEFAULT);
+
+#else
+              hid_t a_id = H5Acreate (group_hid, "SYMBOL_TABLE",
+                                      H5T_NATIVE_IDX, as_id, H5P_DEFAULT);
+#endif
+
+              if (a_id >= 0)
+                {
+                  retval = (H5Awrite (a_id, H5T_NATIVE_IDX, &varlen) >= 0);
+
+                  H5Aclose (a_id);
+                }
+              else
+                retval = false;
+
+              H5Sclose (as_id);
+            }
+          else
+            retval = false;
+#if HAVE_HDF5_18
+          data_hid = H5Gcreate (group_hid, "symbol table", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+          data_hid = H5Gcreate (group_hid, "symbol table", 0);
+#endif
+          if (data_hid < 0)
+            {
+              H5Sclose (space_hid);
+              H5Tclose (type_hid);
+              H5Gclose (group_hid);
+              return false;
+            }
+
+          for (std::list<symbol_table::symbol_record>::const_iterator p = vars.begin ();
+               p != vars.end (); p++)
+            {
+              if (! add_hdf5_data (data_hid, p->varval (), p->name (),
+                                   "", false, save_as_floats))
+                break;
+            }
+          H5Gclose (data_hid);
+        }
+    }
+  else
+    {
+      std::string octaveroot = OCTAVE_EXEC_PREFIX;
+
+      octave_function *f = function_value ();
+      std::string fpath = f ? f->fcn_file_name () : std::string ();
+
+      H5Sclose (space_hid);
+      hdims[0] = 1;
+      hdims[1] = octaveroot.length ();
+      space_hid = H5Screate_simple (0 , hdims, 0);
+      if (space_hid < 0)
+        {
+          H5Tclose (type_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      H5Tclose (type_hid);
+      type_hid = H5Tcopy (H5T_C_S1);
+      H5Tset_size (type_hid, octaveroot.length () + 1);
+#if HAVE_HDF5_18
+      hid_t a_id = H5Acreate (group_hid, "OCTAVEROOT",
+                              type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT);
+#else
+      hid_t a_id = H5Acreate (group_hid, "OCTAVEROOT",
+                              type_hid, space_hid, H5P_DEFAULT);
+#endif
+
+      if (a_id >= 0)
+        {
+          retval = (H5Awrite (a_id, type_hid, octaveroot.c_str ()) >= 0);
+
+          H5Aclose (a_id);
+        }
+      else
+        {
+          H5Sclose (space_hid);
+          H5Tclose (type_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      H5Sclose (space_hid);
+      hdims[0] = 1;
+      hdims[1] = fpath.length ();
+      space_hid = H5Screate_simple (0 , hdims, 0);
+      if (space_hid < 0)
+        {
+          H5Tclose (type_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      H5Tclose (type_hid);
+      type_hid = H5Tcopy (H5T_C_S1);
+      H5Tset_size (type_hid, fpath.length () + 1);
+
+#if HAVE_HDF5_18
+      a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT);
+#else
+      a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid, H5P_DEFAULT);
+#endif
+
+      if (a_id >= 0)
+        {
+          retval = (H5Awrite (a_id, type_hid, fpath.c_str ()) >= 0);
+
+          H5Aclose (a_id);
+        }
+      else
+        retval = false;
+    }
+
+  H5Sclose (space_hid);
+  H5Tclose (type_hid);
+  H5Gclose (group_hid);
+
+  return retval;
+}
+
+bool
+octave_fcn_handle::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool success = true;
+
+  hid_t group_hid, data_hid, space_hid, type_hid, type_class_hid, st_id;
+  hsize_t rank;
+  int slen;
+
+#if HAVE_HDF5_18
+  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  group_hid = H5Gopen (loc_id, name);
+#endif
+  if (group_hid < 0)
+    return false;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nm", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nm");
+#endif
+
+  if (data_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  type_hid = H5Dget_type (data_hid);
+  type_class_hid = H5Tget_class (type_hid);
+
+  if (type_class_hid != H5T_STRING)
+    {
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  slen = H5Tget_size (type_hid);
+  if (slen < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (char, nm_tmp, slen);
+
+  // create datatype for (null-terminated) string to read into:
+  st_id = H5Tcopy (H5T_C_S1);
+  H5Tset_size (st_id, slen);
+
+  if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, nm_tmp) < 0)
+    {
+      H5Tclose (st_id);
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+  H5Tclose (st_id);
+  H5Dclose (data_hid);
+  nm = nm_tmp;
+
+  if (nm == anonymous)
+    {
+#if HAVE_HDF5_18
+      data_hid = H5Dopen (group_hid, "fcn", H5P_DEFAULT);
+#else
+      data_hid = H5Dopen (group_hid, "fcn");
+#endif
+
+      if (data_hid < 0)
+        {
+          H5Sclose (space_hid);
+          H5Tclose (type_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      H5Tclose (type_hid);
+      type_hid = H5Dget_type (data_hid);
+      type_class_hid = H5Tget_class (type_hid);
+
+      if (type_class_hid != H5T_STRING)
+        {
+          H5Sclose (space_hid);
+          H5Tclose (type_hid);
+          H5Dclose (data_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      H5Sclose (space_hid);
+      space_hid = H5Dget_space (data_hid);
+      rank = H5Sget_simple_extent_ndims (space_hid);
+
+      if (rank != 0)
+        {
+          H5Sclose (space_hid);
+          H5Tclose (type_hid);
+          H5Dclose (data_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      slen = H5Tget_size (type_hid);
+      if (slen < 0)
+        {
+          H5Sclose (space_hid);
+          H5Tclose (type_hid);
+          H5Dclose (data_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+
+      OCTAVE_LOCAL_BUFFER (char, fcn_tmp, slen);
+
+      // create datatype for (null-terminated) string to read into:
+      st_id = H5Tcopy (H5T_C_S1);
+      H5Tset_size (st_id, slen);
+
+      if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, fcn_tmp) < 0)
+        {
+          H5Tclose (st_id);
+          H5Sclose (space_hid);
+          H5Tclose (type_hid);
+          H5Dclose (data_hid);
+          H5Gclose (group_hid);
+          return false;
+        }
+      H5Tclose (st_id);
+      H5Dclose (data_hid);
+
+      octave_idx_type len = 0;
+
+      // we have to pull some shenanigans here to make sure
+      // HDF5 doesn't print out all sorts of error messages if we
+      // call H5Aopen for a non-existing attribute
+
+      H5E_auto_t err_func;
+      void *err_func_data;
+
+      // turn off error reporting temporarily, but save the error
+      // reporting function:
+#if HAVE_HDF5_18
+      H5Eget_auto (H5E_DEFAULT, &err_func, &err_func_data);
+      H5Eset_auto (H5E_DEFAULT, 0, 0);
+#else
+      H5Eget_auto (&err_func, &err_func_data);
+      H5Eset_auto (0, 0);
+#endif
+
+      hid_t attr_id = H5Aopen_name (group_hid, "SYMBOL_TABLE");
+
+      if (attr_id >= 0)
+        {
+          if (H5Aread (attr_id, H5T_NATIVE_IDX, &len) < 0)
+            success = false;
+
+          H5Aclose (attr_id);
+        }
+
+      // restore error reporting:
+#if HAVE_HDF5_18
+      H5Eset_auto (H5E_DEFAULT, err_func, err_func_data);
+#else
+      H5Eset_auto (err_func, err_func_data);
+#endif
+
+      unwind_protect_safe frame;
+
+      // Set up temporary scope to use for evaluating the text that
+      // defines the anonymous function.
+
+      symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
+      frame.add_fcn (symbol_table::erase_scope, local_scope);
+
+      symbol_table::set_scope (local_scope);
+
+      octave_call_stack::push (local_scope, 0);
+      frame.add_fcn (octave_call_stack::pop);
+
+      if (len > 0 && success)
+        {
+          hsize_t num_obj = 0;
+#if HAVE_HDF5_18
+          data_hid = H5Gopen (group_hid, "symbol table", H5P_DEFAULT);
+#else
+          data_hid = H5Gopen (group_hid, "symbol table");
+#endif
+          H5Gget_num_objs (data_hid, &num_obj);
+          H5Gclose (data_hid);
+
+          if (num_obj != static_cast<hsize_t>(len))
+            {
+              error ("load: failed to load anonymous function handle");
+              success = false;
+            }
+
+          if (! error_state)
+            {
+              hdf5_callback_data dsub;
+              int current_item = 0;
+              for (octave_idx_type i = 0; i < len; i++)
+                {
+                  if (H5Giterate (group_hid, "symbol table", &current_item,
+                                  hdf5_read_next_data, &dsub) <= 0)
+                    {
+                      error ("load: failed to load anonymous function handle");
+                      success = false;
+                      break;
+                    }
+
+                  symbol_table::varref (dsub.name, local_scope) = dsub.tc;
+                }
+            }
+        }
+
+      if (success)
+        {
+          int parse_status;
+          octave_value anon_fcn_handle =
+            eval_string (fcn_tmp, true, parse_status);
+
+          if (parse_status == 0)
+            {
+              octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
+
+              if (fh)
+                {
+                  fcn = fh->fcn;
+
+                  octave_user_function *uf = fcn.user_function_value (true);
+
+                  if (uf)
+                    symbol_table::cache_name (uf->scope (), nm);
+                }
+              else
+                success = false;
+            }
+          else
+            success = false;
+        }
+
+      frame.run ();
+    }
+  else
+    {
+      std::string octaveroot;
+      std::string fpath;
+
+      // we have to pull some shenanigans here to make sure
+      // HDF5 doesn't print out all sorts of error messages if we
+      // call H5Aopen for a non-existing attribute
+
+      H5E_auto_t err_func;
+      void *err_func_data;
+
+      // turn off error reporting temporarily, but save the error
+      // reporting function:
+#if HAVE_HDF5_18
+      H5Eget_auto (H5E_DEFAULT, &err_func, &err_func_data);
+      H5Eset_auto (H5E_DEFAULT, 0, 0);
+#else
+      H5Eget_auto (&err_func, &err_func_data);
+      H5Eset_auto (0, 0);
+#endif
+
+      hid_t attr_id = H5Aopen_name (group_hid, "OCTAVEROOT");
+      if (attr_id >= 0)
+        {
+          H5Tclose (type_hid);
+          type_hid = H5Aget_type (attr_id);
+          type_class_hid = H5Tget_class (type_hid);
+
+          if (type_class_hid != H5T_STRING)
+            success = false;
+          else
+            {
+              slen = H5Tget_size (type_hid);
+              st_id = H5Tcopy (H5T_C_S1);
+              H5Tset_size (st_id, slen);
+              OCTAVE_LOCAL_BUFFER (char, root_tmp, slen);
+
+              if (H5Aread (attr_id, st_id, root_tmp) < 0)
+                success = false;
+              else
+                octaveroot = root_tmp;
+
+              H5Tclose (st_id);
+            }
+
+          H5Aclose (attr_id);
+        }
+
+      if (success)
+        {
+          attr_id = H5Aopen_name (group_hid, "FILE");
+          if (attr_id >= 0)
+            {
+              H5Tclose (type_hid);
+              type_hid = H5Aget_type (attr_id);
+              type_class_hid = H5Tget_class (type_hid);
+
+              if (type_class_hid != H5T_STRING)
+                success = false;
+              else
+                {
+                  slen = H5Tget_size (type_hid);
+                  st_id = H5Tcopy (H5T_C_S1);
+                  H5Tset_size (st_id, slen);
+                  OCTAVE_LOCAL_BUFFER (char, path_tmp, slen);
+
+                  if (H5Aread (attr_id, st_id, path_tmp) < 0)
+                    success = false;
+                  else
+                    fpath = path_tmp;
+
+                  H5Tclose (st_id);
+                }
+
+              H5Aclose (attr_id);
+            }
+        }
+
+      // restore error reporting:
+#if HAVE_HDF5_18
+      H5Eset_auto (H5E_DEFAULT, err_func, err_func_data);
+#else
+      H5Eset_auto (err_func, err_func_data);
+#endif
+
+      success = (success ? set_fcn (octaveroot, fpath) : success);
+    }
+
+  H5Tclose (type_hid);
+  H5Sclose (space_hid);
+  H5Gclose (group_hid);
+
+  return success;
+}
+
+#endif
+
+/*
+%!test
+%! a = 2;
+%! f = @(x) a + x;
+%! g = @(x) 2 * x;
+%! hm = @version;
+%! hdld = @svd;
+%! hbi = @log2;
+%! f2 = f;
+%! g2 = g;
+%! hm2 = hm;
+%! hdld2 = hdld;
+%! hbi2 = hbi;
+%! modes = {"-text", "-binary"};
+%! if (!isempty (findstr (octave_config_info ("DEFS"), "HAVE_HDF5")))
+%!   modes(end+1) = "-hdf5";
+%! endif
+%! for i = 1:numel (modes)
+%!   mode = modes{i};
+%!   nm = tmpnam ();
+%!   unwind_protect
+%!     save (mode, nm, "f2", "g2", "hm2", "hdld2", "hbi2");
+%!     clear f2 g2 hm2 hdld2 hbi2
+%!     load (nm);
+%!     assert (f (2), f2 (2));
+%!     assert (g (2), g2 (2));
+%!     assert (g (3), g2 (3));
+%!     unlink (nm);
+%!     save (mode, nm, "f2", "g2", "hm2", "hdld2", "hbi2");
+%!   unwind_protect_cleanup
+%!     unlink (nm);
+%!   end_unwind_protect
+%! endfor
+*/
+
+void
+octave_fcn_handle::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+
+void
+octave_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax) const
+{
+  bool printed = false;
+
+  if (nm == anonymous)
+    {
+      tree_print_code tpc (os);
+
+      // FCN is const because this member function is, so we can't
+      // use it to call user_function_value, so we make a copy first.
+
+      octave_value ftmp = fcn;
+
+      octave_user_function *f = ftmp.user_function_value ();
+
+      if (f)
+        {
+          tree_parameter_list *p = f->parameter_list ();
+
+          os << "@(";
+
+          if (p)
+            p->accept (tpc);
+
+          os << ") ";
+
+          tpc.print_fcn_handle_body (f->body ());
+
+          printed = true;
+        }
+    }
+
+  if (! printed)
+    octave_print_internal (os, "@" + nm, pr_as_read_syntax,
+                           current_print_indent_level ());
+}
+
+octave_value
+make_fcn_handle (const std::string& nm, bool local_funcs)
+{
+  octave_value retval;
+
+  // Bow to the god of compatibility.
+
+  // FIXME -- it seems ugly to put this here, but there is no single
+  // function in the parser that converts from the operator name to
+  // the corresponding function name.  At least try to do it without N
+  // string compares.
+
+  std::string tnm = nm;
+
+  size_t len = nm.length ();
+
+  if (len == 3 && nm == ".**")
+    tnm = "power";
+  else if (len == 2)
+    {
+      if (nm[0] == '.')
+        {
+          switch (nm[1])
+            {
+            case '\'':
+              tnm = "transpose";
+              break;
+
+            case '+':
+              tnm = "plus";
+              break;
+
+            case '-':
+              tnm = "minus";
+              break;
+
+            case '*':
+              tnm = "times";
+              break;
+
+            case '/':
+              tnm = "rdivide";
+              break;
+
+            case '^':
+              tnm = "power";
+              break;
+
+            case '\\':
+              tnm = "ldivide";
+              break;
+            }
+        }
+      else if (nm[1] == '=')
+        {
+          switch (nm[0])
+            {
+            case '<':
+              tnm = "le";
+              break;
+
+            case '=':
+              tnm = "eq";
+              break;
+
+            case '>':
+              tnm = "ge";
+              break;
+
+            case '~':
+            case '!':
+              tnm = "ne";
+              break;
+            }
+        }
+      else if (nm == "**")
+        tnm = "mpower";
+    }
+  else if (len == 1)
+    {
+      switch (nm[0])
+        {
+        case '~':
+        case '!':
+          tnm = "not";
+          break;
+
+        case '\'':
+          tnm = "ctranspose";
+          break;
+
+        case '+':
+          tnm = "plus";
+          break;
+
+        case '-':
+          tnm = "minus";
+          break;
+
+        case '*':
+          tnm = "mtimes";
+          break;
+
+        case '/':
+          tnm = "mrdivide";
+          break;
+
+        case '^':
+          tnm = "mpower";
+          break;
+
+        case '\\':
+          tnm = "mldivide";
+          break;
+
+        case '<':
+          tnm = "lt";
+          break;
+
+        case '>':
+          tnm = "gt";
+          break;
+
+        case '&':
+          tnm = "and";
+          break;
+
+        case '|':
+          tnm = "or";
+          break;
+        }
+    }
+
+  octave_value f = symbol_table::find_function (tnm, octave_value_list (),
+                                                local_funcs);
+
+  octave_function *fptr = f.function_value (true);
+
+  // Here we are just looking to see if FCN is a method or constructor
+  // for any class.
+  if (local_funcs && fptr
+      && (fptr->is_subfunction () || fptr->is_private_function ()
+          || fptr->is_class_constructor ()))
+    {
+      // Locally visible function.
+      retval = octave_value (new octave_fcn_handle (f, tnm));
+    }
+  else
+    {
+      // Globally visible (or no match yet). Query overloads.
+      std::list<std::string> classes = load_path::overloads (tnm);
+      bool any_match = fptr != 0 || classes.size () > 0;
+      if (! any_match)
+        {
+          // No match found, try updating load_path and query classes again.
+          load_path::update ();
+          classes = load_path::overloads (tnm);
+          any_match = classes.size () > 0;
+        }
+
+      if (any_match)
+        {
+          octave_fcn_handle *fh = new octave_fcn_handle (f, tnm);
+          retval = fh;
+
+          for (std::list<std::string>::iterator iter = classes.begin ();
+               iter != classes.end (); iter++)
+            {
+              std::string class_name = *iter;
+              octave_value fmeth = symbol_table::find_method (tnm, class_name);
+
+              bool is_builtin = false;
+              for (int i = 0; i < btyp_num_types; i++)
+                {
+                  // FIXME: Too slow? Maybe binary lookup?
+                  if (class_name == btyp_class_name[i])
+                    {
+                      is_builtin = true;
+                      fh->set_overload (static_cast<builtin_type_t> (i), fmeth);
+                    }
+                }
+
+              if (! is_builtin)
+                fh->set_overload (class_name, fmeth);
+            }
+        }
+      else
+        error ("@%s: no function and no method found", tnm.c_str ());
+    }
+
+  return retval;
+}
+
+/*
+%!test
+%! x = {".**", "power";
+%!      ".'", "transpose";
+%!      ".+", "plus";
+%!      ".-", "minus";
+%!      ".*", "times";
+%!      "./", "rdivide";
+%!      ".^", "power";
+%!      ".\\", "ldivide";
+%!      "<=", "le";
+%!      "==", "eq";
+%!      ">=", "ge";
+%!      "~=", "ne";
+%!      "!=", "ne";
+%!      "**", "mpower";
+%!      "~", "not";
+%!      "!", "not";
+%!      "\'", "ctranspose";
+%!      "+", "plus";
+%!      "-", "minus";
+%!      "*", "mtimes";
+%!      "/", "mrdivide";
+%!      "^", "mpower";
+%!      "\\", "mldivide";
+%!      "<", "lt";
+%!      ">", "gt";
+%!      "&", "and";
+%!      "|", "or"};
+%! for i = 1:rows (x)
+%!   assert (functions (str2func (x{i,1})).function, x{i,2});
+%! endfor
+*/
+
+DEFUN (functions, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} functions (@var{fcn_handle})\n\
+Return a struct containing information about the function handle\n\
+@var{fcn_handle}.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    {
+      octave_fcn_handle *fh = args(0).fcn_handle_value ();
+
+      if (! error_state)
+        {
+          octave_function *fcn = fh ? fh->function_value () : 0;
+
+          if (fcn)
+            {
+              octave_scalar_map m;
+
+              std::string fh_nm = fh->fcn_name ();
+
+              if (fh_nm == octave_fcn_handle::anonymous)
+                {
+                  std::ostringstream buf;
+                  fh->print_raw (buf);
+                  m.setfield ("function", buf.str ());
+
+                  m.setfield ("type", "anonymous");
+                }
+              else
+                {
+                  m.setfield ("function", fh_nm);
+
+                  if (fcn->is_subfunction ())
+                    {
+                      m.setfield ("type", "subfunction");
+                      Cell parentage (dim_vector (1, 2));
+                      parentage.elem (0) = fh_nm;
+                      parentage.elem (1) = fcn->parent_fcn_name ();
+                      m.setfield ("parentage", octave_value (parentage));
+                    }
+                  else if (fcn->is_private_function ())
+                    m.setfield ("type", "private");
+                  else if (fh->is_overloaded ())
+                    m.setfield ("type", "overloaded");
+                  else
+                    m.setfield ("type", "simple");
+                }
+
+              std::string nm = fcn->fcn_file_name ();
+
+              if (fh_nm == octave_fcn_handle::anonymous)
+                {
+                  m.setfield ("file", nm);
+
+                  octave_user_function *fu = fh->user_function_value ();
+
+                  std::list<symbol_table::symbol_record> vars
+                    = symbol_table::all_variables (fu->scope (), 0);
+
+                  size_t varlen = vars.size ();
+
+                  if (varlen > 0)
+                    {
+                      octave_scalar_map ws;
+                      for (std::list<symbol_table::symbol_record>::const_iterator p = vars.begin ();
+                           p != vars.end (); p++)
+                        {
+                          ws.assign (p->name (), p->varval (0));
+                        }
+
+                      m.setfield ("workspace", ws);
+                    }
+                }
+              else if (fcn->is_user_function () || fcn->is_user_script ())
+                {
+                  octave_function *fu = fh->function_value ();
+                  m.setfield ("file", fu->fcn_file_name ());
+                }
+              else
+                m.setfield ("file", "");
+
+              retval = m;
+            }
+          else
+            error ("functions: FCN_HANDLE is not a valid function handle object");
+        }
+      else
+        error ("functions: FCN_HANDLE argument must be a function handle object");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (func2str, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} func2str (@var{fcn_handle})\n\
+Return a string containing the name of the function referenced by\n\
+the function handle @var{fcn_handle}.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    {
+      octave_fcn_handle *fh = args(0).fcn_handle_value ();
+
+      if (! error_state && fh)
+        {
+          std::string fh_nm = fh->fcn_name ();
+
+          if (fh_nm == octave_fcn_handle::anonymous)
+            {
+              std::ostringstream buf;
+
+              fh->print_raw (buf);
+
+              retval = buf.str ();
+            }
+          else
+            retval = fh_nm;
+        }
+      else
+        error ("func2str: FCN_HANDLE must be a valid function handle");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (str2func, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} str2func (@var{fcn_name})\n\
+@deftypefnx {Built-in Function} {} str2func (@var{fcn_name}, \"global\")\n\
+Return a function handle constructed from the string @var{fcn_name}.\n\
+If the optional \"global\" argument is passed, locally visible functions\n\
+are ignored in the lookup.\n\
+@end deftypefn")
+{
+  octave_value retval;
+  int nargin = args.length ();
+
+  if (nargin == 1 || nargin == 2)
+    {
+      std::string nm = args(0).string_value ();
+
+      if (! error_state)
+        retval = make_fcn_handle (nm, nargin != 2);
+      else
+        error ("str2func: FCN_NAME must be a string");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!function y = __testrecursionfunc (f, x, n)
+%!  if (nargin < 3)
+%!    n = 0;
+%!  endif
+%!  if (n > 2)
+%!    y = f (x);
+%!  else
+%!    n++;
+%!    y = __testrecursionfunc (@(x) f (2*x), x, n);
+%!  endif
+%!endfunction
+%!
+%!assert (__testrecursionfunc (@(x) x, 1), 8)
+*/
+
+DEFUN (is_function_handle, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} is_function_handle (@var{x})\n\
+Return true if @var{x} is a function handle.\n\
+@seealso{isa, typeinfo, class}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    retval = args(0).is_function_handle ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!shared fh
+%! fh = @(x) x;
+
+%!assert (is_function_handle (fh))
+%!assert (! is_function_handle ({fh}))
+%!assert (! is_function_handle (1))
+
+%!error is_function_handle ()
+%!error is_function_handle (1, 2)
+*/
+
+octave_fcn_binder::octave_fcn_binder (const octave_value& f,
+                                      const octave_value& root,
+                                      const octave_value_list& templ,
+                                      const std::vector<int>& mask,
+                                      int exp_nargin)
+: octave_fcn_handle (f), root_handle (root), arg_template (templ),
+  arg_mask (mask), expected_nargin (exp_nargin)
+{
+}
+
+octave_fcn_handle *
+octave_fcn_binder::maybe_binder (const octave_value& f)
+{
+  octave_fcn_handle *retval = 0;
+
+  octave_user_function *usr_fcn = f.user_function_value (false);
+  tree_parameter_list *param_list = usr_fcn ? usr_fcn->parameter_list () : 0;
+
+  // Verify that the body is a single expression (always true in theory).
+
+  tree_statement_list *cmd_list = usr_fcn ? usr_fcn->body () : 0;
+  tree_expression *body_expr = (cmd_list->length () == 1
+                                ? cmd_list->front ()->expression () : 0);
+
+
+  if (body_expr && body_expr->is_index_expression ()
+      && ! (param_list && param_list->takes_varargs ()))
+    {
+      // It's an index expression.
+      tree_index_expression *idx_expr = dynamic_cast<tree_index_expression *> (body_expr);
+      tree_expression *head_expr = idx_expr->expression ();
+      std::list<tree_argument_list *> arg_lists = idx_expr->arg_lists ();
+      std::string type_tags = idx_expr->type_tags ();
+
+      if (type_tags.length () == 1 && type_tags[0] == '('
+          && head_expr->is_identifier ())
+        {
+          assert (arg_lists.size () == 1);
+
+          // It's a single index expression: a(x,y,....)
+          tree_identifier *head_id = dynamic_cast<tree_identifier *> (head_expr);
+          tree_argument_list *arg_list = arg_lists.front ();
+
+          // Build a map of input params to their position.
+          std::map<std::string, int> arginmap;
+          int npar = 0;
+
+          if (param_list)
+            {
+              for (tree_parameter_list::iterator it = param_list->begin ();
+                   it != param_list->end (); ++it, ++npar)
+                {
+                  tree_decl_elt *elt = *it;
+                  tree_identifier *id = elt ? elt->ident () : 0;
+                  if (id && ! id->is_black_hole ())
+                     arginmap[id->name ()] = npar;
+                }
+            }
+
+          if (arg_list && arg_list->length () > 0)
+            {
+              bool bad = false;
+              int nargs = arg_list->length ();
+              octave_value_list arg_template (nargs);
+              std::vector<int> arg_mask (nargs);
+
+              // Verify that each argument is either a named param, a constant, or a defined identifier.
+              int iarg = 0;
+              for (tree_argument_list::iterator it = arg_list->begin ();
+                   it != arg_list->end (); ++it, ++iarg)
+                {
+                  tree_expression *elt = *it;
+                  if (elt && elt->is_constant ())
+                    {
+                      arg_template(iarg) = elt->rvalue1 ();
+                      arg_mask[iarg] = -1;
+                    }
+                  else if (elt && elt->is_identifier ())
+                    {
+                      tree_identifier *elt_id = dynamic_cast<tree_identifier *> (elt);
+                      if (arginmap.find (elt_id->name ()) != arginmap.end ())
+                        {
+                          arg_mask[iarg] = arginmap[elt_id->name ()];
+                        }
+                      else if (elt_id->is_defined ())
+                        {
+                          arg_template(iarg) = elt_id->rvalue1 ();
+                          arg_mask[iarg] = -1;
+                        }
+                      else
+                        {
+                          bad = true;
+                          break;
+                        }
+                    }
+                  else
+                    {
+                      bad = true;
+                      break;
+                    }
+                }
+
+              octave_value root_val;
+
+              if (! bad)
+                {
+                  // If the head is a value, use it as root.
+                  if (head_id->is_defined ())
+                     root_val = head_id->rvalue1 ();
+                  else
+                    {
+                      // It's a name.
+                      std::string head_name = head_id->name ();
+                      // Function handles can't handle legacy dispatch, so
+                      // we make sure it's not defined.
+                      if (symbol_table::get_dispatch (head_name).size () > 0)
+                         bad = true;
+                      else
+                        {
+                          // Simulate try/catch.
+                          unwind_protect frame;
+                          interpreter_try (frame);
+
+                          root_val = make_fcn_handle (head_name);
+                          if (error_state)
+                             bad = true;
+                        }
+                    }
+                }
+
+              if (! bad)
+                {
+                  // Stash proper name tags.
+                  std::list<string_vector> arg_names = idx_expr->arg_names ();
+                  assert (arg_names.size () == 1);
+                  arg_template.stash_name_tags (arg_names.front ());
+
+                  retval = new octave_fcn_binder (f, root_val, arg_template,
+                                                  arg_mask, npar);
+                }
+            }
+        }
+    }
+
+  if (! retval)
+     retval = new octave_fcn_handle (f, octave_fcn_handle::anonymous);
+
+  return retval;
+}
+
+octave_value_list
+octave_fcn_binder::do_multi_index_op (int nargout,
+                                      const octave_value_list& args)
+{
+  return do_multi_index_op (nargout, args, 0);
+}
+
+octave_value_list
+octave_fcn_binder::do_multi_index_op (int nargout,
+                                      const octave_value_list& args,
+                                      const std::list<octave_lvalue>* lvalue_list)
+{
+  octave_value_list retval;
+
+  if (args.length () == expected_nargin)
+    {
+      for (int i = 0; i < arg_template.length (); i++)
+        {
+          int j = arg_mask[i];
+          if (j >= 0)
+             arg_template(i) = args(j); // May force a copy...
+        }
+
+      // Make a shallow copy of arg_template, to ensure consistency throughout the following
+      // call even if we happen to get back here.
+      octave_value_list tmp (arg_template);
+      retval = root_handle.do_multi_index_op (nargout, tmp, lvalue_list);
+    }
+  else
+     retval = octave_fcn_handle::do_multi_index_op (nargout, args, lvalue_list);
+
+  return retval;
+}
+
+/*
+%!function r = __f (g, i)
+%!  r = g(i);
+%!endfunction
+%!test
+%! x = [1,2;3,4];
+%! assert (__f (@(i) x(:,i), 1), [1;3]);
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-fcn-handle.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,219 @@
+/*
+
+Copyright (C) 2003-2012 John W. Eaton
+Copyright (C) 2009 VZLU Prague
+
+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_fcn_handle_h)
+#define octave_fcn_handle_h 1
+
+#include <iosfwd>
+#include <string>
+#include <memory>
+
+#include "oct-alloc.h"
+
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-fcn.h"
+#include "ov-typeinfo.h"
+
+// Function handles.
+
+class
+OCTINTERP_API
+octave_fcn_handle : public octave_base_value
+{
+private:
+
+  typedef std::map<std::string, octave_value> str_ov_map;
+
+public:
+
+  static const std::string anonymous;
+
+  octave_fcn_handle (void)
+    : fcn (), nm (), has_overloads (false), overloads () { }
+
+  octave_fcn_handle (const std::string& n)
+    : fcn (), nm (n), has_overloads (false), overloads () { }
+
+  octave_fcn_handle (const octave_value& f,  const std::string& n = anonymous);
+
+  octave_fcn_handle (const octave_fcn_handle& fh)
+    : octave_base_value (fh), fcn (fh.fcn), nm (fh.nm),
+    has_overloads (fh.has_overloads), overloads ()
+   {
+     for (int i = 0; i < btyp_num_types; i++)
+       builtin_overloads[i] = fh.builtin_overloads[i];
+
+     overloads = fh.overloads;
+   }
+
+  ~octave_fcn_handle (void) { }
+
+  octave_base_value *clone (void) const { return new octave_fcn_handle (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_fcn_handle (); }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    {
+      octave_value_list tmp = subsref (type, idx, 1);
+      return tmp.length () > 0 ? tmp(0) : octave_value ();
+    }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout, const std::list<octave_lvalue>* lvalue_list);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args,
+                     const std::list<octave_lvalue>* lvalue_list);
+
+  bool is_defined (void) const { return true; }
+
+  bool is_function_handle (void) const { return true; }
+
+  builtin_type_t builtin_type (void) const { return btyp_func_handle; }
+
+  bool is_overloaded (void) const { return has_overloads; }
+
+  dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; }
+
+  octave_function *function_value (bool = false)
+    { return fcn.function_value (); }
+
+  octave_user_function *user_function_value (bool = false)
+    { return fcn.user_function_value (); }
+
+  octave_fcn_handle *fcn_handle_value (bool = false) { return this; }
+
+  octave_value fcn_val (void) const { return fcn; }
+
+  std::string fcn_name (void) const { return nm; }
+
+  void set_overload (builtin_type_t btyp, const octave_value& ov_fcn)
+    {
+      if (btyp != btyp_unknown)
+        {
+          has_overloads = true;
+          builtin_overloads[btyp] = ov_fcn;
+        }
+
+    }
+
+  void set_overload (const std::string& dispatch_type, const octave_value& ov_fcn)
+    {
+      has_overloads = true;
+      overloads[dispatch_type] = ov_fcn;
+    }
+
+  bool is_equal_to (const octave_fcn_handle&) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  // Simple function handles are printed without a newline.
+  bool print_as_scalar (void) const { return nm != anonymous; }
+
+private:
+
+  bool set_fcn (const std::string &octaveroot, const std::string& fpath);
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+
+protected:
+
+  // The function we are handling.
+  octave_value fcn;
+
+  // The name of the handle, including the "@".
+  std::string nm;
+
+  // Whether the function is overloaded at all.
+  bool has_overloads;
+
+  // Overloads for builtin types. We use array to make lookup faster.
+  octave_value builtin_overloads[btyp_num_types];
+
+  // Overloads for other classes.
+  str_ov_map overloads;
+
+  friend octave_value make_fcn_handle (const std::string &, bool);
+};
+
+extern octave_value make_fcn_handle (const std::string& nm,
+                                     bool local_funcs = true);
+
+class
+OCTINTERP_API
+octave_fcn_binder : public octave_fcn_handle
+{
+private:
+  // Private ctor.
+  octave_fcn_binder (const octave_value& f, const octave_value& root,
+                     const octave_value_list& templ,
+                     const std::vector<int>& mask, int exp_nargin);
+
+public:
+
+  // Factory method.
+  static octave_fcn_handle *maybe_binder (const octave_value& f);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args,
+                     const std::list<octave_lvalue>* lvalue_list);
+
+protected:
+
+  octave_value root_handle;
+  octave_value_list arg_template;
+  std::vector<int> arg_mask;
+  int expected_nargin;
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-fcn-inline.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1019 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+In addition to the terms of the GPL, you are permitted to link
+this program with any Open Source program, as defined by the
+Open Source Initiative (www.opensource.org)
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <istream>
+#include <iostream>
+#include <sstream>
+#include <vector>
+
+#include "oct-locbuf.h"
+
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "oct-map.h"
+#include "ov-base.h"
+#include "ov-fcn-inline.h"
+#include "ov-usr-fcn.h"
+#include "pr-output.h"
+#include "variables.h"
+#include "parse.h"
+#include "toplev.h"
+
+#include "byte-swap.h"
+#include "ls-ascii-helper.h"
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+#include "ls-utils.h"
+
+DEFINE_OCTAVE_ALLOCATOR (octave_fcn_inline);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_fcn_inline,
+                                     "inline function",
+                                     "function_handle");
+
+octave_fcn_inline::octave_fcn_inline (const std::string& f,
+                                      const string_vector& a,
+                                      const std::string& n)
+  : octave_fcn_handle (n), iftext (f), ifargs (a)
+{
+  // Form a string representing the function.
+
+  std::ostringstream buf;
+
+  buf << "@(";
+
+  for (int i = 0; i < ifargs.length (); i++)
+    {
+      if (i > 0)
+        buf << ", ";
+
+      buf << ifargs(i);
+    }
+
+  buf << ") " << iftext;
+
+  int parse_status;
+  octave_value anon_fcn_handle = eval_string (buf.str (), true, parse_status);
+
+  if (parse_status == 0)
+    {
+      octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
+
+      if (fh)
+        {
+          fcn = fh->fcn_val ();
+
+          octave_user_function *uf = fcn.user_function_value ();
+
+          if (uf)
+            {
+              octave_function *curr_fcn = octave_call_stack::current ();
+
+              if (curr_fcn)
+                {
+                  symbol_table::scope_id parent_scope
+                    = curr_fcn->parent_fcn_scope ();
+
+                  if (parent_scope < 0)
+                    parent_scope = curr_fcn->scope ();
+
+                  uf->stash_parent_fcn_scope (parent_scope);
+                }
+            }
+        }
+    }
+
+  if (fcn.is_undefined ())
+    error ("inline: unable to define function");
+}
+
+// This function is supplied to allow a Matlab style class structure
+// to be returned..
+octave_map
+octave_fcn_inline::map_value (void) const
+{
+  octave_scalar_map m;
+
+  m.assign ("version", 1.0);
+  m.assign ("isEmpty", 0.0);
+  m.assign ("expr", fcn_text ());
+
+  string_vector args = fcn_arg_names ();
+
+  m.assign ("numArgs", args.length ());
+  m.assign ("args", args);
+
+  std::ostringstream buf;
+
+  for (int i = 0; i < args.length (); i++)
+    buf << args(i) << " = INLINE_INPUTS_{" << i + 1 << "}; ";
+
+  m.assign ("inputExpr", buf.str ());
+
+  return m;
+}
+
+bool
+octave_fcn_inline::save_ascii (std::ostream& os)
+{
+  os << "# nargs: " <<  ifargs.length () << "\n";
+  for (int i = 0; i < ifargs.length (); i++)
+    os << ifargs(i) << "\n";
+  if (nm.length () < 1)
+    // Write an invalid value to flag empty fcn handle name.
+    os << "0\n";
+  else
+    os << nm << "\n";
+  os << iftext << "\n";
+  return true;
+}
+
+bool
+octave_fcn_inline::load_ascii (std::istream& is)
+{
+  int nargs;
+  if (extract_keyword (is, "nargs", nargs, true))
+    {
+      ifargs.resize (nargs);
+      for (int i = 0; i < nargs; i++)
+        is >> ifargs(i);
+      is >> nm;
+      if (nm == "0")
+        nm = "";
+
+      skip_preceeding_newline (is);
+
+      std::string buf;
+
+      if (is)
+        {
+
+          // Get a line of text whitespace characters included,
+          // leaving newline in the stream.
+          buf = read_until_newline (is, true);
+        }
+
+      iftext = buf;
+
+      octave_fcn_inline tmp (iftext, ifargs, nm);
+      fcn = tmp.fcn;
+
+      return true;
+    }
+  else
+    return false;
+}
+
+bool
+octave_fcn_inline::save_binary (std::ostream& os, bool&)
+{
+  int32_t tmp = ifargs.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  for (int i = 0; i < ifargs.length (); i++)
+    {
+      tmp = ifargs(i).length ();
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+      os.write (ifargs(i).c_str (), ifargs(i).length ());
+    }
+  tmp = nm.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  os.write (nm.c_str (), nm.length ());
+  tmp = iftext.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  os.write (iftext.c_str (), iftext.length ());
+  return true;
+}
+
+bool
+octave_fcn_inline::load_binary (std::istream& is, bool swap,
+                                oct_mach_info::float_format)
+{
+  int32_t nargs;
+  if (! is.read (reinterpret_cast<char *> (&nargs), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&nargs);
+
+  if (nargs < 1)
+    return false;
+  else
+    {
+      int32_t tmp;
+      ifargs.resize (nargs);
+      for (int i = 0; i < nargs; i++)
+        {
+          if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+            return false;
+          if (swap)
+            swap_bytes<4> (&tmp);
+
+          OCTAVE_LOCAL_BUFFER (char, ctmp, tmp+1);
+          is.read (ctmp, tmp);
+          ifargs(i) = std::string (ctmp);
+
+          if (! is)
+            return false;
+        }
+
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+
+      OCTAVE_LOCAL_BUFFER (char, ctmp1, tmp+1);
+      is.read (ctmp1, tmp);
+      nm = std::string (ctmp1);
+
+      if (! is)
+        return false;
+
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+
+      OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1);
+      is.read (ctmp2, tmp);
+      iftext = std::string (ctmp2);
+
+      if (! is)
+        return false;
+
+      octave_fcn_inline ftmp (iftext, ifargs, nm);
+      fcn = ftmp.fcn;
+    }
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+bool
+octave_fcn_inline::save_hdf5 (hid_t loc_id, const char *name,
+                              bool /* save_as_floats */)
+{
+  hid_t group_hid = -1;
+#if HAVE_HDF5_18
+  group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  group_hid = H5Gcreate (loc_id, name, 0);
+#endif
+  if (group_hid < 0 ) return false;
+
+  size_t len = 0;
+  for (int i = 0; i < ifargs.length (); i++)
+    if (len < ifargs(i).length ())
+      len = ifargs(i).length ();
+
+  hid_t space_hid = -1, data_hid = -1, type_hid = -1;;
+  bool retval = true;
+
+  // FIXME Is there a better way of saving string vectors, than a
+  // null padded matrix?
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, 2);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  hdims[1] = ifargs.length ();
+  hdims[0] = len + 1;
+
+  space_hid = H5Screate_simple (2, hdims, 0);
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "args", H5T_NATIVE_CHAR, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "args", H5T_NATIVE_CHAR, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (char, s, ifargs.length () * (len + 1));
+
+  // Save the args as a null teminated list
+  for (int i = 0; i < ifargs.length (); i++)
+    {
+      const char * cptr = ifargs(i).c_str ();
+      for (size_t j = 0; j < ifargs(i).length (); j++)
+        s[i*(len+1)+j] = *cptr++;
+      s[ifargs(i).length ()] = '\0';
+    }
+
+  retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, s) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  if (!retval)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  // attach the type of the variable
+  type_hid = H5Tcopy (H5T_C_S1);
+  H5Tset_size (type_hid, nm.length () + 1);
+  if (type_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  hdims[0] = 0;
+  space_hid = H5Screate_simple (0 , hdims, 0);
+  if (space_hid < 0)
+    {
+      H5Tclose (type_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid, H5P_DEFAULT);
+#endif
+  if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
+                                H5P_DEFAULT, nm.c_str ()) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+  H5Dclose (data_hid);
+
+  // attach the type of the variable
+  H5Tset_size (type_hid, iftext.length () + 1);
+  if (type_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "iftext",  type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "iftext",  type_hid, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
+                                H5P_DEFAULT, iftext.c_str ()) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+  H5Tclose (type_hid);
+  H5Gclose (group_hid);
+
+  return retval;
+}
+
+bool
+octave_fcn_inline::load_hdf5 (hid_t loc_id, const char *name)
+{
+  hid_t group_hid, data_hid, space_hid, type_hid, type_class_hid, st_id;
+  hsize_t rank;
+  int slen;
+
+#if HAVE_HDF5_18
+  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  group_hid = H5Gopen (loc_id, name);
+#endif
+  if (group_hid < 0 ) return false;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "args", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "args");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Dclose (data_hid);
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  ifargs.resize (hdims[1]);
+
+  OCTAVE_LOCAL_BUFFER (char, s1, hdims[0] * hdims[1]);
+
+  if (H5Dread (data_hid, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, s1) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  for (size_t i = 0; i < hdims[1]; i++)
+    ifargs(i) = std::string (s1 + i*hdims[0]);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nm", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nm");
+#endif
+
+  if (data_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  type_hid = H5Dget_type (data_hid);
+  type_class_hid = H5Tget_class (type_hid);
+
+  if (type_class_hid != H5T_STRING)
+    {
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  slen = H5Tget_size (type_hid);
+  if (slen < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (char, nm_tmp, slen);
+
+  // create datatype for (null-terminated) string to read into:
+  st_id = H5Tcopy (H5T_C_S1);
+  H5Tset_size (st_id, slen);
+
+  if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, nm_tmp) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+  H5Tclose (st_id);
+  H5Dclose (data_hid);
+  nm = nm_tmp;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "iftext", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "iftext");
+#endif
+
+  if (data_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  type_hid = H5Dget_type (data_hid);
+  type_class_hid = H5Tget_class (type_hid);
+
+  if (type_class_hid != H5T_STRING)
+    {
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  slen = H5Tget_size (type_hid);
+  if (slen < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (char, iftext_tmp, slen);
+
+  // create datatype for (null-terminated) string to read into:
+  st_id = H5Tcopy (H5T_C_S1);
+  H5Tset_size (st_id, slen);
+
+  if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, iftext_tmp) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+  H5Tclose (st_id);
+  H5Dclose (data_hid);
+  iftext = iftext_tmp;
+
+  octave_fcn_inline ftmp (iftext, ifargs, nm);
+  fcn = ftmp.fcn;
+
+  return true;
+}
+#endif
+
+void
+octave_fcn_inline::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+
+void
+octave_fcn_inline::print_raw (std::ostream& os, bool pr_as_read_syntax) const
+{
+  std::ostringstream buf;
+
+  if (nm.empty ())
+    buf << "f(";
+  else
+    buf << nm << "(";
+
+  for (int i = 0; i < ifargs.length (); i++)
+    {
+      if (i)
+        buf << ", ";
+
+      buf << ifargs(i);
+    }
+
+  buf << ") = " << iftext;
+
+  octave_print_internal (os, buf.str (), pr_as_read_syntax,
+                         current_print_indent_level ());
+}
+
+octave_value
+octave_fcn_inline::convert_to_str_internal (bool, bool, char type) const
+{
+  return octave_value (fcn_text (), type);
+}
+
+DEFUNX ("inline", Finline, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} inline (@var{str})\n\
+@deftypefnx {Built-in Function} {} inline (@var{str}, @var{arg1}, @dots{})\n\
+@deftypefnx {Built-in Function} {} inline (@var{str}, @var{n})\n\
+Create an inline function from the character string @var{str}.\n\
+If called with a single argument, the arguments of the generated\n\
+function are extracted from the function itself.  The generated\n\
+function arguments will then be in alphabetical order.  It should\n\
+be noted that i, and j are ignored as arguments due to the\n\
+ambiguity between their use as a variable or their use as an inbuilt\n\
+constant.  All arguments followed by a parenthesis are considered\n\
+to be functions.\n\
+\n\
+If the second and subsequent arguments are character strings,\n\
+they are the names of the arguments of the function.\n\
+\n\
+If the second argument is an integer @var{n}, the arguments are\n\
+@code{\"x\"}, @code{\"P1\"}, @dots{}, @code{\"P@var{N}\"}.\n\
+@seealso{argnames, formula, vectorize}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin > 0)
+    {
+      if (args(0).is_string ())
+        {
+          std::string fun = args(0).string_value ();
+          string_vector fargs;
+
+          if (nargin == 1)
+            {
+              bool is_arg = false;
+              bool in_string = false;
+              std::string tmp_arg;
+              size_t i = 0;
+              size_t fun_length = fun.length ();
+
+              while (i < fun_length)
+                {
+                  bool terminate_arg = false;
+                  char c = fun[i++];
+
+                  if (in_string)
+                    {
+                      if (c == '\'' || c == '\"')
+                        in_string = false;
+                    }
+                  else if (c == '\'' || c == '\"')
+                    {
+                      in_string = true;
+                      if (is_arg)
+                        terminate_arg = true;
+                    }
+                  else if (! isalpha (c) && c != '_')
+                    if (! is_arg)
+                      continue;
+                    else if (isdigit (c))
+                      tmp_arg.append (1, c);
+                    else
+                      {
+                        // Before we do anything remove trailing whitespaces.
+                        while (i < fun_length && isspace (c))
+                          c = fun[i++];
+
+                        // Do we have a variable or a function?
+                        if (c != '(')
+                          terminate_arg = true;
+                        else
+                          {
+                            tmp_arg = std::string ();
+                            is_arg = false;
+                          }
+                      }
+                  else if (! is_arg)
+                    {
+                      if (c == 'e' || c == 'E')
+                        {
+                          // possible number in exponent form, not arg
+                          if (isdigit (fun[i])
+                              || fun[i] == '-' || fun[i] == '+')
+                            continue;
+                        }
+                      is_arg = true;
+                      tmp_arg.append (1, c);
+                    }
+                  else
+                    {
+                      tmp_arg.append (1, c);
+                    }
+
+                  if (terminate_arg || (i == fun_length && is_arg))
+                    {
+                      bool have_arg = false;
+
+                      for (int j = 0; j < fargs.length (); j++)
+                        if (tmp_arg == fargs (j))
+                          {
+                            have_arg = true;
+                            break;
+                          }
+
+                      if (! have_arg && tmp_arg != "i" && tmp_arg != "j" &&
+                          tmp_arg != "NaN" && tmp_arg != "nan" &&
+                          tmp_arg != "Inf" && tmp_arg != "inf" &&
+                          tmp_arg != "NA" && tmp_arg != "pi" &&
+                          tmp_arg != "e" && tmp_arg != "eps")
+                        fargs.append (tmp_arg);
+
+                      tmp_arg = std::string ();
+                      is_arg = false;
+                    }
+                }
+
+              // Sort the arguments into ascii order.
+              fargs.sort ();
+            }
+          else if (nargin == 2 && args(1).is_numeric_type ())
+            {
+              if (! args(1).is_scalar_type ()) 
+                {
+                  error ("inline: N must be an integer");
+                  return retval;
+                }
+              
+              int n = args(1).int_value ();
+
+              if (! error_state)
+                {
+                  if (n >= 0)
+                    {
+                      fargs.resize (n+1);
+
+                      fargs(0) = "x";
+
+                      for (int i = 1; i < n+1; i++)
+                        {
+                          std::ostringstream buf;
+                          buf << "P" << i;
+                          fargs(i) = buf.str ();
+                        }
+                    }
+                  else
+                    {
+                      error ("inline: N must be a positive integer or zero");
+                      return retval;
+                    }
+                }
+              else
+                {
+                  error ("inline: N must be an integer");
+                  return retval;
+                }
+            }
+          else
+            {
+              fargs.resize (nargin - 1);
+
+              for (int i = 1; i < nargin; i++)
+                {
+                  if (args(i).is_string ())
+                    {
+                      std::string s = args(i).string_value ();
+                      fargs(i-1) = s;
+                    }
+                    else
+                    {
+                      error ("inline: expecting string arguments");
+                      return retval;
+                    }
+                }
+            }
+
+          retval = octave_value (new octave_fcn_inline (fun, fargs));
+        }
+      else
+        error ("inline: STR argument must be a string");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!shared fn
+%! fn = inline ("x.^2 + 1");
+%!assert (feval (fn, 6), 37)
+%!assert (fn (6), 37)
+## FIXME: Need tests for other 2 calling forms of inline()
+
+## Test input validation 
+%!error inline ()
+%!error <STR argument must be a string> inline (1)
+%!error <N must be an integer> inline ("2", ones (2,2))
+%!error <N must be a positive integer> inline ("2", -1)
+%!error <expecting string arguments> inline ("2", "x", -1, "y")
+*/
+
+DEFUN (formula, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} formula (@var{fun})\n\
+Return a character string representing the inline function @var{fun}.\n\
+Note that @code{char (@var{fun})} is equivalent to\n\
+@code{formula (@var{fun})}.\n\
+@seealso{argnames, inline, vectorize}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    {
+      octave_fcn_inline* fn = args(0).fcn_inline_value (true);
+
+      if (fn)
+        retval = octave_value (fn->fcn_text ());
+      else
+        error ("formula: FUN must be an inline function");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!assert (formula (fn), "x.^2 + 1")
+%!assert (formula (fn), char (fn))
+
+## Test input validation
+%!error formula ()
+%!error formula (1, 2)
+%!error <FUN must be an inline function> formula (1)
+*/
+
+DEFUN (argnames, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} argnames (@var{fun})\n\
+Return a cell array of character strings containing the names of\n\
+the arguments of the inline function @var{fun}.\n\
+@seealso{inline, formula, vectorize}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    {
+      octave_fcn_inline *fn = args(0).fcn_inline_value (true);
+
+      if (fn)
+        {
+          string_vector t1 = fn->fcn_arg_names ();
+
+          Cell t2 (dim_vector (t1.length (), 1));
+
+          for (int i = 0; i < t1.length (); i++)
+            t2(i) = t1(i);
+
+          retval = t2;
+        }
+      else
+        error ("argnames: FUN must be an inline function");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!assert (argnames (fn), {"x"})
+%!assert (argnames (inline ("1e-3*y + 2e4*z")), {"y"; "z"})
+%!assert (argnames (inline ("2", 2)), {"x"; "P1"; "P2"})
+
+## Test input validation
+%!error argnames ()
+%!error argnames (1, 2)
+%!error <FUN must be an inline function> argnames (1)
+*/
+
+DEFUN (vectorize, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} vectorize (@var{fun})\n\
+Create a vectorized version of the inline function @var{fun}\n\
+by replacing all occurrences of @code{*}, @code{/}, etc., with\n\
+@code{.*}, @code{./}, etc.\n\
+\n\
+This may be useful, for example, when using inline functions with\n\
+numerical integration or optimization where a vector-valued function\n\
+is expected.\n\
+\n\
+@example\n\
+@group\n\
+fcn = vectorize (inline (\"x^2 - 1\"))\n\
+   @result{} fcn = f(x) = x.^2 - 1\n\
+quadv (fcn, 0, 3)\n\
+   @result{} 6\n\
+@end group\n\
+@end example\n\
+@seealso{inline, formula, argnames}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    {
+      std::string old_func;
+      octave_fcn_inline* old = 0;
+      bool func_is_string = true;
+
+      if (args(0).is_string ())
+        old_func = args(0).string_value ();
+      else
+        {
+          old = args(0).fcn_inline_value (true);
+          func_is_string = false;
+
+          if (old)
+            old_func = old->fcn_text ();
+          else
+            error ("vectorize: FUN must be a string or inline function");
+        }
+
+      if (! error_state)
+        {
+          std::string new_func;
+          size_t i = 0;
+
+          while (i < old_func.length ())
+            {
+              std::string t1 = old_func.substr (i, 1);
+
+              if (t1 == "*" || t1 == "/" || t1 == "\\" || t1 == "^")
+                {
+                  if (i && old_func.substr (i-1, 1) != ".")
+                    new_func.append (".");
+
+                  // Special case for ** operator.
+                  if (t1 == "*" && i < (old_func.length () - 1)
+                      && old_func.substr (i+1, 1) == "*")
+                    {
+                      new_func.append ("*");
+                      i++;
+                    }
+                }
+              new_func.append (t1);
+              i++;
+            }
+
+          if (func_is_string)
+            retval = octave_value (new_func);
+          else
+            retval = octave_value (new octave_fcn_inline
+                                   (new_func, old->fcn_arg_names ()));
+        }
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!assert (char (vectorize (fn)), "x.^2 + 1")
+%!assert (char (vectorize (inline ("1e-3*y + 2e4*z"))), "1e-3.*y + 2e4.*z")
+%!assert (char (vectorize (inline ("2**x^5"))), "2.**x.^5")
+%!assert (vectorize ("x.^2 + 1"), "x.^2 + 1")
+%!assert (vectorize ("1e-3*y + 2e4*z"), "1e-3.*y + 2e4.*z")
+%!assert (vectorize ("2**x^5"), "2.**x.^5")
+
+## Test input validation
+%!error vectorize ()
+%!error vectorize (1, 2)
+%!error <FUN must be a string or inline function> vectorize (1)
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-fcn-inline.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,104 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_fcn_inline_h)
+#define octave_fcn_inline_h 1
+
+#include <iosfwd>
+#include <string>
+
+#include "oct-alloc.h"
+
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-fcn.h"
+#include "ov-typeinfo.h"
+#include "symtab.h"
+#include "ov-fcn-handle.h"
+
+// Inline functions.
+
+class
+OCTINTERP_API
+octave_fcn_inline : public octave_fcn_handle
+{
+public:
+
+  octave_fcn_inline (void)
+    : octave_fcn_handle (), iftext (), ifargs () { }
+
+  octave_fcn_inline (const std::string& f, const string_vector& a,
+                     const std::string& n = std::string ());
+
+  octave_fcn_inline (const octave_fcn_inline& fi)
+    : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { }
+
+  ~octave_fcn_inline (void) { }
+
+  octave_base_value *clone (void) const { return new octave_fcn_inline (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_fcn_inline (); }
+
+  bool is_inline_function (void) const { return true; }
+
+  octave_fcn_inline *fcn_inline_value (bool = false) { return this; }
+
+  std::string fcn_text (void) const { return iftext; }
+
+  string_vector fcn_arg_names (void) const { return ifargs; }
+
+  octave_value convert_to_str_internal (bool, bool, char) const;
+
+  octave_map map_value (void) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+
+  // The expression of an inline function.
+  std::string iftext;
+
+  // The args of an inline function.
+  string_vector ifargs;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-fcn.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,45 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "oct-obj.h"
+#include "ov-fcn.h"
+
+DEFINE_OCTAVE_ALLOCATOR (octave_function);
+
+octave_base_value *
+octave_function::clone (void) const
+{
+  panic_impossible ();
+  return 0;
+}
+
+octave_base_value *
+octave_function::empty_clone (void) const
+{
+  panic_impossible ();
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-fcn.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,193 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_function_h)
+#define octave_function_h 1
+
+#include <string>
+
+#include "oct-time.h"
+#include "str-vec.h"
+
+#include "oct-alloc.h"
+#include "oct-obj.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+#include "symtab.h"
+
+class tree_walker;
+
+// Functions.
+
+class
+OCTINTERP_API
+octave_function : public octave_base_value
+{
+public:
+
+  octave_function (void)
+    : relative (false), locked (false), private_function (false),
+      xdispatch_class (), my_name (), my_dir_name (), doc () { }
+
+  ~octave_function (void) { }
+
+  octave_base_value *clone (void) const;
+  octave_base_value *empty_clone (void) const;
+
+  bool is_defined (void) const { return true; }
+
+  bool is_function (void) const { return true; }
+
+  virtual bool is_system_fcn_file (void) const { return false; }
+
+  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 (); }
+
+  virtual std::string parent_fcn_name (void) const { return std::string (); }
+
+  virtual symbol_table::scope_id parent_fcn_scope (void) const { return -1; }
+
+  virtual void mark_fcn_file_up_to_date (const octave_time&) { }
+
+  virtual symbol_table::scope_id scope (void) { return -1; }
+
+  virtual octave_time time_parsed (void) const
+    { return octave_time (static_cast<time_t> (0)); }
+
+  virtual octave_time time_checked (void) const
+    { return octave_time (static_cast<time_t> (0)); }
+
+  virtual bool is_subfunction (void) const { return false; }
+
+  virtual bool is_class_constructor (const std::string& = std::string ()) const
+    { return false; }
+
+  virtual bool is_class_method (const std::string& = std::string ()) const
+    { return false; }
+
+  virtual bool takes_varargs (void) const { return false; }
+
+  virtual bool takes_var_return (void) const { return false; }
+
+  void stash_dispatch_class (const std::string& nm) { xdispatch_class = nm; }
+
+  std::string dispatch_class (void) const { return xdispatch_class; }
+
+  virtual void
+  mark_as_private_function (const std::string& cname = std::string ())
+  {
+    private_function = true;
+    xdispatch_class = cname;
+  }
+
+  bool is_private_function (void) const { return private_function; }
+
+  bool is_private_function_of_class (const std::string& nm) const
+    { return private_function && xdispatch_class == nm; }
+
+  virtual bool
+  is_anonymous_function_of_class (const std::string& = std::string ()) const
+    { return false; }
+
+  std::string dir_name (void) const { return my_dir_name; }
+
+  void stash_dir_name (const std::string& dir) { my_dir_name = dir; }
+
+  void lock (void)
+  {
+    this->lock_subfunctions ();
+    locked = true;
+  }
+
+  void unlock (void)
+  {
+    this->unlock_subfunctions ();
+    locked = false;
+  }
+
+  bool islocked (void) const { return locked; }
+
+  virtual void lock_subfunctions (void) { }
+
+  virtual void unlock_subfunctions (void) { }
+
+  void mark_relative (void) { relative = true; }
+
+  bool is_relative (void) const { return relative; }
+
+  std::string name (void) const { return my_name; }
+
+  void document (const std::string& ds) { doc = ds; }
+
+  std::string doc_string (void) const { return doc; }
+
+  virtual void unload (void) { }
+
+  virtual void accept (tree_walker&) { }
+
+protected:
+
+  octave_function (const std::string& nm,
+                   const std::string& ds = std::string ())
+    : relative (false), locked (false), private_function (false),
+      xdispatch_class (), my_name (nm), my_dir_name (), doc (ds) { }
+
+  // TRUE if this function was found from a relative path element.
+  bool relative;
+
+  // TRUE if this function is tagged so that it can't be cleared.
+  bool locked;
+
+  // TRUE means this is a private function.
+  bool private_function;
+
+  // If this object is a class method or constructor, or a private
+  // function inside a class directory, this is the name of the class
+  // to which the method belongs.
+  std::string xdispatch_class;
+
+  // The name of this function.
+  std::string my_name;
+
+  // The name of the directory in the path where we found this
+  // function.  May be relative.
+  std::string my_dir_name;
+
+  // The help text for this function.
+  std::string doc;
+
+private:
+
+  // No copying!
+
+  octave_function (const octave_function& f);
+
+  octave_function& operator = (const octave_function& f);
+
+  DECLARE_OCTAVE_ALLOCATOR
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-float.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,346 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "data-conv.h"
+#include "mach-info.h"
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-stream.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-base.h"
+#include "ov-base-scalar.h"
+#include "ov-base-scalar.cc"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "pr-output.h"
+#include "xdiv.h"
+#include "xpow.h"
+#include "ops.h"
+
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+
+template class octave_base_scalar<float>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_float_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_scalar, "float scalar", "single");
+
+octave_value
+octave_float_scalar::do_index_op (const octave_value_list& idx, bool resize_ok)
+{
+  // FIXME -- this doesn't solve the problem of
+  //
+  //   a = 1; a([1,1], [1,1], [1,1])
+  //
+  // and similar constructions.  Hmm...
+
+  // FIXME -- using this constructor avoids narrowing the
+  // 1x1 matrix back to a scalar value.  Need a better solution
+  // to this problem.
+
+  octave_value tmp (new octave_float_matrix (float_matrix_value ()));
+
+  return tmp.do_index_op (idx, resize_ok);
+}
+
+octave_value
+octave_float_scalar::resize (const dim_vector& dv, bool fill) const
+{
+  if (fill)
+    {
+      FloatNDArray retval (dv, 0);
+
+      if (dv.numel ())
+        retval(0) = scalar;
+
+      return retval;
+    }
+  else
+    {
+      FloatNDArray retval (dv);
+
+      if (dv.numel ())
+        retval(0) = scalar;
+
+      return retval;
+    }
+}
+
+octave_value
+octave_float_scalar::diag (octave_idx_type m, octave_idx_type n) const
+{
+  return FloatDiagMatrix (Array<float> (dim_vector (1, 1), scalar), m, n);
+}
+
+octave_value
+octave_float_scalar::convert_to_str_internal (bool, bool, char type) const
+{
+  octave_value retval;
+
+  if (xisnan (scalar))
+    gripe_nan_to_character_conversion ();
+  else
+    {
+      int ival = NINT (scalar);
+
+      if (ival < 0 || ival > UCHAR_MAX)
+        {
+          // FIXME -- is there something better we could do?
+
+          ival = 0;
+
+          ::warning ("range error for conversion to character value");
+        }
+
+      retval = octave_value (std::string (1, static_cast<char> (ival)), type);
+    }
+
+  return retval;
+}
+
+bool
+octave_float_scalar::save_ascii (std::ostream& os)
+{
+  float d = float_value ();
+
+  octave_write_float (os, d);
+
+  os << "\n";
+
+  return true;
+}
+
+bool
+octave_float_scalar::load_ascii (std::istream& is)
+{
+  scalar = octave_read_value<float> (is);
+  if (!is)
+    {
+      error ("load: failed to load scalar constant");
+      return false;
+    }
+
+  return true;
+}
+
+bool
+octave_float_scalar::save_binary (std::ostream& os, bool& /* save_as_floats */)
+{
+  char tmp = LS_FLOAT;
+  os.write (reinterpret_cast<char *> (&tmp), 1);
+  float dtmp = float_value ();
+  os.write (reinterpret_cast<char *> (&dtmp), 4);
+
+  return true;
+}
+
+bool
+octave_float_scalar::load_binary (std::istream& is, bool swap,
+                            oct_mach_info::float_format fmt)
+{
+  char tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+    return false;
+
+  float dtmp;
+  read_floats (is, &dtmp, static_cast<save_type> (tmp), 1, swap, fmt);
+  if (error_state || ! is)
+    return false;
+
+  scalar = dtmp;
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_float_scalar::save_hdf5 (hid_t loc_id, const char *name,
+                          bool /* save_as_floats */)
+{
+  hsize_t dimens[3];
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+
+  space_hid = H5Screate_simple (0, dimens, 0);
+  if (space_hid < 0) return false;
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  float tmp = float_value ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &tmp) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_float_scalar::load_hdf5 (hid_t loc_id, const char *name)
+{
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  float dtmp;
+  if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, &dtmp) < 0)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  scalar = dtmp;
+
+  H5Dclose (data_hid);
+
+  return true;
+}
+
+#endif
+
+mxArray *
+octave_float_scalar::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxSINGLE_CLASS, 1, 1, mxREAL);
+
+  float *pr = static_cast<float *> (retval->get_data ());
+
+  pr[0] = scalar;
+
+  return retval;
+}
+
+octave_value
+octave_float_scalar::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_imag:
+      return 0.0f;
+
+    case umap_real:
+    case umap_conj:
+      return scalar;
+
+#define SCALAR_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (FCN (scalar))
+
+      SCALAR_MAPPER (abs, ::fabsf);
+      SCALAR_MAPPER (acos, rc_acos);
+      SCALAR_MAPPER (acosh, rc_acosh);
+      SCALAR_MAPPER (angle, ::arg);
+      SCALAR_MAPPER (arg, ::arg);
+      SCALAR_MAPPER (asin, rc_asin);
+      SCALAR_MAPPER (asinh, ::asinhf);
+      SCALAR_MAPPER (atan, ::atanf);
+      SCALAR_MAPPER (atanh, rc_atanh);
+      SCALAR_MAPPER (erf, ::erff);
+      SCALAR_MAPPER (erfinv, ::erfinv);
+      SCALAR_MAPPER (erfcinv, ::erfcinv);
+      SCALAR_MAPPER (erfc, ::erfcf);
+      SCALAR_MAPPER (erfcx, ::erfcx);
+      SCALAR_MAPPER (gamma, xgamma);
+      SCALAR_MAPPER (lgamma, rc_lgamma);
+      SCALAR_MAPPER (cbrt, ::cbrtf);
+      SCALAR_MAPPER (ceil, ::ceilf);
+      SCALAR_MAPPER (cos, ::cosf);
+      SCALAR_MAPPER (cosh, ::coshf);
+      SCALAR_MAPPER (exp, ::expf);
+      SCALAR_MAPPER (expm1, ::expm1f);
+      SCALAR_MAPPER (fix, ::fix);
+      SCALAR_MAPPER (floor, ::floorf);
+      SCALAR_MAPPER (log, rc_log);
+      SCALAR_MAPPER (log2, rc_log2);
+      SCALAR_MAPPER (log10, rc_log10);
+      SCALAR_MAPPER (log1p, rc_log1p);
+      SCALAR_MAPPER (round, xround);
+      SCALAR_MAPPER (roundb, xroundb);
+      SCALAR_MAPPER (signum, ::signum);
+      SCALAR_MAPPER (sin, ::sinf);
+      SCALAR_MAPPER (sinh, ::sinhf);
+      SCALAR_MAPPER (sqrt, rc_sqrt);
+      SCALAR_MAPPER (tan, ::tanf);
+      SCALAR_MAPPER (tanh, ::tanhf);
+      SCALAR_MAPPER (finite, xfinite);
+      SCALAR_MAPPER (isinf, xisinf);
+      SCALAR_MAPPER (isna, octave_is_NA);
+      SCALAR_MAPPER (isnan, xisnan);
+
+    default:
+      return octave_base_value::map (umap);
+    }
+}
+
+bool
+octave_float_scalar::fast_elem_insert_self (void *where, builtin_type_t btyp) const
+{
+
+  // Support inline real->complex conversion.
+  if (btyp == btyp_float)
+    {
+      *(reinterpret_cast<float *>(where)) = scalar;
+      return true;
+    }
+  else if (btyp == btyp_float_complex)
+    {
+      *(reinterpret_cast<FloatComplex *>(where)) = scalar;
+      return true;
+    }
+  else
+    return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-float.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,258 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_float_h)
+#define octave_float_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "lo-ieee.h"
+#include "lo-mappers.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "gripes.h"
+#include "ov-base.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-base-scalar.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Real scalar values.
+
+class
+OCTINTERP_API
+octave_float_scalar : public octave_base_scalar<float>
+{
+public:
+
+  octave_float_scalar (void)
+    : octave_base_scalar<float> (0.0) { }
+
+  octave_float_scalar (float d)
+    : octave_base_scalar<float> (d) { }
+
+  octave_float_scalar (const octave_float_scalar& s)
+    : octave_base_scalar<float> (s) { }
+
+  ~octave_float_scalar (void) { }
+
+  octave_base_value *clone (void) const { return new octave_float_scalar (*this); }
+
+  // We return an octave_matrix here instead of an octave_float_scalar so
+  // that in expressions like A(2,2,2) = 2 (for A previously
+  // undefined), A will be empty instead of a 1x1 object.
+  octave_base_value *empty_clone (void) const { return new octave_float_matrix (); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  idx_vector index_vector (void) const { return idx_vector (scalar); }
+
+  octave_value any (int = 0) const
+    { return (scalar != 0 && ! lo_ieee_isnan (scalar)); }
+
+  builtin_type_t builtin_type (void) const { return btyp_float; }
+
+  bool is_real_scalar (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_single_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  int8NDArray
+  int8_array_value (void) const
+    { return int8NDArray (dim_vector (1, 1), scalar); }
+
+  int16NDArray
+  int16_array_value (void) const
+    { return int16NDArray (dim_vector (1, 1), scalar); }
+
+  int32NDArray
+  int32_array_value (void) const
+    { return int32NDArray (dim_vector (1, 1), scalar); }
+
+  int64NDArray
+  int64_array_value (void) const
+    { return int64NDArray (dim_vector (1, 1), scalar); }
+
+  uint8NDArray
+  uint8_array_value (void) const
+    { return uint8NDArray (dim_vector (1, 1), scalar); }
+
+  uint16NDArray
+  uint16_array_value (void) const
+    { return uint16NDArray (dim_vector (1, 1), scalar); }
+
+  uint32NDArray
+  uint32_array_value (void) const
+    { return uint32NDArray (dim_vector (1, 1), scalar); }
+
+  uint64NDArray
+  uint64_array_value (void) const
+    { return uint64NDArray (dim_vector (1, 1), scalar); }
+
+#define DEFINE_INT_SCALAR_VALUE(TYPE) \
+  octave_ ## TYPE \
+  TYPE ## _scalar_value (void) const \
+    { return octave_ ## TYPE (scalar); }
+
+  DEFINE_INT_SCALAR_VALUE (int8)
+  DEFINE_INT_SCALAR_VALUE (int16)
+  DEFINE_INT_SCALAR_VALUE (int32)
+  DEFINE_INT_SCALAR_VALUE (int64)
+  DEFINE_INT_SCALAR_VALUE (uint8)
+  DEFINE_INT_SCALAR_VALUE (uint16)
+  DEFINE_INT_SCALAR_VALUE (uint32)
+  DEFINE_INT_SCALAR_VALUE (uint64)
+
+#undef DEFINE_INT_SCALAR_VALUE
+
+  double double_value (bool = false) const { return static_cast<double> (scalar); }
+
+  float float_value (bool = false) const { return scalar; }
+
+  double scalar_value (bool = false) const { return static_cast<double> (scalar); }
+
+  float float_scalar_value (bool = false) const { return scalar; }
+
+  Matrix matrix_value (bool = false) const
+    { return Matrix (1, 1, scalar); }
+
+  FloatMatrix float_matrix_value (bool = false) const
+    { return FloatMatrix (1, 1, scalar); }
+
+  NDArray array_value (bool = false) const
+    { return NDArray (dim_vector (1, 1), scalar); }
+
+  FloatNDArray float_array_value (bool = false) const
+    { return FloatNDArray (dim_vector (1, 1), scalar); }
+
+  SparseMatrix sparse_matrix_value (bool = false) const
+    { return SparseMatrix (Matrix (1, 1, scalar)); }
+
+  // FIXME Need SparseComplexMatrix (Matrix) constructor!!!
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+    { return SparseComplexMatrix (sparse_matrix_value ()); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+  Complex complex_value (bool = false) const { return scalar; }
+
+  FloatComplex float_complex_value (bool = false) const { return scalar; }
+
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return  ComplexMatrix (1, 1, Complex (scalar)); }
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const
+    { return  FloatComplexMatrix (1, 1, FloatComplex (scalar)); }
+
+  ComplexNDArray complex_array_value (bool = false) const
+    { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); }
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const
+    { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); }
+
+  charNDArray
+  char_array_value (bool = false) const
+  {
+    charNDArray retval (dim_vector (1, 1));
+    retval(0) = static_cast<char> (scalar);
+    return retval;
+  }
+
+  bool bool_value (bool warn = false) const
+  {
+    if (xisnan (scalar))
+      gripe_nan_to_logical_conversion ();
+    else if (warn && scalar != 0 && scalar != 1)
+      gripe_logical_conversion ();
+
+    return scalar;
+  }
+
+  boolNDArray bool_array_value (bool warn = false) const
+  {
+    if (xisnan (scalar))
+      gripe_nan_to_logical_conversion ();
+    else if (warn && scalar != 0 && scalar != 1)
+      gripe_logical_conversion ();
+
+    return boolNDArray (dim_vector (1, 1), scalar);
+  }
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  void increment (void) { ++scalar; }
+
+  void decrement (void) { --scalar; }
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      return os.write (array_value (), block_size, output_type,
+                       skip, flt_fmt);
+    }
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+  bool fast_elem_insert_self (void *where, builtin_type_t btyp) const;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-complex.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,448 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+
+#include "oct-obj.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-complex.h"
+#include "ov-base.h"
+#include "ov-base-scalar.h"
+#include "ov-base-scalar.cc"
+#include "ov-flt-cx-mat.h"
+#include "ov-float.h"
+#include "ov-flt-complex.h"
+#include "gripes.h"
+#include "pr-output.h"
+#include "ops.h"
+
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+
+template class octave_base_scalar<FloatComplex>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_float_complex);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex,
+                                     "float complex scalar", "single");
+
+octave_base_value *
+octave_float_complex::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  float im = std::imag (scalar);
+
+  if (im == 0.0)
+    retval = new octave_float_scalar (std::real (scalar));
+
+  return retval;
+}
+
+octave_value
+octave_float_complex::do_index_op (const octave_value_list& idx, bool resize_ok)
+{
+  // FIXME -- this doesn't solve the problem of
+  //
+  //   a = i; a([1,1], [1,1], [1,1])
+  //
+  // and similar constructions.  Hmm...
+
+  // FIXME -- using this constructor avoids narrowing the
+  // 1x1 matrix back to a scalar value.  Need a better solution
+  // to this problem.
+
+  octave_value tmp (new octave_float_complex_matrix (float_complex_matrix_value ()));
+
+  return tmp.do_index_op (idx, resize_ok);
+}
+
+double
+octave_float_complex::double_value (bool force_conversion) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real scalar");
+
+  retval = std::real (scalar);
+
+  return retval;
+}
+
+float
+octave_float_complex::float_value (bool force_conversion) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real scalar");
+
+  retval = std::real (scalar);
+
+  return retval;
+}
+
+Matrix
+octave_float_complex::matrix_value (bool force_conversion) const
+{
+  Matrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real matrix");
+
+  retval = Matrix (1, 1, std::real (scalar));
+
+  return retval;
+}
+
+FloatMatrix
+octave_float_complex::float_matrix_value (bool force_conversion) const
+{
+  FloatMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real matrix");
+
+  retval = FloatMatrix (1, 1, std::real (scalar));
+
+  return retval;
+}
+
+NDArray
+octave_float_complex::array_value (bool force_conversion) const
+{
+  NDArray retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real matrix");
+
+  retval = NDArray (dim_vector (1, 1), std::real (scalar));
+
+  return retval;
+}
+
+FloatNDArray
+octave_float_complex::float_array_value (bool force_conversion) const
+{
+  FloatNDArray retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex scalar", "real matrix");
+
+  retval = FloatNDArray (dim_vector (1, 1), std::real (scalar));
+
+  return retval;
+}
+
+Complex
+octave_float_complex::complex_value (bool) const
+{
+  return scalar;
+}
+
+FloatComplex
+octave_float_complex::float_complex_value (bool) const
+{
+  return static_cast<FloatComplex> (scalar);
+}
+
+ComplexMatrix
+octave_float_complex::complex_matrix_value (bool) const
+{
+  return ComplexMatrix (1, 1, scalar);
+}
+
+FloatComplexMatrix
+octave_float_complex::float_complex_matrix_value (bool) const
+{
+  return FloatComplexMatrix (1, 1, scalar);
+}
+
+ComplexNDArray
+octave_float_complex::complex_array_value (bool /* force_conversion */) const
+{
+  return ComplexNDArray (dim_vector (1, 1), scalar);
+}
+
+FloatComplexNDArray
+octave_float_complex::float_complex_array_value (bool /* force_conversion */) const
+{
+  return FloatComplexNDArray (dim_vector (1, 1), scalar);
+}
+
+octave_value
+octave_float_complex::resize (const dim_vector& dv, bool fill) const
+{
+  if (fill)
+    {
+      FloatComplexNDArray retval (dv, FloatComplex (0));
+
+      if (dv.numel ())
+        retval(0) = scalar;
+
+      return retval;
+    }
+  else
+    {
+      FloatComplexNDArray retval (dv);
+
+      if (dv.numel ())
+        retval(0) = scalar;
+
+      return retval;
+    }
+}
+
+octave_value
+octave_float_complex::diag (octave_idx_type m, octave_idx_type n) const
+{
+  return FloatComplexDiagMatrix (Array<FloatComplex> (dim_vector (1, 1), scalar), m, n);
+}
+
+bool
+octave_float_complex::save_ascii (std::ostream& os)
+{
+  FloatComplex c = float_complex_value ();
+
+  octave_write_float_complex (os, c);
+
+  os << "\n";
+
+  return true;
+}
+
+bool
+octave_float_complex::load_ascii (std::istream& is)
+{
+  scalar = octave_read_value<FloatComplex> (is);
+
+  if (!is)
+    {
+      error ("load: failed to load complex scalar constant");
+      return false;
+    }
+
+  return true;
+}
+
+
+bool
+octave_float_complex::save_binary (std::ostream& os, bool& /* save_as_floats */)
+{
+  char tmp = static_cast<char> (LS_FLOAT);
+  os.write (reinterpret_cast<char *> (&tmp), 1);
+  FloatComplex ctmp = float_complex_value ();
+  os.write (reinterpret_cast<char *> (&ctmp), 8);
+
+  return true;
+}
+
+bool
+octave_float_complex::load_binary (std::istream& is, bool swap,
+                             oct_mach_info::float_format fmt)
+{
+  char tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+    return false;
+
+  FloatComplex ctmp;
+  read_floats (is, reinterpret_cast<float *> (&ctmp),
+                static_cast<save_type> (tmp), 2, swap, fmt);
+  if (error_state || ! is)
+    return false;
+
+  scalar = ctmp;
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_float_complex::save_hdf5 (hid_t loc_id, const char *name,
+                           bool /* save_as_floats */)
+{
+  hsize_t dimens[3];
+  hid_t space_hid = -1, type_hid = -1, data_hid = -1;
+  bool retval = true;
+
+  space_hid = H5Screate_simple (0, dimens, 0);
+  if (space_hid < 0)
+    return false;
+
+  type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
+  if (type_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      return false;
+    }
+
+  FloatComplex tmp = float_complex_value ();
+  retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                     &tmp) >= 0;
+
+  H5Dclose (data_hid);
+  H5Tclose (type_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_float_complex::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t type_hid = H5Dget_type (data_hid);
+
+  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
+
+  if (! hdf5_types_compatible (type_hid, complex_type))
+    {
+      H5Tclose (complex_type);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  hid_t space_id = H5Dget_space (data_hid);
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank != 0)
+    {
+      H5Tclose (complex_type);
+      H5Sclose (space_id);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  // complex scalar:
+  FloatComplex ctmp;
+  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+               &ctmp) >= 0)
+    {
+      retval = true;
+      scalar = ctmp;
+    }
+
+  H5Tclose (complex_type);
+  H5Sclose (space_id);
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_float_complex::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxSINGLE_CLASS, 1, 1, mxCOMPLEX);
+
+  float *pr = static_cast<float *> (retval->get_data ());
+  float *pi = static_cast<float *> (retval->get_imag_data ());
+
+  pr[0] = std::real (scalar);
+  pi[0] = std::imag (scalar);
+
+  return retval;
+}
+
+octave_value
+octave_float_complex::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+#define SCALAR_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (FCN (scalar))
+
+      SCALAR_MAPPER (abs, std::abs);
+      SCALAR_MAPPER (acos, ::acos);
+      SCALAR_MAPPER (acosh, ::acosh);
+      SCALAR_MAPPER (angle, std::arg);
+      SCALAR_MAPPER (arg, std::arg);
+      SCALAR_MAPPER (asin, ::asin);
+      SCALAR_MAPPER (asinh, ::asinh);
+      SCALAR_MAPPER (atan, ::atan);
+      SCALAR_MAPPER (atanh, ::atanh);
+      SCALAR_MAPPER (ceil, ::ceil);
+      SCALAR_MAPPER (conj, std::conj);
+      SCALAR_MAPPER (cos, std::cos);
+      SCALAR_MAPPER (cosh, std::cosh);
+      SCALAR_MAPPER (exp, std::exp);
+      SCALAR_MAPPER (expm1, ::expm1);
+      SCALAR_MAPPER (fix, ::fix);
+      SCALAR_MAPPER (floor, ::floor);
+      SCALAR_MAPPER (imag, std::imag);
+      SCALAR_MAPPER (log, std::log);
+      SCALAR_MAPPER (log2, xlog2);
+      SCALAR_MAPPER (log10, std::log10);
+      SCALAR_MAPPER (log1p, ::log1p);
+      SCALAR_MAPPER (real, std::real);
+      SCALAR_MAPPER (round, xround);
+      SCALAR_MAPPER (roundb, xroundb);
+      SCALAR_MAPPER (signum, ::signum);
+      SCALAR_MAPPER (sin, std::sin);
+      SCALAR_MAPPER (sinh, std::sinh);
+      SCALAR_MAPPER (sqrt, std::sqrt);
+      SCALAR_MAPPER (tan, std::tan);
+      SCALAR_MAPPER (tanh, std::tanh);
+      SCALAR_MAPPER (finite, xfinite);
+      SCALAR_MAPPER (isinf, xisinf);
+      SCALAR_MAPPER (isna, octave_is_NA);
+      SCALAR_MAPPER (isnan, xisnan);
+
+    default:
+      return octave_base_value::map (umap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-complex.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,198 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_float_complex_h)
+#define octave_float_complex_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "lo-ieee.h"
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "gripes.h"
+#include "error.h"
+#include "ov-base.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-base-scalar.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Complex scalar values.
+
+class
+OCTINTERP_API
+octave_float_complex : public octave_base_scalar<FloatComplex>
+{
+public:
+
+  octave_float_complex (void)
+    : octave_base_scalar<FloatComplex> () { }
+
+  octave_float_complex (const FloatComplex& c)
+    : octave_base_scalar<FloatComplex> (c) { }
+
+  octave_float_complex (const octave_float_complex& c)
+    : octave_base_scalar<FloatComplex> (c) { }
+
+  ~octave_float_complex (void) { }
+
+  octave_base_value *clone (void) const { return new octave_float_complex (*this); }
+
+  // We return an octave_float_complex_matrix object here instead of an
+  // octave_float_complex object so that in expressions like A(2,2,2) = 2
+  // (for A previously undefined), A will be empty instead of a 1x1
+  // object.
+  octave_base_value *empty_clone (void) const
+    { return new octave_float_complex_matrix (); }
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  octave_value any (int = 0) const
+    {
+      return (scalar != FloatComplex (0, 0)
+              && ! (lo_ieee_isnan (std::real (scalar))
+                    || lo_ieee_isnan (std::imag (scalar))));
+    }
+
+  builtin_type_t builtin_type (void) const { return btyp_float_complex; }
+
+  bool is_complex_scalar (void) const { return true; }
+
+  bool is_complex_type (void) const { return true; }
+
+  bool is_single_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  float float_scalar_value (bool frc_str_conv = false) const
+    { return float_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  FloatMatrix float_matrix_value (bool = false) const;
+
+  NDArray array_value (bool = false) const;
+
+  FloatNDArray float_array_value (bool = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const
+    { return SparseMatrix (matrix_value ()); }
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+    { return SparseComplexMatrix (complex_matrix_value ()); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  bool bool_value (bool warn = false) const
+  {
+    if (xisnan (scalar))
+      gripe_nan_to_logical_conversion ();
+    else if (warn && scalar != 0.0f && scalar != 1.0f)
+      gripe_logical_conversion ();
+
+    return scalar != 0.0f;
+  }
+
+  boolNDArray bool_array_value (bool warn = false) const
+  {
+    if (xisnan (scalar))
+      gripe_nan_to_logical_conversion ();
+    else if (warn && scalar != 0.0f && scalar != 1.0f)
+      gripe_logical_conversion ();
+
+    return boolNDArray (dim_vector (1, 1), scalar != 1.0f);
+  }
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  void increment (void) { scalar += 1.0; }
+
+  void decrement (void) { scalar -= 1.0; }
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      // Yes, for compatibility, we drop the imaginary part here.
+      return os.write (array_value (true), block_size, output_type,
+                       skip, flt_fmt);
+    }
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+typedef octave_float_complex octave_float_complex_scalar;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-cx-diag.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,207 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "byte-swap.h"
+
+#include "ov-flt-cx-diag.h"
+#include "ov-base-diag.cc"
+#include "ov-flt-re-diag.h"
+#include "ov-flt-complex.h"
+#include "ov-flt-cx-mat.h"
+#include "ls-utils.h"
+
+template class octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_float_complex_diag_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_diag_matrix,
+                                     "float complex diagonal matrix", "single");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_float_complex_diag_matrix&);
+
+  return new octave_float_complex_matrix (v.float_complex_matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_float_complex_diag_matrix::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_float_complex_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_float_complex_diag_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.nelem () == 1)
+    {
+      retval = new octave_float_complex (matrix (0, 0));
+      octave_base_value *rv2 = retval->try_narrowing_conversion ();
+      if (rv2)
+        {
+          delete retval;
+          retval = rv2;
+        }
+    }
+  else if (matrix.all_elements_are_real ())
+    {
+      return new octave_float_diag_matrix (::real (matrix));
+    }
+
+  return retval;
+}
+
+DiagMatrix
+octave_float_complex_diag_matrix::diag_matrix_value (bool force_conversion) const
+{
+  DiagMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               type_name (), "real matrix");
+
+  retval = ::real (matrix);
+
+  return retval;
+}
+
+FloatDiagMatrix
+octave_float_complex_diag_matrix::float_diag_matrix_value (bool force_conversion) const
+{
+  DiagMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               type_name (), "real matrix");
+
+  retval = ::real (matrix);
+
+  return retval;
+}
+
+ComplexDiagMatrix
+octave_float_complex_diag_matrix::complex_diag_matrix_value (bool) const
+{
+  return ComplexDiagMatrix (matrix);
+}
+
+FloatComplexDiagMatrix
+octave_float_complex_diag_matrix::float_complex_diag_matrix_value (bool) const
+{
+  return matrix;
+}
+
+octave_value
+octave_float_complex_diag_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_abs:
+      return matrix.abs ();
+    case umap_real:
+      return ::real (matrix);
+    case umap_conj:
+      return ::conj (matrix);
+    case umap_imag:
+      return ::imag (matrix);
+    case umap_sqrt:
+      {
+        FloatComplexColumnVector tmp = matrix.diag ().map<FloatComplex> (std::sqrt);
+        FloatComplexDiagMatrix retval (tmp);
+        retval.resize (matrix.rows (), matrix.columns ());
+        return retval;
+      }
+    default:
+      return to_dense ().map (umap);
+    }
+}
+
+
+bool
+octave_float_complex_diag_matrix::save_binary (std::ostream& os,
+                                               bool& /* save_as_floats */)
+{
+
+  int32_t r = matrix.rows (), c = matrix.cols ();
+  os.write (reinterpret_cast<char *> (&r), 4);
+  os.write (reinterpret_cast<char *> (&c), 4);
+
+  FloatComplexMatrix m = FloatComplexMatrix (matrix.diag ());
+  save_type st = LS_FLOAT;
+  if (matrix.length () > 4096) // FIXME -- make this configurable.
+    {
+      float max_val, min_val;
+      if (m.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  const FloatComplex *mtmp = m.data ();
+  write_floats (os, reinterpret_cast<const float *> (mtmp), st, 2 * m.numel ());
+
+  return true;
+}
+
+bool
+octave_float_complex_diag_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format fmt)
+{
+  int32_t r, c;
+  char tmp;
+  if (! (is.read (reinterpret_cast<char *> (&r), 4)
+         && is.read (reinterpret_cast<char *> (&c), 4)
+         && is.read (reinterpret_cast<char *> (&tmp), 1)))
+    return false;
+  if (swap)
+    {
+      swap_bytes<4> (&r);
+      swap_bytes<4> (&c);
+    }
+
+  FloatComplexDiagMatrix m (r, c);
+  FloatComplex *re = m.fortran_vec ();
+  octave_idx_type len = m.length ();
+  read_floats (is, reinterpret_cast<float *> (re),
+               static_cast<save_type> (tmp), 2 * len, swap, fmt);
+  if (error_state || ! is)
+    return false;
+  matrix = m;
+
+  return true;
+}
+
+bool
+octave_float_complex_diag_matrix::chk_valid_scalar (const octave_value& val,
+                                                    FloatComplex& x) const
+{
+  bool retval = val.is_complex_scalar () || val.is_real_scalar ();
+  if (retval)
+    x = val.float_complex_value ();
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-cx-diag.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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_float_complex_diag_matrix_h)
+#define octave_float_complex_diag_matrix_h 1
+
+#include "ov-base.h"
+#include "ov-base-diag.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+
+// Real diagonal matrix values.
+
+class
+OCTINTERP_API
+octave_float_complex_diag_matrix
+  : public octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix>
+{
+public:
+
+  octave_float_complex_diag_matrix (void)
+    : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> () { }
+
+  octave_float_complex_diag_matrix (const FloatComplexDiagMatrix& m)
+    : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> (m) { }
+
+  octave_float_complex_diag_matrix (const octave_float_complex_diag_matrix& m)
+    : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> (m) { }
+
+  ~octave_float_complex_diag_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_float_complex_diag_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_float_complex_diag_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  builtin_type_t builtin_type (void) const { return btyp_float_complex; }
+
+  bool is_complex_matrix (void) const { return true; }
+
+  bool is_complex_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  DiagMatrix diag_matrix_value (bool = false) const;
+
+  FloatDiagMatrix float_diag_matrix_value (bool = false) const;
+
+  ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
+
+  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  bool chk_valid_scalar (const octave_value&,
+                         FloatComplex&) const;
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-cx-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,770 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <vector>
+
+#include "data-conv.h"
+#include "lo-ieee.h"
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+#include "mx-base.h"
+#include "mach-info.h"
+#include "oct-locbuf.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-mat.cc"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "pr-output.h"
+#include "ops.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+#include "ls-utils.h"
+
+template class octave_base_matrix<FloatComplexNDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_float_complex_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_matrix,
+                                     "float complex matrix", "single");
+
+octave_base_value *
+octave_float_complex_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.numel () == 1)
+    {
+      FloatComplex c = matrix (0);
+
+      if (std::imag (c) == 0.0)
+        retval = new octave_float_scalar (std::real (c));
+      else
+        retval = new octave_float_complex (c);
+    }
+  else if (matrix.all_elements_are_real ())
+    retval = new octave_float_matrix (::real (matrix));
+
+  return retval;
+}
+
+double
+octave_float_complex_matrix::double_value (bool force_conversion) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real scalar");
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "complex matrix", "real scalar");
+
+      retval = std::real (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("complex matrix", "real scalar");
+
+  return retval;
+}
+
+float
+octave_float_complex_matrix::float_value (bool force_conversion) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real scalar");
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "complex matrix", "real scalar");
+
+      retval = std::real (matrix (0, 0));
+    }
+  else
+    gripe_invalid_conversion ("complex matrix", "real scalar");
+
+  return retval;
+}
+
+Matrix
+octave_float_complex_matrix::matrix_value (bool force_conversion) const
+{
+  Matrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real matrix");
+
+  retval = ::real (matrix.matrix_value ());
+
+  return retval;
+}
+
+FloatMatrix
+octave_float_complex_matrix::float_matrix_value (bool force_conversion) const
+{
+  FloatMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real matrix");
+
+  retval = ::real (matrix.matrix_value ());
+
+  return retval;
+}
+
+Complex
+octave_float_complex_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "complex matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("complex matrix", "complex scalar");
+
+  return retval;
+}
+
+FloatComplex
+octave_float_complex_matrix::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "complex matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("complex matrix", "complex scalar");
+
+  return retval;
+}
+
+ComplexMatrix
+octave_float_complex_matrix::complex_matrix_value (bool) const
+{
+  return matrix.matrix_value ();
+}
+
+FloatComplexMatrix
+octave_float_complex_matrix::float_complex_matrix_value (bool) const
+{
+  return FloatComplexMatrix (matrix.matrix_value ());
+}
+
+boolNDArray
+octave_float_complex_matrix::bool_array_value (bool warn) const
+{
+  if (matrix.any_element_is_nan ())
+    gripe_nan_to_logical_conversion ();
+  else if (warn && (! matrix.all_elements_are_real ()
+                    || real (matrix).any_element_not_one_or_zero ()))
+    gripe_logical_conversion ();
+
+  return mx_el_ne (matrix, FloatComplex (0.0));
+}
+
+charNDArray
+octave_float_complex_matrix::char_array_value (bool frc_str_conv) const
+{
+  charNDArray retval;
+
+  if (! frc_str_conv)
+    gripe_implicit_conversion ("Octave:num-to-str",
+                               "complex matrix", "string");
+  else
+    {
+      retval = charNDArray (dims ());
+      octave_idx_type nel = numel ();
+
+      for (octave_idx_type i = 0; i < nel; i++)
+        retval.elem (i) = static_cast<char>(std::real (matrix.elem (i)));
+    }
+
+  return retval;
+}
+
+FloatComplexNDArray
+octave_float_complex_matrix::float_complex_array_value (bool) const
+{
+  return FloatComplexNDArray (matrix);
+}
+
+SparseMatrix
+octave_float_complex_matrix::sparse_matrix_value (bool force_conversion) const
+{
+  SparseMatrix retval;
+
+  if (! force_conversion)
+    gripe_implicit_conversion ("Octave:imag-to-real",
+                               "complex matrix", "real matrix");
+
+  retval = SparseMatrix (::real (complex_matrix_value ()));
+
+  return retval;
+}
+
+SparseComplexMatrix
+octave_float_complex_matrix::sparse_complex_matrix_value (bool) const
+{
+  return SparseComplexMatrix (complex_matrix_value ());
+}
+
+octave_value
+octave_float_complex_matrix::diag (octave_idx_type k) const
+{
+  octave_value retval;
+  if (k == 0 && matrix.ndims () == 2
+      && (matrix.rows () == 1 || matrix.columns () == 1))
+    retval = FloatComplexDiagMatrix (DiagArray2<FloatComplex> (matrix));
+  else
+    retval = octave_base_matrix<FloatComplexNDArray>::diag (k);
+
+  return retval;
+}
+
+octave_value
+octave_float_complex_matrix::diag (octave_idx_type m, octave_idx_type n) const
+{
+  octave_value retval;
+
+  if (matrix.ndims () == 2
+      && (matrix.rows () == 1 || matrix.columns () == 1))
+    {
+      FloatComplexMatrix mat = matrix.matrix_value ();
+
+      retval = mat.diag (m, n);
+    }
+  else
+    error ("diag: expecting vector argument");
+
+  return retval;
+}
+
+bool
+octave_float_complex_matrix::save_ascii (std::ostream& os)
+{
+  dim_vector d = dims ();
+  if (d.length () > 2)
+    {
+      FloatComplexNDArray tmp = complex_array_value ();
+
+      os << "# ndims: " << d.length () << "\n";
+
+      for (int i = 0; i < d.length (); i++)
+        os << " " << d (i);
+
+      os << "\n" << tmp;
+    }
+  else
+    {
+      // Keep this case, rather than use generic code above for backward
+      // compatiability. Makes load_ascii much more complex!!
+      os << "# rows: " << rows () << "\n"
+         << "# columns: " << columns () << "\n";
+
+      os << complex_matrix_value ();
+    }
+
+  return true;
+}
+
+bool
+octave_float_complex_matrix::load_ascii (std::istream& is)
+{
+  bool success = true;
+
+  string_vector keywords(2);
+
+  keywords[0] = "ndims";
+  keywords[1] = "rows";
+
+  std::string kw;
+  octave_idx_type val = 0;
+
+  if (extract_keyword (is, keywords, kw, val, true))
+    {
+      if (kw == "ndims")
+        {
+          int mdims = static_cast<int> (val);
+
+          if (mdims >= 0)
+            {
+              dim_vector dv;
+              dv.resize (mdims);
+
+              for (int i = 0; i < mdims; i++)
+                is >> dv(i);
+
+              if (is)
+                {
+                  FloatComplexNDArray tmp(dv);
+
+                  is >> tmp;
+
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else
+                {
+                  error ("load: failed to read dimensions");
+                  success = false;
+                }
+            }
+          else
+            {
+              error ("load: failed to extract number of dimensions");
+              success = false;
+            }
+        }
+      else if (kw == "rows")
+        {
+          octave_idx_type nr = val;
+          octave_idx_type nc = 0;
+
+          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
+            {
+              if (nr > 0 && nc > 0)
+                {
+                  FloatComplexMatrix tmp (nr, nc);
+                  is >> tmp;
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else if (nr == 0 || nc == 0)
+                matrix = FloatComplexMatrix (nr, nc);
+              else
+                panic_impossible ();
+            }
+          else
+            {
+              error ("load: failed to extract number of rows and columns");
+              success = false;
+            }
+        }
+      else
+        panic_impossible ();
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_float_complex_matrix::save_binary (std::ostream& os, bool&)
+{
+  dim_vector d = dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims to differentiate with old format!!
+  int32_t tmp = - d.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  for (int i = 0; i < d.length (); i++)
+    {
+      tmp = d(i);
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+    }
+
+  FloatComplexNDArray m = complex_array_value ();
+  save_type st = LS_FLOAT;
+  if (d.numel () > 4096) // FIXME -- make this configurable.
+    {
+      float max_val, min_val;
+      if (m.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  const FloatComplex *mtmp = m.data ();
+  write_floats (os, reinterpret_cast<const float *> (mtmp), st, 2 * d.numel ());
+
+  return true;
+}
+
+bool
+octave_float_complex_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format fmt)
+{
+  char tmp;
+  int32_t mdims;
+  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&mdims);
+  if (mdims < 0)
+    {
+      mdims = - mdims;
+      int32_t di;
+      dim_vector dv;
+      dv.resize (mdims);
+
+      for (int i = 0; i < mdims; i++)
+        {
+          if (! is.read (reinterpret_cast<char *> (&di), 4))
+            return false;
+          if (swap)
+            swap_bytes<4> (&di);
+          dv(i) = di;
+        }
+
+      // Convert an array with a single dimension to be a row vector.
+      // Octave should never write files like this, other software
+      // might.
+
+      if (mdims == 1)
+        {
+          mdims = 2;
+          dv.resize (mdims);
+          dv(1) = dv(0);
+          dv(0) = 1;
+        }
+
+      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+        return false;
+
+      FloatComplexNDArray m(dv);
+      FloatComplex *im = m.fortran_vec ();
+      read_floats (is, reinterpret_cast<float *> (im),
+                    static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  else
+    {
+      int32_t nr, nc;
+      nr = mdims;
+      if (! is.read (reinterpret_cast<char *> (&nc), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&nc);
+      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+        return false;
+      FloatComplexMatrix m (nr, nc);
+      FloatComplex *im = m.fortran_vec ();
+      octave_idx_type len = nr * nc;
+      read_floats (is, reinterpret_cast<float *> (im),
+                    static_cast<save_type> (tmp), 2*len, swap, fmt);
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_float_complex_matrix::save_hdf5 (hid_t loc_id, const char *name, bool)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  int rank = dv.length ();
+  hid_t space_hid = -1, data_hid = -1, type_hid = -1;
+  bool retval = true;
+  FloatComplexNDArray m = complex_array_value ();
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  for (int i = 0; i < rank; i++)
+    hdims[i] = dv (rank-i-1);
+
+  space_hid = H5Screate_simple (rank, hdims, 0);
+  if (space_hid < 0) return false;
+
+  hid_t save_type_hid = H5T_NATIVE_FLOAT;
+
+#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
+  // hdf5 currently doesn't support float/integer conversions
+  else
+    {
+      float max_val, min_val;
+
+      if (m.all_integers (max_val, min_val))
+        save_type_hid
+          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+    }
+#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
+
+  type_hid = hdf5_make_complex_type (save_type_hid);
+  if (type_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      return false;
+    }
+
+  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
+  if (complex_type_hid < 0) retval = false;
+
+  if (retval)
+    {
+      FloatComplex *mtmp = m.fortran_vec ();
+      if (H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                    mtmp) < 0)
+        {
+          H5Tclose (complex_type_hid);
+          retval = false;
+        }
+    }
+
+  H5Tclose (complex_type_hid);
+  H5Dclose (data_hid);
+  H5Tclose (type_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_float_complex_matrix::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+      return (empty > 0);
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t type_hid = H5Dget_type (data_hid);
+
+  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
+
+  if (! hdf5_types_compatible (type_hid, complex_type))
+    {
+      H5Tclose (complex_type);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank < 1)
+    {
+      H5Tclose (complex_type);
+      H5Sclose (space_id);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  if (rank == 1)
+    {
+      dv.resize (2);
+      dv(0) = 1;
+      dv(1) = hdims[0];
+    }
+  else
+    {
+      dv.resize (rank);
+      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
+        dv(j) = hdims[i];
+    }
+
+  FloatComplexNDArray m (dv);
+  FloatComplex *reim = m.fortran_vec ();
+  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+               reim) >= 0)
+    {
+      retval = true;
+      matrix = m;
+    }
+
+  H5Tclose (complex_type);
+  H5Sclose (space_id);
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+void
+octave_float_complex_matrix::print_raw (std::ostream& os,
+                                  bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, matrix, pr_as_read_syntax,
+                         current_print_indent_level ());
+}
+
+mxArray *
+octave_float_complex_matrix::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxSINGLE_CLASS, dims (), mxCOMPLEX);
+
+  float *pr = static_cast<float *> (retval->get_data ());
+  float *pi = static_cast<float *> (retval->get_imag_data ());
+
+  mwSize nel = numel ();
+
+  const FloatComplex *p = matrix.data ();
+
+  for (mwIndex i = 0; i < nel; i++)
+    {
+      pr[i] = std::real (p[i]);
+      pi[i] = std::imag (p[i]);
+    }
+
+  return retval;
+}
+
+octave_value
+octave_float_complex_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    // Mappers handled specially.
+    case umap_real:
+      return ::real (matrix);
+    case umap_imag:
+      return ::imag (matrix);
+    case umap_conj:
+      return ::conj (matrix);
+
+#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.FCN ())
+
+      ARRAY_METHOD_MAPPER (abs, abs);
+      ARRAY_METHOD_MAPPER (isnan, isnan);
+      ARRAY_METHOD_MAPPER (isinf, isinf);
+      ARRAY_METHOD_MAPPER (finite, isfinite);
+
+#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.map<TYPE> (FCN))
+
+      ARRAY_MAPPER (acos, FloatComplex, ::acos);
+      ARRAY_MAPPER (acosh, FloatComplex, ::acosh);
+      ARRAY_MAPPER (angle, float, std::arg);
+      ARRAY_MAPPER (arg, float, std::arg);
+      ARRAY_MAPPER (asin, FloatComplex, ::asin);
+      ARRAY_MAPPER (asinh, FloatComplex, ::asinh);
+      ARRAY_MAPPER (atan, FloatComplex, ::atan);
+      ARRAY_MAPPER (atanh, FloatComplex, ::atanh);
+      ARRAY_MAPPER (ceil, FloatComplex, ::ceil);
+      ARRAY_MAPPER (cos, FloatComplex, std::cos);
+      ARRAY_MAPPER (cosh, FloatComplex, std::cosh);
+      ARRAY_MAPPER (exp, FloatComplex, std::exp);
+      ARRAY_MAPPER (expm1, FloatComplex, ::expm1);
+      ARRAY_MAPPER (fix, FloatComplex, ::fix);
+      ARRAY_MAPPER (floor, FloatComplex, ::floor);
+      ARRAY_MAPPER (log, FloatComplex, std::log);
+      ARRAY_MAPPER (log2, FloatComplex, xlog2);
+      ARRAY_MAPPER (log10, FloatComplex, std::log10);
+      ARRAY_MAPPER (log1p, FloatComplex, ::log1p);
+      ARRAY_MAPPER (round, FloatComplex, xround);
+      ARRAY_MAPPER (roundb, FloatComplex, xroundb);
+      ARRAY_MAPPER (signum, FloatComplex, ::signum);
+      ARRAY_MAPPER (sin, FloatComplex, std::sin);
+      ARRAY_MAPPER (sinh, FloatComplex, std::sinh);
+      ARRAY_MAPPER (sqrt, FloatComplex, std::sqrt);
+      ARRAY_MAPPER (tan, FloatComplex, std::tan);
+      ARRAY_MAPPER (tanh, FloatComplex, std::tanh);
+      ARRAY_MAPPER (isna, bool, octave_is_NA);
+
+    default:
+      return octave_base_value::map (umap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-cx-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,181 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_float_complex_matrix_h)
+#define octave_float_complex_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-typeinfo.h"
+
+#include "MatrixType.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Complex matrix values.
+
+class
+OCTINTERP_API
+octave_float_complex_matrix : public octave_base_matrix<FloatComplexNDArray>
+{
+public:
+
+  octave_float_complex_matrix (void)
+    : octave_base_matrix<FloatComplexNDArray> () { }
+
+  octave_float_complex_matrix (const FloatComplexNDArray& m)
+    : octave_base_matrix<FloatComplexNDArray> (m) { }
+
+  octave_float_complex_matrix (const FloatComplexMatrix& m)
+    : octave_base_matrix<FloatComplexNDArray> (m) { }
+
+  octave_float_complex_matrix (const FloatComplexMatrix& m, const MatrixType& t)
+    : octave_base_matrix<FloatComplexNDArray> (m, t) { }
+
+  octave_float_complex_matrix (const Array<FloatComplex>& m)
+    : octave_base_matrix<FloatComplexNDArray> (FloatComplexNDArray (m)) { }
+
+  octave_float_complex_matrix (const FloatComplexDiagMatrix& d)
+    : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (d)) { }
+
+  octave_float_complex_matrix (const FloatComplexRowVector& v)
+    : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { }
+
+  octave_float_complex_matrix (const FloatComplexColumnVector& v)
+    : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { }
+
+  octave_float_complex_matrix (const octave_float_complex_matrix& cm)
+    : octave_base_matrix<FloatComplexNDArray> (cm) { }
+
+  ~octave_float_complex_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_float_complex_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_float_complex_matrix (); }
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  builtin_type_t builtin_type (void) const { return btyp_float_complex; }
+
+  bool is_complex_matrix (void) const { return true; }
+
+  bool is_complex_type (void) const { return true; }
+
+  bool is_single_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  float float_scalar_value (bool frc_str_conv = false) const
+    { return float_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  FloatMatrix float_matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const { return matrix; }
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool warn = false) const;
+
+  charNDArray char_array_value (bool frc_str_conv = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const;
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
+
+  octave_value diag (octave_idx_type k = 0) const;
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  void increment (void) { matrix += FloatComplex (1.0); }
+
+  void decrement (void) { matrix -= FloatComplex (1.0); }
+
+  void changesign (void) { matrix.changesign (); }
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      // Yes, for compatibility, we drop the imaginary part here.
+      return os.write (matrix_value (true), block_size, output_type,
+                       skip, flt_fmt);
+    }
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-re-diag.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,175 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "byte-swap.h"
+
+#include "ov-flt-re-diag.h"
+#include "ov-base-diag.cc"
+#include "ov-float.h"
+#include "ov-flt-re-mat.h"
+#include "ls-utils.h"
+
+template class octave_base_diag<FloatDiagMatrix, FloatMatrix>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_float_diag_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_diag_matrix,
+                                     "float diagonal matrix", "single");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_float_diag_matrix&);
+
+  return new octave_float_matrix (v.float_matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_float_diag_matrix::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_float_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_float_diag_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.nelem () == 1)
+    retval = new octave_float_scalar (matrix (0, 0));
+
+  return retval;
+}
+
+DiagMatrix
+octave_float_diag_matrix::diag_matrix_value (bool) const
+{
+  return DiagMatrix (matrix);
+}
+
+FloatDiagMatrix
+octave_float_diag_matrix::float_diag_matrix_value (bool) const
+{
+  return matrix;
+}
+
+ComplexDiagMatrix
+octave_float_diag_matrix::complex_diag_matrix_value (bool) const
+{
+  return ComplexDiagMatrix (matrix);
+}
+
+FloatComplexDiagMatrix
+octave_float_diag_matrix::float_complex_diag_matrix_value (bool) const
+{
+  return FloatComplexDiagMatrix (matrix);
+}
+
+octave_value
+octave_float_diag_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_abs:
+      return matrix.abs ();
+    case umap_real:
+    case umap_conj:
+      return matrix;
+    case umap_imag:
+      return DiagMatrix (matrix.rows (), matrix.cols (), 0.0);
+    case umap_sqrt:
+      {
+        FloatComplexColumnVector tmp = matrix.diag ().map<FloatComplex> (rc_sqrt);
+        FloatComplexDiagMatrix retval (tmp);
+        retval.resize (matrix.rows (), matrix.columns ());
+        return retval;
+      }
+    default:
+      return to_dense ().map (umap);
+    }
+}
+
+bool
+octave_float_diag_matrix::save_binary (std::ostream& os,
+                                       bool& /* save_as_floats*/)
+{
+
+  int32_t r = matrix.rows (), c = matrix.cols ();
+  os.write (reinterpret_cast<char *> (&r), 4);
+  os.write (reinterpret_cast<char *> (&c), 4);
+
+  FloatMatrix m = FloatMatrix (matrix.diag ());
+  save_type st = LS_FLOAT;
+  if (matrix.length () > 8192) // FIXME -- make this configurable.
+    {
+      float max_val, min_val;
+      if (m.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  const float *mtmp = m.data ();
+  write_floats (os, mtmp, st, m.numel ());
+
+  return true;
+}
+
+bool
+octave_float_diag_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format fmt)
+{
+  int32_t r, c;
+  char tmp;
+  if (! (is.read (reinterpret_cast<char *> (&r), 4)
+         && is.read (reinterpret_cast<char *> (&c), 4)
+         && is.read (reinterpret_cast<char *> (&tmp), 1)))
+    return false;
+  if (swap)
+    {
+      swap_bytes<4> (&r);
+      swap_bytes<4> (&c);
+    }
+
+  FloatDiagMatrix m (r, c);
+  float *re = m.fortran_vec ();
+  octave_idx_type len = m.length ();
+  read_floats (is, re, static_cast<save_type> (tmp), len, swap, fmt);
+  if (error_state || ! is)
+    return false;
+  matrix = m;
+
+  return true;
+}
+
+bool
+octave_float_diag_matrix::chk_valid_scalar (const octave_value& val,
+                                            float& x) const
+{
+  bool retval = val.is_real_scalar ();
+  if (retval)
+    x = val.float_value ();
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-re-diag.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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_float_diag_matrix_h)
+#define octave_float_diag_matrix_h 1
+
+#include "ov-base.h"
+#include "ov-base-diag.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+
+// Real diagonal matrix values.
+
+class
+OCTINTERP_API
+octave_float_diag_matrix
+  : public octave_base_diag<FloatDiagMatrix, FloatMatrix>
+{
+public:
+
+  octave_float_diag_matrix (void)
+    : octave_base_diag<FloatDiagMatrix, FloatMatrix> () { }
+
+  octave_float_diag_matrix (const FloatDiagMatrix& m)
+    : octave_base_diag<FloatDiagMatrix, FloatMatrix> (m) { }
+
+  octave_float_diag_matrix (const octave_float_diag_matrix& m)
+    : octave_base_diag<FloatDiagMatrix, FloatMatrix> (m) { }
+
+  ~octave_float_diag_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_float_diag_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_float_diag_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  builtin_type_t builtin_type (void) const { return btyp_float; }
+
+  bool is_real_matrix (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_single_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  DiagMatrix diag_matrix_value (bool = false) const;
+
+  FloatDiagMatrix float_diag_matrix_value (bool = false) const;
+
+  ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
+
+  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  bool chk_valid_scalar (const octave_value&,
+                         float&) const;
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-re-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,886 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+#include <vector>
+
+#include "data-conv.h"
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+#include "mach-info.h"
+#include "mx-base.h"
+#include "quit.h"
+#include "oct-locbuf.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-mat.cc"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-re-sparse.h"
+#include "ov-flt-re-diag.h"
+#include "ov-flt-cx-diag.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+#include "ops.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+#if ! defined (UCHAR_MAX)
+#define UCHAR_MAX 255
+#endif
+
+template class octave_base_matrix<FloatNDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_float_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_matrix, "float matrix", "single");
+
+octave_base_value *
+octave_float_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.nelem () == 1)
+    retval = new octave_float_scalar (matrix (0));
+
+  return retval;
+}
+
+double
+octave_float_matrix::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (numel () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "real matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real matrix", "real scalar");
+
+  return retval;
+}
+
+float
+octave_float_matrix::float_value (bool) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (numel () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "real matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real matrix", "real scalar");
+
+  return retval;
+}
+
+// FIXME
+
+Matrix
+octave_float_matrix::matrix_value (bool) const
+{
+  return Matrix (matrix.matrix_value ());
+}
+
+FloatMatrix
+octave_float_matrix::float_matrix_value (bool) const
+{
+  return matrix.matrix_value ();
+}
+
+Complex
+octave_float_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "real matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real matrix", "complex scalar");
+
+  return retval;
+}
+
+FloatComplex
+octave_float_matrix::float_complex_value (bool) const
+{
+  double tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "real matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real matrix", "complex scalar");
+
+  return retval;
+}
+
+// FIXME
+
+ComplexMatrix
+octave_float_matrix::complex_matrix_value (bool) const
+{
+  return ComplexMatrix (matrix.matrix_value ());
+}
+
+FloatComplexMatrix
+octave_float_matrix::float_complex_matrix_value (bool) const
+{
+  return FloatComplexMatrix (matrix.matrix_value ());
+}
+
+ComplexNDArray
+octave_float_matrix::complex_array_value (bool) const
+{
+  return ComplexNDArray (matrix);
+}
+
+FloatComplexNDArray
+octave_float_matrix::float_complex_array_value (bool) const
+{
+  return FloatComplexNDArray (matrix);
+}
+
+NDArray
+octave_float_matrix::array_value (bool) const
+{
+  return NDArray (matrix);
+}
+
+boolNDArray
+octave_float_matrix::bool_array_value (bool warn) const
+{
+  if (matrix.any_element_is_nan ())
+    gripe_nan_to_logical_conversion ();
+  else if (warn && matrix.any_element_not_one_or_zero ())
+    gripe_logical_conversion ();
+
+  return boolNDArray (matrix);
+}
+
+charNDArray
+octave_float_matrix::char_array_value (bool) const
+{
+  charNDArray retval (dims ());
+
+  octave_idx_type nel = numel ();
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    retval.elem (i) = static_cast<char>(matrix.elem (i));
+
+  return retval;
+}
+
+SparseMatrix
+octave_float_matrix::sparse_matrix_value (bool) const
+{
+  return SparseMatrix (matrix_value ());
+}
+
+SparseComplexMatrix
+octave_float_matrix::sparse_complex_matrix_value (bool) const
+{
+  // FIXME Need a SparseComplexMatrix (Matrix) constructor to make
+  // this function more efficient. Then this should become
+  // return SparseComplexMatrix (matrix.matrix_value ());
+  return SparseComplexMatrix (sparse_matrix_value ());
+}
+
+octave_value
+octave_float_matrix::diag (octave_idx_type k) const
+{
+  octave_value retval;
+  if (k == 0 && matrix.ndims () == 2
+      && (matrix.rows () == 1 || matrix.columns () == 1))
+    retval = FloatDiagMatrix (DiagArray2<float> (matrix));
+  else
+    retval = octave_base_matrix<FloatNDArray>::diag (k);
+
+  return retval;
+}
+
+octave_value
+octave_float_matrix::diag (octave_idx_type m, octave_idx_type n) const
+{
+  octave_value retval;
+
+  if (matrix.ndims () == 2
+      && (matrix.rows () == 1 || matrix.columns () == 1))
+    {
+      FloatMatrix mat = matrix.matrix_value ();
+
+      retval = mat.diag (m, n);
+    }
+  else
+    error ("diag: expecting vector argument");
+
+  return retval;
+}
+
+octave_value
+octave_float_matrix::convert_to_str_internal (bool, bool, char type) const
+{
+  octave_value retval;
+  dim_vector dv = dims ();
+  octave_idx_type nel = dv.numel ();
+
+  charNDArray chm (dv);
+
+  bool warned = false;
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      octave_quit ();
+
+      float d = matrix (i);
+
+      if (xisnan (d))
+        {
+          gripe_nan_to_character_conversion ();
+          return retval;
+        }
+      else
+        {
+          int ival = NINT (d);
+
+          if (ival < 0 || ival > UCHAR_MAX)
+            {
+              // FIXME -- is there something
+              // better we could do?
+
+              ival = 0;
+
+              if (! warned)
+                {
+                  ::warning ("range error for conversion to character value");
+                  warned = true;
+                }
+            }
+
+          chm (i) = static_cast<char> (ival);
+        }
+    }
+
+  retval = octave_value (chm, type);
+
+  return retval;
+}
+
+bool
+octave_float_matrix::save_ascii (std::ostream& os)
+{
+  dim_vector d = dims ();
+
+  if (d.length () > 2)
+    {
+      FloatNDArray tmp = float_array_value ();
+
+      os << "# ndims: " << d.length () << "\n";
+
+      for (int i=0; i < d.length (); i++)
+        os << " " << d (i);
+
+      os << "\n" << tmp;
+    }
+  else
+    {
+      // Keep this case, rather than use generic code above for backward
+      // compatiability. Makes load_ascii much more complex!!
+      os << "# rows: " << rows () << "\n"
+         << "# columns: " << columns () << "\n";
+
+      os << float_matrix_value ();
+    }
+
+  return true;
+}
+
+bool
+octave_float_matrix::load_ascii (std::istream& is)
+{
+  bool success = true;
+
+  string_vector keywords(2);
+
+  keywords[0] = "ndims";
+  keywords[1] = "rows";
+
+  std::string kw;
+  octave_idx_type val = 0;
+
+  if (extract_keyword (is, keywords, kw, val, true))
+    {
+      if (kw == "ndims")
+        {
+          int mdims = static_cast<int> (val);
+
+          if (mdims >= 0)
+            {
+              dim_vector dv;
+              dv.resize (mdims);
+
+              for (int i = 0; i < mdims; i++)
+                is >> dv(i);
+
+              if (is)
+                {
+                  FloatNDArray tmp(dv);
+
+                  is >> tmp;
+
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else
+                {
+                  error ("load: failed to read dimensions");
+                  success = false;
+                }
+            }
+          else
+            {
+              error ("load: failed to extract number of dimensions");
+              success = false;
+            }
+        }
+      else if (kw == "rows")
+        {
+          octave_idx_type nr = val;
+          octave_idx_type nc = 0;
+
+          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
+            {
+              if (nr > 0 && nc > 0)
+                {
+                  FloatMatrix tmp (nr, nc);
+                  is >> tmp;
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else if (nr == 0 || nc == 0)
+                matrix = FloatMatrix (nr, nc);
+              else
+                panic_impossible ();
+            }
+          else
+            {
+              error ("load: failed to extract number of rows and columns");
+              success = false;
+            }
+        }
+      else
+        panic_impossible ();
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_float_matrix::save_binary (std::ostream& os, bool&)
+{
+
+  dim_vector d = dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims to differentiate with old format!!
+  int32_t tmp = - d.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  for (int i = 0; i < d.length (); i++)
+    {
+      tmp = d(i);
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+    }
+
+  FloatNDArray m = float_array_value ();
+  save_type st = LS_FLOAT;
+  if (d.numel () > 8192) // FIXME -- make this configurable.
+    {
+      float max_val, min_val;
+      if (m.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  const float *mtmp = m.data ();
+  write_floats (os, mtmp, st, d.numel ());
+
+  return true;
+}
+
+bool
+octave_float_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format fmt)
+{
+  char tmp;
+  int32_t mdims;
+  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&mdims);
+  if (mdims < 0)
+    {
+      mdims = - mdims;
+      int32_t di;
+      dim_vector dv;
+      dv.resize (mdims);
+
+      for (int i = 0; i < mdims; i++)
+        {
+          if (! is.read (reinterpret_cast<char *> (&di), 4))
+            return false;
+          if (swap)
+            swap_bytes<4> (&di);
+          dv(i) = di;
+        }
+
+      // Convert an array with a single dimension to be a row vector.
+      // Octave should never write files like this, other software
+      // might.
+
+      if (mdims == 1)
+        {
+          mdims = 2;
+          dv.resize (mdims);
+          dv(1) = dv(0);
+          dv(0) = 1;
+        }
+
+      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+        return false;
+
+      FloatNDArray m(dv);
+      float *re = m.fortran_vec ();
+      read_floats (is, re, static_cast<save_type> (tmp), dv.numel (), swap, fmt);
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  else
+    {
+      int32_t nr, nc;
+      nr = mdims;
+      if (! is.read (reinterpret_cast<char *> (&nc), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&nc);
+      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+        return false;
+      FloatMatrix m (nr, nc);
+      float *re = m.fortran_vec ();
+      octave_idx_type len = nr * nc;
+      read_floats (is, re, static_cast<save_type> (tmp), len, swap, fmt);
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_float_matrix::save_hdf5 (hid_t loc_id, const char *name, bool)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  int rank = dv.length ();
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+  FloatNDArray m = array_value ();
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  for (int i = 0; i < rank; i++)
+    hdims[i] = dv (rank-i-1);
+
+  space_hid = H5Screate_simple (rank, hdims, 0);
+
+  if (space_hid < 0) return false;
+
+  hid_t save_type_hid = H5T_NATIVE_FLOAT;
+
+#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
+  // hdf5 currently doesn't support float/integer conversions
+  else
+    {
+      float max_val, min_val;
+
+      if (m.all_integers (max_val, min_val))
+        save_type_hid
+          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+    }
+#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  float *mtmp = m.fortran_vec ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, mtmp) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_float_matrix::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+      return (empty > 0);
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank < 1)
+    {
+      H5Sclose (space_id);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  if (rank == 1)
+    {
+      dv.resize (2);
+      dv(0) = 1;
+      dv(1) = hdims[0];
+    }
+  else
+    {
+      dv.resize (rank);
+      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
+        dv(j) = hdims[i];
+    }
+
+  FloatNDArray m (dv);
+  float *re = m.fortran_vec ();
+  if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, re) >= 0)
+    {
+      retval = true;
+      matrix = m;
+    }
+
+  H5Sclose (space_id);
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+void
+octave_float_matrix::print_raw (std::ostream& os,
+                          bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, matrix, pr_as_read_syntax,
+                         current_print_indent_level ());
+}
+
+mxArray *
+octave_float_matrix::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxSINGLE_CLASS, dims (), mxREAL);
+
+  float *pr = static_cast<float *> (retval->get_data ());
+
+  mwSize nel = numel ();
+
+  const float *p = matrix.data ();
+
+  for (mwIndex i = 0; i < nel; i++)
+    pr[i] = p[i];
+
+  return retval;
+}
+
+// This uses a smarter strategy for doing the complex->real mappers.  We
+// allocate an array for a real result and keep filling it until a complex
+// result is produced.
+static octave_value
+do_rc_map (const FloatNDArray& a, FloatComplex (&fcn) (float))
+{
+  octave_idx_type n = a.numel ();
+  NoAlias<FloatNDArray> rr (a.dims ());
+
+  for (octave_idx_type i = 0; i < n; i++)
+    {
+      octave_quit ();
+
+      FloatComplex tmp = fcn (a(i));
+      if (tmp.imag () == 0.0)
+        rr(i) = tmp.real ();
+      else
+        {
+          NoAlias<FloatComplexNDArray> rc (a.dims ());
+
+          for (octave_idx_type j = 0; j < i; j++)
+            rc(j) = rr(j);
+
+          rc(i) = tmp;
+
+          for (octave_idx_type j = i+1; j < n; j++)
+            {
+              octave_quit ();
+
+              rc(j) = fcn (a(j));
+            }
+
+          return new octave_float_complex_matrix (rc);
+        }
+    }
+
+  return rr;
+}
+
+octave_value
+octave_float_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_imag:
+      return FloatNDArray (matrix.dims (), 0.0);
+
+    case umap_real:
+    case umap_conj:
+      return matrix;
+
+    // Mappers handled specially.
+#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.FCN ())
+
+      ARRAY_METHOD_MAPPER (abs, abs);
+      ARRAY_METHOD_MAPPER (isnan, isnan);
+      ARRAY_METHOD_MAPPER (isinf, isinf);
+      ARRAY_METHOD_MAPPER (finite, isfinite);
+
+#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.map<TYPE> (FCN))
+
+#define RC_ARRAY_MAPPER(UMAP, TYPE, FCN) \
+    case umap_ ## UMAP: \
+      return do_rc_map (matrix, FCN)
+
+      RC_ARRAY_MAPPER (acos, FloatComplex, rc_acos);
+      RC_ARRAY_MAPPER (acosh, FloatComplex, rc_acosh);
+      ARRAY_MAPPER (angle, float, ::arg);
+      ARRAY_MAPPER (arg, float, ::arg);
+      RC_ARRAY_MAPPER (asin, FloatComplex, rc_asin);
+      ARRAY_MAPPER (asinh, float, ::asinhf);
+      ARRAY_MAPPER (atan, float, ::atanf);
+      RC_ARRAY_MAPPER (atanh, FloatComplex, rc_atanh);
+      ARRAY_MAPPER (erf, float, ::erff);
+      ARRAY_MAPPER (erfinv, float, ::erfinv);
+      ARRAY_MAPPER (erfcinv, float, ::erfcinv);
+      ARRAY_MAPPER (erfc, float, ::erfcf);
+      ARRAY_MAPPER (erfcx, float, ::erfcx);
+      ARRAY_MAPPER (gamma, float, xgamma);
+      RC_ARRAY_MAPPER (lgamma, FloatComplex, rc_lgamma);
+      ARRAY_MAPPER (cbrt, float, ::cbrtf);
+      ARRAY_MAPPER (ceil, float, ::ceilf);
+      ARRAY_MAPPER (cos, float, ::cosf);
+      ARRAY_MAPPER (cosh, float, ::coshf);
+      ARRAY_MAPPER (exp, float, ::expf);
+      ARRAY_MAPPER (expm1, float, ::expm1f);
+      ARRAY_MAPPER (fix, float, ::fix);
+      ARRAY_MAPPER (floor, float, ::floorf);
+      RC_ARRAY_MAPPER (log, FloatComplex, rc_log);
+      RC_ARRAY_MAPPER (log2, FloatComplex, rc_log2);
+      RC_ARRAY_MAPPER (log10, FloatComplex, rc_log10);
+      RC_ARRAY_MAPPER (log1p, FloatComplex, rc_log1p);
+      ARRAY_MAPPER (round, float, xround);
+      ARRAY_MAPPER (roundb, float, xroundb);
+      ARRAY_MAPPER (signum, float, ::signum);
+      ARRAY_MAPPER (sin, float, ::sinf);
+      ARRAY_MAPPER (sinh, float, ::sinhf);
+      RC_ARRAY_MAPPER (sqrt, FloatComplex, rc_sqrt);
+      ARRAY_MAPPER (tan, float, ::tanf);
+      ARRAY_MAPPER (tanh, float, ::tanhf);
+      ARRAY_MAPPER (isna, bool, octave_is_NA);
+
+    default:
+      return octave_base_value::map (umap);
+    }
+}
+
+DEFUN (single, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} single (@var{x})\n\
+Convert @var{x} to single precision type.\n\
+@seealso{double}\n\
+@end deftypefn")
+{
+  // The OCTAVE_TYPE_CONV_BODY3 macro declares retval, so they go
+  // inside their own scopes, and we don't declare retval here to
+  // avoid a shadowed declaration warning.
+
+  if (args.length () == 1)
+    {
+      if (args(0).is_diag_matrix ())
+        {
+          if (args(0).is_complex_type ())
+            {
+              OCTAVE_TYPE_CONV_BODY3 (single, octave_float_complex_diag_matrix, octave_float_complex);
+            }
+          else
+            {
+              OCTAVE_TYPE_CONV_BODY3 (single, octave_float_diag_matrix, octave_float_scalar);
+            }
+        }
+      else if (args(0).is_sparse_type ())
+        {
+          error ("single: sparse type does not support single precision");
+        }
+      else if (args(0).is_complex_type ())
+        {
+          OCTAVE_TYPE_CONV_BODY3 (single, octave_float_complex_matrix, octave_float_complex);
+        }
+      else
+        {
+          OCTAVE_TYPE_CONV_BODY3 (single, octave_float_matrix, octave_float_scalar);
+        }
+    }
+  else
+    print_usage ();
+
+  return octave_value ();
+}
+
+/*
+%!assert (class (single (1)), "single")
+%!assert (class (single (1 + i)), "single")
+%!assert (class (single (int8 (1))), "single")
+%!assert (class (single (uint8 (1))), "single")
+%!assert (class (single (int16 (1))), "single")
+%!assert (class (single (uint16 (1))), "single")
+%!assert (class (single (int32 (1))), "single")
+%!assert (class (single (uint32 (1))), "single")
+%!assert (class (single (int64 (1))), "single")
+%!assert (class (single (uint64 (1))), "single")
+%!assert (class (single (true)), "single")
+%!assert (class (single ("A")), "single")
+%!error (single (sparse (1)))
+%!test
+%! x = diag ([1 3 2]);
+%! y = single (x);
+%! assert (class (x), "double");
+%! assert (class (y), "single");
+%!test
+%! x = diag ([i 3 2]);
+%! y = single (x);
+%! assert (class (x), "double");
+%! assert (class (y), "single");
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-flt-re-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,214 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_float_matrix_h)
+#define octave_float_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-typeinfo.h"
+
+#include "MatrixType.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Real matrix values.
+
+class
+OCTINTERP_API
+octave_float_matrix : public octave_base_matrix<FloatNDArray>
+{
+public:
+
+  octave_float_matrix (void)
+    : octave_base_matrix<FloatNDArray> () { }
+
+  octave_float_matrix (const FloatMatrix& m)
+    : octave_base_matrix<FloatNDArray> (m) { }
+
+  octave_float_matrix (const FloatMatrix& m, const MatrixType& t)
+    : octave_base_matrix<FloatNDArray> (m, t) { }
+
+  octave_float_matrix (const FloatNDArray& nda)
+    : octave_base_matrix<FloatNDArray> (nda) { }
+
+  octave_float_matrix (const Array<float>& m)
+    : octave_base_matrix<FloatNDArray> (FloatNDArray (m)) { }
+
+  octave_float_matrix (const FloatDiagMatrix& d)
+    : octave_base_matrix<FloatNDArray> (FloatMatrix (d)) { }
+
+  octave_float_matrix (const FloatRowVector& v)
+    : octave_base_matrix<FloatNDArray> (FloatMatrix (v)) { }
+
+  octave_float_matrix (const FloatColumnVector& v)
+    : octave_base_matrix<FloatNDArray> (FloatMatrix (v)) { }
+
+  octave_float_matrix (const octave_float_matrix& m)
+    : octave_base_matrix<FloatNDArray> (m) { }
+
+  ~octave_float_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_float_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_float_matrix (); }
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  idx_vector index_vector (void) const
+    { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
+
+  builtin_type_t builtin_type (void) const { return btyp_float; }
+
+  bool is_real_matrix (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_single_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  int8NDArray
+  int8_array_value (void) const { return int8NDArray (matrix); }
+
+  int16NDArray
+  int16_array_value (void) const { return int16NDArray (matrix); }
+
+  int32NDArray
+  int32_array_value (void) const { return int32NDArray (matrix); }
+
+  int64NDArray
+  int64_array_value (void) const { return int64NDArray (matrix); }
+
+  uint8NDArray
+  uint8_array_value (void) const { return uint8NDArray (matrix); }
+
+  uint16NDArray
+  uint16_array_value (void) const { return uint16NDArray (matrix); }
+
+  uint32NDArray
+  uint32_array_value (void) const { return uint32NDArray (matrix); }
+
+  uint64NDArray
+  uint64_array_value (void) const { return uint64NDArray (matrix); }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  float float_scalar_value (bool frc_str_conv = false) const
+    { return float_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  FloatMatrix float_matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool warn = false) const;
+
+  charNDArray char_array_value (bool = false) const;
+
+  NDArray array_value (bool = false) const;
+
+  FloatNDArray float_array_value (bool = false) const { return matrix; }
+
+  SparseMatrix sparse_matrix_value (bool = false) const;
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
+
+  octave_value diag (octave_idx_type k = 0) const;
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  // Use matrix_ref here to clear index cache.
+  void increment (void) { matrix_ref () += 1.0; }
+
+  void decrement (void) { matrix_ref () -= 1.0; }
+
+  void changesign (void) { matrix_ref ().changesign (); }
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const { return matrix.mex_get_data (); }
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int-traits.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,63 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_value_int_traits_h)
+#define octave_value_int_traits_h 1
+
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+
+template <class T>
+class
+octave_value_int_traits
+{
+public:
+  typedef T scalar_type;
+};
+
+#define OCTAVE_VALUE_INT_TRAITS(MT, ST) \
+  template<> \
+  class \
+  octave_value_int_traits<MT> \
+  { \
+  public: \
+    typedef ST scalar_type; \
+  }
+
+OCTAVE_VALUE_INT_TRAITS(int8NDArray, octave_int8_scalar);
+OCTAVE_VALUE_INT_TRAITS(int16NDArray, octave_int16_scalar);
+OCTAVE_VALUE_INT_TRAITS(int32NDArray, octave_int32_scalar);
+OCTAVE_VALUE_INT_TRAITS(int64NDArray, octave_int64_scalar);
+
+OCTAVE_VALUE_INT_TRAITS(uint8NDArray, octave_uint8_scalar);
+OCTAVE_VALUE_INT_TRAITS(uint16NDArray, octave_uint16_scalar);
+OCTAVE_VALUE_INT_TRAITS(uint32NDArray, octave_uint32_scalar);
+OCTAVE_VALUE_INT_TRAITS(uint64NDArray, octave_uint64_scalar);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int16.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ops.h"
+#include "ov-base.h"
+
+#ifdef HAVE_HDF5
+#define HDF5_SAVE_TYPE H5T_NATIVE_INT16
+#endif
+
+#include "ov-base-int.h"
+#include "ov-base-int.cc"
+#include "ov-int16.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+template class octave_base_matrix<int16NDArray>;
+
+template class octave_base_int_matrix<int16NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_int16_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int16_matrix,
+                                     "int16 matrix", "int16");
+
+template class octave_base_scalar<octave_int16>;
+
+template class octave_base_int_scalar<octave_int16>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_int16_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int16_scalar,
+                                     "int16 scalar", "int16");
+
+DEFUN (int16, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} int16 (@var{x})\n\
+Convert @var{x} to 16-bit integer type.\n\
+@end deftypefn")
+{
+  OCTAVE_TYPE_CONV_BODY (int16);
+}
+
+/*
+%!assert (class (int16 (1)), "int16")
+%!assert (int16 (1.25), int16 (1))
+%!assert (int16 (1.5), int16 (2))
+%!assert (int16 (-1.5), int16 (-2))
+%!assert (int16 (2^17), int16 (2^16-1))
+%!assert (int16 (-2^17), int16 (-2^16))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int16.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,56 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_int16_h)
+#define octave_int16_h 1
+
+#define OCTAVE_INT_T octave_int16
+
+#define OCTAVE_VALUE_INT_MATRIX_T octave_int16_matrix
+#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int16_array_value
+
+#define OCTAVE_VALUE_INT_SCALAR_T octave_int16_scalar
+#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int16_scalar_value
+
+#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int16_type
+
+#define OCTAVE_INT_MX_CLASS mxINT16_CLASS
+
+#define OCTAVE_INT_BTYP btyp_int16
+
+#include "ov-intx.h"
+
+#undef OCTAVE_INT_T
+
+#undef OCTAVE_VALUE_INT_MATRIX_T
+#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_VALUE_INT_SCALAR_T
+#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_TYPE_PREDICATE_FUNCTION
+
+#undef OCTAVE_INT_MX_CLASS
+
+#undef OCTAVE_INT_BTYP
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int32.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ops.h"
+#include "ov-base.h"
+
+#ifdef HAVE_HDF5
+#define HDF5_SAVE_TYPE H5T_NATIVE_INT32
+#endif
+
+#include "ov-base-int.h"
+#include "ov-base-int.cc"
+#include "ov-int32.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+template class octave_base_matrix<int32NDArray>;
+
+template class octave_base_int_matrix<int32NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_int32_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int32_matrix,
+                                     "int32 matrix", "int32");
+
+template class octave_base_scalar<octave_int32>;
+
+template class octave_base_int_scalar<octave_int32>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_int32_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int32_scalar,
+                                     "int32 scalar", "int32");
+
+DEFUN (int32, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} int32 (@var{x})\n\
+Convert @var{x} to 32-bit integer type.\n\
+@end deftypefn")
+{
+  OCTAVE_TYPE_CONV_BODY (int32);
+}
+
+/*
+%!assert (class (int32 (1)), "int32")
+%!assert (int32 (1.25), int32 (1))
+%!assert (int32 (1.5), int32 (2))
+%!assert (int32 (-1.5), int32 (-2))
+%!assert (int32 (2^33), int32 (2^32-1))
+%!assert (int32 (-2^33), int32 (-2^32))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int32.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,56 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_int32_h)
+#define octave_int32_h 1
+
+#define OCTAVE_INT_T octave_int32
+
+#define OCTAVE_VALUE_INT_MATRIX_T octave_int32_matrix
+#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int32_array_value
+
+#define OCTAVE_VALUE_INT_SCALAR_T octave_int32_scalar
+#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int32_scalar_value
+
+#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int32_type
+
+#define OCTAVE_INT_MX_CLASS mxINT32_CLASS
+
+#define OCTAVE_INT_BTYP btyp_int32
+
+#include "ov-intx.h"
+
+#undef OCTAVE_INT_T
+
+#undef OCTAVE_VALUE_INT_MATRIX_T
+#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_VALUE_INT_SCALAR_T
+#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_TYPE_PREDICATE_FUNCTION
+
+#undef OCTAVE_INT_MX_CLASS
+
+#undef OCTAVE_INT_BTYP
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int64.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ops.h"
+#include "ov-base.h"
+
+#ifdef HAVE_HDF5
+#define HDF5_SAVE_TYPE H5T_NATIVE_INT64
+#endif
+
+#include "ov-base-int.h"
+#include "ov-base-int.cc"
+#include "ov-int64.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+template class octave_base_matrix<int64NDArray>;
+
+template class octave_base_int_matrix<int64NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_int64_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int64_matrix,
+                                     "int64 matrix", "int64");
+
+template class octave_base_scalar<octave_int64>;
+
+template class octave_base_int_scalar<octave_int64>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_int64_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int64_scalar,
+                                     "int64 scalar", "int64");
+
+DEFUN (int64, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} int64 (@var{x})\n\
+Convert @var{x} to 64-bit integer type.\n\
+@end deftypefn")
+{
+  OCTAVE_TYPE_CONV_BODY (int64);
+}
+
+/*
+%!assert (class (int64 (1)), "int64")
+%!assert (int64 (1.25), int64 (1))
+%!assert (int64 (1.5), int64 (2))
+%!assert (int64 (-1.5), int64 (-2))
+%!assert (int64 (2^65), int64 (2^64-1))
+%!assert (int64 (-2^65), int64 (-2^64))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int64.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,56 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_int64_h)
+#define octave_int64_h 1
+
+#define OCTAVE_INT_T octave_int64
+
+#define OCTAVE_VALUE_INT_MATRIX_T octave_int64_matrix
+#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int64_array_value
+
+#define OCTAVE_VALUE_INT_SCALAR_T octave_int64_scalar
+#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int64_scalar_value
+
+#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int64_type
+
+#define OCTAVE_INT_MX_CLASS mxINT64_CLASS
+
+#define OCTAVE_INT_BTYP btyp_int64
+
+#include "ov-intx.h"
+
+#undef OCTAVE_INT_T
+
+#undef OCTAVE_VALUE_INT_MATRIX_T
+#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_VALUE_INT_SCALAR_T
+#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_TYPE_PREDICATE_FUNCTION
+
+#undef OCTAVE_INT_MX_CLASS
+
+#undef OCTAVE_INT_BTYP
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int8.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ops.h"
+#include "ov-base.h"
+
+#ifdef HAVE_HDF5
+#define HDF5_SAVE_TYPE H5T_NATIVE_INT8
+#endif
+
+#include "ov-base-int.h"
+#include "ov-base-int.cc"
+#include "ov-int8.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+template class octave_base_matrix<int8NDArray>;
+
+template class octave_base_int_matrix<int8NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_int8_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int8_matrix,
+                                     "int8 matrix", "int8");
+
+template class octave_base_scalar<octave_int8>;
+
+template class octave_base_int_scalar<octave_int8>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_int8_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int8_scalar,
+                                     "int8 scalar", "int8");
+
+DEFUN (int8, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} int8 (@var{x})\n\
+Convert @var{x} to 8-bit integer type.\n\
+@end deftypefn")
+{
+  OCTAVE_TYPE_CONV_BODY (int8);
+}
+
+/*
+%!assert (class (int8 (1)), "int8")
+%!assert (int8 (1.25), int8 (1))
+%!assert (int8 (1.5), int8 (2))
+%!assert (int8 (-1.5), int8 (-2))
+%!assert (int8 (2^9), int8 (2^8-1))
+%!assert (int8 (-2^9), int8 (-2^8))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-int8.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,56 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_int8_h)
+#define octave_int8_h 1
+
+#define OCTAVE_INT_T octave_int8
+
+#define OCTAVE_VALUE_INT_MATRIX_T octave_int8_matrix
+#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int8_array_value
+
+#define OCTAVE_VALUE_INT_SCALAR_T octave_int8_scalar
+#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int8_scalar_value
+
+#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int8_type
+
+#define OCTAVE_INT_MX_CLASS mxINT8_CLASS
+
+#define OCTAVE_INT_BTYP btyp_int8
+
+#include "ov-intx.h"
+
+#undef OCTAVE_INT_T
+
+#undef OCTAVE_VALUE_INT_MATRIX_T
+#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_VALUE_INT_SCALAR_T
+#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_TYPE_PREDICATE_FUNCTION
+
+#undef OCTAVE_INT_MX_CLASS
+
+#undef OCTAVE_INT_BTYP
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-intx.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,668 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+Copyright (C) 2010 VZLU Prague
+
+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/>.
+
+*/
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-base-int.h"
+#include "ov-typeinfo.h"
+#include "gripes.h"
+
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+
+class
+OCTINTERP_API
+OCTAVE_VALUE_INT_MATRIX_T
+  : public octave_base_int_matrix<intNDArray<OCTAVE_INT_T> >
+{
+public:
+
+  OCTAVE_VALUE_INT_MATRIX_T (void)
+    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > () { }
+
+  OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda)
+    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > (nda) { }
+
+  OCTAVE_VALUE_INT_MATRIX_T (const Array<OCTAVE_INT_T>& nda)
+    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> >
+        (intNDArray<OCTAVE_INT_T> (nda)) { }
+
+  ~OCTAVE_VALUE_INT_MATRIX_T (void) { }
+
+  octave_base_value *clone (void) const
+    { return new OCTAVE_VALUE_INT_MATRIX_T (*this); }
+
+  octave_base_value *empty_clone (void) const
+    { return new OCTAVE_VALUE_INT_MATRIX_T (); }
+
+  bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; }
+
+  bool is_integer_type (void) const { return true; }
+
+  builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
+
+public:
+
+  int8NDArray
+  int8_array_value (void) const { return int8NDArray (matrix); }
+
+  int16NDArray
+  int16_array_value (void) const { return int16NDArray (matrix); }
+
+  int32NDArray
+  int32_array_value (void) const { return int32NDArray (matrix); }
+
+  int64NDArray
+  int64_array_value (void) const { return int64NDArray (matrix); }
+
+  uint8NDArray
+  uint8_array_value (void) const { return uint8NDArray (matrix); }
+
+  uint16NDArray
+  uint16_array_value (void) const { return uint16NDArray (matrix); }
+
+  uint32NDArray
+  uint32_array_value (void) const { return uint32NDArray (matrix); }
+
+  uint64NDArray
+  uint64_array_value (void) const { return uint64NDArray (matrix); }
+
+  double
+  double_value (bool = false) const
+    {
+      double retval = lo_ieee_nan_value ();
+
+      if (numel () > 0)
+        {
+          gripe_implicit_conversion ("Octave:array-to-scalar",
+                                     type_name (), "real scalar");
+
+          retval = matrix(0).double_value ();
+        }
+      else
+        gripe_invalid_conversion (type_name (), "real scalar");
+
+      return retval;
+
+    }
+
+  float
+  float_value (bool = false) const
+    {
+      float retval = lo_ieee_float_nan_value ();
+
+      if (numel () > 0)
+        {
+          gripe_implicit_conversion ("Octave:array-to-scalar",
+                                     type_name (), "real scalar");
+
+          retval = matrix(0).float_value ();
+        }
+      else
+        gripe_invalid_conversion (type_name (), "real scalar");
+
+      return retval;
+
+    }
+
+  double scalar_value (bool = false) const { return double_value (); }
+
+  float float_scalar_value (bool = false) const { return float_value (); }
+
+  Matrix
+  matrix_value (bool = false) const
+    {
+      Matrix retval;
+      dim_vector dv = dims ();
+      if (dv.length () > 2)
+        error ("invalid conversion of %s to Matrix", type_name ().c_str ());
+      else
+        {
+          retval = Matrix (dv(0), dv(1));
+          double *vec = retval.fortran_vec ();
+          octave_idx_type nel = matrix.numel ();
+          for (octave_idx_type i = 0; i < nel; i++)
+            vec[i] = matrix(i).double_value ();
+        }
+      return retval;
+    }
+
+  FloatMatrix
+  float_matrix_value (bool = false) const
+    {
+      FloatMatrix retval;
+      dim_vector dv = dims ();
+      if (dv.length () > 2)
+        error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ());
+      else
+        {
+          retval = FloatMatrix (dv(0), dv(1));
+          float *vec = retval.fortran_vec ();
+          octave_idx_type nel = matrix.numel ();
+          for (octave_idx_type i = 0; i < nel; i++)
+            vec[i] = matrix(i).float_value ();
+        }
+      return retval;
+    }
+
+  ComplexMatrix
+  complex_matrix_value (bool = false) const
+    {
+      ComplexMatrix retval;
+      dim_vector dv = dims ();
+      if (dv.length () > 2)
+        error ("invalid conversion of %s to Matrix", type_name ().c_str ());
+      else
+        {
+          retval = ComplexMatrix (dv(0), dv(1));
+          Complex *vec = retval.fortran_vec ();
+          octave_idx_type nel = matrix.numel ();
+          for (octave_idx_type i = 0; i < nel; i++)
+            vec[i] = Complex (matrix(i).double_value ());
+        }
+      return retval;
+    }
+
+  FloatComplexMatrix
+  float_complex_matrix_value (bool = false) const
+    {
+      FloatComplexMatrix retval;
+      dim_vector dv = dims ();
+      if (dv.length () > 2)
+        error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ());
+      else
+        {
+          retval = FloatComplexMatrix (dv(0), dv(1));
+          FloatComplex *vec = retval.fortran_vec ();
+          octave_idx_type nel = matrix.numel ();
+          for (octave_idx_type i = 0; i < nel; i++)
+            vec[i] = FloatComplex (matrix(i).float_value ());
+        }
+      return retval;
+    }
+
+  NDArray
+  array_value (bool = false) const
+    {
+      NDArray retval (matrix.dims ());
+      double *vec = retval.fortran_vec ();
+      octave_idx_type nel = matrix.numel ();
+      for (octave_idx_type i = 0; i < nel; i++)
+        vec[i] = matrix(i).double_value ();
+      return retval;
+    }
+
+  FloatNDArray
+  float_array_value (bool = false) const
+    {
+      FloatNDArray retval (matrix.dims ());
+      float *vec = retval.fortran_vec ();
+      octave_idx_type nel = matrix.numel ();
+      for (octave_idx_type i = 0; i < nel; i++)
+        vec[i] = matrix(i).float_value ();
+      return retval;
+    }
+
+  ComplexNDArray
+  complex_array_value (bool = false) const
+    {
+      ComplexNDArray retval (matrix.dims ());
+      Complex *vec = retval.fortran_vec ();
+      octave_idx_type nel = matrix.numel ();
+      for (octave_idx_type i = 0; i < nel; i++)
+        vec[i] = Complex (matrix(i).double_value ());
+      return retval;
+    }
+
+  FloatComplexNDArray
+  float_complex_array_value (bool = false) const
+    {
+      FloatComplexNDArray retval (matrix.dims ());
+      FloatComplex *vec = retval.fortran_vec ();
+      octave_idx_type nel = matrix.numel ();
+      for (octave_idx_type i = 0; i < nel; i++)
+        vec[i] = FloatComplex (matrix(i).float_value ());
+      return retval;
+    }
+
+  boolNDArray
+  bool_array_value (bool warn = false) const
+  {
+    boolNDArray retval (dims ());
+
+    octave_idx_type nel = numel ();
+
+    if (warn && matrix.any_element_not_one_or_zero ())
+      gripe_logical_conversion ();
+
+    bool *vec = retval.fortran_vec ();
+    for (octave_idx_type i = 0; i < nel; i++)
+      vec[i] = matrix(i).bool_value ();
+
+    return retval;
+  }
+
+  charNDArray
+  char_array_value (bool = false) const
+  {
+    charNDArray retval (dims ());
+
+    octave_idx_type nel = numel ();
+
+    char *vec = retval.fortran_vec ();
+    for (octave_idx_type i = 0; i < nel; i++)
+      vec[i] = matrix(i).char_value ();
+
+    return retval;
+  }
+
+  // Use matrix_ref here to clear index cache.
+  void increment (void)
+   {
+     matrix_ref () += OCTAVE_INT_T (1);
+   }
+
+  void decrement (void)
+   {
+     matrix_ref () -= OCTAVE_INT_T (1);
+   }
+
+  void changesign (void)
+   {
+     matrix_ref ().changesign ();
+   }
+
+  idx_vector index_vector (void) const
+    { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const { return matrix.mex_get_data (); }
+
+  mxArray *as_mxArray (void) const
+  {
+    mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, dims (), mxREAL);
+
+    OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> (retval->get_data ());
+
+    mwSize nel = numel ();
+
+    const OCTAVE_INT_T *p = matrix.data ();
+
+    for (mwIndex i = 0; i < nel; i++)
+      pr[i] = p[i].value ();
+
+    return retval;
+  }
+
+  octave_value map (unary_mapper_t umap) const
+    {
+      switch (umap)
+        {
+        case umap_abs:
+          return matrix.abs ();
+        case umap_signum:
+          return matrix.signum ();
+        case umap_ceil:
+        case umap_conj:
+        case umap_fix:
+        case umap_floor:
+        case umap_real:
+        case umap_round:
+          return matrix;
+        case umap_imag:
+          return intNDArray<OCTAVE_INT_T> (matrix.dims (), OCTAVE_INT_T ());
+        case umap_isnan:
+        case umap_isna:
+        case umap_isinf:
+          return boolNDArray (matrix.dims (), false);
+        case umap_finite:
+          return boolNDArray (matrix.dims (), true);
+
+        default:
+          {
+            octave_matrix m (array_value ());
+            return m.map (umap);
+          }
+        }
+    }
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+class
+OCTINTERP_API
+OCTAVE_VALUE_INT_SCALAR_T
+  : public octave_base_int_scalar<OCTAVE_INT_T>
+{
+public:
+
+  OCTAVE_VALUE_INT_SCALAR_T (void)
+    : octave_base_int_scalar<OCTAVE_INT_T> () { }
+
+  OCTAVE_VALUE_INT_SCALAR_T (const OCTAVE_INT_T& nda)
+    : octave_base_int_scalar<OCTAVE_INT_T> (nda) { }
+
+  ~OCTAVE_VALUE_INT_SCALAR_T (void) { }
+
+  octave_base_value *clone (void) const
+    { return new OCTAVE_VALUE_INT_SCALAR_T (*this); }
+
+  octave_base_value *empty_clone (void) const
+    { return new OCTAVE_VALUE_INT_MATRIX_T (); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false)
+    {
+      // FIXME -- this doesn't solve the problem of
+      //
+      //   a = 1; a([1,1], [1,1], [1,1])
+      //
+      // and similar constructions.  Hmm...
+
+      // FIXME -- using this constructor avoids narrowing the
+      // 1x1 matrix back to a scalar value.  Need a better solution
+      // to this problem.
+
+      octave_value tmp
+        (new OCTAVE_VALUE_INT_MATRIX_T
+         (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ()));
+
+      return tmp.do_index_op (idx, resize_ok);
+    }
+
+  bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; }
+
+  bool is_integer_type (void) const { return true; }
+
+  builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
+
+public:
+
+  octave_int8
+  int8_scalar_value (void) const { return octave_int8 (scalar); }
+
+  octave_int16
+  int16_scalar_value (void) const { return octave_int16 (scalar); }
+
+  octave_int32
+  int32_scalar_value (void) const { return octave_int32 (scalar); }
+
+  octave_int64
+  int64_scalar_value (void) const { return octave_int64 (scalar); }
+
+  octave_uint8
+  uint8_scalar_value (void) const { return octave_uint8 (scalar); }
+
+  octave_uint16
+  uint16_scalar_value (void) const { return octave_uint16 (scalar); }
+
+  octave_uint32
+  uint32_scalar_value (void) const { return octave_uint32 (scalar); }
+
+  octave_uint64
+  uint64_scalar_value (void) const { return octave_uint64 (scalar); }
+
+  int8NDArray
+  int8_array_value (void) const
+    { return int8NDArray (dim_vector (1, 1), int8_scalar_value ()); }
+
+  int16NDArray
+  int16_array_value (void) const
+    { return int16NDArray (dim_vector (1, 1), int16_scalar_value ()); }
+
+  int32NDArray
+  int32_array_value (void) const
+    { return int32NDArray (dim_vector (1, 1), int32_scalar_value ()); }
+
+  int64NDArray
+  int64_array_value (void) const
+    { return int64NDArray (dim_vector (1, 1), int64_scalar_value ()); }
+
+  uint8NDArray
+  uint8_array_value (void) const
+    { return uint8NDArray (dim_vector (1, 1), uint8_scalar_value ()); }
+
+  uint16NDArray
+  uint16_array_value (void) const
+    { return uint16NDArray (dim_vector (1, 1), uint16_scalar_value ()); }
+
+  uint32NDArray
+  uint32_array_value (void) const
+    { return uint32NDArray (dim_vector (1, 1), uint32_scalar_value ()); }
+
+  uint64NDArray
+  uint64_array_value (void) const
+    { return uint64NDArray (dim_vector (1, 1), uint64_scalar_value ()); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const
+    {
+      if (fill)
+        {
+          intNDArray<OCTAVE_INT_T> retval (dv, 0);
+          if (dv.numel ())
+            retval(0) = scalar;
+          return retval;
+        }
+      else
+        {
+          intNDArray<OCTAVE_INT_T> retval (dv);
+          if (dv.numel ())
+            retval(0) = scalar;
+          return retval;
+        }
+    }
+
+  double double_value (bool = false) const { return scalar.double_value (); }
+
+  float float_value (bool = false) const { return scalar.float_value (); }
+
+  double scalar_value (bool = false) const { return scalar.double_value (); }
+
+  float float_scalar_value (bool = false) const { return scalar.float_value (); }
+
+  Matrix
+  matrix_value (bool = false) const
+    {
+      Matrix retval (1, 1);
+      retval(0,0) = scalar.double_value ();
+      return retval;
+    }
+
+  FloatMatrix
+  float_matrix_value (bool = false) const
+    {
+      FloatMatrix retval (1, 1);
+      retval(0,0) = scalar.float_value ();
+      return retval;
+    }
+
+  ComplexMatrix
+  complex_matrix_value (bool = false) const
+    {
+      ComplexMatrix retval (1, 1);
+      retval(0,0) = Complex (scalar.double_value ());
+      return retval;
+    }
+
+  FloatComplexMatrix
+  float_complex_matrix_value (bool = false) const
+    {
+      FloatComplexMatrix retval (1, 1);
+      retval(0,0) = FloatComplex (scalar.float_value ());
+      return retval;
+    }
+
+  NDArray
+  array_value (bool = false) const
+    {
+      NDArray retval (dim_vector (1, 1));
+      retval(0) = scalar.double_value ();
+      return retval;
+    }
+
+  FloatNDArray
+  float_array_value (bool = false) const
+    {
+      FloatNDArray retval (dim_vector (1, 1));
+      retval(0) = scalar.float_value ();
+      return retval;
+    }
+
+  ComplexNDArray
+  complex_array_value (bool = false) const
+    {
+      ComplexNDArray retval (dim_vector (1, 1));
+      retval(0) = FloatComplex (scalar.double_value ());
+      return retval;
+    }
+
+  FloatComplexNDArray
+  float_complex_array_value (bool = false) const
+    {
+      FloatComplexNDArray retval (dim_vector (1, 1));
+      retval(0) = FloatComplex (scalar.float_value ());
+      return retval;
+    }
+
+  bool bool_value (bool warn = false) const
+  {
+    if (warn && scalar != 0.0 && scalar != 1.0)
+      gripe_logical_conversion ();
+
+    return scalar.bool_value ();
+  }
+
+  boolNDArray
+  bool_array_value (bool warn = false) const
+  {
+    boolNDArray retval (dim_vector (1, 1));
+
+    if (warn && scalar != 0.0 && scalar != 1.0)
+      gripe_logical_conversion ();
+
+    retval(0) = scalar.bool_value ();
+
+    return retval;
+  }
+
+  charNDArray
+  char_array_value (bool = false) const
+  {
+    charNDArray retval (dim_vector (1, 1));
+    retval(0) = scalar.char_value ();
+    return retval;
+  }
+
+  void increment (void)
+   {
+     scalar += OCTAVE_INT_T (1);
+   }
+
+  void decrement (void)
+   {
+     scalar -= OCTAVE_INT_T (1);
+   }
+
+  idx_vector index_vector (void) const { return idx_vector (scalar); }
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, octave_idx_type skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      return os.write (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (),
+                       block_size, output_type, skip, flt_fmt);
+    }
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const { return scalar.mex_get_data (); }
+
+  mxArray *as_mxArray (void) const
+  {
+    mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, 1, 1, mxREAL);
+
+    OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> (retval->get_data ());
+
+    pr[0] = scalar.value ();
+
+    return retval;
+  }
+
+  octave_value map (unary_mapper_t umap) const
+    {
+      switch (umap)
+        {
+        case umap_abs:
+          return scalar.abs ();
+        case umap_signum:
+          return scalar.signum ();
+        case umap_ceil:
+        case umap_conj:
+        case umap_fix:
+        case umap_floor:
+        case umap_real:
+        case umap_round:
+          return scalar;
+        case umap_imag:
+          return OCTAVE_INT_T ();
+        case umap_isnan:
+        case umap_isna:
+        case umap_isinf:
+          return false;
+        case umap_finite:
+          return true;
+
+        default:
+          {
+            octave_scalar m (scalar_value ());
+            return m.map (umap);
+          }
+        }
+    }
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-lazy-idx.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,197 @@
+/*
+
+Copyright (C) 2010-2012 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ov-lazy-idx.h"
+#include "ops.h"
+#include "ov-scalar.h"
+#include "ls-oct-ascii.h"
+#include "ls-oct-binary.h"
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_lazy_index, "lazy_index", "double");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_lazy_index&);
+
+  return v.full_value ().clone ();
+}
+
+octave_base_value::type_conv_info
+octave_lazy_index::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_lazy_index::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  switch (index.length (0))
+    {
+    case 1:
+      retval = new octave_scalar (static_cast<double> (index(0) + 1));
+      break;
+
+    case 0:
+      retval = new octave_matrix (NDArray (index.orig_dimensions ()));
+      break;
+
+    default:
+      break;
+    }
+
+  return retval;
+}
+
+octave_value
+octave_lazy_index::reshape (const dim_vector& new_dims) const
+{
+  return idx_vector (index.as_array ().reshape (new_dims),
+                     index.extent (0));
+}
+
+octave_value
+octave_lazy_index::permute (const Array<int>& vec, bool inv) const
+{
+  // If the conversion has already been made, forward the operation.
+  if (value.is_defined ())
+    return value.permute (vec, inv);
+  else
+    return idx_vector (index.as_array ().permute (vec, inv),
+                       index.extent (0));
+}
+
+octave_value
+octave_lazy_index::squeeze (void) const
+{
+  return idx_vector (index.as_array ().squeeze (),
+                     index.extent (0));
+}
+
+octave_value
+octave_lazy_index::sort (octave_idx_type dim, sortmode mode) const
+{
+  const dim_vector odims = index.orig_dimensions ();
+  // index_vector can employ a more efficient sorting algorithm.
+  if (mode == ASCENDING && odims.length () == 2
+      && (dim >= 0 && dim <= 1) && odims (1-dim) == 1)
+    return index_vector ().sorted ();
+  else
+    return idx_vector (index.as_array ().sort (dim, mode),
+                       index.extent (0));
+}
+
+octave_value
+octave_lazy_index::sort (Array<octave_idx_type> &sidx, octave_idx_type dim,
+                         sortmode mode) const
+{
+  const dim_vector odims = index.orig_dimensions ();
+  // index_vector can employ a more efficient sorting algorithm.
+  if (mode == ASCENDING && odims.length () == 2
+      && (dim >= 0 && dim <= 1) && odims (1-dim) == 1)
+    return index_vector ().sorted (sidx);
+  else
+    return idx_vector (index.as_array ().sort (sidx, dim, mode),
+                       index.extent (0));
+}
+
+sortmode
+octave_lazy_index::is_sorted (sortmode mode) const
+{
+  if (index.is_range ())
+    {
+      // Avoid the array conversion.
+      octave_idx_type inc = index.increment ();
+      if (inc == 0)
+        return (mode == UNSORTED ? ASCENDING : mode);
+      else if (inc > 0)
+        return (mode == DESCENDING ? UNSORTED : ASCENDING);
+      else
+        return (mode == ASCENDING ? UNSORTED : DESCENDING);
+    }
+  else
+    return index.as_array ().is_sorted (mode);
+}
+
+Array<octave_idx_type>
+octave_lazy_index::sort_rows_idx (sortmode mode) const
+{
+  return index.as_array ().sort_rows_idx (mode);
+}
+
+sortmode
+octave_lazy_index::is_sorted_rows (sortmode mode) const
+{
+  return index.as_array ().is_sorted_rows (mode);
+}
+
+static const std::string value_save_tag ("index_value");
+
+bool octave_lazy_index::save_ascii (std::ostream& os)
+{
+  return save_ascii_data (os, make_value (), value_save_tag, false, 0);
+}
+
+bool octave_lazy_index::load_ascii (std::istream& is)
+{
+  bool dummy;
+
+  std::string nm = read_ascii_data (is, std::string (), dummy, value, 0);
+
+  if (nm != value_save_tag)
+    error ("lazy_index: corrupted data on load");
+  else
+    index = value.index_vector ();
+
+  return ! error_state;
+}
+
+
+bool octave_lazy_index::save_binary (std::ostream& os, bool& save_as_floats)
+{
+  return save_binary_data (os, make_value (), value_save_tag,
+                           std::string (), false, save_as_floats);
+}
+
+bool octave_lazy_index::load_binary (std::istream& is, bool swap,
+                                     oct_mach_info::float_format fmt)
+{
+  bool dummy;
+  std::string doc;
+
+  std::string nm = read_binary_data (is, swap, fmt, std::string (),
+                                     dummy, value, doc);
+
+  if (nm != value_save_tag)
+    error ("lazy_index: corrupted data on load");
+  else
+    index = value.index_vector ();
+
+  return ! error_state;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-lazy-idx.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,250 @@
+/*
+
+Copyright (C) 2010-2012 VZLU Prague
+
+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_lazy_idx_h)
+#define octave_lazy_idx_h 1
+
+#include "ov-re-mat.h"
+
+// Lazy indices that stay in idx_vector form until the conversion to NDArray is
+// actually needed.
+
+class
+OCTINTERP_API
+octave_lazy_index : public octave_base_value
+{
+public:
+
+  octave_lazy_index (void)
+    : octave_base_value (), index (), value () { }
+
+  octave_lazy_index (const idx_vector& idx)
+    : octave_base_value (), index (idx), value () { }
+
+  octave_lazy_index (const octave_lazy_index& i)
+    : octave_base_value (), index (i.index), value (i.value) { }
+
+  ~octave_lazy_index (void) { }
+
+  octave_base_value *clone (void) const { return new octave_lazy_index (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  size_t byte_size (void) const { return numel () * sizeof (octave_idx_type); }
+
+  octave_value squeeze (void) const;
+
+  octave_value full_value (void) const { return make_value (); }
+
+  idx_vector index_vector (void) const
+    { return index; }
+
+  builtin_type_t builtin_type (void) const { return btyp_double; }
+
+  bool is_real_matrix (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    { return make_value ().subsref (type, idx); }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int)
+    { return subsref (type, idx); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false)
+    { return make_value ().do_index_op (idx, resize_ok); }
+
+  dim_vector dims (void) const { return index.orig_dimensions (); }
+
+  octave_idx_type numel (void) const { return index.length (0); }
+
+  octave_idx_type nnz (void) const { return numel (); }
+
+  octave_value reshape (const dim_vector& new_dims) const;
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const;
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const
+    { return make_value ().resize (dv, fill); }
+
+  octave_value all (int dim = 0) const { return make_value ().all (dim); }
+  octave_value any (int dim = 0) const { return make_value ().any (dim); }
+
+  MatrixType matrix_type (void) const { return make_value ().matrix_type (); }
+  MatrixType matrix_type (const MatrixType& _typ) const
+    { return make_value ().matrix_type (_typ); }
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
+
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const;
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const;
+
+  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const;
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
+
+  bool is_matrix_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return true; }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_true (void) const
+    { return make_value ().is_true (); }
+
+  bool print_as_scalar (void) const
+    { return make_value ().print_as_scalar (); }
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const
+    { make_value ().print (os, pr_as_read_syntax); }
+
+  void print_info (std::ostream& os, const std::string& prefix) const
+    { make_value ().print_info (os, prefix); }
+
+#define FORWARD_VALUE_QUERY(TYPE,NAME) \
+  TYPE \
+  NAME (void) const { return make_value ().NAME (); }
+
+  FORWARD_VALUE_QUERY (int8NDArray,  int8_array_value)
+  FORWARD_VALUE_QUERY (int16NDArray, int16_array_value)
+  FORWARD_VALUE_QUERY (int32NDArray, int32_array_value)
+  FORWARD_VALUE_QUERY (int64NDArray, int64_array_value)
+  FORWARD_VALUE_QUERY (uint8NDArray,  uint8_array_value)
+  FORWARD_VALUE_QUERY (uint16NDArray, uint16_array_value)
+  FORWARD_VALUE_QUERY (uint32NDArray, uint32_array_value)
+  FORWARD_VALUE_QUERY (uint64NDArray, uint64_array_value)
+
+#define FORWARD_VALUE_QUERY1(TYPE,NAME) \
+  TYPE \
+  NAME (bool flag = false) const { return make_value ().NAME (flag); }
+
+  FORWARD_VALUE_QUERY1 (double, double_value)
+
+  FORWARD_VALUE_QUERY1 (float, float_value)
+
+  FORWARD_VALUE_QUERY1 (double, scalar_value)
+
+  FORWARD_VALUE_QUERY1 (Matrix, matrix_value)
+
+  FORWARD_VALUE_QUERY1 (FloatMatrix, float_matrix_value)
+
+  FORWARD_VALUE_QUERY1 (Complex, complex_value)
+
+  FORWARD_VALUE_QUERY1 (FloatComplex, float_complex_value)
+
+  FORWARD_VALUE_QUERY1 (ComplexMatrix, complex_matrix_value)
+
+  FORWARD_VALUE_QUERY1 (FloatComplexMatrix, float_complex_matrix_value)
+
+  FORWARD_VALUE_QUERY1 (ComplexNDArray, complex_array_value)
+
+  FORWARD_VALUE_QUERY1 (FloatComplexNDArray, float_complex_array_value)
+
+  FORWARD_VALUE_QUERY1 (boolNDArray, bool_array_value)
+
+  FORWARD_VALUE_QUERY1 (charNDArray, char_array_value)
+
+  FORWARD_VALUE_QUERY1 (NDArray, array_value)
+
+  FORWARD_VALUE_QUERY1 (FloatNDArray, float_array_value)
+
+  FORWARD_VALUE_QUERY1 (SparseMatrix, sparse_matrix_value)
+
+  FORWARD_VALUE_QUERY1 (SparseComplexMatrix, sparse_complex_matrix_value)
+
+  octave_value diag (octave_idx_type k = 0) const
+    { return make_value ().diag (k); }
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const
+    { return make_value ().convert_to_str_internal (pad, force, type); }
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const
+    { return make_value ().print_raw (os, pr_as_read_syntax); }
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+  // HDF5 functions not defined.
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    { return make_value ().write (os, block_size, output_type, skip, flt_fmt); }
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const
+    { return make_value ().mex_get_data (); }
+
+  mxArray *as_mxArray (void) const
+    { return make_value ().as_mxArray (); }
+
+  octave_value map (unary_mapper_t umap) const
+    { return make_value ().map (umap); }
+
+private:
+  const octave_value& make_value (void) const
+    {
+      if (value.is_undefined ())
+        value = octave_value (index, false);
+
+      return value;
+    }
+
+  octave_value& make_value (void)
+    {
+      if (value.is_undefined ())
+        value = octave_value (index, false);
+
+      return value;
+    }
+
+  idx_vector index;
+  mutable octave_value value;
+
+  static octave_base_value *numeric_conversion_function (const octave_base_value&);
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-mex-fcn.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,162 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "oct-shlib.h"
+
+#include <defaults.h>
+#include "dynamic-ld.h"
+#include "error.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov-mex-fcn.h"
+#include "ov.h"
+#include "profiler.h"
+#include "toplev.h"
+#include "unwind-prot.h"
+
+DEFINE_OCTAVE_ALLOCATOR (octave_mex_function);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_mex_function,
+                                     "mex function", "mex function");
+
+octave_mex_function::octave_mex_function
+  (void *fptr, bool fmex, const octave_shlib& shl,
+   const std::string& nm)
+  : octave_function (nm), mex_fcn_ptr (fptr), exit_fcn_ptr (0),
+    have_fmex (fmex), sh_lib (shl)
+{
+  mark_fcn_file_up_to_date (time_parsed ());
+
+  std::string file_name = fcn_file_name ();
+
+  system_fcn_file
+    = (! file_name.empty ()
+       && Voct_file_dir == file_name.substr (0, Voct_file_dir.length ()));
+}
+
+octave_mex_function::~octave_mex_function (void)
+{
+  if (exit_fcn_ptr)
+    (*exit_fcn_ptr) ();
+
+  octave_dynamic_loader::remove_mex (my_name, sh_lib);
+}
+
+std::string
+octave_mex_function::fcn_file_name (void) const
+{
+  return sh_lib.file_name ();
+}
+
+octave_time
+octave_mex_function::time_parsed (void) const
+{
+  return sh_lib.time_loaded ();
+}
+
+octave_value_list
+octave_mex_function::subsref (const std::string& type,
+                              const std::list<octave_value_list>& idx,
+                              int nargout)
+{
+  octave_value_list retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
+
+        retval = do_multi_index_op (tmp_nargout, idx.front ());
+      }
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // FIXME -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_user_function::subsref.
+  //
+  // FIXME -- Note that if a function call returns multiple
+  // values, and there is further indexing to perform, then we are
+  // ignoring all but the first value.  Is this really what we want to
+  // do?  If it is not, then what should happen for stat("file").size,
+  // for exmaple?
+
+  if (idx.size () > 1)
+    retval = retval(0).next_subsref (nargout, type, idx);
+
+  return retval;
+}
+
+// FIXME -- shouldn't this declaration be a header file somewhere?
+extern octave_value_list
+call_mex (bool have_fmex, void *f, const octave_value_list& args,
+          int nargout, octave_mex_function *curr_mex_fcn);
+
+octave_value_list
+octave_mex_function::do_multi_index_op (int nargout,
+                                        const octave_value_list& args)
+{
+  octave_value_list retval;
+
+  if (error_state)
+    return retval;
+
+  if (args.has_magic_colon ())
+    ::error ("invalid use of colon in function argument list");
+  else
+    {
+      unwind_protect frame;
+
+      octave_call_stack::push (this);
+
+      frame.add_fcn (octave_call_stack::pop);
+
+      try
+        {
+          BEGIN_PROFILER_BLOCK (profiler_name ())
+          retval = call_mex (have_fmex, mex_fcn_ptr, args, nargout, this);
+          END_PROFILER_BLOCK
+        }
+      catch (octave_execution_exception)
+        {
+          gripe_library_execution_error ();
+        }
+    }
+
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-mex-fcn.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,122 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_mex_function_h)
+#define octave_mex_function_h 1
+
+#include <string>
+
+#include "oct-shlib.h"
+
+#include "ov-fcn.h"
+#include "ov-builtin.h"
+#include "ov-typeinfo.h"
+
+class octave_shlib;
+
+class octave_value;
+class octave_value_list;
+
+// Dynamically-linked functions.
+
+class
+octave_mex_function : public octave_function
+{
+public:
+
+  octave_mex_function (void)
+    : mex_fcn_ptr (), exit_fcn_ptr (), have_fmex (), sh_lib (),
+      t_checked (), system_fcn_file () { }
+
+  octave_mex_function (void *fptr, bool fmex, const octave_shlib& shl,
+                       const std::string& nm = std::string ());
+
+  ~octave_mex_function (void);
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    {
+      octave_value_list tmp = subsref (type, idx, 1);
+      return tmp.length () > 0 ? tmp(0) : octave_value ();
+    }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout);
+
+  octave_function *function_value (bool = false) { return this; }
+
+  const octave_function *function_value (bool = false) const { return this; }
+
+  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
+
+  std::string fcn_file_name (void) const;
+
+  octave_time time_parsed (void) const;
+
+  octave_time time_checked (void) const { return t_checked; }
+
+  bool is_system_fcn_file (void) const { return system_fcn_file; }
+
+  bool is_builtin_function (void) const { return false; }
+
+  bool is_mex_function (void) const { return true; }
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args);
+
+  void atexit (void (*fcn) (void)) { exit_fcn_ptr = fcn; }
+
+  octave_shlib get_shlib (void) const
+    { return sh_lib; }
+
+private:
+
+  void *mex_fcn_ptr;
+
+  void (*exit_fcn_ptr) (void);
+
+  bool have_fmex;
+
+  octave_shlib sh_lib;
+
+  // The time the file was last checked to see if it needs to be
+  // parsed again.
+  mutable octave_time t_checked;
+
+  // True if this function came from a file that is considered to be a
+  // system function.  This affects whether we check the time stamp
+  // on the file to see if it has changed.
+  bool system_fcn_file;
+
+  // No copying!
+
+  octave_mex_function (const octave_mex_function& fn);
+
+  octave_mex_function& operator = (const octave_mex_function& fn);
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-null-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,133 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "defun.h"
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_matrix, "null_matrix", "double");
+
+const octave_value octave_null_matrix::instance (new octave_null_matrix ());
+
+static octave_base_value *
+default_null_matrix_numeric_conversion_function (const octave_base_value& a)
+{
+  // The cast is not necessary?
+  // CAST_CONV_ARG (const octave_null_matrix&);
+
+  return a.empty_clone ();
+}
+
+octave_base_value::type_conv_info
+octave_null_matrix::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_null_matrix_numeric_conversion_function,
+                                            octave_matrix::static_type_id ());
+}
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_str, "null_string", "char");
+
+const octave_value octave_null_str::instance (new octave_null_str ());
+
+static octave_base_value *
+default_null_str_numeric_conversion_function (const octave_base_value& a)
+{
+  // The cast is not necessary?
+  // CAST_CONV_ARG (const octave_null_str&);
+
+  return a.empty_clone ();
+}
+
+octave_base_value::type_conv_info
+octave_null_str::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_null_str_numeric_conversion_function,
+                                            octave_char_matrix_str::static_type_id ());
+}
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_sq_str, "null_sq_string", "char");
+
+const octave_value octave_null_sq_str::instance (new octave_null_sq_str ());
+
+static octave_base_value *
+default_null_sq_str_numeric_conversion_function (const octave_base_value& a)
+{
+  // The cast is not necessary?
+  // CAST_CONV_ARG (const octave_null_sq_str&);
+
+  return a.empty_clone ();
+}
+
+octave_base_value::type_conv_info
+octave_null_sq_str::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_null_sq_str_numeric_conversion_function,
+                                            octave_char_matrix_sq_str::static_type_id ());
+}
+
+DEFUN (isnull, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} isnull (@var{x})\n\
+Return true if @var{x} is a special null matrix, string, or single quoted\n\
+string.  Indexed assignment with such a value on the right-hand side should\n\
+delete array elements.  This function should be used when overloading\n\
+indexed assignment for user-defined classes instead of @code{isempty}, to\n\
+distinguish the cases:\n\
+\n\
+@table @asis\n\
+@item @code{A(I) = []}\n\
+This should delete elements if @code{I} is nonempty.\n\
+\n\
+@item @code{X = []; A(I) = X}\n\
+This should give an error if @code{I} is nonempty.\n\
+@end table\n\
+@seealso{isempty, isindex}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1 && args(0).is_defined ())
+    retval = args(0).is_null_value ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!assert (isnull ([]), true)
+%!assert (isnull ([1]), false)
+%!assert (isnull (zeros (0,3)), false)
+%!assert (isnull (""), true)
+%!assert (isnull ("A"), false)
+%!assert (isnull (''), true)
+%!assert (isnull ('A'), false)
+%!test
+%! x = [];
+%! assert (isnull (x), false);
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-null-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,100 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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_null_matrix_h)
+#define octave_null_matrix_h 1
+
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-str-mat.h"
+
+// Design rationale:
+// The constructors are hidden. There is only one null matrix (or null string) object,
+// that can have shallow copies. Cloning the object returns just a normal empty matrix,
+// so all the shallow copies are, in fact, read-only. This conveniently ensures that any
+// attempt to fiddle with the null matrix destroys its special status.
+
+// The special [] value.
+
+class
+OCTINTERP_API
+octave_null_matrix : public octave_matrix
+{
+  octave_null_matrix (void) : octave_matrix () { }
+
+public:
+
+  static const octave_value instance;
+
+  bool is_null_value (void) const { return true; }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+private:
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+// The special "" value
+
+class
+OCTINTERP_API
+octave_null_str : public octave_char_matrix_str
+{
+  octave_null_str (void) : octave_char_matrix_str () { }
+
+public:
+
+  static const octave_value instance;
+
+  bool is_null_value (void) const { return true; }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+
+private:
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+// The special '' value
+
+class
+OCTINTERP_API
+octave_null_sq_str : public octave_char_matrix_sq_str
+{
+  octave_null_sq_str (void) : octave_char_matrix_sq_str () { }
+
+public:
+
+  static const octave_value instance;
+
+  bool is_null_value (void) const { return true; }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+private:
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-oncleanup.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,225 @@
+/*
+
+Copyright (C) 2010-2012 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "defun.h"
+#include "ov-oncleanup.h"
+#include "ov-fcn.h"
+#include "ov-usr-fcn.h"
+#include "pt-misc.h"
+#include "toplev.h"
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_oncleanup, "onCleanup",
+                                     "onCleanup");
+
+octave_oncleanup::octave_oncleanup (const octave_value& f)
+  : fcn (f)
+{
+  if (f.is_function_handle ())
+    {
+      octave_function *fptr = f.function_value (true);
+      if (fptr)
+        {
+          octave_user_function *uptr
+            = dynamic_cast<octave_user_function *> (fptr);
+
+          if (uptr != 0)
+            {
+              tree_parameter_list *pl = uptr->parameter_list ();
+
+              if (pl != 0 && pl->length () > 0)
+                warning ("onCleanup: cleanup action takes parameters");
+            }
+        }
+      else
+        error ("onCleanup: no default dispatch for function handle");
+    }
+  else
+    {
+      fcn = octave_value ();
+      error ("onCleanup: argument must be a function handle");
+    }
+}
+
+octave_oncleanup::~octave_oncleanup (void)
+{
+  if (fcn.is_undefined ())
+    return;
+
+  unwind_protect frame;
+
+  // Clear interrupts.
+  frame.protect_var (octave_interrupt_state);
+  octave_interrupt_state = 0;
+
+  // Disallow quit().
+  frame.protect_var (quit_allowed);
+  quit_allowed = false;
+
+  // Clear errors.
+  frame.protect_var (error_state);
+  error_state = 0;
+
+  try
+    {
+      // Run the actual code.
+      fcn.do_multi_index_op (0, octave_value_list ());
+    }
+  catch (octave_interrupt_exception)
+    {
+      // Swallow the interrupt.
+      warning ("onCleanup: interrupt occured in cleanup action");
+    }
+  catch (std::bad_alloc)
+    {
+      // Swallow the exception.
+      warning ("onCleanup: out of memory occured in cleanup action");
+    }
+  catch (...) // Yes, the black hole. We're in a d-tor.
+    {
+      // This shouldn't happen, in theory.
+      error ("onCleanup: internal error: unhandled exception in cleanup action");
+    }
+
+  // We don't want to ignore errors that occur in the cleanup code, so
+  // if an error is encountered there, leave error_state alone.
+  // Otherwise, set it back to what it was before.
+  if (error_state)
+    {
+      frame.discard_top ();
+      octave_call_stack::backtrace_error_message ();
+    }
+}
+
+octave_scalar_map
+octave_oncleanup::scalar_map_value (void) const
+{
+  octave_scalar_map retval;
+  retval.setfield ("task", fcn);
+  return retval;
+}
+
+static void
+warn_save_load (void)
+{
+  warning ("onCleanup: load and save not supported");
+}
+
+bool
+octave_oncleanup::save_ascii (std::ostream& /* os */)
+{
+  warn_save_load ();
+  return true;
+}
+
+bool
+octave_oncleanup::load_ascii (std::istream& /* is */)
+{
+  warn_save_load ();
+  return true;
+}
+
+bool
+octave_oncleanup::save_binary (std::ostream& /* os */, bool& /* save_as_floats */)
+{
+  warn_save_load ();
+  return true;
+}
+
+bool
+octave_oncleanup::load_binary (std::istream& /* is */, bool /* swap */,
+                               oct_mach_info::float_format /* fmt */)
+{
+  warn_save_load ();
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+bool
+octave_oncleanup::save_hdf5 (hid_t /* loc_id */, const char * /* name */,
+                             bool /* save_as_floats */)
+{
+  warn_save_load ();
+  return true;
+}
+
+bool
+octave_oncleanup::load_hdf5 (hid_t /* loc_id */, const char * /* name */)
+{
+  warn_save_load ();
+  return true;
+}
+#endif
+
+void
+octave_oncleanup::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+
+void
+octave_oncleanup::print_raw (std::ostream& os, bool pr_as_read_syntax) const
+{
+  os << "onCleanup (";
+  if (fcn.is_defined ())
+    fcn.print_raw (os, pr_as_read_syntax);
+  os << ")";
+}
+
+DEFUN (onCleanup, args, ,
+  "-*- texinfo -*-\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\
+clearing the last copy of the object.  Note that if multiple local onCleanup\n\
+variables are created, the order in which they are called is unspecified.\n\
+For similar functionality @xref{The @code{unwind_protect} Statement}.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = octave_value (new octave_oncleanup (args(0)));
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!test
+%! old_wstate = warning ("query");
+%! unwind_protect
+%!   trigger = onCleanup (@() warning ("on", "__MY_WARNING__"));
+%!   warning ("off", "__MY_WARNING__");
+%!   assert ((warning ("query", "__MY_WARNING__")).state, "off");
+%!   clear trigger;
+%!   assert ((warning ("query", "__MY_WARNING__")).state, "on");
+%! unwind_protect_cleanup
+%!   warning (old_wstate);
+%! end_unwind_protect
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-oncleanup.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,101 @@
+/*
+
+Copyright (C) 2010-2012 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iosfwd>
+
+#include "ov-base.h"
+#include "ov-struct.h"
+#include "ov.h"
+
+static void
+gripe_internal (void)
+{
+  error ("onCleanup: internal error: cloning nonempty object");
+}
+
+class octave_oncleanup : public octave_base_value
+{
+public:
+  octave_oncleanup (void) : fcn () { }
+
+  octave_oncleanup (const octave_value& fcn);
+
+  octave_base_value *clone (void) const
+  {
+    if (fcn.is_defined ())
+      gripe_internal ();
+
+    return empty_clone ();
+  }
+
+  octave_base_value *empty_clone (void) const
+  {
+    return new octave_oncleanup ();
+  }
+
+  ~octave_oncleanup (void);
+
+  bool is_defined (void) const { return true; }
+
+  bool is_object (void) const { return true; } // do we want this?
+
+  octave_map map_value (void) const { return scalar_map_value (); }
+
+  octave_scalar_map scalar_map_value (void) const;
+
+  dim_vector dims (void) const
+  {
+    static dim_vector dv (1, 1);
+    return dv;
+  }
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+private:
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+
+protected:
+
+  octave_value fcn;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-perm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,449 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "byte-swap.h"
+
+#include "ov-perm.h"
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+#include "error.h"
+#include "gripes.h"
+#include "ops.h"
+#include "pr-output.h"
+
+#include "ls-oct-ascii.h"
+
+octave_value
+octave_perm_matrix::subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      retval = do_index_op (idx.front ());
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval.next_subsref (type, idx);
+}
+
+octave_value
+octave_perm_matrix::do_index_op (const octave_value_list& idx,
+                                 bool resize_ok)
+{
+  octave_value retval;
+  octave_idx_type nidx = idx.length ();
+  idx_vector idx0, idx1;
+  if (nidx == 2)
+    {
+      idx0 = idx(0).index_vector ();
+      idx1 = idx(1).index_vector ();
+    }
+
+  // This hack is to allow constructing permutation matrices using
+  // eye(n)(p,:), eye(n)(:,q) && eye(n)(p,q) where p & q are permutation
+  // vectors.
+  // Note that, for better consistency, eye(n)(:,:) still converts to a full
+  // matrix.
+  if (! error_state && nidx == 2)
+    {
+      bool left = idx0.is_permutation (matrix.rows ());
+      bool right = idx1.is_permutation (matrix.cols ());
+
+      if (left && right)
+        {
+          if (idx0.is_colon ()) left = false;
+          if (idx1.is_colon ()) right = false;
+          if (left || right)
+            {
+              PermMatrix p = matrix;
+              if (left)
+                p = PermMatrix (idx0, false) * p;
+              if (right)
+                p = p * PermMatrix (idx1, true);
+              retval = p;
+            }
+          else
+            {
+              retval = this;
+              this->count++;
+            }
+        }
+    }
+
+  // if error_state is set, we've already griped.
+  if (! error_state && ! retval.is_defined ())
+    {
+      if (nidx == 2 && ! resize_ok &&
+          idx0.is_scalar () && idx1.is_scalar ())
+        {
+          retval = matrix.checkelem (idx0(0), idx1(0));
+        }
+      else
+        retval = to_dense ().do_index_op (idx, resize_ok);
+    }
+
+  return retval;
+}
+
+bool
+octave_perm_matrix::is_true (void) const
+{
+  return to_dense ().is_true ();
+}
+
+double
+octave_perm_matrix::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (numel () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 type_name (), "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion (type_name (), "real scalar");
+
+  return retval;
+}
+
+float
+octave_perm_matrix::float_value (bool) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (numel () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 type_name (), "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion (type_name (), "real scalar");
+
+  return retval;
+}
+
+Complex
+octave_perm_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 type_name (), "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion (type_name (), "complex scalar");
+
+  return retval;
+}
+
+FloatComplex
+octave_perm_matrix::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 type_name (), "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion (type_name (), "complex scalar");
+
+  return retval;
+}
+
+#define FORWARD_MATRIX_VALUE(TYPE, PREFIX) \
+TYPE \
+octave_perm_matrix::PREFIX ## _value (bool frc_str_conv) const \
+{ \
+  return to_dense ().PREFIX ## _value (frc_str_conv); \
+}
+
+SparseMatrix
+octave_perm_matrix::sparse_matrix_value (bool) const
+{
+  return SparseMatrix (matrix);
+}
+
+SparseBoolMatrix
+octave_perm_matrix::sparse_bool_matrix_value (bool) const
+{
+  return SparseBoolMatrix (matrix);
+}
+
+SparseComplexMatrix
+octave_perm_matrix::sparse_complex_matrix_value (bool) const
+{
+  return SparseComplexMatrix (sparse_matrix_value ());
+}
+
+FORWARD_MATRIX_VALUE (Matrix, matrix)
+FORWARD_MATRIX_VALUE (FloatMatrix, float_matrix)
+FORWARD_MATRIX_VALUE (ComplexMatrix, complex_matrix)
+FORWARD_MATRIX_VALUE (FloatComplexMatrix, float_complex_matrix)
+
+FORWARD_MATRIX_VALUE (NDArray, array)
+FORWARD_MATRIX_VALUE (FloatNDArray, float_array)
+FORWARD_MATRIX_VALUE (ComplexNDArray, complex_array)
+FORWARD_MATRIX_VALUE (FloatComplexNDArray, float_complex_array)
+
+FORWARD_MATRIX_VALUE (boolNDArray, bool_array)
+FORWARD_MATRIX_VALUE (charNDArray, char_array)
+
+idx_vector
+octave_perm_matrix::index_vector (void) const
+{
+  return to_dense ().index_vector ();
+}
+
+octave_value
+octave_perm_matrix::convert_to_str_internal (bool pad, bool force, char type) const
+{
+  return to_dense ().convert_to_str_internal (pad, force, type);
+}
+
+bool
+octave_perm_matrix::save_ascii (std::ostream& os)
+{
+  typedef octave_int<octave_idx_type> idx_int_type;
+
+  os << "# size: " << matrix.rows () << "\n";
+  os << "# orient: " << (matrix.is_col_perm () ? 'c' : 'r') << '\n';
+
+  Array<octave_idx_type> pvec = matrix.pvec ();
+  octave_idx_type n = pvec.length ();
+  ColumnVector tmp (n);
+  for (octave_idx_type i = 0; i < n; i++) tmp(i) = pvec(i) + 1;
+  os << tmp;
+
+  return true;
+}
+
+bool
+octave_perm_matrix::load_ascii (std::istream& is)
+{
+  typedef octave_int<octave_idx_type> idx_int_type;
+  octave_idx_type n;
+  bool success = true;
+  char orient;
+
+  if (extract_keyword (is, "size", n, true)
+      && extract_keyword (is, "orient", orient, true))
+    {
+      bool colp = orient == 'c';
+      ColumnVector tmp (n);
+      is >> tmp;
+      if (!is)
+        {
+          error ("load: failed to load permutation matrix constant");
+          success = false;
+        }
+      else
+        {
+          Array<octave_idx_type> pvec (dim_vector (n, 1));
+          for (octave_idx_type i = 0; i < n; i++) pvec(i) = tmp(i) - 1;
+          matrix = PermMatrix (pvec, colp);
+
+          // Invalidate cache. Probably not necessary, but safe.
+          dense_cache = octave_value ();
+        }
+    }
+  else
+    {
+      error ("load: failed to extract size & orientation");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_perm_matrix::save_binary (std::ostream& os, bool&)
+{
+
+  int32_t sz = matrix.rows ();
+  bool colp = matrix.is_col_perm ();
+  os.write (reinterpret_cast<char *> (&sz), 4);
+  os.write (reinterpret_cast<char *> (&colp), 1);
+  os.write (reinterpret_cast<const char *> (matrix.data ()), matrix.byte_size ());
+
+  return true;
+}
+
+bool
+octave_perm_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format )
+{
+  int32_t sz;
+  bool colp;
+  if (! (is.read (reinterpret_cast<char *> (&sz), 4)
+         && is.read (reinterpret_cast<char *> (&colp), 1)))
+    return false;
+
+  MArray<octave_idx_type> m (dim_vector (sz, 1));
+
+  if (! is.read (reinterpret_cast<char *> (m.fortran_vec ()), m.byte_size ()))
+    return false;
+
+  if (swap)
+    {
+      int nel = m.numel ();
+      for (int i = 0; i < nel; i++)
+        switch (sizeof (octave_idx_type))
+          {
+          case 8:
+            swap_bytes<8> (&m(i));
+            break;
+          case 4:
+            swap_bytes<4> (&m(i));
+            break;
+          case 2:
+            swap_bytes<2> (&m(i));
+            break;
+          case 1:
+          default:
+            break;
+          }
+    }
+
+  matrix = PermMatrix (m, colp);
+  return true;
+}
+
+void
+octave_perm_matrix::print_raw (std::ostream& os,
+                               bool pr_as_read_syntax) const
+{
+  return octave_print_internal (os, matrix, pr_as_read_syntax,
+                                current_print_indent_level ());
+}
+
+mxArray *
+octave_perm_matrix::as_mxArray (void) const
+{
+  return to_dense ().as_mxArray ();
+}
+
+bool
+octave_perm_matrix::print_as_scalar (void) const
+{
+  dim_vector dv = dims ();
+
+  return (dv.all_ones () || dv.any_zero ());
+}
+
+void
+octave_perm_matrix::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+
+int
+octave_perm_matrix::write (octave_stream& os, int block_size,
+                                oct_data_conv::data_type output_type, int skip,
+                                oct_mach_info::float_format flt_fmt) const
+{
+  return to_dense ().write (os, block_size, output_type, skip, flt_fmt);
+}
+
+void
+octave_perm_matrix::print_info (std::ostream& os,
+                                    const std::string& prefix) const
+{
+  matrix.print_info (os, prefix);
+}
+
+
+octave_value
+octave_perm_matrix::to_dense (void) const
+{
+  if (! dense_cache.is_defined ())
+      dense_cache = Matrix (matrix);
+
+  return dense_cache;
+}
+
+DEFINE_OCTAVE_ALLOCATOR (octave_perm_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_perm_matrix,
+                                     "permutation matrix", "double");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_perm_matrix&);
+
+  return new octave_matrix (v.matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_perm_matrix::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_perm_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.nelem () == 1)
+    retval = new octave_scalar (matrix (0, 0));
+
+  return retval;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-perm.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,234 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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_perm_matrix_h)
+#define octave_perm_matrix_h 1
+
+#include "mx-base.h"
+#include "str-vec.h"
+
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+#include "oct-obj.h"
+
+class
+OCTINTERP_API
+octave_perm_matrix : public octave_base_value
+{
+public:
+  octave_perm_matrix (void) : matrix (), dense_cache () { }
+
+  octave_perm_matrix (const PermMatrix& p) : matrix (p), dense_cache () { }
+
+  octave_base_value *clone (void) const { return new octave_perm_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_perm_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  size_t byte_size (void) const { return matrix.byte_size (); }
+
+  octave_value squeeze (void) const { return matrix; }
+
+  octave_value full_value (void) const { return to_dense (); }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int)
+    { return subsref (type, idx); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  dim_vector dims (void) const { return matrix.dims (); }
+
+  octave_idx_type nnz (void) const { return matrix.rows (); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return to_dense ().reshape (new_dims); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return to_dense ().permute (vec, inv); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const
+    { return to_dense ().resize (dv, fill); }
+
+  octave_value all (int dim = 0) const { return to_dense ().all (dim); }
+  octave_value any (int dim = 0) const { return to_dense ().any (dim); }
+
+  MatrixType matrix_type (void) const { return MatrixType::Permuted_Diagonal; }
+  MatrixType matrix_type (const MatrixType&) const
+    { return matrix_type (); }
+
+  octave_value diag (octave_idx_type k = 0) const
+    { return to_dense () .diag (k); }
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
+    { return to_dense ().sort (dim, mode); }
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const
+    { return to_dense ().sort (sidx, dim, mode); }
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const
+    { return to_dense ().is_sorted (mode); }
+
+  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
+    { return to_dense ().sort_rows_idx (mode); }
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
+    { return to_dense ().is_sorted_rows (mode); }
+
+  builtin_type_t builtin_type (void) const { return btyp_double; }
+
+  bool is_perm_matrix (void) const { return true; }
+
+  bool is_matrix_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return true; }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_real_matrix (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  bool is_true (void) const;
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  idx_vector index_vector (void) const;
+
+  PermMatrix perm_matrix_value (void) const
+    { return matrix; }
+
+  Matrix matrix_value (bool = false) const;
+
+  FloatMatrix float_matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool warn = false) const;
+
+  charNDArray char_array_value (bool = false) const;
+
+  NDArray array_value (bool = false) const;
+
+  FloatNDArray float_array_value (bool = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const;
+
+  SparseBoolMatrix sparse_bool_matrix_value (bool = false) const;
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
+
+  int8NDArray
+  int8_array_value (void) const { return to_dense ().int8_array_value (); }
+
+  int16NDArray
+  int16_array_value (void) const { return to_dense ().int16_array_value (); }
+
+  int32NDArray
+  int32_array_value (void) const { return to_dense ().int32_array_value (); }
+
+  int64NDArray
+  int64_array_value (void) const { return to_dense ().int64_array_value (); }
+
+  uint8NDArray
+  uint8_array_value (void) const { return to_dense ().uint8_array_value (); }
+
+  uint16NDArray
+  uint16_array_value (void) const { return to_dense ().uint16_array_value (); }
+
+  uint32NDArray
+  uint32_array_value (void) const { return to_dense ().uint32_array_value (); }
+
+  uint64NDArray
+  uint64_array_value (void) const { return to_dense ().uint64_array_value (); }
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const;
+
+  mxArray *as_mxArray (void) const;
+
+  bool print_as_scalar (void) const;
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_info (std::ostream& os, const std::string& prefix) const;
+
+  octave_value map (unary_mapper_t umap) const
+    { return to_dense ().map (umap); }
+
+protected:
+
+  PermMatrix matrix;
+
+  virtual octave_value to_dense (void) const;
+
+  mutable octave_value dense_cache;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-range.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,691 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+
+#include "defun.h"
+#include "variables.h"
+#include "gripes.h"
+#include "ops.h"
+#include "oct-obj.h"
+#include "ov-range.h"
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+#include "pr-output.h"
+
+#include "byte-swap.h"
+#include "ls-ascii-helper.h"
+#include "ls-hdf5.h"
+#include "ls-utils.h"
+
+// If TRUE, allow ranges with non-integer elements as array indices.
+bool Vallow_noninteger_range_as_index = false;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_range);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_range, "range", "double");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_range&);
+
+  return new octave_matrix (v.matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_range::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_range::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  switch (range.nelem ())
+    {
+    case 1:
+      retval = new octave_scalar (range.base ());
+      break;
+
+    case 0:
+      retval = new octave_matrix (Matrix (1, 0));
+      break;
+
+    case -2:
+      retval = new octave_matrix (range.matrix_value ());
+      break;
+
+    default:
+      break;
+    }
+
+  return retval;
+}
+
+octave_value
+octave_range::subsref (const std::string& type,
+                       const std::list<octave_value_list>& idx)
+{
+  octave_value retval;
+
+  switch (type[0])
+    {
+    case '(':
+      retval = do_index_op (idx.front ());
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  return retval.next_subsref (type, idx);
+}
+
+octave_value
+octave_range::do_index_op (const octave_value_list& idx, bool resize_ok)
+{
+  if (idx.length () == 1 && ! resize_ok)
+    {
+      octave_value retval;
+
+      // The range can handle a single subscript.
+      idx_vector i = idx(0).index_vector ();
+      if (! error_state)
+        {
+          if (i.is_scalar () && i(0) < range.nelem ())
+            retval = range.elem (i(0));
+          else
+            retval = range.index (i);
+        }
+
+      return retval;
+    }
+  else
+    {
+      octave_value tmp (new octave_matrix (range.matrix_value ()));
+
+      return tmp.do_index_op (idx, resize_ok);
+    }
+}
+
+idx_vector
+octave_range::index_vector (void) const
+{
+  if (idx_cache)
+    return *idx_cache;
+  else
+    {
+      if (! Vallow_noninteger_range_as_index
+          || range.all_elements_are_ints ())
+        return set_idx_cache (idx_vector (range));
+      else
+        {
+          warning_with_id ("Octave:noninteger-range-as-index",
+                           "non-integer range used as index");
+
+          return octave_value (matrix_value ()).round ().index_vector ();
+        }
+    }
+}
+
+double
+octave_range::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  octave_idx_type nel = range.nelem ();
+
+  if (nel > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "range", "real scalar");
+
+      retval = range.base ();
+    }
+  else
+    gripe_invalid_conversion ("range", "real scalar");
+
+  return retval;
+}
+
+float
+octave_range::float_value (bool) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  octave_idx_type nel = range.nelem ();
+
+  if (nel > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "range", "real scalar");
+
+      retval = range.base ();
+    }
+  else
+    gripe_invalid_conversion ("range", "real scalar");
+
+  return retval;
+}
+
+charNDArray
+octave_range::char_array_value (bool) const
+{
+  const Matrix matrix = range.matrix_value ();
+  charNDArray retval (dims ());
+
+  octave_idx_type nel = numel ();
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    retval.elem (i) = static_cast<char>(matrix.elem (i));
+
+  return retval;
+}
+
+octave_value
+octave_range::all (int dim) const
+{
+  // FIXME -- this is a potential waste of memory.
+
+  Matrix m = range.matrix_value ();
+
+  return m.all (dim);
+}
+
+octave_value
+octave_range::any (int dim) const
+{
+  // FIXME -- this is a potential waste of memory.
+
+  Matrix m = range.matrix_value ();
+
+  return m.any (dim);
+}
+
+octave_value
+octave_range::diag (octave_idx_type k) const
+{
+  return (k == 0
+          ? octave_value (DiagMatrix (DiagArray2<double> (range.matrix_value ())))
+          : octave_value (range.diag (k)));
+}
+
+octave_value
+octave_range::diag (octave_idx_type m, octave_idx_type n) const
+{
+  Matrix mat = range.matrix_value ();
+
+  return mat.diag (m, n);
+}
+
+bool
+octave_range::is_true (void) const
+{
+  bool retval = false;
+
+  if (range.nelem () != 0)
+    {
+      // FIXME -- this is a potential waste of memory.
+
+      Matrix m ((range.matrix_value () . all ()) . all ());
+
+      retval = (m.rows () == 1 && m.columns () == 1 && m (0, 0) != 0.0);
+    }
+
+  return retval;
+}
+
+Complex
+octave_range::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  octave_idx_type nel = range.nelem ();
+
+  if (nel > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "range", "complex scalar");
+
+      retval = range.base ();
+    }
+  else
+    gripe_invalid_conversion ("range", "complex scalar");
+
+  return retval;
+}
+
+FloatComplex
+octave_range::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  octave_idx_type nel = range.nelem ();
+
+  if (nel > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "range", "complex scalar");
+
+      retval = range.base ();
+    }
+  else
+    gripe_invalid_conversion ("range", "complex scalar");
+
+  return retval;
+}
+
+boolNDArray
+octave_range::bool_array_value (bool warn) const
+{
+  Matrix m = range.matrix_value ();
+
+  if (m.any_element_is_nan ())
+    gripe_nan_to_logical_conversion ();
+  else if (warn && m.any_element_not_one_or_zero ())
+    gripe_logical_conversion ();
+
+  return boolNDArray (m);
+}
+
+octave_value
+octave_range::resize (const dim_vector& dv, bool fill) const
+{
+  NDArray retval = array_value ();
+  if (fill)
+    retval.resize (dv, 0);
+  else
+    retval.resize (dv);
+  return retval;
+}
+
+octave_value
+octave_range::convert_to_str_internal (bool pad, bool force, char type) const
+{
+  octave_value tmp (range.matrix_value ());
+  return tmp.convert_to_str (pad, force, type);
+}
+
+void
+octave_range::print (std::ostream& os, bool pr_as_read_syntax) const
+{
+  print_raw (os, pr_as_read_syntax);
+  newline (os);
+}
+
+void
+octave_range::print_raw (std::ostream& os, bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, range, pr_as_read_syntax,
+                         current_print_indent_level ());
+}
+
+bool
+octave_range::print_name_tag (std::ostream& os, const std::string& name) const
+{
+  bool retval = false;
+
+  octave_idx_type n = range.nelem ();
+
+  indent (os);
+
+  if (n == 0 || n == 1)
+    os << name << " = ";
+  else
+    {
+      os << name << " =";
+      newline (os);
+      if (! Vcompact_format)
+        newline (os);
+
+      retval = true;
+    }
+
+  return retval;
+}
+
+// Skip white space and comments on stream IS.
+
+static void
+skip_comments (std::istream& is)
+{
+  char c = '\0';
+  while (is.get (c))
+    {
+      if (c == ' ' || c == '\t' || c == '\n')
+        ; // Skip whitespace on way to beginning of next line.
+      else
+        break;
+    }
+
+  skip_until_newline (is, false);
+}
+
+bool
+octave_range::save_ascii (std::ostream& os)
+{
+  Range r = range_value ();
+  double base = r.base ();
+  double limit = r.limit ();
+  double inc = r.inc ();
+  octave_idx_type len = r.nelem ();
+
+  if (inc != 0)
+    os << "# base, limit, increment\n";
+  else
+    os << "# base, length, increment\n";
+
+  octave_write_double (os, base);
+  os << " ";
+  if (inc != 0)
+    octave_write_double (os, limit);
+  else
+    os << len;
+  os << " ";
+  octave_write_double (os, inc);
+  os << "\n";
+
+  return true;
+}
+
+bool
+octave_range::load_ascii (std::istream& is)
+{
+  // # base, limit, range comment added by save ().
+  skip_comments (is);
+
+  double base, limit, inc;
+  is >> base >> limit >> inc;
+
+  if (!is)
+    {
+      error ("load: failed to load range constant");
+      return false;
+    }
+
+  if (inc != 0)
+    range = Range (base, limit, inc);
+  else
+    range = Range (base, inc, static_cast<octave_idx_type> (limit));
+
+  return true;
+}
+
+bool
+octave_range::save_binary (std::ostream& os, bool& /* save_as_floats */)
+{
+  char tmp = LS_DOUBLE;
+  os.write (reinterpret_cast<char *> (&tmp), 1);
+  Range r = range_value ();
+  double bas = r.base ();
+  double lim = r.limit ();
+  double inc = r.inc ();
+  if (inc == 0)
+    lim = r.nelem ();
+
+  os.write (reinterpret_cast<char *> (&bas), 8);
+  os.write (reinterpret_cast<char *> (&lim), 8);
+  os.write (reinterpret_cast<char *> (&inc), 8);
+
+  return true;
+}
+
+bool
+octave_range::load_binary (std::istream& is, bool swap,
+                           oct_mach_info::float_format /* fmt */)
+{
+  char tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+    return false;
+  double bas, lim, inc;
+  if (! is.read (reinterpret_cast<char *> (&bas), 8))
+    return false;
+  if (swap)
+    swap_bytes<8> (&bas);
+  if (! is.read (reinterpret_cast<char *> (&lim), 8))
+    return false;
+  if (swap)
+    swap_bytes<8> (&lim);
+  if (! is.read (reinterpret_cast<char *> (&inc), 8))
+    return false;
+  if (swap)
+    swap_bytes<8> (&inc);
+  if (inc != 0)
+    range = Range (bas, lim, inc);
+  else
+    range = Range (bas, inc, static_cast<octave_idx_type> (lim));
+
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+// The following subroutines creates an HDF5 representation of the way
+// we will store Octave range types (triplets of floating-point numbers).
+// NUM_TYPE is the HDF5 numeric type to use for storage (e.g.
+// H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary
+// conversions are handled automatically by HDF5.
+
+static hid_t
+hdf5_make_range_type (hid_t num_type)
+{
+  hid_t type_id = H5Tcreate (H5T_COMPOUND, sizeof (double) * 3);
+
+  H5Tinsert (type_id, "base", 0 * sizeof (double), num_type);
+  H5Tinsert (type_id, "limit", 1 * sizeof (double), num_type);
+  H5Tinsert (type_id, "increment", 2 * sizeof (double), num_type);
+
+  return type_id;
+}
+
+bool
+octave_range::save_hdf5 (hid_t loc_id, const char *name,
+                         bool /* save_as_floats */)
+{
+  hsize_t dimens[3];
+  hid_t space_hid = -1, type_hid = -1, data_hid = -1;
+  bool retval = true;
+
+  space_hid = H5Screate_simple (0, dimens, 0);
+  if (space_hid < 0) return false;
+
+  type_hid = hdf5_make_range_type (H5T_NATIVE_DOUBLE);
+  if (type_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Tclose (type_hid);
+      return false;
+    }
+
+  Range r = range_value ();
+  double range_vals[3];
+  range_vals[0] = r.base ();
+  range_vals[1] = r.inc () != 0 ? r.limit () : r.nelem ();
+  range_vals[2] = r.inc ();
+
+  if (H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                range_vals) >= 0)
+    {
+      octave_idx_type nel = r.nelem ();
+      retval = hdf5_add_scalar_attr (data_hid, H5T_NATIVE_IDX,
+                                     "OCTAVE_RANGE_NELEM", &nel) >= 0;
+    }
+  else
+    retval = false;
+
+  H5Dclose (data_hid);
+  H5Tclose (type_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_range::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t type_hid = H5Dget_type (data_hid);
+
+  hid_t range_type = hdf5_make_range_type (H5T_NATIVE_DOUBLE);
+
+  if (! hdf5_types_compatible (type_hid, range_type))
+    {
+      H5Tclose (range_type);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  hid_t space_hid = H5Dget_space (data_hid);
+  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Tclose (range_type);
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  double rangevals[3];
+  if (H5Dread (data_hid, range_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+               rangevals) >= 0)
+    {
+      retval = true;
+      octave_idx_type nel;
+      if (hdf5_get_scalar_attr (data_hid, H5T_NATIVE_IDX,
+                                "OCTAVE_RANGE_NELEM", &nel))
+        range = Range (rangevals[0], rangevals[2], nel);
+      else
+        {
+          if (rangevals[2] != 0)
+            range = Range (rangevals[0], rangevals[1], rangevals[2]);
+          else
+            range = Range (rangevals[0], rangevals[2],
+                           static_cast<octave_idx_type> (rangevals[1]));
+        }
+    }
+
+  H5Tclose (range_type);
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_range::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxREAL);
+
+  double *pr = static_cast<double *> (retval->get_data ());
+
+  mwSize nel = numel ();
+
+  Matrix m = matrix_value ();
+
+  const double *p = m.data ();
+
+  for (mwSize i = 0; i < nel; i++)
+    pr[i] = p[i];
+
+  return retval;
+}
+
+DEFUN (allow_noninteger_range_as_index, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} allow_noninteger_range_as_index ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} allow_noninteger_range_as_index (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} allow_noninteger_range_as_index (@var{new_val}, \"local\")\n\
+Query or set the internal variable that controls whether non-integer\n\
+ranges are allowed as indices.  This might be useful for @sc{matlab}\n\
+compatibility; however, it is still not entirely compatible because\n\
+@sc{matlab} treats the range expression differently in different contexts.\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (allow_noninteger_range_as_index);
+}
+
+/*
+%!test
+%! x = 0:10;
+%! save = allow_noninteger_range_as_index ();
+%! warn_state = warning ("query", "Octave:noninteger-range-as-index");
+%! unwind_protect
+%!   allow_noninteger_range_as_index (false);
+%!   fail ("x(2.1:5)");
+%!   assert (x(2:5), 1:4);
+%!   allow_noninteger_range_as_index (true);
+%!   warning ("off", "Octave:noninteger-range-as-index");
+%!   assert (x(2.49:5), 1:3);
+%!   assert (x(2.5:5), 2:4);
+%!   assert (x(2.51:5), 2:4);
+%! unwind_protect_cleanup
+%!   allow_noninteger_range_as_index (save);
+%!   warning (warn_state.state, warn_state.identifier);
+%! end_unwind_protect
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-range.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,322 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_range_h)
+#define octave_range_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "Range.h"
+
+#include "lo-mappers.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Range values.
+
+class
+octave_range : public octave_base_value
+{
+public:
+
+  octave_range (void)
+    : octave_base_value (), range (), idx_cache () { }
+
+  octave_range (double base, double limit, double inc)
+    : octave_base_value (), range (base, limit, inc), idx_cache ()
+      {
+        if (range.nelem () < 0)
+          ::error ("invalid range");
+      }
+
+  octave_range (const Range& r)
+    : octave_base_value (), range (r), idx_cache ()
+      {
+        if (range.nelem () < 0 && range.nelem () != -2)
+          ::error ("invalid range");
+      }
+
+  octave_range (const octave_range& r)
+    : octave_base_value (), range (r.range),
+      idx_cache (r.idx_cache ? new idx_vector (*r.idx_cache) : 0)
+    { }
+
+  octave_range (const Range& r, const idx_vector& cache)
+    : octave_base_value (), range (r), idx_cache ()
+      {
+        set_idx_cache (cache);
+      }
+
+  ~octave_range (void) { clear_cached_info (); }
+
+  octave_base_value *clone (void) const { return new octave_range (*this); }
+
+  // A range is really just a special kind of real matrix object.  In
+  // the places where we need to call empty_clone, it makes more sense
+  // to create an empty matrix (0x0) instead of an empty range (1x0).
+  octave_base_value *empty_clone (void) const { return new octave_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int)
+    { return subsref (type, idx); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  idx_vector index_vector (void) const;
+
+  dim_vector dims (void) const
+    {
+      octave_idx_type n = range.nelem ();
+      return dim_vector (n > 0, n);
+    }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+
+  size_t byte_size (void) const { return 3 * sizeof (double); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return NDArray (array_value ().reshape (new_dims)); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return NDArray (array_value ().permute (vec, inv)); }
+
+  octave_value squeeze (void) const { return range; }
+
+  octave_value full_value (void) const { return range.matrix_value (); }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_range (void) const { return true; }
+
+  octave_value all (int dim = 0) const;
+
+  octave_value any (int dim = 0) const;
+
+  octave_value diag (octave_idx_type k = 0) const;
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
+    { return range.sort (dim, mode); }
+
+  octave_value sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const
+    { return range.sort (sidx, dim, mode); }
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const
+    { return range.is_sorted (mode); }
+
+  Array<octave_idx_type> sort_rows_idx (sortmode) const
+    { return Array<octave_idx_type> (dim_vector (1, 0)); }
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
+    { return mode ? mode : ASCENDING; }
+
+  builtin_type_t builtin_type (void) const { return btyp_double; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  bool is_numeric_type (void) const { return true; }
+
+  bool is_true (void) const;
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  float float_scalar_value (bool frc_str_conv = false) const
+    { return float_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const
+    { return range.matrix_value (); }
+
+  FloatMatrix float_matrix_value (bool = false) const
+    { return range.matrix_value (); }
+
+  NDArray array_value (bool = false) const
+    { return range.matrix_value (); }
+
+  FloatNDArray float_array_value (bool = false) const
+    { return FloatMatrix (range.matrix_value ()); }
+
+  charNDArray char_array_value (bool = false) const;
+
+  // FIXME -- it would be better to have Range::intXNDArray_value
+  // functions to avoid the intermediate conversion to a matrix
+  // object.
+
+  int8NDArray
+  int8_array_value (void) const { return int8NDArray (array_value ()); }
+
+  int16NDArray
+  int16_array_value (void) const { return int16NDArray (array_value ()); }
+
+  int32NDArray
+  int32_array_value (void) const { return int32NDArray (array_value ()); }
+
+  int64NDArray
+  int64_array_value (void) const { return int64NDArray (array_value ()); }
+
+  uint8NDArray
+  uint8_array_value (void) const { return uint8NDArray (array_value ()); }
+
+  uint16NDArray
+  uint16_array_value (void) const { return uint16NDArray (array_value ()); }
+
+  uint32NDArray
+  uint32_array_value (void) const { return uint32NDArray (array_value ()); }
+
+  uint64NDArray
+  uint64_array_value (void) const { return uint64NDArray (array_value ()); }
+
+  SparseMatrix sparse_matrix_value (bool = false) const
+    { return SparseMatrix (range.matrix_value ()); }
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+    { return SparseComplexMatrix (sparse_matrix_value ()); }
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool warn = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return ComplexMatrix (range.matrix_value ()); }
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const
+    { return FloatComplexMatrix (range.matrix_value ()); }
+
+  ComplexNDArray complex_array_value (bool = false) const
+    { return ComplexMatrix (range.matrix_value ()); }
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const
+    { return FloatComplexMatrix (range.matrix_value ()); }
+
+  Range range_value (void) const { return range; }
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool print_name_tag (std::ostream& os, const std::string& name) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      // FIXME -- could be more memory efficient by having a
+      // special case of the octave_stream::write method for ranges.
+
+      return os.write (matrix_value (), block_size, output_type, skip,
+                       flt_fmt);
+    }
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const
+    {
+      octave_matrix m (matrix_value ());
+      return m.map (umap);
+    }
+
+private:
+
+  Range range;
+
+  idx_vector set_idx_cache (const idx_vector& idx) const
+    {
+      delete idx_cache;
+      idx_cache = idx ? new idx_vector (idx) : 0;
+      return idx;
+    }
+
+  void clear_cached_info (void) const
+    {
+      delete idx_cache; idx_cache = 0;
+    }
+
+  mutable idx_vector *idx_cache;
+
+  // No assignment.
+
+  octave_range& operator = (const octave_range&);
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+// If TRUE, allow ranges with non-integer elements as array indices.
+extern bool Vallow_noninteger_range_as_index;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-re-diag.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,244 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "byte-swap.h"
+
+#include "ov-re-diag.h"
+#include "ov-flt-re-diag.h"
+#include "ov-base-diag.cc"
+#include "ov-scalar.h"
+#include "ov-re-mat.h"
+#include "ls-utils.h"
+
+template class octave_base_diag<DiagMatrix, Matrix>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_diag_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_diag_matrix, "diagonal matrix", "double");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_diag_matrix&);
+
+  return new octave_matrix (v.matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_diag_matrix::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_matrix::static_type_id ());
+}
+
+static octave_base_value *
+default_numeric_demotion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_diag_matrix&);
+
+  return new octave_float_diag_matrix (v.float_diag_matrix_value ());
+}
+
+octave_base_value::type_conv_info
+octave_diag_matrix::numeric_demotion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_demotion_function,
+                                            octave_float_diag_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_diag_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.nelem () == 1)
+    retval = new octave_scalar (matrix (0, 0));
+
+  return retval;
+}
+
+octave_value
+octave_diag_matrix::do_index_op (const octave_value_list& idx,
+                                 bool resize_ok)
+{
+  octave_value retval;
+
+  // This hack is to allow constructing permutation matrices using
+  // eye(n)(p,:), eye(n)(:,q) && eye(n)(p,q) where p & q are permutation
+  // vectors.
+  if (! resize_ok && idx.length () == 2 && matrix.is_multiple_of_identity (1))
+    {
+      idx_vector idx0 = idx(0).index_vector ();
+      idx_vector idx1 = idx(1).index_vector ();
+
+      if (! error_state)
+        {
+          bool left = idx0.is_permutation (matrix.rows ());
+          bool right = idx1.is_permutation (matrix.cols ());
+
+          if (left && right)
+            {
+              if (idx0.is_colon ()) left = false;
+              if (idx1.is_colon ()) right = false;
+              if (left && right)
+                retval = PermMatrix (idx0, false) * PermMatrix (idx1, true);
+              else if (left)
+                retval = PermMatrix (idx0, false);
+              else if (right)
+                retval = PermMatrix (idx1, true);
+              else
+                {
+                  retval = this;
+                  this->count++;
+                }
+            }
+        }
+    }
+
+  // if error_state is set, we've already griped.
+  if (! error_state && retval.is_undefined ())
+    retval = octave_base_diag<DiagMatrix, Matrix>::do_index_op (idx, resize_ok);
+
+  return retval;
+}
+
+DiagMatrix
+octave_diag_matrix::diag_matrix_value (bool) const
+{
+  return matrix;
+}
+
+FloatDiagMatrix
+octave_diag_matrix::float_diag_matrix_value (bool) const
+{
+  return FloatDiagMatrix (matrix);
+}
+
+ComplexDiagMatrix
+octave_diag_matrix::complex_diag_matrix_value (bool) const
+{
+  return ComplexDiagMatrix (matrix);
+}
+
+FloatComplexDiagMatrix
+octave_diag_matrix::float_complex_diag_matrix_value (bool) const
+{
+  return FloatComplexDiagMatrix (matrix);
+}
+
+octave_value
+octave_diag_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_abs:
+      return matrix.abs ();
+    case umap_real:
+    case umap_conj:
+      return matrix;
+    case umap_imag:
+      return DiagMatrix (matrix.rows (), matrix.cols (), 0.0);
+    case umap_sqrt:
+      {
+        ComplexColumnVector tmp = matrix.diag ().map<Complex> (rc_sqrt);
+        ComplexDiagMatrix retval (tmp);
+        retval.resize (matrix.rows (), matrix.columns ());
+        return retval;
+      }
+    default:
+      return to_dense ().map (umap);
+    }
+}
+
+bool
+octave_diag_matrix::save_binary (std::ostream& os, bool& save_as_floats)
+{
+
+  int32_t r = matrix.rows (), c = matrix.cols ();
+  os.write (reinterpret_cast<char *> (&r), 4);
+  os.write (reinterpret_cast<char *> (&c), 4);
+
+  Matrix m = Matrix (matrix.diag ());
+  save_type st = LS_DOUBLE;
+  if (save_as_floats)
+    {
+      if (m.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        st = LS_FLOAT;
+    }
+  else if (matrix.length () > 8192) // FIXME -- make this configurable.
+    {
+      double max_val, min_val;
+      if (m.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  const double *mtmp = m.data ();
+  write_doubles (os, mtmp, st, m.numel ());
+
+  return true;
+}
+
+bool
+octave_diag_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format fmt)
+{
+  int32_t r, c;
+  char tmp;
+  if (! (is.read (reinterpret_cast<char *> (&r), 4)
+         && is.read (reinterpret_cast<char *> (&c), 4)
+         && is.read (reinterpret_cast<char *> (&tmp), 1)))
+    return false;
+  if (swap)
+    {
+      swap_bytes<4> (&r);
+      swap_bytes<4> (&c);
+    }
+
+  DiagMatrix m (r, c);
+  double *re = m.fortran_vec ();
+  octave_idx_type len = m.length ();
+  read_doubles (is, re, static_cast<save_type> (tmp), len, swap, fmt);
+  if (error_state || ! is)
+    return false;
+  matrix = m;
+
+  return true;
+}
+
+bool
+octave_diag_matrix::chk_valid_scalar (const octave_value& val,
+                                      double& x) const
+{
+  bool retval = val.is_real_scalar ();
+  if (retval)
+    x = val.double_value ();
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-re-diag.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,98 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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_diag_matrix_h)
+#define octave_diag_matrix_h 1
+
+#include "ov-base.h"
+#include "ov-base-diag.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+
+// Real diagonal matrix values.
+
+class
+OCTINTERP_API
+octave_diag_matrix
+  : public octave_base_diag<DiagMatrix, Matrix>
+{
+public:
+
+  octave_diag_matrix (void)
+    : octave_base_diag<DiagMatrix, Matrix> () { }
+
+  octave_diag_matrix (const DiagMatrix& m)
+    : octave_base_diag<DiagMatrix, Matrix> (m) { }
+
+  octave_diag_matrix (const octave_diag_matrix& m)
+    : octave_base_diag<DiagMatrix, Matrix> (m) { }
+
+  ~octave_diag_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_diag_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_diag_matrix (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  type_conv_info numeric_demotion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  builtin_type_t builtin_type (void) const { return btyp_double; }
+
+  bool is_real_matrix (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  DiagMatrix diag_matrix_value (bool = false) const;
+
+  FloatDiagMatrix float_diag_matrix_value (bool = false) const;
+
+  ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
+
+  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+
+  bool chk_valid_scalar (const octave_value&,
+                         double&) const;
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-re-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1031 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+#include <vector>
+
+#include "data-conv.h"
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+#include "mach-info.h"
+#include "mx-base.h"
+#include "quit.h"
+#include "oct-locbuf.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-base-mat.cc"
+#include "ov-scalar.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-re-sparse.h"
+#include "ov-re-diag.h"
+#include "ov-cx-diag.h"
+#include "ov-lazy-idx.h"
+#include "ov-perm.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+#if ! defined (UCHAR_MAX)
+#define UCHAR_MAX 255
+#endif
+
+template class octave_base_matrix<NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_matrix, "matrix", "double");
+
+static octave_base_value *
+default_numeric_demotion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_matrix&);
+
+  return new octave_float_matrix (v.float_array_value ());
+}
+
+octave_base_value::type_conv_info
+octave_matrix::numeric_demotion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_demotion_function,
+                                            octave_float_matrix::static_type_id ());
+}
+
+octave_base_value *
+octave_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (matrix.nelem () == 1)
+    retval = new octave_scalar (matrix (0));
+
+  return retval;
+}
+
+double
+octave_matrix::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (numel () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "real matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real matrix", "real scalar");
+
+  return retval;
+}
+
+float
+octave_matrix::float_value (bool) const
+{
+  float retval = lo_ieee_float_nan_value ();
+
+  if (numel () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "real matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real matrix", "real scalar");
+
+  return retval;
+}
+
+// FIXME
+
+Matrix
+octave_matrix::matrix_value (bool) const
+{
+  return matrix.matrix_value ();
+}
+
+FloatMatrix
+octave_matrix::float_matrix_value (bool) const
+{
+  return FloatMatrix (matrix.matrix_value ());
+}
+
+Complex
+octave_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "real matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real matrix", "complex scalar");
+
+  return retval;
+}
+
+FloatComplex
+octave_matrix::float_complex_value (bool) const
+{
+  float tmp = lo_ieee_float_nan_value ();
+
+  FloatComplex retval (tmp, tmp);
+
+  if (rows () > 0 && columns () > 0)
+    {
+      gripe_implicit_conversion ("Octave:array-to-scalar",
+                                 "real matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real matrix", "complex scalar");
+
+  return retval;
+}
+
+// FIXME
+
+ComplexMatrix
+octave_matrix::complex_matrix_value (bool) const
+{
+  return ComplexMatrix (matrix.matrix_value ());
+}
+
+FloatComplexMatrix
+octave_matrix::float_complex_matrix_value (bool) const
+{
+  return FloatComplexMatrix (matrix.matrix_value ());
+}
+
+ComplexNDArray
+octave_matrix::complex_array_value (bool) const
+{
+  return ComplexNDArray (matrix);
+}
+
+FloatComplexNDArray
+octave_matrix::float_complex_array_value (bool) const
+{
+  return FloatComplexNDArray (matrix);
+}
+
+boolNDArray
+octave_matrix::bool_array_value (bool warn) const
+{
+  if (matrix.any_element_is_nan ())
+    gripe_nan_to_logical_conversion ();
+  else if (warn && matrix.any_element_not_one_or_zero ())
+    gripe_logical_conversion ();
+
+  return boolNDArray (matrix);
+}
+
+charNDArray
+octave_matrix::char_array_value (bool) const
+{
+  charNDArray retval (dims ());
+
+  octave_idx_type nel = numel ();
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    retval.elem (i) = static_cast<char>(matrix.elem (i));
+
+  return retval;
+}
+
+SparseMatrix
+octave_matrix::sparse_matrix_value (bool) const
+{
+  return SparseMatrix (matrix.matrix_value ());
+}
+
+SparseComplexMatrix
+octave_matrix::sparse_complex_matrix_value (bool) const
+{
+  // FIXME Need a SparseComplexMatrix (Matrix) constructor to make
+  // this function more efficient. Then this should become
+  // return SparseComplexMatrix (matrix.matrix_value ());
+  return SparseComplexMatrix (sparse_matrix_value ());
+}
+
+octave_value
+octave_matrix::diag (octave_idx_type k) const
+{
+  octave_value retval;
+  if (k == 0 && matrix.ndims () == 2
+      && (matrix.rows () == 1 || matrix.columns () == 1))
+    retval = DiagMatrix (DiagArray2<double> (matrix));
+  else
+    retval = octave_base_matrix<NDArray>::diag (k);
+
+  return retval;
+}
+
+octave_value
+octave_matrix::diag (octave_idx_type m, octave_idx_type n) const
+{
+  octave_value retval;
+
+  if (matrix.ndims () == 2
+      && (matrix.rows () == 1 || matrix.columns () == 1))
+    {
+      Matrix mat = matrix.matrix_value ();
+
+      retval = mat.diag (m, n);
+    }
+  else
+    error ("diag: expecting vector argument");
+
+  return retval;
+}
+
+// We override these two functions to allow reshaping both
+// the matrix and the index cache.
+octave_value
+octave_matrix::reshape (const dim_vector& new_dims) const
+{
+  if (idx_cache)
+    {
+      return new octave_matrix (matrix.reshape (new_dims),
+                                idx_vector (idx_cache->as_array ().reshape (new_dims),
+                                            idx_cache->extent (0)));
+    }
+  else
+    return octave_base_matrix<NDArray>::reshape (new_dims);
+}
+
+octave_value
+octave_matrix::squeeze (void) const
+{
+  if (idx_cache)
+    {
+      return new octave_matrix (matrix.squeeze (),
+                                idx_vector (idx_cache->as_array ().squeeze (),
+                                            idx_cache->extent (0)));
+    }
+  else
+    return octave_base_matrix<NDArray>::squeeze ();
+}
+
+octave_value
+octave_matrix::sort (octave_idx_type dim, sortmode mode) const
+{
+  if (idx_cache)
+    {
+      // This is a valid index matrix, so sort via integers because it's
+      // generally more efficient.
+      return octave_lazy_index (*idx_cache).sort (dim, mode);
+    }
+  else
+    return octave_base_matrix<NDArray>::sort (dim, mode);
+}
+
+octave_value
+octave_matrix::sort (Array<octave_idx_type> &sidx, octave_idx_type dim,
+                     sortmode mode) const
+{
+  if (idx_cache)
+    {
+      // This is a valid index matrix, so sort via integers because it's
+      // generally more efficient.
+      return octave_lazy_index (*idx_cache).sort (sidx, dim, mode);
+    }
+  else
+    return octave_base_matrix<NDArray>::sort (sidx, dim, mode);
+}
+
+sortmode
+octave_matrix::is_sorted (sortmode mode) const
+{
+  if (idx_cache)
+    {
+      // This is a valid index matrix, so check via integers because it's
+      // generally more efficient.
+      return idx_cache->as_array ().is_sorted (mode);
+    }
+  else
+    return octave_base_matrix<NDArray>::is_sorted (mode);
+}
+Array<octave_idx_type>
+octave_matrix::sort_rows_idx (sortmode mode) const
+{
+  if (idx_cache)
+    {
+      // This is a valid index matrix, so sort via integers because it's
+      // generally more efficient.
+      return octave_lazy_index (*idx_cache).sort_rows_idx (mode);
+    }
+  else
+    return octave_base_matrix<NDArray>::sort_rows_idx (mode);
+}
+
+sortmode
+octave_matrix::is_sorted_rows (sortmode mode) const
+{
+  if (idx_cache)
+    {
+      // This is a valid index matrix, so check via integers because it's
+      // generally more efficient.
+      return idx_cache->as_array ().is_sorted_rows (mode);
+    }
+  else
+    return octave_base_matrix<NDArray>::is_sorted_rows (mode);
+}
+
+octave_value
+octave_matrix::convert_to_str_internal (bool, bool, char type) const
+{
+  octave_value retval;
+  dim_vector dv = dims ();
+  octave_idx_type nel = dv.numel ();
+
+  charNDArray chm (dv);
+
+  bool warned = false;
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      octave_quit ();
+
+      double d = matrix (i);
+
+      if (xisnan (d))
+        {
+          gripe_nan_to_character_conversion ();
+          return retval;
+        }
+      else
+        {
+          int ival = NINT (d);
+
+          if (ival < 0 || ival > UCHAR_MAX)
+            {
+              // FIXME -- is there something
+              // better we could do?
+
+              ival = 0;
+
+              if (! warned)
+                {
+                  ::warning ("range error for conversion to character value");
+                  warned = true;
+                }
+            }
+
+          chm (i) = static_cast<char> (ival);
+        }
+    }
+
+  retval = octave_value (chm, type);
+
+  return retval;
+}
+
+bool
+octave_matrix::save_ascii (std::ostream& os)
+{
+  dim_vector d = dims ();
+
+  if (d.length () > 2)
+    {
+      NDArray tmp = array_value ();
+
+      os << "# ndims: " << d.length () << "\n";
+
+      for (int i=0; i < d.length (); i++)
+        os << " " << d (i);
+
+      os << "\n" << tmp;
+    }
+  else
+    {
+      // Keep this case, rather than use generic code above for backward
+      // compatiability. Makes load_ascii much more complex!!
+      os << "# rows: " << rows () << "\n"
+         << "# columns: " << columns () << "\n";
+
+      os << matrix_value ();
+    }
+
+  return true;
+}
+
+bool
+octave_matrix::load_ascii (std::istream& is)
+{
+  bool success = true;
+
+  string_vector keywords(2);
+
+  keywords[0] = "ndims";
+  keywords[1] = "rows";
+
+  std::string kw;
+  octave_idx_type val = 0;
+
+  if (extract_keyword (is, keywords, kw, val, true))
+    {
+      if (kw == "ndims")
+        {
+          int mdims = static_cast<int> (val);
+
+          if (mdims >= 0)
+            {
+              dim_vector dv;
+              dv.resize (mdims);
+
+              for (int i = 0; i < mdims; i++)
+                is >> dv(i);
+
+              if (is)
+                {
+                  NDArray tmp(dv);
+
+                  is >> tmp;
+
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else
+                {
+                  error ("load: failed to read dimensions");
+                  success = false;
+                }
+            }
+          else
+            {
+              error ("load: failed to extract number of dimensions");
+              success = false;
+            }
+        }
+      else if (kw == "rows")
+        {
+          octave_idx_type nr = val;
+          octave_idx_type nc = 0;
+
+          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
+            {
+              if (nr > 0 && nc > 0)
+                {
+                  Matrix tmp (nr, nc);
+                  is >> tmp;
+                  if (is)
+                    matrix = tmp;
+                  else
+                    {
+                      error ("load: failed to load matrix constant");
+                      success = false;
+                    }
+                }
+              else if (nr == 0 || nc == 0)
+                matrix = Matrix (nr, nc);
+              else
+                panic_impossible ();
+            }
+          else
+            {
+              error ("load: failed to extract number of rows and columns");
+              success = false;
+            }
+        }
+      else
+        panic_impossible ();
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_matrix::save_binary (std::ostream& os, bool& save_as_floats)
+{
+
+  dim_vector d = dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims to differentiate with old format!!
+  int32_t tmp = - d.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  for (int i = 0; i < d.length (); i++)
+    {
+      tmp = d(i);
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+    }
+
+  NDArray m = array_value ();
+  save_type st = LS_DOUBLE;
+  if (save_as_floats)
+    {
+      if (m.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        st = LS_FLOAT;
+    }
+  else if (d.numel () > 8192) // FIXME -- make this configurable.
+    {
+      double max_val, min_val;
+      if (m.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  const double *mtmp = m.data ();
+  write_doubles (os, mtmp, st, d.numel ());
+
+  return true;
+}
+
+bool
+octave_matrix::load_binary (std::istream& is, bool swap,
+                                 oct_mach_info::float_format fmt)
+{
+  char tmp;
+  int32_t mdims;
+  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&mdims);
+  if (mdims < 0)
+    {
+      mdims = - mdims;
+      int32_t di;
+      dim_vector dv;
+      dv.resize (mdims);
+
+      for (int i = 0; i < mdims; i++)
+        {
+          if (! is.read (reinterpret_cast<char *> (&di), 4))
+            return false;
+          if (swap)
+            swap_bytes<4> (&di);
+          dv(i) = di;
+        }
+
+      // Convert an array with a single dimension to be a row vector.
+      // Octave should never write files like this, other software
+      // might.
+
+      if (mdims == 1)
+        {
+          mdims = 2;
+          dv.resize (mdims);
+          dv(1) = dv(0);
+          dv(0) = 1;
+        }
+
+      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+        return false;
+
+      NDArray m(dv);
+      double *re = m.fortran_vec ();
+      read_doubles (is, re, static_cast<save_type> (tmp), dv.numel (), swap, fmt);
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  else
+    {
+      int32_t nr, nc;
+      nr = mdims;
+      if (! is.read (reinterpret_cast<char *> (&nc), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&nc);
+      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+        return false;
+      Matrix m (nr, nc);
+      double *re = m.fortran_vec ();
+      octave_idx_type len = nr * nc;
+      read_doubles (is, re, static_cast<save_type> (tmp), len, swap, fmt);
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_matrix::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  int rank = dv.length ();
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+  NDArray m = array_value ();
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  for (int i = 0; i < rank; i++)
+    hdims[i] = dv (rank-i-1);
+
+  space_hid = H5Screate_simple (rank, hdims, 0);
+
+  if (space_hid < 0) return false;
+
+  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
+
+  if (save_as_floats)
+    {
+      if (m.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        save_type_hid = H5T_NATIVE_FLOAT;
+    }
+#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
+  // hdf5 currently doesn't support float/integer conversions
+  else
+    {
+      double max_val, min_val;
+
+      if (m.all_integers (max_val, min_val))
+        save_type_hid
+          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+    }
+#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  double *mtmp = m.fortran_vec ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, mtmp) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_matrix::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+      return (empty > 0);
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank < 1)
+    {
+      H5Sclose (space_id);
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  if (rank == 1)
+    {
+      dv.resize (2);
+      dv(0) = 1;
+      dv(1) = hdims[0];
+    }
+  else
+    {
+      dv.resize (rank);
+      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
+        dv(j) = hdims[i];
+    }
+
+  NDArray m (dv);
+  double *re = m.fortran_vec ();
+  if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, re) >= 0)
+    {
+      retval = true;
+      matrix = m;
+    }
+
+  H5Sclose (space_id);
+  H5Dclose (data_hid);
+
+  return retval;
+}
+
+#endif
+
+void
+octave_matrix::print_raw (std::ostream& os,
+                          bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, matrix, pr_as_read_syntax,
+                         current_print_indent_level ());
+}
+
+mxArray *
+octave_matrix::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxREAL);
+
+  double *pr = static_cast<double *> (retval->get_data ());
+
+  mwSize nel = numel ();
+
+  const double *p = matrix.data ();
+
+  for (mwIndex i = 0; i < nel; i++)
+    pr[i] = p[i];
+
+  return retval;
+}
+
+// This uses a smarter strategy for doing the complex->real mappers.  We
+// allocate an array for a real result and keep filling it until a complex
+// result is produced.
+static octave_value
+do_rc_map (const NDArray& a, Complex (&fcn) (double))
+{
+  octave_idx_type n = a.numel ();
+  NoAlias<NDArray> rr (a.dims ());
+
+  for (octave_idx_type i = 0; i < n; i++)
+    {
+      octave_quit ();
+
+      Complex tmp = fcn (a(i));
+      if (tmp.imag () == 0.0)
+        rr(i) = tmp.real ();
+      else
+        {
+          NoAlias<ComplexNDArray> rc (a.dims ());
+
+          for (octave_idx_type j = 0; j < i; j++)
+            rc(j) = rr(j);
+
+          rc(i) = tmp;
+
+          for (octave_idx_type j = i+1; j < n; j++)
+            {
+              octave_quit ();
+
+              rc(j) = fcn (a(j));
+            }
+
+          return new octave_complex_matrix (rc);
+        }
+    }
+
+  return rr;
+}
+
+octave_value
+octave_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_imag:
+      return NDArray (matrix.dims (), 0.0);
+
+    case umap_real:
+    case umap_conj:
+      return matrix;
+
+    // Mappers handled specially.
+#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.FCN ())
+
+      ARRAY_METHOD_MAPPER (abs, abs);
+      ARRAY_METHOD_MAPPER (isnan, isnan);
+      ARRAY_METHOD_MAPPER (isinf, isinf);
+      ARRAY_METHOD_MAPPER (finite, isfinite);
+
+#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.map<TYPE> (FCN))
+
+#define RC_ARRAY_MAPPER(UMAP, TYPE, FCN) \
+    case umap_ ## UMAP: \
+      return do_rc_map (matrix, FCN)
+
+      RC_ARRAY_MAPPER (acos, Complex, rc_acos);
+      RC_ARRAY_MAPPER (acosh, Complex, rc_acosh);
+      ARRAY_MAPPER (angle, double, ::arg);
+      ARRAY_MAPPER (arg, double, ::arg);
+      RC_ARRAY_MAPPER (asin, Complex, rc_asin);
+      ARRAY_MAPPER (asinh, double, ::asinh);
+      ARRAY_MAPPER (atan, double, ::atan);
+      RC_ARRAY_MAPPER (atanh, Complex, rc_atanh);
+      ARRAY_MAPPER (erf, double, ::erf);
+      ARRAY_MAPPER (erfinv, double, ::erfinv);
+      ARRAY_MAPPER (erfcinv, double, ::erfcinv);
+      ARRAY_MAPPER (erfc, double, ::erfc);
+      ARRAY_MAPPER (erfcx, double, ::erfcx);
+      ARRAY_MAPPER (gamma, double, xgamma);
+      RC_ARRAY_MAPPER (lgamma, Complex, rc_lgamma);
+      ARRAY_MAPPER (cbrt, double, ::cbrt);
+      ARRAY_MAPPER (ceil, double, ::ceil);
+      ARRAY_MAPPER (cos, double, ::cos);
+      ARRAY_MAPPER (cosh, double, ::cosh);
+      ARRAY_MAPPER (exp, double, ::exp);
+      ARRAY_MAPPER (expm1, double, ::expm1);
+      ARRAY_MAPPER (fix, double, ::fix);
+      ARRAY_MAPPER (floor, double, ::floor);
+      RC_ARRAY_MAPPER (log, Complex, rc_log);
+      RC_ARRAY_MAPPER (log2, Complex, rc_log2);
+      RC_ARRAY_MAPPER (log10, Complex, rc_log10);
+      RC_ARRAY_MAPPER (log1p, Complex, rc_log1p);
+      ARRAY_MAPPER (round, double, xround);
+      ARRAY_MAPPER (roundb, double, xroundb);
+      ARRAY_MAPPER (signum, double, ::signum);
+      ARRAY_MAPPER (sin, double, ::sin);
+      ARRAY_MAPPER (sinh, double, ::sinh);
+      RC_ARRAY_MAPPER (sqrt, Complex, rc_sqrt);
+      ARRAY_MAPPER (tan, double, ::tan);
+      ARRAY_MAPPER (tanh, double, ::tanh);
+      ARRAY_MAPPER (isna, bool, octave_is_NA);
+
+    default:
+      if (umap >= umap_xisalnum && umap <= umap_xtoupper)
+        {
+          octave_value str_conv = convert_to_str (true, true);
+          return error_state ? octave_value () : str_conv.map (umap);
+        }
+      else
+        return octave_base_value::map (umap);
+    }
+}
+
+DEFUN (double, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} double (@var{x})\n\
+Convert @var{x} to double precision type.\n\
+@seealso{single}\n\
+@end deftypefn")
+{
+  // The OCTAVE_TYPE_CONV_BODY3 macro declares retval, so they go
+  // inside their own scopes, and we don't declare retval here to
+  // avoid a shadowed declaration warning.
+
+  if (args.length () == 1)
+    {
+      if (args(0).is_perm_matrix ())
+        {
+          OCTAVE_TYPE_CONV_BODY3 (double, octave_perm_matrix, octave_scalar);
+        }
+      else if (args(0).is_diag_matrix ())
+        {
+          if (args(0).is_complex_type ())
+            {
+              OCTAVE_TYPE_CONV_BODY3 (double, octave_complex_diag_matrix, octave_complex);
+            }
+          else
+            {
+              OCTAVE_TYPE_CONV_BODY3 (double, octave_diag_matrix, octave_scalar);
+            }
+        }
+      else if (args(0).is_sparse_type ())
+        {
+          if (args(0).is_complex_type ())
+            {
+              OCTAVE_TYPE_CONV_BODY3 (double, octave_sparse_complex_matrix, octave_complex);
+            }
+          else
+            {
+              OCTAVE_TYPE_CONV_BODY3 (double, octave_sparse_matrix, octave_scalar);
+            }
+        }
+      else if (args(0).is_complex_type ())
+        {
+          OCTAVE_TYPE_CONV_BODY3 (double, octave_complex_matrix, octave_complex);
+        }
+      else
+        {
+          OCTAVE_TYPE_CONV_BODY3 (double, octave_matrix, octave_scalar);
+        }
+    }
+  else
+    print_usage ();
+
+  return octave_value ();
+}
+
+/*
+%!assert (class (double (single (1))), "double")
+%!assert (class (double (single (1 + i))), "double")
+%!assert (class (double (int8 (1))), "double")
+%!assert (class (double (uint8 (1))), "double")
+%!assert (class (double (int16 (1))), "double")
+%!assert (class (double (uint16 (1))), "double")
+%!assert (class (double (int32 (1))), "double")
+%!assert (class (double (uint32 (1))), "double")
+%!assert (class (double (int64 (1))), "double")
+%!assert (class (double (uint64 (1))), "double")
+%!assert (class (double (true)), "double")
+%!assert (class (double ("A")), "double")
+%!test
+%! x = sparse (logical ([1 0; 0 1]));
+%! y = double (x);
+%! assert (class (x), "logical");
+%! assert (class (y), "double");
+%! assert (issparse (y));
+%!test
+%! x = diag (single ([1 3 2]));
+%! y = double (x);
+%! assert (class (x), "single");
+%! assert (class (y), "double");
+%!test
+%! x = diag (single ([i 3 2]));
+%! y = double (x);
+%! assert (class (x), "single");
+%! assert (class (y), "double");
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-re-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,242 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_matrix_h)
+#define octave_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-base-mat.h"
+#include "ov-typeinfo.h"
+
+#include "MatrixType.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Real matrix values.
+
+class
+OCTINTERP_API
+octave_matrix : public octave_base_matrix<NDArray>
+{
+public:
+
+  octave_matrix (void)
+    : octave_base_matrix<NDArray> () { }
+
+  octave_matrix (const Matrix& m)
+    : octave_base_matrix<NDArray> (m) { }
+
+  octave_matrix (const Matrix& m, const MatrixType& t)
+    : octave_base_matrix<NDArray> (m, t) { }
+
+  octave_matrix (const NDArray& nda)
+    : octave_base_matrix<NDArray> (nda) { }
+
+  octave_matrix (const Array<double>& m)
+    : octave_base_matrix<NDArray> (NDArray (m)) { }
+
+  octave_matrix (const DiagMatrix& d)
+    : octave_base_matrix<NDArray> (Matrix (d)) { }
+
+  octave_matrix (const RowVector& v)
+    : octave_base_matrix<NDArray> (Matrix (v)) { }
+
+  octave_matrix (const ColumnVector& v)
+    : octave_base_matrix<NDArray> (Matrix (v)) { }
+
+  octave_matrix (const octave_matrix& m)
+    : octave_base_matrix<NDArray> (m) { }
+
+  octave_matrix (const Array<octave_idx_type>& idx,
+                 bool zero_based = false, bool cache_index = false)
+    : octave_base_matrix<NDArray> (NDArray (idx, zero_based))
+    {
+      // Auto-create cache to speed up subsequent indexing.
+      if (zero_based && cache_index)
+        set_idx_cache (idx_vector (idx));
+    }
+
+  octave_matrix (const NDArray& nda, const idx_vector& cache)
+    : octave_base_matrix<NDArray> (nda)
+    {
+      set_idx_cache (cache);
+    }
+
+  ~octave_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_matrix (); }
+
+  type_conv_info numeric_demotion_function (void) const;
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  idx_vector index_vector (void) const
+    { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
+
+  builtin_type_t builtin_type (void) const { return btyp_double; }
+
+  bool is_real_matrix (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  int8NDArray
+  int8_array_value (void) const { return int8NDArray (matrix); }
+
+  int16NDArray
+  int16_array_value (void) const { return int16NDArray (matrix); }
+
+  int32NDArray
+  int32_array_value (void) const { return int32NDArray (matrix); }
+
+  int64NDArray
+  int64_array_value (void) const { return int64NDArray (matrix); }
+
+  uint8NDArray
+  uint8_array_value (void) const { return uint8NDArray (matrix); }
+
+  uint16NDArray
+  uint16_array_value (void) const { return uint16NDArray (matrix); }
+
+  uint32NDArray
+  uint32_array_value (void) const { return uint32NDArray (matrix); }
+
+  uint64NDArray
+  uint64_array_value (void) const { return uint64NDArray (matrix); }
+
+  double double_value (bool = false) const;
+
+  float float_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  FloatMatrix float_matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  FloatComplex float_complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool warn = false) const;
+
+  charNDArray char_array_value (bool = false) const;
+
+  NDArray array_value (bool = false) const { return matrix; }
+
+  FloatNDArray float_array_value (bool = false) const { return matrix; }
+
+  SparseMatrix sparse_matrix_value (bool = false) const;
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
+
+  octave_value diag (octave_idx_type k = 0) const;
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  octave_value reshape (const dim_vector& new_dims) const;
+
+  octave_value squeeze (void) const;
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const;
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const;
+
+  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const;
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
+
+  // Use matrix_ref here to clear index cache.
+  void increment (void) { matrix_ref () += 1.0; }
+
+  void decrement (void) { matrix_ref () -= 1.0; }
+
+  void changesign (void) { matrix_ref ().changesign (); }
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
+
+  // Unsafe.  This function exists to support the MEX interface.
+  // You should not use it anywhere else.
+  void *mex_get_data (void) const { return matrix.mex_get_data (); }
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-re-sparse.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,945 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+#include <vector>
+
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+#include "oct-locbuf.h"
+
+#include "ov-base.h"
+#include "ov-scalar.h"
+#include "gripes.h"
+
+#include "ls-hdf5.h"
+
+#include "ov-re-sparse.h"
+
+#include "ov-base-sparse.h"
+#include "ov-base-sparse.cc"
+
+#include "ov-bool-sparse.h"
+
+template class OCTINTERP_API octave_base_sparse<SparseMatrix>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_sparse_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_matrix, "sparse matrix", "double");
+
+idx_vector
+octave_sparse_matrix::index_vector (void) const
+{
+  if (matrix.numel () == matrix.nnz ())
+    return idx_vector (array_value ());
+  else
+    {
+      std::string nm = type_name ();
+      error ("%s type invalid as index value", nm.c_str ());
+      return idx_vector ();
+    }
+}
+
+octave_base_value *
+octave_sparse_matrix::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (Vsparse_auto_mutate)
+    {
+      // Don't use numel, since it can overflow for very large matrices
+      // Note that for the second test, this means it becomes approximative
+      // since it involves a cast to double to avoid issues of overflow
+      if (matrix.rows () == 1 && matrix.cols () == 1)
+        {
+          // Const copy of the matrix, so the right version of () operator used
+          const SparseMatrix tmp (matrix);
+
+          retval = new octave_scalar (tmp (0));
+        }
+      else if (matrix.cols () > 0 && matrix.rows () > 0
+               && (double (matrix.byte_size ()) > double (matrix.rows ())
+                   * double (matrix.cols ()) * sizeof (double)))
+        retval = new octave_matrix (matrix.matrix_value ());
+    }
+
+  return retval;
+}
+
+double
+octave_sparse_matrix::double_value (bool) const
+{
+  double retval = lo_ieee_nan_value ();
+
+  if (numel () > 0)
+    {
+      if (numel () > 1)
+        gripe_implicit_conversion ("Octave:array-to-scalar",
+                                   "real sparse matrix", "real scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real sparse matrix", "real scalar");
+
+  return retval;
+}
+
+Complex
+octave_sparse_matrix::complex_value (bool) const
+{
+  double tmp = lo_ieee_nan_value ();
+
+  Complex retval (tmp, tmp);
+
+  // FIXME -- maybe this should be a function, valid_as_scalar()
+  if (rows () > 0 && columns () > 0)
+    {
+      if (numel () > 1)
+        gripe_implicit_conversion ("Octave:array-to-scalar",
+                                   "real sparse matrix", "complex scalar");
+
+      retval = matrix (0, 0);
+    }
+  else
+    gripe_invalid_conversion ("real sparse matrix", "complex scalar");
+
+  return retval;
+}
+
+Matrix
+octave_sparse_matrix::matrix_value (bool) const
+{
+  return matrix.matrix_value ();
+}
+
+boolNDArray
+octave_sparse_matrix::bool_array_value (bool warn) const
+{
+  NDArray m = matrix.matrix_value ();
+
+  if (m.any_element_is_nan ())
+    gripe_nan_to_logical_conversion ();
+  else if (warn && m.any_element_not_one_or_zero ())
+    gripe_logical_conversion ();
+
+  return boolNDArray (m);
+}
+
+charNDArray
+octave_sparse_matrix::char_array_value (bool) const
+{
+  charNDArray retval (dims (), 0);
+  octave_idx_type nc = matrix.cols ();
+  octave_idx_type nr = matrix.rows ();
+
+  for (octave_idx_type j = 0; j < nc; j++)
+    for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
+      retval(matrix.ridx (i) + nr * j) = static_cast<char>(matrix.data (i));
+
+  return retval;
+}
+
+ComplexMatrix
+octave_sparse_matrix::complex_matrix_value (bool) const
+{
+  return ComplexMatrix (matrix.matrix_value ());
+}
+
+ComplexNDArray
+octave_sparse_matrix::complex_array_value (bool) const
+{
+  return ComplexNDArray (ComplexMatrix (matrix.matrix_value ()));
+}
+
+NDArray
+octave_sparse_matrix::array_value (bool) const
+{
+  return NDArray (matrix.matrix_value ());
+}
+
+SparseBoolMatrix
+octave_sparse_matrix::sparse_bool_matrix_value (bool warn) const
+{
+  if (matrix.any_element_is_nan ())
+    gripe_nan_to_logical_conversion ();
+  else if (warn && matrix.any_element_not_one_or_zero ())
+    gripe_logical_conversion ();
+
+  return mx_el_ne (matrix, 0.0);
+}
+
+octave_value
+octave_sparse_matrix::convert_to_str_internal (bool, bool, char type) const
+{
+  octave_value retval;
+  dim_vector dv = dims ();
+  octave_idx_type nel = dv.numel ();
+
+  if (nel == 0)
+    {
+      char s = '\0';
+      retval = octave_value (&s, type);
+    }
+  else
+    {
+      octave_idx_type nr = matrix.rows ();
+      octave_idx_type nc = matrix.cols ();
+      charNDArray chm (dv, static_cast<char> (0));
+
+      bool warned = false;
+
+      for (octave_idx_type j = 0; j < nc; j++)
+        for (octave_idx_type i = matrix.cidx (j);
+             i < matrix.cidx (j+1); i++)
+          {
+            octave_quit ();
+
+            double d = matrix.data (i);
+
+              if (xisnan (d))
+                {
+                  gripe_nan_to_character_conversion ();
+                  return retval;
+                }
+              else
+                {
+                  int ival = NINT (d);
+
+                  if (ival < 0 || ival > UCHAR_MAX)
+                    {
+                      // FIXME -- is there something
+                      // better we could do?
+
+                      ival = 0;
+
+                      if (! warned)
+                        {
+                          ::warning ("range error for conversion to character value");
+                          warned = true;
+                        }
+                    }
+
+                  chm (matrix.ridx (i) + j * nr) =
+                    static_cast<char> (ival);
+                }
+          }
+
+      retval = octave_value (chm, type);
+    }
+
+  return retval;
+}
+
+bool
+octave_sparse_matrix::save_binary (std::ostream& os, bool&save_as_floats)
+{
+  dim_vector d = this->dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Ensure that additional memory is deallocated
+  matrix.maybe_compress ();
+
+  int nr = d(0);
+  int nc = d(1);
+  int nz = nnz ();
+
+  int32_t itmp;
+  // Use negative value for ndims to be consistent with other formats
+  itmp= -2;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nr;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nc;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  itmp= nz;
+  os.write (reinterpret_cast<char *> (&itmp), 4);
+
+  save_type st = LS_DOUBLE;
+  if (save_as_floats)
+    {
+      if (matrix.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        st = LS_FLOAT;
+    }
+  else if (matrix.nnz () > 8192) // FIXME -- make this configurable.
+    {
+      double max_val, min_val;
+      if (matrix.all_integers (max_val, min_val))
+        st = get_save_type (max_val, min_val);
+    }
+
+  // add one to the printed indices to go from
+  // zero-based to one-based arrays
+   for (int i = 0; i < nc+1; i++)
+     {
+       octave_quit ();
+       itmp = matrix.cidx (i);
+       os.write (reinterpret_cast<char *> (&itmp), 4);
+     }
+
+   for (int i = 0; i < nz; i++)
+     {
+       octave_quit ();
+       itmp = matrix.ridx (i);
+       os.write (reinterpret_cast<char *> (&itmp), 4);
+     }
+
+   write_doubles (os, matrix.data (), st, nz);
+
+  return true;
+}
+
+bool
+octave_sparse_matrix::load_binary (std::istream& is, bool swap,
+                                   oct_mach_info::float_format fmt)
+{
+  int32_t nz, nc, nr, tmp;
+  char ctmp;
+
+  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+    return false;
+
+  if (swap)
+    swap_bytes<4> (&tmp);
+
+  if (tmp != -2) {
+    error ("load: only 2D sparse matrices are supported");
+    return false;
+  }
+
+  if (! is.read (reinterpret_cast<char *> (&nr), 4))
+    return false;
+  if (! is.read (reinterpret_cast<char *> (&nc), 4))
+    return false;
+  if (! is.read (reinterpret_cast<char *> (&nz), 4))
+    return false;
+
+  if (swap)
+    {
+      swap_bytes<4> (&nr);
+      swap_bytes<4> (&nc);
+      swap_bytes<4> (&nz);
+    }
+
+  SparseMatrix m (static_cast<octave_idx_type> (nr),
+                  static_cast<octave_idx_type> (nc),
+                  static_cast<octave_idx_type> (nz));
+
+  for (int i = 0; i < nc+1; i++)
+    {
+      octave_quit ();
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+      m.xcidx (i) = tmp;
+    }
+
+  for (int i = 0; i < nz; i++)
+    {
+      octave_quit ();
+      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&tmp);
+      m.xridx (i) = tmp;
+    }
+
+  if (! is.read (reinterpret_cast<char *> (&ctmp), 1))
+    return false;
+
+  read_doubles (is, m.xdata (), static_cast<save_type> (ctmp), nz, swap, fmt);
+
+  if (error_state || ! is)
+    return false;
+
+  if (! m.indices_ok ())
+    return false;
+
+  matrix = m;
+
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_sparse_matrix::save_hdf5 (hid_t loc_id, const char *name,
+                                 bool save_as_floats)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  // Ensure that additional memory is deallocated
+  matrix.maybe_compress ();
+
+#if HAVE_HDF5_18
+  hid_t group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  hid_t group_hid = H5Gcreate (loc_id, name, 0);
+#endif
+  if (group_hid < 0)
+    return false;
+
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+  SparseMatrix m = sparse_matrix_value ();
+  octave_idx_type tmp;
+  hsize_t hdims[2];
+
+  space_hid = H5Screate_simple (0, hdims, 0);
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.rows ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                     &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.cols ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                     &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  tmp = m.nnz ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                     &tmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+
+  hdims[0] = m.cols () + 1;
+  hdims[1] = 1;
+
+  space_hid = H5Screate_simple (2, hdims, 0);
+
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  octave_idx_type * itmp = m.xcidx ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                     itmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+
+  hdims[0] = m.nnz ();
+  hdims[1] = 1;
+
+  space_hid = H5Screate_simple (2, hdims, 0);
+
+  if (space_hid < 0)
+    {
+      H5Gclose (group_hid);
+      return false;
+    }
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  itmp = m.xridx ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+                     itmp) >= 0;
+  H5Dclose (data_hid);
+  if (!retval)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
+
+  if (save_as_floats)
+    {
+      if (m.too_large_for_float ())
+        {
+          warning ("save: some values too large to save as floats --");
+          warning ("save: saving as doubles instead");
+        }
+      else
+        save_type_hid = H5T_NATIVE_FLOAT;
+    }
+#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
+  // hdf5 currently doesn't support float/integer conversions
+  else
+    {
+      double max_val, min_val;
+
+      if (m.all_integers (max_val, min_val))
+        save_type_hid
+          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+    }
+#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  double * dtmp = m.xdata ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, dtmp) >= 0;
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+  H5Gclose (group_hid);
+
+  return retval;
+}
+
+bool
+octave_sparse_matrix::load_hdf5 (hid_t loc_id, const char *name)
+{
+  octave_idx_type nr, nc, nz;
+  hid_t group_hid, data_hid, space_hid;
+  hsize_t rank;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+    return (empty > 0);
+
+#if HAVE_HDF5_18
+  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  group_hid = H5Gopen (loc_id, name);
+#endif
+  if (group_hid < 0) return false;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nr", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nr");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, &nr) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nc", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nc");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, &nc) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nz", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "nz");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, &nz) < 0)
+    {
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Dclose (data_hid);
+
+  SparseMatrix m (static_cast<octave_idx_type> (nr),
+                  static_cast<octave_idx_type> (nc),
+                  static_cast<octave_idx_type> (nz));
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "cidx", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "cidx");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nc + 1
+      || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  octave_idx_type *itmp = m.xcidx ();
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, itmp) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "ridx", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "ridx");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  itmp = m.xridx ();
+  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, itmp) < 0)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "data", H5P_DEFAULT);
+#else
+  data_hid = H5Dopen (group_hid, "data");
+#endif
+  space_hid = H5Dget_space (data_hid);
+  rank = H5Sget_simple_extent_ndims (space_hid);
+
+  if (rank != 2)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+  if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1)
+    {
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      H5Gclose (group_hid);
+      return false;
+    }
+
+  double *dtmp = m.xdata ();
+  bool retval = false;
+  if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, dtmp) >= 0
+      && m.indices_ok ())
+    {
+      retval = true;
+      matrix = m;
+    }
+
+  H5Sclose (space_hid);
+  H5Dclose (data_hid);
+  H5Gclose (group_hid);
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_sparse_matrix::as_mxArray (void) const
+{
+  mwSize nz = nzmax ();
+  mwSize nr = rows ();
+  mwSize nc = columns ();
+  mxArray *retval = new mxArray (mxDOUBLE_CLASS, nr, nc, nz, mxREAL);
+  double *pr = static_cast<double *> (retval->get_data ());
+  mwIndex *ir = retval->get_ir ();
+  mwIndex *jc = retval->get_jc ();
+
+  for (mwIndex i = 0; i < nz; i++)
+    {
+      pr[i] = matrix.data (i);
+      ir[i] = matrix.ridx (i);
+    }
+
+  for (mwIndex i = 0; i < nc + 1; i++)
+    jc[i] = matrix.cidx (i);
+
+  return retval;
+}
+
+octave_value
+octave_sparse_matrix::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_imag:
+      return SparseMatrix (matrix.rows (), matrix.cols (), 0.0);
+
+    case umap_real:
+    case umap_conj:
+      return matrix;
+
+    // Mappers handled specially.
+#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.FCN ())
+
+      ARRAY_METHOD_MAPPER (abs, abs);
+
+#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (matrix.map<TYPE> (FCN))
+
+      ARRAY_MAPPER (acos, Complex, rc_acos);
+      ARRAY_MAPPER (acosh, Complex, rc_acosh);
+      ARRAY_MAPPER (angle, double, ::arg);
+      ARRAY_MAPPER (arg, double, ::arg);
+      ARRAY_MAPPER (asin, Complex, rc_asin);
+      ARRAY_MAPPER (asinh, double, ::asinh);
+      ARRAY_MAPPER (atan, double, ::atan);
+      ARRAY_MAPPER (atanh, Complex, rc_atanh);
+      ARRAY_MAPPER (erf, double, ::erf);
+      ARRAY_MAPPER (erfinv, double, ::erfinv);
+      ARRAY_MAPPER (erfcinv, double, ::erfcinv);
+      ARRAY_MAPPER (erfc, double, ::erfc);
+      ARRAY_MAPPER (gamma, double, xgamma);
+      ARRAY_MAPPER (lgamma, Complex, rc_lgamma);
+      ARRAY_MAPPER (cbrt, double, ::cbrt);
+      ARRAY_MAPPER (ceil, double, ::ceil);
+      ARRAY_MAPPER (cos, double, ::cos);
+      ARRAY_MAPPER (cosh, double, ::cosh);
+      ARRAY_MAPPER (exp, double, ::exp);
+      ARRAY_MAPPER (expm1, double, ::expm1);
+      ARRAY_MAPPER (fix, double, ::fix);
+      ARRAY_MAPPER (floor, double, ::floor);
+      ARRAY_MAPPER (log, Complex, rc_log);
+      ARRAY_MAPPER (log2, Complex, rc_log2);
+      ARRAY_MAPPER (log10, Complex, rc_log10);
+      ARRAY_MAPPER (log1p, Complex, rc_log1p);
+      ARRAY_MAPPER (round, double, xround);
+      ARRAY_MAPPER (roundb, double, xroundb);
+      ARRAY_MAPPER (signum, double, ::signum);
+      ARRAY_MAPPER (sin, double, ::sin);
+      ARRAY_MAPPER (sinh, double, ::sinh);
+      ARRAY_MAPPER (sqrt, Complex, rc_sqrt);
+      ARRAY_MAPPER (tan, double, ::tan);
+      ARRAY_MAPPER (tanh, double, ::tanh);
+      ARRAY_MAPPER (isnan, bool, xisnan);
+      ARRAY_MAPPER (isna, bool, octave_is_NA);
+      ARRAY_MAPPER (isinf, bool, xisinf);
+      ARRAY_MAPPER (finite, bool, xfinite);
+
+    default: // Attempt to go via dense matrix.
+      return octave_base_sparse<SparseMatrix>::map (umap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-re-sparse.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,164 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+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_sparse_matrix_h)
+#define octave_sparse_matrix_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+#include "dSparse.h"
+#include "MatrixType.h"
+#include "ov-base-sparse.h"
+#include "ov-cx-sparse.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+class
+OCTINTERP_API
+octave_sparse_matrix : public octave_base_sparse<SparseMatrix>
+{
+public:
+
+  octave_sparse_matrix (void)
+    : octave_base_sparse<SparseMatrix> () { }
+
+  octave_sparse_matrix (const Matrix& m)
+    : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { }
+
+  octave_sparse_matrix (const NDArray& m)
+    : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { }
+
+  octave_sparse_matrix (const SparseMatrix& m)
+    : octave_base_sparse<SparseMatrix> (m) { }
+
+  octave_sparse_matrix (const SparseMatrix& m, const MatrixType& t)
+    : octave_base_sparse<SparseMatrix> (m, t) { }
+
+  octave_sparse_matrix (const MSparse<double>& m)
+    : octave_base_sparse<SparseMatrix> (m) { }
+
+  octave_sparse_matrix (const MSparse<double>& m, const MatrixType& t)
+    : octave_base_sparse<SparseMatrix> (m, t) { }
+
+  octave_sparse_matrix (const Sparse<double>& m)
+    : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { }
+
+  octave_sparse_matrix (const Sparse<double>& m, const MatrixType& t)
+    : octave_base_sparse<SparseMatrix> (SparseMatrix (m), t) { }
+
+  octave_sparse_matrix (const octave_sparse_matrix& m)
+    : octave_base_sparse<SparseMatrix> (m) { }
+
+  ~octave_sparse_matrix (void) { }
+
+  octave_base_value *clone (void) const { return new octave_sparse_matrix (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_sparse_matrix (); }
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  idx_vector index_vector (void) const;
+
+  builtin_type_t builtin_type (void) const { return btyp_double; }
+
+  bool is_real_matrix (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  double double_value (bool = false) const;
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
+
+  Matrix matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  boolNDArray bool_array_value (bool warn = false) const;
+
+  charNDArray char_array_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  NDArray array_value (bool = false) const;
+
+  SparseMatrix sparse_matrix_value (bool = false) const
+    { return matrix; }
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+    { return SparseComplexMatrix (matrix); }
+
+  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+#if 0
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
+#endif
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+private:
+  octave_value map (double (*fcn) (double)) const;
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-scalar.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,368 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "data-conv.h"
+#include "mach-info.h"
+#include "lo-specfun.h"
+#include "lo-mappers.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-stream.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-base.h"
+#include "ov-base-scalar.h"
+#include "ov-base-scalar.cc"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+#include "pr-output.h"
+#include "xdiv.h"
+#include "xpow.h"
+#include "ops.h"
+
+#include "ls-oct-ascii.h"
+#include "ls-hdf5.h"
+
+template class octave_base_scalar<double>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_scalar, "scalar", "double");
+
+static octave_base_value *
+default_numeric_demotion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_scalar&);
+
+  return new octave_float_scalar (v.float_value ());
+}
+
+octave_base_value::type_conv_info
+octave_scalar::numeric_demotion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_demotion_function,
+                                            octave_float_scalar::static_type_id ());
+}
+
+octave_value
+octave_scalar::do_index_op (const octave_value_list& idx, bool resize_ok)
+{
+  // FIXME -- this doesn't solve the problem of
+  //
+  //   a = 1; a([1,1], [1,1], [1,1])
+  //
+  // and similar constructions.  Hmm...
+
+  // FIXME -- using this constructor avoids narrowing the
+  // 1x1 matrix back to a scalar value.  Need a better solution
+  // to this problem.
+
+  octave_value tmp (new octave_matrix (matrix_value ()));
+
+  return tmp.do_index_op (idx, resize_ok);
+}
+
+octave_value
+octave_scalar::resize (const dim_vector& dv, bool fill) const
+{
+  if (fill)
+    {
+      NDArray retval (dv, 0);
+
+      if (dv.numel ())
+        retval(0) = scalar;
+
+      return retval;
+    }
+  else
+    {
+      NDArray retval (dv);
+
+      if (dv.numel ())
+        retval(0) = scalar;
+
+      return retval;
+    }
+}
+
+octave_value
+octave_scalar::diag (octave_idx_type m, octave_idx_type n) const
+{
+  return DiagMatrix (Array<double> (dim_vector (1, 1), scalar), m, n);
+}
+
+octave_value
+octave_scalar::convert_to_str_internal (bool, bool, char type) const
+{
+  octave_value retval;
+
+  if (xisnan (scalar))
+    gripe_nan_to_character_conversion ();
+  else
+    {
+      int ival = NINT (scalar);
+
+      if (ival < 0 || ival > UCHAR_MAX)
+        {
+          // FIXME -- is there something better we could do?
+
+          ival = 0;
+
+          ::warning ("range error for conversion to character value");
+        }
+
+      retval = octave_value (std::string (1, static_cast<char> (ival)), type);
+    }
+
+  return retval;
+}
+
+bool
+octave_scalar::save_ascii (std::ostream& os)
+{
+  double d = double_value ();
+
+  octave_write_double (os, d);
+
+  os << "\n";
+
+  return true;
+}
+
+bool
+octave_scalar::load_ascii (std::istream& is)
+{
+  scalar = octave_read_value<double> (is);
+  if (!is)
+    {
+      error ("load: failed to load scalar constant");
+      return false;
+    }
+
+  return true;
+}
+
+bool
+octave_scalar::save_binary (std::ostream& os, bool& /* save_as_floats */)
+{
+  char tmp = LS_DOUBLE;
+  os.write (reinterpret_cast<char *> (&tmp), 1);
+  double dtmp = double_value ();
+  os.write (reinterpret_cast<char *> (&dtmp), 8);
+
+  return true;
+}
+
+bool
+octave_scalar::load_binary (std::istream& is, bool swap,
+                            oct_mach_info::float_format fmt)
+{
+  char tmp;
+  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
+    return false;
+
+  double dtmp;
+  read_doubles (is, &dtmp, static_cast<save_type> (tmp), 1, swap, fmt);
+  if (error_state || ! is)
+    return false;
+
+  scalar = dtmp;
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_scalar::save_hdf5 (hid_t loc_id, const char *name,
+                          bool /* save_as_floats */)
+{
+  hsize_t dimens[3];
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+
+  space_hid = H5Screate_simple (0, dimens, 0);
+  if (space_hid < 0) return false;
+
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  double tmp = double_value ();
+  retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, &tmp) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_scalar::load_hdf5 (hid_t loc_id, const char *name)
+{
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_id = H5Dget_space (data_hid);
+
+  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
+
+  if (rank != 0)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  double dtmp;
+  if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+               H5P_DEFAULT, &dtmp) < 0)
+    {
+      H5Dclose (data_hid);
+      return false;
+    }
+
+  scalar = dtmp;
+
+  H5Dclose (data_hid);
+
+  return true;
+}
+
+#endif
+
+mxArray *
+octave_scalar::as_mxArray (void) const
+{
+  mxArray *retval = new mxArray (mxDOUBLE_CLASS, 1, 1, mxREAL);
+
+  double *pr = static_cast<double *> (retval->get_data ());
+
+  pr[0] = scalar;
+
+  return retval;
+}
+
+octave_value
+octave_scalar::map (unary_mapper_t umap) const
+{
+  switch (umap)
+    {
+    case umap_imag:
+      return 0.0;
+
+    case umap_real:
+    case umap_conj:
+      return scalar;
+
+#define SCALAR_MAPPER(UMAP, FCN) \
+    case umap_ ## UMAP: \
+      return octave_value (FCN (scalar))
+
+      SCALAR_MAPPER (abs, ::fabs);
+      SCALAR_MAPPER (acos, rc_acos);
+      SCALAR_MAPPER (acosh, rc_acosh);
+      SCALAR_MAPPER (angle, ::arg);
+      SCALAR_MAPPER (arg, ::arg);
+      SCALAR_MAPPER (asin, rc_asin);
+      SCALAR_MAPPER (asinh, ::asinh);
+      SCALAR_MAPPER (atan, ::atan);
+      SCALAR_MAPPER (atanh, rc_atanh);
+      SCALAR_MAPPER (erf, ::erf);
+      SCALAR_MAPPER (erfinv, ::erfinv);
+      SCALAR_MAPPER (erfcinv, ::erfcinv);
+      SCALAR_MAPPER (erfc, ::erfc);
+      SCALAR_MAPPER (erfcx, ::erfcx);
+      SCALAR_MAPPER (gamma, xgamma);
+      SCALAR_MAPPER (lgamma, rc_lgamma);
+      SCALAR_MAPPER (cbrt, ::cbrt);
+      SCALAR_MAPPER (ceil, ::ceil);
+      SCALAR_MAPPER (cos, ::cos);
+      SCALAR_MAPPER (cosh, ::cosh);
+      SCALAR_MAPPER (exp, ::exp);
+      SCALAR_MAPPER (expm1, ::expm1);
+      SCALAR_MAPPER (fix, ::fix);
+      SCALAR_MAPPER (floor, gnulib::floor);
+      SCALAR_MAPPER (log, rc_log);
+      SCALAR_MAPPER (log2, rc_log2);
+      SCALAR_MAPPER (log10, rc_log10);
+      SCALAR_MAPPER (log1p, rc_log1p);
+      SCALAR_MAPPER (round, xround);
+      SCALAR_MAPPER (roundb, xroundb);
+      SCALAR_MAPPER (signum, ::signum);
+      SCALAR_MAPPER (sin, ::sin);
+      SCALAR_MAPPER (sinh, ::sinh);
+      SCALAR_MAPPER (sqrt, rc_sqrt);
+      SCALAR_MAPPER (tan, ::tan);
+      SCALAR_MAPPER (tanh, ::tanh);
+      SCALAR_MAPPER (finite, xfinite);
+      SCALAR_MAPPER (isinf, xisinf);
+      SCALAR_MAPPER (isna, octave_is_NA);
+      SCALAR_MAPPER (isnan, xisnan);
+
+    default:
+      if (umap >= umap_xisalnum && umap <= umap_xtoupper)
+        {
+          octave_value str_conv = convert_to_str (true, true);
+          return error_state ? octave_value () : str_conv.map (umap);
+        }
+      else
+        return octave_base_value::map (umap);
+    }
+}
+
+bool
+octave_scalar::fast_elem_insert_self (void *where, builtin_type_t btyp) const
+{
+
+  // Support inline real->complex conversion.
+  if (btyp == btyp_double)
+    {
+      *(reinterpret_cast<double *>(where)) = scalar;
+      return true;
+    }
+  else if (btyp == btyp_complex)
+    {
+      *(reinterpret_cast<Complex *>(where)) = scalar;
+      return true;
+    }
+  else
+    return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-scalar.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,259 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_scalar_h)
+#define octave_scalar_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "lo-ieee.h"
+#include "lo-mappers.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "str-vec.h"
+
+#include "gripes.h"
+#include "ov-base.h"
+#include "ov-re-mat.h"
+#include "ov-base-scalar.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Real scalar values.
+
+class
+OCTINTERP_API
+octave_scalar : public octave_base_scalar<double>
+{
+public:
+
+  octave_scalar (void)
+    : octave_base_scalar<double> (0.0) { }
+
+  octave_scalar (double d)
+    : octave_base_scalar<double> (d) { }
+
+  octave_scalar (const octave_scalar& s)
+    : octave_base_scalar<double> (s) { }
+
+  ~octave_scalar (void) { }
+
+  octave_base_value *clone (void) const { return new octave_scalar (*this); }
+
+  // We return an octave_matrix here instead of an octave_scalar so
+  // that in expressions like A(2,2,2) = 2 (for A previously
+  // undefined), A will be empty instead of a 1x1 object.
+  octave_base_value *empty_clone (void) const { return new octave_matrix (); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  type_conv_info numeric_demotion_function (void) const;
+
+  idx_vector index_vector (void) const { return idx_vector (scalar); }
+
+  octave_value any (int = 0) const
+    { return (scalar != 0 && ! lo_ieee_isnan (scalar)); }
+
+  builtin_type_t builtin_type (void) const { return btyp_double; }
+
+  bool is_real_scalar (void) const { return true; }
+
+  bool is_real_type (void) const { return true; }
+
+  bool is_double_type (void) const { return true; }
+
+  bool is_float_type (void) const { return true; }
+
+  int8NDArray
+  int8_array_value (void) const
+    { return int8NDArray (dim_vector (1, 1), scalar); }
+
+  int16NDArray
+  int16_array_value (void) const
+    { return int16NDArray (dim_vector (1, 1), scalar); }
+
+  int32NDArray
+  int32_array_value (void) const
+    { return int32NDArray (dim_vector (1, 1), scalar); }
+
+  int64NDArray
+  int64_array_value (void) const
+    { return int64NDArray (dim_vector (1, 1), scalar); }
+
+  uint8NDArray
+  uint8_array_value (void) const
+    { return uint8NDArray (dim_vector (1, 1), scalar); }
+
+  uint16NDArray
+  uint16_array_value (void) const
+    { return uint16NDArray (dim_vector (1, 1), scalar); }
+
+  uint32NDArray
+  uint32_array_value (void) const
+    { return uint32NDArray (dim_vector (1, 1), scalar); }
+
+  uint64NDArray
+  uint64_array_value (void) const
+    { return uint64NDArray (dim_vector (1, 1), scalar); }
+
+#define DEFINE_INT_SCALAR_VALUE(TYPE) \
+  octave_ ## TYPE \
+  TYPE ## _scalar_value (void) const \
+    { return octave_ ## TYPE (scalar); }
+
+  DEFINE_INT_SCALAR_VALUE (int8)
+  DEFINE_INT_SCALAR_VALUE (int16)
+  DEFINE_INT_SCALAR_VALUE (int32)
+  DEFINE_INT_SCALAR_VALUE (int64)
+  DEFINE_INT_SCALAR_VALUE (uint8)
+  DEFINE_INT_SCALAR_VALUE (uint16)
+  DEFINE_INT_SCALAR_VALUE (uint32)
+  DEFINE_INT_SCALAR_VALUE (uint64)
+
+#undef DEFINE_INT_SCALAR_VALUE
+
+  double double_value (bool = false) const { return scalar; }
+
+  float float_value (bool = false) const { return static_cast<float> (scalar); }
+
+  double scalar_value (bool = false) const { return scalar; }
+
+  float float_scalar_value (bool = false) const { return static_cast<float> (scalar); }
+
+  Matrix matrix_value (bool = false) const
+    { return Matrix (1, 1, scalar); }
+
+  FloatMatrix float_matrix_value (bool = false) const
+    { return FloatMatrix (1, 1, scalar); }
+
+  NDArray array_value (bool = false) const
+    { return NDArray (dim_vector (1, 1), scalar); }
+
+  FloatNDArray float_array_value (bool = false) const
+    { return FloatNDArray (dim_vector (1, 1), scalar); }
+
+  SparseMatrix sparse_matrix_value (bool = false) const
+    { return SparseMatrix (Matrix (1, 1, scalar)); }
+
+  // FIXME Need SparseComplexMatrix (Matrix) constructor!!!
+  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
+    { return SparseComplexMatrix (sparse_matrix_value ()); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+  Complex complex_value (bool = false) const { return scalar; }
+
+  FloatComplex float_complex_value (bool = false) const { return scalar; }
+
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return  ComplexMatrix (1, 1, Complex (scalar)); }
+
+  FloatComplexMatrix float_complex_matrix_value (bool = false) const
+    { return  FloatComplexMatrix (1, 1, FloatComplex (scalar)); }
+
+  ComplexNDArray complex_array_value (bool = false) const
+    { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); }
+
+  FloatComplexNDArray float_complex_array_value (bool = false) const
+    { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); }
+
+  charNDArray
+  char_array_value (bool = false) const
+  {
+    charNDArray retval (dim_vector (1, 1));
+    retval(0) = static_cast<char> (scalar);
+    return retval;
+  }
+
+  bool bool_value (bool warn = false) const
+  {
+    if (xisnan (scalar))
+      gripe_nan_to_logical_conversion ();
+    else if (warn && scalar != 0 && scalar != 1)
+      gripe_logical_conversion ();
+
+    return scalar;
+  }
+
+  boolNDArray bool_array_value (bool warn = false) const
+  {
+    if (xisnan (scalar))
+      gripe_nan_to_logical_conversion ();
+    else if (warn && scalar != 0 && scalar != 1)
+      gripe_logical_conversion ();
+
+    return boolNDArray (dim_vector (1, 1), scalar);
+  }
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const;
+
+  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
+
+  void increment (void) { ++scalar; }
+
+  void decrement (void) { --scalar; }
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    {
+      return os.write (array_value (), block_size, output_type,
+                       skip, flt_fmt);
+    }
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value map (unary_mapper_t umap) const;
+
+  bool fast_elem_insert_self (void *where, builtin_type_t btyp) const;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-str-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,777 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cctype>
+
+#include <iostream>
+#include <vector>
+
+#include "data-conv.h"
+#include "lo-ieee.h"
+#include "mach-info.h"
+#include "mx-base.h"
+#include "oct-locbuf.h"
+
+#include "byte-swap.h"
+#include "defun.h"
+#include "gripes.h"
+#include "ls-ascii-helper.h"
+#include "ls-hdf5.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "oct-obj.h"
+#include "oct-stream.h"
+#include "ops.h"
+#include "ov-scalar.h"
+#include "ov-re-mat.h"
+#include "ov-str-mat.h"
+#include "pr-output.h"
+#include "pt-mat.h"
+#include "utils.h"
+
+DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix_str);
+DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix_sq_str);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_str, "string", "char");
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_sq_str, "sq_string", "char");
+
+static octave_base_value *
+default_numeric_conversion_function (const octave_base_value& a)
+{
+  octave_base_value *retval = 0;
+
+  CAST_CONV_ARG (const octave_char_matrix_str&);
+
+  NDArray nda = v.array_value (true);
+
+  if (! error_state)
+    {
+      if (nda.numel () == 1)
+        retval = new octave_scalar (nda(0));
+      else
+        retval = new octave_matrix (nda);
+    }
+
+  return retval;
+}
+
+octave_base_value::type_conv_info
+octave_char_matrix_str::numeric_conversion_function (void) const
+{
+  return octave_base_value::type_conv_info (default_numeric_conversion_function,
+                                            octave_matrix::static_type_id ());
+}
+
+octave_value
+octave_char_matrix_str::do_index_op_internal (const octave_value_list& idx,
+                                              bool resize_ok, char type)
+{
+  octave_value retval;
+
+  octave_idx_type len = idx.length ();
+
+  switch (len)
+    {
+    case 0:
+      retval = octave_value (matrix, type);
+      break;
+
+    case 1:
+      {
+        idx_vector i = idx (0).index_vector ();
+
+        if (! error_state)
+          retval = octave_value (charNDArray (matrix.index (i, resize_ok)),
+                                 type);
+      }
+      break;
+
+    case 2:
+      {
+        idx_vector i = idx (0).index_vector ();
+        idx_vector j = idx (1).index_vector ();
+
+        if (! error_state)
+          retval = octave_value (charNDArray (matrix.index (i, j, resize_ok)),
+                                 type);
+      }
+      break;
+
+    default:
+      {
+        Array<idx_vector> idx_vec (dim_vector (len, 1));
+
+        for (octave_idx_type i = 0; i < len; i++)
+          idx_vec(i) = idx(i).index_vector ();
+
+        if (! error_state)
+          retval = octave_value (charNDArray (matrix.index (idx_vec, resize_ok)),
+                                 type);
+      }
+      break;
+    }
+
+  return retval;
+}
+
+octave_value
+octave_char_matrix_str::resize (const dim_vector& dv, bool fill) const
+{
+  charNDArray retval (matrix);
+  if (fill)
+    retval.resize (dv, 0);
+  else
+    retval.resize (dv);
+  return octave_value (retval, is_sq_string () ? '\'' : '"');
+}
+
+#define CHAR_MATRIX_CONV(T, INIT, TNAME, FCN) \
+  T retval INIT; \
+ \
+  if (! force_string_conv) \
+    gripe_invalid_conversion ("string", TNAME); \
+  else \
+    { \
+      warning_with_id ("Octave:str-to-num", \
+                       "implicit conversion from %s to %s", \
+                       "string", TNAME); \
+ \
+      retval = octave_char_matrix::FCN (); \
+    } \
+ \
+  return retval
+
+double
+octave_char_matrix_str::double_value (bool force_string_conv) const
+{
+  CHAR_MATRIX_CONV (double, = 0, "real scalar", double_value);
+}
+
+Complex
+octave_char_matrix_str::complex_value (bool force_string_conv) const
+{
+  CHAR_MATRIX_CONV (Complex, = 0, "complex scalar", complex_value);
+}
+
+Matrix
+octave_char_matrix_str::matrix_value (bool force_string_conv) const
+{
+  CHAR_MATRIX_CONV (Matrix, , "real matrix", matrix_value);
+}
+
+ComplexMatrix
+octave_char_matrix_str::complex_matrix_value (bool force_string_conv) const
+{
+  CHAR_MATRIX_CONV (ComplexMatrix, , "complex matrix", complex_matrix_value);
+}
+
+NDArray
+octave_char_matrix_str::array_value (bool force_string_conv) const
+{
+  CHAR_MATRIX_CONV (NDArray, , "real N-d array", array_value);
+}
+
+ComplexNDArray
+octave_char_matrix_str::complex_array_value (bool force_string_conv) const
+{
+  CHAR_MATRIX_CONV (ComplexNDArray, , "complex N-d array",
+                    complex_array_value);
+}
+
+string_vector
+octave_char_matrix_str::all_strings (bool) const
+{
+  string_vector retval;
+
+  if (matrix.ndims () == 2)
+    {
+      charMatrix chm = matrix.matrix_value ();
+
+      octave_idx_type n = chm.rows ();
+
+      retval.resize (n);
+
+      for (octave_idx_type i = 0; i < n; i++)
+        retval[i] = chm.row_as_string (i);
+    }
+  else
+    error ("invalid conversion of charNDArray to string_vector");
+
+  return retval;
+}
+
+std::string
+octave_char_matrix_str::string_value (bool) const
+{
+  std::string retval;
+
+  if (matrix.ndims () == 2)
+    {
+      charMatrix chm = matrix.matrix_value ();
+
+      retval = chm.row_as_string (0);  // FIXME???
+    }
+  else
+    error ("invalid conversion of charNDArray to string");
+
+  return retval;
+}
+
+Array<std::string>
+octave_char_matrix_str::cellstr_value (void) const
+{
+  Array<std::string> retval;
+
+  if (matrix.ndims () == 2)
+    {
+      const charMatrix chm = matrix.matrix_value ();
+      octave_idx_type nr = chm.rows ();
+      retval.clear (nr, 1);
+      for (octave_idx_type i = 0; i < nr; i++)
+        retval.xelem (i) = chm.row_as_string (i);
+    }
+  else
+    error ("cellstr: cannot convert multidimensional arrays");
+
+  return retval;
+}
+
+void
+octave_char_matrix_str::print_raw (std::ostream& os, bool pr_as_read_syntax) const
+{
+  octave_print_internal (os, matrix, pr_as_read_syntax,
+                         current_print_indent_level (), true);
+}
+
+bool
+octave_char_matrix_str::save_ascii (std::ostream& os)
+{
+  dim_vector d = dims ();
+  if (d.length () > 2)
+    {
+      charNDArray tmp = char_array_value ();
+      os << "# ndims: " << d.length () << "\n";
+      for (int i=0; i < d.length (); i++)
+        os << " " << d (i);
+      os << "\n";
+      os.write (tmp.fortran_vec (), d.numel ());
+      os << "\n";
+    }
+  else
+    {
+      // Keep this case, rather than use generic code above for
+      // backward compatiability. Makes load_ascii much more complex!!
+      charMatrix chm = char_matrix_value ();
+      octave_idx_type elements = chm.rows ();
+      os << "# elements: " << elements << "\n";
+      for (octave_idx_type i = 0; i < elements; i++)
+        {
+          unsigned len = chm.cols ();
+          os << "# length: " << len << "\n";
+          std::string tstr = chm.row_as_string (i);
+          const char *tmp = tstr.data ();
+          if (tstr.length () > len)
+            panic_impossible ();
+          os.write (tmp, len);
+          os << "\n";
+        }
+    }
+
+  return true;
+}
+
+bool
+octave_char_matrix_str::load_ascii (std::istream& is)
+{
+  bool success = true;
+
+  string_vector keywords(3);
+
+  keywords[0] = "ndims";
+  keywords[1] = "elements";
+  keywords[2] = "length";
+
+  std::string kw;
+  int val = 0;
+
+  if (extract_keyword (is, keywords, kw, val, true))
+    {
+      if (kw == "ndims")
+        {
+          int mdims = val;
+
+          if (mdims >= 0)
+            {
+              dim_vector dv;
+              dv.resize (mdims);
+
+              for (int i = 0; i < mdims; i++)
+                is >> dv(i);
+
+              if (is)
+                {
+                  charNDArray tmp(dv);
+
+                  if (tmp.is_empty ())
+                    matrix = tmp;
+                  else
+                    {
+                      char *ftmp = tmp.fortran_vec ();
+
+                      skip_preceeding_newline (is);
+
+                      if (! is.read (ftmp, dv.numel ()) || !is)
+                        {
+                          error ("load: failed to load string constant");
+                          success = false;
+                        }
+                      else
+                        matrix = tmp;
+                    }
+                }
+              else
+                {
+                  error ("load: failed to read dimensions");
+                  success = false;
+                }
+            }
+          else
+            {
+              error ("load: failed to extract matrix size");
+              success = false;
+            }
+        }
+      else if (kw == "elements")
+        {
+          int elements = val;
+
+          if (elements >= 0)
+            {
+              // FIXME -- need to be able to get max length
+              // before doing anything.
+
+              charMatrix chm (elements, 0);
+              int max_len = 0;
+              for (int i = 0; i < elements; i++)
+                {
+                  int len;
+                  if (extract_keyword (is, "length", len) && len >= 0)
+                    {
+                      // Use this instead of a C-style character
+                      // buffer so that we can properly handle
+                      // embedded NUL characters.
+                      charMatrix tmp (1, len);
+                      char *ptmp = tmp.fortran_vec ();
+
+                      if (len > 0 && ! is.read (ptmp, len))
+                        {
+                          error ("load: failed to load string constant");
+                          success = false;
+                          break;
+                        }
+                      else
+                        {
+                          if (len > max_len)
+                            {
+                              max_len = len;
+                              chm.resize (elements, max_len, 0);
+                            }
+
+                          chm.insert (tmp, i, 0);
+                        }
+                    }
+                  else
+                    {
+                      error ("load: failed to extract string length for element %d",
+                             i+1);
+                      success = false;
+                    }
+                }
+
+              if (! error_state)
+                matrix = chm;
+            }
+          else
+            {
+              error ("load: failed to extract number of string elements");
+              success = false;
+            }
+        }
+      else if (kw == "length")
+        {
+          int len = val;
+
+          if (len >= 0)
+            {
+              // This is cruft for backward compatiability,
+              // but relatively harmless.
+
+              // Use this instead of a C-style character buffer so
+              // that we can properly handle embedded NUL characters.
+              charMatrix tmp (1, len);
+              char *ptmp = tmp.fortran_vec ();
+
+              if (len > 0 && ! is.read (ptmp, len))
+                {
+                  error ("load: failed to load string constant");
+                }
+              else
+                {
+                  if (is)
+                    matrix = tmp;
+                  else
+                    error ("load: failed to load string constant");
+                }
+            }
+        }
+      else
+        panic_impossible ();
+    }
+  else
+    {
+      error ("load: failed to extract number of rows and columns");
+      success = false;
+    }
+
+  return success;
+}
+
+bool
+octave_char_matrix_str::save_binary (std::ostream& os,
+                                     bool& /* save_as_floats */)
+{
+  dim_vector d = dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims to differentiate with old format!!
+  int32_t tmp = - d.length ();
+  os.write (reinterpret_cast<char *> (&tmp), 4);
+  for (int i=0; i < d.length (); i++)
+    {
+      tmp = d(i);
+      os.write (reinterpret_cast<char *> (&tmp), 4);
+    }
+
+  charNDArray m = char_array_value ();
+  os.write (m.fortran_vec (), d.numel ());
+  return true;
+}
+
+bool
+octave_char_matrix_str::load_binary (std::istream& is, bool swap,
+                                     oct_mach_info::float_format /* fmt */)
+{
+  int32_t elements;
+  if (! is.read (reinterpret_cast<char *> (&elements), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&elements);
+
+  if (elements < 0)
+    {
+      int32_t mdims = - elements;
+      int32_t di;
+      dim_vector dv;
+      dv.resize (mdims);
+
+      for (int i = 0; i < mdims; i++)
+        {
+          if (! is.read (reinterpret_cast<char *> (&di), 4))
+            return false;
+          if (swap)
+            swap_bytes<4> (&di);
+          dv(i) = di;
+        }
+
+      // Convert an array with a single dimension to be a row vector.
+      // Octave should never write files like this, other software
+      // might.
+
+      if (mdims == 1)
+        {
+          mdims = 2;
+          dv.resize (mdims);
+          dv(1) = dv(0);
+          dv(0) = 1;
+        }
+
+      charNDArray m(dv);
+      char *tmp = m.fortran_vec ();
+      is.read (tmp, dv.numel ());
+
+      if (error_state || ! is)
+        return false;
+      matrix = m;
+    }
+  else
+    {
+      charMatrix chm (elements, 0);
+      int max_len = 0;
+      for (int i = 0; i < elements; i++)
+        {
+          int32_t len;
+          if (! is.read (reinterpret_cast<char *> (&len), 4))
+            return false;
+          if (swap)
+            swap_bytes<4> (&len);
+          charMatrix btmp (1, len);
+          char *pbtmp = btmp.fortran_vec ();
+          if (! is.read (pbtmp, len))
+            return false;
+          if (len > max_len)
+            {
+              max_len = len;
+              chm.resize (elements, max_len, 0);
+            }
+          chm.insert (btmp, i, 0);
+        }
+      matrix = chm;
+    }
+  return true;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_char_matrix_str::save_hdf5 (hid_t loc_id, const char *name,
+                                   bool /* save_as_floats */)
+{
+  dim_vector dv = dims ();
+  int empty = save_hdf5_empty (loc_id, name, dv);
+  if (empty)
+    return (empty > 0);
+
+  int rank = dv.length ();
+  hid_t space_hid = -1, data_hid = -1;
+  bool retval = true;
+  charNDArray m = char_array_value ();
+
+  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+
+  // Octave uses column-major, while HDF5 uses row-major ordering
+  for (int i = 0; i < rank; i++)
+    hdims[i] = dv (rank-i-1);
+
+  space_hid = H5Screate_simple (rank, hdims, 0);
+  if (space_hid < 0)
+    return false;
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
+                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
+                        H5P_DEFAULT);
+#endif
+  if (data_hid < 0)
+    {
+      H5Sclose (space_hid);
+      return false;
+    }
+
+  OCTAVE_LOCAL_BUFFER (char, s, dv.numel ());
+
+  for (int i = 0; i < dv.numel (); ++i)
+    s[i] = m(i);
+
+  retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
+                     H5P_DEFAULT, s) >= 0;
+
+  H5Dclose (data_hid);
+  H5Sclose (space_hid);
+
+  return retval;
+}
+
+bool
+octave_char_matrix_str::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  dim_vector dv;
+  int empty = load_hdf5_empty (loc_id, name, dv);
+  if (empty > 0)
+    matrix.resize (dv);
+  if (empty)
+    return (empty > 0);
+
+#if HAVE_HDF5_18
+  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t data_hid = H5Dopen (loc_id, name);
+#endif
+  hid_t space_hid = H5Dget_space (data_hid);
+  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
+  hid_t type_hid = H5Dget_type (data_hid);
+  hid_t type_class_hid = H5Tget_class (type_hid);
+
+  if (type_class_hid == H5T_INTEGER)
+    {
+      if (rank < 1)
+        {
+          H5Tclose (type_hid);
+          H5Sclose (space_hid);
+          H5Dclose (data_hid);
+          return false;
+        }
+
+      OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
+      OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
+
+      H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
+
+      // Octave uses column-major, while HDF5 uses row-major ordering
+      if (rank == 1)
+        {
+          dv.resize (2);
+          dv(0) = 1;
+          dv(1) = hdims[0];
+        }
+      else
+        {
+          dv.resize (rank);
+          for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
+            dv(j) = hdims[i];
+        }
+
+      charNDArray m (dv);
+      char *str = m.fortran_vec ();
+      if (H5Dread (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
+                   H5P_DEFAULT, str) >= 0)
+        {
+          retval = true;
+          matrix = m;
+        }
+
+      H5Tclose (type_hid);
+      H5Sclose (space_hid);
+      H5Dclose (data_hid);
+      return true;
+    }
+  else
+    {
+      // This is cruft for backward compatiability and easy data
+      // importation
+      if (rank == 0)
+        {
+          // a single string:
+          int slen = H5Tget_size (type_hid);
+          if (slen < 0)
+            {
+              H5Tclose (type_hid);
+              H5Sclose (space_hid);
+              H5Dclose (data_hid);
+              return false;
+            }
+          else
+            {
+              OCTAVE_LOCAL_BUFFER (char, s, slen);
+              // create datatype for (null-terminated) string
+              // to read into:
+              hid_t st_id = H5Tcopy (H5T_C_S1);
+              H5Tset_size (st_id, slen);
+              if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, s) < 0)
+                {
+                  H5Tclose (st_id);
+                  H5Tclose (type_hid);
+                  H5Sclose (space_hid);
+                  H5Dclose (data_hid);
+                  return false;
+                }
+
+              matrix = charMatrix (s);
+
+              H5Tclose (st_id);
+              H5Tclose (type_hid);
+              H5Sclose (space_hid);
+              H5Dclose (data_hid);
+              return true;
+            }
+        }
+      else if (rank == 1)
+        {
+          // string vector
+          hsize_t elements, maxdim;
+          H5Sget_simple_extent_dims (space_hid, &elements, &maxdim);
+          int slen = H5Tget_size (type_hid);
+          if (slen < 0)
+            {
+              H5Tclose (type_hid);
+              H5Sclose (space_hid);
+              H5Dclose (data_hid);
+              return false;
+            }
+          else
+            {
+              // hdf5 string arrays store strings of all the
+              // same physical length (I think), which is
+              // slightly wasteful, but oh well.
+
+              OCTAVE_LOCAL_BUFFER (char, s, elements * slen);
+
+              // create datatype for (null-terminated) string
+              // to read into:
+              hid_t st_id = H5Tcopy (H5T_C_S1);
+              H5Tset_size (st_id, slen);
+
+              if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, s) < 0)
+                {
+                  H5Tclose (st_id);
+                  H5Tclose (type_hid);
+                  H5Sclose (space_hid);
+                  H5Dclose (data_hid);
+                  return false;
+                }
+
+              charMatrix chm (elements, slen - 1);
+              for (hsize_t i = 0; i < elements; ++i)
+                {
+                  chm.insert (s + i*slen, i, 0);
+                }
+
+              matrix = chm;
+
+              H5Tclose (st_id);
+              H5Tclose (type_hid);
+              H5Sclose (space_hid);
+              H5Dclose (data_hid);
+              return true;
+            }
+        }
+      else
+        {
+          H5Tclose (type_hid);
+          H5Sclose (space_hid);
+          H5Dclose (data_hid);
+          return false;
+        }
+    }
+
+  return retval;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-str-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,257 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_char_matrix_str_h)
+#define octave_char_matrix_str_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-stream.h"
+#include "ov.h"
+#include "ov-ch-mat.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Character matrix values with special properties for use as
+// strings.
+
+class
+OCTINTERP_API
+octave_char_matrix_str : public octave_char_matrix
+{
+public:
+
+  octave_char_matrix_str (void)
+    : octave_char_matrix () { }
+
+  octave_char_matrix_str (const charMatrix& chm)
+    : octave_char_matrix (chm) { }
+
+  octave_char_matrix_str (const charNDArray& chm)
+    : octave_char_matrix (chm) { }
+
+  octave_char_matrix_str (const Array<char>& chm)
+    : octave_char_matrix (chm) { }
+
+  octave_char_matrix_str (char c)
+    : octave_char_matrix (c) { }
+
+  octave_char_matrix_str (const char *s)
+    : octave_char_matrix (s) { }
+
+  octave_char_matrix_str (const std::string& s)
+    : octave_char_matrix (s) { }
+
+  octave_char_matrix_str (const string_vector& s)
+    : octave_char_matrix (s) { }
+
+  octave_char_matrix_str (const octave_char_matrix& chm)
+    : octave_char_matrix (chm) { }
+
+  octave_char_matrix_str (const octave_char_matrix_str& chms)
+    : octave_char_matrix (chms) { }
+
+  ~octave_char_matrix_str (void) { }
+
+  octave_base_value *clone (void) const { return new octave_char_matrix_str (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_char_matrix_str (); }
+
+  type_conv_info numeric_conversion_function (void) const;
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false)
+    { return do_index_op_internal (idx, resize_ok); }
+
+  octave_value squeeze (void) const
+    { return octave_value (charNDArray (matrix.squeeze ())); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return octave_value (charNDArray (matrix.reshape (new_dims))); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return octave_value (charNDArray (matrix.permute (vec, inv))); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const;
+
+  octave_value diag (octave_idx_type k = 0) const
+    { return octave_value (matrix.diag (k)); }
+
+  bool is_string (void) const { return true; }
+
+  bool is_numeric_type (void) const { return false; }
+
+  double double_value (bool = false) const;
+
+  Matrix matrix_value (bool = false) const;
+
+  NDArray array_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
+
+  ComplexMatrix complex_matrix_value (bool = false) const;
+
+  ComplexNDArray complex_array_value (bool = false) const;
+
+  string_vector all_strings (bool pad = false) const;
+
+  std::string string_value (bool force = false) const;
+
+  Array<std::string> cellstr_value (void) const;
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
+    { return octave_value (matrix.sort (dim, mode)); }
+
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const
+    { return octave_value (matrix.sort (sidx, dim, mode)); }
+
+  bool print_as_scalar (void) const { return (rows () <= 1); }
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  int write (octave_stream& os, int block_size,
+             oct_data_conv::data_type output_type, int skip,
+             oct_mach_info::float_format flt_fmt) const
+    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
+
+protected:
+
+  octave_value do_index_op_internal (const octave_value_list& idx,
+                                     bool resize_ok, char type = '"');
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+typedef octave_char_matrix_str octave_char_matrix_dq_str;
+
+class
+octave_char_matrix_sq_str : public octave_char_matrix_str
+{
+public:
+
+  octave_char_matrix_sq_str (void)
+    : octave_char_matrix_str () { }
+
+  octave_char_matrix_sq_str (const charMatrix& chm)
+    : octave_char_matrix_str (chm) { }
+
+  octave_char_matrix_sq_str (const charNDArray& chm)
+    : octave_char_matrix_str (chm) { }
+
+  octave_char_matrix_sq_str (const Array<char>& chm)
+    : octave_char_matrix_str (chm) { }
+
+  octave_char_matrix_sq_str (char c)
+    : octave_char_matrix_str (c) { }
+
+  octave_char_matrix_sq_str (const char *s)
+    : octave_char_matrix_str (s) { }
+
+  octave_char_matrix_sq_str (const std::string& s)
+    : octave_char_matrix_str (s) { }
+
+  octave_char_matrix_sq_str (const string_vector& s)
+    : octave_char_matrix_str (s) { }
+
+  octave_char_matrix_sq_str (const octave_char_matrix_str& chm)
+    : octave_char_matrix_str (chm) { }
+
+  octave_char_matrix_sq_str (const octave_char_matrix_sq_str& chms)
+    : octave_char_matrix_str (chms) { }
+
+  ~octave_char_matrix_sq_str (void) { }
+
+  octave_base_value *clone (void) const { return new octave_char_matrix_sq_str (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_char_matrix_sq_str (); }
+
+  octave_value squeeze (void) const
+    { return octave_value (charNDArray (matrix.squeeze ()), '\''); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return octave_value (charNDArray (matrix.reshape (new_dims)), '\''); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return octave_value (charNDArray (matrix.permute (vec, inv)), '\''); }
+
+  octave_value resize (const dim_vector& dv, bool = false) const
+    {
+      charNDArray retval (matrix);
+      retval.resize (dv);
+      return octave_value (retval, '\'');
+    }
+
+  octave_value diag (octave_idx_type k = 0) const
+    { return octave_value (matrix.diag (k), '\''); }
+
+  bool is_sq_string (void) const { return true; }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false)
+    { return do_index_op_internal (idx, resize_ok, '\''); }
+
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
+    { return octave_value (matrix.sort (dim, mode), '\''); }
+
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                     sortmode mode = ASCENDING) const
+    { return octave_value (matrix.sort (sidx, dim, mode), '\''); }
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-struct.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,2235 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "Cell.h"
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "oct-lvalue.h"
+#include "ov-struct.h"
+#include "unwind-prot.h"
+#include "utils.h"
+#include "variables.h"
+
+#include "Array-util.h"
+#include "oct-locbuf.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-oct-binary.h"
+#include "ls-hdf5.h"
+#include "ls-utils.h"
+#include "pr-output.h"
+
+DEFINE_OCTAVE_ALLOCATOR(octave_struct);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_struct, "struct", "struct");
+
+// How many levels of structure elements should we print?
+static int Vstruct_levels_to_print = 2;
+
+// TRUE means print struct array contents, up to the number of levels
+// specified by struct_levels_to_print.
+static bool Vprint_struct_array_contents = false;
+
+octave_base_value *
+octave_struct::try_narrowing_conversion (void)
+{
+  octave_base_value *retval = 0;
+
+  if (numel () == 1)
+    retval = new octave_scalar_struct (map.checkelem (0));
+
+  return retval;
+}
+
+Cell
+octave_struct::dotref (const octave_value_list& idx, bool auto_add)
+{
+  Cell retval;
+
+  assert (idx.length () == 1);
+
+  std::string nm = idx(0).string_value ();
+
+  octave_map::const_iterator p = map.seek (nm);
+
+  if (p != map.end ())
+    retval = map.contents (p);
+  else if (auto_add)
+    retval = (numel () == 0) ? Cell (dim_vector (1, 1)) : Cell (dims ());
+  else
+    error ("structure has no member `%s'", nm.c_str ());
+
+  return retval;
+}
+
+#if 0
+static void
+gripe_invalid_index1 (void)
+{
+  error ("invalid index for structure array");
+}
+#endif
+
+static void
+gripe_invalid_index_for_assignment (void)
+{
+  error ("invalid index for structure array assignment");
+}
+
+static void
+gripe_invalid_index_type (const std::string& nm, char t)
+{
+  error ("%s cannot be indexed with %c", nm.c_str (), t);
+}
+
+static void
+gripe_failed_assignment (void)
+{
+  error ("assignment to structure element failed");
+}
+
+octave_value_list
+octave_struct::subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx,
+                        int nargout)
+{
+  octave_value_list retval;
+
+  int skip = 1;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        if (type.length () > 1 && type[1] == '.')
+          {
+            std::list<octave_value_list>::const_iterator p = idx.begin ();
+            octave_value_list key_idx = *++p;
+
+            const Cell tmp = dotref (key_idx);
+
+            if (! error_state)
+              {
+                const Cell t = tmp.index (idx.front ());
+
+                retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
+
+                // We handled two index elements, so tell
+                // next_subsref to skip both of them.
+
+                skip++;
+              }
+          }
+        else
+          retval(0) = do_index_op (idx.front ());
+      }
+      break;
+
+    case '.':
+      {
+        if (map.numel () > 0)
+          {
+            const Cell t = dotref (idx.front ());
+
+            retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
+          }
+      }
+      break;
+
+    case '{':
+      gripe_invalid_index_type (type_name (), type[0]);
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // FIXME -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_user_function::subsref.
+
+  if (idx.size () > 1)
+    retval = retval(0).next_subsref (nargout, type, idx, skip);
+
+  return retval;
+}
+
+octave_value
+octave_struct::subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx,
+                        bool auto_add)
+{
+  octave_value retval;
+
+  int skip = 1;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        if (type.length () > 1 && type[1] == '.')
+          {
+            std::list<octave_value_list>::const_iterator p = idx.begin ();
+            octave_value_list key_idx = *++p;
+
+            const Cell tmp = dotref (key_idx, auto_add);
+
+            if (! error_state)
+              {
+                const Cell t = tmp.index (idx.front (), auto_add);
+
+                retval = (t.length () == 1) ? t(0) : octave_value (t, true);
+
+                // We handled two index elements, so tell
+                // next_subsref to skip both of them.
+
+                skip++;
+              }
+          }
+        else
+          retval = do_index_op (idx.front (), auto_add);
+      }
+      break;
+
+    case '.':
+      {
+        if (map.numel () > 0)
+          {
+            const Cell t = dotref (idx.front (), auto_add);
+
+            retval = (t.length () == 1) ? t(0) : octave_value (t, true);
+          }
+      }
+      break;
+
+    case '{':
+      gripe_invalid_index_type (type_name (), type[0]);
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // FIXME -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_user_function::subsref.
+
+  if (idx.size () > 1)
+    retval = retval.next_subsref (auto_add, type, idx, skip);
+
+  return retval;
+}
+
+/*
+%!test
+%! x(1).a.a = 1;
+%! x(2).a.a = 2;
+%! assert (size (x), [1, 2]);
+%! assert (x(1).a.a, 1);
+%! assert (x(2).a.a, 2);
+*/
+
+octave_value
+octave_struct::numeric_conv (const octave_value& val,
+                             const std::string& type)
+{
+  octave_value retval;
+
+  if (type.length () > 0 && type[0] == '.' && ! val.is_map ())
+    retval = octave_map ();
+  else
+    retval = val;
+
+  return retval;
+}
+
+octave_value
+octave_struct::subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs)
+{
+  octave_value retval;
+
+  int n = type.length ();
+
+  octave_value t_rhs = rhs;
+
+  if (idx.front ().empty ())
+    {
+      error ("missing index in indexed assignment");
+      return retval;
+    }
+
+  if (n > 1 && ! (type.length () == 2 && type[0] == '(' && type[1] == '.'))
+    {
+      switch (type[0])
+        {
+        case '(':
+          {
+            if (type.length () > 1 && type[1] == '.')
+              {
+                std::list<octave_value_list>::const_iterator p = idx.begin ();
+                octave_value_list t_idx = *p;
+
+                octave_value_list key_idx = *++p;
+
+                assert (key_idx.length () == 1);
+
+                std::string key = key_idx(0).string_value ();
+
+                std::list<octave_value_list> next_idx (idx);
+
+                // We handled two index elements, so subsasgn to
+                // needs to skip both of them.
+
+                next_idx.erase (next_idx.begin ());
+                next_idx.erase (next_idx.begin ());
+
+                std::string next_type = type.substr (2);
+
+                Cell tmpc (1, 1);
+                octave_map::iterator pkey = map.seek (key);
+                if (pkey != map.end ())
+                  {
+                    map.contents (pkey).make_unique ();
+                    tmpc = map.contents (pkey).index (idx.front (), true);
+                  }
+
+                // FIXME: better code reuse? cf. octave_cell::subsasgn and the case below.
+                if (! error_state)
+                  {
+                    if (tmpc.numel () == 1)
+                      {
+                        octave_value& tmp = tmpc(0);
+
+                        bool orig_undefined = tmp.is_undefined ();
+
+                        if (orig_undefined || tmp.is_zero_by_zero ())
+                          {
+                            tmp = octave_value::empty_conv (next_type, rhs);
+                            tmp.make_unique (); // probably a no-op.
+                          }
+                        else
+                          // optimization: ignore the copy still stored inside our map.
+                          tmp.make_unique (1);
+
+                        if (! error_state)
+                          t_rhs = (orig_undefined
+                                   ? tmp.undef_subsasgn (next_type, next_idx, rhs)
+                                   : tmp.subsasgn (next_type, next_idx, rhs));
+                      }
+                    else
+                      gripe_indexed_cs_list ();
+                  }
+              }
+            else
+              gripe_invalid_index_for_assignment ();
+          }
+          break;
+
+        case '.':
+          {
+            octave_value_list key_idx = idx.front ();
+
+            assert (key_idx.length () == 1);
+
+            std::string key = key_idx(0).string_value ();
+
+            std::list<octave_value_list> next_idx (idx);
+
+            next_idx.erase (next_idx.begin ());
+
+            std::string next_type = type.substr (1);
+
+            Cell tmpc (1, 1);
+            octave_map::iterator pkey = map.seek (key);
+            if (pkey != map.end ())
+              {
+                map.contents (pkey).make_unique ();
+                tmpc = map.contents (pkey);
+              }
+
+            // FIXME: better code reuse?
+            if (! error_state)
+              {
+                if (tmpc.numel () == 1)
+                  {
+                    octave_value& tmp = tmpc(0);
+
+                    bool orig_undefined = tmp.is_undefined ();
+
+                    if (orig_undefined || tmp.is_zero_by_zero ())
+                      {
+                        tmp = octave_value::empty_conv (next_type, rhs);
+                        tmp.make_unique (); // probably a no-op.
+                      }
+                    else
+                      // optimization: ignore the copy still stored inside our map.
+                      tmp.make_unique (1);
+
+                    if (! error_state)
+                      t_rhs = (orig_undefined
+                               ? tmp.undef_subsasgn (next_type, next_idx, rhs)
+                               : tmp.subsasgn (next_type, next_idx, rhs));
+                  }
+                else
+                  gripe_indexed_cs_list ();
+              }
+          }
+          break;
+
+        case '{':
+          gripe_invalid_index_type (type_name (), type[0]);
+          break;
+
+        default:
+          panic_impossible ();
+        }
+    }
+
+  if (! error_state)
+    {
+      switch (type[0])
+        {
+        case '(':
+          {
+            if (n > 1 && type[1] == '.')
+              {
+                std::list<octave_value_list>::const_iterator p = idx.begin ();
+                octave_value_list key_idx = *++p;
+                octave_value_list idxf = idx.front ();
+
+                assert (key_idx.length () == 1);
+
+                std::string key = key_idx(0).string_value ();
+
+                if (! error_state)
+                  {
+                    if (t_rhs.is_cs_list ())
+                      {
+                        Cell tmp_cell = Cell (t_rhs.list_value ());
+
+                        // Inquire the proper shape of the RHS.
+
+                        dim_vector didx = dims ().redim (idxf.length ());
+                        for (octave_idx_type k = 0; k < idxf.length (); k++)
+                          if (! idxf(k).is_magic_colon ()) didx(k) = idxf(k).numel ();
+
+                        if (didx.numel () == tmp_cell.numel ())
+                          tmp_cell = tmp_cell.reshape (didx);
+
+
+                        map.assign (idxf, key, tmp_cell);
+
+                        if (! error_state)
+                          {
+                            count++;
+                            retval = octave_value (this);
+                          }
+                        else
+                          gripe_failed_assignment ();
+                      }
+                    else
+                      {
+                        const octave_map& cmap = const_cast<const octave_map &> (map);
+                        // cast map to const reference to avoid forced key insertion.
+                        if (idxf.all_scalars ()
+                            || cmap.contents (key).index (idxf, true).numel () == 1)
+                          {
+                            map.assign (idxf, key, Cell (t_rhs.storable_value ()));
+                            if (! error_state)
+                              {
+                                count++;
+                                retval = octave_value (this);
+                              }
+                            else
+                              gripe_failed_assignment ();
+                          }
+                        else if (! error_state)
+                          gripe_nonbraced_cs_list_assignment ();
+                      }
+                  }
+                else
+                  gripe_failed_assignment ();
+              }
+            else
+              {
+                if (t_rhs.is_map () || t_rhs.is_object ())
+                  {
+                    octave_map rhs_map = t_rhs.map_value ();
+
+                    if (! error_state)
+                      {
+                        map.assign (idx.front (), rhs_map);
+
+                        if (! error_state)
+                          {
+                            count++;
+                            retval = octave_value (this);
+                          }
+                        else
+                          gripe_failed_assignment ();
+                      }
+                    else
+                      error ("invalid structure assignment");
+                  }
+                else
+                  {
+                    if (t_rhs.is_null_value ())
+                      {
+                        map.delete_elements (idx.front ());
+
+                        if (! error_state)
+                          {
+                            count++;
+                            retval = octave_value (this);
+                          }
+                        else
+                          gripe_failed_assignment ();
+                      }
+                    else
+                      error ("invalid structure assignment");
+                  }
+              }
+          }
+          break;
+
+        case '.':
+          {
+            octave_value_list key_idx = idx.front ();
+
+            assert (key_idx.length () == 1);
+
+            std::string key = key_idx(0).string_value ();
+
+            if (t_rhs.is_cs_list ())
+              {
+                Cell tmp_cell = Cell (t_rhs.list_value ());
+
+                // The shape of the RHS is irrelevant, we just want
+                // the number of elements to agree and to preserve the
+                // shape of the left hand side of the assignment.
+
+                if (numel () == tmp_cell.numel ())
+                  tmp_cell = tmp_cell.reshape (dims ());
+
+                map.setfield (key, tmp_cell);
+              }
+            else
+              {
+                Cell tmp_cell(1, 1);
+                tmp_cell(0) = t_rhs.storable_value ();
+                map.setfield (key, tmp_cell);
+              }
+
+            if (! error_state)
+              {
+                count++;
+                retval = octave_value (this);
+              }
+            else
+              gripe_failed_assignment ();
+          }
+          break;
+
+        case '{':
+          gripe_invalid_index_type (type_name (), type[0]);
+          break;
+
+        default:
+          panic_impossible ();
+        }
+    }
+  else
+    gripe_failed_assignment ();
+
+  retval.maybe_mutate ();
+
+  return retval;
+}
+
+octave_value
+octave_struct::do_index_op (const octave_value_list& idx, bool resize_ok)
+{
+  // octave_map handles indexing itself.
+  return map.index (idx, resize_ok);
+}
+
+size_t
+octave_struct::byte_size (void) const
+{
+  // Neglect the size of the fieldnames.
+
+  size_t retval = 0;
+
+  for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
+    {
+      std::string key = map.key (p);
+
+      octave_value val = octave_value (map.contents (p));
+
+      retval += val.byte_size ();
+    }
+
+  return retval;
+}
+
+void
+octave_struct::print (std::ostream& os, bool) const
+{
+  print_raw (os);
+}
+
+void
+octave_struct::print_raw (std::ostream& os, bool) const
+{
+  unwind_protect frame;
+
+  frame.protect_var (Vstruct_levels_to_print);
+
+  if (Vstruct_levels_to_print >= 0)
+    {
+      bool max_depth_reached = Vstruct_levels_to_print-- == 0;
+
+      bool print_fieldnames_only
+        = (max_depth_reached || ! Vprint_struct_array_contents);
+
+      increment_indent_level ();
+
+      newline (os);
+      indent (os);
+      dim_vector dv = dims ();
+      os << dv.str () << " struct array containing the fields:";
+      newline (os);
+
+      increment_indent_level ();
+
+      string_vector key_list = map.fieldnames ();
+
+      for (octave_idx_type i = 0; i < key_list.length (); i++)
+        {
+          std::string key = key_list[i];
+
+          Cell val = map.contents (key);
+
+          newline (os);
+
+          if (print_fieldnames_only)
+            {
+              indent (os);
+              os << key;
+            }
+          else
+            {
+              octave_value tmp (val);
+              tmp.print_with_name (os, key);
+            }
+        }
+
+      if (print_fieldnames_only)
+        newline (os);
+
+      decrement_indent_level ();
+      decrement_indent_level ();
+    }
+  else
+    {
+      indent (os);
+      os << "<structure>";
+      newline (os);
+    }
+}
+
+bool
+octave_struct::print_name_tag (std::ostream& os, const std::string& name) const
+{
+  bool retval = false;
+
+  indent (os);
+
+  if (Vstruct_levels_to_print < 0)
+    os << name << " = ";
+  else
+    {
+      os << name << " =";
+      newline (os);
+      retval = true;
+    }
+
+  return retval;
+}
+
+static bool
+scalar (const dim_vector& dims)
+{
+  return dims.length () == 2 && dims (0) == 1 && dims (1) == 1;
+}
+
+
+bool
+octave_struct::save_ascii (std::ostream& os)
+{
+  octave_map m = map_value ();
+
+  octave_idx_type nf = m.nfields ();
+
+  const dim_vector dv = dims ();
+
+  os << "# ndims: " << dv.length () << "\n";
+
+  for (int i = 0; i < dv.length (); i++)
+    os << " " << dv (i);
+  os << "\n";
+
+  os << "# length: " << nf << "\n";
+
+  // Iterating over the list of keys will preserve the order of the
+  // fields.
+  string_vector keys = m.fieldnames ();
+
+  for (octave_idx_type i = 0; i < nf; i++)
+    {
+      std::string key = keys(i);
+
+      octave_value val = map.contents (key);
+
+      bool b = save_ascii_data (os, val, key, false, 0);
+
+      if (! b)
+        return os;
+    }
+
+  return true;
+}
+
+bool
+octave_struct::load_ascii (std::istream& is)
+{
+  octave_idx_type len = 0;
+  dim_vector dv (1, 1);
+  bool success = true;
+
+  // KLUGE: earlier Octave versions did not save extra dimensions with struct,
+  // and as a result did not preserve dimensions for empty structs.
+  // The default dimensions were 1x1, which we want to preserve.
+  string_vector keywords(2);
+
+  keywords[0] = "ndims";
+  keywords[1] = "length";
+
+  std::string kw;
+
+  if (extract_keyword (is, keywords, kw, len, true))
+    {
+      if (kw == keywords[0])
+        {
+          int mdims = std::max (static_cast<int> (len), 2);
+          dv.resize (mdims);
+          for (int i = 0; i < mdims; i++)
+            is >> dv(i);
+
+          success = extract_keyword (is, keywords[1], len);
+        }
+    }
+  else
+    success = false;
+
+  if (success && len >= 0)
+    {
+      if (len > 0)
+        {
+          octave_map m (dv);
+
+          for (octave_idx_type j = 0; j < len; j++)
+            {
+              octave_value t2;
+              bool dummy;
+
+              // recurse to read cell elements
+              std::string nm
+                = read_ascii_data (is, std::string (), dummy, t2, j);
+
+              if (!is)
+                break;
+
+              Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+
+              if (error_state)
+                {
+                  error ("load: internal error loading struct elements");
+                  return false;
+                }
+
+              m.setfield (nm, tcell);
+            }
+
+          if (is)
+            map = m;
+          else
+            {
+              error ("load: failed to load structure");
+              success = false;
+            }
+        }
+      else if (len == 0 )
+        map = octave_map (dv);
+      else
+        panic_impossible ();
+    }
+  else {
+    error ("load: failed to extract number of elements in structure");
+    success = false;
+  }
+
+  return success;
+}
+
+bool
+octave_struct::save_binary (std::ostream& os, bool& save_as_floats)
+{
+  octave_map m = map_value ();
+
+  octave_idx_type nf = m.nfields ();
+
+  dim_vector d = dims ();
+  if (d.length () < 1)
+    return false;
+
+  // Use negative value for ndims
+  int32_t di = - d.length ();
+  os.write (reinterpret_cast<char *> (&di), 4);
+  for (int i = 0; i < d.length (); i++)
+    {
+      di = d(i);
+      os.write (reinterpret_cast<char *> (&di), 4);
+    }
+
+  int32_t len = nf;
+  os.write (reinterpret_cast<char *> (&len), 4);
+
+  // Iterating over the list of keys will preserve the order of the
+  // fields.
+  string_vector keys = m.fieldnames ();
+
+  for (octave_idx_type i = 0; i < nf; i++)
+    {
+      std::string key = keys(i);
+
+      octave_value val = map.contents (key);
+
+      bool b = save_binary_data (os, val, key, "", 0, save_as_floats);
+
+      if (! b)
+        return os;
+    }
+
+  return true;
+}
+
+bool
+octave_struct::load_binary (std::istream& is, bool swap,
+                            oct_mach_info::float_format fmt)
+{
+  bool success = true;
+  int32_t len;
+  if (! is.read (reinterpret_cast<char *> (&len), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&len);
+
+  dim_vector dv (1, 1);
+
+  if (len < 0)
+    {
+      // We have explicit dimensions.
+      int mdims = -len;
+
+      int32_t di;
+      dv.resize (mdims);
+
+      for (int i = 0; i < mdims; i++)
+        {
+          if (! is.read (reinterpret_cast<char *> (&di), 4))
+            return false;
+          if (swap)
+            swap_bytes<4> (&di);
+          dv(i) = di;
+        }
+
+      if (! is.read (reinterpret_cast<char *> (&len), 4))
+        return false;
+      if (swap)
+        swap_bytes<4> (&len);
+    }
+
+  if (len > 0)
+    {
+      octave_map m (dv);
+
+      for (octave_idx_type j = 0; j < len; j++)
+        {
+          octave_value t2;
+          bool dummy;
+          std::string doc;
+
+          // recurse to read cell elements
+          std::string nm = read_binary_data (is, swap, fmt, std::string (),
+                                             dummy, t2, doc);
+
+          if (!is)
+            break;
+
+          Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+
+          if (error_state)
+            {
+              error ("load: internal error loading struct elements");
+              return false;
+            }
+
+          m.setfield (nm, tcell);
+        }
+
+      if (is)
+        map = m;
+      else
+        {
+          error ("load: failed to load structure");
+          success = false;
+        }
+    }
+  else if (len == 0)
+    map = octave_map (dv);
+  else
+    success = false;
+
+  return success;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_struct::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
+{
+  hid_t data_hid = -1;
+
+#if HAVE_HDF5_18
+  data_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Gcreate (loc_id, name, 0);
+#endif
+  if (data_hid < 0) return false;
+
+  // recursively add each element of the structure to this group
+  octave_map m = map_value ();
+
+  octave_idx_type nf = m.nfields ();
+
+  // Iterating over the list of keys will preserve the order of the
+  // fields.
+  string_vector keys = m.fieldnames ();
+
+  for (octave_idx_type i = 0; i < nf; i++)
+    {
+      std::string key = keys(i);
+
+      octave_value val = map.contents (key);
+
+      bool retval2 = add_hdf5_data (data_hid, val, key, "", false,
+                                    save_as_floats);
+
+      if (! retval2)
+        break;
+    }
+
+  H5Gclose (data_hid);
+
+  return true;
+}
+
+bool
+octave_struct::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  hdf5_callback_data dsub;
+
+  herr_t retval2 = 0;
+  octave_map m (dim_vector (1, 1));
+  int current_item = 0;
+  hsize_t num_obj = 0;
+#if HAVE_HDF5_18
+  hid_t group_id = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t group_id = H5Gopen (loc_id, name);
+#endif
+  H5Gget_num_objs (group_id, &num_obj);
+  H5Gclose (group_id);
+
+  // FIXME -- fields appear to be sorted alphabetically on loading.
+  // Why is that happening?
+
+  while (current_item < static_cast<int> (num_obj)
+         && (retval2 = H5Giterate (loc_id, name, &current_item,
+                                   hdf5_read_next_data, &dsub)) > 0)
+    {
+      octave_value t2 = dsub.tc;
+
+      Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+
+      if (error_state)
+        {
+          error ("load: internal error loading struct elements");
+          return false;
+        }
+
+      m.setfield (dsub.name, tcell);
+
+    }
+
+  if (retval2 >= 0)
+    {
+      map = m;
+      retval = true;
+    }
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_struct::as_mxArray (void) const
+{
+  int nf = nfields ();
+  string_vector kv = map_keys ();
+
+  OCTAVE_LOCAL_BUFFER (const char *, f, nf);
+
+  for (int i = 0; i < nf; i++)
+    f[i] = kv[i].c_str ();
+
+  mxArray *retval = new mxArray (dims (), nf, f);
+
+  mxArray **elts = static_cast<mxArray **> (retval->get_data ());
+
+  mwSize nel = numel ();
+
+  mwSize ntot = nf * nel;
+
+  for (int i = 0; i < nf; i++)
+    {
+      Cell c = map.contents (kv[i]);
+
+      const octave_value *p = c.data ();
+
+      mwIndex k = 0;
+      for (mwIndex j = i; j < ntot; j += nf)
+        elts[j] = new mxArray (p[k++]);
+    }
+
+  return retval;
+}
+
+octave_value
+octave_struct::fast_elem_extract (octave_idx_type n) const
+{
+  if (n < map.numel ())
+    return map.checkelem (n);
+  else
+    return octave_value ();
+}
+
+bool
+octave_struct::fast_elem_insert (octave_idx_type n,
+                                 const octave_value& x)
+{
+  bool retval = false;
+
+  if (n < map.numel ())
+    {
+      // To avoid copying the scalar struct, it just stores a pointer to
+      // itself.
+      const octave_scalar_map *sm_ptr;
+      void *here = reinterpret_cast<void *>(&sm_ptr);
+      return (x.get_rep ().fast_elem_insert_self (here, btyp_struct)
+              && map.fast_elem_insert (n, *sm_ptr));
+    }
+
+  return retval;
+}
+DEFINE_OCTAVE_ALLOCATOR(octave_scalar_struct);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_scalar_struct, "scalar struct", "struct");
+
+octave_value
+octave_scalar_struct::dotref (const octave_value_list& idx, bool auto_add)
+{
+  assert (idx.length () == 1);
+
+  std::string nm = idx(0).string_value ();
+
+  octave_value retval = map.getfield (nm);
+
+  if (! auto_add && retval.is_undefined ())
+    error ("structure has no member `%s'", nm.c_str ());
+
+  return retval;
+}
+
+octave_value
+octave_scalar_struct::subsref (const std::string& type,
+                               const std::list<octave_value_list>& idx)
+{
+  octave_value retval;
+
+  if (type[0] == '.')
+    {
+      int skip = 1;
+
+      retval = dotref (idx.front ());
+
+      if (idx.size () > 1)
+        retval = retval.next_subsref (type, idx, skip);
+    }
+  else
+    retval = to_array ().subsref (type, idx);
+
+  return retval;
+}
+
+octave_value_list
+octave_scalar_struct::subsref (const std::string& type,
+                               const std::list<octave_value_list>& idx,
+                               int nargout)
+{
+  octave_value_list retval;
+
+  if (type[0] == '.')
+    {
+      int skip = 1;
+
+      retval(0) = dotref (idx.front ());
+
+      if (idx.size () > 1)
+        retval = retval(0).next_subsref (nargout, type, idx, skip);
+    }
+  else
+    retval = to_array ().subsref (type, idx, nargout);
+
+  return retval;
+}
+
+octave_value
+octave_scalar_struct::subsref (const std::string& type,
+                               const std::list<octave_value_list>& idx,
+                               bool auto_add)
+{
+  octave_value retval;
+
+  if (type[0] == '.')
+    {
+      int skip = 1;
+
+      retval = dotref (idx.front (), auto_add);
+
+      if (idx.size () > 1)
+        retval = retval.next_subsref (auto_add, type, idx, skip);
+    }
+  else
+    retval = to_array ().subsref (type, idx, auto_add);
+
+  return retval;
+}
+
+/*
+%!test
+%! x(1).a.a = 1;
+%! x(2).a.a = 2;
+%! assert (size (x), [1, 2]);
+%! assert (x(1).a.a, 1);
+%! assert (x(2).a.a, 2);
+*/
+
+octave_value
+octave_scalar_struct::numeric_conv (const octave_value& val,
+                                    const std::string& type)
+{
+  octave_value retval;
+
+  if (type.length () > 0 && type[0] == '.' && ! val.is_map ())
+    retval = octave_map ();
+  else
+    retval = val;
+
+  return retval;
+}
+
+octave_value
+octave_scalar_struct::subsasgn (const std::string& type,
+                                const std::list<octave_value_list>& idx,
+                                const octave_value& rhs)
+{
+  octave_value retval;
+
+  if (idx.front ().empty ())
+    {
+      error ("missing index in indexed assignment");
+      return retval;
+    }
+
+  if (type[0] == '.')
+    {
+      int n = type.length ();
+
+      octave_value t_rhs = rhs;
+
+      octave_value_list key_idx = idx.front ();
+
+      assert (key_idx.length () == 1);
+
+      std::string key = key_idx(0).string_value ();
+
+      if (n > 1)
+        {
+          std::list<octave_value_list> next_idx (idx);
+
+          next_idx.erase (next_idx.begin ());
+
+          std::string next_type = type.substr (1);
+
+          octave_value tmp;
+          octave_map::iterator pkey = map.seek (key);
+          if (pkey != map.end ())
+            {
+              map.contents (pkey).make_unique ();
+              tmp = map.contents (pkey);
+            }
+
+          if (! error_state)
+            {
+              bool orig_undefined = tmp.is_undefined ();
+
+              if (orig_undefined || tmp.is_zero_by_zero ())
+                {
+                  tmp = octave_value::empty_conv (next_type, rhs);
+                  tmp.make_unique (); // probably a no-op.
+                }
+              else
+                // optimization: ignore the copy still stored inside our map.
+                tmp.make_unique (1);
+
+              if (! error_state)
+                t_rhs = (orig_undefined
+                         ? tmp.undef_subsasgn (next_type, next_idx, rhs)
+                         : tmp.subsasgn (next_type, next_idx, rhs));
+            }
+        }
+
+      if (! error_state)
+        map.setfield (key, t_rhs.storable_value ());
+      else
+        gripe_failed_assignment ();
+
+      count++;
+      retval = this;
+    }
+  else
+    {
+      // Forward this case to octave_struct.
+      octave_value tmp (new octave_struct (octave_map (map)));
+      retval = tmp.subsasgn (type, idx, rhs);
+    }
+
+  return retval;
+}
+
+octave_value
+octave_scalar_struct::do_index_op (const octave_value_list& idx, bool resize_ok)
+{
+  // octave_map handles indexing itself.
+  return octave_map (map).index (idx, resize_ok);
+}
+
+size_t
+octave_scalar_struct::byte_size (void) const
+{
+  // Neglect the size of the fieldnames.
+
+  size_t retval = 0;
+
+  for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
+    {
+      std::string key = map.key (p);
+
+      octave_value val = octave_value (map.contents (p));
+
+      retval += val.byte_size ();
+    }
+
+  return retval;
+}
+
+void
+octave_scalar_struct::print (std::ostream& os, bool) const
+{
+  print_raw (os);
+}
+
+void
+octave_scalar_struct::print_raw (std::ostream& os, bool) const
+{
+  unwind_protect frame;
+
+  frame.protect_var (Vstruct_levels_to_print);
+
+  if (Vstruct_levels_to_print >= 0)
+    {
+      bool max_depth_reached = Vstruct_levels_to_print-- == 0;
+
+      bool print_fieldnames_only = max_depth_reached;
+
+      increment_indent_level ();
+
+      if (! Vcompact_format)
+        newline (os);
+
+      indent (os);
+      os << "scalar structure containing the fields:";
+      newline (os);
+      if (! Vcompact_format)
+        newline (os);
+
+      increment_indent_level ();
+
+      string_vector key_list = map.fieldnames ();
+
+      for (octave_idx_type i = 0; i < key_list.length (); i++)
+        {
+          std::string key = key_list[i];
+
+          octave_value val = map.contents (key);
+
+          if (print_fieldnames_only)
+            {
+              indent (os);
+              os << key;
+              dim_vector dv = val.dims ();
+              os << ": " << dv.str () << " " << val.type_name ();
+              newline (os);
+            }
+          else
+            val.print_with_name (os, key);
+        }
+
+      decrement_indent_level ();
+      decrement_indent_level ();
+    }
+  else
+    {
+      indent (os);
+      os << "<structure>";
+      newline (os);
+    }
+}
+
+bool
+octave_scalar_struct::print_name_tag (std::ostream& os, const std::string& name) const
+{
+  bool retval = false;
+
+  indent (os);
+
+  if (Vstruct_levels_to_print < 0)
+    os << name << " = ";
+  else
+    {
+      os << name << " =";
+      newline (os);
+      retval = true;
+    }
+
+  return retval;
+}
+
+bool
+octave_scalar_struct::save_ascii (std::ostream& os)
+{
+  octave_map m = map_value ();
+
+  octave_idx_type nf = m.nfields ();
+
+  const dim_vector dv = dims ();
+
+  os << "# ndims: " << dv.length () << "\n";
+
+  for (int i = 0; i < dv.length (); i++)
+    os << " " << dv (i);
+  os << "\n";
+
+  os << "# length: " << nf << "\n";
+
+  // Iterating over the list of keys will preserve the order of the
+  // fields.
+  string_vector keys = m.fieldnames ();
+
+  for (octave_idx_type i = 0; i < nf; i++)
+    {
+      std::string key = keys(i);
+
+      octave_value val = map.contents (key);
+
+      bool b = save_ascii_data (os, val, key, false, 0);
+
+      if (! b)
+        return os;
+    }
+
+  return true;
+}
+
+bool
+octave_scalar_struct::load_ascii (std::istream& is)
+{
+  bool success = true;
+  octave_idx_type len = 0;
+
+  if (extract_keyword (is, "length", len) && len >= 0)
+    {
+      if (len > 0)
+        {
+          octave_scalar_map m;
+
+          for (octave_idx_type j = 0; j < len; j++)
+            {
+              octave_value t2;
+              bool dummy;
+
+              // recurse to read cell elements
+              std::string nm
+                = read_ascii_data (is, std::string (), dummy, t2, j);
+
+              if (!is)
+                break;
+
+              if (error_state)
+                {
+                  error ("load: internal error loading struct elements");
+                  return false;
+                }
+
+              m.setfield (nm, t2);
+            }
+
+          if (is)
+            map = m;
+          else
+            {
+              error ("load: failed to load structure");
+              success = false;
+            }
+        }
+      else if (len == 0)
+        map = octave_scalar_map ();
+      else
+        panic_impossible ();
+    }
+  else {
+    error ("load: failed to extract number of elements in structure");
+    success = false;
+  }
+
+  return success;
+}
+
+bool
+octave_scalar_struct::save_binary (std::ostream& os, bool& save_as_floats)
+{
+  octave_map m = map_value ();
+
+  octave_idx_type nf = m.nfields ();
+
+  int32_t len = nf;
+  os.write (reinterpret_cast<char *> (&len), 4);
+
+  // Iterating over the list of keys will preserve the order of the
+  // fields.
+  string_vector keys = m.fieldnames ();
+
+  for (octave_idx_type i = 0; i < nf; i++)
+    {
+      std::string key = keys(i);
+
+      octave_value val = map.contents (key);
+
+      bool b = save_binary_data (os, val, key, "", 0, save_as_floats);
+
+      if (! b)
+        return os;
+    }
+
+  return true;
+}
+
+bool
+octave_scalar_struct::load_binary (std::istream& is, bool swap,
+                                   oct_mach_info::float_format fmt)
+{
+  bool success = true;
+  int32_t len;
+  if (! is.read (reinterpret_cast<char *> (&len), 4))
+    return false;
+  if (swap)
+    swap_bytes<4> (&len);
+
+  dim_vector dv (1, 1);
+
+  if (len > 0)
+    {
+      octave_scalar_map m;
+
+      for (octave_idx_type j = 0; j < len; j++)
+        {
+          octave_value t2;
+          bool dummy;
+          std::string doc;
+
+          // recurse to read cell elements
+          std::string nm = read_binary_data (is, swap, fmt, std::string (),
+                                             dummy, t2, doc);
+
+          if (!is)
+            break;
+
+          if (error_state)
+            {
+              error ("load: internal error loading struct elements");
+              return false;
+            }
+
+          m.setfield (nm, t2);
+        }
+
+      if (is)
+        map = m;
+      else
+        {
+          error ("load: failed to load structure");
+          success = false;
+        }
+    }
+  else if (len == 0)
+    map = octave_scalar_map ();
+  else
+    success = false;
+
+  return success;
+}
+
+#if defined (HAVE_HDF5)
+
+bool
+octave_scalar_struct::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
+{
+  hid_t data_hid = -1;
+
+#if HAVE_HDF5_18
+  data_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+  data_hid = H5Gcreate (loc_id, name, 0);
+#endif
+  if (data_hid < 0) return false;
+
+  // recursively add each element of the structure to this group
+  octave_scalar_map m = scalar_map_value ();
+
+  octave_idx_type nf = m.nfields ();
+
+  // Iterating over the list of keys will preserve the order of the
+  // fields.
+  string_vector keys = m.fieldnames ();
+
+  for (octave_idx_type i = 0; i < nf; i++)
+    {
+      std::string key = keys(i);
+
+      octave_value val = map.contents (key);
+
+      bool retval2 = add_hdf5_data (data_hid, val, key, "", false,
+                                    save_as_floats);
+
+      if (! retval2)
+        break;
+    }
+
+  H5Gclose (data_hid);
+
+  return true;
+}
+
+bool
+octave_scalar_struct::load_hdf5 (hid_t loc_id, const char *name)
+{
+  bool retval = false;
+
+  hdf5_callback_data dsub;
+
+  herr_t retval2 = 0;
+  octave_scalar_map m;
+  int current_item = 0;
+  hsize_t num_obj = 0;
+#if HAVE_HDF5_18
+  hid_t group_id = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
+  hid_t group_id = H5Gopen (loc_id, name);
+#endif
+  H5Gget_num_objs (group_id, &num_obj);
+  H5Gclose (group_id);
+
+  // FIXME -- fields appear to be sorted alphabetically on loading.
+  // Why is that happening?
+
+  while (current_item < static_cast<int> (num_obj)
+         && (retval2 = H5Giterate (loc_id, name, &current_item,
+                                   hdf5_read_next_data, &dsub)) > 0)
+    {
+      octave_value t2 = dsub.tc;
+
+      if (error_state)
+        {
+          error ("load: internal error loading struct elements");
+          return false;
+        }
+
+      m.setfield (dsub.name, t2);
+
+    }
+
+  if (retval2 >= 0)
+    {
+      map = m;
+      retval = true;
+    }
+
+  return retval;
+}
+
+#endif
+
+mxArray *
+octave_scalar_struct::as_mxArray (void) const
+{
+  int nf = nfields ();
+  string_vector kv = map_keys ();
+
+  OCTAVE_LOCAL_BUFFER (const char *, f, nf);
+
+  for (int i = 0; i < nf; i++)
+    f[i] = kv[i].c_str ();
+
+  mxArray *retval = new mxArray (dims (), nf, f);
+
+  mxArray **elts = static_cast<mxArray **> (retval->get_data ());
+
+  mwSize nel = numel ();
+
+  mwSize ntot = nf * nel;
+
+  for (int i = 0; i < nf; i++)
+    {
+      Cell c = map.contents (kv[i]);
+
+      const octave_value *p = c.data ();
+
+      mwIndex k = 0;
+      for (mwIndex j = i; j < ntot; j += nf)
+        elts[j] = new mxArray (p[k++]);
+    }
+
+  return retval;
+}
+
+
+octave_value
+octave_scalar_struct::to_array (void)
+{
+  return new octave_struct (octave_map (map));
+}
+
+bool
+octave_scalar_struct::fast_elem_insert_self (void *where, builtin_type_t btyp) const
+{
+
+  if (btyp == btyp_struct)
+    {
+      *(reinterpret_cast<const octave_scalar_map **>(where)) = &map;
+      return true;
+    }
+  else
+    return false;
+}
+
+DEFUN (struct, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} struct (\"field\", @var{value}, \"field\", @var{value}, @dots{})\n\
+\n\
+Create a structure and initialize its value.\n\
+\n\
+If the values are cell arrays, create a structure array and initialize\n\
+its values.  The dimensions of each cell array of values must match.\n\
+Singleton cells and non-cell values are repeated so that they fill\n\
+the entire array.  If the cells are empty, create an empty structure\n\
+array with the specified field names.\n\
+\n\
+If the argument is an object, return the underlying struct.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  // struct ([]) returns an empty struct.
+
+  // struct (empty_matrix) returns an empty struct with the same
+  // dimensions as the empty matrix.
+
+  // Note that struct () creates a 1x1 struct with no fields for
+  // compatibility with Matlab.
+
+  if (nargin == 1 && args(0).is_map ())
+    return args(0);
+
+  if (nargin == 1 && args(0).is_object ())
+    {
+      retval = args(0).map_value ();
+
+      return retval;
+    }
+
+  if ((nargin == 1 || nargin == 2)
+      && args(0).is_empty () && args(0).is_real_matrix ())
+    {
+      Cell fields;
+
+      if (nargin == 2)
+        {
+          if (args(1).is_cellstr ())
+            retval = octave_map (args(0).dims (), args(1).cellstr_value ());
+          else
+            error ("struct: expecting cell array of field names as second argument");
+        }
+      else
+        retval = octave_map (args(0).dims ());
+
+      return retval;
+    }
+
+  // Check for "field", VALUE pairs.
+
+  for (int i = 0; i < nargin; i += 2)
+    {
+      if (! args(i).is_string () || i + 1 >= nargin)
+        {
+          error ("struct: expecting alternating \"field\", VALUE pairs");
+          return retval;
+        }
+    }
+
+  // Check that the dimensions of the values correspond.
+
+  dim_vector dims (1, 1);
+
+  int first_dimensioned_value = 0;
+
+  for (int i = 1; i < nargin; i += 2)
+    {
+      if (args(i).is_cell ())
+        {
+          dim_vector argdims (args(i).dims ());
+
+          if (! scalar (argdims))
+            {
+              if (! first_dimensioned_value)
+                {
+                  dims = argdims;
+                  first_dimensioned_value = i + 1;
+                }
+              else if (dims != argdims)
+                {
+                  error ("struct: dimensions of parameter %d do not match those of parameter %d",
+                         first_dimensioned_value, i+1);
+                  return retval;
+                }
+            }
+        }
+    }
+
+  // Create the return value.
+
+  octave_map map (dims);
+
+  for (int i = 0; i < nargin; i+= 2)
+    {
+      // Get key.
+
+      std::string key (args(i).string_value ());
+
+      if (error_state)
+        return retval;
+
+      if (! valid_identifier (key))
+        {
+          error ("struct: invalid structure field name `%s'", key.c_str ());
+          return retval;
+        }
+
+      // Value may be v, { v }, or { v1, v2, ... }
+      // In the first two cases, we need to create a cell array of
+      // the appropriate dimensions filled with v.  In the last case,
+      // the cell array has already been determined to be of the
+      // correct dimensions.
+
+      if (args(i+1).is_cell ())
+        {
+          const Cell c (args(i+1).cell_value ());
+
+          if (error_state)
+            return retval;
+
+          if (scalar (c.dims ()))
+            map.setfield (key, Cell (dims, c(0)));
+          else
+            map.setfield (key, c);
+        }
+      else
+        map.setfield (key, Cell (dims, args(i+1)));
+
+      if (error_state)
+        return retval;
+    }
+
+  return octave_value (map);
+}
+
+/*
+%!shared x
+%! x(1).a=1;  x(2).a=2;  x(1).b=3;  x(2).b=3;
+%!assert (struct ("a",1, "b",3), x(1))
+%!assert (isempty (x([])))
+%!assert (isempty (struct ("a",{}, "b",{})))
+%!assert (struct ("a",{1,2}, "b",{3,3}), x)
+%!assert (struct ("a",{1,2}, "b",3), x)
+%!assert (struct ("a",{1,2}, "b",{3}), x)
+%!assert (struct ("b",3, "a",{1,2}), x)
+%!assert (struct ("b",{3}, "a",{1,2}), x)
+%!test x = struct ([]);
+%!assert (size (x), [0,0])
+%!assert (isstruct (x))
+%!assert (isempty (fieldnames (x)))
+%!fail ('struct ("a",{1,2},"b",{1,2,3})', 'dimensions of parameter 2 do not match those of parameter 4')
+%!fail ('struct (1,2,3,4)', 'struct: expecting alternating "field", VALUE pairs')
+%!fail ('struct ("1",2,"3")', 'struct: expecting alternating "field", VALUE pairs')
+*/
+
+DEFUN (isstruct, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} isstruct (@var{x})\n\
+Return true if @var{x} is a structure or a structure array.\n\
+@seealso{ismatrix, iscell, isa}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = args(0).is_map ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (fieldnames, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} fieldnames (@var{struct})\n\
+Return a cell array of strings naming the elements of the structure\n\
+@var{struct}.  It is an error to call @code{fieldnames} with an\n\
+argument that is not a structure.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    {
+      octave_value arg = args(0);
+
+      if (arg.is_map () || arg.is_object ())
+        {
+          octave_map m = arg.map_value ();
+
+          string_vector keys = m.fieldnames ();
+
+          if (keys.length () == 0)
+            retval = Cell (0, 1);
+          else
+            retval = Cell (keys);
+        }
+      else
+        gripe_wrong_type_arg ("fieldnames", args(0));
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+## test preservation of fieldname order
+%!test
+%! x(3).d=1;  x(2).a=2; x(1).b=3;  x(2).c=3;
+%! assert (fieldnames (x), {"d"; "a"; "b"; "c"});
+*/
+
+DEFUN (isfield, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} isfield (@var{x}, @var{name})\n\
+Return true if the @var{x} is a structure and it\n\
+includes an element named @var{name}.  If @var{name} is a cell\n\
+array of strings then a logical array of equal dimension is returned.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 2)
+    {
+      retval = false;
+
+      if (args(0).is_map ())
+        {
+          octave_map m = args(0).map_value ();
+
+          // FIXME -- should this work for all types that can do
+          // structure reference operations?
+
+          if (args(1).is_string ())
+            {
+              std::string key = args(1).string_value ();
+
+              retval = m.isfield (key);
+            }
+          else if (args(1).is_cell ())
+            {
+              Cell c = args(1).cell_value ();
+              boolNDArray bm (c.dims ());
+              octave_idx_type n = bm.numel ();
+
+              for (octave_idx_type i = 0; i < n; i++)
+                {
+                  if (c(i).is_string ())
+                    {
+                      std::string key = c(i).string_value ();
+
+                      bm(i) = m.isfield (key);
+                    }
+                  else
+                    bm(i) = false;
+                }
+
+              retval = bm;
+            }
+        }
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (nfields, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} nfields (@var{s})\n\
+Return the number of fields of the structure @var{s}.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1 && args(0).is_map ())
+    {
+      retval = static_cast<double> (args(0).nfields ());
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+## test isfield
+%!test
+%! x(3).d=1;  x(2).a=2;  x(1).b=3;  x(2).c=3;
+%! assert (isfield (x, "b"));
+%!assert (isfield (struct ("a", "1"), "a"))
+%!assert (isfield ({1}, "c"), false)
+%!assert (isfield (struct ("a", "1"), 10), false)
+%!assert (isfield (struct ("a", "b"), "a "), false)
+%!assert (isfield (struct ("a", 1, "b", 2), {"a", "c"}), [true, false])
+*/
+
+DEFUN (cell2struct, args, ,
+       "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} cell2struct (@var{cell}, @var{fields}, @var{dim})\n\
+Convert @var{cell} to a structure.  The number of fields in @var{fields}\n\
+must match the number of elements in @var{cell} along dimension @var{dim},\n\
+that is @code{numel (@var{fields}) == size (@var{cell}, @var{dim})}.\n\
+If @var{dim} is omitted, a value of 1 is assumed.\n\
+\n\
+@example\n\
+@group\n\
+A = cell2struct (@{\"Peter\", \"Hannah\", \"Robert\";\n\
+                   185, 170, 168@},\n\
+                 @{\"Name\",\"Height\"@}, 1);\n\
+A(1)\n\
+   @result{}\n\
+      @{\n\
+        Name   = Peter\n\
+        Height = 185\n\
+      @}\n\
+\n\
+@end group\n\
+@end example\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 2 || nargin == 3)
+    {
+      if (! args(0).is_cell ())
+        {
+          error ("cell2struct: argument CELL must be of type cell");
+          return retval;
+        }
+
+      if (! (args(1).is_cellstr () || args(1).is_char_matrix ()))
+        {
+          error ("cell2struct: FIELDS must be a cell array of strings or a character matrix");
+          return retval;
+        }
+
+      const Cell vals = args(0).cell_value ();
+      const Array<std::string> fields = args(1).cellstr_value ();
+
+      octave_idx_type ext = 0;
+
+      int dim = 0;
+
+      if (nargin == 3)
+        {
+          if (args(2).is_real_scalar ())
+            {
+              dim = nargin == 2 ? 0 : args(2).int_value () - 1;
+
+              if (error_state)
+                return retval;
+            }
+          else
+            {
+              error ("cell2struct: DIM must be a real scalar");
+              return retval;
+            }
+        }
+
+      if (dim < 0)
+        {
+          error ("cell2struct: DIM must be a valid dimension");
+          return retval;
+        }
+
+      ext = vals.ndims () > dim ? vals.dims ()(dim) : 1;
+
+      if (ext != fields.numel ())
+        {
+          error ("cell2struct: number of FIELDS does not match dimension");
+          return retval;
+        }
+
+      int nd = std::max (dim+1, vals.ndims ());
+      // result dimensions.
+      dim_vector rdv = vals.dims ().redim (nd);
+
+      assert (ext == rdv(dim));
+      if (nd == 2)
+        {
+          rdv(0) = rdv(1-dim);
+          rdv(1) = 1;
+        }
+      else
+        {
+          for (int i =  dim + 1; i < nd; i++)
+            rdv(i-1) = rdv(i);
+
+          rdv.resize (nd-1);
+        }
+
+      octave_map map (rdv);
+      Array<idx_vector> ia (dim_vector (nd, 1), idx_vector::colon);
+
+      for (octave_idx_type i = 0; i < ext; i++)
+        {
+          ia(dim) = i;
+          map.setfield (fields(i), vals.index (ia).reshape (rdv));
+        }
+
+      retval = map;
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+## test cell2struct versus struct2cell
+%!test
+%! keys = cellstr (char (floor (rand (100,10)*24+65)))';
+%! vals = mat2cell (rand (100,1), ones (100,1), 1)';
+%! s = struct ([keys; vals]{:});
+%! t = cell2struct (vals, keys, 2);
+%! assert (s, t);
+%! assert (struct2cell (s), vals');
+%! assert (fieldnames (s), keys');
+
+%!assert (cell2struct ({1; 2}, {"a"; "b"}), struct ("a", 1, "b", 2));
+
+%!assert (cell2struct ({}, {"f"}, 3), struct ("f", {}));
+*/
+
+
+// So we can call Fcellstr directly.
+extern octave_value_list Fcellstr (const octave_value_list& args, int);
+
+DEFUN (rmfield, args, ,
+       "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} rmfield (@var{s}, @var{f})\n\
+Return a copy of the structure (array) @var{s} with the field @var{f}\n\
+removed.  If @var{f} is a cell array of strings or a character array, remove\n\
+the named fields.\n\
+@seealso{cellstr, iscellstr, setfield}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 2)
+    {
+      octave_map m = args(0).map_value ();
+
+      octave_value_list fval = Fcellstr (args(1), 1);
+
+      if (! error_state)
+        {
+          Cell fcell = fval(0).cell_value ();
+
+          for (int i = 0; i < fcell.numel (); i++)
+            {
+              std::string key = fcell(i).string_value ();
+
+              if (m.isfield (key))
+                m.rmfield (key);
+              else
+                {
+                  error ("rmfield: structure does not contain field %s",
+                         key.c_str ());
+
+                  break;
+                }
+            }
+
+          if (! error_state)
+            retval = m;
+        }
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+## test rmfield
+%!test
+%! x(3).d=1;  x(2).a=2;  x(1).b=3;  x(2).c=3;  x(6).f="abc123";
+%! y = rmfield (x, {"a", "f"});
+%! assert (fieldnames (y), {"d"; "b"; "c"});
+%! assert (size (y), [1, 6]);
+*/
+
+DEFUN (struct_levels_to_print, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} struct_levels_to_print ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} struct_levels_to_print (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} struct_levels_to_print (@var{new_val}, \"local\")\n\
+Query or set the internal variable that specifies the number of\n\
+structure levels to display.\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE_WITH_LIMITS (struct_levels_to_print,
+                                            -1, INT_MAX);
+}
+
+DEFUN (print_struct_array_contents, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} print_struct_array_contents ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} print_struct_array_contents (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} print_struct_array_contents (@var{new_val}, \"local\")\n\
+Query or set the internal variable that specifies whether to print struct\n\
+array contents.  If true, values of struct array elements are printed.\n\
+This variable does not affect scalar structures.  Their elements\n\
+are always printed.  In both cases, however, printing will be limited to\n\
+the number of levels specified by @var{struct_levels_to_print}.\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (print_struct_array_contents);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-struct.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,289 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_struct_h)
+#define octave_struct_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+
+#include "mx-base.h"
+#include "str-vec.h"
+
+#include "error.h"
+#include "oct-alloc.h"
+#include "oct-map.h"
+#include "ov-base.h"
+#include "ov-typeinfo.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+// Data structures.
+
+class
+octave_struct : public octave_base_value
+{
+public:
+
+  octave_struct (void)
+    : octave_base_value (), map () { }
+
+  octave_struct (const octave_map& m)
+    : octave_base_value (), map (m) { }
+
+  octave_struct (const octave_struct& s)
+    : octave_base_value (), map (s.map) { }
+
+  ~octave_struct (void) { }
+
+  octave_base_value *clone (void) const { return new octave_struct (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_struct (); }
+
+  octave_base_value *try_narrowing_conversion (void);
+
+  Cell dotref (const octave_value_list& idx, bool auto_add = false);
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    {
+      octave_value_list tmp = subsref (type, idx, 1);
+      return tmp.length () > 0 ? tmp(0) : octave_value ();
+    }
+
+  octave_value_list subsref (const std::string&,
+                             const std::list<octave_value_list>&, int);
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx,
+                        bool auto_add);
+
+  static octave_value numeric_conv (const octave_value& val,
+                                    const std::string& type);
+
+  octave_value subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs);
+
+  octave_value squeeze (void) const { return map.squeeze (); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return map.permute (vec, inv); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  dim_vector dims (void) const { return map.dims (); }
+
+  size_t byte_size (void) const;
+
+  // This is the number of elements in each field.  The total number
+  // of elements is numel () * nfields ().
+  octave_idx_type numel (void) const
+  {
+    return map.numel ();
+  }
+
+  octave_idx_type nfields (void) const { return map.nfields (); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return map.reshape (new_dims); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const
+    { octave_map tmap = map; tmap.resize (dv, fill); return tmap; }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_map (void) const { return true; }
+
+  builtin_type_t builtin_type (void) const { return btyp_struct; }
+
+  octave_map map_value (void) const { return map; }
+
+  string_vector map_keys (void) const { return map.fieldnames (); }
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool print_name_tag (std::ostream& os, const std::string& name) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  mxArray *as_mxArray (void) const;
+
+  octave_value
+  fast_elem_extract (octave_idx_type n) const;
+
+  bool
+  fast_elem_insert (octave_idx_type n, const octave_value& x);
+
+protected:
+
+  // The associative array used to manage the structure data.
+  octave_map map;
+
+private:
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+class
+octave_scalar_struct : public octave_base_value
+{
+public:
+
+  octave_scalar_struct (void)
+    : octave_base_value (), map () { }
+
+  octave_scalar_struct (const octave_scalar_map& m)
+    : octave_base_value (), map (m) { }
+
+  octave_scalar_struct (const octave_scalar_struct& s)
+    : octave_base_value (), map (s.map) { }
+
+  ~octave_scalar_struct (void) { }
+
+  octave_base_value *clone (void) const { return new octave_scalar_struct (*this); }
+  octave_base_value *empty_clone (void) const { return new octave_scalar_struct (); }
+
+  octave_value dotref (const octave_value_list& idx, bool auto_add = false);
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx, int);
+
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx,
+                        bool auto_add);
+
+  static octave_value numeric_conv (const octave_value& val,
+                                    const std::string& type);
+
+  octave_value subsasgn (const std::string& type,
+                         const std::list<octave_value_list>& idx,
+                         const octave_value& rhs);
+
+  octave_value squeeze (void) const { return map; }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return octave_map (map).permute (vec, inv); }
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false);
+
+  dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; }
+
+  size_t byte_size (void) const;
+
+  // This is the number of elements in each field.  The total number
+  // of elements is numel () * nfields ().
+  octave_idx_type numel (void) const
+  {
+    return 1;
+  }
+
+  octave_idx_type nfields (void) const { return map.nfields (); }
+
+  octave_value reshape (const dim_vector& new_dims) const
+    { return octave_map (map).reshape (new_dims); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const
+    { octave_map tmap = map; tmap.resize (dv, fill); return tmap; }
+
+  bool is_defined (void) const { return true; }
+
+  bool is_constant (void) const { return true; }
+
+  bool is_map (void) const { return true; }
+
+  builtin_type_t builtin_type (void) const { return btyp_struct; }
+
+  octave_map map_value (void) const { return map; }
+
+  octave_scalar_map scalar_map_value (void) const { return map; }
+
+  string_vector map_keys (void) const { return map.fieldnames (); }
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
+
+  bool print_name_tag (std::ostream& os, const std::string& name) const;
+
+  bool save_ascii (std::ostream& os);
+
+  bool load_ascii (std::istream& is);
+
+  bool save_binary (std::ostream& os, bool& save_as_floats);
+
+  bool load_binary (std::istream& is, bool swap,
+                    oct_mach_info::float_format fmt);
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
+
+  bool load_hdf5 (hid_t loc_id, const char *name);
+#endif
+
+  mxArray *as_mxArray (void) const;
+
+  bool fast_elem_insert_self (void *where, builtin_type_t btyp) const;
+
+protected:
+
+  // The associative array used to manage the structure data.
+  octave_scalar_map map;
+
+private:
+
+  octave_value to_array (void);
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-type-conv.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,109 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_ov_type_conv_h)
+#define octave_ov_type_conv_h 1
+
+static
+octave_value
+octave_type_conv_body (const octave_value &arg, const std::string& name, int t_result)
+{
+  int t_arg = arg.type_id ();
+  octave_value retval;
+
+  if (t_arg == t_result || arg.class_name () == name)
+    {
+      retval = arg;
+    }
+  else
+    {
+      octave_base_value::type_conv_fcn cf1
+        = octave_value_typeinfo::lookup_type_conv_op (t_arg, t_result);
+
+      if (cf1)
+        {
+          octave_base_value *tmp (cf1 (*(arg.internal_rep ())));
+
+          if (tmp)
+            {
+              retval = octave_value (tmp);
+
+              retval.maybe_mutate ();
+            }
+        }
+      else
+        {
+          octave_base_value::type_conv_fcn cf2
+            = arg.numeric_conversion_function ();
+
+          if (cf2)
+            {
+              octave_base_value *tmp (cf2 (*(arg.internal_rep ())));
+
+              if (tmp)
+                {
+                  octave_value xarg (tmp);
+
+                  retval = octave_type_conv_body (xarg, name, t_result);
+                }
+            }
+        }
+    }
+
+  return retval;
+}
+
+
+#define OCTAVE_TYPE_CONV_BODY3(NAME, MATRIX_RESULT_T, SCALAR_RESULT_T) \
+ \
+  octave_value retval; \
+ \
+  int nargin = args.length (); \
+ \
+  if (nargin == 1) \
+    { \
+      const octave_value arg = args(0); \
+ \
+      int t_result = MATRIX_RESULT_T::static_type_id (); \
+ \
+      retval = octave_type_conv_body (arg, #NAME, t_result); \
+      if (retval.is_undefined ()) \
+        { \
+          std::string arg_tname = arg.type_name (); \
+ \
+          std::string result_tname = arg.numel () == 1 \
+            ? SCALAR_RESULT_T::static_type_name () \
+            : MATRIX_RESULT_T::static_type_name (); \
+ \
+          gripe_invalid_conversion (arg_tname, result_tname); \
+        } \
+    } \
+  else \
+    print_usage (); \
+ \
+  return retval
+
+#define OCTAVE_TYPE_CONV_BODY(NAME) \
+  OCTAVE_TYPE_CONV_BODY3 (NAME, octave_ ## NAME ## _matrix, \
+                          octave_ ## NAME ## _scalar)
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-typeinfo.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,707 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Array.h"
+#include "singleton-cleanup.h"
+
+#include "defun.h"
+#include "error.h"
+#include "ov-typeinfo.h"
+
+const int
+octave_value_typeinfo::init_tab_sz (16);
+
+octave_value_typeinfo *
+octave_value_typeinfo::instance (0);
+
+bool
+octave_value_typeinfo::instance_ok (void)
+{
+  bool retval = true;
+
+  if (! instance)
+    {
+      instance = new octave_value_typeinfo ();
+
+      if (instance)
+        singleton_cleanup_list::add (cleanup_instance);
+    }
+
+  if (! instance)
+    {
+      ::error ("unable to create value type info object!");
+
+      retval = false;
+    }
+
+  return retval;
+}
+
+int
+octave_value_typeinfo::register_type (const std::string& t_name,
+                                      const std::string& c_name,
+                                      const octave_value& val)
+{
+  return (instance_ok ())
+    ? instance->do_register_type (t_name, c_name, val) : -1;
+}
+
+bool
+octave_value_typeinfo::register_unary_class_op (octave_value::unary_op op,
+                                                octave_value_typeinfo::unary_class_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_unary_class_op (op, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_unary_op (octave_value::unary_op op,
+                                           int t, octave_value_typeinfo::unary_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_unary_op (op, t, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_non_const_unary_op (octave_value::unary_op op,
+                                                    int t,
+                                                    octave_value_typeinfo::non_const_unary_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_non_const_unary_op (op, t, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_binary_class_op (octave_value::binary_op op,
+                                                 octave_value_typeinfo::binary_class_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_binary_class_op (op, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_binary_op (octave_value::binary_op op,
+                                           int t1, int t2,
+                                           octave_value_typeinfo::binary_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_binary_op (op, t1, t2, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_binary_class_op (octave_value::compound_binary_op op,
+                                                 octave_value_typeinfo::binary_class_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_binary_class_op (op, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_binary_op (octave_value::compound_binary_op op,
+                                           int t1, int t2,
+                                           octave_value_typeinfo::binary_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_binary_op (op, t1, t2, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_cat_op (int t1, int t2, octave_value_typeinfo::cat_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_cat_op (t1, t2, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_assign_op (octave_value::assign_op op,
+                                           int t_lhs, int t_rhs,
+                                           octave_value_typeinfo::assign_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_assign_op (op, t_lhs, t_rhs, f) : -1;
+}
+
+bool
+octave_value_typeinfo::register_assignany_op (octave_value::assign_op op,
+                                              int t_lhs, octave_value_typeinfo::assignany_op_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_assignany_op (op, t_lhs, f) : -1;
+}
+
+bool
+octave_value_typeinfo::register_pref_assign_conv (int t_lhs, int t_rhs,
+                                                  int t_result)
+{
+  return (instance_ok ())
+    ? instance->do_register_pref_assign_conv (t_lhs, t_rhs, t_result) : false;
+}
+
+bool
+octave_value_typeinfo::register_type_conv_op (int t, int t_result,
+                                              octave_base_value::type_conv_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_type_conv_op (t, t_result, f) : false;
+}
+
+bool
+octave_value_typeinfo::register_widening_op (int t, int t_result,
+                                             octave_base_value::type_conv_fcn f)
+{
+  return (instance_ok ())
+    ? instance->do_register_widening_op (t, t_result, f) : false;
+}
+
+// FIXME -- we should also store all class names and provide a
+// way to list them (calling class with nargin == 0?).
+
+int
+octave_value_typeinfo::do_register_type (const std::string& t_name,
+                                         const std::string& /* c_name */,
+                                         const octave_value& val)
+{
+  int i = 0;
+
+  for (i = 0; i < num_types; i++)
+    if (t_name == types (i))
+      return i;
+
+  int len = types.length ();
+
+  if (i == len)
+    {
+      len *= 2;
+
+      types.resize (dim_vector (len, 1), std::string ());
+
+      vals.resize (dim_vector (len, 1), octave_value ());
+
+      unary_ops.resize (dim_vector (octave_value::num_unary_ops, len), 0);
+
+      non_const_unary_ops.resize
+        (dim_vector (octave_value::num_unary_ops, len), 0);
+
+      binary_ops.resize
+        (dim_vector (octave_value::num_binary_ops, len, len), 0);
+
+      compound_binary_ops.resize
+        (dim_vector (octave_value::num_compound_binary_ops, len, len), 0);
+
+      cat_ops.resize (dim_vector (len, len), 0);
+
+      assign_ops.resize
+        (dim_vector (octave_value::num_assign_ops, len, len), 0);
+
+      assignany_ops.resize
+        (dim_vector (octave_value::num_assign_ops, len), 0);
+
+      pref_assign_conv.resize (dim_vector (len, len), -1);
+
+      type_conv_ops.resize (dim_vector (len, len), 0);
+
+      widening_ops.resize (dim_vector (len, len), 0);
+    }
+
+  types (i) = t_name;
+
+  vals (i) = val;
+
+  num_types++;
+
+  return i;
+}
+
+bool
+octave_value_typeinfo::do_register_unary_class_op (octave_value::unary_op op,
+                                                   octave_value_typeinfo::unary_class_op_fcn f)
+{
+  if (lookup_unary_class_op (op))
+    {
+      std::string op_name = octave_value::unary_op_as_string (op);
+
+      warning ("duplicate unary operator `%s' for class dispatch",
+               op_name.c_str ());
+    }
+
+  unary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_unary_op (octave_value::unary_op op,
+                                             int t, octave_value_typeinfo::unary_op_fcn f)
+{
+  if (lookup_unary_op (op, t))
+    {
+      std::string op_name = octave_value::unary_op_as_string (op);
+      std::string type_name = types(t);
+
+      warning ("duplicate unary operator `%s' for type `%s'",
+               op_name.c_str (), type_name.c_str ());
+    }
+
+  unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_non_const_unary_op
+  (octave_value::unary_op op, int t, octave_value_typeinfo::non_const_unary_op_fcn f)
+{
+  if (lookup_non_const_unary_op (op, t))
+    {
+      std::string op_name = octave_value::unary_op_as_string (op);
+      std::string type_name = types(t);
+
+      warning ("duplicate unary operator `%s' for type `%s'",
+               op_name.c_str (), type_name.c_str ());
+    }
+
+  non_const_unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_binary_class_op (octave_value::binary_op op,
+                                                    octave_value_typeinfo::binary_class_op_fcn f)
+{
+  if (lookup_binary_class_op (op))
+    {
+      std::string op_name = octave_value::binary_op_as_string (op);
+
+      warning ("duplicate binary operator `%s' for class dispatch",
+               op_name.c_str ());
+    }
+
+  binary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_binary_op (octave_value::binary_op op,
+                                              int t1, int t2,
+                                              octave_value_typeinfo::binary_op_fcn f)
+{
+  if (lookup_binary_op (op, t1, t2))
+    {
+      std::string op_name = octave_value::binary_op_as_string (op);
+      std::string t1_name = types(t1);
+      std::string t2_name = types(t2);
+
+      warning ("duplicate binary operator `%s' for types `%s' and `%s'",
+               op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
+    }
+
+  binary_ops.checkelem (static_cast<int> (op), t1, t2) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_binary_class_op (octave_value::compound_binary_op op,
+                                                    octave_value_typeinfo::binary_class_op_fcn f)
+{
+  if (lookup_binary_class_op (op))
+    {
+      std::string op_name = octave_value::binary_op_fcn_name (op);
+
+      warning ("duplicate compound binary operator `%s' for class dispatch",
+               op_name.c_str ());
+    }
+
+  compound_binary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_binary_op (octave_value::compound_binary_op op,
+                                              int t1, int t2,
+                                              octave_value_typeinfo::binary_op_fcn f)
+{
+  if (lookup_binary_op (op, t1, t2))
+    {
+      std::string op_name = octave_value::binary_op_fcn_name (op);
+      std::string t1_name = types(t1);
+      std::string t2_name = types(t2);
+
+      warning ("duplicate compound binary operator `%s' for types `%s' and `%s'",
+               op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
+    }
+
+  compound_binary_ops.checkelem (static_cast<int> (op), t1, t2) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_cat_op (int t1, int t2, octave_value_typeinfo::cat_op_fcn f)
+{
+  if (lookup_cat_op (t1, t2))
+    {
+      std::string t1_name = types(t1);
+      std::string t2_name = types(t2);
+
+      warning ("duplicate concatenation operator for types `%s' and `%s'",
+               t1_name.c_str (), t1_name.c_str ());
+    }
+
+  cat_ops.checkelem (t1, t2) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_assign_op (octave_value::assign_op op,
+                                              int t_lhs, int t_rhs,
+                                              octave_value_typeinfo::assign_op_fcn f)
+{
+  if (lookup_assign_op (op, t_lhs, t_rhs))
+    {
+      std::string op_name = octave_value::assign_op_as_string (op);
+      std::string t_lhs_name = types(t_lhs);
+      std::string t_rhs_name = types(t_rhs);
+
+      warning ("duplicate assignment operator `%s' for types `%s' and `%s'",
+               op_name.c_str (), t_lhs_name.c_str (), t_rhs_name.c_str ());
+    }
+
+  assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_assignany_op (octave_value::assign_op op,
+                                                 int t_lhs, octave_value_typeinfo::assignany_op_fcn f)
+{
+  if (lookup_assignany_op (op, t_lhs))
+    {
+      std::string op_name = octave_value::assign_op_as_string (op);
+      std::string t_lhs_name = types(t_lhs);
+
+      warning ("duplicate assignment operator `%s' for types `%s'",
+               op_name.c_str (), t_lhs_name.c_str ());
+    }
+
+  assignany_ops.checkelem (static_cast<int> (op), t_lhs) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_pref_assign_conv (int t_lhs, int t_rhs,
+                                                     int t_result)
+{
+  if (lookup_pref_assign_conv (t_lhs, t_rhs) >= 0)
+    {
+      std::string t_lhs_name = types(t_lhs);
+      std::string t_rhs_name = types(t_rhs);
+
+      warning ("overriding assignment conversion for types `%s' and `%s'",
+               t_lhs_name.c_str (), t_rhs_name.c_str ());
+    }
+
+  pref_assign_conv.checkelem (t_lhs, t_rhs) = t_result;
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_type_conv_op
+  (int t, int t_result, octave_base_value::type_conv_fcn f)
+{
+  if (lookup_type_conv_op (t, t_result))
+    {
+      std::string t_name = types(t);
+      std::string t_result_name = types(t_result);
+
+      warning ("overriding type conversion op for `%s' to `%s'",
+               t_name.c_str (), t_result_name.c_str ());
+    }
+
+  type_conv_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+bool
+octave_value_typeinfo::do_register_widening_op
+  (int t, int t_result, octave_base_value::type_conv_fcn f)
+{
+  if (lookup_widening_op (t, t_result))
+    {
+      std::string t_name = types(t);
+      std::string t_result_name = types(t_result);
+
+      warning ("overriding widening op for `%s' to `%s'",
+               t_name.c_str (), t_result_name.c_str ());
+    }
+
+  widening_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f);
+
+  return false;
+}
+
+octave_value
+octave_value_typeinfo::do_lookup_type (const std::string& nm)
+{
+  octave_value retval;
+
+  for (int i = 0; i < num_types; i++)
+    {
+      if (nm == types(i))
+        {
+          retval = vals(i);
+          retval.make_unique ();
+          break;
+        }
+    }
+
+  return retval;
+}
+
+octave_value_typeinfo::unary_class_op_fcn
+octave_value_typeinfo::do_lookup_unary_class_op (octave_value::unary_op op)
+{
+  void *f = unary_class_ops.checkelem (static_cast<int> (op));
+  return reinterpret_cast<octave_value_typeinfo::unary_class_op_fcn> (f);
+}
+
+octave_value_typeinfo::unary_op_fcn
+octave_value_typeinfo::do_lookup_unary_op (octave_value::unary_op op, int t)
+{
+  void *f = unary_ops.checkelem (static_cast<int> (op), t);
+  return reinterpret_cast<octave_value_typeinfo::unary_op_fcn> (f);
+}
+
+octave_value_typeinfo::non_const_unary_op_fcn
+octave_value_typeinfo::do_lookup_non_const_unary_op
+  (octave_value::unary_op op, int t)
+{
+  void *f = non_const_unary_ops.checkelem (static_cast<int> (op), t);
+  return reinterpret_cast<octave_value_typeinfo::non_const_unary_op_fcn> (f);
+}
+
+octave_value_typeinfo::binary_class_op_fcn
+octave_value_typeinfo::do_lookup_binary_class_op (octave_value::binary_op op)
+{
+  void *f = binary_class_ops.checkelem (static_cast<int> (op));
+  return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f);
+}
+
+octave_value_typeinfo::binary_op_fcn
+octave_value_typeinfo::do_lookup_binary_op (octave_value::binary_op op,
+                                            int t1, int t2)
+{
+  void *f = binary_ops.checkelem (static_cast<int> (op), t1, t2);
+  return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f);
+}
+
+octave_value_typeinfo::binary_class_op_fcn
+octave_value_typeinfo::do_lookup_binary_class_op (octave_value::compound_binary_op op)
+{
+  void *f = compound_binary_class_ops.checkelem (static_cast<int> (op));
+  return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f);
+}
+
+octave_value_typeinfo::binary_op_fcn
+octave_value_typeinfo::do_lookup_binary_op (octave_value::compound_binary_op op,
+                                            int t1, int t2)
+{
+  void *f = compound_binary_ops.checkelem (static_cast<int> (op), t1, t2);
+  return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f);
+}
+
+octave_value_typeinfo::cat_op_fcn
+octave_value_typeinfo::do_lookup_cat_op (int t1, int t2)
+{
+  void *f = cat_ops.checkelem (t1, t2);
+  return reinterpret_cast<octave_value_typeinfo::cat_op_fcn> (f);
+}
+
+octave_value_typeinfo::assign_op_fcn
+octave_value_typeinfo::do_lookup_assign_op (octave_value::assign_op op,
+                                            int t_lhs, int t_rhs)
+{
+  void *f = assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs);
+  return reinterpret_cast<octave_value_typeinfo::assign_op_fcn> (f);
+}
+
+octave_value_typeinfo::assignany_op_fcn
+octave_value_typeinfo::do_lookup_assignany_op (octave_value::assign_op op,
+                                               int t_lhs)
+{
+  void *f = assignany_ops.checkelem (static_cast<int> (op), t_lhs);
+  return reinterpret_cast<octave_value_typeinfo::assignany_op_fcn> (f);
+}
+
+int
+octave_value_typeinfo::do_lookup_pref_assign_conv (int t_lhs, int t_rhs)
+{
+  return pref_assign_conv.checkelem (t_lhs, t_rhs);
+}
+
+octave_base_value::type_conv_fcn
+octave_value_typeinfo::do_lookup_type_conv_op (int t, int t_result)
+{
+  void *f = type_conv_ops.checkelem (t, t_result);
+  return reinterpret_cast<octave_base_value::type_conv_fcn> (f);
+}
+
+octave_base_value::type_conv_fcn
+octave_value_typeinfo::do_lookup_widening_op (int t, int t_result)
+{
+  void *f = widening_ops.checkelem (t, t_result);
+  return reinterpret_cast<octave_base_value::type_conv_fcn> (f);
+}
+
+string_vector
+octave_value_typeinfo::do_installed_type_names (void)
+{
+  string_vector retval (num_types);
+
+  for (int i = 0; i < num_types; i++)
+    retval(i) = types(i);
+
+  return retval;
+}
+
+DEFUN (typeinfo, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} typeinfo ()\n\
+@deftypefnx {Built-in Function} {} typeinfo (@var{expr})\n\
+\n\
+Return the type of the expression @var{expr}, as a string.  If\n\
+@var{expr} is omitted, return an cell array of strings containing all the\n\
+currently installed data types.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 0)
+    retval = Cell (octave_value_typeinfo::installed_type_names ());
+  else if (nargin == 1)
+    retval = args(0).type_name ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!assert (iscellstr (typeinfo ()))
+
+%!assert (typeinfo ({"cell"}), "cell")
+
+%!assert (typeinfo (1), "scalar")
+%!assert (typeinfo (double (1)), "scalar")
+%!assert (typeinfo (i), "complex scalar")
+
+%!assert (typeinfo ([1, 2]), "matrix")
+%!assert (typeinfo (double ([1, 2])), "matrix")
+%!assert (typeinfo (diag ([1, 2])), "diagonal matrix")
+%!assert (typeinfo ([i, 2]), "complex matrix")
+%!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix")
+
+%!assert (typeinfo (1:2), "range")
+
+%!assert (typeinfo (false), "bool")
+%!assert (typeinfo ([true, false]), "bool matrix")
+
+%!assert (typeinfo ("string"), "string")
+%!assert (typeinfo ('string'), "sq_string")
+
+%!assert (typeinfo (int8 (1)), "int8 scalar")
+%!assert (typeinfo (int16 (1)), "int16 scalar")
+%!assert (typeinfo (int32 (1)), "int32 scalar")
+%!assert (typeinfo (int64 (1)), "int64 scalar")
+%!assert (typeinfo (uint8 (1)), "uint8 scalar")
+%!assert (typeinfo (uint16 (1)), "uint16 scalar")
+%!assert (typeinfo (uint32 (1)), "uint32 scalar")
+%!assert (typeinfo (uint64 (1)), "uint64 scalar")
+
+%!assert (typeinfo (int8 ([1,2])), "int8 matrix")
+%!assert (typeinfo (int16 ([1,2])), "int16 matrix")
+%!assert (typeinfo (int32 ([1,2])), "int32 matrix")
+%!assert (typeinfo (int64 ([1,2])), "int64 matrix")
+%!assert (typeinfo (uint8 ([1,2])), "uint8 matrix")
+%!assert (typeinfo (uint16 ([1,2])), "uint16 matrix")
+%!assert (typeinfo (uint32 ([1,2])), "uint32 matrix")
+%!assert (typeinfo (uint64 ([1,2])), "uint64 matrix")
+
+%!assert (typeinfo (sparse ([true, false])), "sparse bool matrix")
+%!assert (typeinfo (logical (sparse (i * eye (10)))), "sparse bool matrix")
+%!assert (typeinfo (sparse ([1,2])), "sparse matrix")
+%!assert (typeinfo (sparse (eye (10))), "sparse matrix")
+%!assert (typeinfo (sparse ([i,2])), "sparse complex matrix")
+%!assert (typeinfo (sparse (i * eye (10))), "sparse complex matrix")
+
+%!test
+%! s(2).a = 1;
+%! assert (typeinfo (s), "struct");
+
+%!test
+%! s.a = 1;
+%! assert (typeinfo (s), "scalar struct");
+
+## FIXME: This doesn't work as a test for comma-separated list
+%!#test
+%! clist = {1, 2, 3};
+%! assert (typeinfo (clist{:}), "cs-list");
+
+%!assert (typeinfo (@sin), "function handle")
+%!assert (typeinfo (@(x) x), "function handle")
+
+%!assert (typeinfo (inline ("x^2")), "inline function")
+
+%!assert (typeinfo (single (1)), "float scalar")
+%!assert (typeinfo (single (i)), "float complex scalar")
+%!assert (typeinfo (single ([1, 2])), "float matrix")
+
+%!assert (typeinfo (single (diag ([1, 2]))), "float diagonal matrix")
+%!assert (typeinfo (diag (single ([1, 2]))), "float diagonal matrix")
+%!assert (typeinfo (single (diag ([i, 2]))), "float complex diagonal matrix")
+%!assert (typeinfo (diag (single ([i, 2]))), "float complex diagonal matrix")
+
+%!assert (typeinfo (eye(3)(:,[1 3 2])), "permutation matrix")
+%!test
+%! [l, u, p] = lu (rand (3));
+%! assert (typeinfo (p), "permutation matrix");
+
+%!assert (typeinfo ([]), "null_matrix")
+%!assert (typeinfo (""), "null_string")
+%!assert (typeinfo (''), "null_sq_string")
+
+%!error typeinfo ("foo", 1)
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-typeinfo.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,327 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_value_typeinfo_h)
+#define octave_value_typeinfo_h 1
+
+#include <string>
+
+#include "Array.h"
+
+#include "ov.h"
+
+class string_vector;
+
+class
+OCTINTERP_API
+octave_value_typeinfo
+{
+public:
+
+  typedef octave_value (*unary_class_op_fcn) (const octave_value&);
+
+  typedef octave_value (*unary_op_fcn) (const octave_base_value&);
+
+  typedef void (*non_const_unary_op_fcn) (octave_base_value&);
+
+  typedef octave_value (*binary_class_op_fcn)
+    (const octave_value&, const octave_value&);
+
+  typedef octave_value (*binary_op_fcn)
+    (const octave_base_value&, const octave_base_value&);
+
+  typedef octave_value (*cat_op_fcn)
+    (octave_base_value&, const octave_base_value&,
+     const Array<octave_idx_type>& ra_idx);
+
+  typedef octave_value (*assign_op_fcn)
+    (octave_base_value&, const octave_value_list&, const octave_base_value&);
+
+  typedef octave_value (*assignany_op_fcn)
+    (octave_base_value&, const octave_value_list&, const octave_value&);
+
+  static bool instance_ok (void);
+
+  static int register_type (const std::string&, const std::string&,
+                            const octave_value&);
+
+  static bool register_unary_class_op (octave_value::unary_op,
+                                       unary_class_op_fcn);
+
+  static bool register_unary_op (octave_value::unary_op, int, unary_op_fcn);
+
+  static bool register_non_const_unary_op (octave_value::unary_op, int,
+                                           non_const_unary_op_fcn);
+
+  static bool register_binary_class_op (octave_value::binary_op,
+                                        binary_class_op_fcn);
+
+  static bool register_binary_op (octave_value::binary_op, int, int,
+                                  binary_op_fcn);
+
+  static bool register_binary_class_op (octave_value::compound_binary_op,
+                                        binary_class_op_fcn);
+
+  static bool register_binary_op (octave_value::compound_binary_op, int, int,
+                                  binary_op_fcn);
+
+  static bool register_cat_op (int, int, cat_op_fcn);
+
+  static bool register_assign_op (octave_value::assign_op, int, int,
+                                  assign_op_fcn);
+
+  static bool register_assignany_op (octave_value::assign_op, int,
+                                     assignany_op_fcn);
+
+  static bool register_pref_assign_conv (int, int, int);
+
+  static bool
+  register_type_conv_op (int, int, octave_base_value::type_conv_fcn);
+
+  static bool
+  register_widening_op (int, int, octave_base_value::type_conv_fcn);
+
+  static octave_value
+  lookup_type (const std::string& nm)
+  {
+    return instance->do_lookup_type (nm);
+  }
+
+  static unary_class_op_fcn
+  lookup_unary_class_op (octave_value::unary_op op)
+  {
+    return instance->do_lookup_unary_class_op (op);
+  }
+
+  static unary_op_fcn
+  lookup_unary_op (octave_value::unary_op op, int t)
+  {
+    return instance->do_lookup_unary_op (op, t);
+  }
+
+  static non_const_unary_op_fcn
+  lookup_non_const_unary_op (octave_value::unary_op op, int t)
+  {
+    return instance->do_lookup_non_const_unary_op (op, t);
+  }
+
+  static binary_class_op_fcn
+  lookup_binary_class_op (octave_value::binary_op op)
+  {
+    return instance->do_lookup_binary_class_op (op);
+  }
+
+  static binary_op_fcn
+  lookup_binary_op (octave_value::binary_op op, int t1, int t2)
+  {
+    return instance->do_lookup_binary_op (op, t1, t2);
+  }
+
+  static binary_class_op_fcn
+  lookup_binary_class_op (octave_value::compound_binary_op op)
+  {
+    return instance->do_lookup_binary_class_op (op);
+  }
+
+  static binary_op_fcn
+  lookup_binary_op (octave_value::compound_binary_op op, int t1, int t2)
+  {
+    return instance->do_lookup_binary_op (op, t1, t2);
+  }
+
+  static cat_op_fcn
+  lookup_cat_op (int t1, int t2)
+  {
+    return instance->do_lookup_cat_op (t1, t2);
+  }
+
+  static assign_op_fcn
+  lookup_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs)
+  {
+    return instance->do_lookup_assign_op (op, t_lhs, t_rhs);
+  }
+
+  static assignany_op_fcn
+  lookup_assignany_op (octave_value::assign_op op, int t_lhs)
+  {
+    return instance->do_lookup_assignany_op (op, t_lhs);
+  }
+
+  static int
+  lookup_pref_assign_conv (int t_lhs, int t_rhs)
+  {
+    return instance->do_lookup_pref_assign_conv (t_lhs, t_rhs);
+  }
+
+  static octave_base_value::type_conv_fcn
+  lookup_type_conv_op (int t, int t_result)
+  {
+    return instance->do_lookup_type_conv_op (t, t_result);
+  }
+
+  static octave_base_value::type_conv_fcn
+  lookup_widening_op (int t, int t_result)
+  {
+    return instance->do_lookup_widening_op (t, t_result);
+  }
+
+  static string_vector installed_type_names (void)
+  {
+    return instance->do_installed_type_names ();
+  }
+
+protected:
+
+  octave_value_typeinfo (void)
+    : num_types (0), types (dim_vector (init_tab_sz, 1), std::string ()),
+      vals (dim_vector (init_tab_sz, 1)),
+      unary_class_ops (dim_vector (octave_value::num_unary_ops, 1), 0),
+      unary_ops (dim_vector (octave_value::num_unary_ops, init_tab_sz), 0),
+      non_const_unary_ops (dim_vector (octave_value::num_unary_ops, init_tab_sz), 0),
+      binary_class_ops (dim_vector (octave_value::num_binary_ops, 1), 0),
+      binary_ops (dim_vector (octave_value::num_binary_ops, init_tab_sz, init_tab_sz), 0),
+      compound_binary_class_ops (dim_vector (octave_value::num_compound_binary_ops, 1), 0),
+      compound_binary_ops (dim_vector (octave_value::num_compound_binary_ops, init_tab_sz, init_tab_sz), 0),
+      cat_ops (dim_vector (init_tab_sz, init_tab_sz), 0),
+      assign_ops (dim_vector (octave_value::num_assign_ops, init_tab_sz, init_tab_sz), 0),
+      assignany_ops (dim_vector (octave_value::num_assign_ops, init_tab_sz), 0),
+      pref_assign_conv (dim_vector (init_tab_sz, init_tab_sz), -1),
+      type_conv_ops (dim_vector (init_tab_sz, init_tab_sz), 0),
+      widening_ops (dim_vector (init_tab_sz, init_tab_sz), 0)  { }
+
+  ~octave_value_typeinfo (void) { }
+
+private:
+
+  static const int init_tab_sz;
+
+  static octave_value_typeinfo *instance;
+
+  static void cleanup_instance (void) { delete instance; instance = 0; }
+
+  int num_types;
+
+  Array<std::string> types;
+
+  Array<octave_value> vals;
+
+  Array<void *> unary_class_ops;
+
+  Array<void *> unary_ops;
+
+  Array<void *> non_const_unary_ops;
+
+  Array<void *> binary_class_ops;
+
+  Array<void *> binary_ops;
+
+  Array<void *> compound_binary_class_ops;
+
+  Array<void *> compound_binary_ops;
+
+  Array<void *> cat_ops;
+
+  Array<void *> assign_ops;
+
+  Array<void *> assignany_ops;
+
+  Array<int> pref_assign_conv;
+
+  Array<void *> type_conv_ops;
+
+  Array<void *> widening_ops;
+
+  int do_register_type (const std::string&, const std::string&,
+                        const octave_value&);
+
+  bool do_register_unary_class_op (octave_value::unary_op, unary_class_op_fcn);
+
+  bool do_register_unary_op (octave_value::unary_op, int, unary_op_fcn);
+
+  bool do_register_non_const_unary_op (octave_value::unary_op, int,
+                                       non_const_unary_op_fcn);
+
+  bool do_register_binary_class_op (octave_value::binary_op,
+                                    binary_class_op_fcn);
+
+  bool do_register_binary_op (octave_value::binary_op, int, int,
+                              binary_op_fcn);
+
+  bool do_register_binary_class_op (octave_value::compound_binary_op,
+                                    binary_class_op_fcn);
+
+  bool do_register_binary_op (octave_value::compound_binary_op, int, int,
+                              binary_op_fcn);
+
+  bool do_register_cat_op (int, int, cat_op_fcn);
+
+  bool do_register_assign_op (octave_value::assign_op, int, int,
+                              assign_op_fcn);
+
+  bool do_register_assignany_op (octave_value::assign_op, int,
+                                 assignany_op_fcn);
+
+  bool do_register_pref_assign_conv (int, int, int);
+
+  bool do_register_type_conv_op (int, int, octave_base_value::type_conv_fcn);
+
+  bool do_register_widening_op (int, int, octave_base_value::type_conv_fcn);
+
+  octave_value do_lookup_type (const std::string& nm);
+
+  unary_class_op_fcn do_lookup_unary_class_op (octave_value::unary_op);
+
+  unary_op_fcn do_lookup_unary_op (octave_value::unary_op, int);
+
+  non_const_unary_op_fcn do_lookup_non_const_unary_op
+    (octave_value::unary_op, int);
+
+  binary_class_op_fcn do_lookup_binary_class_op (octave_value::binary_op);
+
+  binary_op_fcn do_lookup_binary_op (octave_value::binary_op, int, int);
+
+  binary_class_op_fcn do_lookup_binary_class_op (octave_value::compound_binary_op);
+
+  binary_op_fcn do_lookup_binary_op (octave_value::compound_binary_op, int, int);
+
+  cat_op_fcn do_lookup_cat_op (int, int);
+
+  assign_op_fcn do_lookup_assign_op (octave_value::assign_op, int, int);
+
+  assignany_op_fcn do_lookup_assignany_op (octave_value::assign_op, int);
+
+  int do_lookup_pref_assign_conv (int, int);
+
+  octave_base_value::type_conv_fcn do_lookup_type_conv_op (int, int);
+
+  octave_base_value::type_conv_fcn do_lookup_widening_op (int, int);
+
+  string_vector do_installed_type_names (void);
+
+  // No copying!
+
+  octave_value_typeinfo (const octave_value_typeinfo&);
+
+  octave_value_typeinfo& operator = (const octave_value_typeinfo&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-uint16.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ops.h"
+#include "ov-base.h"
+
+#ifdef HAVE_HDF5
+#define HDF5_SAVE_TYPE H5T_NATIVE_UINT16
+#endif
+
+#include "ov-base-int.h"
+#include "ov-base-int.cc"
+#include "ov-uint16.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+template class octave_base_matrix<uint16NDArray>;
+
+template class octave_base_int_matrix<uint16NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_uint16_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint16_matrix,
+                                     "uint16 matrix", "uint16");
+
+template class octave_base_scalar<octave_uint16>;
+
+template class octave_base_int_scalar<octave_uint16>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_uint16_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint16_scalar,
+                                     "uint16 scalar", "uint16");
+
+DEFUN (uint16, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} uint16 (@var{x})\n\
+Convert @var{x} to unsigned 16-bit integer type.\n\
+@end deftypefn")
+{
+  OCTAVE_TYPE_CONV_BODY (uint16);
+}
+
+/*
+%!assert (class (uint16 (1)), "uint16")
+%!assert (uint16 (1.25), uint16 (1))
+%!assert (uint16 (1.5), uint16 (2))
+%!assert (uint16 (-1.5), uint16 (0))
+%!assert (uint16 (2^17), uint16 (2^16-1))
+%!assert (uint16 (-2^17), uint16 (0))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-uint16.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,56 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_uint16_h)
+#define octave_uint16_h 1
+
+#define OCTAVE_INT_T octave_uint16
+
+#define OCTAVE_VALUE_INT_MATRIX_T octave_uint16_matrix
+#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint16_array_value
+
+#define OCTAVE_VALUE_INT_SCALAR_T octave_uint16_scalar
+#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint16_scalar_value
+
+#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint16_type
+
+#define OCTAVE_INT_MX_CLASS mxUINT16_CLASS
+
+#define OCTAVE_INT_BTYP btyp_uint16
+
+#include "ov-intx.h"
+
+#undef OCTAVE_INT_T
+
+#undef OCTAVE_VALUE_INT_MATRIX_T
+#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_VALUE_INT_SCALAR_T
+#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_TYPE_PREDICATE_FUNCTION
+
+#undef OCTAVE_INT_MX_CLASS
+
+#undef OCTAVE_INT_BTYP
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-uint32.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ops.h"
+#include "ov-base.h"
+
+#ifdef HAVE_HDF5
+#define HDF5_SAVE_TYPE H5T_NATIVE_UINT32
+#endif
+
+#include "ov-base-int.h"
+#include "ov-base-int.cc"
+#include "ov-uint32.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+template class octave_base_matrix<uint32NDArray>;
+
+template class octave_base_int_matrix<uint32NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_uint32_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint32_matrix,
+                                     "uint32 matrix", "uint32");
+
+template class octave_base_scalar<octave_uint32>;
+
+template class octave_base_int_scalar<octave_uint32>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_uint32_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint32_scalar,
+                                     "uint32 scalar", "uint32");
+
+DEFUN (uint32, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} uint32 (@var{x})\n\
+Convert @var{x} to unsigned 32-bit integer type.\n\
+@end deftypefn")
+{
+  OCTAVE_TYPE_CONV_BODY (uint32);
+}
+
+/*
+%!assert (class (uint32 (1)), "uint32")
+%!assert (uint32 (1.25), uint32 (1))
+%!assert (uint32 (1.5), uint32 (2))
+%!assert (uint32 (-1.5), uint32 (0))
+%!assert (uint32 (2^33), uint32 (2^32-1))
+%!assert (uint32 (-2^33), uint32 (0))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-uint32.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,56 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_uint32_h)
+#define octave_uint32_h 1
+
+#define OCTAVE_INT_T octave_uint32
+
+#define OCTAVE_VALUE_INT_MATRIX_T octave_uint32_matrix
+#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint32_array_value
+
+#define OCTAVE_VALUE_INT_SCALAR_T octave_uint32_scalar
+#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint32_scalar_value
+
+#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint32_type
+
+#define OCTAVE_INT_MX_CLASS mxUINT32_CLASS
+
+#define OCTAVE_INT_BTYP btyp_uint32
+
+#include "ov-intx.h"
+
+#undef OCTAVE_INT_T
+
+#undef OCTAVE_VALUE_INT_MATRIX_T
+#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_VALUE_INT_SCALAR_T
+#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_TYPE_PREDICATE_FUNCTION
+
+#undef OCTAVE_INT_MX_CLASS
+
+#undef OCTAVE_INT_BTYP
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-uint64.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ops.h"
+#include "ov-base.h"
+
+#ifdef HAVE_HDF5
+#define HDF5_SAVE_TYPE H5T_NATIVE_UINT64
+#endif
+
+#include "ov-base-int.h"
+#include "ov-base-int.cc"
+#include "ov-uint64.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+template class octave_base_matrix<uint64NDArray>;
+
+template class octave_base_int_matrix<uint64NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_uint64_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint64_matrix,
+                                     "uint64 matrix", "uint64");
+
+template class octave_base_scalar<octave_uint64>;
+
+template class octave_base_int_scalar<octave_uint64>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_uint64_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint64_scalar,
+                                     "uint64 scalar", "uint64");
+
+DEFUN (uint64, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} uint64 (@var{x})\n\
+Convert @var{x} to unsigned 64-bit integer type.\n\
+@end deftypefn")
+{
+  OCTAVE_TYPE_CONV_BODY (uint64);
+}
+
+/*
+%!assert (class (uint64 (1)), "uint64")
+%!assert (uint64 (1.25), uint64 (1))
+%!assert (uint64 (1.5), uint64 (2))
+%!assert (uint64 (-1.5), uint64 (0))
+%!assert (uint64 (2^65), uint64 (2^64-1))
+%!assert (uint64 (-2^65), uint64 (0))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-uint64.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,56 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_uint64_h)
+#define octave_uint64_h 1
+
+#define OCTAVE_INT_T octave_uint64
+
+#define OCTAVE_VALUE_INT_MATRIX_T octave_uint64_matrix
+#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint64_array_value
+
+#define OCTAVE_VALUE_INT_SCALAR_T octave_uint64_scalar
+#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint64_scalar_value
+
+#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint64_type
+
+#define OCTAVE_INT_MX_CLASS mxUINT64_CLASS
+
+#define OCTAVE_INT_BTYP btyp_uint64
+
+#include "ov-intx.h"
+
+#undef OCTAVE_INT_T
+
+#undef OCTAVE_VALUE_INT_MATRIX_T
+#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_VALUE_INT_SCALAR_T
+#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_TYPE_PREDICATE_FUNCTION
+
+#undef OCTAVE_INT_MX_CLASS
+
+#undef OCTAVE_INT_BTYP
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-uint8.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,93 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <climits>
+
+#include <iostream>
+
+#include "lo-ieee.h"
+#include "lo-utils.h"
+#include "mx-base.h"
+#include "quit.h"
+
+#include "defun.h"
+#include "gripes.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ops.h"
+#include "ov-base.h"
+
+#ifdef HAVE_HDF5
+#define HDF5_SAVE_TYPE H5T_NATIVE_UINT8
+#endif
+
+#include "ov-base-int.h"
+#include "ov-base-int.cc"
+#include "ov-uint8.h"
+#include "ov-type-conv.h"
+#include "pr-output.h"
+#include "variables.h"
+
+#include "byte-swap.h"
+#include "ls-oct-ascii.h"
+#include "ls-utils.h"
+#include "ls-hdf5.h"
+
+template class octave_base_matrix<uint8NDArray>;
+
+template class octave_base_int_matrix<uint8NDArray>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_uint8_matrix);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint8_matrix,
+                                     "uint8 matrix", "uint8");
+
+template class octave_base_scalar<octave_uint8>;
+
+template class octave_base_int_scalar<octave_uint8>;
+
+DEFINE_OCTAVE_ALLOCATOR (octave_uint8_scalar);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint8_scalar,
+                                     "uint8 scalar", "uint8");
+
+DEFUN (uint8, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} uint8 (@var{x})\n\
+Convert @var{x} to unsigned 8-bit integer type.\n\
+@end deftypefn")
+{
+  OCTAVE_TYPE_CONV_BODY (uint8);
+}
+
+/*
+%!assert (class (uint8 (1)), "uint8")
+%!assert (uint8 (1.25), uint8 (1))
+%!assert (uint8 (1.5), uint8 (2))
+%!assert (uint8 (-1.5), uint8 (0))
+%!assert (uint8 (2^9), uint8 (2^8-1))
+%!assert (uint8 (-2^9), uint8 (0))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-uint8.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,56 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_uint8_h)
+#define octave_uint8_h 1
+
+#define OCTAVE_INT_T octave_uint8
+
+#define OCTAVE_VALUE_INT_MATRIX_T octave_uint8_matrix
+#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint8_array_value
+
+#define OCTAVE_VALUE_INT_SCALAR_T octave_uint8_scalar
+#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint8_scalar_value
+
+#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint8_type
+
+#define OCTAVE_INT_MX_CLASS mxUINT8_CLASS
+
+#define OCTAVE_INT_BTYP btyp_uint8
+
+#include "ov-intx.h"
+
+#undef OCTAVE_INT_T
+
+#undef OCTAVE_VALUE_INT_MATRIX_T
+#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_VALUE_INT_SCALAR_T
+#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
+
+#undef OCTAVE_TYPE_PREDICATE_FUNCTION
+
+#undef OCTAVE_INT_MX_CLASS
+
+#undef OCTAVE_INT_BTYP
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-usr-fcn.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,966 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sstream>
+
+#include "str-vec.h"
+
+#include <defaults.h>
+#include "Cell.h"
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "input.h"
+#include "oct-obj.h"
+#include "ov-usr-fcn.h"
+#include "ov.h"
+#include "pager.h"
+#include "pt-eval.h"
+#include "pt-jump.h"
+#include "pt-misc.h"
+#include "pt-pr-code.h"
+#include "pt-stmt.h"
+#include "pt-walk.h"
+#include "symtab.h"
+#include "toplev.h"
+#include "unwind-prot.h"
+#include "utils.h"
+#include "parse.h"
+#include "profiler.h"
+#include "variables.h"
+#include "ov-fcn-handle.h"
+
+// Whether to optimize subsasgn method calls.
+static bool Voptimize_subsasgn_calls = true;
+
+// User defined scripts.
+
+DEFINE_OCTAVE_ALLOCATOR (octave_user_script);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_user_script,
+                                     "user-defined script",
+                                     "user-defined script");
+
+octave_user_script::octave_user_script (void)
+  : octave_user_code (), cmd_list (0), file_name (),
+    t_parsed (static_cast<time_t> (0)),
+    t_checked (static_cast<time_t> (0)),
+    call_depth (-1)
+{ }
+
+octave_user_script::octave_user_script (const std::string& fnm,
+                                        const std::string& nm,
+                                        tree_statement_list *cmds,
+                                        const std::string& ds)
+  : octave_user_code (nm, ds), cmd_list (cmds), file_name (fnm),
+    t_parsed (static_cast<time_t> (0)),
+    t_checked (static_cast<time_t> (0)),
+    call_depth (-1)
+{
+  if (cmd_list)
+    cmd_list->mark_as_script_body ();
+}
+
+octave_user_script::octave_user_script (const std::string& fnm,
+                                        const std::string& nm,
+                                        const std::string& ds)
+  : octave_user_code (nm, ds), cmd_list (0), file_name (fnm),
+    t_parsed (static_cast<time_t> (0)),
+    t_checked (static_cast<time_t> (0)),
+    call_depth (-1)
+{ }
+
+octave_user_script::~octave_user_script (void)
+{
+  delete cmd_list;
+}
+
+octave_value_list
+octave_user_script::subsref (const std::string&,
+                             const std::list<octave_value_list>&, int)
+{
+  octave_value_list retval;
+
+  ::error ("invalid use of script %s in index expression", file_name.c_str ());
+
+  return retval;
+}
+
+octave_value_list
+octave_user_script::do_multi_index_op (int nargout,
+                                       const octave_value_list& args)
+{
+  octave_value_list retval;
+
+  unwind_protect frame;
+
+  if (! error_state)
+    {
+      if (args.length () == 0 && nargout == 0)
+        {
+          if (cmd_list)
+            {
+              frame.protect_var (call_depth);
+              call_depth++;
+
+              if (call_depth < Vmax_recursion_depth)
+                {
+                  octave_call_stack::push (this);
+
+                  frame.add_fcn (octave_call_stack::pop);
+
+                  frame.protect_var (tree_evaluator::statement_context);
+                  tree_evaluator::statement_context = tree_evaluator::script;
+
+                  BEGIN_PROFILER_BLOCK (profiler_name ())
+                  cmd_list->accept (*current_evaluator);
+                  END_PROFILER_BLOCK
+
+                  if (tree_return_command::returning)
+                    tree_return_command::returning = 0;
+
+                  if (tree_break_command::breaking)
+                    tree_break_command::breaking--;
+
+                  if (error_state)
+                    octave_call_stack::backtrace_error_message ();
+                }
+              else
+                ::error ("max_recursion_depth exceeded");
+            }
+        }
+      else
+        error ("invalid call to script %s", file_name.c_str ());
+    }
+
+  return retval;
+}
+
+void
+octave_user_script::accept (tree_walker& tw)
+{
+  tw.visit_octave_user_script (*this);
+}
+
+// User defined functions.
+
+DEFINE_OCTAVE_ALLOCATOR (octave_user_function);
+
+DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_user_function,
+                                     "user-defined function",
+                                     "user-defined function");
+
+// Ugh.  This really needs to be simplified (code/data?
+// extrinsic/intrinsic state?).
+
+octave_user_function::octave_user_function
+  (symbol_table::scope_id sid, tree_parameter_list *pl,
+   tree_parameter_list *rl, tree_statement_list *cl)
+  : octave_user_code (std::string (), std::string ()),
+    param_list (pl), ret_list (rl), cmd_list (cl),
+    lead_comm (), trail_comm (), file_name (),
+    location_line (0), location_column (0),
+    parent_name (), t_parsed (static_cast<time_t> (0)),
+    t_checked (static_cast<time_t> (0)),
+    system_fcn_file (false), call_depth (-1),
+    num_named_args (param_list ? param_list->length () : 0),
+    subfunction (false), inline_function (false),
+    anonymous_function (false), nested_function (false),
+    class_constructor (false), class_method (false),
+    parent_scope (-1), local_scope (sid),
+    curr_unwind_protect_frame (0)
+{
+  if (cmd_list)
+    cmd_list->mark_as_function_body ();
+
+  if (local_scope >= 0)
+    symbol_table::set_curr_fcn (this, local_scope);
+}
+
+octave_user_function::~octave_user_function (void)
+{
+  delete param_list;
+  delete ret_list;
+  delete cmd_list;
+  delete lead_comm;
+  delete trail_comm;
+
+  symbol_table::erase_scope (local_scope);
+}
+
+octave_user_function *
+octave_user_function::define_ret_list (tree_parameter_list *t)
+{
+  ret_list = t;
+
+  return this;
+}
+
+void
+octave_user_function::stash_fcn_file_name (const std::string& nm)
+{
+  file_name = nm;
+}
+
+std::string
+octave_user_function::profiler_name (void) const
+{
+  std::ostringstream result;
+
+  if (is_inline_function ())
+    result << "inline@" << fcn_file_name ()
+           << ":" << location_line << ":" << location_column;
+  else if (is_anonymous_function ())
+    result << "anonymous@" << fcn_file_name ()
+           << ":" << location_line << ":" << location_column;
+  else if (is_subfunction ())
+    result << parent_fcn_name () << ">" << name ();
+  else
+    result << name ();
+
+  return result.str ();
+}
+
+void
+octave_user_function::mark_as_system_fcn_file (void)
+{
+  if (! file_name.empty ())
+    {
+      // We really should stash the whole path to the file we found,
+      // when we looked it up, to avoid possible race conditions...
+      // FIXME
+      //
+      // We probably also don't need to get the library directory
+      // every time, but since this function is only called when the
+      // function file is parsed, it probably doesn't matter that
+      // much.
+
+      std::string ff_name = fcn_file_in_path (file_name);
+
+      if (Vfcn_file_dir == ff_name.substr (0, Vfcn_file_dir.length ()))
+        system_fcn_file = true;
+    }
+  else
+    system_fcn_file = false;
+}
+
+bool
+octave_user_function::takes_varargs (void) const
+{
+  return (param_list && param_list->takes_varargs ());
+}
+
+bool
+octave_user_function::takes_var_return (void) const
+{
+  return (ret_list && ret_list->takes_varargs ());
+}
+
+void
+octave_user_function::lock_subfunctions (void)
+{
+  symbol_table::lock_subfunctions (local_scope);
+}
+
+void
+octave_user_function::unlock_subfunctions (void)
+{
+  symbol_table::unlock_subfunctions (local_scope);
+}
+
+octave_value_list
+octave_user_function::all_va_args (const octave_value_list& args)
+{
+  octave_value_list retval;
+
+  octave_idx_type n = args.length () - num_named_args;
+
+  if (n > 0)
+    retval = args.slice (num_named_args, n);
+
+  return retval;
+}
+
+octave_value_list
+octave_user_function::subsref (const std::string& type,
+                               const std::list<octave_value_list>& idx,
+                               int nargout)
+{
+  return octave_user_function::subsref (type, idx, nargout, 0);
+}
+
+octave_value_list
+octave_user_function::subsref (const std::string& type,
+                               const std::list<octave_value_list>& idx,
+                               int nargout, const std::list<octave_lvalue>* lvalue_list)
+{
+  octave_value_list retval;
+
+  switch (type[0])
+    {
+    case '(':
+      {
+        int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
+
+        retval = do_multi_index_op (tmp_nargout, idx.front (),
+                                    idx.size () == 1 ? lvalue_list : 0);
+      }
+      break;
+
+    case '{':
+    case '.':
+      {
+        std::string nm = type_name ();
+        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
+      }
+      break;
+
+    default:
+      panic_impossible ();
+    }
+
+  // FIXME -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_builtin::subsref.
+
+  if (idx.size () > 1)
+    retval = retval(0).next_subsref (nargout, type, idx);
+
+  return retval;
+}
+
+octave_value_list
+octave_user_function::do_multi_index_op (int nargout,
+                                         const octave_value_list& args)
+{
+  return do_multi_index_op (nargout, args, 0);
+}
+
+octave_value_list
+octave_user_function::do_multi_index_op (int nargout,
+                                         const octave_value_list& args,
+                                         const std::list<octave_lvalue>* lvalue_list)
+{
+  octave_value_list retval;
+
+  if (error_state)
+    return retval;
+
+  if (! cmd_list)
+    return retval;
+
+  int nargin = args.length ();
+
+  unwind_protect frame;
+
+  frame.protect_var (call_depth);
+  call_depth++;
+
+  if (call_depth >= Vmax_recursion_depth)
+    {
+      ::error ("max_recursion_depth exceeded");
+      return retval;
+    }
+
+  // Save old and set current symbol table context, for
+  // eval_undefined_error().
+
+  int context = active_context ();
+
+  octave_call_stack::push (this, local_scope, context);
+  frame.add_fcn (octave_call_stack::pop);
+
+  if (call_depth > 0 && ! is_anonymous_function ())
+    {
+      symbol_table::push_context ();
+
+      frame.add_fcn (symbol_table::pop_context);
+    }
+
+  string_vector arg_names = args.name_tags ();
+
+  if (param_list && ! param_list->varargs_only ())
+    {
+      param_list->define_from_arg_vector (args);
+      if (error_state)
+        return retval;
+    }
+
+  // Force parameter list to be undefined when this function exits.
+  // Doing so decrements the reference counts on the values of local
+  // variables that are also named function parameters.
+
+  if (param_list)
+    frame.add_method (param_list, &tree_parameter_list::undefine);
+
+  // Force return list to be undefined when this function exits.
+  // Doing so decrements the reference counts on the values of local
+  // variables that are also named values returned by this function.
+
+  if (ret_list)
+    frame.add_method (ret_list, &tree_parameter_list::undefine);
+
+  if (call_depth == 0)
+    {
+      // Force symbols to be undefined again when this function
+      // exits.
+      //
+      // This cleanup function is added to the unwind_protect stack
+      // after the calls to clear the parameter lists so that local
+      // variables will be cleared before the parameter lists are
+      // cleared.  That way, any function parameters that have been
+      // declared global will be unmarked as global before they are
+      // undefined by the clear_param_list cleanup function.
+
+      frame.add_fcn (symbol_table::clear_variables);
+    }
+
+  bind_automatic_vars (arg_names, nargin, nargout, all_va_args (args),
+                       lvalue_list);
+
+  bool echo_commands = (Vecho_executing_commands & ECHO_FUNCTIONS);
+
+  if (echo_commands)
+    print_code_function_header ();
+
+  // Set pointer to the current unwind_protect frame to allow
+  // certain builtins register simple cleanup in a very optimized manner.
+  // This is *not* intended as a general-purpose on-cleanup mechanism,
+  frame.protect_var (curr_unwind_protect_frame);
+  curr_unwind_protect_frame = &frame;
+
+  // Evaluate the commands that make up the function.
+
+  frame.protect_var (tree_evaluator::statement_context);
+  tree_evaluator::statement_context = tree_evaluator::function;
+
+  bool special_expr = (is_inline_function () || is_anonymous_function ());
+
+  BEGIN_PROFILER_BLOCK (profiler_name ())
+
+  if (special_expr)
+    {
+      assert (cmd_list->length () == 1);
+
+      tree_statement *stmt = 0;
+
+      if ((stmt = cmd_list->front ())
+          && stmt->is_expression ())
+        {
+          tree_expression *expr = stmt->expression ();
+
+          retval = expr->rvalue (nargout);
+        }
+    }
+  else
+    cmd_list->accept (*current_evaluator);
+
+  END_PROFILER_BLOCK
+
+  if (echo_commands)
+    print_code_function_trailer ();
+
+  if (tree_return_command::returning)
+    tree_return_command::returning = 0;
+
+  if (tree_break_command::breaking)
+    tree_break_command::breaking--;
+
+  if (error_state)
+    {
+      octave_call_stack::backtrace_error_message ();
+      return retval;
+    }
+
+  // Copy return values out.
+
+  if (ret_list && ! special_expr)
+    {
+      ret_list->initialize_undefined_elements (my_name, nargout, Matrix ());
+
+      Cell varargout;
+
+      if (ret_list->takes_varargs ())
+        {
+          octave_value varargout_varval = symbol_table::varval ("varargout");
+
+          if (varargout_varval.is_defined ())
+            {
+              varargout = varargout_varval.cell_value ();
+
+              if (error_state)
+                error ("expecting varargout to be a cell array object");
+            }
+        }
+
+      if (! error_state)
+        retval = ret_list->convert_to_const_vector (nargout, varargout);
+    }
+
+  return retval;
+}
+
+void
+octave_user_function::accept (tree_walker& tw)
+{
+  tw.visit_octave_user_function (*this);
+}
+
+bool
+octave_user_function::subsasgn_optimization_ok (void)
+{
+  bool retval = false;
+  if (Voptimize_subsasgn_calls
+      && param_list->length () > 0 && ! param_list->varargs_only ()
+      && ret_list->length () == 1 && ! ret_list->takes_varargs ())
+    {
+      tree_identifier *par1 = param_list->front ()->ident ();
+      tree_identifier *ret1 = ret_list->front ()->ident ();
+      retval = par1->name () == ret1->name ();
+    }
+
+  return retval;
+}
+
+#if 0
+void
+octave_user_function::print_symtab_info (std::ostream& os) const
+{
+  symbol_table::print_info (os, local_scope);
+}
+#endif
+
+void
+octave_user_function::print_code_function_header (void)
+{
+  tree_print_code tpc (octave_stdout, VPS4);
+
+  tpc.visit_octave_user_function_header (*this);
+}
+
+void
+octave_user_function::print_code_function_trailer (void)
+{
+  tree_print_code tpc (octave_stdout, VPS4);
+
+  tpc.visit_octave_user_function_trailer (*this);
+}
+
+void
+octave_user_function::bind_automatic_vars
+  (const string_vector& arg_names, int nargin, int nargout,
+   const octave_value_list& va_args, const std::list<octave_lvalue> *lvalue_list)
+{
+  if (! arg_names.empty ())
+    {
+      // It is better to save this in the hidden variable .argn. and
+      // then use that in the inputname function instead of using argn,
+      // which might be redefined in a function.  Keep the old argn name
+      // for backward compatibility of functions that use it directly.
+
+      symbol_table::varref ("argn") = arg_names;
+      symbol_table::varref (".argn.") = Cell (arg_names);
+
+      symbol_table::mark_hidden (".argn.");
+
+      symbol_table::mark_automatic ("argn");
+      symbol_table::mark_automatic (".argn.");
+    }
+
+  symbol_table::varref (".nargin.") = nargin;
+  symbol_table::varref (".nargout.") = nargout;
+
+  symbol_table::mark_hidden (".nargin.");
+  symbol_table::mark_hidden (".nargout.");
+
+  symbol_table::mark_automatic (".nargin.");
+  symbol_table::mark_automatic (".nargout.");
+
+  if (takes_varargs ())
+    symbol_table::varref ("varargin") = va_args.cell_value ();
+
+  // Force .ignored. variable to be undefined by default.
+  symbol_table::varref (".ignored.") = octave_value ();
+
+  if (lvalue_list)
+    {
+      octave_idx_type nbh = 0;
+      for (std::list<octave_lvalue>::const_iterator p = lvalue_list->begin ();
+           p != lvalue_list->end (); p++)
+        nbh += p->is_black_hole ();
+
+      if (nbh > 0)
+        {
+          // Only assign the hidden variable if black holes actually present.
+          Matrix bh (1, nbh);
+          octave_idx_type k = 0, l = 0;
+          for (std::list<octave_lvalue>::const_iterator p = lvalue_list->begin ();
+               p != lvalue_list->end (); p++)
+            {
+              if (p->is_black_hole ())
+                bh(l++) = k+1;
+              k += p->numel ();
+            }
+
+          symbol_table::varref (".ignored.") = bh;
+        }
+    }
+
+  symbol_table::mark_hidden (".ignored.");
+  symbol_table::mark_automatic (".ignored.");
+}
+
+DEFUN (nargin, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} nargin ()\n\
+@deftypefnx {Built-in Function} {} nargin (@var{fcn})\n\
+Within a function, return the number of arguments passed to the function.\n\
+At the top level, return the number of command line arguments passed to\n\
+Octave.\n\
+\n\
+If called with the optional argument @var{fcn}, a function name or handle,\n\
+return the declared number of arguments that the function can accept.\n\
+If the last argument is @var{varargin} the returned value is negative.\n\
+This feature does not work on builtin functions.\n\
+@seealso{nargout, varargin, isargout, varargout, nthargout}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    {
+      octave_value func = args(0);
+
+      if (func.is_string ())
+        {
+          std::string name = func.string_value ();
+          func = symbol_table::find_function (name);
+          if (func.is_undefined ())
+            error ("nargout: invalid function name: %s", name.c_str ());
+        }
+
+      octave_function *fcn_val = func.function_value ();
+      if (fcn_val)
+        {
+          octave_user_function *fcn = fcn_val->user_function_value (true);
+
+          if (fcn)
+            {
+              tree_parameter_list *param_list = fcn->parameter_list ();
+
+              retval = param_list ? param_list->length () : 0;
+              if (fcn->takes_varargs ())
+                retval = -1 - retval;
+            }
+          else
+            {
+              // Matlab gives up for histc, so maybe it's ok we give up somtimes too.
+              error ("nargin: nargin information not available for builtin functions");
+            }
+        }
+      else
+        error ("nargin: FCN must be a string or function handle");
+    }
+  else if (nargin == 0)
+    {
+      retval = symbol_table::varval (".nargin.");
+
+      if (retval.is_undefined ())
+        retval = 0;
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (nargout, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {} nargout ()\n\
+@deftypefnx {Built-in Function} {} nargout (@var{fcn})\n\
+Within a function, return the number of values the caller expects to\n\
+receive.  If called with the optional argument @var{fcn}, a function\n\
+name or handle, return the number of declared output values that the\n\
+function can produce.  If the final output argument is @var{varargout}\n\
+the returned value is negative.\n\
+\n\
+For example,\n\
+\n\
+@example\n\
+f ()\n\
+@end example\n\
+\n\
+@noindent\n\
+will cause @code{nargout} to return 0 inside the function @code{f} and\n\
+\n\
+@example\n\
+[s, t] = f ()\n\
+@end example\n\
+\n\
+@noindent\n\
+will cause @code{nargout} to return 2 inside the function\n\
+@code{f}.\n\
+\n\
+In the second usage,\n\
+\n\
+@example\n\
+nargout (@@histc) \% or nargout ('histc')\n\
+@end example\n\
+\n\
+@noindent\n\
+will return 2, because @code{histc} has two outputs, whereas\n\
+\n\
+@example\n\
+nargout (@@deal)\n\
+@end example\n\
+\n\
+@noindent\n\
+will return -1, because @code{deal} has a variable number of outputs.\n\
+\n\
+At the top level, @code{nargout} with no argument is undefined.\n\
+@code{nargout} does not work on builtin functions.\n\
+@code{nargout} returns -1 for all anonymous functions.\n\
+@seealso{nargin, varargin, isargout, varargout, nthargout}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    {
+      octave_value func = args(0);
+
+      if (func.is_string ())
+        {
+          std::string name = func.string_value ();
+          func = symbol_table::find_function (name);
+          if (func.is_undefined ())
+            error ("nargout: invalid function name: %s", name.c_str ());
+        }
+
+      if (func.is_inline_function ())
+        {
+          retval = 1;
+          return retval;
+        }
+
+      if (func.is_function_handle ())
+        {
+          octave_fcn_handle *fh = func.fcn_handle_value ();
+          std::string fh_nm = fh->fcn_name ();
+
+          if (fh_nm == octave_fcn_handle::anonymous)
+            {
+              retval = -1;
+              return retval;
+            }
+        }
+
+      octave_function *fcn_val = func.function_value ();
+      if (fcn_val)
+        {
+          octave_user_function *fcn = fcn_val->user_function_value (true);
+
+          if (fcn)
+            {
+              tree_parameter_list *ret_list = fcn->return_list ();
+          
+              retval = ret_list ? ret_list->length () : 0;
+
+              if (fcn->takes_var_return ())
+                retval = -1 - retval;
+            }
+          else
+            {
+              // JWE said this information is not available (currently, 2011-03-10)
+              // without making intrusive changes to Octave.
+              // Matlab gives up for histc, so maybe it's ok we give up somtimes too.
+              error ("nargout: nargout information not available for builtin functions.");
+            }
+        }
+      else
+        error ("nargout: FCN must be a string or function handle");
+    }
+  else if (nargin == 0)
+    {
+      if (! symbol_table::at_top_level ())
+        {
+          retval = symbol_table::varval (".nargout.");
+
+          if (retval.is_undefined ())
+            retval = 0;
+        }
+      else
+        error ("nargout: invalid call at top level");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (optimize_subsasgn_calls, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} optimize_subsasgn_calls ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} optimize_subsasgn_calls (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} optimize_subsasgn_calls (@var{new_val}, \"local\")\n\
+Query or set the internal flag for subsasgn method call optimizations.\n\
+If true, Octave will attempt to eliminate the redundant copying when calling\n\
+subsasgn method of a user-defined class.\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (optimize_subsasgn_calls);
+}
+
+static bool val_in_table (const Matrix& table, double val)
+{
+  if (table.is_empty ())
+    return false;
+
+  octave_idx_type i = table.lookup (val, ASCENDING);
+  return (i > 0 && table(i-1) == val);
+}
+
+static bool isargout1 (int nargout, const Matrix& ignored, double k)
+{
+  if (k != xround (k) || k <= 0)
+    {
+      error ("isargout: K must be a positive integer");
+      return false;
+    }
+  else
+    return (k == 1 || k <= nargout) && ! val_in_table (ignored, k);
+}
+
+DEFUN (isargout, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} isargout (@var{k})\n\
+Within a function, return a logical value indicating whether the argument\n\
+@var{k} will be assigned on output to a variable.  If the result is false,\n\
+the argument has been ignored during the function call through the use of\n\
+the tilde (~) special output argument.  Functions can use @code{isargout} to\n\
+avoid performing unnecessary calculations for outputs which are unwanted.\n\
+\n\
+If @var{k} is outside the range @code{1:max (nargout)}, the function returns\n\
+false.  @var{k} can also be an array, in which case the function works\n\
+element-by-element and a logical array is returned.  At the top level,\n\
+@code{isargout} returns an error.\n\
+@seealso{nargout, nargin, varargin, varargout, nthargout}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1)
+    {
+      if (! symbol_table::at_top_level ())
+        {
+          int nargout1 = symbol_table::varval (".nargout.").int_value ();
+          if (error_state)
+            {
+              error ("isargout: internal error");
+              return retval;
+            }
+
+          Matrix ignored;
+          octave_value tmp = symbol_table::varval (".ignored.");
+          if (tmp.is_defined ())
+            ignored = tmp.matrix_value ();
+
+          if (args(0).is_scalar_type ())
+            {
+              double k = args(0).double_value ();
+              if (! error_state)
+                retval = isargout1 (nargout1, ignored, k);
+            }
+          else if (args(0).is_numeric_type ())
+            {
+              const NDArray ka = args(0).array_value ();
+              if (! error_state)
+                {
+                  boolNDArray r (ka.dims ());
+                  for (octave_idx_type i = 0; i < ka.numel () && ! error_state; i++)
+                    r(i) = isargout1 (nargout1, ignored, ka(i));
+
+                  retval = r;
+                }
+            }
+          else
+            gripe_wrong_type_arg ("isargout", args(0));
+        }
+      else
+        error ("isargout: invalid call at top level");
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!function [x, y] = try_isargout ()
+%!  if (isargout (1))
+%!    if (isargout (2))
+%!      x = 1; y = 2;
+%!    else
+%!      x = -1;
+%!    endif
+%!  else
+%!    if (isargout (2))
+%!      y = -2;
+%!    else
+%!      error ("no outputs requested");
+%!    endif
+%!  endif
+%!endfunction
+%!
+%!test
+%! [x, y] = try_isargout ();
+%! assert ([x, y], [1, 2]);
+%!
+%!test
+%! [x, ~] = try_isargout ();
+%! assert (x, -1);
+%!
+%!test
+%! [~, y] = try_isargout ();
+%! assert (y, -2);
+%!
+%!error [~, ~] = try_isargout ();
+%!
+%% Check to see that isargout isn't sticky:
+%!test
+%! [x, y] = try_isargout ();
+%! assert ([x, y], [1, 2]);
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov-usr-fcn.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,463 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_user_function_h)
+#define octave_user_function_h 1
+
+#include <ctime>
+
+#include <string>
+#include <stack>
+
+#include "comment-list.h"
+#include "oct-obj.h"
+#include "ov-fcn.h"
+#include "ov-typeinfo.h"
+#include "symtab.h"
+#include "unwind-prot.h"
+
+class string_vector;
+
+class octave_value;
+class tree_parameter_list;
+class tree_statement_list;
+class tree_va_return_list;
+class tree_walker;
+
+class
+octave_user_code : public octave_function
+{
+public:
+  octave_user_code (void)
+    : octave_function () { }
+
+  ~octave_user_code (void) { }
+
+  bool is_user_code (void) const { return true; }
+
+  virtual tree_statement_list *body (void) = 0;
+
+protected:
+
+  octave_user_code (const std::string& nm,
+                    const std::string& ds = std::string ())
+    : octave_function (nm, ds) { }
+
+private:
+
+  // No copying!
+
+  octave_user_code (const octave_user_code& f);
+
+  octave_user_code& operator = (const octave_user_code& f);
+};
+
+// Scripts.
+
+class
+octave_user_script : public octave_user_code
+{
+public:
+
+  octave_user_script (void);
+
+  octave_user_script (const std::string& fnm, const std::string& nm,
+                      tree_statement_list *cmds,
+                      const std::string& ds = std::string ());
+
+  octave_user_script (const std::string& fnm, const std::string& nm,
+                      const std::string& ds = std::string ());
+
+  ~octave_user_script (void);
+
+  octave_function *function_value (bool = false) { return this; }
+
+  octave_user_script *user_script_value (bool = false) { return this; }
+
+  octave_user_code *user_code_value (bool = false) { return this; }
+
+  // Scripts and user functions are both considered "scripts" because
+  // they are written in Octave's scripting language.
+
+  bool is_user_script (void) const { return true; }
+
+  void stash_fcn_file_name (const std::string& nm) { file_name = nm; }
+
+  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
+
+  void stash_fcn_file_time (const octave_time& t)
+    {
+      t_parsed = t;
+      mark_fcn_file_up_to_date (t);
+    }
+
+  std::string fcn_file_name (void) const { return file_name; }
+
+  octave_time time_parsed (void) const { return t_parsed; }
+
+  octave_time time_checked (void) const { return t_checked; }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    {
+      octave_value_list tmp = subsref (type, idx, 1);
+      return tmp.length () > 0 ? tmp(0) : octave_value ();
+    }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args);
+
+  tree_statement_list *body (void) { return cmd_list; }
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // The list of commands that make up the body of this function.
+  tree_statement_list *cmd_list;
+
+  // The name of the file we parsed.
+  std::string file_name;
+
+  // The time the file was parsed.
+  octave_time t_parsed;
+
+  // The time the file was last checked to see if it needs to be
+  // parsed again.
+  octave_time t_checked;
+
+  // Used to keep track of recursion depth.
+  int call_depth;
+
+  // No copying!
+
+  octave_user_script (const octave_user_script& f);
+
+  octave_user_script& operator = (const octave_user_script& f);
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+// User-defined functions.
+
+class
+octave_user_function : public octave_user_code
+{
+public:
+
+  octave_user_function (symbol_table::scope_id sid = -1,
+                        tree_parameter_list *pl = 0,
+                        tree_parameter_list *rl = 0,
+                        tree_statement_list *cl = 0);
+
+  ~octave_user_function (void);
+
+  symbol_table::context_id active_context () const
+  {
+    return is_anonymous_function ()
+      ? 0 : static_cast<symbol_table::context_id>(call_depth);
+  }
+
+  octave_function *function_value (bool = false) { return this; }
+
+  octave_user_function *user_function_value (bool = false) { return this; }
+
+  octave_user_code *user_code_value (bool = false) { return this; }
+
+  octave_user_function *define_param_list (tree_parameter_list *t);
+
+  octave_user_function *define_ret_list (tree_parameter_list *t);
+
+  void stash_fcn_file_name (const std::string& nm);
+
+  void stash_fcn_location (int line, int col)
+    {
+      location_line = line;
+      location_column = col;
+    }
+
+  void stash_parent_fcn_name (const std::string& p) { parent_name = p; }
+
+  void stash_parent_fcn_scope (symbol_table::scope_id ps) { parent_scope = ps; }
+
+  void stash_leading_comment (octave_comment_list *lc) { lead_comm = lc; }
+
+  void stash_trailing_comment (octave_comment_list *tc) { trail_comm = tc; }
+
+  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
+
+  void stash_fcn_file_time (const octave_time& t)
+    {
+      t_parsed = t;
+      mark_fcn_file_up_to_date (t);
+    }
+
+  std::string fcn_file_name (void) const { return file_name; }
+
+  std::string profiler_name (void) const;
+
+  std::string parent_fcn_name (void) const { return parent_name; }
+
+  symbol_table::scope_id parent_fcn_scope (void) const { return parent_scope; }
+
+  symbol_table::scope_id scope (void) { return local_scope; }
+
+  octave_time time_parsed (void) const { return t_parsed; }
+
+  octave_time time_checked (void) const { return t_checked; }
+
+  void mark_as_system_fcn_file (void);
+
+  bool is_system_fcn_file (void) const { return system_fcn_file; }
+
+  bool is_user_function (void) const { return true; }
+
+  void erase_subfunctions (void)
+    {
+      symbol_table::erase_subfunctions_in_scope (local_scope);
+    }
+
+  bool takes_varargs (void) const;
+
+  bool takes_var_return (void) const;
+
+  void mark_as_private_function (const std::string& cname = std::string ())
+    {
+      symbol_table::mark_subfunctions_in_scope_as_private (local_scope, cname);
+
+      octave_function::mark_as_private_function (cname);
+    }
+
+  void lock_subfunctions (void);
+
+  void unlock_subfunctions (void);
+
+  octave_value_list all_va_args (const octave_value_list& args);
+
+  void stash_function_name (const std::string& s) { my_name = s; }
+
+  void mark_as_subfunction (void) { subfunction = true; }
+
+  bool is_subfunction (void) const { return subfunction; }
+
+  void mark_as_inline_function (void) { inline_function = true; }
+
+  bool is_inline_function (void) const { return inline_function; }
+
+  void mark_as_anonymous_function (void) { anonymous_function = true; }
+
+  bool is_anonymous_function (void) const { return anonymous_function; }
+
+  bool is_anonymous_function_of_class
+    (const std::string& cname = std::string ()) const
+  {
+    return anonymous_function
+      ? (cname.empty ()
+         ? (! dispatch_class ().empty ())
+         : cname == dispatch_class ())
+      : false;
+  }
+
+  bool is_nested_function (void) const { return nested_function; }
+
+  void mark_as_nested_function (void) { nested_function = true; }
+
+  void mark_as_class_constructor (void) { class_constructor = true; }
+
+  bool is_class_constructor (const std::string& cname = std::string ()) const
+    {
+      return class_constructor
+        ? (cname.empty () ? true : cname == dispatch_class ()) : false;
+    }
+
+  void mark_as_class_method (void) { class_method = true; }
+
+  bool is_class_method (const std::string& cname = std::string ()) const
+    {
+      return class_method
+        ? (cname.empty () ? true : cname == dispatch_class ()) : false;
+    }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    {
+      octave_value_list tmp = subsref (type, idx, 1);
+      return tmp.length () > 0 ? tmp(0) : octave_value ();
+    }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout, const std::list<octave_lvalue>* lvalue_list);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& args,
+                     const std::list<octave_lvalue>* lvalue_list);
+
+  tree_parameter_list *parameter_list (void) { return param_list; }
+
+  tree_parameter_list *return_list (void) { return ret_list; }
+
+  tree_statement_list *body (void) { return cmd_list; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  octave_comment_list *trailing_comment (void) { return trail_comm; }
+
+  bool subsasgn_optimization_ok (void);
+
+  void accept (tree_walker& tw);
+
+  template <class T>
+  bool local_protect (T& variable)
+    {
+      if (curr_unwind_protect_frame)
+        {
+          curr_unwind_protect_frame->protect_var (variable);
+          return true;
+        }
+      else
+        return false;
+    }
+
+#if 0
+  void print_symtab_info (std::ostream& os) const;
+#endif
+
+private:
+
+  // List of arguments for this function.  These are local variables.
+  tree_parameter_list *param_list;
+
+  // List of parameters we return.  These are also local variables in
+  // this function.
+  tree_parameter_list *ret_list;
+
+  // The list of commands that make up the body of this function.
+  tree_statement_list *cmd_list;
+
+  // The comments preceding the FUNCTION token.
+  octave_comment_list *lead_comm;
+
+  // The comments preceding the ENDFUNCTION token.
+  octave_comment_list *trail_comm;
+
+  // The name of the file we parsed.
+  std::string file_name;
+
+  // Location where this function was defined.
+  int location_line;
+  int location_column;
+
+  // The name of the parent function, if any.
+  std::string parent_name;
+
+  // The time the file was parsed.
+  octave_time t_parsed;
+
+  // The time the file was last checked to see if it needs to be
+  // parsed again.
+  octave_time t_checked;
+
+  // True if this function came from a file that is considered to be a
+  // system function.  This affects whether we check the time stamp
+  // on the file to see if it has changed.
+  bool system_fcn_file;
+
+  // Used to keep track of recursion depth.
+  int call_depth;
+
+  // The number of arguments that have names.
+  int num_named_args;
+
+  // TRUE means this subfunction of a primary function.
+  bool subfunction;
+
+  // TRUE means this is an inline function.
+  bool inline_function;
+
+  // TRUE means this is an anonymous function.
+  bool anonymous_function;
+
+  // TRUE means this is a nested function. (either a child or parent)
+  bool nested_function;
+
+  // TRUE means this function is the constructor for class object.
+  bool class_constructor;
+
+  // TRUE means this function is a method for a class.
+  bool class_method;
+
+  // The scope of the parent function, if any.
+  symbol_table::scope_id parent_scope;
+
+  symbol_table::scope_id local_scope;
+
+  // pointer to the current unwind_protect frame of this function.
+  unwind_protect *curr_unwind_protect_frame;
+
+#if 0
+  // The symbol record for argn in the local symbol table.
+  octave_value& argn_varref;
+
+  // The symbol record for nargin in the local symbol table.
+  octave_value& nargin_varref;
+
+  // The symbol record for nargout in the local symbol table.
+  octave_value& nargout_varref;
+
+  // The symbol record for varargin in the local symbol table.
+  octave_value& varargin_varref;
+#endif
+
+  void print_code_function_header (void);
+
+  void print_code_function_trailer (void);
+
+  void bind_automatic_vars (const string_vector& arg_names, int nargin,
+                            int nargout, const octave_value_list& va_args,
+                            const std::list<octave_lvalue> *lvalue_list);
+
+  // No copying!
+
+  octave_user_function (const octave_user_function& fn);
+
+  octave_user_function& operator = (const octave_user_function& fn);
+
+  DECLARE_OCTAVE_ALLOCATOR
+
+  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,3046 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "data-conv.h"
+#include "quit.h"
+#include "str-vec.h"
+
+#include "oct-obj.h"
+#include "oct-stream.h"
+#include "ov.h"
+#include "ov-base.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-cell.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-re-diag.h"
+#include "ov-flt-re-diag.h"
+#include "ov-perm.h"
+#include "ov-bool-sparse.h"
+#include "ov-cx-sparse.h"
+#include "ov-re-sparse.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-cx-diag.h"
+#include "ov-flt-cx-diag.h"
+#include "ov-ch-mat.h"
+#include "ov-str-mat.h"
+#include "ov-range.h"
+#include "ov-struct.h"
+#include "ov-class.h"
+#include "ov-oncleanup.h"
+#include "ov-cs-list.h"
+#include "ov-colon.h"
+#include "ov-builtin.h"
+#include "ov-dld-fcn.h"
+#include "ov-usr-fcn.h"
+#include "ov-fcn-handle.h"
+#include "ov-fcn-inline.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ov-lazy-idx.h"
+
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "pager.h"
+#include "parse.h"
+#include "pr-output.h"
+#include "symtab.h"
+#include "utils.h"
+#include "variables.h"
+
+// We are likely to have a lot of octave_value objects to allocate, so
+// make the grow_size large.
+DEFINE_OCTAVE_ALLOCATOR2(octave_value, 1024);
+
+// FIXME
+
+// Octave's value type.
+
+std::string
+octave_value::unary_op_as_string (unary_op op)
+{
+  std::string retval;
+
+  switch (op)
+    {
+    case op_not:
+      retval = "!";
+      break;
+
+    case op_uplus:
+      retval = "+";
+      break;
+
+    case op_uminus:
+      retval = "-";
+      break;
+
+    case op_transpose:
+      retval = ".'";
+      break;
+
+    case op_hermitian:
+      retval = "'";
+      break;
+
+    case op_incr:
+      retval = "++";
+      break;
+
+    case op_decr:
+      retval = "--";
+      break;
+
+    default:
+      retval = "<unknown>";
+    }
+
+  return retval;
+}
+
+std::string
+octave_value::unary_op_fcn_name (unary_op op)
+{
+  std::string retval;
+
+  switch (op)
+    {
+    case op_not:
+      retval = "not";
+      break;
+
+    case op_uplus:
+      retval = "uplus";
+      break;
+
+    case op_uminus:
+      retval = "uminus";
+      break;
+
+    case op_transpose:
+      retval = "transpose";
+      break;
+
+    case op_hermitian:
+      retval = "ctranspose";
+      break;
+
+    default:
+      break;
+    }
+
+  return retval;
+}
+
+std::string
+octave_value::binary_op_as_string (binary_op op)
+{
+  std::string retval;
+
+  switch (op)
+    {
+    case op_add:
+      retval = "+";
+      break;
+
+    case op_sub:
+      retval = "-";
+      break;
+
+    case op_mul:
+      retval = "*";
+      break;
+
+    case op_div:
+      retval = "/";
+      break;
+
+    case op_pow:
+      retval = "^";
+      break;
+
+    case op_ldiv:
+      retval = "\\";
+      break;
+
+    case op_lshift:
+      retval = "<<";
+      break;
+
+    case op_rshift:
+      retval = ">>";
+      break;
+
+    case op_lt:
+      retval = "<";
+      break;
+
+    case op_le:
+      retval = "<=";
+      break;
+
+    case op_eq:
+      retval = "==";
+      break;
+
+    case op_ge:
+      retval = ">=";
+      break;
+
+    case op_gt:
+      retval = ">";
+      break;
+
+    case op_ne:
+      retval = "!=";
+      break;
+
+    case op_el_mul:
+      retval = ".*";
+      break;
+
+    case op_el_div:
+      retval = "./";
+      break;
+
+    case op_el_pow:
+      retval = ".^";
+      break;
+
+    case op_el_ldiv:
+      retval = ".\\";
+      break;
+
+    case op_el_and:
+      retval = "&";
+      break;
+
+    case op_el_or:
+      retval = "|";
+      break;
+
+    case op_struct_ref:
+      retval = ".";
+      break;
+
+    default:
+      retval = "<unknown>";
+    }
+
+  return retval;
+}
+
+std::string
+octave_value::binary_op_fcn_name (binary_op op)
+{
+  std::string retval;
+
+  switch (op)
+    {
+    case op_add:
+      retval = "plus";
+      break;
+
+    case op_sub:
+      retval = "minus";
+      break;
+
+    case op_mul:
+      retval = "mtimes";
+      break;
+
+    case op_div:
+      retval = "mrdivide";
+      break;
+
+    case op_pow:
+      retval = "mpower";
+      break;
+
+    case op_ldiv:
+      retval = "mldivide";
+      break;
+
+    case op_lt:
+      retval = "lt";
+      break;
+
+    case op_le:
+      retval = "le";
+      break;
+
+    case op_eq:
+      retval = "eq";
+      break;
+
+    case op_ge:
+      retval = "ge";
+      break;
+
+    case op_gt:
+      retval = "gt";
+      break;
+
+    case op_ne:
+      retval = "ne";
+      break;
+
+    case op_el_mul:
+      retval = "times";
+      break;
+
+    case op_el_div:
+      retval = "rdivide";
+      break;
+
+    case op_el_pow:
+      retval = "power";
+      break;
+
+    case op_el_ldiv:
+      retval = "ldivide";
+      break;
+
+    case op_el_and:
+      retval = "and";
+      break;
+
+    case op_el_or:
+      retval = "or";
+      break;
+
+    default:
+      break;
+    }
+
+  return retval;
+}
+
+std::string
+octave_value::binary_op_fcn_name (compound_binary_op op)
+{
+  std::string retval;
+
+  switch (op)
+    {
+    case op_trans_mul:
+      retval = "transtimes";
+      break;
+
+    case op_mul_trans:
+      retval = "timestrans";
+      break;
+
+    case op_herm_mul:
+      retval = "hermtimes";
+      break;
+
+    case op_mul_herm:
+      retval = "timesherm";
+      break;
+
+    case op_trans_ldiv:
+      retval = "transldiv";
+      break;
+
+    case op_herm_ldiv:
+      retval = "hermldiv";
+      break;
+
+    case op_el_and_not:
+      retval = "andnot";
+      break;
+
+    case op_el_or_not:
+      retval = "ornot";
+      break;
+
+    case op_el_not_and:
+      retval = "notand";
+      break;
+
+    case op_el_not_or:
+      retval = "notor";
+      break;
+
+    default:
+      break;
+    }
+
+  return retval;
+}
+
+std::string
+octave_value::assign_op_as_string (assign_op op)
+{
+  std::string retval;
+
+  switch (op)
+    {
+    case op_asn_eq:
+      retval = "=";
+      break;
+
+    case op_add_eq:
+      retval = "+=";
+      break;
+
+    case op_sub_eq:
+      retval = "-=";
+      break;
+
+    case op_mul_eq:
+      retval = "*=";
+      break;
+
+    case op_div_eq:
+      retval = "/=";
+      break;
+
+    case op_ldiv_eq:
+      retval = "\\=";
+      break;
+
+    case op_pow_eq:
+      retval = "^=";
+      break;
+
+    case op_lshift_eq:
+      retval = "<<=";
+      break;
+
+    case op_rshift_eq:
+      retval = ">>=";
+      break;
+
+    case op_el_mul_eq:
+      retval = ".*=";
+      break;
+
+    case op_el_div_eq:
+      retval = "./=";
+      break;
+
+    case op_el_ldiv_eq:
+      retval = ".\\=";
+      break;
+
+    case op_el_pow_eq:
+      retval = ".^=";
+      break;
+
+    case op_el_and_eq:
+      retval = "&=";
+      break;
+
+    case op_el_or_eq:
+      retval = "|=";
+      break;
+
+    default:
+      retval = "<unknown>";
+    }
+
+  return retval;
+}
+
+octave_value::assign_op
+octave_value::binary_op_to_assign_op (binary_op op)
+{
+  assign_op retval;
+
+  switch (op)
+    {
+    case op_add:
+      retval = op_add_eq;
+      break;
+    case op_sub:
+      retval = op_sub_eq;
+      break;
+    case op_mul:
+      retval = op_mul_eq;
+      break;
+    case op_div:
+      retval = op_div_eq;
+      break;
+    case op_el_mul:
+      retval = op_el_mul_eq;
+      break;
+    case op_el_div:
+      retval = op_el_div_eq;
+      break;
+    case op_el_and:
+      retval = op_el_and_eq;
+      break;
+    case op_el_or:
+      retval = op_el_or_eq;
+      break;
+    default:
+      retval = unknown_assign_op;
+    }
+
+  return retval;
+}
+
+octave_value::octave_value (short int i)
+  : rep (new octave_scalar (i))
+{
+}
+
+octave_value::octave_value (unsigned short int i)
+  : rep (new octave_scalar (i))
+{
+}
+
+octave_value::octave_value (int i)
+  : rep (new octave_scalar (i))
+{
+}
+
+octave_value::octave_value (unsigned int i)
+  : rep (new octave_scalar (i))
+{
+}
+
+octave_value::octave_value (long int i)
+  : rep (new octave_scalar (i))
+{
+}
+
+octave_value::octave_value (unsigned long int i)
+  : rep (new octave_scalar (i))
+{
+}
+
+#if defined (HAVE_LONG_LONG_INT)
+octave_value::octave_value (long long int i)
+  : rep (new octave_scalar (i))
+{
+}
+#endif
+
+#if defined (HAVE_UNSIGNED_LONG_LONG_INT)
+octave_value::octave_value (unsigned long long int i)
+  : rep (new octave_scalar (i))
+{
+}
+#endif
+
+octave_value::octave_value (octave_time t)
+  : rep (new octave_scalar (t.double_value ()))
+{
+}
+
+octave_value::octave_value (double d)
+  : rep (new octave_scalar (d))
+{
+}
+
+octave_value::octave_value (float d)
+  : rep (new octave_float_scalar (d))
+{
+}
+
+octave_value::octave_value (const Cell& c, bool is_csl)
+  : rep (is_csl
+         ? dynamic_cast<octave_base_value *> (new octave_cs_list (c))
+         : dynamic_cast<octave_base_value *> (new octave_cell (c)))
+{
+}
+
+octave_value::octave_value (const Array<octave_value>& a, bool is_csl)
+  : rep (is_csl
+         ? dynamic_cast<octave_base_value *> (new octave_cs_list (Cell (a)))
+         : dynamic_cast<octave_base_value *> (new octave_cell (Cell (a))))
+{
+}
+
+octave_value::octave_value (const Matrix& m, const MatrixType& t)
+  : rep (new octave_matrix (m, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatMatrix& m, const MatrixType& t)
+  : rep (new octave_float_matrix (m, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const NDArray& a)
+  : rep (new octave_matrix (a))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatNDArray& a)
+  : rep (new octave_float_matrix (a))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<double>& a)
+  : rep (new octave_matrix (a))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<float>& a)
+  : rep (new octave_float_matrix (a))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const DiagMatrix& d)
+  : rep (new octave_diag_matrix (d))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatDiagMatrix& d)
+  : rep (new octave_float_diag_matrix (d))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const RowVector& v)
+  : rep (new octave_matrix (v))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatRowVector& v)
+  : rep (new octave_float_matrix (v))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const ColumnVector& v)
+  : rep (new octave_matrix (v))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatColumnVector& v)
+  : rep (new octave_float_matrix (v))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Complex& C)
+  : rep (new octave_complex (C))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatComplex& C)
+  : rep (new octave_float_complex (C))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const ComplexMatrix& m, const MatrixType& t)
+  : rep (new octave_complex_matrix (m, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatComplexMatrix& m, const MatrixType& t)
+  : rep (new octave_float_complex_matrix (m, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const ComplexNDArray& a)
+  : rep (new octave_complex_matrix (a))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatComplexNDArray& a)
+  : rep (new octave_float_complex_matrix (a))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<Complex>& a)
+  : rep (new octave_complex_matrix (a))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<FloatComplex>& a)
+  : rep (new octave_float_complex_matrix (a))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const ComplexDiagMatrix& d)
+  : rep (new octave_complex_diag_matrix (d))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatComplexDiagMatrix& d)
+  : rep (new octave_float_complex_diag_matrix (d))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const ComplexRowVector& v)
+  : rep (new octave_complex_matrix (v))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatComplexRowVector& v)
+  : rep (new octave_float_complex_matrix (v))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const ComplexColumnVector& v)
+  : rep (new octave_complex_matrix (v))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const FloatComplexColumnVector& v)
+  : rep (new octave_float_complex_matrix (v))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const PermMatrix& p)
+  : rep (new octave_perm_matrix (p))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (bool b)
+  : rep (new octave_bool (b))
+{
+}
+
+octave_value::octave_value (const boolMatrix& bm, const MatrixType& t)
+  : rep (new octave_bool_matrix (bm, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const boolNDArray& bnda)
+  : rep (new octave_bool_matrix (bnda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<bool>& bnda)
+  : rep (new octave_bool_matrix (bnda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (char c, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (c)
+         : new octave_char_matrix_sq_str (c))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const char *s, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (s)
+         : new octave_char_matrix_sq_str (s))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const std::string& s, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (s)
+         : new octave_char_matrix_sq_str (s))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const string_vector& s, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (s)
+         : new octave_char_matrix_sq_str (s))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const charMatrix& chm, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (chm)
+         : new octave_char_matrix_sq_str (chm))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const charNDArray& chm, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (chm)
+         : new octave_char_matrix_sq_str (chm))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<char>& chm, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (chm)
+         : new octave_char_matrix_sq_str (chm))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const charMatrix& chm, bool, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (chm)
+         : new octave_char_matrix_sq_str (chm))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const charNDArray& chm, bool, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (chm)
+         : new octave_char_matrix_sq_str (chm))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<char>& chm, bool, char type)
+  : rep (type == '"'
+         ? new octave_char_matrix_dq_str (chm)
+         : new octave_char_matrix_sq_str (chm))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const SparseMatrix& m, const MatrixType &t)
+  : rep (new octave_sparse_matrix (m, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Sparse<double>& m, const MatrixType &t)
+  : rep (new octave_sparse_matrix (m, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const SparseComplexMatrix& m, const MatrixType &t)
+  : rep (new octave_sparse_complex_matrix (m, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Sparse<Complex>& m, const MatrixType &t)
+  : rep (new octave_sparse_complex_matrix (m, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const SparseBoolMatrix& bm, const MatrixType &t)
+  : rep (new octave_sparse_bool_matrix (bm, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Sparse<bool>& bm, const MatrixType &t)
+  : rep (new octave_sparse_bool_matrix (bm, t))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_int8& i)
+  : rep (new octave_int8_scalar (i))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_uint8& i)
+  : rep (new octave_uint8_scalar (i))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_int16& i)
+  : rep (new octave_int16_scalar (i))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_uint16& i)
+  : rep (new octave_uint16_scalar (i))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_int32& i)
+  : rep (new octave_int32_scalar (i))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_uint32& i)
+  : rep (new octave_uint32_scalar (i))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_int64& i)
+  : rep (new octave_int64_scalar (i))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_uint64& i)
+  : rep (new octave_uint64_scalar (i))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const int8NDArray& inda)
+  : rep (new octave_int8_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_int8>& inda)
+  : rep (new octave_int8_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const uint8NDArray& inda)
+  : rep (new octave_uint8_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_uint8>& inda)
+  : rep (new octave_uint8_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const int16NDArray& inda)
+  : rep (new octave_int16_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_int16>& inda)
+  : rep (new octave_int16_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const uint16NDArray& inda)
+  : rep (new octave_uint16_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_uint16>& inda)
+  : rep (new octave_uint16_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const int32NDArray& inda)
+  : rep (new octave_int32_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_int32>& inda)
+  : rep (new octave_int32_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const uint32NDArray& inda)
+  : rep (new octave_uint32_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_uint32>& inda)
+  : rep (new octave_uint32_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const int64NDArray& inda)
+  : rep (new octave_int64_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_int64>& inda)
+  : rep (new octave_int64_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const uint64NDArray& inda)
+  : rep (new octave_uint64_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_uint64>& inda)
+  : rep (new octave_uint64_matrix (inda))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<octave_idx_type>& inda, bool zero_based,
+                            bool cache_index)
+  : rep (new octave_matrix (inda, zero_based, cache_index))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const idx_vector& idx, bool lazy)
+  : rep ()
+{
+  double scalar;
+  Range range;
+  NDArray array;
+  boolNDArray mask;
+  idx_vector::idx_class_type idx_class;
+
+  if (lazy)
+    {
+      // Only make lazy indices out of ranges and index vectors.
+      switch (idx.idx_class ())
+        {
+        case idx_vector::class_range:
+        case idx_vector::class_vector:
+          rep = new octave_lazy_index (idx);
+          maybe_mutate ();
+          return;
+        default:
+          break;
+        }
+    }
+
+  idx.unconvert (idx_class, scalar, range, array, mask);
+
+  switch (idx_class)
+    {
+    case idx_vector::class_colon:
+      rep = new octave_magic_colon ();
+      break;
+    case idx_vector::class_range:
+      rep = new octave_range (range, idx);
+      break;
+    case idx_vector::class_scalar:
+      rep = new octave_scalar (scalar);
+      break;
+    case idx_vector::class_vector:
+      rep = new octave_matrix (array, idx);
+      break;
+    case idx_vector::class_mask:
+      rep = new octave_bool_matrix (mask, idx);
+      break;
+    default:
+      assert (false);
+      break;
+    }
+
+  // FIXME: needed?
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Array<std::string>& cellstr)
+  : rep (new octave_cell (cellstr))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (double base, double limit, double inc)
+  : rep (new octave_range (base, limit, inc))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Range& r)
+  : rep (new octave_range (r))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_map& m)
+  : rep (new octave_struct (m))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const octave_scalar_map& m)
+  : rep (new octave_scalar_struct (m))
+{
+}
+
+octave_value::octave_value (const Octave_map& m)
+  : rep (new octave_struct (m))
+{
+  maybe_mutate ();
+}
+
+octave_value::octave_value (const Octave_map& m, const std::string& id,
+                            const std::list<std::string>& plist)
+  : rep (new octave_class (m, id, plist))
+{
+}
+
+octave_value::octave_value (const octave_value_list& l, bool)
+  : rep (new octave_cs_list (l))
+{
+}
+
+octave_value::octave_value (octave_value::magic_colon)
+  : rep (new octave_magic_colon ())
+{
+}
+
+octave_value::octave_value (octave_base_value *new_rep, bool borrow)
+  : rep (new_rep)
+{
+  if (borrow)
+    rep->count++;
+}
+
+octave_value::octave_value (octave_base_value *new_rep, int xcount)
+  : rep (new_rep)
+{
+  rep->count = xcount;
+}
+
+octave_base_value *
+octave_value::clone (void) const
+{
+  return rep->clone ();
+}
+
+void
+octave_value::maybe_mutate (void)
+{
+  octave_base_value *tmp = rep->try_narrowing_conversion ();
+
+  if (tmp && tmp != rep)
+    {
+      if (--rep->count == 0)
+        delete rep;
+
+      rep = tmp;
+    }
+}
+
+octave_value
+octave_value::single_subsref (const std::string& type,
+                              const octave_value_list& idx)
+{
+  std::list<octave_value_list> i;
+
+  i.push_back (idx);
+
+  return rep->subsref (type, i);
+}
+
+octave_value_list
+octave_value::subsref (const std::string& type,
+                       const std::list<octave_value_list>& idx, int nargout)
+{
+  if (nargout == 1)
+    return rep->subsref (type, idx);
+  else
+    return rep->subsref (type, idx, nargout);
+}
+
+octave_value_list
+octave_value::subsref (const std::string& type,
+                       const std::list<octave_value_list>& idx, int nargout,
+                       const std::list<octave_lvalue> *lvalue_list)
+{
+  if (lvalue_list)
+    return rep->subsref (type, idx, nargout, lvalue_list);
+  else
+    return subsref (type, idx, nargout);
+}
+
+octave_value
+octave_value::next_subsref (const std::string& type,
+                            const std::list<octave_value_list>& idx,
+                            size_t skip)
+{
+  if (! error_state && idx.size () > skip)
+    {
+      std::list<octave_value_list> new_idx (idx);
+      for (size_t i = 0; i < skip; i++)
+        new_idx.erase (new_idx.begin ());
+      return subsref (type.substr (skip), new_idx);
+    }
+  else
+    return *this;
+}
+
+octave_value_list
+octave_value::next_subsref (int nargout, const std::string& type,
+                            const std::list<octave_value_list>& idx,
+                            size_t skip)
+{
+  if (! error_state && idx.size () > skip)
+    {
+      std::list<octave_value_list> new_idx (idx);
+      for (size_t i = 0; i < skip; i++)
+        new_idx.erase (new_idx.begin ());
+      return subsref (type.substr (skip), new_idx, nargout);
+    }
+  else
+    return *this;
+}
+
+octave_value
+octave_value::next_subsref (bool auto_add, const std::string& type,
+                            const std::list<octave_value_list>& idx,
+                            size_t skip)
+{
+  if (! error_state && idx.size () > skip)
+    {
+      std::list<octave_value_list> new_idx (idx);
+      for (size_t i = 0; i < skip; i++)
+        new_idx.erase (new_idx.begin ());
+      return subsref (type.substr (skip), new_idx, auto_add);
+    }
+  else
+    return *this;
+}
+
+octave_value_list
+octave_value::do_multi_index_op (int nargout, const octave_value_list& idx)
+{
+  return rep->do_multi_index_op (nargout, idx);
+}
+
+octave_value_list
+octave_value::do_multi_index_op (int nargout, const octave_value_list& idx,
+                                 const std::list<octave_lvalue> *lvalue_list)
+{
+  return rep->do_multi_index_op (nargout, idx, lvalue_list);
+}
+
+#if 0
+static void
+gripe_assign_failed (const std::string& on, const std::string& tn1,
+                     const std::string& tn2)
+{
+  error ("assignment failed for `%s %s %s'",
+         tn1.c_str (), on.c_str (), tn2.c_str ());
+}
+#endif
+
+static void
+gripe_assign_failed_or_no_method (const std::string& on,
+                                  const std::string& tn1,
+                                  const std::string& tn2)
+{
+  error ("assignment failed, or no method for `%s %s %s'",
+         tn1.c_str (), on.c_str (), tn2.c_str ());
+}
+
+octave_value
+octave_value::subsasgn (const std::string& type,
+                        const std::list<octave_value_list>& idx,
+                        const octave_value& rhs)
+{
+  return rep->subsasgn (type, idx, rhs);
+}
+
+octave_value
+octave_value::undef_subsasgn (const std::string& type,
+                              const std::list<octave_value_list>& idx,
+                              const octave_value& rhs)
+{
+  return rep->undef_subsasgn (type, idx, rhs);
+}
+
+octave_value&
+octave_value::assign (assign_op op, const std::string& type,
+                      const std::list<octave_value_list>& idx,
+                      const octave_value& rhs)
+{
+  octave_value retval;
+
+  make_unique ();
+
+  octave_value t_rhs = rhs;
+
+  if (op != op_asn_eq)
+    {
+      if (is_defined ())
+        {
+          octave_value t = subsref (type, idx);
+
+          if (! error_state)
+            {
+              binary_op binop = op_eq_to_binary_op (op);
+
+              if (! error_state)
+                t_rhs = do_binary_op (binop, t, rhs);
+            }
+        }
+      else
+        error ("in computed assignment A(index) OP= X, A must be defined first");
+    }
+
+  if (! error_state)
+    {
+      octave_value tmp = subsasgn (type, idx, t_rhs);
+
+      if (error_state)
+        gripe_assign_failed_or_no_method (assign_op_as_string (op_asn_eq),
+                                          type_name (), rhs.type_name ());
+      else
+        *this = tmp;
+    }
+
+  return *this;
+}
+
+octave_value&
+octave_value::assign (assign_op op, const octave_value& rhs)
+{
+  if (op == op_asn_eq)
+    // Regularize a null matrix if stored into a variable.
+    operator = (rhs.storable_value ());
+  else if (is_defined ())
+    {
+      octave_value_typeinfo::assign_op_fcn f = 0;
+
+      // Only attempt to operate in-place if this variable is unshared.
+      if (rep->count == 1)
+        {
+          int tthis = this->type_id ();
+          int trhs = rhs.type_id ();
+
+          f = octave_value_typeinfo::lookup_assign_op (op, tthis, trhs);
+        }
+
+      if (f)
+        {
+          try
+            {
+              f (*rep, octave_value_list (), *rhs.rep);
+              maybe_mutate (); // Usually unnecessary, but may be needed (complex arrays).
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        {
+
+          binary_op binop = op_eq_to_binary_op (op);
+
+          if (! error_state)
+            {
+              octave_value t = do_binary_op (binop, *this, rhs);
+
+              if (! error_state)
+                operator = (t);
+            }
+        }
+    }
+  else
+    error ("in computed assignment A OP= X, A must be defined first");
+
+  return *this;
+}
+
+octave_idx_type
+octave_value::length (void) const
+{
+  octave_idx_type retval = 0;
+
+  const dim_vector dv = dims ();
+
+  for (int i = 0; i < dv.length (); i++)
+    {
+      if (dv(i) == 0)
+        {
+          retval = 0;
+          break;
+        }
+
+      if (dv(i) > retval)
+        retval = dv(i);
+    }
+
+  return retval;
+}
+
+bool
+octave_value::is_equal (const octave_value& test) const
+{
+  bool retval = false;
+
+  // If there is no op_eq for these types, we can't compare values.
+
+  if (rows () == test.rows () && columns () == test.columns ())
+    {
+      octave_value tmp = do_binary_op (octave_value::op_eq, *this, test);
+
+      // Empty array also means a match.
+      if (! error_state && tmp.is_defined ())
+        retval = tmp.is_true () || tmp.is_empty ();
+    }
+
+  return retval;
+}
+
+Cell
+octave_value::cell_value (void) const
+{
+  return rep->cell_value ();
+}
+
+// Define the idx_type_value function here instead of in ov.h to avoid
+// needing definitions for the SIZEOF_X macros in ov.h.
+
+octave_idx_type
+octave_value::idx_type_value (bool req_int, bool frc_str_conv) const
+{
+#if SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_LONG
+  return long_value (req_int, frc_str_conv);
+#elif SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_INT
+  return int_value (req_int, frc_str_conv);
+#else
+#error "no octave_value extractor for octave_idx_type"
+#endif
+}
+
+octave_map
+octave_value::map_value (void) const
+{
+  return rep->map_value ();
+}
+
+octave_scalar_map
+octave_value::scalar_map_value (void) const
+{
+  return rep->scalar_map_value ();
+}
+
+octave_function *
+octave_value::function_value (bool silent) const
+{
+  return rep->function_value (silent);
+}
+
+octave_user_function *
+octave_value::user_function_value (bool silent) const
+{
+  return rep->user_function_value (silent);
+}
+
+octave_user_script *
+octave_value::user_script_value (bool silent) const
+{
+  return rep->user_script_value (silent);
+}
+
+octave_user_code *
+octave_value::user_code_value (bool silent) const
+{
+  return rep->user_code_value (silent);
+}
+
+octave_fcn_handle *
+octave_value::fcn_handle_value (bool silent) const
+{
+  return rep->fcn_handle_value (silent);
+}
+
+octave_fcn_inline *
+octave_value::fcn_inline_value (bool silent) const
+{
+  return rep->fcn_inline_value (silent);
+}
+
+octave_value_list
+octave_value::list_value (void) const
+{
+  return rep->list_value ();
+}
+
+static dim_vector
+make_vector_dims (const dim_vector& dv, bool force_vector_conversion,
+                  const std::string& my_type, const std::string& wanted_type)
+{
+  dim_vector retval (dv);
+  retval.chop_trailing_singletons ();
+  octave_idx_type nel = dv.numel ();
+
+  if (retval.length () > 2 || (retval(0) != 1 && retval(1) != 1))
+    {
+      if (!force_vector_conversion)
+        gripe_implicit_conversion ("Octave:array-to-vector",
+                                   my_type.c_str (), wanted_type.c_str ());
+      retval = dim_vector (nel, 1);
+    }
+
+  return retval;
+}
+
+ColumnVector
+octave_value::column_vector_value (bool force_string_conv,
+                                   bool frc_vec_conv) const
+{
+  return ColumnVector (vector_value (force_string_conv,
+                                     frc_vec_conv));
+}
+
+ComplexColumnVector
+octave_value::complex_column_vector_value (bool force_string_conv,
+                                           bool frc_vec_conv) const
+{
+  return ComplexColumnVector (complex_vector_value (force_string_conv,
+                                                    frc_vec_conv));
+}
+
+RowVector
+octave_value::row_vector_value (bool force_string_conv,
+                                bool frc_vec_conv) const
+{
+  return RowVector (vector_value (force_string_conv,
+                                  frc_vec_conv));
+}
+
+ComplexRowVector
+octave_value::complex_row_vector_value (bool force_string_conv,
+                                        bool frc_vec_conv) const
+{
+  return ComplexRowVector (complex_vector_value (force_string_conv,
+                                                 frc_vec_conv));
+}
+
+Array<double>
+octave_value::vector_value (bool force_string_conv,
+                            bool force_vector_conversion) const
+{
+  Array<double> retval = array_value (force_string_conv);
+
+  if (error_state)
+    return retval;
+  else
+    return retval.reshape (make_vector_dims (retval.dims (),
+                                             force_vector_conversion,
+                                             type_name (), "real vector"));
+}
+
+template <class T>
+static Array<int>
+convert_to_int_array (const Array<octave_int<T> >& A)
+{
+  Array<int> retval (A.dims ());
+  octave_idx_type n = A.numel ();
+
+  for (octave_idx_type i = 0; i < n; i++)
+    retval.xelem (i) = octave_int<int> (A.xelem (i));
+
+  return retval;
+}
+
+Array<int>
+octave_value::int_vector_value (bool force_string_conv, bool require_int,
+                                bool force_vector_conversion) const
+{
+  Array<int> retval;
+
+  if (is_integer_type ())
+    {
+      if (is_int32_type ())
+        retval = convert_to_int_array (int32_array_value ());
+      else if (is_int64_type ())
+        retval = convert_to_int_array (int64_array_value ());
+      else if (is_int16_type ())
+        retval = convert_to_int_array (int16_array_value ());
+      else if (is_int8_type ())
+        retval = convert_to_int_array (int8_array_value ());
+      else if (is_uint32_type ())
+        retval = convert_to_int_array (uint32_array_value ());
+      else if (is_uint64_type ())
+        retval = convert_to_int_array (uint64_array_value ());
+      else if (is_uint16_type ())
+        retval = convert_to_int_array (uint16_array_value ());
+      else if (is_uint8_type ())
+        retval = convert_to_int_array (uint8_array_value ());
+      else
+        retval = array_value (force_string_conv);
+    }
+  else
+    {
+      const NDArray a = array_value (force_string_conv);
+      if (! error_state)
+        {
+          if (require_int)
+            {
+              retval.resize (a.dims ());
+              for (octave_idx_type i = 0; i < a.numel (); i++)
+                {
+                  double ai = a.elem (i);
+                  int v = static_cast<int> (ai);
+                  if (ai == v)
+                    retval.xelem (i) = v;
+                  else
+                    {
+                      error_with_cfn ("conversion to integer value failed");
+                      break;
+                    }
+                }
+            }
+          else
+            retval = Array<int> (a);
+        }
+    }
+
+
+  if (error_state)
+    return retval;
+  else
+    return retval.reshape (make_vector_dims (retval.dims (),
+                                             force_vector_conversion,
+                                             type_name (), "integer vector"));
+}
+
+template <class T>
+static Array<octave_idx_type>
+convert_to_octave_idx_type_array (const Array<octave_int<T> >& A)
+{
+  Array<octave_idx_type> retval (A.dims ());
+  octave_idx_type n = A.numel ();
+
+  for (octave_idx_type i = 0; i < n; i++)
+    retval.xelem (i) = octave_int<octave_idx_type> (A.xelem (i));
+
+  return retval;
+}
+
+Array<octave_idx_type>
+octave_value::octave_idx_type_vector_value (bool require_int,
+                                            bool force_string_conv,
+                                            bool force_vector_conversion) const
+{
+  Array<octave_idx_type> retval;
+
+  if (is_integer_type ())
+    {
+      if (is_int32_type ())
+        retval = convert_to_octave_idx_type_array (int32_array_value ());
+      else if (is_int64_type ())
+        retval = convert_to_octave_idx_type_array (int64_array_value ());
+      else if (is_int16_type ())
+        retval = convert_to_octave_idx_type_array (int16_array_value ());
+      else if (is_int8_type ())
+        retval = convert_to_octave_idx_type_array (int8_array_value ());
+      else if (is_uint32_type ())
+        retval = convert_to_octave_idx_type_array (uint32_array_value ());
+      else if (is_uint64_type ())
+        retval = convert_to_octave_idx_type_array (uint64_array_value ());
+      else if (is_uint16_type ())
+        retval = convert_to_octave_idx_type_array (uint16_array_value ());
+      else if (is_uint8_type ())
+        retval = convert_to_octave_idx_type_array (uint8_array_value ());
+      else
+        retval = array_value (force_string_conv);
+    }
+  else
+    {
+      const NDArray a = array_value (force_string_conv);
+      if (! error_state)
+        {
+          if (require_int)
+            {
+              retval.resize (a.dims ());
+              for (octave_idx_type i = 0; i < a.numel (); i++)
+                {
+                  double ai = a.elem (i);
+                  octave_idx_type v = static_cast<octave_idx_type> (ai);
+                  if (ai == v)
+                    retval.xelem (i) = v;
+                  else
+                    {
+                      error_with_cfn ("conversion to integer value failed");
+                      break;
+                    }
+                }
+            }
+          else
+            retval = Array<octave_idx_type> (a);
+        }
+    }
+
+
+  if (error_state)
+    return retval;
+  else
+    return retval.reshape (make_vector_dims (retval.dims (),
+                                             force_vector_conversion,
+                                             type_name (), "integer vector"));
+}
+
+Array<Complex>
+octave_value::complex_vector_value (bool force_string_conv,
+                                    bool force_vector_conversion) const
+{
+  Array<Complex> retval = complex_array_value (force_string_conv);
+
+  if (error_state)
+    return retval;
+  else
+    return retval.reshape (make_vector_dims (retval.dims (),
+                                             force_vector_conversion,
+                                             type_name (), "complex vector"));
+}
+
+FloatColumnVector
+octave_value::float_column_vector_value (bool force_string_conv,
+                                         bool frc_vec_conv) const
+{
+  return FloatColumnVector (float_vector_value (force_string_conv,
+                                                frc_vec_conv));
+}
+
+FloatComplexColumnVector
+octave_value::float_complex_column_vector_value (bool force_string_conv,
+                                                 bool frc_vec_conv) const
+{
+  return FloatComplexColumnVector (float_complex_vector_value (force_string_conv,
+                                                               frc_vec_conv));
+}
+
+FloatRowVector
+octave_value::float_row_vector_value (bool force_string_conv,
+                                      bool frc_vec_conv) const
+{
+  return FloatRowVector (float_vector_value (force_string_conv,
+                                             frc_vec_conv));
+}
+
+FloatComplexRowVector
+octave_value::float_complex_row_vector_value (bool force_string_conv,
+                                              bool frc_vec_conv) const
+{
+  return FloatComplexRowVector (float_complex_vector_value (force_string_conv,
+                                                           frc_vec_conv));
+}
+
+Array<float>
+octave_value::float_vector_value (bool force_string_conv,
+                                  bool force_vector_conversion) const
+{
+  Array<float> retval = float_array_value (force_string_conv);
+
+  if (error_state)
+    return retval;
+  else
+    return retval.reshape (make_vector_dims (retval.dims (),
+                                             force_vector_conversion,
+                                             type_name (), "real vector"));
+}
+
+Array<FloatComplex>
+octave_value::float_complex_vector_value (bool force_string_conv,
+                                          bool force_vector_conversion) const
+{
+  Array<FloatComplex> retval = float_complex_array_value (force_string_conv);
+
+  if (error_state)
+    return retval;
+  else
+    return retval.reshape (make_vector_dims (retval.dims (),
+                                             force_vector_conversion,
+                                             type_name (), "complex vector"));
+}
+
+octave_value
+octave_value::storable_value (void) const
+{
+  octave_value retval = *this;
+  if (is_null_value ())
+    retval = octave_value (rep->empty_clone ());
+  else
+    retval.maybe_economize ();
+
+  return retval;
+}
+
+void
+octave_value::make_storable_value (void)
+{
+  if (is_null_value ())
+    {
+      octave_base_value *rc = rep->empty_clone ();
+      if (--rep->count == 0)
+        delete rep;
+      rep = rc;
+    }
+  else
+    maybe_economize ();
+}
+
+int
+octave_value::write (octave_stream& os, int block_size,
+                     oct_data_conv::data_type output_type, int skip,
+                     oct_mach_info::float_format flt_fmt) const
+{
+  return rep->write (os, block_size, output_type, skip, flt_fmt);
+}
+
+static void
+gripe_binary_op (const std::string& on, const std::string& tn1,
+                 const std::string& tn2)
+{
+  error ("binary operator `%s' not implemented for `%s' by `%s' operations",
+         on.c_str (), tn1.c_str (), tn2.c_str ());
+}
+
+static void
+gripe_binary_op_conv (const std::string& on)
+{
+  error ("type conversion failed for binary operator `%s'", on.c_str ());
+}
+
+octave_value
+do_binary_op (octave_value::binary_op op,
+              const octave_value& v1, const octave_value& v2)
+{
+  octave_value retval;
+
+  int t1 = v1.type_id ();
+  int t2 = v2.type_id ();
+
+  if (t1 == octave_class::static_type_id ()
+      || t2 == octave_class::static_type_id ())
+    {
+      octave_value_typeinfo::binary_class_op_fcn f
+        = octave_value_typeinfo::lookup_binary_class_op (op);
+
+      if (f)
+        {
+          try
+            {
+              retval = f (v1, v2);
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        gripe_binary_op (octave_value::binary_op_as_string (op),
+                         v1.class_name (), v2.class_name ());
+    }
+  else
+    {
+      // FIXME -- we need to handle overloading operators for built-in
+      // classes (double, char, int8, etc.)
+
+      octave_value_typeinfo::binary_op_fcn f
+        = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
+
+      if (f)
+        {
+          try
+            {
+              retval = f (*v1.rep, *v2.rep);
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        {
+          octave_value tv1;
+          octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
+
+          octave_value tv2;
+          octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
+
+          // Try biased (one-sided) conversions first.
+          if (cf2.type_id () >= 0 &&
+              octave_value_typeinfo::lookup_binary_op (op, t1, cf2.type_id ()))
+            cf1 = 0;
+          else if (cf1.type_id () >= 0 &&
+                   octave_value_typeinfo::lookup_binary_op (op, cf1.type_id (), t2))
+            cf2 = 0;
+
+          if (cf1)
+            {
+              octave_base_value *tmp = cf1 (*v1.rep);
+
+              if (tmp)
+                {
+                  tv1 = octave_value (tmp);
+                  t1 = tv1.type_id ();
+                }
+              else
+                {
+                  gripe_binary_op_conv (octave_value::binary_op_as_string (op));
+                  return retval;
+                }
+            }
+          else
+            tv1 = v1;
+
+          if (cf2)
+            {
+              octave_base_value *tmp = cf2 (*v2.rep);
+
+              if (tmp)
+                {
+                  tv2 = octave_value (tmp);
+                  t2 = tv2.type_id ();
+                }
+              else
+                {
+                  gripe_binary_op_conv (octave_value::binary_op_as_string (op));
+                  return retval;
+                }
+            }
+          else
+            tv2 = v2;
+
+          if (cf1 || cf2)
+            {
+              retval = do_binary_op (op, tv1, tv2);
+            }
+          else
+            {
+              //demote double -> single and try again
+              cf1 = tv1.numeric_demotion_function ();
+
+              cf2 = tv2.numeric_demotion_function ();
+
+              // Try biased (one-sided) conversions first.
+              if (cf2.type_id () >= 0
+                  && octave_value_typeinfo::lookup_binary_op (op, t1, cf2.type_id ()))
+                cf1 = 0;
+              else if (cf1.type_id () >= 0
+                       && octave_value_typeinfo::lookup_binary_op (op, cf1.type_id (), t2))
+                cf2 = 0;
+
+              if (cf1)
+                {
+                  octave_base_value *tmp = cf1 (*tv1.rep);
+
+                  if (tmp)
+                    {
+                      tv1 = octave_value (tmp);
+                      t1 = tv1.type_id ();
+                    }
+                  else
+                    {
+                      gripe_binary_op_conv (octave_value::binary_op_as_string (op));
+                      return retval;
+                    }
+                }
+
+              if (cf2)
+                {
+                  octave_base_value *tmp = cf2 (*tv2.rep);
+
+                  if (tmp)
+                    {
+                      tv2 = octave_value (tmp);
+                      t2 = tv2.type_id ();
+                    }
+                  else
+                    {
+                      gripe_binary_op_conv (octave_value::binary_op_as_string (op));
+                      return retval;
+                    }
+                }
+
+              if (cf1 || cf2)
+                {
+                  f = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
+
+                  if (f)
+                    {
+                      try
+                        {
+                          retval = f (*tv1.rep, *tv2.rep);
+                        }
+                      catch (octave_execution_exception)
+                        {
+                          gripe_library_execution_error ();
+                        }
+                    }
+                  else
+                    gripe_binary_op (octave_value::binary_op_as_string (op),
+                                     v1.type_name (), v2.type_name ());
+                }
+              else
+                gripe_binary_op (octave_value::binary_op_as_string (op),
+                                 v1.type_name (), v2.type_name ());
+            }
+        }
+    }
+
+  return retval;
+}
+
+static octave_value
+decompose_binary_op (octave_value::compound_binary_op op,
+                     const octave_value& v1, const octave_value& v2)
+{
+  octave_value retval;
+
+  switch (op)
+    {
+    case octave_value::op_trans_mul:
+      retval = do_binary_op (octave_value::op_mul,
+                             do_unary_op (octave_value::op_transpose, v1),
+                             v2);
+      break;
+    case octave_value::op_mul_trans:
+      retval = do_binary_op (octave_value::op_mul,
+                             v1,
+                             do_unary_op (octave_value::op_transpose, v2));
+      break;
+    case octave_value::op_herm_mul:
+      retval = do_binary_op (octave_value::op_mul,
+                             do_unary_op (octave_value::op_hermitian, v1),
+                             v2);
+      break;
+    case octave_value::op_mul_herm:
+      retval = do_binary_op (octave_value::op_mul,
+                             v1,
+                             do_unary_op (octave_value::op_hermitian, v2));
+      break;
+    case octave_value::op_trans_ldiv:
+      retval = do_binary_op (octave_value::op_ldiv,
+                             do_unary_op (octave_value::op_transpose, v1),
+                             v2);
+      break;
+    case octave_value::op_herm_ldiv:
+      retval = do_binary_op (octave_value::op_ldiv,
+                             do_unary_op (octave_value::op_hermitian, v1),
+                             v2);
+      break;
+    case octave_value::op_el_not_and:
+      retval = do_binary_op (octave_value::op_el_and,
+                             do_unary_op (octave_value::op_not, v1),
+                             v2);
+      break;
+    case octave_value::op_el_not_or:
+      retval = do_binary_op (octave_value::op_el_or,
+                             do_unary_op (octave_value::op_not, v1),
+                             v2);
+      break;
+    case octave_value::op_el_and_not:
+      retval = do_binary_op (octave_value::op_el_and,
+                             v1,
+                             do_unary_op (octave_value::op_not, v2));
+      break;
+    case octave_value::op_el_or_not:
+      retval = do_binary_op (octave_value::op_el_or,
+                             v1,
+                             do_unary_op (octave_value::op_not, v2));
+      break;
+    default:
+      error ("invalid compound operator");
+      break;
+    }
+
+  return retval;
+}
+
+octave_value
+do_binary_op (octave_value::compound_binary_op op,
+              const octave_value& v1, const octave_value& v2)
+{
+  octave_value retval;
+
+  int t1 = v1.type_id ();
+  int t2 = v2.type_id ();
+
+  if (t1 == octave_class::static_type_id ()
+      || t2 == octave_class::static_type_id ())
+    {
+      octave_value_typeinfo::binary_class_op_fcn f
+        = octave_value_typeinfo::lookup_binary_class_op (op);
+
+      if (f)
+        {
+          try
+            {
+              retval = f (v1, v2);
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        retval = decompose_binary_op (op, v1, v2);
+    }
+  else
+    {
+      octave_value_typeinfo::binary_op_fcn f
+        = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
+
+      if (f)
+        {
+          try
+            {
+              retval = f (*v1.rep, *v2.rep);
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        retval = decompose_binary_op (op, v1, v2);
+    }
+
+  return retval;
+}
+
+static void
+gripe_cat_op (const std::string& tn1, const std::string& tn2)
+{
+  error ("concatenation operator not implemented for `%s' by `%s' operations",
+         tn1.c_str (), tn2.c_str ());
+}
+
+static void
+gripe_cat_op_conv (void)
+{
+  error ("type conversion failed for concatenation operator");
+}
+
+octave_value
+do_cat_op (const octave_value& v1, const octave_value& v2,
+           const Array<octave_idx_type>& ra_idx)
+{
+  octave_value retval;
+
+  // Can't rapid return for concatenation with an empty object here as
+  // something like cat(1,[],single([]) must return the correct type.
+
+  int t1 = v1.type_id ();
+  int t2 = v2.type_id ();
+
+  octave_value_typeinfo::cat_op_fcn f
+    = octave_value_typeinfo::lookup_cat_op (t1, t2);
+
+  if (f)
+    {
+      try
+        {
+          retval = f (*v1.rep, *v2.rep, ra_idx);
+        }
+      catch (octave_execution_exception)
+        {
+          gripe_library_execution_error ();
+        }
+    }
+  else
+    {
+      octave_value tv1;
+      octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
+
+      octave_value tv2;
+      octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
+
+      // Try biased (one-sided) conversions first.
+      if (cf2.type_id () >= 0
+          && octave_value_typeinfo::lookup_cat_op (t1, cf2.type_id ()))
+        cf1 = 0;
+      else if (cf1.type_id () >= 0
+               && octave_value_typeinfo::lookup_cat_op (cf1.type_id (), t2))
+        cf2 = 0;
+
+      if (cf1)
+        {
+          octave_base_value *tmp = cf1 (*v1.rep);
+
+          if (tmp)
+            {
+              tv1 = octave_value (tmp);
+              t1 = tv1.type_id ();
+            }
+          else
+            {
+              gripe_cat_op_conv ();
+              return retval;
+            }
+        }
+      else
+        tv1 = v1;
+
+      if (cf2)
+        {
+          octave_base_value *tmp = cf2 (*v2.rep);
+
+          if (tmp)
+            {
+              tv2 = octave_value (tmp);
+              t2 = tv2.type_id ();
+            }
+          else
+            {
+              gripe_cat_op_conv ();
+              return retval;
+            }
+        }
+      else
+        tv2 = v2;
+
+      if (cf1 || cf2)
+        {
+          retval = do_cat_op (tv1, tv2, ra_idx);
+        }
+      else
+        gripe_cat_op (v1.type_name (), v2.type_name ());
+    }
+
+  return retval;
+}
+
+void
+octave_value::print_info (std::ostream& os, const std::string& prefix) const
+{
+  os << prefix << "type_name: " << type_name () << "\n"
+     << prefix << "count:     " << get_count () << "\n"
+     << prefix << "rep info:  ";
+
+  rep->print_info (os, prefix + " ");
+}
+
+static void
+gripe_unary_op (const std::string& on, const std::string& tn)
+{
+  error ("unary operator `%s' not implemented for `%s' operands",
+         on.c_str (), tn.c_str ());
+}
+
+static void
+gripe_unary_op_conv (const std::string& on)
+{
+  error ("type conversion failed for unary operator `%s'", on.c_str ());
+}
+
+octave_value
+do_unary_op (octave_value::unary_op op, const octave_value& v)
+{
+  octave_value retval;
+
+  int t = v.type_id ();
+
+  if (t == octave_class::static_type_id ())
+    {
+      octave_value_typeinfo::unary_class_op_fcn f
+        = octave_value_typeinfo::lookup_unary_class_op (op);
+
+      if (f)
+        {
+          try
+            {
+              retval = f (v);
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        gripe_unary_op (octave_value::unary_op_as_string (op),
+                        v.class_name ());
+    }
+  else
+    {
+      // FIXME -- we need to handle overloading operators for built-in
+      // classes (double, char, int8, etc.)
+
+      octave_value_typeinfo::unary_op_fcn f
+        = octave_value_typeinfo::lookup_unary_op (op, t);
+
+      if (f)
+        {
+          try
+            {
+              retval = f (*v.rep);
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        {
+          octave_value tv;
+          octave_base_value::type_conv_fcn cf
+            = v.numeric_conversion_function ();
+
+          if (cf)
+            {
+              octave_base_value *tmp = cf (*v.rep);
+
+              if (tmp)
+                {
+                  tv = octave_value (tmp);
+                  retval = do_unary_op (op, tv);
+                }
+              else
+                gripe_unary_op_conv (octave_value::unary_op_as_string (op));
+            }
+          else
+            gripe_unary_op (octave_value::unary_op_as_string (op),
+                            v.type_name ());
+        }
+    }
+
+  return retval;
+}
+
+static void
+gripe_unary_op_conversion_failed (const std::string& op,
+                                  const std::string& tn)
+{
+  error ("operator %s: type conversion for `%s' failed",
+         op.c_str (), tn.c_str ());
+}
+
+octave_value&
+octave_value::do_non_const_unary_op (unary_op op)
+{
+  if (op == op_incr || op == op_decr)
+    {
+      // We want the gripe just here, because in the other branch this should
+      // not happen, and if it did anyway (internal error), the message would
+      // be confusing.
+      if (is_undefined ())
+        {
+          std::string op_str = unary_op_as_string (op);
+          error ("in x%s or %sx, x must be defined first",
+                 op_str.c_str (), op_str.c_str ());
+          return *this;
+        }
+
+      // Genuine.
+      int t = type_id ();
+
+      octave_value_typeinfo::non_const_unary_op_fcn f
+        = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
+
+      if (f)
+        {
+          make_unique ();
+
+          try
+            {
+              f (*rep);
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        {
+          octave_base_value::type_conv_fcn cf = numeric_conversion_function ();
+
+          if (cf)
+            {
+              octave_base_value *tmp = cf (*rep);
+
+              if (tmp)
+                {
+                  octave_base_value *old_rep = rep;
+                  rep = tmp;
+
+                  t = type_id ();
+
+                  f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
+
+                  if (f)
+                    {
+                      try
+                        {
+                          f (*rep);
+                        }
+                      catch (octave_execution_exception)
+                        {
+                          gripe_library_execution_error ();
+                        }
+
+                      if (old_rep && --old_rep->count == 0)
+                        delete old_rep;
+                    }
+                  else
+                    {
+                      if (old_rep)
+                        {
+                          if (--rep->count == 0)
+                            delete rep;
+
+                          rep = old_rep;
+                        }
+
+                      gripe_unary_op (octave_value::unary_op_as_string (op),
+                                      type_name ());
+                    }
+                }
+              else
+                gripe_unary_op_conversion_failed
+                  (octave_value::unary_op_as_string (op), type_name ());
+            }
+          else
+            gripe_unary_op (octave_value::unary_op_as_string (op), type_name ());
+        }
+    }
+  else
+    {
+      // Non-genuine.
+      int t = type_id ();
+
+      octave_value_typeinfo::non_const_unary_op_fcn f = 0;
+
+      // Only attempt to operate in-place if this variable is unshared.
+      if (rep->count == 1)
+        f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
+
+      if (f)
+        {
+          try
+            {
+              f (*rep);
+            }
+          catch (octave_execution_exception)
+            {
+              gripe_library_execution_error ();
+            }
+        }
+      else
+        *this = do_unary_op (op, *this);
+    }
+
+  return *this;
+}
+
+octave_value&
+octave_value::do_non_const_unary_op (unary_op op, const std::string& type,
+                                     const std::list<octave_value_list>& idx)
+{
+  if (idx.empty ())
+    do_non_const_unary_op (op);
+  else
+    {
+      // FIXME -- only do the following stuff if we can't find a
+      // specific function to call to handle the op= operation for the
+      // types we have.
+
+      assign_op assop = unary_op_to_assign_op (op);
+
+      assign (assop, type, idx, 1.0);
+    }
+
+  return *this;
+}
+
+octave_value::assign_op
+octave_value::unary_op_to_assign_op (unary_op op)
+{
+  assign_op binop = unknown_assign_op;
+
+  switch (op)
+    {
+    case op_incr:
+      binop = op_add_eq;
+      break;
+
+    case op_decr:
+      binop = op_sub_eq;
+      break;
+
+    default:
+      {
+        std::string on = unary_op_as_string (op);
+        error ("operator %s: no assign operator found", on.c_str ());
+      }
+    }
+
+  return binop;
+}
+
+octave_value::binary_op
+octave_value::op_eq_to_binary_op (assign_op op)
+{
+  binary_op binop = unknown_binary_op;
+
+  switch (op)
+    {
+    case op_add_eq:
+      binop = op_add;
+      break;
+
+    case op_sub_eq:
+      binop = op_sub;
+      break;
+
+    case op_mul_eq:
+      binop = op_mul;
+      break;
+
+    case op_div_eq:
+      binop = op_div;
+      break;
+
+    case op_ldiv_eq:
+      binop = op_ldiv;
+      break;
+
+    case op_pow_eq:
+      binop = op_pow;
+      break;
+
+    case op_lshift_eq:
+      binop = op_lshift;
+      break;
+
+    case op_rshift_eq:
+      binop = op_rshift;
+      break;
+
+    case op_el_mul_eq:
+      binop = op_el_mul;
+      break;
+
+    case op_el_div_eq:
+      binop = op_el_div;
+      break;
+
+    case op_el_ldiv_eq:
+      binop = op_el_ldiv;
+      break;
+
+    case op_el_pow_eq:
+      binop = op_el_pow;
+      break;
+
+    case op_el_and_eq:
+      binop = op_el_and;
+      break;
+
+    case op_el_or_eq:
+      binop = op_el_or;
+      break;
+
+    default:
+      {
+        std::string on = assign_op_as_string (op);
+        error ("operator %s: no binary operator found", on.c_str ());
+      }
+    }
+
+  return binop;
+}
+
+octave_value
+octave_value::empty_conv (const std::string& type, const octave_value& rhs)
+{
+  octave_value retval;
+
+  if (type.length () > 0)
+    {
+      switch (type[0])
+        {
+        case '(':
+          {
+            if (type.length () > 1 && type[1] == '.')
+              retval = octave_map ();
+            else
+              retval = octave_value (rhs.empty_clone ());
+          }
+          break;
+
+        case '{':
+          retval = Cell ();
+          break;
+
+        case '.':
+          retval = octave_scalar_map ();
+          break;
+
+        default:
+          panic_impossible ();
+        }
+    }
+  else
+    retval = octave_value (rhs.empty_clone ());
+
+  return retval;
+}
+
+void
+install_types (void)
+{
+  octave_base_value::register_type ();
+  octave_cell::register_type ();
+  octave_scalar::register_type ();
+  octave_complex::register_type ();
+  octave_matrix::register_type ();
+  octave_diag_matrix::register_type ();
+  octave_complex_matrix::register_type ();
+  octave_complex_diag_matrix::register_type ();
+  octave_range::register_type ();
+  octave_bool::register_type ();
+  octave_bool_matrix::register_type ();
+  octave_char_matrix_str::register_type ();
+  octave_char_matrix_sq_str::register_type ();
+  octave_int8_scalar::register_type ();
+  octave_int16_scalar::register_type ();
+  octave_int32_scalar::register_type ();
+  octave_int64_scalar::register_type ();
+  octave_uint8_scalar::register_type ();
+  octave_uint16_scalar::register_type ();
+  octave_uint32_scalar::register_type ();
+  octave_uint64_scalar::register_type ();
+  octave_int8_matrix::register_type ();
+  octave_int16_matrix::register_type ();
+  octave_int32_matrix::register_type ();
+  octave_int64_matrix::register_type ();
+  octave_uint8_matrix::register_type ();
+  octave_uint16_matrix::register_type ();
+  octave_uint32_matrix::register_type ();
+  octave_uint64_matrix::register_type ();
+  octave_sparse_bool_matrix::register_type ();
+  octave_sparse_matrix::register_type ();
+  octave_sparse_complex_matrix::register_type ();
+  octave_struct::register_type ();
+  octave_scalar_struct::register_type ();
+  octave_class::register_type ();
+  octave_cs_list::register_type ();
+  octave_magic_colon::register_type ();
+  octave_builtin::register_type ();
+  octave_user_function::register_type ();
+  octave_dld_function::register_type ();
+  octave_fcn_handle::register_type ();
+  octave_fcn_inline::register_type ();
+  octave_float_scalar::register_type ();
+  octave_float_complex::register_type ();
+  octave_float_matrix::register_type ();
+  octave_float_diag_matrix::register_type ();
+  octave_float_complex_matrix::register_type ();
+  octave_float_complex_diag_matrix::register_type ();
+  octave_perm_matrix::register_type ();
+  octave_null_matrix::register_type ();
+  octave_null_str::register_type ();
+  octave_null_sq_str::register_type ();
+  octave_lazy_index::register_type ();
+  octave_oncleanup::register_type ();
+}
+
+DEFUN (sizeof, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} sizeof (@var{val})\n\
+Return the size of @var{val} in bytes.\n\
+@seealso{whos}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = args(0).byte_size ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!assert (sizeof (uint64 (ones (3))), 72)
+%!assert (sizeof (double (zeros (2,4))), 64)
+%!assert (sizeof ({"foo", "bar", "baaz"}), 10)
+*/
+
+static void
+decode_subscripts (const char* name, const octave_value& arg,
+                   std::string& type_string,
+                   std::list<octave_value_list>& idx)
+{
+  const octave_map m = arg.map_value ();
+
+  if (! error_state
+      && m.nfields () == 2 && m.contains ("type") && m.contains ("subs"))
+    {
+      octave_idx_type nel = m.numel ();
+
+      type_string = std::string (nel, '\0');
+      idx = std::list<octave_value_list> ();
+
+      if (nel == 0)
+        return;
+
+      const Cell type = m.contents ("type");
+      const Cell subs = m.contents ("subs");
+
+      for (int k = 0; k < nel; k++)
+        {
+          std::string item = type(k).string_value ();
+
+          if (! error_state)
+            {
+              if (item == "{}")
+                type_string[k] = '{';
+              else if (item == "()")
+                type_string[k] = '(';
+              else if (item == ".")
+                type_string[k] = '.';
+              else
+                {
+                  error ("%s: invalid indexing type `%s'", name, item.c_str ());
+                  return;
+                }
+            }
+          else
+            {
+              error ("%s: expecting type(%d) to be a character string",
+                     name, k+1);
+              return;
+            }
+
+          octave_value_list idx_item;
+
+          if (subs(k).is_string ())
+            idx_item(0) = subs(k);
+          else if (subs(k).is_cell ())
+            {
+              Cell subs_cell = subs(k).cell_value ();
+
+              for (int n = 0; n < subs_cell.length (); n++)
+                {
+                  if (subs_cell(n).is_string ()
+                      && subs_cell(n).string_value () == ":")
+                    idx_item(n) = octave_value(octave_value::magic_colon_t);
+                  else
+                    idx_item(n) = subs_cell(n);
+                }
+            }
+          else
+            {
+              error ("%s: expecting subs(%d) to be a character string or cell array",
+                     name, k+1);
+              return;
+            }
+
+          idx.push_back (idx_item);
+        }
+    }
+  else
+    error ("%s: second argument must be a structure with fields `type' and `subs'", name);
+}
+
+DEFUN (subsref, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} subsref (@var{val}, @var{idx})\n\
+Perform the subscripted element selection operation according to\n\
+the subscript specified by @var{idx}.\n\
+\n\
+The subscript @var{idx} is expected to be a structure array with\n\
+fields @samp{type} and @samp{subs}.  Valid values for @samp{type}\n\
+are @samp{\"()\"}, @samp{\"@{@}\"}, and @samp{\".\"}.\n\
+The @samp{subs} field may be either @samp{\":\"} or a cell array\n\
+of index values.\n\
+\n\
+The following example shows how to extract the two first columns of\n\
+a matrix\n\
+\n\
+@example\n\
+@group\n\
+val = magic (3)\n\
+    @result{} val = [ 8   1   6\n\
+               3   5   7\n\
+               4   9   2 ]\n\
+idx.type = \"()\";\n\
+idx.subs = @{\":\", 1:2@};\n\
+subsref (val, idx)\n\
+     @result{} [ 8   1\n\
+          3   5\n\
+          4   9 ]\n\
+@end group\n\
+@end example\n\
+\n\
+@noindent\n\
+Note that this is the same as writing @code{val(:,1:2)}.\n\
+\n\
+If @var{idx} is an empty structure array with fields @samp{type}\n\
+and @samp{subs}, return @var{val}.\n\
+@seealso{subsasgn, substruct}\n\
+@end deftypefn")
+{
+  octave_value_list retval;
+
+  if (args.length () == 2)
+    {
+      std::string type;
+      std::list<octave_value_list> idx;
+
+      decode_subscripts ("subsref", args(1), type, idx);
+
+      if (! error_state)
+        {
+          octave_value arg0 = args(0);
+
+          if (type.empty ())
+            retval = arg0;
+          else
+            retval = arg0.subsref (type, idx, nargout);
+        }
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+DEFUN (subsasgn, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} subsasgn (@var{val}, @var{idx}, @var{rhs})\n\
+Perform the subscripted assignment operation according to\n\
+the subscript specified by @var{idx}.\n\
+\n\
+The subscript @var{idx} is expected to be a structure array with\n\
+fields @samp{type} and @samp{subs}.  Valid values for @samp{type}\n\
+are @samp{\"()\"}, @samp{\"@{@}\"}, and @samp{\".\"}.\n\
+The @samp{subs} field may be either @samp{\":\"} or a cell array\n\
+of index values.\n\
+\n\
+The following example shows how to set the two first columns of a\n\
+3-by-3 matrix to zero.\n\
+\n\
+@example\n\
+@group\n\
+val = magic (3);\n\
+idx.type = \"()\";\n\
+idx.subs = @{\":\", 1:2@};\n\
+subsasgn (val, idx, 0)\n\
+     @result{}  [ 0   0   6\n\
+           0   0   7\n\
+           0   0   2 ]\n\
+@end group\n\
+@end example\n\
+\n\
+Note that this is the same as writing @code{val(:,1:2) = 0}.\n\
+\n\
+If @var{idx} is an empty structure array with fields @samp{type}\n\
+and @samp{subs}, return @var{rhs}.\n\
+@seealso{subsref, substruct}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 3)
+    {
+      std::string type;
+      std::list<octave_value_list> idx;
+
+      decode_subscripts ("subsasgn", args(1), type, idx);
+
+      if (! error_state)
+        {
+          if (type.empty ())
+            {
+              // Regularize a null matrix if stored into a variable.
+
+              retval = args(2).storable_value ();
+            }
+          else
+            {
+              octave_value arg0 = args(0);
+
+              arg0.make_unique ();
+
+              if (! error_state)
+                retval= arg0.subsasgn (type, idx, args(2));
+            }
+        }
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!test
+%! a = reshape ([1:25], 5,5);
+%! idx1 = substruct ("()", {3, 3});
+%! idx2 = substruct ("()", {2:2:5, 2:2:5});
+%! idx3 = substruct ("()", {":", [1,5]});
+%! idx4 = struct ("type", {}, "subs", {});
+%! assert (subsref (a, idx1), 13);
+%! assert (subsref (a, idx2), [7 17; 9 19]);
+%! assert (subsref (a, idx3), [1:5; 21:25]');
+%! assert (subsref (a, idx4), a);
+%! a = subsasgn (a, idx1, 0);
+%! a = subsasgn (a, idx2, 0);
+%! a = subsasgn (a, idx3, 0);
+%!# a = subsasgn (a, idx4, 0);
+%! b = [0    6   11   16    0
+%!      0    0   12    0    0
+%!      0    8    0   18    0
+%!      0    0   14    0    0
+%!      0   10   15   20    0];
+%! assert (a, b);
+
+%!test
+%! c = num2cell (reshape ([1:25],5,5));
+%! idx1 = substruct  ("{}", {3, 3});
+%! idx2 = substruct  ("()", {2:2:5, 2:2:5});
+%! idx3 = substruct  ("()", {":", [1,5]});
+%! idx2p = substruct ("{}", {2:2:5, 2:2:5});
+%! idx3p = substruct ("{}", {":", [1,5]});
+%! idx4 = struct ("type", {}, "subs", {});
+%! assert ({ subsref(c, idx1) }, {13});
+%! assert ({ subsref(c, idx2p) }, {7 9 17 19});
+%! assert ({ subsref(c, idx3p) }, num2cell ([1:5, 21:25]));
+%! assert (subsref (c, idx4), c);
+%! c = subsasgn (c, idx1, 0);
+%! c = subsasgn (c, idx2, 0);
+%! c = subsasgn (c, idx3, 0);
+%!# c = subsasgn (c, idx4, 0);
+%! d = {0    6   11   16    0
+%!      0    0   12    0    0
+%!      0    8    0   18    0
+%!      0    0   14    0    0
+%!      0   10   15   20    0};
+%! assert (c, d);
+
+%!test
+%! s.a = "ohai";
+%! s.b = "dere";
+%! s.c = 42;
+%! idx1 = substruct (".", "a");
+%! idx2 = substruct (".", "b");
+%! idx3 = substruct (".", "c");
+%! idx4 = struct ("type", {}, "subs", {});
+%! assert (subsref (s, idx1), "ohai");
+%! assert (subsref (s, idx2), "dere");
+%! assert (subsref (s, idx3), 42);
+%! assert (subsref (s, idx4), s);
+%! s = subsasgn (s, idx1, "Hello");
+%! s = subsasgn (s, idx2, "There");
+%! s = subsasgn (s, idx3, 163);
+%!# s = subsasgn (s, idx4, 163);
+%! t.a = "Hello";
+%! t.b = "There";
+%! t.c = 163;
+%! assert (s, t);
+*/
+
+DEFUN (is_sq_string, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} is_sq_string (@var{x})\n\
+Return true if @var{x} is a single-quoted character string.\n\
+@seealso{is_dq_string, ischar}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = args(0).is_sq_string ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!assert (is_sq_string ('foo'), true)
+%!assert (is_sq_string ("foo"), false)
+%!assert (is_sq_string (1.0), false)
+%!assert (is_sq_string ({2.0}), false)
+
+%!error is_sq_string ()
+%!error is_sq_string ('foo', 2)
+*/
+
+DEFUN (is_dq_string, args, ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} is_dq_string (@var{x})\n\
+Return true if @var{x} is a double-quoted character string.\n\
+@seealso{is_sq_string, ischar}\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    retval = args(0).is_dq_string ();
+  else
+    print_usage ();
+
+  return retval;
+}
+
+/*
+%!assert (is_dq_string ("foo"), true)
+%!assert (is_dq_string ('foo'), false)
+%!assert (is_dq_string (1.0), false)
+%!assert (is_dq_string ({2.0}), false)
+
+%!error is_dq_string ()
+%!error is_dq_string ("foo", 2)
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-value/ov.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1394 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+Copyright (C) 2009-2010 VZLU Prague
+
+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_value_h)
+#define octave_value_h 1
+
+#include <cstdlib>
+
+#include <iosfwd>
+#include <string>
+#include <list>
+
+#include "Range.h"
+#include "data-conv.h"
+#include "idx-vector.h"
+#include "mach-info.h"
+#include "mxarray.h"
+#include "mx-base.h"
+#include "oct-alloc.h"
+#include "oct-time.h"
+#include "str-vec.h"
+
+#include "oct-hdf5.h"
+#include "oct-sort.h"
+
+class Cell;
+class octave_map;
+class octave_scalar_map;
+class Octave_map;
+class octave_stream;
+class octave_function;
+class octave_user_function;
+class octave_fcn_handle;
+class octave_fcn_inline;
+class octave_value_list;
+class octave_lvalue;
+
+#include "ov-base.h"
+
+// Constants.
+
+class octave_value;
+
+class
+OCTINTERP_API
+octave_value
+{
+public:
+
+  enum unary_op
+  {
+    op_not,            // not
+    op_uplus,          // uplus
+    op_uminus,         // uminus
+    op_transpose,      // transpose
+    op_hermitian,      // ctranspose
+    op_incr,
+    op_decr,
+    num_unary_ops,
+    unknown_unary_op
+  };
+
+  enum binary_op
+  {
+    op_add,            // plus
+    op_sub,            // minus
+    op_mul,            // mtimes
+    op_div,            // mrdivide
+    op_pow,            // mpower
+    op_ldiv,           // mldivide
+    op_lshift,
+    op_rshift,
+    op_lt,             // lt
+    op_le,             // le
+    op_eq,             // eq
+    op_ge,             // ge
+    op_gt,             // gt
+    op_ne,             // ne
+    op_el_mul,         // times
+    op_el_div,         // rdivide
+    op_el_pow,         // power
+    op_el_ldiv,        // ldivide
+    op_el_and,         // and
+    op_el_or,          // or
+    op_struct_ref,
+    num_binary_ops,
+    unknown_binary_op
+  };
+
+  enum compound_binary_op
+  {
+    // ** compound operations **
+    op_trans_mul,
+    op_mul_trans,
+    op_herm_mul,
+    op_mul_herm,
+    op_trans_ldiv,
+    op_herm_ldiv,
+    op_el_not_and,
+    op_el_not_or,
+    op_el_and_not,
+    op_el_or_not,
+    num_compound_binary_ops,
+    unknown_compound_binary_op
+  };
+
+  enum assign_op
+  {
+    op_asn_eq,
+    op_add_eq,
+    op_sub_eq,
+    op_mul_eq,
+    op_div_eq,
+    op_ldiv_eq,
+    op_pow_eq,
+    op_lshift_eq,
+    op_rshift_eq,
+    op_el_mul_eq,
+    op_el_div_eq,
+    op_el_ldiv_eq,
+    op_el_pow_eq,
+    op_el_and_eq,
+    op_el_or_eq,
+    num_assign_ops,
+    unknown_assign_op
+  };
+
+  static assign_op binary_op_to_assign_op (binary_op);
+
+  static std::string unary_op_as_string (unary_op);
+  static std::string unary_op_fcn_name (unary_op);
+
+  static std::string binary_op_as_string (binary_op);
+  static std::string binary_op_fcn_name (binary_op);
+
+  static std::string binary_op_fcn_name (compound_binary_op);
+
+  static std::string assign_op_as_string (assign_op);
+
+  static octave_value empty_conv (const std::string& type,
+                                  const octave_value& rhs = octave_value ());
+
+  enum magic_colon { magic_colon_t };
+
+  octave_value (void)
+    {
+      static octave_base_value nil_rep;
+      rep = &nil_rep;
+      rep->count++;
+    }
+
+  octave_value (short int i);
+  octave_value (unsigned short int i);
+  octave_value (int i);
+  octave_value (unsigned int i);
+  octave_value (long int i);
+  octave_value (unsigned long int i);
+
+  // FIXME -- these are kluges.  They turn into doubles
+  // internally, which will break for very large values.  We just use
+  // them to store things like 64-bit ino_t, etc, and hope that those
+  // values are never actually larger than can be represented exactly
+  // in a double.
+
+#if defined (HAVE_LONG_LONG_INT)
+  octave_value (long long int i);
+#endif
+#if defined (HAVE_UNSIGNED_LONG_LONG_INT)
+  octave_value (unsigned long long int i);
+#endif
+
+  octave_value (octave_time t);
+  octave_value (double d);
+  octave_value (float d);
+  octave_value (const Array<octave_value>& a, bool is_cs_list = false);
+  octave_value (const Cell& c, bool is_cs_list = false);
+  octave_value (const Matrix& m, const MatrixType& t = MatrixType ());
+  octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType ());
+  octave_value (const NDArray& nda);
+  octave_value (const FloatNDArray& nda);
+  octave_value (const Array<double>& m);
+  octave_value (const Array<float>& m);
+  octave_value (const DiagMatrix& d);
+  octave_value (const FloatDiagMatrix& d);
+  octave_value (const RowVector& v);
+  octave_value (const FloatRowVector& v);
+  octave_value (const ColumnVector& v);
+  octave_value (const FloatColumnVector& v);
+  octave_value (const Complex& C);
+  octave_value (const FloatComplex& C);
+  octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType ());
+  octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixType ());
+  octave_value (const ComplexNDArray& cnda);
+  octave_value (const FloatComplexNDArray& cnda);
+  octave_value (const Array<Complex>& m);
+  octave_value (const Array<FloatComplex>& m);
+  octave_value (const ComplexDiagMatrix& d);
+  octave_value (const FloatComplexDiagMatrix& d);
+  octave_value (const ComplexRowVector& v);
+  octave_value (const FloatComplexRowVector& v);
+  octave_value (const ComplexColumnVector& v);
+  octave_value (const FloatComplexColumnVector& v);
+  octave_value (const PermMatrix& p);
+  octave_value (bool b);
+  octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType ());
+  octave_value (const boolNDArray& bnda);
+  octave_value (const Array<bool>& bnda);
+  octave_value (char c, char type = '\'');
+  octave_value (const char *s, char type = '\'');
+  octave_value (const std::string& s, char type = '\'');
+  octave_value (const string_vector& s, char type = '\'');
+  octave_value (const charMatrix& chm,  char type = '\'');
+  octave_value (const charNDArray& chnda, char type = '\'');
+  octave_value (const Array<char>& chnda, char type = '\'');
+  octave_value (const charMatrix& chm, bool is_string,
+                char type = '\'') GCC_ATTR_DEPRECATED;
+  octave_value (const charNDArray& chnda, bool is_string,
+                char type = '\'') GCC_ATTR_DEPRECATED;
+  octave_value (const Array<char>& chnda, bool is_string,
+                char type = '\'') GCC_ATTR_DEPRECATED;
+  octave_value (const SparseMatrix& m, const MatrixType& t = MatrixType ());
+  octave_value (const Sparse<double>& m, const MatrixType& t = MatrixType ());
+  octave_value (const SparseComplexMatrix& m,
+                const MatrixType& t = MatrixType ());
+  octave_value (const Sparse<Complex>& m, const MatrixType& t = MatrixType ());
+  octave_value (const SparseBoolMatrix& bm,
+                const MatrixType& t = MatrixType ());
+  octave_value (const Sparse<bool>& m, const MatrixType& t = MatrixType ());
+  octave_value (const octave_int8& i);
+  octave_value (const octave_int16& i);
+  octave_value (const octave_int32& i);
+  octave_value (const octave_int64& i);
+  octave_value (const octave_uint8& i);
+  octave_value (const octave_uint16& i);
+  octave_value (const octave_uint32& i);
+  octave_value (const octave_uint64& i);
+  octave_value (const int8NDArray& inda);
+  octave_value (const Array<octave_int8>& inda);
+  octave_value (const int16NDArray& inda);
+  octave_value (const Array<octave_int16>& inda);
+  octave_value (const int32NDArray& inda);
+  octave_value (const Array<octave_int32>& inda);
+  octave_value (const int64NDArray& inda);
+  octave_value (const Array<octave_int64>& inda);
+  octave_value (const uint8NDArray& inda);
+  octave_value (const Array<octave_uint8>& inda);
+  octave_value (const uint16NDArray& inda);
+  octave_value (const Array<octave_uint16>& inda);
+  octave_value (const uint32NDArray& inda);
+  octave_value (const Array<octave_uint32>& inda);
+  octave_value (const uint64NDArray& inda);
+  octave_value (const Array<octave_uint64>& inda);
+  octave_value (const Array<octave_idx_type>& inda,
+                bool zero_based = false, bool cache_index = false);
+  octave_value (const Array<std::string>& cellstr);
+  octave_value (const idx_vector& idx, bool lazy = true);
+  octave_value (double base, double limit, double inc);
+  octave_value (const Range& r);
+  octave_value (const octave_map& m);
+  octave_value (const octave_scalar_map& m);
+  octave_value (const Octave_map& m);
+  octave_value (const Octave_map& m, const std::string& id,
+                const std::list<std::string>& plist);
+  octave_value (const octave_value_list& m, bool = false);
+  octave_value (octave_value::magic_colon);
+
+  octave_value (octave_base_value *new_rep, bool borrow = false);
+  octave_value (octave_base_value *new_rep, int xcount) GCC_ATTR_DEPRECATED;
+
+  // Copy constructor.
+
+  octave_value (const octave_value& a)
+    {
+      rep = a.rep;
+      rep->count++;
+    }
+
+  // This should only be called for derived types.
+
+  octave_base_value *clone (void) const;
+
+  octave_base_value *empty_clone (void) const
+    { return rep->empty_clone (); }
+
+  // Delete the representation of this constant if the count drops to
+  // zero.
+
+  ~octave_value (void)
+  {
+    if (--rep->count == 0)
+      delete rep;
+  }
+
+  void make_unique (void)
+    {
+      if (rep->count > 1)
+        {
+          octave_base_value *r = rep->unique_clone ();
+
+          if (--rep->count == 0)
+            delete rep;
+
+          rep = r;
+        }
+    }
+
+  // This uniquifies the value if it is referenced by more than a certain
+  // number of shallow copies. This is useful for optimizations where we
+  // know a certain copy, typically within a cell array, to be obsolete.
+  void make_unique (int obsolete_copies)
+    {
+      if (rep->count > obsolete_copies + 1)
+        {
+          octave_base_value *r = rep->unique_clone ();
+
+          if (--rep->count == 0)
+            delete rep;
+
+          rep = r;
+        }
+    }
+
+  // Simple assignment.
+
+  octave_value& operator = (const octave_value& a)
+    {
+      if (rep != a.rep)
+        {
+          if (--rep->count == 0)
+            delete rep;
+
+          rep = a.rep;
+          rep->count++;
+        }
+
+      return *this;
+    }
+
+  octave_idx_type get_count (void) const { return rep->count; }
+
+  octave_base_value::type_conv_info numeric_conversion_function (void) const
+    { return rep->numeric_conversion_function (); }
+
+  octave_base_value::type_conv_info numeric_demotion_function (void) const
+    { return rep->numeric_demotion_function (); }
+
+  void maybe_mutate (void);
+
+  octave_value squeeze (void) const
+    { return rep->squeeze (); }
+
+  // The result of full().
+  octave_value full_value (void) const
+    { return rep->full_value (); }
+
+  octave_base_value *try_narrowing_conversion (void)
+    { return rep->try_narrowing_conversion (); }
+
+  // Close to dims (), but can be overloaded for classes.
+  Matrix size (void)
+    { return rep->size (); }
+
+  octave_idx_type numel (const octave_value_list& idx)
+    { return rep->numel (idx); }
+
+  octave_value single_subsref (const std::string& type,
+                               const octave_value_list& idx);
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx)
+    { return rep->subsref (type, idx); }
+
+  octave_value subsref (const std::string& type,
+                        const std::list<octave_value_list>& idx,
+                        bool auto_add)
+    { return rep->subsref (type, idx, auto_add); }
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout);
+
+  octave_value_list subsref (const std::string& type,
+                             const std::list<octave_value_list>& idx,
+                             int nargout,
+                             const std::list<octave_lvalue> *lvalue_list);
+
+  octave_value next_subsref (const std::string& type, const
+                             std::list<octave_value_list>& idx,
+                             size_t skip = 1);
+
+  octave_value_list next_subsref (int nargout,
+                                  const std::string& type, const
+                                  std::list<octave_value_list>& idx,
+                                  size_t skip = 1);
+
+  octave_value next_subsref (bool auto_add, const std::string& type, const
+                             std::list<octave_value_list>& idx,
+                             size_t skip = 1);
+
+  octave_value do_index_op (const octave_value_list& idx,
+                            bool resize_ok = false)
+    { return rep->do_index_op (idx, resize_ok); }
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& idx);
+
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& idx,
+                     const std::list<octave_lvalue> *lvalue_list);
+
+  octave_value subsasgn (const std::string& type,
+                                 const std::list<octave_value_list>& idx,
+                                 const octave_value& rhs);
+
+  octave_value undef_subsasgn (const std::string& type,
+                               const std::list<octave_value_list>& idx,
+                               const octave_value& rhs);
+
+  octave_value& assign (assign_op op, const std::string& type,
+                       const std::list<octave_value_list>& idx,
+                       const octave_value& rhs);
+
+  octave_value& assign (assign_op, const octave_value& rhs);
+
+  idx_vector index_vector (void) const
+    { return rep->index_vector (); }
+
+  // Size.
+
+  dim_vector dims (void) const
+    { return rep->dims (); }
+
+  octave_idx_type rows (void) const { return rep->rows (); }
+
+  octave_idx_type columns (void) const { return rep->columns (); }
+
+  octave_idx_type length (void) const;
+
+  int ndims (void) const { return rep->ndims (); }
+
+  bool all_zero_dims (void) const { return dims ().all_zero (); }
+
+  octave_idx_type numel (void) const
+    { return rep->numel (); }
+
+  octave_idx_type capacity (void) const
+    { return rep->capacity (); }
+
+  size_t byte_size (void) const
+    { return rep->byte_size (); }
+
+  octave_idx_type nnz (void) const { return rep->nnz (); }
+
+  octave_idx_type nzmax (void) const { return rep->nzmax (); }
+
+  octave_idx_type nfields (void) const { return rep->nfields (); }
+
+  octave_value reshape (const dim_vector& dv) const
+    { return rep->reshape (dv); }
+
+  octave_value permute (const Array<int>& vec, bool inv = false) const
+    { return rep->permute (vec, inv); }
+
+  octave_value ipermute (const Array<int>& vec) const
+    { return rep->permute (vec, true); }
+
+  octave_value resize (const dim_vector& dv, bool fill = false) const
+    { return rep->resize (dv, fill);}
+
+  MatrixType matrix_type (void) const
+  { return rep->matrix_type (); }
+
+  MatrixType matrix_type (const MatrixType& typ) const
+  { return rep->matrix_type (typ); }
+
+  // Does this constant have a type?  Both of these are provided since
+  // it is sometimes more natural to write is_undefined() instead of
+  // ! is_defined().
+
+  bool is_defined (void) const
+    { return rep->is_defined (); }
+
+  bool is_undefined (void) const
+    { return ! is_defined (); }
+
+  bool is_empty (void) const
+    { return rep->is_empty (); }
+
+  bool is_cell (void) const
+    { return rep->is_cell (); }
+
+  bool is_cellstr (void) const
+    { return rep->is_cellstr (); }
+
+  bool is_real_scalar (void) const
+    { return rep->is_real_scalar (); }
+
+  bool is_real_matrix (void) const
+    { return rep->is_real_matrix (); }
+
+  bool is_real_nd_array (void) const
+    { return rep->is_real_nd_array (); }
+
+  bool is_complex_scalar (void) const
+    { return rep->is_complex_scalar (); }
+
+  bool is_complex_matrix (void) const
+    { return rep->is_complex_matrix (); }
+
+  bool is_bool_scalar (void) const
+    { return rep->is_bool_scalar (); }
+
+  bool is_bool_matrix (void) const
+    { return rep->is_bool_matrix (); }
+
+  bool is_char_matrix (void) const
+    { return rep->is_char_matrix (); }
+
+  bool is_diag_matrix (void) const
+    { return rep->is_diag_matrix (); }
+
+  bool is_perm_matrix (void) const
+    { return rep->is_perm_matrix (); }
+
+  bool is_string (void) const
+    { return rep->is_string (); }
+
+  bool is_sq_string (void) const
+    { return rep->is_sq_string (); }
+
+  bool is_dq_string (void) const
+    { return rep->is_string () && ! rep->is_sq_string (); }
+
+  bool is_range (void) const
+    { return rep->is_range (); }
+
+  bool is_map (void) const
+    { return rep->is_map (); }
+
+  bool is_object (void) const
+    { return rep->is_object (); }
+
+  bool is_cs_list (void) const
+    { return rep->is_cs_list (); }
+
+  bool is_magic_colon (void) const
+    { return rep->is_magic_colon (); }
+
+  bool is_null_value (void) const
+    { return rep->is_null_value (); }
+
+  // Are any or all of the elements in this constant nonzero?
+
+  octave_value all (int dim = 0) const
+    { return rep->all (dim); }
+
+  octave_value any (int dim = 0) const
+    { return rep->any (dim); }
+
+  builtin_type_t builtin_type (void) const
+    { return rep->builtin_type (); }
+
+  // Floating point types.
+
+  bool is_double_type (void) const
+    { return rep->is_double_type (); }
+
+  bool is_single_type (void) const
+    { return rep->is_single_type (); }
+
+  bool is_float_type (void) const
+    { return rep->is_float_type (); }
+
+  // Integer types.
+
+  bool is_int8_type (void) const
+    { return rep->is_int8_type (); }
+
+  bool is_int16_type (void) const
+    { return rep->is_int16_type (); }
+
+  bool is_int32_type (void) const
+    { return rep->is_int32_type (); }
+
+  bool is_int64_type (void) const
+   { return rep->is_int64_type (); }
+
+  bool is_uint8_type (void) const
+    { return rep->is_uint8_type (); }
+
+  bool is_uint16_type (void) const
+    { return rep->is_uint16_type (); }
+
+  bool is_uint32_type (void) const
+    { return rep->is_uint32_type (); }
+
+  bool is_uint64_type (void) const
+    { return rep->is_uint64_type (); }
+
+  // Other type stuff.
+
+  bool is_bool_type (void) const
+    { return rep->is_bool_type (); }
+
+  bool is_integer_type (void) const
+    { return rep->is_integer_type (); }
+
+  bool is_real_type (void) const
+    { return rep->is_real_type (); }
+
+  bool is_complex_type (void) const
+    { return rep->is_complex_type (); }
+
+  bool is_scalar_type (void) const
+    { return rep->is_scalar_type (); }
+
+  bool is_matrix_type (void) const
+    { return rep->is_matrix_type (); }
+
+  bool is_numeric_type (void) const
+    { return rep->is_numeric_type (); }
+
+  bool is_sparse_type (void) const
+    { return rep->is_sparse_type (); }
+
+  // Does this constant correspond to a truth value?
+
+  bool is_true (void) const
+    { return rep->is_true (); }
+
+  // Do two constants match (in a switch statement)?
+
+  bool is_equal (const octave_value&) const;
+
+  // Are the dimensions of this constant zero by zero?
+
+  bool is_zero_by_zero (void) const
+    { return (rows () == 0 && columns () == 0); }
+
+  bool is_constant (void) const
+    { return rep->is_constant (); }
+
+  bool is_function_handle (void) const
+    { return rep->is_function_handle (); }
+
+  bool is_anonymous_function (void) const
+    { return rep->is_anonymous_function (); }
+
+  bool is_inline_function (void) const
+    { return rep->is_inline_function (); }
+
+  bool is_function (void) const
+    { return rep->is_function (); }
+
+  bool is_user_script (void) const
+    { return rep->is_user_script (); }
+
+  bool is_user_function (void) const
+    { return rep->is_user_function (); }
+
+  bool is_user_code (void) const
+    { return rep->is_user_code (); }
+
+  bool is_builtin_function (void) const
+    { return rep->is_builtin_function (); }
+
+  bool is_dld_function (void) const
+    { return rep->is_dld_function (); }
+
+  bool is_mex_function (void) const
+    { return rep->is_mex_function (); }
+
+  void erase_subfunctions (void) { rep->erase_subfunctions (); }
+
+  // Values.
+
+  octave_value eval (void) { return *this; }
+
+  short int
+  short_value (bool req_int = false, bool frc_str_conv = false) const
+    { return rep->short_value (req_int, frc_str_conv); }
+
+  unsigned short int
+  ushort_value (bool req_int = false, bool frc_str_conv = false) const
+    { return rep->ushort_value (req_int, frc_str_conv); }
+
+  int int_value (bool req_int = false, bool frc_str_conv = false) const
+    { return rep->int_value (req_int, frc_str_conv); }
+
+  unsigned int
+  uint_value (bool req_int = false, bool frc_str_conv = false) const
+    { return rep->uint_value (req_int, frc_str_conv); }
+
+  int nint_value (bool frc_str_conv = false) const
+    { return rep->nint_value (frc_str_conv); }
+
+  long int
+  long_value (bool req_int = false, bool frc_str_conv = false) const
+    { return rep->long_value (req_int, frc_str_conv); }
+
+  unsigned long int
+  ulong_value (bool req_int = false, bool frc_str_conv = false) const
+    { return rep->ulong_value (req_int, frc_str_conv); }
+
+  octave_idx_type
+  idx_type_value (bool req_int = false, bool frc_str_conv = false) const;
+
+  double double_value (bool frc_str_conv = false) const
+    { return rep->double_value (frc_str_conv); }
+
+  float float_value (bool frc_str_conv = false) const
+    { return rep->float_value (frc_str_conv); }
+
+  double scalar_value (bool frc_str_conv = false) const
+    { return rep->scalar_value (frc_str_conv); }
+
+  float float_scalar_value (bool frc_str_conv = false) const
+    { return rep->float_scalar_value (frc_str_conv); }
+
+  Cell cell_value (void) const;
+
+  Matrix matrix_value (bool frc_str_conv = false) const
+    { return rep->matrix_value (frc_str_conv); }
+
+  FloatMatrix float_matrix_value (bool frc_str_conv = false) const
+    { return rep->float_matrix_value (frc_str_conv); }
+
+  NDArray array_value (bool frc_str_conv = false) const
+    { return rep->array_value (frc_str_conv); }
+
+  FloatNDArray float_array_value (bool frc_str_conv = false) const
+    { return rep->float_array_value (frc_str_conv); }
+
+  Complex complex_value (bool frc_str_conv = false) const
+    { return rep->complex_value (frc_str_conv); }
+
+  FloatComplex float_complex_value (bool frc_str_conv = false) const
+    { return rep->float_complex_value (frc_str_conv); }
+
+  ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const
+    { return rep->complex_matrix_value (frc_str_conv); }
+
+  FloatComplexMatrix float_complex_matrix_value (bool frc_str_conv = false) const
+    { return rep->float_complex_matrix_value (frc_str_conv); }
+
+  ComplexNDArray complex_array_value (bool frc_str_conv = false) const
+    { return rep->complex_array_value (frc_str_conv); }
+
+  FloatComplexNDArray float_complex_array_value (bool frc_str_conv = false) const
+    { return rep->float_complex_array_value (frc_str_conv); }
+
+  bool bool_value (bool warn = false) const
+    { return rep->bool_value (warn); }
+
+  boolMatrix bool_matrix_value (bool warn = false) const
+    { return rep->bool_matrix_value (warn); }
+
+  boolNDArray bool_array_value (bool warn = false) const
+    { return rep->bool_array_value (warn); }
+
+  charMatrix char_matrix_value (bool frc_str_conv = false) const
+    { return rep->char_matrix_value (frc_str_conv); }
+
+  charNDArray char_array_value (bool frc_str_conv = false) const
+    { return rep->char_array_value (frc_str_conv); }
+
+  SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const
+    { return rep->sparse_matrix_value (frc_str_conv); }
+
+  SparseComplexMatrix sparse_complex_matrix_value (bool frc_str_conv = false) const
+    { return rep->sparse_complex_matrix_value (frc_str_conv); }
+
+  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const
+    { return rep->sparse_bool_matrix_value (warn); }
+
+  DiagMatrix diag_matrix_value (bool force = false) const
+    { return rep->diag_matrix_value (force); }
+
+  FloatDiagMatrix float_diag_matrix_value (bool force = false) const
+    { return rep->float_diag_matrix_value (force); }
+
+  ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const
+    { return rep->complex_diag_matrix_value (force); }
+
+  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool force = false) const
+    { return rep->float_complex_diag_matrix_value (force); }
+
+  PermMatrix perm_matrix_value (void) const
+    { return rep->perm_matrix_value (); }
+
+  octave_int8 int8_scalar_value (void) const
+    { return rep->int8_scalar_value (); }
+
+  octave_int16 int16_scalar_value (void) const
+    { return rep->int16_scalar_value (); }
+
+  octave_int32 int32_scalar_value (void) const
+    { return rep->int32_scalar_value (); }
+
+  octave_int64 int64_scalar_value (void) const
+    { return rep->int64_scalar_value (); }
+
+  octave_uint8 uint8_scalar_value (void) const
+    { return rep->uint8_scalar_value (); }
+
+  octave_uint16 uint16_scalar_value (void) const
+    { return rep->uint16_scalar_value (); }
+
+  octave_uint32 uint32_scalar_value (void) const
+    { return rep->uint32_scalar_value (); }
+
+  octave_uint64 uint64_scalar_value (void) const
+    { return rep->uint64_scalar_value (); }
+
+  int8NDArray int8_array_value (void) const
+    { return rep->int8_array_value (); }
+
+  int16NDArray int16_array_value (void) const
+    { return rep->int16_array_value (); }
+
+  int32NDArray int32_array_value (void) const
+    { return rep->int32_array_value (); }
+
+  int64NDArray int64_array_value (void) const
+    { return rep->int64_array_value (); }
+
+  uint8NDArray uint8_array_value (void) const
+    { return rep->uint8_array_value (); }
+
+  uint16NDArray uint16_array_value (void) const
+    { return rep->uint16_array_value (); }
+
+  uint32NDArray uint32_array_value (void) const
+    { return rep->uint32_array_value (); }
+
+  uint64NDArray uint64_array_value (void) const
+    { return rep->uint64_array_value (); }
+
+  string_vector all_strings (bool pad = false) const
+    { return rep->all_strings (pad); }
+
+  std::string string_value (bool force = false) const
+    { return rep->string_value (force); }
+
+  Array<std::string> cellstr_value (void) const
+    { return rep->cellstr_value (); }
+
+  Range range_value (void) const
+    { return rep->range_value (); }
+
+  octave_map map_value (void) const;
+
+  octave_scalar_map scalar_map_value (void) const;
+
+  string_vector map_keys (void) const
+    { return rep->map_keys (); }
+
+  size_t nparents (void) const
+    { return rep->nparents (); }
+
+  std::list<std::string> parent_class_name_list (void) const
+    { return rep->parent_class_name_list (); }
+
+  string_vector parent_class_names (void) const
+    { return rep->parent_class_names (); }
+
+  octave_base_value *
+  find_parent_class (const std::string& parent_class_name)
+    { return rep->find_parent_class (parent_class_name); }
+
+  octave_function *function_value (bool silent = false) const;
+
+  octave_user_function *user_function_value (bool silent = false) const;
+
+  octave_user_script *user_script_value (bool silent = false) const;
+
+  octave_user_code *user_code_value (bool silent = false) const;
+
+  octave_fcn_handle *fcn_handle_value (bool silent = false) const;
+
+  octave_fcn_inline *fcn_inline_value (bool silent = false) const;
+
+  octave_value_list list_value (void) const;
+
+  ColumnVector column_vector_value (bool frc_str_conv = false,
+                             bool frc_vec_conv = false) const;
+
+  ComplexColumnVector
+  complex_column_vector_value (bool frc_str_conv = false,
+                        bool frc_vec_conv = false) const;
+
+  RowVector row_vector_value (bool frc_str_conv = false,
+                              bool frc_vec_conv = false) const;
+
+  ComplexRowVector
+  complex_row_vector_value (bool frc_str_conv = false,
+                            bool frc_vec_conv = false) const;
+
+
+  FloatColumnVector float_column_vector_value (bool frc_str_conv = false,
+                             bool frc_vec_conv = false) const;
+
+  FloatComplexColumnVector
+  float_complex_column_vector_value (bool frc_str_conv = false,
+                        bool frc_vec_conv = false) const;
+
+  FloatRowVector float_row_vector_value (bool frc_str_conv = false,
+                              bool frc_vec_conv = false) const;
+
+  FloatComplexRowVector
+  float_complex_row_vector_value (bool frc_str_conv = false,
+                            bool frc_vec_conv = false) const;
+
+
+
+
+  Array<int> int_vector_value (bool req_int = false,
+                               bool frc_str_conv = false,
+                               bool frc_vec_conv = false) const;
+
+  Array<octave_idx_type>
+  octave_idx_type_vector_value (bool req_int = false,
+                                bool frc_str_conv = false,
+                                bool frc_vec_conv = false) const;
+
+  Array<double> vector_value (bool frc_str_conv = false,
+                              bool frc_vec_conv = false) const;
+
+  Array<Complex> complex_vector_value (bool frc_str_conv = false,
+                                       bool frc_vec_conv = false) const;
+
+  Array<float> float_vector_value (bool frc_str_conv = false,
+                              bool frc_vec_conv = false) const;
+
+  Array<FloatComplex> float_complex_vector_value (bool frc_str_conv = false,
+                                       bool frc_vec_conv = false) const;
+
+  // Possibly economize a lazy-indexed value.
+
+  void maybe_economize (void)
+    { rep->maybe_economize (); }
+
+  // The following two hook conversions are called on any octave_value prior to
+  // storing it to a "permanent" location, like a named variable, a cell or a
+  // struct component, or a return value of a function.
+
+  octave_value storable_value (void) const;
+
+  // Ditto, but in place, i.e. equivalent to *this = this->storable_value (),
+  // but possibly more efficient.
+
+  void make_storable_value (void);
+
+  // Conversions.  These should probably be private.  If a user of this
+  // class wants a certain kind of constant, he should simply ask for
+  // it, and we should convert it if possible.
+
+  octave_value convert_to_str (bool pad = false, bool force = false,
+                               char type = '\'') const
+    { return rep->convert_to_str (pad, force, type); }
+
+  octave_value
+  convert_to_str_internal (bool pad, bool force, char type) const
+    { return rep->convert_to_str_internal (pad, force, type); }
+
+  void convert_to_row_or_column_vector (void)
+    { rep->convert_to_row_or_column_vector (); }
+
+  bool print_as_scalar (void) const
+    { return rep->print_as_scalar (); }
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false) const
+    { rep->print (os, pr_as_read_syntax); }
+
+  void print_raw (std::ostream& os,
+                          bool pr_as_read_syntax = false) const
+    { rep->print_raw (os, pr_as_read_syntax); }
+
+  bool print_name_tag (std::ostream& os, const std::string& name) const
+    { return rep->print_name_tag (os, name); }
+
+  void print_with_name (std::ostream& os, const std::string& name) const
+  { rep->print_with_name (os, name, true); }
+
+  int type_id (void) const { return rep->type_id (); }
+
+  std::string type_name (void) const { return rep->type_name (); }
+
+  std::string class_name (void) const { return rep->class_name (); }
+
+  // Unary and binary operations.
+
+  friend OCTINTERP_API octave_value do_unary_op (unary_op op,
+                                   const octave_value& a);
+
+  octave_value& do_non_const_unary_op (unary_op op);
+
+  octave_value& do_non_const_unary_op (unary_op op, const std::string& type,
+                                      const std::list<octave_value_list>& idx);
+
+  friend OCTINTERP_API octave_value do_binary_op (binary_op op,
+                                    const octave_value& a,
+                                    const octave_value& b);
+
+  friend OCTINTERP_API octave_value do_binary_op (compound_binary_op op,
+                                                  const octave_value& a,
+                                                  const octave_value& b);
+
+  friend OCTINTERP_API octave_value do_cat_op (const octave_value& a,
+                                 const octave_value& b,
+                                 const Array<octave_idx_type>& ra_idx);
+
+  const octave_base_value& get_rep (void) const { return *rep; }
+
+  bool is_copy_of (const octave_value &val) const { return rep == val.rep; }
+
+  void print_info (std::ostream& os,
+                           const std::string& prefix = std::string ()) const;
+
+  bool save_ascii (std::ostream& os) { return rep->save_ascii (os); }
+
+  bool load_ascii (std::istream& is) { return rep->load_ascii (is); }
+
+  bool save_binary (std::ostream& os, bool& save_as_floats)
+    { return rep->save_binary (os, save_as_floats); }
+
+  bool load_binary (std::istream& is, bool swap,
+                            oct_mach_info::float_format fmt)
+    { return rep->load_binary (is, swap, fmt); }
+
+#if defined (HAVE_HDF5)
+  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
+    { return rep->save_hdf5 (loc_id, name, save_as_floats); }
+
+  bool load_hdf5 (hid_t loc_id, const char *name)
+    { return rep->load_hdf5 (loc_id, name); }
+#endif
+
+  int write (octave_stream& os, int block_size,
+                     oct_data_conv::data_type output_type, int skip,
+                     oct_mach_info::float_format flt_fmt) const;
+
+  octave_base_value *internal_rep (void) const { return rep; }
+
+  // Unsafe.  These functions exist to support the MEX interface.
+  // You should not use them anywhere else.
+  void *mex_get_data (void) const { return rep->mex_get_data (); }
+
+  octave_idx_type *mex_get_ir (void) const { return rep->mex_get_ir (); }
+
+  octave_idx_type *mex_get_jc (void) const { return rep->mex_get_jc (); }
+
+  mxArray *as_mxArray (void) const { return rep->as_mxArray (); }
+
+  octave_value diag (octave_idx_type k = 0) const
+    { return rep->diag (k); }
+
+  octave_value diag (octave_idx_type m, octave_idx_type n) const
+    { return rep->diag (m, n); }
+
+  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
+    { return rep->sort (dim, mode); }
+  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+                 sortmode mode = ASCENDING) const
+    { return rep->sort (sidx, dim, mode); }
+
+  sortmode is_sorted (sortmode mode = UNSORTED) const
+    { return rep->is_sorted (mode); }
+
+  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
+    { return rep->sort_rows_idx (mode); }
+
+  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
+    { return rep->is_sorted_rows (mode); }
+
+  void lock (void) { rep->lock (); }
+
+  void unlock (void) { rep->unlock (); }
+
+  bool islocked (void) const { return rep->islocked (); }
+
+  void dump (std::ostream& os) const { rep->dump (os); }
+
+#define MAPPER_FORWARD(F) \
+  octave_value F (void) const { return rep->map (octave_base_value::umap_ ## F); }
+
+  MAPPER_FORWARD (abs)
+  MAPPER_FORWARD (acos)
+  MAPPER_FORWARD (acosh)
+  MAPPER_FORWARD (angle)
+  MAPPER_FORWARD (arg)
+  MAPPER_FORWARD (asin)
+  MAPPER_FORWARD (asinh)
+  MAPPER_FORWARD (atan)
+  MAPPER_FORWARD (atanh)
+  MAPPER_FORWARD (cbrt)
+  MAPPER_FORWARD (ceil)
+  MAPPER_FORWARD (conj)
+  MAPPER_FORWARD (cos)
+  MAPPER_FORWARD (cosh)
+  MAPPER_FORWARD (erf)
+  MAPPER_FORWARD (erfinv)
+  MAPPER_FORWARD (erfcinv)
+  MAPPER_FORWARD (erfc)
+  MAPPER_FORWARD (erfcx)
+  MAPPER_FORWARD (exp)
+  MAPPER_FORWARD (expm1)
+  MAPPER_FORWARD (finite)
+  MAPPER_FORWARD (fix)
+  MAPPER_FORWARD (floor)
+  MAPPER_FORWARD (gamma)
+  MAPPER_FORWARD (imag)
+  MAPPER_FORWARD (isinf)
+  MAPPER_FORWARD (isna)
+  MAPPER_FORWARD (isnan)
+  MAPPER_FORWARD (lgamma)
+  MAPPER_FORWARD (log)
+  MAPPER_FORWARD (log2)
+  MAPPER_FORWARD (log10)
+  MAPPER_FORWARD (log1p)
+  MAPPER_FORWARD (real)
+  MAPPER_FORWARD (round)
+  MAPPER_FORWARD (roundb)
+  MAPPER_FORWARD (signum)
+  MAPPER_FORWARD (sin)
+  MAPPER_FORWARD (sinh)
+  MAPPER_FORWARD (sqrt)
+  MAPPER_FORWARD (tan)
+  MAPPER_FORWARD (tanh)
+
+  // These functions are prefixed with X to avoid potential macro
+  // conflicts.
+
+  MAPPER_FORWARD (xisalnum)
+  MAPPER_FORWARD (xisalpha)
+  MAPPER_FORWARD (xisascii)
+  MAPPER_FORWARD (xiscntrl)
+  MAPPER_FORWARD (xisdigit)
+  MAPPER_FORWARD (xisgraph)
+  MAPPER_FORWARD (xislower)
+  MAPPER_FORWARD (xisprint)
+  MAPPER_FORWARD (xispunct)
+  MAPPER_FORWARD (xisspace)
+  MAPPER_FORWARD (xisupper)
+  MAPPER_FORWARD (xisxdigit)
+  MAPPER_FORWARD (xtoascii)
+  MAPPER_FORWARD (xtolower)
+  MAPPER_FORWARD (xtoupper)
+
+#undef MAPPER_FORWARD
+
+  octave_value map (octave_base_value::unary_mapper_t umap) const
+    { return rep->map (umap); }
+
+  // Extract the n-th element, aka val(n). Result is undefined if val is not an
+  // array type or n is out of range. Never error.
+  octave_value
+  fast_elem_extract (octave_idx_type n) const
+    { return rep->fast_elem_extract (n); }
+
+  // Assign the n-th element, aka val(n) = x. Returns false if val is not an
+  // array type, x is not a matching scalar type, or n is out of range.
+  // Never error.
+  virtual bool
+  fast_elem_insert (octave_idx_type n, const octave_value& x)
+    {
+      make_unique ();
+      return rep->fast_elem_insert (n, x);
+    }
+
+protected:
+
+  // The real representation.
+  octave_base_value *rep;
+
+private:
+
+  assign_op unary_op_to_assign_op (unary_op op);
+
+  binary_op op_eq_to_binary_op (assign_op op);
+
+  // This declaration protects against constructing octave_value from
+  // const octave_base_value* which actually silently calls octave_value (bool).
+  octave_value (const octave_base_value *);
+
+  DECLARE_OCTAVE_ALLOCATOR
+};
+
+// Publish externally used friend functions.
+
+extern OCTINTERP_API octave_value
+do_unary_op (octave_value::unary_op op, const octave_value& a);
+
+extern OCTINTERP_API octave_value
+do_binary_op (octave_value::binary_op op,
+              const octave_value& a, const octave_value& b);
+
+extern OCTINTERP_API octave_value
+do_binary_op (octave_value::compound_binary_op op,
+              const octave_value& a, const octave_value& b);
+
+#define OV_UNOP_FN(name) \
+  inline octave_value \
+  name (const octave_value& a) \
+  { \
+    return do_unary_op (octave_value::name, a); \
+  }
+
+#define OV_UNOP_OP(name, op) \
+  inline octave_value \
+  operator op (const octave_value& a) \
+  { \
+    return name (a); \
+  }
+
+#define OV_UNOP_FN_OP(name, op) \
+  OV_UNOP_FN (name) \
+  OV_UNOP_OP (name, op)
+
+OV_UNOP_FN_OP (op_not, !)
+OV_UNOP_FN_OP (op_uplus, +)
+OV_UNOP_FN_OP (op_uminus, -)
+
+OV_UNOP_FN (op_transpose)
+OV_UNOP_FN (op_hermitian)
+
+// No simple way to define these for prefix and suffix ops?
+//
+//   incr
+//   decr
+
+#define OV_BINOP_FN(name) \
+  inline octave_value \
+  name (const octave_value& a1, const octave_value& a2) \
+  { \
+    return do_binary_op (octave_value::name, a1, a2); \
+  }
+
+#define OV_BINOP_OP(name, op) \
+  inline octave_value \
+  operator op (const octave_value& a1, const octave_value& a2) \
+  { \
+    return name (a1, a2); \
+  }
+
+#define OV_BINOP_FN_OP(name, op) \
+  OV_BINOP_FN (name) \
+  OV_BINOP_OP (name, op)
+
+OV_BINOP_FN_OP (op_add, +)
+OV_BINOP_FN_OP (op_sub, -)
+OV_BINOP_FN_OP (op_mul, *)
+OV_BINOP_FN_OP (op_div, /)
+
+OV_BINOP_FN (op_pow)
+OV_BINOP_FN (op_ldiv)
+OV_BINOP_FN (op_lshift)
+OV_BINOP_FN (op_rshift)
+
+OV_BINOP_FN_OP (op_lt, <)
+OV_BINOP_FN_OP (op_le, <=)
+OV_BINOP_FN_OP (op_eq, ==)
+OV_BINOP_FN_OP (op_ge, >=)
+OV_BINOP_FN_OP (op_gt, >)
+OV_BINOP_FN_OP (op_ne, !=)
+
+OV_BINOP_FN (op_el_mul)
+OV_BINOP_FN (op_el_div)
+OV_BINOP_FN (op_el_pow)
+OV_BINOP_FN (op_el_ldiv)
+OV_BINOP_FN (op_el_and)
+OV_BINOP_FN (op_el_or)
+
+OV_BINOP_FN (op_struct_ref)
+
+#define OV_COMP_BINOP_FN(name) \
+  inline octave_value \
+  name (const octave_value& a1, const octave_value& a2) \
+  { \
+    return do_binary_op (octave_value::name, a1, a2); \
+  }
+
+OV_COMP_BINOP_FN (op_trans_mul)
+OV_COMP_BINOP_FN (op_mul_trans)
+OV_COMP_BINOP_FN (op_herm_mul)
+OV_COMP_BINOP_FN (op_mul_herm)
+
+extern OCTINTERP_API void install_types (void);
+
+// This will eventually go away, but for now it can be used to
+// simplify the transition to the new octave_value class hierarchy,
+// which uses octave_base_value instead of octave_value for the type
+// of octave_value::rep.
+#define OV_REP_TYPE octave_base_value
+
+// Templated value extractors.
+template<class Value>
+inline Value octave_value_extract (const octave_value&)
+  { assert (false); }
+
+#define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \
+template<> \
+inline VALUE octave_value_extract<VALUE> (const octave_value& v) \
+  { return v.MPREFIX ## _value (); }
+
+DEF_VALUE_EXTRACTOR (double, scalar)
+DEF_VALUE_EXTRACTOR (float, float_scalar)
+DEF_VALUE_EXTRACTOR (Complex, complex)
+DEF_VALUE_EXTRACTOR (FloatComplex, float_complex)
+DEF_VALUE_EXTRACTOR (bool, bool)
+
+DEF_VALUE_EXTRACTOR (octave_int8, int8_scalar)
+DEF_VALUE_EXTRACTOR (octave_int16, int16_scalar)
+DEF_VALUE_EXTRACTOR (octave_int32, int32_scalar)
+DEF_VALUE_EXTRACTOR (octave_int64, int64_scalar)
+DEF_VALUE_EXTRACTOR (octave_uint8, uint8_scalar)
+DEF_VALUE_EXTRACTOR (octave_uint16, uint16_scalar)
+DEF_VALUE_EXTRACTOR (octave_uint32, uint32_scalar)
+DEF_VALUE_EXTRACTOR (octave_uint64, uint64_scalar)
+
+
+DEF_VALUE_EXTRACTOR (NDArray, array)
+DEF_VALUE_EXTRACTOR (FloatNDArray, float_array)
+DEF_VALUE_EXTRACTOR (ComplexNDArray, complex_array)
+DEF_VALUE_EXTRACTOR (FloatComplexNDArray, float_complex_array)
+DEF_VALUE_EXTRACTOR (boolNDArray, bool_array)
+
+DEF_VALUE_EXTRACTOR (charNDArray, char_array)
+DEF_VALUE_EXTRACTOR (int8NDArray, int8_array)
+DEF_VALUE_EXTRACTOR (int16NDArray, int16_array)
+DEF_VALUE_EXTRACTOR (int32NDArray, int32_array)
+DEF_VALUE_EXTRACTOR (int64NDArray, int64_array)
+DEF_VALUE_EXTRACTOR (uint8NDArray, uint8_array)
+DEF_VALUE_EXTRACTOR (uint16NDArray, uint16_array)
+DEF_VALUE_EXTRACTOR (uint32NDArray, uint32_array)
+DEF_VALUE_EXTRACTOR (uint64NDArray, uint64_array)
+
+DEF_VALUE_EXTRACTOR (Matrix, matrix)
+DEF_VALUE_EXTRACTOR (FloatMatrix, float_matrix)
+DEF_VALUE_EXTRACTOR (ComplexMatrix, complex_matrix)
+DEF_VALUE_EXTRACTOR (FloatComplexMatrix, float_complex_matrix)
+DEF_VALUE_EXTRACTOR (boolMatrix, bool_matrix)
+
+DEF_VALUE_EXTRACTOR (ColumnVector, column_vector)
+DEF_VALUE_EXTRACTOR (FloatColumnVector, float_column_vector)
+DEF_VALUE_EXTRACTOR (ComplexColumnVector, complex_column_vector)
+DEF_VALUE_EXTRACTOR (FloatComplexColumnVector, float_complex_column_vector)
+
+DEF_VALUE_EXTRACTOR (RowVector, row_vector)
+DEF_VALUE_EXTRACTOR (FloatRowVector, float_row_vector)
+DEF_VALUE_EXTRACTOR (ComplexRowVector, complex_row_vector)
+DEF_VALUE_EXTRACTOR (FloatComplexRowVector, float_complex_row_vector)
+
+DEF_VALUE_EXTRACTOR (DiagMatrix, diag_matrix)
+DEF_VALUE_EXTRACTOR (FloatDiagMatrix, float_diag_matrix)
+DEF_VALUE_EXTRACTOR (ComplexDiagMatrix, complex_diag_matrix)
+DEF_VALUE_EXTRACTOR (FloatComplexDiagMatrix, float_complex_diag_matrix)
+DEF_VALUE_EXTRACTOR (PermMatrix, perm_matrix)
+
+DEF_VALUE_EXTRACTOR (SparseMatrix, sparse_matrix)
+DEF_VALUE_EXTRACTOR (SparseComplexMatrix, sparse_complex_matrix)
+DEF_VALUE_EXTRACTOR (SparseBoolMatrix, sparse_bool_matrix)
+#undef DEF_VALUE_EXTRACTOR
+
+#define DEF_DUMMY_VALUE_EXTRACTOR(VALUE,DEFVAL) \
+template<> \
+inline VALUE octave_value_extract<VALUE> (const octave_value&) \
+  { assert (false); return DEFVAL; }
+
+DEF_DUMMY_VALUE_EXTRACTOR (char, 0)
+DEF_DUMMY_VALUE_EXTRACTOR (octave_value, octave_value ())
+#undef DEF_DUMMY_VALUE_EXTRACTOR
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/module.mk	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,136 @@
+EXTRA_DIST += operators/module.mk
+
+OPERATORS_SRC = \
+  operators/op-b-b.cc \
+  operators/op-b-bm.cc \
+  operators/op-b-sbm.cc \
+  operators/op-bm-b.cc \
+  operators/op-bm-bm.cc \
+  operators/op-bm-sbm.cc \
+  operators/op-cdm-cdm.cc \
+  operators/op-cdm-cm.cc \
+  operators/op-cdm-cs.cc \
+  operators/op-cdm-dm.cc \
+  operators/op-cdm-m.cc \
+  operators/op-cdm-s.cc \
+  operators/op-cell.cc \
+  operators/op-chm.cc \
+  operators/op-class.cc \
+  operators/op-cm-cdm.cc \
+  operators/op-cm-cm.cc \
+  operators/op-cm-cs.cc \
+  operators/op-cm-dm.cc \
+  operators/op-cm-m.cc \
+  operators/op-cm-pm.cc \
+  operators/op-cm-s.cc \
+  operators/op-cm-scm.cc \
+  operators/op-cm-sm.cc \
+  operators/op-cs-cm.cc \
+  operators/op-cs-cs.cc \
+  operators/op-cs-m.cc \
+  operators/op-cs-s.cc \
+  operators/op-cs-scm.cc \
+  operators/op-cs-sm.cc \
+  operators/op-dm-cdm.cc \
+  operators/op-dm-cm.cc \
+  operators/op-dm-cs.cc \
+  operators/op-dm-dm.cc \
+  operators/op-dm-m.cc \
+  operators/op-dm-s.cc \
+  operators/op-dm-scm.cc \
+  operators/op-dm-sm.cc \
+  operators/op-double-conv.cc \
+  operators/op-fcdm-fcdm.cc \
+  operators/op-fcdm-fcm.cc \
+  operators/op-fcdm-fcs.cc \
+  operators/op-fcdm-fdm.cc \
+  operators/op-fcdm-fm.cc \
+  operators/op-fcdm-fs.cc \
+  operators/op-fcm-fcdm.cc \
+  operators/op-fcm-fcm.cc \
+  operators/op-fcm-fcs.cc \
+  operators/op-fcm-fdm.cc \
+  operators/op-fcm-fm.cc \
+  operators/op-fcm-fs.cc \
+  operators/op-fcm-pm.cc \
+  operators/op-fcn.cc \
+  operators/op-fcs-fcm.cc \
+  operators/op-fcs-fcs.cc \
+  operators/op-fcs-fm.cc \
+  operators/op-fcs-fs.cc \
+  operators/op-fdm-fcdm.cc \
+  operators/op-fdm-fcm.cc \
+  operators/op-fdm-fcs.cc \
+  operators/op-fdm-fdm.cc \
+  operators/op-fdm-fm.cc \
+  operators/op-fdm-fs.cc \
+  operators/op-float-conv.cc \
+  operators/op-fm-fcdm.cc \
+  operators/op-fm-fcm.cc \
+  operators/op-fm-fcs.cc \
+  operators/op-fm-fdm.cc \
+  operators/op-fm-fm.cc \
+  operators/op-fm-fs.cc \
+  operators/op-fm-pm.cc \
+  operators/op-fs-fcm.cc \
+  operators/op-fs-fcs.cc \
+  operators/op-fs-fm.cc \
+  operators/op-fs-fs.cc \
+  operators/op-i16-i16.cc \
+  operators/op-i32-i32.cc \
+  operators/op-i64-i64.cc \
+  operators/op-i8-i8.cc \
+  operators/op-int-concat.cc \
+  operators/op-int-conv.cc \
+  operators/op-m-cdm.cc \
+  operators/op-m-cm.cc \
+  operators/op-m-cs.cc \
+  operators/op-m-dm.cc \
+  operators/op-m-m.cc \
+  operators/op-m-pm.cc \
+  operators/op-m-s.cc \
+  operators/op-m-scm.cc \
+  operators/op-m-sm.cc \
+  operators/op-pm-cm.cc \
+  operators/op-pm-fcm.cc \
+  operators/op-pm-fm.cc \
+  operators/op-pm-m.cc \
+  operators/op-pm-pm.cc \
+  operators/op-pm-scm.cc \
+  operators/op-pm-sm.cc \
+  operators/op-range.cc \
+  operators/op-s-cm.cc \
+  operators/op-s-cs.cc \
+  operators/op-s-m.cc \
+  operators/op-s-s.cc \
+  operators/op-s-scm.cc \
+  operators/op-s-sm.cc \
+  operators/op-sbm-b.cc \
+  operators/op-sbm-bm.cc \
+  operators/op-sbm-sbm.cc \
+  operators/op-scm-cm.cc \
+  operators/op-scm-cs.cc \
+  operators/op-scm-m.cc \
+  operators/op-scm-s.cc \
+  operators/op-scm-scm.cc \
+  operators/op-scm-sm.cc \
+  operators/op-sm-cm.cc \
+  operators/op-sm-cs.cc \
+  operators/op-sm-m.cc \
+  operators/op-sm-s.cc \
+  operators/op-sm-scm.cc \
+  operators/op-sm-sm.cc \
+  operators/op-str-m.cc \
+  operators/op-str-s.cc \
+  operators/op-str-str.cc \
+  operators/op-struct.cc \
+  operators/op-ui16-ui16.cc \
+  operators/op-ui32-ui32.cc \
+  operators/op-ui64-ui64.cc \
+  operators/op-ui8-ui8.cc
+
+octinclude_HEADERS += \
+  operators/op-dm-template.cc \
+  operators/op-dms-template.cc \
+  operators/op-int.h \
+  operators/op-pm-template.cc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-b-b.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,95 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// bool unary ops.
+
+// scalar unary ops.
+
+DEFUNOP_OP (not, bool, !)
+
+UNOPDECL (uplus, a)
+{
+  CAST_UNOP_ARG (const octave_bool&);
+  return octave_value (v.double_value ());
+}
+
+UNOPDECL (uminus, a)
+{
+  CAST_UNOP_ARG (const octave_bool&);
+  return octave_value (- v.double_value ());
+}
+
+DEFUNOP_OP (transpose, bool, /* no-op */)
+DEFUNOP_OP (hermitian, bool, /* no-op */)
+
+// bool by bool ops.
+
+DEFBINOP_OP (eq, bool, bool, ==)
+DEFBINOP_OP (ne, bool, bool, !=)
+DEFBINOP_OP (el_and, bool, bool, &&)
+DEFBINOP_OP (el_or, bool, bool, ||)
+
+DEFNDCATOP_FN (b_b, bool, bool, bool_array, bool_array, concat)
+DEFNDCATOP_FN (b_s, bool, scalar, array, array, concat)
+DEFNDCATOP_FN (s_b, scalar, bool, array, array, concat)
+DEFNDCATOP_FN (b_f, bool, float_scalar, float_array, float_array, concat)
+DEFNDCATOP_FN (f_b, float_scalar, bool, float_array, float_array, concat)
+
+void
+install_b_b_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_bool, not);
+  INSTALL_UNOP (op_uplus, octave_bool, uplus);
+  INSTALL_UNOP (op_uminus, octave_bool, uminus);
+  INSTALL_UNOP (op_transpose, octave_bool, transpose);
+  INSTALL_UNOP (op_hermitian, octave_bool, hermitian);
+
+  INSTALL_BINOP (op_eq, octave_bool, octave_bool, eq);
+  INSTALL_BINOP (op_ne, octave_bool, octave_bool, ne);
+  INSTALL_BINOP (op_el_and, octave_bool, octave_bool, el_and);
+  INSTALL_BINOP (op_el_or, octave_bool, octave_bool, el_or);
+
+  INSTALL_CATOP (octave_bool, octave_bool, b_b);
+  INSTALL_CATOP (octave_bool, octave_scalar, b_s);
+  INSTALL_CATOP (octave_scalar, octave_bool, s_b);
+  INSTALL_CATOP (octave_bool, octave_float_scalar, b_f);
+  INSTALL_CATOP (octave_float_scalar, octave_bool, f_b);
+
+  INSTALL_ASSIGNCONV (octave_bool, octave_bool, octave_bool_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-b-bm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,80 @@
+/*
+
+Copyright (C) 2003-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// bool matrix by bool ops.
+
+DEFNDBINOP_FN (el_and, bool, bool_matrix, bool, bool_array, mx_el_and)
+DEFNDBINOP_FN (el_or, bool, bool_matrix, bool, bool_array, mx_el_or)
+
+DEFNDBINOP_FN (el_and_not, bool, bool_matrix, bool, bool_array, mx_el_and_not)
+DEFNDBINOP_FN (el_or_not, bool, bool_matrix, bool, bool_array, mx_el_or_not)
+
+DEFNDCATOP_FN (b_bm, bool, bool_matrix, bool_array, bool_array, concat)
+DEFNDCATOP_FN (b_m, bool, matrix, array, array, concat)
+DEFNDCATOP_FN (s_bm, scalar, bool_matrix, array, array, concat)
+
+DEFNDCATOP_FN (b_fm, bool, float_matrix, float_array, float_array, concat)
+DEFNDCATOP_FN (f_bm, float_scalar, bool_matrix, float_array, float_array, concat)
+
+DEFCONV (bool_matrix_conv, bool, bool_matrix)
+{
+  CAST_CONV_ARG (const octave_bool&);
+
+  return new octave_bool_matrix (v.bool_matrix_value ());
+}
+
+void
+install_b_bm_ops (void)
+{
+  INSTALL_BINOP (op_el_and, octave_bool, octave_bool_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_bool, octave_bool_matrix, el_or);
+  INSTALL_BINOP (op_el_and_not, octave_bool, octave_bool_matrix, el_and_not);
+  INSTALL_BINOP (op_el_or_not, octave_bool, octave_bool_matrix, el_or_not);
+
+  INSTALL_CATOP (octave_bool, octave_bool_matrix, b_bm);
+  INSTALL_CATOP (octave_bool, octave_matrix, b_m);
+  INSTALL_CATOP (octave_scalar, octave_bool_matrix, s_bm);
+  INSTALL_CATOP (octave_bool, octave_float_matrix, b_fm);
+  INSTALL_CATOP (octave_float_scalar, octave_bool_matrix, f_bm);
+
+  INSTALL_ASSIGNCONV (octave_bool, octave_bool_matrix, octave_bool_matrix);
+
+  INSTALL_WIDENOP (octave_bool, octave_bool_matrix, bool_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-b-sbm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,95 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ops.h"
+
+#include "ov-re-sparse.h"
+#include "ov-bool-sparse.h"
+
+// bool by sparse bool matrix ops.
+
+DEFBINOP_FN (ne, bool, sparse_bool_matrix, mx_el_ne)
+DEFBINOP_FN (eq, bool, sparse_bool_matrix, mx_el_eq)
+
+DEFBINOP_FN (el_and, bool, sparse_bool_matrix, mx_el_and)
+DEFBINOP_FN (el_or, bool, sparse_bool_matrix, mx_el_or)
+
+DEFCATOP (b_sbm, bool, sparse_bool_matrix)
+{
+  CAST_BINOP_ARGS (octave_bool&, const octave_sparse_bool_matrix&);
+  SparseBoolMatrix tmp (1, 1, v1.bool_value ());
+  return octave_value (tmp. concat (v2.sparse_bool_matrix_value (),
+                                    ra_idx));
+}
+
+DEFCATOP (b_sm, bool, sparse_matrix)
+{
+  CAST_BINOP_ARGS (octave_bool&, const octave_sparse_matrix&);
+  SparseMatrix tmp (1, 1, v1.scalar_value ());
+  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
+}
+
+DEFCATOP (s_sbm, scalar, sparse_bool_matrix)
+{
+  CAST_BINOP_ARGS (octave_scalar&, const octave_sparse_bool_matrix&);
+  SparseMatrix tmp (1, 1, v1.scalar_value ());
+  return octave_value(tmp. concat (v2.sparse_matrix_value (), ra_idx));
+}
+
+DEFCONV (sparse_bool_matrix_conv, bool, sparse_bool_matrix)
+{
+  CAST_CONV_ARG (const octave_bool&);
+
+  return new octave_sparse_bool_matrix
+    (SparseBoolMatrix (1, 1, v.bool_value ()));
+}
+
+void
+install_b_sbm_ops (void)
+{
+  INSTALL_BINOP (op_eq, octave_bool, octave_sparse_bool_matrix, eq);
+  INSTALL_BINOP (op_ne, octave_bool, octave_sparse_bool_matrix, ne);
+
+  INSTALL_BINOP (op_el_and, octave_bool, octave_sparse_bool_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_bool, octave_sparse_bool_matrix, el_or);
+
+  INSTALL_CATOP (octave_bool, octave_sparse_bool_matrix, b_sbm);
+  INSTALL_CATOP (octave_bool, octave_sparse_matrix, b_sm);
+  INSTALL_CATOP (octave_scalar, octave_sparse_bool_matrix, s_sbm);
+
+  INSTALL_ASSIGNCONV (octave_bool, octave_sparse_bool_matrix,
+                      octave_bool_matrix);
+
+  INSTALL_WIDENOP (octave_bool, octave_sparse_bool_matrix, sparse_bool_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-bm-b.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,111 @@
+/*
+
+Copyright (C) 2001-2012 Cai Jianming
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-str-mat.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// bool matrix by bool ops.
+
+DEFNDBINOP_FN (el_and, bool_matrix, bool, bool_array, bool, mx_el_and)
+DEFNDBINOP_FN (el_or, bool_matrix, bool, bool_array, bool, mx_el_or)
+
+DEFNDBINOP_FN (el_not_and, bool_matrix, bool, bool_array, bool, mx_el_not_and)
+DEFNDBINOP_FN (el_not_or, bool_matrix, bool, bool_array, bool, mx_el_not_or)
+
+DEFNDCATOP_FN (bm_b, bool_matrix, bool, bool_array, bool_array, concat)
+DEFNDCATOP_FN (bm_s, bool_matrix, scalar, array, array, concat)
+DEFNDCATOP_FN (m_b, matrix, bool, array, array, concat)
+DEFNDCATOP_FN (bm_f, bool_matrix, float_scalar, float_array, float_array, concat)
+DEFNDCATOP_FN (fm_b, float_matrix, bool, float_array, float_array, concat)
+
+DEFNDASSIGNOP_FN (assign, bool_matrix, bool, bool_array, assign)
+
+static octave_value
+oct_assignop_conv_and_assign (octave_base_value& a1,
+                              const octave_value_list& idx,
+                              const octave_base_value& a2)
+{
+  octave_bool_matrix& v1 = dynamic_cast<octave_bool_matrix&> (a1);
+
+  // FIXME -- perhaps add a warning for this conversion if the values
+  // are not all 0 or 1?
+
+  boolNDArray v2 = a2.bool_array_value (true);
+
+  if (! error_state)
+    v1.assign (idx, v2);
+
+  return octave_value ();
+}
+
+void
+install_bm_b_ops (void)
+{
+  INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool, el_and);
+  INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool, el_or);
+  INSTALL_BINOP (op_el_not_and, octave_bool_matrix, octave_bool, el_not_and);
+  INSTALL_BINOP (op_el_not_or, octave_bool_matrix, octave_bool, el_not_or);
+
+  INSTALL_CATOP (octave_bool_matrix, octave_bool, bm_b);
+  INSTALL_CATOP (octave_bool_matrix, octave_scalar, bm_s);
+  INSTALL_CATOP (octave_matrix, octave_bool, m_b);
+  INSTALL_CATOP (octave_bool_matrix, octave_float_scalar, bm_f);
+  INSTALL_CATOP (octave_float_matrix, octave_bool, fm_b);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool, assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_scalar, conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int8_scalar, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int16_scalar, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int32_scalar, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int64_scalar, conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint8_scalar, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint16_scalar, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint32_scalar, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint64_scalar, conv_and_assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-bm-bm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,184 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ov-range.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-re-sparse.h"
+#include "ov-str-mat.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// unary bool matrix ops.
+
+DEFNDUNOP_OP (not, bool_matrix, bool_array, !)
+DEFNDUNOP_OP (uplus, bool_matrix, array, +)
+DEFNDUNOP_OP (uminus, bool_matrix, array, -)
+
+DEFNCUNOP_METHOD (invert, bool_matrix, invert)
+
+DEFUNOP (transpose, bool_matrix)
+{
+  CAST_UNOP_ARG (const octave_bool_matrix&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.bool_matrix_value ().transpose ());
+}
+
+// bool matrix by bool matrix ops.
+
+DEFNDBINOP_FN (eq, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_eq)
+DEFNDBINOP_FN (ne, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_ne)
+
+DEFNDBINOP_FN (el_and, bool_matrix, bool_matrix, bool_array, bool_array,
+               mx_el_and)
+
+DEFNDBINOP_FN (el_or,  bool_matrix, bool_matrix, bool_array, bool_array,
+               mx_el_or)
+
+DEFNDBINOP_FN (el_not_and, bool_matrix, bool_matrix, bool_array, bool_array,
+               mx_el_not_and)
+
+DEFNDBINOP_FN (el_not_or,  bool_matrix, bool_matrix, bool_array, bool_array,
+               mx_el_not_or)
+
+DEFNDBINOP_FN (el_and_not, bool_matrix, bool_matrix, bool_array, bool_array,
+               mx_el_and_not)
+
+DEFNDBINOP_FN (el_or_not,  bool_matrix, bool_matrix, bool_array, bool_array,
+               mx_el_or_not)
+
+DEFNDCATOP_FN (bm_bm, bool_matrix, bool_matrix, bool_array, bool_array, concat)
+DEFNDCATOP_FN (bm_m, bool_matrix, matrix, array, array, concat)
+DEFNDCATOP_FN (m_bm, matrix, bool_matrix, array, array, concat)
+DEFNDCATOP_FN (bm_fm, bool_matrix, float_matrix, float_array, float_array, concat)
+DEFNDCATOP_FN (fm_bm, float_matrix, bool_matrix, float_array, float_array, concat)
+
+DEFNDASSIGNOP_FN (assign, bool_matrix, bool_matrix, bool_array, assign)
+DEFNDASSIGNOP_FNOP (assign_and, bool_matrix, bool_matrix, bool_array, mx_el_and_assign)
+DEFNDASSIGNOP_FNOP (assign_or, bool_matrix, bool_matrix, bool_array, mx_el_or_assign)
+
+DEFNULLASSIGNOP_FN (null_assign, bool_matrix, delete_elements)
+
+static octave_value
+oct_assignop_conv_and_assign (octave_base_value& a1,
+                              const octave_value_list& idx,
+                              const octave_base_value& a2)
+{
+  octave_bool_matrix& v1 = dynamic_cast<octave_bool_matrix&> (a1);
+
+  // FIXME -- perhaps add a warning for this conversion if the values
+  // are not all 0 or 1?
+
+  boolNDArray v2 = a2.bool_array_value (true);
+
+  if (! error_state)
+    v1.assign (idx, v2);
+
+  return octave_value ();
+}
+
+DEFCONVFN (matrix_to_bool_matrix, matrix, bool)
+DEFCONVFN (scalar_to_bool_matrix, scalar, bool)
+
+void
+install_bm_bm_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_bool_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_bool_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_bool_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_bool_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_bool_matrix, transpose);
+
+  INSTALL_NCUNOP (op_not, octave_bool_matrix, invert);
+
+  INSTALL_BINOP (op_eq, octave_bool_matrix, octave_bool_matrix, eq);
+  INSTALL_BINOP (op_ne, octave_bool_matrix, octave_bool_matrix, ne);
+
+  INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool_matrix, el_or);
+  INSTALL_BINOP (op_el_not_and, octave_bool_matrix, octave_bool_matrix, el_not_and);
+  INSTALL_BINOP (op_el_not_or, octave_bool_matrix, octave_bool_matrix, el_not_or);
+  INSTALL_BINOP (op_el_and_not, octave_bool_matrix, octave_bool_matrix, el_and_not);
+  INSTALL_BINOP (op_el_or_not, octave_bool_matrix, octave_bool_matrix, el_or_not);
+
+  INSTALL_CATOP (octave_bool_matrix, octave_bool_matrix, bm_bm);
+  INSTALL_CATOP (octave_bool_matrix, octave_matrix, bm_m);
+  INSTALL_CATOP (octave_matrix, octave_bool_matrix, m_bm);
+  INSTALL_CATOP (octave_bool_matrix, octave_float_matrix, bm_fm);
+  INSTALL_CATOP (octave_float_matrix, octave_bool_matrix, fm_bm);
+
+  INSTALL_CONVOP (octave_matrix, octave_bool_matrix, matrix_to_bool_matrix);
+  INSTALL_CONVOP (octave_scalar, octave_bool_matrix, scalar_to_bool_matrix);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool_matrix, assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_matrix, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_char_matrix_str, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_char_matrix_sq_str, conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_range, conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_sparse_matrix, conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int8_matrix, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int16_matrix, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int32_matrix, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int64_matrix, conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint8_matrix, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint16_matrix, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint32_matrix, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint64_matrix, conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_null_sq_str, null_assign);
+
+  INSTALL_ASSIGNOP (op_el_and_eq, octave_bool_matrix, octave_bool_matrix, assign_and);
+  INSTALL_ASSIGNOP (op_el_or_eq, octave_bool_matrix, octave_bool_matrix, assign_or);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-bm-sbm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,103 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-bool-mat.h"
+#include "boolMatrix.h"
+#include "ov-scalar.h"
+#include "ops.h"
+
+#include "ov-re-sparse.h"
+#include "ov-bool-sparse.h"
+#include "smx-bm-sbm.h"
+#include "smx-sbm-bm.h"
+
+// bool matrix by sparse bool matrix ops.
+
+DEFBINOP_FN (eq, bool_matrix, sparse_bool_matrix, mx_el_eq)
+DEFBINOP_FN (ne, bool_matrix, sparse_bool_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_and, bool_matrix, sparse_bool_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  bool_matrix, sparse_bool_matrix, mx_el_or)
+
+DEFCATOP (bm_sbm, bool_matrix, sparse_bool_matrix)
+{
+  CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_bool_matrix&);
+  SparseBoolMatrix tmp (v1.bool_matrix_value ());
+  return octave_value (tmp. concat (v2.sparse_bool_matrix_value (),
+                                    ra_idx));
+}
+
+DEFCATOP (m_sbm, matrix, sparse_bool_matrix)
+{
+  CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_bool_matrix&);
+  SparseMatrix tmp (v1.matrix_value ());
+  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
+}
+
+DEFCATOP (bm_sm, bool_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_matrix&);
+  SparseMatrix tmp (v1.matrix_value ());
+  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
+}
+
+DEFCONV (sparse_bool_matrix_conv, bool_matrix, sparse_bool_matrix)
+{
+  CAST_CONV_ARG (const octave_bool_matrix&);
+  return new octave_sparse_bool_matrix
+    (SparseBoolMatrix (v.bool_matrix_value ()));
+}
+
+DEFNDASSIGNOP_FN (assign, bool_matrix, sparse_bool_matrix, bool_array, assign)
+
+void
+install_bm_sbm_ops (void)
+{
+  INSTALL_BINOP (op_eq, octave_bool_matrix, octave_sparse_bool_matrix, eq);
+  INSTALL_BINOP (op_ne, octave_bool_matrix, octave_sparse_bool_matrix, ne);
+
+  INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_sparse_bool_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_sparse_bool_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_bool_matrix, octave_sparse_bool_matrix, bm_sbm);
+  INSTALL_CATOP (octave_bool_matrix, octave_sparse_matrix, bm_sm);
+  INSTALL_CATOP (octave_matrix, octave_sparse_bool_matrix, m_sbm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_sparse_bool_matrix,
+                    assign)
+  INSTALL_ASSIGNCONV (octave_bool_matrix, octave_sparse_bool_matrix,
+                      octave_bool_matrix);
+
+  INSTALL_WIDENOP (octave_bool_matrix, octave_sparse_bool_matrix,
+                   sparse_bool_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cdm-cdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,110 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-cx-diag.h"
+#include "ov-flt-cx-diag.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix unary ops.
+
+DEFUNOP_OP (uplus, complex_diag_matrix, /* no-op */)
+DEFUNOP_OP (uminus, complex_diag_matrix, -)
+
+DEFUNOP (transpose, complex_diag_matrix)
+{
+  CAST_UNOP_ARG (const octave_complex_diag_matrix&);
+  return octave_value (v.complex_diag_matrix_value ().transpose ());
+}
+
+DEFUNOP (hermitian, complex_diag_matrix)
+{
+  CAST_UNOP_ARG (const octave_complex_diag_matrix&);
+  return octave_value (v.complex_diag_matrix_value ().hermitian ());
+}
+
+// matrix by matrix ops.
+
+DEFBINOP_OP (add, complex_diag_matrix, complex_diag_matrix, +)
+DEFBINOP_OP (sub, complex_diag_matrix, complex_diag_matrix, -)
+DEFBINOP_OP (mul, complex_diag_matrix, complex_diag_matrix, *)
+
+DEFBINOP (div, complex_diag_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_complex_diag_matrix&);
+
+  return xdiv (v1.complex_diag_matrix_value (),
+               v2.complex_diag_matrix_value ());
+}
+
+DEFBINOP (ldiv, complex_diag_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_complex_diag_matrix&);
+
+  return xleftdiv (v1.complex_diag_matrix_value (),
+                   v2.complex_diag_matrix_value ());
+}
+
+CONVDECL (complex_diag_matrix_to_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_complex_diag_matrix&);
+
+  return new octave_complex_matrix (v.complex_matrix_value ());
+}
+
+CONVDECL (complex_diag_matrix_to_float_complex_diag_matrix)
+{
+  CAST_CONV_ARG (const octave_complex_diag_matrix&);
+
+  return new octave_float_complex_diag_matrix (v.float_complex_diag_matrix_value ());
+}
+
+void
+install_cdm_cdm_ops (void)
+{
+  INSTALL_UNOP (op_uplus, octave_complex_diag_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_complex_diag_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_complex_diag_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_complex_diag_matrix, hermitian);
+
+  INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_complex_diag_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_complex_diag_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_complex_diag_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex_diag_matrix, octave_complex_diag_matrix, div);
+  INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_complex_diag_matrix, ldiv);
+
+  INSTALL_CONVOP (octave_complex_diag_matrix, octave_complex_matrix, complex_diag_matrix_to_complex_matrix);
+  INSTALL_CONVOP (octave_complex_diag_matrix, octave_float_complex_diag_matrix,
+                  complex_diag_matrix_to_float_complex_diag_matrix);
+  INSTALL_ASSIGNCONV (octave_complex_diag_matrix, octave_complex_matrix, octave_complex_matrix);
+  INSTALL_WIDENOP (octave_complex_diag_matrix, octave_complex_matrix, complex_diag_matrix_to_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cdm-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-cx-diag.h"
+#define RINCLUDE "ov-cx-mat.h"
+
+#define LMATRIX complex_diag_matrix
+#define RMATRIX complex_matrix
+
+#define LSHORT cdm
+#define RSHORT cm
+
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cdm-cs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 SINCLUDE "ov-complex.h"
+#define MINCLUDE "ov-cx-diag.h"
+
+#define SCALAR complex
+#define MATRIX complex_diag_matrix
+
+#define SSHORT cs
+#define MSHORT cdm
+
+#include "op-dms-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cdm-dm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,37 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-cx-diag.h"
+#define RINCLUDE "ov-re-diag.h"
+
+#define LMATRIX complex_diag_matrix
+#define RMATRIX diag_matrix
+#define RDMATRIX LMATRIX
+
+#define LSHORT cdm
+#define RSHORT dm
+
+#define DEFINEDIV
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cdm-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,38 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-cx-diag.h"
+#define RINCLUDE "ov-re-mat.h"
+
+#define LMATRIX complex_diag_matrix
+#define LDMATRIX complex_matrix
+#define RMATRIX matrix
+#define RDMATRIX complex_matrix
+
+#define LSHORT cdm
+#define RSHORT m
+
+#define DEFINELDIV
+#define DEFINENULLASSIGNCONV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cdm-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,34 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 SINCLUDE "ov-scalar.h"
+#define MINCLUDE "ov-cx-diag.h"
+
+#define SCALAR scalar
+#define SCALARV complex
+#define MATRIX complex_diag_matrix
+
+#define SSHORT s
+#define MSHORT cdm
+
+#include "op-dms-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cell.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,71 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cell.h"
+#include "ov-scalar.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+
+// cell ops.
+
+DEFUNOP (transpose, cell)
+{
+  CAST_UNOP_ARG (const octave_cell&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (Cell (v.cell_value ().transpose ()));
+}
+
+DEFCATOP_FN (c_c, cell, cell, concat)
+
+DEFASSIGNANYOP_FN (assign, cell, assign);
+
+DEFNULLASSIGNOP_FN (null_assign, cell, delete_elements)
+
+void
+install_cell_ops (void)
+{
+  INSTALL_UNOP (op_transpose, octave_cell, transpose);
+  INSTALL_UNOP (op_hermitian, octave_cell, transpose);
+
+  INSTALL_CATOP (octave_cell, octave_cell, c_c);
+
+  INSTALL_ASSIGNANYOP (op_asn_eq, octave_cell, assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_cell, octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_cell, octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_cell, octave_null_sq_str, null_assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-chm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,105 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-ch-mat.h"
+#include "ov-scalar.h"
+#include "ov-re-mat.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+// char matrix unary ops.
+
+DEFUNOP (transpose, char_matrix)
+{
+  CAST_UNOP_ARG (const octave_char_matrix&);
+
+  return octave_value (v.matrix_value ().transpose ());
+}
+
+DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array,
+               concat)
+
+DEFCATOP (chm_s, char_matrix, scalar)
+{
+  CAST_BINOP_ARGS (octave_char_matrix&, const octave_scalar&);
+
+  gripe_implicit_conversion ("Octave:num-to-str",
+                             v2.type_name (), v1.type_name ());
+
+  return octave_value (v1.char_array_value (). concat(v2.array_value (),
+                               ra_idx));
+}
+
+DEFCATOP (chm_m, char_matrix, matrix)
+{
+  CAST_BINOP_ARGS (octave_char_matrix&, const octave_matrix&);
+
+  gripe_implicit_conversion ("Octave:num-to-str",
+                             v2.type_name (), v1.type_name ());
+
+  return octave_value (v1.char_array_value (). concat (v2.array_value (),
+                               ra_idx));
+}
+
+DEFCATOP (s_chm, scalar, char_matrix)
+{
+  CAST_BINOP_ARGS (octave_scalar&, const octave_char_matrix&);
+
+  gripe_implicit_conversion ("Octave:num-to-str",
+                             v1.type_name (), v2.type_name ());
+
+  return octave_value (v1.array_value (). concat (v2.char_array_value (),
+                               ra_idx));
+}
+
+DEFCATOP (m_chm, matrix, char_matrix)
+{
+  CAST_BINOP_ARGS (octave_matrix&, const octave_char_matrix&);
+
+  gripe_implicit_conversion ("Octave:num-to-str",
+                             v1.type_name (), v2.type_name ());
+
+  return octave_value (v1.array_value (). concat (v2.char_array_value (),
+                               ra_idx));
+}
+
+void
+install_chm_ops (void)
+{
+  INSTALL_UNOP (op_transpose, octave_char_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_char_matrix, transpose);
+
+  INSTALL_CATOP (octave_char_matrix, octave_char_matrix, chm_chm);
+  INSTALL_CATOP (octave_char_matrix, octave_scalar, chm_s);
+  INSTALL_CATOP (octave_char_matrix, octave_matrix, chm_m);
+  INSTALL_CATOP (octave_scalar, octave_char_matrix, s_chm);
+  INSTALL_CATOP (octave_matrix, octave_char_matrix, m_chm);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-class.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,161 @@
+/*
+
+Copyright (C) 2007-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "oct-time.h"
+
+#include "gripes.h"
+#include "load-path.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-class.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "symtab.h"
+#include "parse.h"
+
+// class ops.
+
+#define DEF_CLASS_UNOP(name) \
+  static octave_value \
+  oct_unop_ ## name (const octave_value& a) \
+  { \
+    octave_value retval; \
+ \
+    std::string class_name = a.class_name (); \
+ \
+    octave_value meth = symbol_table::find_method (#name, class_name); \
+ \
+    if (meth.is_defined ()) \
+      { \
+        octave_value_list args; \
+ \
+        args(0) = a; \
+ \
+        octave_value_list tmp = feval (meth.function_value (), args, 1); \
+ \
+        if (tmp.length () > 0) \
+          retval = tmp(0); \
+      } \
+    else \
+      error ("%s method not defined for %s class", \
+             #name, class_name.c_str ()); \
+ \
+    return retval; \
+  }
+
+DEF_CLASS_UNOP (not)
+DEF_CLASS_UNOP (uplus)
+DEF_CLASS_UNOP (uminus)
+DEF_CLASS_UNOP (transpose)
+DEF_CLASS_UNOP (ctranspose)
+
+// FIXME -- we need to handle precedence in the binop function.
+
+#define DEF_CLASS_BINOP(name) \
+  static octave_value \
+  oct_binop_ ## name (const octave_value& a1, const octave_value& a2) \
+  { \
+    octave_value retval; \
+ \
+    std::string dispatch_type \
+      = a1.is_object () ? a1.class_name () : a2.class_name (); \
+ \
+    octave_value meth = symbol_table::find_method (#name, dispatch_type); \
+ \
+    if (meth.is_defined ()) \
+      { \
+        octave_value_list args; \
+ \
+        args(1) = a2; \
+        args(0) = a1; \
+ \
+        octave_value_list tmp = feval (meth.function_value (), args, 1); \
+ \
+        if (tmp.length () > 0) \
+          retval = tmp(0); \
+      } \
+    else \
+      error ("%s method not defined for %s class", \
+             #name, dispatch_type.c_str ()); \
+ \
+    return retval; \
+  }
+
+DEF_CLASS_BINOP (plus)
+DEF_CLASS_BINOP (minus)
+DEF_CLASS_BINOP (mtimes)
+DEF_CLASS_BINOP (mrdivide)
+DEF_CLASS_BINOP (mpower)
+DEF_CLASS_BINOP (mldivide)
+DEF_CLASS_BINOP (lt)
+DEF_CLASS_BINOP (le)
+DEF_CLASS_BINOP (eq)
+DEF_CLASS_BINOP (ge)
+DEF_CLASS_BINOP (gt)
+DEF_CLASS_BINOP (ne)
+DEF_CLASS_BINOP (times)
+DEF_CLASS_BINOP (rdivide)
+DEF_CLASS_BINOP (power)
+DEF_CLASS_BINOP (ldivide)
+DEF_CLASS_BINOP (and)
+DEF_CLASS_BINOP (or)
+
+#define INSTALL_CLASS_UNOP(op, f) \
+  octave_value_typeinfo::register_unary_class_op \
+    (octave_value::op, oct_unop_ ## f)
+
+#define INSTALL_CLASS_BINOP(op, f) \
+  octave_value_typeinfo::register_binary_class_op \
+    (octave_value::op, oct_binop_ ## f)
+
+void
+install_class_ops (void)
+{
+  INSTALL_CLASS_UNOP (op_not, not);
+  INSTALL_CLASS_UNOP (op_uplus, uplus);
+  INSTALL_CLASS_UNOP (op_uminus, uminus);
+  INSTALL_CLASS_UNOP (op_transpose, transpose);
+  INSTALL_CLASS_UNOP (op_hermitian, ctranspose);
+
+  INSTALL_CLASS_BINOP (op_add, plus);
+  INSTALL_CLASS_BINOP (op_sub, minus);
+  INSTALL_CLASS_BINOP (op_mul, mtimes);
+  INSTALL_CLASS_BINOP (op_div, mrdivide);
+  INSTALL_CLASS_BINOP (op_pow, mpower);
+  INSTALL_CLASS_BINOP (op_ldiv, mldivide);
+  INSTALL_CLASS_BINOP (op_lt, lt);
+  INSTALL_CLASS_BINOP (op_le, le);
+  INSTALL_CLASS_BINOP (op_eq, eq);
+  INSTALL_CLASS_BINOP (op_ge, ge);
+  INSTALL_CLASS_BINOP (op_gt, gt);
+  INSTALL_CLASS_BINOP (op_ne, ne);
+  INSTALL_CLASS_BINOP (op_el_mul, times);
+  INSTALL_CLASS_BINOP (op_el_div, rdivide);
+  INSTALL_CLASS_BINOP (op_el_pow, power);
+  INSTALL_CLASS_BINOP (op_el_ldiv, ldivide);
+  INSTALL_CLASS_BINOP (op_el_and, and);
+  INSTALL_CLASS_BINOP (op_el_or, or);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-cdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-cx-mat.h"
+#define RINCLUDE "ov-cx-diag.h"
+
+#define LMATRIX complex_matrix
+#define RMATRIX complex_diag_matrix
+
+#define LSHORT cm
+#define RSHORT cdm
+
+#define DEFINEDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,260 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// unary complex matrix ops.
+
+DEFNDUNOP_OP (not, complex_matrix, complex_array, !)
+DEFNDUNOP_OP (uplus, complex_matrix, complex_array, /* no-op */)
+DEFNDUNOP_OP (uminus, complex_matrix, complex_array, -)
+
+DEFUNOP (transpose, complex_matrix)
+{
+  CAST_UNOP_ARG (const octave_complex_matrix&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.complex_matrix_value ().transpose ());
+}
+
+DEFUNOP (hermitian, complex_matrix)
+{
+  CAST_UNOP_ARG (const octave_complex_matrix&);
+
+  if (v.ndims () > 2)
+    {
+      error ("complex-conjugate transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.complex_matrix_value ().hermitian ());
+}
+
+DEFNCUNOP_METHOD (incr, complex_matrix, increment)
+DEFNCUNOP_METHOD (decr, complex_matrix, decrement)
+DEFNCUNOP_METHOD (changesign, complex_matrix, changesign)
+
+// complex matrix by complex matrix ops.
+
+DEFNDBINOP_OP (add, complex_matrix, complex_matrix, complex_array, complex_array, +)
+DEFNDBINOP_OP (sub, complex_matrix, complex_matrix, complex_array, complex_array, -)
+
+DEFBINOP_OP (mul, complex_matrix, complex_matrix, *)
+
+DEFBINOP (div, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
+                            v2.complex_matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, complex_matrix, complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
+                                v2.complex_matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP (trans_mul, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+  return octave_value(xgemm (v1.complex_matrix_value (),
+                             v2.complex_matrix_value (),
+                             blas_trans, blas_no_trans));
+}
+
+DEFBINOP (mul_trans, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+  return octave_value(xgemm (v1.complex_matrix_value (),
+                             v2.complex_matrix_value (),
+                             blas_no_trans, blas_trans));
+}
+
+DEFBINOP (herm_mul, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+  return octave_value(xgemm (v1.complex_matrix_value (),
+                             v2.complex_matrix_value (),
+                             blas_conj_trans, blas_no_trans));
+}
+
+DEFBINOP (mul_herm, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+  return octave_value(xgemm (v1.complex_matrix_value (),
+                             v2.complex_matrix_value (),
+                             blas_no_trans, blas_conj_trans));
+}
+
+DEFBINOP (trans_ldiv, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
+                                v2.complex_matrix_value (), typ, blas_trans);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP (herm_ldiv, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
+                                v2.complex_matrix_value (), typ, blas_conj_trans);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_ne)
+
+DEFNDBINOP_FN (el_mul, complex_matrix, complex_matrix, complex_array, complex_array, product)
+DEFNDBINOP_FN (el_div, complex_matrix, complex_matrix, complex_array, complex_array, quotient)
+DEFNDBINOP_FN (el_pow, complex_matrix, complex_matrix, complex_array, complex_array, elem_xpow)
+
+DEFBINOP (el_ldiv, complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
+
+  return octave_value (quotient (v2.complex_array_value (), v1.complex_array_value ()));
+}
+
+DEFNDBINOP_FN (el_and, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  complex_matrix, complex_matrix, complex_array, complex_array, mx_el_or)
+
+DEFNDCATOP_FN (cm_cm, complex_matrix, complex_matrix, complex_array, complex_array, concat)
+
+DEFNDASSIGNOP_FN (assign, complex_matrix, complex_matrix, complex_array, assign)
+
+DEFNULLASSIGNOP_FN (null_assign, complex_matrix, delete_elements)
+
+DEFNDASSIGNOP_OP (assign_add, complex_matrix, complex_matrix, complex_array, +=)
+DEFNDASSIGNOP_OP (assign_sub, complex_matrix, complex_matrix, complex_array, -=)
+DEFNDASSIGNOP_FNOP (assign_el_mul, complex_matrix, complex_matrix, complex_array, product_eq)
+DEFNDASSIGNOP_FNOP (assign_el_div, complex_matrix, complex_matrix, complex_array, quotient_eq)
+
+CONVDECL (complex_matrix_to_float_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_complex_matrix&);
+
+  return new octave_float_complex_matrix (FloatComplexNDArray (v.complex_array_value ()));
+}
+
+void
+install_cm_cm_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_complex_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_complex_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_complex_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_complex_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_complex_matrix, hermitian);
+
+  INSTALL_NCUNOP (op_incr, octave_complex_matrix, incr);
+  INSTALL_NCUNOP (op_decr, octave_complex_matrix, decr);
+  INSTALL_NCUNOP (op_uminus, octave_complex_matrix, changesign);
+
+  INSTALL_BINOP (op_add, octave_complex_matrix, octave_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex_matrix, octave_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_complex_matrix, ldiv);
+  INSTALL_BINOP (op_trans_mul, octave_complex_matrix, octave_complex_matrix, trans_mul);
+  INSTALL_BINOP (op_mul_trans, octave_complex_matrix, octave_complex_matrix, mul_trans);
+  INSTALL_BINOP (op_herm_mul, octave_complex_matrix, octave_complex_matrix, herm_mul);
+  INSTALL_BINOP (op_mul_herm, octave_complex_matrix, octave_complex_matrix, mul_herm);
+  INSTALL_BINOP (op_trans_ldiv, octave_complex_matrix, octave_complex_matrix, trans_ldiv);
+  INSTALL_BINOP (op_herm_ldiv, octave_complex_matrix, octave_complex_matrix, herm_ldiv);
+
+  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_complex_matrix, octave_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_complex_matrix, octave_complex_matrix, cm_cm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_complex_matrix, assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_null_sq_str, null_assign);
+
+  INSTALL_ASSIGNOP (op_add_eq, octave_complex_matrix, octave_complex_matrix, assign_add);
+  INSTALL_ASSIGNOP (op_sub_eq, octave_complex_matrix, octave_complex_matrix, assign_sub);
+  INSTALL_ASSIGNOP (op_el_mul_eq, octave_complex_matrix, octave_complex_matrix, assign_el_mul);
+  INSTALL_ASSIGNOP (op_el_div_eq, octave_complex_matrix, octave_complex_matrix, assign_el_div);
+
+  INSTALL_CONVOP (octave_complex_matrix, octave_float_complex_matrix,
+                  complex_matrix_to_float_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-cs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,145 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-complex.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex matrix by complex scalar ops.
+
+DEFNDBINOP_OP (add, complex_matrix, complex, complex_array, complex, +)
+DEFNDBINOP_OP (sub, complex_matrix, complex, complex_array, complex, -)
+DEFNDBINOP_OP (mul, complex_matrix, complex, complex_array, complex, *)
+
+DEFBINOP (div, complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.complex_array_value () / d);
+}
+
+DEFBINOP_FN (pow, complex_matrix, complex, xpow)
+
+DEFBINOP (ldiv, complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
+
+  ComplexMatrix m1 = v1.complex_matrix_value ();
+  ComplexMatrix m2 = v2.complex_matrix_value ();
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (m1, m2, typ);
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, complex_matrix, complex, complex_array, complex, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, complex_matrix, complex, complex_array, complex, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, complex_matrix, complex, complex_array, complex, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, complex_matrix, complex, complex_array, complex, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, complex_matrix, complex, complex_array, complex, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, complex_matrix, complex, complex_array, complex, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, complex_matrix, complex, complex_array, complex, *)
+
+DEFBINOP (el_div, complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.complex_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_pow, complex_matrix, complex, complex_array, complex, elem_xpow)
+
+DEFBINOP (el_ldiv, complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&);
+
+  return x_el_div (v2.complex_value (), v1.complex_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, complex_matrix, complex, complex_array, complex, mx_el_and)
+DEFNDBINOP_FN (el_or,  complex_matrix, complex, complex_array, complex, mx_el_or)
+
+DEFNDCATOP_FN (cm_cs, complex_matrix, complex, complex_array, complex_array, concat)
+
+DEFNDASSIGNOP_FN (assign, complex_matrix, complex, complex, assign)
+DEFNDASSIGNOP_FN (sgl_assign, float_complex_matrix, complex, float_complex, assign)
+
+DEFNDASSIGNOP_OP (assign_add, complex_matrix, complex_scalar, complex, +=)
+DEFNDASSIGNOP_OP (assign_sub, complex_matrix, complex_scalar, complex, -=)
+DEFNDASSIGNOP_OP (assign_mul, complex_matrix, complex_scalar, complex, *=)
+DEFNDASSIGNOP_OP (assign_div, complex_matrix, complex_scalar, complex, /=)
+
+void
+install_cm_cs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex_matrix, octave_complex, add);
+  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_complex, sub);
+  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_complex, mul);
+  INSTALL_BINOP (op_div, octave_complex_matrix, octave_complex, div);
+  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_complex, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_complex, lt);
+  INSTALL_BINOP (op_le, octave_complex_matrix, octave_complex, le);
+  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_complex, eq);
+  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_complex, ge);
+  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_complex, gt);
+  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_complex, el_or);
+
+  INSTALL_CATOP (octave_complex_matrix, octave_complex, cm_cs);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_complex, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_complex, sgl_assign);
+
+  INSTALL_ASSIGNOP (op_add_eq, octave_complex_matrix, octave_complex_scalar, assign_add);
+  INSTALL_ASSIGNOP (op_sub_eq, octave_complex_matrix, octave_complex_scalar, assign_sub);
+  INSTALL_ASSIGNOP (op_mul_eq, octave_complex_matrix, octave_complex_scalar, assign_mul);
+  INSTALL_ASSIGNOP (op_div_eq, octave_complex_matrix, octave_complex_scalar, assign_div);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-dm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-cx-mat.h"
+#define RINCLUDE "ov-re-diag.h"
+
+#define LMATRIX complex_matrix
+#define RMATRIX diag_matrix
+
+#define LSHORT cm
+#define RSHORT dm
+
+#define DEFINEDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,143 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-cm-m.h"
+#include "mx-m-cm.h"
+#include "mx-cnda-nda.h"
+#include "mx-nda-cnda.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex matrix by matrix ops.
+
+DEFNDBINOP_OP (add, complex_matrix, matrix, complex_array, array, +)
+DEFNDBINOP_OP (sub, complex_matrix, matrix, complex_array, array, -)
+
+DEFBINOP_OP (mul, complex_matrix, matrix, *)
+
+DEFBINOP (mul_trans, complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
+
+  ComplexMatrix m1 = v1.complex_matrix_value ();
+  Matrix m2 = v2.matrix_value ();
+
+  return ComplexMatrix (xgemm (real (m1), m2, blas_no_trans, blas_trans),
+                        xgemm (imag (m1), m2, blas_no_trans, blas_trans));
+}
+
+DEFBINOP (div, complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
+                            v2.matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+
+DEFBINOPX (pow, complex_matrix, matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
+                                v2.matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, complex_matrix, matrix, complex_array, array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, complex_matrix, matrix, complex_array, array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, complex_matrix, matrix, complex_array, array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, complex_matrix, matrix, complex_array, array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, complex_matrix, matrix, complex_array, array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, complex_matrix, matrix, complex_array, array, mx_el_ne)
+
+DEFNDBINOP_FN (el_mul, complex_matrix, matrix, complex_array, array, product)
+DEFNDBINOP_FN (el_div, complex_matrix, matrix, complex_array, array, quotient)
+DEFNDBINOP_FN (el_pow, complex_matrix, matrix, complex_array, array, elem_xpow)
+
+DEFBINOP (el_ldiv, complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&);
+
+  return quotient (v2.array_value (), v1.complex_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, complex_matrix, matrix, complex_array, array, mx_el_and)
+DEFNDBINOP_FN (el_or,  complex_matrix, matrix, complex_array, array, mx_el_or)
+
+DEFNDCATOP_FN (cm_m, complex_matrix, matrix, complex_array, array, concat)
+
+DEFNDASSIGNOP_FN (assign, complex_matrix, matrix, complex_array, assign)
+
+void
+install_cm_m_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex_matrix, octave_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex_matrix, octave_matrix, div);
+  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_matrix, lt);
+  INSTALL_BINOP (op_le, octave_complex_matrix, octave_matrix, le);
+  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_matrix, el_or);
+  INSTALL_BINOP (op_mul_trans, octave_complex_matrix, octave_matrix, mul_trans);
+  INSTALL_BINOP (op_mul_herm, octave_complex_matrix, octave_matrix, mul_trans);
+
+  INSTALL_CATOP (octave_complex_matrix, octave_matrix, cm_m);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_matrix, assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-pm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 MINCLUDE "ov-cx-mat.h"
+
+#define LMATRIX complex_matrix
+#define RMATRIX perm_matrix
+
+#define LSHORT cm
+#define RSHORT pm
+
+#define RIGHT
+
+#include "op-pm-template.cc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,143 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-cm-s.h"
+#include "mx-cnda-s.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex matrix by scalar ops.
+
+DEFNDBINOP_OP (add, complex_matrix, scalar, complex_array, scalar, +)
+DEFNDBINOP_OP (sub, complex_matrix, scalar, complex_array, scalar, -)
+DEFNDBINOP_OP (mul, complex_matrix, scalar, complex_array, scalar, *)
+
+DEFBINOP (div, complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
+
+  double d = v2.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.complex_array_value () / d);
+}
+
+DEFBINOP_FN (pow, complex_matrix, scalar, xpow)
+
+DEFBINOP (ldiv, complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
+
+  ComplexMatrix m1 = v1.complex_matrix_value ();
+  Matrix m2 = v2.matrix_value ();
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (m1, m2, typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, complex_matrix, scalar, complex_array, scalar, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, complex_matrix, scalar, complex_array, scalar, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, complex_matrix, scalar, complex_array, scalar, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, complex_matrix, scalar, complex_array, scalar, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, complex_matrix, scalar, complex_array, scalar, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, complex_matrix, scalar, complex_array, scalar, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, complex_matrix, scalar, complex_array, scalar, *)
+
+DEFBINOP (el_div, complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
+
+  double d = v2.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.complex_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_pow, complex_matrix, scalar, complex_array, scalar, elem_xpow)
+
+DEFBINOP (el_ldiv, complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&);
+
+  return x_el_div (v2.double_value (), v1.complex_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, complex_matrix, scalar, complex_array, scalar, mx_el_and)
+DEFNDBINOP_FN (el_or,  complex_matrix, scalar, complex_array, scalar, mx_el_or)
+
+DEFNDCATOP_FN (cm_s, complex_matrix, scalar, complex_array, array, concat)
+
+DEFNDASSIGNOP_FN (assign, complex_matrix, scalar, complex_array, assign)
+
+DEFNDASSIGNOP_OP (assign_mul, complex_matrix, scalar, scalar, *=)
+DEFNDASSIGNOP_OP (assign_div, complex_matrix, scalar, scalar, /=)
+
+void
+install_cm_s_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex_matrix, octave_scalar, add);
+  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_scalar, mul);
+  INSTALL_BINOP (op_div, octave_complex_matrix, octave_scalar, div);
+  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_scalar, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_scalar, lt);
+  INSTALL_BINOP (op_le, octave_complex_matrix, octave_scalar, le);
+  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_scalar, el_or);
+
+  INSTALL_CATOP (octave_complex_matrix, octave_scalar, cm_s);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_scalar, assign);
+
+  INSTALL_ASSIGNOP (op_mul_eq, octave_complex_matrix, octave_scalar, assign_mul);
+  INSTALL_ASSIGNOP (op_div_eq, octave_complex_matrix, octave_scalar, assign_div);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-scm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,203 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-cx-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-scm-cm.h"
+#include "smx-cm-scm.h"
+#include "ov-cx-sparse.h"
+
+// complex matrix by sparse complex matrix ops.
+
+DEFBINOP_OP (add, complex_matrix, sparse_complex_matrix, +)
+DEFBINOP_OP (sub, complex_matrix, sparse_complex_matrix, -)
+
+DEFBINOP_OP (mul, complex_matrix, sparse_complex_matrix, *)
+
+DEFBINOP (div, complex_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      Complex d = v2.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.complex_array_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+
+      ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
+                                v2.sparse_complex_matrix_value (), typ);
+
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOPX (pow, complex_matrix, sparse_complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, complex_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&,
+                   const octave_sparse_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
+                                v2.complex_matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (mul_trans, complex_matrix, sparse_complex_matrix, mul_trans);
+DEFBINOP_FN (mul_herm, complex_matrix, sparse_complex_matrix, mul_herm);
+
+DEFBINOP_FN (lt, complex_matrix, sparse_complex_matrix, mx_el_lt)
+DEFBINOP_FN (le, complex_matrix, sparse_complex_matrix, mx_el_le)
+DEFBINOP_FN (eq, complex_matrix, sparse_complex_matrix, mx_el_eq)
+DEFBINOP_FN (ge, complex_matrix, sparse_complex_matrix, mx_el_ge)
+DEFBINOP_FN (gt, complex_matrix, sparse_complex_matrix, mx_el_gt)
+DEFBINOP_FN (ne, complex_matrix, sparse_complex_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, complex_matrix, sparse_complex_matrix, product)
+DEFBINOP_FN (el_div, complex_matrix, sparse_complex_matrix, quotient)
+
+DEFBINOP (el_pow, complex_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  return octave_value
+    (elem_xpow (SparseComplexMatrix (v1.complex_matrix_value ()),
+                v2.sparse_complex_matrix_value ()));
+}
+
+DEFBINOP (el_ldiv, sparse_complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  return octave_value (quotient (v2.sparse_complex_matrix_value (),
+                                 v1.complex_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, complex_matrix, sparse_complex_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  complex_matrix, sparse_complex_matrix, mx_el_or)
+
+DEFCATOP (cm_scm, complex_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (octave_complex_matrix&,
+                   const octave_sparse_complex_matrix&);
+  SparseComplexMatrix tmp (v1.complex_matrix_value ());
+  return octave_value (tmp. concat (v2.sparse_complex_matrix_value (),
+                                    ra_idx));
+}
+
+DEFCONV (sparse_complex_matrix_conv, complex_matrix,
+         sparse_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_complex_matrix&);
+  return new octave_sparse_complex_matrix
+    (SparseComplexMatrix (v.complex_matrix_value ()));
+}
+
+DEFNDASSIGNOP_FN (assign, complex_matrix, sparse_complex_matrix,
+                  complex_array, assign)
+
+void
+install_cm_scm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex_matrix,
+                 octave_sparse_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex_matrix,
+                 octave_sparse_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex_matrix,
+                 octave_sparse_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex_matrix,
+                 octave_sparse_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_complex_matrix,
+                 octave_sparse_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex_matrix,
+                 octave_sparse_complex_matrix, ldiv);
+  INSTALL_BINOP (op_mul_trans, octave_complex_matrix,
+                 octave_sparse_complex_matrix, mul_trans);
+  INSTALL_BINOP (op_mul_herm, octave_complex_matrix,
+                 octave_sparse_complex_matrix, mul_herm);
+  INSTALL_BINOP (op_lt, octave_complex_matrix,
+                 octave_sparse_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_complex_matrix,
+                 octave_sparse_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_complex_matrix,
+                 octave_sparse_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_complex_matrix,
+                 octave_sparse_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_complex_matrix,
+                 octave_sparse_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_complex_matrix,
+                 octave_sparse_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex_matrix,
+                 octave_sparse_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex_matrix,
+                 octave_sparse_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex_matrix,
+                 octave_sparse_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix,
+                 octave_sparse_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex_matrix,
+                 octave_sparse_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex_matrix,
+                 octave_sparse_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_complex_matrix,
+                 octave_sparse_complex_matrix, cm_scm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
+                    octave_sparse_complex_matrix, assign)
+  INSTALL_ASSIGNCONV (octave_complex_matrix, octave_sparse_complex_matrix,
+                      octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_complex_matrix, octave_sparse_complex_matrix,
+                   sparse_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cm-sm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,168 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-cx-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-sm-cm.h"
+#include "smx-cm-sm.h"
+#include "ov-re-sparse.h"
+
+// complex matrix by sparse matrix ops.
+
+DEFBINOP_OP (add, complex_matrix, sparse_matrix, +)
+DEFBINOP_OP (sub, complex_matrix, sparse_matrix, -)
+
+DEFBINOP_OP (mul, complex_matrix, sparse_matrix, *)
+
+DEFBINOP (div, complex_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.complex_array_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+
+      ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
+                                v2.sparse_matrix_value (), typ);
+
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOPX (pow, complex_matrix, sparse_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, complex_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&,
+                   const octave_sparse_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (),
+                                v2.matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (lt, complex_matrix, sparse_matrix, mx_el_lt)
+DEFBINOP_FN (le, complex_matrix, sparse_matrix, mx_el_le)
+DEFBINOP_FN (eq, complex_matrix, sparse_matrix, mx_el_eq)
+DEFBINOP_FN (ge, complex_matrix, sparse_matrix, mx_el_ge)
+DEFBINOP_FN (gt, complex_matrix, sparse_matrix, mx_el_gt)
+DEFBINOP_FN (ne, complex_matrix, sparse_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, complex_matrix, sparse_matrix, product)
+DEFBINOP_FN (el_div, complex_matrix, sparse_matrix, quotient)
+
+DEFBINOP (el_pow, complex_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&,
+                   const octave_sparse_matrix&);
+
+  return octave_value
+    (elem_xpow ( SparseComplexMatrix (v1.complex_matrix_value ()),
+                 v2.sparse_matrix_value ()));
+}
+
+DEFBINOP (el_ldiv, complex_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_matrix&,
+                   const octave_sparse_matrix&);
+  return octave_value
+    (quotient (v2.sparse_matrix_value (), v1.complex_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, complex_matrix, sparse_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  complex_matrix, sparse_matrix, mx_el_or)
+
+DEFCATOP (cm_sm, complex_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (octave_complex_matrix&, const octave_sparse_matrix&);
+  SparseComplexMatrix tmp (v1.complex_matrix_value ());
+  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
+}
+
+DEFNDASSIGNOP_FN (assign, complex_matrix, sparse_matrix, complex_array, assign)
+
+void
+install_cm_sm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex_matrix, octave_sparse_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex_matrix, octave_sparse_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex_matrix, octave_sparse_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex_matrix, octave_sparse_matrix, div);
+  INSTALL_BINOP (op_pow, octave_complex_matrix, octave_sparse_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_sparse_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex_matrix, octave_sparse_matrix, lt);
+  INSTALL_BINOP (op_le, octave_complex_matrix, octave_sparse_matrix, le);
+  INSTALL_BINOP (op_eq, octave_complex_matrix, octave_sparse_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_complex_matrix, octave_sparse_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_complex_matrix, octave_sparse_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_complex_matrix, octave_sparse_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_sparse_matrix,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_sparse_matrix,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_sparse_matrix,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_sparse_matrix,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_sparse_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_sparse_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_complex_matrix, octave_sparse_matrix, cm_sm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_sparse_matrix,
+                    assign);
+  INSTALL_ASSIGNCONV (octave_complex_matrix, octave_sparse_matrix,
+                      octave_complex_matrix)
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cs-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,133 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex scalar by complex matrix ops.
+
+DEFNDBINOP_OP (add, complex, complex_matrix, complex, complex_array, +)
+DEFNDBINOP_OP (sub, complex, complex_matrix, complex, complex_array, -)
+DEFNDBINOP_OP (mul, complex, complex_matrix, complex, complex_array, *)
+
+DEFBINOP (div, complex, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
+
+  ComplexMatrix m1 = v1.complex_matrix_value ();
+  ComplexMatrix m2 = v2.complex_matrix_value ();
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (m1, m2, typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (pow, complex, complex_matrix, xpow)
+
+DEFBINOP (ldiv, complex, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.complex_array_value () / d);
+}
+
+DEFNDCMPLXCMPOP_FN (lt, complex, complex_matrix, complex, complex_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, complex, complex_matrix, complex, complex_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, complex, complex_matrix, complex, complex_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, complex, complex_matrix, complex, complex_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, complex, complex_matrix, complex, complex_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, complex, complex_matrix, complex, complex_array, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, complex, complex_matrix, complex, complex_array, *)
+DEFNDBINOP_FN (el_div, complex, complex_matrix, complex, complex_array, x_el_div)
+DEFNDBINOP_FN (el_pow, complex, complex_matrix, complex, complex_array, elem_xpow)
+
+DEFBINOP (el_ldiv, complex, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.complex_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_and, complex, complex_matrix, complex, complex_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  complex, complex_matrix, complex, complex_array, mx_el_or)
+
+DEFNDCATOP_FN (cs_cm, complex, complex_matrix, complex_array, complex_array, concat)
+
+DEFCONV (complex_matrix_conv, complex, complex_matrix)
+{
+  CAST_CONV_ARG (const octave_complex&);
+
+  return new octave_complex_matrix (v.complex_matrix_value ());
+}
+
+void
+install_cs_cm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex, octave_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex, octave_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex, octave_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex, octave_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_complex, octave_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex, octave_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex, octave_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_complex, octave_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_complex, octave_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_complex, octave_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_complex, octave_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_complex, octave_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex, octave_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex, octave_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex, octave_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex, octave_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex, octave_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_complex, octave_complex_matrix, cs_cm);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_complex_matrix, octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cs-cs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,197 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Array-util.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// unary complex scalar ops.
+
+DEFUNOP (not, complex)
+{
+  CAST_UNOP_ARG (const octave_complex&);
+  Complex x = v.complex_value ();
+  if (xisnan (x))
+    gripe_nan_to_logical_conversion ();
+  return octave_value (x == 0.0);
+}
+
+DEFUNOP_OP (uplus, complex, /* no-op */)
+DEFUNOP_OP (uminus, complex, -)
+DEFUNOP_OP (transpose, complex, /* no-op */)
+
+DEFUNOP (hermitian, complex)
+{
+  CAST_UNOP_ARG (const octave_complex&);
+
+  return octave_value (conj (v.complex_value ()));
+}
+
+DEFNCUNOP_METHOD (incr, complex, increment)
+DEFNCUNOP_METHOD (decr, complex, decrement)
+
+// complex scalar by complex scalar ops.
+
+DEFBINOP_OP (add, complex, complex, +)
+DEFBINOP_OP (sub, complex, complex, -)
+DEFBINOP_OP (mul, complex, complex, *)
+
+DEFBINOP (div, complex, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.complex_value () / d);
+}
+
+DEFBINOP_FN (pow, complex, complex, xpow)
+
+DEFBINOP (ldiv, complex, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.complex_value () / d);
+}
+
+DEFCMPLXCMPOP_OP (lt, complex, complex, <)
+DEFCMPLXCMPOP_OP (le, complex, complex, <=)
+DEFCMPLXCMPOP_OP (eq, complex, complex, ==)
+DEFCMPLXCMPOP_OP (ge, complex, complex, >=)
+DEFCMPLXCMPOP_OP (gt, complex, complex, >)
+DEFCMPLXCMPOP_OP (ne, complex, complex, !=)
+
+DEFBINOP_OP (el_mul, complex, complex, *)
+
+DEFBINOP (el_div, complex, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.complex_value () / d);
+}
+
+DEFBINOP_FN (el_pow, complex, complex, xpow)
+
+DEFBINOP (el_ldiv, complex, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.complex_value () / d);
+}
+
+DEFBINOP (el_and, complex, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
+
+  return v1.complex_value () != 0.0 && v2.complex_value () != 0.0;
+}
+
+DEFBINOP (el_or, complex, complex)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_complex&);
+
+  return v1.complex_value () != 0.0 || v2.complex_value () != 0.0;
+}
+
+DEFNDCATOP_FN (cs_cs, complex, complex, complex_array, complex_array, concat)
+
+CONVDECL (complex_to_float_complex)
+{
+  CAST_CONV_ARG (const octave_complex&);
+
+  return new octave_float_complex_matrix (FloatComplexMatrix (1, 1, static_cast<FloatComplex>(v.complex_value ())));
+}
+
+void
+install_cs_cs_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_complex, not);
+  INSTALL_UNOP (op_uplus, octave_complex, uplus);
+  INSTALL_UNOP (op_uminus, octave_complex, uminus);
+  INSTALL_UNOP (op_transpose, octave_complex, transpose);
+  INSTALL_UNOP (op_hermitian, octave_complex, hermitian);
+
+  INSTALL_NCUNOP (op_incr, octave_complex, incr);
+  INSTALL_NCUNOP (op_decr, octave_complex, decr);
+
+  INSTALL_BINOP (op_add, octave_complex, octave_complex, add);
+  INSTALL_BINOP (op_sub, octave_complex, octave_complex, sub);
+  INSTALL_BINOP (op_mul, octave_complex, octave_complex, mul);
+  INSTALL_BINOP (op_div, octave_complex, octave_complex, div);
+  INSTALL_BINOP (op_pow, octave_complex, octave_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex, octave_complex, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex, octave_complex, lt);
+  INSTALL_BINOP (op_le, octave_complex, octave_complex, le);
+  INSTALL_BINOP (op_eq, octave_complex, octave_complex, eq);
+  INSTALL_BINOP (op_ge, octave_complex, octave_complex, ge);
+  INSTALL_BINOP (op_gt, octave_complex, octave_complex, gt);
+  INSTALL_BINOP (op_ne, octave_complex, octave_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex, octave_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex, octave_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex, octave_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex, octave_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex, octave_complex, el_or);
+
+  INSTALL_CATOP (octave_complex, octave_complex, cs_cs);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_complex, octave_complex_matrix);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_null_matrix, octave_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_complex, octave_null_str, octave_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_complex, octave_null_sq_str, octave_complex_matrix);
+
+  INSTALL_CONVOP (octave_complex, octave_float_complex_matrix,
+                  complex_to_float_complex);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cs-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,130 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-cs-nda.h"
+#include "mx-nda-cs.h"
+#include "mx-cs-nda.h"
+#include "mx-nda-cs.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex scalar by matrix ops.
+
+DEFNDBINOP_OP (add, complex, matrix, complex, array, +)
+DEFNDBINOP_OP (sub, complex, matrix, complex, array, -)
+DEFNDBINOP_OP (mul, complex, matrix, complex, array, *)
+
+DEFBINOP (div, complex, matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&);
+
+  ComplexMatrix m1 = v1.complex_matrix_value ();
+  Matrix m2 = v2.matrix_value ();
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (m1, m2, typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (pow, complex, matrix, xpow)
+
+DEFBINOP (ldiv, complex, matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.array_value () / d);
+}
+
+DEFNDCMPLXCMPOP_FN (lt, complex, matrix, complex, array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, complex, matrix, complex, array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, complex, matrix, complex, array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, complex, matrix, complex, array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, complex, matrix, complex, array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, complex, matrix, complex, array, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, complex, matrix, complex, array, *)
+DEFNDBINOP_FN (el_div, complex, matrix, complex, array, x_el_div)
+DEFNDBINOP_FN (el_pow, complex, matrix, complex, array, elem_xpow)
+
+DEFBINOP (el_ldiv, complex, matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_matrix&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.array_value () / d);
+}
+
+DEFNDBINOP_FN (el_and, complex, matrix, complex, array, mx_el_and)
+DEFNDBINOP_FN (el_or,  complex, matrix, complex, array, mx_el_or)
+
+DEFNDCATOP_FN (cs_m, complex, matrix, complex_array, array, concat)
+
+void
+install_cs_m_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex, octave_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex, octave_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex, octave_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex, octave_matrix, div);
+  INSTALL_BINOP (op_pow, octave_complex, octave_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex, octave_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex, octave_matrix, lt);
+  INSTALL_BINOP (op_le, octave_complex, octave_matrix, le);
+  INSTALL_BINOP (op_eq, octave_complex, octave_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_complex, octave_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_complex, octave_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_complex, octave_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex, octave_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex, octave_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex, octave_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex, octave_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex, octave_matrix, el_or);
+
+  INSTALL_CATOP (octave_complex, octave_matrix, cs_m);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_matrix, octave_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cs-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,146 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex scalar by scalar ops.
+
+DEFBINOP_OP (add, complex, scalar, +)
+DEFBINOP_OP (sub, complex, scalar, -)
+DEFBINOP_OP (mul, complex, scalar, *)
+
+DEFBINOP (div, complex, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
+
+  double d = v2.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.complex_value () / d);
+}
+
+DEFBINOP_FN (pow, complex, scalar, xpow)
+
+DEFBINOP (ldiv, complex, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.double_value () / d);
+}
+
+DEFCMPLXCMPOP_OP (lt, complex, scalar, <)
+DEFCMPLXCMPOP_OP (le, complex, scalar, <=)
+DEFCMPLXCMPOP_OP (eq, complex, scalar, ==)
+DEFCMPLXCMPOP_OP (ge, complex, scalar, >=)
+DEFCMPLXCMPOP_OP (gt, complex, scalar, >)
+DEFCMPLXCMPOP_OP (ne, complex, scalar, !=)
+
+DEFBINOP_OP (el_mul, complex, scalar, *)
+
+DEFBINOP (el_div, complex, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
+
+  double d = v2.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.complex_value () / d);
+}
+
+DEFBINOP_FN (el_pow, complex, scalar, xpow)
+
+DEFBINOP (el_ldiv, complex, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.double_value () / d);
+}
+
+DEFBINOP (el_and, complex, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
+
+  return v1.complex_value () != 0.0 && v2.double_value ();
+}
+
+DEFBINOP (el_or, complex, scalar)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&);
+
+  return v1.complex_value () != 0.0 || v2.double_value ();
+}
+
+DEFNDCATOP_FN (cs_s, complex, scalar, complex_array, array, concat)
+
+void
+install_cs_s_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex, octave_scalar, add);
+  INSTALL_BINOP (op_sub, octave_complex, octave_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_complex, octave_scalar, mul);
+  INSTALL_BINOP (op_div, octave_complex, octave_scalar, div);
+  INSTALL_BINOP (op_pow, octave_complex, octave_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex, octave_scalar, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex, octave_scalar, lt);
+  INSTALL_BINOP (op_le, octave_complex, octave_scalar, le);
+  INSTALL_BINOP (op_eq, octave_complex, octave_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_complex, octave_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_complex, octave_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_complex, octave_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex, octave_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex, octave_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex, octave_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex, octave_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex, octave_scalar, el_or);
+
+  INSTALL_CATOP (octave_complex, octave_scalar, cs_s);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_scalar, octave_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cs-scm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,172 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-cx-mat.h"
+#include "ov-complex.h"
+#include "ops.h"
+#include "xpow.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "ov-cx-sparse.h"
+
+// complex scalar by sparse complex matrix ops.
+
+DEFBINOP_OP (add, complex, sparse_complex_matrix, +)
+DEFBINOP_OP (sub, complex, sparse_complex_matrix, -)
+DEFBINOP_OP (mul, complex, sparse_complex_matrix, *)
+
+DEFBINOP (div, complex, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      Complex d = v2.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / d));
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
+      SparseComplexMatrix m2 = v2.sparse_complex_matrix_value ();
+      ComplexMatrix ret = xdiv (m1, m2, typ);
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP (pow, complex, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&,
+                   const octave_sparse_complex_matrix&);
+  return xpow (v1.complex_value (), v2.complex_matrix_value ());
+}
+
+DEFBINOP (ldiv, complex, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&);
+
+  Complex d = v1.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.sparse_complex_matrix_value () / d);
+}
+
+DEFBINOP_FN (lt, complex, sparse_complex_matrix, mx_el_lt)
+DEFBINOP_FN (le, complex, sparse_complex_matrix, mx_el_le)
+DEFBINOP_FN (eq, complex, sparse_complex_matrix, mx_el_eq)
+DEFBINOP_FN (ge, complex, sparse_complex_matrix, mx_el_ge)
+DEFBINOP_FN (gt, complex, sparse_complex_matrix, mx_el_gt)
+DEFBINOP_FN (ne, complex, sparse_complex_matrix, mx_el_ne)
+
+DEFBINOP_OP (el_mul, complex, sparse_complex_matrix, *)
+DEFBINOP_FN (el_div, complex, sparse_complex_matrix, x_el_div)
+
+DEFBINOP_FN (el_pow, complex, sparse_complex_matrix, elem_xpow)
+
+DEFBINOP (el_ldiv, complex, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&);
+
+  Complex d = v1.complex_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v2.sparse_complex_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (el_and, complex, sparse_complex_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  complex, sparse_complex_matrix, mx_el_or)
+
+DEFCATOP (cs_scm, complex, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (octave_complex&, const octave_sparse_complex_matrix&);
+  SparseComplexMatrix tmp (1, 1, v1.complex_value ());
+  return octave_value (tmp. concat (v2.sparse_complex_matrix_value (),
+                                    ra_idx));
+}
+
+DEFCONV (sparse_complex_matrix_conv, complex, sparse_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_complex&);
+
+  return new octave_sparse_complex_matrix
+    (SparseComplexMatrix (v.complex_matrix_value ()));
+}
+
+void
+install_cs_scm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex, octave_sparse_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex, octave_sparse_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex, octave_sparse_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex, octave_sparse_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_complex, octave_sparse_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex, octave_sparse_complex_matrix,
+                 ldiv);
+  INSTALL_BINOP (op_lt, octave_complex, octave_sparse_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_complex, octave_sparse_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_complex, octave_sparse_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_complex, octave_sparse_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_complex, octave_sparse_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_complex, octave_sparse_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex, octave_sparse_complex_matrix,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex, octave_sparse_complex_matrix,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex, octave_sparse_complex_matrix,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_sparse_complex_matrix,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex, octave_sparse_complex_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_complex, octave_sparse_complex_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_complex, octave_sparse_complex_matrix, cs_scm);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_sparse_complex_matrix,
+                      octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_complex, octave_sparse_complex_matrix,
+                   sparse_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-cs-sm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,166 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-complex.h"
+#include "ops.h"
+#include "xpow.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+#include "smx-cs-sm.h"
+#include "smx-sm-cs.h"
+
+// complex by sparse matrix ops.
+
+DEFBINOP_OP (add, complex, sparse_matrix, +)
+DEFBINOP_OP (sub, complex, sparse_matrix, -)
+DEFBINOP_OP (mul, complex, sparse_matrix, *)
+
+DEFBINOP (div, complex, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (SparseComplexMatrix (1, 1, v1.complex_value () / d));
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      ComplexMatrix m1 = ComplexMatrix (1, 1, v1.complex_value ());
+      SparseMatrix m2 = v2.sparse_matrix_value ();
+      ComplexMatrix ret = xdiv (m1, m2, typ);
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP (pow, complex, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
+  return xpow (v1.complex_value (), v2.matrix_value ());
+}
+
+DEFBINOP (ldiv, complex, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
+
+  Complex d = v1.complex_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v2.sparse_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (lt, complex, sparse_matrix, mx_el_lt)
+DEFBINOP_FN (le, complex, sparse_matrix, mx_el_le)
+DEFBINOP_FN (eq, complex, sparse_matrix, mx_el_eq)
+DEFBINOP_FN (ge, complex, sparse_matrix, mx_el_ge)
+DEFBINOP_FN (gt, complex, sparse_matrix, mx_el_gt)
+DEFBINOP_FN (ne, complex, sparse_matrix, mx_el_ne)
+
+DEFBINOP_OP (el_mul, complex, sparse_matrix, *)
+DEFBINOP_FN (el_div, complex, sparse_matrix, x_el_div)
+DEFBINOP_FN (el_pow, complex, sparse_matrix, elem_xpow)
+
+DEFBINOP (el_ldiv, complex, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&);
+
+  Complex d = v1.complex_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v2.sparse_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (el_and, complex, sparse_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  complex, sparse_matrix, mx_el_or)
+
+DEFCATOP (cs_sm, sparse_matrix, complex)
+{
+  CAST_BINOP_ARGS (octave_complex&, const octave_sparse_matrix&);
+  SparseComplexMatrix tmp (1, 1, v1.complex_value ());
+  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
+}
+
+DEFCONV (sparse_matrix_conv, complex, sparse_matrix)
+{
+  CAST_CONV_ARG (const octave_complex&);
+
+  return new octave_sparse_matrix
+    (SparseMatrix (v.matrix_value ()));
+}
+
+void
+install_cs_sm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_complex, octave_sparse_matrix, add);
+  INSTALL_BINOP (op_sub, octave_complex, octave_sparse_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_complex, octave_sparse_matrix, mul);
+  INSTALL_BINOP (op_div, octave_complex, octave_sparse_matrix, div);
+  INSTALL_BINOP (op_pow, octave_complex, octave_sparse_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_complex, octave_sparse_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_complex, octave_sparse_matrix, lt);
+  INSTALL_BINOP (op_le, octave_complex, octave_sparse_matrix, le);
+  INSTALL_BINOP (op_eq, octave_complex, octave_sparse_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_complex, octave_sparse_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_complex, octave_sparse_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_complex, octave_sparse_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_complex, octave_sparse_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_complex, octave_sparse_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_complex, octave_sparse_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_complex, octave_sparse_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_complex, octave_sparse_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_complex, octave_sparse_matrix, el_or);
+
+  INSTALL_CATOP (octave_complex, octave_sparse_matrix, cs_sm);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_sparse_matrix,
+                      octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_complex, octave_sparse_matrix, sparse_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-cdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,37 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-re-diag.h"
+#define RINCLUDE "ov-cx-diag.h"
+
+#define LMATRIX diag_matrix
+#define RMATRIX complex_diag_matrix
+#define LDMATRIX RMATRIX
+
+#define LSHORT dm
+#define RSHORT cdm
+
+#define DEFINEDIV
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-re-diag.h"
+#define RINCLUDE "ov-cx-mat.h"
+
+#define LMATRIX diag_matrix
+#define RMATRIX complex_matrix
+
+#define LSHORT dm
+#define RSHORT cm
+
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-cs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,34 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 SINCLUDE "ov-complex.h"
+#define MINCLUDE "ov-re-diag.h"
+
+#define SCALAR complex
+#define MATRIX diag_matrix
+#define MATRIXV complex_diag_matrix
+
+#define SSHORT cs
+#define MSHORT dm
+
+#include "op-dms-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-dm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,103 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-re-diag.h"
+#include "ov-flt-re-diag.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix unary ops.
+
+DEFUNOP_OP (uplus, diag_matrix, /* no-op */)
+DEFUNOP_OP (uminus, diag_matrix, -)
+
+DEFUNOP (transpose, diag_matrix)
+{
+  CAST_UNOP_ARG (const octave_diag_matrix&);
+  return octave_value (v.diag_matrix_value ().transpose ());
+}
+
+// matrix by matrix ops.
+
+DEFBINOP_OP (add, diag_matrix, diag_matrix, +)
+DEFBINOP_OP (sub, diag_matrix, diag_matrix, -)
+DEFBINOP_OP (mul, diag_matrix, diag_matrix, *)
+
+DEFBINOP (div, diag_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_diag_matrix&);
+
+  return xdiv (v1.diag_matrix_value (),
+               v2.diag_matrix_value ());
+}
+
+DEFBINOP (ldiv, diag_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_diag_matrix&);
+
+  return xleftdiv (v1.diag_matrix_value (),
+                   v2.diag_matrix_value ());
+}
+
+CONVDECL (diag_matrix_to_matrix)
+{
+  CAST_CONV_ARG (const octave_diag_matrix&);
+
+  return new octave_matrix (v.matrix_value ());
+}
+
+CONVDECL (diag_matrix_to_float_diag_matrix)
+{
+  CAST_CONV_ARG (const octave_diag_matrix&);
+
+  return new octave_float_diag_matrix (v.float_diag_matrix_value ());
+}
+
+void
+install_dm_dm_ops (void)
+{
+  INSTALL_UNOP (op_uplus, octave_diag_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_diag_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_diag_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_diag_matrix, transpose);
+
+  INSTALL_BINOP (op_add, octave_diag_matrix, octave_diag_matrix, add);
+  INSTALL_BINOP (op_sub, octave_diag_matrix, octave_diag_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_diag_matrix, octave_diag_matrix, mul);
+  INSTALL_BINOP (op_div, octave_diag_matrix, octave_diag_matrix, div);
+  INSTALL_BINOP (op_ldiv, octave_diag_matrix, octave_diag_matrix, ldiv);
+
+  INSTALL_CONVOP (octave_diag_matrix, octave_matrix, diag_matrix_to_matrix);
+  INSTALL_CONVOP (octave_diag_matrix, octave_float_diag_matrix, diag_matrix_to_float_diag_matrix);
+  INSTALL_ASSIGNCONV (octave_diag_matrix, octave_matrix, octave_matrix);
+  INSTALL_WIDENOP (octave_diag_matrix, octave_matrix, diag_matrix_to_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,37 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-re-diag.h"
+#define RINCLUDE "ov-re-mat.h"
+
+#define LMATRIX diag_matrix
+#define LDMATRIX matrix
+#define RMATRIX matrix
+
+#define LSHORT dm
+#define RSHORT m
+
+#define DEFINELDIV
+#define DEFINENULLASSIGNCONV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 SINCLUDE "ov-scalar.h"
+#define MINCLUDE "ov-re-diag.h"
+
+#define SCALAR scalar
+#define MATRIX diag_matrix
+
+#define SSHORT s
+#define MSHORT dm
+
+#include "op-dms-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-scm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,511 @@
+/*
+
+Copyright (C) 2009-2012 Jason Riedy, Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+#include "ov-re-diag.h"
+#include "ov-cx-diag.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+
+#include "sparse-xdiv.h"
+
+// diagonal matrix by sparse matrix ops
+
+DEFBINOP (mul_dm_scm, diag_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.diag_matrix_value () * d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      SparseComplexMatrix ret = v1.diag_matrix_value () * v2.sparse_complex_matrix_value ();
+      octave_value out = octave_value (ret);
+      typ.mark_as_unsymmetric ();
+      out.matrix_type (typ);
+      return out;
+    }
+}
+
+DEFBINOP (mul_cdm_sm, complex_diag_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.scalar_value ();
+
+      return octave_value (v1.complex_diag_matrix_value () * d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      SparseComplexMatrix ret = v1.complex_diag_matrix_value () * v2.sparse_matrix_value ();
+      octave_value out = octave_value (ret);
+      typ.mark_as_unsymmetric ();
+      out.matrix_type (typ);
+      return out;
+    }
+}
+
+DEFBINOP (mul_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.complex_diag_matrix_value () * d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      SparseComplexMatrix ret = v1.complex_diag_matrix_value () * v2.sparse_complex_matrix_value ();
+      octave_value out = octave_value (ret);
+      typ.mark_as_unsymmetric ();
+      out.matrix_type (typ);
+      return out;
+    }
+}
+
+DEFBINOP (ldiv_dm_scm, diag_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  MatrixType typ = v2.matrix_type ();
+  return xleftdiv (v1.diag_matrix_value (), v2.sparse_complex_matrix_value (),
+                   typ);
+}
+
+DEFBINOP (ldiv_cdm_sm, complex_diag_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&,
+                   const octave_sparse_matrix&);
+
+  MatrixType typ = v2.matrix_type ();
+  return xleftdiv (v1.complex_diag_matrix_value (), v2.sparse_matrix_value (),
+                   typ);
+}
+
+DEFBINOP (ldiv_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  MatrixType typ = v2.matrix_type ();
+  return xleftdiv (v1.complex_diag_matrix_value (), v2.sparse_complex_matrix_value (),
+                   typ);
+}
+
+DEFBINOP (add_dm_scm, diag_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.matrix_value () + d);
+    }
+  else
+    return v1.diag_matrix_value () + v2.sparse_complex_matrix_value ();
+}
+
+DEFBINOP (add_cdm_sm, complex_diag_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v2.scalar_value ();
+
+      return octave_value (v1.complex_matrix_value () + d);
+    }
+  else
+    return v1.complex_diag_matrix_value () + v2.sparse_matrix_value ();
+}
+
+DEFBINOP (add_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.complex_matrix_value () + d);
+    }
+  else
+    return v1.complex_diag_matrix_value () + v2.sparse_complex_matrix_value ();
+}
+
+DEFBINOP (sub_dm_scm, diag_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.matrix_value () + (-d));
+    }
+  else
+    return v1.diag_matrix_value () - v2.sparse_complex_matrix_value ();
+}
+
+DEFBINOP (sub_cdm_sm, complex_diag_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v2.scalar_value ();
+
+      return octave_value (v1.complex_matrix_value () + (-d));
+    }
+  else
+    return v1.complex_diag_matrix_value () - v2.sparse_matrix_value ();
+}
+
+DEFBINOP (sub_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.complex_matrix_value () + (-d));
+    }
+  else
+    return v1.complex_diag_matrix_value () - v2.sparse_complex_matrix_value ();
+}
+
+// sparse matrix by diagonal matrix ops
+
+DEFBINOP (mul_scm_dm, sparse_complex_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    // If v1 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v1.complex_value ();
+
+      return octave_value (d * v2.diag_matrix_value ());
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+      SparseComplexMatrix ret = v1.sparse_complex_matrix_value () * v2.diag_matrix_value ();
+      octave_value out = octave_value (ret);
+      typ.mark_as_unsymmetric ();
+      out.matrix_type (typ);
+      return out;
+    }
+}
+
+DEFBINOP (mul_sm_cdm, sparse_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    // If v1 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v1.complex_value ();
+
+      return octave_value (d * v2.complex_diag_matrix_value ());
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+      SparseComplexMatrix ret = v1.sparse_matrix_value () * v2.complex_diag_matrix_value ();
+      octave_value out = octave_value (ret);
+      typ.mark_as_unsymmetric ();
+      out.matrix_type (typ);
+      return out;
+    }
+}
+
+DEFBINOP (mul_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    // If v1 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v1.complex_value ();
+
+      return octave_value (d * v2.complex_diag_matrix_value ());
+    }
+  else if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, don't bother with further dispatching.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.sparse_complex_matrix_value () * d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+      SparseComplexMatrix ret = v1.sparse_complex_matrix_value () * v2.complex_diag_matrix_value ();
+      octave_value out = octave_value (ret);
+      typ.mark_as_unsymmetric ();
+      out.matrix_type (typ);
+      return out;
+    }
+}
+
+DEFBINOP (div_scm_dm, sparse_complex_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.sparse_complex_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      return xdiv (v1.sparse_complex_matrix_value (), v2.diag_matrix_value (), typ);
+    }
+}
+
+DEFBINOP (div_sm_cdm, sparse_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.sparse_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      return xdiv (v1.sparse_matrix_value (), v2.complex_diag_matrix_value (), typ);
+    }
+}
+
+DEFBINOP (div_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.sparse_complex_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      return xdiv (v1.sparse_complex_matrix_value (), v2.complex_diag_matrix_value (), typ);
+    }
+}
+
+DEFBINOP (add_sm_cdm, sparse_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.sparse_matrix_value () + d);
+    }
+  else
+    return v1.sparse_matrix_value () + v2.complex_diag_matrix_value ();
+}
+
+DEFBINOP (add_scm_dm, sparse_complex_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v2.scalar_value ();
+
+      return octave_value (v1.sparse_complex_matrix_value () + d);
+    }
+  else
+    return v1.sparse_complex_matrix_value () + v2.diag_matrix_value ();
+}
+
+DEFBINOP (add_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.sparse_complex_matrix_value () + d);
+    }
+  else
+    return v1.sparse_complex_matrix_value () + v2.complex_diag_matrix_value ();
+}
+
+DEFBINOP (sub_sm_cdm, sparse_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.sparse_matrix_value () + (-d));
+    }
+  else
+    return v1.sparse_matrix_value () - v2.complex_diag_matrix_value ();
+}
+
+DEFBINOP (sub_scm_dm, sparse_complex_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v2.scalar_value ();
+
+      return octave_value (v1.sparse_complex_matrix_value () + (-d));
+    }
+  else
+    return v1.sparse_complex_matrix_value () - v2.diag_matrix_value ();
+}
+
+DEFBINOP (sub_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.sparse_complex_matrix_value () + (-d));
+    }
+  else
+    return v1.sparse_complex_matrix_value () - v2.complex_diag_matrix_value ();
+}
+
+void
+install_dm_scm_ops (void)
+{
+  INSTALL_BINOP (op_mul, octave_diag_matrix, octave_sparse_complex_matrix,
+                 mul_dm_scm);
+  INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_sparse_matrix,
+                 mul_cdm_sm);
+  INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_sparse_complex_matrix,
+                 mul_cdm_scm);
+  INSTALL_BINOP (op_ldiv, octave_diag_matrix, octave_sparse_complex_matrix, ldiv_dm_scm);
+  INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_sparse_matrix, ldiv_cdm_sm);
+  INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_sparse_complex_matrix,
+                 ldiv_cdm_scm);
+
+  INSTALL_BINOP (op_add, octave_diag_matrix, octave_sparse_complex_matrix, add_dm_scm);
+  INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_sparse_matrix, add_cdm_sm);
+  INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_sparse_complex_matrix,
+                 add_cdm_scm);
+  INSTALL_BINOP (op_sub, octave_diag_matrix, octave_sparse_complex_matrix, sub_dm_scm);
+  INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_sparse_matrix, sub_cdm_sm);
+  INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_sparse_complex_matrix,
+                 sub_cdm_scm);
+
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_diag_matrix,
+                 mul_scm_dm);
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_complex_diag_matrix,
+                 mul_sm_cdm);
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_complex_diag_matrix,
+                 mul_scm_cdm);
+
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_diag_matrix, div_scm_dm);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_complex_diag_matrix, div_sm_cdm);
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_complex_diag_matrix, div_scm_cdm);
+
+  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_diag_matrix, add_scm_dm);
+  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_complex_diag_matrix, add_sm_cdm);
+  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_complex_diag_matrix, add_scm_cdm);
+  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_diag_matrix, sub_scm_dm);
+  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_complex_diag_matrix, sub_sm_cdm);
+  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_complex_diag_matrix, sub_scm_cdm);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-sm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,196 @@
+/*
+
+Copyright (C) 2009-2012 Jason Riedy, Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+#include "ov-re-diag.h"
+#include "ov-re-sparse.h"
+
+#include "sparse-xdiv.h"
+
+// diagonal matrix by sparse matrix ops
+
+DEFBINOP (mul_dm_sm, diag_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v2.scalar_value ();
+
+      return octave_value (v1.diag_matrix_value () * d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      SparseMatrix ret = v1.diag_matrix_value () * v2.sparse_matrix_value ();
+      octave_value out = octave_value (ret);
+      typ.mark_as_unsymmetric ();
+      out.matrix_type (typ);
+      return out;
+    }
+}
+
+DEFBINOP (ldiv_dm_sm, diag_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&);
+
+  MatrixType typ = v2.matrix_type ();
+  return xleftdiv (v1.diag_matrix_value (), v2.sparse_matrix_value (), typ);
+}
+
+DEFBINOP (add_dm_sm, diag_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v2.scalar_value ();
+
+      return octave_value (v1.matrix_value () + d);
+    }
+  else
+    return v1.diag_matrix_value () + v2.sparse_matrix_value ();
+}
+
+DEFBINOP (sub_dm_sm, diag_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    // If v2 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v2.scalar_value ();
+
+      return octave_value (v1.matrix_value () - d);
+    }
+  else
+    return v1.diag_matrix_value () - v2.sparse_matrix_value ();
+}
+
+// sparse matrix by diagonal matrix ops
+
+DEFBINOP (mul_sm_dm, sparse_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    // If v1 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v1.scalar_value ();
+
+      return octave_value (d * v2.diag_matrix_value ());
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+      SparseMatrix ret = v1.sparse_matrix_value () * v2.diag_matrix_value ();
+      octave_value out = octave_value (ret);
+      typ.mark_as_unsymmetric ();
+      out.matrix_type (typ);
+      return out;
+    }
+}
+
+DEFBINOP (div_sm_dm, sparse_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.sparse_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      return xdiv (v1.sparse_matrix_value (), v2.diag_matrix_value (), typ);
+    }
+}
+
+DEFBINOP (add_sm_dm, sparse_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    // If v1 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v1.scalar_value ();
+
+      return octave_value (d + v2.matrix_value ());
+    }
+  else
+    return v1.sparse_matrix_value () + v2.diag_matrix_value ();
+}
+
+DEFBINOP (sub_sm_dm, sparse_matrix, diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    // If v1 is a scalar in disguise, return a diagonal matrix rather than
+    // a sparse matrix.
+    {
+      double d = v1.scalar_value ();
+
+      return octave_value (d - v2.matrix_value ());
+    }
+  else
+    return v1.sparse_matrix_value () - v2.diag_matrix_value ();
+}
+
+void
+install_dm_sm_ops (void)
+{
+  INSTALL_BINOP (op_mul, octave_diag_matrix, octave_sparse_matrix,
+                 mul_dm_sm);
+
+  INSTALL_BINOP (op_add, octave_diag_matrix, octave_sparse_matrix, add_dm_sm);
+  INSTALL_BINOP (op_sub, octave_diag_matrix, octave_sparse_matrix, sub_dm_sm);
+  INSTALL_BINOP (op_ldiv, octave_diag_matrix, octave_sparse_matrix, ldiv_dm_sm);
+
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_diag_matrix,
+                 mul_sm_dm);
+
+  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_diag_matrix, add_sm_dm);
+  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_diag_matrix, sub_sm_dm);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_diag_matrix, div_sm_dm);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dm-template.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,95 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ops.h"
+#include "xdiv.h"
+#include LINCLUDE
+#include RINCLUDE
+#ifdef DEFINENULLASSIGNCONV
+#include "ov-null-mat.h"
+#endif
+
+// matrix by diag matrix ops.
+
+DEFBINOP_OP (add, LMATRIX, RMATRIX, +)
+DEFBINOP_OP (sub, LMATRIX, RMATRIX, -)
+DEFBINOP_OP (mul, LMATRIX, RMATRIX, *)
+
+#ifndef LDMATRIX
+#define LDMATRIX LMATRIX
+#endif
+
+#ifndef RDMATRIX
+#define RDMATRIX RMATRIX
+#endif
+
+#define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
+#define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
+#define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
+#define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
+#define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
+#define LDMATRIX_VALUE CONCAT2(LDMATRIX, _value)
+#define RDMATRIX_VALUE CONCAT2(RDMATRIX, _value)
+
+#ifdef DEFINEDIV
+DEFBINOP (div, LMATRIX, RMATRIX)
+{
+  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
+
+  return xdiv (v1.LDMATRIX_VALUE (), v2.RMATRIX_VALUE ());
+}
+#endif
+
+#ifdef DEFINELDIV
+DEFBINOP (ldiv, LMATRIX, RMATRIX)
+{
+  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
+
+  return xleftdiv (v1.LMATRIX_VALUE (), v2.RDMATRIX_VALUE ());
+}
+#endif
+
+#define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
+#define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
+
+void
+INST_NAME (void)
+{
+  INSTALL_BINOP (op_add, OCTAVE_LMATRIX, OCTAVE_RMATRIX, add);
+  INSTALL_BINOP (op_sub, OCTAVE_LMATRIX, OCTAVE_RMATRIX, sub);
+  INSTALL_BINOP (op_mul, OCTAVE_LMATRIX, OCTAVE_RMATRIX, mul);
+#ifdef DEFINEDIV
+  INSTALL_BINOP (op_div, OCTAVE_LMATRIX, OCTAVE_RMATRIX, div);
+#endif
+#ifdef DEFINELDIV
+  INSTALL_BINOP (op_ldiv, OCTAVE_LMATRIX, OCTAVE_RMATRIX, ldiv);
+#endif
+#ifdef DEFINENULLASSIGNCONV
+  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_matrix, OCTAVE_LDMATRIX);
+  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_str, OCTAVE_LDMATRIX);
+  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_sq_str, OCTAVE_LDMATRIX);
+#endif
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-dms-template.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,92 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ops.h"
+#include "gripes.h"
+#include "xpow.h"
+#include SINCLUDE
+#include MINCLUDE
+
+// matrix by diag matrix ops.
+
+#ifndef SCALARV
+#define SCALARV SCALAR
+#endif
+
+#ifndef MATRIXV
+#define MATRIXV MATRIX
+#endif
+
+DEFNDBINOP_OP (sdmmul, SCALAR, MATRIX, SCALARV, MATRIXV, *)
+DEFNDBINOP_OP (dmsmul, MATRIX, SCALAR, MATRIXV, SCALARV, *)
+
+#define OCTAVE_MATRIX CONCAT2(octave_, MATRIX)
+#define OCTAVE_SCALAR CONCAT2(octave_, SCALAR)
+#define MATRIX_VALUE CONCAT2(MATRIXV, _value)
+#define SCALAR_VALUE CONCAT2(SCALARV, _value)
+
+template <class T>
+static T
+gripe_if_zero (T x)
+{
+  if (x == T ())
+    gripe_divide_by_zero ();
+  return x;
+}
+
+DEFBINOP (dmsdiv, MATRIX, SCALAR)
+{
+  CAST_BINOP_ARGS (const OCTAVE_MATRIX&, const OCTAVE_SCALAR&);
+
+  return v1.MATRIX_VALUE () / gripe_if_zero (v2.SCALAR_VALUE ());
+}
+
+DEFBINOP (sdmldiv, SCALAR, MATRIX)
+{
+  CAST_BINOP_ARGS (const OCTAVE_SCALAR&, const OCTAVE_MATRIX&);
+
+  return v2.MATRIX_VALUE () / gripe_if_zero (v1.SCALAR_VALUE ());
+}
+
+DEFBINOP (dmspow, MATRIX, SCALAR)
+{
+  CAST_BINOP_ARGS (const OCTAVE_MATRIX&, const OCTAVE_SCALAR&);
+
+  return xpow (v1.MATRIX_VALUE (), v2.SCALAR_VALUE ());
+}
+
+#define SHORT_NAME CONCAT3(MSHORT, _, SSHORT)
+#define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
+
+void
+INST_NAME (void)
+{
+  INSTALL_BINOP (op_mul, OCTAVE_MATRIX, OCTAVE_SCALAR, dmsmul);
+  INSTALL_BINOP (op_div, OCTAVE_MATRIX, OCTAVE_SCALAR, dmsdiv);
+  INSTALL_BINOP (op_mul, OCTAVE_SCALAR, OCTAVE_MATRIX, sdmmul);
+  INSTALL_BINOP (op_ldiv, OCTAVE_SCALAR, OCTAVE_MATRIX, sdmldiv);
+  INSTALL_BINOP (op_pow, OCTAVE_MATRIX, OCTAVE_SCALAR, dmspow);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-double-conv.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,119 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-re-sparse.h"
+#include "ov-bool-sparse.h"
+#include "ov-range.h"
+#include "ov-scalar.h"
+#include "ov-re-mat.h"
+#include "ov-str-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+// conversion ops
+
+DEFDBLCONVFN (int8_matrix_to_double_matrix, int8_matrix, int8_array)
+DEFDBLCONVFN (int16_matrix_to_double_matrix, int16_matrix, int16_array)
+DEFDBLCONVFN (int32_matrix_to_double_matrix, int32_matrix, int32_array)
+DEFDBLCONVFN (int64_matrix_to_double_matrix, int64_matrix, int64_array)
+
+DEFDBLCONVFN (uint8_matrix_to_double_matrix, uint8_matrix, uint8_array)
+DEFDBLCONVFN (uint16_matrix_to_double_matrix, uint16_matrix, uint16_array)
+DEFDBLCONVFN (uint32_matrix_to_double_matrix, uint32_matrix, uint32_array)
+DEFDBLCONVFN (uint64_matrix_to_double_matrix, uint64_matrix, uint64_array)
+
+DEFDBLCONVFN (int8_scalar_to_double_matrix, int8_scalar, int8_array)
+DEFDBLCONVFN (int16_scalar_to_double_matrix, int16_scalar, int16_array)
+DEFDBLCONVFN (int32_scalar_to_double_matrix, int32_scalar, int32_array)
+DEFDBLCONVFN (int64_scalar_to_double_matrix, int64_scalar, int64_array)
+
+DEFDBLCONVFN (uint8_scalar_to_double_matrix, uint8_scalar, uint8_array)
+DEFDBLCONVFN (uint16_scalar_to_double_matrix, uint16_scalar, uint16_array)
+DEFDBLCONVFN (uint32_scalar_to_double_matrix, uint32_scalar, uint32_array)
+DEFDBLCONVFN (uint64_scalar_to_double_matrix, uint64_scalar, uint64_array)
+
+DEFDBLCONVFN (bool_matrix_to_double_matrix, bool_matrix, bool_array)
+DEFDBLCONVFN (bool_scalar_to_double_matrix, bool, bool_array)
+
+DEFDBLCONVFN (sparse_matrix_to_double_matrix, sparse_matrix, array)
+DEFDBLCONVFN (sparse_bool_matrix_to_double_matrix, sparse_bool_matrix, array)
+
+DEFDBLCONVFN (range_to_double_matrix, range, array)
+
+DEFSTRDBLCONVFN(char_matrix_str_to_double_matrix, char_matrix_str)
+DEFSTRDBLCONVFN(char_matrix_sq_str_to_double_matrix, char_matrix_sq_str)
+
+DEFDBLCONVFN (double_scalar_to_double_matrix, scalar, array)
+
+void
+install_double_conv_ops (void)
+{
+  INSTALL_CONVOP (octave_int8_matrix, octave_matrix, int8_matrix_to_double_matrix);
+  INSTALL_CONVOP (octave_int16_matrix, octave_matrix, int16_matrix_to_double_matrix);
+  INSTALL_CONVOP (octave_int32_matrix, octave_matrix, int32_matrix_to_double_matrix);
+  INSTALL_CONVOP (octave_int64_matrix, octave_matrix, int64_matrix_to_double_matrix);
+
+  INSTALL_CONVOP (octave_uint8_matrix, octave_matrix, uint8_matrix_to_double_matrix);
+  INSTALL_CONVOP (octave_uint16_matrix, octave_matrix, uint16_matrix_to_double_matrix);
+  INSTALL_CONVOP (octave_uint32_matrix, octave_matrix, uint32_matrix_to_double_matrix);
+  INSTALL_CONVOP (octave_uint64_matrix, octave_matrix, uint64_matrix_to_double_matrix);
+
+  INSTALL_CONVOP (octave_int8_scalar, octave_matrix, int8_scalar_to_double_matrix);
+  INSTALL_CONVOP (octave_int16_scalar, octave_matrix, int16_scalar_to_double_matrix);
+  INSTALL_CONVOP (octave_int32_scalar, octave_matrix, int32_scalar_to_double_matrix);
+  INSTALL_CONVOP (octave_int64_scalar, octave_matrix, int64_scalar_to_double_matrix);
+
+  INSTALL_CONVOP (octave_uint8_scalar, octave_matrix, uint8_scalar_to_double_matrix);
+  INSTALL_CONVOP (octave_uint16_scalar, octave_matrix, uint16_scalar_to_double_matrix);
+  INSTALL_CONVOP (octave_uint32_scalar, octave_matrix, uint32_scalar_to_double_matrix);
+  INSTALL_CONVOP (octave_uint64_scalar, octave_matrix, uint64_scalar_to_double_matrix);
+
+  INSTALL_CONVOP (octave_bool_matrix, octave_matrix, bool_matrix_to_double_matrix);
+  INSTALL_CONVOP (octave_bool, octave_matrix, bool_scalar_to_double_matrix);
+
+  INSTALL_CONVOP (octave_sparse_matrix, octave_matrix, sparse_matrix_to_double_matrix);
+  INSTALL_CONVOP (octave_sparse_bool_matrix, octave_matrix, sparse_bool_matrix_to_double_matrix);
+
+  INSTALL_CONVOP (octave_range, octave_matrix, range_to_double_matrix);
+
+  INSTALL_CONVOP (octave_char_matrix_str, octave_matrix, char_matrix_str_to_double_matrix);
+  INSTALL_CONVOP (octave_char_matrix_sq_str, octave_matrix, char_matrix_sq_str_to_double_matrix);
+
+  INSTALL_CONVOP (octave_scalar, octave_matrix, double_scalar_to_double_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcdm-fcdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,112 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-flt-cx-diag.h"
+#include "ov-cx-diag.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix unary ops.
+
+DEFUNOP_OP (uplus, float_complex_diag_matrix, /* no-op */)
+DEFUNOP_OP (uminus, float_complex_diag_matrix, -)
+
+DEFUNOP (transpose, float_complex_diag_matrix)
+{
+  CAST_UNOP_ARG (const octave_float_complex_diag_matrix&);
+  return octave_value (v.float_complex_diag_matrix_value ().transpose ());
+}
+
+DEFUNOP (hermitian, float_complex_diag_matrix)
+{
+  CAST_UNOP_ARG (const octave_float_complex_diag_matrix&);
+  return octave_value (v.float_complex_diag_matrix_value ().hermitian ());
+}
+
+// matrix by matrix ops.
+
+DEFBINOP_OP (add, float_complex_diag_matrix, float_complex_diag_matrix, +)
+DEFBINOP_OP (sub, float_complex_diag_matrix, float_complex_diag_matrix, -)
+DEFBINOP_OP (mul, float_complex_diag_matrix, float_complex_diag_matrix, *)
+
+DEFBINOP (div, float_complex_diag_matrix, float_complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_diag_matrix&, const octave_float_complex_diag_matrix&);
+
+  return xdiv (v1.float_complex_diag_matrix_value (),
+               v2.float_complex_diag_matrix_value ());
+}
+
+DEFBINOP (ldiv, float_complex_diag_matrix, float_complex_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_diag_matrix&, const octave_float_complex_diag_matrix&);
+
+  return xleftdiv (v1.float_complex_diag_matrix_value (),
+                   v2.float_complex_diag_matrix_value ());
+}
+
+CONVDECL (float_complex_diag_matrix_to_float_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_float_complex_diag_matrix&);
+
+  return new octave_float_complex_matrix (v.float_complex_matrix_value ());
+}
+
+CONVDECL (float_complex_diag_matrix_to_complex_diag_matrix)
+{
+  CAST_CONV_ARG (const octave_float_complex_diag_matrix&);
+
+  return new octave_complex_diag_matrix (v.complex_diag_matrix_value ());
+}
+
+void
+install_fcdm_fcdm_ops (void)
+{
+  INSTALL_UNOP (op_uplus, octave_float_complex_diag_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_float_complex_diag_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_float_complex_diag_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_float_complex_diag_matrix, hermitian);
+
+  INSTALL_BINOP (op_add, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, div);
+  INSTALL_BINOP (op_ldiv, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, ldiv);
+
+  INSTALL_CONVOP (octave_float_complex_diag_matrix, octave_complex_diag_matrix,
+                  float_complex_diag_matrix_to_complex_diag_matrix);
+  INSTALL_CONVOP (octave_float_complex_diag_matrix, octave_float_complex_matrix,
+                  float_complex_diag_matrix_to_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_float_complex_diag_matrix, octave_float_complex_matrix, octave_float_complex_matrix);
+  INSTALL_WIDENOP (octave_float_complex_diag_matrix, octave_complex_diag_matrix,
+                   float_complex_diag_matrix_to_complex_diag_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcdm-fcm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-cx-diag.h"
+#define RINCLUDE "ov-flt-cx-mat.h"
+
+#define LMATRIX float_complex_diag_matrix
+#define RMATRIX float_complex_matrix
+
+#define LSHORT fcdm
+#define RSHORT fcm
+
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcdm-fcs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 SINCLUDE "ov-flt-complex.h"
+#define MINCLUDE "ov-flt-cx-diag.h"
+
+#define SCALAR float_complex
+#define MATRIX float_complex_diag_matrix
+
+#define SSHORT fcs
+#define MSHORT fcdm
+
+#include "op-dms-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcdm-fdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,51 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-flt-cx-diag.h"
+#include "ov-flt-re-diag.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#define LINCLUDE "ov-flt-cx-diag.h"
+#define RINCLUDE "ov-flt-re-diag.h"
+
+#define LMATRIX float_complex_diag_matrix
+#define RMATRIX float_diag_matrix
+#define RDMATRIX LMATRIX
+
+#define LSHORT fcdm
+#define RSHORT fdm
+
+#define DEFINEDIV
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcdm-fm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,36 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-cx-diag.h"
+#define RINCLUDE "ov-flt-re-mat.h"
+
+#define LMATRIX float_complex_diag_matrix
+#define RMATRIX float_matrix
+#define RDMATRIX float_complex_matrix
+
+#define LSHORT fcdm
+#define RSHORT fm
+
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcdm-fs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,34 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 SINCLUDE "ov-float.h"
+#define MINCLUDE "ov-flt-cx-diag.h"
+
+#define SCALAR float_scalar
+#define SCALARV float_complex
+#define MATRIX float_complex_diag_matrix
+
+#define SSHORT fs
+#define MSHORT fcdm
+
+#include "op-dms-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcm-fcdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-cx-mat.h"
+#define RINCLUDE "ov-flt-cx-diag.h"
+
+#define LMATRIX float_complex_matrix
+#define RMATRIX float_complex_diag_matrix
+
+#define LSHORT fcm
+#define RSHORT fcdm
+
+#define DEFINEDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcm-fcm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,335 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// unary complex matrix ops.
+
+DEFNDUNOP_OP (not, float_complex_matrix, float_complex_array, !)
+DEFNDUNOP_OP (uplus, float_complex_matrix, float_complex_array, /* no-op */)
+DEFNDUNOP_OP (uminus, float_complex_matrix, float_complex_array, -)
+
+DEFUNOP (transpose, float_complex_matrix)
+{
+  CAST_UNOP_ARG (const octave_float_complex_matrix&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.float_complex_matrix_value ().transpose ());
+}
+
+DEFUNOP (hermitian, float_complex_matrix)
+{
+  CAST_UNOP_ARG (const octave_float_complex_matrix&);
+
+  if (v.ndims () > 2)
+    {
+      error ("complex-conjugate transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.float_complex_matrix_value ().hermitian ());
+}
+
+DEFNCUNOP_METHOD (incr, float_complex_matrix, increment)
+DEFNCUNOP_METHOD (decr, float_complex_matrix, decrement)
+DEFNCUNOP_METHOD (changesign, float_complex_matrix, changesign)
+
+// complex matrix by complex matrix ops.
+
+DEFNDBINOP_OP (add, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, +)
+DEFNDBINOP_OP (sub, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, -)
+
+DEFBINOP_OP (mul, float_complex_matrix, float_complex_matrix, *)
+
+DEFBINOP (div, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (),
+                            v2.float_complex_matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, float_complex_matrix, float_complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
+                                     v2.float_complex_matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP (trans_mul, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&);
+  return octave_value(xgemm (v1.float_complex_matrix_value (),
+                             v2.float_complex_matrix_value (),
+                             blas_trans, blas_no_trans));
+}
+
+DEFBINOP (mul_trans, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&);
+  return octave_value(xgemm (v1.float_complex_matrix_value (),
+                             v2.float_complex_matrix_value (),
+                             blas_no_trans, blas_trans));
+}
+
+DEFBINOP (herm_mul, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&);
+  return octave_value(xgemm (v1.float_complex_matrix_value (),
+                             v2.float_complex_matrix_value (),
+                             blas_conj_trans, blas_no_trans));
+}
+
+DEFBINOP (mul_herm, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&);
+  return octave_value(xgemm (v1.float_complex_matrix_value (),
+                             v2.float_complex_matrix_value (),
+                             blas_no_trans, blas_conj_trans));
+}
+
+DEFBINOP (trans_ldiv, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
+                                     v2.float_complex_matrix_value (), typ, blas_trans);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP (herm_ldiv, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
+                                     v2.float_complex_matrix_value (), typ, blas_conj_trans);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, mx_el_ne)
+
+DEFNDBINOP_FN (el_mul, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, product)
+DEFNDBINOP_FN (el_div, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, quotient)
+DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, elem_xpow)
+
+DEFBINOP (el_ldiv, float_complex_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex_matrix&);
+
+  return octave_value (quotient (v2.float_complex_array_value (), v1.float_complex_array_value ()));
+}
+
+DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, mx_el_or)
+
+DEFNDCATOP_FN (fcm_fcm, float_complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, concat)
+
+DEFNDCATOP_FN (cm_fcm, complex_matrix, float_complex_matrix,
+               float_complex_array, float_complex_array, concat)
+
+DEFNDCATOP_FN (fcm_cm, float_complex_matrix, complex_matrix,
+               float_complex_array, float_complex_array, concat)
+
+DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex_matrix,
+                  float_complex_array, assign)
+DEFNDASSIGNOP_FN (dbl_clx_assign, float_complex_matrix, complex_matrix,
+                  float_complex_array, assign)
+DEFNDASSIGNOP_FN (dbl_assign, float_complex_matrix, matrix,
+                  float_complex_array, assign)
+
+DEFNULLASSIGNOP_FN (null_assign, float_complex_matrix, delete_elements)
+
+DEFNDASSIGNOP_OP (assign_add, float_complex_matrix,
+                  float_complex_matrix, float_complex_array, +=)
+DEFNDASSIGNOP_OP (assign_sub, float_complex_matrix,
+                  float_complex_matrix, float_complex_array, -=)
+DEFNDASSIGNOP_FNOP (assign_el_mul, float_complex_matrix, float_complex_matrix,
+                    float_complex_array, product_eq)
+DEFNDASSIGNOP_FNOP (assign_el_div, float_complex_matrix, float_complex_matrix,
+                    float_complex_array, quotient_eq)
+
+CONVDECL (float_complex_matrix_to_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_float_complex_matrix&);
+
+  return new octave_complex_matrix (ComplexNDArray (v.float_complex_array_value ()));
+}
+
+void
+install_fcm_fcm_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_float_complex_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_float_complex_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_float_complex_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_float_complex_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_float_complex_matrix, hermitian);
+
+  INSTALL_NCUNOP (op_incr, octave_float_complex_matrix, incr);
+  INSTALL_NCUNOP (op_decr, octave_float_complex_matrix, decr);
+  INSTALL_NCUNOP (op_uminus, octave_float_complex_matrix, changesign);
+
+  INSTALL_BINOP (op_add, octave_float_complex_matrix,
+                 octave_float_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_complex_matrix,
+                 octave_float_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex_matrix,
+                 octave_float_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_complex_matrix,
+                 octave_float_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_float_complex_matrix,
+                 octave_float_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_complex_matrix,
+                 octave_float_complex_matrix, ldiv);
+  INSTALL_BINOP (op_trans_mul, octave_float_complex_matrix,
+                 octave_float_complex_matrix, trans_mul);
+  INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix,
+                 octave_float_complex_matrix, mul_trans);
+  INSTALL_BINOP (op_herm_mul, octave_float_complex_matrix,
+                 octave_float_complex_matrix, herm_mul);
+  INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix,
+                 octave_float_complex_matrix, mul_herm);
+  INSTALL_BINOP (op_trans_ldiv, octave_float_complex_matrix,
+                 octave_float_complex_matrix, trans_ldiv);
+  INSTALL_BINOP (op_herm_ldiv, octave_float_complex_matrix,
+                 octave_float_complex_matrix, herm_ldiv);
+
+  INSTALL_BINOP (op_lt, octave_float_complex_matrix,
+                 octave_float_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_float_complex_matrix,
+                 octave_float_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_float_complex_matrix,
+                 octave_float_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_float_complex_matrix,
+                 octave_float_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_float_complex_matrix,
+                 octave_float_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_float_complex_matrix,
+                 octave_float_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_complex_matrix,
+                 octave_float_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_complex_matrix,
+                 octave_float_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_complex_matrix,
+                 octave_float_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix,
+                 octave_float_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_complex_matrix,
+                 octave_float_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_complex_matrix,
+                 octave_float_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_float_complex_matrix,
+                 octave_float_complex_matrix, fcm_fcm);
+  INSTALL_CATOP (octave_complex_matrix,
+                 octave_float_complex_matrix, cm_fcm);
+  INSTALL_CATOP (octave_float_complex_matrix,
+                 octave_complex_matrix, fcm_cm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_float_complex_matrix, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_complex_matrix, dbl_clx_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_matrix, dbl_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_null_sq_str, null_assign);
+
+  INSTALL_ASSIGNOP (op_add_eq, octave_float_complex_matrix,
+                    octave_float_complex_matrix, assign_add);
+  INSTALL_ASSIGNOP (op_sub_eq, octave_float_complex_matrix,
+                    octave_float_complex_matrix, assign_sub);
+  INSTALL_ASSIGNOP (op_el_mul_eq, octave_float_complex_matrix,
+                    octave_float_complex_matrix, assign_el_mul);
+  INSTALL_ASSIGNOP (op_el_div_eq, octave_float_complex_matrix,
+                    octave_float_complex_matrix, assign_el_div);
+
+  INSTALL_CONVOP (octave_float_complex_matrix, octave_complex_matrix,
+                  float_complex_matrix_to_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcm-fcs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,196 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-flt-complex.h"
+#include "ov-complex.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex matrix by complex scalar ops.
+
+DEFNDBINOP_OP (add, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, +)
+DEFNDBINOP_OP (sub, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, -)
+DEFNDBINOP_OP (mul, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, *)
+
+DEFBINOP (div, float_complex_matrix, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex&);
+
+  FloatComplex d = v2.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_complex_array_value () / d);
+}
+
+DEFBINOP_FN (pow, float_complex_matrix, float_complex, xpow)
+
+DEFBINOP (ldiv, float_complex_matrix, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex&);
+
+  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
+  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (m1, m2, typ);
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, *)
+
+DEFBINOP (el_div, float_complex_matrix, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex&);
+
+  FloatComplex d = v2.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_complex_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, elem_xpow)
+
+DEFBINOP (el_ldiv, float_complex_matrix, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_complex&);
+
+  return x_el_div (v2.float_complex_value (), v1.float_complex_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex,
+               float_complex_array, float_complex, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_complex_matrix, float_complex,
+               float_complex_array, float_complex, mx_el_or)
+
+DEFNDCATOP_FN (fcm_fcs, float_complex_matrix, float_complex,
+               float_complex_array, float_complex_array, concat)
+
+DEFNDCATOP_FN (cm_fcs, complex_matrix, float_complex,
+               float_complex_array, float_complex_array, concat)
+
+DEFNDCATOP_FN (fcm_cs, float_complex_matrix, complex,
+               float_complex_array, float_complex_array, concat)
+
+DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex,
+                  float_complex, assign)
+DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_complex,
+                  complex, assign)
+
+DEFNDASSIGNOP_OP (assign_add, float_complex_matrix, float_complex_scalar,
+                  float_complex, +=)
+DEFNDASSIGNOP_OP (assign_sub, float_complex_matrix, float_complex_scalar,
+                  float_complex, -=)
+DEFNDASSIGNOP_OP (assign_mul, float_complex_matrix, float_complex_scalar,
+                  float_complex, *=)
+DEFNDASSIGNOP_OP (assign_div, float_complex_matrix, float_complex_scalar,
+                  float_complex, /=)
+
+void
+install_fcm_fcs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_complex_matrix,
+                 octave_float_complex, add);
+  INSTALL_BINOP (op_sub, octave_float_complex_matrix,
+                 octave_float_complex, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex_matrix,
+                 octave_float_complex, mul);
+  INSTALL_BINOP (op_div, octave_float_complex_matrix,
+                 octave_float_complex, div);
+  INSTALL_BINOP (op_pow, octave_float_complex_matrix,
+                 octave_float_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_complex_matrix,
+                 octave_float_complex, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_complex, lt);
+  INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_complex, le);
+  INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_complex, eq);
+  INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_complex, ge);
+  INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_complex, gt);
+  INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_complex_matrix,
+                 octave_float_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_complex_matrix,
+                 octave_float_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_complex_matrix,
+                 octave_float_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix,
+                 octave_float_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_complex_matrix,
+                 octave_float_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_complex_matrix,
+                 octave_float_complex, el_or);
+
+  INSTALL_CATOP (octave_float_complex_matrix, octave_float_complex, fcm_fcs);
+  INSTALL_CATOP (octave_complex_matrix, octave_float_complex, cm_fcs);
+  INSTALL_CATOP (octave_float_complex_matrix, octave_complex, fcm_cs);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_float_complex, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
+                    octave_float_complex, dbl_assign);
+
+  INSTALL_ASSIGNOP (op_add_eq, octave_float_complex_matrix,
+                    octave_float_complex_scalar, assign_add);
+  INSTALL_ASSIGNOP (op_sub_eq, octave_float_complex_matrix,
+                    octave_float_complex_scalar, assign_sub);
+  INSTALL_ASSIGNOP (op_mul_eq, octave_float_complex_matrix,
+                    octave_float_complex_scalar, assign_mul);
+  INSTALL_ASSIGNOP (op_div_eq, octave_float_complex_matrix,
+                    octave_float_complex_scalar, assign_div);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcm-fdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-cx-mat.h"
+#define RINCLUDE "ov-flt-re-diag.h"
+
+#define LMATRIX float_complex_matrix
+#define RMATRIX float_diag_matrix
+
+#define LSHORT fcm
+#define RSHORT fdm
+
+#define DEFINEDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcm-fm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,183 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-fcm-fm.h"
+#include "mx-fm-fcm.h"
+#include "mx-fcnda-fnda.h"
+#include "mx-fnda-fcnda.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex matrix by matrix ops.
+
+DEFNDBINOP_OP (add, float_complex_matrix, float_matrix, float_complex_array, float_array, +)
+DEFNDBINOP_OP (sub, float_complex_matrix, float_matrix, float_complex_array, float_array, -)
+
+DEFBINOP_OP (mul, float_complex_matrix, float_matrix, *)
+
+DEFBINOP (mul_trans, float_complex_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_matrix&);
+
+  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
+  FloatMatrix m2 = v2.float_matrix_value ();
+
+  return FloatComplexMatrix (xgemm (real (m1), m2, blas_no_trans, blas_trans),
+                             xgemm (imag (m1), m2, blas_no_trans, blas_trans));
+}
+
+DEFBINOP (div, float_complex_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (),
+                                 v2.float_matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+
+DEFBINOPX (pow, float_complex_matrix, float_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, float_complex_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
+                                     v2.float_matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, mx_el_ne)
+
+DEFNDBINOP_FN (el_mul, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, product)
+DEFNDBINOP_FN (el_div, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, quotient)
+DEFNDBINOP_FN (el_pow, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, elem_xpow)
+
+DEFBINOP (el_ldiv, float_complex_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&,
+                   const octave_float_matrix&);
+
+  return quotient (v2.float_array_value (), v1.float_complex_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_complex_matrix, float_matrix,
+               float_complex_array, float_array, mx_el_or)
+
+DEFNDCATOP_FN (fcm_fm, float_complex_matrix, float_matrix,
+               float_complex_array, float_array, concat)
+
+DEFNDCATOP_FN (cm_fm, complex_matrix, float_matrix,
+               float_complex_array, float_array, concat)
+
+DEFNDCATOP_FN (fcm_m, float_complex_matrix, matrix,
+               float_complex_array, float_array, concat)
+
+DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_matrix,
+                  float_complex_array, assign)
+DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_matrix,
+                  complex_array, assign)
+
+void
+install_fcm_fm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_complex_matrix, octave_float_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_complex_matrix, octave_float_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_matrix, div);
+  INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_complex_matrix,
+                 octave_float_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_matrix, lt);
+  INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_matrix, le);
+  INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_complex_matrix,
+                 octave_float_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_complex_matrix,
+                 octave_float_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_complex_matrix,
+                 octave_float_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix,
+                 octave_float_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_complex_matrix,
+                 octave_float_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_complex_matrix,
+                 octave_float_matrix, el_or);
+  INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix,
+                 octave_float_matrix, mul_trans);
+  INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix,
+                 octave_float_matrix, mul_trans);
+
+  INSTALL_CATOP (octave_float_complex_matrix, octave_float_matrix, fcm_fm);
+  INSTALL_CATOP (octave_complex_matrix, octave_float_matrix, cm_fm);
+  INSTALL_CATOP (octave_float_complex_matrix, octave_matrix, fcm_m);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_float_matrix, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
+                    octave_float_matrix, dbl_assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcm-fs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,172 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-cm-s.h"
+#include "mx-cnda-s.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-float.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex matrix by scalar ops.
+
+DEFNDBINOP_OP (add, float_complex_matrix, float_scalar, float_complex_array, float_scalar, +)
+DEFNDBINOP_OP (sub, float_complex_matrix, float_scalar, float_complex_array, float_scalar, -)
+DEFNDBINOP_OP (mul, float_complex_matrix, float_scalar, float_complex_array, float_scalar, *)
+
+DEFBINOP (div, float_complex_matrix, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_scalar&);
+
+  float d = v2.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_complex_array_value () / d);
+}
+
+DEFBINOP_FN (pow, float_complex_matrix, float_scalar, xpow)
+
+DEFBINOP (ldiv, float_complex_matrix, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_scalar&);
+
+  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
+  FloatMatrix m2 = v2.float_matrix_value ();
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (m1, m2, typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, *)
+
+DEFBINOP (el_div, float_complex_matrix, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_scalar&);
+
+  float d = v2.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_complex_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_pow, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, elem_xpow)
+
+DEFBINOP (el_ldiv, float_complex_matrix, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_scalar&);
+
+  return x_el_div (v2.float_value (), v1.float_complex_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_complex_matrix, float_scalar, float_complex_array,
+               float_scalar, mx_el_or)
+
+DEFNDCATOP_FN (fcm_fs, float_complex_matrix, float_scalar, float_complex_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (cm_fs, complex_matrix, float_scalar, float_complex_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (fcm_s, float_complex_matrix, scalar, float_complex_array,
+               float_array, concat)
+
+DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_scalar, float_complex_array, assign)
+DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_scalar, complex_array, assign)
+
+DEFNDASSIGNOP_OP (assign_mul, float_complex_matrix, float_scalar,
+                  float_scalar, *=)
+DEFNDASSIGNOP_OP (assign_div, float_complex_matrix, float_scalar,
+                  float_scalar, /=)
+
+void
+install_fcm_fs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_complex_matrix, octave_float_scalar, add);
+  INSTALL_BINOP (op_sub, octave_float_complex_matrix, octave_float_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_scalar, mul);
+  INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_scalar, div);
+  INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_complex_matrix, octave_float_scalar, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_scalar, lt);
+  INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_scalar, le);
+  INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_complex_matrix, octave_float_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_complex_matrix, octave_float_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_complex_matrix, octave_float_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix, octave_float_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_complex_matrix, octave_float_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_complex_matrix, octave_float_scalar, el_or);
+
+  INSTALL_CATOP (octave_float_complex_matrix, octave_float_scalar, fcm_fs);
+  INSTALL_CATOP (octave_complex_matrix, octave_float_scalar, cm_fs);
+  INSTALL_CATOP (octave_float_complex_matrix, octave_scalar, fcm_s);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
+                    octave_float_scalar, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
+                    octave_float_scalar, dbl_assign);
+
+  INSTALL_ASSIGNOP (op_mul_eq, octave_float_complex_matrix,
+                    octave_float_scalar, assign_mul);
+  INSTALL_ASSIGNOP (op_div_eq, octave_float_complex_matrix,
+                    octave_float_scalar, assign_div);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcm-pm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 MINCLUDE "ov-flt-cx-mat.h"
+
+#define LMATRIX float_complex_matrix
+#define RMATRIX perm_matrix
+
+#define LSHORT fcm
+#define RSHORT pm
+
+#define RIGHT
+
+#include "op-pm-template.cc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcn.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,54 @@
+/*
+
+Copyright (C) 2010-2012 VZLU Prague
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-fcn-handle.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+DEFBINOP (eq, fcn_handle, fcn_handle)
+{
+  CAST_BINOP_ARGS (const octave_fcn_handle&, const octave_fcn_handle&);
+
+  return v1.is_equal_to (v2);
+}
+
+DEFBINOP (ne, fcn_handle, fcn_handle)
+{
+  CAST_BINOP_ARGS (const octave_fcn_handle&, const octave_fcn_handle&);
+
+  return ! v1.is_equal_to (v2);
+}
+
+void
+install_fcn_ops (void)
+{
+  INSTALL_BINOP (op_eq, octave_fcn_handle, octave_fcn_handle, eq);
+  INSTALL_BINOP (op_ne, octave_fcn_handle, octave_fcn_handle, ne);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcs-fcm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,152 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex scalar by complex matrix ops.
+
+DEFNDBINOP_OP (add, float_complex, float_complex_matrix, float_complex, float_complex_array, +)
+DEFNDBINOP_OP (sub, float_complex, float_complex_matrix, float_complex, float_complex_array, -)
+DEFNDBINOP_OP (mul, float_complex, float_complex_matrix, float_complex, float_complex_array, *)
+
+DEFBINOP (div, float_complex, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
+
+  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
+  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
+  MatrixType typ = v2.matrix_type ();
+
+  FloatComplexMatrix ret = xdiv (m1, m2, typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (pow, float_complex, float_complex_matrix, xpow)
+
+DEFBINOP (ldiv, float_complex, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
+
+  FloatComplex d = v1.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_complex_array_value () / d);
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, *)
+DEFNDBINOP_FN (el_div, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, x_el_div)
+DEFNDBINOP_FN (el_pow, float_complex, float_complex_matrix, float_complex,
+               float_complex_array, elem_xpow)
+
+DEFBINOP (el_ldiv, float_complex, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex_matrix&);
+
+  FloatComplex d = v1.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_complex_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_and, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_or)
+
+DEFNDCATOP_FN (fcs_fcm, float_complex, float_complex_matrix, float_complex_array, float_complex_array, concat)
+
+DEFNDCATOP_FN (cs_fcm, complex, float_complex_matrix, float_complex_array, float_complex_array, concat)
+
+DEFNDCATOP_FN (fcs_cm, float_complex, complex_matrix, float_complex_array, float_complex_array, concat)
+
+DEFCONV (float_complex_matrix_conv, float_complex, float_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_float_complex&);
+
+  return new octave_float_complex_matrix (v.float_complex_matrix_value ());
+}
+
+void
+install_fcs_fcm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_complex, octave_float_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_complex, octave_float_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex, octave_float_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_complex, octave_float_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_float_complex, octave_float_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_complex, octave_float_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_float_complex, octave_float_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_float_complex, octave_float_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_float_complex, octave_float_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_float_complex, octave_float_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_float_complex, octave_float_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_float_complex, octave_float_complex_matrix, fcs_fcm);
+  INSTALL_CATOP (octave_complex, octave_float_complex_matrix, cs_fcm);
+  INSTALL_CATOP (octave_float_complex, octave_complex_matrix, fcs_cm);
+
+  INSTALL_ASSIGNCONV (octave_float_complex, octave_float_complex_matrix, octave_float_complex_matrix);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_float_complex_matrix, octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_float_complex, octave_float_complex_matrix, float_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcs-fcs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,208 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// unary complex scalar ops.
+
+DEFUNOP (not, float_complex)
+{
+  CAST_UNOP_ARG (const octave_float_complex&);
+  FloatComplex x = v.float_complex_value ();
+  if (xisnan (x))
+    gripe_nan_to_logical_conversion ();
+  return octave_value (x == 0.0f);
+}
+
+DEFUNOP_OP (uplus, float_complex, /* no-op */)
+DEFUNOP_OP (uminus, float_complex, -)
+DEFUNOP_OP (transpose, float_complex, /* no-op */)
+
+DEFUNOP (hermitian, float_complex)
+{
+  CAST_UNOP_ARG (const octave_float_complex&);
+
+  return octave_value (conj (v.float_complex_value ()));
+}
+
+DEFNCUNOP_METHOD (incr, float_complex, increment)
+DEFNCUNOP_METHOD (decr, float_complex, decrement)
+
+// complex scalar by complex scalar ops.
+
+DEFBINOP_OP (add, float_complex, float_complex, +)
+DEFBINOP_OP (sub, float_complex, float_complex, -)
+DEFBINOP_OP (mul, float_complex, float_complex, *)
+
+DEFBINOP (div, float_complex, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
+
+  FloatComplex d = v2.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_complex_value () / d);
+}
+
+DEFBINOP_FN (pow, float_complex, float_complex, xpow)
+
+DEFBINOP (ldiv, float_complex, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
+
+  FloatComplex d = v1.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_complex_value () / d);
+}
+
+DEFCMPLXCMPOP_OP (lt, float_complex, float_complex, <)
+DEFCMPLXCMPOP_OP (le, float_complex, float_complex, <=)
+DEFCMPLXCMPOP_OP (eq, float_complex, float_complex, ==)
+DEFCMPLXCMPOP_OP (ge, float_complex, float_complex, >=)
+DEFCMPLXCMPOP_OP (gt, float_complex, float_complex, >)
+DEFCMPLXCMPOP_OP (ne, float_complex, float_complex, !=)
+
+DEFBINOP_OP (el_mul, float_complex, float_complex, *)
+
+DEFBINOP (el_div, float_complex, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
+
+  FloatComplex d = v2.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_complex_value () / d);
+}
+
+DEFBINOP_FN (el_pow, float_complex, float_complex, xpow)
+
+DEFBINOP (el_ldiv, float_complex, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
+
+  FloatComplex d = v1.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_complex_value () / d);
+}
+
+DEFBINOP (el_and, float_complex, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
+
+  return (v1.float_complex_value () != static_cast<float>(0.0) &&
+          v2.float_complex_value () != static_cast<float>(0.0));
+}
+
+DEFBINOP (el_or, float_complex, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&);
+
+  return (v1.float_complex_value () != static_cast<float>(0.0) ||
+          v2.float_complex_value () != static_cast<float>(0.0));
+}
+
+DEFNDCATOP_FN (fcs_fcs, float_complex, float_complex, float_complex_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (cs_fcs, complex, float_complex, float_complex_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (fcs_cs, float_complex, complex, float_complex_array,
+               float_complex_array, concat)
+
+CONVDECL (float_complex_to_complex)
+{
+  CAST_CONV_ARG (const octave_float_complex&);
+
+  return new octave_complex_matrix (ComplexMatrix (1, 1, static_cast<Complex>(v.float_complex_value ())));
+}
+
+void
+install_fcs_fcs_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_float_complex, not);
+  INSTALL_UNOP (op_uplus, octave_float_complex, uplus);
+  INSTALL_UNOP (op_uminus, octave_float_complex, uminus);
+  INSTALL_UNOP (op_transpose, octave_float_complex, transpose);
+  INSTALL_UNOP (op_hermitian, octave_float_complex, hermitian);
+
+  INSTALL_NCUNOP (op_incr, octave_float_complex, incr);
+  INSTALL_NCUNOP (op_decr, octave_float_complex, decr);
+
+  INSTALL_BINOP (op_add, octave_float_complex, octave_float_complex, add);
+  INSTALL_BINOP (op_sub, octave_float_complex, octave_float_complex, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex, octave_float_complex, mul);
+  INSTALL_BINOP (op_div, octave_float_complex, octave_float_complex, div);
+  INSTALL_BINOP (op_pow, octave_float_complex, octave_float_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_complex, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_complex, octave_float_complex, lt);
+  INSTALL_BINOP (op_le, octave_float_complex, octave_float_complex, le);
+  INSTALL_BINOP (op_eq, octave_float_complex, octave_float_complex, eq);
+  INSTALL_BINOP (op_ge, octave_float_complex, octave_float_complex, ge);
+  INSTALL_BINOP (op_gt, octave_float_complex, octave_float_complex, gt);
+  INSTALL_BINOP (op_ne, octave_float_complex, octave_float_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_complex, el_or);
+
+  INSTALL_CATOP (octave_float_complex, octave_float_complex, fcs_fcs);
+  INSTALL_CATOP (octave_complex, octave_float_complex, cs_fcs);
+  INSTALL_CATOP (octave_float_complex, octave_complex, fcs_cs);
+
+  INSTALL_ASSIGNCONV (octave_float_complex, octave_float_complex, octave_float_complex_matrix);
+
+  INSTALL_ASSIGNCONV (octave_complex, octave_float_complex, octave_complex_matrix);
+
+  INSTALL_ASSIGNCONV (octave_float_complex, octave_null_matrix, octave_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_float_complex, octave_null_str, octave_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_float_complex, octave_null_sq_str, octave_float_complex_matrix);
+
+  INSTALL_CONVOP (octave_float_complex, octave_complex_matrix,
+                  float_complex_to_complex);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcs-fm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,156 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-cs-nda.h"
+#include "mx-nda-cs.h"
+#include "mx-cs-nda.h"
+#include "mx-nda-cs.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex scalar by matrix ops.
+
+DEFNDBINOP_OP (add, float_complex, float_matrix, float_complex, float_array, +)
+DEFNDBINOP_OP (sub, float_complex, float_matrix, float_complex, float_array, -)
+DEFNDBINOP_OP (mul, float_complex, float_matrix, float_complex, float_array, *)
+
+DEFBINOP (div, float_complex, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_matrix&);
+
+  FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
+  FloatMatrix m2 = v2.float_matrix_value ();
+  MatrixType typ = v2.matrix_type ();
+
+  FloatComplexMatrix ret = xdiv (m1, m2, typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (pow, float_complex, float_matrix, xpow)
+
+DEFBINOP (ldiv, float_complex, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_matrix&);
+
+  FloatComplex d = v1.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_array_value () / d);
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_complex, float_matrix, float_complex,
+               float_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_complex, float_matrix, float_complex,
+               float_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_complex, float_matrix, float_complex,
+               float_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_complex, float_matrix, float_complex,
+               float_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_complex, float_matrix, float_complex,
+               float_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_complex, float_matrix, float_complex,
+               float_array, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, float_complex, float_matrix, float_complex,
+               float_array, *)
+DEFNDBINOP_FN (el_div, float_complex, float_matrix, float_complex,
+               float_array, x_el_div)
+DEFNDBINOP_FN (el_pow, float_complex, float_matrix, float_complex,
+               float_array, elem_xpow)
+
+DEFBINOP (el_ldiv, float_complex, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_matrix&);
+
+  FloatComplex d = v1.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_and, float_complex, float_matrix, float_complex,
+               float_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_complex, float_matrix, float_complex,
+               float_array, mx_el_or)
+
+DEFNDCATOP_FN (fcs_fm, float_complex, float_matrix, float_complex_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (cs_fm, complex, float_matrix, float_complex_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (fcs_m, float_complex, matrix, float_complex_array,
+               float_array, concat)
+
+void
+install_fcs_fm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_complex, octave_float_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_complex, octave_float_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex, octave_float_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_complex, octave_float_matrix, div);
+  INSTALL_BINOP (op_pow, octave_float_complex, octave_float_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_complex, octave_float_matrix, lt);
+  INSTALL_BINOP (op_le, octave_float_complex, octave_float_matrix, le);
+  INSTALL_BINOP (op_eq, octave_float_complex, octave_float_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_float_complex, octave_float_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_float_complex, octave_float_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_float_complex, octave_float_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_matrix, el_or);
+
+  INSTALL_CATOP (octave_float_complex, octave_float_matrix, fcs_fm);
+  INSTALL_CATOP (octave_complex, octave_float_matrix, cs_fm);
+  INSTALL_CATOP (octave_float_complex, octave_matrix, fcs_m);
+
+  INSTALL_ASSIGNCONV (octave_float_complex, octave_float_matrix,
+                      octave_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_complex, octave_float_matrix,
+                      octave_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fcs-fs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,163 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-float.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// complex scalar by scalar ops.
+
+DEFBINOP_OP (add, float_complex, float_scalar, +)
+DEFBINOP_OP (sub, float_complex, float_scalar, -)
+DEFBINOP_OP (mul, float_complex, float_scalar, *)
+
+DEFBINOP (div, float_complex, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
+
+  float d = v2.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_complex_value () / d);
+}
+
+DEFBINOP_FN (pow, float_complex, float_scalar, xpow)
+
+DEFBINOP (ldiv, float_complex, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
+
+  FloatComplex d = v1.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_value () / d);
+}
+
+DEFCMPLXCMPOP_OP (lt, float_complex, float_scalar, <)
+DEFCMPLXCMPOP_OP (le, float_complex, float_scalar, <=)
+DEFCMPLXCMPOP_OP (eq, float_complex, float_scalar, ==)
+DEFCMPLXCMPOP_OP (ge, float_complex, float_scalar, >=)
+DEFCMPLXCMPOP_OP (gt, float_complex, float_scalar, >)
+DEFCMPLXCMPOP_OP (ne, float_complex, float_scalar, !=)
+
+DEFBINOP_OP (el_mul, float_complex, float_scalar, *)
+
+DEFBINOP (el_div, float_complex, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
+
+  float d = v2.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_complex_value () / d);
+}
+
+DEFBINOP_FN (el_pow, float_complex, float_scalar, xpow)
+
+DEFBINOP (el_ldiv, float_complex, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
+
+  FloatComplex d = v1.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_value () / d);
+}
+
+DEFBINOP (el_and, float_complex, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
+
+  return (v1.float_complex_value () != static_cast<float>(0.0) &&
+          v2.float_value ());
+}
+
+DEFBINOP (el_or, float_complex, float)
+{
+  CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&);
+
+  return (v1.float_complex_value () != static_cast<float>(0.0) ||
+          v2.float_value ());
+}
+
+DEFNDCATOP_FN (fcs_fs, float_complex, float_scalar, float_complex_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (cs_fs, complex, float_scalar, float_complex_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (fcs_s, float_complex, scalar, float_complex_array,
+               float_array, concat)
+
+void
+install_fcs_fs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_complex, octave_float_scalar, add);
+  INSTALL_BINOP (op_sub, octave_float_complex, octave_float_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_float_complex, octave_float_scalar, mul);
+  INSTALL_BINOP (op_div, octave_float_complex, octave_float_scalar, div);
+  INSTALL_BINOP (op_pow, octave_float_complex, octave_float_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_complex, octave_float_scalar, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_complex, octave_float_scalar, lt);
+  INSTALL_BINOP (op_le, octave_float_complex, octave_float_scalar, le);
+  INSTALL_BINOP (op_eq, octave_float_complex, octave_float_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_float_complex, octave_float_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_float_complex, octave_float_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_float_complex, octave_float_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_complex, octave_float_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_complex, octave_float_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_complex, octave_float_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_complex, octave_float_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_complex, octave_float_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_complex, octave_float_scalar, el_or);
+
+  INSTALL_CATOP (octave_float_complex, octave_float_scalar, fcs_fs);
+  INSTALL_CATOP (octave_complex, octave_float_scalar, cs_fs);
+  INSTALL_CATOP (octave_float_complex, octave_scalar, fcs_s);
+
+  INSTALL_ASSIGNCONV (octave_float_complex, octave_float_scalar,
+                      octave_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_complex, octave_float_scalar,
+                      octave_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fdm-fcdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,37 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-re-diag.h"
+#define RINCLUDE "ov-flt-cx-diag.h"
+
+#define LMATRIX float_diag_matrix
+#define RMATRIX float_complex_diag_matrix
+#define LDMATRIX RMATRIX
+
+#define LSHORT fdm
+#define RSHORT fcdm
+
+#define DEFINEDIV
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fdm-fcm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-re-diag.h"
+#define RINCLUDE "ov-flt-cx-mat.h"
+
+#define LMATRIX float_diag_matrix
+#define RMATRIX float_complex_matrix
+
+#define LSHORT fdm
+#define RSHORT fcm
+
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fdm-fcs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,34 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 SINCLUDE "ov-flt-complex.h"
+#define MINCLUDE "ov-flt-re-diag.h"
+
+#define SCALAR float_complex
+#define MATRIX float_diag_matrix
+#define MATRIXV float_complex_diag_matrix
+
+#define SSHORT fcs
+#define MSHORT fdm
+
+#include "op-dms-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fdm-fdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,103 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-flt-re-mat.h"
+#include "ov-flt-re-diag.h"
+#include "ov-re-diag.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix unary ops.
+
+DEFUNOP_OP (uplus, float_diag_matrix, /* no-op */)
+DEFUNOP_OP (uminus, float_diag_matrix, -)
+
+DEFUNOP (transpose, float_diag_matrix)
+{
+  CAST_UNOP_ARG (const octave_float_diag_matrix&);
+  return octave_value (v.float_diag_matrix_value ().transpose ());
+}
+
+// matrix by matrix ops.
+
+DEFBINOP_OP (add, float_diag_matrix, float_diag_matrix, +)
+DEFBINOP_OP (sub, float_diag_matrix, float_diag_matrix, -)
+DEFBINOP_OP (mul, float_diag_matrix, float_diag_matrix, *)
+
+DEFBINOP (div, float_diag_matrix, float_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_diag_matrix&, const octave_float_diag_matrix&);
+
+  return xdiv (v1.float_diag_matrix_value (),
+               v2.float_diag_matrix_value ());
+}
+
+DEFBINOP (ldiv, float_diag_matrix, float_diag_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_diag_matrix&, const octave_float_diag_matrix&);
+
+  return xleftdiv (v1.float_diag_matrix_value (),
+                   v2.float_diag_matrix_value ());
+}
+
+CONVDECL (float_diag_matrix_to_diag_matrix)
+{
+  CAST_CONV_ARG (const octave_float_diag_matrix&);
+
+  return new octave_diag_matrix (v.diag_matrix_value ());
+}
+
+CONVDECL (float_diag_matrix_to_float_matrix)
+{
+  CAST_CONV_ARG (const octave_float_diag_matrix&);
+
+  return new octave_float_matrix (v.float_matrix_value ());
+}
+
+void
+install_fdm_fdm_ops (void)
+{
+  INSTALL_UNOP (op_uplus, octave_float_diag_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_float_diag_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_float_diag_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_float_diag_matrix, transpose);
+
+  INSTALL_BINOP (op_add, octave_float_diag_matrix, octave_float_diag_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_diag_matrix, octave_float_diag_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_diag_matrix, octave_float_diag_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_diag_matrix, octave_float_diag_matrix, div);
+  INSTALL_BINOP (op_ldiv, octave_float_diag_matrix, octave_float_diag_matrix, ldiv);
+
+  INSTALL_CONVOP (octave_float_diag_matrix, octave_float_matrix, float_diag_matrix_to_float_matrix);
+  INSTALL_CONVOP (octave_float_diag_matrix, octave_diag_matrix, float_diag_matrix_to_diag_matrix);
+  INSTALL_ASSIGNCONV (octave_float_diag_matrix, octave_float_matrix, octave_float_matrix);
+  INSTALL_WIDENOP (octave_float_diag_matrix, octave_float_matrix, float_diag_matrix_to_float_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fdm-fm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-re-diag.h"
+#define RINCLUDE "ov-flt-re-mat.h"
+
+#define LMATRIX float_diag_matrix
+#define RMATRIX float_matrix
+
+#define LSHORT fdm
+#define RSHORT fm
+
+#define DEFINELDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fdm-fs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 SINCLUDE "ov-float.h"
+#define MINCLUDE "ov-flt-re-diag.h"
+
+#define SCALAR float_scalar
+#define MATRIX float_diag_matrix
+
+#define SSHORT fs
+#define MSHORT fdm
+
+#include "op-dms-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-float-conv.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,111 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-range.h"
+#include "ov-float.h"
+#include "ov-flt-re-mat.h"
+#include "ov-str-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+// conversion ops
+
+DEFFLTCONVFN (int8_matrix_to_float_matrix, int8_matrix, int8_array)
+DEFFLTCONVFN (int16_matrix_to_float_matrix, int16_matrix, int16_array)
+DEFFLTCONVFN (int32_matrix_to_float_matrix, int32_matrix, int32_array)
+DEFFLTCONVFN (int64_matrix_to_float_matrix, int64_matrix, int64_array)
+
+DEFFLTCONVFN (uint8_matrix_to_float_matrix, uint8_matrix, uint8_array)
+DEFFLTCONVFN (uint16_matrix_to_float_matrix, uint16_matrix, uint16_array)
+DEFFLTCONVFN (uint32_matrix_to_float_matrix, uint32_matrix, uint32_array)
+DEFFLTCONVFN (uint64_matrix_to_float_matrix, uint64_matrix, uint64_array)
+
+DEFFLTCONVFN (int8_scalar_to_float_matrix, int8_scalar, int8_array)
+DEFFLTCONVFN (int16_scalar_to_float_matrix, int16_scalar, int16_array)
+DEFFLTCONVFN (int32_scalar_to_float_matrix, int32_scalar, int32_array)
+DEFFLTCONVFN (int64_scalar_to_float_matrix, int64_scalar, int64_array)
+
+DEFFLTCONVFN (uint8_scalar_to_float_matrix, uint8_scalar, uint8_array)
+DEFFLTCONVFN (uint16_scalar_to_float_matrix, uint16_scalar, uint16_array)
+DEFFLTCONVFN (uint32_scalar_to_float_matrix, uint32_scalar, uint32_array)
+DEFFLTCONVFN (uint64_scalar_to_float_matrix, uint64_scalar, uint64_array)
+
+DEFFLTCONVFN (bool_matrix_to_float_matrix, bool_matrix, bool_array)
+DEFFLTCONVFN (bool_scalar_to_float_matrix, bool, bool_array)
+
+DEFFLTCONVFN (range_to_float_matrix, range, array)
+
+DEFSTRFLTCONVFN(char_matrix_str_to_float_matrix, char_matrix_str)
+DEFSTRFLTCONVFN(char_matrix_sq_str_to_float_matrix, char_matrix_sq_str)
+
+DEFFLTCONVFN (float_scalar_to_float_matrix, scalar, array)
+
+void
+install_float_conv_ops (void)
+{
+  INSTALL_CONVOP (octave_int8_matrix, octave_float_matrix, int8_matrix_to_float_matrix);
+  INSTALL_CONVOP (octave_int16_matrix, octave_float_matrix, int16_matrix_to_float_matrix);
+  INSTALL_CONVOP (octave_int32_matrix, octave_float_matrix, int32_matrix_to_float_matrix);
+  INSTALL_CONVOP (octave_int64_matrix, octave_float_matrix, int64_matrix_to_float_matrix);
+
+  INSTALL_CONVOP (octave_uint8_matrix, octave_float_matrix, uint8_matrix_to_float_matrix);
+  INSTALL_CONVOP (octave_uint16_matrix, octave_float_matrix, uint16_matrix_to_float_matrix);
+  INSTALL_CONVOP (octave_uint32_matrix, octave_float_matrix, uint32_matrix_to_float_matrix);
+  INSTALL_CONVOP (octave_uint64_matrix, octave_float_matrix, uint64_matrix_to_float_matrix);
+
+  INSTALL_CONVOP (octave_int8_scalar, octave_float_matrix, int8_scalar_to_float_matrix);
+  INSTALL_CONVOP (octave_int16_scalar, octave_float_matrix, int16_scalar_to_float_matrix);
+  INSTALL_CONVOP (octave_int32_scalar, octave_float_matrix, int32_scalar_to_float_matrix);
+  INSTALL_CONVOP (octave_int64_scalar, octave_float_matrix, int64_scalar_to_float_matrix);
+
+  INSTALL_CONVOP (octave_uint8_scalar, octave_float_matrix, uint8_scalar_to_float_matrix);
+  INSTALL_CONVOP (octave_uint16_scalar, octave_float_matrix, uint16_scalar_to_float_matrix);
+  INSTALL_CONVOP (octave_uint32_scalar, octave_float_matrix, uint32_scalar_to_float_matrix);
+  INSTALL_CONVOP (octave_uint64_scalar, octave_float_matrix, uint64_scalar_to_float_matrix);
+
+  INSTALL_CONVOP (octave_bool_matrix, octave_float_matrix, bool_matrix_to_float_matrix);
+  INSTALL_CONVOP (octave_bool, octave_float_matrix, bool_scalar_to_float_matrix);
+
+  INSTALL_CONVOP (octave_range, octave_float_matrix, range_to_float_matrix);
+
+  INSTALL_CONVOP (octave_char_matrix_str, octave_float_matrix, char_matrix_str_to_float_matrix);
+  INSTALL_CONVOP (octave_char_matrix_sq_str, octave_float_matrix, char_matrix_sq_str_to_float_matrix);
+
+  INSTALL_CONVOP (octave_scalar, octave_float_matrix, float_scalar_to_float_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fm-fcdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,36 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-re-mat.h"
+#define RINCLUDE "ov-flt-cx-diag.h"
+
+#define LMATRIX float_matrix
+#define RMATRIX float_complex_diag_matrix
+#define LDMATRIX float_complex_matrix
+
+#define LSHORT fm
+#define RSHORT fcdm
+
+#define DEFINEDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fm-fcm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,206 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-fm-fcm.h"
+#include "mx-fcm-fm.h"
+#include "mx-fnda-fcnda.h"
+#include "mx-fcnda-fnda.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix by complex matrix ops.
+
+DEFNDBINOP_OP (add, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, +)
+DEFNDBINOP_OP (sub, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, -)
+
+DEFBINOP_OP (mul, float_matrix, float_complex_matrix, *)
+
+DEFBINOP (trans_mul, float_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex_matrix&);
+
+  FloatMatrix m1 = v1.float_matrix_value ();
+  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
+
+  return FloatComplexMatrix (xgemm (m1, real (m2), blas_trans, blas_no_trans),
+                             xgemm (m1, imag (m2), blas_trans, blas_no_trans));
+}
+
+DEFBINOP (div, float_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&,
+                   const octave_float_complex_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  FloatComplexMatrix ret = xdiv (v1.float_matrix_value (),
+                                 v2.float_complex_matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, float_matrix, float_complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, float_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&,
+                   const octave_float_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (v1.float_matrix_value (),
+                                v2.float_complex_matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP (trans_ldiv, float_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&,
+                   const octave_float_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (v1.float_matrix_value (),
+                         v2.float_complex_matrix_value (), typ, blas_trans);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, mx_el_ne)
+
+DEFNDBINOP_FN (el_mul, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, product)
+DEFNDBINOP_FN (el_div, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, quotient)
+DEFNDBINOP_FN (el_pow, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, elem_xpow)
+
+DEFBINOP (el_ldiv, float_matrix, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&,
+                   const octave_float_complex_matrix&);
+
+  return quotient (v2.float_complex_array_value (), v1.float_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_matrix, float_complex_matrix, float_array,
+               float_complex_array, mx_el_or)
+
+DEFNDCATOP_FN (fm_fcm, float_matrix, float_complex_matrix, float_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (m_fcm, matrix, float_complex_matrix, float_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (fm_cm, float_matrix, complex_matrix, float_array,
+               float_complex_array, concat)
+
+DEFCONV (float_complex_matrix_conv, float_matrix, float_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_float_matrix&);
+
+  return new octave_float_complex_matrix (FloatComplexNDArray (v.float_array_value ()));
+}
+
+void
+install_fm_fcm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_matrix, octave_float_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_matrix, octave_float_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_matrix,
+                 octave_float_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_float_matrix, octave_float_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_matrix,
+                 octave_float_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_matrix,
+                 octave_float_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_matrix,
+                 octave_float_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_matrix,
+                 octave_float_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_matrix,
+                 octave_float_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_matrix,
+                 octave_float_complex_matrix, el_or);
+  INSTALL_BINOP (op_trans_mul, octave_float_matrix,
+                 octave_float_complex_matrix, trans_mul);
+  INSTALL_BINOP (op_herm_mul, octave_float_matrix,
+                 octave_float_complex_matrix, trans_mul);
+  INSTALL_BINOP (op_trans_ldiv, octave_float_matrix,
+                 octave_float_complex_matrix, trans_ldiv);
+  INSTALL_BINOP (op_herm_ldiv, octave_float_matrix,
+                 octave_float_complex_matrix, trans_ldiv);
+
+  INSTALL_CATOP (octave_float_matrix, octave_float_complex_matrix, fm_fcm);
+  INSTALL_CATOP (octave_matrix, octave_float_complex_matrix, m_fcm);
+  INSTALL_CATOP (octave_float_matrix, octave_complex_matrix, fm_cm);
+
+  INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex_matrix,
+                      octave_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex_matrix,
+                      octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_float_matrix, octave_float_complex_matrix,
+                   float_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fm-fcs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,162 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-fm-fcs.h"
+#include "mx-fcs-fm.h"
+#include "mx-fnda-fcs.h"
+#include "mx-fcs-fnda.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-flt-complex.h"
+#include "ov-complex.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix by complex scalar ops.
+
+DEFNDBINOP_OP (add, float_matrix, float_complex, float_array, float_complex, +)
+DEFNDBINOP_OP (sub, float_matrix, float_complex, float_array, float_complex, -)
+DEFNDBINOP_OP (mul, float_matrix, float_complex, float_array, float_complex, *)
+
+DEFBINOP (div, float_matrix, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&);
+
+  FloatComplex d = v2.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_array_value () / d);
+}
+
+DEFBINOP_FN (pow, float_matrix, float_complex, xpow)
+
+DEFBINOP (ldiv, float_matrix, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&);
+
+  FloatMatrix m1 = v1.float_matrix_value ();
+  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
+  MatrixType typ = v1.matrix_type ();
+
+  FloatComplexMatrix ret = xleftdiv (m1, m2, typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_matrix, float_complex, float_array,
+               float_complex, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_matrix, float_complex, float_array,
+               float_complex, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_matrix, float_complex, float_array,
+               float_complex, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_matrix, float_complex, float_array,
+               float_complex, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_matrix, float_complex, float_array,
+               float_complex, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_matrix, float_complex, float_array,
+               float_complex, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, float_matrix, float_complex, float_array,
+               float_complex, *)
+
+DEFBINOP (el_div, float_matrix, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&);
+
+  FloatComplex d = v2.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_pow, float_matrix, float_complex, float_array,
+               float_complex, elem_xpow)
+
+DEFBINOP (el_ldiv, float_matrix, flaot_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&);
+
+  return x_el_div (v2.float_complex_value (), v1.float_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, float_matrix, float_complex, float_array,
+               float_complex, mx_el_and)
+DEFNDBINOP_FN (el_or, float_matrix, float_complex, float_array,
+               float_complex, mx_el_or)
+
+DEFNDCATOP_FN (fm_fcs, float_matrix, float_complex, float_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (m_fcs, matrix, float_complex, float_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (fm_cs, float_matrix, complex, float_array,
+               float_complex_array, concat)
+
+void
+install_fm_fcs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_matrix, octave_float_complex, add);
+  INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_complex, sub);
+  INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_complex, mul);
+  INSTALL_BINOP (op_div, octave_float_matrix, octave_float_complex, div);
+  INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_matrix, octave_float_complex, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_complex, lt);
+  INSTALL_BINOP (op_le, octave_float_matrix, octave_float_complex, le);
+  INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_complex, eq);
+  INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_complex, ge);
+  INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_complex, gt);
+  INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_matrix, octave_float_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_matrix, octave_float_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_matrix, octave_float_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_matrix, octave_float_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_matrix, octave_float_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_matrix, octave_float_complex, el_or);
+
+  INSTALL_CATOP (octave_float_matrix, octave_float_complex, fm_fcs);
+  INSTALL_CATOP (octave_matrix, octave_float_complex, m_fcs);
+  INSTALL_CATOP (octave_float_matrix, octave_complex, fm_cs);
+
+  INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex,
+                      octave_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex,
+                      octave_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fm-fdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-flt-re-mat.h"
+#define RINCLUDE "ov-flt-re-diag.h"
+
+#define LMATRIX float_matrix
+#define RMATRIX float_diag_matrix
+
+#define LSHORT fm
+#define RSHORT fdm
+
+#define DEFINEDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fm-fm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,255 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix unary ops.
+
+DEFNDUNOP_OP (not, float_matrix, float_array, !)
+DEFNDUNOP_OP (uplus, float_matrix, float_array, /* no-op */)
+DEFNDUNOP_OP (uminus, float_matrix, float_array, -)
+
+DEFUNOP (transpose, float_matrix)
+{
+  CAST_UNOP_ARG (const octave_float_matrix&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.float_matrix_value ().transpose ());
+}
+
+DEFNCUNOP_METHOD (incr, float_matrix, increment)
+DEFNCUNOP_METHOD (decr, float_matrix, decrement)
+DEFNCUNOP_METHOD (changesign, float_matrix, changesign)
+
+// matrix by matrix ops.
+
+DEFNDBINOP_OP (add, float_matrix, float_matrix, float_array, float_array, +)
+DEFNDBINOP_OP (sub, float_matrix, float_matrix, float_array, float_array, -)
+
+DEFBINOP_OP (mul, float_matrix, float_matrix, *)
+
+DEFBINOP (div, float_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  FloatMatrix ret = xdiv (v1.float_matrix_value (),
+                          v2.float_matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, float_matrix, float_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, float_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  FloatMatrix ret = xleftdiv (v1.float_matrix_value (),
+                              v2.float_matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP (trans_mul, float_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
+  return octave_value(xgemm (v1.float_matrix_value (),
+                             v2.float_matrix_value (),
+                             blas_trans, blas_no_trans));
+}
+
+DEFBINOP (mul_trans, float_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
+  return octave_value(xgemm (v1.float_matrix_value (),
+                             v2.float_matrix_value (),
+                             blas_no_trans, blas_trans));
+}
+
+DEFBINOP (trans_ldiv, float_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  FloatMatrix ret = xleftdiv (v1.float_matrix_value (),
+                              v2.float_matrix_value (), typ, blas_trans);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDBINOP_FN (lt, float_matrix, float_matrix, float_array,
+               float_array, mx_el_lt)
+DEFNDBINOP_FN (le, float_matrix, float_matrix, float_array,
+               float_array, mx_el_le)
+DEFNDBINOP_FN (eq, float_matrix, float_matrix, float_array,
+               float_array, mx_el_eq)
+DEFNDBINOP_FN (ge, float_matrix, float_matrix, float_array,
+               float_array, mx_el_ge)
+DEFNDBINOP_FN (gt, float_matrix, float_matrix, float_array,
+               float_array, mx_el_gt)
+DEFNDBINOP_FN (ne, float_matrix, float_matrix, float_array,
+               float_array, mx_el_ne)
+
+DEFNDBINOP_FN (el_mul, float_matrix, float_matrix, float_array,
+               float_array, product)
+DEFNDBINOP_FN (el_div, float_matrix, float_matrix, float_array,
+               float_array, quotient)
+DEFNDBINOP_FN (el_pow, float_matrix, float_matrix, float_array,
+               float_array, elem_xpow)
+
+DEFBINOP (el_ldiv, float_matrix, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&);
+
+  return octave_value (quotient (v2.float_array_value (),
+                                 v1.float_array_value ()));
+}
+
+DEFNDBINOP_FN (el_and, float_matrix, float_matrix, float_array,
+               float_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_matrix, float_matrix, float_array,
+               float_array, mx_el_or)
+DEFNDBINOP_FN (el_not_and, float_matrix, float_matrix, float_array,
+               float_array, mx_el_not_and)
+DEFNDBINOP_FN (el_not_or,  float_matrix, float_matrix, float_array,
+               float_array, mx_el_not_or)
+DEFNDBINOP_FN (el_and_not, float_matrix, float_matrix, float_array,
+               float_array, mx_el_and_not)
+DEFNDBINOP_FN (el_or_not,  float_matrix, float_matrix, float_array,
+               float_array, mx_el_or_not)
+
+
+
+DEFNDCATOP_FN (fm_fm, float_matrix, float_matrix, float_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (m_fm, matrix, float_matrix, float_array, float_array, concat)
+
+DEFNDCATOP_FN (fm_m, float_matrix, matrix, float_array, float_array, concat)
+
+DEFNDASSIGNOP_FN (assign, float_matrix, float_matrix, float_array, assign)
+
+DEFNDASSIGNOP_FN (dbl_assign, matrix, float_matrix, array, assign)
+
+DEFNULLASSIGNOP_FN (null_assign, float_matrix, delete_elements)
+
+DEFNDASSIGNOP_OP (assign_add, float_matrix, float_matrix, float_array, +=)
+DEFNDASSIGNOP_OP (assign_sub, float_matrix, float_matrix, float_array, -=)
+DEFNDASSIGNOP_FNOP (assign_el_mul, float_matrix, float_matrix, float_array, product_eq)
+DEFNDASSIGNOP_FNOP (assign_el_div, float_matrix, float_matrix, float_array, quotient_eq)
+
+CONVDECL (float_matrix_to_matrix)
+{
+  CAST_CONV_ARG (const octave_float_matrix&);
+
+  return new octave_matrix (v.array_value ());
+}
+
+void
+install_fm_fm_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_float_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_float_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_float_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_float_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_float_matrix, transpose);
+
+  INSTALL_NCUNOP (op_incr, octave_float_matrix, incr);
+  INSTALL_NCUNOP (op_decr, octave_float_matrix, decr);
+  INSTALL_NCUNOP (op_uminus, octave_float_matrix, changesign);
+
+  INSTALL_BINOP (op_add, octave_float_matrix, octave_float_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_matrix, octave_float_matrix, div);
+  INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_matrix, octave_float_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_matrix, lt);
+  INSTALL_BINOP (op_le, octave_float_matrix, octave_float_matrix, le);
+  INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_matrix, octave_float_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_matrix, octave_float_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_matrix, octave_float_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_matrix, octave_float_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_matrix, octave_float_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_matrix, octave_float_matrix, el_or);
+  INSTALL_BINOP (op_el_and_not, octave_float_matrix, octave_float_matrix, el_and_not);
+  INSTALL_BINOP (op_el_or_not, octave_float_matrix, octave_float_matrix, el_or_not);
+  INSTALL_BINOP (op_el_not_and, octave_float_matrix, octave_float_matrix, el_not_and);
+  INSTALL_BINOP (op_el_not_or, octave_float_matrix, octave_float_matrix, el_not_or);
+  INSTALL_BINOP (op_trans_mul, octave_float_matrix, octave_float_matrix, trans_mul);
+  INSTALL_BINOP (op_mul_trans, octave_float_matrix, octave_float_matrix, mul_trans);
+  INSTALL_BINOP (op_herm_mul, octave_float_matrix, octave_float_matrix, trans_mul);
+  INSTALL_BINOP (op_mul_herm, octave_float_matrix, octave_float_matrix, mul_trans);
+  INSTALL_BINOP (op_trans_ldiv, octave_float_matrix, octave_float_matrix, trans_ldiv);
+  INSTALL_BINOP (op_herm_ldiv, octave_float_matrix, octave_float_matrix, trans_ldiv);
+
+  INSTALL_CATOP (octave_float_matrix, octave_float_matrix, fm_fm);
+  INSTALL_CATOP (octave_matrix, octave_float_matrix, m_fm);
+  INSTALL_CATOP (octave_float_matrix, octave_matrix, fm_m);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix,
+                    octave_float_matrix, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix,
+                    octave_float_matrix, dbl_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_null_sq_str, null_assign);
+
+  INSTALL_ASSIGNOP (op_add_eq, octave_float_matrix, octave_float_matrix, assign_add);
+  INSTALL_ASSIGNOP (op_sub_eq, octave_float_matrix, octave_float_matrix, assign_sub);
+  INSTALL_ASSIGNOP (op_el_mul_eq, octave_float_matrix, octave_float_matrix, assign_el_mul);
+  INSTALL_ASSIGNOP (op_el_div_eq, octave_float_matrix, octave_float_matrix, assign_el_div);
+
+  INSTALL_CONVOP (octave_float_matrix, octave_matrix, float_matrix_to_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fm-fs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,162 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-flt-re-mat.h"
+#include "ov-float.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix by scalar ops.
+
+DEFNDBINOP_OP (add, float_matrix, float_scalar, float_array, float_scalar, +)
+DEFNDBINOP_OP (sub, float_matrix, float_scalar, float_array, float_scalar, -)
+DEFNDBINOP_OP (mul, float_matrix, float_scalar, float_array, float_scalar, *)
+
+DEFBINOP (div, float_matrix, float)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_scalar&);
+
+  float d = v2.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_array_value () / d);
+}
+
+DEFBINOP_FN (pow, float_matrix, float_scalar, xpow)
+
+DEFBINOP (ldiv, float_matrix, float)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_scalar&);
+
+  FloatMatrix m1 = v1.float_matrix_value ();
+  FloatMatrix m2 = v2.float_matrix_value ();
+  MatrixType typ = v1.matrix_type ();
+
+  FloatMatrix ret = xleftdiv (m1, m2, typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDBINOP_FN (lt, float_matrix, float_scalar, float_array,
+               float_scalar, mx_el_lt)
+DEFNDBINOP_FN (le, float_matrix, float_scalar, float_array,
+               float_scalar, mx_el_le)
+DEFNDBINOP_FN (eq, float_matrix, float_scalar, float_array,
+               float_scalar, mx_el_eq)
+DEFNDBINOP_FN (ge, float_matrix, float_scalar, float_array,
+               float_scalar, mx_el_ge)
+DEFNDBINOP_FN (gt, float_matrix, float_scalar, float_array,
+               float_scalar, mx_el_gt)
+DEFNDBINOP_FN (ne, float_matrix, float_scalar, float_array,
+               float_scalar, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, float_matrix, float_scalar, float_array, float_scalar, *)
+
+DEFBINOP (el_div, float_matrix, float)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_scalar&);
+
+  float d = v2.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_pow, float_matrix, float_scalar, float_array,
+               float_scalar, elem_xpow)
+
+DEFBINOP (el_ldiv, float_matrix, float)
+{
+  CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_scalar&);
+
+  return x_el_div (v2.float_value (), v1.float_array_value ());
+}
+
+DEFNDBINOP_FN (el_and, float_matrix, float_scalar, float_array,
+               float_scalar, mx_el_and)
+DEFNDBINOP_FN (el_or, float_matrix, float_scalar, float_array,
+               float_scalar, mx_el_or)
+
+DEFNDCATOP_FN (fm_fs, float_matrix, float_scalar, float_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (m_fs, matrix, float_scalar, float_array, float_array, concat)
+
+DEFNDCATOP_FN (fm_s, float_matrix, scalar, float_array, float_array, concat)
+
+DEFNDASSIGNOP_FN (assign, float_matrix, float_scalar, float_scalar, assign)
+DEFNDASSIGNOP_FN (dbl_assign, matrix, float_scalar, scalar, assign)
+
+DEFNDASSIGNOP_OP (assign_add, float_matrix, float_scalar, float_scalar, +=)
+DEFNDASSIGNOP_OP (assign_sub, float_matrix, float_scalar, float_scalar, -=)
+DEFNDASSIGNOP_OP (assign_mul, float_matrix, float_scalar, float_scalar, *=)
+DEFNDASSIGNOP_OP (assign_div, float_matrix, float_scalar, float_scalar, /=)
+
+void
+install_fm_fs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_matrix, octave_float_scalar, add);
+  INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_scalar, mul);
+  INSTALL_BINOP (op_div, octave_float_matrix, octave_float_scalar, div);
+  INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_matrix, octave_float_scalar, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_scalar, lt);
+  INSTALL_BINOP (op_le, octave_float_matrix, octave_float_scalar, le);
+  INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_matrix, octave_float_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_matrix, octave_float_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_matrix, octave_float_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_matrix, octave_float_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_matrix, octave_float_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_matrix, octave_float_scalar, el_or);
+
+  INSTALL_CATOP (octave_float_matrix, octave_float_scalar, fm_fs);
+  INSTALL_CATOP (octave_matrix, octave_float_scalar, m_fs);
+  INSTALL_CATOP (octave_float_matrix, octave_scalar, fm_s);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_float_scalar, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_float_scalar, dbl_assign);
+
+  INSTALL_ASSIGNOP (op_add_eq, octave_float_matrix, octave_float_scalar, assign_add);
+  INSTALL_ASSIGNOP (op_sub_eq, octave_float_matrix, octave_float_scalar, assign_sub);
+  INSTALL_ASSIGNOP (op_mul_eq, octave_float_matrix, octave_float_scalar, assign_mul);
+  INSTALL_ASSIGNOP (op_div_eq, octave_float_matrix, octave_float_scalar, assign_div);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fm-pm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 MINCLUDE "ov-flt-re-mat.h"
+
+#define LMATRIX float_matrix
+#define RMATRIX perm_matrix
+
+#define LSHORT fm
+#define RSHORT pm
+
+#define RIGHT
+
+#include "op-pm-template.cc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fs-fcm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,178 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-fs-fcm.h"
+#include "mx-fcm-fs.h"
+#include "mx-fs-fcnda.h"
+#include "mx-fcnda-fs.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// scalar by complex matrix ops.
+
+DEFNDBINOP_OP (add, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, +)
+DEFNDBINOP_OP (sub, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, -)
+DEFNDBINOP_OP (mul, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, *)
+
+DEFBINOP (div, float_scalar, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&,
+                   const octave_float_complex_matrix&);
+
+  FloatMatrix m1 = v1.float_matrix_value ();
+  FloatComplexMatrix m2 = v2.float_complex_matrix_value ();
+  MatrixType typ = v2.matrix_type ();
+
+  FloatComplexMatrix ret = xdiv (m1, m2, typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (pow, float_scalar, float_complex_matrix, xpow)
+
+DEFBINOP (ldiv, float_scalar, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&,
+                   const octave_float_complex_matrix&);
+
+  float d = v1.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_complex_array_value () / d);
+}
+
+DEFNDCMPLXCMPOP_FN (lt, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, *)
+DEFNDBINOP_FN (el_div, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, x_el_div)
+DEFNDBINOP_FN (el_pow, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, elem_xpow)
+
+DEFBINOP (el_ldiv, float_scalar, float_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&,
+                   const octave_float_complex_matrix&);
+
+  float d = v1.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_complex_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_and, float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_scalar, float_complex_matrix, float_scalar,
+               float_complex_array, mx_el_or)
+
+DEFNDCATOP_FN (fs_fcm, float_scalar, float_complex_matrix, float_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (s_fcm, scalar, float_complex_matrix, float_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (fs_cm, float_scalar, complex_matrix, float_array,
+               float_complex_array, concat)
+
+DEFCONV (float_complex_matrix_conv, float_scalar, float_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_float_scalar&);
+
+  return new octave_float_complex_matrix (FloatComplexMatrix (v.float_matrix_value ()));
+}
+
+void
+install_fs_fcm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_scalar, octave_float_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_scalar, octave_float_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_scalar,
+                 octave_float_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_float_scalar, octave_float_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_scalar,
+                 octave_float_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_scalar,
+                 octave_float_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_scalar,
+                 octave_float_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_scalar,
+                 octave_float_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_scalar,
+                 octave_float_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_scalar,
+                 octave_float_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_float_scalar, octave_float_complex_matrix, fs_fcm);
+  INSTALL_CATOP (octave_scalar, octave_float_complex_matrix, s_fcm);
+  INSTALL_CATOP (octave_float_scalar, octave_complex_matrix, fs_cm);
+
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex_matrix,
+                      octave_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex_matrix,
+                      octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_float_scalar, octave_float_complex_matrix,
+                   float_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fs-fcs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,161 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-flt-complex.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// scalar by complex scalar ops.
+
+DEFBINOP_OP (add, float_scalar, float_complex, +)
+DEFBINOP_OP (sub, float_scalar, float_complex, -)
+DEFBINOP_OP (mul, float_scalar, float_complex, *)
+
+DEFBINOP (div, float_scalar, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
+
+  FloatComplex d = v2.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_value () / d);
+}
+
+DEFBINOP_FN (pow, float_scalar, float_complex, xpow)
+
+DEFBINOP (ldiv, float_scalar, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
+
+  float d = v1.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_complex_value () / d);
+}
+
+DEFCMPLXCMPOP_OP (lt, float_scalar, float_complex, <)
+DEFCMPLXCMPOP_OP (le, float_scalar, float_complex, <=)
+DEFCMPLXCMPOP_OP (eq, float_scalar, float_complex, ==)
+DEFCMPLXCMPOP_OP (ge, float_scalar, float_complex, >=)
+DEFCMPLXCMPOP_OP (gt, float_scalar, float_complex, >)
+DEFCMPLXCMPOP_OP (ne, float_scalar, float_complex, !=)
+
+DEFBINOP_OP (el_mul, float_scalar, float_complex, *)
+
+DEFBINOP (el_div, float_scalar, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
+
+  FloatComplex d = v2.float_complex_value ();
+
+  if (d == static_cast<float>(0.0))
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_value () / d);
+}
+
+DEFBINOP_FN (el_pow, float_scalar, float_complex, xpow)
+
+DEFBINOP (el_ldiv, float_scalar, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
+
+  float d = v1.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_complex_value () / d);
+}
+
+DEFBINOP (el_and, float_scalar, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
+
+  return octave_value (v1.float_scalar_value () && (v2.float_complex_value () != static_cast<float>(0.0)));
+}
+
+DEFBINOP (el_or, float_scalar, float_complex)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&);
+
+  return octave_value (v1.float_scalar_value () || (v2.float_complex_value () != static_cast<float>(0.0)));
+}
+
+DEFNDCATOP_FN (fs_fcs, float_scalar, float_complex, float_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (s_fcs, scalar, float_complex, float_array,
+               float_complex_array, concat)
+
+DEFNDCATOP_FN (fs_cs, float_scalar, complex, float_array,
+               float_complex_array, concat)
+
+void
+install_fs_fcs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_scalar, octave_float_complex, add);
+  INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_complex, sub);
+  INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_complex, mul);
+  INSTALL_BINOP (op_div, octave_float_scalar, octave_float_complex, div);
+  INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_scalar, octave_float_complex, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_complex, lt);
+  INSTALL_BINOP (op_le, octave_float_scalar, octave_float_complex, le);
+  INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_complex, eq);
+  INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_complex, ge);
+  INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_complex, gt);
+  INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_scalar, octave_float_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_scalar, octave_float_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_scalar, octave_float_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_scalar, octave_float_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_scalar, octave_float_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_scalar, octave_float_complex, el_or);
+
+  INSTALL_CATOP (octave_float_scalar, octave_float_complex, fs_fcs);
+  INSTALL_CATOP (octave_scalar, octave_float_complex, s_fcs);
+  INSTALL_CATOP (octave_float_scalar, octave_complex, fs_cs);
+
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex,
+                      octave_float_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex,
+                      octave_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fs-fm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,154 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// scalar by matrix ops.
+
+DEFNDBINOP_OP (add, float_scalar, float_matrix, float_scalar, float_array, +)
+DEFNDBINOP_OP (sub, float_scalar, float_matrix, float_scalar, float_array, -)
+DEFNDBINOP_OP (mul, float_scalar, float_matrix, float_scalar, float_array, *)
+
+DEFBINOP (div, float_scalar, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_matrix&);
+
+  FloatMatrix m1 = v1.float_matrix_value ();
+  FloatMatrix m2 = v2.float_matrix_value ();
+  MatrixType typ = v2.matrix_type ();
+
+  FloatMatrix ret = xdiv (m1, m2, typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (pow, float_scalar, float_matrix, xpow)
+
+DEFBINOP (ldiv, float_scalar, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_matrix&);
+
+  float d = v1.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_array_value () / d);
+}
+
+DEFNDBINOP_FN (lt, float_scalar, float_matrix, float_scalar,
+               float_array, mx_el_lt)
+DEFNDBINOP_FN (le, float_scalar, float_matrix, float_scalar,
+               float_array, mx_el_le)
+DEFNDBINOP_FN (eq, float_scalar, float_matrix, float_scalar,
+               float_array, mx_el_eq)
+DEFNDBINOP_FN (ge, float_scalar, float_matrix, float_scalar,
+               float_array, mx_el_ge)
+DEFNDBINOP_FN (gt, float_scalar, float_matrix, float_scalar,
+float_array, mx_el_gt)
+DEFNDBINOP_FN (ne, float_scalar, float_matrix, float_scalar,
+               float_array, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, float_scalar, float_matrix, float_scalar,
+               float_array, *)
+DEFNDBINOP_FN (el_div, float_scalar, float_matrix, float_scalar,
+               float_array, x_el_div)
+DEFNDBINOP_FN (el_pow, float_scalar, float_matrix, float_scalar,
+               float_array, elem_xpow)
+
+DEFBINOP (el_ldiv, float_scalar, float_matrix)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_matrix&);
+
+  float d = v1.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_and, float_scalar, float_matrix, float_scalar,
+               float_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  float_scalar, float_matrix, float_scalar,
+               float_array, mx_el_or)
+
+DEFNDCATOP_FN (fs_fm, float_scalar, float_matrix, float_array,
+               float_array, concat)
+
+DEFNDCATOP_FN (s_fm, scalar, float_matrix, float_array, float_array, concat)
+
+DEFNDCATOP_FN (fs_m, float_scalar, matrix, float_array, float_array, concat)
+
+DEFCONV (matrix_conv, float_scalar, float_matrix)
+{
+  CAST_CONV_ARG (const octave_float_scalar&);
+
+  return new octave_float_matrix (v.float_matrix_value ());
+}
+
+void
+install_fs_fm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_float_scalar, octave_float_matrix, add);
+  INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_matrix, mul);
+  INSTALL_BINOP (op_div, octave_float_scalar, octave_float_matrix, div);
+  INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_scalar, octave_float_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_matrix, lt);
+  INSTALL_BINOP (op_le, octave_float_scalar, octave_float_matrix, le);
+  INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_scalar, octave_float_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_scalar, octave_float_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_scalar, octave_float_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_scalar, octave_float_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_scalar, octave_float_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_scalar, octave_float_matrix, el_or);
+
+  INSTALL_CATOP (octave_float_scalar, octave_float_matrix, fs_fm);
+  INSTALL_CATOP (octave_scalar, octave_float_matrix, s_fm);
+  INSTALL_CATOP (octave_float_scalar, octave_matrix, fs_m);
+
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_matrix, octave_float_matrix);
+  INSTALL_ASSIGNCONV (octave_scalar, octave_float_matrix, octave_matrix);
+
+  INSTALL_WIDENOP (octave_float_scalar, octave_float_matrix, matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-fs-fs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,184 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Array-util.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// scalar unary ops.
+
+DEFUNOP (not, float_scalar)
+{
+  CAST_UNOP_ARG (const octave_float_scalar&);
+  float x = v.float_value ();
+  if (xisnan (x))
+    gripe_nan_to_logical_conversion ();
+  return octave_value (x == 0.0f);
+}
+
+DEFUNOP_OP (uplus, float_scalar, /* no-op */)
+DEFUNOP_OP (uminus, float_scalar, -)
+DEFUNOP_OP (transpose, float_scalar, /* no-op */)
+DEFUNOP_OP (hermitian, float_scalar, /* no-op */)
+
+DEFNCUNOP_METHOD (incr, float_scalar, increment)
+DEFNCUNOP_METHOD (decr, float_scalar, decrement)
+
+// float by float ops.
+
+DEFBINOP_OP (add, float_scalar, float_scalar, +)
+DEFBINOP_OP (sub, float_scalar, float_scalar, -)
+DEFBINOP_OP (mul, float_scalar, float_scalar, *)
+
+DEFBINOP (div, float_scalar, float_scalar)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_scalar&);
+
+  float d = v2.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_value () / d);
+}
+
+DEFBINOP_FN (pow, float_scalar, float_scalar, xpow)
+
+DEFBINOP (ldiv, float_scalar, float_scalar)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_scalar&);
+
+  float d = v1.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_value () / d);
+}
+
+DEFBINOP_OP (lt, float_scalar, float_scalar, <)
+DEFBINOP_OP (le, float_scalar, float_scalar, <=)
+DEFBINOP_OP (eq, float_scalar, float_scalar, ==)
+DEFBINOP_OP (ge, float_scalar, float_scalar, >=)
+DEFBINOP_OP (gt, float_scalar, float_scalar, >)
+DEFBINOP_OP (ne, float_scalar, float_scalar, !=)
+
+DEFBINOP_OP (el_mul, float_scalar, float_scalar, *)
+
+DEFBINOP (el_div, float_scalar, float_scalar)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_scalar&);
+
+  float d = v2.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.float_value () / d);
+}
+
+DEFBINOP_FN (el_pow, float_scalar, float_scalar, xpow)
+
+DEFBINOP (el_ldiv, float_scalar, float_scalar)
+{
+  CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_scalar&);
+
+  float d = v1.float_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.float_value () / d);
+}
+
+DEFSCALARBOOLOP_OP (el_and, float_scalar, float_scalar, &&)
+DEFSCALARBOOLOP_OP (el_or, float_scalar, float_scalar, ||)
+
+DEFNDCATOP_FN (fs_fs, float_scalar, float_scalar, float_array, float_array, concat)
+DEFNDCATOP_FN (s_fs, scalar, float_scalar, float_array, float_array, concat)
+DEFNDCATOP_FN (fs_s, float_scalar, scalar, float_array, float_array, concat)
+
+CONVDECL (float_to_scalar)
+{
+  CAST_CONV_ARG (const octave_float_scalar&);
+
+  return new octave_matrix (Matrix (1, 1, static_cast<double>(v.float_value ())));
+}
+
+void
+install_fs_fs_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_float_scalar, not);
+  INSTALL_UNOP (op_uplus, octave_float_scalar, uplus);
+  INSTALL_UNOP (op_uminus, octave_float_scalar, uminus);
+  INSTALL_UNOP (op_transpose, octave_float_scalar, transpose);
+  INSTALL_UNOP (op_hermitian, octave_float_scalar, hermitian);
+
+  INSTALL_NCUNOP (op_incr, octave_float_scalar, incr);
+  INSTALL_NCUNOP (op_decr, octave_float_scalar, decr);
+
+  INSTALL_BINOP (op_add, octave_float_scalar, octave_float_scalar, add);
+  INSTALL_BINOP (op_sub, octave_float_scalar, octave_float_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_scalar, mul);
+  INSTALL_BINOP (op_div, octave_float_scalar, octave_float_scalar, div);
+  INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_float_scalar, octave_float_scalar, ldiv);
+  INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_scalar, lt);
+  INSTALL_BINOP (op_le, octave_float_scalar, octave_float_scalar, le);
+  INSTALL_BINOP (op_eq, octave_float_scalar, octave_float_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_float_scalar, octave_float_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_float_scalar, octave_float_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_float_scalar, octave_float_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_float_scalar, octave_float_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_float_scalar, octave_float_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_float_scalar, octave_float_scalar, el_or);
+
+  INSTALL_CATOP (octave_float_scalar, octave_float_scalar, fs_fs);
+  INSTALL_CATOP (octave_scalar, octave_float_scalar, s_fs);
+  INSTALL_CATOP (octave_float_scalar, octave_scalar, fs_s);
+
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_scalar, octave_float_matrix);
+  INSTALL_ASSIGNCONV (octave_scalar, octave_float_scalar, octave_matrix);
+
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_null_matrix, octave_float_matrix);
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_null_str, octave_float_matrix);
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_null_sq_str, octave_float_matrix);
+
+  INSTALL_CONVOP (octave_float_scalar, octave_matrix, float_to_scalar);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-i16-i16.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-i16nda-i8.h"
+#include "mx-i16nda-ui8.h"
+#include "mx-i16nda-ui16.h"
+#include "mx-i16nda-i32.h"
+#include "mx-i16nda-ui32.h"
+#include "mx-i16nda-i64.h"
+#include "mx-i16nda-ui64.h"
+
+#include "mx-i16nda-i8nda.h"
+#include "mx-i16nda-ui8nda.h"
+#include "mx-i16nda-ui16nda.h"
+#include "mx-i16nda-i32nda.h"
+#include "mx-i16nda-ui32nda.h"
+#include "mx-i16nda-i64nda.h"
+#include "mx-i16nda-ui64nda.h"
+
+#include "mx-i16-i8nda.h"
+#include "mx-i16-ui8nda.h"
+#include "mx-i16-ui16nda.h"
+#include "mx-i16-i32nda.h"
+#include "mx-i16-ui32nda.h"
+#include "mx-i16-i64nda.h"
+#include "mx-i16-ui64nda.h"
+
+#include "mx-i16nda-s.h"
+#include "mx-s-i16nda.h"
+
+#include "mx-i16nda-nda.h"
+#include "mx-nda-i16nda.h"
+
+#include "mx-i16-nda.h"
+#include "mx-nda-i16.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-int8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-uint8.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#include "op-int.h"
+
+OCTAVE_INT_OPS (int16)
+
+OCTAVE_MS_INT_ASSIGN_OPS (mi8, int16_, int8_, int8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui8, int16_, uint8_, uint8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui16, int16_, uint16_, uint16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi32, int16_, int32_, int32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui32, int16_, uint32_, uint32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi64, int16_, int64_, int64_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui64, int16_, uint64_, uint64_)
+
+OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int16_, int8_, int8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int16_, uint8_, uint8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int16_, uint16_, uint16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int16_, int32_, int32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int16_, uint32_, uint32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int16_, int64_, int64_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int16_, uint64_, uint64_)
+
+OCTAVE_MIXED_INT_CMP_OPS (int16, int8)
+OCTAVE_MIXED_INT_CMP_OPS (int16, uint8)
+OCTAVE_MIXED_INT_CMP_OPS (int16, uint16)
+OCTAVE_MIXED_INT_CMP_OPS (int16, int32)
+OCTAVE_MIXED_INT_CMP_OPS (int16, uint32)
+OCTAVE_MIXED_INT_CMP_OPS (int16, int64)
+OCTAVE_MIXED_INT_CMP_OPS (int16, uint64)
+
+void
+install_i16_i16_ops (void)
+{
+  OCTAVE_INSTALL_INT_OPS (int16);
+
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int16_, int8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int16_, uint8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int16_, uint16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int16_, int32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int16_, uint32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int16_, int64_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int16_, uint64_);
+
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int16_, int8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int16_, uint8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int16_, uint16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int16_, int32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int16_, uint32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int16_, int64_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int16_, uint64_);
+
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, int8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, uint8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, uint16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, int32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, uint32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, int64);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int16, uint64);
+
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, int8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, uint8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, uint16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, int32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, uint32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, int64);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int16, uint64);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-i32-i32.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-i32nda-i8.h"
+#include "mx-i32nda-ui8.h"
+#include "mx-i32nda-i16.h"
+#include "mx-i32nda-ui16.h"
+#include "mx-i32nda-ui32.h"
+#include "mx-i32nda-i64.h"
+#include "mx-i32nda-ui64.h"
+
+#include "mx-i32nda-i8nda.h"
+#include "mx-i32nda-ui8nda.h"
+#include "mx-i32nda-i16nda.h"
+#include "mx-i32nda-ui16nda.h"
+#include "mx-i32nda-ui32nda.h"
+#include "mx-i32nda-i64nda.h"
+#include "mx-i32nda-ui64nda.h"
+
+#include "mx-i32-i8nda.h"
+#include "mx-i32-ui8nda.h"
+#include "mx-i32-i16nda.h"
+#include "mx-i32-ui16nda.h"
+#include "mx-i32-ui32nda.h"
+#include "mx-i32-i64nda.h"
+#include "mx-i32-ui64nda.h"
+
+#include "mx-i32nda-s.h"
+#include "mx-s-i32nda.h"
+
+#include "mx-i32nda-nda.h"
+#include "mx-nda-i32nda.h"
+
+#include "mx-i32-nda.h"
+#include "mx-nda-i32.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-int8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-uint8.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#include "op-int.h"
+
+OCTAVE_INT_OPS (int32)
+
+OCTAVE_MS_INT_ASSIGN_OPS (mi8, int32_, int8_, int8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui8, int32_, uint8_, uint8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi16, int32_, int16_, int16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui16, int32_, uint16_, uint16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui32, int32_, uint32_, uint32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi64, int32_, int64_, int64_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui64, int32_, uint64_, uint64_)
+
+OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int32_, int8_, int8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int32_, uint8_, uint8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int32_, int16_, int16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int32_, uint16_, uint16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int32_, uint32_, uint32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int32_, int64_, int64_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int32_, uint64_, uint64_)
+
+OCTAVE_MIXED_INT_CMP_OPS (int32, int8)
+OCTAVE_MIXED_INT_CMP_OPS (int32, uint8)
+OCTAVE_MIXED_INT_CMP_OPS (int32, int16)
+OCTAVE_MIXED_INT_CMP_OPS (int32, uint16)
+OCTAVE_MIXED_INT_CMP_OPS (int32, uint32)
+OCTAVE_MIXED_INT_CMP_OPS (int32, int64)
+OCTAVE_MIXED_INT_CMP_OPS (int32, uint64)
+
+void
+install_i32_i32_ops (void)
+{
+  OCTAVE_INSTALL_INT_OPS (int32);
+
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int32_, int8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int32_, uint8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int32_, int16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int32_, uint16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int32_, uint32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int32_, int64_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int32_, uint64_);
+
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int32_, int8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int32_, uint8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int32_, int16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int32_, uint16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int32_, uint32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int32_, int64_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int32_, uint64_);
+
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, int8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, uint8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, int16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, uint16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, uint32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, int64);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int32, uint64);
+
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, int8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, uint8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, int16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, uint16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, uint32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, int64);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int32, uint64);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-i64-i64.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-i64nda-i8.h"
+#include "mx-i64nda-ui8.h"
+#include "mx-i64nda-i16.h"
+#include "mx-i64nda-ui16.h"
+#include "mx-i64nda-i32.h"
+#include "mx-i64nda-ui32.h"
+#include "mx-i64nda-ui64.h"
+
+#include "mx-i64nda-i8nda.h"
+#include "mx-i64nda-ui8nda.h"
+#include "mx-i64nda-i16nda.h"
+#include "mx-i64nda-ui16nda.h"
+#include "mx-i64nda-i32nda.h"
+#include "mx-i64nda-ui32nda.h"
+#include "mx-i64nda-ui64nda.h"
+
+#include "mx-i64-i8nda.h"
+#include "mx-i64-ui8nda.h"
+#include "mx-i64-i16nda.h"
+#include "mx-i64-ui16nda.h"
+#include "mx-i64-i32nda.h"
+#include "mx-i64-ui32nda.h"
+#include "mx-i64-ui64nda.h"
+
+#include "mx-i64nda-s.h"
+#include "mx-s-i64nda.h"
+
+#include "mx-i64nda-nda.h"
+#include "mx-nda-i64nda.h"
+
+#include "mx-i64-nda.h"
+#include "mx-nda-i64.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-int8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-uint8.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#include "op-int.h"
+
+OCTAVE_INT_OPS (int64)
+
+OCTAVE_MS_INT_ASSIGN_OPS (mi8, int64_, int8_, int8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui8, int64_, uint8_, uint8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi16, int64_, int16_, int16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui16, int64_, uint16_, uint16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi32, int64_, int32_, int32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui32, int64_, uint32_, uint32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui64, int64_, uint64_, uint64_)
+
+OCTAVE_MM_INT_ASSIGN_OPS (mmi8, int64_, int8_, int8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int64_, uint8_, uint8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int64_, int16_, int16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int64_, uint16_, uint16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int64_, int32_, int32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int64_, uint32_, uint32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int64_, uint64_, uint64_)
+
+OCTAVE_MIXED_INT_CMP_OPS (int64, int8)
+OCTAVE_MIXED_INT_CMP_OPS (int64, uint8)
+OCTAVE_MIXED_INT_CMP_OPS (int64, int16)
+OCTAVE_MIXED_INT_CMP_OPS (int64, uint16)
+OCTAVE_MIXED_INT_CMP_OPS (int64, int32)
+OCTAVE_MIXED_INT_CMP_OPS (int64, uint32)
+OCTAVE_MIXED_INT_CMP_OPS (int64, uint64)
+
+void
+install_i64_i64_ops (void)
+{
+  OCTAVE_INSTALL_INT_OPS (int64);
+
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, int64_, int8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int64_, uint8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int64_, int16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int64_, uint16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int64_, int32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int64_, uint32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int64_, uint64_);
+
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, int64_, int8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int64_, uint8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int64_, int16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int64_, uint16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int64_, int32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int64_, uint32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int64_, uint64_);
+
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, int8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, uint8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, int16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, uint16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, int32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, uint32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int64, uint64);
+
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, int8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, uint8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, int16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, uint16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, int32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, uint32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int64, uint64);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-i8-i8.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-i8nda-ui8.h"
+#include "mx-i8nda-i16.h"
+#include "mx-i8nda-ui16.h"
+#include "mx-i8nda-i32.h"
+#include "mx-i8nda-ui32.h"
+#include "mx-i8nda-i64.h"
+#include "mx-i8nda-ui64.h"
+
+#include "mx-i8nda-ui8nda.h"
+#include "mx-i8nda-i16nda.h"
+#include "mx-i8nda-ui16nda.h"
+#include "mx-i8nda-i32nda.h"
+#include "mx-i8nda-ui32nda.h"
+#include "mx-i8nda-i64nda.h"
+#include "mx-i8nda-ui64nda.h"
+
+#include "mx-i8-ui8nda.h"
+#include "mx-i8-i16nda.h"
+#include "mx-i8-ui16nda.h"
+#include "mx-i8-i32nda.h"
+#include "mx-i8-ui32nda.h"
+#include "mx-i8-i64nda.h"
+#include "mx-i8-ui64nda.h"
+
+#include "mx-i8nda-s.h"
+#include "mx-s-i8nda.h"
+
+#include "mx-i8nda-nda.h"
+#include "mx-nda-i8nda.h"
+
+#include "mx-i8-nda.h"
+#include "mx-nda-i8.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-int8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-uint8.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#include "op-int.h"
+
+OCTAVE_INT_OPS (int8)
+
+OCTAVE_MS_INT_ASSIGN_OPS (mui8, int8_, uint8_, uint8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi16, int8_, int16_, int16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui16, int8_, uint16_, uint16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi32, int8_, int32_, int32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui32, int8_, uint32_, uint32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi64, int8_, int64_, int64_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui64, int8_, uint64_, uint64_)
+
+OCTAVE_MM_INT_ASSIGN_OPS (mmui8, int8_, uint8_, uint8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi16, int8_, int16_, int16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui16, int8_, uint16_, uint16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi32, int8_, int32_, int32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui32, int8_, uint32_, uint32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi64, int8_, int64_, int64_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui64, int8_, uint64_, uint64_)
+
+OCTAVE_MIXED_INT_CMP_OPS (int8, uint8)
+OCTAVE_MIXED_INT_CMP_OPS (int8, int16)
+OCTAVE_MIXED_INT_CMP_OPS (int8, uint16)
+OCTAVE_MIXED_INT_CMP_OPS (int8, int32)
+OCTAVE_MIXED_INT_CMP_OPS (int8, uint32)
+OCTAVE_MIXED_INT_CMP_OPS (int8, int64)
+OCTAVE_MIXED_INT_CMP_OPS (int8, uint64)
+
+void
+install_i8_i8_ops (void)
+{
+  OCTAVE_INSTALL_INT_OPS (int8);
+
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, int8_, uint8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, int8_, int16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, int8_, uint16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, int8_, int32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, int8_, uint32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, int8_, int64_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, int8_, uint64_);
+
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, int8_, uint8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, int8_, int16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, int8_, uint16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, int8_, int32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, int8_, uint32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, int8_, int64_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, int8_, uint64_);
+
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, uint8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, int16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, uint16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, int32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, uint32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, int64);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (int8, uint64);
+
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, uint8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, int16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, uint16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, int32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, uint32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, int64);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (int8, uint64);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-int-concat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,318 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-range.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-str-mat.h"
+#include "ov-typeinfo.h"
+#include "op-int.h"
+#include "ops.h"
+
+// Concatentation of mixed integer types:
+
+OCTAVE_CONCAT_FN2 (int8, int16)
+OCTAVE_CONCAT_FN2 (int8, int32)
+OCTAVE_CONCAT_FN2 (int8, int64)
+
+OCTAVE_CONCAT_FN2 (int8, uint8)
+OCTAVE_CONCAT_FN2 (int8, uint16)
+OCTAVE_CONCAT_FN2 (int8, uint32)
+OCTAVE_CONCAT_FN2 (int8, uint64)
+
+OCTAVE_CONCAT_FN2 (int16, int8)
+OCTAVE_CONCAT_FN2 (int16, int32)
+OCTAVE_CONCAT_FN2 (int16, int64)
+
+OCTAVE_CONCAT_FN2 (int16, uint8)
+OCTAVE_CONCAT_FN2 (int16, uint16)
+OCTAVE_CONCAT_FN2 (int16, uint32)
+OCTAVE_CONCAT_FN2 (int16, uint64)
+
+OCTAVE_CONCAT_FN2 (int32, int8)
+OCTAVE_CONCAT_FN2 (int32, int16)
+OCTAVE_CONCAT_FN2 (int32, int64)
+
+OCTAVE_CONCAT_FN2 (int32, uint8)
+OCTAVE_CONCAT_FN2 (int32, uint16)
+OCTAVE_CONCAT_FN2 (int32, uint32)
+OCTAVE_CONCAT_FN2 (int32, uint64)
+
+OCTAVE_CONCAT_FN2 (int64, int8)
+OCTAVE_CONCAT_FN2 (int64, int16)
+OCTAVE_CONCAT_FN2 (int64, int32)
+
+OCTAVE_CONCAT_FN2 (int64, uint8)
+OCTAVE_CONCAT_FN2 (int64, uint16)
+OCTAVE_CONCAT_FN2 (int64, uint32)
+OCTAVE_CONCAT_FN2 (int64, uint64)
+
+OCTAVE_CONCAT_FN2 (uint8, int8)
+OCTAVE_CONCAT_FN2 (uint8, int16)
+OCTAVE_CONCAT_FN2 (uint8, int32)
+OCTAVE_CONCAT_FN2 (uint8, int64)
+
+OCTAVE_CONCAT_FN2 (uint8, uint16)
+OCTAVE_CONCAT_FN2 (uint8, uint32)
+OCTAVE_CONCAT_FN2 (uint8, uint64)
+
+OCTAVE_CONCAT_FN2 (uint16, int8)
+OCTAVE_CONCAT_FN2 (uint16, int16)
+OCTAVE_CONCAT_FN2 (uint16, int32)
+OCTAVE_CONCAT_FN2 (uint16, int64)
+
+OCTAVE_CONCAT_FN2 (uint16, uint8)
+OCTAVE_CONCAT_FN2 (uint16, uint32)
+OCTAVE_CONCAT_FN2 (uint16, uint64)
+
+OCTAVE_CONCAT_FN2 (uint32, int8)
+OCTAVE_CONCAT_FN2 (uint32, int16)
+OCTAVE_CONCAT_FN2 (uint32, int32)
+OCTAVE_CONCAT_FN2 (uint32, int64)
+
+OCTAVE_CONCAT_FN2 (uint32, uint8)
+OCTAVE_CONCAT_FN2 (uint32, uint16)
+OCTAVE_CONCAT_FN2 (uint32, uint64)
+
+OCTAVE_CONCAT_FN2 (uint64, int8)
+OCTAVE_CONCAT_FN2 (uint64, int16)
+OCTAVE_CONCAT_FN2 (uint64, int32)
+OCTAVE_CONCAT_FN2 (uint64, int64)
+
+OCTAVE_CONCAT_FN2 (uint64, uint8)
+OCTAVE_CONCAT_FN2 (uint64, uint16)
+OCTAVE_CONCAT_FN2 (uint64, uint32)
+
+OCTAVE_INT_DOUBLE_CONCAT_FN (int8)
+OCTAVE_INT_DOUBLE_CONCAT_FN (int16)
+OCTAVE_INT_DOUBLE_CONCAT_FN (int32)
+OCTAVE_INT_DOUBLE_CONCAT_FN (int64)
+
+OCTAVE_INT_DOUBLE_CONCAT_FN (uint8)
+OCTAVE_INT_DOUBLE_CONCAT_FN (uint16)
+OCTAVE_INT_DOUBLE_CONCAT_FN (uint32)
+OCTAVE_INT_DOUBLE_CONCAT_FN (uint64)
+
+OCTAVE_DOUBLE_INT_CONCAT_FN (int8)
+OCTAVE_DOUBLE_INT_CONCAT_FN (int16)
+OCTAVE_DOUBLE_INT_CONCAT_FN (int32)
+OCTAVE_DOUBLE_INT_CONCAT_FN (int64)
+
+OCTAVE_DOUBLE_INT_CONCAT_FN (uint8)
+OCTAVE_DOUBLE_INT_CONCAT_FN (uint16)
+OCTAVE_DOUBLE_INT_CONCAT_FN (uint32)
+OCTAVE_DOUBLE_INT_CONCAT_FN (uint64)
+
+OCTAVE_INT_FLOAT_CONCAT_FN (int8)
+OCTAVE_INT_FLOAT_CONCAT_FN (int16)
+OCTAVE_INT_FLOAT_CONCAT_FN (int32)
+OCTAVE_INT_FLOAT_CONCAT_FN (int64)
+
+OCTAVE_INT_FLOAT_CONCAT_FN (uint8)
+OCTAVE_INT_FLOAT_CONCAT_FN (uint16)
+OCTAVE_INT_FLOAT_CONCAT_FN (uint32)
+OCTAVE_INT_FLOAT_CONCAT_FN (uint64)
+
+OCTAVE_FLOAT_INT_CONCAT_FN (int8)
+OCTAVE_FLOAT_INT_CONCAT_FN (int16)
+OCTAVE_FLOAT_INT_CONCAT_FN (int32)
+OCTAVE_FLOAT_INT_CONCAT_FN (int64)
+
+OCTAVE_FLOAT_INT_CONCAT_FN (uint8)
+OCTAVE_FLOAT_INT_CONCAT_FN (uint16)
+OCTAVE_FLOAT_INT_CONCAT_FN (uint32)
+OCTAVE_FLOAT_INT_CONCAT_FN (uint64)
+
+OCTAVE_INT_CHAR_CONCAT_FN (int8)
+OCTAVE_INT_CHAR_CONCAT_FN (int16)
+OCTAVE_INT_CHAR_CONCAT_FN (int32)
+OCTAVE_INT_CHAR_CONCAT_FN (int64)
+
+OCTAVE_INT_CHAR_CONCAT_FN (uint8)
+OCTAVE_INT_CHAR_CONCAT_FN (uint16)
+OCTAVE_INT_CHAR_CONCAT_FN (uint32)
+OCTAVE_INT_CHAR_CONCAT_FN (uint64)
+
+OCTAVE_CHAR_INT_CONCAT_FN (int8)
+OCTAVE_CHAR_INT_CONCAT_FN (int16)
+OCTAVE_CHAR_INT_CONCAT_FN (int32)
+OCTAVE_CHAR_INT_CONCAT_FN (int64)
+
+OCTAVE_CHAR_INT_CONCAT_FN (uint8)
+OCTAVE_CHAR_INT_CONCAT_FN (uint16)
+OCTAVE_CHAR_INT_CONCAT_FN (uint32)
+OCTAVE_CHAR_INT_CONCAT_FN (uint64)
+
+void
+install_int_concat_ops (void)
+{
+  OCTAVE_INSTALL_CONCAT_FN2 (int8, int16);
+  OCTAVE_INSTALL_CONCAT_FN2 (int8, int32);
+  OCTAVE_INSTALL_CONCAT_FN2 (int8, int64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (int8, uint8);
+  OCTAVE_INSTALL_CONCAT_FN2 (int8, uint16);
+  OCTAVE_INSTALL_CONCAT_FN2 (int8, uint32);
+  OCTAVE_INSTALL_CONCAT_FN2 (int8, uint64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (int16, int8);
+  OCTAVE_INSTALL_CONCAT_FN2 (int16, int32);
+  OCTAVE_INSTALL_CONCAT_FN2 (int16, int64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (int16, uint8);
+  OCTAVE_INSTALL_CONCAT_FN2 (int16, uint16);
+  OCTAVE_INSTALL_CONCAT_FN2 (int16, uint32);
+  OCTAVE_INSTALL_CONCAT_FN2 (int16, uint64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (int32, int8);
+  OCTAVE_INSTALL_CONCAT_FN2 (int32, int16);
+  OCTAVE_INSTALL_CONCAT_FN2 (int32, int64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (int32, uint8);
+  OCTAVE_INSTALL_CONCAT_FN2 (int32, uint16);
+  OCTAVE_INSTALL_CONCAT_FN2 (int32, uint32);
+  OCTAVE_INSTALL_CONCAT_FN2 (int32, uint64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (int64, int8);
+  OCTAVE_INSTALL_CONCAT_FN2 (int64, int16);
+  OCTAVE_INSTALL_CONCAT_FN2 (int64, int32);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (int64, uint8);
+  OCTAVE_INSTALL_CONCAT_FN2 (int64, uint16);
+  OCTAVE_INSTALL_CONCAT_FN2 (int64, uint32);
+  OCTAVE_INSTALL_CONCAT_FN2 (int64, uint64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (uint8, int8);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint8, int16);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint8, int32);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint8, int64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint16);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint32);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (uint16, int8);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint16, int16);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint16, int32);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint16, int64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint8);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint32);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (uint32, int8);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint32, int16);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint32, int32);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint32, int64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint8);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint16);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (uint64, int8);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint64, int16);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint64, int32);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint64, int64);
+
+  OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint8);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint16);
+  OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint32);
+
+  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int8);
+  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int16);
+  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int32);
+  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int64);
+
+  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint8);
+  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint16);
+  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint32);
+  OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint64);
+
+  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int8);
+  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int16);
+  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int32);
+  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int64);
+
+  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint8);
+  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint16);
+  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint32);
+  OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint64);
+
+  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int8);
+  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int16);
+  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int32);
+  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int64);
+
+  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint8);
+  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint16);
+  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint32);
+  OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint64);
+
+  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int8);
+  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int16);
+  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int32);
+  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int64);
+
+  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint8);
+  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint16);
+  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint32);
+  OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint64);
+
+  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int8);
+  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int16);
+  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int32);
+  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int64);
+
+  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint8);
+  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint16);
+  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint32);
+  OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint64);
+
+  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int8);
+  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int16);
+  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int32);
+  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int64);
+
+  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint8);
+  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint16);
+  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint32);
+  OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint64);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-int-conv.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,235 @@
+/*
+
+Copyright (C) 2004-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-range.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-str-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+#define DEFINTCONVFN(name, tfrom, tto) \
+  CONVDECL (name) \
+  { \
+    CAST_CONV_ARG (const octave_ ## tfrom&); \
+ \
+    octave_ ## tto ## _matrix v2 = v.tto ## _array_value (); \
+    return new octave_ ## tto ## _matrix (v2); \
+  }
+
+// conversion ops
+
+DEFINTCONVFN (scalar_to_int8, scalar, int8)
+DEFINTCONVFN (scalar_to_int16, scalar, int16)
+DEFINTCONVFN (scalar_to_int32, scalar, int32)
+DEFINTCONVFN (scalar_to_int64, scalar, int64)
+
+DEFINTCONVFN (scalar_to_uint8, scalar, uint8)
+DEFINTCONVFN (scalar_to_uint16, scalar, uint16)
+DEFINTCONVFN (scalar_to_uint32, scalar, uint32)
+DEFINTCONVFN (scalar_to_uint64, scalar, uint64)
+
+DEFINTCONVFN (matrix_to_int8, matrix, int8)
+DEFINTCONVFN (matrix_to_int16, matrix, int16)
+DEFINTCONVFN (matrix_to_int32, matrix, int32)
+DEFINTCONVFN (matrix_to_int64, matrix, int64)
+
+DEFINTCONVFN (matrix_to_uint8, matrix, uint8)
+DEFINTCONVFN (matrix_to_uint16, matrix, uint16)
+DEFINTCONVFN (matrix_to_uint32, matrix, uint32)
+DEFINTCONVFN (matrix_to_uint64, matrix, uint64)
+
+DEFINTCONVFN (float_scalar_to_int8, float_scalar, int8)
+DEFINTCONVFN (float_scalar_to_int16, float_scalar, int16)
+DEFINTCONVFN (float_scalar_to_int32, float_scalar, int32)
+DEFINTCONVFN (float_scalar_to_int64, float_scalar, int64)
+
+DEFINTCONVFN (float_scalar_to_uint8, float_scalar, uint8)
+DEFINTCONVFN (float_scalar_to_uint16, float_scalar, uint16)
+DEFINTCONVFN (float_scalar_to_uint32, float_scalar, uint32)
+DEFINTCONVFN (float_scalar_to_uint64, float_scalar, uint64)
+
+DEFINTCONVFN (float_matrix_to_int8, float_matrix, int8)
+DEFINTCONVFN (float_matrix_to_int16, float_matrix, int16)
+DEFINTCONVFN (float_matrix_to_int32, float_matrix, int32)
+DEFINTCONVFN (float_matrix_to_int64, float_matrix, int64)
+
+DEFINTCONVFN (float_matrix_to_uint8, float_matrix, uint8)
+DEFINTCONVFN (float_matrix_to_uint16, float_matrix, uint16)
+DEFINTCONVFN (float_matrix_to_uint32, float_matrix, uint32)
+DEFINTCONVFN (float_matrix_to_uint64, float_matrix, uint64)
+
+DEFCONVFN (bool_to_int8, bool, int8)
+DEFCONVFN (bool_to_int16, bool, int16)
+DEFCONVFN (bool_to_int32, bool, int32)
+DEFCONVFN (bool_to_int64, bool, int64)
+
+DEFCONVFN (bool_to_uint8, bool, uint8)
+DEFCONVFN (bool_to_uint16, bool, uint16)
+DEFCONVFN (bool_to_uint32, bool, uint32)
+DEFCONVFN (bool_to_uint64, bool, uint64)
+
+DEFCONVFN (bool_matrix_to_int8, bool_matrix, int8)
+DEFCONVFN (bool_matrix_to_int16, bool_matrix, int16)
+DEFCONVFN (bool_matrix_to_int32, bool_matrix, int32)
+DEFCONVFN (bool_matrix_to_int64, bool_matrix, int64)
+
+DEFCONVFN (bool_matrix_to_uint8, bool_matrix, uint8)
+DEFCONVFN (bool_matrix_to_uint16, bool_matrix, uint16)
+DEFCONVFN (bool_matrix_to_uint32, bool_matrix, uint32)
+DEFCONVFN (bool_matrix_to_uint64, bool_matrix, uint64)
+
+DEFSTRINTCONVFN (char_matrix_sq_str_to_int8, int8)
+DEFSTRINTCONVFN (char_matrix_sq_str_to_int16, int16)
+DEFSTRINTCONVFN (char_matrix_sq_str_to_int32, int32)
+DEFSTRINTCONVFN (char_matrix_sq_str_to_int64, int64)
+
+DEFSTRINTCONVFN (char_matrix_sq_str_to_uint8, uint8)
+DEFSTRINTCONVFN (char_matrix_sq_str_to_uint16, uint16)
+DEFSTRINTCONVFN (char_matrix_sq_str_to_uint32, uint32)
+DEFSTRINTCONVFN (char_matrix_sq_str_to_uint64, uint64)
+
+DEFSTRINTCONVFN (char_matrix_dq_str_to_int8, int8)
+DEFSTRINTCONVFN (char_matrix_dq_str_to_int16, int16)
+DEFSTRINTCONVFN (char_matrix_dq_str_to_int32, int32)
+DEFSTRINTCONVFN (char_matrix_dq_str_to_int64, int64)
+
+DEFSTRINTCONVFN (char_matrix_dq_str_to_uint8, uint8)
+DEFSTRINTCONVFN (char_matrix_dq_str_to_uint16, uint16)
+DEFSTRINTCONVFN (char_matrix_dq_str_to_uint32, uint32)
+DEFSTRINTCONVFN (char_matrix_dq_str_to_uint64, uint64)
+
+DEFINTCONVFN (range_to_int8, range, int8)
+DEFINTCONVFN (range_to_int16, range, int16)
+DEFINTCONVFN (range_to_int32, range, int32)
+DEFINTCONVFN (range_to_int64, range, int64)
+
+DEFINTCONVFN (range_to_uint8, range, uint8)
+DEFINTCONVFN (range_to_uint16, range, uint16)
+DEFINTCONVFN (range_to_uint32, range, uint32)
+DEFINTCONVFN (range_to_uint64, range, uint64)
+
+#define INT_CONV_FUNCTIONS(tfrom) \
+  DEFCONVFN2 (tfrom ## _scalar_to_int8, tfrom, scalar, int8) \
+  DEFCONVFN2 (tfrom ## _scalar_to_int16, tfrom, scalar, int16) \
+  DEFCONVFN2 (tfrom ## _scalar_to_int32, tfrom, scalar, int32) \
+  DEFCONVFN2 (tfrom ## _scalar_to_int64, tfrom, scalar, int64) \
+ \
+  DEFCONVFN2 (tfrom ## _scalar_to_uint8, tfrom, scalar, uint8) \
+  DEFCONVFN2 (tfrom ## _scalar_to_uint16, tfrom, scalar, uint16) \
+  DEFCONVFN2 (tfrom ## _scalar_to_uint32, tfrom, scalar, uint32) \
+  DEFCONVFN2 (tfrom ## _scalar_to_uint64, tfrom, scalar, uint64) \
+ \
+  DEFCONVFN2 (tfrom ## _matrix_to_int8, tfrom, matrix, int8) \
+  DEFCONVFN2 (tfrom ## _matrix_to_int16, tfrom, matrix, int16) \
+  DEFCONVFN2 (tfrom ## _matrix_to_int32, tfrom, matrix, int32) \
+  DEFCONVFN2 (tfrom ## _matrix_to_int64, tfrom, matrix, int64) \
+ \
+  DEFCONVFN2 (tfrom ## _matrix_to_uint8, tfrom, matrix, uint8) \
+  DEFCONVFN2 (tfrom ## _matrix_to_uint16, tfrom, matrix, uint16) \
+  DEFCONVFN2 (tfrom ## _matrix_to_uint32, tfrom, matrix, uint32) \
+  DEFCONVFN2 (tfrom ## _matrix_to_uint64, tfrom, matrix, uint64)
+
+INT_CONV_FUNCTIONS (int8)
+INT_CONV_FUNCTIONS (int16)
+INT_CONV_FUNCTIONS (int32)
+INT_CONV_FUNCTIONS (int64)
+
+INT_CONV_FUNCTIONS (uint8)
+INT_CONV_FUNCTIONS (uint16)
+INT_CONV_FUNCTIONS (uint32)
+INT_CONV_FUNCTIONS (uint64)
+
+#define INSTALL_INT_CONV_FUNCTIONS(tfrom) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_int8_matrix, tfrom ## _scalar_to_int8) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_int16_matrix, tfrom ## _scalar_to_int16) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_int32_matrix, tfrom ## _scalar_to_int32) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_int64_matrix, tfrom ## _scalar_to_int64) \
+ \
+  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_uint8_matrix, tfrom ## _scalar_to_uint8) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_uint16_matrix, tfrom ## _scalar_to_uint16) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_uint32_matrix, tfrom ## _scalar_to_uint32) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _scalar, octave_uint64_matrix, tfrom ## _scalar_to_uint64) \
+ \
+  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_int8_matrix, tfrom ## _matrix_to_int8) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_int16_matrix, tfrom ## _matrix_to_int16) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_int32_matrix, tfrom ## _matrix_to_int32) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_int64_matrix, tfrom ## _matrix_to_int64) \
+ \
+  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_uint8_matrix, tfrom ## _matrix_to_uint8) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_uint16_matrix, tfrom ## _matrix_to_uint16) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_uint32_matrix, tfrom ## _matrix_to_uint32) \
+  INSTALL_CONVOP (octave_ ## tfrom ## _matrix, octave_uint64_matrix, tfrom ## _matrix_to_uint64)
+
+#define INSTALL_CONVOPS(tfrom) \
+  INSTALL_CONVOP (octave_ ## tfrom, octave_int8_matrix, tfrom ## _to_int8) \
+  INSTALL_CONVOP (octave_ ## tfrom, octave_int16_matrix, tfrom ## _to_int16) \
+  INSTALL_CONVOP (octave_ ## tfrom, octave_int32_matrix, tfrom ## _to_int32) \
+  INSTALL_CONVOP (octave_ ## tfrom, octave_int64_matrix, tfrom ## _to_int64) \
+ \
+  INSTALL_CONVOP (octave_ ## tfrom, octave_uint8_matrix, tfrom ## _to_uint8) \
+  INSTALL_CONVOP (octave_ ## tfrom, octave_uint16_matrix, tfrom ## _to_uint16) \
+  INSTALL_CONVOP (octave_ ## tfrom, octave_uint32_matrix, tfrom ## _to_uint32) \
+  INSTALL_CONVOP (octave_ ## tfrom, octave_uint64_matrix, tfrom ## _to_uint64)
+
+void
+install_int_conv_ops (void)
+{
+  INSTALL_CONVOPS (scalar)
+  INSTALL_CONVOPS (matrix)
+  INSTALL_CONVOPS (float_scalar)
+  INSTALL_CONVOPS (float_matrix)
+  INSTALL_CONVOPS (bool)
+  INSTALL_CONVOPS (bool_matrix)
+  INSTALL_CONVOPS (range)
+  INSTALL_CONVOPS (char_matrix_sq_str)
+  INSTALL_CONVOPS (char_matrix_dq_str)
+
+  INSTALL_INT_CONV_FUNCTIONS (int8)
+  INSTALL_INT_CONV_FUNCTIONS (int16)
+  INSTALL_INT_CONV_FUNCTIONS (int32)
+  INSTALL_INT_CONV_FUNCTIONS (int64)
+
+  INSTALL_INT_CONV_FUNCTIONS (uint8)
+  INSTALL_INT_CONV_FUNCTIONS (uint16)
+  INSTALL_INT_CONV_FUNCTIONS (uint32)
+  INSTALL_INT_CONV_FUNCTIONS (uint64)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-int.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1191 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#include "quit.h"
+#include "bsxfun.h"
+
+#define DEFINTBINOP_OP(name, t1, t2, op, t3) \
+  BINOPDECL (name, a1, a2) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
+    octave_value retval = octave_value \
+      (v1.t1 ## _value () op v2.t2 ## _value ()); \
+    return retval; \
+  }
+
+#define DEFINTNDBINOP_OP(name, t1, t2, e1, e2, op, t3) \
+  BINOPDECL (name, a1, a2) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
+    octave_value retval = octave_value \
+      (v1.e1 ## _value () op v2.e2 ## _value ()); \
+    return retval; \
+  }
+
+#define DEFINTBINOP_FN(name, t1, t2, f, t3, op) \
+  BINOPDECL (name, a1, a2) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
+    octave_value retval = octave_value (f (v1.t1 ## _value (), v2.t2 ## _value ())); \
+    return retval; \
+  }
+
+#define DEFINTNDBINOP_FN(name, t1, t2, e1, e2, f, t3, op)       \
+  BINOPDECL (name, a1, a2) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
+    octave_value retval = octave_value (f (v1.e1 ## _value (), v2.e2 ## _value ())); \
+    return retval; \
+  }
+
+#define OCTAVE_CONCAT_FN2(T1, T2) \
+  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _s_s, T1 ## _scalar, T2 ## _scalar, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
+  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _s_m, T1 ## _scalar, T2 ## _matrix, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
+  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _m_s, T1 ## _matrix, T2 ## _scalar, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat) \
+  DEFNDCATOP_FN2 (T1 ## _ ## T2 ## _m_m, T1 ## _matrix, T2 ## _matrix, , T1 ## NDArray, T1 ## _array, T2 ## _array, concat)
+
+#define OCTAVE_INSTALL_CONCAT_FN2(T1, T2) \
+  INSTALL_CATOP (octave_ ## T1 ## _scalar, octave_ ## T2 ## _scalar, T1 ## _ ## T2 ## _s_s) \
+  INSTALL_CATOP (octave_ ## T1 ## _scalar, octave_ ## T2 ## _matrix, T1 ## _ ## T2 ## _s_m) \
+  INSTALL_CATOP (octave_ ## T1 ## _matrix, octave_ ## T2 ## _scalar, T1 ## _ ## T2 ## _m_s) \
+  INSTALL_CATOP (octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, T1 ## _ ## T2 ## _m_m)
+
+#define OCTAVE_DOUBLE_INT_CONCAT_FN(TYPE) \
+  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _s_s, scalar, TYPE ## _scalar, TYPE ## NDArray, , array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _s_m, scalar, TYPE ## _matrix, TYPE ## NDArray, , array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _m_s, matrix, TYPE ## _scalar, TYPE ## NDArray, , array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN2 (double ## _ ## TYPE ## _m_m, matrix, TYPE ## _matrix, TYPE ## NDArray, , array, TYPE ## _array, concat)
+
+#define OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN(TYPE) \
+  INSTALL_CATOP (octave_scalar, octave_ ## TYPE ## _scalar, double ## _ ## TYPE ## _s_s) \
+  INSTALL_CATOP (octave_scalar, octave_ ## TYPE ## _matrix, double ## _ ## TYPE ## _s_m) \
+  INSTALL_CATOP (octave_matrix, octave_ ## TYPE ## _scalar, double ## _ ## TYPE ## _m_s) \
+  INSTALL_CATOP (octave_matrix, octave_ ## TYPE ## _matrix, double ## _ ## TYPE ## _m_m)
+
+#define OCTAVE_INT_DOUBLE_CONCAT_FN(TYPE) \
+  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _s_s, TYPE ## _scalar, scalar, , TYPE ## NDArray, TYPE ## _array, array, concat) \
+  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _s_m, TYPE ## _scalar, matrix, , TYPE ## NDArray, TYPE ## _array, array, concat) \
+  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _m_s, TYPE ## _matrix, scalar, , TYPE ## NDArray, TYPE ## _array, array, concat) \
+  DEFNDCATOP_FN2 (TYPE ## _ ## double ## _m_m, TYPE ## _matrix, matrix, , TYPE ## NDArray, TYPE ## _array, array, concat)
+
+#define OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN(TYPE) \
+  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_scalar, TYPE ## _ ## double ## _s_s) \
+  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_matrix, TYPE ## _ ## double ## _s_m) \
+  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_scalar, TYPE ## _ ## double ## _m_s) \
+  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_matrix, TYPE ## _ ## double ## _m_m)
+
+#define OCTAVE_FLOAT_INT_CONCAT_FN(TYPE) \
+  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _s_s, float_scalar, TYPE ## _scalar, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _s_m, float_scalar, TYPE ## _matrix, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _m_s, float_matrix, TYPE ## _scalar, TYPE ## NDArray, , float_array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN2 (float ## _ ## TYPE ## _m_m, float_matrix, TYPE ## _matrix, TYPE ## NDArray, , float_array, TYPE ## _array, concat)
+
+#define OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN(TYPE) \
+  INSTALL_CATOP (octave_float_scalar, octave_ ## TYPE ## _scalar, float ## _ ## TYPE ## _s_s) \
+  INSTALL_CATOP (octave_float_scalar, octave_ ## TYPE ## _matrix, float ## _ ## TYPE ## _s_m) \
+  INSTALL_CATOP (octave_float_matrix, octave_ ## TYPE ## _scalar, float ## _ ## TYPE ## _m_s) \
+  INSTALL_CATOP (octave_float_matrix, octave_ ## TYPE ## _matrix, float ## _ ## TYPE ## _m_m)
+
+#define OCTAVE_INT_FLOAT_CONCAT_FN(TYPE) \
+  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _s_s, TYPE ## _scalar, float_scalar, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
+  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _s_m, TYPE ## _scalar, float_matrix, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
+  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _m_s, TYPE ## _matrix, float_scalar, , TYPE ## NDArray, TYPE ## _array, float_array, concat) \
+  DEFNDCATOP_FN2 (TYPE ## _ ## float ## _m_m, TYPE ## _matrix, float_matrix, , TYPE ## NDArray, TYPE ## _array, float_array, concat)
+
+#define OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN(TYPE) \
+  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_float_scalar, TYPE ## _ ## float ## _s_s) \
+  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_float_matrix, TYPE ## _ ## float ## _s_m) \
+  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_float_scalar, TYPE ## _ ## float ## _m_s) \
+  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_float_matrix, TYPE ## _ ## float ## _m_m)
+
+// For compatibility, concatenation with a character always returns a
+// character.
+
+#define OCTAVE_CHAR_INT_CONCAT_FN(TYPE) \
+  DEFNDCHARCATOP_FN (char ## _ ## TYPE ## _m_s, char_matrix, TYPE ## _scalar, concat) \
+  DEFNDCHARCATOP_FN (char ## _ ## TYPE ## _m_m, char_matrix, TYPE ## _matrix, concat)
+
+#define OCTAVE_INSTALL_CHAR_INT_CONCAT_FN(TYPE) \
+  INSTALL_CATOP (octave_char_matrix_str, octave_ ## TYPE ## _scalar, char ## _ ## TYPE ## _m_s) \
+  INSTALL_CATOP (octave_char_matrix_str, octave_ ## TYPE ## _matrix, char ## _ ## TYPE ## _m_m) \
+  INSTALL_CATOP (octave_char_matrix_sq_str, octave_ ## TYPE ## _scalar, char ## _ ## TYPE ## _m_s) \
+  INSTALL_CATOP (octave_char_matrix_sq_str, octave_ ## TYPE ## _matrix, char ## _ ## TYPE ## _m_m)
+
+#define OCTAVE_INT_CHAR_CONCAT_FN(TYPE) \
+  DEFNDCHARCATOP_FN (TYPE ## _ ## char ## _s_m, TYPE ## _scalar, char_matrix, concat) \
+  DEFNDCHARCATOP_FN (TYPE ## _ ## char ## _m_m, TYPE ## _matrix, char_matrix, concat)
+
+#define OCTAVE_INSTALL_INT_CHAR_CONCAT_FN(TYPE) \
+  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_char_matrix_str, TYPE ## _ ## char ## _s_m) \
+  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_char_matrix_str, TYPE ## _ ## char ## _m_m) \
+  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_char_matrix_sq_str, TYPE ## _ ## char ## _s_m) \
+  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_char_matrix_sq_str, TYPE ## _ ## char ## _m_m)
+
+#define OCTAVE_CONCAT_FN(TYPE) \
+  DEFNDCATOP_FN (TYPE ## _s_s, TYPE ## _scalar, TYPE ## _scalar, TYPE ## _array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN (TYPE ## _s_m, TYPE ## _scalar, TYPE ## _matrix, TYPE ## _array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN (TYPE ## _m_s, TYPE ## _matrix, TYPE ## _scalar, TYPE ## _array, TYPE ## _array, concat) \
+  DEFNDCATOP_FN (TYPE ## _m_m, TYPE ## _matrix, TYPE ## _matrix, TYPE ## _array, TYPE ## _array, concat)
+
+#define OCTAVE_INSTALL_CONCAT_FN(TYPE) \
+  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, TYPE ## _s_s) \
+  INSTALL_CATOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _s_m) \
+  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _scalar, TYPE ## _m_s) \
+  INSTALL_CATOP (octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix, TYPE ## _m_m)
+
+#define OCTAVE_S_INT_UNOPS(TYPE) \
+  /* scalar unary ops. */  \
+ \
+  DEFUNOP_OP (s_not, TYPE ## _scalar, !) \
+  DEFUNOP_OP (s_uplus, TYPE ## _scalar, /* no-op */) \
+  DEFUNOP (s_uminus, TYPE ## _scalar) \
+  { \
+    CAST_UNOP_ARG (const octave_ ## TYPE ## _scalar &); \
+    octave_value retval = octave_value (- v. TYPE ## _scalar_value ()); \
+    return retval; \
+  } \
+  DEFUNOP_OP (s_transpose, TYPE ## _scalar, /* no-op */) \
+  DEFUNOP_OP (s_hermitian, TYPE ## _scalar, /* no-op */) \
+ \
+  DEFNCUNOP_METHOD (s_incr, TYPE ## _scalar, increment) \
+  DEFNCUNOP_METHOD (s_decr, TYPE ## _scalar, decrement)
+
+#define OCTAVE_SS_INT_ARITH_OPS(PFX, T1, T2, T3)        \
+  /* scalar by scalar ops. */ \
+ \
+  DEFINTBINOP_OP (PFX ## _add, T1 ## scalar, T2 ## scalar, +, T3) \
+  DEFINTBINOP_OP (PFX ## _sub, T1 ## scalar, T2 ## scalar, -, T3) \
+  DEFINTBINOP_OP (PFX ## _mul, T1 ## scalar, T2 ## scalar, *, T3) \
+ \
+  DEFBINOP (PFX ## _div, T1 ## scalar, T2 ## scalar) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
+ \
+    if (! v2.T2 ## scalar_value ()) \
+      gripe_divide_by_zero (); \
+ \
+    octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
+    return retval; \
+  } \
+ \
+  DEFINTBINOP_FN (PFX ## _pow, T1 ## scalar, T2 ## scalar, xpow, T3, ^) \
+ \
+  DEFBINOP (PFX ## _ldiv, T1 ## scalar, T2 ## scalar) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
+ \
+    if (! v1.T1 ## scalar_value ()) \
+      gripe_divide_by_zero (); \
+ \
+    octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
+    return retval; \
+  } \
+ \
+  DEFINTBINOP_OP (PFX ## _el_mul, T1 ## scalar, T2 ## scalar, *, T3)    \
+ \
+  DEFBINOP (PFX ## _el_div, T1 ## scalar, T2 ## scalar) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
+ \
+    if (! v2.T2 ## scalar_value ()) \
+      gripe_divide_by_zero (); \
+ \
+    octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
+    return retval; \
+  } \
+ \
+  DEFINTBINOP_FN (PFX ## _el_pow, T1 ## scalar, T2 ## scalar, xpow, T3, .^) \
+ \
+  DEFBINOP (PFX ## _el_ldiv, T1 ## scalar, T2 ## scalar) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
+ \
+    if (! v1.T1 ## scalar_value ()) \
+      gripe_divide_by_zero (); \
+ \
+    octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
+    return retval; \
+  } \
+
+#define OCTAVE_SS_INT_BOOL_OPS(PFX, T1, T2, Z1, Z2) \
+  DEFBINOP (PFX ## _el_and, T2, T2) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
+ \
+    return v1.T1 ## scalar_value () != Z1 && v2.T2 ## scalar_value () != Z2; \
+  } \
+ \
+  DEFBINOP (PFX ## _el_or, T1, T2) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## T1 ## scalar&, const octave_ ## T2 ## scalar&); \
+ \
+    return v1.T1 ## scalar_value () != Z1 || v2.T2 ## scalar_value () != Z2; \
+  }
+
+#define OCTAVE_SS_INT_CMP_OPS(PFX, T1, T2) \
+  DEFBINOP_OP (PFX ## _lt, T1 ## scalar, T2 ## scalar, <) \
+  DEFBINOP_OP (PFX ## _le, T1 ## scalar, T2 ## scalar, <=) \
+  DEFBINOP_OP (PFX ## _eq, T1 ## scalar, T2 ## scalar, ==) \
+  DEFBINOP_OP (PFX ## _ge, T1 ## scalar, T2 ## scalar, >=) \
+  DEFBINOP_OP (PFX ## _gt, T1 ## scalar, T2 ## scalar, >) \
+  DEFBINOP_OP (PFX ## _ne, T1 ## scalar, T2 ## scalar, !=)
+
+#define OCTAVE_SS_POW_OPS(T1, T2) \
+  octave_value \
+  xpow (const octave_ ## T1& a, const octave_ ## T2& b) \
+  { \
+    return pow (a, b); \
+  } \
+ \
+  octave_value \
+  xpow (const octave_ ## T1& a, double b) \
+  { \
+    return pow (a, b); \
+  } \
+ \
+  octave_value \
+  xpow (double a, const octave_ ## T1& b) \
+  { \
+    return pow (a, b); \
+  } \
+ \
+  octave_value \
+  xpow (const octave_ ## T1& a, float b) \
+  { \
+    return powf (a, b); \
+  } \
+ \
+  octave_value \
+  xpow (float a, const octave_ ## T1& b) \
+  { \
+    return powf (a, b); \
+  }
+
+#define OCTAVE_SS_INT_OPS(TYPE) \
+  OCTAVE_S_INT_UNOPS (TYPE) \
+  OCTAVE_SS_POW_OPS (TYPE, TYPE) \
+  OCTAVE_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _, TYPE) \
+  OCTAVE_SS_INT_ARITH_OPS (ssx, TYPE ## _, , TYPE) \
+  OCTAVE_SS_INT_ARITH_OPS (sxs, , TYPE ## _, TYPE) \
+  OCTAVE_SS_INT_ARITH_OPS (ssfx, TYPE ## _, float_, TYPE) \
+  OCTAVE_SS_INT_ARITH_OPS (sfxs, float_, TYPE ## _, TYPE) \
+  OCTAVE_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \
+  OCTAVE_SS_INT_CMP_OPS (sx, TYPE ## _, ) \
+  OCTAVE_SS_INT_CMP_OPS (xs, , TYPE ## _) \
+  OCTAVE_SS_INT_CMP_OPS (sfx, TYPE ## _, float_) \
+  OCTAVE_SS_INT_CMP_OPS (fxs, float_, TYPE ## _) \
+  OCTAVE_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _, octave_ ## TYPE (0), octave_ ## TYPE (0)) \
+  OCTAVE_SS_INT_BOOL_OPS (sx, TYPE ## _, , octave_ ## TYPE (0), 0) \
+  OCTAVE_SS_INT_BOOL_OPS (xs, , TYPE ## _, 0, octave_ ## TYPE (0)) \
+  OCTAVE_SS_INT_BOOL_OPS (sfx, TYPE ## _, float_, octave_ ## TYPE (0), 0) \
+  OCTAVE_SS_INT_BOOL_OPS (fxs, float_, TYPE ## _, 0, octave_ ## TYPE (0))
+
+#define OCTAVE_SM_INT_ARITH_OPS(PFX, TS, TM, TI) \
+  /* scalar by matrix ops. */ \
+ \
+  DEFINTNDBINOP_OP (PFX ## _add, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, +, TI) \
+  DEFINTNDBINOP_OP (PFX ## _sub, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, -, TI) \
+  DEFINTNDBINOP_OP (PFX ## _mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \
+ \
+  /* DEFBINOP (PFX ## _div, TS ## scalar, TM ## matrix) */ \
+  /* { */ \
+  /* CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); */ \
+  /* */ \
+  /* Matrix m1 = v1.TM ## matrix_value (); */ \
+  /* Matrix m2 = v2.TM ## matrix_value (); */ \
+  /* */ \
+  /* return octave_value (xdiv (m1, m2)); */ \
+  /* } */ \
+ \
+  /* DEFBINOP_FN (PFX ## _pow, TS ## scalar, TM ## matrix, xpow) */ \
+ \
+  DEFBINOP (PFX ## _ldiv, TS ## scalar, TM ## matrix) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
+ \
+    if (! v1.TS ## scalar_value ()) \
+      gripe_divide_by_zero (); \
+ \
+    octave_value retval = octave_value (v2.TS ## scalar_value () / v1.TS ## scalar_value ()); \
+    return retval; \
+  } \
+ \
+  DEFINTNDBINOP_OP (PFX ## _el_mul, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, *, TI) \
+  DEFBINOP (PFX ## _el_div, TS ## scalar, TM ## matrix) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
+ \
+    octave_value retval = octave_value (v1.TS ## scalar_value () / v2.TM ## array_value ()); \
+    return retval; \
+  } \
+ \
+  DEFINTNDBINOP_FN (PFX ## _el_pow, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, elem_xpow, TI, .^) \
+ \
+  DEFBINOP (PFX ## _el_ldiv, TS ## scalar, TM ## matrix) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
+ \
+    if (! v1.TS ## scalar_value ()) \
+      gripe_divide_by_zero (); \
+ \
+    octave_value retval = octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \
+    return retval; \
+  }
+
+#define OCTAVE_SM_INT_CMP_OPS(PFX, TS, TM) \
+  DEFNDBINOP_FN (PFX ## _lt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_lt) \
+  DEFNDBINOP_FN (PFX ## _le, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_le) \
+  DEFNDBINOP_FN (PFX ## _eq, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_eq) \
+  DEFNDBINOP_FN (PFX ## _ge, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ge) \
+  DEFNDBINOP_FN (PFX ## _gt, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_gt) \
+  DEFNDBINOP_FN (PFX ## _ne, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_ne)
+
+#define OCTAVE_SM_INT_BOOL_OPS(PFX, TS, TM) \
+  DEFNDBINOP_FN (PFX ## _el_and, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_and) \
+  DEFNDBINOP_FN (PFX ## _el_or,  TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_or) \
+  DEFNDBINOP_FN (PFX ## _el_and_not, TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_and_not) \
+  DEFNDBINOP_FN (PFX ## _el_or_not,  TS ## scalar, TM ## matrix, TS ## scalar, TM ## array, mx_el_or_not)
+
+#define OCTAVE_SM_POW_OPS(T1, T2) \
+  octave_value \
+  elem_xpow (const octave_ ## T1& a, const T2 ## NDArray& b) \
+  { \
+    T2 ## NDArray result (b.dims ()); \
+    for (int i = 0; i < b.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = pow (a, b(i)); \
+      } \
+    return octave_value (result); \
+  } \
+\
+  octave_value \
+  elem_xpow (const octave_ ## T1& a, const NDArray& b) \
+  { \
+    T1 ## NDArray result (b.dims ()); \
+    for (int i = 0; i < b.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = pow (a, b(i)); \
+      } \
+    return octave_value (result); \
+  } \
+ \
+  octave_value \
+  elem_xpow (double a, const T2 ## NDArray& b) \
+  { \
+    T2 ## NDArray result (b.dims ()); \
+    for (int i = 0; i < b.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = pow (a, b(i)); \
+      } \
+    return octave_value (result); \
+  } \
+\
+  octave_value \
+  elem_xpow (const octave_ ## T1& a, const FloatNDArray& b) \
+  { \
+    T1 ## NDArray result (b.dims ()); \
+    for (int i = 0; i < b.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = powf (a, b(i)); \
+      } \
+    return octave_value (result); \
+  } \
+ \
+  octave_value \
+  elem_xpow (float a, const T2 ## NDArray& b) \
+  { \
+    T2 ## NDArray result (b.dims ()); \
+    for (int i = 0; i < b.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = powf (a, b(i)); \
+      } \
+    return octave_value (result); \
+  }
+
+
+#define OCTAVE_SM_CONV(TS, TM) \
+  DEFCONV (TS ## s_ ## TM ## m_conv, TM ## scalar, TM ## matrix) \
+  { \
+    CAST_CONV_ARG (const octave_ ## TS ## scalar&); \
+ \
+    return new octave_ ## TM ## matrix (v.TM ## array_value ()); \
+  }
+
+#define OCTAVE_SM_INT_OPS(TYPE) \
+  OCTAVE_SM_POW_OPS (TYPE, TYPE) \
+  OCTAVE_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _, TYPE) \
+  OCTAVE_SM_INT_ARITH_OPS (smx, TYPE ## _, , TYPE) \
+  OCTAVE_SM_INT_ARITH_OPS (sxm, , TYPE ## _, TYPE) \
+  OCTAVE_SM_INT_ARITH_OPS (smfx, TYPE ## _, float_, TYPE) \
+  OCTAVE_SM_INT_ARITH_OPS (sfxm, float_, TYPE ## _, TYPE) \
+  OCTAVE_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \
+  OCTAVE_SM_INT_CMP_OPS (xm, , TYPE ## _) \
+  OCTAVE_SM_INT_CMP_OPS (smx, TYPE ## _, ) \
+  OCTAVE_SM_INT_CMP_OPS (fxm, float_, TYPE ## _) \
+  OCTAVE_SM_INT_CMP_OPS (smfx, TYPE ## _, float_) \
+  OCTAVE_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \
+  OCTAVE_SM_INT_BOOL_OPS (xm, , TYPE ## _) \
+  OCTAVE_SM_INT_BOOL_OPS (smx, TYPE ## _, ) \
+  OCTAVE_SM_INT_BOOL_OPS (fxm, float_, TYPE ## _) \
+  OCTAVE_SM_INT_BOOL_OPS (smfx, TYPE ## _, float_) \
+  OCTAVE_SM_CONV (TYPE ## _, TYPE ## _) \
+  OCTAVE_SM_CONV (TYPE ## _, complex_) \
+  OCTAVE_SM_CONV (TYPE ## _, float_complex_)
+
+#define OCTAVE_MS_INT_ARITH_OPS(PFX, TM, TS, TI) \
+  /* matrix by scalar ops. */ \
+ \
+  DEFINTNDBINOP_OP (PFX ## _add, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, +, TI) \
+  DEFINTNDBINOP_OP (PFX ## _sub, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, -, TI) \
+  DEFINTNDBINOP_OP (PFX ## _mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *, TI) \
+ \
+  DEFBINOP (PFX ## _div, TM ## matrix, TS ## scalar) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
+ \
+    if (! v2.TS ## scalar_value ()) \
+      gripe_divide_by_zero (); \
+ \
+    octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
+    return retval; \
+  } \
+ \
+  /* DEFBINOP_FN (PFX ## _pow, TM ## matrix, TS ## scalar, xpow) */ \
+ \
+  /* DEFBINOP (PFX ## _ldiv, TM ## matrix, TS ## scalar) */ \
+  /* { */ \
+  /* CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); */ \
+  /* */ \
+  /* Matrix m1 = v1.TM ## matrix_value (); */ \
+  /* Matrix m2 = v2.TM ## matrix_value (); */ \
+  /* */ \
+  /* return octave_value (xleftdiv (m1, m2)); */ \
+  /* } */ \
+ \
+  DEFINTNDBINOP_OP (PFX ## _el_mul, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, *, TI) \
+ \
+  DEFBINOP (PFX ## _el_div, TM ## matrix, TS ## scalar) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
+ \
+    if (! v2.TS ## scalar_value ()) \
+      gripe_divide_by_zero (); \
+ \
+    octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
+    return retval; \
+  } \
+ \
+  DEFINTNDBINOP_FN (PFX ## _el_pow, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, elem_xpow, TI, .^) \
+ \
+  DEFBINOP (PFX ## _el_ldiv, TM ## matrix, TS ## scalar) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
+    \
+    octave_value retval = v2.TS ## scalar_value () / v1.TM ## array_value (); \
+    return retval; \
+  }
+
+#define OCTAVE_MS_INT_CMP_OPS(PFX, TM, TS) \
+  DEFNDBINOP_FN (PFX ## _lt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_lt) \
+  DEFNDBINOP_FN (PFX ## _le, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_le) \
+  DEFNDBINOP_FN (PFX ## _eq, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_eq) \
+  DEFNDBINOP_FN (PFX ## _ge, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ge) \
+  DEFNDBINOP_FN (PFX ## _gt, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_gt) \
+  DEFNDBINOP_FN (PFX ## _ne, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_ne)
+
+#define OCTAVE_MS_INT_BOOL_OPS(PFX, TM, TS) \
+  DEFNDBINOP_FN (PFX ## _el_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_and) \
+  DEFNDBINOP_FN (PFX ## _el_or, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_or) \
+  DEFNDBINOP_FN (PFX ## _el_not_and, TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_not_and) \
+  DEFNDBINOP_FN (PFX ## _el_not_or,  TM ## matrix, TS ## scalar, TM ## array, TS ## scalar, mx_el_not_or)
+
+#define OCTAVE_MS_INT_ASSIGN_OPS(PFX, TM, TS, TE) \
+  DEFNDASSIGNOP_FN (PFX ## _assign, TM ## matrix, TS ## scalar, TM ## scalar, assign)
+
+#define OCTAVE_MS_INT_ASSIGNEQ_OPS(PFX, TM) \
+  DEFNDASSIGNOP_OP (PFX ## _assign_add, TM ## matrix, TM ## scalar, TM ## scalar, +=) \
+  DEFNDASSIGNOP_OP (PFX ## _assign_sub, TM ## matrix, TM ## scalar, TM ## scalar, -=) \
+  DEFNDASSIGNOP_OP (PFX ## _assign_mul, TM ## matrix, TM ## scalar, TM ## scalar, *=) \
+  DEFNDASSIGNOP_OP (PFX ## _assign_div, TM ## matrix, TM ## scalar, TM ## scalar, /=)
+
+#define OCTAVE_MS_POW_OPS(T1, T2) \
+octave_value elem_xpow (T1 ## NDArray a, octave_ ## T2  b) \
+{ \
+  T1 ## NDArray result (a.dims ()); \
+  for (int i = 0; i < a.length (); i++) \
+    { \
+      OCTAVE_QUIT; \
+      result (i) = pow (a(i), b);               \
+    } \
+  return octave_value (result); \
+} \
+\
+octave_value elem_xpow (T1 ## NDArray a, double  b) \
+{ \
+  T1 ## NDArray result (a.dims ()); \
+  for (int i = 0; i < a.length (); i++) \
+    { \
+      OCTAVE_QUIT; \
+      result (i) = pow (a(i), b);               \
+    } \
+  return octave_value (result); \
+} \
+\
+octave_value elem_xpow (NDArray a, octave_ ## T2  b) \
+{ \
+  T2 ## NDArray result (a.dims ()); \
+  for (int i = 0; i < a.length (); i++) \
+    { \
+      OCTAVE_QUIT; \
+      result (i) = pow (a(i), b);               \
+    } \
+  return octave_value (result); \
+} \
+\
+octave_value elem_xpow (T1 ## NDArray a, float  b) \
+{ \
+  T1 ## NDArray result (a.dims ()); \
+  for (int i = 0; i < a.length (); i++) \
+    { \
+      OCTAVE_QUIT; \
+      result (i) = powf (a(i), b);              \
+    } \
+  return octave_value (result); \
+} \
+\
+octave_value elem_xpow (FloatNDArray a, octave_ ## T2  b) \
+{ \
+  T2 ## NDArray result (a.dims ()); \
+  for (int i = 0; i < a.length (); i++) \
+    { \
+      OCTAVE_QUIT; \
+      result (i) = powf (a(i), b);              \
+    } \
+  return octave_value (result); \
+}
+
+
+#define OCTAVE_MS_INT_OPS(TYPE) \
+  OCTAVE_MS_POW_OPS (TYPE, TYPE) \
+  OCTAVE_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _, TYPE) \
+  OCTAVE_MS_INT_ARITH_OPS (msx, TYPE ## _, , TYPE) \
+  OCTAVE_MS_INT_ARITH_OPS (mxs, , TYPE ## _, TYPE) \
+  OCTAVE_MS_INT_ARITH_OPS (msfx, TYPE ## _, float_, TYPE) \
+  OCTAVE_MS_INT_ARITH_OPS (mfxs, float_, TYPE ## _, TYPE) \
+  OCTAVE_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \
+  OCTAVE_MS_INT_CMP_OPS (mx, TYPE ## _, ) \
+  OCTAVE_MS_INT_CMP_OPS (mxs, , TYPE ## _) \
+  OCTAVE_MS_INT_CMP_OPS (mfx, TYPE ## _, float_) \
+  OCTAVE_MS_INT_CMP_OPS (mfxs, float_, TYPE ## _) \
+  OCTAVE_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \
+  OCTAVE_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \
+  OCTAVE_MS_INT_BOOL_OPS (mxs, , TYPE ## _) \
+  OCTAVE_MS_INT_BOOL_OPS (mfx, TYPE ## _, float_) \
+  OCTAVE_MS_INT_BOOL_OPS (mfxs, float_, TYPE ## _) \
+  OCTAVE_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _, TYPE ## _) \
+  OCTAVE_MS_INT_ASSIGNEQ_OPS (mse, TYPE ## _) \
+  OCTAVE_MS_INT_ASSIGN_OPS (mx, TYPE ## _, , ) \
+  OCTAVE_MS_INT_ASSIGN_OPS (mfx, TYPE ## _, float_, float_)
+
+#define OCTAVE_M_INT_UNOPS(TYPE) \
+  /* matrix unary ops. */ \
+ \
+  DEFNDUNOP_OP (m_not, TYPE ## _matrix, TYPE ## _array, !) \
+  DEFNDUNOP_OP (m_uplus, TYPE ## _matrix, TYPE ## _array, /* no-op */) \
+  DEFUNOP (m_uminus, TYPE ## _matrix) \
+  { \
+    CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix &); \
+    octave_value retval = octave_value (- v. TYPE ## _array_value ()); \
+    return retval; \
+  } \
+ \
+  DEFUNOP (m_transpose, TYPE ## _matrix) \
+  { \
+    CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix&); \
+ \
+    if (v.ndims () > 2) \
+      { \
+        error ("transpose not defined for N-d objects"); \
+        return octave_value (); \
+      } \
+    else \
+      return octave_value (v.TYPE ## _array_value ().transpose ()); \
+  } \
+ \
+  DEFNCUNOP_METHOD (m_incr, TYPE ## _matrix, increment) \
+  DEFNCUNOP_METHOD (m_decr, TYPE ## _matrix, decrement) \
+  DEFNCUNOP_METHOD (m_changesign, TYPE ## _matrix, changesign)
+
+#define OCTAVE_MM_INT_ARITH_OPS(PFX, T1, T2, T3)        \
+  /* matrix by matrix ops. */ \
+ \
+  DEFINTNDBINOP_OP (PFX ## _add, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, +, T3) \
+  DEFINTNDBINOP_OP (PFX ## _sub, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, -, T3) \
+ \
+  /* DEFBINOP_OP (PFX ## _mul, T1 ## matrix, T2 ## matrix, *) */ \
+  /* DEFBINOP_FN (PFX ## _div, T1 ## matrix, T2 ## matrix, xdiv) */ \
+ \
+  DEFBINOPX (PFX ## _pow, T1 ## matrix, T2 ## matrix) \
+  { \
+    error ("can't do A ^ B for A and B both matrices"); \
+    return octave_value (); \
+  } \
+ \
+  /* DEFBINOP_FN (PFX ## _ldiv, T1 ## matrix, T2 ## matrix, xleftdiv) */ \
+ \
+  DEFINTNDBINOP_FN (PFX ## _el_mul, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, product, T3, .*) \
+ \
+  DEFINTNDBINOP_FN (PFX ## _el_div, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, quotient, T3, ./) \
+ \
+  DEFINTNDBINOP_FN (PFX ## _el_pow, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, elem_xpow, T3, .^) \
+ \
+  DEFBINOP (PFX ## _el_ldiv, T1 ## matrix, T2 ## matrix) \
+  { \
+    CAST_BINOP_ARGS (const octave_ ## T1 ## matrix&, const octave_ ## T2 ## matrix&); \
+    \
+    octave_value retval = octave_value (quotient (v2.T2 ## array_value (), v1.T1 ## array_value ())); \
+    return retval; \
+  }
+
+#define OCTAVE_MM_INT_CMP_OPS(PFX, T1, T2) \
+  DEFNDBINOP_FN (PFX ## _lt, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_lt) \
+  DEFNDBINOP_FN (PFX ## _le, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_le) \
+  DEFNDBINOP_FN (PFX ## _eq, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_eq) \
+  DEFNDBINOP_FN (PFX ## _ge, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_ge) \
+  DEFNDBINOP_FN (PFX ## _gt, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_gt) \
+  DEFNDBINOP_FN (PFX ## _ne, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_ne)
+
+#define OCTAVE_MM_INT_BOOL_OPS(PFX, T1, T2) \
+  DEFNDBINOP_FN (PFX ## _el_and, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_and) \
+  DEFNDBINOP_FN (PFX ## _el_or,  T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_or) \
+  DEFNDBINOP_FN (PFX ## _el_not_and, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_not_and) \
+  DEFNDBINOP_FN (PFX ## _el_not_or,  T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_not_or) \
+  DEFNDBINOP_FN (PFX ## _el_and_not, T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_and_not) \
+  DEFNDBINOP_FN (PFX ## _el_or_not,  T1 ## matrix, T2 ## matrix, T1 ## array, T2 ## array, mx_el_or_not)
+
+#define OCTAVE_MM_INT_ASSIGN_OPS(PFX, TLHS, TRHS, TE) \
+  DEFNDASSIGNOP_FN (PFX ## _assign, TLHS ## matrix, TRHS ## matrix, TLHS ## array, assign)
+
+#define OCTAVE_MM_INT_ASSIGNEQ_OPS(PFX, TM) \
+  DEFNDASSIGNOP_OP (PFX ## _assign_add, TM ## matrix, TM ## matrix, TM ## array, +=) \
+  DEFNDASSIGNOP_OP (PFX ## _assign_sub, TM ## matrix, TM ## matrix, TM ## array, -=) \
+  DEFNDASSIGNOP_FNOP (PFX ## _assign_el_mul, TM ## matrix, TM ## matrix, TM ## array, product_eq) \
+  DEFNDASSIGNOP_FNOP (PFX ## _assign_el_div, TM ## matrix, TM ## matrix, TM ## array, quotient_eq)
+
+#define OCTAVE_MM_POW_OPS(T1, T2) \
+  octave_value \
+  elem_xpow (const T1 ## NDArray& a, const T2 ## NDArray& b) \
+  { \
+    dim_vector a_dims = a.dims (); \
+    dim_vector b_dims = b.dims (); \
+    if (a_dims != b_dims) \
+      { \
+        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
+          { \
+            return bsxfun_pow (a, b); \
+          } \
+        else \
+          { \
+            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
+            return octave_value (); \
+          } \
+      } \
+    T1 ## NDArray result (a_dims); \
+    for (int i = 0; i < a.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = pow (a(i), b(i)); \
+      } \
+    return octave_value (result); \
+  } \
+\
+  octave_value \
+  elem_xpow (const T1 ## NDArray& a, const NDArray& b) \
+  { \
+    dim_vector a_dims = a.dims (); \
+    dim_vector b_dims = b.dims (); \
+    if (a_dims != b_dims) \
+      { \
+        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
+          { \
+            return bsxfun_pow (a, b); \
+          } \
+        else \
+          { \
+            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
+            return octave_value (); \
+          } \
+      } \
+    T1 ## NDArray result (a_dims); \
+    for (int i = 0; i < a.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = pow (a(i), b(i)); \
+      } \
+    return octave_value (result); \
+  } \
+\
+  octave_value \
+  elem_xpow (const NDArray& a, const T2 ## NDArray& b) \
+  { \
+    dim_vector a_dims = a.dims (); \
+    dim_vector b_dims = b.dims (); \
+    if (a_dims != b_dims) \
+      { \
+        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
+          { \
+            return bsxfun_pow (a, b); \
+          } \
+        else \
+          { \
+            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
+            return octave_value (); \
+          } \
+      } \
+    T2 ## NDArray result (a_dims); \
+    for (int i = 0; i < a.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = pow (a(i), b(i)); \
+      } \
+    return octave_value (result); \
+  } \
+\
+  octave_value \
+  elem_xpow (const T1 ## NDArray& a, const FloatNDArray& b) \
+  { \
+    dim_vector a_dims = a.dims (); \
+    dim_vector b_dims = b.dims (); \
+    if (a_dims != b_dims) \
+      { \
+        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
+          { \
+            return bsxfun_pow (a, b); \
+          } \
+        else \
+          { \
+            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
+            return octave_value (); \
+          } \
+      } \
+    T1 ## NDArray result (a_dims); \
+    for (int i = 0; i < a.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = powf (a(i), b(i)); \
+      } \
+    return octave_value (result); \
+  } \
+\
+  octave_value \
+  elem_xpow (const FloatNDArray& a, const T2 ## NDArray& b) \
+  { \
+    dim_vector a_dims = a.dims (); \
+    dim_vector b_dims = b.dims (); \
+    if (a_dims != b_dims) \
+      { \
+        if (is_valid_bsxfun ("operator .^", a_dims, b_dims))     \
+          { \
+            return bsxfun_pow (a, b); \
+          } \
+        else \
+          { \
+            gripe_nonconformant ("operator .^", a_dims, b_dims);  \
+            return octave_value (); \
+          } \
+      } \
+    T2 ## NDArray result (a_dims); \
+    for (int i = 0; i < a.length (); i++) \
+      { \
+        OCTAVE_QUIT; \
+        result (i) = powf (a(i), b(i)); \
+      } \
+    return octave_value (result); \
+  }
+
+
+#define OCTAVE_MM_CONV(T1, T2) \
+  DEFCONV (T1 ## m_ ## T2 ## m_conv, T1 ## matrix, T2 ## matrix) \
+  { \
+    CAST_CONV_ARG (const octave_ ## T1 ## matrix&); \
+ \
+    return new octave_ ## T2 ## matrix (v.T2 ## array_value ()); \
+  }
+
+#define OCTAVE_MM_INT_OPS(TYPE) \
+  OCTAVE_M_INT_UNOPS (TYPE) \
+  OCTAVE_MM_POW_OPS (TYPE, TYPE) \
+  OCTAVE_MM_INT_ARITH_OPS (mm, TYPE ## _, TYPE ## _, TYPE) \
+  OCTAVE_MM_INT_ARITH_OPS (mmx, TYPE ## _, , TYPE) \
+  OCTAVE_MM_INT_ARITH_OPS (mxm, , TYPE ## _, TYPE) \
+  OCTAVE_MM_INT_ARITH_OPS (mmfx, TYPE ## _, float_, TYPE) \
+  OCTAVE_MM_INT_ARITH_OPS (mfxm, float_, TYPE ## _, TYPE) \
+  OCTAVE_MM_INT_CMP_OPS (mm, TYPE ## _, TYPE ## _) \
+  OCTAVE_MM_INT_CMP_OPS (mmx, TYPE ## _, ) \
+  OCTAVE_MM_INT_CMP_OPS (mfxm, float_, TYPE ## _) \
+  OCTAVE_MM_INT_CMP_OPS (mmfx, TYPE ## _, float_) \
+  OCTAVE_MM_INT_CMP_OPS (mxm, , TYPE ## _) \
+  OCTAVE_MM_INT_BOOL_OPS (mm, TYPE ## _, TYPE ## _) \
+  OCTAVE_MM_INT_BOOL_OPS (mmx, TYPE ## _, ) \
+  OCTAVE_MM_INT_BOOL_OPS (mxm, , TYPE ## _) \
+  OCTAVE_MM_INT_BOOL_OPS (mmfx, TYPE ## _, float_) \
+  OCTAVE_MM_INT_BOOL_OPS (mfxm, float_, TYPE ## _) \
+  OCTAVE_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _, TYPE ## _) \
+  OCTAVE_MM_INT_ASSIGNEQ_OPS (mme, TYPE ## _) \
+  OCTAVE_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, , ) \
+  OCTAVE_MM_INT_ASSIGN_OPS (mmfx, TYPE ## _, float_, float_) \
+  OCTAVE_MM_CONV(TYPE ## _, complex_) \
+  OCTAVE_MM_CONV(TYPE ## _, float_complex_)
+
+#define OCTAVE_RE_INT_ASSIGN_OPS(TYPE) \
+  DEFNDASSIGNOP_FN (TYPE ## ms_assign, matrix, TYPE ## _scalar, array, assign) \
+  DEFNDASSIGNOP_FN (TYPE ## mm_assign, matrix, TYPE ## _matrix, array, assign)
+
+#define OCTAVE_FLT_RE_INT_ASSIGN_OPS(TYPE) \
+  DEFNDASSIGNOP_FN (TYPE ## fms_assign, float_matrix, TYPE ## _scalar, float_array, assign) \
+  DEFNDASSIGNOP_FN (TYPE ## fmm_assign, float_matrix, TYPE ## _matrix, float_array, assign)
+
+#define OCTAVE_CX_INT_ASSIGN_OPS(TYPE) \
+  DEFNDASSIGNOP_FN (TYPE ## cms_assign, complex_matrix, TYPE ## _scalar, complex_array, assign) \
+  DEFNDASSIGNOP_FN (TYPE ## cmm_assign, complex_matrix, TYPE ## _matrix, complex_array, assign)
+
+#define OCTAVE_FLT_CX_INT_ASSIGN_OPS(TYPE) \
+  DEFNDASSIGNOP_FN (TYPE ## fcms_assign, float_complex_matrix, TYPE ## _scalar, float_complex_array, assign) \
+  DEFNDASSIGNOP_FN (TYPE ## fcmm_assign, float_complex_matrix, TYPE ## _matrix, float_complex_array, assign)
+
+#define OCTAVE_INT_NULL_ASSIGN_OPS(TYPE) \
+  DEFNULLASSIGNOP_FN (TYPE ## null_assign, TYPE ## _matrix, delete_elements)
+
+#define OCTAVE_INT_OPS(TYPE) \
+  OCTAVE_SS_INT_OPS (TYPE) \
+  OCTAVE_SM_INT_OPS (TYPE) \
+  OCTAVE_MS_INT_OPS (TYPE) \
+  OCTAVE_MM_INT_OPS (TYPE) \
+  OCTAVE_CONCAT_FN (TYPE) \
+  OCTAVE_RE_INT_ASSIGN_OPS (TYPE) \
+  OCTAVE_FLT_RE_INT_ASSIGN_OPS (TYPE) \
+  OCTAVE_CX_INT_ASSIGN_OPS (TYPE) \
+  OCTAVE_FLT_CX_INT_ASSIGN_OPS (TYPE) \
+  OCTAVE_INT_NULL_ASSIGN_OPS(TYPE)
+
+#define OCTAVE_INSTALL_S_INT_UNOPS(TYPE) \
+  INSTALL_UNOP (op_not, octave_ ## TYPE ## _scalar, s_not); \
+  INSTALL_UNOP (op_uplus, octave_ ## TYPE ## _scalar, s_uplus); \
+  INSTALL_UNOP (op_uminus, octave_ ## TYPE ## _scalar, s_uminus); \
+  INSTALL_UNOP (op_transpose, octave_ ## TYPE ## _scalar, s_transpose); \
+  INSTALL_UNOP (op_hermitian, octave_ ## TYPE ## _scalar, s_hermitian); \
+ \
+  INSTALL_NCUNOP (op_incr, octave_ ## TYPE ## _scalar, s_incr); \
+  INSTALL_NCUNOP (op_decr, octave_ ## TYPE ## _scalar, s_decr);
+
+#define OCTAVE_INSTALL_SS_INT_ARITH_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _add); \
+  INSTALL_BINOP (op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _sub); \
+  INSTALL_BINOP (op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _mul); \
+  INSTALL_BINOP (op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _div); \
+  INSTALL_BINOP (op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _pow); \
+  INSTALL_BINOP (op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ldiv); \
+  INSTALL_BINOP (op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_mul); \
+  INSTALL_BINOP (op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_div); \
+  INSTALL_BINOP (op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_pow); \
+  INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_ldiv);
+
+#define OCTAVE_INSTALL_SS_INT_CMP_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _lt); \
+  INSTALL_BINOP (op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _le); \
+  INSTALL_BINOP (op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _eq); \
+  INSTALL_BINOP (op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ge); \
+  INSTALL_BINOP (op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _gt); \
+  INSTALL_BINOP (op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _ne);
+
+#define OCTAVE_INSTALL_SS_INT_BOOL_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_and); \
+  INSTALL_BINOP (op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## scalar, PFX ## _el_or);
+
+#define OCTAVE_INSTALL_SS_INT_OPS(TYPE) \
+  OCTAVE_INSTALL_S_INT_UNOPS (TYPE) \
+  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ss, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ssx, TYPE ## _, )         \
+  OCTAVE_INSTALL_SS_INT_ARITH_OPS (sxs,  , TYPE ## _)        \
+  OCTAVE_INSTALL_SS_INT_ARITH_OPS (ssfx, TYPE ## _, float_)          \
+  OCTAVE_INSTALL_SS_INT_ARITH_OPS (sfxs,  float_, TYPE ## _)         \
+  OCTAVE_INSTALL_SS_INT_CMP_OPS (ss, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_SS_INT_CMP_OPS (sx, TYPE ## _, ) \
+  OCTAVE_INSTALL_SS_INT_CMP_OPS (xs, , TYPE ## _) \
+  OCTAVE_INSTALL_SS_INT_CMP_OPS (sfx, TYPE ## _, float_) \
+  OCTAVE_INSTALL_SS_INT_CMP_OPS (fxs, float_, TYPE ## _) \
+  OCTAVE_INSTALL_SS_INT_BOOL_OPS (ss, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_SS_INT_BOOL_OPS (sx, TYPE ## _, ) \
+  OCTAVE_INSTALL_SS_INT_BOOL_OPS (xs, , TYPE ## _) \
+  OCTAVE_INSTALL_SS_INT_BOOL_OPS (sfx, TYPE ## _, float_) \
+  OCTAVE_INSTALL_SS_INT_BOOL_OPS (fxs, float_, TYPE ## _) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_scalar, octave_ ## TYPE ## _matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_scalar, octave_ ## TYPE ## _matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_complex_scalar, octave_complex_matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_complex_scalar, octave_float_complex_matrix)
+
+#define OCTAVE_INSTALL_SM_INT_ARITH_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_add, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _add); \
+  INSTALL_BINOP (op_sub, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _sub); \
+  INSTALL_BINOP (op_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _mul); \
+  /* INSTALL_BINOP (op_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _div); */ \
+  /* INSTALL_BINOP (op_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _pow); */ \
+  INSTALL_BINOP (op_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ldiv); \
+  INSTALL_BINOP (op_el_mul, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_mul); \
+  INSTALL_BINOP (op_el_div, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_div); \
+  INSTALL_BINOP (op_el_pow, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_pow); \
+  INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_ldiv);
+
+#define OCTAVE_INSTALL_SM_INT_CMP_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_lt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _lt); \
+  INSTALL_BINOP (op_le, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _le); \
+  INSTALL_BINOP (op_eq, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _eq); \
+  INSTALL_BINOP (op_ge, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ge); \
+  INSTALL_BINOP (op_gt, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _gt); \
+  INSTALL_BINOP (op_ne, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _ne);
+
+#define OCTAVE_INSTALL_SM_INT_BOOL_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_el_and, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and); \
+  INSTALL_BINOP (op_el_or, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_or); \
+  INSTALL_BINOP (op_el_and_not, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_and_not); \
+  INSTALL_BINOP (op_el_or_not, octave_ ## T1 ## scalar, octave_ ## T2 ## matrix, PFX ## _el_or_not);
+
+#define OCTAVE_INSTALL_SM_INT_OPS(TYPE) \
+  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sm, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_SM_INT_ARITH_OPS (smx, TYPE ## _, )         \
+  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sxm, , TYPE ## _)         \
+  OCTAVE_INSTALL_SM_INT_ARITH_OPS (smfx, TYPE ## _, float_)          \
+  OCTAVE_INSTALL_SM_INT_ARITH_OPS (sfxm, float_, TYPE ## _)          \
+  OCTAVE_INSTALL_SM_INT_CMP_OPS (sm, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_SM_INT_CMP_OPS (xm, , TYPE ## _) \
+  OCTAVE_INSTALL_SM_INT_CMP_OPS (smx, TYPE ## _, ) \
+  OCTAVE_INSTALL_SM_INT_CMP_OPS (fxm, float_, TYPE ## _) \
+  OCTAVE_INSTALL_SM_INT_CMP_OPS (smfx, TYPE ## _, float_) \
+  OCTAVE_INSTALL_SM_INT_BOOL_OPS (sm, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_SM_INT_BOOL_OPS (xm, , TYPE ## _) \
+  OCTAVE_INSTALL_SM_INT_BOOL_OPS (smx, TYPE ## _, ) \
+  OCTAVE_INSTALL_SM_INT_BOOL_OPS (fxm, float_, TYPE ## _) \
+  OCTAVE_INSTALL_SM_INT_BOOL_OPS (smfx, TYPE ## _, float_) \
+  INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, TYPE ## _s_ ## TYPE ## _m_conv) \
+  INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_complex_matrix, TYPE ## _s_complex_m_conv) \
+  INSTALL_WIDENOP (octave_ ## TYPE ## _scalar, octave_float_complex_matrix, TYPE ## _s_float_complex_m_conv) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_ ## TYPE ## _matrix, octave_ ## TYPE ## _matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_matrix, octave_ ## TYPE ## _matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_matrix, octave_ ## TYPE ## _matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_complex_matrix, octave_complex_matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _scalar, octave_float_complex_matrix, octave_float_complex_matrix)
+
+#define OCTAVE_INSTALL_MS_INT_ARITH_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _add); \
+  INSTALL_BINOP (op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _sub); \
+  INSTALL_BINOP (op_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _mul); \
+  INSTALL_BINOP (op_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _div); \
+  /* INSTALL_BINOP (op_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _pow); */ \
+  /* INSTALL_BINOP (op_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ldiv); */ \
+ \
+  INSTALL_BINOP (op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_mul); \
+  INSTALL_BINOP (op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_div); \
+  INSTALL_BINOP (op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_pow); \
+  INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_ldiv);
+
+#define OCTAVE_INSTALL_MS_INT_CMP_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _lt); \
+  INSTALL_BINOP (op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _le); \
+  INSTALL_BINOP (op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _eq); \
+  INSTALL_BINOP (op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ge); \
+  INSTALL_BINOP (op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _gt); \
+  INSTALL_BINOP (op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _ne);
+
+#define OCTAVE_INSTALL_MS_INT_BOOL_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_and); \
+  INSTALL_BINOP (op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_or); \
+  INSTALL_BINOP (op_el_not_and, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_not_and); \
+  INSTALL_BINOP (op_el_not_or, octave_ ## T1 ## matrix, octave_ ## T2 ## scalar, PFX ## _el_not_or);
+
+#define OCTAVE_INSTALL_MS_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign)
+
+#define OCTAVE_INSTALL_MS_INT_ASSIGNEQ_OPS(PFX, TLHS, TRHS) \
+  INSTALL_ASSIGNOP (op_add_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_add) \
+  INSTALL_ASSIGNOP (op_sub_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_sub) \
+  INSTALL_ASSIGNOP (op_mul_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_mul) \
+  INSTALL_ASSIGNOP (op_div_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## scalar, PFX ## _assign_div)
+
+#define OCTAVE_INSTALL_MS_INT_OPS(TYPE) \
+  OCTAVE_INSTALL_MS_INT_ARITH_OPS (ms, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_ARITH_OPS (msx, TYPE ## _, ) \
+  OCTAVE_INSTALL_MS_INT_ARITH_OPS (mxs, , TYPE ## _)       \
+  OCTAVE_INSTALL_MS_INT_ARITH_OPS (msfx, TYPE ## _, float_) \
+  OCTAVE_INSTALL_MS_INT_ARITH_OPS (mfxs, float_, TYPE ## _)        \
+  OCTAVE_INSTALL_MS_INT_CMP_OPS (ms, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_CMP_OPS (mx, TYPE ## _, ) \
+  OCTAVE_INSTALL_MS_INT_CMP_OPS (mxs, , TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_CMP_OPS (mfx, TYPE ## _, float_) \
+  OCTAVE_INSTALL_MS_INT_CMP_OPS (mfxs, float_, TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_BOOL_OPS (ms, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mx, TYPE ## _, ) \
+  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mxs, , TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mfx, TYPE ## _, float_) \
+  OCTAVE_INSTALL_MS_INT_BOOL_OPS (mfxs, float_, TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (ms, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_ASSIGNEQ_OPS (mse, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mx, TYPE ## _, ) \
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mfx, TYPE ## _, float_) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_complex_scalar, octave_complex_matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_float_complex_scalar, octave_float_complex_matrix)
+
+#define OCTAVE_INSTALL_M_INT_UNOPS(TYPE) \
+  INSTALL_UNOP (op_not, octave_ ## TYPE ## _matrix, m_not); \
+  INSTALL_UNOP (op_uplus, octave_ ## TYPE ## _matrix, m_uplus); \
+  INSTALL_UNOP (op_uminus, octave_ ## TYPE ## _matrix, m_uminus); \
+  INSTALL_UNOP (op_transpose, octave_ ## TYPE ## _matrix, m_transpose); \
+  INSTALL_UNOP (op_hermitian, octave_ ## TYPE ## _matrix, m_transpose); \
+ \
+  INSTALL_NCUNOP (op_incr, octave_ ## TYPE ## _matrix, m_incr); \
+  INSTALL_NCUNOP (op_decr, octave_ ## TYPE ## _matrix, m_decr); \
+  INSTALL_NCUNOP (op_uminus, octave_ ## TYPE ## _matrix, m_changesign);
+
+#define OCTAVE_INSTALL_MM_INT_ARITH_OPS(PFX, T1, T2)                    \
+  INSTALL_BINOP (op_add, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _add); \
+  INSTALL_BINOP (op_sub, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _sub); \
+  /* INSTALL_BINOP (op_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _mul); */ \
+  /* INSTALL_BINOP (op_div, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _div); */ \
+  INSTALL_BINOP (op_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _pow); \
+  /* INSTALL_BINOP (op_ldiv, octave_ ## T1 ## _matrix, octave_ ## T2 ## _matrix, mm_ldiv); */ \
+  INSTALL_BINOP (op_el_mul, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_mul); \
+  INSTALL_BINOP (op_el_div, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_div); \
+  INSTALL_BINOP (op_el_pow, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_pow); \
+  INSTALL_BINOP (op_el_ldiv, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_ldiv);
+
+#define OCTAVE_INSTALL_MM_INT_CMP_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_lt, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _lt); \
+  INSTALL_BINOP (op_le, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _le); \
+  INSTALL_BINOP (op_eq, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _eq); \
+  INSTALL_BINOP (op_ge, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _ge); \
+  INSTALL_BINOP (op_gt, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _gt); \
+  INSTALL_BINOP (op_ne, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _ne);
+
+#define OCTAVE_INSTALL_MM_INT_BOOL_OPS(PFX, T1, T2) \
+  INSTALL_BINOP (op_el_and, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_and); \
+  INSTALL_BINOP (op_el_or, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_or); \
+  INSTALL_BINOP (op_el_not_and, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_not_and); \
+  INSTALL_BINOP (op_el_not_or, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_not_or); \
+  INSTALL_BINOP (op_el_and_not, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_and_not); \
+  INSTALL_BINOP (op_el_or_not, octave_ ## T1 ## matrix, octave_ ## T2 ## matrix, PFX ## _el_or_not);
+
+#define OCTAVE_INSTALL_MM_INT_ASSIGN_OPS(PFX, TLHS, TRHS) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign)
+
+#define OCTAVE_INSTALL_MM_INT_ASSIGNEQ_OPS(PFX, TLHS, TRHS) \
+  INSTALL_ASSIGNOP (op_add_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_add) \
+  INSTALL_ASSIGNOP (op_sub_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_sub) \
+  INSTALL_ASSIGNOP (op_el_mul_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_el_mul) \
+  INSTALL_ASSIGNOP (op_el_div_eq, octave_ ## TLHS ## matrix, octave_ ## TRHS ## matrix, PFX ## _assign_el_div)
+
+#define OCTAVE_INSTALL_MM_INT_OPS(TYPE) \
+  OCTAVE_INSTALL_M_INT_UNOPS (TYPE) \
+  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mm, TYPE ##_, TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mmx, TYPE ##_, ) \
+  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mxm, , TYPE ##_)        \
+  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mmfx, TYPE ##_, float_) \
+  OCTAVE_INSTALL_MM_INT_ARITH_OPS (mfxm, float_, TYPE ##_)         \
+  OCTAVE_INSTALL_MM_INT_CMP_OPS (mm, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_CMP_OPS (mmx, TYPE ## _, ) \
+  OCTAVE_INSTALL_MM_INT_CMP_OPS (mxm, , TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_CMP_OPS (mmfx, TYPE ## _, float_) \
+  OCTAVE_INSTALL_MM_INT_CMP_OPS (mfxm, float_, TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mm, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mmx, TYPE ## _, ) \
+  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mxm, , TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mmfx, TYPE ## _, float_) \
+  OCTAVE_INSTALL_MM_INT_BOOL_OPS (mfxm, float_, TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mm, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_ASSIGNEQ_OPS (mme, TYPE ## _, TYPE ## _) \
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmx, TYPE ## _, ) \
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmfx, TYPE ## _, float_) \
+  INSTALL_WIDENOP (octave_ ## TYPE ## _matrix, octave_complex_matrix, TYPE ## _m_complex_m_conv) \
+  INSTALL_WIDENOP (octave_ ## TYPE ## _matrix, octave_float_complex_matrix, TYPE ## _m_float_complex_m_conv) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_complex_matrix, octave_complex_matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TYPE ## _matrix, octave_float_complex_matrix, octave_float_complex_matrix)
+
+#define OCTAVE_INSTALL_RE_INT_ASSIGN_OPS(TYPE) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_ ## TYPE ## _scalar, TYPE ## ms_assign) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_ ## TYPE ## _matrix, TYPE ## mm_assign) \
+  INSTALL_ASSIGNCONV (octave_scalar, octave_ ## TYPE ## _scalar, octave_matrix) \
+  INSTALL_ASSIGNCONV (octave_matrix, octave_ ## TYPE ## _matrix, octave_matrix)
+
+#define OCTAVE_INSTALL_FLT_RE_INT_ASSIGN_OPS(TYPE) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_ ## TYPE ## _scalar, TYPE ## fms_assign) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_ ## TYPE ## _matrix, TYPE ## fmm_assign) \
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_ ## TYPE ## _scalar, octave_float_matrix) \
+  INSTALL_ASSIGNCONV (octave_float_matrix, octave_ ## TYPE ## _matrix, octave_float_matrix)
+
+#define OCTAVE_INSTALL_CX_INT_ASSIGN_OPS(TYPE) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_ ## TYPE ## _scalar, TYPE ## cms_assign) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_ ## TYPE ## _matrix, TYPE ## cmm_assign) \
+  INSTALL_ASSIGNCONV (octave_complex_scalar, octave_ ## TYPE ## _scalar, octave_complex_matrix) \
+  INSTALL_ASSIGNCONV (octave_complex_matrix, octave_ ## TYPE ## _matrix, octave_complex_matrix)
+
+#define OCTAVE_INSTALL_FLT_CX_INT_ASSIGN_OPS(TYPE) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_ ## TYPE ## _scalar, TYPE ## fcms_assign) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_ ## TYPE ## _matrix, TYPE ## fcmm_assign) \
+  INSTALL_ASSIGNCONV (octave_float_complex_scalar, octave_ ## TYPE ## _scalar, octave_complex_matrix) \
+  INSTALL_ASSIGNCONV (octave_float_complex_matrix, octave_ ## TYPE ## _matrix, octave_complex_matrix)
+
+#define OCTAVE_INSTALL_INT_NULL_ASSIGN_OPS(TYPE) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_matrix, TYPE ## null_assign) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_str, TYPE ## null_assign) \
+  INSTALL_ASSIGNOP (op_asn_eq, octave_ ## TYPE ## _matrix, octave_null_sq_str, TYPE ## null_assign)
+
+#define OCTAVE_INSTALL_INT_OPS(TYPE) \
+  OCTAVE_INSTALL_SS_INT_OPS (TYPE) \
+  OCTAVE_INSTALL_SM_INT_OPS (TYPE) \
+  OCTAVE_INSTALL_MS_INT_OPS (TYPE) \
+  OCTAVE_INSTALL_MM_INT_OPS (TYPE) \
+  OCTAVE_INSTALL_CONCAT_FN (TYPE) \
+  OCTAVE_INSTALL_RE_INT_ASSIGN_OPS (TYPE) \
+  OCTAVE_INSTALL_FLT_RE_INT_ASSIGN_OPS (TYPE) \
+  OCTAVE_INSTALL_CX_INT_ASSIGN_OPS (TYPE) \
+  OCTAVE_INSTALL_FLT_CX_INT_ASSIGN_OPS (TYPE) \
+  OCTAVE_INSTALL_INT_NULL_ASSIGN_OPS(TYPE)
+
+#define OCTAVE_INSTALL_SM_INT_ASSIGNCONV(TLHS, TRHS) \
+  INSTALL_ASSIGNCONV (octave_ ## TLHS ## _scalar, octave_ ## TRHS ## _scalar, octave_ ## TLHS ## _matrix) \
+  INSTALL_ASSIGNCONV (octave_ ## TLHS ## _scalar, octave_ ## TRHS ## _matrix, octave_ ## TLHS ## _matrix)
+
+#define OCTAVE_MIXED_INT_CMP_OPS(T1, T2) \
+  OCTAVE_SS_INT_CMP_OPS (T1 ## _ ## T2 ## _ss, T1 ## _, T2 ## _) \
+  OCTAVE_SM_INT_CMP_OPS (T1 ## _ ## T2 ## _sm, T1 ## _, T2 ## _) \
+  OCTAVE_MS_INT_CMP_OPS (T1 ## _ ## T2 ## _ms, T1 ## _, T2 ## _) \
+  OCTAVE_MM_INT_CMP_OPS (T1 ## _ ## T2 ## _mm, T1 ## _, T2 ## _)
+
+#define OCTAVE_INSTALL_MIXED_INT_CMP_OPS(T1, T2) \
+  OCTAVE_INSTALL_SS_INT_CMP_OPS (T1 ## _ ## T2 ## _ss, T1 ## _, T2 ## _) \
+  OCTAVE_INSTALL_SM_INT_CMP_OPS (T1 ## _ ## T2 ## _sm, T1 ## _, T2 ## _) \
+  OCTAVE_INSTALL_MS_INT_CMP_OPS (T1 ## _ ## T2 ## _ms, T1 ## _, T2 ## _) \
+  OCTAVE_INSTALL_MM_INT_CMP_OPS (T1 ## _ ## T2 ## _mm, T1 ## _, T2 ## _)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-cdm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,36 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-re-mat.h"
+#define RINCLUDE "ov-cx-diag.h"
+
+#define LMATRIX matrix
+#define RMATRIX complex_diag_matrix
+#define LDMATRIX complex_matrix
+
+#define LSHORT m
+#define RSHORT cdm
+
+#define DEFINEDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,166 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-m-cm.h"
+#include "mx-cm-m.h"
+#include "mx-nda-cnda.h"
+#include "mx-cnda-nda.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix by complex matrix ops.
+
+DEFNDBINOP_OP (add, matrix, complex_matrix, array, complex_array, +)
+DEFNDBINOP_OP (sub, matrix, complex_matrix, array, complex_array, -)
+
+DEFBINOP_OP (mul, matrix, complex_matrix, *)
+
+DEFBINOP (trans_mul, matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
+
+  Matrix m1 = v1.matrix_value ();
+  ComplexMatrix m2 = v2.complex_matrix_value ();
+
+  return ComplexMatrix (xgemm (m1, real (m2), blas_trans, blas_no_trans),
+                        xgemm (m1, imag (m2), blas_trans, blas_no_trans));
+}
+
+DEFBINOP (div, matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (v1.matrix_value (),
+                            v2.complex_matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, matrix, complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.matrix_value (),
+                                v2.complex_matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP (trans_ldiv, matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.matrix_value (),
+                         v2.complex_matrix_value (), typ, blas_trans);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, matrix, complex_matrix, array, complex_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, matrix, complex_matrix, array, complex_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, matrix, complex_matrix, array, complex_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, matrix, complex_matrix, array, complex_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, matrix, complex_matrix, array, complex_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, matrix, complex_matrix, array, complex_array, mx_el_ne)
+
+DEFNDBINOP_FN (el_mul, matrix, complex_matrix, array, complex_array, product)
+DEFNDBINOP_FN (el_div, matrix, complex_matrix, array, complex_array, quotient)
+DEFNDBINOP_FN (el_pow, matrix, complex_matrix, array, complex_array, elem_xpow)
+
+DEFBINOP (el_ldiv, matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&);
+
+  return quotient (v2.complex_array_value (), v1.array_value ());
+}
+
+DEFNDBINOP_FN (el_and, matrix, complex_matrix, array, complex_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  matrix, complex_matrix, array, complex_array, mx_el_or)
+
+DEFNDCATOP_FN (m_cm, matrix, complex_matrix, array, complex_array, concat)
+
+DEFCONV (complex_matrix_conv, matrix, complex_matrix)
+{
+  CAST_CONV_ARG (const octave_matrix&);
+
+  return new octave_complex_matrix (ComplexNDArray (v.array_value ()));
+}
+
+void
+install_m_cm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_matrix, octave_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_matrix, octave_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_matrix, octave_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_matrix, octave_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_matrix, octave_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_matrix, octave_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_matrix, octave_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_matrix, octave_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_matrix, octave_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_matrix, octave_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_matrix, octave_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_matrix, octave_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_matrix, octave_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_matrix, octave_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_matrix, octave_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_matrix, octave_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_matrix, octave_complex_matrix, el_or);
+  INSTALL_BINOP (op_trans_mul, octave_matrix, octave_complex_matrix, trans_mul);
+  INSTALL_BINOP (op_herm_mul, octave_matrix, octave_complex_matrix, trans_mul);
+  INSTALL_BINOP (op_trans_ldiv, octave_matrix, octave_complex_matrix, trans_ldiv);
+  INSTALL_BINOP (op_herm_ldiv, octave_matrix, octave_complex_matrix, trans_ldiv);
+
+  INSTALL_CATOP (octave_matrix, octave_complex_matrix, m_cm);
+
+  INSTALL_ASSIGNCONV (octave_matrix, octave_complex_matrix, octave_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_float_matrix, octave_complex_matrix, octave_float_complex_matrix);
+
+  INSTALL_WIDENOP (octave_matrix, octave_complex_matrix, complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-cs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,140 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-m-cs.h"
+#include "mx-cs-m.h"
+#include "mx-nda-cs.h"
+#include "mx-cs-nda.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-complex.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix by complex scalar ops.
+
+DEFNDBINOP_OP (add, matrix, complex, array, complex, +)
+DEFNDBINOP_OP (sub, matrix, complex, array, complex, -)
+DEFNDBINOP_OP (mul, matrix, complex, array, complex, *)
+
+DEFBINOP (div, matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.array_value () / d);
+}
+
+DEFBINOP_FN (pow, matrix, complex, xpow)
+
+DEFBINOP (ldiv, matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
+
+  Matrix m1 = v1.matrix_value ();
+  ComplexMatrix m2 = v2.complex_matrix_value ();
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (m1, m2, typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDCMPLXCMPOP_FN (lt, matrix, complex, array, complex, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, matrix, complex, array, complex, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, matrix, complex, array, complex, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, matrix, complex, array, complex, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, matrix, complex, array, complex, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, matrix, complex, array, complex, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, matrix, complex, array, complex, *)
+
+DEFBINOP (el_div, matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.array_value () / d);
+}
+
+DEFNDBINOP_FN (el_pow, matrix, complex, array, complex, elem_xpow)
+
+DEFBINOP (el_ldiv, matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_complex&);
+
+  return x_el_div (v2.complex_value (), v1.array_value ());
+}
+
+DEFNDBINOP_FN (el_and, matrix, complex, array, complex, mx_el_and)
+DEFNDBINOP_FN (el_or, matrix, complex, array, complex, mx_el_or)
+
+DEFNDCATOP_FN (m_cs, matrix, complex, array, complex_array, concat)
+
+void
+install_m_cs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_matrix, octave_complex, add);
+  INSTALL_BINOP (op_sub, octave_matrix, octave_complex, sub);
+  INSTALL_BINOP (op_mul, octave_matrix, octave_complex, mul);
+  INSTALL_BINOP (op_div, octave_matrix, octave_complex, div);
+  INSTALL_BINOP (op_pow, octave_matrix, octave_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_matrix, octave_complex, ldiv);
+  INSTALL_BINOP (op_lt, octave_matrix, octave_complex, lt);
+  INSTALL_BINOP (op_le, octave_matrix, octave_complex, le);
+  INSTALL_BINOP (op_eq, octave_matrix, octave_complex, eq);
+  INSTALL_BINOP (op_ge, octave_matrix, octave_complex, ge);
+  INSTALL_BINOP (op_gt, octave_matrix, octave_complex, gt);
+  INSTALL_BINOP (op_ne, octave_matrix, octave_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_matrix, octave_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_matrix, octave_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_matrix, octave_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_matrix, octave_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_matrix, octave_complex, el_or);
+
+  INSTALL_CATOP (octave_matrix, octave_complex, m_cs);
+
+  INSTALL_ASSIGNCONV (octave_matrix, octave_complex, octave_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_float_matrix, octave_complex, octave_float_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-dm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 LINCLUDE "ov-re-mat.h"
+#define RINCLUDE "ov-re-diag.h"
+
+#define LMATRIX matrix
+#define RMATRIX diag_matrix
+
+#define LSHORT m
+#define RSHORT dm
+
+#define DEFINEDIV
+
+#include "op-dm-template.cc"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,223 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix unary ops.
+
+DEFNDUNOP_OP (not, matrix, array, !)
+DEFNDUNOP_OP (uplus, matrix, array, /* no-op */)
+DEFNDUNOP_OP (uminus, matrix, array, -)
+
+DEFUNOP (transpose, matrix)
+{
+  CAST_UNOP_ARG (const octave_matrix&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.matrix_value ().transpose ());
+}
+
+DEFNCUNOP_METHOD (incr, matrix, increment)
+DEFNCUNOP_METHOD (decr, matrix, decrement)
+DEFNCUNOP_METHOD (changesign, matrix, changesign)
+
+// matrix by matrix ops.
+
+DEFNDBINOP_OP (add, matrix, matrix, array, array, +)
+DEFNDBINOP_OP (sub, matrix, matrix, array, array, -)
+
+DEFBINOP_OP (mul, matrix, matrix, *)
+
+DEFBINOP (div, matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  Matrix ret = xdiv (v1.matrix_value (), v2.matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, matrix, matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP (trans_mul, matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
+  return octave_value(xgemm (v1.matrix_value (), v2.matrix_value (),
+                             blas_trans, blas_no_trans));
+}
+
+DEFBINOP (mul_trans, matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
+  return octave_value(xgemm (v1.matrix_value (), v2.matrix_value (),
+                             blas_no_trans, blas_trans));
+}
+
+DEFBINOP (trans_ldiv, matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ, blas_trans);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDBINOP_FN (lt, matrix, matrix, array, array, mx_el_lt)
+DEFNDBINOP_FN (le, matrix, matrix, array, array, mx_el_le)
+DEFNDBINOP_FN (eq, matrix, matrix, array, array, mx_el_eq)
+DEFNDBINOP_FN (ge, matrix, matrix, array, array, mx_el_ge)
+DEFNDBINOP_FN (gt, matrix, matrix, array, array, mx_el_gt)
+DEFNDBINOP_FN (ne, matrix, matrix, array, array, mx_el_ne)
+
+DEFNDBINOP_FN (el_mul, matrix, matrix, array, array, product)
+DEFNDBINOP_FN (el_div, matrix, matrix, array, array, quotient)
+DEFNDBINOP_FN (el_pow, matrix, matrix, array, array, elem_xpow)
+
+DEFBINOP (el_ldiv, matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&);
+
+  return octave_value (quotient (v2.array_value (), v1.array_value ()));
+}
+
+DEFNDBINOP_FN (el_and, matrix, matrix, array, array, mx_el_and)
+DEFNDBINOP_FN (el_or,  matrix, matrix, array, array, mx_el_or)
+DEFNDBINOP_FN (el_not_and, matrix, matrix, array, array, mx_el_not_and)
+DEFNDBINOP_FN (el_not_or,  matrix, matrix, array, array, mx_el_not_or)
+DEFNDBINOP_FN (el_and_not, matrix, matrix, array, array, mx_el_and_not)
+DEFNDBINOP_FN (el_or_not,  matrix, matrix, array, array, mx_el_or_not)
+
+
+DEFNDCATOP_FN (m_m, matrix, matrix, array, array, concat)
+
+DEFNDASSIGNOP_FN (assign, matrix, matrix, array, assign)
+DEFNDASSIGNOP_FN (sgl_assign, float_matrix, matrix, float_array, assign)
+
+DEFNULLASSIGNOP_FN (null_assign, matrix, delete_elements)
+
+DEFNDASSIGNOP_OP (assign_add, matrix, matrix, array, +=)
+DEFNDASSIGNOP_OP (assign_sub, matrix, matrix, array, -=)
+DEFNDASSIGNOP_FNOP (assign_el_mul, matrix, matrix, array, product_eq)
+DEFNDASSIGNOP_FNOP (assign_el_div, matrix, matrix, array, quotient_eq)
+
+CONVDECL (matrix_to_float_matrix)
+{
+  CAST_CONV_ARG (const octave_matrix&);
+
+  return new octave_float_matrix (FloatNDArray (v.array_value ()));
+}
+
+void
+install_m_m_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_matrix, transpose);
+
+  INSTALL_NCUNOP (op_incr, octave_matrix, incr);
+  INSTALL_NCUNOP (op_decr, octave_matrix, decr);
+  INSTALL_NCUNOP (op_uminus, octave_matrix, changesign);
+
+  INSTALL_BINOP (op_add, octave_matrix, octave_matrix, add);
+  INSTALL_BINOP (op_sub, octave_matrix, octave_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_matrix, octave_matrix, mul);
+  INSTALL_BINOP (op_div, octave_matrix, octave_matrix, div);
+  INSTALL_BINOP (op_pow, octave_matrix, octave_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_matrix, octave_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_matrix, octave_matrix, lt);
+  INSTALL_BINOP (op_le, octave_matrix, octave_matrix, le);
+  INSTALL_BINOP (op_eq, octave_matrix, octave_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_matrix, octave_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_matrix, octave_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_matrix, octave_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_matrix, octave_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_matrix, octave_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_matrix, octave_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_matrix, octave_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_matrix, octave_matrix, el_or);
+  INSTALL_BINOP (op_el_and_not, octave_matrix, octave_matrix, el_and_not);
+  INSTALL_BINOP (op_el_or_not, octave_matrix, octave_matrix, el_or_not);
+  INSTALL_BINOP (op_el_not_and, octave_matrix, octave_matrix, el_not_and);
+  INSTALL_BINOP (op_el_not_or, octave_matrix, octave_matrix, el_not_or);
+  INSTALL_BINOP (op_trans_mul, octave_matrix, octave_matrix, trans_mul);
+  INSTALL_BINOP (op_mul_trans, octave_matrix, octave_matrix, mul_trans);
+  INSTALL_BINOP (op_herm_mul, octave_matrix, octave_matrix, trans_mul);
+  INSTALL_BINOP (op_mul_herm, octave_matrix, octave_matrix, mul_trans);
+  INSTALL_BINOP (op_trans_ldiv, octave_matrix, octave_matrix, trans_ldiv);
+  INSTALL_BINOP (op_herm_ldiv, octave_matrix, octave_matrix, trans_ldiv);
+
+  INSTALL_CATOP (octave_matrix, octave_matrix, m_m);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_matrix, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_matrix, sgl_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_null_sq_str, null_assign);
+
+  INSTALL_ASSIGNOP (op_add_eq, octave_matrix, octave_matrix, assign_add);
+  INSTALL_ASSIGNOP (op_sub_eq, octave_matrix, octave_matrix, assign_sub);
+  INSTALL_ASSIGNOP (op_el_mul_eq, octave_matrix, octave_matrix, assign_el_mul);
+  INSTALL_ASSIGNOP (op_el_div_eq, octave_matrix, octave_matrix, assign_el_div);
+
+  INSTALL_CONVOP (octave_matrix, octave_float_matrix, matrix_to_float_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-pm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 MINCLUDE "ov-re-mat.h"
+
+#define LMATRIX matrix
+#define RMATRIX perm_matrix
+
+#define LSHORT m
+#define RSHORT pm
+
+#define RIGHT
+
+#include "op-pm-template.cc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,155 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// matrix by scalar ops.
+
+DEFNDBINOP_OP (add, matrix, scalar, array, scalar, +)
+DEFNDBINOP_OP (sub, matrix, scalar, array, scalar, -)
+DEFNDBINOP_OP (mul, matrix, scalar, array, scalar, *)
+
+DEFBINOP (div, matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
+
+  double d = v2.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.array_value () / d);
+}
+
+DEFBINOP_FN (pow, matrix, scalar, xpow)
+
+DEFBINOP (ldiv, matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
+
+  Matrix m1 = v1.matrix_value ();
+  Matrix m2 = v2.matrix_value ();
+  MatrixType typ = v1.matrix_type ();
+
+  Matrix ret = xleftdiv (m1, m2, typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFNDBINOP_FN (lt, matrix, scalar, array, scalar, mx_el_lt)
+DEFNDBINOP_FN (le, matrix, scalar, array, scalar, mx_el_le)
+DEFNDBINOP_FN (eq, matrix, scalar, array, scalar, mx_el_eq)
+DEFNDBINOP_FN (ge, matrix, scalar, array, scalar, mx_el_ge)
+DEFNDBINOP_FN (gt, matrix, scalar, array, scalar, mx_el_gt)
+DEFNDBINOP_FN (ne, matrix, scalar, array, scalar, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, matrix, scalar, array, scalar, *)
+
+DEFBINOP (el_div, matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
+
+  double d = v2.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.array_value () / d);
+}
+
+DEFNDBINOP_FN (el_pow, matrix, scalar, array, scalar, elem_xpow)
+
+DEFBINOP (el_ldiv, matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_scalar&);
+
+  return x_el_div (v2.double_value (), v1.array_value ());
+}
+
+DEFNDBINOP_FN (el_and, matrix, scalar, array, scalar, mx_el_and)
+DEFNDBINOP_FN (el_or, matrix, scalar, array, scalar, mx_el_or)
+
+DEFNDCATOP_FN (m_s, matrix, scalar, array, array, concat)
+
+DEFNDASSIGNOP_FN (assign, matrix, scalar, scalar, assign)
+DEFNDASSIGNOP_FN (sgl_assign, float_matrix, scalar, float_scalar, assign)
+DEFNDASSIGNOP_FN (clx_sgl_assign, float_complex_matrix, scalar, float_complex, assign)
+
+DEFNDASSIGNOP_OP (assign_add, matrix, scalar, scalar, +=)
+DEFNDASSIGNOP_OP (assign_sub, matrix, scalar, scalar, -=)
+DEFNDASSIGNOP_OP (assign_mul, matrix, scalar, scalar, *=)
+DEFNDASSIGNOP_OP (assign_div, matrix, scalar, scalar, /=)
+
+void
+install_m_s_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_matrix, octave_scalar, add);
+  INSTALL_BINOP (op_sub, octave_matrix, octave_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_matrix, octave_scalar, mul);
+  INSTALL_BINOP (op_div, octave_matrix, octave_scalar, div);
+  INSTALL_BINOP (op_pow, octave_matrix, octave_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_matrix, octave_scalar, ldiv);
+
+  //  INSTALL_BINOP (op_lt, octave_matrix, octave_scalar, lt);
+
+  octave_value_typeinfo::register_binary_op
+    (octave_value::op_lt, octave_matrix::static_type_id (),
+     octave_scalar::static_type_id (), oct_binop_lt);
+
+  INSTALL_BINOP (op_le, octave_matrix, octave_scalar, le);
+  INSTALL_BINOP (op_eq, octave_matrix, octave_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_matrix, octave_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_matrix, octave_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_matrix, octave_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_matrix, octave_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_matrix, octave_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_matrix, octave_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_matrix, octave_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_matrix, octave_scalar, el_or);
+
+  INSTALL_CATOP (octave_matrix, octave_scalar, m_s);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_scalar, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_scalar, sgl_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_scalar, clx_sgl_assign);
+
+  INSTALL_ASSIGNOP (op_add_eq, octave_matrix, octave_scalar, assign_add);
+  INSTALL_ASSIGNOP (op_sub_eq, octave_matrix, octave_scalar, assign_sub);
+  INSTALL_ASSIGNOP (op_mul_eq, octave_matrix, octave_scalar, assign_mul);
+  INSTALL_ASSIGNOP (op_div_eq, octave_matrix, octave_scalar, assign_div);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-scm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,175 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-scm-m.h"
+#include "smx-m-scm.h"
+#include "ov-cx-sparse.h"
+
+// matrix by sparse complex matrix ops.
+
+DEFBINOP_OP (add, matrix, sparse_complex_matrix, +)
+DEFBINOP_OP (sub, matrix, sparse_complex_matrix, -)
+
+DEFBINOP_OP (mul, matrix, sparse_complex_matrix, *)
+
+DEFBINOP (div, matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      Complex d = v2.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.array_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+
+      ComplexMatrix ret = xdiv (v1.matrix_value (),
+                                v2.sparse_complex_matrix_value (), typ);
+
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOPX (pow, matrix, sparse_complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&,
+                   const octave_sparse_complex_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  ComplexMatrix ret = xleftdiv (v1.matrix_value (),
+                                v2.complex_matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (lt, matrix, sparse_complex_matrix, mx_el_lt)
+DEFBINOP_FN (le, matrix, sparse_complex_matrix, mx_el_le)
+DEFBINOP_FN (eq, matrix, sparse_complex_matrix, mx_el_eq)
+DEFBINOP_FN (ge, matrix, sparse_complex_matrix, mx_el_ge)
+DEFBINOP_FN (gt, matrix, sparse_complex_matrix, mx_el_gt)
+DEFBINOP_FN (ne, matrix, sparse_complex_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, matrix, sparse_complex_matrix, product)
+DEFBINOP_FN (el_div, matrix, sparse_complex_matrix, quotient)
+
+DEFBINOP (el_pow, matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  return octave_value
+    (elem_xpow (SparseMatrix (v1.matrix_value ()),
+                v2.sparse_complex_matrix_value ()));
+}
+
+DEFBINOP (el_ldiv, matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&,
+                   const octave_sparse_complex_matrix&);
+  return octave_value
+    (quotient (v2.sparse_complex_matrix_value (), v1.matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, matrix, sparse_complex_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  matrix, sparse_complex_matrix, mx_el_or)
+
+DEFCATOP (m_scm, matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_complex_matrix&);
+  SparseMatrix tmp (v1.matrix_value ());
+  return octave_value (tmp. concat (v2.sparse_complex_matrix_value (),
+                                    ra_idx));
+}
+
+DEFCONV (sparse_complex_matrix_conv, matrix, sparse_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_matrix&);
+  return new octave_sparse_complex_matrix
+    (SparseComplexMatrix (v.complex_matrix_value ()));
+}
+
+void
+install_m_scm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_matrix, octave_sparse_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_matrix, octave_sparse_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_matrix, octave_sparse_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_matrix, octave_sparse_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_matrix, octave_sparse_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_matrix, octave_sparse_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_matrix, octave_sparse_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_matrix, octave_sparse_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_matrix, octave_sparse_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_matrix, octave_sparse_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_matrix, octave_sparse_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_matrix, octave_sparse_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_matrix, octave_sparse_complex_matrix,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_matrix, octave_sparse_complex_matrix,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_matrix, octave_sparse_complex_matrix,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_sparse_complex_matrix,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_matrix, octave_sparse_complex_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_matrix, octave_sparse_complex_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_matrix, octave_sparse_complex_matrix, m_scm);
+
+  INSTALL_ASSIGNCONV (octave_matrix, octave_sparse_complex_matrix,
+                      octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_matrix, octave_sparse_complex_matrix,
+                   sparse_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-m-sm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,167 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-re-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-sm-m.h"
+#include "smx-m-sm.h"
+#include "ov-re-sparse.h"
+
+// matrix by sparse matrix ops.
+
+DEFBINOP_OP (add, matrix, sparse_matrix, +)
+DEFBINOP_OP (sub, matrix, sparse_matrix, -)
+
+DEFBINOP_OP (mul, matrix, sparse_matrix, *)
+
+DEFBINOP (div, matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.array_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+
+      Matrix ret = xdiv (v1.matrix_value (), v2.sparse_matrix_value (), typ);
+
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOPX (pow, matrix, sparse_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
+  MatrixType typ = v1.matrix_type ();
+
+  Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ);
+
+  v1.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (mul_trans, matrix, sparse_matrix, mul_trans);
+
+DEFBINOP_FN (lt, matrix, sparse_matrix, mx_el_lt)
+DEFBINOP_FN (le, matrix, sparse_matrix, mx_el_le)
+DEFBINOP_FN (eq, matrix, sparse_matrix, mx_el_eq)
+DEFBINOP_FN (ge, matrix, sparse_matrix, mx_el_ge)
+DEFBINOP_FN (gt, matrix, sparse_matrix, mx_el_gt)
+DEFBINOP_FN (ne, matrix, sparse_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, matrix, sparse_matrix, product)
+DEFBINOP_FN (el_div, matrix, sparse_matrix, quotient)
+
+DEFBINOP (el_pow, matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
+
+  return octave_value (elem_xpow (SparseMatrix (v1.matrix_value ()),
+                                  v2.sparse_matrix_value ()));
+}
+
+DEFBINOP (el_ldiv, matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&);
+
+  return octave_value
+    (quotient (v2.sparse_matrix_value (), v1.matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, matrix, sparse_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  matrix, sparse_matrix, mx_el_or)
+
+DEFCATOP (m_sm, matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_matrix&);
+  SparseMatrix tmp (v1.matrix_value ());
+  return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
+}
+
+DEFCONV (sparse_matrix_conv, matrix, sparse_matrix)
+{
+  CAST_CONV_ARG (const octave_matrix&);
+  return new octave_sparse_matrix (SparseMatrix (v.matrix_value ()));
+}
+
+DEFNDASSIGNOP_FN (assign, matrix, sparse_matrix, array, assign)
+
+void
+install_m_sm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_matrix, octave_sparse_matrix, add);
+  INSTALL_BINOP (op_sub, octave_matrix, octave_sparse_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_matrix, octave_sparse_matrix, mul);
+  INSTALL_BINOP (op_div, octave_matrix, octave_sparse_matrix, div);
+  INSTALL_BINOP (op_pow, octave_matrix, octave_sparse_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_matrix, octave_sparse_matrix, ldiv);
+  INSTALL_BINOP (op_mul_trans, octave_matrix, octave_sparse_matrix, mul_trans);
+  INSTALL_BINOP (op_mul_herm, octave_matrix, octave_sparse_matrix, mul_trans);
+  INSTALL_BINOP (op_lt, octave_matrix, octave_sparse_matrix, lt);
+  INSTALL_BINOP (op_le, octave_matrix, octave_sparse_matrix, le);
+  INSTALL_BINOP (op_eq, octave_matrix, octave_sparse_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_matrix, octave_sparse_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_matrix, octave_sparse_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_matrix, octave_sparse_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_matrix, octave_sparse_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_matrix, octave_sparse_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_matrix, octave_sparse_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_sparse_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_matrix, octave_sparse_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_matrix, octave_sparse_matrix,  el_or);
+
+  INSTALL_CATOP (octave_matrix, octave_sparse_matrix, m_sm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_sparse_matrix, assign)
+  INSTALL_ASSIGNCONV (octave_matrix, octave_sparse_matrix, octave_matrix)
+
+  INSTALL_WIDENOP (octave_matrix, octave_sparse_matrix,
+                   sparse_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-pm-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 MINCLUDE "ov-cx-mat.h"
+
+#define LMATRIX perm_matrix
+#define RMATRIX complex_matrix
+
+#define LSHORT pm
+#define RSHORT cm
+
+#define LEFT
+
+#include "op-pm-template.cc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-pm-fcm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 MINCLUDE "ov-flt-cx-mat.h"
+
+#define LMATRIX perm_matrix
+#define RMATRIX float_complex_matrix
+
+#define LSHORT pm
+#define RSHORT fcm
+
+#define LEFT
+
+#include "op-pm-template.cc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-pm-fm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 MINCLUDE "ov-flt-re-mat.h"
+
+#define LMATRIX perm_matrix
+#define RMATRIX float_matrix
+
+#define LSHORT pm
+#define RSHORT fm
+
+#define LEFT
+
+#include "op-pm-template.cc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-pm-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,35 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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 MINCLUDE "ov-re-mat.h"
+
+#define LMATRIX perm_matrix
+#define LDMATRIX matrix
+#define RMATRIX matrix
+
+#define LSHORT pm
+#define RSHORT m
+
+#define LEFT
+#define DEFINENULLASSIGNCONV
+
+#include "op-pm-template.cc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-pm-pm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,87 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-perm.h"
+#include "ov-re-mat.h"
+#include "ov-scalar.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xpow.h"
+
+DEFUNOP (transpose, perm_matrix)
+{
+  CAST_UNOP_ARG (const octave_perm_matrix&);
+  return octave_value (v.perm_matrix_value ().transpose ());
+}
+
+DEFBINOP_OP (mul, perm_matrix, perm_matrix, *)
+
+DEFBINOP (div, perm_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
+
+  return (v1.perm_matrix_value () * v2.perm_matrix_value ().inverse ());
+}
+
+DEFBINOP (ldiv, perm_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
+
+  return (v1.perm_matrix_value ().inverse () * v2.perm_matrix_value ());
+}
+
+DEFBINOP (pow, perm_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_scalar&);
+
+  return xpow (v1.perm_matrix_value (), v2.scalar_value ());
+}
+
+CONVDECL (perm_matrix_to_matrix)
+{
+  CAST_CONV_ARG (const octave_perm_matrix&);
+
+  return new octave_matrix (v.matrix_value ());
+}
+
+void
+install_pm_pm_ops (void)
+{
+  INSTALL_UNOP (op_transpose, octave_perm_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_perm_matrix, transpose);
+
+  INSTALL_BINOP (op_mul, octave_perm_matrix, octave_perm_matrix, mul);
+  INSTALL_BINOP (op_div, octave_perm_matrix, octave_perm_matrix, div);
+  INSTALL_BINOP (op_ldiv, octave_perm_matrix, octave_perm_matrix, ldiv);
+  INSTALL_BINOP (op_pow, octave_perm_matrix, octave_scalar, pow);
+
+  INSTALL_CONVOP (octave_perm_matrix, octave_matrix, perm_matrix_to_matrix);
+  INSTALL_ASSIGNCONV (octave_perm_matrix, octave_matrix, octave_matrix);
+  INSTALL_WIDENOP (octave_perm_matrix, octave_matrix, perm_matrix_to_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-pm-scm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,97 @@
+/*
+
+Copyright (C) 2009-2012 Jason Riedy
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+#include "ov-perm.h"
+#include "ov-cx-sparse.h"
+
+// permutation matrix by sparse matrix ops
+
+DEFBINOP (mul_pm_scm, perm_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      std::complex<double> d = v2.complex_value ();
+
+      return octave_value (v1.sparse_matrix_value () * d);
+    }
+  else if (v1.rows () == 1 && v1.columns () == 1)
+    return octave_value (v2.sparse_complex_matrix_value ());
+  else
+    return v1.perm_matrix_value  () * v2.sparse_complex_matrix_value ();
+}
+
+DEFBINOP (ldiv_pm_scm, perm_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_complex_matrix&);
+
+  return v1.perm_matrix_value ().inverse () * v2.sparse_complex_matrix_value ();
+}
+
+// sparse matrix by diagonal matrix ops
+
+DEFBINOP (mul_scm_pm, sparse_complex_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_perm_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      std::complex<double> d = v1.scalar_value ();
+
+      return octave_value (d * v2.sparse_matrix_value ());
+    }
+  else if (v2.rows () == 1 && v2.columns () == 1)
+    return octave_value (v1.sparse_complex_matrix_value ());
+  else
+    return v1.sparse_complex_matrix_value  () * v2.perm_matrix_value ();
+}
+
+DEFBINOP (div_scm_pm, sparse_complex_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_perm_matrix&);
+
+  return v1.sparse_complex_matrix_value () * v2.perm_matrix_value ().inverse ();
+}
+
+void
+install_pm_scm_ops (void)
+{
+  INSTALL_BINOP (op_mul, octave_perm_matrix, octave_sparse_complex_matrix,
+                 mul_pm_scm);
+  INSTALL_BINOP (op_ldiv, octave_perm_matrix, octave_sparse_complex_matrix,
+                 ldiv_pm_scm);
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_perm_matrix,
+                 mul_scm_pm);
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_perm_matrix,
+                 div_scm_pm);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-pm-sm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,150 @@
+/*
+
+Copyright (C) 2009-2012 Jason Riedy
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+#include "ov-perm.h"
+#include "ov-re-sparse.h"
+#include "ov-bool-sparse.h"
+
+// Unary permutation ops, some cast to sparse
+
+//Avoid casting to a full matrix
+DEFUNOP_OP (uplus, perm_matrix, /* no-op */)
+
+// Not calling standard CAST_UNOP_ARG for these next two because a
+// dynamic_cast would fail.
+DEFUNOP (not, perm_matrix)
+{
+  // Obviously negation of a permutation matrix destroys sparsity
+  return octave_value ( ! a.bool_array_value ());
+}
+
+DEFUNOP (uminus, perm_matrix)
+{
+  return octave_value ( - a.sparse_matrix_value ());
+}
+
+// Most other logical operations cast to SparseBoolMatrix
+DEFBINOP (eq_pm, perm_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
+  return v1.sparse_bool_matrix_value () == v2.sparse_bool_matrix_value ();
+}
+DEFBINOP (ne_pm, perm_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
+  return v1.sparse_bool_matrix_value () != v2.sparse_bool_matrix_value ();
+}
+DEFBINOP (el_and_pm, perm_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
+  return mx_el_and(v1.sparse_bool_matrix_value (),
+                   v2.sparse_bool_matrix_value ());
+}
+DEFBINOP (el_or_pm,  perm_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&);
+  return mx_el_or(v1.sparse_bool_matrix_value (),
+                  v2.sparse_bool_matrix_value ());
+}
+
+// permutation matrix by sparse matrix ops
+
+DEFBINOP (mul_pm_sm, perm_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      return octave_value (v1.sparse_matrix_value () * d);
+    }
+  else if (v1.rows () == 1 && v1.columns () == 1)
+    return octave_value (v2.sparse_matrix_value ());
+  else
+    return v1.perm_matrix_value  () * v2.sparse_matrix_value ();
+}
+
+DEFBINOP (ldiv_pm_sm, perm_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_matrix&);
+
+  return v1.perm_matrix_value ().inverse () * v2.sparse_matrix_value ();
+}
+
+// sparse matrix by diagonal matrix ops
+
+DEFBINOP (mul_sm_pm, sparse_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_perm_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      double d = v1.scalar_value ();
+
+      return octave_value (d * v2.sparse_matrix_value ());
+    }
+  else if (v2.rows () == 1 && v2.columns () == 1)
+    return octave_value (v1.sparse_matrix_value ());
+  else
+    return v1.sparse_matrix_value  () * v2.perm_matrix_value ();
+}
+
+DEFBINOP (div_sm_pm, sparse_matrix, perm_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_perm_matrix&);
+
+  return v1.sparse_matrix_value () * v2.perm_matrix_value ().inverse ();
+}
+
+void
+install_pm_sm_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_perm_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_perm_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_perm_matrix, uminus);
+
+
+  INSTALL_BINOP (op_mul, octave_perm_matrix, octave_sparse_matrix,
+                 mul_pm_sm);
+  INSTALL_BINOP (op_ldiv, octave_perm_matrix, octave_sparse_matrix,
+                 ldiv_pm_sm);
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_perm_matrix,
+                 mul_sm_pm);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_perm_matrix,
+                 div_sm_pm);
+
+  INSTALL_BINOP (op_eq, octave_perm_matrix, octave_perm_matrix, eq_pm);
+  INSTALL_BINOP (op_ne, octave_perm_matrix, octave_perm_matrix, ne_pm);
+  INSTALL_BINOP (op_el_and, octave_perm_matrix, octave_perm_matrix, el_and_pm);
+  INSTALL_BINOP (op_el_or,  octave_perm_matrix, octave_perm_matrix, el_or_pm);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-pm-template.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,90 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ov-perm.h"
+#include MINCLUDE
+#include "ops.h"
+#ifdef DEFINENULLASSIGNCONV
+#include "ov-null-mat.h"
+#endif
+
+#ifndef LDMATRIX
+#define LDMATRIX LMATRIX
+#endif
+
+#define OCTAVE_LMATRIX CONCAT2(octave_, LMATRIX)
+#define OCTAVE_LDMATRIX CONCAT2(octave_, LDMATRIX)
+#define OCTAVE_RMATRIX CONCAT2(octave_, RMATRIX)
+#ifdef LEFT
+#define LMATRIX_VALUE perm_matrix_value
+#define RMATRIX_VALUE CONCAT2(RMATRIX, _value)
+#else
+#define LMATRIX_VALUE CONCAT2(LMATRIX, _value)
+#define RMATRIX_VALUE perm_matrix_value
+#endif
+
+DEFBINOP (mul, LMATRIX, RMATRIX)
+{
+  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
+
+  return v1.LMATRIX_VALUE () * v2.RMATRIX_VALUE ();
+}
+
+#ifdef LEFT
+DEFBINOP (ldiv, LMATRIX, RMATRIX)
+{
+  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
+
+  return v1.perm_matrix_value ().inverse () * v2.RMATRIX_VALUE ();
+}
+#else
+DEFBINOP (div, LMATRIX, RMATRIX)
+{
+  CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&);
+
+  return v1.LMATRIX_VALUE () * v2.perm_matrix_value ().inverse ();
+}
+#endif
+
+
+#define SHORT_NAME CONCAT3(LSHORT, _, RSHORT)
+#define INST_NAME CONCAT3(install_, SHORT_NAME, _ops)
+
+void
+INST_NAME (void)
+{
+  INSTALL_BINOP (op_mul, OCTAVE_LMATRIX, OCTAVE_RMATRIX, mul);
+#ifdef LEFT
+  INSTALL_BINOP (op_ldiv, OCTAVE_LMATRIX, OCTAVE_RMATRIX, ldiv);
+#else
+  INSTALL_BINOP (op_div, OCTAVE_LMATRIX, OCTAVE_RMATRIX, div);
+#endif
+#ifdef DEFINENULLASSIGNCONV
+  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_matrix, OCTAVE_LDMATRIX);
+  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_str, OCTAVE_LDMATRIX);
+  INSTALL_ASSIGNCONV (OCTAVE_LMATRIX, octave_null_sq_str, OCTAVE_LDMATRIX);
+#endif
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-range.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,142 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-range.h"
+#include "ov-ch-mat.h"
+#include "ov-scalar.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-bool.h"
+#include "ov-bool-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xpow.h"
+
+// range unary ops.
+
+DEFUNOP (not, range)
+{
+  CAST_UNOP_ARG (const octave_range&);
+
+  return octave_value (! v.matrix_value ());
+}
+
+DEFUNOP_OP (uplus, range, /* no-op */)
+DEFUNOP_OP (uminus, range, -)
+
+DEFUNOP (transpose, range)
+{
+  CAST_UNOP_ARG (const octave_range&);
+
+  return octave_value (v.matrix_value ().transpose ());
+}
+
+DEFBINOP_OP (addrs, range, scalar, +)
+DEFBINOP_OP (addsr, scalar, range, +)
+DEFBINOP_OP (subrs, range, scalar, -)
+DEFBINOP_OP (subsr, scalar, range, -)
+DEFBINOP_OP (mulrs, range, scalar, *)
+DEFBINOP_OP (mulsr, scalar, range, *)
+
+DEFBINOP_FN (el_powsr, scalar, range, elem_xpow)
+DEFBINOP_FN (el_powcsr, complex, range, elem_xpow)
+
+DEFNDCATOP_FN (r_r, range, range, array, array, concat)
+DEFNDCATOP_FN (r_s, range, scalar, array, array, concat)
+DEFNDCATOP_FN (r_m, range, matrix, array, array, concat)
+DEFNDCATOP_FN (r_cs, range, complex, array, complex_array, concat)
+DEFNDCATOP_FN (r_cm, range, complex_matrix, array, complex_array, concat)
+DEFNDCATOP_FN (r_b, range, bool, array, array, concat)
+DEFNDCATOP_FN (r_bm, range, bool_matrix, array, array, concat)
+DEFNDCATOP_FN (r_chm, range, char_matrix, array, char_array, concat)
+DEFNDCATOP_FN (s_r, scalar, range, array, array, concat)
+DEFNDCATOP_FN (m_r, matrix, range, array, array, concat)
+DEFNDCATOP_FN (cs_r, complex, range, complex_array, array, concat)
+DEFNDCATOP_FN (cm_r, complex_matrix, range, complex_array, array, concat)
+DEFNDCATOP_FN (b_r, bool, range, array, array, concat)
+DEFNDCATOP_FN (bm_r, bool_matrix, range, array, array, concat)
+DEFNDCATOP_FN (chm_r, char_matrix, range, char_array, array, concat)
+
+CONVDECL (range_to_matrix)
+{
+  CAST_CONV_ARG (const octave_range&);
+
+  return new octave_matrix (v.array_value ());
+}
+
+void
+install_range_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_range, not);
+  INSTALL_UNOP (op_uplus, octave_range, uplus);
+  INSTALL_UNOP (op_uminus, octave_range, uminus);
+  INSTALL_UNOP (op_transpose, octave_range, transpose);
+  INSTALL_UNOP (op_hermitian, octave_range, transpose);
+
+  INSTALL_BINOP (op_add, octave_range, octave_scalar, addrs);
+  INSTALL_BINOP (op_add, octave_scalar, octave_range, addsr);
+  INSTALL_BINOP (op_sub, octave_range, octave_scalar, subrs);
+  INSTALL_BINOP (op_sub, octave_scalar, octave_range, subsr);
+  INSTALL_BINOP (op_mul, octave_range, octave_scalar, mulrs);
+  INSTALL_BINOP (op_mul, octave_scalar, octave_range, mulsr);
+
+  INSTALL_BINOP (op_el_pow, octave_scalar, octave_range, el_powsr);
+  INSTALL_BINOP (op_el_pow, octave_complex, octave_range, el_powcsr);
+
+  INSTALL_CATOP (octave_range, octave_range, r_r);
+  INSTALL_CATOP (octave_range, octave_scalar, r_s);
+  INSTALL_CATOP (octave_range, octave_matrix, r_m);
+  INSTALL_CATOP (octave_range, octave_complex, r_cs);
+  INSTALL_CATOP (octave_range, octave_complex_matrix, r_cm);
+  INSTALL_CATOP (octave_range, octave_bool, r_b);
+  INSTALL_CATOP (octave_range, octave_bool_matrix, r_bm);
+  INSTALL_CATOP (octave_range, octave_char_matrix, r_chm);
+  INSTALL_CATOP (octave_scalar, octave_range, s_r);
+  INSTALL_CATOP (octave_matrix, octave_range, m_r);
+  INSTALL_CATOP (octave_complex, octave_range, cs_r);
+  INSTALL_CATOP (octave_complex_matrix, octave_range, cm_r);
+  INSTALL_CATOP (octave_bool, octave_range, b_r);
+  INSTALL_CATOP (octave_bool_matrix, octave_range, bm_r);
+  INSTALL_CATOP (octave_char_matrix, octave_range, chm_r);
+
+  // FIXME -- this would be unneccessary if
+  // octave_base_value::numeric_assign always tried converting lhs
+  // before rhs.
+
+  INSTALL_ASSIGNCONV (octave_range, octave_null_matrix, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_range, octave_null_str, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_range, octave_null_sq_str, octave_matrix);
+
+  // However, this should probably be here just in case we need it.
+
+  INSTALL_WIDENOP (octave_range, octave_matrix, range_to_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-s-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,142 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-s-cm.h"
+#include "mx-cm-s.h"
+#include "mx-s-cnda.h"
+#include "mx-cnda-s.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// scalar by complex matrix ops.
+
+DEFNDBINOP_OP (add, scalar, complex_matrix, scalar, complex_array, +)
+DEFNDBINOP_OP (sub, scalar, complex_matrix, scalar, complex_array, -)
+DEFNDBINOP_OP (mul, scalar, complex_matrix, scalar, complex_array, *)
+
+DEFBINOP (div, scalar, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
+
+  Matrix m1 = v1.matrix_value ();
+  ComplexMatrix m2 = v2.complex_matrix_value ();
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (m1, m2, typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (pow, scalar, complex_matrix, xpow)
+
+DEFBINOP (ldiv, scalar, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
+
+  double d = v1.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.complex_array_value () / d);
+}
+
+DEFNDCMPLXCMPOP_FN (lt, scalar, complex_matrix, scalar, complex_array, mx_el_lt)
+DEFNDCMPLXCMPOP_FN (le, scalar, complex_matrix, scalar, complex_array, mx_el_le)
+DEFNDCMPLXCMPOP_FN (eq, scalar, complex_matrix, scalar, complex_array, mx_el_eq)
+DEFNDCMPLXCMPOP_FN (ge, scalar, complex_matrix, scalar, complex_array, mx_el_ge)
+DEFNDCMPLXCMPOP_FN (gt, scalar, complex_matrix, scalar, complex_array, mx_el_gt)
+DEFNDCMPLXCMPOP_FN (ne, scalar, complex_matrix, scalar, complex_array, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, scalar, complex_matrix, scalar, complex_array, *)
+DEFNDBINOP_FN (el_div, scalar, complex_matrix, scalar, complex_array, x_el_div)
+DEFNDBINOP_FN (el_pow, scalar, complex_matrix, scalar, complex_array, elem_xpow)
+
+DEFBINOP (el_ldiv, scalar, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&);
+
+  double d = v1.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.complex_array_value () / d);
+}
+
+DEFNDBINOP_FN (el_and, scalar, complex_matrix, scalar, complex_array, mx_el_and)
+DEFNDBINOP_FN (el_or,  scalar, complex_matrix, scalar, complex_array, mx_el_or)
+
+DEFNDCATOP_FN (s_cm, scalar, complex_matrix, array, complex_array, concat)
+
+DEFCONV (complex_matrix_conv, scalar, complex_matrix)
+{
+  CAST_CONV_ARG (const octave_scalar&);
+
+  return new octave_complex_matrix (ComplexMatrix (v.matrix_value ()));
+}
+
+void
+install_s_cm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_scalar, octave_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_scalar, octave_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_scalar, octave_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_scalar, octave_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_scalar, octave_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_scalar, octave_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_scalar, octave_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_scalar, octave_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_scalar, octave_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_scalar, octave_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_scalar, octave_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_scalar, octave_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_scalar, octave_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_scalar, octave_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_scalar, octave_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_scalar, octave_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_scalar, octave_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_scalar, octave_complex_matrix, s_cm);
+
+  INSTALL_ASSIGNCONV (octave_scalar, octave_complex_matrix, octave_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_complex_matrix, octave_float_complex_matrix);
+
+  INSTALL_WIDENOP (octave_scalar, octave_complex_matrix, complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-s-cs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// scalar by complex scalar ops.
+
+DEFBINOP_OP (add, scalar, complex, +)
+DEFBINOP_OP (sub, scalar, complex, -)
+DEFBINOP_OP (mul, scalar, complex, *)
+
+DEFBINOP (div, scalar, complex)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.double_value () / d);
+}
+
+DEFBINOP_FN (pow, scalar, complex, xpow)
+
+DEFBINOP (ldiv, scalar, complex)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
+
+  double d = v1.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.complex_value () / d);
+}
+
+DEFCMPLXCMPOP_OP (lt, scalar, complex, <)
+DEFCMPLXCMPOP_OP (le, scalar, complex, <=)
+DEFCMPLXCMPOP_OP (eq, scalar, complex, ==)
+DEFCMPLXCMPOP_OP (ge, scalar, complex, >=)
+DEFCMPLXCMPOP_OP (gt, scalar, complex, >)
+DEFCMPLXCMPOP_OP (ne, scalar, complex, !=)
+
+DEFBINOP_OP (el_mul, scalar, complex, *)
+
+DEFBINOP (el_div, scalar, complex)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.double_value () / d);
+}
+
+DEFBINOP_FN (el_pow, scalar, complex, xpow)
+
+DEFBINOP (el_ldiv, scalar, complex)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
+
+  double d = v1.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.complex_value () / d);
+}
+
+DEFBINOP (el_and, scalar, complex)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
+
+  return octave_value (v1.double_value () && (v2.complex_value () != 0.0));
+}
+
+DEFBINOP (el_or, scalar, complex)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
+
+  return octave_value (v1.double_value () || (v2.complex_value () != 0.0));
+}
+
+DEFNDCATOP_FN (s_cs, scalar, complex, array, complex_array, concat)
+
+void
+install_s_cs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_scalar, octave_complex, add);
+  INSTALL_BINOP (op_sub, octave_scalar, octave_complex, sub);
+  INSTALL_BINOP (op_mul, octave_scalar, octave_complex, mul);
+  INSTALL_BINOP (op_div, octave_scalar, octave_complex, div);
+  INSTALL_BINOP (op_pow, octave_scalar, octave_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_scalar, octave_complex, ldiv);
+  INSTALL_BINOP (op_lt, octave_scalar, octave_complex, lt);
+  INSTALL_BINOP (op_le, octave_scalar, octave_complex, le);
+  INSTALL_BINOP (op_eq, octave_scalar, octave_complex, eq);
+  INSTALL_BINOP (op_ge, octave_scalar, octave_complex, ge);
+  INSTALL_BINOP (op_gt, octave_scalar, octave_complex, gt);
+  INSTALL_BINOP (op_ne, octave_scalar, octave_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_scalar, octave_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_scalar, octave_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_scalar, octave_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_scalar, octave_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_scalar, octave_complex, el_or);
+
+  INSTALL_CATOP (octave_scalar, octave_complex, s_cs);
+
+  INSTALL_ASSIGNCONV (octave_scalar, octave_complex, octave_complex_matrix);
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_complex, octave_float_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-s-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,136 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// scalar by matrix ops.
+
+DEFNDBINOP_OP (add, scalar, matrix, scalar, array, +)
+DEFNDBINOP_OP (sub, scalar, matrix, scalar, array, -)
+DEFNDBINOP_OP (mul, scalar, matrix, scalar, array, *)
+
+DEFBINOP (div, scalar, matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&);
+
+  Matrix m1 = v1.matrix_value ();
+  Matrix m2 = v2.matrix_value ();
+  MatrixType typ = v2.matrix_type ();
+
+  Matrix ret = xdiv (m1, m2, typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOP_FN (pow, scalar, matrix, xpow)
+
+DEFBINOP (ldiv, scalar, matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&);
+
+  double d = v1.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.array_value () / d);
+}
+
+DEFNDBINOP_FN (lt, scalar, matrix, scalar, array, mx_el_lt)
+DEFNDBINOP_FN (le, scalar, matrix, scalar, array, mx_el_le)
+DEFNDBINOP_FN (eq, scalar, matrix, scalar, array, mx_el_eq)
+DEFNDBINOP_FN (ge, scalar, matrix, scalar, array, mx_el_ge)
+DEFNDBINOP_FN (gt, scalar, matrix, scalar, array, mx_el_gt)
+DEFNDBINOP_FN (ne, scalar, matrix, scalar, array, mx_el_ne)
+
+DEFNDBINOP_OP (el_mul, scalar, matrix, scalar, array, *)
+DEFNDBINOP_FN (el_div, scalar, matrix, scalar, array, x_el_div)
+DEFNDBINOP_FN (el_pow, scalar, matrix, scalar, array, elem_xpow)
+
+DEFBINOP (el_ldiv, scalar, matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_matrix&);
+
+  double d = v1.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.array_value () / d);
+}
+
+DEFNDBINOP_FN (el_and, scalar, matrix, scalar, array, mx_el_and)
+DEFNDBINOP_FN (el_or,  scalar, matrix, scalar, array, mx_el_or)
+
+DEFNDCATOP_FN (s_m, scalar, matrix, array, array, concat)
+
+DEFCONV (matrix_conv, scalar, matrix)
+{
+  CAST_CONV_ARG (const octave_scalar&);
+
+  return new octave_matrix (v.matrix_value ());
+}
+
+void
+install_s_m_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_scalar, octave_matrix, add);
+  INSTALL_BINOP (op_sub, octave_scalar, octave_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_scalar, octave_matrix, mul);
+  INSTALL_BINOP (op_div, octave_scalar, octave_matrix, div);
+  INSTALL_BINOP (op_pow, octave_scalar, octave_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_scalar, octave_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_scalar, octave_matrix, lt);
+  INSTALL_BINOP (op_le, octave_scalar, octave_matrix, le);
+  INSTALL_BINOP (op_eq, octave_scalar, octave_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_scalar, octave_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_scalar, octave_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_scalar, octave_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_scalar, octave_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_scalar, octave_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_scalar, octave_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_scalar, octave_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_scalar, octave_matrix, el_or);
+
+  INSTALL_CATOP (octave_scalar, octave_matrix, s_m);
+
+  INSTALL_ASSIGNCONV (octave_scalar, octave_matrix, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_matrix, octave_float_matrix);
+
+  INSTALL_WIDENOP (octave_scalar, octave_matrix, matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-s-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,172 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Array-util.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// scalar unary ops.
+
+DEFUNOP (not, scalar)
+{
+  CAST_UNOP_ARG (const octave_scalar&);
+  double x = v.scalar_value ();
+  if (xisnan (x))
+    gripe_nan_to_logical_conversion ();
+  return octave_value (x == 0.0);
+}
+
+DEFUNOP_OP (uplus, scalar, /* no-op */)
+DEFUNOP_OP (uminus, scalar, -)
+DEFUNOP_OP (transpose, scalar, /* no-op */)
+DEFUNOP_OP (hermitian, scalar, /* no-op */)
+
+DEFNCUNOP_METHOD (incr, scalar, increment)
+DEFNCUNOP_METHOD (decr, scalar, decrement)
+
+// scalar by scalar ops.
+
+DEFBINOP_OP (add, scalar, scalar, +)
+DEFBINOP_OP (sub, scalar, scalar, -)
+DEFBINOP_OP (mul, scalar, scalar, *)
+
+DEFBINOP (div, scalar, scalar)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&);
+
+  double d = v2.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.double_value () / d);
+}
+
+DEFBINOP_FN (pow, scalar, scalar, xpow)
+
+DEFBINOP (ldiv, scalar, scalar)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&);
+
+  double d = v1.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.double_value () / d);
+}
+
+DEFBINOP_OP (lt, scalar, scalar, <)
+DEFBINOP_OP (le, scalar, scalar, <=)
+DEFBINOP_OP (eq, scalar, scalar, ==)
+DEFBINOP_OP (ge, scalar, scalar, >=)
+DEFBINOP_OP (gt, scalar, scalar, >)
+DEFBINOP_OP (ne, scalar, scalar, !=)
+
+DEFBINOP_OP (el_mul, scalar, scalar, *)
+
+DEFBINOP (el_div, scalar, scalar)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&);
+
+  double d = v2.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v1.double_value () / d);
+}
+
+DEFBINOP_FN (el_pow, scalar, scalar, xpow)
+
+DEFBINOP (el_ldiv, scalar, scalar)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_scalar&);
+
+  double d = v1.double_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  return octave_value (v2.double_value () / d);
+}
+
+DEFSCALARBOOLOP_OP (el_and, scalar, scalar, &&)
+DEFSCALARBOOLOP_OP (el_or, scalar, scalar, ||)
+
+DEFNDCATOP_FN (s_s, scalar, scalar, array, array, concat)
+
+void
+install_s_s_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_scalar, not);
+  INSTALL_UNOP (op_uplus, octave_scalar, uplus);
+  INSTALL_UNOP (op_uminus, octave_scalar, uminus);
+  INSTALL_UNOP (op_transpose, octave_scalar, transpose);
+  INSTALL_UNOP (op_hermitian, octave_scalar, hermitian);
+
+  INSTALL_NCUNOP (op_incr, octave_scalar, incr);
+  INSTALL_NCUNOP (op_decr, octave_scalar, decr);
+
+  INSTALL_BINOP (op_add, octave_scalar, octave_scalar, add);
+  INSTALL_BINOP (op_sub, octave_scalar, octave_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_scalar, octave_scalar, mul);
+  INSTALL_BINOP (op_div, octave_scalar, octave_scalar, div);
+  INSTALL_BINOP (op_pow, octave_scalar, octave_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_scalar, octave_scalar, ldiv);
+  INSTALL_BINOP (op_lt, octave_scalar, octave_scalar, lt);
+  INSTALL_BINOP (op_le, octave_scalar, octave_scalar, le);
+  INSTALL_BINOP (op_eq, octave_scalar, octave_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_scalar, octave_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_scalar, octave_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_scalar, octave_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_scalar, octave_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_scalar, octave_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_scalar, octave_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_scalar, octave_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_scalar, octave_scalar, el_or);
+
+  INSTALL_CATOP (octave_scalar, octave_scalar, s_s);
+
+  INSTALL_ASSIGNCONV (octave_scalar, octave_scalar, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_float_scalar, octave_scalar, octave_float_matrix);
+
+  INSTALL_ASSIGNCONV (octave_scalar, octave_null_matrix, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_scalar, octave_null_str, octave_matrix);
+  INSTALL_ASSIGNCONV (octave_scalar, octave_null_sq_str, octave_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-s-scm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,178 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-cx-mat.h"
+#include "ov-scalar.h"
+#include "ops.h"
+#include "xpow.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-s-scm.h"
+#include "smx-scm-s.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+
+// scalar by sparse complex matrix ops.
+
+DEFBINOP_OP (add, scalar, sparse_complex_matrix, +)
+DEFBINOP_OP (sub, scalar, sparse_complex_matrix, -)
+DEFBINOP_OP (mul, scalar, sparse_complex_matrix, *)
+
+DEFBINOP (div, scalar, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      Complex d = v2.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (SparseComplexMatrix (1, 1, v1.scalar_value () / d));
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      Matrix m1 = Matrix (1, 1, v1.scalar_value ());
+      SparseComplexMatrix m2 = v2.sparse_complex_matrix_value ();
+      ComplexMatrix ret = xdiv (m1, m2, typ);
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP (pow, scalar, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&,
+                   const octave_sparse_complex_matrix&);
+  return xpow (v1.scalar_value (), v2.complex_matrix_value ());
+}
+
+DEFBINOP (ldiv, scalar, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&,
+                   const octave_sparse_complex_matrix&);
+
+  double d = v1.double_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v2.sparse_complex_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (lt, scalar, sparse_complex_matrix, mx_el_lt)
+DEFBINOP_FN (le, scalar, sparse_complex_matrix, mx_el_le)
+DEFBINOP_FN (eq, scalar, sparse_complex_matrix, mx_el_eq)
+DEFBINOP_FN (ge, scalar, sparse_complex_matrix, mx_el_ge)
+DEFBINOP_FN (gt, scalar, sparse_complex_matrix, mx_el_gt)
+DEFBINOP_FN (ne, scalar, sparse_complex_matrix, mx_el_ne)
+
+DEFBINOP_OP (el_mul, scalar, sparse_complex_matrix, *)
+DEFBINOP_FN (el_div, scalar, sparse_complex_matrix, x_el_div)
+DEFBINOP_FN (el_pow, scalar, sparse_complex_matrix, elem_xpow)
+
+DEFBINOP (el_ldiv, scalar, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&,
+                   const octave_sparse_complex_matrix&);
+
+  double d = v1.double_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v2.sparse_complex_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (el_and, scalar, sparse_complex_matrix, mx_el_and)
+DEFBINOP_FN (el_or, scalar, sparse_complex_matrix, mx_el_or)
+
+DEFCATOP (s_scm, scalar, sparse_compelx_matrix)
+{
+  CAST_BINOP_ARGS (octave_scalar&, const octave_sparse_complex_matrix&);
+  SparseMatrix tmp (1, 1, v1.scalar_value ());
+  return octave_value
+    (tmp.concat (v2.sparse_complex_matrix_value (), ra_idx));
+}
+
+DEFCONV (sparse_complex_matrix_conv, scalar, sparse_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_scalar&);
+
+  return new octave_sparse_complex_matrix
+    (SparseComplexMatrix (v.complex_matrix_value ()));
+}
+
+void
+install_s_scm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_scalar, octave_sparse_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_scalar, octave_sparse_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_scalar, octave_sparse_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_scalar, octave_sparse_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_scalar, octave_sparse_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_scalar, octave_sparse_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_scalar, octave_sparse_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_scalar, octave_sparse_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_scalar, octave_sparse_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_scalar, octave_sparse_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_scalar, octave_sparse_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_scalar, octave_sparse_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_scalar, octave_sparse_complex_matrix,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_scalar, octave_sparse_complex_matrix,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_scalar, octave_sparse_complex_matrix,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_sparse_complex_matrix,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_scalar, octave_sparse_complex_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_scalar, octave_sparse_complex_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_scalar, octave_sparse_complex_matrix, s_scm);
+
+  INSTALL_ASSIGNCONV (octave_scalar, octave_sparse_complex_matrix,
+                      octave_complex_matrix);
+
+  INSTALL_WIDENOP (octave_scalar, octave_sparse_complex_matrix,
+                   sparse_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-s-sm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,161 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-scalar.h"
+#include "ops.h"
+#include "xpow.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "ov-re-sparse.h"
+
+// scalar by sparse matrix ops.
+
+DEFBINOP_OP (add, scalar, sparse_matrix, +)
+DEFBINOP_OP (sub, scalar, sparse_matrix, -)
+DEFBINOP_OP (mul, scalar, sparse_matrix, *)
+
+DEFBINOP (div, scalar, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (SparseMatrix (1, 1, v1.scalar_value () / d));
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      Matrix m1 = Matrix (1, 1, v1.double_value ());
+      SparseMatrix m2 = v2.sparse_matrix_value ();
+      Matrix ret = xdiv (m1, m2, typ);
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP (pow, scalar, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
+  return xpow (v1.scalar_value (), v2.matrix_value ());
+}
+
+DEFBINOP (ldiv, scalar, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
+
+  double d = v1.double_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v2.sparse_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (lt, scalar, sparse_matrix, mx_el_lt)
+DEFBINOP_FN (le, scalar, sparse_matrix, mx_el_le)
+DEFBINOP_FN (eq, scalar, sparse_matrix, mx_el_eq)
+DEFBINOP_FN (ge, scalar, sparse_matrix, mx_el_ge)
+DEFBINOP_FN (gt, scalar, sparse_matrix, mx_el_gt)
+DEFBINOP_FN (ne, scalar, sparse_matrix, mx_el_ne)
+
+DEFBINOP_OP (el_mul, scalar, sparse_matrix, *)
+DEFBINOP_FN (el_div, scalar, sparse_matrix, x_el_div)
+DEFBINOP_FN (el_pow, scalar, sparse_matrix, elem_xpow)
+
+DEFBINOP (el_ldiv, scalar, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&);
+
+  double d = v1.double_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v2.sparse_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (el_and, scalar, sparse_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  scalar, sparse_matrix, mx_el_or)
+
+DEFCATOP (s_sm, scalar, sparse_matrix)
+{
+  CAST_BINOP_ARGS (octave_scalar&, const octave_sparse_matrix&);
+  SparseMatrix tmp (1, 1, v1.scalar_value ());
+  return octave_value (tmp.concat (v2.sparse_matrix_value (), ra_idx));
+}
+
+DEFCONV (sparse_matrix_conv, scalar, sparse_matrix)
+{
+  CAST_CONV_ARG (const octave_scalar&);
+
+  return new octave_sparse_matrix (SparseMatrix (v.matrix_value ()));
+}
+
+void
+install_s_sm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_scalar, octave_sparse_matrix, add);
+  INSTALL_BINOP (op_sub, octave_scalar, octave_sparse_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_scalar, octave_sparse_matrix, mul);
+  INSTALL_BINOP (op_div, octave_scalar, octave_sparse_matrix, div);
+  INSTALL_BINOP (op_pow, octave_scalar, octave_sparse_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_scalar, octave_sparse_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_scalar, octave_sparse_matrix, lt);
+  INSTALL_BINOP (op_le, octave_scalar, octave_sparse_matrix, le);
+  INSTALL_BINOP (op_eq, octave_scalar, octave_sparse_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_scalar, octave_sparse_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_scalar, octave_sparse_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_scalar, octave_sparse_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_scalar, octave_sparse_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_scalar, octave_sparse_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_scalar, octave_sparse_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_sparse_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_scalar, octave_sparse_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_scalar, octave_sparse_matrix, el_or);
+
+  INSTALL_CATOP (octave_scalar, octave_sparse_matrix, s_sm);
+
+  INSTALL_ASSIGNCONV (octave_scalar, octave_sparse_matrix, octave_matrix);
+
+  INSTALL_WIDENOP (octave_scalar, octave_sparse_matrix, sparse_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sbm-b.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,141 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-bool.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-scalar.h"
+#include "ops.h"
+
+#include "ov-re-sparse.h"
+#include "ov-bool-sparse.h"
+
+// sparse bool matrix by bool ops.
+
+DEFBINOP_FN (ne, sparse_bool_matrix, bool, mx_el_ne)
+DEFBINOP_FN (eq, sparse_bool_matrix, bool, mx_el_eq)
+
+DEFBINOP_FN (el_and, sparse_bool_matrix, bool, mx_el_and)
+DEFBINOP_FN (el_or, sparse_bool_matrix, bool, mx_el_or)
+
+DEFCATOP (sbm_b, sparse_bool_matrix, bool)
+{
+  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool&);
+
+  SparseBoolMatrix tmp (1, 1, v2.bool_value ());
+  return octave_value (v1.sparse_bool_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFCATOP (sm_b, sparse_matrix, bool)
+{
+  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool&);
+
+  SparseMatrix tmp (1, 1, v2.scalar_value ());
+  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFCATOP (sbm_s, sparse_bool_matrix, scalar)
+{
+  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_scalar&);
+
+  SparseMatrix tmp (1, 1, v2.scalar_value ());
+  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFASSIGNOP (assign, sparse_bool_matrix, bool)
+{
+  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool&);
+
+  SparseBoolMatrix tmp (1, 1, v2.bool_value ());
+  v1.assign (idx, tmp);
+  return octave_value ();
+}
+
+static octave_value
+oct_assignop_conv_and_assign (octave_base_value& a1,
+                              const octave_value_list& idx,
+                              const octave_base_value& a2)
+{
+  octave_sparse_bool_matrix& v1 = dynamic_cast<octave_sparse_bool_matrix&> (a1);
+
+  // FIXME -- perhaps add a warning for this conversion if the values
+  // are not all 0 or 1?
+
+  SparseBoolMatrix v2 (1, 1, a2.bool_value ());
+
+  if (! error_state)
+    v1.assign (idx, v2);
+
+  return octave_value ();
+}
+
+void
+install_sbm_b_ops (void)
+{
+  INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, octave_bool, eq);
+  INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, octave_bool, ne);
+
+  INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_bool, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_bool, el_or);
+
+  INSTALL_CATOP (octave_sparse_bool_matrix, octave_bool, sbm_b);
+  INSTALL_CATOP (octave_sparse_bool_matrix, octave_scalar, sbm_s);
+  INSTALL_CATOP (octave_sparse_matrix, octave_bool, sm_b);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_bool, assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_scalar,
+                    conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int8_scalar,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int16_scalar,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int32_scalar,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int64_scalar,
+                    conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint8_scalar,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint16_scalar,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint32_scalar,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint64_scalar,
+                    conv_and_assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sbm-bm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,167 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-bool-mat.h"
+#include "boolMatrix.h"
+#include "ov-int8.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-uint8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-range.h"
+#include "ov-scalar.h"
+#include "ov-str-mat.h"
+#include "ops.h"
+#include "ov-null-mat.h"
+#include "ov-re-sparse.h"
+#include "ov-bool-sparse.h"
+#include "smx-bm-sbm.h"
+#include "smx-sbm-bm.h"
+
+// sparse bool matrix by bool matrix ops.
+
+DEFBINOP_FN (eq, sparse_bool_matrix, bool_matrix, mx_el_eq)
+DEFBINOP_FN (ne, sparse_bool_matrix, bool_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_and, sparse_bool_matrix, bool_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_bool_matrix, bool_matrix, mx_el_or)
+
+DEFCATOP (sbm_bm, sparse_bool_matrix, bool_matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&);
+
+  SparseBoolMatrix tmp (v2.bool_matrix_value ());
+  return octave_value (v1.sparse_bool_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFCATOP (sbm_m, sparse_bool_matrix, matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_matrix&);
+
+  SparseMatrix tmp (v2.matrix_value ());
+  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFCATOP (sm_bm, sparse_matrix, bool_matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool_matrix&);
+
+  SparseMatrix tmp (v2.matrix_value ());
+  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFASSIGNOP (assign, sparse_bool_matrix, bool_matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&);
+
+  v1.assign (idx, SparseBoolMatrix (v2.bool_matrix_value ()));
+  return octave_value ();
+}
+
+DEFNULLASSIGNOP_FN (null_assign, sparse_bool_matrix, delete_elements)
+
+static octave_value
+oct_assignop_conv_and_assign (octave_base_value& a1,
+                              const octave_value_list& idx,
+                              const octave_base_value& a2)
+{
+  octave_sparse_bool_matrix& v1 = dynamic_cast<octave_sparse_bool_matrix&> (a1);
+
+  // FIXME -- perhaps add a warning for this conversion if the values
+  // are not all 0 or 1?
+
+  SparseBoolMatrix v2 (a2.bool_array_value ());
+
+  if (! error_state)
+    v1.assign (idx, v2);
+
+  return octave_value ();
+}
+
+void
+install_sbm_bm_ops (void)
+{
+  INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, octave_bool_matrix, eq);
+  INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, octave_bool_matrix, ne);
+
+  INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_bool_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_bool_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_sparse_bool_matrix, octave_bool_matrix, sbm_bm);
+  INSTALL_CATOP (octave_sparse_matrix, octave_bool_matrix, sm_bm);
+  INSTALL_CATOP (octave_sparse_bool_matrix, octave_matrix, sbm_m);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
+                    octave_bool_matrix, assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_matrix,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
+                    octave_char_matrix_str, conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
+                    octave_char_matrix_sq_str, conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_range,
+                    conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_sparse_matrix,
+                    conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int8_matrix,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int16_matrix,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int32_matrix,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_int64_matrix,
+                    conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint8_matrix,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint16_matrix,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint32_matrix,
+                    conv_and_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_uint64_matrix,
+                    conv_and_assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_null_matrix,
+                    null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_null_str,
+                    null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_null_sq_str,
+                    null_assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sbm-sbm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,114 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-bool-mat.h"
+#include "ov-scalar.h"
+#include "ops.h"
+
+#include "ov-re-sparse.h"
+#include "ov-bool-sparse.h"
+
+// unary sparse bool matrix ops.
+
+DEFUNOP_OP (not, sparse_bool_matrix, !)
+
+DEFUNOP (uplus, sparse_bool_matrix)
+{
+  CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
+  return octave_value (v.sparse_matrix_value ());
+}
+
+DEFUNOP (uminus, sparse_bool_matrix)
+{
+  CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
+  return octave_value ( - v.sparse_matrix_value ());
+}
+
+DEFUNOP (transpose, sparse_bool_matrix)
+{
+  CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
+  return octave_value (v.sparse_bool_matrix_value ().transpose ());
+}
+
+// sparse bool matrix by sparse bool matrix ops.
+
+DEFBINOP_FN (eq, sparse_bool_matrix, sparse_bool_matrix, mx_el_eq)
+DEFBINOP_FN (ne, sparse_bool_matrix, sparse_bool_matrix, mx_el_ne)
+DEFBINOP_FN (el_and, sparse_bool_matrix, sparse_bool_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_bool_matrix, sparse_bool_matrix, mx_el_or)
+
+DEFNDCATOP_FN (sbm_sbm, sparse_bool_matrix, sparse_bool_matrix,
+               sparse_bool_matrix, sparse_bool_matrix, concat)
+DEFNDCATOP_FN (sbm_sm, sparse_bool_matrix, sparse_matrix, sparse_matrix,
+               sparse_matrix, concat)
+DEFNDCATOP_FN (sm_sbm, sparse_matrix, sparse_bool_matrix, sparse_matrix,
+               sparse_matrix, concat)
+
+DEFASSIGNOP_FN (assign, sparse_bool_matrix, sparse_bool_matrix,
+                assign)
+
+CONVDECL (bool_matrix_to_double_matrix)
+{
+  CAST_CONV_ARG (const octave_sparse_bool_matrix&);
+
+  return new octave_sparse_matrix (SparseMatrix (v.sparse_bool_matrix_value ()));
+}
+
+void
+install_sbm_sbm_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_sparse_bool_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_sparse_bool_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_sparse_bool_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_sparse_bool_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_sparse_bool_matrix, transpose);
+
+  INSTALL_BINOP (op_eq, octave_sparse_bool_matrix,
+                 octave_sparse_bool_matrix, eq);
+  INSTALL_BINOP (op_ne, octave_sparse_bool_matrix,
+                 octave_sparse_bool_matrix, ne);
+
+  INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix,
+                 octave_sparse_bool_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix,
+                 octave_sparse_bool_matrix, el_or);
+
+  INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_bool_matrix,
+                 sbm_sbm);
+  INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_matrix, sbm_sm);
+  INSTALL_CATOP (octave_sparse_matrix, octave_sparse_bool_matrix, sm_sbm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
+                    octave_sparse_bool_matrix, assign);
+
+  INSTALL_CONVOP (octave_sparse_bool_matrix, octave_sparse_matrix,
+                  bool_matrix_to_double_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-scm-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,196 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-cx-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-scm-cm.h"
+#include "smx-cm-scm.h"
+#include "ov-cx-sparse.h"
+
+// sparse complex matrix by complex matrix ops.
+
+DEFBINOP_OP (add, sparse_complex_matrix, complex_matrix, +)
+DEFBINOP_OP (sub, sparse_complex_matrix, complex_matrix, -)
+
+DEFBINOP_OP (mul, sparse_complex_matrix, complex_matrix, *)
+
+DEFBINOP (div, sparse_complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_complex_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
+                            v2.complex_matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, sparse_complex_matrix, complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, sparse_complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      Complex d = v1.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v2.complex_array_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+
+      ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (),
+                      v2.complex_matrix_value (), typ);
+
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (trans_mul, sparse_complex_matrix, complex_matrix, trans_mul);
+DEFBINOP_FN (herm_mul, sparse_complex_matrix, complex_matrix, herm_mul);
+
+DEFBINOP_FN (lt, sparse_complex_matrix, complex_matrix, mx_el_lt)
+DEFBINOP_FN (le, sparse_complex_matrix, complex_matrix, mx_el_le)
+DEFBINOP_FN (eq, sparse_complex_matrix, complex_matrix, mx_el_eq)
+DEFBINOP_FN (ge, sparse_complex_matrix, complex_matrix, mx_el_ge)
+DEFBINOP_FN (gt, sparse_complex_matrix, complex_matrix, mx_el_gt)
+DEFBINOP_FN (ne, sparse_complex_matrix, complex_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, sparse_complex_matrix, complex_matrix, product)
+DEFBINOP_FN (el_div, sparse_complex_matrix, complex_matrix, quotient)
+
+DEFBINOP (el_pow, sparse_complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_complex_matrix&);
+
+  return octave_value
+    (elem_xpow (v1.sparse_complex_matrix_value (), SparseComplexMatrix
+                (v2.complex_matrix_value ())));
+}
+
+DEFBINOP (el_ldiv, sparse_complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_complex_matrix&);
+
+  return octave_value (quotient (v2.complex_matrix_value (),
+                                 v1.sparse_complex_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_complex_matrix, complex_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_complex_matrix, complex_matrix, mx_el_or)
+
+DEFCATOP (scm_cm, sparse_complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_complex_matrix&,
+                   const octave_complex_matrix&);
+  SparseComplexMatrix tmp (v2.complex_matrix_value ());
+  return octave_value
+    (v1.sparse_complex_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFASSIGNOP (assign, sparse_complex_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_complex_matrix&,
+                   const octave_complex_matrix&);
+
+  SparseComplexMatrix tmp (v2.complex_matrix_value ());
+  v1.assign (idx, tmp);
+  return octave_value ();
+}
+
+void
+install_scm_cm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_complex_matrix,
+                 octave_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix,
+                 octave_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix,
+                 octave_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix,
+                 octave_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix,
+                 octave_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix,
+                 octave_complex_matrix, ldiv);
+  INSTALL_BINOP (op_trans_mul, octave_sparse_complex_matrix,
+                 octave_complex_matrix, trans_mul);
+  INSTALL_BINOP (op_herm_mul, octave_sparse_complex_matrix,
+                 octave_complex_matrix, herm_mul);
+  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix,
+                 octave_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_sparse_complex_matrix,
+                 octave_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix,
+                 octave_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix,
+                 octave_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix,
+                 octave_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix,
+                 octave_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix,
+                 octave_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix,
+                 octave_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix,
+                 octave_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix,
+                 octave_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix,
+                 octave_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix,
+                 octave_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_sparse_complex_matrix,
+                 octave_complex_matrix, scm_cm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
+                    octave_complex_matrix, assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-scm-cs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,184 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-cx-mat.h"
+#include "ov-complex.h"
+#include "ops.h"
+#include "xpow.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "ov-cx-sparse.h"
+
+// sparse complex matrix by complex scalar ops.
+
+DEFBINOP_OP (add, sparse_complex_matrix, complex, +)
+DEFBINOP_OP (sub, sparse_complex_matrix, complex, -)
+DEFBINOP_OP (mul, sparse_complex_matrix, complex, *)
+
+DEFBINOP (div, sparse_complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_complex&);
+
+  Complex d = v2.complex_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v1.sparse_complex_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP (pow, sparse_complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_complex&);
+  return xpow (v1.complex_matrix_value (), v2.complex_value ());
+}
+
+DEFBINOP (ldiv, sparse_complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      Complex d = v1.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (SparseComplexMatrix (1, 1, v2.complex_value () / d));
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+      SparseComplexMatrix m1 = v1.sparse_complex_matrix_value ();
+      ComplexMatrix m2 = ComplexMatrix (1, 1, v2.complex_value ());
+      ComplexMatrix ret = xleftdiv (m1, m2, typ);
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_complex_matrix, complex, mx_el_lt)
+DEFBINOP_FN (le, sparse_complex_matrix, complex, mx_el_le)
+DEFBINOP_FN (eq, sparse_complex_matrix, complex, mx_el_eq)
+DEFBINOP_FN (ge, sparse_complex_matrix, complex, mx_el_ge)
+DEFBINOP_FN (gt, sparse_complex_matrix, complex, mx_el_gt)
+DEFBINOP_FN (ne, sparse_complex_matrix, complex, mx_el_ne)
+
+DEFBINOP_OP (el_mul, sparse_complex_matrix, complex, *)
+
+DEFBINOP (el_div, sparse_complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_complex&);
+
+  octave_value retval;
+
+  Complex d = v2.complex_value ();
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval =  octave_value (v1.sparse_complex_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (el_pow, sparse_complex_matrix, complex, elem_xpow)
+
+DEFBINOP (el_ldiv, sparse_complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_complex&);
+
+  return octave_value
+    (x_el_div (v2.complex_value (), v1.sparse_complex_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_complex_matrix, complex, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_complex_matrix, complex, mx_el_or)
+
+DEFCATOP (scm_cs, sparse_complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_complex&);
+  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
+  return octave_value
+    (v1.sparse_complex_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFASSIGNOP (assign, sparse_complex_matrix, complex)
+{
+  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_complex&);
+
+  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
+  v1.assign (idx, tmp);
+  return octave_value ();
+}
+
+void
+install_scm_cs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_complex, add);
+  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_complex, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_complex, mul);
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_complex, div);
+  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_complex,
+                 ldiv);
+  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_complex, lt);
+  INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_complex, le);
+  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_complex, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_complex, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_complex, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_complex,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_complex,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_complex,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_complex,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_complex,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_complex,
+                 el_or);
+
+  INSTALL_CATOP (octave_sparse_complex_matrix, octave_complex, scm_cs);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_complex,
+                    assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-scm-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,175 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-scm-m.h"
+#include "smx-m-scm.h"
+#include "ov-cx-sparse.h"
+
+// sparse complex matrix by matrix ops.
+
+DEFBINOP_OP (add, sparse_complex_matrix, matrix, +)
+DEFBINOP_OP (sub, sparse_complex_matrix, matrix, -)
+
+DEFBINOP_OP (mul, sparse_complex_matrix, matrix, *)
+
+DEFBINOP (div, sparse_complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (v1.complex_matrix_value (),
+                            v2.matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, sparse_complex_matrix, matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, sparse_complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      Complex d = v1.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v2.array_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+
+      ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (),
+                                    v2.matrix_value (), typ);
+
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_complex_matrix, matrix, mx_el_lt)
+DEFBINOP_FN (le, sparse_complex_matrix, matrix, mx_el_le)
+DEFBINOP_FN (eq, sparse_complex_matrix, matrix, mx_el_eq)
+DEFBINOP_FN (ge, sparse_complex_matrix, matrix, mx_el_ge)
+DEFBINOP_FN (gt, sparse_complex_matrix, matrix, mx_el_gt)
+DEFBINOP_FN (ne, sparse_complex_matrix, matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, sparse_complex_matrix, matrix, product)
+DEFBINOP_FN (el_div, sparse_complex_matrix, matrix, quotient)
+
+DEFBINOP (el_pow, sparse_complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_matrix&);
+
+  return octave_value
+    (elem_xpow (v1.sparse_complex_matrix_value (), SparseMatrix
+                (v2.matrix_value ())));
+}
+
+DEFBINOP (el_ldiv, sparse_complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_matrix&);
+
+  return octave_value
+    (quotient (v2.matrix_value (), v1.sparse_complex_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_complex_matrix, matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_complex_matrix, matrix, mx_el_or)
+
+DEFCATOP (scm_m, sparse_complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_matrix&);
+  SparseMatrix tmp (v2.matrix_value ());
+  return octave_value
+    (v1.sparse_complex_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFASSIGNOP (assign, sparse_complex_matrix, matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_matrix&);
+
+  SparseComplexMatrix tmp (v2.complex_matrix_value ());
+  v1.assign (idx, tmp);
+  return octave_value ();
+}
+
+void
+install_scm_m_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_matrix, add);
+  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_matrix, mul);
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_matrix, div);
+  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_matrix, lt);
+  INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_matrix, le);
+  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_matrix,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_matrix,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_matrix,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_matrix,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_sparse_complex_matrix, octave_matrix, scm_m);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_matrix,
+                    assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-scm-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,189 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-cx-mat.h"
+#include "ov-scalar.h"
+#include "ops.h"
+#include "xpow.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-scm-s.h"
+#include "smx-s-scm.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+
+// sparse complex matrix by scalar ops.
+
+DEFBINOP_OP (add, sparse_complex_matrix, scalar, +)
+DEFBINOP_OP (sub, sparse_complex_matrix, scalar, -)
+DEFBINOP_OP (mul, sparse_complex_matrix, scalar, *)
+
+DEFBINOP (div, sparse_complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_scalar&);
+
+  double d = v2.double_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v1.sparse_complex_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP (pow, sparse_complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_scalar&);
+
+  double tmp = v2.scalar_value ();
+  if (static_cast<int> (tmp) == tmp)
+    return xpow (v1.sparse_complex_matrix_value (), tmp);
+  else
+    return xpow (v1.complex_matrix_value (), tmp);
+}
+
+DEFBINOP (ldiv, sparse_complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      Complex d = v1.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (SparseComplexMatrix (1, 1, v2.scalar_value () / d));
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+      SparseComplexMatrix m1 = v1.sparse_complex_matrix_value ();
+      Matrix m2 = Matrix (1, 1, v2.scalar_value ());
+      ComplexMatrix ret = xleftdiv (m1, m2, typ);
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_complex_matrix, scalar, mx_el_lt)
+DEFBINOP_FN (le, sparse_complex_matrix, scalar, mx_el_le)
+DEFBINOP_FN (eq, sparse_complex_matrix, scalar, mx_el_eq)
+DEFBINOP_FN (ge, sparse_complex_matrix, scalar, mx_el_ge)
+DEFBINOP_FN (gt, sparse_complex_matrix, scalar, mx_el_gt)
+DEFBINOP_FN (ne, sparse_complex_matrix, scalar, mx_el_ne)
+
+DEFBINOP_OP (el_mul, sparse_complex_matrix, scalar, *)
+
+DEFBINOP (el_div, sparse_complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_scalar&);
+
+  double d = v2.double_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v1.sparse_complex_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (el_pow, sparse_complex_matrix, scalar, elem_xpow)
+
+DEFBINOP (el_ldiv, sparse_complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&);
+
+  return octave_value
+    (x_el_div (v2.double_value (), v1.sparse_complex_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_complex_matrix, scalar, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_complex_matrix, scalar, mx_el_or)
+
+DEFCATOP (scm_s, sparse_complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_scalar&);
+  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
+  return octave_value
+    (v1.sparse_complex_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFASSIGNOP (assign, sparse_complex_matrix, scalar)
+{
+  CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_scalar&);
+
+  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
+  v1.assign (idx, tmp);
+  return octave_value ();
+}
+
+void
+install_scm_s_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_scalar, add);
+  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_scalar, mul);
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_scalar, div);
+  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_scalar, ldiv);
+  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_scalar, lt);
+  INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_scalar, le);
+  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_scalar,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_scalar,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_scalar,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_scalar,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_scalar,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_scalar,
+                 el_or);
+
+  INSTALL_CATOP (octave_sparse_complex_matrix, octave_scalar, scm_s);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_scalar,
+                    assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-scm-scm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,248 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+
+#include "sparse-xdiv.h"
+#include "sparse-xpow.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+// unary sparse complex matrix ops.
+
+DEFUNOP_OP (not, sparse_complex_matrix, !)
+DEFUNOP_OP (uplus, sparse_complex_matrix, /* no-op */)
+DEFUNOP_OP (uminus, sparse_complex_matrix, -)
+
+DEFUNOP (transpose, sparse_complex_matrix)
+{
+  CAST_UNOP_ARG (const octave_sparse_complex_matrix&);
+  return octave_value
+    (v.sparse_complex_matrix_value ().transpose (),
+     v.matrix_type ().transpose ());
+}
+
+DEFUNOP (hermitian, sparse_complex_matrix)
+{
+  CAST_UNOP_ARG (const octave_sparse_complex_matrix&);
+  return octave_value
+    (v.sparse_complex_matrix_value ().hermitian (),
+     v.matrix_type ().transpose ());
+}
+
+#if 0
+DEFUNOP (incr, sparse_complex_matrix)
+{
+  CAST_UNOP_ARG (const octave_sparse_complex_matrix&);
+
+  return octave_value (v.complex_matrix_value () .increment ());
+}
+
+DEFUNOP (decr, sparse_complex_matrix)
+{
+  CAST_UNOP_ARG (const octave_sparse_complex_matrix&);
+
+  return octave_value (v.complex_matrix_value () .decrement ());
+}
+#endif
+
+// complex matrix by complex matrix ops.
+
+DEFBINOP_OP (add, sparse_complex_matrix, sparse_complex_matrix, +)
+DEFBINOP_OP (sub, sparse_complex_matrix, sparse_complex_matrix, -)
+
+DEFBINOP_OP (mul, sparse_complex_matrix, sparse_complex_matrix, *)
+
+DEFBINOP (div, sparse_complex_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      Complex d = v2.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.sparse_complex_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (),
+                                      v2.sparse_complex_matrix_value (), typ);
+
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOPX (pow, sparse_complex_matrix, sparse_complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, sparse_complex_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      Complex d = v1.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v2.sparse_complex_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+
+      SparseComplexMatrix ret =
+        xleftdiv (v1.sparse_complex_matrix_value (),
+                  v2.sparse_complex_matrix_value (), typ);
+
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_complex_matrix, sparse_complex_matrix, mx_el_lt)
+DEFBINOP_FN (le, sparse_complex_matrix, sparse_complex_matrix, mx_el_le)
+DEFBINOP_FN (eq, sparse_complex_matrix, sparse_complex_matrix, mx_el_eq)
+DEFBINOP_FN (ge, sparse_complex_matrix, sparse_complex_matrix, mx_el_ge)
+DEFBINOP_FN (gt, sparse_complex_matrix, sparse_complex_matrix, mx_el_gt)
+DEFBINOP_FN (ne, sparse_complex_matrix, sparse_complex_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, sparse_complex_matrix, sparse_complex_matrix, product)
+DEFBINOP_FN (el_div, sparse_complex_matrix, sparse_complex_matrix, quotient)
+DEFBINOP_FN (el_pow, sparse_complex_matrix, sparse_complex_matrix, elem_xpow)
+
+DEFBINOP (el_ldiv, sparse_complex_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  return octave_value (quotient (v2.sparse_complex_matrix_value (),
+                                 v1.sparse_complex_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_complex_matrix, sparse_complex_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_complex_matrix, sparse_complex_matrix, mx_el_or)
+
+DEFCATOP_FN (scm_scm, sparse_complex_matrix, sparse_complex_matrix, concat)
+
+DEFASSIGNOP_FN (assign, sparse_complex_matrix, sparse_complex_matrix, assign)
+
+DEFNULLASSIGNOP_FN (null_assign, sparse_complex_matrix, delete_elements)
+
+void
+install_scm_scm_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_sparse_complex_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_sparse_complex_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_sparse_complex_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_sparse_complex_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_sparse_complex_matrix, hermitian);
+
+#if 0
+  INSTALL_NCUNOP (op_incr, octave_sparse_complex_matrix, incr);
+  INSTALL_NCUNOP (op_decr, octave_sparse_complex_matrix, decr);
+#endif
+
+  INSTALL_BINOP (op_add, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_sparse_complex_matrix,
+                 octave_sparse_complex_matrix, scm_scm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
+                    octave_sparse_complex_matrix, assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
+                    octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
+                    octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
+                    octave_null_sq_str, null_assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-scm-sm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,174 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+#include "sparse-xdiv.h"
+#include "sparse-xpow.h"
+#include "smx-sm-scm.h"
+#include "smx-scm-sm.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+
+// sparse complex matrix by sparse matrix ops.
+
+DEFBINOP_OP (add, sparse_complex_matrix, sparse_matrix, +)
+DEFBINOP_OP (sub, sparse_complex_matrix, sparse_matrix, -)
+
+DEFBINOP_OP (mul, sparse_complex_matrix, sparse_matrix, *)
+
+DEFBINOP (div, sparse_complex_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.sparse_complex_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (),
+                                      v2.sparse_matrix_value (), typ);
+
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOPX (pow, sparse_complex_matrix, sparse_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, sparse_complex_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      Complex d = v1.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v2.sparse_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+
+      SparseComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (),
+                                          v2.sparse_matrix_value (), typ);
+
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_complex_matrix, sparse_matrix, mx_el_lt)
+DEFBINOP_FN (le, sparse_complex_matrix, sparse_matrix, mx_el_le)
+DEFBINOP_FN (eq, sparse_complex_matrix, sparse_matrix, mx_el_eq)
+DEFBINOP_FN (ge, sparse_complex_matrix, sparse_matrix, mx_el_ge)
+DEFBINOP_FN (gt, sparse_complex_matrix, sparse_matrix, mx_el_gt)
+DEFBINOP_FN (ne, sparse_complex_matrix, sparse_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, sparse_complex_matrix, sparse_matrix, product)
+DEFBINOP_FN (el_div, sparse_complex_matrix, sparse_matrix, quotient)
+DEFBINOP_FN (el_pow, sparse_complex_matrix, sparse_matrix, elem_xpow)
+
+DEFBINOP (el_ldiv, sparse_complex_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
+                   const octave_sparse_matrix&);
+
+  return octave_value
+    (quotient (v2.sparse_matrix_value (), v1.sparse_complex_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_complex_matrix, sparse_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_complex_matrix, sparse_matrix, mx_el_or)
+
+DEFCATOP_FN (scm_sm, sparse_complex_matrix, sparse_matrix, concat)
+
+DEFASSIGNOP_FN (assign, sparse_complex_matrix, sparse_matrix, assign)
+
+void
+install_scm_sm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 add);
+  INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 sub);
+  INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 mul);
+  INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 div);
+  INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 ldiv);
+  INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 lt);
+  INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 le);
+  INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 eq);
+  INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 ge);
+  INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 gt);
+  INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_sparse_matrix,
+                 ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix,
+                 octave_sparse_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix,
+                 octave_sparse_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix,
+                 octave_sparse_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix,
+                 octave_sparse_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix,
+                 octave_sparse_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix,
+                 octave_sparse_matrix, el_or);
+
+  INSTALL_CATOP (octave_sparse_complex_matrix, octave_sparse_matrix, scm_sm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
+                    octave_sparse_matrix, assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sm-cm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,173 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-cx-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-sm-cm.h"
+#include "smx-cm-sm.h"
+#include "ov-re-sparse.h"
+
+// sparse matrix by complex matrix ops.
+
+DEFBINOP_OP (add, sparse_matrix, complex_matrix, +)
+DEFBINOP_OP (sub, sparse_matrix, complex_matrix, -)
+
+DEFBINOP_OP (mul, sparse_matrix, complex_matrix, *)
+
+DEFBINOP (div, sparse_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&,
+                   const octave_complex_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  ComplexMatrix ret = xdiv (v1.matrix_value (),
+                            v2.complex_matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, sparse_matrix, complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, sparse_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      double d = v1.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v2.complex_array_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+
+      ComplexMatrix ret = xleftdiv (v1.sparse_matrix_value (),
+                                    v2.complex_matrix_value (), typ);
+
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_matrix, complex_matrix, mx_el_lt)
+DEFBINOP_FN (le, sparse_matrix, complex_matrix, mx_el_le)
+DEFBINOP_FN (eq, sparse_matrix, complex_matrix, mx_el_eq)
+DEFBINOP_FN (ge, sparse_matrix, complex_matrix, mx_el_ge)
+DEFBINOP_FN (gt, sparse_matrix, complex_matrix, mx_el_gt)
+DEFBINOP_FN (ne, sparse_matrix, complex_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, sparse_matrix, complex_matrix, product)
+DEFBINOP_FN (el_div, sparse_matrix, complex_matrix, quotient)
+
+DEFBINOP (el_pow, sparse_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&,
+                   const octave_complex_matrix&);
+
+  return octave_value
+    (elem_xpow (v1.sparse_matrix_value (), SparseComplexMatrix
+                (v2.complex_matrix_value ())));
+}
+
+DEFBINOP (el_ldiv, sparse_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&,
+                   const octave_complex_matrix&);
+
+  return octave_value
+    (quotient (v2.complex_matrix_value (), v1.sparse_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_matrix, complex_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_matrix, complex_matrix, mx_el_or)
+
+DEFCATOP (sm_cm, sparse_matrix, complex_matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_complex_matrix&);
+  SparseComplexMatrix tmp (v2.complex_matrix_value ());
+  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFCONV (sparse_complex_matrix_conv, sparse_matrix, sparse_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_sparse_matrix&);
+  return new octave_complex_matrix (v.complex_matrix_value ());
+}
+
+void
+install_sm_cm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_complex_matrix, add);
+  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_complex_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_complex_matrix, mul);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_complex_matrix, div);
+  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_complex_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_complex_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_complex_matrix, lt);
+  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_complex_matrix, le);
+  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_complex_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_complex_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_complex_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_complex_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_complex_matrix,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_complex_matrix,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_complex_matrix,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_complex_matrix,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_complex_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_complex_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_sparse_matrix, octave_complex_matrix, sm_cm);
+
+  INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_complex_matrix,
+                      octave_sparse_complex_matrix);
+
+  INSTALL_WIDENOP (octave_sparse_matrix, octave_complex_matrix,
+                   sparse_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sm-cs.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,165 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-complex.h"
+#include "ops.h"
+#include "xpow.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+#include "smx-sm-cs.h"
+#include "smx-cs-sm.h"
+
+// sparse matrix by scalar ops.
+
+DEFBINOP_OP (add, sparse_matrix, complex, +)
+DEFBINOP_OP (sub, sparse_matrix, complex, -)
+DEFBINOP_OP (mul, sparse_matrix, complex, *)
+
+DEFBINOP (div, sparse_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v1.sparse_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP (pow, sparse_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
+  return xpow (v1.matrix_value (), v2.complex_value ());
+}
+
+DEFBINOP (ldiv, sparse_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      double d = v1.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (SparseComplexMatrix (1, 1, v2.complex_value () / d));
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+      SparseMatrix m1 = v1.sparse_matrix_value ();
+      ComplexMatrix m2 = ComplexMatrix (1, 1, v2.complex_value ());
+      ComplexMatrix ret = xleftdiv (m1, m2, typ);
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_matrix, complex, mx_el_lt)
+DEFBINOP_FN (le, sparse_matrix, complex, mx_el_le)
+DEFBINOP_FN (eq, sparse_matrix, complex, mx_el_eq)
+DEFBINOP_FN (ge, sparse_matrix, complex, mx_el_ge)
+DEFBINOP_FN (gt, sparse_matrix, complex, mx_el_gt)
+DEFBINOP_FN (ne, sparse_matrix, complex, mx_el_ne)
+
+DEFBINOP_OP (el_mul, sparse_matrix, complex, *)
+
+DEFBINOP (el_div, sparse_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
+
+  Complex d = v2.complex_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v1.sparse_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (el_pow, sparse_matrix, complex, elem_xpow)
+
+DEFBINOP (el_ldiv, sparse_matrix, complex)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&);
+
+  return octave_value (x_el_div (v2.complex_value (),
+                                 v1.sparse_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_matrix, complex, mx_el_and)
+DEFBINOP_FN (el_or, sparse_matrix, complex, mx_el_or)
+
+DEFCATOP (sm_cs, sparse_matrix, complex)
+{
+  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_complex&);
+  SparseComplexMatrix tmp (1, 1, v2.complex_value ());
+  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
+}
+
+void
+install_sm_cs_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_complex, add);
+  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_complex, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_complex, mul);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_complex, div);
+  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_complex, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_complex, ldiv);
+
+  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_complex, lt);
+  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_complex, le);
+  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_complex, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_complex, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_complex, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_complex, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_complex, el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_complex, el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_complex, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_complex, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_complex, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_complex, el_or);
+
+  INSTALL_CATOP (octave_sparse_matrix, octave_complex, sm_cs);
+
+  INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_complex,
+                      octave_sparse_complex_matrix);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sm-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,165 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-re-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "smx-sm-m.h"
+#include "smx-m-sm.h"
+#include "ov-re-sparse.h"
+
+// sparse matrix by matrix ops.
+
+DEFBINOP_OP (add, sparse_matrix, matrix, +)
+DEFBINOP_OP (sub, sparse_matrix, matrix, -)
+
+DEFBINOP_OP (mul, sparse_matrix, matrix, *)
+
+DEFBINOP (div, sparse_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
+  MatrixType typ = v2.matrix_type ();
+
+  Matrix ret = xdiv (v1.matrix_value (), v2.matrix_value (), typ);
+
+  v2.matrix_type (typ);
+  return ret;
+}
+
+DEFBINOPX (pow, sparse_matrix, matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, sparse_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      double d = v1.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v2.array_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+
+      Matrix ret = xleftdiv (v1.sparse_matrix_value (),
+                             v2.matrix_value (), typ);
+
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (trans_mul, sparse_matrix, matrix, trans_mul);
+
+DEFBINOP_FN (lt, sparse_matrix, matrix, mx_el_lt)
+DEFBINOP_FN (le, sparse_matrix, matrix, mx_el_le)
+DEFBINOP_FN (eq, sparse_matrix, matrix, mx_el_eq)
+DEFBINOP_FN (ge, sparse_matrix, matrix, mx_el_ge)
+DEFBINOP_FN (gt, sparse_matrix, matrix, mx_el_gt)
+DEFBINOP_FN (ne, sparse_matrix, matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, sparse_matrix, matrix, product)
+DEFBINOP_FN (el_div, sparse_matrix, matrix, quotient)
+
+DEFBINOP (el_pow, sparse_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
+
+  return octave_value (elem_xpow (v1.sparse_matrix_value (),
+                                  SparseMatrix (v2.matrix_value ())));
+}
+
+DEFBINOP (el_ldiv, sparse_matrix, matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&);
+
+  return octave_value
+    (quotient (v2.matrix_value (), v1.sparse_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_matrix, matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_matrix, matrix, mx_el_or)
+
+DEFCATOP (sm_m, sparse_matrix, matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_matrix&);
+  SparseMatrix tmp (v2.matrix_value ());
+  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFASSIGNOP (assign, sparse_matrix, matrix)
+{
+  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_matrix&);
+
+  SparseMatrix tmp (v2.matrix_value ());
+  v1.assign (idx, tmp);
+  return octave_value ();
+}
+
+void
+install_sm_m_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_matrix, add);
+  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_matrix, mul);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_matrix, div);
+  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_matrix, ldiv);
+  INSTALL_BINOP (op_trans_mul, octave_sparse_matrix, octave_matrix, trans_mul);
+  INSTALL_BINOP (op_herm_mul, octave_sparse_matrix, octave_matrix, trans_mul);
+  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_matrix, lt);
+  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_matrix, le);
+  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_matrix,  el_or);
+
+  INSTALL_CATOP (octave_sparse_matrix, octave_matrix, sm_m);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_matrix, assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sm-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,175 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-scalar.h"
+#include "ops.h"
+#include "xpow.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "ov-re-sparse.h"
+
+// sparse matrix by scalar ops.
+
+DEFBINOP_OP (add, sparse_matrix, scalar, +)
+DEFBINOP_OP (sub, sparse_matrix, scalar, -)
+DEFBINOP_OP (mul, sparse_matrix, scalar, *)
+
+DEFBINOP (div, sparse_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
+
+  double d = v2.double_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v1.sparse_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP (pow, sparse_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
+
+  double tmp = v2.scalar_value ();
+  if (static_cast<int> (tmp) == tmp)
+    return xpow (v1.sparse_matrix_value (), tmp);
+  else
+    return xpow (v1.matrix_value (), tmp);
+}
+
+DEFBINOP (ldiv, sparse_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      double d = v1.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (SparseMatrix(1, 1, v2.scalar_value () / d));
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+      SparseMatrix m1 = v1.sparse_matrix_value ();
+      Matrix m2 = Matrix (1, 1, v2.scalar_value ());
+      Matrix ret = xleftdiv (m1, m2, typ);
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_matrix, scalar, mx_el_lt)
+DEFBINOP_FN (le, sparse_matrix, scalar, mx_el_le)
+DEFBINOP_FN (eq, sparse_matrix, scalar, mx_el_eq)
+DEFBINOP_FN (ge, sparse_matrix, scalar, mx_el_ge)
+DEFBINOP_FN (gt, sparse_matrix, scalar, mx_el_gt)
+DEFBINOP_FN (ne, sparse_matrix, scalar, mx_el_ne)
+
+DEFBINOP_OP (el_mul, sparse_matrix, scalar, *)
+
+DEFBINOP (el_div, sparse_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
+
+  double d = v2.double_value ();
+  octave_value retval;
+
+  if (d == 0.0)
+    gripe_divide_by_zero ();
+
+  retval = octave_value (v1.sparse_matrix_value () / d);
+
+  return retval;
+}
+
+DEFBINOP_FN (el_pow, sparse_matrix, scalar, elem_xpow)
+
+DEFBINOP (el_ldiv, sparse_matrix, scalar)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&);
+
+  return octave_value
+    (x_el_div (v2.complex_value (), v1.sparse_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_matrix, scalar, mx_el_and)
+DEFBINOP_FN (el_or, sparse_matrix, scalar, mx_el_or)
+
+DEFCATOP (sm_s, sparse_matrix, scalar)
+{
+  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_scalar&);
+  SparseMatrix tmp (1, 1, v2.scalar_value ());
+  return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx));
+}
+
+DEFASSIGNOP (assign, sparse_matrix, scalar)
+{
+  CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_scalar&);
+
+  SparseMatrix tmp (1, 1, v2.scalar_value ());
+  v1.assign (idx, tmp);
+  return octave_value ();
+}
+
+void
+install_sm_s_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_scalar, add);
+  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_scalar, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_scalar, mul);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_scalar, div);
+  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_scalar, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_scalar, ldiv);
+
+  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_scalar, lt);
+  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_scalar, le);
+  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_scalar, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_scalar, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_scalar, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_scalar, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_scalar, el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_scalar, el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_scalar, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_scalar, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_scalar, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_scalar, el_or);
+
+  INSTALL_CATOP (octave_sparse_matrix, octave_scalar, sm_s);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_scalar, assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sm-scm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,182 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+#include "sparse-xdiv.h"
+#include "sparse-xpow.h"
+#include "smx-sm-scm.h"
+#include "smx-scm-sm.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+
+// sparse matrix by sparse complex matrix ops.
+
+DEFBINOP_OP (add, sparse_matrix, sparse_complex_matrix, +)
+DEFBINOP_OP (sub, sparse_matrix, sparse_complex_matrix, -)
+
+DEFBINOP_OP (mul, sparse_matrix, sparse_complex_matrix, *)
+
+DEFBINOP (div, sparse_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      Complex d = v2.complex_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.sparse_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      SparseComplexMatrix ret = xdiv (v1.sparse_matrix_value (),
+                                  v2.sparse_complex_matrix_value (), typ);
+
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOPX (pow, sparse_matrix, sparse_complex_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, sparse_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      double d = v1.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v2.sparse_complex_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+
+      SparseComplexMatrix ret =
+        xleftdiv (v1.sparse_matrix_value (),
+                  v2.sparse_complex_matrix_value (), typ);
+
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_matrix, sparse_complex_matrix, mx_el_lt)
+DEFBINOP_FN (le, sparse_matrix, sparse_complex_matrix, mx_el_le)
+DEFBINOP_FN (eq, sparse_matrix, sparse_complex_matrix, mx_el_eq)
+DEFBINOP_FN (ge, sparse_matrix, sparse_complex_matrix, mx_el_ge)
+DEFBINOP_FN (gt, sparse_matrix, sparse_complex_matrix, mx_el_gt)
+DEFBINOP_FN (ne, sparse_matrix, sparse_complex_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, sparse_matrix, sparse_complex_matrix, product)
+DEFBINOP_FN (el_div, sparse_matrix, sparse_complex_matrix, quotient)
+DEFBINOP_FN (el_pow, sparse_matrix, sparse_complex_matrix, elem_xpow)
+
+DEFBINOP (el_ldiv, sparse_matrix, sparse_complex_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&,
+                   const octave_sparse_complex_matrix&);
+
+  return octave_value
+    (quotient (v2.sparse_complex_matrix_value (), v1.sparse_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_matrix, sparse_complex_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_matrix, sparse_complex_matrix, mx_el_or)
+
+DEFCATOP_FN (sm_scm, sparse_matrix, sparse_complex_matrix, concat)
+
+DEFCONV (sparse_complex_matrix_conv, sparse_matrix, sparse_complex_matrix)
+{
+  CAST_CONV_ARG (const octave_sparse_matrix&);
+  return new octave_sparse_complex_matrix (v.sparse_complex_matrix_value ());
+}
+
+void
+install_sm_scm_ops (void)
+{
+  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 add);
+  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 sub);
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 mul);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 div);
+  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 ldiv);
+  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 lt);
+  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 le);
+  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 eq);
+  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 ge);
+  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 gt);
+  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_complex_matrix,
+                 ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_matrix,
+                 octave_sparse_complex_matrix, el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_matrix,
+                 octave_sparse_complex_matrix, el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_matrix,
+                 octave_sparse_complex_matrix, el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix,
+                 octave_sparse_complex_matrix, el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_matrix,
+                 octave_sparse_complex_matrix, el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_matrix,
+                 octave_sparse_complex_matrix, el_or);
+
+  INSTALL_CATOP (octave_sparse_matrix, octave_sparse_complex_matrix, sm_scm);
+
+  INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_sparse_complex_matrix,
+                      octave_sparse_complex_matrix);
+
+  INSTALL_WIDENOP (octave_sparse_matrix, octave_sparse_complex_matrix,
+                   sparse_complex_matrix_conv);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-sm-sm.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,196 @@
+/*
+
+Copyright (C) 2004-2012 David Bateman
+Copyright (C) 1998-2004 Andy Adler
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-typeinfo.h"
+#include "ov-re-mat.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+
+#include "sparse-xpow.h"
+#include "sparse-xdiv.h"
+#include "ov-re-sparse.h"
+
+// sparse matrix unary ops.
+
+DEFUNOP_OP (not, sparse_matrix, !)
+DEFUNOP_OP (uplus, sparse_matrix, /* no-op */)
+DEFUNOP_OP (uminus, sparse_matrix, -)
+
+DEFUNOP (transpose, sparse_matrix)
+{
+  CAST_UNOP_ARG (const octave_sparse_matrix&);
+  return octave_value (v.sparse_matrix_value ().transpose (),
+                       v.matrix_type ().transpose ());
+}
+
+// sparse matrix by sparse matrix ops.
+
+DEFBINOP_OP (add, sparse_matrix, sparse_matrix, +)
+
+// DEFBINOP_OP (sub, sparse_matrix, sparse_matrix, -)
+
+  static octave_value
+  oct_binop_sub (const octave_base_value& a1, const octave_base_value& a2)
+  {
+    const octave_sparse_matrix& v1 = dynamic_cast<const octave_sparse_matrix&> (a1);
+    const octave_sparse_matrix& v2 = dynamic_cast<const octave_sparse_matrix&> (a2);
+    SparseMatrix m = v1.sparse_matrix_value () - v2.sparse_matrix_value ();
+
+    return octave_value (m);
+  }
+
+DEFBINOP_OP (mul, sparse_matrix, sparse_matrix, *)
+
+DEFBINOP (div, sparse_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
+
+  if (v2.rows () == 1 && v2.columns () == 1)
+    {
+      double d = v2.scalar_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v1.sparse_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v2.matrix_type ();
+      SparseMatrix ret = xdiv (v1.sparse_matrix_value (),
+                               v2.sparse_matrix_value (), typ);
+
+      v2.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOPX (pow, sparse_matrix, sparse_matrix)
+{
+  error ("can't do A ^ B for A and B both matrices");
+  return octave_value ();
+}
+
+DEFBINOP (ldiv, sparse_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
+
+  if (v1.rows () == 1 && v1.columns () == 1)
+    {
+      double d = v1.double_value ();
+
+      if (d == 0.0)
+        gripe_divide_by_zero ();
+
+      return octave_value (v2.sparse_matrix_value () / d);
+    }
+  else
+    {
+      MatrixType typ = v1.matrix_type ();
+
+      SparseMatrix ret = xleftdiv (v1.sparse_matrix_value (),
+                                   v2.sparse_matrix_value (), typ);
+
+      v1.matrix_type (typ);
+      return ret;
+    }
+}
+
+DEFBINOP_FN (lt, sparse_matrix, sparse_matrix, mx_el_lt)
+DEFBINOP_FN (le, sparse_matrix, sparse_matrix, mx_el_le)
+DEFBINOP_FN (eq, sparse_matrix, sparse_matrix, mx_el_eq)
+DEFBINOP_FN (ge, sparse_matrix, sparse_matrix, mx_el_ge)
+DEFBINOP_FN (gt, sparse_matrix, sparse_matrix, mx_el_gt)
+DEFBINOP_FN (ne, sparse_matrix, sparse_matrix, mx_el_ne)
+
+DEFBINOP_FN (el_mul, sparse_matrix, sparse_matrix, product)
+DEFBINOP_FN (el_div, sparse_matrix, sparse_matrix, quotient)
+
+DEFBINOP_FN (el_pow, sparse_matrix, sparse_matrix, elem_xpow)
+
+DEFBINOP (el_ldiv, sparse_matrix, sparse_matrix)
+{
+  CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&);
+  return octave_value
+    (quotient (v2.sparse_matrix_value (), v1.sparse_matrix_value ()));
+}
+
+DEFBINOP_FN (el_and, sparse_matrix, sparse_matrix, mx_el_and)
+DEFBINOP_FN (el_or,  sparse_matrix, sparse_matrix, mx_el_or)
+
+DEFCATOP_FN (sm_sm, sparse_matrix, sparse_matrix, concat)
+
+DEFASSIGNOP_FN (assign, sparse_matrix, sparse_matrix, assign)
+
+DEFNULLASSIGNOP_FN (null_assign, sparse_matrix, delete_elements)
+
+void
+install_sm_sm_ops (void)
+{
+  INSTALL_UNOP (op_not, octave_sparse_matrix, not);
+  INSTALL_UNOP (op_uplus, octave_sparse_matrix, uplus);
+  INSTALL_UNOP (op_uminus, octave_sparse_matrix, uminus);
+  INSTALL_UNOP (op_transpose, octave_sparse_matrix, transpose);
+  INSTALL_UNOP (op_hermitian, octave_sparse_matrix, transpose);
+
+  INSTALL_BINOP (op_add, octave_sparse_matrix, octave_sparse_matrix, add);
+  INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_sparse_matrix, sub);
+  INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_sparse_matrix, mul);
+  INSTALL_BINOP (op_div, octave_sparse_matrix, octave_sparse_matrix, div);
+  INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_sparse_matrix, pow);
+  INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_sparse_matrix, ldiv);
+  INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_sparse_matrix, lt);
+  INSTALL_BINOP (op_le, octave_sparse_matrix, octave_sparse_matrix, le);
+  INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_sparse_matrix, eq);
+  INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_matrix, ge);
+  INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_matrix, gt);
+  INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_matrix, ne);
+  INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_sparse_matrix,
+                 el_mul);
+  INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_sparse_matrix,
+                 el_div);
+  INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_sparse_matrix,
+                 el_pow);
+  INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_sparse_matrix,
+                 el_ldiv);
+  INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_sparse_matrix,
+                 el_and);
+  INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_sparse_matrix,
+                 el_or);
+
+  INSTALL_CATOP (octave_sparse_matrix, octave_sparse_matrix, sm_sm);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_sparse_matrix,
+                    assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_null_sq_str, null_assign);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-str-m.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,64 @@
+/*
+
+Copyright (C) 2003-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-str-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+DEFASSIGNOP (assign, char_matrix_str, octave_matrix)
+{
+  CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_matrix&);
+
+  octave_value tmp
+    = v2.convert_to_str_internal (false, false,
+                                  a1.is_sq_string () ? '\'' : '"');
+
+  if (! error_state)
+    v1.assign (idx, tmp.char_array_value ());
+
+  return octave_value ();
+}
+
+DEFNDCHARCATOP_FN (str_m, char_matrix_str, matrix, concat)
+
+DEFNDCHARCATOP_FN (m_str, matrix, char_matrix_str, concat)
+
+void
+install_str_m_ops (void)
+{
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_matrix, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_matrix, assign);
+
+  INSTALL_CATOP (octave_char_matrix_str, octave_matrix, str_m);
+  INSTALL_CATOP (octave_char_matrix_sq_str, octave_matrix, str_m);
+
+  INSTALL_CATOP (octave_matrix, octave_char_matrix_str, m_str);
+  INSTALL_CATOP (octave_matrix, octave_char_matrix_sq_str, m_str);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-str-s.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,64 @@
+/*
+
+Copyright (C) 2003-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-scalar.h"
+#include "ov-str-mat.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+DEFASSIGNOP (assign, char_matrix_str, octave_scalar)
+{
+  CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_scalar&);
+
+  octave_value tmp
+    = v2.convert_to_str_internal (false, false,
+                                  a1.is_sq_string () ? '\'' : '"');
+
+  if (! error_state)
+    v1.assign (idx, tmp.char_array_value ());
+
+  return octave_value ();
+}
+
+DEFNDCHARCATOP_FN (str_s, char_matrix_str, scalar, concat)
+
+DEFNDCHARCATOP_FN (s_str, scalar, char_matrix_str, concat)
+
+void
+install_str_s_ops (void)
+{
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_scalar, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_scalar, assign);
+
+  INSTALL_CATOP (octave_char_matrix_str, octave_scalar, str_s);
+  INSTALL_CATOP (octave_char_matrix_sq_str, octave_scalar, str_s);
+
+  INSTALL_CATOP (octave_scalar, octave_char_matrix_str, s_str);
+  INSTALL_CATOP (octave_scalar, octave_char_matrix_sq_str, s_str);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-str-str.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,155 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-str-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+
+// string unary ops.
+
+DEFUNOP (transpose, char_matrix_str)
+{
+  CAST_UNOP_ARG (const octave_char_matrix_str&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.char_matrix_value ().transpose (),
+                         a.is_sq_string () ? '\'' : '"');
+}
+
+// string by string ops.
+
+#define DEFCHARNDBINOP_FN(name, op, t1, t2, e1, e2, f)  \
+  BINOPDECL (name, a1, a2) \
+  { \
+    dim_vector a1_dims = a1.dims (); \
+    dim_vector a2_dims = a2.dims (); \
+ \
+    bool a1_is_scalar = a1_dims.all_ones (); \
+    bool a2_is_scalar = a2_dims.all_ones (); \
+ \
+    CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
+ \
+    if (a1_is_scalar) \
+      { \
+        if (a2_is_scalar) \
+          return octave_value ((v1.e1 ## _value ())(0) op (v2.e2 ## _value ())(0)); \
+        else \
+          return octave_value (f ((v1.e1 ## _value ())(0), v2.e2 ## _value ())); \
+      } \
+    else \
+      { \
+        if (a2_is_scalar) \
+          return octave_value (f (v1.e1 ## _value (), (v2.e2 ## _value ())(0))); \
+        else \
+          return octave_value (f (v1.e1 ## _value (), v2.e2 ## _value ())); \
+      } \
+  }
+
+DEFCHARNDBINOP_FN (lt, <, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_lt)
+DEFCHARNDBINOP_FN (le, <=, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_le)
+DEFCHARNDBINOP_FN (eq, ==, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_eq)
+DEFCHARNDBINOP_FN (ge, >=, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_ge)
+DEFCHARNDBINOP_FN (gt, >, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_gt)
+DEFCHARNDBINOP_FN (ne, !=, char_matrix_str, char_matrix_str, char_array, char_array, mx_el_ne)
+
+DEFASSIGNOP (assign, char_matrix_str, char_matrix_str)
+{
+  CAST_BINOP_ARGS (octave_char_matrix_str&, const octave_char_matrix_str&);
+
+  v1.assign (idx, v2.char_array_value ());
+  return octave_value ();
+}
+
+DEFNULLASSIGNOP_FN (null_assign, char_matrix_str, delete_elements)
+
+DEFNDCHARCATOP_FN (str_str, char_matrix_str, char_matrix_str, concat)
+
+void
+install_str_str_ops (void)
+{
+  INSTALL_UNOP (op_transpose, octave_char_matrix_str, transpose);
+  INSTALL_UNOP (op_transpose, octave_char_matrix_sq_str, transpose);
+
+  INSTALL_UNOP (op_hermitian, octave_char_matrix_str, transpose);
+  INSTALL_UNOP (op_hermitian, octave_char_matrix_sq_str, transpose);
+
+  INSTALL_BINOP (op_lt, octave_char_matrix_str, octave_char_matrix_str, lt);
+  INSTALL_BINOP (op_lt, octave_char_matrix_str, octave_char_matrix_sq_str, lt);
+  INSTALL_BINOP (op_lt, octave_char_matrix_sq_str, octave_char_matrix_str, lt);
+  INSTALL_BINOP (op_lt, octave_char_matrix_sq_str, octave_char_matrix_sq_str, lt);
+
+  INSTALL_BINOP (op_le, octave_char_matrix_str, octave_char_matrix_str, le);
+  INSTALL_BINOP (op_le, octave_char_matrix_str, octave_char_matrix_sq_str, le);
+  INSTALL_BINOP (op_le, octave_char_matrix_sq_str, octave_char_matrix_str, le);
+  INSTALL_BINOP (op_le, octave_char_matrix_sq_str, octave_char_matrix_sq_str, le);
+
+  INSTALL_BINOP (op_eq, octave_char_matrix_str, octave_char_matrix_str, eq);
+  INSTALL_BINOP (op_eq, octave_char_matrix_str, octave_char_matrix_sq_str, eq);
+  INSTALL_BINOP (op_eq, octave_char_matrix_sq_str, octave_char_matrix_str, eq);
+  INSTALL_BINOP (op_eq, octave_char_matrix_sq_str, octave_char_matrix_sq_str, eq);
+
+  INSTALL_BINOP (op_ge, octave_char_matrix_str, octave_char_matrix_str, ge);
+  INSTALL_BINOP (op_ge, octave_char_matrix_str, octave_char_matrix_sq_str, ge);
+  INSTALL_BINOP (op_ge, octave_char_matrix_sq_str, octave_char_matrix_str, ge);
+  INSTALL_BINOP (op_ge, octave_char_matrix_sq_str, octave_char_matrix_sq_str, ge);
+
+  INSTALL_BINOP (op_gt, octave_char_matrix_str, octave_char_matrix_str, gt);
+  INSTALL_BINOP (op_gt, octave_char_matrix_str, octave_char_matrix_sq_str, gt);
+  INSTALL_BINOP (op_gt, octave_char_matrix_sq_str, octave_char_matrix_str, gt);
+  INSTALL_BINOP (op_gt, octave_char_matrix_sq_str, octave_char_matrix_sq_str, gt);
+
+  INSTALL_BINOP (op_ne, octave_char_matrix_str, octave_char_matrix_str, ne);
+  INSTALL_BINOP (op_ne, octave_char_matrix_str, octave_char_matrix_sq_str, ne);
+  INSTALL_BINOP (op_ne, octave_char_matrix_sq_str, octave_char_matrix_str, ne);
+  INSTALL_BINOP (op_ne, octave_char_matrix_sq_str, octave_char_matrix_sq_str, ne);
+
+  INSTALL_CATOP (octave_char_matrix_str, octave_char_matrix_str, str_str);
+  INSTALL_CATOP (octave_char_matrix_str, octave_char_matrix_sq_str, str_str);
+  INSTALL_CATOP (octave_char_matrix_sq_str, octave_char_matrix_str, str_str);
+  INSTALL_CATOP (octave_char_matrix_sq_str, octave_char_matrix_sq_str, str_str);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_char_matrix_str, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_char_matrix_sq_str, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_char_matrix_str, assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_char_matrix_sq_str, assign);
+
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_null_sq_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_null_matrix, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_null_str, null_assign);
+  INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_sq_str, octave_null_sq_str, null_assign);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-struct.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,108 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-re-mat.h"
+#include "ov-struct.h"
+#include "ov-typeinfo.h"
+#include "ops.h"
+
+// struct ops.
+
+DEFUNOP (transpose, struct)
+{
+  CAST_UNOP_ARG (const octave_struct&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.map_value ().transpose ());
+}
+
+DEFUNOP (scalar_transpose, scalar_struct)
+{
+  CAST_UNOP_ARG (const octave_scalar_struct&);
+
+  return octave_value (v.scalar_map_value ());
+}
+
+DEFNDCATOP_FN (s_s_concat, struct, struct, map, map, concat)
+DEFNDCATOP_FN (s_ss_concat, struct, scalar_struct, map, map, concat)
+DEFNDCATOP_FN (ss_s_concat, scalar_struct, struct, map, map, concat)
+DEFNDCATOP_FN (ss_ss_concat, scalar_struct, scalar_struct, map, map, concat)
+
+static octave_value
+oct_catop_struct_matrix (octave_base_value& a1, const octave_base_value& a2,
+                         const Array<octave_idx_type>&)
+{
+  octave_value retval;
+  CAST_BINOP_ARGS (const octave_struct&, const octave_matrix&);
+  NDArray tmp = v2.array_value ();
+  dim_vector dv = tmp.dims ();
+  if (dv.all_zero ())
+    retval = octave_value (v1.map_value ());
+  else
+    error ("invalid concatenation of structure with matrix");
+  return retval;
+}
+
+static octave_value
+oct_catop_matrix_struct (octave_base_value& a1, const octave_base_value& a2,
+                         const Array<octave_idx_type>&)
+{
+  octave_value retval;
+  CAST_BINOP_ARGS (const octave_matrix&, const octave_struct&);
+  NDArray tmp = v1.array_value ();
+  dim_vector dv = tmp.dims ();
+  if (dv.all_zero ())
+    retval = octave_value (v2.map_value ());
+  else
+    error ("invalid concatenation of structure with matrix");
+  return retval;
+}
+
+void
+install_struct_ops (void)
+{
+  INSTALL_UNOP (op_transpose, octave_struct, transpose);
+  INSTALL_UNOP (op_hermitian, octave_struct, transpose);
+
+  INSTALL_UNOP (op_transpose, octave_scalar_struct, scalar_transpose);
+  INSTALL_UNOP (op_hermitian, octave_scalar_struct, scalar_transpose);
+
+  INSTALL_CATOP (octave_struct, octave_struct, s_s_concat);
+  INSTALL_CATOP (octave_struct, octave_scalar_struct, s_ss_concat)
+  INSTALL_CATOP (octave_scalar_struct, octave_struct, ss_s_concat)
+  INSTALL_CATOP (octave_scalar_struct, octave_scalar_struct, ss_ss_concat)
+
+  INSTALL_CATOP (octave_struct, octave_matrix, struct_matrix);
+  INSTALL_CATOP (octave_matrix, octave_struct, matrix_struct);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-ui16-ui16.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-ui16nda-i8.h"
+#include "mx-ui16nda-ui8.h"
+#include "mx-ui16nda-i16.h"
+#include "mx-ui16nda-i32.h"
+#include "mx-ui16nda-ui32.h"
+#include "mx-ui16nda-i64.h"
+#include "mx-ui16nda-ui64.h"
+
+#include "mx-ui16nda-i8nda.h"
+#include "mx-ui16nda-ui8nda.h"
+#include "mx-ui16nda-i16nda.h"
+#include "mx-ui16nda-i32nda.h"
+#include "mx-ui16nda-ui32nda.h"
+#include "mx-ui16nda-i64nda.h"
+#include "mx-ui16nda-ui64nda.h"
+
+#include "mx-ui16-i8nda.h"
+#include "mx-ui16-ui8nda.h"
+#include "mx-ui16-i16nda.h"
+#include "mx-ui16-i32nda.h"
+#include "mx-ui16-ui32nda.h"
+#include "mx-ui16-i64nda.h"
+#include "mx-ui16-ui64nda.h"
+
+#include "mx-ui16nda-s.h"
+#include "mx-s-ui16nda.h"
+
+#include "mx-ui16nda-nda.h"
+#include "mx-nda-ui16nda.h"
+
+#include "mx-ui16-nda.h"
+#include "mx-nda-ui16.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-int8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-uint8.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#include "op-int.h"
+
+OCTAVE_INT_OPS (uint16)
+
+OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint16_, int8_, int8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint16_, uint8_, uint8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint16_, int16_, int16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint16_, int32_, int32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint16_, uint32_, uint32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint16_, int64_, int64_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint16_, uint64_, uint64_)
+
+OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint16_, int8_, int8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint16_, uint8_, uint8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint16_, int16_, int16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint16_, int32_, int32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint16_, uint32_, uint32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint16_, int64_, int64_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint16_, uint64_, uint64_)
+
+OCTAVE_MIXED_INT_CMP_OPS (uint16, int8)
+OCTAVE_MIXED_INT_CMP_OPS (uint16, uint8)
+OCTAVE_MIXED_INT_CMP_OPS (uint16, int16)
+OCTAVE_MIXED_INT_CMP_OPS (uint16, int32)
+OCTAVE_MIXED_INT_CMP_OPS (uint16, uint32)
+OCTAVE_MIXED_INT_CMP_OPS (uint16, int64)
+OCTAVE_MIXED_INT_CMP_OPS (uint16, uint64)
+
+void
+install_ui16_ui16_ops (void)
+{
+  OCTAVE_INSTALL_INT_OPS (uint16);
+
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint16_, int8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint16_, uint8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint16_, int16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint16_, int32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint16_, uint32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint16_, int64_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint16_, uint64_);
+
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint16_, int8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint16_, uint8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint16_, int16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint16_, int32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint16_, uint32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint16_, int64_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint16_, uint64_);
+
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, int8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, uint8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, int16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, int32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, uint32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, int64);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint16, uint64);
+
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, int8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, uint8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, int16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, int32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, uint32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, int64);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint16, uint64);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-ui32-ui32.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,148 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-ui32nda-i8.h"
+#include "mx-ui32nda-ui8.h"
+#include "mx-ui32nda-i16.h"
+#include "mx-ui32nda-ui16.h"
+#include "mx-ui32nda-i32.h"
+#include "mx-ui32nda-i64.h"
+#include "mx-ui32nda-ui64.h"
+
+#include "mx-ui32nda-i8nda.h"
+#include "mx-ui32nda-ui8nda.h"
+#include "mx-ui32nda-i16nda.h"
+#include "mx-ui32nda-ui16nda.h"
+#include "mx-ui32nda-i32nda.h"
+#include "mx-ui32nda-i64nda.h"
+#include "mx-ui32nda-ui64nda.h"
+
+#include "mx-ui32-i8nda.h"
+#include "mx-ui32-ui8nda.h"
+#include "mx-ui32-i16nda.h"
+#include "mx-ui32-ui16nda.h"
+#include "mx-ui32-i32nda.h"
+#include "mx-ui32-i64nda.h"
+#include "mx-ui32-ui64nda.h"
+
+#include "mx-ui32nda-s.h"
+#include "mx-s-ui32nda.h"
+
+#include "mx-ui32nda-nda.h"
+#include "mx-nda-ui32nda.h"
+
+#include "mx-ui32-nda.h"
+#include "mx-nda-ui32.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-int8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-uint8.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#include "op-int.h"
+
+OCTAVE_INT_OPS (uint32)
+
+OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint32_, int8_, int8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint32_, uint8_, uint8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint32_, int16_, int16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint32_, uint16_, uint16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint32_, int32_, int32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint32_, int64_, int64_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint32_, uint64_, uint64_)
+
+OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint32_, int8_, int8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint32_, uint8_, uint8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint32_, int16_, int16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint32_, uint16_, uint16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint32_, int32_, int32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint32_, int64_, int64_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint32_, uint64_, uint64_)
+
+OCTAVE_MIXED_INT_CMP_OPS (uint32, int8)
+OCTAVE_MIXED_INT_CMP_OPS (uint32, uint8)
+OCTAVE_MIXED_INT_CMP_OPS (uint32, int16)
+OCTAVE_MIXED_INT_CMP_OPS (uint32, uint16)
+OCTAVE_MIXED_INT_CMP_OPS (uint32, int32)
+OCTAVE_MIXED_INT_CMP_OPS (uint32, int64)
+OCTAVE_MIXED_INT_CMP_OPS (uint32, uint64)
+void
+install_ui32_ui32_ops (void)
+{
+  OCTAVE_INSTALL_INT_OPS (uint32);
+
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint32_, int8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint32_, uint8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint32_, int16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint32_, uint16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint32_, int32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint32_, int64_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint32_, uint64_);
+
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint32_, int8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint32_, uint8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint32_, int16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint32_, uint16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint32_, int32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint32_, int64_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint32_, uint64_);
+
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, int8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, uint8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, int16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, uint16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, int32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, int64);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint32, uint64);
+
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, int8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, uint8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, int16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, uint16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, int32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, int64);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint32, uint64);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-ui64-ui64.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-ui64nda-i8.h"
+#include "mx-ui64nda-ui8.h"
+#include "mx-ui64nda-i16.h"
+#include "mx-ui64nda-ui16.h"
+#include "mx-ui64nda-i32.h"
+#include "mx-ui64nda-ui32.h"
+#include "mx-ui64nda-i64.h"
+
+#include "mx-ui64nda-i8nda.h"
+#include "mx-ui64nda-ui8nda.h"
+#include "mx-ui64nda-i16nda.h"
+#include "mx-ui64nda-ui16nda.h"
+#include "mx-ui64nda-i32nda.h"
+#include "mx-ui64nda-ui32nda.h"
+#include "mx-ui64nda-i64nda.h"
+
+#include "mx-ui64-i8nda.h"
+#include "mx-ui64-ui8nda.h"
+#include "mx-ui64-i16nda.h"
+#include "mx-ui64-ui16nda.h"
+#include "mx-ui64-i32nda.h"
+#include "mx-ui64-ui32nda.h"
+#include "mx-ui64-i64nda.h"
+
+#include "mx-ui64nda-s.h"
+#include "mx-s-ui64nda.h"
+
+#include "mx-ui64nda-nda.h"
+#include "mx-nda-ui64nda.h"
+
+#include "mx-ui64-nda.h"
+#include "mx-nda-ui64.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-int8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-uint8.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#include "op-int.h"
+
+OCTAVE_INT_OPS (uint64)
+
+OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint64_, int8_, int8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui8, uint64_, uint8_, uint8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint64_, int16_, int16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint64_, uint16_, uint16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint64_, int32_, int32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint64_, uint32_, uint32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint64_, int64_, int64_)
+
+OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint64_, int8_, int8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui8, uint64_, uint8_, uint8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint64_, int16_, int16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint64_, uint16_, uint16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint64_, int32_, int32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint64_, uint32_, uint32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint64_, int64_, int64_)
+
+OCTAVE_MIXED_INT_CMP_OPS (uint64, int8)
+OCTAVE_MIXED_INT_CMP_OPS (uint64, uint8)
+OCTAVE_MIXED_INT_CMP_OPS (uint64, int16)
+OCTAVE_MIXED_INT_CMP_OPS (uint64, uint16)
+OCTAVE_MIXED_INT_CMP_OPS (uint64, int32)
+OCTAVE_MIXED_INT_CMP_OPS (uint64, uint32)
+OCTAVE_MIXED_INT_CMP_OPS (uint64, int64)
+
+void
+install_ui64_ui64_ops (void)
+{
+  OCTAVE_INSTALL_INT_OPS (uint64);
+
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint64_, int8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint64_, uint8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint64_, int16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint64_, uint16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint64_, int32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint64_, uint32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint64_, int64_);
+
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint64_, int8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui8, uint64_, uint8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint64_, int16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint64_, uint16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint64_, int32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint64_, uint32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint64_, int64_);
+
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, int8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, uint8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, int16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, uint16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, int32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, uint32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint64, int64);
+
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, int8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, uint8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, int16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, uint16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, int32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, uint32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint64, int64);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/operators/op-ui8-ui8.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "mx-ui8nda-i8.h"
+#include "mx-ui8nda-i16.h"
+#include "mx-ui8nda-ui16.h"
+#include "mx-ui8nda-i32.h"
+#include "mx-ui8nda-ui32.h"
+#include "mx-ui8nda-i64.h"
+#include "mx-ui8nda-ui64.h"
+
+#include "mx-ui8nda-i8nda.h"
+#include "mx-ui8nda-i16nda.h"
+#include "mx-ui8nda-ui16nda.h"
+#include "mx-ui8nda-i32nda.h"
+#include "mx-ui8nda-ui32nda.h"
+#include "mx-ui8nda-i64nda.h"
+#include "mx-ui8nda-ui64nda.h"
+
+#include "mx-ui8-i8nda.h"
+#include "mx-ui8-i16nda.h"
+#include "mx-ui8-ui16nda.h"
+#include "mx-ui8-i32nda.h"
+#include "mx-ui8-ui32nda.h"
+#include "mx-ui8-i64nda.h"
+#include "mx-ui8-ui64nda.h"
+
+#include "mx-ui8nda-s.h"
+#include "mx-s-ui8nda.h"
+
+#include "mx-ui8nda-nda.h"
+#include "mx-nda-ui8nda.h"
+
+#include "mx-ui8-nda.h"
+#include "mx-nda-ui8.h"
+
+#include "gripes.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-int16.h"
+#include "ov-int32.h"
+#include "ov-int64.h"
+#include "ov-int8.h"
+#include "ov-uint16.h"
+#include "ov-uint32.h"
+#include "ov-uint64.h"
+#include "ov-uint8.h"
+#include "ov-scalar.h"
+#include "ov-float.h"
+#include "ov-complex.h"
+#include "ov-flt-complex.h"
+#include "ov-re-mat.h"
+#include "ov-flt-re-mat.h"
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-typeinfo.h"
+#include "ov-null-mat.h"
+#include "ops.h"
+#include "xdiv.h"
+#include "xpow.h"
+
+#include "op-int.h"
+
+OCTAVE_INT_OPS (uint8)
+
+OCTAVE_MS_INT_ASSIGN_OPS (mi8, uint8_, int8_, int8_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi16, uint8_, int16_, int16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui16, uint8_, uint16_, uint16_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi32, uint8_, int32_, int32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui32, uint8_, uint32_, uint32_)
+OCTAVE_MS_INT_ASSIGN_OPS (mi64, uint8_, int64_, int64_)
+OCTAVE_MS_INT_ASSIGN_OPS (mui64, uint8_, uint64_, uint64_)
+
+OCTAVE_MM_INT_ASSIGN_OPS (mmi8, uint8_, int8_, int8_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi16, uint8_, int16_, int16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui16, uint8_, uint16_, uint16_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi32, uint8_, int32_, int32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui32, uint8_, uint32_, uint32_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmi64, uint8_, int64_, int64_)
+OCTAVE_MM_INT_ASSIGN_OPS (mmui64, uint8_, uint64_, uint64_)
+
+OCTAVE_MIXED_INT_CMP_OPS (uint8, int8)
+OCTAVE_MIXED_INT_CMP_OPS (uint8, int16)
+OCTAVE_MIXED_INT_CMP_OPS (uint8, uint16)
+OCTAVE_MIXED_INT_CMP_OPS (uint8, int32)
+OCTAVE_MIXED_INT_CMP_OPS (uint8, uint32)
+OCTAVE_MIXED_INT_CMP_OPS (uint8, int64)
+OCTAVE_MIXED_INT_CMP_OPS (uint8, uint64)
+
+void
+install_ui8_ui8_ops (void)
+{
+  OCTAVE_INSTALL_INT_OPS (uint8)
+
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint8_, int8_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint8_, int16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui16, uint8_, uint16_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi32, uint8_, int32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui32, uint8_, uint32_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi64, uint8_, int64_);
+  OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui64, uint8_, uint64_);
+
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi8, uint8_, int8_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi16, uint8_, int16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui16, uint8_, uint16_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi32, uint8_, int32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui32, uint8_, uint32_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmi64, uint8_, int64_);
+  OCTAVE_INSTALL_MM_INT_ASSIGN_OPS (mmui64, uint8_, uint64_);
+
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, int8);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, int16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, uint16);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, int32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, uint32);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, int64);
+  OCTAVE_INSTALL_SM_INT_ASSIGNCONV (uint8, uint64);
+
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, int8);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, int16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, uint16);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, int32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, uint32);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, int64);
+  OCTAVE_INSTALL_MIXED_INT_CMP_OPS (uint8, uint64);
+}
--- a/src/ov-base-diag.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,506 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "mach-info.h"
-#include "lo-ieee.h"
-
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "pr-output.h"
-#include "error.h"
-#include "gripes.h"
-#include "oct-stream.h"
-#include "ops.h"
-
-#include "ls-oct-ascii.h"
-
-template <class DMT, class MT>
-octave_value
-octave_base_diag<DMT, MT>::subsref (const std::string& type,
-                                    const std::list<octave_value_list>& idx)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      retval = do_index_op (idx.front ());
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval.next_subsref (type, idx);
-}
-
-template <class DMT, class MT>
-octave_value
-octave_base_diag<DMT, MT>::do_index_op (const octave_value_list& idx,
-                                        bool resize_ok)
-{
-  octave_value retval;
-  typedef typename DMT::element_type el_type;
-
-  if (idx.length () == 2 && ! resize_ok)
-    {
-      idx_vector idx0 = idx(0).index_vector ();
-      idx_vector idx1 = idx(1).index_vector ();
-
-      if (idx0.is_scalar () && idx1.is_scalar ())
-        {
-          retval = matrix.elem (idx0(0), idx1(0));
-        }
-      else
-        {
-          octave_idx_type m = idx0.length (matrix.rows ());
-          octave_idx_type n = idx1.length (matrix.columns ());
-          if (idx0.is_colon_equiv (m) && idx1.is_colon_equiv (n)
-              && m <= matrix.rows () && n <= matrix.rows ())
-            {
-              DMT rm (matrix);
-              rm.resize (m, n);
-              retval = rm;
-            }
-          else
-            retval = to_dense ().do_index_op (idx, resize_ok);
-        }
-    }
-  else
-    retval = to_dense ().do_index_op (idx, resize_ok);
-
-  return retval;
-}
-
-template <class DMT, class MT>
-octave_value
-octave_base_diag<DMT, MT>::subsasgn (const std::string& type,
-                                     const std::list<octave_value_list>& idx,
-                                     const octave_value& rhs)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        if (type.length () == 1)
-          {
-            octave_value_list jdx = idx.front ();
-            // Check for a simple element assignment. That means, if D is a diagonal matrix,
-            // `D(i,i) = x' will not destroy its diagonality (provided i is a valid index).
-            if (jdx.length () == 2 && jdx(0).is_scalar_type () && jdx(1).is_scalar_type ())
-              {
-                typename DMT::element_type val;
-                idx_vector i0 = jdx(0).index_vector (), i1 = jdx(1).index_vector ();
-                if (! error_state  && i0(0) == i1(0)
-                    && i0(0) < matrix.rows () && i1(0) < matrix.cols ()
-                    && chk_valid_scalar (rhs, val))
-                  {
-                    matrix.dgelem (i0(0)) = val;
-                    retval = this;
-                    this->count++;
-                    // invalidate cache
-                    dense_cache = octave_value ();
-                  }
-              }
-
-            if (! error_state && ! retval.is_defined ())
-              retval = numeric_assign (type, idx, rhs);
-          }
-        else
-          {
-            std::string nm = type_name ();
-            error ("in indexed assignment of %s, last lhs index must be ()",
-                   nm.c_str ());
-          }
-      }
-      break;
-
-    case '{':
-    case '.':
-      {
-        if (is_empty ())
-          {
-            octave_value tmp = octave_value::empty_conv (type, rhs);
-
-            retval = tmp.subsasgn (type, idx, rhs);
-          }
-        else
-          {
-            std::string nm = type_name ();
-            error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-          }
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval;
-}
-
-template <class DMT, class MT>
-octave_value
-octave_base_diag<DMT, MT>::resize (const dim_vector& dv, bool fill) const
-{
-  octave_value retval;
-  if (dv.length () == 2)
-    {
-      DMT rm (matrix);
-      rm.resize (dv(0), dv(1));
-      retval = rm;
-    }
-  else
-    retval = to_dense ().resize (dv, fill);
-  return retval;
-}
-
-template <class DMT, class MT>
-bool
-octave_base_diag<DMT, MT>::is_true (void) const
-{
-  return to_dense ().is_true ();
-}
-
-// FIXME: this should be achieveable using ::real
-template <class T> inline T helper_getreal (T x) { return x; }
-template <class T> inline T helper_getreal (std::complex<T> x) { return x.real (); }
-// FIXME: we really need some traits so that ad hoc hooks like this are not necessary
-template <class T> inline T helper_iscomplex (T) { return false; }
-template <class T> inline T helper_iscomplex (std::complex<T>) { return true; }
-
-template <class DMT, class MT>
-double
-octave_base_diag<DMT, MT>::double_value (bool force_conversion) const
-{
-  double retval = lo_ieee_nan_value ();
-  typedef typename DMT::element_type el_type;
-
-  if (helper_iscomplex (el_type ()) && ! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real scalar");
-
-  if (numel () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 type_name (), "real scalar");
-
-      retval = helper_getreal (el_type (matrix (0, 0)));
-    }
-  else
-    gripe_invalid_conversion (type_name (), "real scalar");
-
-  return retval;
-}
-
-template <class DMT, class MT>
-float
-octave_base_diag<DMT, MT>::float_value (bool force_conversion) const
-{
-  float retval = lo_ieee_float_nan_value ();
-  typedef typename DMT::element_type el_type;
-
-  if (helper_iscomplex (el_type ()) && ! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real scalar");
-
-  if (numel () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 type_name (), "real scalar");
-
-      retval = helper_getreal (el_type (matrix (0, 0)));
-    }
-  else
-    gripe_invalid_conversion (type_name (), "real scalar");
-
-  return retval;
-}
-
-template <class DMT, class MT>
-Complex
-octave_base_diag<DMT, MT>::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 type_name (), "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion (type_name (), "complex scalar");
-
-  return retval;
-}
-
-template <class DMT, class MT>
-FloatComplex
-octave_base_diag<DMT, MT>::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 type_name (), "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion (type_name (), "complex scalar");
-
-  return retval;
-}
-
-template <class DMT, class MT>
-Matrix
-octave_base_diag<DMT, MT>::matrix_value (bool) const
-{
-  return Matrix (diag_matrix_value ());
-}
-
-template <class DMT, class MT>
-FloatMatrix
-octave_base_diag<DMT, MT>::float_matrix_value (bool) const
-{
-  return FloatMatrix (float_diag_matrix_value ());
-}
-
-template <class DMT, class MT>
-ComplexMatrix
-octave_base_diag<DMT, MT>::complex_matrix_value (bool) const
-{
-  return ComplexMatrix (complex_diag_matrix_value ());
-}
-
-template <class DMT, class MT>
-FloatComplexMatrix
-octave_base_diag<DMT, MT>::float_complex_matrix_value (bool) const
-{
-  return FloatComplexMatrix (float_complex_diag_matrix_value ());
-}
-
-template <class DMT, class MT>
-NDArray
-octave_base_diag<DMT, MT>::array_value (bool) const
-{
-  return NDArray (matrix_value ());
-}
-
-template <class DMT, class MT>
-FloatNDArray
-octave_base_diag<DMT, MT>::float_array_value (bool) const
-{
-  return FloatNDArray (float_matrix_value ());
-}
-
-template <class DMT, class MT>
-ComplexNDArray
-octave_base_diag<DMT, MT>::complex_array_value (bool) const
-{
-  return ComplexNDArray (complex_matrix_value ());
-}
-
-template <class DMT, class MT>
-FloatComplexNDArray
-octave_base_diag<DMT, MT>::float_complex_array_value (bool) const
-{
-  return FloatComplexNDArray (float_complex_matrix_value ());
-}
-
-template <class DMT, class MT>
-boolNDArray
-octave_base_diag<DMT, MT>::bool_array_value (bool warn) const
-{
-  return to_dense ().bool_array_value (warn);
-}
-
-template <class DMT, class MT>
-charNDArray
-octave_base_diag<DMT, MT>::char_array_value (bool warn) const
-{
-  return to_dense ().char_array_value (warn);
-}
-
-template <class DMT, class MT>
-SparseMatrix
-octave_base_diag<DMT, MT>::sparse_matrix_value (bool) const
-{
-  return SparseMatrix (diag_matrix_value ());
-}
-
-template <class DMT, class MT>
-SparseComplexMatrix
-octave_base_diag<DMT, MT>::sparse_complex_matrix_value (bool) const
-{
-  return SparseComplexMatrix (complex_diag_matrix_value ());
-}
-
-template <class DMT, class MT>
-idx_vector
-octave_base_diag<DMT, MT>::index_vector (void) const
-{
-  return to_dense ().index_vector ();
-}
-
-template <class DMT, class MT>
-octave_value
-octave_base_diag<DMT, MT>::convert_to_str_internal (bool pad, bool force, char type) const
-{
-  return to_dense ().convert_to_str_internal (pad, force, type);
-}
-
-template <class DMT, class MT>
-bool
-octave_base_diag<DMT, MT>::save_ascii (std::ostream& os)
-{
-  os << "# rows: " << matrix.rows () << "\n"
-    << "# columns: " << matrix.columns () << "\n";
-
-  os << matrix.diag ();
-
-  return true;
-}
-
-template <class DMT, class MT>
-bool
-octave_base_diag<DMT, MT>::load_ascii (std::istream& is)
-{
-  octave_idx_type r = 0, c = 0;
-  bool success = true;
-
-  if (extract_keyword (is, "rows", r, true)
-      && extract_keyword (is, "columns", c, true))
-    {
-      octave_idx_type l = r < c ? r : c;
-      MT tmp (l, 1);
-      is >> tmp;
-
-      if (!is)
-        {
-          error ("load: failed to load diagonal matrix constant");
-          success = false;
-        }
-      else
-        {
-          // This is a little tricky, as we have the Matrix type, but
-          // not ColumnVector type. We need to help the compiler get
-          // through the inheritance tree.
-          typedef typename DMT::element_type el_type;
-          matrix = DMT (MDiagArray2<el_type> (MArray<el_type> (tmp)));
-          matrix.resize (r, c);
-
-          // Invalidate cache. Probably not necessary, but safe.
-          dense_cache = octave_value ();
-        }
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-template <class DMT, class MT>
-void
-octave_base_diag<DMT, MT>::print_raw (std::ostream& os,
-                                      bool pr_as_read_syntax) const
-{
-  return octave_print_internal (os, matrix, pr_as_read_syntax,
-                                current_print_indent_level ());
-}
-
-template <class DMT, class MT>
-mxArray *
-octave_base_diag<DMT, MT>::as_mxArray (void) const
-{
-  return to_dense ().as_mxArray ();
-}
-
-template <class DMT, class MT>
-bool
-octave_base_diag<DMT, MT>::print_as_scalar (void) const
-{
-  dim_vector dv = dims ();
-
-  return (dv.all_ones () || dv.any_zero ());
-}
-
-template <class DMT, class MT>
-void
-octave_base_diag<DMT, MT>::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-template <class DMT, class MT>
-int
-octave_base_diag<DMT, MT>::write (octave_stream& os, int block_size,
-                                  oct_data_conv::data_type output_type, int skip,
-                                  oct_mach_info::float_format flt_fmt) const
-{
-  return to_dense ().write (os, block_size, output_type, skip, flt_fmt);
-}
-
-template <class DMT, class MT>
-void
-octave_base_diag<DMT, MT>::print_info (std::ostream& os,
-                                       const std::string& prefix) const
-{
-  matrix.print_info (os, prefix);
-}
-
-template <class DMT, class MT>
-octave_value
-octave_base_diag<DMT, MT>::to_dense (void) const
-{
-  if (! dense_cache.is_defined ())
-    dense_cache = MT (matrix);
-
-  return dense_cache;
-}
-
--- a/src/ov-base-diag.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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_base_diag_h)
-#define octave_base_diag_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "str-vec.h"
-
-#include "oct-obj.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-class tree_walker;
-
-// Real matrix values.
-
-template <class DMT, class MT>
-class
-octave_base_diag : public octave_base_value
-{
-
-public:
-
-  octave_base_diag (void)
-    : octave_base_value (), matrix (), dense_cache () { }
-
-  octave_base_diag (const DMT& m)
-    : octave_base_value (), matrix (m), dense_cache ()
-  { }
-
-  octave_base_diag (const octave_base_diag& m)
-    : octave_base_value (), matrix (m.matrix), dense_cache () { }
-
-  ~octave_base_diag (void) { }
-
-  size_t byte_size (void) const { return matrix.byte_size (); }
-
-  octave_value squeeze (void) const { return matrix; }
-
-  octave_value full_value (void) const { return to_dense (); }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int)
-    { return subsref (type, idx); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  octave_value subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs);
-
-  dim_vector dims (void) const { return matrix.dims (); }
-
-  octave_idx_type nnz (void) const { return to_dense ().nnz (); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return to_dense ().reshape (new_dims); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return to_dense ().permute (vec, inv); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-  octave_value all (int dim = 0) const { return MT (matrix).all (dim); }
-  octave_value any (int dim = 0) const { return MT (matrix).any (dim); }
-
-  MatrixType matrix_type (void) const { return MatrixType::Diagonal; }
-  MatrixType matrix_type (const MatrixType&) const
-    { return matrix_type (); }
-
-  octave_value diag (octave_idx_type k = 0) const
-    { return octave_value (matrix.diag (k)); }
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
-    { return to_dense ().sort (dim, mode); }
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const
-    { return to_dense ().sort (sidx, dim, mode); }
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const
-    { return to_dense ().is_sorted (mode); }
-
-  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
-    { return to_dense ().sort_rows_idx (mode); }
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
-    { return to_dense ().is_sorted_rows (mode); }
-
-  bool is_matrix_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return true; }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_true (void) const;
-
-  bool is_diag_matrix (void) const { return true; }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  idx_vector index_vector (void) const;
-
-  Matrix matrix_value (bool = false) const;
-
-  FloatMatrix float_matrix_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool warn = false) const;
-
-  charNDArray char_array_value (bool = false) const;
-
-  NDArray array_value (bool = false) const;
-
-  FloatNDArray float_array_value (bool = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const;
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
-
-  int8NDArray
-  int8_array_value (void) const { return to_dense ().int8_array_value (); }
-
-  int16NDArray
-  int16_array_value (void) const { return to_dense ().int16_array_value (); }
-
-  int32NDArray
-  int32_array_value (void) const { return to_dense ().int32_array_value (); }
-
-  int64NDArray
-  int64_array_value (void) const { return to_dense ().int64_array_value (); }
-
-  uint8NDArray
-  uint8_array_value (void) const { return to_dense ().uint8_array_value (); }
-
-  uint16NDArray
-  uint16_array_value (void) const { return to_dense ().uint16_array_value (); }
-
-  uint32NDArray
-  uint32_array_value (void) const { return to_dense ().uint32_array_value (); }
-
-  uint64NDArray
-  uint64_array_value (void) const { return to_dense ().uint64_array_value (); }
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const;
-
-  mxArray *as_mxArray (void) const;
-
-  bool print_as_scalar (void) const;
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_info (std::ostream& os, const std::string& prefix) const;
-
-protected:
-
-  DMT matrix;
-
-  octave_value to_dense (void) const;
-
-  virtual bool chk_valid_scalar (const octave_value&,
-                                 typename DMT::element_type&) const = 0;
-
-private:
-
-  mutable octave_value dense_cache;
-
-};
-
-#endif
--- a/src/ov-base-int.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,608 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-#include <vector>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-#include "oct-locbuf.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-mat.cc"
-#include "ov-base-scalar.h"
-#include "ov-base-scalar.cc"
-#include "ov-base-int.h"
-#include "ov-int-traits.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-// We have all the machinery below (octave_base_int_helper and
-// octave_base_int_helper_traits) to avoid a few warnings from GCC
-// about comparisons always false due to limited range of data types.
-// Ugh.  The cure may be worse than the disease.
-
-template <class T, bool is_signed = true, bool can_be_too_big = true>
-struct octave_base_int_helper
-{
-  static bool
-  char_value_out_of_range (T val) { return val < 0 || val > UCHAR_MAX; }
-};
-
-template <class T>
-struct octave_base_int_helper<T, false, false>
-{
-  static bool char_value_out_of_range (T) { return false; }
-};
-
-template <class T>
-struct octave_base_int_helper<T, false, true>
-{
-  static bool char_value_out_of_range (T val) { return val > UCHAR_MAX; }
-};
-
-template <class T>
-struct octave_base_int_helper<T, true, false>
-{
-  static bool char_value_out_of_range (T val) { return val < 0; }
-};
-
-// For all types other than char, signed char, and unsigned char, we
-// assume that the upper limit for the range of allowable values is
-// larger than the range for unsigned char.  If that's not true, we
-// are still OK, but will see the warnings again for any other types
-// that do not meet this assumption.
-
-template <class T>
-struct octave_base_int_helper_traits
-{
-  static const bool can_be_larger_than_uchar_max = true;
-};
-
-template <>
-struct octave_base_int_helper_traits<char>
-{
-  static const bool can_be_larger_than_uchar_max = false;
-};
-
-template <>
-struct octave_base_int_helper_traits<signed char>
-{
-  static const bool can_be_larger_than_uchar_max = false;
-};
-
-template <>
-struct octave_base_int_helper_traits<unsigned char>
-{
-  static const bool can_be_larger_than_uchar_max = false;
-};
-
-
-template <class T>
-octave_base_value *
-octave_base_int_matrix<T>::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (this->matrix.nelem () == 1)
-    retval = new typename octave_value_int_traits<T>::scalar_type (this->matrix (0));
-
-  return retval;
-}
-
-template <class T>
-octave_value
-octave_base_int_matrix<T>::convert_to_str_internal (bool, bool, char type) const
-{
-  octave_value retval;
-  dim_vector dv = this->dims ();
-  octave_idx_type nel = dv.numel ();
-
-  charNDArray chm (dv);
-
-  bool warned = false;
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      octave_quit ();
-
-      typename T::element_type tmp = this->matrix(i);
-
-      typedef typename T::element_type::val_type val_type;
-
-      val_type ival = tmp.value ();
-
-      static const bool is_signed = std::numeric_limits<val_type>::is_signed;
-      static const bool can_be_larger_than_uchar_max
-        = octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar_max;
-
-      if (octave_base_int_helper<val_type, is_signed,
-          can_be_larger_than_uchar_max>::char_value_out_of_range (ival))
-        {
-          // FIXME -- is there something better we could do?
-
-          ival = 0;
-
-          if (! warned)
-            {
-              ::warning ("range error for conversion to character value");
-              warned = true;
-            }
-        }
-      else
-        chm (i) = static_cast<char> (ival);
-    }
-
-  retval = octave_value (chm, type);
-
-  return retval;
-}
-
-template <class T>
-bool
-octave_base_int_matrix<T>::save_ascii (std::ostream& os)
-{
-  dim_vector d = this->dims ();
-
-  os << "# ndims: " << d.length () << "\n";
-
-  for (int i = 0; i < d.length (); i++)
-    os << " " << d (i);
-
-  os << "\n" << this->matrix;
-
-  return true;
-}
-
-template <class T>
-bool
-octave_base_int_matrix<T>::load_ascii (std::istream& is)
-{
-  int mdims = 0;
-  bool success = true;
-
-  if (extract_keyword (is, "ndims", mdims, true))
-    {
-      if (mdims >= 0)
-        {
-          dim_vector dv;
-          dv.resize (mdims);
-
-          for (int i = 0; i < mdims; i++)
-            is >> dv(i);
-
-          T tmp(dv);
-
-          is >> tmp;
-
-          if (!is)
-            {
-              error ("load: failed to load matrix constant");
-              success = false;
-            }
-
-          this->matrix = tmp;
-        }
-      else
-        {
-          error ("load: failed to extract number of rows and columns");
-          success = false;
-        }
-    }
-  else
-    error ("load: failed to extract number of dimensions");
-
-  return success;
-}
-
-template <class T>
-bool
-octave_base_int_matrix<T>::save_binary (std::ostream& os, bool&)
-{
-  dim_vector d = this->dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims to differentiate with old format!!
-  int32_t tmp = - d.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i=0; i < d.length (); i++)
-    {
-      tmp = d(i);
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-    }
-
-  os.write (reinterpret_cast<const char *> (this->matrix.data ()), this->byte_size ());
-
-  return true;
-}
-
-template <class T>
-bool
-octave_base_int_matrix<T>::load_binary (std::istream& is, bool swap,
-                                        oct_mach_info::float_format )
-{
-  int32_t mdims;
-  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&mdims);
-  if (mdims >= 0)
-    return false;
-
-  mdims = - mdims;
-  int32_t di;
-  dim_vector dv;
-  dv.resize (mdims);
-
-  for (int i = 0; i < mdims; i++)
-    {
-      if (! is.read (reinterpret_cast<char *> (&di), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&di);
-      dv(i) = di;
-    }
-
-  // Convert an array with a single dimension to be a row vector.
-  // Octave should never write files like this, other software
-  // might.
-
-  if (mdims == 1)
-    {
-      mdims = 2;
-      dv.resize (mdims);
-      dv(1) = dv(0);
-      dv(0) = 1;
-    }
-
-  T m (dv);
-
-  if (! is.read (reinterpret_cast<char *> (m.fortran_vec ()), m.byte_size ()))
-    return false;
-
-  if (swap)
-    {
-      int nel = dv.numel ();
-      int bytes = nel / m.byte_size ();
-      for (int i = 0; i < nel; i++)
-        switch (bytes)
-          {
-          case 8:
-            swap_bytes<8> (&m(i));
-            break;
-          case 4:
-            swap_bytes<4> (&m(i));
-            break;
-          case 2:
-            swap_bytes<2> (&m(i));
-            break;
-          case 1:
-          default:
-            break;
-          }
-    }
-
-  this->matrix = m;
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-template <class T>
-bool
-octave_base_int_matrix<T>::save_hdf5 (hid_t loc_id, const char *name, bool)
-{
-  hid_t save_type_hid = HDF5_SAVE_TYPE;
-  bool retval = true;
-  dim_vector dv = this->dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  int rank = dv.length ();
-  hid_t space_hid = -1, data_hid = -1;
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
-
-  space_hid = H5Screate_simple (rank, hdims, 0);
-
-  if (space_hid < 0) return false;
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, this->matrix.data ()) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-template <class T>
-bool
-octave_base_int_matrix<T>::load_hdf5 (hid_t loc_id, const char *name)
-{
-  hid_t save_type_hid = HDF5_SAVE_TYPE;
-  bool retval = false;
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    this->matrix.resize (dv);
-  if (empty)
-      return (empty > 0);
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank < 1)
-    {
-      H5Sclose (space_id);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  if (rank == 1)
-    {
-      dv.resize (2);
-      dv(0) = 1;
-      dv(1) = hdims[0];
-    }
-  else
-    {
-      dv.resize (rank);
-      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
-        dv(j) = hdims[i];
-    }
-
-  T m (dv);
-  if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, m.fortran_vec ()) >= 0)
-    {
-      retval = true;
-      this->matrix = m;
-    }
-
-  H5Sclose (space_id);
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-template <class T>
-void
-octave_base_int_matrix<T>::print_raw (std::ostream& os,
-                                      bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, this->matrix, pr_as_read_syntax,
-                         this->current_print_indent_level ());
-}
-
-template <class T>
-octave_value
-octave_base_int_scalar<T>::convert_to_str_internal (bool, bool, char type) const
-{
-  octave_value retval;
-
-  T tmp = this->scalar;
-
-  typedef typename T::val_type val_type;
-
-  val_type ival = tmp.value ();
-
-  static const bool is_signed = std::numeric_limits<val_type>::is_signed;
-  static const bool can_be_larger_than_uchar_max
-    = octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar_max;
-
-  if (octave_base_int_helper<val_type, is_signed,
-      can_be_larger_than_uchar_max>::char_value_out_of_range (ival))
-    {
-      // FIXME -- is there something better we could do?
-
-      ival = 0;
-
-      ::warning ("range error for conversion to character value");
-    }
-  else
-    retval = octave_value (std::string (1, static_cast<char> (ival)), type);
-
-  return retval;
-}
-
-template <class T>
-bool
-octave_base_int_scalar<T>::save_ascii (std::ostream& os)
-{
-  os << this->scalar << "\n";
-  return true;
-}
-
-template <class T>
-bool
-octave_base_int_scalar<T>::load_ascii (std::istream& is)
-{
-  is >> this->scalar;
-  if (!is)
-    {
-      error ("load: failed to load scalar constant");
-      return false;
-    }
-  return true;
-}
-
-template <class T>
-bool
-octave_base_int_scalar<T>::save_binary (std::ostream& os, bool&)
-{
-  os.write (reinterpret_cast<char *> (&(this->scalar)), this->byte_size ());
-  return true;
-}
-
-template <class T>
-bool
-octave_base_int_scalar<T>::load_binary (std::istream& is, bool swap,
-                                        oct_mach_info::float_format)
-{
-  T tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), this->byte_size ()))
-    return false;
-
-  if (swap)
-    switch (this->byte_size ())
-      {
-      case 8:
-        swap_bytes<8> (&tmp);
-        break;
-      case 4:
-        swap_bytes<4> (&tmp);
-        break;
-      case 2:
-        swap_bytes<2> (&tmp);
-        break;
-      case 1:
-      default:
-        break;
-      }
-  this->scalar = tmp;
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-template <class T>
-bool
-octave_base_int_scalar<T>::save_hdf5 (hid_t loc_id, const char *name, bool)
-{
-  hid_t save_type_hid = HDF5_SAVE_TYPE;
-  bool retval = true;
-  hsize_t dimens[3];
-  hid_t space_hid = -1, data_hid = -1;
-
-  space_hid = H5Screate_simple (0, dimens, 0);
-  if (space_hid < 0) return false;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &(this->scalar)) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-template <class T>
-bool
-octave_base_int_scalar<T>::load_hdf5 (hid_t loc_id, const char *name)
-{
-  hid_t save_type_hid = HDF5_SAVE_TYPE;
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  T tmp;
-  if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, &tmp) < 0)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  this->scalar = tmp;
-
-  H5Dclose (data_hid);
-
-  return true;
-}
-
-#endif
--- a/src/ov-base-int.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_base_int_matrix_h)
-#define octave_base_int_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-scalar.h"
-#include "ov-typeinfo.h"
-
-// base int matrix values.
-
-template <class T>
-class
-octave_base_int_matrix : public octave_base_matrix<T>
-{
-public:
-
-  octave_base_int_matrix (void) : octave_base_matrix<T> () { }
-
-  octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { }
-
-  ~octave_base_int_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_base_int_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_base_int_matrix (); }
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  bool is_real_type (void) const { return true; }
-
-  //  void increment (void) { matrix += 1; }
-
-  //  void decrement (void) { matrix -= 1; }
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  octave_value convert_to_str_internal (bool, bool, char type) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& );
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format );
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-};
-
-// base int scalar values.
-
-template <class T>
-class
-octave_base_int_scalar : public octave_base_scalar<T>
-{
-public:
-
-  octave_base_int_scalar (void) : octave_base_scalar<T> () { }
-
-  octave_base_int_scalar (const T& s) : octave_base_scalar<T> (s) { }
-
-  ~octave_base_int_scalar (void) { }
-
-  octave_base_value *clone (void) const { return new octave_base_int_scalar (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_base_int_scalar (); }
-
-  octave_base_value *try_narrowing_conversion (void) { return 0; }
-
-  bool is_real_type (void) const { return true; }
-
-  //  void increment (void) { scalar += 1; }
-
-  //  void decrement (void) { scalar -= 1; }
-
-  octave_value convert_to_str_internal (bool, bool, char type) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& );
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format );
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool );
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-};
-
-#endif
--- a/src/ov-base-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,482 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "Cell.h"
-#include "oct-obj.h"
-#include "oct-map.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-scalar.h"
-#include "pr-output.h"
-
-template <class MT>
-octave_value
-octave_base_matrix<MT>::subsref (const std::string& type,
-                                 const std::list<octave_value_list>& idx)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      retval = do_index_op (idx.front ());
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval.next_subsref (type, idx);
-}
-
-template <class MT>
-octave_value
-octave_base_matrix<MT>::subsasgn (const std::string& type,
-                                  const std::list<octave_value_list>& idx,
-                                  const octave_value& rhs)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        if (type.length () == 1)
-          retval = numeric_assign (type, idx, rhs);
-        else if (is_empty ())
-          {
-            // Allow conversion of empty matrix to some other type in
-            // cases like
-            //
-            //  x = []; x(i).f = rhs
-
-            if (type[1] == '.')
-              {
-                octave_value tmp = octave_value::empty_conv (type, rhs);
-
-                retval = tmp.subsasgn (type, idx, rhs);
-              }
-            else
-              error ("invalid assignment expression");
-          }
-        else
-          {
-            std::string nm = type_name ();
-            error ("in indexed assignment of %s, last lhs index must be ()",
-                   nm.c_str ());
-          }
-      }
-      break;
-
-    case '{':
-    case '.':
-      {
-        if (is_empty ())
-          {
-            octave_value tmp = octave_value::empty_conv (type, rhs);
-
-            retval = tmp.subsasgn (type, idx, rhs);
-          }
-        else
-          {
-            std::string nm = type_name ();
-            error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-          }
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval;
-}
-
-template <class MT>
-octave_value
-octave_base_matrix<MT>::do_index_op (const octave_value_list& idx,
-                                     bool resize_ok)
-{
-  octave_value retval;
-
-  octave_idx_type n_idx = idx.length ();
-
-  int nd = matrix.ndims ();
-  const MT& cmatrix = matrix;
-
-  switch (n_idx)
-    {
-    case 0:
-      retval = matrix;
-      break;
-
-    case 1:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          {
-            // optimize single scalar index.
-            if (! resize_ok && i.is_scalar ())
-              retval = cmatrix.checkelem (i(0));
-            else
-              retval = MT (matrix.index (i, resize_ok));
-          }
-      }
-      break;
-
-    case 2:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          {
-            idx_vector j = idx (1).index_vector ();
-
-            if (! error_state)
-              {
-                // optimize two scalar indices.
-                if (! resize_ok && i.is_scalar () && j.is_scalar ())
-                  retval = cmatrix.checkelem (i(0), j(0));
-                else
-                  retval = MT (matrix.index (i, j, resize_ok));
-              }
-          }
-      }
-      break;
-
-    default:
-      {
-        Array<idx_vector> idx_vec (dim_vector (n_idx, 1));
-        bool scalar_opt = n_idx == nd && ! resize_ok;
-        const dim_vector dv = matrix.dims ();
-
-        for (octave_idx_type i = 0; i < n_idx; i++)
-          {
-            idx_vec(i) = idx(i).index_vector ();
-
-            if (error_state)
-              break;
-
-            scalar_opt = (scalar_opt && idx_vec(i).is_scalar ());
-          }
-
-        if (! error_state)
-          {
-            if (scalar_opt)
-              retval = cmatrix.checkelem (conv_to_int_array (idx_vec));
-            else
-              retval = MT (matrix.index (idx_vec, resize_ok));
-          }
-      }
-      break;
-    }
-
-  return retval;
-}
-
-template <class MT>
-void
-octave_base_matrix<MT>::assign (const octave_value_list& idx, const MT& rhs)
-{
-  octave_idx_type n_idx = idx.length ();
-
-  switch (n_idx)
-    {
-    case 0:
-      panic_impossible ();
-      break;
-
-    case 1:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          matrix.assign (i, rhs);
-      }
-      break;
-
-    case 2:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          {
-            idx_vector j = idx (1).index_vector ();
-
-            if (! error_state)
-              matrix.assign (i, j, rhs);
-          }
-      }
-      break;
-
-    default:
-      {
-        Array<idx_vector> idx_vec (dim_vector (n_idx, 1));
-
-        for (octave_idx_type i = 0; i < n_idx; i++)
-          {
-            idx_vec(i) = idx(i).index_vector ();
-
-            if (error_state)
-              break;
-          }
-
-        if (! error_state)
-          matrix.assign (idx_vec, rhs);
-      }
-      break;
-    }
-
-  // Clear cache.
-  clear_cached_info ();
-}
-
-template <class MT>
-MatrixType
-octave_base_matrix<MT>::matrix_type (const MatrixType& _typ) const
-{
-  delete typ;
-  typ = new MatrixType (_typ);
-  return *typ;
-}
-
-template <class MT>
-void
-octave_base_matrix<MT>::assign (const octave_value_list& idx,
-                                typename MT::element_type rhs)
-{
-  octave_idx_type n_idx = idx.length ();
-
-  int nd = matrix.ndims ();
-
-  MT mrhs (dim_vector (1, 1), rhs);
-
-  switch (n_idx)
-    {
-    case 0:
-      panic_impossible ();
-      break;
-
-    case 1:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          {
-            // optimize single scalar index.
-            if (i.is_scalar () && i(0) < matrix.numel ())
-              matrix(i(0)) = rhs;
-            else
-              matrix.assign (i, mrhs);
-          }
-      }
-      break;
-
-    case 2:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          {
-            idx_vector j = idx (1).index_vector ();
-
-            if (! error_state)
-              {
-                // optimize two scalar indices.
-                if (i.is_scalar () && j.is_scalar () && nd == 2
-                    && i(0) < matrix.rows () && j(0) < matrix.columns ())
-                  matrix(i(0), j(0)) = rhs;
-                else
-                  matrix.assign (i, j, mrhs);
-              }
-          }
-      }
-      break;
-
-    default:
-      {
-        Array<idx_vector> idx_vec (dim_vector (n_idx, 1));
-        bool scalar_opt = n_idx == nd;
-        const dim_vector dv = matrix.dims ().redim (n_idx);
-
-        for (octave_idx_type i = 0; i < n_idx; i++)
-          {
-            idx_vec(i) = idx(i).index_vector ();
-
-            if (error_state)
-              break;
-
-            scalar_opt = (scalar_opt && idx_vec(i).is_scalar ()
-                          && idx_vec(i)(0) < dv(i));
-          }
-
-        if (! error_state)
-          {
-            if (scalar_opt)
-              {
-                // optimize all scalar indices. Don't construct an index array,
-                // but rather calc a scalar index directly.
-                octave_idx_type k = 1, j = 0;
-                for (octave_idx_type i = 0; i < n_idx; i++)
-                  {
-                    j += idx_vec(i)(0) * k;
-                    k *= dv (i);
-                  }
-                matrix(j) = rhs;
-              }
-            else
-              matrix.assign (idx_vec, mrhs);
-          }
-      }
-      break;
-    }
-
-  // Clear cache.
-  clear_cached_info ();
-}
-
-template <class MT>
-void
-octave_base_matrix<MT>::delete_elements (const octave_value_list& idx)
-{
-  octave_idx_type len = idx.length ();
-
-  Array<idx_vector> ra_idx (dim_vector (len, 1));
-
-  for (octave_idx_type i = 0; i < len; i++)
-    ra_idx(i) = idx(i).index_vector ();
-
-  matrix.delete_elements (ra_idx);
-
-  // Clear cache.
-  clear_cached_info ();
-}
-
-template <class MT>
-octave_value
-octave_base_matrix<MT>::resize (const dim_vector& dv, bool fill) const
-{
-  MT retval (matrix);
-  if (fill)
-    retval.resize (dv, 0);
-  else
-    retval.resize (dv);
-  return retval;
-}
-
-template <class MT>
-bool
-octave_base_matrix<MT>::is_true (void) const
-{
-  bool retval = false;
-  dim_vector dv = matrix.dims ();
-  int nel = dv.numel ();
-
-  if (nel > 0)
-    {
-      MT t1 (matrix.reshape (dim_vector (nel, 1)));
-
-      if (t1.any_element_is_nan ())
-        gripe_nan_to_logical_conversion ();
-      else
-        {
-          boolNDArray t2 = t1.all ();
-
-          retval = t2(0);
-        }
-    }
-
-  return retval;
-}
-
-template <class MT>
-bool
-octave_base_matrix<MT>::print_as_scalar (void) const
-{
-  dim_vector dv = dims ();
-
-  return (dv.all_ones () || dv.any_zero ());
-}
-
-template <class MT>
-void
-octave_base_matrix<MT>::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-
-template <class MT>
-void
-octave_base_matrix<MT>::print_info (std::ostream& os,
-                                    const std::string& prefix) const
-{
-  matrix.print_info (os, prefix);
-}
-
-template <class MT>
-octave_value
-octave_base_matrix<MT>::fast_elem_extract (octave_idx_type n) const
-{
-  if (n < matrix.numel ())
-    return matrix(n);
-  else
-    return octave_value ();
-}
-
-template <class MT>
-bool
-octave_base_matrix<MT>::fast_elem_insert (octave_idx_type n,
-                                          const octave_value& x)
-{
-  if (n < matrix.numel ())
-    {
-      // Don't use builtin_type () here to avoid an extra VM call.
-      typedef typename MT::element_type ET;
-      const builtin_type_t btyp = class_to_btyp<ET>::btyp;
-      if (btyp == btyp_unknown) // Dead branch?
-        return false;
-
-      // Set up the pointer to the proper place.
-      void *here = reinterpret_cast<void *> (&matrix(n));
-      // Ask x to store there if it can.
-      return x.get_rep ().fast_elem_insert_self (here, btyp);
-    }
-  else
-    return false;
-}
--- a/src/ov-base-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
-
-Copyright (C) 1998-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_base_matrix_h)
-#define octave_base_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "str-vec.h"
-#include "MatrixType.h"
-
-#include "error.h"
-#include "oct-obj.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-class tree_walker;
-
-// Real matrix values.
-
-template <class MT>
-class
-octave_base_matrix : public octave_base_value
-{
-public:
-
-  octave_base_matrix (void)
-    : octave_base_value (), matrix (), typ (), idx_cache () { }
-
-  octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ())
-    : octave_base_value (), matrix (m),
-      typ (t.is_known () ? new MatrixType (t) : 0), idx_cache ()
-  {
-    if (matrix.ndims () == 0)
-      matrix.resize (dim_vector (0, 0));
-  }
-
-  octave_base_matrix (const octave_base_matrix& m)
-    : octave_base_value (), matrix (m.matrix),
-      typ (m.typ ? new MatrixType (*m.typ) : 0),
-      idx_cache (m.idx_cache ? new idx_vector (*m.idx_cache) : 0)
-    { }
-
-  ~octave_base_matrix (void) { clear_cached_info (); }
-
-  size_t byte_size (void) const { return matrix.byte_size (); }
-
-  octave_value squeeze (void) const { return MT (matrix.squeeze ()); }
-
-  octave_value full_value (void) const { return matrix; }
-
-  void maybe_economize (void) { matrix.maybe_economize (); }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int)
-    { return subsref (type, idx); }
-
-  octave_value subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs);
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  octave_value_list do_multi_index_op (int, const octave_value_list& idx)
-    { return do_index_op (idx); }
-
-  void assign (const octave_value_list& idx, const MT& rhs);
-
-  void assign (const octave_value_list& idx, typename MT::element_type rhs);
-
-  void delete_elements (const octave_value_list& idx);
-
-  dim_vector dims (void) const { return matrix.dims (); }
-
-  octave_idx_type numel (void) const { return matrix.numel (); }
-
-  int ndims (void) const { return matrix.ndims (); }
-
-  octave_idx_type nnz (void) const { return matrix.nnz (); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return MT (matrix.reshape (new_dims)); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return MT (matrix.permute (vec, inv)); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-  octave_value all (int dim = 0) const { return matrix.all (dim); }
-  octave_value any (int dim = 0) const { return matrix.any (dim); }
-
-  MatrixType matrix_type (void) const { return typ ? *typ : MatrixType (); }
-  MatrixType matrix_type (const MatrixType& _typ) const;
-
-  octave_value diag (octave_idx_type k = 0) const
-    { return octave_value (matrix.diag (k)); }
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const
-    { return octave_value (matrix.diag (m, n)); }
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
-    { return octave_value (matrix.sort (dim, mode)); }
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const
-    { return octave_value (matrix.sort (sidx, dim, mode)); }
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const
-    { return matrix.is_sorted (mode); }
-
-  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
-    { return matrix.sort_rows_idx (mode); }
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
-    { return matrix.is_sorted_rows (mode); }
-
-  bool is_matrix_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return true; }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_true (void) const;
-
-  bool print_as_scalar (void) const;
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_info (std::ostream& os, const std::string& prefix) const;
-
-  MT& matrix_ref (void)
-    {
-      clear_cached_info ();
-      return matrix;
-    }
-
-  const MT& matrix_ref (void) const
-    {
-      return matrix;
-    }
-
-  octave_value
-  fast_elem_extract (octave_idx_type n) const;
-
-  bool
-  fast_elem_insert (octave_idx_type n, const octave_value& x);
-
-protected:
-
-  MT matrix;
-
-  idx_vector set_idx_cache (const idx_vector& idx) const
-    {
-      delete idx_cache;
-      idx_cache = idx ? new idx_vector (idx) : 0;
-      return idx;
-    }
-
-  void clear_cached_info (void) const
-    {
-      delete typ; typ = 0;
-      delete idx_cache; idx_cache = 0;
-    }
-
-  mutable MatrixType *typ;
-  mutable idx_vector *idx_cache;
-
-private:
-
-  // No assignment.
-
-  octave_base_matrix& operator = (const octave_base_matrix&);
-};
-
-#endif
--- a/src/ov-base-scalar.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "oct-obj.h"
-#include "ov-base.h"
-#include "ov-cx-mat.h"
-#include "ov-re-mat.h"
-#include "ov-base-scalar.h"
-#include "pr-output.h"
-
-template <class ST>
-octave_value
-octave_base_scalar<ST>::subsref (const std::string& type,
-                                 const std::list<octave_value_list>& idx)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      retval = do_index_op (idx.front ());
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval.next_subsref (type, idx);
-}
-
-template <class ST>
-octave_value
-octave_base_scalar<ST>::subsasgn (const std::string& type,
-                                  const std::list<octave_value_list>& idx,
-                                  const octave_value& rhs)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        if (type.length () == 1)
-          retval = numeric_assign (type, idx, rhs);
-        else
-          {
-            std::string nm = type_name ();
-            error ("in indexed assignment of %s, last rhs index must be ()",
-                   nm.c_str ());
-          }
-      }
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval;
-}
-
-template <class ST>
-octave_value
-octave_base_scalar<ST>::permute (const Array<int>& vec, bool inv) const
-{
-  return Array<ST> (dim_vector (1, 1), scalar).permute (vec, inv);
-}
-
-template <class ST>
-octave_value
-octave_base_scalar<ST>::reshape (const dim_vector& new_dims) const
-{
-  return Array<ST> (dim_vector (1, 1), scalar).reshape (new_dims);
-}
-
-template <class ST>
-octave_value
-octave_base_scalar<ST>::diag (octave_idx_type k) const
-{
-  return Array<ST> (dim_vector (1, 1), scalar).diag (k);
-}
-
-template <class ST>
-octave_value
-octave_base_scalar<ST>::diag (octave_idx_type m, octave_idx_type n) const
-{
-  return Array<ST> (dim_vector (1, 1), scalar).diag (m, n);
-}
-
-template <class ST>
-bool
-octave_base_scalar<ST>::is_true (void) const
-{
-  bool retval = false;
-
-  if (xisnan (scalar))
-    gripe_nan_to_logical_conversion ();
-  else
-    retval = (scalar != ST ());
-
-  return retval;
-}
-
-template <class ST>
-void
-octave_base_scalar<ST>::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-
-template <class ST>
-void
-octave_base_scalar<ST>::print_raw (std::ostream& os,
-                                   bool pr_as_read_syntax) const
-{
-  indent (os);
-  octave_print_internal (os, scalar, pr_as_read_syntax);
-}
-
-template <class ST>
-bool
-octave_base_scalar<ST>::print_name_tag (std::ostream& os,
-                                        const std::string& name) const
-{
-  indent (os);
-  os << name << " = ";
-  return false;
-}
-
-template <class ST>
-bool
-octave_base_scalar<ST>::fast_elem_insert_self (void *where, builtin_type_t btyp) const
-{
-
-  // Don't use builtin_type () here to avoid an extra VM call.
-  if (btyp == class_to_btyp<ST>::btyp)
-    {
-      *(reinterpret_cast<ST *>(where)) = scalar;
-      return true;
-    }
-  else
-    return false;
-}
--- a/src/ov-base-scalar.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_base_scalar_h)
-#define octave_base_scalar_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "lo-mappers.h"
-#include "lo-utils.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-#include "MatrixType.h"
-
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-// Real scalar values.
-
-template <class ST>
-class
-octave_base_scalar : public octave_base_value
-{
-public:
-
-  octave_base_scalar (void)
-    : octave_base_value (), scalar () { }
-
-  octave_base_scalar (const ST& s)
-    : octave_base_value (), scalar (s) { }
-
-  octave_base_scalar (const octave_base_scalar& s)
-    : octave_base_value (), scalar (s.scalar) { }
-
-  ~octave_base_scalar (void) { }
-
-  octave_value squeeze (void) const { return scalar; }
-
-  octave_value full_value (void) const { return scalar; }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int)
-    { return subsref (type, idx); }
-
-  octave_value subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs);
-
-  octave_value_list do_multi_index_op (int, const octave_value_list& idx)
-    { return do_index_op (idx); }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_defined (void) const { return true; }
-
-  dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; }
-
-  octave_idx_type numel (void) const { return 1; }
-
-  int ndims (void) const { return 2; }
-
-  octave_idx_type nnz (void) const { return (scalar != ST ()) ? 1 : 0; }
-
-  octave_value permute (const Array<int>&, bool = false) const;
-
-  octave_value reshape (const dim_vector& new_dims) const;
-
-  size_t byte_size (void) const { return sizeof (ST); }
-
-  octave_value all (int = 0) const { return (scalar != ST ()); }
-
-  octave_value any (int = 0) const { return (scalar != ST ()); }
-
-  octave_value diag (octave_idx_type k = 0) const;
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  octave_value sort (octave_idx_type, sortmode) const
-    { return octave_value (scalar); }
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type,
-                     sortmode) const
-    {
-      sidx.resize (dim_vector (1, 1));
-      sidx(0) = 0;
-      return octave_value (scalar);
-    }
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const
-    { return mode ? mode : ASCENDING; }
-
-  Array<octave_idx_type> sort_rows_idx (sortmode) const
-    {
-      return Array<octave_idx_type> (dim_vector (1, 1),
-                                     static_cast<octave_idx_type> (0));
-    }
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
-    { return mode ? mode : ASCENDING; }
-
-  MatrixType matrix_type (void) const { return MatrixType::Diagonal; }
-  MatrixType matrix_type (const MatrixType&) const
-    { return matrix_type (); }
-
-  bool is_scalar_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return true; }
-
-  bool is_true (void) const;
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool print_name_tag (std::ostream& os, const std::string& name) const;
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const { return const_cast<ST *> (&scalar); }
-
-  const ST& scalar_ref (void) const { return scalar; }
-
-  ST& scalar_ref (void) { return scalar; }
-
-  bool fast_elem_insert_self (void *where, builtin_type_t btyp) const;
-
-protected:
-
-  // The value of this scalar.
-  ST scalar;
-};
-
-#endif
--- a/src/ov-base-sparse.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,465 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-Copyright (C) 2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iomanip>
-#include <iostream>
-
-#include "oct-obj.h"
-#include "ov-base.h"
-#include "quit.h"
-#include "pr-output.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-#include "boolSparse.h"
-#include "ov-base-sparse.h"
-#include "pager.h"
-
-template <class T>
-octave_value
-octave_base_sparse<T>::do_index_op (const octave_value_list& idx,
-                                    bool resize_ok)
-{
-  octave_value retval;
-
-  octave_idx_type n_idx = idx.length ();
-
-  switch (n_idx)
-    {
-    case 0:
-      retval = matrix;
-      break;
-
-    case 1:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          retval = octave_value (matrix.index (i, resize_ok));
-      }
-      break;
-
-    case 2:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          {
-            idx_vector j = idx (1).index_vector ();
-
-            if (! error_state)
-              retval = octave_value (matrix.index (i, j, resize_ok));
-          }
-      }
-      break;
-    default:
-      error ("sparse indexing needs 1 or 2 indices");
-    }
-
-  return retval;
-}
-
-template <class T>
-octave_value
-octave_base_sparse<T>::subsref (const std::string& type,
-                                const std::list<octave_value_list>& idx)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      retval = do_index_op (idx.front ());
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval.next_subsref (type, idx);
-}
-
-template <class T>
-octave_value
-octave_base_sparse<T>::subsasgn (const std::string& type,
-                                 const std::list<octave_value_list>& idx,
-                                 const octave_value& rhs)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        if (type.length () == 1)
-          retval = numeric_assign (type, idx, rhs);
-        else
-          {
-            std::string nm = type_name ();
-            error ("in indexed assignment of %s, last lhs index must be ()",
-                   nm.c_str ());
-          }
-      }
-      break;
-
-    case '{':
-    case '.':
-      {
-        if (is_empty ())
-          {
-            octave_value tmp = octave_value::empty_conv (type, rhs);
-
-            retval = tmp.subsasgn (type, idx, rhs);
-          }
-        else
-          {
-            std::string nm = type_name ();
-            error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-          }
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval;
-}
-
-template <class T>
-void
-octave_base_sparse<T>::assign (const octave_value_list& idx, const T& rhs)
-{
-
-  octave_idx_type len = idx.length ();
-
-  switch (len)
-    {
-    case 1:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          matrix.assign (i, rhs);
-
-        break;
-      }
-
-    case 2:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          {
-            idx_vector j = idx (1).index_vector ();
-
-            if (! error_state)
-              matrix.assign (i, j, rhs);
-          }
-
-        break;
-      }
-
-    default:
-      error ("sparse indexing needs 1 or 2 indices");
-    }
-
-
-  // Invalidate matrix type.
-  typ.invalidate_type ();
-}
-
-template <class MT>
-void
-octave_base_sparse<MT>::delete_elements (const octave_value_list& idx)
-{
-  octave_idx_type len = idx.length ();
-
-  switch (len)
-    {
-    case 1:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          matrix.delete_elements (i);
-
-        break;
-      }
-
-    case 2:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          {
-            idx_vector j = idx (1).index_vector ();
-
-            if (! error_state)
-              matrix.delete_elements (i, j);
-          }
-
-        break;
-      }
-
-    default:
-      error ("sparse indexing needs 1 or 2 indices");
-    }
-
-  // Invalidate the matrix type
-  typ.invalidate_type ();
-}
-
-template <class T>
-octave_value
-octave_base_sparse<T>::resize (const dim_vector& dv, bool) const
-{
-  T retval (matrix);
-  retval.resize (dv);
-  return retval;
-}
-
-template <class T>
-bool
-octave_base_sparse<T>::is_true (void) const
-{
-  bool retval = false;
-  dim_vector dv = matrix.dims ();
-  octave_idx_type nel = dv.numel ();
-  octave_idx_type nz = nnz ();
-
-  if (nz == nel && nel > 0)
-    {
-      T t1 (matrix.reshape (dim_vector (nel, 1)));
-
-      SparseBoolMatrix t2 = t1.all ();
-
-      retval = t2(0);
-    }
-
-  return retval;
-}
-
-template <class T>
-bool
-octave_base_sparse<T>::print_as_scalar (void) const
-{
-  dim_vector dv = dims ();
-
-  return (dv.all_ones () || dv.any_zero ());
-}
-
-template <class T>
-void
-octave_base_sparse<T>::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-
-template <class T>
-void
-octave_base_sparse<T>::print_info (std::ostream& os,
-                                   const std::string& prefix) const
-{
-  matrix.print_info (os, prefix);
-}
-
-template <class T>
-void
-octave_base_sparse<T>::print_raw (std::ostream& os,
-                                  bool pr_as_read_syntax) const
-{
-  octave_idx_type nr = matrix.rows ();
-  octave_idx_type nc = matrix.cols ();
-  octave_idx_type nz = nnz ();
-
-  // FIXME -- this should probably all be handled by a
-  // separate octave_print_internal function that can handle format
-  // compact, loose, etc.
-
-  os << "Compressed Column Sparse (rows = " << nr
-     << ", cols = " << nc
-     << ", nnz = " << nz;
-
-  // Avoid calling numel here since it can easily overflow
-  // octave_idx_type even when there is no real problem storing the
-  // sparse array.
-
-  double dnr = nr;
-  double dnc = nc;
-  double dnel = dnr * dnc;
-
-  if (dnel > 0)
-    {
-      double pct = (nz / dnel * 100);
-
-      int prec = 2;
-
-      // Display at least 2 significant figures and up to 4 as we
-      // approach 100%.  Avoid having limited precision of the display
-      // result in reporting 100% for matrices that are not actually
-      // 100% full.
-
-      if (pct == 100)
-        prec = 3;
-      else
-        {
-          if (pct > 99.9)
-            prec = 4;
-          else if (pct > 99)
-            prec = 3;
-
-          if (pct > 99.99)
-            pct = 99.99;
-        }
-
-      os << " [" << std::setprecision (prec) << pct << "%]";
-    }
-
-  os << ")\n";
-
-  // add one to the printed indices to go from
-  //  zero-based to one-based arrays
-
-  if (nz != 0)
-    {
-      for (octave_idx_type j = 0; j < nc; j++)
-        {
-          octave_quit ();
-
-          // FIXME -- is there an easy way to get the max row
-          // and column indices so we can set the width appropriately
-          // and line up the columns here?  Similarly, we should look
-          // at all the nonzero values and display them with the same
-          // formatting rules that apply to columns of a matrix.
-
-          for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
-            {
-              os << "\n";
-              os << "  (" << matrix.ridx (i)+1 <<
-                ", "  << j+1 << ") -> ";
-
-              octave_print_internal (os, matrix.data (i), pr_as_read_syntax);
-            }
-        }
-    }
-}
-
-template <class T>
-bool
-octave_base_sparse<T>::save_ascii (std::ostream& os)
-{
-  dim_vector dv = this->dims ();
-
-  // Ensure that additional memory is deallocated
-  matrix.maybe_compress ();
-
-  os << "# nnz: "      << nnz () << "\n";
-  os << "# rows: "     << dv (0) << "\n";
-  os << "# columns: "  << dv (1) << "\n";
-
-  os << this->matrix;
-
-  return true;
-}
-
-template <class T>
-bool
-octave_base_sparse<T>::load_ascii (std::istream& is)
-{
-  octave_idx_type nz = 0;
-  octave_idx_type nr = 0;
-  octave_idx_type nc = 0;
-  bool success = true;
-
-  if (extract_keyword (is, "nnz", nz, true) &&
-      extract_keyword (is, "rows", nr, true) &&
-      extract_keyword (is, "columns", nc, true))
-    {
-      T tmp (nr, nc, nz);
-
-      is >> tmp;
-
-      if (!is)
-        {
-          error ("load: failed to load matrix constant");
-          success = false;
-        }
-
-      matrix = tmp;
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-template <class T>
-octave_value
-octave_base_sparse<T>::map (octave_base_value::unary_mapper_t umap) const
-{
-  // Try the map on the dense value.
-  octave_value retval = this->full_value ().map (umap);
-
-  // Sparsify the result if possible.
-  // FIXME: intentionally skip this step for string mappers. Is this wanted?
-  if (umap >= umap_xisalnum && umap <= umap_xtoupper)
-    return retval;
-
-  switch (retval.builtin_type ())
-    {
-    case btyp_double:
-      retval = retval.sparse_matrix_value ();
-      break;
-    case btyp_complex:
-      retval = retval.sparse_complex_matrix_value ();
-      break;
-    case btyp_bool:
-      retval = retval.sparse_bool_matrix_value ();
-      break;
-    default:
-      break;
-    }
-
-  return retval;
-}
--- a/src/ov-base-sparse.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-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_base_sparse_h)
-#define octave_base_sparse_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-obj.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-#include "boolSparse.h"
-#include "MatrixType.h"
-
-class tree_walker;
-
-class octave_sparse_bool_matrix;
-
-template <class T>
-class
-octave_base_sparse : public octave_base_value
-{
- public:
-
-  octave_base_sparse (void)
-    : octave_base_value (), matrix (), typ (MatrixType ())
-  { }
-
-  octave_base_sparse (const T& a) : octave_base_value (), matrix (a),
-                                    typ (MatrixType ())
-  {
-    if (matrix.ndims () == 0)
-      matrix.resize (dim_vector (0, 0));
-  }
-
-  octave_base_sparse (const T& a, const MatrixType& t) : octave_base_value (),
-                                matrix (a), typ (t)
-  {
-    if (matrix.ndims () == 0)
-      matrix.resize (dim_vector (0, 0));
-  }
-
-  octave_base_sparse (const octave_base_sparse& a) :
-    octave_base_value (), matrix (a.matrix), typ (a.typ) { }
-
-  ~octave_base_sparse (void) { }
-
-  octave_idx_type nnz (void) const { return matrix.nnz (); }
-
-  octave_idx_type nzmax (void) const { return matrix.nzmax (); }
-
-  size_t byte_size (void) const { return matrix.byte_size (); }
-
-  octave_value squeeze (void) const { return matrix.squeeze (); }
-
-  octave_value full_value (void) const { return matrix.matrix_value (); }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int)
-    { return subsref (type, idx); }
-
-  octave_value subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs);
-
-  void assign (const octave_value_list& idx, const T& rhs);
-
-  void delete_elements (const octave_value_list& idx);
-
-  dim_vector dims (void) const { return matrix.dims (); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return T (matrix.reshape (new_dims)); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return T (matrix.permute (vec, inv)); }
-
-  octave_value resize (const dim_vector& dv, bool = false) const;
-
-  octave_value all (int dim = 0) const { return matrix.all (dim); }
-  octave_value any (int dim = 0) const { return matrix.any (dim); }
-
-  octave_value diag (octave_idx_type k = 0) const
-    { return octave_value (matrix.diag (k)); }
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
-    { return octave_value (matrix.sort (dim, mode)); }
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const
-    { return octave_value (matrix.sort (sidx, dim, mode)); }
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const
-    { return full_value ().is_sorted (mode); }
-
-  MatrixType matrix_type (void) const { return typ; }
-  MatrixType matrix_type (const MatrixType& _typ) const
-    { MatrixType ret = typ; typ = _typ; return ret; }
-
-  bool is_matrix_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return true; }
-
-  bool is_sparse_type (void) const { return true; }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_true (void) const;
-
-  octave_idx_type capacity (void) const { return matrix.capacity (); }
-
-  bool print_as_scalar (void) const;
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_info (std::ostream& os, const std::string& prefix) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  // Unsafe.  These functions exists to support the MEX interface.
-  // You should not use them anywhere else.
-  void *mex_get_data (void) const { return matrix.mex_get_data (); }
-
-  octave_idx_type *mex_get_ir (void) const { return matrix.mex_get_ir (); }
-
-  octave_idx_type *mex_get_jc (void) const { return matrix.mex_get_jc (); }
-
-protected:
-
-  octave_value map (octave_base_value::unary_mapper_t umap) const;
-
-  T matrix;
-
-  mutable MatrixType typ;
-};
-
-#endif
--- a/src/ov-base.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1579 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-mappers.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-map.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-base.h"
-#include "ov-cell.h"
-#include "ov-ch-mat.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-range.h"
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-#include "ov-str-mat.h"
-#include "ov-fcn-handle.h"
-#include "parse.h"
-#include "pr-output.h"
-#include "utils.h"
-#include "variables.h"
-
-builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y)
-{
-  builtin_type_t retval = btyp_unknown;
-
-  if (x == btyp_bool)
-    x = btyp_double;
-  if (y == btyp_bool)
-    y = btyp_double;
-
-  if (x <= btyp_float_complex && y <= btyp_float_complex)
-    retval = static_cast<builtin_type_t> (x | y);
-  else if (x <= btyp_uint64 && y <= btyp_float)
-    retval = x;
-  else if (x <= btyp_float && y <= btyp_uint64)
-    retval = y;
-  else if ((x >= btyp_int8 && x <= btyp_int64
-            && y >= btyp_int8 && y <= btyp_int64)
-           || (x >= btyp_uint8 && x <= btyp_uint64
-               && y >= btyp_uint8 && y <= btyp_uint64))
-    retval = (x > y) ? x : y;
-
-  return retval;
-}
-
-std::string btyp_class_name[btyp_num_types] =
-{
-  "double", "single", "double", "single",
-  "int8", "int16", "int32", "int64",
-  "uint8", "uint16", "uint32", "uint64",
-  "logical", "char",
-  "struct", "cell", "function_handle"
-};
-
-string_vector
-get_builtin_classes (void)
-{
-  static string_vector retval;
-
-  if (retval.is_empty ())
-    {
-      int n = btyp_num_types - 2;
-      retval = string_vector (n);
-      int j = 0;
-      for (int i = 0; i < btyp_num_types; i++)
-        {
-          builtin_type_t ityp = static_cast<builtin_type_t> (i);
-          if (ityp != btyp_complex && ityp != btyp_float_complex)
-            retval(j++) = btyp_class_name[i];
-        }
-    }
-
-  return retval;
-}
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value,
-                                     "<unknown type>", "unknown");
-
-// TRUE means to perform automatic sparse to real mutation if there
-// is memory to be saved
-bool Vsparse_auto_mutate = false;
-
-octave_base_value *
-octave_base_value::empty_clone (void) const
-{
-  return resize (dim_vector ()).clone ();
-}
-
-octave_value
-octave_base_value::squeeze (void) const
-{
-  std::string nm = type_name ();
-  error ("squeeze: invalid operation for %s type", nm.c_str ());
-  return octave_value ();
-}
-
-octave_value
-octave_base_value::full_value (void) const
-{
-  gripe_wrong_type_arg ("full: invalid operation for %s type", type_name ());
-  return octave_value ();
-}
-
-Matrix
-octave_base_value::size (void)
-{
-  const dim_vector dv = dims ();
-  Matrix mdv (1, dv.length ());
-  for (octave_idx_type i = 0; i < dv.length (); i++)
-    mdv(i) = dv(i);
-  return mdv;
-}
-
-octave_idx_type
-octave_base_value::numel (const octave_value_list& idx)
-{
-  return dims_to_numel (dims (), idx);
-}
-
-octave_value
-octave_base_value::subsref (const std::string&,
-                            const std::list<octave_value_list>&)
-{
-  std::string nm = type_name ();
-  error ("can't perform indexing operations for %s type", nm.c_str ());
-  return octave_value ();
-}
-
-octave_value_list
-octave_base_value::subsref (const std::string&,
-                            const std::list<octave_value_list>&, int)
-{
-  std::string nm = type_name ();
-  error ("can't perform indexing operations for %s type", nm.c_str ());
-  return octave_value ();
-}
-
-octave_value
-octave_base_value::subsref (const std::string& type,
-                            const std::list<octave_value_list>& idx,
-                            bool /* auto_add */)
-{
-  // This way we may get a more meaningful error message.
-  return subsref (type, idx);
-}
-
-octave_value_list
-octave_base_value::subsref (const std::string& type,
-                            const std::list<octave_value_list>& idx,
-                            int nargout,
-                            const std::list<octave_lvalue> *)
-{
-  // Fall back to call without passing lvalue list.
-  return subsref (type, idx, nargout);
-}
-
-octave_value
-octave_base_value::do_index_op (const octave_value_list&, bool)
-{
-  std::string nm = type_name ();
-  error ("can't perform indexing operations for %s type", nm.c_str ());
-  return octave_value ();
-}
-
-octave_value_list
-octave_base_value::do_multi_index_op (int, const octave_value_list&)
-{
-  std::string nm = type_name ();
-  error ("can't perform indexing operations for %s type", nm.c_str ());
-  return octave_value ();
-}
-
-octave_value_list
-octave_base_value::do_multi_index_op (int nargout, const octave_value_list& idx,
-                                      const std::list<octave_lvalue> *)
-{
-  // Fall back.
-  return do_multi_index_op (nargout, idx);
-}
-
-idx_vector
-octave_base_value::index_vector (void) const
-{
-  std::string nm = type_name ();
-  error ("%s type invalid as index value", nm.c_str ());
-  return idx_vector ();
-}
-
-octave_value
-octave_base_value::subsasgn (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             const octave_value& rhs)
-{
-  octave_value retval;
-
-  if (is_defined ())
-    {
-      if (is_numeric_type ())
-        {
-          switch (type[0])
-            {
-            case '(':
-              {
-                if (type.length () == 1)
-                  retval = numeric_assign (type, idx, rhs);
-                else if (is_empty ())
-                  {
-                    // Allow conversion of empty matrix to some other
-                    // type in cases like
-                    //
-                    //  x = []; x(i).f = rhs
-
-                    octave_value tmp = octave_value::empty_conv (type, rhs);
-
-                    retval = tmp.subsasgn (type, idx, rhs);
-                  }
-                else
-                  {
-                    std::string nm = type_name ();
-                    error ("in indexed assignment of %s, last rhs index must be ()",
-                           nm.c_str ());
-                  }
-              }
-              break;
-
-            case '{':
-            case '.':
-              {
-                std::string nm = type_name ();
-                error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-              }
-              break;
-
-            default:
-              panic_impossible ();
-            }
-        }
-      else
-        {
-          std::string nm = type_name ();
-          error ("can't perform indexed assignment for %s type", nm.c_str ());
-        }
-    }
-  else
-    {
-      // Create new object of appropriate type for given index and rhs
-      // types and then call undef_subsasgn for that object.
-
-      octave_value tmp = octave_value::empty_conv (type, rhs);
-
-      retval = tmp.undef_subsasgn (type, idx, rhs);
-    }
-
-  return retval;
-}
-
-octave_value
-octave_base_value::undef_subsasgn (const std::string& type,
-                                   const std::list<octave_value_list>& idx,
-                                   const octave_value& rhs)
-{
-  // In most cases, undef_subsasgn is handled the sams as subsasgn.  One
-  // exception is octave_class objects.
-
-  return subsasgn (type, idx, rhs);
-}
-
-octave_idx_type
-octave_base_value::nnz (void) const
-{
-  gripe_wrong_type_arg ("octave_base_value::nnz ()", type_name ());
-  return -1;
-}
-
-octave_idx_type
-octave_base_value::nzmax (void) const
-{
-  return numel ();
-}
-
-octave_idx_type
-octave_base_value::nfields (void) const
-{
-  gripe_wrong_type_arg ("octave_base_value::nfields ()", type_name ());
-  return -1;
-}
-
-octave_value
-octave_base_value::reshape (const dim_vector&) const
-{
-  gripe_wrong_type_arg ("octave_base_value::reshape ()", type_name ());
-  return octave_value ();
-}
-
-octave_value
-octave_base_value::permute (const Array<int>&, bool) const
-{
-  gripe_wrong_type_arg ("octave_base_value::permute ()", type_name ());
-  return octave_value ();
-}
-
-octave_value
-octave_base_value::resize (const dim_vector&, bool) const
-{
-  gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ());
-  return octave_value ();
-}
-
-MatrixType
-octave_base_value::matrix_type (void) const
-{
-  gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
-  return MatrixType ();
-}
-
-MatrixType
-octave_base_value::matrix_type (const MatrixType&) const
-{
-  gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
-  return MatrixType ();
-}
-
-octave_value
-octave_base_value::all (int) const
-{
-  return 0.0;
-}
-
-octave_value
-octave_base_value::any (int) const
-{
-  return 0.0;
-}
-
-octave_value
-octave_base_value::convert_to_str (bool pad, bool force, char type) const
-{
-  octave_value retval = convert_to_str_internal (pad, force, type);
-
-  if (! force && is_numeric_type ())
-    gripe_implicit_conversion ("Octave:num-to-str",
-                               type_name (), retval.type_name ());
-
-  return retval;
-}
-
-octave_value
-octave_base_value::convert_to_str_internal (bool, bool, char) const
-{
-  gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()",
-                        type_name ());
-  return octave_value ();
-}
-
-void
-octave_base_value::convert_to_row_or_column_vector (void)
-{
-  gripe_wrong_type_arg
-    ("octave_base_value::convert_to_row_or_column_vector ()",
-     type_name ());
-}
-
-void
-octave_base_value::print (std::ostream&, bool) const
-{
-  gripe_wrong_type_arg ("octave_base_value::print ()", type_name ());
-}
-
-void
-octave_base_value::print_raw (std::ostream&, bool) const
-{
-  gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ());
-}
-
-bool
-octave_base_value::print_name_tag (std::ostream& os, const std::string& name) const
-{
-  bool retval = false;
-
-  indent (os);
-
-  if (print_as_scalar ())
-    os << name << " = ";
-  else
-    {
-      os << name << " =";
-      newline (os);
-      if (! Vcompact_format)
-        newline (os);
-
-      retval = true;
-    }
-
-  return retval;
-}
-
-void
-octave_base_value::print_with_name (std::ostream& output_buf,
-                                    const std::string& name,
-                                    bool print_padding)
-{
-  bool pad_after = print_name_tag (output_buf, name);
-
-  print (output_buf);
-
-  if (print_padding  && pad_after && ! Vcompact_format)
-    newline (output_buf);
-}
-
-void
-octave_base_value::print_info (std::ostream& os,
-                               const std::string& /* prefix */) const
-{
-  os << "no info for type: " << type_name () << "\n";
-}
-
-#define INT_CONV_METHOD(T, F, MIN_LIMIT, MAX_LIMIT) \
-  T \
-  octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
-  { \
-    T retval = 0; \
- \
-    double d = double_value (frc_str_conv); \
- \
-    if (! error_state) \
-      { \
-        if (require_int && D_NINT (d) != d) \
-          error_with_cfn ("conversion of %g to " #T " value failed", d); \
-        else if (d < MIN_LIMIT) \
-          retval = MIN_LIMIT; \
-        else if (d > MAX_LIMIT) \
-          retval = MAX_LIMIT; \
-        else \
-          retval = static_cast<T> (::fix (d));  \
-      } \
-    else \
-      gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \
-                            type_name ()); \
- \
-    return retval; \
-  }
-
-INT_CONV_METHOD (short int, short, SHRT_MIN, SHRT_MAX)
-INT_CONV_METHOD (unsigned short int, ushort, 0, USHRT_MAX)
-
-INT_CONV_METHOD (int, int, INT_MIN, INT_MAX)
-INT_CONV_METHOD (unsigned int, uint, 0, UINT_MAX)
-
-INT_CONV_METHOD (long int, long, LONG_MIN, LONG_MAX)
-INT_CONV_METHOD (unsigned long int, ulong, 0, ULONG_MAX)
-
-int
-octave_base_value::nint_value (bool frc_str_conv) const
-{
-  int retval = 0;
-
-  double d = double_value (frc_str_conv);
-
-  if (! error_state)
-    {
-      if (xisnan (d))
-        {
-          error ("conversion of NaN to integer value failed");
-          return retval;
-        }
-
-      retval = static_cast<int> (::fix (d));
-    }
-  else
-    gripe_wrong_type_arg ("octave_base_value::nint_value ()", type_name ());
-
-  return retval;
-}
-
-double
-octave_base_value::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-  gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
-  return retval;
-}
-
-float
-octave_base_value::float_value (bool) const
-{
-  float retval = lo_ieee_float_nan_value ();
-  gripe_wrong_type_arg ("octave_base_value::float_value ()", type_name ());
-  return retval;
-}
-
-Cell
-octave_base_value::cell_value () const
-{
-  Cell retval;
-  gripe_wrong_type_arg ("octave_base_value::cell_value()", type_name ());
-  return retval;
-}
-
-Matrix
-octave_base_value::matrix_value (bool) const
-{
-  Matrix retval;
-  gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
-  return retval;
-}
-
-FloatMatrix
-octave_base_value::float_matrix_value (bool) const
-{
-  FloatMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::float_matrix_value()", type_name ());
-  return retval;
-}
-
-NDArray
-octave_base_value::array_value (bool) const
-{
-  FloatNDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ());
-  return retval;
-}
-
-FloatNDArray
-octave_base_value::float_array_value (bool) const
-{
-  FloatNDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::float_array_value()", type_name ());
-  return retval;
-}
-
-Complex
-octave_base_value::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-  Complex retval (tmp, tmp);
-  gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
-  return retval;
-}
-
-FloatComplex
-octave_base_value::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-  FloatComplex retval (tmp, tmp);
-  gripe_wrong_type_arg ("octave_base_value::float_complex_value()", type_name ());
-  return retval;
-}
-
-ComplexMatrix
-octave_base_value::complex_matrix_value (bool) const
-{
-  ComplexMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()",
-                        type_name ());
-  return retval;
-}
-
-FloatComplexMatrix
-octave_base_value::float_complex_matrix_value (bool) const
-{
-  FloatComplexMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::float_complex_matrix_value()",
-                        type_name ());
-  return retval;
-}
-
-ComplexNDArray
-octave_base_value::complex_array_value (bool) const
-{
-  ComplexNDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::complex_array_value()",
-                        type_name ());
-  return retval;
-}
-
-FloatComplexNDArray
-octave_base_value::float_complex_array_value (bool) const
-{
-  FloatComplexNDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::float_complex_array_value()",
-                        type_name ());
-  return retval;
-}
-
-bool
-octave_base_value::bool_value (bool) const
-{
-  bool retval = false;
-  gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ());
-  return retval;
-}
-
-boolMatrix
-octave_base_value::bool_matrix_value (bool) const
-{
-  boolMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()",
-                        type_name ());
-  return retval;
-}
-
-boolNDArray
-octave_base_value::bool_array_value (bool) const
-{
-  boolNDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::bool_array_value()",
-                        type_name ());
-  return retval;
-}
-
-charMatrix
-octave_base_value::char_matrix_value (bool force) const
-{
-  charMatrix retval;
-
-  octave_value tmp = convert_to_str (false, force);
-
-  if (! error_state)
-    retval = tmp.char_matrix_value ();
-
-  return retval;
-}
-
-charNDArray
-octave_base_value::char_array_value (bool) const
-{
-  charNDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::char_array_value()",
-                        type_name ());
-  return retval;
-}
-
-SparseMatrix
-octave_base_value::sparse_matrix_value (bool) const
-{
-  SparseMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ());
-  return retval;
-}
-
-SparseComplexMatrix
-octave_base_value::sparse_complex_matrix_value (bool) const
-{
-  SparseComplexMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()", type_name ());
-  return retval;
-}
-
-SparseBoolMatrix
-octave_base_value::sparse_bool_matrix_value (bool) const
-{
-  SparseBoolMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()", type_name ());
-  return retval;
-}
-
-DiagMatrix
-octave_base_value::diag_matrix_value (bool) const
-{
-  DiagMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ());
-  return retval;
-}
-
-FloatDiagMatrix
-octave_base_value::float_diag_matrix_value (bool) const
-{
-  FloatDiagMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::float_diag_matrix_value()", type_name ());
-  return retval;
-}
-
-ComplexDiagMatrix
-octave_base_value::complex_diag_matrix_value (bool) const
-{
-  ComplexDiagMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()", type_name ());
-  return retval;
-}
-
-FloatComplexDiagMatrix
-octave_base_value::float_complex_diag_matrix_value (bool) const
-{
-  FloatComplexDiagMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()", type_name ());
-  return retval;
-}
-
-PermMatrix
-octave_base_value::perm_matrix_value (void) const
-{
-  PermMatrix retval;
-  gripe_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ());
-  return retval;
-}
-
-octave_int8
-octave_base_value::int8_scalar_value (void) const
-{
-  octave_int8 retval;
-  gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()",
-                        type_name ());
-  return retval;
-}
-
-octave_int16
-octave_base_value::int16_scalar_value (void) const
-{
-  octave_int16 retval;
-  gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()",
-                        type_name ());
-  return retval;
-}
-
-octave_int32
-octave_base_value::int32_scalar_value (void) const
-{
-  octave_int32 retval;
-  gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()",
-                        type_name ());
-  return retval;
-}
-
-octave_int64
-octave_base_value::int64_scalar_value (void) const
-{
-  octave_int64 retval;
-  gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()",
-                        type_name ());
-  return retval;
-}
-
-octave_uint8
-octave_base_value::uint8_scalar_value (void) const
-{
-  octave_uint8 retval;
-  gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()",
-                        type_name ());
-  return retval;
-}
-
-octave_uint16
-octave_base_value::uint16_scalar_value (void) const
-{
-  octave_uint16 retval;
-  gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()",
-                        type_name ());
-  return retval;
-}
-
-octave_uint32
-octave_base_value::uint32_scalar_value (void) const
-{
-  octave_uint32 retval;
-  gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()",
-                        type_name ());
-  return retval;
-}
-
-octave_uint64
-octave_base_value::uint64_scalar_value (void) const
-{
-  octave_uint64 retval;
-  gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()",
-                        type_name ());
-  return retval;
-}
-
-int8NDArray
-octave_base_value::int8_array_value (void) const
-{
-  int8NDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::int8_array_value()",
-                        type_name ());
-  return retval;
-}
-
-int16NDArray
-octave_base_value::int16_array_value (void) const
-{
-  int16NDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::int16_array_value()",
-                        type_name ());
-  return retval;
-}
-
-int32NDArray
-octave_base_value::int32_array_value (void) const
-{
-  int32NDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::int32_array_value()",
-                        type_name ());
-  return retval;
-}
-
-int64NDArray
-octave_base_value::int64_array_value (void) const
-{
-  int64NDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::int64_array_value()",
-                        type_name ());
-  return retval;
-}
-
-uint8NDArray
-octave_base_value::uint8_array_value (void) const
-{
-  uint8NDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::uint8_array_value()",
-                        type_name ());
-  return retval;
-}
-
-uint16NDArray
-octave_base_value::uint16_array_value (void) const
-{
-  uint16NDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::uint16_array_value()",
-                        type_name ());
-  return retval;
-}
-
-uint32NDArray
-octave_base_value::uint32_array_value (void) const
-{
-  uint32NDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::uint32_array_value()",
-                        type_name ());
-  return retval;
-}
-
-uint64NDArray
-octave_base_value::uint64_array_value (void) const
-{
-  uint64NDArray retval;
-  gripe_wrong_type_arg ("octave_base_value::uint64_array_value()",
-                        type_name ());
-  return retval;
-}
-
-string_vector
-octave_base_value::all_strings (bool pad) const
-{
-  string_vector retval;
-
-  octave_value tmp = convert_to_str (pad, true);
-
-  if (! error_state)
-    retval = tmp.all_strings ();
-
-  return retval;
-}
-
-std::string
-octave_base_value::string_value (bool force) const
-{
-  std::string retval;
-
-  octave_value tmp = convert_to_str (force);
-
-  if (! error_state)
-    retval = tmp.string_value ();
-
-  return retval;
-}
-
-Array<std::string>
-octave_base_value::cellstr_value (void) const
-{
-  Array<std::string> retval;
-  gripe_wrong_type_arg ("octave_base_value::cellstry_value()",
-                        type_name ());
-  return retval;
-}
-
-Range
-octave_base_value::range_value (void) const
-{
-  Range retval;
-  gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ());
-  return retval;
-}
-
-octave_map
-octave_base_value::map_value (void) const
-{
-  octave_map retval;
-  gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ());
-  return retval;
-}
-
-octave_scalar_map
-octave_base_value::scalar_map_value (void) const
-{
-  octave_map tmp = map_value ();
-
-  if (tmp.numel () == 1)
-    return tmp.checkelem (0);
-  else
-    {
-      if (! error_state)
-        error ("invalid conversion of multi-dimensional struct to scalar struct");
-
-      return octave_scalar_map ();
-    }
-}
-
-string_vector
-octave_base_value::map_keys (void) const
-{
-  string_vector retval;
-  gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ());
-  return retval;
-}
-
-size_t
-octave_base_value::nparents (void) const
-{
-  size_t retval = 0;
-  gripe_wrong_type_arg ("octave_base_value::nparents()", type_name ());
-  return retval;
-}
-
-std::list<std::string>
-octave_base_value::parent_class_name_list (void) const
-{
-  std::list<std::string> retval;
-  gripe_wrong_type_arg ("octave_base_value::parent_class_name_list()",
-                        type_name ());
-  return retval;
-}
-
-string_vector
-octave_base_value::parent_class_names (void) const
-{
-  string_vector retval;
-  gripe_wrong_type_arg ("octave_base_value::parent_class_names()",
-                        type_name ());
-  return retval;
-}
-
-octave_function *
-octave_base_value::function_value (bool silent)
-{
-  octave_function *retval = 0;
-
-  if (! silent)
-    gripe_wrong_type_arg ("octave_base_value::function_value()",
-                          type_name ());
-  return retval;
-}
-
-octave_user_function *
-octave_base_value::user_function_value (bool silent)
-{
-  octave_user_function *retval = 0;
-
-  if (! silent)
-    gripe_wrong_type_arg ("octave_base_value::user_function_value()",
-                          type_name ());
-  return retval;
-}
-
-octave_user_script *
-octave_base_value::user_script_value (bool silent)
-{
-  octave_user_script *retval = 0;
-
-  if (! silent)
-    gripe_wrong_type_arg ("octave_base_value::user_script_value()",
-                          type_name ());
-  return retval;
-}
-
-octave_user_code *
-octave_base_value::user_code_value (bool silent)
-{
-  octave_user_code *retval = 0;
-
-  if (! silent)
-    gripe_wrong_type_arg ("octave_base_value::user_code_value()",
-                          type_name ());
-  return retval;
-}
-
-octave_fcn_handle *
-octave_base_value::fcn_handle_value (bool silent)
-{
-  octave_fcn_handle *retval = 0;
-
-  if (! silent)
-    gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()",
-                          type_name ());
-  return retval;
-}
-
-octave_fcn_inline *
-octave_base_value::fcn_inline_value (bool silent)
-{
-  octave_fcn_inline *retval = 0;
-
-  if (! silent)
-    gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()",
-                          type_name ());
-  return retval;
-}
-
-octave_value_list
-octave_base_value::list_value (void) const
-{
-  octave_value_list retval;
-  gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ());
-  return retval;
-}
-
-bool
-octave_base_value::save_ascii (std::ostream&)
-{
-  gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ());
-  return false;
-}
-
-bool
-octave_base_value::load_ascii (std::istream&)
-{
-  gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ());
-  return false;
-}
-
-bool
-octave_base_value::save_binary (std::ostream&, bool&)
-{
-  gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
-  return false;
-}
-
-bool
-octave_base_value::load_binary (std::istream&, bool,
-                                oct_mach_info::float_format)
-{
-  gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
-  return false;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_base_value::save_hdf5 (hid_t, const char *, bool)
-{
-  gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
-
-  return false;
-}
-
-bool
-octave_base_value::load_hdf5 (hid_t, const char *)
-{
-  gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
-
-  return false;
-}
-
-#endif
-
-int
-octave_base_value::write (octave_stream&, int, oct_data_conv::data_type,
-                          int, oct_mach_info::float_format) const
-{
-  gripe_wrong_type_arg ("octave_base_value::write()", type_name ());
-
-  return false;
-}
-
-mxArray *
-octave_base_value::as_mxArray (void) const
-{
-  return 0;
-}
-
-octave_value
-octave_base_value::diag (octave_idx_type) const
-{
-  gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ());
-
-  return octave_value ();
-}
-
-octave_value
-octave_base_value::diag (octave_idx_type, octave_idx_type) const
-{
-  gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ());
-
-  return octave_value ();
-}
-
-octave_value
-octave_base_value::sort (octave_idx_type, sortmode) const
-{
-  gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ());
-
-  return octave_value ();
-}
-
-octave_value
-octave_base_value::sort (Array<octave_idx_type> &,
-                         octave_idx_type, sortmode) const
-{
-  gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ());
-
-  return octave_value ();
-}
-
-sortmode
-octave_base_value::is_sorted (sortmode) const
-{
-  gripe_wrong_type_arg ("octave_base_value::is_sorted ()", type_name ());
-
-  return UNSORTED;
-}
-
-Array<octave_idx_type>
-octave_base_value::sort_rows_idx (sortmode) const
-{
-  gripe_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ());
-
-  return Array<octave_idx_type> ();
-}
-
-sortmode
-octave_base_value::is_sorted_rows (sortmode) const
-{
-  gripe_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ());
-
-  return UNSORTED;
-}
-
-
-const char *
-octave_base_value::get_umap_name (unary_mapper_t umap)
-{
-  static const char *names[num_unary_mappers] =
-    {
-      "abs",
-      "acos",
-      "acosh",
-      "angle",
-      "arg",
-      "asin",
-      "asinh",
-      "atan",
-      "atanh",
-      "cbrt",
-      "ceil",
-      "conj",
-      "cos",
-      "cosh",
-      "erf",
-      "erfinv",
-      "erfcinv",
-      "erfc",
-      "exp",
-      "expm1",
-      "finite",
-      "fix",
-      "floor",
-      "gamma",
-      "imag",
-      "isinf",
-      "isna",
-      "isnan",
-      "lgamma",
-      "log",
-      "log2",
-      "log10",
-      "log1p",
-      "real",
-      "round",
-      "roundb",
-      "signum",
-      "sin",
-      "sinh",
-      "sqrt",
-      "tan",
-      "tanh",
-      "isalnum",
-      "isalpha",
-      "isascii",
-      "iscntrl",
-      "isdigit",
-      "isgraph",
-      "islower",
-      "isprint",
-      "ispunct",
-      "isspace",
-      "isupper",
-      "isxdigit",
-      "toascii",
-      "tolower",
-      "toupper"
-    };
-
-  if (umap < 0 || umap >= num_unary_mappers)
-    return "unknown";
-  else
-    return names[umap];
-}
-
-octave_value
-octave_base_value::map (unary_mapper_t umap) const
-{
-  error ("%s: not defined for %s", get_umap_name (umap), type_name ().c_str ());
-  return octave_value ();
-}
-
-void
-octave_base_value::lock (void)
-{
-  gripe_wrong_type_arg ("octave_base_value::lock ()", type_name ());
-}
-
-void
-octave_base_value::unlock (void)
-{
-  gripe_wrong_type_arg ("octave_base_value::unlock ()", type_name ());
-}
-
-void
-octave_base_value::dump (std::ostream& os) const
-{
-  dim_vector dv = this->dims ();
-
-  os << "class: " << this->class_name ()
-     << " type: " << this->type_name ()
-     << " dims: " << dv.str ();
-}
-
-static void
-gripe_indexed_assignment (const std::string& tn1, const std::string& tn2)
-{
-  error ("assignment of `%s' to indexed `%s' not implemented",
-         tn2.c_str (), tn1.c_str ());
-}
-
-static void
-gripe_assign_conversion_failed (const std::string& tn1,
-                                const std::string& tn2)
-{
-  error ("type conversion for assignment of `%s' to indexed `%s' failed",
-         tn2.c_str (), tn1.c_str ());
-}
-
-static void
-gripe_no_conversion (const std::string& on, const std::string& tn1,
-                     const std::string& tn2)
-{
-  error ("operator %s: no conversion for assignment of `%s' to indexed `%s'",
-         on.c_str (), tn2.c_str (), tn1.c_str ());
-}
-
-octave_value
-octave_base_value::numeric_assign (const std::string& type,
-                                   const std::list<octave_value_list>& idx,
-                                   const octave_value& rhs)
-{
-  octave_value retval;
-
-  if (idx.front ().empty ())
-    {
-      error ("missing index in indexed assignment");
-      return retval;
-    }
-
-  int t_lhs = type_id ();
-  int t_rhs = rhs.type_id ();
-
-  octave_value_typeinfo::assign_op_fcn f
-    = octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
-                                               t_lhs, t_rhs);
-
-  bool done = false;
-
-  if (f)
-    {
-      f (*this, idx.front (), rhs.get_rep ());
-
-      done = (! error_state);
-    }
-
-  if (done)
-    {
-      count++;
-      retval = octave_value (this);
-    }
-  else
-    {
-      int t_result
-        = octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, t_rhs);
-
-      if (t_result >= 0)
-        {
-          octave_base_value::type_conv_fcn cf
-            = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result);
-
-          if (cf)
-            {
-              octave_base_value *tmp = cf (*this);
-
-              if (tmp)
-                {
-                  octave_value val (tmp);
-
-                  retval = val.subsasgn (type, idx, rhs);
-
-                  done = (! error_state);
-                }
-              else
-                gripe_assign_conversion_failed (type_name (),
-                                                rhs.type_name ());
-            }
-          else
-            gripe_indexed_assignment (type_name (), rhs.type_name ());
-        }
-
-      if (! (done || error_state))
-        {
-          octave_value tmp_rhs;
-
-          octave_base_value::type_conv_info cf_rhs
-            = rhs.numeric_conversion_function ();
-
-          octave_base_value::type_conv_info cf_this
-            = numeric_conversion_function ();
-
-          // Try biased (one-sided) conversions first.
-          if (cf_rhs.type_id () >= 0
-              && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
-                                                           t_lhs, cf_rhs.type_id ())
-                  || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs,
-                                                                     cf_rhs.type_id ()) >= 0))
-            cf_this = 0;
-          else if (cf_this.type_id () >= 0
-                   && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq,
-                                                                cf_this.type_id (), t_rhs)
-                       || octave_value_typeinfo::lookup_pref_assign_conv (cf_this.type_id (),
-                                                                          t_rhs) >= 0))
-            cf_rhs = 0;
-
-          if (cf_rhs)
-            {
-              octave_base_value *tmp = cf_rhs (rhs.get_rep ());
-
-              if (tmp)
-                tmp_rhs = octave_value (tmp);
-              else
-                {
-                  gripe_assign_conversion_failed (type_name (),
-                                                  rhs.type_name ());
-                  return octave_value ();
-                }
-            }
-          else
-            tmp_rhs = rhs;
-
-          count++;
-          octave_value tmp_lhs = octave_value (this);
-
-          if (cf_this)
-            {
-              octave_base_value *tmp = cf_this (*this);
-
-              if (tmp)
-                tmp_lhs = octave_value (tmp);
-              else
-                {
-                  gripe_assign_conversion_failed (type_name (),
-                                                  rhs.type_name ());
-                  return octave_value ();
-                }
-            }
-
-          if (cf_this || cf_rhs)
-            {
-              retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
-
-              done = (! error_state);
-            }
-          else
-            gripe_no_conversion (octave_value::assign_op_as_string (octave_value::op_asn_eq),
-                                 type_name (), rhs.type_name ());
-        }
-    }
-
-  // The assignment may have converted to a type that is wider than
-  // necessary.
-
-  retval.maybe_mutate ();
-
-  return retval;
-}
-
-// Current indentation.
-int octave_base_value::curr_print_indent_level = 0;
-
-// TRUE means we are at the beginning of a line.
-bool octave_base_value::beginning_of_line = true;
-
-// Each print() function should call this before printing anything.
-//
-// This doesn't need to be fast, but isn't there a better way?
-
-void
-octave_base_value::indent (std::ostream& os) const
-{
-  assert (curr_print_indent_level >= 0);
-
-  if (beginning_of_line)
-    {
-      // FIXME -- do we need this?
-      // os << prefix;
-
-      for (int i = 0; i < curr_print_indent_level; i++)
-        os << " ";
-
-      beginning_of_line = false;
-    }
-}
-
-// All print() functions should use this to print new lines.
-
-void
-octave_base_value::newline (std::ostream& os) const
-{
-  os << "\n";
-
-  beginning_of_line = true;
-}
-
-// For ressetting print state.
-
-void
-octave_base_value::reset (void) const
-{
-  beginning_of_line = true;
-  curr_print_indent_level = 0;
-}
-
-
-octave_value
-octave_base_value::fast_elem_extract (octave_idx_type) const
-{
-  return octave_value ();
-}
-
-bool
-octave_base_value::fast_elem_insert (octave_idx_type, const octave_value&)
-{
-  return false;
-}
-
-bool
-octave_base_value::fast_elem_insert_self (void *, builtin_type_t) const
-{
-  return false;
-}
-
-CONVDECLX (matrix_conv)
-{
-  return new octave_matrix ();
-}
-
-CONVDECLX (complex_matrix_conv)
-{
-  return new octave_complex_matrix ();
-}
-
-CONVDECLX (string_conv)
-{
-  return new octave_char_matrix_str ();
-}
-
-CONVDECLX (cell_conv)
-{
-  return new octave_cell ();
-}
-
-void
-install_base_type_conversions (void)
-{
-  INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix);
-  INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix);
-  INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str);
-  INSTALL_ASSIGNCONV (octave_base_value, octave_cell, octave_cell);
-
-  INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv);
-  INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv);
-  INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv);
-  INSTALL_WIDENOP (octave_base_value, octave_cell, cell_conv);
-}
-
-DEFUN (sparse_auto_mutate, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} sparse_auto_mutate ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} sparse_auto_mutate (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} sparse_auto_mutate (@var{new_val}, \"local\")\n\
-Query or set the internal variable that controls whether Octave will\n\
-automatically mutate sparse matrices to full matrices to save memory.\n\
-For example:\n\
-\n\
-@example\n\
-@group\n\
-s = speye (3);\n\
-sparse_auto_mutate (false);\n\
-s(:, 1) = 1;\n\
-typeinfo (s)\n\
-@result{} sparse matrix\n\
-sparse_auto_mutate (true);\n\
-s(1, :) = 1;\n\
-typeinfo (s)\n\
-@result{} matrix\n\
-@end group\n\
-@end example\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE (sparse_auto_mutate);
-}
-
-/*
-%!test
-%! s = speye (3);
-%! sparse_auto_mutate (false);
-%! s(:, 1) = 1;
-%! assert (typeinfo (s), "sparse matrix");
-%! sparse_auto_mutate (true);
-%! s(1, :) = 1;
-%! assert (typeinfo (s), "matrix");
-%! sparse_auto_mutate (false);
-*/
--- a/src/ov-base.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,820 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_base_value_h)
-#define octave_base_value_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <list>
-#include <string>
-
-#include "Range.h"
-#include "data-conv.h"
-#include "mxarray.h"
-#include "mx-base.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-hdf5.h"
-
-class Cell;
-class octave_map;
-class octave_scalar_map;
-class octave_value;
-class octave_value_list;
-class octave_stream;
-class octave_function;
-class octave_user_function;
-class octave_user_script;
-class octave_user_code;
-class octave_fcn_handle;
-class octave_fcn_inline;
-class octave_value_list;
-class octave_lvalue;
-
-class tree_walker;
-
-enum builtin_type_t
-{
-  btyp_double,
-  btyp_float,
-  btyp_complex,
-  btyp_float_complex,
-  btyp_int8,
-  btyp_int16,
-  btyp_int32,
-  btyp_int64,
-  btyp_uint8,
-  btyp_uint16,
-  btyp_uint32,
-  btyp_uint64,
-  btyp_bool,
-  btyp_char,
-  btyp_struct,
-  btyp_cell,
-  btyp_func_handle,
-  btyp_unknown,
-  btyp_num_types = btyp_unknown
-};
-
-extern OCTINTERP_API std::string
-btyp_class_name [btyp_num_types];
-
-extern OCTINTERP_API string_vector
-get_builtin_classes (void);
-
-inline bool btyp_isnumeric (builtin_type_t btyp)
-{ return btyp <= btyp_uint64; }
-
-inline bool btyp_isinteger (builtin_type_t btyp)
-{ return btyp >= btyp_int8 && btyp <= btyp_uint64; }
-
-inline bool btyp_isfloat (builtin_type_t btyp)
-{ return btyp <= btyp_float_complex; }
-
-inline bool btyp_isarray (builtin_type_t btyp)
-{ return btyp <= btyp_char; }
-
-// Compute a numeric type for a possibly mixed-type operation, using these rules:
-// bool -> double
-// single + double -> single
-// real + complex -> complex
-// integer + real -> integer
-// uint + uint -> uint (the bigger one)
-// sint + sint -> sint (the bigger one)
-//
-// failing otherwise.
-
-extern OCTINTERP_API
-builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y);
-
-template <class T>
-struct class_to_btyp
-{
-  static const builtin_type_t btyp = btyp_unknown;
-};
-
-#define DEF_CLASS_TO_BTYP(CLASS,BTYP) \
-template <> \
-struct class_to_btyp<CLASS> \
-{ static const builtin_type_t btyp = BTYP; }
-
-DEF_CLASS_TO_BTYP (double, btyp_double);
-DEF_CLASS_TO_BTYP (float, btyp_float);
-DEF_CLASS_TO_BTYP (Complex, btyp_complex);
-DEF_CLASS_TO_BTYP (FloatComplex, btyp_float_complex);
-DEF_CLASS_TO_BTYP (octave_int8, btyp_int8);
-DEF_CLASS_TO_BTYP (octave_int16, btyp_int16);
-DEF_CLASS_TO_BTYP (octave_int32, btyp_int32);
-DEF_CLASS_TO_BTYP (octave_int64, btyp_int64);
-DEF_CLASS_TO_BTYP (octave_uint8, btyp_uint8);
-DEF_CLASS_TO_BTYP (octave_uint16, btyp_uint16);
-DEF_CLASS_TO_BTYP (octave_uint32, btyp_uint32);
-DEF_CLASS_TO_BTYP (octave_uint64, btyp_uint64);
-DEF_CLASS_TO_BTYP (bool, btyp_bool);
-DEF_CLASS_TO_BTYP (char, btyp_char);
-
-// T_ID is the type id of struct objects, set by register_type().
-// T_NAME is the type name of struct objects.
-
-#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG)
-
-#define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual)
-
-#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \
-  public: \
-    VIRTUAL int type_id (void) const { return t_id; } \
-    VIRTUAL std::string type_name (void) const { return t_name; } \
-    VIRTUAL std::string class_name (void) const { return c_name; } \
-    static int static_type_id (void) { return t_id; } \
-    static std::string static_type_name (void) { return t_name; } \
-    static std::string static_class_name (void) { return c_name; } \
-    static void register_type (void); \
- \
-  private: \
-    static int t_id; \
-    static const std::string t_name; \
-    static const std::string c_name;
-
-
-#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \
-  int t::t_id (-1); \
-  const std::string t::t_name (n); \
-  const std::string t::c_name (c); \
-  void t::register_type (void) \
-    { \
-      static t exemplar; \
-      octave_value v (&exemplar, true); \
-      t_id = octave_value_typeinfo::register_type (t::t_name, t::c_name, v); \
-    }
-
-// A base value type, so that derived types only have to redefine what
-// they need (if they are derived from octave_base_value instead of
-// octave_value).
-
-class
-OCTINTERP_API
-octave_base_value
-{
-public:
-
-  typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&);
-
-  // type conversion, including result type information
-  class type_conv_info
-  {
-  public:
-    type_conv_info (type_conv_fcn f = 0, int t = -1) : _fcn (f), _type_id (t) { }
-
-    operator type_conv_fcn (void) const { return _fcn; }
-
-    octave_base_value * operator () (const octave_base_value &v) const
-      { return (*_fcn) (v); }
-
-    int type_id (void) const { return _type_id; }
-
-  private:
-    type_conv_fcn _fcn;
-    int _type_id;
-  };
-
-  friend class octave_value;
-
-  octave_base_value (void) : count (1) { }
-
-  octave_base_value (const octave_base_value&) : count (1) { }
-
-  virtual ~octave_base_value (void) { }
-
-  // Unconditional clone. Always clones.
-  virtual octave_base_value *
-  clone (void) const { return new octave_base_value (*this); }
-
-  // Empty clone.
-  virtual octave_base_value *
-  empty_clone (void) const;
-
-  // Unique clone. Usually clones, but may be overriden to fake the
-  // cloning when sharing copies is to be controlled from within an
-  // instance (see octave_class).
-  virtual octave_base_value *
-  unique_clone (void) { return clone (); }
-
-  virtual type_conv_info
-  numeric_conversion_function (void) const
-    { return type_conv_info (); }
-
-  virtual type_conv_info
-  numeric_demotion_function (void) const
-    { return type_conv_info (); }
-
-  virtual octave_value squeeze (void) const;
-
-  virtual octave_value full_value (void) const;
-
-  virtual octave_base_value *try_narrowing_conversion (void) { return 0; }
-
-  virtual void maybe_economize (void) { }
-
-  virtual Matrix size (void);
-
-  virtual octave_idx_type numel (const octave_value_list&);
-
-  virtual octave_value
-  subsref (const std::string& type,
-           const std::list<octave_value_list>& idx);
-
-  virtual octave_value_list
-  subsref (const std::string& type,
-           const std::list<octave_value_list>& idx,
-           int nargout);
-
-  virtual octave_value
-  subsref (const std::string& type,
-           const std::list<octave_value_list>& idx,
-           bool auto_add);
-
-  virtual octave_value_list
-  subsref (const std::string& type,
-           const std::list<octave_value_list>& idx,
-           int nargout,
-           const std::list<octave_lvalue> *lvalue_list);
-
-  virtual octave_value
-  do_index_op (const octave_value_list& idx, bool resize_ok = false);
-
-  virtual octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& idx);
-
-  virtual octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& idx,
-                     const std::list<octave_lvalue> *lvalue_list);
-
-  virtual void assign (const std::string&, const octave_value&) { }
-
-  virtual octave_value
-  subsasgn (const std::string& type,
-            const std::list<octave_value_list>& idx,
-            const octave_value& rhs);
-
-  virtual octave_value
-  undef_subsasgn (const std::string& type,
-                  const std::list<octave_value_list>& idx,
-                  const octave_value& rhs);
-
-  virtual idx_vector index_vector (void) const;
-
-  virtual dim_vector dims (void) const { return dim_vector (); }
-
-  octave_idx_type rows (void) const
-    {
-      const dim_vector dv = dims ();
-
-      return dv(0);
-    }
-
-  octave_idx_type columns (void) const
-    {
-      const dim_vector dv = dims ();
-
-      return dv(1);
-    }
-
-  virtual int ndims (void) const
-    { return dims ().length (); }
-
-  virtual octave_idx_type numel (void) const { return dims ().numel (); }
-
-  virtual octave_idx_type capacity (void) const { return numel (); }
-
-  virtual size_t byte_size (void) const { return 0; }
-
-  virtual octave_idx_type nnz (void) const;
-
-  virtual octave_idx_type nzmax (void) const;
-
-  virtual octave_idx_type nfields (void) const;
-
-  virtual octave_value reshape (const dim_vector&) const;
-
-  virtual octave_value permute (const Array<int>& vec, bool = false) const;
-
-  virtual octave_value resize (const dim_vector&, bool fill = false) const;
-
-  virtual MatrixType matrix_type (void) const;
-
-  virtual MatrixType matrix_type (const MatrixType& typ) const;
-
-  virtual bool is_defined (void) const { return false; }
-
-  bool is_empty (void) const { return numel () == 0; }
-
-  virtual bool is_cell (void) const { return false; }
-
-  virtual bool is_cellstr (void) const { return false; }
-
-  virtual bool is_real_scalar (void) const { return false; }
-
-  virtual bool is_real_matrix (void) const { return false; }
-
-  virtual bool is_real_nd_array (void) const { return false; }
-
-  virtual bool is_complex_scalar (void) const { return false; }
-
-  virtual bool is_complex_matrix (void) const { return false; }
-
-  virtual bool is_bool_scalar (void) const { return false; }
-
-  virtual bool is_bool_matrix (void) const { return false; }
-
-  virtual bool is_char_matrix (void) const { return false; }
-
-  virtual bool is_diag_matrix (void) const { return false; }
-
-  virtual bool is_perm_matrix (void) const { return false; }
-
-  virtual bool is_string (void) const { return false; }
-
-  virtual bool is_sq_string (void) const { return false; }
-
-  virtual bool is_range (void) const { return false; }
-
-  virtual bool is_map (void) const { return false; }
-
-  virtual bool is_object (void) const { return false; }
-
-  virtual bool is_cs_list (void) const { return false; }
-
-  virtual bool is_magic_colon (void) const { return false; }
-
-  virtual bool is_all_va_args (void) const { return false; }
-
-  virtual octave_value all (int = 0) const;
-
-  virtual octave_value any (int = 0) const;
-
-  virtual builtin_type_t builtin_type (void) const { return btyp_unknown; }
-
-  virtual bool is_double_type (void) const { return false; }
-
-  virtual bool is_single_type (void) const { return false; }
-
-  virtual bool is_float_type (void) const { return false; }
-
-  virtual bool is_int8_type (void) const { return false; }
-
-  virtual bool is_int16_type (void) const { return false; }
-
-  virtual bool is_int32_type (void) const { return false; }
-
-  virtual bool is_int64_type (void) const { return false; }
-
-  virtual bool is_uint8_type (void) const { return false; }
-
-  virtual bool is_uint16_type (void) const { return false; }
-
-  virtual bool is_uint32_type (void) const { return false; }
-
-  virtual bool is_uint64_type (void) const { return false; }
-
-  virtual bool is_bool_type (void) const { return false; }
-
-  virtual bool is_integer_type (void) const { return false; }
-
-  virtual bool is_real_type (void) const { return false; }
-
-  virtual bool is_complex_type (void) const { return false; }
-
-  // Would be nice to get rid of the next four functions:
-
-  virtual bool is_scalar_type (void) const { return false; }
-
-  virtual bool is_matrix_type (void) const { return false; }
-
-  virtual bool is_numeric_type (void) const { return false; }
-
-  virtual bool is_sparse_type (void) const { return false; }
-
-  virtual bool is_true (void) const { return false; }
-
-  virtual bool is_null_value (void) const { return false; }
-
-  virtual bool is_constant (void) const { return false; }
-
-  virtual bool is_function_handle (void) const { return false; }
-
-  virtual bool is_anonymous_function (void) const { return false; }
-
-  virtual bool is_inline_function (void) const { return false; }
-
-  virtual bool is_function (void) const { return false; }
-
-  virtual bool is_user_script (void) const { return false; }
-
-  virtual bool is_user_function (void) const { return false; }
-
-  virtual bool is_user_code (void) const { return false; }
-
-  virtual bool is_builtin_function (void) const { return false; }
-
-  virtual bool is_dld_function (void) const { return false; }
-
-  virtual bool is_mex_function (void) const { return false; }
-
-  virtual void erase_subfunctions (void) { }
-
-  virtual short int short_value (bool = false, bool = false) const;
-
-  virtual unsigned short int ushort_value (bool = false, bool = false) const;
-
-  virtual int int_value (bool = false, bool = false) const;
-
-  virtual unsigned int uint_value (bool = false, bool = false) const;
-
-  virtual int nint_value (bool = false) const;
-
-  virtual long int long_value (bool = false, bool = false) const;
-
-  virtual unsigned long int ulong_value (bool = false, bool = false) const;
-
-  virtual double double_value (bool = false) const;
-
-  virtual float float_value (bool = false) const;
-
-  virtual double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  virtual float float_scalar_value (bool frc_str_conv = false) const
-    { return float_value (frc_str_conv); }
-
-  virtual Cell cell_value (void) const;
-
-  virtual Matrix matrix_value (bool = false) const;
-
-  virtual FloatMatrix float_matrix_value (bool = false) const;
-
-  virtual NDArray array_value (bool = false) const;
-
-  virtual FloatNDArray float_array_value (bool = false) const;
-
-  virtual Complex complex_value (bool = false) const;
-
-  virtual FloatComplex float_complex_value (bool = false) const;
-
-  virtual ComplexMatrix complex_matrix_value (bool = false) const;
-
-  virtual FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  virtual ComplexNDArray complex_array_value (bool = false) const;
-
-  virtual FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  virtual bool bool_value (bool = false) const;
-
-  virtual boolMatrix bool_matrix_value (bool = false) const;
-
-  virtual boolNDArray bool_array_value (bool = false) const;
-
-  virtual charMatrix char_matrix_value (bool force = false) const;
-
-  virtual charNDArray char_array_value (bool = false) const;
-
-  virtual SparseMatrix sparse_matrix_value (bool = false) const;
-
-  virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
-
-  virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const;
-
-  virtual DiagMatrix diag_matrix_value (bool = false) const;
-
-  virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const;
-
-  virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
-
-  virtual FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
-
-  virtual PermMatrix perm_matrix_value (void) const;
-
-  virtual octave_int8 int8_scalar_value (void) const;
-
-  virtual octave_int16 int16_scalar_value (void) const;
-
-  virtual octave_int32 int32_scalar_value (void) const;
-
-  virtual octave_int64 int64_scalar_value (void) const;
-
-  virtual octave_uint8 uint8_scalar_value (void) const;
-
-  virtual octave_uint16 uint16_scalar_value (void) const;
-
-  virtual octave_uint32 uint32_scalar_value (void) const;
-
-  virtual octave_uint64 uint64_scalar_value (void) const;
-
-  virtual int8NDArray int8_array_value (void) const;
-
-  virtual int16NDArray int16_array_value (void) const;
-
-  virtual int32NDArray int32_array_value (void) const;
-
-  virtual int64NDArray int64_array_value (void) const;
-
-  virtual uint8NDArray uint8_array_value (void) const;
-
-  virtual uint16NDArray uint16_array_value (void) const;
-
-  virtual uint32NDArray uint32_array_value (void) const;
-
-  virtual uint64NDArray uint64_array_value (void) const;
-
-  virtual string_vector all_strings (bool pad = false) const;
-
-  virtual std::string string_value (bool force = false) const;
-
-  virtual Array<std::string> cellstr_value (void) const;
-
-  virtual Range range_value (void) const;
-
-  virtual octave_map map_value (void) const;
-
-  virtual octave_scalar_map scalar_map_value (void) const;
-
-  virtual string_vector map_keys (void) const;
-
-  virtual size_t nparents (void) const;
-
-  virtual std::list<std::string> parent_class_name_list (void) const;
-
-  virtual string_vector parent_class_names (void) const;
-
-  virtual octave_base_value *find_parent_class (const std::string&)
-    { return 0; }
-
-  virtual octave_base_value *unique_parent_class (const std::string&)
-    { return 0; }
-
-  virtual octave_function *function_value (bool silent = false);
-
-  virtual octave_user_function *user_function_value (bool silent = false);
-
-  virtual octave_user_script *user_script_value (bool silent = false);
-
-  virtual octave_user_code *user_code_value (bool silent = false);
-
-  virtual octave_fcn_handle *fcn_handle_value (bool silent = false);
-
-  virtual octave_fcn_inline *fcn_inline_value (bool silent = false);
-
-  virtual octave_value_list list_value (void) const;
-
-  virtual octave_value convert_to_str (bool pad = false, bool force = false,
-                                       char type = '\'') const;
-  virtual octave_value
-  convert_to_str_internal (bool pad, bool force, char type) const;
-
-  virtual void convert_to_row_or_column_vector (void);
-
-  virtual bool print_as_scalar (void) const { return false; }
-
-  virtual void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  virtual void
-  print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  virtual bool
-  print_name_tag (std::ostream& os, const std::string& name) const;
-
-  virtual void
-  print_with_name (std::ostream& output_buf, const std::string& name,
-                   bool print_padding = true);
-
-  virtual void print_info (std::ostream& os, const std::string& prefix) const;
-
-  virtual bool save_ascii (std::ostream& os);
-
-  virtual bool load_ascii (std::istream& is);
-
-  virtual bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  virtual bool load_binary (std::istream& is, bool swap,
-                            oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  virtual bool
-  save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  virtual bool
-  load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  virtual int
-  write (octave_stream& os, int block_size,
-         oct_data_conv::data_type output_type, int skip,
-         oct_mach_info::float_format flt_fmt) const;
-
-  virtual void *mex_get_data (void) const { return 0; }
-
-  virtual octave_idx_type *mex_get_ir (void) const { return 0; }
-
-  virtual octave_idx_type *mex_get_jc (void) const { return 0; }
-
-  virtual mxArray *as_mxArray (void) const;
-
-  virtual octave_value diag (octave_idx_type k = 0) const;
-
-  virtual octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  virtual octave_value sort (octave_idx_type dim = 0,
-                             sortmode mode = ASCENDING) const;
-  virtual octave_value sort (Array<octave_idx_type> &sidx,
-                             octave_idx_type dim = 0,
-                             sortmode mode = ASCENDING) const;
-
-  virtual sortmode is_sorted (sortmode mode = UNSORTED) const;
-
-  virtual Array<octave_idx_type>
-  sort_rows_idx (sortmode mode = ASCENDING) const;
-
-  virtual sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
-
-  virtual void lock (void);
-
-  virtual void unlock (void);
-
-  virtual bool islocked (void) const { return false; }
-
-  virtual void dump (std::ostream& os) const;
-
-  // Standard mappers. Register new ones here.
-  enum unary_mapper_t
-    {
-      umap_abs,
-      umap_acos,
-      umap_acosh,
-      umap_angle,
-      umap_arg,
-      umap_asin,
-      umap_asinh,
-      umap_atan,
-      umap_atanh,
-      umap_cbrt,
-      umap_ceil,
-      umap_conj,
-      umap_cos,
-      umap_cosh,
-      umap_erf,
-      umap_erfinv,
-      umap_erfcinv,
-      umap_erfc,
-      umap_erfcx,
-      umap_exp,
-      umap_expm1,
-      umap_finite,
-      umap_fix,
-      umap_floor,
-      umap_gamma,
-      umap_imag,
-      umap_isinf,
-      umap_isna,
-      umap_isnan,
-      umap_lgamma,
-      umap_log,
-      umap_log2,
-      umap_log10,
-      umap_log1p,
-      umap_real,
-      umap_round,
-      umap_roundb,
-      umap_signum,
-      umap_sin,
-      umap_sinh,
-      umap_sqrt,
-      umap_tan,
-      umap_tanh,
-      umap_xisalnum,
-      umap_xisalpha,
-      umap_xisascii,
-      umap_xiscntrl,
-      umap_xisdigit,
-      umap_xisgraph,
-      umap_xislower,
-      umap_xisprint,
-      umap_xispunct,
-      umap_xisspace,
-      umap_xisupper,
-      umap_xisxdigit,
-      umap_xtoascii,
-      umap_xtolower,
-      umap_xtoupper,
-      umap_unknown,
-      num_unary_mappers = umap_unknown
-    };
-
-  virtual octave_value map (unary_mapper_t) const;
-
-  // These are fast indexing & assignment shortcuts for extracting
-  // or inserting a single scalar from/to an array.
-
-  // Extract the n-th element, aka val(n). Result is undefined if val is not an
-  // array type or n is out of range. Never error.
-  virtual octave_value
-  fast_elem_extract (octave_idx_type n) const;
-
-  // Assign the n-th element, aka val(n) = x. Returns false if val is not an
-  // array type, x is not a matching scalar type, or n is out of range.
-  // Never error.
-  virtual bool
-  fast_elem_insert (octave_idx_type n, const octave_value& x);
-
-  // This is a helper for the above, to be overriden in scalar types.  The
-  // whole point is to handle the insertion efficiently with just *two* VM
-  // calls, which is basically the theoretical minimum.
-  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.
-
-  octave_value numeric_assign (const std::string& type,
-                               const std::list<octave_value_list>& idx,
-                               const octave_value& rhs);
-
-  void reset_indent_level (void) const
-    { curr_print_indent_level = 0; }
-
-  void increment_indent_level (void) const
-    { curr_print_indent_level += 2; }
-
-  void decrement_indent_level (void) const
-    { curr_print_indent_level -= 2; }
-
-  int current_print_indent_level (void) const
-    { return curr_print_indent_level; }
-
-  void indent (std::ostream& os) const;
-
-  void newline (std::ostream& os) const;
-
-  void reset (void) const;
-
-  // A reference count.
-  // NOTE: the declaration is octave_idx_type because with 64-bit indexing,
-  // it is well possible to have more than MAX_INT copies of a single value
-  // (think of an empty cell array with >2G elements).
-  octave_refcount<octave_idx_type> count;
-
-private:
-
-  static const char *get_umap_name (unary_mapper_t);
-
-  static int curr_print_indent_level;
-  static bool beginning_of_line;
-
-  DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA
-};
-
-// TRUE means to perform automatic sparse to real mutation if there
-// is memory to be saved
-extern OCTINTERP_API bool Vsparse_auto_mutate;
-
-#endif
--- a/src/ov-bool-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,588 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <vector>
-
-#include "lo-ieee.h"
-#include "mx-base.h"
-#include "oct-locbuf.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ops.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-mat.cc"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-re-mat.h"
-#include "pr-output.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-#include "ls-utils.h"
-
-template class octave_base_matrix<boolNDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_bool_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_bool_matrix,
-                                     "bool matrix", "logical");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_bool_matrix&);
-
-  return new octave_matrix (NDArray (v.bool_array_value ()));
-}
-
-octave_base_value::type_conv_info
-octave_bool_matrix::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_bool_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.ndims () == 2)
-    {
-      boolMatrix bm = matrix.matrix_value ();
-
-      octave_idx_type nr = bm.rows ();
-      octave_idx_type nc = bm.cols ();
-
-      if (nr == 1 && nc == 1)
-        retval = new octave_bool (bm (0, 0));
-    }
-
-  return retval;
-}
-
-double
-octave_bool_matrix::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "bool matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("bool matrix", "real scalar");
-
-  return retval;
-}
-
-float
-octave_bool_matrix::float_value (bool) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "bool matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("bool matrix", "real scalar");
-
-  return retval;
-}
-
-Complex
-octave_bool_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "bool matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("bool matrix", "complex scalar");
-
-  return retval;
-}
-
-FloatComplex
-octave_bool_matrix::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "bool matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("bool matrix", "complex scalar");
-
-  return retval;
-}
-
-octave_value
-octave_bool_matrix::convert_to_str_internal (bool pad, bool force,
-                                             char type) const
-{
-  octave_value tmp = octave_value (array_value ());
-  return tmp.convert_to_str (pad, force, type);
-}
-
-void
-octave_bool_matrix::print_raw (std::ostream& os,
-                               bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, matrix, pr_as_read_syntax,
-                         current_print_indent_level ());
-}
-
-bool
-octave_bool_matrix::save_ascii (std::ostream& os)
-{
-  dim_vector d = dims ();
-  if (d.length () > 2)
-    {
-      NDArray tmp = array_value ();
-      os << "# ndims: " << d.length () << "\n";
-
-      for (int i = 0; i < d.length (); i++)
-        os << " " << d (i);
-
-      os << "\n" << tmp;
-    }
-  else
-    {
-      // Keep this case, rather than use generic code above for backward
-      // compatiability. Makes load_ascii much more complex!!
-      os << "# rows: " << rows () << "\n"
-         << "# columns: " << columns () << "\n";
-
-      Matrix tmp = matrix_value ();
-
-      os << tmp;
-    }
-
-  return true;
-}
-
-bool
-octave_bool_matrix::load_ascii (std::istream& is)
-{
-  bool success = true;
-
-  string_vector keywords (2);
-
-  keywords[0] = "ndims";
-  keywords[1] = "rows";
-
-  std::string kw;
-  octave_idx_type val = 0;
-
-  if (extract_keyword (is, keywords, kw, val, true))
-    {
-      if (kw == "ndims")
-        {
-          int mdims = static_cast<int> (val);
-
-          if (mdims >= 0)
-            {
-              dim_vector dv;
-              dv.resize (mdims);
-
-              for (int i = 0; i < mdims; i++)
-                is >> dv(i);
-
-              if (is)
-                {
-                  boolNDArray btmp (dv);
-
-                  if (btmp.is_empty ())
-                    matrix = btmp;
-                  else
-                    {
-                      NDArray tmp(dv);
-                      is >> tmp;
-
-                      if (is)
-                        {
-                          for (octave_idx_type i = 0; i < btmp.nelem (); i++)
-                            btmp.elem (i) = (tmp.elem (i) != 0.);
-
-                          matrix = btmp;
-                        }
-                      else
-                        {
-                          error ("load: failed to load matrix constant");
-                          success = false;
-                        }
-                    }
-                }
-              else
-                {
-                  error ("load: failed to extract dimensions");
-                  success = false;
-                }
-            }
-          else
-            {
-              error ("load: failed to extract number of dimensions");
-              success = false;
-            }
-        }
-      else if (kw == "rows")
-        {
-          octave_idx_type nr = val;
-          octave_idx_type nc = 0;
-
-          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
-            {
-              if (nr > 0 && nc > 0)
-                {
-                  Matrix tmp (nr, nc);
-                  is >> tmp;
-                  if (is)
-                    {
-                      boolMatrix btmp (nr, nc);
-                      for (octave_idx_type j = 0; j < nc; j++)
-                        for (octave_idx_type i = 0; i < nr; i++)
-                          btmp.elem (i,j) = (tmp.elem (i, j) != 0.);
-
-                      matrix = btmp;
-                    }
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else if (nr == 0 || nc == 0)
-                matrix = boolMatrix (nr, nc);
-              else
-                panic_impossible ();
-            }
-          else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
-        }
-      else
-        panic_impossible ();
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_bool_matrix::save_binary (std::ostream& os, bool& /* save_as_floats */)
-{
-
-  dim_vector d = dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims to differentiate with old format!!
-  int32_t tmp = - d.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i = 0; i < d.length (); i++)
-    {
-      tmp = d(i);
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-    }
-
-  boolNDArray m = bool_array_value ();
-  bool *mtmp = m.fortran_vec ();
-  octave_idx_type nel = m.nelem ();
-  OCTAVE_LOCAL_BUFFER (char, htmp, nel);
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    htmp[i] = (mtmp[i] ? 1 : 0);
-
-  os.write (htmp, nel);
-
-  return true;
-}
-
-bool
-octave_bool_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format /* fmt */)
-{
-  int32_t mdims;
-  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&mdims);
-  if (mdims >= 0)
-    return false;
-
-  // mdims is negative for consistency with other matrices, where it is
-  // negative to allow the positive value to be used for rows/cols for
-  // backward compatibility
-  mdims = - mdims;
-  int32_t di;
-  dim_vector dv;
-  dv.resize (mdims);
-
-  for (int i = 0; i < mdims; i++)
-    {
-      if (! is.read (reinterpret_cast<char *> (&di), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&di);
-      dv(i) = di;
-    }
-
-  // Convert an array with a single dimension to be a row vector.
-  // Octave should never write files like this, other software
-  // might.
-
-  if (mdims == 1)
-    {
-      mdims = 2;
-      dv.resize (mdims);
-      dv(1) = dv(0);
-      dv(0) = 1;
-    }
-
-  octave_idx_type nel = dv.numel ();
-  OCTAVE_LOCAL_BUFFER (char, htmp, nel);
-  if (! is.read (htmp, nel))
-    return false;
-  boolNDArray m(dv);
-  bool *mtmp = m.fortran_vec ();
-  for (octave_idx_type i = 0; i < nel; i++)
-    mtmp[i] = (htmp[i] ? 1 : 0);
-  matrix = m;
-
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_bool_matrix::save_hdf5 (hid_t loc_id, const char *name,
-                               bool /* save_as_floats */)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  int rank = dv.length ();
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-  boolNDArray m = bool_array_value ();
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
-
-  space_hid = H5Screate_simple (rank, hdims, 0);
-  if (space_hid < 0) return false;
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  octave_idx_type nel = m.nelem ();
-  bool *mtmp = m.fortran_vec ();
-  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel);
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    htmp[i] = mtmp[i];
-
-  retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, htmp) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_bool_matrix::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-    return (empty > 0);
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank < 1)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  if (rank == 1)
-    {
-      dv.resize (2);
-      dv(0) = 1;
-      dv(1) = hdims[0];
-    }
-  else
-    {
-      dv.resize (rank);
-      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
-        dv(j) = hdims[i];
-    }
-
-  octave_idx_type nel = dv.numel ();
-  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel);
-  if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, htmp) >= 0)
-    {
-      retval = true;
-
-      boolNDArray btmp (dv);
-      for (octave_idx_type i = 0; i < nel; i++)
-          btmp.elem (i) = htmp[i];
-
-      matrix = btmp;
-    }
-
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_bool_matrix::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxLOGICAL_CLASS, dims (), mxREAL);
-
-  bool *pr = static_cast<bool *> (retval->get_data ());
-
-  mwSize nel = numel ();
-
-  const bool *p = matrix.data ();
-
-  for (mwIndex i = 0; i < nel; i++)
-    pr[i] = p[i];
-
-  return retval;
-}
-
-DEFUN (logical, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} logical (@var{x})\n\
-Convert @var{x} to logical type.\n\
-@seealso{double, single, char}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    {
-      octave_value arg = args(0);
-      if (arg.is_bool_type ())
-        retval = arg;
-      else if (arg.is_numeric_type ())
-        {
-          if (arg.is_sparse_type ())
-            retval = arg.sparse_bool_matrix_value ();
-          else if (arg.is_scalar_type ())
-            retval = arg.bool_value ();
-          else
-            retval = arg.bool_array_value ();
-        }
-      else
-        gripe_wrong_type_arg ("logical", arg);
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!test
-%! m = eye (2) != 0;
-%! s = !0;
-%! c = {"double", "single", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "logical"};
-%! for i = 1:numel (c)
-%!   assert (logical (eye (2, c{i})), m)
-%!   assert (logical (eye (1, c{i})), s)
-%! endfor
-*/
--- a/src/ov-bool-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_bool_matrix_h)
-#define octave_bool_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-
-#include "MatrixType.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Character matrix values.
-
-class
-octave_bool_matrix : public octave_base_matrix<boolNDArray>
-{
-public:
-
-  octave_bool_matrix (void)
-    : octave_base_matrix<boolNDArray> () { }
-
-  octave_bool_matrix (const boolNDArray& bnda)
-    : octave_base_matrix<boolNDArray> (bnda) { }
-
-  octave_bool_matrix (const Array<bool>& bnda)
-    : octave_base_matrix<boolNDArray> (bnda) { }
-
-  octave_bool_matrix (const boolMatrix& bm)
-    : octave_base_matrix<boolNDArray> (bm) { }
-
-  octave_bool_matrix (const boolMatrix& bm, const MatrixType& t)
-    : octave_base_matrix<boolNDArray> (bm, t) { }
-
-  octave_bool_matrix (const boolNDArray& bm, const idx_vector& cache)
-    : octave_base_matrix<boolNDArray> (bm)
-    {
-      set_idx_cache (cache);
-    }
-
-  octave_bool_matrix (const octave_bool_matrix& bm)
-    : octave_base_matrix<boolNDArray> (bm) { }
-
-  ~octave_bool_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_bool_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_bool_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  idx_vector index_vector (void) const
-    { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
-
-  builtin_type_t builtin_type (void) const { return btyp_bool; }
-
-  bool is_bool_matrix (void) const { return true; }
-
-  bool is_bool_type (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return false; }
-
-  int8NDArray
-  int8_array_value (void) const { return int8NDArray (matrix); }
-
-  int16NDArray
-  int16_array_value (void) const { return int16NDArray (matrix); }
-
-  int32NDArray
-  int32_array_value (void) const { return int32NDArray (matrix); }
-
-  int64NDArray
-  int64_array_value (void) const { return int64NDArray (matrix); }
-
-  uint8NDArray
-  uint8_array_value (void) const { return uint8NDArray (matrix); }
-
-  uint16NDArray
-  uint16_array_value (void) const { return uint16NDArray (matrix); }
-
-  uint32NDArray
-  uint32_array_value (void) const { return uint32NDArray (matrix); }
-
-  uint64NDArray
-  uint64_array_value (void) const { return uint64NDArray (matrix); }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const
-    { return Matrix (matrix.matrix_value ()); }
-
-  FloatMatrix float_matrix_value (bool = false) const
-    { return FloatMatrix (matrix.matrix_value ()); }
-
-  NDArray array_value (bool = false) const
-    { return NDArray (matrix); }
-
-  FloatNDArray float_array_value (bool = false) const
-    { return FloatNDArray (matrix); }
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const
-    { return ComplexMatrix (matrix.matrix_value ( )); }
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const
-    { return FloatComplexMatrix (matrix.matrix_value ( )); }
-
-  ComplexNDArray complex_array_value (bool = false) const
-    { return ComplexNDArray (matrix); }
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const
-    { return FloatComplexNDArray (matrix); }
-
-  charNDArray
-  char_array_value (bool = false) const
-  {
-    charNDArray retval (dims ());
-
-    octave_idx_type nel = numel ();
-
-    for (octave_idx_type i = 0; i < nel; i++)
-      retval(i) = static_cast<char>(matrix(i));
-
-    return retval;
-  }
-
-  boolMatrix bool_matrix_value (bool = false) const
-    { return matrix.matrix_value (); }
-
-  boolNDArray bool_array_value (bool = false) const
-    { return matrix; }
-
-  SparseMatrix sparse_matrix_value (bool = false) const
-  { return SparseMatrix (Matrix (matrix.matrix_value ())); }
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-  { return SparseComplexMatrix (ComplexMatrix (matrix.matrix_value ())); }
-
-  SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
-  { return SparseBoolMatrix (matrix.matrix_value ()); }
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  // Use matrix_ref here to clear index cache.
-  void invert (void) { matrix_ref ().invert (); }
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const { return matrix.mex_get_data (); }
-
-  mxArray *as_mxArray (void) const;
-
-  // Mapper functions are converted to double for treatment
-  octave_value map (unary_mapper_t umap) const
-    {
-      octave_matrix m (array_value ());
-      return m.map (umap);
-    }
-
-protected:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-bool-sparse.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,793 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-#include <vector>
-
-#include "ov-base.h"
-#include "ov-scalar.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "gripes.h"
-#include "ops.h"
-#include "oct-locbuf.h"
-
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-#include "ov-bool-sparse.h"
-
-#include "ov-base-sparse.h"
-#include "ov-base-sparse.cc"
-
-template class OCTINTERP_API octave_base_sparse<SparseBoolMatrix>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_sparse_bool_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_bool_matrix, "sparse bool matrix", "logical");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_sparse_bool_matrix&);
-
-  return new octave_sparse_matrix (SparseMatrix (v.sparse_bool_matrix_value ()));
-}
-
-octave_base_value::type_conv_info
-octave_sparse_bool_matrix::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_sparse_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_sparse_bool_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (Vsparse_auto_mutate)
-    {
-      // Don't use numel, since it can overflow for very large matrices
-      // Note that for the second test, this means it becomes approximative
-      // since it involves a cast to double to avoid issues of overflow
-      if (matrix.rows () == 1 && matrix.cols () == 1)
-        {
-          // Const copy of the matrix, so the right version of () operator used
-          const SparseBoolMatrix tmp (matrix);
-
-          retval = new octave_bool (tmp (0));
-        }
-      else if (matrix.cols () > 0 && matrix.rows () > 0
-               && (double (matrix.byte_size ()) > double (matrix.rows ())
-                   * double (matrix.cols ()) * sizeof (bool)))
-        retval = new octave_bool_matrix (matrix.matrix_value ());
-    }
-
-  return retval;
-}
-
-double
-octave_sparse_bool_matrix::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (numel () > 0)
-    {
-      if (numel () > 1)
-        gripe_implicit_conversion ("Octave:array-to-scalar",
-                                   "bool sparse matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("bool sparse matrix", "real scalar");
-
-  return retval;
-}
-
-Complex
-octave_sparse_bool_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      if (numel () > 1)
-        gripe_implicit_conversion ("Octave:array-to-scalar",
-                                   "bool sparse matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("bool sparse matrix", "complex scalar");
-
-  return retval;
-}
-
-octave_value
-octave_sparse_bool_matrix::convert_to_str_internal (bool pad, bool force,
-                                                    char type) const
-{
-  octave_value tmp = octave_value (array_value ());
-  return tmp.convert_to_str (pad, force, type);
-}
-
-// FIXME These are inefficient ways of creating full matrices
-
-Matrix
-octave_sparse_bool_matrix::matrix_value (bool) const
-{
-  return Matrix (matrix.matrix_value ());
-}
-
-ComplexMatrix
-octave_sparse_bool_matrix::complex_matrix_value (bool) const
-{
-  return ComplexMatrix (matrix.matrix_value ());
-}
-
-ComplexNDArray
-octave_sparse_bool_matrix::complex_array_value (bool) const
-{
-  return ComplexNDArray (ComplexMatrix (matrix.matrix_value ()));
-}
-
-NDArray
-octave_sparse_bool_matrix::array_value (bool) const
-{
-  return NDArray (Matrix (matrix.matrix_value ()));
-}
-
-charNDArray
-octave_sparse_bool_matrix::char_array_value (bool) const
-{
-  charNDArray retval (dims (), 0);
-  octave_idx_type nc = matrix.cols ();
-  octave_idx_type nr = matrix.rows ();
-
-  for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
-      retval(matrix.ridx (i) + nr * j) = static_cast<char>(matrix.data (i));
-
-  return retval;
-}
-
-boolMatrix
-octave_sparse_bool_matrix::bool_matrix_value (bool) const
-{
-  return matrix.matrix_value ();
-}
-
-boolNDArray
-octave_sparse_bool_matrix::bool_array_value (bool) const
-{
-  return boolNDArray (matrix.matrix_value ());
-}
-
-
-SparseMatrix
-octave_sparse_bool_matrix::sparse_matrix_value (bool) const
-{
-  return SparseMatrix (this->matrix);
-}
-
-SparseComplexMatrix
-octave_sparse_bool_matrix::sparse_complex_matrix_value (bool) const
-{
-  return SparseComplexMatrix (this->matrix);
-}
-
-bool
-octave_sparse_bool_matrix::save_binary (std::ostream& os, bool&)
-{
-  dim_vector d = this->dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Ensure that additional memory is deallocated
-  matrix.maybe_compress ();
-
-  int nr = d(0);
-  int nc = d(1);
-  int nz = nnz ();
-
-  int32_t itmp;
-  // Use negative value for ndims to be consistent with other formats
-  itmp= -2;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nr;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nc;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nz;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  // add one to the printed indices to go from
-  // zero-based to one-based arrays
-  for (int i = 0; i < nc+1; i++)
-    {
-      octave_quit ();
-      itmp = matrix.cidx (i);
-      os.write (reinterpret_cast<char *> (&itmp), 4);
-    }
-
-  for (int i = 0; i < nz; i++)
-    {
-      octave_quit ();
-      itmp = matrix.ridx (i);
-      os.write (reinterpret_cast<char *> (&itmp), 4);
-    }
-
-  OCTAVE_LOCAL_BUFFER (char, htmp, nz);
-
-  for (int i = 0; i < nz; i++)
-    htmp[i] = (matrix.data (i) ? 1 : 0);
-
-  os.write (htmp, nz);
-
-  return true;
-}
-
-bool
-octave_sparse_bool_matrix::load_binary (std::istream& is, bool swap,
-                                        oct_mach_info::float_format /* fmt */)
-{
-  int32_t nz, nc, nr, tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-    return false;
-
-  if (swap)
-    swap_bytes<4> (&tmp);
-
-  if (tmp != -2) {
-    error ("load: only 2D sparse matrices are supported");
-    return false;
-  }
-
-  if (! is.read (reinterpret_cast<char *> (&nr), 4))
-    return false;
-  if (! is.read (reinterpret_cast<char *> (&nc), 4))
-    return false;
-  if (! is.read (reinterpret_cast<char *> (&nz), 4))
-    return false;
-
-  if (swap)
-    {
-      swap_bytes<4> (&nr);
-      swap_bytes<4> (&nc);
-      swap_bytes<4> (&nz);
-    }
-
-  SparseBoolMatrix m (static_cast<octave_idx_type> (nr),
-                      static_cast<octave_idx_type> (nc),
-                      static_cast<octave_idx_type> (nz));
-
-  for (int i = 0; i < nc+1; i++)
-    {
-      octave_quit ();
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-      m.cidx (i) = tmp;
-    }
-
-  for (int i = 0; i < nz; i++)
-    {
-      octave_quit ();
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-      m.ridx (i) = tmp;
-    }
-
-  if (error_state || ! is)
-    return false;
-
-  OCTAVE_LOCAL_BUFFER (char, htmp, nz);
-
-  if (! is.read (htmp, nz))
-    return false;
-
-  for (int i = 0; i < nz; i++)
-    m.data(i) = (htmp[i] ? 1 : 0);
-
-  if (! m.indices_ok ())
-    return false;
-
-  matrix = m;
-
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_sparse_bool_matrix::save_hdf5 (hid_t loc_id, const char *name, bool)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  // Ensure that additional memory is deallocated
-  matrix.maybe_compress ();
-#if HAVE_HDF5_18
-  hid_t group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  hid_t group_hid = H5Gcreate (loc_id, name, 0);
-#endif
-  if (group_hid < 0)
-    return false;
-
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-  SparseBoolMatrix m = sparse_bool_matrix_value ();
-  octave_idx_type tmp;
-  hsize_t hdims[2];
-
-  space_hid = H5Screate_simple (0, hdims, 0);
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.rows ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.cols ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.nnz ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-
-  hdims[0] = m.cols () + 1;
-  hdims[1] = 1;
-
-  space_hid = H5Screate_simple (2, hdims, 0);
-
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  octave_idx_type * itmp = m.xcidx ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, itmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-
-  hdims[0] = m.nnz ();
-  hdims[1] = 1;
-
-  space_hid = H5Screate_simple (2, hdims, 0);
-
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  itmp = m.xridx ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, itmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, m.nnz ());
-  for (int i = 0; i < m.nnz (); i++)
-    htmp[i] = m.xdata(i);
-
-  retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, htmp) >= 0;
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-  H5Gclose (group_hid);
-
-  return retval;
-}
-
-bool
-octave_sparse_bool_matrix::load_hdf5 (hid_t loc_id, const char *name)
-{
-  octave_idx_type nr, nc, nz;
-  hid_t group_hid, data_hid, space_hid;
-  hsize_t rank;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-    return (empty > 0);
-
-#if HAVE_HDF5_18
-  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  group_hid = H5Gopen (loc_id, name);
-#endif
-  if (group_hid < 0 ) return false;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nr", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nr");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nr) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nc", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nc");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nc) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nz", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nz");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nz) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-  SparseBoolMatrix m (static_cast<octave_idx_type> (nr),
-                      static_cast<octave_idx_type> (nc),
-                      static_cast<octave_idx_type> (nz));
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "cidx", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "cidx");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nc + 1
-      || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  octave_idx_type *itmp = m.xcidx ();
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "ridx", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "ridx");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nz
-      || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  itmp = m.xridx ();
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, itmp) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "data", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "data");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nz
-      || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nz);
-  bool retval = false;
-  if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, htmp) >= 0
-      && m.indices_ok ())
-    {
-      retval = true;
-
-      for (int i = 0; i < nz; i++)
-        m.xdata(i) = htmp[i];
-
-      matrix = m;
-    }
-
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-  H5Gclose (group_hid);
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_sparse_bool_matrix::as_mxArray (void) const
-{
-  mwSize nz = nzmax ();
-  mxArray *retval = new mxArray (mxLOGICAL_CLASS, rows (), columns (),
-                                 nz, mxREAL);
-  bool *pr = static_cast<bool *> (retval->get_data ());
-  mwIndex *ir = retval->get_ir ();
-  mwIndex *jc = retval->get_jc ();
-
-  for (mwIndex i = 0; i < nz; i++)
-    {
-      pr[i] = matrix.data (i);
-      ir[i] = matrix.ridx (i);
-    }
-
-  for (mwIndex i = 0; i < columns () + 1; i++)
-    jc[i] = matrix.cidx (i);
-
-  return retval;
-}
--- a/src/ov-bool-sparse.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-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_sparse_bool_matrix_h)
-#define octave_sparse_bool_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-#include "boolSparse.h"
-#include "ov-base-sparse.h"
-#include "ov-re-sparse.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-class
-OCTINTERP_API
-octave_sparse_bool_matrix : public octave_base_sparse<SparseBoolMatrix>
-{
-public:
-
-  octave_sparse_bool_matrix (void)
-    : octave_base_sparse<SparseBoolMatrix> () { }
-
-  octave_sparse_bool_matrix (const SparseBoolMatrix& bnda)
-    : octave_base_sparse<SparseBoolMatrix> (bnda) { }
-
-  octave_sparse_bool_matrix (const SparseBoolMatrix& bnda,
-                             const MatrixType& t)
-    : octave_base_sparse<SparseBoolMatrix> (bnda, t) { }
-
-  octave_sparse_bool_matrix (const boolNDArray& m)
-    : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { }
-
-  octave_sparse_bool_matrix (const boolMatrix& m)
-    : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { }
-
-  octave_sparse_bool_matrix (const Sparse<bool>& a)
-    : octave_base_sparse<SparseBoolMatrix> (a) { }
-
-  octave_sparse_bool_matrix (const octave_sparse_bool_matrix& bm)
-    : octave_base_sparse<SparseBoolMatrix> (bm) { }
-
-  ~octave_sparse_bool_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_sparse_bool_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_sparse_bool_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  // FIXME Adapt idx_vector to allow sparse logical indexing!!
-  idx_vector index_vector (void) const
-    { return idx_vector (bool_array_value ()); }
-
-  builtin_type_t builtin_type (void) const { return btyp_bool; }
-
-  bool is_bool_matrix (void) const { return true; }
-
-  bool is_bool_type (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return false; }
-
-  double double_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  NDArray array_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  charNDArray char_array_value (bool = false) const;
-
-  boolMatrix bool_matrix_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const;
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
-
-  SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
-    { return matrix; }
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  mxArray *as_mxArray (void) const;
-
-  // Mapper functions are converted to double for treatment
-  octave_value map (unary_mapper_t umap) const
-    {
-      octave_sparse_matrix m (sparse_matrix_value ());
-      return m.map (umap);
-    }
-
-protected:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-bool.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "mx-base.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ops.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-base.h"
-#include "ov-base-scalar.h"
-#include "ov-base-scalar.cc"
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-#include "pr-output.h"
-
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-
-template class octave_base_scalar<bool>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_bool);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_bool, "bool", "logical");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_bool&);
-
-  return new octave_scalar (v.bool_value ());
-}
-
-octave_base_value::type_conv_info
-octave_bool::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_scalar::static_type_id ());
-
-}
-
-octave_value
-octave_bool::do_index_op (const octave_value_list& idx, bool resize_ok)
-{
-  // FIXME -- this doesn't solve the problem of
-  //
-  //   a = 1; a([1,1], [1,1], [1,1])
-  //
-  // and similar constructions.  Hmm...
-
-  // FIXME -- using this constructor avoids narrowing the
-  // 1x1 matrix back to a scalar value.  Need a better solution
-  // to this problem.
-
-  octave_value tmp (new octave_bool_matrix (bool_matrix_value ()));
-
-  return tmp.do_index_op (idx, resize_ok);
-}
-
-octave_value
-octave_bool::resize (const dim_vector& dv, bool fill) const
-{
-  if (fill)
-    {
-      boolNDArray retval (dv, false);
-      if (dv.numel ())
-        retval(0) = scalar;
-      return retval;
-    }
-  else
-    {
-      boolNDArray retval (dv);
-      if (dv.numel ())
-        retval(0) = scalar;
-      return retval;
-    }
-}
-
-octave_value
-octave_bool::convert_to_str_internal (bool, bool, char type) const
-{
-  char s[2];
-  s[0] = static_cast<char> (scalar);
-  s[1] = '\0';
-
-  return octave_value (s, type);
-}
-
-bool
-octave_bool::save_ascii (std::ostream& os)
-{
-  double d = double_value ();
-
-  octave_write_double (os, d);
-  os << "\n";
-
-  return true;
-}
-
-bool
-octave_bool::load_ascii (std::istream& is)
-{
-  scalar = (octave_read_value<double> (is) != 0.);
-
-  if (!is)
-    {
-      error ("load: failed to load scalar constant");
-      return false;
-    }
-
-  return true;
-}
-
-bool
-octave_bool::save_binary (std::ostream& os, bool& /* save_as_floats */)
-{
-  char tmp = (scalar ? 1 : 0);
-  os.write (reinterpret_cast<char *> (&tmp), 1);
-
-  return true;
-}
-
-bool
-octave_bool::load_binary (std::istream& is, bool /* swap */,
-                          oct_mach_info::float_format /* fmt */)
-{
-  char tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-    return false;
-  scalar = (tmp ? 1 : 0);
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_bool::save_hdf5 (hid_t loc_id, const char *name,
-                        bool /* save_as_floats */)
-{
-  hsize_t dimens[3];
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-
-  space_hid = H5Screate_simple (0, dimens, 0);
-  if (space_hid < 0) return false;
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  double tmp = double_value ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &tmp) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_bool::load_hdf5 (hid_t loc_id, const char *name)
-{
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  double dtmp;
-  if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, &dtmp) < 0)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  scalar = (dtmp != 0.);
-
-  H5Dclose (data_hid);
-
-  return true;
-}
-
-#endif
-
-mxArray *
-octave_bool::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxLOGICAL_CLASS, 1, 1, mxREAL);
-
-  bool *pr = static_cast<bool *> (retval->get_data ());
-
-  pr[0] = scalar;
-
-  return retval;
-}
--- a/src/ov-bool.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_bool_h)
-#define octave_bool_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-base-scalar.h"
-#include "ov-bool-mat.h"
-#include "ov-scalar.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Real scalar values.
-
-class
-OCTINTERP_API
-octave_bool : public octave_base_scalar<bool>
-{
-public:
-
-  octave_bool (void)
-    : octave_base_scalar<bool> (false) { }
-
-  octave_bool (bool b)
-    : octave_base_scalar<bool> (b) { }
-
-  octave_bool (const octave_bool& s)
-    : octave_base_scalar<bool> (s) { }
-
-  ~octave_bool (void) { }
-
-  octave_base_value *clone (void) const { return new octave_bool (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_bool_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  idx_vector index_vector (void) const { return idx_vector (scalar); }
-
-  builtin_type_t builtin_type (void) const { return btyp_bool; }
-
-  bool is_real_scalar (void) const { return true; }
-
-  bool is_bool_scalar (void) const { return true; }
-
-  bool is_bool_type (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return false; }
-
-  bool is_true (void) const { return scalar; }
-
-  int8NDArray
-  int8_array_value (void) const
-    { return int8NDArray (dim_vector (1, 1), scalar); }
-
-  int16NDArray
-  int16_array_value (void) const
-    { return int16NDArray (dim_vector (1, 1), scalar); }
-
-  int32NDArray
-  int32_array_value (void) const
-    { return int32NDArray (dim_vector (1, 1), scalar); }
-
-  int64NDArray
-  int64_array_value (void) const
-    { return int64NDArray (dim_vector (1, 1), scalar); }
-
-  uint8NDArray
-  uint8_array_value (void) const
-    { return uint8NDArray (dim_vector (1, 1), scalar); }
-
-  uint16NDArray
-  uint16_array_value (void) const
-    { return uint16NDArray (dim_vector (1, 1), scalar); }
-
-  uint32NDArray
-  uint32_array_value (void) const
-    { return uint32NDArray (dim_vector (1, 1), scalar); }
-
-  uint64NDArray
-  uint64_array_value (void) const
-    { return uint64NDArray (dim_vector (1, 1), scalar); }
-
-  octave_int8
-  int8_scalar_value (void) const { return octave_int8 (scalar); }
-
-  octave_int16
-  int16_scalar_value (void) const { return octave_int16 (scalar); }
-
-  octave_int32
-  int32_scalar_value (void) const { return octave_int32 (scalar); }
-
-  octave_int64
-  int64_scalar_value (void) const { return octave_int64 (scalar); }
-
-  octave_uint8
-  uint8_scalar_value (void) const { return octave_uint8 (scalar); }
-
-  octave_uint16
-  uint16_scalar_value (void) const { return octave_uint16 (scalar); }
-
-  octave_uint32
-  uint32_scalar_value (void) const { return octave_uint32 (scalar); }
-
-  octave_uint64
-  uint64_scalar_value (void) const { return octave_uint64 (scalar); }
-
-  double double_value (bool = false) const { return scalar; }
-
-  float float_value (bool = false) const { return scalar; }
-
-  double scalar_value (bool = false) const { return scalar; }
-
-  float float_scalar_value (bool = false) const { return scalar; }
-
-  Matrix matrix_value (bool = false) const
-    { return Matrix (1, 1, scalar); }
-
-  FloatMatrix float_matrix_value (bool = false) const
-    { return FloatMatrix (1, 1, scalar); }
-
-  NDArray array_value (bool = false) const
-    { return NDArray (dim_vector (1, 1), static_cast<double> (scalar)); }
-
-  FloatNDArray float_array_value (bool = false) const
-    { return FloatNDArray (dim_vector (1, 1), static_cast<double> (scalar)); }
-
-  Complex complex_value (bool = false) const { return scalar; }
-
-  FloatComplex float_complex_value (bool = false) const { return scalar; }
-
-  ComplexMatrix complex_matrix_value (bool = false) const
-    { return ComplexMatrix (1, 1, Complex (scalar)); }
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const
-    { return FloatComplexMatrix (1, 1, FloatComplex (scalar)); }
-
-  ComplexNDArray complex_array_value (bool = false) const
-    { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); }
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const
-    { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); }
-
-  SparseMatrix sparse_matrix_value (bool = false) const
-    { return SparseMatrix (Matrix (1, 1, scalar)); }
-
-  // FIXME Need SparseComplexMatrix (Matrix) constructor!!!
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-    { return SparseComplexMatrix (sparse_matrix_value ()); }
-
-  SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
-    { return SparseBoolMatrix (boolMatrix (1, 1, scalar)); }
-
-  charNDArray
-  char_array_value (bool = false) const
-  {
-    charNDArray retval (dim_vector (1, 1));
-    retval(0) = static_cast<char> (scalar);
-    return retval;
-  }
-
-  bool bool_value (bool = false) const { return scalar; }
-
-  boolMatrix bool_matrix_value (bool = false) const
-    { return boolMatrix (1, 1, scalar); }
-
-  boolNDArray bool_array_value (bool = false) const
-    { return boolNDArray (dim_vector (1, 1), scalar); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      return os.write (bool_array_value (), block_size, output_type,
-                       skip, flt_fmt);
-    }
-
-  mxArray *as_mxArray (void) const;
-
-  // Mapper functions are converted to double for treatment
-  octave_value map (unary_mapper_t umap) const
-    {
-      octave_scalar m (scalar_value ());
-      return m.map (umap);
-    }
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-builtin.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov-builtin.h"
-#include "ov.h"
-#include "profiler.h"
-#include "toplev.h"
-#include "unwind-prot.h"
-
-DEFINE_OCTAVE_ALLOCATOR (octave_builtin);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_builtin,
-                                     "built-in function",
-                                     "built-in function");
-
-octave_value_list
-octave_builtin::subsref (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         int nargout)
-{
-  return octave_builtin::subsref (type, idx, nargout, 0);
-}
-
-octave_value_list
-octave_builtin::subsref (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         int nargout, const std::list<octave_lvalue>* lvalue_list)
-{
-  octave_value_list retval;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
-
-        retval = do_multi_index_op (tmp_nargout, idx.front (),
-                                    idx.size () == 1 ? lvalue_list : 0);
-      }
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  // FIXME -- perhaps there should be an
-  // octave_value_list::next_subsref member function?  See also
-  // octave_user_function::subsref.
-  //
-  // FIXME -- Note that if a function call returns multiple
-  // values, and there is further indexing to perform, then we are
-  // ignoring all but the first value.  Is this really what we want to
-  // do?  If it is not, then what should happen for stat("file").size,
-  // for exmaple?
-
-  if (idx.size () > 1)
-    retval = retval(0).next_subsref (nargout, type, idx);
-
-  return retval;
-}
-
-octave_value_list
-octave_builtin::do_multi_index_op (int nargout, const octave_value_list& args)
-{
-  return octave_builtin::do_multi_index_op (nargout, args, 0);
-}
-
-octave_value_list
-octave_builtin::do_multi_index_op (int nargout, const octave_value_list& args,
-                                   const std::list<octave_lvalue> *lvalue_list)
-{
-  octave_value_list retval;
-
-  if (error_state)
-    return retval;
-
-  if (args.has_magic_colon ())
-    ::error ("invalid use of colon in function argument list");
-  else
-    {
-      unwind_protect frame;
-
-      octave_call_stack::push (this);
-
-      frame.add_fcn (octave_call_stack::pop);
-
-      if (lvalue_list || curr_lvalue_list)
-        {
-          frame.protect_var (curr_lvalue_list);
-          curr_lvalue_list = lvalue_list;
-        }
-
-      try
-        {
-          BEGIN_PROFILER_BLOCK (profiler_name ())
-
-          retval = (*f) (args, nargout);
-          // Do not allow null values to be returned from functions.
-          // FIXME -- perhaps true builtins should be allowed?
-          retval.make_storable_values ();
-          // Fix the case of a single undefined value.
-          // This happens when a compiled function uses
-          //   octave_value retval;
-          // instead of
-          //   octave_value_list retval;
-          // the idiom is very common, so we solve that here.
-          if (retval.length () == 1 && retval.xelem (0).is_undefined ())
-            retval.clear ();
-
-          END_PROFILER_BLOCK
-        }
-      catch (octave_execution_exception)
-        {
-          gripe_library_execution_error ();
-        }
-    }
-
-  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	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_builtin_h)
-#define octave_builtin_h 1
-
-#include <string>
-
-#include "ov-fcn.h"
-#include "ov-typeinfo.h"
-
-class octave_value;
-class octave_value_list;
-class jit_type;
-
-// Builtin functions.
-
-class
-OCTINTERP_API
-octave_builtin : public octave_function
-{
-public:
-
-  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), 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)
-    {
-      octave_value_list tmp = subsref (type, idx, 1);
-      return tmp.length () > 0 ? tmp(0) : octave_value ();
-    }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout, const std::list<octave_lvalue>* lvalue_list);
-
-  octave_function *function_value (bool = false) { return this; }
-
-  bool is_builtin_function (void) const { return true; }
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args);
-
-  octave_value_list
-  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:
-
-  // 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!
-
-  octave_builtin (const octave_builtin& ob);
-
-  octave_builtin& operator = (const octave_builtin& ob);
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-cell.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1528 +0,0 @@
-/*
-
-Copyright (C) 1999-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <vector>
-#include <queue>
-
-#include "Array-util.h"
-#include "byte-swap.h"
-#include "lo-utils.h"
-#include "quit.h"
-#include "oct-locbuf.h"
-
-#include "defun.h"
-#include "error.h"
-#include "ov-cell.h"
-#include "oct-obj.h"
-#include "unwind-prot.h"
-#include "utils.h"
-#include "ov-base-mat.h"
-#include "ov-base-mat.cc"
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-#include "pr-output.h"
-#include "ov-scalar.h"
-#include "gripes.h"
-
-#include "ls-oct-ascii.h"
-#include "ls-oct-binary.h"
-#include "ls-hdf5.h"
-#include "ls-utils.h"
-
-// Cell is able to handle octave_value indexing by itself, so just forward
-// everything.
-
-template <>
-octave_value
-octave_base_matrix<Cell>::do_index_op (const octave_value_list& idx,
-                                       bool resize_ok)
-{
-  return matrix.index (idx, resize_ok);
-}
-
-template <>
-void
-octave_base_matrix<Cell>::assign (const octave_value_list& idx, const Cell& rhs)
-{
-  matrix.assign (idx, rhs);
-}
-
-template <>
-void
-octave_base_matrix<Cell>::assign (const octave_value_list& idx, octave_value rhs)
-{
-  // FIXME: Really?
-  if (rhs.is_cell ())
-    matrix.assign (idx, rhs.cell_value ());
-  else
-    matrix.assign (idx, Cell (rhs));
-}
-
-template <>
-void
-octave_base_matrix<Cell>::delete_elements (const octave_value_list& idx)
-{
-  matrix.delete_elements (idx);
-}
-
-// FIXME: this list of specializations is becoming so long that we should really ask
-// whether octave_cell should inherit from octave_base_matrix at all.
-
-template <>
-octave_value
-octave_base_matrix<Cell>::fast_elem_extract (octave_idx_type n) const
-{
-  if (n < matrix.numel ())
-    return Cell (matrix(n));
-  else
-    return octave_value ();
-}
-
-template <>
-bool
-octave_base_matrix<Cell>::fast_elem_insert (octave_idx_type n,
-                                            const octave_value& x)
-{
-  const octave_cell *xrep =
-    dynamic_cast<const octave_cell *> (&x.get_rep ());
-
-  bool retval = xrep && xrep->matrix.numel () == 1 && n < matrix.numel ();
-  if (retval)
-    matrix(n) = xrep->matrix(0);
-
-  return retval;
-}
-
-template class octave_base_matrix<Cell>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_cell);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cell, "cell", "cell");
-
-static void
-gripe_failed_assignment (void)
-{
-  error ("assignment to cell array failed");
-}
-
-octave_value_list
-octave_cell::subsref (const std::string& type,
-                      const std::list<octave_value_list>& idx,
-                      int nargout)
-{
-  octave_value_list retval;
-
-  switch (type[0])
-    {
-    case '(':
-      retval(0) = do_index_op (idx.front ());
-      break;
-
-    case '{':
-      {
-        octave_value tmp = do_index_op (idx.front ());
-
-        if (! error_state)
-          {
-            Cell tcell = tmp.cell_value ();
-
-            if (tcell.length () == 1)
-              retval(0) = tcell(0,0);
-            else
-              retval = octave_value (octave_value_list (tcell), true);
-          }
-      }
-      break;
-
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  // FIXME -- perhaps there should be an
-  // octave_value_list::next_subsref member function?  See also
-  // octave_user_function::subsref.
-
-  if (idx.size () > 1)
-    retval = retval(0).next_subsref (nargout, type, idx);
-
-  return retval;
-}
-
-octave_value
-octave_cell::subsref (const std::string& type,
-                      const std::list<octave_value_list>& idx,
-                      bool auto_add)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      retval = do_index_op (idx.front (), auto_add);
-      break;
-
-    case '{':
-      {
-        octave_value tmp = do_index_op (idx.front (), auto_add);
-
-        if (! error_state)
-          {
-            const Cell tcell = tmp.cell_value ();
-
-            if (tcell.length () == 1)
-              retval = tcell(0,0);
-            else
-              retval = octave_value (octave_value_list (tcell), true);
-          }
-      }
-      break;
-
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  // FIXME -- perhaps there should be an
-  // octave_value_list::next_subsref member function?  See also
-  // octave_user_function::subsref.
-
-  if (idx.size () > 1)
-    retval = retval.next_subsref (auto_add, type, idx);
-
-  return retval;
-}
-
-octave_value
-octave_cell::subsasgn (const std::string& type,
-                       const std::list<octave_value_list>& idx,
-                       const octave_value& rhs)
-{
-  octave_value retval;
-
-  int n = type.length ();
-
-  octave_value t_rhs = rhs;
-
-  clear_cellstr_cache ();
-
-  if (idx.front ().empty ())
-    {
-      error ("missing index in indexed assignment");
-      return retval;
-    }
-
-  if (n > 1)
-    {
-      switch (type[0])
-        {
-        case '(':
-          {
-            if (is_empty () && type[1] == '.')
-              {
-                // Allow conversion of empty cell array to some other
-                // type in cases like
-                //
-                //  x = {}; x(i).f = rhs
-
-                octave_value tmp = octave_value::empty_conv (type, rhs);
-
-                return tmp.subsasgn (type, idx, rhs);
-              }
-            else
-              {
-                octave_value tmp = do_index_op (idx.front (), true);
-
-                if (! tmp.is_defined ())
-                  tmp = octave_value::empty_conv (type.substr (1), rhs);
-
-                if (! error_state)
-                  {
-                    std::list<octave_value_list> next_idx (idx);
-
-                    next_idx.erase (next_idx.begin ());
-
-                    tmp.make_unique ();
-
-                    t_rhs = tmp.subsasgn (type.substr (1), next_idx, rhs);
-                  }
-              }
-          }
-          break;
-
-        case '{':
-          {
-            matrix.make_unique ();
-            Cell tmpc = matrix.index (idx.front (), true);
-
-            if (! error_state)
-              {
-                std::list<octave_value_list> next_idx (idx);
-
-                next_idx.erase (next_idx.begin ());
-
-                std::string next_type = type.substr (1);
-
-                if (tmpc.numel () == 1)
-                  {
-                    octave_value tmp = tmpc(0);
-                    tmpc = Cell ();
-
-                    if (! tmp.is_defined () || tmp.is_zero_by_zero ())
-                      {
-                        tmp = octave_value::empty_conv (type.substr (1), rhs);
-                        tmp.make_unique (); // probably a no-op.
-                      }
-                    else
-                      // optimization: ignore the copy still stored inside our array.
-                      tmp.make_unique (1);
-
-                    if (! error_state)
-                      t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
-                  }
-                else
-                  gripe_indexed_cs_list ();
-              }
-          }
-          break;
-
-        case '.':
-          {
-            if (is_empty ())
-              {
-                // Do nothing; the next branch will handle it.
-              }
-            else
-              {
-                std::string nm = type_name ();
-                error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-              }
-          }
-          break;
-
-        default:
-          panic_impossible ();
-        }
-    }
-
-  if (! error_state)
-    {
-      switch (type[0])
-        {
-        case '(':
-          {
-            octave_value_list i = idx.front ();
-
-            if (t_rhs.is_cell ())
-              octave_base_matrix<Cell>::assign (i, t_rhs.cell_value ());
-            else
-              if (t_rhs.is_null_value ())
-                octave_base_matrix<Cell>::delete_elements (i);
-              else
-                octave_base_matrix<Cell>::assign (i, Cell (t_rhs));
-
-            if (! error_state)
-              {
-                count++;
-                retval = octave_value (this);
-              }
-            else
-              gripe_failed_assignment ();
-          }
-          break;
-
-        case '{':
-          {
-            octave_value_list idxf = idx.front ();
-
-            if (t_rhs.is_cs_list ())
-              {
-                Cell tmp_cell = Cell (t_rhs.list_value ());
-
-                // Inquire the proper shape of the RHS.
-
-                dim_vector didx = dims ().redim (idxf.length ());
-                for (octave_idx_type k = 0; k < idxf.length (); k++)
-                  if (! idxf(k).is_magic_colon ()) didx(k) = idxf(k).numel ();
-
-                if (didx.numel () == tmp_cell.numel ())
-                  tmp_cell = tmp_cell.reshape (didx);
-
-
-                octave_base_matrix<Cell>::assign (idxf, tmp_cell);
-              }
-            else if (idxf.all_scalars () || do_index_op (idxf, true).numel () == 1)
-              // Regularize a null matrix if stored into a cell.
-              octave_base_matrix<Cell>::assign (idxf, Cell (t_rhs.storable_value ()));
-            else if (! error_state)
-              gripe_nonbraced_cs_list_assignment ();
-
-            if (! error_state)
-              {
-                count++;
-                retval = octave_value (this);
-              }
-            else
-              gripe_failed_assignment ();
-          }
-          break;
-
-        case '.':
-          {
-            if (is_empty ())
-              {
-                // Allow conversion of empty cell array to some other
-                // type in cases like
-                //
-                //  x = {}; x.f = rhs
-
-                octave_value tmp = octave_value::empty_conv (type, rhs);
-
-                return tmp.subsasgn (type, idx, rhs);
-              }
-            else
-              {
-                std::string nm = type_name ();
-                error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-              }
-          }
-          break;
-
-        default:
-          panic_impossible ();
-        }
-    }
-
-  return retval;
-}
-
-bool
-octave_cell::is_cellstr (void) const
-{
-  bool retval;
-  if (cellstr_cache.get ())
-    retval = true;
-  else
-    {
-      retval = matrix.is_cellstr ();
-      // Allocate empty cache to mark that this is indeed a cellstr.
-      if (retval)
-        cellstr_cache.reset (new Array<std::string> ());
-    }
-
-  return retval;
-}
-
-void
-octave_cell::assign (const octave_value_list& idx, const Cell& rhs)
-{
-  clear_cellstr_cache ();
-  octave_base_matrix<Cell>::assign (idx, rhs);
-}
-
-void
-octave_cell::assign (const octave_value_list& idx, const octave_value& rhs)
-{
-  clear_cellstr_cache ();
-  octave_base_matrix<Cell>::assign (idx, rhs);
-}
-
-
-void
-octave_cell::delete_elements (const octave_value_list& idx)
-{
-  clear_cellstr_cache ();
-  octave_base_matrix<Cell>::delete_elements (idx);
-}
-
-size_t
-octave_cell::byte_size (void) const
-{
-  size_t retval = 0;
-
-  for (octave_idx_type i = 0; i < numel (); i++)
-    retval += matrix(i).byte_size ();
-
-  return retval;
-}
-
-octave_value
-octave_cell::sort (octave_idx_type dim, sortmode mode) const
-{
-  octave_value retval;
-
-  if (is_cellstr ())
-    {
-      Array<std::string> tmp = cellstr_value ();
-
-      tmp = tmp.sort (dim, mode);
-
-      // We already have the cache.
-      retval = new octave_cell (tmp);
-    }
-  else
-    error ("sort: only cell arrays of character strings may be sorted");
-
-  return retval;
-}
-
-octave_value
-octave_cell::sort (Array<octave_idx_type> &sidx, octave_idx_type dim,
-                   sortmode mode) const
-{
-  octave_value retval;
-
-  if (is_cellstr ())
-    {
-      Array<std::string> tmp = cellstr_value ();
-
-      tmp = tmp.sort (sidx, dim, mode);
-
-      // We already have the cache.
-      retval = new octave_cell (tmp);
-    }
-  else
-    error ("sort: only cell arrays of character strings may be sorted");
-
-  return retval;
-}
-
-sortmode
-octave_cell::is_sorted (sortmode mode) const
-{
-  sortmode retval = UNSORTED;
-
-  if (is_cellstr ())
-    {
-      Array<std::string> tmp = cellstr_value ();
-
-      retval = tmp.is_sorted (mode);
-    }
-  else
-    error ("issorted: A is not a cell array of strings");
-
-  return retval;
-}
-
-
-Array<octave_idx_type>
-octave_cell::sort_rows_idx (sortmode mode) const
-{
-  Array<octave_idx_type> retval;
-
-  if (is_cellstr ())
-    {
-      Array<std::string> tmp = cellstr_value ();
-
-      retval = tmp.sort_rows_idx (mode);
-    }
-  else
-    error ("sortrows: only cell arrays of character strings may be sorted");
-
-  return retval;
-}
-
-sortmode
-octave_cell::is_sorted_rows (sortmode mode) const
-{
-  sortmode retval = UNSORTED;
-
-  if (is_cellstr ())
-    {
-      Array<std::string> tmp = cellstr_value ();
-
-      retval = tmp.is_sorted_rows (mode);
-    }
-  else
-    error ("issorted: A is not a cell array of strings");
-
-  return retval;
-}
-
-bool
-octave_cell::is_true (void) const
-{
-  error ("invalid conversion from cell array to logical value");
-  return false;
-}
-
-octave_value_list
-octave_cell::list_value (void) const
-{
-  return octave_value_list (matrix);
-}
-
-string_vector
-octave_cell::all_strings (bool pad) const
-{
-  string_vector retval;
-
-  octave_idx_type nel = numel ();
-
-  int n_elts = 0;
-
-  octave_idx_type max_len = 0;
-
-  std::queue<string_vector> strvec_queue;
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      string_vector s = matrix(i).all_strings ();
-
-      if (error_state)
-        return retval;
-
-      octave_idx_type s_len = s.length ();
-
-      n_elts += s_len ? s_len : 1;
-
-      octave_idx_type s_max_len = s.max_length ();
-
-      if (s_max_len > max_len)
-        max_len = s_max_len;
-
-      strvec_queue.push (s);
-    }
-
-  retval = string_vector (n_elts);
-
-  octave_idx_type k = 0;
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      const string_vector s = strvec_queue.front ();
-      strvec_queue.pop ();
-
-      octave_idx_type s_len = s.length ();
-
-      if (s_len)
-        {
-          for (octave_idx_type j = 0; j < s_len; j++)
-            {
-              std::string t = s[j];
-              int t_len = t.length ();
-
-              if (pad && max_len > t_len)
-                t += std::string (max_len - t_len, ' ');
-
-              retval[k++] = t;
-            }
-        }
-      else if (pad)
-        retval[k++] = std::string (max_len, ' ');
-      else
-        retval[k++] = std::string ();
-    }
-
-  return retval;
-}
-
-Array<std::string>
-octave_cell::cellstr_value (void) const
-{
-  Array<std::string> retval;
-
-  if (is_cellstr ())
-    {
-      if (cellstr_cache->is_empty ())
-        *cellstr_cache = matrix.cellstr_value ();
-
-      return *cellstr_cache;
-    }
-  else
-    error ("invalid conversion from cell array to array of strings");
-
-  return retval;
-}
-
-bool
-octave_cell::print_as_scalar (void) const
-{
-  return true;
-}
-
-void
-octave_cell::print (std::ostream& os, bool) const
-{
-  print_raw (os);
-}
-
-void
-octave_cell::print_raw (std::ostream& os, bool) const
-{
-  int nd = matrix.ndims ();
-
-  if (nd == 2)
-    {
-      octave_idx_type nr = rows ();
-      octave_idx_type nc = columns ();
-
-      if (nr > 0 && nc > 0)
-        {
-          newline (os);
-          indent (os);
-          os << "{";
-          newline (os);
-
-          increment_indent_level ();
-
-          for (octave_idx_type j = 0; j < nc; j++)
-            {
-              for (octave_idx_type i = 0; i < nr; i++)
-                {
-                  octave_quit ();
-
-                  std::ostringstream buf;
-                  buf << "[" << i+1 << "," << j+1 << "]";
-
-                  octave_value val = matrix(i,j);
-
-                  val.print_with_name (os, buf.str ());
-                }
-            }
-
-          decrement_indent_level ();
-
-          indent (os);
-          os << "}";
-          newline (os);
-        }
-      else
-        {
-          indent (os);
-          os << "{}";
-          if (Vprint_empty_dimensions)
-            os << "(" << nr << "x" << nc << ")";
-          newline (os);
-        }
-    }
-  else
-    {
-      indent (os);
-      dim_vector dv = matrix.dims ();
-      os << "{" << dv.str () << " Cell Array}";
-      newline (os);
-    }
-}
-
-#define CELL_ELT_TAG "<cell-element>"
-
-bool
-octave_cell::save_ascii (std::ostream& os)
-{
-  dim_vector d = dims ();
-  if (d.length () > 2)
-    {
-      os << "# ndims: " << d.length () << "\n";
-
-      for (int i = 0; i < d.length (); i++)
-        os << " " << d (i);
-      os << "\n";
-
-      Cell tmp = cell_value ();
-
-      for (octave_idx_type i = 0; i < d.numel (); i++)
-        {
-          octave_value o_val = tmp.elem (i);
-
-          // Recurse to print sub-value.
-          bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, false, 0);
-
-          if (! b)
-            return os;
-        }
-    }
-  else
-    {
-      // Keep this case, rather than use generic code above for backward
-      // compatiability. Makes load_ascii much more complex!!
-      os << "# rows: " << rows () << "\n"
-         << "# columns: " << columns () << "\n";
-
-      Cell tmp = cell_value ();
-
-      for (octave_idx_type j = 0; j < tmp.cols (); j++)
-        {
-          for (octave_idx_type i = 0; i < tmp.rows (); i++)
-            {
-              octave_value o_val = tmp.elem (i, j);
-
-              // Recurse to print sub-value.
-              bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, false, 0);
-
-              if (! b)
-                return os;
-            }
-
-          os << "\n";
-        }
-    }
-
-  return true;
-}
-
-bool
-octave_cell::load_ascii (std::istream& is)
-{
-  bool success = true;
-
-  clear_cellstr_cache ();
-
-  string_vector keywords(2);
-
-  keywords[0] = "ndims";
-  keywords[1] = "rows";
-
-  std::string kw;
-  octave_idx_type val = 0;
-
-  if (extract_keyword (is, keywords, kw, val, true))
-    {
-      if (kw == "ndims")
-        {
-          int mdims = static_cast<int> (val);
-
-          if (mdims >= 0)
-            {
-              dim_vector dv;
-              dv.resize (mdims);
-
-              for (int i = 0; i < mdims; i++)
-                is >> dv(i);
-
-              Cell tmp(dv);
-
-              for (octave_idx_type i = 0; i < dv.numel (); i++)
-                {
-                  octave_value t2;
-                  bool dummy;
-
-                  // recurse to read cell elements
-                  std::string nm = read_ascii_data (is, std::string (),
-                                                    dummy, t2, i);
-
-                  if (nm == CELL_ELT_TAG)
-                    {
-                      if (is)
-                        tmp.elem (i) = t2;
-                    }
-                  else
-                    {
-                      error ("load: cell array element had unexpected name");
-                      success = false;
-                      break;
-                    }
-                }
-
-              if (is)
-                matrix = tmp;
-              else
-                {
-                  error ("load: failed to load matrix constant");
-                  success = false;
-                }
-            }
-          else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
-        }
-      else if (kw == "rows")
-        {
-          octave_idx_type nr = val;
-          octave_idx_type nc = 0;
-
-          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
-            {
-              if (nr > 0 && nc > 0)
-                {
-                  Cell tmp (nr, nc);
-
-                  for (octave_idx_type j = 0; j < nc; j++)
-                    {
-                      for (octave_idx_type i = 0; i < nr; i++)
-                        {
-                          octave_value t2;
-                          bool dummy;
-
-                          // recurse to read cell elements
-                          std::string nm = read_ascii_data (is, std::string (),
-                                                            dummy, t2, i);
-
-                          if (nm == CELL_ELT_TAG)
-                            {
-                              if (is)
-                                tmp.elem (i, j) = t2;
-                            }
-                          else
-                            {
-                              error ("load: cell array element had unexpected name");
-                              success = false;
-                              goto cell_read_error;
-                            }
-                        }
-                    }
-
-                cell_read_error:
-
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load cell element");
-                      success = false;
-                    }
-                }
-              else if (nr == 0 || nc == 0)
-                matrix = Cell (nr, nc);
-              else
-                panic_impossible ();
-            }
-          else
-            {
-              error ("load: failed to extract number of rows and columns for cell array");
-              success = false;
-            }
-        }
-      else
-        panic_impossible ();
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_cell::save_binary (std::ostream& os, bool& save_as_floats)
-{
-  dim_vector d = dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims
-  int32_t di = - d.length ();
-  os.write (reinterpret_cast<char *> (&di), 4);
-  for (int i = 0; i < d.length (); i++)
-    {
-      di = d(i);
-      os.write (reinterpret_cast<char *> (&di), 4);
-    }
-
-  Cell tmp = cell_value ();
-
-  for (octave_idx_type i = 0; i < d.numel (); i++)
-    {
-      octave_value o_val = tmp.elem (i);
-
-      // Recurse to print sub-value.
-      bool b = save_binary_data (os, o_val, CELL_ELT_TAG, "", 0,
-                                 save_as_floats);
-
-      if (! b)
-        return false;
-    }
-
-  return true;
-}
-
-bool
-octave_cell::load_binary (std::istream& is, bool swap,
-                          oct_mach_info::float_format fmt)
-{
-  clear_cellstr_cache ();
-
-  bool success = true;
-  int32_t mdims;
-  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&mdims);
-  if (mdims >= 0)
-    return false;
-
-  mdims = -mdims;
-  int32_t di;
-  dim_vector dv;
-  dv.resize (mdims);
-
-  for (int i = 0; i < mdims; i++)
-    {
-      if (! is.read (reinterpret_cast<char *> (&di), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&di);
-      dv(i) = di;
-    }
-
-  // Convert an array with a single dimension to be a row vector.
-  // Octave should never write files like this, other software
-  // might.
-
-  if (mdims == 1)
-    {
-      mdims = 2;
-      dv.resize (mdims);
-      dv(1) = dv(0);
-      dv(0) = 1;
-    }
-
-  octave_idx_type nel = dv.numel ();
-  Cell tmp(dv);
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      octave_value t2;
-      bool dummy;
-      std::string doc;
-
-      // recurse to read cell elements
-      std::string nm = read_binary_data (is, swap, fmt, std::string (),
-                                         dummy, t2, doc);
-
-      if (nm == CELL_ELT_TAG)
-        {
-          if (is)
-            tmp.elem (i) = t2;
-        }
-      else
-        {
-          error ("load: cell array element had unexpected name");
-          success = false;
-          break;
-        }
-    }
-
-  if (is)
-    matrix = tmp;
-  else
-    {
-      error ("load: failed to load matrix constant");
-      success = false;
-    }
-
-  return success;
-}
-
-void *
-octave_cell::mex_get_data (void) const
-{
-  clear_cellstr_cache ();
-  return matrix.mex_get_data ();
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_cell::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  hsize_t rank = dv.length ();
-  hid_t space_hid = -1, data_hid = -1, size_hid = -1;
-
-#if HAVE_HDF5_18
-  data_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Gcreate (loc_id, name, 0);
-#endif
-
-  if (data_hid < 0)
-    return false;
-
-  // Have to save cell array shape, since can't have a
-  // dataset of groups....
-
-  space_hid = H5Screate_simple (1, &rank, 0);
-
-  if (space_hid < 0)
-    {
-      H5Gclose (data_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (octave_idx_type, hdims, rank);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  for (hsize_t i = 0; i < rank; i++)
-    hdims[i] = dv(rank-i-1);
-
-#if HAVE_HDF5_18
-  size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (size_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (data_hid);
-      return false;
-    }
-
-  if (H5Dwrite (size_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                H5P_DEFAULT, hdims) < 0)
-    {
-      H5Dclose (size_hid);
-      H5Sclose (space_hid);
-      H5Gclose (data_hid);
-      return false;
-    }
-
-  H5Dclose (size_hid);
-  H5Sclose (space_hid);
-
-  // Recursively add each element of the cell to this group.
-
-  Cell tmp = cell_value ();
-
-  octave_idx_type nel = dv.numel ();
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      std::ostringstream buf;
-      int digits = static_cast<int> (gnulib::floor (::log10 (static_cast<double> (nel)) + 1.0));
-      buf << "_" << std::setw (digits) << std::setfill ('0') << i;
-      std::string s = buf.str ();
-
-      if (! add_hdf5_data (data_hid, tmp.elem (i), s.c_str (), "", false,
-                           save_as_floats))
-        {
-          H5Gclose (data_hid);
-          return false;
-        }
-    }
-
-  H5Gclose (data_hid);
-
-  return true;
-}
-
-bool
-octave_cell::load_hdf5 (hid_t loc_id, const char *name)
-{
-  clear_cellstr_cache ();
-
-  bool retval = false;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-    return (empty > 0);
-
-#if HAVE_HDF5_18
-  hid_t group_id = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t group_id = H5Gopen (loc_id, name);
-#endif
-
-  if (group_id < 0)
-    return false;
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (group_id, "dims", H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (group_id, "dims");
-#endif
-  hid_t space_hid = H5Dget_space (data_hid);
-  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
-  if (rank != 1)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_id);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering.
-
-  dv.resize (hdims[0]);
-
-  OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, hdims[0]);
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, tmp) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_id);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-  H5Gclose (group_id);
-
-  for (hsize_t i = 0, j = hdims[0] - 1; i < hdims[0]; i++, j--)
-    dv(j) = tmp[i];
-
-  hdf5_callback_data dsub;
-
-  herr_t retval2 = -1;
-
-  Cell m (dv);
-
-  int current_item = 0;
-
-  hsize_t num_obj = 0;
-#if HAVE_HDF5_18
-  group_id = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  group_id = H5Gopen (loc_id, name);
-#endif
-  H5Gget_num_objs (group_id, &num_obj);
-  H5Gclose (group_id);
-
-  for (octave_idx_type i = 0; i < dv.numel (); i++)
-    {
-
-      if (current_item >= static_cast<int> (num_obj))
-        retval2 = -1;
-      else
-        retval2 = H5Giterate (loc_id, name, &current_item,
-                              hdf5_read_next_data, &dsub);
-
-      if (retval2 <= 0)
-        break;
-
-      octave_value ov = dsub.tc;
-      m.elem (i) = ov;
-
-    }
-
-  if (retval2 >= 0)
-    {
-      matrix = m;
-      retval = true;
-    }
-
-  return retval;
-}
-
-#endif
-
-DEFUN (iscell, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} iscell (@var{x})\n\
-Return true if @var{x} is a cell array object.\n\
-@seealso{ismatrix, isstruct, iscellstr, isa}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    retval = args(0).is_cell ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (cell, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} cell (@var{n})\n\
-@deftypefnx {Built-in Function} {} cell (@var{m}, @var{n})\n\
-@deftypefnx {Built-in Function} {} cell (@var{m}, @var{n}, @var{k}, @dots{})\n\
-@deftypefnx {Built-in Function} {} cell ([@var{m} @var{n} @dots{}])\n\
-Create a new cell array object.\n\
-If invoked with a single scalar integer argument, return a square\n\
-@nospell{NxN} cell array.  If invoked with two or more scalar\n\
-integer arguments, or a vector of integer values, return an array with\n\
-the given dimensions.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  dim_vector dims;
-
-  switch (nargin)
-    {
-    case 0:
-      dims = dim_vector (0, 0);
-      break;
-
-    case 1:
-      get_dimensions (args(0), "cell", dims);
-      break;
-
-    default:
-      {
-        dims.resize (nargin);
-
-        for (int i = 0; i < nargin; i++)
-          {
-            dims(i) = args(i).is_empty () ? 0 : args(i).nint_value ();
-
-            if (error_state)
-              {
-                error ("cell: expecting scalar arguments");
-                break;
-              }
-          }
-      }
-      break;
-    }
-
-  if (! error_state)
-    {
-      dims.chop_trailing_singletons ();
-
-      check_dimensions (dims, "cell");
-
-      if (! error_state)
-        retval = Cell (dims, Matrix ());
-    }
-
-  return retval;
-}
-
-DEFUN (iscellstr, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} iscellstr (@var{cell})\n\
-Return true if every element of the cell array @var{cell} is a\n\
-character string.\n\
-@seealso{ischar}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    retval = args(0).is_cellstr ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-// Note that since Fcellstr calls Fiscellstr, we need to have
-// Fiscellstr defined first (to provide a declaration) and also we
-// should keep it in the same file (so we don't have to provide a
-// declaration) and so we don't have to use feval to call it.
-
-DEFUN (cellstr, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} cellstr (@var{string})\n\
-Create a new cell array object from the elements of the string\n\
-array @var{string}.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    {
-      octave_value_list tmp = Fiscellstr (args, 1);
-
-      if (tmp(0).is_true ())
-        retval = args(0);
-      else
-        {
-          string_vector s = args(0).all_strings ();
-
-          if (! error_state)
-            retval = (s.is_empty ()
-                      ? Cell (octave_value (std::string ()))
-                      : Cell (s, true));
-          else
-            error ("cellstr: argument STRING must be a 2-D character array");
-        }
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (struct2cell, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} struct2cell (@var{S})\n\
-Create a new cell array from the objects stored in the struct object.\n\
-If @var{f} is the number of fields in the structure, the resulting\n\
-cell array will have a dimension vector corresponding to\n\
-@code{[@var{F} size(@var{S})]}.  For example:\n\
-\n\
-@example\n\
-@group\n\
-s = struct (\"name\", @{\"Peter\", \"Hannah\", \"Robert\"@},\n\
-           \"age\", @{23, 16, 3@});\n\
-c = struct2cell (s)\n\
-   @result{} c = @{1x1x3 Cell Array@}\n\
-c(1,1,:)(:)\n\
-   @result{}\n\
-      @{\n\
-        [1,1] = Peter\n\
-        [2,1] = Hannah\n\
-        [3,1] = Robert\n\
-      @}\n\
-c(2,1,:)(:)\n\
-   @result{}\n\
-      @{\n\
-        [1,1] = 23\n\
-        [2,1] = 16\n\
-        [3,1] = 3\n\
-      @}\n\
-@end group\n\
-@end example\n\
-\n\
-@seealso{cell2struct, fieldnames}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    {
-      const octave_map m = args(0).map_value ();
-
-      if (! error_state)
-        {
-          const dim_vector m_dv = m.dims ();
-
-          octave_idx_type num_fields = m.nfields ();
-
-          // The resulting dim_vector should have dimensions:
-          // [numel(fields) size(struct)]
-          // except if the struct is a column vector.
-
-          dim_vector result_dv;
-          if (m_dv (m_dv.length () - 1) == 1)
-              result_dv.resize (m_dv.length ());
-          else
-              result_dv.resize (m_dv.length () + 1); // Add 1 for the fields.
-
-          result_dv(0) = num_fields;
-
-          for (int i = 1; i < result_dv.length (); i++)
-            result_dv(i) = m_dv(i-1);
-
-          NoAlias<Cell> c (result_dv);
-
-          octave_idx_type n_elts = m.numel ();
-
-          // Fill c in one sweep. Note that thanks to octave_map structure,
-          // we don't need a key lookup at all.
-          for (octave_idx_type j = 0; j < n_elts; j++)
-            for (octave_idx_type i = 0; i < num_fields; i++)
-              c(i,j) = m.contents(i)(j);
-
-          retval = c;
-        }
-      else
-        error ("struct2cell: argument S must be a structure");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!test
-%! keys = cellstr (char (floor (rand (11,10)*24+65)))';
-%! vals = cellfun (@(x) mat2cell (rand (19,1), ones (19,1), 1), ...
-%!          mat2cell ([1:11]', ones (11,1), 1), "uniformoutput", false)';
-%! s = struct ([keys; vals]{:});
-%! t = cell2struct ([vals{:}], keys, 2);
-%! assert (s, t);
-%! assert (struct2cell (s), [vals{:}]');
-%! assert (fieldnames (s), keys');
-*/
-
-mxArray *
-octave_cell::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (dims ());
-
-  mxArray **elts = static_cast<mxArray **> (retval->get_data ());
-
-  mwSize nel = numel ();
-
-  const octave_value *p = matrix.data ();
-
-  for (mwIndex i = 0; i < nel; i++)
-    elts[i] = new mxArray (p[i]);
-
-  return retval;
-}
-
-octave_value
-octave_cell::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-#define FORWARD_MAPPER(UMAP) \
-    case umap_ ## UMAP: \
-      return matrix.UMAP ()
-    FORWARD_MAPPER (xisalnum);
-    FORWARD_MAPPER (xisalpha);
-    FORWARD_MAPPER (xisascii);
-    FORWARD_MAPPER (xiscntrl);
-    FORWARD_MAPPER (xisdigit);
-    FORWARD_MAPPER (xisgraph);
-    FORWARD_MAPPER (xislower);
-    FORWARD_MAPPER (xisprint);
-    FORWARD_MAPPER (xispunct);
-    FORWARD_MAPPER (xisspace);
-    FORWARD_MAPPER (xisupper);
-    FORWARD_MAPPER (xisxdigit);
-    FORWARD_MAPPER (xtoascii);
-    FORWARD_MAPPER (xtolower);
-    FORWARD_MAPPER (xtoupper);
-
-    default:
-      return octave_base_value::map (umap);
-    }
-}
--- a/src/ov-cell.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
-
-Copyright (C) 1999-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_cell_h)
-#define octave_cell_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-#include <memory>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "Cell.h"
-#include "error.h"
-#include "ov-base-mat.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Cells.
-
-class
-octave_cell : public octave_base_matrix<Cell>
-{
-public:
-
-  octave_cell (void)
-    : octave_base_matrix<Cell> (), cellstr_cache () { }
-
-  octave_cell (const Cell& c)
-    : octave_base_matrix<Cell> (c), cellstr_cache () { }
-
-  octave_cell (const Array<std::string>& str)
-    : octave_base_matrix<Cell> (Cell (str)), cellstr_cache (new Array<std::string> (str)) { }
-
-  octave_cell (const octave_cell& c)
-    : octave_base_matrix<Cell> (c), cellstr_cache () { }
-
-  ~octave_cell (void) { }
-
-  octave_base_value *clone (void) const { return new octave_cell (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_cell (); }
-
-#if 0
-  octave_base_value *try_narrowing_conversion (void);
-#endif
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    {
-      octave_value_list tmp = subsref (type, idx, 1);
-      return tmp.length () > 0 ? tmp(0) : octave_value ();
-    }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int);
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx,
-                        bool auto_add);
-
-  octave_value subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs);
-
-  void assign (const octave_value_list& idx, const Cell& rhs);
-
-  void assign (const octave_value_list& idx, const octave_value& rhs);
-
-  void delete_elements (const octave_value_list& idx);
-
-  size_t byte_size (void) const;
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
-
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const;
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const;
-
-  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const;
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
-
-  bool is_matrix_type (void) const { return false; }
-
-  bool is_numeric_type (void) const { return false; }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_cell (void) const { return true; }
-
-  builtin_type_t builtin_type (void) const { return btyp_cell; }
-
-  bool is_cellstr (void) const;
-
-  bool is_true (void) const;
-
-  Cell cell_value (void) const { return matrix; }
-
-  octave_value_list list_value (void) const;
-
-  octave_value convert_to_str_internal (bool pad, bool, char type) const
-    { return octave_value (all_strings (pad), type); }
-
-  string_vector all_strings (bool pad = false) const;
-
-  Array<std::string> cellstr_value (void) const;
-
-  bool print_as_scalar (void) const;
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  octave_value map (unary_mapper_t umap) const;
-
-  mxArray *as_mxArray (void) const;
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const;
-
-private:
-
-  void clear_cellstr_cache (void) const
-    { cellstr_cache.reset (); }
-
-  mutable std::auto_ptr<Array<std::string> > cellstr_cache;
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-ch-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <cctype>
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "mx-base.h"
-
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-mat.cc"
-#include "ov-ch-mat.h"
-#include "gripes.h"
-#include "pr-output.h"
-
-template class octave_base_matrix<charNDArray>;
-
-idx_vector
-octave_char_matrix::index_vector (void) const
-{
-  const char *p = matrix.data ();
-  if (numel () == 1 && *p == ':')
-    return idx_vector (':');
-  else
-    return idx_vector (array_value (true));
-}
-
-double
-octave_char_matrix::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "character matrix", "real scalar");
-
-      retval = static_cast<unsigned char> (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("character matrix", "real scalar");
-
-  return retval;
-}
-
-float
-octave_char_matrix::float_value (bool) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "character matrix", "real scalar");
-
-      retval = static_cast<unsigned char> (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("character matrix", "real scalar");
-
-  return retval;
-}
-
-Complex
-octave_char_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "character matrix", "complex scalar");
-
-      retval = static_cast<unsigned char> (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("character matrix", "complex scalar");
-
-  return retval;
-}
-
-FloatComplex
-octave_char_matrix::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "character matrix", "complex scalar");
-
-      retval = static_cast<unsigned char> (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("character matrix", "complex scalar");
-
-  return retval;
-}
-
-void
-octave_char_matrix::print_raw (std::ostream& os,
-                               bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, matrix, pr_as_read_syntax,
-                         current_print_indent_level ());
-}
-
-mxArray *
-octave_char_matrix::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxCHAR_CLASS, dims (), mxREAL);
-
-  mxChar *pr = static_cast<mxChar *> (retval->get_data ());
-
-  mwSize nel = numel ();
-
-  const char *p = matrix.data ();
-
-  for (mwIndex i = 0; i < nel; i++)
-    pr[i] = p[i];
-
-  return retval;
-}
-
-// The C++ standard guarantees cctype defines functions, not macros (and hence macros *CAN'T*
-// be defined if only cctype is included)
-// so there's no need to f*ck around. The exceptions are isascii and toascii,
-// which are not C++.
-// Oddly enough, all those character functions are int (*) (int), even
-// in C++. Wicked!
-static inline int xisascii (int c)
-{ return isascii (c); }
-
-static inline int xtoascii (int c)
-{ return toascii (c); }
-
-octave_value
-octave_char_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-#define STRING_MAPPER(UMAP,FCN,TYPE) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.map<TYPE, int (&) (int)> (FCN))
-
-    STRING_MAPPER (xisalnum, std::isalnum, bool);
-    STRING_MAPPER (xisalpha, std::isalpha, bool);
-    STRING_MAPPER (xisascii, xisascii, bool);
-    STRING_MAPPER (xiscntrl, std::iscntrl, bool);
-    STRING_MAPPER (xisdigit, std::isdigit, bool);
-    STRING_MAPPER (xisgraph, std::isgraph, bool);
-    STRING_MAPPER (xislower, std::islower, bool);
-    STRING_MAPPER (xisprint, std::isprint, bool);
-    STRING_MAPPER (xispunct, std::ispunct, bool);
-    STRING_MAPPER (xisspace, std::isspace, bool);
-    STRING_MAPPER (xisupper, std::isupper, bool);
-    STRING_MAPPER (xisxdigit, std::isxdigit, bool);
-    STRING_MAPPER (xtoascii, xtoascii, double);
-    STRING_MAPPER (xtolower, std::tolower, char);
-    STRING_MAPPER (xtoupper, std::toupper, char);
-
-    default:
-      {
-        octave_matrix m (array_value (true));
-        return m.map (umap);
-      }
-    }
-}
--- a/src/ov-ch-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_char_matrix_h)
-#define octave_char_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "ov.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Character matrix values.
-
-class
-octave_char_matrix : public octave_base_matrix<charNDArray>
-{
-protected:
-
-  octave_char_matrix (void)
-    : octave_base_matrix<charNDArray> () { }
-
-  octave_char_matrix (const charMatrix& chm)
-    : octave_base_matrix<charNDArray> (chm) { }
-
-  octave_char_matrix (const charNDArray& chm)
-    : octave_base_matrix<charNDArray> (chm) { }
-
-  octave_char_matrix (const Array<char>& chm)
-    : octave_base_matrix<charNDArray> (chm) { }
-
-  octave_char_matrix (char c)
-    : octave_base_matrix<charNDArray> (c) { }
-
-  octave_char_matrix (const char *s)
-    : octave_base_matrix<charNDArray> (s) { }
-
-  octave_char_matrix (const std::string& s)
-    : octave_base_matrix<charNDArray> (s) { }
-
-  octave_char_matrix (const string_vector& s)
-    : octave_base_matrix<charNDArray> (s) { }
-
-  octave_char_matrix (const octave_char_matrix& chm)
-    : octave_base_matrix<charNDArray> (chm) { }
-
-public:
-
-  ~octave_char_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_char_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_char_matrix (); }
-
-  idx_vector index_vector (void) const;
-
-  builtin_type_t builtin_type (void) const { return btyp_char; }
-
-  bool is_char_matrix (void) const { return true; }
-  bool is_real_matrix (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  float float_scalar_value (bool frc_str_conv = false) const
-    { return float_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const
-    { return Matrix (matrix.matrix_value ()); }
-
-  FloatMatrix float_matrix_value (bool = false) const
-    { return FloatMatrix (matrix.matrix_value ()); }
-
-  NDArray array_value (bool = false) const
-    { return NDArray (matrix); }
-
-  FloatNDArray float_array_value (bool = false) const
-    { return FloatNDArray (matrix); }
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const
-    { return ComplexMatrix (matrix.matrix_value ()); }
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const
-    { return FloatComplexMatrix (matrix.matrix_value ()); }
-
-  ComplexNDArray complex_array_value (bool = false) const
-    { return ComplexNDArray (matrix); }
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const
-    { return FloatComplexNDArray (matrix); }
-
-  charMatrix char_matrix_value (bool = false) const
-    { return matrix.matrix_value (); }
-
-  charNDArray char_array_value (bool = false) const
-    { return matrix; }
-
-  octave_value convert_to_str_internal (bool, bool, char type) const
-    { return octave_value (matrix, type); }
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const { return matrix.mex_get_data (); }
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-};
-
-#endif
--- a/src/ov-class.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2282 +0,0 @@
-/*
-
-Copyright (C) 2007-2012 John W. Eaton
-Copyright (C) 2009 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "Array-util.h"
-#include "byte-swap.h"
-#include "oct-locbuf.h"
-#include "lo-mappers.h"
-
-#include "Cell.h"
-#include "defun.h"
-#include "error.h"
-#include "file-ops.h"
-#include "gripes.h"
-#include "load-path.h"
-#include "ls-hdf5.h"
-#include "ls-oct-ascii.h"
-#include "ls-oct-binary.h"
-#include "ls-utils.h"
-#include "oct-lvalue.h"
-#include "ov-class.h"
-#include "ov-fcn.h"
-#include "ov-usr-fcn.h"
-#include "pager.h"
-#include "parse.h"
-#include "pr-output.h"
-#include "toplev.h"
-#include "unwind-prot.h"
-#include "variables.h"
-
-DEFINE_OCTAVE_ALLOCATOR(octave_class);
-
-int octave_class::t_id (-1);
-
-const std::string octave_class::t_name ("class");
-
-void
-octave_class::register_type (void)
-{
-  t_id = octave_value_typeinfo::register_type
-    (octave_class::t_name, "<unknown>", octave_value (new octave_class ()));
-}
-
-octave_class::octave_class (const octave_map& m, const std::string& id,
-                            const octave_value_list& parents)
-  : octave_base_value (), map (m), c_name (id), obsolete_copies (0)
-{
-  octave_idx_type n = parents.length ();
-
-  for (octave_idx_type idx = 0; idx < n; idx++)
-    {
-      octave_value parent = parents(idx);
-
-      if (! parent.is_object ())
-        error ("parents must be objects");
-      else
-        {
-          std::string pcnm = parent.class_name ();
-
-          if (find_parent_class (pcnm))
-            error ("duplicate class in parent tree");
-          else
-            {
-              parent_list.push_back (pcnm);
-
-              octave_idx_type nel = map.numel ();
-              octave_idx_type p_nel = parent.numel ();
-
-              if (nel == 0)
-                {
-                  if (p_nel == 0)
-                    {
-                      // No elements in MAP or the parent class object,
-                      // so just add the field name.
-
-                      map.assign (pcnm, Cell (map.dims ()));
-                    }
-                  else if (p_nel == 1)
-                    {
-                      if (map.nfields () == 0)
-                        {
-                          // No elements or fields in MAP, but the
-                          // parent is class object with one element.
-                          // Resize to match size of parent class and
-                          // make the parent a field in MAP.
-
-                          map.resize (parent.dims ());
-
-                          map.assign (pcnm, parent);
-                        }
-                      else
-                        {
-                          // No elements in MAP, but we have at least
-                          // one field.  So don't resize, just add the
-                          // field name.
-
-                          map.assign (pcnm, Cell (map.dims ()));
-                        }
-                    }
-                  else if (map.nfields () == 0)
-                    {
-                      // No elements or fields in MAP and more than one
-                      // element in the parent class object, so we can
-                      // resize MAP to match parent dimsenions, then
-                      // distribute the elements of the parent object to
-                      // the elements of MAP.
-
-                      dim_vector parent_dims = parent.dims ();
-
-                      map.resize (parent_dims);
-
-                      Cell c (parent_dims);
-
-                      octave_map pmap = parent.map_value ();
-
-                      std::list<std::string> plist
-                        = parent.parent_class_name_list ();
-
-                      for (octave_idx_type i = 0; i < p_nel; i++)
-                        c(i) = octave_value (pmap.index (i), pcnm, plist);
-
-                      map.assign (pcnm, c);
-                    }
-                  else
-                    error ("class: parent class dimension mismatch");
-                }
-              else if (nel == 1 && p_nel == 1)
-                {
-                  // Simple assignment.
-
-                  map.assign (pcnm, parent);
-                }
-              else
-                {
-                  if (p_nel == 1)
-                    {
-                      // Broadcast the scalar parent class object to
-                      // each element of MAP.
-
-                      Cell pcell (map.dims (), parent);
-
-                      map.assign (pcnm, pcell);
-                    }
-
-                  else if (nel == p_nel)
-                    {
-                      // FIXME -- is there a better way to do this?
-
-                      // The parent class object has the same number of
-                      // elements as the map we are using to create the
-                      // new object, so distribute those elements to
-                      // each element of the new object by first
-                      // splitting the elements of the parent class
-                      // object into a cell array with one element per
-                      // cell.  Then do the assignment all at once.
-
-                      Cell c (parent.dims ());
-
-                      octave_map pmap = parent.map_value ();
-
-                      std::list<std::string> plist
-                        = parent.parent_class_name_list ();
-
-                      for (octave_idx_type i = 0; i < p_nel; i++)
-                        c(i) = octave_value (pmap.index (i), pcnm, plist);
-
-                      map.assign (pcnm, c);
-                    }
-                  else
-                    error ("class: parent class dimension mismatch");
-                }
-            }
-        }
-    }
-
-  if (! error_state)
-    symbol_table::add_to_parent_map (id, parent_list);
-}
-
-octave_base_value *
-octave_class::unique_clone (void)
-{
-  if (count == obsolete_copies)
-    {
-      // All remaining copies are obsolete. We don't actually need to clone.
-      count++;
-      return this;
-    }
-  else
-    {
-      // In theory, this shouldn't be happening, but it's here just in case.
-      if (count < obsolete_copies)
-        obsolete_copies = 0;
-
-      return clone ();
-    }
-}
-
-std::string
-octave_class::get_current_method_class (void)
-{
-  std::string retval = class_name ();
-
-  if (nparents () > 0)
-    {
-      octave_function *fcn = octave_call_stack::current ();
-
-      // Here we are just looking to see if FCN is a method or constructor
-      // for any class, not specifically this one.
-      if (fcn && (fcn->is_class_method () || fcn->is_class_constructor ()))
-        retval = fcn->dispatch_class ();
-    }
-
-  return retval;
-}
-
-static void
-gripe_invalid_index1 (void)
-{
-  error ("invalid index for class");
-}
-
-static void
-gripe_invalid_index_for_assignment (void)
-{
-  error ("invalid index for class assignment");
-}
-
-static void
-gripe_invalid_index_type (const std::string& nm, char t)
-{
-  error ("%s cannot be indexed with %c", nm.c_str (), t);
-}
-
-static void
-gripe_failed_assignment (void)
-{
-  error ("assignment to class element failed");
-}
-
-static inline octave_value_list
-sanitize (const octave_value_list& ovl)
-{
-  octave_value_list retval = ovl;
-
-  for (octave_idx_type i = 0; i < ovl.length (); i++)
-    {
-      if (retval(i).is_magic_colon ())
-        retval(i) = ":";
-    }
-
-  return retval;
-}
-
-static inline octave_value
-make_idx_args (const std::string& type,
-               const std::list<octave_value_list>& idx,
-               const std::string& who)
-{
-  octave_value retval;
-
-  size_t len = type.length ();
-
-  if (len == idx.size ())
-    {
-      Cell type_field (1, len);
-      Cell subs_field (1, len);
-
-      std::list<octave_value_list>::const_iterator p = idx.begin ();
-
-      for (size_t i = 0; i < len; i++)
-        {
-          char t = type[i];
-
-          switch (t)
-            {
-            case '(':
-              type_field(i) = "()";
-              subs_field(i) = Cell (sanitize (*p++));
-              break;
-
-            case '{':
-              type_field(i) = "{}";
-              subs_field(i) = Cell (sanitize (*p++));
-              break;
-
-            case '.':
-              {
-                type_field(i) = ".";
-
-                octave_value_list vlist = *p++;
-
-                if (vlist.length () == 1)
-                  {
-                    octave_value val = vlist(0);
-
-                    if (val.is_string ())
-                      subs_field(i) = val;
-                    else
-                      {
-                        error ("expecting character string argument for `.' index");
-                        return retval;
-                      }
-                  }
-                else
-                  {
-                    error ("expecting single argument for `.' index");
-                    return retval;
-                  }
-              }
-              break;
-
-            default:
-              panic_impossible ();
-              break;
-            }
-        }
-
-      octave_map m;
-
-      m.assign ("type", type_field);
-      m.assign ("subs", subs_field);
-
-      retval = m;
-    }
-  else
-    error ("invalid index for %s", who.c_str ());
-
-  return retval;
-}
-
-Cell
-octave_class::dotref (const octave_value_list& idx)
-{
-  Cell retval;
-
-  assert (idx.length () == 1);
-
-  std::string method_class = get_current_method_class ();
-
-  // Find the class in which this method resides before attempting to access
-  // the requested field.
-
-  octave_base_value *obvp = find_parent_class (method_class);
-
-  if (obvp == 0)
-    {
-      error ("malformed class");
-      return retval;
-    }
-
-  octave_map my_map = (obvp != this) ? obvp->map_value () : map;
-
-  std::string nm = idx(0).string_value ();
-
-  if (! error_state)
-    {
-      octave_map::const_iterator p = my_map.seek (nm);
-
-      if (p != my_map.end ())
-        retval = my_map.contents (p);
-      else
-        error ("class has no member `%s'", nm.c_str ());
-    }
-  else
-    gripe_invalid_index1 ();
-
-  return retval;
-}
-
-static bool
-called_from_builtin (void)
-{
-  octave_function *fcn = octave_call_stack::caller ();
-
-  // FIXME -- we probably need a better check here, or some other
-  // mechanism to avoid overloaded functions when builtin is used.
-  // For example, what if someone overloads the builtin function?
-  // Also, are there other places where using builtin is not properly
-  // avoiding dispatch?
-
-  return (fcn && fcn->name () == "builtin");
-}
-
-Matrix
-octave_class::size (void)
-{
-  if (in_class_method () || called_from_builtin ())
-    return octave_base_value::size ();
-
-  Matrix retval (1, 2, 1.0);
-  octave_value meth = symbol_table::find_method ("size", class_name ());
-
-  if (meth.is_defined ())
-    {
-      count++;
-      octave_value_list args (1, octave_value (this));
-
-      octave_value_list lv = feval (meth.function_value (), args, 1);
-      if (lv.length () > 0 && lv(0).is_matrix_type () && lv(0).dims ().is_vector ())
-        retval = lv(0).matrix_value ();
-      else
-        error ("@%s/size: invalid return value", class_name ().c_str ());
-    }
-  else
-    {
-      dim_vector dv = dims ();
-
-      int nd = dv.length ();
-
-      retval.resize (1, nd);
-
-      for (int i = 0; i < nd; i++)
-        retval(i) = dv(i);
-    }
-
-  return retval;
-}
-
-octave_idx_type
-octave_class::numel (const octave_value_list& idx)
-{
-  if (in_class_method () || called_from_builtin ())
-    return octave_base_value::numel (idx);
-
-  octave_idx_type retval = -1;
-  const std::string cn = class_name ();
-
-  octave_value meth = symbol_table::find_method ("numel", cn);
-
-  if (meth.is_defined ())
-    {
-      octave_value_list args (idx.length () + 1, octave_value ());
-
-      count++;
-      args(0) = octave_value (this);
-
-      for (octave_idx_type i = 0; i < idx.length (); i++)
-        args(i+1) = idx(i);
-
-      octave_value_list lv = feval (meth.function_value (), args, 1);
-      if (lv.length () == 1 && lv(0).is_scalar_type ())
-        retval = lv(0).idx_type_value (true);
-      else
-        error ("@%s/numel: invalid return value", cn.c_str ());
-    }
-  else
-    retval = octave_base_value::numel (idx);
-
-  return retval;
-}
-
-octave_value_list
-octave_class::subsref (const std::string& type,
-                       const std::list<octave_value_list>& idx,
-                       int nargout)
-{
-  octave_value_list retval;
-
-  if (in_class_method () || called_from_builtin ())
-    {
-      // FIXME -- this block of code is the same as the body of
-      // octave_struct::subsref.  Maybe it could be shared instead of
-      // duplicated.
-
-      int skip = 1;
-
-      switch (type[0])
-        {
-        case '(':
-          {
-            if (type.length () > 1 && type[1] == '.')
-              {
-                std::list<octave_value_list>::const_iterator p = idx.begin ();
-                octave_value_list key_idx = *++p;
-
-                Cell tmp = dotref (key_idx);
-
-                if (! error_state)
-                  {
-                    Cell t = tmp.index (idx.front ());
-
-                    retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
-
-                    // We handled two index elements, so tell
-                    // next_subsref to skip both of them.
-
-                    skip++;
-                  }
-              }
-            else
-              retval(0) = octave_value (map.index (idx.front ()),
-                                        c_name, parent_list);
-          }
-          break;
-
-        case '.':
-          {
-            if (map.numel () > 0)
-              {
-                Cell t = dotref (idx.front ());
-
-                retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
-              }
-          }
-          break;
-
-        case '{':
-          gripe_invalid_index_type (type_name (), type[0]);
-          break;
-
-        default:
-          panic_impossible ();
-        }
-
-      // FIXME -- perhaps there should be an
-      // octave_value_list::next_subsref member function?  See also
-      // octave_user_function::subsref.
-
-      if (idx.size () > 1)
-        retval = retval(0).next_subsref (nargout, type, idx, skip);
-    }
-  else
-    {
-      octave_value meth = symbol_table::find_method ("subsref", class_name ());
-
-      if (meth.is_defined ())
-        {
-          octave_value_list args;
-
-          args(1) = make_idx_args (type, idx, "subsref");
-
-          if (error_state)
-            return octave_value_list ();
-
-          count++;
-          args(0) = octave_value (this);
-
-          // FIXME: for Matlab compatibility, let us attempt to set up a proper
-          // value for nargout at least in the simple case where the
-          // cs-list-type expression - i.e., {} or ().x, is the leading one.
-          // Note that Octave does not actually need this, since it will
-          // be able to properly react to varargout a posteriori.
-          bool maybe_cs_list_query = (type[0] == '.' || type[0] == '{'
-                                      || (type.length () > 1 && type[0] == '('
-                                          && type[1] == '.'));
-
-          int true_nargout = nargout;
-
-          if (maybe_cs_list_query)
-            {
-              // Set up a proper nargout for the subsref call by calling numel.
-              octave_value_list tmp;
-              if (type[0] != '.') tmp = idx.front ();
-              true_nargout = numel (tmp);
-            }
-
-          retval = feval (meth.function_value (), args, true_nargout);
-
-          // Since we're handling subsref, return the list in the first value
-          // if it has more than one element, to be able to pass through
-          // rvalue1 calls.
-          if (retval.length () > 1)
-            retval = octave_value (retval, true);
-        }
-      else
-        {
-          if (type.length () == 1 && type[0] == '(')
-            retval(0) = octave_value (map.index (idx.front ()), c_name,
-                                      parent_list);
-          else
-            gripe_invalid_index1 ();
-        }
-    }
-
-  return retval;
-}
-
-octave_value
-octave_class::numeric_conv (const Cell& val, const std::string& type)
-{
-  octave_value retval;
-
-  if (val.length () == 1)
-    {
-      retval = val(0);
-
-      if (type.length () > 0 && type[0] == '.' && ! retval.is_map ())
-        retval = octave_map ();
-    }
-  else
-    gripe_invalid_index_for_assignment ();
-
-  return retval;
-}
-
-octave_value
-octave_class::subsasgn (const std::string& type,
-                        const std::list<octave_value_list>& idx,
-                        const octave_value& rhs)
-{
-  count++;
-  return subsasgn_common (octave_value (this), type, idx, rhs);
-}
-
-octave_value
-octave_class::undef_subsasgn (const std::string& type,
-                              const std::list<octave_value_list>& idx,
-                              const octave_value& rhs)
-{
-  // For compatibility with Matlab, pass [] as the first argument to the
-  // the subsasgn function when the LHS of an indexed assignment is
-  // undefined.
-
-  return subsasgn_common (Matrix (), type, idx, rhs);
-}
-
-octave_value
-octave_class::subsasgn_common (const octave_value& obj,
-                               const std::string& type,
-                               const std::list<octave_value_list>& idx,
-                               const octave_value& rhs)
-{
-  octave_value retval;
-
-  if (! (in_class_method () || called_from_builtin ()))
-    {
-      octave_value meth = symbol_table::find_method ("subsasgn", class_name ());
-
-      if (meth.is_defined ())
-        {
-          octave_value_list args;
-
-          if (rhs.is_cs_list ())
-            {
-              octave_value_list lrhs = rhs.list_value ();
-              args.resize (2 + lrhs.length ());
-              for (octave_idx_type i = 0; i < lrhs.length (); i++)
-                args(2+i) = lrhs(i);
-            }
-          else
-            args(2) = rhs;
-
-          args(1) = make_idx_args (type, idx, "subsasgn");
-
-          if (error_state)
-            return octave_value_list ();
-
-          args(0) = obj;
-
-          // Now comes the magic. Count copies with me:
-          // 1. myself (obsolete)
-          // 2. the copy inside args (obsolete)
-          // 3. the copy in method's symbol table (working)
-          // ... possibly more (not obsolete).
-          //
-          // So we mark 2 copies as obsolete and hold our fingers crossed.
-          // But prior to doing that, check whether the routine is amenable
-          // to the optimization.
-          // It is essential that the handling function doesn't store extra
-          // copies anywhere. If it does, things will not break but the
-          // optimization won't work.
-
-          octave_value_list tmp;
-
-          if (obsolete_copies == 0 && meth.is_user_function ()
-              && meth.user_function_value ()->subsasgn_optimization_ok ())
-            {
-              unwind_protect frame;
-              frame.protect_var (obsolete_copies);
-              obsolete_copies = 2;
-
-              tmp = feval (meth.function_value (), args);
-            }
-          else
-            tmp = feval (meth.function_value (), args);
-
-          // FIXME -- should the subsasgn method be able to return
-          // more than one value?
-
-          if (tmp.length () > 1)
-            error ("expecting single return value from @%s/subsasgn",
-                   class_name ().c_str ());
-
-          else
-            retval = tmp(0);
-
-          return retval;
-        }
-    }
-
-  // Find the class in which this method resides before
-  // attempting to do the indexed assignment.
-
-  std::string method_class = get_current_method_class ();
-
-  octave_base_value *obvp = unique_parent_class (method_class);
-  if (obvp != this)
-    {
-
-      if (obvp)
-        {
-          obvp->subsasgn (type, idx, rhs);
-          if (! error_state)
-            {
-              count++;
-              retval = octave_value (this);
-            }
-          else
-            gripe_failed_assignment ();
-        }
-      else
-        error ("malformed class");
-
-      return retval;
-    }
-
-  // FIXME -- this block of code is the same as the body of
-  // octave_struct::subsasgn.  Maybe it could be shared instead of
-  // duplicated.
-
-  int n = type.length ();
-
-  octave_value t_rhs = rhs;
-
-  if (n > 1 && ! (type.length () == 2 && type[0] == '(' && type[1] == '.'))
-    {
-      switch (type[0])
-        {
-        case '(':
-          {
-            if (type.length () > 1 && type[1] == '.')
-              {
-                std::list<octave_value_list>::const_iterator p = idx.begin ();
-                octave_value_list t_idx = *p;
-
-                octave_value_list key_idx = *++p;
-
-                assert (key_idx.length () == 1);
-
-                std::string key = key_idx(0).string_value ();
-
-                if (! error_state)
-                  {
-                    octave_value u;
-
-                    if (! map.contains (key))
-                      u = octave_value::empty_conv (type.substr (2), rhs);
-                    else
-                      {
-                        Cell map_val = map.contents (key);
-
-                        Cell map_elt = map_val.index (idx.front (), true);
-
-                        u = numeric_conv (map_elt, type.substr (2));
-                      }
-
-                    if (! error_state)
-                      {
-                        std::list<octave_value_list> next_idx (idx);
-
-                        // We handled two index elements, so subsasgn to
-                        // needs to skip both of them.
-
-                        next_idx.erase (next_idx.begin ());
-                        next_idx.erase (next_idx.begin ());
-
-                        u.make_unique ();
-
-                        t_rhs = u.subsasgn (type.substr (2), next_idx, rhs);
-                      }
-                  }
-                else
-                  gripe_invalid_index_for_assignment ();
-              }
-            else
-              gripe_invalid_index_for_assignment ();
-          }
-          break;
-
-        case '.':
-          {
-            octave_value_list key_idx = idx.front ();
-
-            assert (key_idx.length () == 1);
-
-            std::string key = key_idx(0).string_value ();
-
-            std::list<octave_value_list> next_idx (idx);
-
-            next_idx.erase (next_idx.begin ());
-
-            std::string next_type = type.substr (1);
-
-            Cell tmpc (1, 1);
-            octave_map::iterator pkey = map.seek (key);
-            if (pkey != map.end ())
-              {
-                map.contents (pkey).make_unique ();
-                tmpc = map.contents (pkey);
-              }
-
-            // FIXME: better code reuse?
-            if (! error_state)
-              {
-                if (tmpc.numel () == 1)
-                  {
-                    octave_value& tmp = tmpc(0);
-
-                    if (! tmp.is_defined () || tmp.is_zero_by_zero ())
-                      {
-                        tmp = octave_value::empty_conv (next_type, rhs);
-                        tmp.make_unique (); // probably a no-op.
-                      }
-                    else
-                      // optimization: ignore the copy still stored inside our map.
-                      tmp.make_unique (1);
-
-                    if (! error_state)
-                      t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
-                  }
-                else
-                  gripe_indexed_cs_list ();
-              }
-          }
-          break;
-
-        case '{':
-          gripe_invalid_index_type (type_name (), type[0]);
-          break;
-
-        default:
-          panic_impossible ();
-        }
-    }
-
-  if (! error_state)
-    {
-      switch (type[0])
-        {
-        case '(':
-          {
-            if (n > 1 && type[1] == '.')
-              {
-                std::list<octave_value_list>::const_iterator p = idx.begin ();
-                octave_value_list key_idx = *++p;
-
-                assert (key_idx.length () == 1);
-
-                std::string key = key_idx(0).string_value ();
-
-                if (! error_state)
-                  {
-                    map.assign (idx.front (), key, t_rhs);
-
-                    if (! error_state)
-                      {
-                        count++;
-                        retval = octave_value (this);
-                      }
-                    else
-                      gripe_failed_assignment ();
-                  }
-                else
-                  gripe_failed_assignment ();
-              }
-            else
-              {
-                if (t_rhs.is_object () || t_rhs.is_map ())
-                  {
-                    octave_map rhs_map = t_rhs.map_value ();
-
-                    if (! error_state)
-                      {
-                        map.assign (idx.front (), rhs_map);
-
-                        if (! error_state)
-                          {
-                            count++;
-                            retval = octave_value (this);
-                          }
-                        else
-                          gripe_failed_assignment ();
-                      }
-                    else
-                      error ("invalid class assignment");
-                  }
-                else
-                  {
-                    if (t_rhs.is_empty ())
-                      {
-                        map.delete_elements (idx.front ());
-
-                        if (! error_state)
-                          {
-                            count++;
-                            retval = octave_value (this);
-                          }
-                        else
-                          gripe_failed_assignment ();
-                      }
-                    else
-                      error ("invalid class assignment");
-                  }
-              }
-          }
-          break;
-
-        case '.':
-          {
-            octave_value_list key_idx = idx.front ();
-
-            assert (key_idx.length () == 1);
-
-            std::string key = key_idx(0).string_value ();
-
-            if (t_rhs.is_cs_list ())
-              {
-                Cell tmp_cell = Cell (t_rhs.list_value ());
-
-                // The shape of the RHS is irrelevant, we just want
-                // the number of elements to agree and to preserve the
-                // shape of the left hand side of the assignment.
-
-                if (numel () == tmp_cell.numel ())
-                  tmp_cell = tmp_cell.reshape (dims ());
-
-                map.setfield (key, tmp_cell);
-              }
-            else
-              {
-                Cell tmp_cell(1, 1);
-                tmp_cell(0) = t_rhs.storable_value ();
-                map.setfield (key, tmp_cell);
-              }
-
-            if (! error_state)
-              {
-                count++;
-                retval = octave_value (this);
-              }
-            else
-              gripe_failed_assignment ();
-          }
-          break;
-
-        case '{':
-          gripe_invalid_index_type (type_name (), type[0]);
-          break;
-
-        default:
-          panic_impossible ();
-        }
-    }
-  else
-    gripe_failed_assignment ();
-
-  return retval;
-}
-
-idx_vector
-octave_class::index_vector (void) const
-{
-  idx_vector retval;
-
-  octave_value meth = symbol_table::find_method ("subsindex", class_name ());
-
-  if (meth.is_defined ())
-    {
-      octave_value_list args;
-      args(0) = octave_value (new octave_class (map, c_name, parent_list));
-
-      octave_value_list tmp = feval (meth.function_value (), args, 1);
-
-      if (!error_state && tmp.length () >= 1)
-        {
-          if (tmp(0).is_object ())
-            error ("subsindex function must return a valid index vector");
-          else
-            // Index vector returned by subsindex is zero based
-            // (why this inconsistency Mathworks?), and so we must
-            // add one to the value returned as the index_vector method
-            // expects it to be one based.
-            retval = do_binary_op (octave_value::op_add, tmp (0),
-                                   octave_value (1.0)).index_vector ();
-        }
-    }
-  else
-    error ("no subsindex method defined for class %s",
-           class_name ().c_str ());
-
-  return retval;
-}
-
-size_t
-octave_class::byte_size (void) const
-{
-  // Neglect the size of the fieldnames.
-
-  size_t retval = 0;
-
-  for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
-    {
-      std::string key = map.key (p);
-
-      octave_value val = octave_value (map.contents (p));
-
-      retval += val.byte_size ();
-    }
-
-  return retval;
-}
-
-string_vector
-octave_class::map_keys (void) const
-{
-  string_vector retval;
-  gripe_wrong_type_arg ("octave_class::map_keys()", type_name ());
-  return retval;
-}
-
-octave_base_value *
-octave_class::find_parent_class (const std::string& parent_class_name)
-{
-  octave_base_value* retval = 0;
-
-  if (parent_class_name == class_name ())
-    retval = this;
-  else
-    {
-      for (std::list<std::string>::iterator pit = parent_list.begin ();
-           pit != parent_list.end ();
-           pit++)
-        {
-          octave_map::const_iterator smap = map.seek (*pit);
-
-          const Cell& tmp = map.contents (smap);
-
-          octave_value vtmp = tmp(0);
-
-          octave_base_value *obvp = vtmp.internal_rep ();
-
-          retval = obvp->find_parent_class (parent_class_name);
-
-          if (retval)
-            break;
-        }
-    }
-
-  return retval;
-}
-
-octave_base_value *
-octave_class::unique_parent_class (const std::string& parent_class_name)
-{
-  octave_base_value* retval = 0;
-
-  if (parent_class_name == class_name ())
-    retval = this;
-  else
-    {
-      for (std::list<std::string>::iterator pit = parent_list.begin ();
-           pit != parent_list.end ();
-           pit++)
-        {
-          octave_map::iterator smap = map.seek (*pit);
-
-          Cell& tmp = map.contents (smap);
-
-          octave_value& vtmp = tmp(0);
-
-          octave_base_value *obvp = vtmp.internal_rep ();
-
-          // Use find_parent_class first to avoid uniquifying if not necessary.
-          retval = obvp->find_parent_class (parent_class_name);
-
-          if (retval)
-            {
-              vtmp.make_unique ();
-              obvp = vtmp.internal_rep ();
-              retval = obvp->unique_parent_class (parent_class_name);
-
-              break;
-            }
-        }
-    }
-
-  return retval;
-}
-
-string_vector
-octave_class::all_strings (bool pad) const
-{
-  string_vector retval;
-
-  octave_value meth = symbol_table::find_method ("char", class_name ());
-
-  if (meth.is_defined ())
-    {
-      octave_value_list args;
-      args(0) = octave_value (new octave_class (map, c_name, parent_list));
-
-      octave_value_list tmp = feval (meth.function_value (), args, 1);
-
-      if (!error_state && tmp.length () >= 1)
-        {
-          if (tmp(0).is_string ())
-            retval = tmp(0).all_strings (pad);
-          else
-            error ("cname/char method did not return a character string");
-        }
-    }
-  else
-    error ("no char method defined for class %s", class_name ().c_str ());
-
-  return retval;
-}
-
-
-void
-octave_class::print (std::ostream& os, bool) const
-{
-  print_raw (os);
-}
-
-void
-octave_class::print_raw (std::ostream& os, bool) const
-{
-  unwind_protect frame;
-
-  indent (os);
-  os << "  <class " << class_name () << ">";
-  newline (os);
-}
-
-bool
-octave_class::print_name_tag (std::ostream& os, const std::string& name) const
-{
-  bool retval = false;
-
-  indent (os);
-  os << name << " =";
-  newline (os);
-  if (! Vcompact_format)
-    newline (os);
-
-  return retval;
-}
-
-void
-octave_class::print_with_name (std::ostream& os, const std::string& name,
-                               bool)
-{
-  octave_value fcn = symbol_table::find_method ("display", class_name ());
-
-  if (fcn.is_defined ())
-    {
-      octave_value_list args;
-
-      count++;
-      args(0) = octave_value (this);
-
-      string_vector arg_names (1);
-
-      arg_names[0] = name;
-
-      args.stash_name_tags (arg_names);
-
-      feval (fcn.function_value (), args);
-    }
-  else
-    {
-      indent (os);
-      os << name << " = <class " << class_name () << ">";
-      newline (os);
-    }
-}
-
-// Loading a class properly requires an exemplar map entry for success.
-// If we don't have one, we attempt to create one by calling the constructor
-// with no arguments.
-bool
-octave_class::reconstruct_exemplar (void)
-{
-  bool retval = false;
-
-  octave_class::exemplar_const_iterator it
-    = octave_class::exemplar_map.find (c_name);
-
-  if (it != octave_class::exemplar_map.end ())
-    retval = true;
-  else
-    {
-      octave_value ctor = symbol_table::find_method (c_name, c_name);
-
-      bool have_ctor = false;
-
-      if (ctor.is_defined () && ctor.is_function ())
-        {
-          octave_function *fcn = ctor.function_value ();
-
-          if (fcn && fcn->is_class_constructor (c_name))
-            have_ctor = true;
-
-          // Something has gone terribly wrong if
-          // symbol_table::find_method (c_name, c_name) does not return
-          // a class constructor for the class c_name...
-          assert (have_ctor);
-        }
-
-      if (have_ctor)
-        {
-          octave_value_list result
-            = ctor.do_multi_index_op (1, octave_value_list ());
-
-          if (result.length () == 1)
-            retval = true;
-          else
-            warning ("call to constructor for class %s failed", c_name.c_str ());
-        }
-      else
-        warning ("no constructor for class %s", c_name.c_str ());
-    }
-
-  return retval;
-}
-
-void
-octave_class::clear_exemplar_map (void)
-{
-  exemplar_map.clear ();
-}
-
-//  Load/save does not provide enough information to reconstruct the
-//  class inheritance structure.  reconstruct_parents () attempts to
-//  do so.  If successful, a "true" value is returned.
-//
-//  Note that we don't check the loaded object structure against the
-//  class structure here so the user's loadobj method has a chance
-//  to do its magic.
-bool
-octave_class::reconstruct_parents (void)
-{
-  bool retval = true, might_have_inheritance = false;
-  std::string dbgstr = "dork";
-
-  // First, check to see if there might be an issue with inheritance.
-  for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
-    {
-      std::string  key = map.key (p);
-      Cell         val = map.contents (p);
-      if ( val(0).is_object () )
-        {
-          dbgstr = "blork";
-          if ( key == val(0).class_name () )
-            {
-              might_have_inheritance = true;
-              dbgstr = "cork";
-              break;
-            }
-        }
-    }
-
-  if (might_have_inheritance)
-    {
-      octave_class::exemplar_const_iterator it
-        = octave_class::exemplar_map.find (c_name);
-
-      if (it == octave_class::exemplar_map.end ())
-        retval = false;
-      else
-        {
-          octave_class::exemplar_info exmplr = it->second;
-          parent_list = exmplr.parents ();
-          for (std::list<std::string>::iterator pit = parent_list.begin ();
-               pit != parent_list.end ();
-               pit++)
-            {
-              dbgstr = *pit;
-              bool dbgbool = map.contains (*pit);
-              if (!dbgbool)
-                {
-                  retval = false;
-                  break;
-                }
-            }
-        }
-    }
-
-  return retval;
-}
-
-bool
-octave_class::save_ascii (std::ostream& os)
-{
-  os << "# classname: " << class_name () << "\n";
-  octave_map m;
-  if (load_path::find_method (class_name (), "saveobj") != std::string ())
-    {
-      octave_value in = new octave_class (*this);
-      octave_value_list tmp = feval ("saveobj", in, 1);
-      if (! error_state)
-        m = tmp(0).map_value ();
-      else
-        return false;
-    }
-  else
-    m = map_value ();
-
-  os << "# length: " << m.nfields () << "\n";
-
-  octave_map::iterator i = m.begin ();
-  while (i != m.end ())
-    {
-      octave_value val = map.contents (i);
-
-      bool b = save_ascii_data (os, val, m.key (i), false, 0);
-
-      if (! b)
-        return os;
-
-      i++;
-    }
-
-  return true;
-}
-
-bool
-octave_class::load_ascii (std::istream& is)
-{
-  octave_idx_type len = 0;
-  std::string classname;
-  bool success = true;
-
-  if (extract_keyword (is, "classname", classname) && classname != "")
-    {
-      if (extract_keyword (is, "length", len) && len >= 0)
-        {
-          if (len > 0)
-            {
-              octave_map m (map);
-
-              for (octave_idx_type j = 0; j < len; j++)
-                {
-                  octave_value t2;
-                  bool dummy;
-
-                  // recurse to read cell elements
-                  std::string nm
-                    = read_ascii_data (is, std::string (), dummy, t2, j);
-
-                  if (! is)
-                    break;
-
-                  Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
-
-                  if (error_state)
-                    {
-                      error ("load: internal error loading class elements");
-                      return false;
-                    }
-
-                  m.assign (nm, tcell);
-                }
-
-              if (is)
-                {
-                  c_name = classname;
-                  reconstruct_exemplar ();
-
-                  map = m;
-
-                  if (! reconstruct_parents ())
-                    warning ("load: unable to reconstruct object inheritance");
-                  else
-                    {
-                      if (load_path::find_method (classname, "loadobj")
-                          != std::string ())
-                        {
-                          octave_value in = new octave_class (*this);
-                          octave_value_list tmp = feval ("loadobj", in, 1);
-
-                          if (! error_state)
-                            map = tmp(0).map_value ();
-                          else
-                            success = false;
-                        }
-                    }
-                }
-              else
-                {
-                  error ("load: failed to load class");
-                  success = false;
-                }
-            }
-          else if (len == 0 )
-            {
-              map = octave_map (dim_vector (1, 1));
-              c_name = classname;
-            }
-          else
-            panic_impossible ();
-        }
-      else
-        {
-          error ("load: failed to extract number of elements in class");
-          success = false;
-        }
-    }
-  else
-    {
-      error ("load: failed to extract name of class");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_class::save_binary (std::ostream& os, bool& save_as_floats)
-{
-  int32_t classname_len = class_name ().length ();
-
-  os.write (reinterpret_cast<char *> (&classname_len), 4);
-  os << class_name ();
-
-  octave_map m;
-  if (load_path::find_method (class_name (), "saveobj") != std::string ())
-    {
-      octave_value in = new octave_class (*this);
-      octave_value_list tmp = feval ("saveobj", in, 1);
-      if (! error_state)
-        m = tmp(0).map_value ();
-      else
-        return false;
-    }
-  else
-    m = map_value ();
-
-  int32_t len = m.nfields ();
-  os.write (reinterpret_cast<char *> (&len), 4);
-
-  octave_map::iterator i = m.begin ();
-  while (i != m.end ())
-    {
-      octave_value val = map.contents (i);
-
-      bool b = save_binary_data (os, val, m.key (i), "", 0, save_as_floats);
-
-      if (! b)
-        return os;
-
-      i++;
-    }
-
-  return true;
-}
-
-bool
-octave_class::load_binary (std::istream& is, bool swap,
-                            oct_mach_info::float_format fmt)
-{
-  bool success = true;
-
-  int32_t classname_len;
-
-  is.read (reinterpret_cast<char *> (&classname_len), 4);
-  if (! is)
-    return false;
-  else if (swap)
-    swap_bytes<4> (&classname_len);
-
-  {
-    OCTAVE_LOCAL_BUFFER (char, classname, classname_len+1);
-    classname[classname_len] = '\0';
-    if (! is.read (reinterpret_cast<char *> (classname), classname_len))
-      return false;
-    c_name = classname;
-  }
-  reconstruct_exemplar ();
-
-  int32_t len;
-  if (! is.read (reinterpret_cast<char *> (&len), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&len);
-
-  if (len > 0)
-    {
-      octave_map m (map);
-
-      for (octave_idx_type j = 0; j < len; j++)
-        {
-          octave_value t2;
-          bool dummy;
-          std::string doc;
-
-          // recurse to read cell elements
-          std::string nm = read_binary_data (is, swap, fmt, std::string (),
-                                             dummy, t2, doc);
-
-          if (! is)
-            break;
-
-          Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
-
-          if (error_state)
-            {
-              error ("load: internal error loading class elements");
-              return false;
-            }
-
-          m.assign (nm, tcell);
-        }
-
-      if (is)
-        {
-          map = m;
-
-          if (! reconstruct_parents ())
-            warning ("load: unable to reconstruct object inheritance");
-          else
-            {
-              if (load_path::find_method (c_name, "loadobj") != std::string ())
-                {
-                  octave_value in = new octave_class (*this);
-                  octave_value_list tmp = feval ("loadobj", in, 1);
-
-                  if (! error_state)
-                    map = tmp(0).map_value ();
-                  else
-                    success = false;
-                }
-            }
-        }
-      else
-        {
-          warning ("load: failed to load class");
-          success = false;
-        }
-    }
-  else if (len == 0 )
-    map = octave_map (dim_vector (1, 1));
-  else
-    panic_impossible ();
-
-  return success;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_class::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
-{
-  hsize_t hdims[3];
-  hid_t group_hid = -1;
-  hid_t type_hid = -1;
-  hid_t space_hid = -1;
-  hid_t class_hid = -1;
-  hid_t data_hid = -1;
-  octave_map m;
-  octave_map::iterator i;
-
-#if HAVE_HDF5_18
-  group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  group_hid = H5Gcreate (loc_id, name, 0);
-#endif
-  if (group_hid < 0)
-    goto error_cleanup;
-
-  // Add the class name to the group
-  type_hid = H5Tcopy (H5T_C_S1); H5Tset_size (type_hid, c_name.length () + 1);
-  if (type_hid < 0)
-    goto error_cleanup;
-
-  hdims[0] = 0;
-  space_hid = H5Screate_simple (0 , hdims, 0);
-  if (space_hid < 0)
-    goto error_cleanup;
-#if HAVE_HDF5_18
-  class_hid = H5Dcreate (group_hid, "classname",  type_hid, space_hid,
-                         H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  class_hid = H5Dcreate (group_hid, "classname",  type_hid, space_hid,
-                         H5P_DEFAULT);
-#endif
-  if (class_hid < 0 || H5Dwrite (class_hid, type_hid, H5S_ALL, H5S_ALL,
-                                    H5P_DEFAULT, c_name.c_str ()) < 0)
-    goto error_cleanup;
-
-#if HAVE_HDF5_18
-  data_hid = H5Gcreate (group_hid, "value", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Gcreate (group_hid, "value", 0);
-#endif
-  if (data_hid < 0)
-    goto error_cleanup;
-
-  if (load_path::find_method (class_name (), "saveobj") != std::string ())
-    {
-      octave_value in = new octave_class (*this);
-      octave_value_list tmp = feval ("saveobj", in, 1);
-      if (! error_state)
-        m = tmp(0).map_value ();
-      else
-        goto error_cleanup;
-    }
-  else
-    m = map_value ();
-
-  // recursively add each element of the class to this group
-  i = m.begin ();
-  while (i != m.end ())
-    {
-      octave_value val = map.contents (i);
-
-      bool retval2 = add_hdf5_data (data_hid, val, m.key (i), "", false,
-                                    save_as_floats);
-
-      if (! retval2)
-        break;
-
-      i++;
-    }
-
- error_cleanup:
-
-  if (data_hid > 0)
-    H5Gclose (data_hid);
-
-  if (class_hid > 0)
-    H5Dclose (class_hid);
-
-  if (space_hid > 0)
-    H5Sclose (space_hid);
-
-  if (type_hid > 0)
-    H5Tclose (type_hid);
-
-  if (group_hid > 0)
-    H5Gclose (group_hid);
-
-  return true;
-}
-
-bool
-octave_class::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  hid_t group_hid = -1;
-  hid_t data_hid = -1;
-  hid_t type_hid = -1;
-  hid_t type_class_hid = -1;
-  hid_t space_hid = -1;
-  hid_t subgroup_hid = -1;
-  hid_t st_id = -1;
-
-  hdf5_callback_data dsub;
-
-  herr_t retval2 = 0;
-  octave_map m (dim_vector (1, 1));
-  int current_item = 0;
-  hsize_t num_obj = 0;
-  int slen = 0;
-  hsize_t rank = 0;
-
-#if HAVE_HDF5_18
-  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  group_hid = H5Gopen (loc_id, name);
-#endif
-  if (group_hid < 0)
-    goto error_cleanup;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "classname", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "classname");
-#endif
-
-  if (data_hid < 0)
-    goto error_cleanup;
-
-  type_hid = H5Dget_type (data_hid);
-
-  type_class_hid = H5Tget_class (type_hid);
-
-  if (type_class_hid != H5T_STRING)
-    goto error_cleanup;
-
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    goto error_cleanup;
-
-  slen = H5Tget_size (type_hid);
-  if (slen < 0)
-    goto error_cleanup;
-
-  // do-while loop here to prevent goto crossing initialization of classname
-  do
-    {
-      OCTAVE_LOCAL_BUFFER (char, classname, slen);
-
-      // create datatype for (null-terminated) string to read into:
-      st_id = H5Tcopy (H5T_C_S1);
-      H5Tset_size (st_id, slen);
-
-      if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                   classname) < 0)
-        {
-          H5Tclose (st_id);
-          H5Dclose (data_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      H5Tclose (st_id);
-      H5Dclose (data_hid);
-      data_hid = -1;
-
-      c_name = classname;
-    }
-  while (0);
-  reconstruct_exemplar ();
-
-#if HAVE_HDF5_18
-  subgroup_hid = H5Gopen (group_hid, name, H5P_DEFAULT);
-#else
-  subgroup_hid = H5Gopen (group_hid, name);
-#endif
-  H5Gget_num_objs (subgroup_hid, &num_obj);
-  H5Gclose (subgroup_hid);
-
-  while (current_item < static_cast<int> (num_obj)
-         && (retval2 = H5Giterate (group_hid, name, &current_item,
-                                   hdf5_read_next_data, &dsub)) > 0)
-    {
-      octave_value t2 = dsub.tc;
-
-      Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
-
-      if (error_state)
-        {
-          error ("load: internal error loading class elements");
-          return false;
-        }
-
-      m.assign (dsub.name, tcell);
-
-    }
-
-  if (retval2 >= 0)
-    {
-      map = m;
-
-      if (!reconstruct_parents ())
-        warning ("load: unable to reconstruct object inheritance");
-      else
-        {
-          if (load_path::find_method (c_name, "loadobj") != std::string ())
-            {
-              octave_value in = new octave_class (*this);
-              octave_value_list tmp = feval ("loadobj", in, 1);
-
-              if (! error_state)
-                {
-                  map = tmp(0).map_value ();
-                  retval = true;
-                }
-              else
-                retval = false;
-            }
-          else
-            retval = true;
-        }
-    }
-
- error_cleanup:
-  if (data_hid > 0)
-    H5Dclose (data_hid);
-
-  if (data_hid > 0)
-    H5Gclose (group_hid);
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_class::as_mxArray (void) const
-{
-  gripe_wrong_type_arg ("octave_class::as_mxArray ()", type_name ());
-
-  return 0;
-}
-
-bool
-octave_class::in_class_method (void)
-{
-  octave_function *fcn = octave_call_stack::current ();
-
-  return (fcn
-          && (fcn->is_class_method ()
-              || fcn->is_class_constructor ()
-              || fcn->is_anonymous_function_of_class ()
-              || fcn->is_private_function_of_class (class_name ()))
-          && find_parent_class (fcn->dispatch_class ()));
-}
-
-octave_class::exemplar_info::exemplar_info (const octave_value& obj)
-  : field_names (), parent_class_names ()
-{
-  if (obj.is_object ())
-    {
-      octave_map m = obj.map_value ();
-      field_names = m.keys ();
-
-      parent_class_names = obj.parent_class_name_list ();
-    }
-  else
-    error ("invalid call to exemplar_info constructor");
-}
-
-
-// A map from class names to lists of fields.
-std::map<std::string, octave_class::exemplar_info> octave_class::exemplar_map;
-
-bool
-octave_class::exemplar_info::compare (const octave_value& obj) const
-{
-  bool retval = true;
-
-  if (obj.is_object ())
-    {
-      if (nfields () == obj.nfields ())
-        {
-          octave_map obj_map = obj.map_value ();
-          string_vector obj_fnames = obj_map.keys ();
-          string_vector fnames = fields ();
-
-          for (octave_idx_type i = 0; i < nfields (); i++)
-            {
-              if (obj_fnames[i] != fnames[i])
-                {
-                  retval = false;
-                  error ("mismatch in field names");
-                  break;
-                }
-            }
-
-          if (nparents () == obj.nparents ())
-            {
-              std::list<std::string> obj_parents
-                = obj.parent_class_name_list ();
-              std::list<std::string> pnames = parents ();
-
-              std::list<std::string>::const_iterator p = obj_parents.begin ();
-              std::list<std::string>::const_iterator q = pnames.begin ();
-
-              while (p != obj_parents.end ())
-                {
-                  if (*p++ != *q++)
-                    {
-                      retval = false;
-                      error ("mismatch in parent classes");
-                      break;
-                    }
-                }
-            }
-          else
-            {
-              retval = false;
-              error ("mismatch in number of parent classes");
-            }
-        }
-      else
-        {
-          retval = false;
-          error ("mismatch in number of fields");
-        }
-    }
-  else
-    {
-      retval = false;
-      error ("invalid comparison of class exemplar to non-class object");
-    }
-
-  return retval;
-}
-
-DEFUN (class, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} class (@var{expr})\n\
-@deftypefnx {Built-in Function} {} class (@var{s}, @var{id})\n\
-@deftypefnx {Built-in Function} {} class (@var{s}, @var{id}, @var{p}, @dots{})\n\
-Return the class of the expression @var{expr} or create a class with\n\
-fields from structure @var{s} and name (string) @var{id}.  Additional\n\
-arguments name a list of parent classes from which the new class is\n\
-derived.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 0)
-    print_usage ();
-  else if (nargin == 1)
-    retval = args(0).class_name ();
-  else
-    {
-      octave_function *fcn = octave_call_stack::caller ();
-
-      std::string id = args(1).string_value ();
-
-      if (! error_state)
-        {
-          if (fcn)
-            {
-              if (fcn->is_class_constructor (id) || fcn->is_class_method (id))
-                {
-                  octave_map m = args(0).map_value ();
-
-                  if (! error_state)
-                    {
-                      if (nargin == 2)
-                        retval
-                          = octave_value (new octave_class
-                                          (m, id, std::list<std::string> ()));
-                      else
-                        {
-                          octave_value_list parents = args.slice (2, nargin-2);
-
-                          retval
-                            = octave_value (new octave_class (m, id, parents));
-                        }
-
-                      if (! error_state)
-                        {
-                          octave_class::exemplar_const_iterator it
-                            = octave_class::exemplar_map.find (id);
-
-                          if (it == octave_class::exemplar_map.end ())
-                            octave_class::exemplar_map[id]
-                              = octave_class::exemplar_info (retval);
-                          else if (! it->second.compare (retval))
-                            error ("class: object of class `%s' does not match previously constructed objects",
-                                   id.c_str ());
-                        }
-                    }
-                  else
-                    error ("class: expecting structure S as first argument");
-                }
-              else
-                error ("class: `%s' is invalid as a class name in this context",
-                       id.c_str ());
-            }
-          else
-            error ("class: invalid call from outside class constructor or method");
-        }
-      else
-        error ("class: ID (class name) must be a character string");
-    }
-
-  return retval;
-}
-
-DEFUN (__isa_parent__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} __isa_parent__ (@var{class}, @var{name})\n\
-Undocumented internal function.\n\
-@end deftypefn")
-{
-  octave_value retval = false;
-
-  if (args.length () == 2)
-    {
-      octave_value cls = args(0);
-      octave_value nm = args(1);
-
-      if (! error_state)
-        {
-          if (cls.find_parent_class (nm.string_value ()))
-            retval = true;
-        }
-      else
-        error ("__isa_parent__: expecting arguments to be character strings");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (__parent_classes__, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} __parent_classes__ (@var{x})\n\
-Undocumented internal function.\n\
-@end deftypefn")
-{
-  octave_value retval = Cell ();
-
-  if (args.length () == 1)
-    {
-      octave_value arg = args(0);
-
-      if (arg.is_object ())
-        retval = Cell (arg.parent_class_names ());
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (isobject, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} isobject (@var{x})\n\
-Return true if @var{x} is a class object.\n\
-@seealso{class, typeinfo, isa, ismethod}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    retval = args(0).is_object ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (ismethod, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} ismethod (@var{x}, @var{method})\n\
-Return true if @var{x} is a class object and the string @var{method}\n\
-is a method of this class.\n\
-@seealso{isobject}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 2)
-    {
-      octave_value arg = args(0);
-
-      std::string class_name;
-
-      if (arg.is_object ())
-        class_name = arg.class_name ();
-      else if (arg.is_string ())
-        class_name = arg.string_value ();
-      else
-        error ("ismethod: expecting object or class name as first argument");
-
-      if (! error_state)
-        {
-          std::string method = args(1).string_value ();
-
-          if (! error_state)
-            {
-              if (load_path::find_method (class_name, method) != std::string ())
-                retval = true;
-              else
-                retval = false;
-            }
-        }
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (methods, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} methods (@var{x})\n\
-@deftypefnx {Built-in Function} {} methods (\"classname\")\n\
-Return a cell array containing the names of the methods for the\n\
-object @var{x} or the named class.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    {
-      octave_value arg = args(0);
-
-      std::string class_name;
-
-      if (arg.is_object ())
-        class_name = arg.class_name ();
-      else if (arg.is_string ())
-        class_name = arg.string_value ();
-      else
-        error ("methods: expecting object or class name as argument");
-
-      if (! error_state)
-        {
-          string_vector sv = load_path::methods (class_name);
-
-          if (nargout == 0)
-            {
-              octave_stdout << "Methods for class " << class_name << ":\n\n";
-
-              sv.list_in_columns (octave_stdout);
-
-              octave_stdout << std::endl;
-            }
-          else
-            retval = Cell (sv);
-        }
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-static bool
-is_built_in_class (const std::string& cn)
-{
-  static std::set<std::string> built_in_class_names;
-
-  if (built_in_class_names.empty ())
-    {
-      built_in_class_names.insert ("double");
-      built_in_class_names.insert ("single");
-      built_in_class_names.insert ("cell");
-      built_in_class_names.insert ("struct");
-      built_in_class_names.insert ("logical");
-      built_in_class_names.insert ("char");
-      built_in_class_names.insert ("function handle");
-      built_in_class_names.insert ("int8");
-      built_in_class_names.insert ("uint8");
-      built_in_class_names.insert ("int16");
-      built_in_class_names.insert ("uint16");
-      built_in_class_names.insert ("int32");
-      built_in_class_names.insert ("uint32");
-      built_in_class_names.insert ("int64");
-      built_in_class_names.insert ("uint64");
-    }
-
-  return built_in_class_names.find (cn) != built_in_class_names.end ();
-}
-
-DEFUN (superiorto, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} superiorto (@var{class_name}, @dots{})\n\
-When called from a class constructor, mark the object currently\n\
-constructed as having a higher precedence than @var{class_name}.\n\
-More that one such class can be specified in a single call.\n\
-This function may only be called from a class constructor.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  octave_function *fcn = octave_call_stack::caller ();
-
-  if (fcn && fcn->is_class_constructor ())
-    {
-      for (int i = 0; i < args.length (); i++)
-        {
-          std::string class_name = args(i).string_value ();
-
-          if (! error_state)
-            {
-              if (! is_built_in_class (class_name))
-                {
-                  std::string this_class_name = fcn->name ();
-
-                  if (! symbol_table::set_class_relationship (this_class_name,
-                                                              class_name))
-                    {
-                      error ("superiorto: precedence already set for %s and %s",
-                             this_class_name.c_str (), class_name.c_str ());
-                      break;
-                    }
-                }
-              else
-                {
-                  // User defined classes always have higher precedence
-                  // than built-in classes.
-                }
-            }
-          else
-            {
-              error ("superiorto: expecting argument to be class name");
-              break;
-            }
-        }
-    }
-  else
-    error ("superiorto: invalid call from outside class constructor");
-
-  return retval;
-}
-
-DEFUN (inferiorto, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} inferiorto (@var{class_name}, @dots{})\n\
-When called from a class constructor, mark the object currently\n\
-constructed as having a lower precedence than @var{class_name}.\n\
-More that one such class can be specified in a single call.\n\
-This function may only be called from a class constructor.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  octave_function *fcn = octave_call_stack::caller ();
-
-  if (fcn && fcn->is_class_constructor ())
-    {
-      for (int i = 0; i < args.length (); i++)
-        {
-          std::string class_name = args(i).string_value ();
-
-          if (! error_state)
-            {
-              if (! is_built_in_class (class_name))
-                {
-                  std::string this_class_name = fcn->name ();
-
-                  symbol_table::set_class_relationship (class_name,
-                                                        this_class_name);
-
-                  if (! symbol_table::set_class_relationship (this_class_name,
-                                                              class_name))
-                    {
-                      error ("inferiorto: precedence already set for %s and %s",
-                             this_class_name.c_str (), class_name.c_str ());
-                      break;
-                    }
-                }
-              else
-                {
-                  error ("inferiorto: cannot give user-defined class lower precedence than built-in class");
-                  break;
-                }
-            }
-          else
-            {
-              error ("inferiorto: expecting argument to be class name");
-              break;
-            }
-        }
-    }
-  else
-    error ("inferiorto: invalid call from outside class constructor");
-
-  return retval;
-}
--- a/src/ov-class.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-/*
-
-Copyright (C) 2007-2012 John W. Eaton
-Copyright (C) 2009 VZLU Prague
-
-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_class_h)
-#define octave_class_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-alloc.h"
-#include "oct-map.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Data structures.
-
-class
-octave_class : public octave_base_value
-{
-public:
-
-  octave_class (void)
-    : octave_base_value (), map (), c_name (),
-      parent_list (), obsolete_copies (0)
-    { }
-
-  octave_class (const octave_map& m, const std::string& id,
-                const std::list<std::string>& plist)
-    : octave_base_value (), map (m), c_name (id),
-      parent_list (plist), obsolete_copies (0)
-    { }
-
-  octave_class (const octave_map& m, const std::string& id,
-                const octave_value_list& parents);
-
-  octave_class (const octave_class& s)
-    : octave_base_value (s), map (s.map), c_name (s.c_name),
-      parent_list (s.parent_list), obsolete_copies (0)  { }
-
-  ~octave_class (void) { }
-
-  octave_base_value *clone (void) const { return new octave_class (*this); }
-
-  octave_base_value *unique_clone (void);
-
-  octave_base_value *empty_clone (void) const
-  {
-    return new octave_class (octave_map (map.keys ()), c_name, parent_list);
-  }
-
-  Cell dotref (const octave_value_list& idx);
-
-  Matrix size (void);
-
-  octave_idx_type numel (const octave_value_list&);
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    {
-      octave_value_list tmp = subsref (type, idx, 1);
-      return tmp.length () > 0 ? tmp(0) : octave_value ();
-    }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& idx)
-  {
-    return subsref ("(", std::list<octave_value_list> (1, idx), nargout);
-  }
-
-  static octave_value numeric_conv (const Cell& val,
-                                    const std::string& type);
-
-  void assign(const std::string& k, const octave_value& rhs)
-  { map.assign (k, rhs); };
-
-  octave_value subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs);
-
-  octave_value undef_subsasgn (const std::string& type,
-                               const std::list<octave_value_list>& idx,
-                               const octave_value& rhs);
-
-  idx_vector index_vector (void) const;
-
-  dim_vector dims (void) const { return map.dims (); }
-
-  size_t byte_size (void) const;
-
-  // This is the number of elements in each field.  The total number
-  // of elements is numel () * nfields ().
-  octave_idx_type numel (void) const
-  {
-    dim_vector dv = dims ();
-    return dv.numel ();
-  }
-
-  octave_idx_type nfields (void) const { return map.nfields (); }
-
-  size_t nparents (void) const { return parent_list.size (); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    {
-      octave_class retval = octave_class (*this);
-      retval.map = retval.map_value ().reshape (new_dims);
-      return octave_value (new octave_class (retval));
-    }
-
-  octave_value resize (const dim_vector& dv, bool = false) const
-    {
-      octave_class retval = octave_class (*this);
-      retval.map.resize (dv);
-      return octave_value (new octave_class (retval));
-    }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_map (void) const { return false; }
-
-  bool is_object (void) const { return true; }
-
-  octave_map map_value (void) const { return map; }
-
-  string_vector map_keys (void) const;
-
-  std::list<std::string> parent_class_name_list (void) const
-    { return parent_list; }
-
-  string_vector parent_class_names (void) const
-    { return string_vector (parent_list); }
-
-  octave_base_value *find_parent_class (const std::string&);
-
-  octave_base_value *unique_parent_class (const std::string&);
-
-  string_vector all_strings (bool pad) const;
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool print_name_tag (std::ostream& os, const std::string& name) const;
-
-  void print_with_name (std::ostream& os, const std::string& name,
-                        bool print_padding = true);
-
-  bool reconstruct_exemplar (void);
-
-  static void clear_exemplar_map (void);
-
-  bool reconstruct_parents (void);
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  mxArray *as_mxArray (void) const;
-
-private:
-
-  octave_map map;
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-public:
-  int type_id (void) const { return t_id; }
-  std::string type_name (void) const { return t_name; }
-  std::string class_name (void) const { return c_name; }
-
-  static int static_type_id (void) { return t_id; }
-  static std::string static_type_name (void) { return t_name; }
-  static std::string static_class_name (void) { return "<unknown>"; }
-  static void register_type (void);
-
-private:
-  static int t_id;
-
-  static const std::string t_name;
-  std::string c_name;
-  std::list<std::string> parent_list;
-
-  bool in_class_method (void);
-  std::string get_current_method_class (void);
-
-  octave_value subsasgn_common (const octave_value& obj,
-                                const std::string& type,
-                                const std::list<octave_value_list>& idx,
-                                const octave_value& rhs);
-
-  int obsolete_copies;
-
-public:
-  // The list of field names and parent classes defines a class.  We
-  // keep track of each class that has been created so that we know
-  class exemplar_info
-  {
-  public:
-
-    exemplar_info (void) : field_names (), parent_class_names () { }
-
-    exemplar_info (const octave_value& obj);
-
-    exemplar_info (const exemplar_info& x)
-      : field_names (x.field_names),
-        parent_class_names (x.parent_class_names) { }
-
-    exemplar_info& operator = (const exemplar_info& x)
-    {
-      if (&x != this)
-        {
-          field_names = x.field_names;
-          parent_class_names = x.parent_class_names;
-        }
-      return *this;
-    }
-
-    octave_idx_type nfields (void) const { return field_names.length (); }
-
-    size_t nparents (void) const { return parent_class_names.size (); }
-
-    string_vector fields (void) const { return field_names; }
-
-    std::list<std::string> parents (void) const { return parent_class_names; }
-
-    bool compare (const octave_value& obj) const;
-
-  private:
-
-    string_vector field_names;
-    std::list<std::string> parent_class_names;
-  };
-
-  // A map from class names to lists of fields.
-  static std::map<std::string, exemplar_info> exemplar_map;
-
-  typedef std::map<std::string, exemplar_info>::iterator exemplar_iterator;
-  typedef std::map<std::string, exemplar_info>::const_iterator exemplar_const_iterator;
-};
-
-#endif
--- a/src/ov-colon.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "error.h"
-#include "pr-output.h"
-#include "oct-obj.h"
-#include "ov-colon.h"
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_magic_colon,
-                                     "magic-colon", "magic-colon");
-
-void
-octave_magic_colon::print (std::ostream& os, bool) const
-{
-  indent (os);
-  print_raw (os);
-}
-
-void
-octave_magic_colon::print_raw (std::ostream& os, bool) const
-{
-  os << ":";
-}
--- a/src/ov-colon.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_magic_colon_h)
-#define octave_magic_colon_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// A type to represent `:' as used for indexing.
-
-class
-octave_magic_colon : public octave_base_value
-{
-public:
-
-  octave_magic_colon (void)
-    : octave_base_value () { }
-
-  octave_magic_colon (const octave_magic_colon&)
-    : octave_base_value () { }
-
-  ~octave_magic_colon (void) { }
-
-  octave_base_value *clone (void) const { return new octave_magic_colon (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_magic_colon (); }
-
-  idx_vector index_vector (void) const { return idx_vector (':'); }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_magic_colon (void) const { return true; }
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-private:
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-complex.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,463 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-
-#include "oct-obj.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-base.h"
-#include "ov-base-scalar.h"
-#include "ov-base-scalar.cc"
-#include "ov-cx-mat.h"
-#include "ov-scalar.h"
-#include "gripes.h"
-#include "pr-output.h"
-#include "ops.h"
-
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-
-template class octave_base_scalar<Complex>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_complex);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex,
-                                     "complex scalar", "double");
-
-static octave_base_value *
-default_numeric_demotion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_complex&);
-
-  return new octave_float_complex (v.float_complex_value ());
-}
-
-octave_base_value::type_conv_info
-octave_complex::numeric_demotion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_demotion_function,
-                                            octave_float_complex::static_type_id ());
-}
-
-octave_base_value *
-octave_complex::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  double im = std::imag (scalar);
-
-  if (im == 0.0)
-    retval = new octave_scalar (std::real (scalar));
-
-  return retval;
-}
-
-octave_value
-octave_complex::do_index_op (const octave_value_list& idx, bool resize_ok)
-{
-  // FIXME -- this doesn't solve the problem of
-  //
-  //   a = i; a([1,1], [1,1], [1,1])
-  //
-  // and similar constructions.  Hmm...
-
-  // FIXME -- using this constructor avoids narrowing the
-  // 1x1 matrix back to a scalar value.  Need a better solution
-  // to this problem.
-
-  octave_value tmp (new octave_complex_matrix (complex_matrix_value ()));
-
-  return tmp.do_index_op (idx, resize_ok);
-}
-
-double
-octave_complex::double_value (bool force_conversion) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real scalar");
-
-  retval = std::real (scalar);
-
-  return retval;
-}
-
-float
-octave_complex::float_value (bool force_conversion) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real scalar");
-
-  retval = std::real (scalar);
-
-  return retval;
-}
-
-Matrix
-octave_complex::matrix_value (bool force_conversion) const
-{
-  Matrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real matrix");
-
-  retval = Matrix (1, 1, std::real (scalar));
-
-  return retval;
-}
-
-FloatMatrix
-octave_complex::float_matrix_value (bool force_conversion) const
-{
-  FloatMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real matrix");
-
-  retval = FloatMatrix (1, 1, std::real (scalar));
-
-  return retval;
-}
-
-NDArray
-octave_complex::array_value (bool force_conversion) const
-{
-  NDArray retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real matrix");
-
-  retval = NDArray (dim_vector (1, 1), std::real (scalar));
-
-  return retval;
-}
-
-FloatNDArray
-octave_complex::float_array_value (bool force_conversion) const
-{
-  FloatNDArray retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real matrix");
-
-  retval = FloatNDArray (dim_vector (1, 1), std::real (scalar));
-
-  return retval;
-}
-
-Complex
-octave_complex::complex_value (bool) const
-{
-  return scalar;
-}
-
-FloatComplex
-octave_complex::float_complex_value (bool) const
-{
-  return static_cast<FloatComplex> (scalar);
-}
-
-ComplexMatrix
-octave_complex::complex_matrix_value (bool) const
-{
-  return ComplexMatrix (1, 1, scalar);
-}
-
-FloatComplexMatrix
-octave_complex::float_complex_matrix_value (bool) const
-{
-  return FloatComplexMatrix (1, 1, static_cast<FloatComplex> (scalar));
-}
-
-ComplexNDArray
-octave_complex::complex_array_value (bool /* force_conversion */) const
-{
-  return ComplexNDArray (dim_vector (1, 1), scalar);
-}
-
-FloatComplexNDArray
-octave_complex::float_complex_array_value (bool /* force_conversion */) const
-{
-  return FloatComplexNDArray (dim_vector (1, 1), static_cast<FloatComplex> (scalar));
-}
-
-octave_value
-octave_complex::resize (const dim_vector& dv, bool fill) const
-{
-  if (fill)
-    {
-      ComplexNDArray retval (dv, Complex (0));
-
-      if (dv.numel ())
-        retval(0) = scalar;
-
-      return retval;
-    }
-  else
-    {
-      ComplexNDArray retval (dv);
-
-      if (dv.numel ())
-        retval(0) = scalar;
-
-      return retval;
-    }
-}
-
-octave_value
-octave_complex::diag (octave_idx_type m, octave_idx_type n) const
-{
-  return ComplexDiagMatrix (Array<Complex> (dim_vector (1, 1), scalar), m, n);
-}
-
-bool
-octave_complex::save_ascii (std::ostream& os)
-{
-  Complex c = complex_value ();
-
-  octave_write_complex (os, c);
-
-  os << "\n";
-
-  return true;
-}
-
-bool
-octave_complex::load_ascii (std::istream& is)
-{
-  scalar = octave_read_value<Complex> (is);
-
-  if (!is)
-    {
-      error ("load: failed to load complex scalar constant");
-      return false;
-    }
-
-  return true;
-}
-
-
-bool
-octave_complex::save_binary (std::ostream& os, bool& /* save_as_floats */)
-{
-  char tmp = static_cast<char> (LS_DOUBLE);
-  os.write (reinterpret_cast<char *> (&tmp), 1);
-  Complex ctmp = complex_value ();
-  os.write (reinterpret_cast<char *> (&ctmp), 16);
-
-  return true;
-}
-
-bool
-octave_complex::load_binary (std::istream& is, bool swap,
-                             oct_mach_info::float_format fmt)
-{
-  char tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-    return false;
-
-  Complex ctmp;
-  read_doubles (is, reinterpret_cast<double *> (&ctmp),
-                static_cast<save_type> (tmp), 2, swap, fmt);
-  if (error_state || ! is)
-    return false;
-
-  scalar = ctmp;
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_complex::save_hdf5 (hid_t loc_id, const char *name,
-                           bool /* save_as_floats */)
-{
-  hsize_t dimens[3];
-  hid_t space_hid = -1, type_hid = -1, data_hid = -1;
-  bool retval = true;
-
-  space_hid = H5Screate_simple (0, dimens, 0);
-  if (space_hid < 0)
-    return false;
-
-  type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
-  if (type_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      return false;
-    }
-
-  Complex tmp = complex_value ();
-  retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                     &tmp) >= 0;
-
-  H5Dclose (data_hid);
-  H5Tclose (type_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_complex::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t type_hid = H5Dget_type (data_hid);
-
-  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
-
-  if (! hdf5_types_compatible (type_hid, complex_type))
-    {
-      H5Tclose (complex_type);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  hid_t space_id = H5Dget_space (data_hid);
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank != 0)
-    {
-      H5Tclose (complex_type);
-      H5Sclose (space_id);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  // complex scalar:
-  Complex ctmp;
-  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-               &ctmp) >= 0)
-    {
-      retval = true;
-      scalar = ctmp;
-    }
-
-  H5Tclose (complex_type);
-  H5Sclose (space_id);
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_complex::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxDOUBLE_CLASS, 1, 1, mxCOMPLEX);
-
-  double *pr = static_cast<double *> (retval->get_data ());
-  double *pi = static_cast<double *> (retval->get_imag_data ());
-
-  pr[0] = std::real (scalar);
-  pi[0] = std::imag (scalar);
-
-  return retval;
-}
-
-octave_value
-octave_complex::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-#define SCALAR_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (FCN (scalar))
-
-      SCALAR_MAPPER (abs, std::abs);
-      SCALAR_MAPPER (acos, ::acos);
-      SCALAR_MAPPER (acosh, ::acosh);
-      SCALAR_MAPPER (angle, std::arg);
-      SCALAR_MAPPER (arg, std::arg);
-      SCALAR_MAPPER (asin, ::asin);
-      SCALAR_MAPPER (asinh, ::asinh);
-      SCALAR_MAPPER (atan, ::atan);
-      SCALAR_MAPPER (atanh, ::atanh);
-      SCALAR_MAPPER (ceil, ::ceil);
-      SCALAR_MAPPER (conj, std::conj);
-      SCALAR_MAPPER (cos, std::cos);
-      SCALAR_MAPPER (cosh, std::cosh);
-      SCALAR_MAPPER (exp, std::exp);
-      SCALAR_MAPPER (expm1, ::expm1);
-      SCALAR_MAPPER (fix, ::fix);
-      SCALAR_MAPPER (floor, ::floor);
-      SCALAR_MAPPER (imag, std::imag);
-      SCALAR_MAPPER (log, std::log);
-      SCALAR_MAPPER (log2, xlog2);
-      SCALAR_MAPPER (log10, std::log10);
-      SCALAR_MAPPER (log1p, ::log1p);
-      SCALAR_MAPPER (real, std::real);
-      SCALAR_MAPPER (round, xround);
-      SCALAR_MAPPER (roundb, xroundb);
-      SCALAR_MAPPER (signum, ::signum);
-      SCALAR_MAPPER (sin, std::sin);
-      SCALAR_MAPPER (sinh, std::sinh);
-      SCALAR_MAPPER (sqrt, std::sqrt);
-      SCALAR_MAPPER (tan, std::tan);
-      SCALAR_MAPPER (tanh, std::tanh);
-      SCALAR_MAPPER (finite, xfinite);
-      SCALAR_MAPPER (isinf, xisinf);
-      SCALAR_MAPPER (isna, octave_is_NA);
-      SCALAR_MAPPER (isnan, xisnan);
-
-    default:
-      return octave_base_value::map (umap);
-    }
-}
--- a/src/ov-complex.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_complex_h)
-#define octave_complex_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "lo-ieee.h"
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "gripes.h"
-#include "error.h"
-#include "ov-base.h"
-#include "ov-cx-mat.h"
-#include "ov-base-scalar.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Complex scalar values.
-
-class
-OCTINTERP_API
-octave_complex : public octave_base_scalar<Complex>
-{
-public:
-
-  octave_complex (void)
-    : octave_base_scalar<Complex> () { }
-
-  octave_complex (const Complex& c)
-    : octave_base_scalar<Complex> (c) { }
-
-  octave_complex (const octave_complex& c)
-    : octave_base_scalar<Complex> (c) { }
-
-  ~octave_complex (void) { }
-
-  octave_base_value *clone (void) const { return new octave_complex (*this); }
-
-  // We return an octave_complex_matrix object here instead of an
-  // octave_complex object so that in expressions like A(2,2,2) = 2
-  // (for A previously undefined), A will be empty instead of a 1x1
-  // object.
-  octave_base_value *empty_clone (void) const
-    { return new octave_complex_matrix (); }
-
-  type_conv_info numeric_demotion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  // Use this to give a more specific error message
-  idx_vector index_vector (void) const
-  {
-    error (
-           "attempted to use a complex scalar as an index\n"
-           "       (forgot to initialize i or j?)");
-    return idx_vector ();
-  }
-
-  octave_value any (int = 0) const
-    {
-      return (scalar != Complex (0, 0)
-              && ! (lo_ieee_isnan (std::real (scalar))
-                    || lo_ieee_isnan (std::imag (scalar))));
-    }
-
-  builtin_type_t builtin_type (void) const { return btyp_complex; }
-
-  bool is_complex_scalar (void) const { return true; }
-
-  bool is_complex_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  float float_scalar_value (bool frc_str_conv = false) const
-    { return float_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  FloatMatrix float_matrix_value (bool = false) const;
-
-  NDArray array_value (bool = false) const;
-
-  FloatNDArray float_array_value (bool = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const
-    { return SparseMatrix (matrix_value ()); }
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-    { return SparseComplexMatrix (complex_matrix_value ()); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  bool bool_value (bool warn = false) const
-  {
-    if (xisnan (scalar))
-      gripe_nan_to_logical_conversion ();
-    else if (warn && scalar != 0.0 && scalar != 1.0)
-      gripe_logical_conversion ();
-
-    return scalar != 0.0;
-  }
-
-  boolNDArray bool_array_value (bool warn = false) const
-  {
-    if (xisnan (scalar))
-      gripe_nan_to_logical_conversion ();
-    else if (warn && scalar != 0.0 && scalar != 1.0)
-      gripe_logical_conversion ();
-
-    return boolNDArray (dim_vector (1, 1), scalar != 0.0);
-  }
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  void increment (void) { scalar += 1.0; }
-
-  void decrement (void) { scalar -= 1.0; }
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      // Yes, for compatibility, we drop the imaginary part here.
-      return os.write (array_value (true), block_size, output_type,
-                       skip, flt_fmt);
-    }
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-typedef octave_complex octave_complex_scalar;
-
-#endif
--- a/src/ov-cs-list.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-
-Copyright (C) 2002-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <sstream>
-
-#include "lo-utils.h"
-
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "ov-cs-list.h"
-#include "unwind-prot.h"
-
-DEFINE_OCTAVE_ALLOCATOR (octave_cs_list);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cs_list, "cs-list", "cs-list");
-
-octave_cs_list::octave_cs_list (const Cell& c)
-  : octave_base_value (), lst (c)
-{
-}
-
-octave_value
-octave_cs_list::subsref (const std::string&,
-                         const std::list<octave_value_list>&)
-{
-  gripe_indexed_cs_list ();
-  return octave_value ();
-}
-
-octave_value_list
-octave_cs_list::subsref (const std::string&,
-                         const std::list<octave_value_list>&, int)
-{
-  gripe_indexed_cs_list ();
-  return octave_value_list ();
-}
-
--- a/src/ov-cs-list.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
-
-Copyright (C) 2002-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_cs_list_h)
-#define octave_cs_list_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "str-vec.h"
-
-#include "Cell.h"
-#include "error.h"
-#include "oct-alloc.h"
-#include "oct-obj.h"
-#include "ov-typeinfo.h"
-
-class tree_walker;
-
-// Lists.
-
-class
-octave_cs_list : public octave_base_value
-{
-public:
-
-  octave_cs_list (void)
-    : octave_base_value (), lst () { }
-
-  octave_cs_list (const octave_value_list& l)
-    : octave_base_value (), lst (l) { }
-
-  octave_cs_list (const Cell& c);
-
-  octave_cs_list (const octave_cs_list& l)
-    : octave_base_value (), lst (l.lst) { }
-
-  ~octave_cs_list (void) { }
-
-  octave_base_value *clone (void) const { return new octave_cs_list (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_cs_list (); }
-
-  dim_vector dims (void) const { return dim_vector (1, lst.length ()); }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_cs_list (void) const { return true; }
-
-  octave_value_list list_value (void) const { return lst; }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int);
-
-private:
-
-  // The list of Octave values.
-  octave_value_list lst;
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-cx-diag.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "byte-swap.h"
-
-#include "ov-cx-diag.h"
-#include "ov-flt-cx-diag.h"
-#include "ov-re-diag.h"
-#include "ov-base-diag.cc"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ls-utils.h"
-
-template class octave_base_diag<ComplexDiagMatrix, ComplexMatrix>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_complex_diag_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_diag_matrix,
-                                     "complex diagonal matrix", "double");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_complex_diag_matrix&);
-
-  return new octave_complex_matrix (v.complex_matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_complex_diag_matrix::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_complex_matrix::static_type_id ());
-}
-
-static octave_base_value *
-default_numeric_demotion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_complex_diag_matrix&);
-
-  return new octave_float_complex_diag_matrix (v.float_complex_diag_matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_complex_diag_matrix::numeric_demotion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_demotion_function,
-                                            octave_float_complex_diag_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_complex_diag_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.nelem () == 1)
-    {
-      retval = new octave_complex (matrix (0, 0));
-      octave_base_value *rv2 = retval->try_narrowing_conversion ();
-      if (rv2)
-        {
-          delete retval;
-          retval = rv2;
-        }
-    }
-  else if (matrix.all_elements_are_real ())
-    {
-      return new octave_diag_matrix (::real (matrix));
-    }
-
-  return retval;
-}
-
-DiagMatrix
-octave_complex_diag_matrix::diag_matrix_value (bool force_conversion) const
-{
-  DiagMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               type_name (), "real matrix");
-
-  retval = ::real (matrix);
-
-  return retval;
-}
-
-FloatDiagMatrix
-octave_complex_diag_matrix::float_diag_matrix_value (bool force_conversion) const
-{
-  DiagMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               type_name (), "real matrix");
-
-  retval = ::real (matrix);
-
-  return retval;
-}
-
-ComplexDiagMatrix
-octave_complex_diag_matrix::complex_diag_matrix_value (bool) const
-{
-  return matrix;
-}
-
-FloatComplexDiagMatrix
-octave_complex_diag_matrix::float_complex_diag_matrix_value (bool) const
-{
-  return FloatComplexDiagMatrix (matrix);
-}
-
-octave_value
-octave_complex_diag_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_abs:
-      return matrix.abs ();
-    case umap_real:
-      return ::real (matrix);
-    case umap_conj:
-      return ::conj (matrix);
-    case umap_imag:
-      return ::imag (matrix);
-    case umap_sqrt:
-      {
-        ComplexColumnVector tmp = matrix.diag ().map<Complex> (std::sqrt);
-        ComplexDiagMatrix retval (tmp);
-        retval.resize (matrix.rows (), matrix.columns ());
-        return retval;
-      }
-    default:
-      return to_dense ().map (umap);
-    }
-}
-
-bool
-octave_complex_diag_matrix::save_binary (std::ostream& os, bool& save_as_floats)
-{
-
-  int32_t r = matrix.rows (), c = matrix.cols ();
-  os.write (reinterpret_cast<char *> (&r), 4);
-  os.write (reinterpret_cast<char *> (&c), 4);
-
-  ComplexMatrix m = ComplexMatrix (matrix.diag ());
-  save_type st = LS_DOUBLE;
-  if (save_as_floats)
-    {
-      if (m.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        st = LS_FLOAT;
-    }
-  else if (matrix.length () > 4096) // FIXME -- make this configurable.
-    {
-      double max_val, min_val;
-      if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  const Complex *mtmp = m.data ();
-  write_doubles (os, reinterpret_cast<const double *> (mtmp), st, 2 * m.numel ());
-
-  return true;
-}
-
-bool
-octave_complex_diag_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format fmt)
-{
-  int32_t r, c;
-  char tmp;
-  if (! (is.read (reinterpret_cast<char *> (&r), 4)
-         && is.read (reinterpret_cast<char *> (&c), 4)
-         && is.read (reinterpret_cast<char *> (&tmp), 1)))
-    return false;
-  if (swap)
-    {
-      swap_bytes<4> (&r);
-      swap_bytes<4> (&c);
-    }
-
-  ComplexDiagMatrix m (r, c);
-  Complex *im = m.fortran_vec ();
-  octave_idx_type len = m.length ();
-  read_doubles (is, reinterpret_cast<double *> (im),
-                static_cast<save_type> (tmp), 2 * len, swap, fmt);
-  if (error_state || ! is)
-    return false;
-  matrix = m;
-
-  return true;
-}
-
-bool
-octave_complex_diag_matrix::chk_valid_scalar (const octave_value& val,
-                                              Complex& x) const
-{
-  bool retval = val.is_complex_scalar () || val.is_real_scalar ();
-  if (retval)
-    x = val.complex_value ();
-  return retval;
-}
-
-/*
-
-%% bug #36368
-%!assert (diag ([1+i, 1-i])^2 , diag ([2i, -2i]), 4*eps);
-
-*/
--- a/src/ov-cx-diag.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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_complex_diag_matrix_h)
-#define octave_complex_diag_matrix_h 1
-
-#include "ov-base.h"
-#include "ov-base-diag.h"
-#include "ov-cx-mat.h"
-#include "ov-typeinfo.h"
-
-// Real diagonal matrix values.
-
-class
-OCTINTERP_API
-octave_complex_diag_matrix
-  : public octave_base_diag<ComplexDiagMatrix, ComplexMatrix>
-{
-public:
-
-  octave_complex_diag_matrix (void)
-    : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> () { }
-
-  octave_complex_diag_matrix (const ComplexDiagMatrix& m)
-    : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> (m) { }
-
-  octave_complex_diag_matrix (const octave_complex_diag_matrix& m)
-    : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> (m) { }
-
-  ~octave_complex_diag_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_complex_diag_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_complex_diag_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  type_conv_info numeric_demotion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  builtin_type_t builtin_type (void) const { return btyp_complex; }
-
-  bool is_complex_matrix (void) const { return true; }
-
-  bool is_complex_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  DiagMatrix diag_matrix_value (bool = false) const;
-
-  FloatDiagMatrix float_diag_matrix_value (bool = false) const;
-
-  ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
-
-  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  bool chk_valid_scalar (const octave_value&,
-                         Complex&) const;
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-cx-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,803 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <vector>
-
-#include "data-conv.h"
-#include "lo-ieee.h"
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-#include "mx-base.h"
-#include "mach-info.h"
-#include "oct-locbuf.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-mat.cc"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-#include "pr-output.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-#include "ls-utils.h"
-
-template class octave_base_matrix<ComplexNDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_complex_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_matrix,
-                                     "complex matrix", "double");
-
-static octave_base_value *
-default_numeric_demotion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_complex_matrix&);
-
-  return new octave_float_complex_matrix (v.float_complex_matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_complex_matrix::numeric_demotion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_demotion_function,
-                                            octave_float_complex_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_complex_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.numel () == 1)
-    {
-      Complex c = matrix (0);
-
-      if (std::imag (c) == 0.0)
-        retval = new octave_scalar (std::real (c));
-      else
-        retval = new octave_complex (c);
-    }
-  else if (matrix.all_elements_are_real ())
-    retval = new octave_matrix (::real (matrix));
-
-  return retval;
-}
-
-double
-octave_complex_matrix::double_value (bool force_conversion) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real scalar");
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "complex matrix", "real scalar");
-
-      retval = std::real (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("complex matrix", "real scalar");
-
-  return retval;
-}
-
-float
-octave_complex_matrix::float_value (bool force_conversion) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real scalar");
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "complex matrix", "real scalar");
-
-      retval = std::real (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("complex matrix", "real scalar");
-
-  return retval;
-}
-
-Matrix
-octave_complex_matrix::matrix_value (bool force_conversion) const
-{
-  Matrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real matrix");
-
-  retval = ::real (matrix.matrix_value ());
-
-  return retval;
-}
-
-FloatMatrix
-octave_complex_matrix::float_matrix_value (bool force_conversion) const
-{
-  FloatMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real matrix");
-
-  retval = ::real (matrix.matrix_value ());
-
-  return retval;
-}
-
-Complex
-octave_complex_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "complex matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("complex matrix", "complex scalar");
-
-  return retval;
-}
-
-FloatComplex
-octave_complex_matrix::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "complex matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("complex matrix", "complex scalar");
-
-  return retval;
-}
-
-ComplexMatrix
-octave_complex_matrix::complex_matrix_value (bool) const
-{
-  return matrix.matrix_value ();
-}
-
-FloatComplexMatrix
-octave_complex_matrix::float_complex_matrix_value (bool) const
-{
-  return FloatComplexMatrix (matrix.matrix_value ());
-}
-
-boolNDArray
-octave_complex_matrix::bool_array_value (bool warn) const
-{
-  if (matrix.any_element_is_nan ())
-    gripe_nan_to_logical_conversion ();
-  else if (warn && (! matrix.all_elements_are_real ()
-                    || real (matrix).any_element_not_one_or_zero ()))
-    gripe_logical_conversion ();
-
-  return mx_el_ne (matrix, Complex (0.0));
-}
-
-charNDArray
-octave_complex_matrix::char_array_value (bool frc_str_conv) const
-{
-  charNDArray retval;
-
-  if (! frc_str_conv)
-    gripe_implicit_conversion ("Octave:num-to-str",
-                               "complex matrix", "string");
-  else
-    {
-      retval = charNDArray (dims ());
-      octave_idx_type nel = numel ();
-
-      for (octave_idx_type i = 0; i < nel; i++)
-        retval.elem (i) = static_cast<char>(std::real (matrix.elem (i)));
-    }
-
-  return retval;
-}
-
-FloatComplexNDArray
-octave_complex_matrix::float_complex_array_value (bool) const
-{
-  return FloatComplexNDArray (matrix);
-}
-
-SparseMatrix
-octave_complex_matrix::sparse_matrix_value (bool force_conversion) const
-{
-  SparseMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real matrix");
-
-  retval = SparseMatrix (::real (matrix.matrix_value ()));
-
-  return retval;
-}
-
-SparseComplexMatrix
-octave_complex_matrix::sparse_complex_matrix_value (bool) const
-{
-  return SparseComplexMatrix (matrix.matrix_value ());
-}
-
-octave_value
-octave_complex_matrix::diag (octave_idx_type k) const
-{
-  octave_value retval;
-  if (k == 0 && matrix.ndims () == 2
-      && (matrix.rows () == 1 || matrix.columns () == 1))
-    retval = ComplexDiagMatrix (DiagArray2<Complex> (matrix));
-  else
-    retval = octave_base_matrix<ComplexNDArray>::diag (k);
-
-  return retval;
-}
-
-octave_value
-octave_complex_matrix::diag (octave_idx_type m, octave_idx_type n) const
-{
-  octave_value retval;
-
-  if (matrix.ndims () == 2
-      && (matrix.rows () == 1 || matrix.columns () == 1))
-    {
-      ComplexMatrix mat = matrix.matrix_value ();
-
-      retval = mat.diag (m, n);
-    }
-  else
-    error ("diag: expecting vector argument");
-
-  return retval;
-}
-
-bool
-octave_complex_matrix::save_ascii (std::ostream& os)
-{
-  dim_vector d = dims ();
-  if (d.length () > 2)
-    {
-      ComplexNDArray tmp = complex_array_value ();
-
-      os << "# ndims: " << d.length () << "\n";
-
-      for (int i = 0; i < d.length (); i++)
-        os << " " << d (i);
-
-      os << "\n" << tmp;
-    }
-  else
-    {
-      // Keep this case, rather than use generic code above for backward
-      // compatiability. Makes load_ascii much more complex!!
-      os << "# rows: " << rows () << "\n"
-         << "# columns: " << columns () << "\n";
-
-      os << complex_matrix_value ();
-    }
-
-  return true;
-}
-
-bool
-octave_complex_matrix::load_ascii (std::istream& is)
-{
-  bool success = true;
-
-  string_vector keywords(2);
-
-  keywords[0] = "ndims";
-  keywords[1] = "rows";
-
-  std::string kw;
-  octave_idx_type val = 0;
-
-  if (extract_keyword (is, keywords, kw, val, true))
-    {
-      if (kw == "ndims")
-        {
-          int mdims = static_cast<int> (val);
-
-          if (mdims >= 0)
-            {
-              dim_vector dv;
-              dv.resize (mdims);
-
-              for (int i = 0; i < mdims; i++)
-                is >> dv(i);
-
-              if (is)
-                {
-                  ComplexNDArray tmp(dv);
-
-                  is >> tmp;
-
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else
-                {
-                  error ("load: failed to read dimensions");
-                  success = false;
-                }
-            }
-          else
-            {
-              error ("load: failed to extract number of dimensions");
-              success = false;
-            }
-        }
-      else if (kw == "rows")
-        {
-          octave_idx_type nr = val;
-          octave_idx_type nc = 0;
-
-          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
-            {
-              if (nr > 0 && nc > 0)
-                {
-                  ComplexMatrix tmp (nr, nc);
-                  is >> tmp;
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else if (nr == 0 || nc == 0)
-                matrix = ComplexMatrix (nr, nc);
-              else
-                panic_impossible ();
-            }
-          else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
-        }
-      else
-        panic_impossible ();
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_complex_matrix::save_binary (std::ostream& os, bool& save_as_floats)
-{
-  dim_vector d = dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims to differentiate with old format!!
-  int32_t tmp = - d.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i = 0; i < d.length (); i++)
-    {
-      tmp = d(i);
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-    }
-
-  ComplexNDArray m = complex_array_value ();
-  save_type st = LS_DOUBLE;
-  if (save_as_floats)
-    {
-      if (m.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        st = LS_FLOAT;
-    }
-  else if (d.numel () > 4096) // FIXME -- make this configurable.
-    {
-      double max_val, min_val;
-      if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-
-  const Complex *mtmp = m.data ();
-  write_doubles (os, reinterpret_cast<const double *> (mtmp), st, 2 * d.numel ());
-
-  return true;
-}
-
-bool
-octave_complex_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format fmt)
-{
-  char tmp;
-  int32_t mdims;
-  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&mdims);
-  if (mdims < 0)
-    {
-      mdims = - mdims;
-      int32_t di;
-      dim_vector dv;
-      dv.resize (mdims);
-
-      for (int i = 0; i < mdims; i++)
-        {
-          if (! is.read (reinterpret_cast<char *> (&di), 4))
-            return false;
-          if (swap)
-            swap_bytes<4> (&di);
-          dv(i) = di;
-        }
-
-      // Convert an array with a single dimension to be a row vector.
-      // Octave should never write files like this, other software
-      // might.
-
-      if (mdims == 1)
-        {
-          mdims = 2;
-          dv.resize (mdims);
-          dv(1) = dv(0);
-          dv(0) = 1;
-        }
-
-      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-        return false;
-
-      ComplexNDArray m(dv);
-      Complex *im = m.fortran_vec ();
-      read_doubles (is, reinterpret_cast<double *> (im),
-                    static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  else
-    {
-      int32_t nr, nc;
-      nr = mdims;
-      if (! is.read (reinterpret_cast<char *> (&nc), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&nc);
-      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-        return false;
-      ComplexMatrix m (nr, nc);
-      Complex *im = m.fortran_vec ();
-      octave_idx_type len = nr * nc;
-      read_doubles (is, reinterpret_cast<double *> (im),
-                    static_cast<save_type> (tmp), 2*len, swap, fmt);
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_complex_matrix::save_hdf5 (hid_t loc_id, const char *name,
-                                  bool save_as_floats)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  int rank = dv.length ();
-  hid_t space_hid = -1, data_hid = -1, type_hid = -1;
-  bool retval = true;
-  ComplexNDArray m = complex_array_value ();
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
-
-  space_hid = H5Screate_simple (rank, hdims, 0);
-  if (space_hid < 0) return false;
-
-  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
-
-  if (save_as_floats)
-    {
-      if (m.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        save_type_hid = H5T_NATIVE_FLOAT;
-    }
-#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
-  // hdf5 currently doesn't support float/integer conversions
-  else
-    {
-      double max_val, min_val;
-
-      if (m.all_integers (max_val, min_val))
-        save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
-    }
-#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
-
-  type_hid = hdf5_make_complex_type (save_type_hid);
-  if (type_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      return false;
-    }
-
-  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
-  if (complex_type_hid < 0) retval = false;
-
-  if (retval)
-    {
-      Complex *mtmp = m.fortran_vec ();
-      if (H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                    mtmp) < 0)
-        {
-          H5Tclose (complex_type_hid);
-          retval = false;
-        }
-    }
-
-  H5Tclose (complex_type_hid);
-  H5Dclose (data_hid);
-  H5Tclose (type_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_complex_matrix::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-      return (empty > 0);
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t type_hid = H5Dget_type (data_hid);
-
-  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
-
-  if (! hdf5_types_compatible (type_hid, complex_type))
-    {
-      H5Tclose (complex_type);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank < 1)
-    {
-      H5Tclose (complex_type);
-      H5Sclose (space_id);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  if (rank == 1)
-    {
-      dv.resize (2);
-      dv(0) = 1;
-      dv(1) = hdims[0];
-    }
-  else
-    {
-      dv.resize (rank);
-      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
-        dv(j) = hdims[i];
-    }
-
-  ComplexNDArray m (dv);
-  Complex *reim = m.fortran_vec ();
-  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-               reim) >= 0)
-    {
-      retval = true;
-      matrix = m;
-    }
-
-  H5Tclose (complex_type);
-  H5Sclose (space_id);
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-void
-octave_complex_matrix::print_raw (std::ostream& os,
-                                  bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, matrix, pr_as_read_syntax,
-                         current_print_indent_level ());
-}
-
-mxArray *
-octave_complex_matrix::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxCOMPLEX);
-
-  double *pr = static_cast<double *> (retval->get_data ());
-  double *pi = static_cast<double *> (retval->get_imag_data ());
-
-  mwSize nel = numel ();
-
-  const Complex *p = matrix.data ();
-
-  for (mwIndex i = 0; i < nel; i++)
-    {
-      pr[i] = std::real (p[i]);
-      pi[i] = std::imag (p[i]);
-    }
-
-  return retval;
-}
-
-octave_value
-octave_complex_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    // Mappers handled specially.
-    case umap_real:
-      return ::real (matrix);
-    case umap_imag:
-      return ::imag (matrix);
-    case umap_conj:
-      return ::conj (matrix);
-
-#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.FCN ())
-
-      ARRAY_METHOD_MAPPER (abs, abs);
-      ARRAY_METHOD_MAPPER (isnan, isnan);
-      ARRAY_METHOD_MAPPER (isinf, isinf);
-      ARRAY_METHOD_MAPPER (finite, isfinite);
-
-#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.map<TYPE> (FCN))
-
-      ARRAY_MAPPER (acos, Complex, ::acos);
-      ARRAY_MAPPER (acosh, Complex, ::acosh);
-      ARRAY_MAPPER (angle, double, std::arg);
-      ARRAY_MAPPER (arg, double, std::arg);
-      ARRAY_MAPPER (asin, Complex, ::asin);
-      ARRAY_MAPPER (asinh, Complex, ::asinh);
-      ARRAY_MAPPER (atan, Complex, ::atan);
-      ARRAY_MAPPER (atanh, Complex, ::atanh);
-      ARRAY_MAPPER (ceil, Complex, ::ceil);
-      ARRAY_MAPPER (cos, Complex, std::cos);
-      ARRAY_MAPPER (cosh, Complex, std::cosh);
-      ARRAY_MAPPER (exp, Complex, std::exp);
-      ARRAY_MAPPER (expm1, Complex, ::expm1);
-      ARRAY_MAPPER (fix, Complex, ::fix);
-      ARRAY_MAPPER (floor, Complex, ::floor);
-      ARRAY_MAPPER (log, Complex, std::log);
-      ARRAY_MAPPER (log2, Complex, xlog2);
-      ARRAY_MAPPER (log10, Complex, std::log10);
-      ARRAY_MAPPER (log1p, Complex, ::log1p);
-      ARRAY_MAPPER (round, Complex, xround);
-      ARRAY_MAPPER (roundb, Complex, xroundb);
-      ARRAY_MAPPER (signum, Complex, ::signum);
-      ARRAY_MAPPER (sin, Complex, std::sin);
-      ARRAY_MAPPER (sinh, Complex, std::sinh);
-      ARRAY_MAPPER (sqrt, Complex, std::sqrt);
-      ARRAY_MAPPER (tan, Complex, std::tan);
-      ARRAY_MAPPER (tanh, Complex, std::tanh);
-      ARRAY_MAPPER (isna, bool, octave_is_NA);
-
-    default:
-      return octave_base_value::map (umap);
-    }
-}
--- a/src/ov-cx-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_complex_matrix_h)
-#define octave_complex_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-typeinfo.h"
-
-#include "MatrixType.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Complex matrix values.
-
-class
-OCTINTERP_API
-octave_complex_matrix : public octave_base_matrix<ComplexNDArray>
-{
-public:
-
-  octave_complex_matrix (void)
-    : octave_base_matrix<ComplexNDArray> () { }
-
-  octave_complex_matrix (const ComplexNDArray& m)
-    : octave_base_matrix<ComplexNDArray> (m) { }
-
-  octave_complex_matrix (const ComplexMatrix& m)
-    : octave_base_matrix<ComplexNDArray> (m) { }
-
-  octave_complex_matrix (const ComplexMatrix& m, const MatrixType& t)
-    : octave_base_matrix<ComplexNDArray> (m, t) { }
-
-  octave_complex_matrix (const Array<Complex>& m)
-    : octave_base_matrix<ComplexNDArray> (ComplexNDArray (m)) { }
-
-  octave_complex_matrix (const ComplexDiagMatrix& d)
-    : octave_base_matrix<ComplexNDArray> (ComplexMatrix (d)) { }
-
-  octave_complex_matrix (const ComplexRowVector& v)
-    : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { }
-
-  octave_complex_matrix (const ComplexColumnVector& v)
-    : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { }
-
-  octave_complex_matrix (const octave_complex_matrix& cm)
-    : octave_base_matrix<ComplexNDArray> (cm) { }
-
-  ~octave_complex_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_complex_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_complex_matrix (); }
-
-  type_conv_info numeric_demotion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  builtin_type_t builtin_type (void) const { return btyp_complex; }
-
-  bool is_complex_matrix (void) const { return true; }
-
-  bool is_complex_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  float float_scalar_value (bool frc_str_conv = false) const
-    { return float_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  FloatMatrix float_matrix_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const { return matrix; }
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool warn = false) const;
-
-  charNDArray char_array_value (bool frc_str_conv = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const;
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
-
-  octave_value diag (octave_idx_type k = 0) const;
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  void increment (void) { matrix += Complex (1.0); }
-
-  void decrement (void) { matrix -= Complex (1.0); }
-
-  void changesign (void) { matrix.changesign (); }
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      // Yes, for compatibility, we drop the imaginary part here.
-      return os.write (matrix_value (true), block_size, output_type,
-                       skip, flt_fmt);
-    }
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-cx-sparse.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,934 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-#include <vector>
-
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-#include "oct-locbuf.h"
-
-#include "ov-base.h"
-#include "ov-scalar.h"
-#include "ov-complex.h"
-#include "gripes.h"
-
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-
-#include "ov-base-sparse.h"
-#include "ov-base-sparse.cc"
-
-#include "ov-bool-sparse.h"
-
-template class OCTINTERP_API octave_base_sparse<SparseComplexMatrix>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_sparse_complex_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_complex_matrix, "sparse complex matrix", "double");
-
-octave_base_value *
-octave_sparse_complex_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (Vsparse_auto_mutate)
-    {
-      int nr = matrix.rows ();
-      int nc = matrix.cols ();
-
-      // Don't use numel, since it can overflow for very large matrices
-      // Note that for the tests on matrix size, they become approximative
-      // since they involves a cast to double to avoid issues of overflow
-      if (matrix.rows () == 1 && matrix.cols () == 1)
-        {
-          // Const copy of the matrix, so the right version of () operator used
-          const SparseComplexMatrix tmp (matrix);
-
-          Complex c = tmp (0, 0);
-
-          if (std::imag (c) == 0.0)
-            retval = new octave_scalar (std::real (c));
-          else
-            retval = new octave_complex (c);
-        }
-      else if (nr == 0 || nc == 0)
-        retval = new octave_matrix (Matrix (nr, nc));
-      else if (matrix.all_elements_are_real ())
-        if (matrix.cols () > 0 && matrix.rows () > 0
-            && (double (matrix.byte_size ()) > double (matrix.rows ())
-                * double (matrix.cols ()) * sizeof (double)))
-          retval = new octave_matrix (::real (matrix.matrix_value ()));
-        else
-          retval = new octave_sparse_matrix (::real (matrix));
-      else if (matrix.cols () > 0 && matrix.rows () > 0
-               && (double (matrix.byte_size ()) > double (matrix.rows ())
-                   * double (matrix.cols ()) * sizeof (Complex)))
-        retval = new octave_complex_matrix (matrix.matrix_value ());
-    }
-  else
-    {
-      if (matrix.all_elements_are_real ())
-        retval = new octave_sparse_matrix (::real (matrix));
-    }
-
-  return retval;
-}
-
-double
-octave_sparse_complex_matrix::double_value (bool force_conversion) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex sparse matrix", "real scalar");
-
-  // FIXME -- maybe this should be a function, valid_as_scalar()
-  if (numel () > 0)
-    {
-      if (numel () > 1)
-        gripe_implicit_conversion ("Octave:array-to-scalar",
-                                   "complex sparse matrix", "real scalar");
-
-      retval = std::real (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("complex sparse matrix", "real scalar");
-
-  return retval;
-}
-
-Matrix
-octave_sparse_complex_matrix::matrix_value (bool force_conversion) const
-{
-  Matrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex sparse matrix", "real matrix");
-
-  retval = ::real (matrix.matrix_value ());
-
-  return retval;
-}
-
-Complex
-octave_sparse_complex_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  // FIXME -- maybe this should be a function, valid_as_scalar()
-  if (numel () > 0)
-    {
-      if (numel () > 1)
-        gripe_implicit_conversion ("Octave:array-to-scalar",
-                                   "complex sparse matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("complex sparse matrix", "real scalar");
-
-  return retval;
-}
-
-ComplexMatrix
-octave_sparse_complex_matrix::complex_matrix_value (bool) const
-{
-  return matrix.matrix_value ();
-}
-
-ComplexNDArray
-octave_sparse_complex_matrix::complex_array_value (bool) const
-{
-  return ComplexNDArray (matrix.matrix_value ());
-}
-
-charNDArray
-octave_sparse_complex_matrix::char_array_value (bool frc_str_conv) const
-{
-  charNDArray retval;
-
-  if (! frc_str_conv)
-    gripe_implicit_conversion ("Octave:num-to-str",
-                               "sparse complex matrix", "string");
-  else
-    {
-      retval = charNDArray (dims (), 0);
-      octave_idx_type nc = matrix.cols ();
-      octave_idx_type nr = matrix.rows ();
-
-      for (octave_idx_type j = 0; j < nc; j++)
-        for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
-          retval(matrix.ridx (i) + nr * j) =
-            static_cast<char>(std::real (matrix.data (i)));
-    }
-
-  return retval;
-}
-
-SparseMatrix
-octave_sparse_complex_matrix::sparse_matrix_value (bool force_conversion) const
-{
-  SparseMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex sparse matrix",
-                               "real sparse matrix");
-
-  retval = ::real (matrix);
-
-  return retval;
-}
-
-SparseBoolMatrix
-octave_sparse_complex_matrix::sparse_bool_matrix_value (bool warn) const
-{
-  if (matrix.any_element_is_nan ())
-    gripe_nan_to_logical_conversion ();
-  else if (warn && (! matrix.all_elements_are_real ()
-                    || real (matrix).any_element_not_one_or_zero ()))
-    gripe_logical_conversion ();
-
-  return mx_el_ne (matrix, Complex (0.0));
-}
-
-bool
-octave_sparse_complex_matrix::save_binary (std::ostream& os,
-                                           bool&save_as_floats)
-{
-  dim_vector d = this->dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Ensure that additional memory is deallocated
-  matrix.maybe_compress ();
-
-  int nr = d(0);
-  int nc = d(1);
-  int nz = nnz ();
-
-  int32_t itmp;
-  // Use negative value for ndims to be consistent with other formats
-  itmp= -2;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nr;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nc;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nz;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  save_type st = LS_DOUBLE;
-  if (save_as_floats)
-    {
-      if (matrix.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        st = LS_FLOAT;
-    }
-  else if (matrix.nnz () > 8192) // FIXME -- make this configurable.
-    {
-      double max_val, min_val;
-      if (matrix.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  // add one to the printed indices to go from
-  // zero-based to one-based arrays
-   for (int i = 0; i < nc+1; i++)
-     {
-       octave_quit ();
-       itmp = matrix.cidx (i);
-       os.write (reinterpret_cast<char *> (&itmp), 4);
-     }
-
-   for (int i = 0; i < nz; i++)
-     {
-       octave_quit ();
-       itmp = matrix.ridx (i);
-       os.write (reinterpret_cast<char *> (&itmp), 4);
-     }
-
-   write_doubles (os, reinterpret_cast<const double *> (matrix.data ()), st, 2 * nz);
-
-  return true;
-}
-
-bool
-octave_sparse_complex_matrix::load_binary (std::istream& is, bool swap,
-                                   oct_mach_info::float_format fmt)
-{
-  int32_t nz, nc, nr, tmp;
-  char ctmp;
-
-  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-    return false;
-
-  if (swap)
-    swap_bytes<4> (&tmp);
-
-  if (tmp != -2) {
-    error ("load: only 2D sparse matrices are supported");
-    return false;
-  }
-
-  if (! is.read (reinterpret_cast<char *> (&nr), 4))
-    return false;
-  if (! is.read (reinterpret_cast<char *> (&nc), 4))
-    return false;
-  if (! is.read (reinterpret_cast<char *> (&nz), 4))
-    return false;
-
-  if (swap)
-    {
-      swap_bytes<4> (&nr);
-      swap_bytes<4> (&nc);
-      swap_bytes<4> (&nz);
-    }
-
-  SparseComplexMatrix m (static_cast<octave_idx_type> (nr),
-                         static_cast<octave_idx_type> (nc),
-                         static_cast<octave_idx_type> (nz));
-
-  for (int i = 0; i < nc+1; i++)
-    {
-      octave_quit ();
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-      m.cidx (i) = tmp;
-    }
-
-  for (int i = 0; i < nz; i++)
-    {
-      octave_quit ();
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-      m.ridx (i) = tmp;
-    }
-
-  if (! is.read (reinterpret_cast<char *> (&ctmp), 1))
-    return false;
-
-  read_doubles (is, reinterpret_cast<double *> (m.data ()),
-                static_cast<save_type> (ctmp), 2 * nz, swap, fmt);
-
-  if (error_state || ! is)
-    return false;
-
-  if (! m.indices_ok ())
-    return false;
-
-  matrix = m;
-
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_sparse_complex_matrix::save_hdf5 (hid_t loc_id, const char *name,
-                                         bool save_as_floats)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  // Ensure that additional memory is deallocated
-  matrix.maybe_compress ();
-
-#if HAVE_HDF5_18
-  hid_t group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  hid_t group_hid = H5Gcreate (loc_id, name, 0);
-#endif
-  if (group_hid < 0)
-    return false;
-
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-  SparseComplexMatrix m = sparse_complex_matrix_value ();
-  octave_idx_type tmp;
-  hsize_t hdims[2];
-
-  space_hid = H5Screate_simple (0, hdims, 0);
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.rows ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.cols ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.nnz ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-
-  hdims[0] = m.cols () + 1;
-  hdims[1] = 1;
-
-  space_hid = H5Screate_simple (2, hdims, 0);
-
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  octave_idx_type * itmp = m.xcidx ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, itmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-
-  hdims[0] = m.nnz ();
-  hdims[1] = 1;
-
-  space_hid = H5Screate_simple (2, hdims, 0);
-
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  itmp = m.xridx ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
-
-  if (save_as_floats)
-    {
-      if (m.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        save_type_hid = H5T_NATIVE_FLOAT;
-    }
-#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
-  // hdf5 currently doesn't support float/integer conversions
-  else
-    {
-      double max_val, min_val;
-
-      if (m.all_integers (max_val, min_val))
-        save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
-    }
-#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
-
-  hid_t type_hid = hdf5_make_complex_type (save_type_hid);
-  if (type_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
-  retval = false;
-  if (complex_type_hid >= 0)
-    {
-      Complex * ctmp = m.xdata ();
-
-      retval = H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL,
-                         H5P_DEFAULT, ctmp) >= 0;
-    }
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-  H5Tclose (type_hid);
-  H5Gclose (group_hid);
-
-  return retval;
-}
-
-bool
-octave_sparse_complex_matrix::load_hdf5 (hid_t loc_id, const char *name)
-{
-  octave_idx_type nr, nc, nz;
-  hid_t group_hid, data_hid, space_hid;
-  hsize_t rank;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-    return (empty > 0);
-
-#if HAVE_HDF5_18
-  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  group_hid = H5Gopen (loc_id, name);
-#endif
-  if (group_hid < 0 ) return false;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nr", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nr");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nr) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nc", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nc");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nc) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nz", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nz");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nz) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-  SparseComplexMatrix m (static_cast<octave_idx_type> (nr),
-                         static_cast<octave_idx_type> (nc),
-                         static_cast<octave_idx_type> (nz));
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "cidx", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "cidx");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nc + 1
-      || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  octave_idx_type *itmp = m.xcidx ();
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "ridx", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "ridx");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nz
-      || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  itmp = m.xridx ();
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "data", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "data");
-#endif
-  hid_t type_hid = H5Dget_type (data_hid);
-
-  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
-
-  if (! hdf5_types_compatible (type_hid, complex_type))
-    {
-      H5Tclose (complex_type);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nz
-      || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  Complex *ctmp = m.xdata ();
-  bool retval = false;
-  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, ctmp) >= 0
-      && m.indices_ok ())
-    {
-      retval = true;
-      matrix = m;
-    }
-
-  H5Tclose (complex_type);
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-  H5Gclose (group_hid);
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_sparse_complex_matrix::as_mxArray (void) const
-{
-  mwSize nz = nzmax ();
-  mxArray *retval = new mxArray (mxDOUBLE_CLASS, rows (), columns (),
-                                 nz, mxCOMPLEX);
-  double *pr = static_cast<double *> (retval->get_data ());
-  double *pi = static_cast<double *> (retval->get_imag_data ());
-  mwIndex *ir = retval->get_ir ();
-  mwIndex *jc = retval->get_jc ();
-
-  for (mwIndex i = 0; i < nz; i++)
-    {
-      Complex val = matrix.data (i);
-      pr[i] = std::real (val);
-      pi[i] = std::imag (val);
-      ir[i] = matrix.ridx (i);
-    }
-
-  for (mwIndex i = 0; i < columns () + 1; i++)
-    jc[i] = matrix.cidx (i);
-
-  return retval;
-}
-
-octave_value
-octave_sparse_complex_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    // Mappers handled specially.
-    case umap_real:
-      return ::real (matrix);
-    case umap_imag:
-      return ::imag (matrix);
-
-#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.FCN ())
-
-      ARRAY_METHOD_MAPPER (abs, abs);
-
-#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.map<TYPE> (FCN))
-
-      ARRAY_MAPPER (acos, Complex, ::acos);
-      ARRAY_MAPPER (acosh, Complex, ::acosh);
-      ARRAY_MAPPER (angle, double, std::arg);
-      ARRAY_MAPPER (arg, double, std::arg);
-      ARRAY_MAPPER (asin, Complex, ::asin);
-      ARRAY_MAPPER (asinh, Complex, ::asinh);
-      ARRAY_MAPPER (atan, Complex, ::atan);
-      ARRAY_MAPPER (atanh, Complex, ::atanh);
-      ARRAY_MAPPER (ceil, Complex, ::ceil);
-      ARRAY_MAPPER (conj, Complex, std::conj<double>);
-      ARRAY_MAPPER (cos, Complex, std::cos);
-      ARRAY_MAPPER (cosh, Complex, std::cosh);
-      ARRAY_MAPPER (exp, Complex, std::exp);
-      ARRAY_MAPPER (expm1, Complex, ::expm1);
-      ARRAY_MAPPER (fix, Complex, ::fix);
-      ARRAY_MAPPER (floor, Complex, ::floor);
-      ARRAY_MAPPER (log, Complex, std::log);
-      ARRAY_MAPPER (log2, Complex, xlog2);
-      ARRAY_MAPPER (log10, Complex, std::log10);
-      ARRAY_MAPPER (log1p, Complex, ::log1p);
-      ARRAY_MAPPER (round, Complex, xround);
-      ARRAY_MAPPER (roundb, Complex, xroundb);
-      ARRAY_MAPPER (signum, Complex, ::signum);
-      ARRAY_MAPPER (sin, Complex, std::sin);
-      ARRAY_MAPPER (sinh, Complex, std::sinh);
-      ARRAY_MAPPER (sqrt, Complex, std::sqrt);
-      ARRAY_MAPPER (tan, Complex, std::tan);
-      ARRAY_MAPPER (tanh, Complex, std::tanh);
-      ARRAY_MAPPER (isnan, bool, xisnan);
-      ARRAY_MAPPER (isna, bool, octave_is_NA);
-      ARRAY_MAPPER (isinf, bool, xisinf);
-      ARRAY_MAPPER (finite, bool, xfinite);
-
-    default: // Attempt to go via dense matrix.
-      return octave_base_sparse<SparseComplexMatrix>::map (umap);
-    }
-}
--- a/src/ov-cx-sparse.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-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_sparse_complex_matrix_h)
-#define octave_sparse_complex_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-#include "CSparse.h"
-#include "ov-base-sparse.h"
-#include "ov-re-sparse.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-class
-OCTINTERP_API
-octave_sparse_complex_matrix : public octave_base_sparse<SparseComplexMatrix>
-{
-public:
-
-  octave_sparse_complex_matrix (void)
-    : octave_base_sparse<SparseComplexMatrix> () { }
-
-  octave_sparse_complex_matrix (const ComplexNDArray& m)
-    : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
-
-  octave_sparse_complex_matrix (const ComplexMatrix& m)
-    : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
-
-  octave_sparse_complex_matrix (const SparseComplexMatrix& m)
-    : octave_base_sparse<SparseComplexMatrix> (m) { }
-
-  octave_sparse_complex_matrix (const SparseComplexMatrix& m,
-                                const MatrixType &t)
-    : octave_base_sparse<SparseComplexMatrix> (m, t) { }
-
-  octave_sparse_complex_matrix (const MSparse<Complex>& m)
-    : octave_base_sparse<SparseComplexMatrix> (m) { }
-
-  octave_sparse_complex_matrix (const MSparse<Complex>& m,
-                                const MatrixType &t)
-    : octave_base_sparse<SparseComplexMatrix> (m, t) { }
-
-  octave_sparse_complex_matrix (const Sparse<Complex>& m,
-                                const MatrixType &t)
-    : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m), t) { }
-
-  octave_sparse_complex_matrix (const Sparse<Complex>& m)
-    : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
-
-  octave_sparse_complex_matrix (const octave_sparse_complex_matrix& cm)
-    : octave_base_sparse<SparseComplexMatrix> (cm) { }
-
-  ~octave_sparse_complex_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_sparse_complex_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_sparse_complex_matrix (); }
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  builtin_type_t builtin_type (void) const { return btyp_complex; }
-
-  bool is_complex_matrix (void) const { return true; }
-
-  bool is_complex_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  double double_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  charNDArray char_array_value (bool frc_str_conv = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const;
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-    { return matrix; }
-
-  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
-
-#if 0
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      // Yes, for compatibility, we drop the imaginary part here.
-      return os.write (matrix_value (true), block_size, output_type,
-                       skip, flt_fmt);
-    }
-#endif
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-dld-fcn.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "oct-shlib.h"
-
-#include <defaults.h>
-#include "dynamic-ld.h"
-#include "error.h"
-#include "oct-obj.h"
-#include "ov-dld-fcn.h"
-#include "ov.h"
-
-DEFINE_OCTAVE_ALLOCATOR (octave_dld_function);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_dld_function,
-                                     "dynamically-linked function",
-                                     "dynamically-linked function");
-
-
-octave_dld_function::octave_dld_function
-  (octave_builtin::fcn ff, const octave_shlib& shl,
-   const std::string& nm, const std::string& ds)
-  : octave_builtin (ff, nm, ds), sh_lib (shl)
-{
-  mark_fcn_file_up_to_date (time_parsed ());
-
-  std::string file_name = fcn_file_name ();
-
-  system_fcn_file
-    = (! file_name.empty ()
-       && Voct_file_dir == file_name.substr (0, Voct_file_dir.length ()));
-}
-
-octave_dld_function::~octave_dld_function (void)
-{
-  octave_dynamic_loader::remove_oct (my_name, sh_lib);
-}
-
-std::string
-octave_dld_function::fcn_file_name (void) const
-{
-  return sh_lib.file_name ();
-}
-
-octave_time
-octave_dld_function::time_parsed (void) const
-{
-  return sh_lib.time_loaded ();
-}
-
-// Note: this wrapper around the octave_dld_function constructor is
-//       necessary to work around a MSVC limitation handling in
-//       virtual destructors that prevents unloading a dynamic module
-//       before *all* objects (of class using a virtual dtor) have
-//       been fully deleted; indeed, MSVC attaches auto-generated code
-//       (scalar deleting destructor) to objects created in a dynamic
-//       module, and this code will be executed in the dynamic module
-//       context at object deletion; unloading the dynamic module
-//       before objects have been deleted will make the "delete" code
-//       of objects to point to an invalid code segment.
-
-octave_dld_function*
-octave_dld_function::create (octave_builtin::fcn ff, const octave_shlib& shl,
-                             const std::string& nm, const std::string& ds)
-{
-  return new octave_dld_function (ff, shl, nm, ds);
-}
--- a/src/ov-dld-fcn.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_dld_function_h)
-#define octave_dld_function_h 1
-
-#include <string>
-
-#include "oct-shlib.h"
-
-#include "ov-fcn.h"
-#include "ov-builtin.h"
-#include "ov-typeinfo.h"
-
-class octave_shlib;
-
-class octave_value;
-class octave_value_list;
-
-// Dynamically-linked functions.
-
-class
-OCTINTERP_API
-octave_dld_function : public octave_builtin
-{
-public:
-
-  octave_dld_function (void)
-    : sh_lib (), t_checked (), system_fcn_file ()
-  { }
-
-  octave_dld_function (octave_builtin::fcn ff, const octave_shlib& shl,
-                       const std::string& nm = std::string (),
-                       const std::string& ds = std::string ());
-
-  ~octave_dld_function (void);
-
-  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
-
-  std::string fcn_file_name (void) const;
-
-  octave_time time_parsed (void) const;
-
-  octave_time time_checked (void) const { return t_checked; }
-
-  bool is_system_fcn_file (void) const { return system_fcn_file; }
-
-  bool is_builtin_function (void) const { return false; }
-
-  bool is_dld_function (void) const { return true; }
-
-  static octave_dld_function* create (octave_builtin::fcn ff,
-      const octave_shlib& shl,
-      const std::string& nm = std::string (),
-      const std::string& ds = std::string ());
-
-  octave_shlib get_shlib (void) const
-    { return sh_lib; }
-
-private:
-
-  octave_shlib sh_lib;
-
-  // The time the file was last checked to see if it needs to be
-  // parsed again.
-  mutable octave_time t_checked;
-
-  // True if this function came from a file that is considered to be a
-  // system function.  This affects whether we check the time stamp
-  // on the file to see if it has changed.
-  bool system_fcn_file;
-
-  // No copying!
-
-  octave_dld_function (const octave_dld_function& fn);
-
-  octave_dld_function& operator = (const octave_dld_function& fn);
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-fcn-handle.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2000 +0,0 @@
-/*
-
-Copyright (C) 2003-2012 John W. Eaton
-Copyright (C) 2009 VZLU Prague, a.s.
-Copyright (C) 2010 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <sstream>
-#include <vector>
-
-#include "file-ops.h"
-#include "oct-locbuf.h"
-
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "input.h"
-#include "oct-map.h"
-#include "ov-base.h"
-#include "ov-fcn-handle.h"
-#include "ov-usr-fcn.h"
-#include "pr-output.h"
-#include "pt-pr-code.h"
-#include "pt-misc.h"
-#include "pt-stmt.h"
-#include "pt-cmd.h"
-#include "pt-exp.h"
-#include "pt-assign.h"
-#include "pt-arg-list.h"
-#include "variables.h"
-#include "parse.h"
-#include "unwind-prot.h"
-#include "defaults.h"
-#include "file-stat.h"
-#include "load-path.h"
-#include "oct-env.h"
-
-#include "byte-swap.h"
-#include "ls-ascii-helper.h"
-#include "ls-hdf5.h"
-#include "ls-oct-ascii.h"
-#include "ls-oct-binary.h"
-#include "ls-utils.h"
-
-DEFINE_OCTAVE_ALLOCATOR (octave_fcn_handle);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_fcn_handle,
-                                     "function handle",
-                                     "function_handle");
-
-const std::string octave_fcn_handle::anonymous ("@<anonymous>");
-
-octave_fcn_handle::octave_fcn_handle (const octave_value& f,
-                                      const std::string& n)
-  : fcn (f), nm (n), has_overloads (false)
-{
-  octave_user_function *uf = fcn.user_function_value (true);
-
-  if (uf && nm != anonymous)
-    symbol_table::cache_name (uf->scope (), nm);
-
-  if (uf && uf->is_nested_function ())
-    ::error ("handles to nested functions are not yet supported");
-}
-
-octave_value_list
-octave_fcn_handle::subsref (const std::string& type,
-                            const std::list<octave_value_list>& idx,
-                            int nargout)
-{
-  return octave_fcn_handle::subsref (type, idx, nargout, 0);
-}
-
-octave_value_list
-octave_fcn_handle::subsref (const std::string& type,
-                            const std::list<octave_value_list>& idx,
-                            int nargout, const std::list<octave_lvalue>* lvalue_list)
-{
-  octave_value_list retval;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
-
-        retval = do_multi_index_op (tmp_nargout, idx.front (),
-                                    idx.size () == 1 ? lvalue_list : 0);
-      }
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string tnm = type_name ();
-        error ("%s cannot be indexed with %c", tnm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  // FIXME -- perhaps there should be an
-  // octave_value_list::next_subsref member function?  See also
-  // octave_builtin::subsref.
-
-  if (idx.size () > 1)
-    retval = retval(0).next_subsref (nargout, type, idx);
-
-  return retval;
-}
-
-octave_value_list
-octave_fcn_handle::do_multi_index_op (int nargout,
-                                      const octave_value_list& args)
-{
-  return do_multi_index_op (nargout, args, 0);
-}
-
-octave_value_list
-octave_fcn_handle::do_multi_index_op (int nargout,
-                                      const octave_value_list& args,
-                                      const std::list<octave_lvalue>* lvalue_list)
-{
-  octave_value_list retval;
-
-  out_of_date_check (fcn, std::string (), false);
-
-  if (has_overloads)
-    {
-      // Possibly overloaded function.
-      octave_value ov_fcn;
-
-      // Compute dispatch type.
-      builtin_type_t btyp;
-      std::string dispatch_type = get_dispatch_type (args, btyp);
-
-      // Retrieve overload.
-      if (btyp != btyp_unknown)
-        {
-          out_of_date_check (builtin_overloads[btyp], dispatch_type, false);
-          ov_fcn = builtin_overloads[btyp];
-        }
-      else
-        {
-          str_ov_map::iterator it = overloads.find (dispatch_type);
-
-          if (it == overloads.end ())
-            {
-              // Try parent classes too.
-
-              std::list<std::string> plist
-                = symbol_table::parent_classes (dispatch_type);
-
-              std::list<std::string>::const_iterator pit = plist.begin ();
-
-              while (pit != plist.end ())
-                {
-                  std::string pname = *pit;
-
-                  std::string fnm = fcn_name ();
-
-                  octave_value ftmp = symbol_table::find_method (fnm, pname);
-
-                  if (ftmp.is_defined ())
-                    {
-                      set_overload (pname, ftmp);
-
-                      out_of_date_check (ftmp, pname, false);
-                      ov_fcn = ftmp;
-
-                      break;
-                    }
-
-                  pit++;
-                }
-            }
-          else
-            {
-              out_of_date_check (it->second, dispatch_type, false);
-              ov_fcn = it->second;
-            }
-        }
-
-      if (ov_fcn.is_defined ())
-        retval = ov_fcn.do_multi_index_op (nargout, args, lvalue_list);
-      else if (fcn.is_defined ())
-        retval = fcn.do_multi_index_op (nargout, args, lvalue_list);
-      else
-        error ("%s: no method for class %s", nm.c_str (), dispatch_type.c_str ());
-    }
-  else
-    {
-      // Non-overloaded function (anonymous, subfunction, private function).
-      if (fcn.is_defined ())
-        retval = fcn.do_multi_index_op (nargout, args, lvalue_list);
-      else
-        error ("%s: no longer valid function handle", nm.c_str ());
-    }
-
-  return retval;
-}
-
-bool
-octave_fcn_handle::is_equal_to (const octave_fcn_handle& h) const
-{
-  bool retval = fcn.is_copy_of (h.fcn) && (has_overloads == h.has_overloads);
-  retval = retval && (overloads.size () == h.overloads.size ());
-
-  if (retval && has_overloads)
-    {
-      for (int i = 0; i < btyp_num_types && retval; i++)
-        retval = builtin_overloads[i].is_copy_of (h.builtin_overloads[i]);
-
-      str_ov_map::const_iterator iter = overloads.begin (), hiter = h.overloads.begin ();
-      for (; iter != overloads.end () && retval; iter++, hiter++)
-        retval = (iter->first == hiter->first) && (iter->second.is_copy_of (hiter->second));
-    }
-
-  return retval;
-}
-
-bool
-octave_fcn_handle::set_fcn (const std::string &octaveroot,
-                            const std::string& fpath)
-{
-  bool success = true;
-
-  if (octaveroot.length () != 0
-      && fpath.length () >= octaveroot.length ()
-      && fpath.substr (0, octaveroot.length ()) == octaveroot
-      && OCTAVE_EXEC_PREFIX != octaveroot)
-    {
-      // First check if just replacing matlabroot is enough
-      std::string str = OCTAVE_EXEC_PREFIX +
-        fpath.substr (octaveroot.length ());
-      file_stat fs (str);
-
-      if (fs.exists ())
-        {
-          size_t xpos = str.find_last_of (file_ops::dir_sep_chars ());
-
-          std::string dir_name = str.substr (0, xpos);
-
-          octave_function *xfcn
-            = load_fcn_from_file (str, dir_name, "", nm);
-
-          if (xfcn)
-            {
-              octave_value tmp (xfcn);
-
-              fcn = octave_value (new octave_fcn_handle (tmp, nm));
-            }
-          else
-            {
-              error ("function handle points to non-existent function");
-              success = false;
-            }
-        }
-      else
-        {
-          // Next just search for it anywhere in the system path
-          string_vector names(3);
-          names(0) = nm + ".oct";
-          names(1) = nm + ".mex";
-          names(2) = nm + ".m";
-
-          dir_path p (load_path::system_path ());
-
-          str = octave_env::make_absolute (p.find_first_of (names));
-
-          size_t xpos = str.find_last_of (file_ops::dir_sep_chars ());
-
-          std::string dir_name = str.substr (0, xpos);
-
-          octave_function *xfcn = load_fcn_from_file (str, dir_name, "", nm);
-
-          if (xfcn)
-            {
-              octave_value tmp (xfcn);
-
-              fcn = octave_value (new octave_fcn_handle (tmp, nm));
-            }
-          else
-            {
-              error ("function handle points to non-existent function");
-              success = false;
-            }
-        }
-    }
-  else
-    {
-      if (fpath.length () > 0)
-        {
-          size_t xpos = fpath.find_last_of (file_ops::dir_sep_chars ());
-
-          std::string dir_name = fpath.substr (0, xpos);
-
-          octave_function *xfcn = load_fcn_from_file (fpath, dir_name, "", nm);
-
-          if (xfcn)
-            {
-              octave_value tmp (xfcn);
-
-              fcn = octave_value (new octave_fcn_handle (tmp, nm));
-            }
-          else
-            {
-              error ("function handle points to non-existent function");
-              success = false;
-            }
-        }
-      else
-        {
-          fcn = symbol_table::find_function (nm);
-
-          if (! fcn.is_function ())
-            {
-              error ("function handle points to non-existent function");
-              success = false;
-            }
-        }
-    }
-
-  return success;
-}
-
-bool
-octave_fcn_handle::save_ascii (std::ostream& os)
-{
-  if (nm == anonymous)
-    {
-      os << nm << "\n";
-
-      print_raw (os, true);
-      os << "\n";
-
-      if (fcn.is_undefined ())
-        return false;
-
-      octave_user_function *f = fcn.user_function_value ();
-
-      std::list<symbol_table::symbol_record> vars
-        = symbol_table::all_variables (f->scope (), 0);
-
-      size_t varlen = vars.size ();
-
-      if (varlen > 0)
-        {
-          os << "# length: " << varlen << "\n";
-
-          for (std::list<symbol_table::symbol_record>::const_iterator p = vars.begin ();
-               p != vars.end (); p++)
-            {
-              if (! save_ascii_data (os, p->varval (), p->name (), false, 0))
-                return os;
-            }
-        }
-    }
-  else
-    {
-      octave_function *f = function_value ();
-      std::string fnm = f ? f->fcn_file_name () : std::string ();
-
-      os << "# octaveroot: " << OCTAVE_EXEC_PREFIX << "\n";
-      if (! fnm.empty ())
-        os << "# path: " << fnm << "\n";
-      os << nm << "\n";
-    }
-
-  return true;
-}
-
-bool
-octave_fcn_handle::load_ascii (std::istream& is)
-{
-  bool success = true;
-
-  std::streampos pos = is.tellg ();
-  std::string octaveroot = extract_keyword (is, "octaveroot", true);
-  if (octaveroot.length () == 0)
-    {
-      is.seekg (pos);
-      is.clear ();
-    }
-  pos = is.tellg ();
-  std::string fpath = extract_keyword (is, "path", true);
-  if (fpath.length () == 0)
-    {
-      is.seekg (pos);
-      is.clear ();
-    }
-
-  is >> nm;
-
-  if (nm == anonymous)
-    {
-      skip_preceeding_newline (is);
-
-      std::string buf;
-
-      if (is)
-        {
-
-          // Get a line of text whitespace characters included, leaving
-          // newline in the stream.
-          buf = read_until_newline (is, true);
-
-        }
-
-      pos = is.tellg ();
-
-      unwind_protect_safe frame;
-
-      // Set up temporary scope to use for evaluating the text that
-      // defines the anonymous function.
-
-      symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
-      frame.add_fcn (symbol_table::erase_scope, local_scope);
-
-      symbol_table::set_scope (local_scope);
-
-      octave_call_stack::push (local_scope, 0);
-      frame.add_fcn (octave_call_stack::pop);
-
-      octave_idx_type len = 0;
-
-      if (extract_keyword (is, "length", len, true) && len >= 0)
-        {
-          if (len > 0)
-            {
-              for (octave_idx_type i = 0; i < len; i++)
-                {
-                  octave_value t2;
-                  bool dummy;
-
-                  std::string name
-                    = read_ascii_data (is, std::string (), dummy, t2, i);
-
-                  if (!is)
-                    {
-                      error ("load: failed to load anonymous function handle");
-                      break;
-                    }
-
-                  symbol_table::varref (name, local_scope, 0) = t2;
-                }
-            }
-        }
-      else
-        {
-          is.seekg (pos);
-          is.clear ();
-        }
-
-      if (is && success)
-        {
-          int parse_status;
-          octave_value anon_fcn_handle =
-            eval_string (buf, true, parse_status);
-
-          if (parse_status == 0)
-            {
-              octave_fcn_handle *fh =
-                anon_fcn_handle.fcn_handle_value ();
-
-              if (fh)
-                {
-                  fcn = fh->fcn;
-
-                  octave_user_function *uf = fcn.user_function_value (true);
-
-                  if (uf)
-                    symbol_table::cache_name (uf->scope (), nm);
-                }
-              else
-                success = false;
-            }
-          else
-            success = false;
-        }
-      else
-        success = false;
-    }
-  else
-    success = set_fcn (octaveroot, fpath);
-
-  return success;
-}
-
-bool
-octave_fcn_handle::save_binary (std::ostream& os, bool& save_as_floats)
-{
-  if (nm == anonymous)
-    {
-      std::ostringstream nmbuf;
-
-      if (fcn.is_undefined ())
-        return false;
-
-      octave_user_function *f = fcn.user_function_value ();
-
-      std::list<symbol_table::symbol_record> vars
-        = symbol_table::all_variables (f->scope (), 0);
-
-      size_t varlen = vars.size ();
-
-      if (varlen > 0)
-        nmbuf << nm << " " << varlen;
-      else
-        nmbuf << nm;
-
-      std::string buf_str = nmbuf.str ();
-      int32_t tmp = buf_str.length ();
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-      os.write (buf_str.c_str (), buf_str.length ());
-
-      std::ostringstream buf;
-      print_raw (buf, true);
-      std::string stmp = buf.str ();
-      tmp = stmp.length ();
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-      os.write (stmp.c_str (), stmp.length ());
-
-      if (varlen > 0)
-        {
-          for (std::list<symbol_table::symbol_record>::const_iterator p = vars.begin ();
-               p != vars.end (); p++)
-            {
-              if (! save_binary_data (os, p->varval (), p->name (),
-                                      "", 0, save_as_floats))
-                return os;
-            }
-        }
-    }
-  else
-    {
-      std::ostringstream nmbuf;
-
-      octave_function *f = function_value ();
-      std::string fnm = f ? f->fcn_file_name () : std::string ();
-
-      nmbuf << nm << "\n" << OCTAVE_EXEC_PREFIX << "\n" << fnm;
-
-      std::string buf_str = nmbuf.str ();
-      int32_t tmp = buf_str.length ();
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-      os.write (buf_str.c_str (), buf_str.length ());
-    }
-
-  return true;
-}
-
-bool
-octave_fcn_handle::load_binary (std::istream& is, bool swap,
-                                oct_mach_info::float_format fmt)
-{
-  bool success = true;
-
-  int32_t tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&tmp);
-
-  OCTAVE_LOCAL_BUFFER (char, ctmp1, tmp+1);
-  // is.get (ctmp1, tmp+1, 0); caused is.eof () to be true though
-  // effectively not reading over file end
-  is.read (ctmp1, tmp);
-  ctmp1[tmp] = 0;
-  nm = std::string (ctmp1);
-
-  if (! is)
-    return false;
-
-  size_t anl = anonymous.length ();
-
-  if (nm.length () >= anl && nm.substr (0, anl) == anonymous)
-    {
-      octave_idx_type len = 0;
-
-      if (nm.length () > anl)
-        {
-          std::istringstream nm_is (nm.substr (anl));
-          nm_is >> len;
-          nm = nm.substr (0, anl);
-        }
-
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-
-      OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1);
-      // is.get (ctmp2, tmp+1, 0); caused is.eof () to be true though
-      // effectively not reading over file end
-      is.read (ctmp2, tmp);
-      ctmp2[tmp] = 0;
-
-      unwind_protect_safe frame;
-
-      // Set up temporary scope to use for evaluating the text that
-      // defines the anonymous function.
-
-      symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
-      frame.add_fcn (symbol_table::erase_scope, local_scope);
-
-      symbol_table::set_scope (local_scope);
-
-      octave_call_stack::push (local_scope, 0);
-      frame.add_fcn (octave_call_stack::pop);
-
-      if (len > 0)
-        {
-          for (octave_idx_type i = 0; i < len; i++)
-            {
-              octave_value t2;
-              bool dummy;
-              std::string doc;
-
-              std::string name =
-                read_binary_data (is, swap, fmt, std::string (),
-                                  dummy, t2, doc);
-
-              if (!is)
-                {
-                  error ("load: failed to load anonymous function handle");
-                  break;
-                }
-
-              symbol_table::varref (name, local_scope) = t2;
-            }
-        }
-
-      if (is && success)
-        {
-          int parse_status;
-          octave_value anon_fcn_handle =
-            eval_string (ctmp2, true, parse_status);
-
-          if (parse_status == 0)
-            {
-              octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
-
-              if (fh)
-                {
-                  fcn = fh->fcn;
-
-                  octave_user_function *uf = fcn.user_function_value (true);
-
-                  if (uf)
-                    symbol_table::cache_name (uf->scope (), nm);
-                }
-              else
-                success = false;
-            }
-          else
-            success = false;
-        }
-    }
-  else
-    {
-      std::string octaveroot;
-      std::string fpath;
-
-      if (nm.find_first_of ("\n") != std::string::npos)
-        {
-          size_t pos1 = nm.find_first_of ("\n");
-          size_t pos2 = nm.find_first_of ("\n", pos1 + 1);
-          octaveroot = nm.substr (pos1 + 1, pos2 - pos1 - 1);
-          fpath = nm.substr (pos2 + 1);
-          nm = nm.substr (0, pos1);
-        }
-
-      success = set_fcn (octaveroot, fpath);
-     }
-
-  return success;
-}
-
-#if defined (HAVE_HDF5)
-bool
-octave_fcn_handle::save_hdf5 (hid_t loc_id, const char *name,
-                              bool save_as_floats)
-{
-  bool retval = true;
-
-  hid_t group_hid = -1;
-#if HAVE_HDF5_18
-  group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  group_hid = H5Gcreate (loc_id, name, 0);
-#endif
-  if (group_hid < 0)
-    return false;
-
-  hid_t space_hid = -1, data_hid = -1, type_hid = -1;;
-
-  // attach the type of the variable
-  type_hid = H5Tcopy (H5T_C_S1);
-  H5Tset_size (type_hid, nm.length () + 1);
-  if (type_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, 2);
-  hdims[0] = 0;
-  hdims[1] = 0;
-  space_hid = H5Screate_simple (0 , hdims, 0);
-  if (space_hid < 0)
-    {
-      H5Tclose (type_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid, H5P_DEFAULT);
-#endif
-  if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
-                                H5P_DEFAULT, nm.c_str ()) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-  H5Dclose (data_hid);
-
-  if (nm == anonymous)
-    {
-      std::ostringstream buf;
-      print_raw (buf, true);
-      std::string stmp = buf.str ();
-
-      // attach the type of the variable
-      H5Tset_size (type_hid, stmp.length () + 1);
-      if (type_hid < 0)
-        {
-          H5Sclose (space_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-#if HAVE_HDF5_18
-      data_hid = H5Dcreate (group_hid, "fcn",  type_hid, space_hid,
-                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-      data_hid = H5Dcreate (group_hid, "fcn",  type_hid, space_hid,
-                            H5P_DEFAULT);
-#endif
-      if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
-                                    H5P_DEFAULT, stmp.c_str ()) < 0)
-        {
-          H5Sclose (space_hid);
-          H5Tclose (type_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      H5Dclose (data_hid);
-
-      octave_user_function *f = fcn.user_function_value ();
-
-      std::list<symbol_table::symbol_record> vars
-        = symbol_table::all_variables (f->scope (), 0);
-
-      size_t varlen = vars.size ();
-
-      if (varlen > 0)
-        {
-          hid_t as_id = H5Screate (H5S_SCALAR);
-
-          if (as_id >= 0)
-            {
-#if HAVE_HDF5_18
-              hid_t a_id = H5Acreate (group_hid, "SYMBOL_TABLE",
-                                      H5T_NATIVE_IDX, as_id,
-                                      H5P_DEFAULT, H5P_DEFAULT);
-
-#else
-              hid_t a_id = H5Acreate (group_hid, "SYMBOL_TABLE",
-                                      H5T_NATIVE_IDX, as_id, H5P_DEFAULT);
-#endif
-
-              if (a_id >= 0)
-                {
-                  retval = (H5Awrite (a_id, H5T_NATIVE_IDX, &varlen) >= 0);
-
-                  H5Aclose (a_id);
-                }
-              else
-                retval = false;
-
-              H5Sclose (as_id);
-            }
-          else
-            retval = false;
-#if HAVE_HDF5_18
-          data_hid = H5Gcreate (group_hid, "symbol table", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-          data_hid = H5Gcreate (group_hid, "symbol table", 0);
-#endif
-          if (data_hid < 0)
-            {
-              H5Sclose (space_hid);
-              H5Tclose (type_hid);
-              H5Gclose (group_hid);
-              return false;
-            }
-
-          for (std::list<symbol_table::symbol_record>::const_iterator p = vars.begin ();
-               p != vars.end (); p++)
-            {
-              if (! add_hdf5_data (data_hid, p->varval (), p->name (),
-                                   "", false, save_as_floats))
-                break;
-            }
-          H5Gclose (data_hid);
-        }
-    }
-  else
-    {
-      std::string octaveroot = OCTAVE_EXEC_PREFIX;
-
-      octave_function *f = function_value ();
-      std::string fpath = f ? f->fcn_file_name () : std::string ();
-
-      H5Sclose (space_hid);
-      hdims[0] = 1;
-      hdims[1] = octaveroot.length ();
-      space_hid = H5Screate_simple (0 , hdims, 0);
-      if (space_hid < 0)
-        {
-          H5Tclose (type_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      H5Tclose (type_hid);
-      type_hid = H5Tcopy (H5T_C_S1);
-      H5Tset_size (type_hid, octaveroot.length () + 1);
-#if HAVE_HDF5_18
-      hid_t a_id = H5Acreate (group_hid, "OCTAVEROOT",
-                              type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT);
-#else
-      hid_t a_id = H5Acreate (group_hid, "OCTAVEROOT",
-                              type_hid, space_hid, H5P_DEFAULT);
-#endif
-
-      if (a_id >= 0)
-        {
-          retval = (H5Awrite (a_id, type_hid, octaveroot.c_str ()) >= 0);
-
-          H5Aclose (a_id);
-        }
-      else
-        {
-          H5Sclose (space_hid);
-          H5Tclose (type_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      H5Sclose (space_hid);
-      hdims[0] = 1;
-      hdims[1] = fpath.length ();
-      space_hid = H5Screate_simple (0 , hdims, 0);
-      if (space_hid < 0)
-        {
-          H5Tclose (type_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      H5Tclose (type_hid);
-      type_hid = H5Tcopy (H5T_C_S1);
-      H5Tset_size (type_hid, fpath.length () + 1);
-
-#if HAVE_HDF5_18
-      a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT);
-#else
-      a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid, H5P_DEFAULT);
-#endif
-
-      if (a_id >= 0)
-        {
-          retval = (H5Awrite (a_id, type_hid, fpath.c_str ()) >= 0);
-
-          H5Aclose (a_id);
-        }
-      else
-        retval = false;
-    }
-
-  H5Sclose (space_hid);
-  H5Tclose (type_hid);
-  H5Gclose (group_hid);
-
-  return retval;
-}
-
-bool
-octave_fcn_handle::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool success = true;
-
-  hid_t group_hid, data_hid, space_hid, type_hid, type_class_hid, st_id;
-  hsize_t rank;
-  int slen;
-
-#if HAVE_HDF5_18
-  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  group_hid = H5Gopen (loc_id, name);
-#endif
-  if (group_hid < 0)
-    return false;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nm", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nm");
-#endif
-
-  if (data_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  type_hid = H5Dget_type (data_hid);
-  type_class_hid = H5Tget_class (type_hid);
-
-  if (type_class_hid != H5T_STRING)
-    {
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  slen = H5Tget_size (type_hid);
-  if (slen < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (char, nm_tmp, slen);
-
-  // create datatype for (null-terminated) string to read into:
-  st_id = H5Tcopy (H5T_C_S1);
-  H5Tset_size (st_id, slen);
-
-  if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, nm_tmp) < 0)
-    {
-      H5Tclose (st_id);
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-  H5Tclose (st_id);
-  H5Dclose (data_hid);
-  nm = nm_tmp;
-
-  if (nm == anonymous)
-    {
-#if HAVE_HDF5_18
-      data_hid = H5Dopen (group_hid, "fcn", H5P_DEFAULT);
-#else
-      data_hid = H5Dopen (group_hid, "fcn");
-#endif
-
-      if (data_hid < 0)
-        {
-          H5Sclose (space_hid);
-          H5Tclose (type_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      H5Tclose (type_hid);
-      type_hid = H5Dget_type (data_hid);
-      type_class_hid = H5Tget_class (type_hid);
-
-      if (type_class_hid != H5T_STRING)
-        {
-          H5Sclose (space_hid);
-          H5Tclose (type_hid);
-          H5Dclose (data_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      H5Sclose (space_hid);
-      space_hid = H5Dget_space (data_hid);
-      rank = H5Sget_simple_extent_ndims (space_hid);
-
-      if (rank != 0)
-        {
-          H5Sclose (space_hid);
-          H5Tclose (type_hid);
-          H5Dclose (data_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      slen = H5Tget_size (type_hid);
-      if (slen < 0)
-        {
-          H5Sclose (space_hid);
-          H5Tclose (type_hid);
-          H5Dclose (data_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-
-      OCTAVE_LOCAL_BUFFER (char, fcn_tmp, slen);
-
-      // create datatype for (null-terminated) string to read into:
-      st_id = H5Tcopy (H5T_C_S1);
-      H5Tset_size (st_id, slen);
-
-      if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, fcn_tmp) < 0)
-        {
-          H5Tclose (st_id);
-          H5Sclose (space_hid);
-          H5Tclose (type_hid);
-          H5Dclose (data_hid);
-          H5Gclose (group_hid);
-          return false;
-        }
-      H5Tclose (st_id);
-      H5Dclose (data_hid);
-
-      octave_idx_type len = 0;
-
-      // we have to pull some shenanigans here to make sure
-      // HDF5 doesn't print out all sorts of error messages if we
-      // call H5Aopen for a non-existing attribute
-
-      H5E_auto_t err_func;
-      void *err_func_data;
-
-      // turn off error reporting temporarily, but save the error
-      // reporting function:
-#if HAVE_HDF5_18
-      H5Eget_auto (H5E_DEFAULT, &err_func, &err_func_data);
-      H5Eset_auto (H5E_DEFAULT, 0, 0);
-#else
-      H5Eget_auto (&err_func, &err_func_data);
-      H5Eset_auto (0, 0);
-#endif
-
-      hid_t attr_id = H5Aopen_name (group_hid, "SYMBOL_TABLE");
-
-      if (attr_id >= 0)
-        {
-          if (H5Aread (attr_id, H5T_NATIVE_IDX, &len) < 0)
-            success = false;
-
-          H5Aclose (attr_id);
-        }
-
-      // restore error reporting:
-#if HAVE_HDF5_18
-      H5Eset_auto (H5E_DEFAULT, err_func, err_func_data);
-#else
-      H5Eset_auto (err_func, err_func_data);
-#endif
-
-      unwind_protect_safe frame;
-
-      // Set up temporary scope to use for evaluating the text that
-      // defines the anonymous function.
-
-      symbol_table::scope_id local_scope = symbol_table::alloc_scope ();
-      frame.add_fcn (symbol_table::erase_scope, local_scope);
-
-      symbol_table::set_scope (local_scope);
-
-      octave_call_stack::push (local_scope, 0);
-      frame.add_fcn (octave_call_stack::pop);
-
-      if (len > 0 && success)
-        {
-          hsize_t num_obj = 0;
-#if HAVE_HDF5_18
-          data_hid = H5Gopen (group_hid, "symbol table", H5P_DEFAULT);
-#else
-          data_hid = H5Gopen (group_hid, "symbol table");
-#endif
-          H5Gget_num_objs (data_hid, &num_obj);
-          H5Gclose (data_hid);
-
-          if (num_obj != static_cast<hsize_t>(len))
-            {
-              error ("load: failed to load anonymous function handle");
-              success = false;
-            }
-
-          if (! error_state)
-            {
-              hdf5_callback_data dsub;
-              int current_item = 0;
-              for (octave_idx_type i = 0; i < len; i++)
-                {
-                  if (H5Giterate (group_hid, "symbol table", &current_item,
-                                  hdf5_read_next_data, &dsub) <= 0)
-                    {
-                      error ("load: failed to load anonymous function handle");
-                      success = false;
-                      break;
-                    }
-
-                  symbol_table::varref (dsub.name, local_scope) = dsub.tc;
-                }
-            }
-        }
-
-      if (success)
-        {
-          int parse_status;
-          octave_value anon_fcn_handle =
-            eval_string (fcn_tmp, true, parse_status);
-
-          if (parse_status == 0)
-            {
-              octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
-
-              if (fh)
-                {
-                  fcn = fh->fcn;
-
-                  octave_user_function *uf = fcn.user_function_value (true);
-
-                  if (uf)
-                    symbol_table::cache_name (uf->scope (), nm);
-                }
-              else
-                success = false;
-            }
-          else
-            success = false;
-        }
-
-      frame.run ();
-    }
-  else
-    {
-      std::string octaveroot;
-      std::string fpath;
-
-      // we have to pull some shenanigans here to make sure
-      // HDF5 doesn't print out all sorts of error messages if we
-      // call H5Aopen for a non-existing attribute
-
-      H5E_auto_t err_func;
-      void *err_func_data;
-
-      // turn off error reporting temporarily, but save the error
-      // reporting function:
-#if HAVE_HDF5_18
-      H5Eget_auto (H5E_DEFAULT, &err_func, &err_func_data);
-      H5Eset_auto (H5E_DEFAULT, 0, 0);
-#else
-      H5Eget_auto (&err_func, &err_func_data);
-      H5Eset_auto (0, 0);
-#endif
-
-      hid_t attr_id = H5Aopen_name (group_hid, "OCTAVEROOT");
-      if (attr_id >= 0)
-        {
-          H5Tclose (type_hid);
-          type_hid = H5Aget_type (attr_id);
-          type_class_hid = H5Tget_class (type_hid);
-
-          if (type_class_hid != H5T_STRING)
-            success = false;
-          else
-            {
-              slen = H5Tget_size (type_hid);
-              st_id = H5Tcopy (H5T_C_S1);
-              H5Tset_size (st_id, slen);
-              OCTAVE_LOCAL_BUFFER (char, root_tmp, slen);
-
-              if (H5Aread (attr_id, st_id, root_tmp) < 0)
-                success = false;
-              else
-                octaveroot = root_tmp;
-
-              H5Tclose (st_id);
-            }
-
-          H5Aclose (attr_id);
-        }
-
-      if (success)
-        {
-          attr_id = H5Aopen_name (group_hid, "FILE");
-          if (attr_id >= 0)
-            {
-              H5Tclose (type_hid);
-              type_hid = H5Aget_type (attr_id);
-              type_class_hid = H5Tget_class (type_hid);
-
-              if (type_class_hid != H5T_STRING)
-                success = false;
-              else
-                {
-                  slen = H5Tget_size (type_hid);
-                  st_id = H5Tcopy (H5T_C_S1);
-                  H5Tset_size (st_id, slen);
-                  OCTAVE_LOCAL_BUFFER (char, path_tmp, slen);
-
-                  if (H5Aread (attr_id, st_id, path_tmp) < 0)
-                    success = false;
-                  else
-                    fpath = path_tmp;
-
-                  H5Tclose (st_id);
-                }
-
-              H5Aclose (attr_id);
-            }
-        }
-
-      // restore error reporting:
-#if HAVE_HDF5_18
-      H5Eset_auto (H5E_DEFAULT, err_func, err_func_data);
-#else
-      H5Eset_auto (err_func, err_func_data);
-#endif
-
-      success = (success ? set_fcn (octaveroot, fpath) : success);
-    }
-
-  H5Tclose (type_hid);
-  H5Sclose (space_hid);
-  H5Gclose (group_hid);
-
-  return success;
-}
-
-#endif
-
-/*
-%!test
-%! a = 2;
-%! f = @(x) a + x;
-%! g = @(x) 2 * x;
-%! hm = @version;
-%! hdld = @svd;
-%! hbi = @log2;
-%! f2 = f;
-%! g2 = g;
-%! hm2 = hm;
-%! hdld2 = hdld;
-%! hbi2 = hbi;
-%! modes = {"-text", "-binary"};
-%! if (!isempty (findstr (octave_config_info ("DEFS"), "HAVE_HDF5")))
-%!   modes(end+1) = "-hdf5";
-%! endif
-%! for i = 1:numel (modes)
-%!   mode = modes{i};
-%!   nm = tmpnam ();
-%!   unwind_protect
-%!     save (mode, nm, "f2", "g2", "hm2", "hdld2", "hbi2");
-%!     clear f2 g2 hm2 hdld2 hbi2
-%!     load (nm);
-%!     assert (f (2), f2 (2));
-%!     assert (g (2), g2 (2));
-%!     assert (g (3), g2 (3));
-%!     unlink (nm);
-%!     save (mode, nm, "f2", "g2", "hm2", "hdld2", "hbi2");
-%!   unwind_protect_cleanup
-%!     unlink (nm);
-%!   end_unwind_protect
-%! endfor
-*/
-
-void
-octave_fcn_handle::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-
-void
-octave_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax) const
-{
-  bool printed = false;
-
-  if (nm == anonymous)
-    {
-      tree_print_code tpc (os);
-
-      // FCN is const because this member function is, so we can't
-      // use it to call user_function_value, so we make a copy first.
-
-      octave_value ftmp = fcn;
-
-      octave_user_function *f = ftmp.user_function_value ();
-
-      if (f)
-        {
-          tree_parameter_list *p = f->parameter_list ();
-
-          os << "@(";
-
-          if (p)
-            p->accept (tpc);
-
-          os << ") ";
-
-          tpc.print_fcn_handle_body (f->body ());
-
-          printed = true;
-        }
-    }
-
-  if (! printed)
-    octave_print_internal (os, "@" + nm, pr_as_read_syntax,
-                           current_print_indent_level ());
-}
-
-octave_value
-make_fcn_handle (const std::string& nm, bool local_funcs)
-{
-  octave_value retval;
-
-  // Bow to the god of compatibility.
-
-  // FIXME -- it seems ugly to put this here, but there is no single
-  // function in the parser that converts from the operator name to
-  // the corresponding function name.  At least try to do it without N
-  // string compares.
-
-  std::string tnm = nm;
-
-  size_t len = nm.length ();
-
-  if (len == 3 && nm == ".**")
-    tnm = "power";
-  else if (len == 2)
-    {
-      if (nm[0] == '.')
-        {
-          switch (nm[1])
-            {
-            case '\'':
-              tnm = "transpose";
-              break;
-
-            case '+':
-              tnm = "plus";
-              break;
-
-            case '-':
-              tnm = "minus";
-              break;
-
-            case '*':
-              tnm = "times";
-              break;
-
-            case '/':
-              tnm = "rdivide";
-              break;
-
-            case '^':
-              tnm = "power";
-              break;
-
-            case '\\':
-              tnm = "ldivide";
-              break;
-            }
-        }
-      else if (nm[1] == '=')
-        {
-          switch (nm[0])
-            {
-            case '<':
-              tnm = "le";
-              break;
-
-            case '=':
-              tnm = "eq";
-              break;
-
-            case '>':
-              tnm = "ge";
-              break;
-
-            case '~':
-            case '!':
-              tnm = "ne";
-              break;
-            }
-        }
-      else if (nm == "**")
-        tnm = "mpower";
-    }
-  else if (len == 1)
-    {
-      switch (nm[0])
-        {
-        case '~':
-        case '!':
-          tnm = "not";
-          break;
-
-        case '\'':
-          tnm = "ctranspose";
-          break;
-
-        case '+':
-          tnm = "plus";
-          break;
-
-        case '-':
-          tnm = "minus";
-          break;
-
-        case '*':
-          tnm = "mtimes";
-          break;
-
-        case '/':
-          tnm = "mrdivide";
-          break;
-
-        case '^':
-          tnm = "mpower";
-          break;
-
-        case '\\':
-          tnm = "mldivide";
-          break;
-
-        case '<':
-          tnm = "lt";
-          break;
-
-        case '>':
-          tnm = "gt";
-          break;
-
-        case '&':
-          tnm = "and";
-          break;
-
-        case '|':
-          tnm = "or";
-          break;
-        }
-    }
-
-  octave_value f = symbol_table::find_function (tnm, octave_value_list (),
-                                                local_funcs);
-
-  octave_function *fptr = f.function_value (true);
-
-  // Here we are just looking to see if FCN is a method or constructor
-  // for any class.
-  if (local_funcs && fptr
-      && (fptr->is_subfunction () || fptr->is_private_function ()
-          || fptr->is_class_constructor ()))
-    {
-      // Locally visible function.
-      retval = octave_value (new octave_fcn_handle (f, tnm));
-    }
-  else
-    {
-      // Globally visible (or no match yet). Query overloads.
-      std::list<std::string> classes = load_path::overloads (tnm);
-      bool any_match = fptr != 0 || classes.size () > 0;
-      if (! any_match)
-        {
-          // No match found, try updating load_path and query classes again.
-          load_path::update ();
-          classes = load_path::overloads (tnm);
-          any_match = classes.size () > 0;
-        }
-
-      if (any_match)
-        {
-          octave_fcn_handle *fh = new octave_fcn_handle (f, tnm);
-          retval = fh;
-
-          for (std::list<std::string>::iterator iter = classes.begin ();
-               iter != classes.end (); iter++)
-            {
-              std::string class_name = *iter;
-              octave_value fmeth = symbol_table::find_method (tnm, class_name);
-
-              bool is_builtin = false;
-              for (int i = 0; i < btyp_num_types; i++)
-                {
-                  // FIXME: Too slow? Maybe binary lookup?
-                  if (class_name == btyp_class_name[i])
-                    {
-                      is_builtin = true;
-                      fh->set_overload (static_cast<builtin_type_t> (i), fmeth);
-                    }
-                }
-
-              if (! is_builtin)
-                fh->set_overload (class_name, fmeth);
-            }
-        }
-      else
-        error ("@%s: no function and no method found", tnm.c_str ());
-    }
-
-  return retval;
-}
-
-/*
-%!test
-%! x = {".**", "power";
-%!      ".'", "transpose";
-%!      ".+", "plus";
-%!      ".-", "minus";
-%!      ".*", "times";
-%!      "./", "rdivide";
-%!      ".^", "power";
-%!      ".\\", "ldivide";
-%!      "<=", "le";
-%!      "==", "eq";
-%!      ">=", "ge";
-%!      "~=", "ne";
-%!      "!=", "ne";
-%!      "**", "mpower";
-%!      "~", "not";
-%!      "!", "not";
-%!      "\'", "ctranspose";
-%!      "+", "plus";
-%!      "-", "minus";
-%!      "*", "mtimes";
-%!      "/", "mrdivide";
-%!      "^", "mpower";
-%!      "\\", "mldivide";
-%!      "<", "lt";
-%!      ">", "gt";
-%!      "&", "and";
-%!      "|", "or"};
-%! for i = 1:rows (x)
-%!   assert (functions (str2func (x{i,1})).function, x{i,2});
-%! endfor
-*/
-
-DEFUN (functions, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} functions (@var{fcn_handle})\n\
-Return a struct containing information about the function handle\n\
-@var{fcn_handle}.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    {
-      octave_fcn_handle *fh = args(0).fcn_handle_value ();
-
-      if (! error_state)
-        {
-          octave_function *fcn = fh ? fh->function_value () : 0;
-
-          if (fcn)
-            {
-              octave_scalar_map m;
-
-              std::string fh_nm = fh->fcn_name ();
-
-              if (fh_nm == octave_fcn_handle::anonymous)
-                {
-                  std::ostringstream buf;
-                  fh->print_raw (buf);
-                  m.setfield ("function", buf.str ());
-
-                  m.setfield ("type", "anonymous");
-                }
-              else
-                {
-                  m.setfield ("function", fh_nm);
-
-                  if (fcn->is_subfunction ())
-                    {
-                      m.setfield ("type", "subfunction");
-                      Cell parentage (dim_vector (1, 2));
-                      parentage.elem (0) = fh_nm;
-                      parentage.elem (1) = fcn->parent_fcn_name ();
-                      m.setfield ("parentage", octave_value (parentage));
-                    }
-                  else if (fcn->is_private_function ())
-                    m.setfield ("type", "private");
-                  else if (fh->is_overloaded ())
-                    m.setfield ("type", "overloaded");
-                  else
-                    m.setfield ("type", "simple");
-                }
-
-              std::string nm = fcn->fcn_file_name ();
-
-              if (fh_nm == octave_fcn_handle::anonymous)
-                {
-                  m.setfield ("file", nm);
-
-                  octave_user_function *fu = fh->user_function_value ();
-
-                  std::list<symbol_table::symbol_record> vars
-                    = symbol_table::all_variables (fu->scope (), 0);
-
-                  size_t varlen = vars.size ();
-
-                  if (varlen > 0)
-                    {
-                      octave_scalar_map ws;
-                      for (std::list<symbol_table::symbol_record>::const_iterator p = vars.begin ();
-                           p != vars.end (); p++)
-                        {
-                          ws.assign (p->name (), p->varval (0));
-                        }
-
-                      m.setfield ("workspace", ws);
-                    }
-                }
-              else if (fcn->is_user_function () || fcn->is_user_script ())
-                {
-                  octave_function *fu = fh->function_value ();
-                  m.setfield ("file", fu->fcn_file_name ());
-                }
-              else
-                m.setfield ("file", "");
-
-              retval = m;
-            }
-          else
-            error ("functions: FCN_HANDLE is not a valid function handle object");
-        }
-      else
-        error ("functions: FCN_HANDLE argument must be a function handle object");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (func2str, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} func2str (@var{fcn_handle})\n\
-Return a string containing the name of the function referenced by\n\
-the function handle @var{fcn_handle}.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    {
-      octave_fcn_handle *fh = args(0).fcn_handle_value ();
-
-      if (! error_state && fh)
-        {
-          std::string fh_nm = fh->fcn_name ();
-
-          if (fh_nm == octave_fcn_handle::anonymous)
-            {
-              std::ostringstream buf;
-
-              fh->print_raw (buf);
-
-              retval = buf.str ();
-            }
-          else
-            retval = fh_nm;
-        }
-      else
-        error ("func2str: FCN_HANDLE must be a valid function handle");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (str2func, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} str2func (@var{fcn_name})\n\
-@deftypefnx {Built-in Function} {} str2func (@var{fcn_name}, \"global\")\n\
-Return a function handle constructed from the string @var{fcn_name}.\n\
-If the optional \"global\" argument is passed, locally visible functions\n\
-are ignored in the lookup.\n\
-@end deftypefn")
-{
-  octave_value retval;
-  int nargin = args.length ();
-
-  if (nargin == 1 || nargin == 2)
-    {
-      std::string nm = args(0).string_value ();
-
-      if (! error_state)
-        retval = make_fcn_handle (nm, nargin != 2);
-      else
-        error ("str2func: FCN_NAME must be a string");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!function y = __testrecursionfunc (f, x, n)
-%!  if (nargin < 3)
-%!    n = 0;
-%!  endif
-%!  if (n > 2)
-%!    y = f (x);
-%!  else
-%!    n++;
-%!    y = __testrecursionfunc (@(x) f (2*x), x, n);
-%!  endif
-%!endfunction
-%!
-%!assert (__testrecursionfunc (@(x) x, 1), 8)
-*/
-
-DEFUN (is_function_handle, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} is_function_handle (@var{x})\n\
-Return true if @var{x} is a function handle.\n\
-@seealso{isa, typeinfo, class}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    retval = args(0).is_function_handle ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!shared fh
-%! fh = @(x) x;
-
-%!assert (is_function_handle (fh))
-%!assert (! is_function_handle ({fh}))
-%!assert (! is_function_handle (1))
-
-%!error is_function_handle ()
-%!error is_function_handle (1, 2)
-*/
-
-octave_fcn_binder::octave_fcn_binder (const octave_value& f,
-                                      const octave_value& root,
-                                      const octave_value_list& templ,
-                                      const std::vector<int>& mask,
-                                      int exp_nargin)
-: octave_fcn_handle (f), root_handle (root), arg_template (templ),
-  arg_mask (mask), expected_nargin (exp_nargin)
-{
-}
-
-octave_fcn_handle *
-octave_fcn_binder::maybe_binder (const octave_value& f)
-{
-  octave_fcn_handle *retval = 0;
-
-  octave_user_function *usr_fcn = f.user_function_value (false);
-  tree_parameter_list *param_list = usr_fcn ? usr_fcn->parameter_list () : 0;
-
-  // Verify that the body is a single expression (always true in theory).
-
-  tree_statement_list *cmd_list = usr_fcn ? usr_fcn->body () : 0;
-  tree_expression *body_expr = (cmd_list->length () == 1
-                                ? cmd_list->front ()->expression () : 0);
-
-
-  if (body_expr && body_expr->is_index_expression ()
-      && ! (param_list && param_list->takes_varargs ()))
-    {
-      // It's an index expression.
-      tree_index_expression *idx_expr = dynamic_cast<tree_index_expression *> (body_expr);
-      tree_expression *head_expr = idx_expr->expression ();
-      std::list<tree_argument_list *> arg_lists = idx_expr->arg_lists ();
-      std::string type_tags = idx_expr->type_tags ();
-
-      if (type_tags.length () == 1 && type_tags[0] == '('
-          && head_expr->is_identifier ())
-        {
-          assert (arg_lists.size () == 1);
-
-          // It's a single index expression: a(x,y,....)
-          tree_identifier *head_id = dynamic_cast<tree_identifier *> (head_expr);
-          tree_argument_list *arg_list = arg_lists.front ();
-
-          // Build a map of input params to their position.
-          std::map<std::string, int> arginmap;
-          int npar = 0;
-
-          if (param_list)
-            {
-              for (tree_parameter_list::iterator it = param_list->begin ();
-                   it != param_list->end (); ++it, ++npar)
-                {
-                  tree_decl_elt *elt = *it;
-                  tree_identifier *id = elt ? elt->ident () : 0;
-                  if (id && ! id->is_black_hole ())
-                     arginmap[id->name ()] = npar;
-                }
-            }
-
-          if (arg_list && arg_list->length () > 0)
-            {
-              bool bad = false;
-              int nargs = arg_list->length ();
-              octave_value_list arg_template (nargs);
-              std::vector<int> arg_mask (nargs);
-
-              // Verify that each argument is either a named param, a constant, or a defined identifier.
-              int iarg = 0;
-              for (tree_argument_list::iterator it = arg_list->begin ();
-                   it != arg_list->end (); ++it, ++iarg)
-                {
-                  tree_expression *elt = *it;
-                  if (elt && elt->is_constant ())
-                    {
-                      arg_template(iarg) = elt->rvalue1 ();
-                      arg_mask[iarg] = -1;
-                    }
-                  else if (elt && elt->is_identifier ())
-                    {
-                      tree_identifier *elt_id = dynamic_cast<tree_identifier *> (elt);
-                      if (arginmap.find (elt_id->name ()) != arginmap.end ())
-                        {
-                          arg_mask[iarg] = arginmap[elt_id->name ()];
-                        }
-                      else if (elt_id->is_defined ())
-                        {
-                          arg_template(iarg) = elt_id->rvalue1 ();
-                          arg_mask[iarg] = -1;
-                        }
-                      else
-                        {
-                          bad = true;
-                          break;
-                        }
-                    }
-                  else
-                    {
-                      bad = true;
-                      break;
-                    }
-                }
-
-              octave_value root_val;
-
-              if (! bad)
-                {
-                  // If the head is a value, use it as root.
-                  if (head_id->is_defined ())
-                     root_val = head_id->rvalue1 ();
-                  else
-                    {
-                      // It's a name.
-                      std::string head_name = head_id->name ();
-                      // Function handles can't handle legacy dispatch, so
-                      // we make sure it's not defined.
-                      if (symbol_table::get_dispatch (head_name).size () > 0)
-                         bad = true;
-                      else
-                        {
-                          // Simulate try/catch.
-                          unwind_protect frame;
-                          interpreter_try (frame);
-
-                          root_val = make_fcn_handle (head_name);
-                          if (error_state)
-                             bad = true;
-                        }
-                    }
-                }
-
-              if (! bad)
-                {
-                  // Stash proper name tags.
-                  std::list<string_vector> arg_names = idx_expr->arg_names ();
-                  assert (arg_names.size () == 1);
-                  arg_template.stash_name_tags (arg_names.front ());
-
-                  retval = new octave_fcn_binder (f, root_val, arg_template,
-                                                  arg_mask, npar);
-                }
-            }
-        }
-    }
-
-  if (! retval)
-     retval = new octave_fcn_handle (f, octave_fcn_handle::anonymous);
-
-  return retval;
-}
-
-octave_value_list
-octave_fcn_binder::do_multi_index_op (int nargout,
-                                      const octave_value_list& args)
-{
-  return do_multi_index_op (nargout, args, 0);
-}
-
-octave_value_list
-octave_fcn_binder::do_multi_index_op (int nargout,
-                                      const octave_value_list& args,
-                                      const std::list<octave_lvalue>* lvalue_list)
-{
-  octave_value_list retval;
-
-  if (args.length () == expected_nargin)
-    {
-      for (int i = 0; i < arg_template.length (); i++)
-        {
-          int j = arg_mask[i];
-          if (j >= 0)
-             arg_template(i) = args(j); // May force a copy...
-        }
-
-      // Make a shallow copy of arg_template, to ensure consistency throughout the following
-      // call even if we happen to get back here.
-      octave_value_list tmp (arg_template);
-      retval = root_handle.do_multi_index_op (nargout, tmp, lvalue_list);
-    }
-  else
-     retval = octave_fcn_handle::do_multi_index_op (nargout, args, lvalue_list);
-
-  return retval;
-}
-
-/*
-%!function r = __f (g, i)
-%!  r = g(i);
-%!endfunction
-%!test
-%! x = [1,2;3,4];
-%! assert (__f (@(i) x(:,i), 1), [1;3]);
-*/
--- a/src/ov-fcn-handle.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-/*
-
-Copyright (C) 2003-2012 John W. Eaton
-Copyright (C) 2009 VZLU Prague
-
-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_fcn_handle_h)
-#define octave_fcn_handle_h 1
-
-#include <iosfwd>
-#include <string>
-#include <memory>
-
-#include "oct-alloc.h"
-
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-fcn.h"
-#include "ov-typeinfo.h"
-
-// Function handles.
-
-class
-OCTINTERP_API
-octave_fcn_handle : public octave_base_value
-{
-private:
-
-  typedef std::map<std::string, octave_value> str_ov_map;
-
-public:
-
-  static const std::string anonymous;
-
-  octave_fcn_handle (void)
-    : fcn (), nm (), has_overloads (false), overloads () { }
-
-  octave_fcn_handle (const std::string& n)
-    : fcn (), nm (n), has_overloads (false), overloads () { }
-
-  octave_fcn_handle (const octave_value& f,  const std::string& n = anonymous);
-
-  octave_fcn_handle (const octave_fcn_handle& fh)
-    : octave_base_value (fh), fcn (fh.fcn), nm (fh.nm),
-    has_overloads (fh.has_overloads), overloads ()
-   {
-     for (int i = 0; i < btyp_num_types; i++)
-       builtin_overloads[i] = fh.builtin_overloads[i];
-
-     overloads = fh.overloads;
-   }
-
-  ~octave_fcn_handle (void) { }
-
-  octave_base_value *clone (void) const { return new octave_fcn_handle (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_fcn_handle (); }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    {
-      octave_value_list tmp = subsref (type, idx, 1);
-      return tmp.length () > 0 ? tmp(0) : octave_value ();
-    }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout, const std::list<octave_lvalue>* lvalue_list);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args,
-                     const std::list<octave_lvalue>* lvalue_list);
-
-  bool is_defined (void) const { return true; }
-
-  bool is_function_handle (void) const { return true; }
-
-  builtin_type_t builtin_type (void) const { return btyp_func_handle; }
-
-  bool is_overloaded (void) const { return has_overloads; }
-
-  dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; }
-
-  octave_function *function_value (bool = false)
-    { return fcn.function_value (); }
-
-  octave_user_function *user_function_value (bool = false)
-    { return fcn.user_function_value (); }
-
-  octave_fcn_handle *fcn_handle_value (bool = false) { return this; }
-
-  octave_value fcn_val (void) const { return fcn; }
-
-  std::string fcn_name (void) const { return nm; }
-
-  void set_overload (builtin_type_t btyp, const octave_value& ov_fcn)
-    {
-      if (btyp != btyp_unknown)
-        {
-          has_overloads = true;
-          builtin_overloads[btyp] = ov_fcn;
-        }
-
-    }
-
-  void set_overload (const std::string& dispatch_type, const octave_value& ov_fcn)
-    {
-      has_overloads = true;
-      overloads[dispatch_type] = ov_fcn;
-    }
-
-  bool is_equal_to (const octave_fcn_handle&) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  // Simple function handles are printed without a newline.
-  bool print_as_scalar (void) const { return nm != anonymous; }
-
-private:
-
-  bool set_fcn (const std::string &octaveroot, const std::string& fpath);
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-
-protected:
-
-  // The function we are handling.
-  octave_value fcn;
-
-  // The name of the handle, including the "@".
-  std::string nm;
-
-  // Whether the function is overloaded at all.
-  bool has_overloads;
-
-  // Overloads for builtin types. We use array to make lookup faster.
-  octave_value builtin_overloads[btyp_num_types];
-
-  // Overloads for other classes.
-  str_ov_map overloads;
-
-  friend octave_value make_fcn_handle (const std::string &, bool);
-};
-
-extern octave_value make_fcn_handle (const std::string& nm,
-                                     bool local_funcs = true);
-
-class
-OCTINTERP_API
-octave_fcn_binder : public octave_fcn_handle
-{
-private:
-  // Private ctor.
-  octave_fcn_binder (const octave_value& f, const octave_value& root,
-                     const octave_value_list& templ,
-                     const std::vector<int>& mask, int exp_nargin);
-
-public:
-
-  // Factory method.
-  static octave_fcn_handle *maybe_binder (const octave_value& f);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args,
-                     const std::list<octave_lvalue>* lvalue_list);
-
-protected:
-
-  octave_value root_handle;
-  octave_value_list arg_template;
-  std::vector<int> arg_mask;
-  int expected_nargin;
-};
-#endif
--- a/src/ov-fcn-inline.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1019 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-In addition to the terms of the GPL, you are permitted to link
-this program with any Open Source program, as defined by the
-Open Source Initiative (www.opensource.org)
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <istream>
-#include <iostream>
-#include <sstream>
-#include <vector>
-
-#include "oct-locbuf.h"
-
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "oct-map.h"
-#include "ov-base.h"
-#include "ov-fcn-inline.h"
-#include "ov-usr-fcn.h"
-#include "pr-output.h"
-#include "variables.h"
-#include "parse.h"
-#include "toplev.h"
-
-#include "byte-swap.h"
-#include "ls-ascii-helper.h"
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-#include "ls-utils.h"
-
-DEFINE_OCTAVE_ALLOCATOR (octave_fcn_inline);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_fcn_inline,
-                                     "inline function",
-                                     "function_handle");
-
-octave_fcn_inline::octave_fcn_inline (const std::string& f,
-                                      const string_vector& a,
-                                      const std::string& n)
-  : octave_fcn_handle (n), iftext (f), ifargs (a)
-{
-  // Form a string representing the function.
-
-  std::ostringstream buf;
-
-  buf << "@(";
-
-  for (int i = 0; i < ifargs.length (); i++)
-    {
-      if (i > 0)
-        buf << ", ";
-
-      buf << ifargs(i);
-    }
-
-  buf << ") " << iftext;
-
-  int parse_status;
-  octave_value anon_fcn_handle = eval_string (buf.str (), true, parse_status);
-
-  if (parse_status == 0)
-    {
-      octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value ();
-
-      if (fh)
-        {
-          fcn = fh->fcn_val ();
-
-          octave_user_function *uf = fcn.user_function_value ();
-
-          if (uf)
-            {
-              octave_function *curr_fcn = octave_call_stack::current ();
-
-              if (curr_fcn)
-                {
-                  symbol_table::scope_id parent_scope
-                    = curr_fcn->parent_fcn_scope ();
-
-                  if (parent_scope < 0)
-                    parent_scope = curr_fcn->scope ();
-
-                  uf->stash_parent_fcn_scope (parent_scope);
-                }
-            }
-        }
-    }
-
-  if (fcn.is_undefined ())
-    error ("inline: unable to define function");
-}
-
-// This function is supplied to allow a Matlab style class structure
-// to be returned..
-octave_map
-octave_fcn_inline::map_value (void) const
-{
-  octave_scalar_map m;
-
-  m.assign ("version", 1.0);
-  m.assign ("isEmpty", 0.0);
-  m.assign ("expr", fcn_text ());
-
-  string_vector args = fcn_arg_names ();
-
-  m.assign ("numArgs", args.length ());
-  m.assign ("args", args);
-
-  std::ostringstream buf;
-
-  for (int i = 0; i < args.length (); i++)
-    buf << args(i) << " = INLINE_INPUTS_{" << i + 1 << "}; ";
-
-  m.assign ("inputExpr", buf.str ());
-
-  return m;
-}
-
-bool
-octave_fcn_inline::save_ascii (std::ostream& os)
-{
-  os << "# nargs: " <<  ifargs.length () << "\n";
-  for (int i = 0; i < ifargs.length (); i++)
-    os << ifargs(i) << "\n";
-  if (nm.length () < 1)
-    // Write an invalid value to flag empty fcn handle name.
-    os << "0\n";
-  else
-    os << nm << "\n";
-  os << iftext << "\n";
-  return true;
-}
-
-bool
-octave_fcn_inline::load_ascii (std::istream& is)
-{
-  int nargs;
-  if (extract_keyword (is, "nargs", nargs, true))
-    {
-      ifargs.resize (nargs);
-      for (int i = 0; i < nargs; i++)
-        is >> ifargs(i);
-      is >> nm;
-      if (nm == "0")
-        nm = "";
-
-      skip_preceeding_newline (is);
-
-      std::string buf;
-
-      if (is)
-        {
-
-          // Get a line of text whitespace characters included,
-          // leaving newline in the stream.
-          buf = read_until_newline (is, true);
-        }
-
-      iftext = buf;
-
-      octave_fcn_inline tmp (iftext, ifargs, nm);
-      fcn = tmp.fcn;
-
-      return true;
-    }
-  else
-    return false;
-}
-
-bool
-octave_fcn_inline::save_binary (std::ostream& os, bool&)
-{
-  int32_t tmp = ifargs.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i = 0; i < ifargs.length (); i++)
-    {
-      tmp = ifargs(i).length ();
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-      os.write (ifargs(i).c_str (), ifargs(i).length ());
-    }
-  tmp = nm.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  os.write (nm.c_str (), nm.length ());
-  tmp = iftext.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  os.write (iftext.c_str (), iftext.length ());
-  return true;
-}
-
-bool
-octave_fcn_inline::load_binary (std::istream& is, bool swap,
-                                oct_mach_info::float_format)
-{
-  int32_t nargs;
-  if (! is.read (reinterpret_cast<char *> (&nargs), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&nargs);
-
-  if (nargs < 1)
-    return false;
-  else
-    {
-      int32_t tmp;
-      ifargs.resize (nargs);
-      for (int i = 0; i < nargs; i++)
-        {
-          if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-            return false;
-          if (swap)
-            swap_bytes<4> (&tmp);
-
-          OCTAVE_LOCAL_BUFFER (char, ctmp, tmp+1);
-          is.read (ctmp, tmp);
-          ifargs(i) = std::string (ctmp);
-
-          if (! is)
-            return false;
-        }
-
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-
-      OCTAVE_LOCAL_BUFFER (char, ctmp1, tmp+1);
-      is.read (ctmp1, tmp);
-      nm = std::string (ctmp1);
-
-      if (! is)
-        return false;
-
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-
-      OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1);
-      is.read (ctmp2, tmp);
-      iftext = std::string (ctmp2);
-
-      if (! is)
-        return false;
-
-      octave_fcn_inline ftmp (iftext, ifargs, nm);
-      fcn = ftmp.fcn;
-    }
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-bool
-octave_fcn_inline::save_hdf5 (hid_t loc_id, const char *name,
-                              bool /* save_as_floats */)
-{
-  hid_t group_hid = -1;
-#if HAVE_HDF5_18
-  group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  group_hid = H5Gcreate (loc_id, name, 0);
-#endif
-  if (group_hid < 0 ) return false;
-
-  size_t len = 0;
-  for (int i = 0; i < ifargs.length (); i++)
-    if (len < ifargs(i).length ())
-      len = ifargs(i).length ();
-
-  hid_t space_hid = -1, data_hid = -1, type_hid = -1;;
-  bool retval = true;
-
-  // FIXME Is there a better way of saving string vectors, than a
-  // null padded matrix?
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, 2);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  hdims[1] = ifargs.length ();
-  hdims[0] = len + 1;
-
-  space_hid = H5Screate_simple (2, hdims, 0);
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "args", H5T_NATIVE_CHAR, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "args", H5T_NATIVE_CHAR, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (char, s, ifargs.length () * (len + 1));
-
-  // Save the args as a null teminated list
-  for (int i = 0; i < ifargs.length (); i++)
-    {
-      const char * cptr = ifargs(i).c_str ();
-      for (size_t j = 0; j < ifargs(i).length (); j++)
-        s[i*(len+1)+j] = *cptr++;
-      s[ifargs(i).length ()] = '\0';
-    }
-
-  retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, s) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  if (!retval)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  // attach the type of the variable
-  type_hid = H5Tcopy (H5T_C_S1);
-  H5Tset_size (type_hid, nm.length () + 1);
-  if (type_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  hdims[0] = 0;
-  space_hid = H5Screate_simple (0 , hdims, 0);
-  if (space_hid < 0)
-    {
-      H5Tclose (type_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid, H5P_DEFAULT);
-#endif
-  if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
-                                H5P_DEFAULT, nm.c_str ()) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-  H5Dclose (data_hid);
-
-  // attach the type of the variable
-  H5Tset_size (type_hid, iftext.length () + 1);
-  if (type_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "iftext",  type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "iftext",  type_hid, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
-                                H5P_DEFAULT, iftext.c_str ()) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-  H5Tclose (type_hid);
-  H5Gclose (group_hid);
-
-  return retval;
-}
-
-bool
-octave_fcn_inline::load_hdf5 (hid_t loc_id, const char *name)
-{
-  hid_t group_hid, data_hid, space_hid, type_hid, type_class_hid, st_id;
-  hsize_t rank;
-  int slen;
-
-#if HAVE_HDF5_18
-  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  group_hid = H5Gopen (loc_id, name);
-#endif
-  if (group_hid < 0 ) return false;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "args", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "args");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Dclose (data_hid);
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  ifargs.resize (hdims[1]);
-
-  OCTAVE_LOCAL_BUFFER (char, s1, hdims[0] * hdims[1]);
-
-  if (H5Dread (data_hid, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, s1) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  for (size_t i = 0; i < hdims[1]; i++)
-    ifargs(i) = std::string (s1 + i*hdims[0]);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nm", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nm");
-#endif
-
-  if (data_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  type_hid = H5Dget_type (data_hid);
-  type_class_hid = H5Tget_class (type_hid);
-
-  if (type_class_hid != H5T_STRING)
-    {
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  slen = H5Tget_size (type_hid);
-  if (slen < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (char, nm_tmp, slen);
-
-  // create datatype for (null-terminated) string to read into:
-  st_id = H5Tcopy (H5T_C_S1);
-  H5Tset_size (st_id, slen);
-
-  if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, nm_tmp) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-  H5Tclose (st_id);
-  H5Dclose (data_hid);
-  nm = nm_tmp;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "iftext", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "iftext");
-#endif
-
-  if (data_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  type_hid = H5Dget_type (data_hid);
-  type_class_hid = H5Tget_class (type_hid);
-
-  if (type_class_hid != H5T_STRING)
-    {
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  slen = H5Tget_size (type_hid);
-  if (slen < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (char, iftext_tmp, slen);
-
-  // create datatype for (null-terminated) string to read into:
-  st_id = H5Tcopy (H5T_C_S1);
-  H5Tset_size (st_id, slen);
-
-  if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, iftext_tmp) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-  H5Tclose (st_id);
-  H5Dclose (data_hid);
-  iftext = iftext_tmp;
-
-  octave_fcn_inline ftmp (iftext, ifargs, nm);
-  fcn = ftmp.fcn;
-
-  return true;
-}
-#endif
-
-void
-octave_fcn_inline::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-
-void
-octave_fcn_inline::print_raw (std::ostream& os, bool pr_as_read_syntax) const
-{
-  std::ostringstream buf;
-
-  if (nm.empty ())
-    buf << "f(";
-  else
-    buf << nm << "(";
-
-  for (int i = 0; i < ifargs.length (); i++)
-    {
-      if (i)
-        buf << ", ";
-
-      buf << ifargs(i);
-    }
-
-  buf << ") = " << iftext;
-
-  octave_print_internal (os, buf.str (), pr_as_read_syntax,
-                         current_print_indent_level ());
-}
-
-octave_value
-octave_fcn_inline::convert_to_str_internal (bool, bool, char type) const
-{
-  return octave_value (fcn_text (), type);
-}
-
-DEFUNX ("inline", Finline, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} inline (@var{str})\n\
-@deftypefnx {Built-in Function} {} inline (@var{str}, @var{arg1}, @dots{})\n\
-@deftypefnx {Built-in Function} {} inline (@var{str}, @var{n})\n\
-Create an inline function from the character string @var{str}.\n\
-If called with a single argument, the arguments of the generated\n\
-function are extracted from the function itself.  The generated\n\
-function arguments will then be in alphabetical order.  It should\n\
-be noted that i, and j are ignored as arguments due to the\n\
-ambiguity between their use as a variable or their use as an inbuilt\n\
-constant.  All arguments followed by a parenthesis are considered\n\
-to be functions.\n\
-\n\
-If the second and subsequent arguments are character strings,\n\
-they are the names of the arguments of the function.\n\
-\n\
-If the second argument is an integer @var{n}, the arguments are\n\
-@code{\"x\"}, @code{\"P1\"}, @dots{}, @code{\"P@var{N}\"}.\n\
-@seealso{argnames, formula, vectorize}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin > 0)
-    {
-      if (args(0).is_string ())
-        {
-          std::string fun = args(0).string_value ();
-          string_vector fargs;
-
-          if (nargin == 1)
-            {
-              bool is_arg = false;
-              bool in_string = false;
-              std::string tmp_arg;
-              size_t i = 0;
-              size_t fun_length = fun.length ();
-
-              while (i < fun_length)
-                {
-                  bool terminate_arg = false;
-                  char c = fun[i++];
-
-                  if (in_string)
-                    {
-                      if (c == '\'' || c == '\"')
-                        in_string = false;
-                    }
-                  else if (c == '\'' || c == '\"')
-                    {
-                      in_string = true;
-                      if (is_arg)
-                        terminate_arg = true;
-                    }
-                  else if (! isalpha (c) && c != '_')
-                    if (! is_arg)
-                      continue;
-                    else if (isdigit (c))
-                      tmp_arg.append (1, c);
-                    else
-                      {
-                        // Before we do anything remove trailing whitespaces.
-                        while (i < fun_length && isspace (c))
-                          c = fun[i++];
-
-                        // Do we have a variable or a function?
-                        if (c != '(')
-                          terminate_arg = true;
-                        else
-                          {
-                            tmp_arg = std::string ();
-                            is_arg = false;
-                          }
-                      }
-                  else if (! is_arg)
-                    {
-                      if (c == 'e' || c == 'E')
-                        {
-                          // possible number in exponent form, not arg
-                          if (isdigit (fun[i])
-                              || fun[i] == '-' || fun[i] == '+')
-                            continue;
-                        }
-                      is_arg = true;
-                      tmp_arg.append (1, c);
-                    }
-                  else
-                    {
-                      tmp_arg.append (1, c);
-                    }
-
-                  if (terminate_arg || (i == fun_length && is_arg))
-                    {
-                      bool have_arg = false;
-
-                      for (int j = 0; j < fargs.length (); j++)
-                        if (tmp_arg == fargs (j))
-                          {
-                            have_arg = true;
-                            break;
-                          }
-
-                      if (! have_arg && tmp_arg != "i" && tmp_arg != "j" &&
-                          tmp_arg != "NaN" && tmp_arg != "nan" &&
-                          tmp_arg != "Inf" && tmp_arg != "inf" &&
-                          tmp_arg != "NA" && tmp_arg != "pi" &&
-                          tmp_arg != "e" && tmp_arg != "eps")
-                        fargs.append (tmp_arg);
-
-                      tmp_arg = std::string ();
-                      is_arg = false;
-                    }
-                }
-
-              // Sort the arguments into ascii order.
-              fargs.sort ();
-            }
-          else if (nargin == 2 && args(1).is_numeric_type ())
-            {
-              if (! args(1).is_scalar_type ()) 
-                {
-                  error ("inline: N must be an integer");
-                  return retval;
-                }
-              
-              int n = args(1).int_value ();
-
-              if (! error_state)
-                {
-                  if (n >= 0)
-                    {
-                      fargs.resize (n+1);
-
-                      fargs(0) = "x";
-
-                      for (int i = 1; i < n+1; i++)
-                        {
-                          std::ostringstream buf;
-                          buf << "P" << i;
-                          fargs(i) = buf.str ();
-                        }
-                    }
-                  else
-                    {
-                      error ("inline: N must be a positive integer or zero");
-                      return retval;
-                    }
-                }
-              else
-                {
-                  error ("inline: N must be an integer");
-                  return retval;
-                }
-            }
-          else
-            {
-              fargs.resize (nargin - 1);
-
-              for (int i = 1; i < nargin; i++)
-                {
-                  if (args(i).is_string ())
-                    {
-                      std::string s = args(i).string_value ();
-                      fargs(i-1) = s;
-                    }
-                    else
-                    {
-                      error ("inline: expecting string arguments");
-                      return retval;
-                    }
-                }
-            }
-
-          retval = octave_value (new octave_fcn_inline (fun, fargs));
-        }
-      else
-        error ("inline: STR argument must be a string");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!shared fn
-%! fn = inline ("x.^2 + 1");
-%!assert (feval (fn, 6), 37)
-%!assert (fn (6), 37)
-## FIXME: Need tests for other 2 calling forms of inline()
-
-## Test input validation 
-%!error inline ()
-%!error <STR argument must be a string> inline (1)
-%!error <N must be an integer> inline ("2", ones (2,2))
-%!error <N must be a positive integer> inline ("2", -1)
-%!error <expecting string arguments> inline ("2", "x", -1, "y")
-*/
-
-DEFUN (formula, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} formula (@var{fun})\n\
-Return a character string representing the inline function @var{fun}.\n\
-Note that @code{char (@var{fun})} is equivalent to\n\
-@code{formula (@var{fun})}.\n\
-@seealso{argnames, inline, vectorize}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    {
-      octave_fcn_inline* fn = args(0).fcn_inline_value (true);
-
-      if (fn)
-        retval = octave_value (fn->fcn_text ());
-      else
-        error ("formula: FUN must be an inline function");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!assert (formula (fn), "x.^2 + 1")
-%!assert (formula (fn), char (fn))
-
-## Test input validation
-%!error formula ()
-%!error formula (1, 2)
-%!error <FUN must be an inline function> formula (1)
-*/
-
-DEFUN (argnames, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} argnames (@var{fun})\n\
-Return a cell array of character strings containing the names of\n\
-the arguments of the inline function @var{fun}.\n\
-@seealso{inline, formula, vectorize}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    {
-      octave_fcn_inline *fn = args(0).fcn_inline_value (true);
-
-      if (fn)
-        {
-          string_vector t1 = fn->fcn_arg_names ();
-
-          Cell t2 (dim_vector (t1.length (), 1));
-
-          for (int i = 0; i < t1.length (); i++)
-            t2(i) = t1(i);
-
-          retval = t2;
-        }
-      else
-        error ("argnames: FUN must be an inline function");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!assert (argnames (fn), {"x"})
-%!assert (argnames (inline ("1e-3*y + 2e4*z")), {"y"; "z"})
-%!assert (argnames (inline ("2", 2)), {"x"; "P1"; "P2"})
-
-## Test input validation
-%!error argnames ()
-%!error argnames (1, 2)
-%!error <FUN must be an inline function> argnames (1)
-*/
-
-DEFUN (vectorize, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} vectorize (@var{fun})\n\
-Create a vectorized version of the inline function @var{fun}\n\
-by replacing all occurrences of @code{*}, @code{/}, etc., with\n\
-@code{.*}, @code{./}, etc.\n\
-\n\
-This may be useful, for example, when using inline functions with\n\
-numerical integration or optimization where a vector-valued function\n\
-is expected.\n\
-\n\
-@example\n\
-@group\n\
-fcn = vectorize (inline (\"x^2 - 1\"))\n\
-   @result{} fcn = f(x) = x.^2 - 1\n\
-quadv (fcn, 0, 3)\n\
-   @result{} 6\n\
-@end group\n\
-@end example\n\
-@seealso{inline, formula, argnames}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    {
-      std::string old_func;
-      octave_fcn_inline* old = 0;
-      bool func_is_string = true;
-
-      if (args(0).is_string ())
-        old_func = args(0).string_value ();
-      else
-        {
-          old = args(0).fcn_inline_value (true);
-          func_is_string = false;
-
-          if (old)
-            old_func = old->fcn_text ();
-          else
-            error ("vectorize: FUN must be a string or inline function");
-        }
-
-      if (! error_state)
-        {
-          std::string new_func;
-          size_t i = 0;
-
-          while (i < old_func.length ())
-            {
-              std::string t1 = old_func.substr (i, 1);
-
-              if (t1 == "*" || t1 == "/" || t1 == "\\" || t1 == "^")
-                {
-                  if (i && old_func.substr (i-1, 1) != ".")
-                    new_func.append (".");
-
-                  // Special case for ** operator.
-                  if (t1 == "*" && i < (old_func.length () - 1)
-                      && old_func.substr (i+1, 1) == "*")
-                    {
-                      new_func.append ("*");
-                      i++;
-                    }
-                }
-              new_func.append (t1);
-              i++;
-            }
-
-          if (func_is_string)
-            retval = octave_value (new_func);
-          else
-            retval = octave_value (new octave_fcn_inline
-                                   (new_func, old->fcn_arg_names ()));
-        }
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!assert (char (vectorize (fn)), "x.^2 + 1")
-%!assert (char (vectorize (inline ("1e-3*y + 2e4*z"))), "1e-3.*y + 2e4.*z")
-%!assert (char (vectorize (inline ("2**x^5"))), "2.**x.^5")
-%!assert (vectorize ("x.^2 + 1"), "x.^2 + 1")
-%!assert (vectorize ("1e-3*y + 2e4*z"), "1e-3.*y + 2e4.*z")
-%!assert (vectorize ("2**x^5"), "2.**x.^5")
-
-## Test input validation
-%!error vectorize ()
-%!error vectorize (1, 2)
-%!error <FUN must be a string or inline function> vectorize (1)
-*/
--- a/src/ov-fcn-inline.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_fcn_inline_h)
-#define octave_fcn_inline_h 1
-
-#include <iosfwd>
-#include <string>
-
-#include "oct-alloc.h"
-
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-fcn.h"
-#include "ov-typeinfo.h"
-#include "symtab.h"
-#include "ov-fcn-handle.h"
-
-// Inline functions.
-
-class
-OCTINTERP_API
-octave_fcn_inline : public octave_fcn_handle
-{
-public:
-
-  octave_fcn_inline (void)
-    : octave_fcn_handle (), iftext (), ifargs () { }
-
-  octave_fcn_inline (const std::string& f, const string_vector& a,
-                     const std::string& n = std::string ());
-
-  octave_fcn_inline (const octave_fcn_inline& fi)
-    : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { }
-
-  ~octave_fcn_inline (void) { }
-
-  octave_base_value *clone (void) const { return new octave_fcn_inline (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_fcn_inline (); }
-
-  bool is_inline_function (void) const { return true; }
-
-  octave_fcn_inline *fcn_inline_value (bool = false) { return this; }
-
-  std::string fcn_text (void) const { return iftext; }
-
-  string_vector fcn_arg_names (void) const { return ifargs; }
-
-  octave_value convert_to_str_internal (bool, bool, char) const;
-
-  octave_map map_value (void) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-
-  // The expression of an inline function.
-  std::string iftext;
-
-  // The args of an inline function.
-  string_vector ifargs;
-};
-
-#endif
--- a/src/ov-fcn.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "oct-obj.h"
-#include "ov-fcn.h"
-
-DEFINE_OCTAVE_ALLOCATOR (octave_function);
-
-octave_base_value *
-octave_function::clone (void) const
-{
-  panic_impossible ();
-  return 0;
-}
-
-octave_base_value *
-octave_function::empty_clone (void) const
-{
-  panic_impossible ();
-  return 0;
-}
--- a/src/ov-fcn.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_function_h)
-#define octave_function_h 1
-
-#include <string>
-
-#include "oct-time.h"
-#include "str-vec.h"
-
-#include "oct-alloc.h"
-#include "oct-obj.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-#include "symtab.h"
-
-class tree_walker;
-
-// Functions.
-
-class
-OCTINTERP_API
-octave_function : public octave_base_value
-{
-public:
-
-  octave_function (void)
-    : relative (false), locked (false), private_function (false),
-      xdispatch_class (), my_name (), my_dir_name (), doc () { }
-
-  ~octave_function (void) { }
-
-  octave_base_value *clone (void) const;
-  octave_base_value *empty_clone (void) const;
-
-  bool is_defined (void) const { return true; }
-
-  bool is_function (void) const { return true; }
-
-  virtual bool is_system_fcn_file (void) const { return false; }
-
-  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 (); }
-
-  virtual std::string parent_fcn_name (void) const { return std::string (); }
-
-  virtual symbol_table::scope_id parent_fcn_scope (void) const { return -1; }
-
-  virtual void mark_fcn_file_up_to_date (const octave_time&) { }
-
-  virtual symbol_table::scope_id scope (void) { return -1; }
-
-  virtual octave_time time_parsed (void) const
-    { return octave_time (static_cast<time_t> (0)); }
-
-  virtual octave_time time_checked (void) const
-    { return octave_time (static_cast<time_t> (0)); }
-
-  virtual bool is_subfunction (void) const { return false; }
-
-  virtual bool is_class_constructor (const std::string& = std::string ()) const
-    { return false; }
-
-  virtual bool is_class_method (const std::string& = std::string ()) const
-    { return false; }
-
-  virtual bool takes_varargs (void) const { return false; }
-
-  virtual bool takes_var_return (void) const { return false; }
-
-  void stash_dispatch_class (const std::string& nm) { xdispatch_class = nm; }
-
-  std::string dispatch_class (void) const { return xdispatch_class; }
-
-  virtual void
-  mark_as_private_function (const std::string& cname = std::string ())
-  {
-    private_function = true;
-    xdispatch_class = cname;
-  }
-
-  bool is_private_function (void) const { return private_function; }
-
-  bool is_private_function_of_class (const std::string& nm) const
-    { return private_function && xdispatch_class == nm; }
-
-  virtual bool
-  is_anonymous_function_of_class (const std::string& = std::string ()) const
-    { return false; }
-
-  std::string dir_name (void) const { return my_dir_name; }
-
-  void stash_dir_name (const std::string& dir) { my_dir_name = dir; }
-
-  void lock (void)
-  {
-    this->lock_subfunctions ();
-    locked = true;
-  }
-
-  void unlock (void)
-  {
-    this->unlock_subfunctions ();
-    locked = false;
-  }
-
-  bool islocked (void) const { return locked; }
-
-  virtual void lock_subfunctions (void) { }
-
-  virtual void unlock_subfunctions (void) { }
-
-  void mark_relative (void) { relative = true; }
-
-  bool is_relative (void) const { return relative; }
-
-  std::string name (void) const { return my_name; }
-
-  void document (const std::string& ds) { doc = ds; }
-
-  std::string doc_string (void) const { return doc; }
-
-  virtual void unload (void) { }
-
-  virtual void accept (tree_walker&) { }
-
-protected:
-
-  octave_function (const std::string& nm,
-                   const std::string& ds = std::string ())
-    : relative (false), locked (false), private_function (false),
-      xdispatch_class (), my_name (nm), my_dir_name (), doc (ds) { }
-
-  // TRUE if this function was found from a relative path element.
-  bool relative;
-
-  // TRUE if this function is tagged so that it can't be cleared.
-  bool locked;
-
-  // TRUE means this is a private function.
-  bool private_function;
-
-  // If this object is a class method or constructor, or a private
-  // function inside a class directory, this is the name of the class
-  // to which the method belongs.
-  std::string xdispatch_class;
-
-  // The name of this function.
-  std::string my_name;
-
-  // The name of the directory in the path where we found this
-  // function.  May be relative.
-  std::string my_dir_name;
-
-  // The help text for this function.
-  std::string doc;
-
-private:
-
-  // No copying!
-
-  octave_function (const octave_function& f);
-
-  octave_function& operator = (const octave_function& f);
-
-  DECLARE_OCTAVE_ALLOCATOR
-};
-
-#endif
--- a/src/ov-float.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,346 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "data-conv.h"
-#include "mach-info.h"
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-stream.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-base.h"
-#include "ov-base-scalar.h"
-#include "ov-base-scalar.cc"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-#include "pr-output.h"
-#include "xdiv.h"
-#include "xpow.h"
-#include "ops.h"
-
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-
-template class octave_base_scalar<float>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_float_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_scalar, "float scalar", "single");
-
-octave_value
-octave_float_scalar::do_index_op (const octave_value_list& idx, bool resize_ok)
-{
-  // FIXME -- this doesn't solve the problem of
-  //
-  //   a = 1; a([1,1], [1,1], [1,1])
-  //
-  // and similar constructions.  Hmm...
-
-  // FIXME -- using this constructor avoids narrowing the
-  // 1x1 matrix back to a scalar value.  Need a better solution
-  // to this problem.
-
-  octave_value tmp (new octave_float_matrix (float_matrix_value ()));
-
-  return tmp.do_index_op (idx, resize_ok);
-}
-
-octave_value
-octave_float_scalar::resize (const dim_vector& dv, bool fill) const
-{
-  if (fill)
-    {
-      FloatNDArray retval (dv, 0);
-
-      if (dv.numel ())
-        retval(0) = scalar;
-
-      return retval;
-    }
-  else
-    {
-      FloatNDArray retval (dv);
-
-      if (dv.numel ())
-        retval(0) = scalar;
-
-      return retval;
-    }
-}
-
-octave_value
-octave_float_scalar::diag (octave_idx_type m, octave_idx_type n) const
-{
-  return FloatDiagMatrix (Array<float> (dim_vector (1, 1), scalar), m, n);
-}
-
-octave_value
-octave_float_scalar::convert_to_str_internal (bool, bool, char type) const
-{
-  octave_value retval;
-
-  if (xisnan (scalar))
-    gripe_nan_to_character_conversion ();
-  else
-    {
-      int ival = NINT (scalar);
-
-      if (ival < 0 || ival > UCHAR_MAX)
-        {
-          // FIXME -- is there something better we could do?
-
-          ival = 0;
-
-          ::warning ("range error for conversion to character value");
-        }
-
-      retval = octave_value (std::string (1, static_cast<char> (ival)), type);
-    }
-
-  return retval;
-}
-
-bool
-octave_float_scalar::save_ascii (std::ostream& os)
-{
-  float d = float_value ();
-
-  octave_write_float (os, d);
-
-  os << "\n";
-
-  return true;
-}
-
-bool
-octave_float_scalar::load_ascii (std::istream& is)
-{
-  scalar = octave_read_value<float> (is);
-  if (!is)
-    {
-      error ("load: failed to load scalar constant");
-      return false;
-    }
-
-  return true;
-}
-
-bool
-octave_float_scalar::save_binary (std::ostream& os, bool& /* save_as_floats */)
-{
-  char tmp = LS_FLOAT;
-  os.write (reinterpret_cast<char *> (&tmp), 1);
-  float dtmp = float_value ();
-  os.write (reinterpret_cast<char *> (&dtmp), 4);
-
-  return true;
-}
-
-bool
-octave_float_scalar::load_binary (std::istream& is, bool swap,
-                            oct_mach_info::float_format fmt)
-{
-  char tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-    return false;
-
-  float dtmp;
-  read_floats (is, &dtmp, static_cast<save_type> (tmp), 1, swap, fmt);
-  if (error_state || ! is)
-    return false;
-
-  scalar = dtmp;
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_float_scalar::save_hdf5 (hid_t loc_id, const char *name,
-                          bool /* save_as_floats */)
-{
-  hsize_t dimens[3];
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-
-  space_hid = H5Screate_simple (0, dimens, 0);
-  if (space_hid < 0) return false;
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  float tmp = float_value ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &tmp) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_float_scalar::load_hdf5 (hid_t loc_id, const char *name)
-{
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  float dtmp;
-  if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, &dtmp) < 0)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  scalar = dtmp;
-
-  H5Dclose (data_hid);
-
-  return true;
-}
-
-#endif
-
-mxArray *
-octave_float_scalar::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxSINGLE_CLASS, 1, 1, mxREAL);
-
-  float *pr = static_cast<float *> (retval->get_data ());
-
-  pr[0] = scalar;
-
-  return retval;
-}
-
-octave_value
-octave_float_scalar::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_imag:
-      return 0.0f;
-
-    case umap_real:
-    case umap_conj:
-      return scalar;
-
-#define SCALAR_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (FCN (scalar))
-
-      SCALAR_MAPPER (abs, ::fabsf);
-      SCALAR_MAPPER (acos, rc_acos);
-      SCALAR_MAPPER (acosh, rc_acosh);
-      SCALAR_MAPPER (angle, ::arg);
-      SCALAR_MAPPER (arg, ::arg);
-      SCALAR_MAPPER (asin, rc_asin);
-      SCALAR_MAPPER (asinh, ::asinhf);
-      SCALAR_MAPPER (atan, ::atanf);
-      SCALAR_MAPPER (atanh, rc_atanh);
-      SCALAR_MAPPER (erf, ::erff);
-      SCALAR_MAPPER (erfinv, ::erfinv);
-      SCALAR_MAPPER (erfcinv, ::erfcinv);
-      SCALAR_MAPPER (erfc, ::erfcf);
-      SCALAR_MAPPER (erfcx, ::erfcx);
-      SCALAR_MAPPER (gamma, xgamma);
-      SCALAR_MAPPER (lgamma, rc_lgamma);
-      SCALAR_MAPPER (cbrt, ::cbrtf);
-      SCALAR_MAPPER (ceil, ::ceilf);
-      SCALAR_MAPPER (cos, ::cosf);
-      SCALAR_MAPPER (cosh, ::coshf);
-      SCALAR_MAPPER (exp, ::expf);
-      SCALAR_MAPPER (expm1, ::expm1f);
-      SCALAR_MAPPER (fix, ::fix);
-      SCALAR_MAPPER (floor, ::floorf);
-      SCALAR_MAPPER (log, rc_log);
-      SCALAR_MAPPER (log2, rc_log2);
-      SCALAR_MAPPER (log10, rc_log10);
-      SCALAR_MAPPER (log1p, rc_log1p);
-      SCALAR_MAPPER (round, xround);
-      SCALAR_MAPPER (roundb, xroundb);
-      SCALAR_MAPPER (signum, ::signum);
-      SCALAR_MAPPER (sin, ::sinf);
-      SCALAR_MAPPER (sinh, ::sinhf);
-      SCALAR_MAPPER (sqrt, rc_sqrt);
-      SCALAR_MAPPER (tan, ::tanf);
-      SCALAR_MAPPER (tanh, ::tanhf);
-      SCALAR_MAPPER (finite, xfinite);
-      SCALAR_MAPPER (isinf, xisinf);
-      SCALAR_MAPPER (isna, octave_is_NA);
-      SCALAR_MAPPER (isnan, xisnan);
-
-    default:
-      return octave_base_value::map (umap);
-    }
-}
-
-bool
-octave_float_scalar::fast_elem_insert_self (void *where, builtin_type_t btyp) const
-{
-
-  // Support inline real->complex conversion.
-  if (btyp == btyp_float)
-    {
-      *(reinterpret_cast<float *>(where)) = scalar;
-      return true;
-    }
-  else if (btyp == btyp_float_complex)
-    {
-      *(reinterpret_cast<FloatComplex *>(where)) = scalar;
-      return true;
-    }
-  else
-    return false;
-}
--- a/src/ov-float.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_float_h)
-#define octave_float_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "lo-ieee.h"
-#include "lo-mappers.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "gripes.h"
-#include "ov-base.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-base-scalar.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Real scalar values.
-
-class
-OCTINTERP_API
-octave_float_scalar : public octave_base_scalar<float>
-{
-public:
-
-  octave_float_scalar (void)
-    : octave_base_scalar<float> (0.0) { }
-
-  octave_float_scalar (float d)
-    : octave_base_scalar<float> (d) { }
-
-  octave_float_scalar (const octave_float_scalar& s)
-    : octave_base_scalar<float> (s) { }
-
-  ~octave_float_scalar (void) { }
-
-  octave_base_value *clone (void) const { return new octave_float_scalar (*this); }
-
-  // We return an octave_matrix here instead of an octave_float_scalar so
-  // that in expressions like A(2,2,2) = 2 (for A previously
-  // undefined), A will be empty instead of a 1x1 object.
-  octave_base_value *empty_clone (void) const { return new octave_float_matrix (); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  idx_vector index_vector (void) const { return idx_vector (scalar); }
-
-  octave_value any (int = 0) const
-    { return (scalar != 0 && ! lo_ieee_isnan (scalar)); }
-
-  builtin_type_t builtin_type (void) const { return btyp_float; }
-
-  bool is_real_scalar (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_single_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  int8NDArray
-  int8_array_value (void) const
-    { return int8NDArray (dim_vector (1, 1), scalar); }
-
-  int16NDArray
-  int16_array_value (void) const
-    { return int16NDArray (dim_vector (1, 1), scalar); }
-
-  int32NDArray
-  int32_array_value (void) const
-    { return int32NDArray (dim_vector (1, 1), scalar); }
-
-  int64NDArray
-  int64_array_value (void) const
-    { return int64NDArray (dim_vector (1, 1), scalar); }
-
-  uint8NDArray
-  uint8_array_value (void) const
-    { return uint8NDArray (dim_vector (1, 1), scalar); }
-
-  uint16NDArray
-  uint16_array_value (void) const
-    { return uint16NDArray (dim_vector (1, 1), scalar); }
-
-  uint32NDArray
-  uint32_array_value (void) const
-    { return uint32NDArray (dim_vector (1, 1), scalar); }
-
-  uint64NDArray
-  uint64_array_value (void) const
-    { return uint64NDArray (dim_vector (1, 1), scalar); }
-
-#define DEFINE_INT_SCALAR_VALUE(TYPE) \
-  octave_ ## TYPE \
-  TYPE ## _scalar_value (void) const \
-    { return octave_ ## TYPE (scalar); }
-
-  DEFINE_INT_SCALAR_VALUE (int8)
-  DEFINE_INT_SCALAR_VALUE (int16)
-  DEFINE_INT_SCALAR_VALUE (int32)
-  DEFINE_INT_SCALAR_VALUE (int64)
-  DEFINE_INT_SCALAR_VALUE (uint8)
-  DEFINE_INT_SCALAR_VALUE (uint16)
-  DEFINE_INT_SCALAR_VALUE (uint32)
-  DEFINE_INT_SCALAR_VALUE (uint64)
-
-#undef DEFINE_INT_SCALAR_VALUE
-
-  double double_value (bool = false) const { return static_cast<double> (scalar); }
-
-  float float_value (bool = false) const { return scalar; }
-
-  double scalar_value (bool = false) const { return static_cast<double> (scalar); }
-
-  float float_scalar_value (bool = false) const { return scalar; }
-
-  Matrix matrix_value (bool = false) const
-    { return Matrix (1, 1, scalar); }
-
-  FloatMatrix float_matrix_value (bool = false) const
-    { return FloatMatrix (1, 1, scalar); }
-
-  NDArray array_value (bool = false) const
-    { return NDArray (dim_vector (1, 1), scalar); }
-
-  FloatNDArray float_array_value (bool = false) const
-    { return FloatNDArray (dim_vector (1, 1), scalar); }
-
-  SparseMatrix sparse_matrix_value (bool = false) const
-    { return SparseMatrix (Matrix (1, 1, scalar)); }
-
-  // FIXME Need SparseComplexMatrix (Matrix) constructor!!!
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-    { return SparseComplexMatrix (sparse_matrix_value ()); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-  Complex complex_value (bool = false) const { return scalar; }
-
-  FloatComplex float_complex_value (bool = false) const { return scalar; }
-
-  ComplexMatrix complex_matrix_value (bool = false) const
-    { return  ComplexMatrix (1, 1, Complex (scalar)); }
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const
-    { return  FloatComplexMatrix (1, 1, FloatComplex (scalar)); }
-
-  ComplexNDArray complex_array_value (bool = false) const
-    { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); }
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const
-    { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); }
-
-  charNDArray
-  char_array_value (bool = false) const
-  {
-    charNDArray retval (dim_vector (1, 1));
-    retval(0) = static_cast<char> (scalar);
-    return retval;
-  }
-
-  bool bool_value (bool warn = false) const
-  {
-    if (xisnan (scalar))
-      gripe_nan_to_logical_conversion ();
-    else if (warn && scalar != 0 && scalar != 1)
-      gripe_logical_conversion ();
-
-    return scalar;
-  }
-
-  boolNDArray bool_array_value (bool warn = false) const
-  {
-    if (xisnan (scalar))
-      gripe_nan_to_logical_conversion ();
-    else if (warn && scalar != 0 && scalar != 1)
-      gripe_logical_conversion ();
-
-    return boolNDArray (dim_vector (1, 1), scalar);
-  }
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  void increment (void) { ++scalar; }
-
-  void decrement (void) { --scalar; }
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      return os.write (array_value (), block_size, output_type,
-                       skip, flt_fmt);
-    }
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-  bool fast_elem_insert_self (void *where, builtin_type_t btyp) const;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-flt-complex.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,448 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-
-#include "oct-obj.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-complex.h"
-#include "ov-base.h"
-#include "ov-base-scalar.h"
-#include "ov-base-scalar.cc"
-#include "ov-flt-cx-mat.h"
-#include "ov-float.h"
-#include "ov-flt-complex.h"
-#include "gripes.h"
-#include "pr-output.h"
-#include "ops.h"
-
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-
-template class octave_base_scalar<FloatComplex>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_float_complex);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex,
-                                     "float complex scalar", "single");
-
-octave_base_value *
-octave_float_complex::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  float im = std::imag (scalar);
-
-  if (im == 0.0)
-    retval = new octave_float_scalar (std::real (scalar));
-
-  return retval;
-}
-
-octave_value
-octave_float_complex::do_index_op (const octave_value_list& idx, bool resize_ok)
-{
-  // FIXME -- this doesn't solve the problem of
-  //
-  //   a = i; a([1,1], [1,1], [1,1])
-  //
-  // and similar constructions.  Hmm...
-
-  // FIXME -- using this constructor avoids narrowing the
-  // 1x1 matrix back to a scalar value.  Need a better solution
-  // to this problem.
-
-  octave_value tmp (new octave_float_complex_matrix (float_complex_matrix_value ()));
-
-  return tmp.do_index_op (idx, resize_ok);
-}
-
-double
-octave_float_complex::double_value (bool force_conversion) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real scalar");
-
-  retval = std::real (scalar);
-
-  return retval;
-}
-
-float
-octave_float_complex::float_value (bool force_conversion) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real scalar");
-
-  retval = std::real (scalar);
-
-  return retval;
-}
-
-Matrix
-octave_float_complex::matrix_value (bool force_conversion) const
-{
-  Matrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real matrix");
-
-  retval = Matrix (1, 1, std::real (scalar));
-
-  return retval;
-}
-
-FloatMatrix
-octave_float_complex::float_matrix_value (bool force_conversion) const
-{
-  FloatMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real matrix");
-
-  retval = FloatMatrix (1, 1, std::real (scalar));
-
-  return retval;
-}
-
-NDArray
-octave_float_complex::array_value (bool force_conversion) const
-{
-  NDArray retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real matrix");
-
-  retval = NDArray (dim_vector (1, 1), std::real (scalar));
-
-  return retval;
-}
-
-FloatNDArray
-octave_float_complex::float_array_value (bool force_conversion) const
-{
-  FloatNDArray retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex scalar", "real matrix");
-
-  retval = FloatNDArray (dim_vector (1, 1), std::real (scalar));
-
-  return retval;
-}
-
-Complex
-octave_float_complex::complex_value (bool) const
-{
-  return scalar;
-}
-
-FloatComplex
-octave_float_complex::float_complex_value (bool) const
-{
-  return static_cast<FloatComplex> (scalar);
-}
-
-ComplexMatrix
-octave_float_complex::complex_matrix_value (bool) const
-{
-  return ComplexMatrix (1, 1, scalar);
-}
-
-FloatComplexMatrix
-octave_float_complex::float_complex_matrix_value (bool) const
-{
-  return FloatComplexMatrix (1, 1, scalar);
-}
-
-ComplexNDArray
-octave_float_complex::complex_array_value (bool /* force_conversion */) const
-{
-  return ComplexNDArray (dim_vector (1, 1), scalar);
-}
-
-FloatComplexNDArray
-octave_float_complex::float_complex_array_value (bool /* force_conversion */) const
-{
-  return FloatComplexNDArray (dim_vector (1, 1), scalar);
-}
-
-octave_value
-octave_float_complex::resize (const dim_vector& dv, bool fill) const
-{
-  if (fill)
-    {
-      FloatComplexNDArray retval (dv, FloatComplex (0));
-
-      if (dv.numel ())
-        retval(0) = scalar;
-
-      return retval;
-    }
-  else
-    {
-      FloatComplexNDArray retval (dv);
-
-      if (dv.numel ())
-        retval(0) = scalar;
-
-      return retval;
-    }
-}
-
-octave_value
-octave_float_complex::diag (octave_idx_type m, octave_idx_type n) const
-{
-  return FloatComplexDiagMatrix (Array<FloatComplex> (dim_vector (1, 1), scalar), m, n);
-}
-
-bool
-octave_float_complex::save_ascii (std::ostream& os)
-{
-  FloatComplex c = float_complex_value ();
-
-  octave_write_float_complex (os, c);
-
-  os << "\n";
-
-  return true;
-}
-
-bool
-octave_float_complex::load_ascii (std::istream& is)
-{
-  scalar = octave_read_value<FloatComplex> (is);
-
-  if (!is)
-    {
-      error ("load: failed to load complex scalar constant");
-      return false;
-    }
-
-  return true;
-}
-
-
-bool
-octave_float_complex::save_binary (std::ostream& os, bool& /* save_as_floats */)
-{
-  char tmp = static_cast<char> (LS_FLOAT);
-  os.write (reinterpret_cast<char *> (&tmp), 1);
-  FloatComplex ctmp = float_complex_value ();
-  os.write (reinterpret_cast<char *> (&ctmp), 8);
-
-  return true;
-}
-
-bool
-octave_float_complex::load_binary (std::istream& is, bool swap,
-                             oct_mach_info::float_format fmt)
-{
-  char tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-    return false;
-
-  FloatComplex ctmp;
-  read_floats (is, reinterpret_cast<float *> (&ctmp),
-                static_cast<save_type> (tmp), 2, swap, fmt);
-  if (error_state || ! is)
-    return false;
-
-  scalar = ctmp;
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_float_complex::save_hdf5 (hid_t loc_id, const char *name,
-                           bool /* save_as_floats */)
-{
-  hsize_t dimens[3];
-  hid_t space_hid = -1, type_hid = -1, data_hid = -1;
-  bool retval = true;
-
-  space_hid = H5Screate_simple (0, dimens, 0);
-  if (space_hid < 0)
-    return false;
-
-  type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
-  if (type_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      return false;
-    }
-
-  FloatComplex tmp = float_complex_value ();
-  retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                     &tmp) >= 0;
-
-  H5Dclose (data_hid);
-  H5Tclose (type_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_float_complex::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t type_hid = H5Dget_type (data_hid);
-
-  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
-
-  if (! hdf5_types_compatible (type_hid, complex_type))
-    {
-      H5Tclose (complex_type);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  hid_t space_id = H5Dget_space (data_hid);
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank != 0)
-    {
-      H5Tclose (complex_type);
-      H5Sclose (space_id);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  // complex scalar:
-  FloatComplex ctmp;
-  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-               &ctmp) >= 0)
-    {
-      retval = true;
-      scalar = ctmp;
-    }
-
-  H5Tclose (complex_type);
-  H5Sclose (space_id);
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_float_complex::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxSINGLE_CLASS, 1, 1, mxCOMPLEX);
-
-  float *pr = static_cast<float *> (retval->get_data ());
-  float *pi = static_cast<float *> (retval->get_imag_data ());
-
-  pr[0] = std::real (scalar);
-  pi[0] = std::imag (scalar);
-
-  return retval;
-}
-
-octave_value
-octave_float_complex::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-#define SCALAR_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (FCN (scalar))
-
-      SCALAR_MAPPER (abs, std::abs);
-      SCALAR_MAPPER (acos, ::acos);
-      SCALAR_MAPPER (acosh, ::acosh);
-      SCALAR_MAPPER (angle, std::arg);
-      SCALAR_MAPPER (arg, std::arg);
-      SCALAR_MAPPER (asin, ::asin);
-      SCALAR_MAPPER (asinh, ::asinh);
-      SCALAR_MAPPER (atan, ::atan);
-      SCALAR_MAPPER (atanh, ::atanh);
-      SCALAR_MAPPER (ceil, ::ceil);
-      SCALAR_MAPPER (conj, std::conj);
-      SCALAR_MAPPER (cos, std::cos);
-      SCALAR_MAPPER (cosh, std::cosh);
-      SCALAR_MAPPER (exp, std::exp);
-      SCALAR_MAPPER (expm1, ::expm1);
-      SCALAR_MAPPER (fix, ::fix);
-      SCALAR_MAPPER (floor, ::floor);
-      SCALAR_MAPPER (imag, std::imag);
-      SCALAR_MAPPER (log, std::log);
-      SCALAR_MAPPER (log2, xlog2);
-      SCALAR_MAPPER (log10, std::log10);
-      SCALAR_MAPPER (log1p, ::log1p);
-      SCALAR_MAPPER (real, std::real);
-      SCALAR_MAPPER (round, xround);
-      SCALAR_MAPPER (roundb, xroundb);
-      SCALAR_MAPPER (signum, ::signum);
-      SCALAR_MAPPER (sin, std::sin);
-      SCALAR_MAPPER (sinh, std::sinh);
-      SCALAR_MAPPER (sqrt, std::sqrt);
-      SCALAR_MAPPER (tan, std::tan);
-      SCALAR_MAPPER (tanh, std::tanh);
-      SCALAR_MAPPER (finite, xfinite);
-      SCALAR_MAPPER (isinf, xisinf);
-      SCALAR_MAPPER (isna, octave_is_NA);
-      SCALAR_MAPPER (isnan, xisnan);
-
-    default:
-      return octave_base_value::map (umap);
-    }
-}
--- a/src/ov-flt-complex.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_float_complex_h)
-#define octave_float_complex_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "lo-ieee.h"
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "gripes.h"
-#include "error.h"
-#include "ov-base.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-base-scalar.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Complex scalar values.
-
-class
-OCTINTERP_API
-octave_float_complex : public octave_base_scalar<FloatComplex>
-{
-public:
-
-  octave_float_complex (void)
-    : octave_base_scalar<FloatComplex> () { }
-
-  octave_float_complex (const FloatComplex& c)
-    : octave_base_scalar<FloatComplex> (c) { }
-
-  octave_float_complex (const octave_float_complex& c)
-    : octave_base_scalar<FloatComplex> (c) { }
-
-  ~octave_float_complex (void) { }
-
-  octave_base_value *clone (void) const { return new octave_float_complex (*this); }
-
-  // We return an octave_float_complex_matrix object here instead of an
-  // octave_float_complex object so that in expressions like A(2,2,2) = 2
-  // (for A previously undefined), A will be empty instead of a 1x1
-  // object.
-  octave_base_value *empty_clone (void) const
-    { return new octave_float_complex_matrix (); }
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  octave_value any (int = 0) const
-    {
-      return (scalar != FloatComplex (0, 0)
-              && ! (lo_ieee_isnan (std::real (scalar))
-                    || lo_ieee_isnan (std::imag (scalar))));
-    }
-
-  builtin_type_t builtin_type (void) const { return btyp_float_complex; }
-
-  bool is_complex_scalar (void) const { return true; }
-
-  bool is_complex_type (void) const { return true; }
-
-  bool is_single_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  float float_scalar_value (bool frc_str_conv = false) const
-    { return float_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  FloatMatrix float_matrix_value (bool = false) const;
-
-  NDArray array_value (bool = false) const;
-
-  FloatNDArray float_array_value (bool = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const
-    { return SparseMatrix (matrix_value ()); }
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-    { return SparseComplexMatrix (complex_matrix_value ()); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  bool bool_value (bool warn = false) const
-  {
-    if (xisnan (scalar))
-      gripe_nan_to_logical_conversion ();
-    else if (warn && scalar != 0.0f && scalar != 1.0f)
-      gripe_logical_conversion ();
-
-    return scalar != 0.0f;
-  }
-
-  boolNDArray bool_array_value (bool warn = false) const
-  {
-    if (xisnan (scalar))
-      gripe_nan_to_logical_conversion ();
-    else if (warn && scalar != 0.0f && scalar != 1.0f)
-      gripe_logical_conversion ();
-
-    return boolNDArray (dim_vector (1, 1), scalar != 1.0f);
-  }
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  void increment (void) { scalar += 1.0; }
-
-  void decrement (void) { scalar -= 1.0; }
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      // Yes, for compatibility, we drop the imaginary part here.
-      return os.write (array_value (true), block_size, output_type,
-                       skip, flt_fmt);
-    }
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-typedef octave_float_complex octave_float_complex_scalar;
-
-#endif
--- a/src/ov-flt-cx-diag.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "byte-swap.h"
-
-#include "ov-flt-cx-diag.h"
-#include "ov-base-diag.cc"
-#include "ov-flt-re-diag.h"
-#include "ov-flt-complex.h"
-#include "ov-flt-cx-mat.h"
-#include "ls-utils.h"
-
-template class octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_float_complex_diag_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_diag_matrix,
-                                     "float complex diagonal matrix", "single");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_float_complex_diag_matrix&);
-
-  return new octave_float_complex_matrix (v.float_complex_matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_float_complex_diag_matrix::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_float_complex_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_float_complex_diag_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.nelem () == 1)
-    {
-      retval = new octave_float_complex (matrix (0, 0));
-      octave_base_value *rv2 = retval->try_narrowing_conversion ();
-      if (rv2)
-        {
-          delete retval;
-          retval = rv2;
-        }
-    }
-  else if (matrix.all_elements_are_real ())
-    {
-      return new octave_float_diag_matrix (::real (matrix));
-    }
-
-  return retval;
-}
-
-DiagMatrix
-octave_float_complex_diag_matrix::diag_matrix_value (bool force_conversion) const
-{
-  DiagMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               type_name (), "real matrix");
-
-  retval = ::real (matrix);
-
-  return retval;
-}
-
-FloatDiagMatrix
-octave_float_complex_diag_matrix::float_diag_matrix_value (bool force_conversion) const
-{
-  DiagMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               type_name (), "real matrix");
-
-  retval = ::real (matrix);
-
-  return retval;
-}
-
-ComplexDiagMatrix
-octave_float_complex_diag_matrix::complex_diag_matrix_value (bool) const
-{
-  return ComplexDiagMatrix (matrix);
-}
-
-FloatComplexDiagMatrix
-octave_float_complex_diag_matrix::float_complex_diag_matrix_value (bool) const
-{
-  return matrix;
-}
-
-octave_value
-octave_float_complex_diag_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_abs:
-      return matrix.abs ();
-    case umap_real:
-      return ::real (matrix);
-    case umap_conj:
-      return ::conj (matrix);
-    case umap_imag:
-      return ::imag (matrix);
-    case umap_sqrt:
-      {
-        FloatComplexColumnVector tmp = matrix.diag ().map<FloatComplex> (std::sqrt);
-        FloatComplexDiagMatrix retval (tmp);
-        retval.resize (matrix.rows (), matrix.columns ());
-        return retval;
-      }
-    default:
-      return to_dense ().map (umap);
-    }
-}
-
-
-bool
-octave_float_complex_diag_matrix::save_binary (std::ostream& os,
-                                               bool& /* save_as_floats */)
-{
-
-  int32_t r = matrix.rows (), c = matrix.cols ();
-  os.write (reinterpret_cast<char *> (&r), 4);
-  os.write (reinterpret_cast<char *> (&c), 4);
-
-  FloatComplexMatrix m = FloatComplexMatrix (matrix.diag ());
-  save_type st = LS_FLOAT;
-  if (matrix.length () > 4096) // FIXME -- make this configurable.
-    {
-      float max_val, min_val;
-      if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  const FloatComplex *mtmp = m.data ();
-  write_floats (os, reinterpret_cast<const float *> (mtmp), st, 2 * m.numel ());
-
-  return true;
-}
-
-bool
-octave_float_complex_diag_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format fmt)
-{
-  int32_t r, c;
-  char tmp;
-  if (! (is.read (reinterpret_cast<char *> (&r), 4)
-         && is.read (reinterpret_cast<char *> (&c), 4)
-         && is.read (reinterpret_cast<char *> (&tmp), 1)))
-    return false;
-  if (swap)
-    {
-      swap_bytes<4> (&r);
-      swap_bytes<4> (&c);
-    }
-
-  FloatComplexDiagMatrix m (r, c);
-  FloatComplex *re = m.fortran_vec ();
-  octave_idx_type len = m.length ();
-  read_floats (is, reinterpret_cast<float *> (re),
-               static_cast<save_type> (tmp), 2 * len, swap, fmt);
-  if (error_state || ! is)
-    return false;
-  matrix = m;
-
-  return true;
-}
-
-bool
-octave_float_complex_diag_matrix::chk_valid_scalar (const octave_value& val,
-                                                    FloatComplex& x) const
-{
-  bool retval = val.is_complex_scalar () || val.is_real_scalar ();
-  if (retval)
-    x = val.float_complex_value ();
-  return retval;
-}
--- a/src/ov-flt-cx-diag.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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_float_complex_diag_matrix_h)
-#define octave_float_complex_diag_matrix_h 1
-
-#include "ov-base.h"
-#include "ov-base-diag.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-typeinfo.h"
-
-// Real diagonal matrix values.
-
-class
-OCTINTERP_API
-octave_float_complex_diag_matrix
-  : public octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix>
-{
-public:
-
-  octave_float_complex_diag_matrix (void)
-    : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> () { }
-
-  octave_float_complex_diag_matrix (const FloatComplexDiagMatrix& m)
-    : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> (m) { }
-
-  octave_float_complex_diag_matrix (const octave_float_complex_diag_matrix& m)
-    : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> (m) { }
-
-  ~octave_float_complex_diag_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_float_complex_diag_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_float_complex_diag_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  builtin_type_t builtin_type (void) const { return btyp_float_complex; }
-
-  bool is_complex_matrix (void) const { return true; }
-
-  bool is_complex_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  DiagMatrix diag_matrix_value (bool = false) const;
-
-  FloatDiagMatrix float_diag_matrix_value (bool = false) const;
-
-  ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
-
-  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  bool chk_valid_scalar (const octave_value&,
-                         FloatComplex&) const;
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-flt-cx-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,770 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <vector>
-
-#include "data-conv.h"
-#include "lo-ieee.h"
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-#include "mx-base.h"
-#include "mach-info.h"
-#include "oct-locbuf.h"
-
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-mat.cc"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "pr-output.h"
-#include "ops.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-#include "ls-utils.h"
-
-template class octave_base_matrix<FloatComplexNDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_float_complex_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_matrix,
-                                     "float complex matrix", "single");
-
-octave_base_value *
-octave_float_complex_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.numel () == 1)
-    {
-      FloatComplex c = matrix (0);
-
-      if (std::imag (c) == 0.0)
-        retval = new octave_float_scalar (std::real (c));
-      else
-        retval = new octave_float_complex (c);
-    }
-  else if (matrix.all_elements_are_real ())
-    retval = new octave_float_matrix (::real (matrix));
-
-  return retval;
-}
-
-double
-octave_float_complex_matrix::double_value (bool force_conversion) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real scalar");
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "complex matrix", "real scalar");
-
-      retval = std::real (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("complex matrix", "real scalar");
-
-  return retval;
-}
-
-float
-octave_float_complex_matrix::float_value (bool force_conversion) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real scalar");
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "complex matrix", "real scalar");
-
-      retval = std::real (matrix (0, 0));
-    }
-  else
-    gripe_invalid_conversion ("complex matrix", "real scalar");
-
-  return retval;
-}
-
-Matrix
-octave_float_complex_matrix::matrix_value (bool force_conversion) const
-{
-  Matrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real matrix");
-
-  retval = ::real (matrix.matrix_value ());
-
-  return retval;
-}
-
-FloatMatrix
-octave_float_complex_matrix::float_matrix_value (bool force_conversion) const
-{
-  FloatMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real matrix");
-
-  retval = ::real (matrix.matrix_value ());
-
-  return retval;
-}
-
-Complex
-octave_float_complex_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "complex matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("complex matrix", "complex scalar");
-
-  return retval;
-}
-
-FloatComplex
-octave_float_complex_matrix::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "complex matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("complex matrix", "complex scalar");
-
-  return retval;
-}
-
-ComplexMatrix
-octave_float_complex_matrix::complex_matrix_value (bool) const
-{
-  return matrix.matrix_value ();
-}
-
-FloatComplexMatrix
-octave_float_complex_matrix::float_complex_matrix_value (bool) const
-{
-  return FloatComplexMatrix (matrix.matrix_value ());
-}
-
-boolNDArray
-octave_float_complex_matrix::bool_array_value (bool warn) const
-{
-  if (matrix.any_element_is_nan ())
-    gripe_nan_to_logical_conversion ();
-  else if (warn && (! matrix.all_elements_are_real ()
-                    || real (matrix).any_element_not_one_or_zero ()))
-    gripe_logical_conversion ();
-
-  return mx_el_ne (matrix, FloatComplex (0.0));
-}
-
-charNDArray
-octave_float_complex_matrix::char_array_value (bool frc_str_conv) const
-{
-  charNDArray retval;
-
-  if (! frc_str_conv)
-    gripe_implicit_conversion ("Octave:num-to-str",
-                               "complex matrix", "string");
-  else
-    {
-      retval = charNDArray (dims ());
-      octave_idx_type nel = numel ();
-
-      for (octave_idx_type i = 0; i < nel; i++)
-        retval.elem (i) = static_cast<char>(std::real (matrix.elem (i)));
-    }
-
-  return retval;
-}
-
-FloatComplexNDArray
-octave_float_complex_matrix::float_complex_array_value (bool) const
-{
-  return FloatComplexNDArray (matrix);
-}
-
-SparseMatrix
-octave_float_complex_matrix::sparse_matrix_value (bool force_conversion) const
-{
-  SparseMatrix retval;
-
-  if (! force_conversion)
-    gripe_implicit_conversion ("Octave:imag-to-real",
-                               "complex matrix", "real matrix");
-
-  retval = SparseMatrix (::real (complex_matrix_value ()));
-
-  return retval;
-}
-
-SparseComplexMatrix
-octave_float_complex_matrix::sparse_complex_matrix_value (bool) const
-{
-  return SparseComplexMatrix (complex_matrix_value ());
-}
-
-octave_value
-octave_float_complex_matrix::diag (octave_idx_type k) const
-{
-  octave_value retval;
-  if (k == 0 && matrix.ndims () == 2
-      && (matrix.rows () == 1 || matrix.columns () == 1))
-    retval = FloatComplexDiagMatrix (DiagArray2<FloatComplex> (matrix));
-  else
-    retval = octave_base_matrix<FloatComplexNDArray>::diag (k);
-
-  return retval;
-}
-
-octave_value
-octave_float_complex_matrix::diag (octave_idx_type m, octave_idx_type n) const
-{
-  octave_value retval;
-
-  if (matrix.ndims () == 2
-      && (matrix.rows () == 1 || matrix.columns () == 1))
-    {
-      FloatComplexMatrix mat = matrix.matrix_value ();
-
-      retval = mat.diag (m, n);
-    }
-  else
-    error ("diag: expecting vector argument");
-
-  return retval;
-}
-
-bool
-octave_float_complex_matrix::save_ascii (std::ostream& os)
-{
-  dim_vector d = dims ();
-  if (d.length () > 2)
-    {
-      FloatComplexNDArray tmp = complex_array_value ();
-
-      os << "# ndims: " << d.length () << "\n";
-
-      for (int i = 0; i < d.length (); i++)
-        os << " " << d (i);
-
-      os << "\n" << tmp;
-    }
-  else
-    {
-      // Keep this case, rather than use generic code above for backward
-      // compatiability. Makes load_ascii much more complex!!
-      os << "# rows: " << rows () << "\n"
-         << "# columns: " << columns () << "\n";
-
-      os << complex_matrix_value ();
-    }
-
-  return true;
-}
-
-bool
-octave_float_complex_matrix::load_ascii (std::istream& is)
-{
-  bool success = true;
-
-  string_vector keywords(2);
-
-  keywords[0] = "ndims";
-  keywords[1] = "rows";
-
-  std::string kw;
-  octave_idx_type val = 0;
-
-  if (extract_keyword (is, keywords, kw, val, true))
-    {
-      if (kw == "ndims")
-        {
-          int mdims = static_cast<int> (val);
-
-          if (mdims >= 0)
-            {
-              dim_vector dv;
-              dv.resize (mdims);
-
-              for (int i = 0; i < mdims; i++)
-                is >> dv(i);
-
-              if (is)
-                {
-                  FloatComplexNDArray tmp(dv);
-
-                  is >> tmp;
-
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else
-                {
-                  error ("load: failed to read dimensions");
-                  success = false;
-                }
-            }
-          else
-            {
-              error ("load: failed to extract number of dimensions");
-              success = false;
-            }
-        }
-      else if (kw == "rows")
-        {
-          octave_idx_type nr = val;
-          octave_idx_type nc = 0;
-
-          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
-            {
-              if (nr > 0 && nc > 0)
-                {
-                  FloatComplexMatrix tmp (nr, nc);
-                  is >> tmp;
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else if (nr == 0 || nc == 0)
-                matrix = FloatComplexMatrix (nr, nc);
-              else
-                panic_impossible ();
-            }
-          else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
-        }
-      else
-        panic_impossible ();
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_float_complex_matrix::save_binary (std::ostream& os, bool&)
-{
-  dim_vector d = dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims to differentiate with old format!!
-  int32_t tmp = - d.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i = 0; i < d.length (); i++)
-    {
-      tmp = d(i);
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-    }
-
-  FloatComplexNDArray m = complex_array_value ();
-  save_type st = LS_FLOAT;
-  if (d.numel () > 4096) // FIXME -- make this configurable.
-    {
-      float max_val, min_val;
-      if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  const FloatComplex *mtmp = m.data ();
-  write_floats (os, reinterpret_cast<const float *> (mtmp), st, 2 * d.numel ());
-
-  return true;
-}
-
-bool
-octave_float_complex_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format fmt)
-{
-  char tmp;
-  int32_t mdims;
-  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&mdims);
-  if (mdims < 0)
-    {
-      mdims = - mdims;
-      int32_t di;
-      dim_vector dv;
-      dv.resize (mdims);
-
-      for (int i = 0; i < mdims; i++)
-        {
-          if (! is.read (reinterpret_cast<char *> (&di), 4))
-            return false;
-          if (swap)
-            swap_bytes<4> (&di);
-          dv(i) = di;
-        }
-
-      // Convert an array with a single dimension to be a row vector.
-      // Octave should never write files like this, other software
-      // might.
-
-      if (mdims == 1)
-        {
-          mdims = 2;
-          dv.resize (mdims);
-          dv(1) = dv(0);
-          dv(0) = 1;
-        }
-
-      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-        return false;
-
-      FloatComplexNDArray m(dv);
-      FloatComplex *im = m.fortran_vec ();
-      read_floats (is, reinterpret_cast<float *> (im),
-                    static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  else
-    {
-      int32_t nr, nc;
-      nr = mdims;
-      if (! is.read (reinterpret_cast<char *> (&nc), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&nc);
-      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-        return false;
-      FloatComplexMatrix m (nr, nc);
-      FloatComplex *im = m.fortran_vec ();
-      octave_idx_type len = nr * nc;
-      read_floats (is, reinterpret_cast<float *> (im),
-                    static_cast<save_type> (tmp), 2*len, swap, fmt);
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_float_complex_matrix::save_hdf5 (hid_t loc_id, const char *name, bool)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  int rank = dv.length ();
-  hid_t space_hid = -1, data_hid = -1, type_hid = -1;
-  bool retval = true;
-  FloatComplexNDArray m = complex_array_value ();
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
-
-  space_hid = H5Screate_simple (rank, hdims, 0);
-  if (space_hid < 0) return false;
-
-  hid_t save_type_hid = H5T_NATIVE_FLOAT;
-
-#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
-  // hdf5 currently doesn't support float/integer conversions
-  else
-    {
-      float max_val, min_val;
-
-      if (m.all_integers (max_val, min_val))
-        save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
-    }
-#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
-
-  type_hid = hdf5_make_complex_type (save_type_hid);
-  if (type_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      return false;
-    }
-
-  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
-  if (complex_type_hid < 0) retval = false;
-
-  if (retval)
-    {
-      FloatComplex *mtmp = m.fortran_vec ();
-      if (H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                    mtmp) < 0)
-        {
-          H5Tclose (complex_type_hid);
-          retval = false;
-        }
-    }
-
-  H5Tclose (complex_type_hid);
-  H5Dclose (data_hid);
-  H5Tclose (type_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_float_complex_matrix::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-      return (empty > 0);
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t type_hid = H5Dget_type (data_hid);
-
-  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
-
-  if (! hdf5_types_compatible (type_hid, complex_type))
-    {
-      H5Tclose (complex_type);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank < 1)
-    {
-      H5Tclose (complex_type);
-      H5Sclose (space_id);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  if (rank == 1)
-    {
-      dv.resize (2);
-      dv(0) = 1;
-      dv(1) = hdims[0];
-    }
-  else
-    {
-      dv.resize (rank);
-      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
-        dv(j) = hdims[i];
-    }
-
-  FloatComplexNDArray m (dv);
-  FloatComplex *reim = m.fortran_vec ();
-  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-               reim) >= 0)
-    {
-      retval = true;
-      matrix = m;
-    }
-
-  H5Tclose (complex_type);
-  H5Sclose (space_id);
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-void
-octave_float_complex_matrix::print_raw (std::ostream& os,
-                                  bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, matrix, pr_as_read_syntax,
-                         current_print_indent_level ());
-}
-
-mxArray *
-octave_float_complex_matrix::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxSINGLE_CLASS, dims (), mxCOMPLEX);
-
-  float *pr = static_cast<float *> (retval->get_data ());
-  float *pi = static_cast<float *> (retval->get_imag_data ());
-
-  mwSize nel = numel ();
-
-  const FloatComplex *p = matrix.data ();
-
-  for (mwIndex i = 0; i < nel; i++)
-    {
-      pr[i] = std::real (p[i]);
-      pi[i] = std::imag (p[i]);
-    }
-
-  return retval;
-}
-
-octave_value
-octave_float_complex_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    // Mappers handled specially.
-    case umap_real:
-      return ::real (matrix);
-    case umap_imag:
-      return ::imag (matrix);
-    case umap_conj:
-      return ::conj (matrix);
-
-#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.FCN ())
-
-      ARRAY_METHOD_MAPPER (abs, abs);
-      ARRAY_METHOD_MAPPER (isnan, isnan);
-      ARRAY_METHOD_MAPPER (isinf, isinf);
-      ARRAY_METHOD_MAPPER (finite, isfinite);
-
-#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.map<TYPE> (FCN))
-
-      ARRAY_MAPPER (acos, FloatComplex, ::acos);
-      ARRAY_MAPPER (acosh, FloatComplex, ::acosh);
-      ARRAY_MAPPER (angle, float, std::arg);
-      ARRAY_MAPPER (arg, float, std::arg);
-      ARRAY_MAPPER (asin, FloatComplex, ::asin);
-      ARRAY_MAPPER (asinh, FloatComplex, ::asinh);
-      ARRAY_MAPPER (atan, FloatComplex, ::atan);
-      ARRAY_MAPPER (atanh, FloatComplex, ::atanh);
-      ARRAY_MAPPER (ceil, FloatComplex, ::ceil);
-      ARRAY_MAPPER (cos, FloatComplex, std::cos);
-      ARRAY_MAPPER (cosh, FloatComplex, std::cosh);
-      ARRAY_MAPPER (exp, FloatComplex, std::exp);
-      ARRAY_MAPPER (expm1, FloatComplex, ::expm1);
-      ARRAY_MAPPER (fix, FloatComplex, ::fix);
-      ARRAY_MAPPER (floor, FloatComplex, ::floor);
-      ARRAY_MAPPER (log, FloatComplex, std::log);
-      ARRAY_MAPPER (log2, FloatComplex, xlog2);
-      ARRAY_MAPPER (log10, FloatComplex, std::log10);
-      ARRAY_MAPPER (log1p, FloatComplex, ::log1p);
-      ARRAY_MAPPER (round, FloatComplex, xround);
-      ARRAY_MAPPER (roundb, FloatComplex, xroundb);
-      ARRAY_MAPPER (signum, FloatComplex, ::signum);
-      ARRAY_MAPPER (sin, FloatComplex, std::sin);
-      ARRAY_MAPPER (sinh, FloatComplex, std::sinh);
-      ARRAY_MAPPER (sqrt, FloatComplex, std::sqrt);
-      ARRAY_MAPPER (tan, FloatComplex, std::tan);
-      ARRAY_MAPPER (tanh, FloatComplex, std::tanh);
-      ARRAY_MAPPER (isna, bool, octave_is_NA);
-
-    default:
-      return octave_base_value::map (umap);
-    }
-}
--- a/src/ov-flt-cx-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_float_complex_matrix_h)
-#define octave_float_complex_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-typeinfo.h"
-
-#include "MatrixType.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Complex matrix values.
-
-class
-OCTINTERP_API
-octave_float_complex_matrix : public octave_base_matrix<FloatComplexNDArray>
-{
-public:
-
-  octave_float_complex_matrix (void)
-    : octave_base_matrix<FloatComplexNDArray> () { }
-
-  octave_float_complex_matrix (const FloatComplexNDArray& m)
-    : octave_base_matrix<FloatComplexNDArray> (m) { }
-
-  octave_float_complex_matrix (const FloatComplexMatrix& m)
-    : octave_base_matrix<FloatComplexNDArray> (m) { }
-
-  octave_float_complex_matrix (const FloatComplexMatrix& m, const MatrixType& t)
-    : octave_base_matrix<FloatComplexNDArray> (m, t) { }
-
-  octave_float_complex_matrix (const Array<FloatComplex>& m)
-    : octave_base_matrix<FloatComplexNDArray> (FloatComplexNDArray (m)) { }
-
-  octave_float_complex_matrix (const FloatComplexDiagMatrix& d)
-    : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (d)) { }
-
-  octave_float_complex_matrix (const FloatComplexRowVector& v)
-    : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { }
-
-  octave_float_complex_matrix (const FloatComplexColumnVector& v)
-    : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { }
-
-  octave_float_complex_matrix (const octave_float_complex_matrix& cm)
-    : octave_base_matrix<FloatComplexNDArray> (cm) { }
-
-  ~octave_float_complex_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_float_complex_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_float_complex_matrix (); }
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  builtin_type_t builtin_type (void) const { return btyp_float_complex; }
-
-  bool is_complex_matrix (void) const { return true; }
-
-  bool is_complex_type (void) const { return true; }
-
-  bool is_single_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  float float_scalar_value (bool frc_str_conv = false) const
-    { return float_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  FloatMatrix float_matrix_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const { return matrix; }
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool warn = false) const;
-
-  charNDArray char_array_value (bool frc_str_conv = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const;
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
-
-  octave_value diag (octave_idx_type k = 0) const;
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  void increment (void) { matrix += FloatComplex (1.0); }
-
-  void decrement (void) { matrix -= FloatComplex (1.0); }
-
-  void changesign (void) { matrix.changesign (); }
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      // Yes, for compatibility, we drop the imaginary part here.
-      return os.write (matrix_value (true), block_size, output_type,
-                       skip, flt_fmt);
-    }
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-flt-re-diag.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "byte-swap.h"
-
-#include "ov-flt-re-diag.h"
-#include "ov-base-diag.cc"
-#include "ov-float.h"
-#include "ov-flt-re-mat.h"
-#include "ls-utils.h"
-
-template class octave_base_diag<FloatDiagMatrix, FloatMatrix>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_float_diag_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_diag_matrix,
-                                     "float diagonal matrix", "single");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_float_diag_matrix&);
-
-  return new octave_float_matrix (v.float_matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_float_diag_matrix::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_float_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_float_diag_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.nelem () == 1)
-    retval = new octave_float_scalar (matrix (0, 0));
-
-  return retval;
-}
-
-DiagMatrix
-octave_float_diag_matrix::diag_matrix_value (bool) const
-{
-  return DiagMatrix (matrix);
-}
-
-FloatDiagMatrix
-octave_float_diag_matrix::float_diag_matrix_value (bool) const
-{
-  return matrix;
-}
-
-ComplexDiagMatrix
-octave_float_diag_matrix::complex_diag_matrix_value (bool) const
-{
-  return ComplexDiagMatrix (matrix);
-}
-
-FloatComplexDiagMatrix
-octave_float_diag_matrix::float_complex_diag_matrix_value (bool) const
-{
-  return FloatComplexDiagMatrix (matrix);
-}
-
-octave_value
-octave_float_diag_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_abs:
-      return matrix.abs ();
-    case umap_real:
-    case umap_conj:
-      return matrix;
-    case umap_imag:
-      return DiagMatrix (matrix.rows (), matrix.cols (), 0.0);
-    case umap_sqrt:
-      {
-        FloatComplexColumnVector tmp = matrix.diag ().map<FloatComplex> (rc_sqrt);
-        FloatComplexDiagMatrix retval (tmp);
-        retval.resize (matrix.rows (), matrix.columns ());
-        return retval;
-      }
-    default:
-      return to_dense ().map (umap);
-    }
-}
-
-bool
-octave_float_diag_matrix::save_binary (std::ostream& os,
-                                       bool& /* save_as_floats*/)
-{
-
-  int32_t r = matrix.rows (), c = matrix.cols ();
-  os.write (reinterpret_cast<char *> (&r), 4);
-  os.write (reinterpret_cast<char *> (&c), 4);
-
-  FloatMatrix m = FloatMatrix (matrix.diag ());
-  save_type st = LS_FLOAT;
-  if (matrix.length () > 8192) // FIXME -- make this configurable.
-    {
-      float max_val, min_val;
-      if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  const float *mtmp = m.data ();
-  write_floats (os, mtmp, st, m.numel ());
-
-  return true;
-}
-
-bool
-octave_float_diag_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format fmt)
-{
-  int32_t r, c;
-  char tmp;
-  if (! (is.read (reinterpret_cast<char *> (&r), 4)
-         && is.read (reinterpret_cast<char *> (&c), 4)
-         && is.read (reinterpret_cast<char *> (&tmp), 1)))
-    return false;
-  if (swap)
-    {
-      swap_bytes<4> (&r);
-      swap_bytes<4> (&c);
-    }
-
-  FloatDiagMatrix m (r, c);
-  float *re = m.fortran_vec ();
-  octave_idx_type len = m.length ();
-  read_floats (is, re, static_cast<save_type> (tmp), len, swap, fmt);
-  if (error_state || ! is)
-    return false;
-  matrix = m;
-
-  return true;
-}
-
-bool
-octave_float_diag_matrix::chk_valid_scalar (const octave_value& val,
-                                            float& x) const
-{
-  bool retval = val.is_real_scalar ();
-  if (retval)
-    x = val.float_value ();
-  return retval;
-}
--- a/src/ov-flt-re-diag.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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_float_diag_matrix_h)
-#define octave_float_diag_matrix_h 1
-
-#include "ov-base.h"
-#include "ov-base-diag.h"
-#include "ov-flt-re-mat.h"
-#include "ov-typeinfo.h"
-
-// Real diagonal matrix values.
-
-class
-OCTINTERP_API
-octave_float_diag_matrix
-  : public octave_base_diag<FloatDiagMatrix, FloatMatrix>
-{
-public:
-
-  octave_float_diag_matrix (void)
-    : octave_base_diag<FloatDiagMatrix, FloatMatrix> () { }
-
-  octave_float_diag_matrix (const FloatDiagMatrix& m)
-    : octave_base_diag<FloatDiagMatrix, FloatMatrix> (m) { }
-
-  octave_float_diag_matrix (const octave_float_diag_matrix& m)
-    : octave_base_diag<FloatDiagMatrix, FloatMatrix> (m) { }
-
-  ~octave_float_diag_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_float_diag_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_float_diag_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  builtin_type_t builtin_type (void) const { return btyp_float; }
-
-  bool is_real_matrix (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_single_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  DiagMatrix diag_matrix_value (bool = false) const;
-
-  FloatDiagMatrix float_diag_matrix_value (bool = false) const;
-
-  ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
-
-  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  bool chk_valid_scalar (const octave_value&,
-                         float&) const;
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-flt-re-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,886 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-#include <vector>
-
-#include "data-conv.h"
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-#include "mach-info.h"
-#include "mx-base.h"
-#include "quit.h"
-#include "oct-locbuf.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-mat.cc"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-flt-complex.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-re-sparse.h"
-#include "ov-flt-re-diag.h"
-#include "ov-flt-cx-diag.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-#include "ops.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-#if ! defined (UCHAR_MAX)
-#define UCHAR_MAX 255
-#endif
-
-template class octave_base_matrix<FloatNDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_float_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_matrix, "float matrix", "single");
-
-octave_base_value *
-octave_float_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.nelem () == 1)
-    retval = new octave_float_scalar (matrix (0));
-
-  return retval;
-}
-
-double
-octave_float_matrix::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (numel () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "real matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real matrix", "real scalar");
-
-  return retval;
-}
-
-float
-octave_float_matrix::float_value (bool) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (numel () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "real matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real matrix", "real scalar");
-
-  return retval;
-}
-
-// FIXME
-
-Matrix
-octave_float_matrix::matrix_value (bool) const
-{
-  return Matrix (matrix.matrix_value ());
-}
-
-FloatMatrix
-octave_float_matrix::float_matrix_value (bool) const
-{
-  return matrix.matrix_value ();
-}
-
-Complex
-octave_float_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "real matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real matrix", "complex scalar");
-
-  return retval;
-}
-
-FloatComplex
-octave_float_matrix::float_complex_value (bool) const
-{
-  double tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "real matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real matrix", "complex scalar");
-
-  return retval;
-}
-
-// FIXME
-
-ComplexMatrix
-octave_float_matrix::complex_matrix_value (bool) const
-{
-  return ComplexMatrix (matrix.matrix_value ());
-}
-
-FloatComplexMatrix
-octave_float_matrix::float_complex_matrix_value (bool) const
-{
-  return FloatComplexMatrix (matrix.matrix_value ());
-}
-
-ComplexNDArray
-octave_float_matrix::complex_array_value (bool) const
-{
-  return ComplexNDArray (matrix);
-}
-
-FloatComplexNDArray
-octave_float_matrix::float_complex_array_value (bool) const
-{
-  return FloatComplexNDArray (matrix);
-}
-
-NDArray
-octave_float_matrix::array_value (bool) const
-{
-  return NDArray (matrix);
-}
-
-boolNDArray
-octave_float_matrix::bool_array_value (bool warn) const
-{
-  if (matrix.any_element_is_nan ())
-    gripe_nan_to_logical_conversion ();
-  else if (warn && matrix.any_element_not_one_or_zero ())
-    gripe_logical_conversion ();
-
-  return boolNDArray (matrix);
-}
-
-charNDArray
-octave_float_matrix::char_array_value (bool) const
-{
-  charNDArray retval (dims ());
-
-  octave_idx_type nel = numel ();
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    retval.elem (i) = static_cast<char>(matrix.elem (i));
-
-  return retval;
-}
-
-SparseMatrix
-octave_float_matrix::sparse_matrix_value (bool) const
-{
-  return SparseMatrix (matrix_value ());
-}
-
-SparseComplexMatrix
-octave_float_matrix::sparse_complex_matrix_value (bool) const
-{
-  // FIXME Need a SparseComplexMatrix (Matrix) constructor to make
-  // this function more efficient. Then this should become
-  // return SparseComplexMatrix (matrix.matrix_value ());
-  return SparseComplexMatrix (sparse_matrix_value ());
-}
-
-octave_value
-octave_float_matrix::diag (octave_idx_type k) const
-{
-  octave_value retval;
-  if (k == 0 && matrix.ndims () == 2
-      && (matrix.rows () == 1 || matrix.columns () == 1))
-    retval = FloatDiagMatrix (DiagArray2<float> (matrix));
-  else
-    retval = octave_base_matrix<FloatNDArray>::diag (k);
-
-  return retval;
-}
-
-octave_value
-octave_float_matrix::diag (octave_idx_type m, octave_idx_type n) const
-{
-  octave_value retval;
-
-  if (matrix.ndims () == 2
-      && (matrix.rows () == 1 || matrix.columns () == 1))
-    {
-      FloatMatrix mat = matrix.matrix_value ();
-
-      retval = mat.diag (m, n);
-    }
-  else
-    error ("diag: expecting vector argument");
-
-  return retval;
-}
-
-octave_value
-octave_float_matrix::convert_to_str_internal (bool, bool, char type) const
-{
-  octave_value retval;
-  dim_vector dv = dims ();
-  octave_idx_type nel = dv.numel ();
-
-  charNDArray chm (dv);
-
-  bool warned = false;
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      octave_quit ();
-
-      float d = matrix (i);
-
-      if (xisnan (d))
-        {
-          gripe_nan_to_character_conversion ();
-          return retval;
-        }
-      else
-        {
-          int ival = NINT (d);
-
-          if (ival < 0 || ival > UCHAR_MAX)
-            {
-              // FIXME -- is there something
-              // better we could do?
-
-              ival = 0;
-
-              if (! warned)
-                {
-                  ::warning ("range error for conversion to character value");
-                  warned = true;
-                }
-            }
-
-          chm (i) = static_cast<char> (ival);
-        }
-    }
-
-  retval = octave_value (chm, type);
-
-  return retval;
-}
-
-bool
-octave_float_matrix::save_ascii (std::ostream& os)
-{
-  dim_vector d = dims ();
-
-  if (d.length () > 2)
-    {
-      FloatNDArray tmp = float_array_value ();
-
-      os << "# ndims: " << d.length () << "\n";
-
-      for (int i=0; i < d.length (); i++)
-        os << " " << d (i);
-
-      os << "\n" << tmp;
-    }
-  else
-    {
-      // Keep this case, rather than use generic code above for backward
-      // compatiability. Makes load_ascii much more complex!!
-      os << "# rows: " << rows () << "\n"
-         << "# columns: " << columns () << "\n";
-
-      os << float_matrix_value ();
-    }
-
-  return true;
-}
-
-bool
-octave_float_matrix::load_ascii (std::istream& is)
-{
-  bool success = true;
-
-  string_vector keywords(2);
-
-  keywords[0] = "ndims";
-  keywords[1] = "rows";
-
-  std::string kw;
-  octave_idx_type val = 0;
-
-  if (extract_keyword (is, keywords, kw, val, true))
-    {
-      if (kw == "ndims")
-        {
-          int mdims = static_cast<int> (val);
-
-          if (mdims >= 0)
-            {
-              dim_vector dv;
-              dv.resize (mdims);
-
-              for (int i = 0; i < mdims; i++)
-                is >> dv(i);
-
-              if (is)
-                {
-                  FloatNDArray tmp(dv);
-
-                  is >> tmp;
-
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else
-                {
-                  error ("load: failed to read dimensions");
-                  success = false;
-                }
-            }
-          else
-            {
-              error ("load: failed to extract number of dimensions");
-              success = false;
-            }
-        }
-      else if (kw == "rows")
-        {
-          octave_idx_type nr = val;
-          octave_idx_type nc = 0;
-
-          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
-            {
-              if (nr > 0 && nc > 0)
-                {
-                  FloatMatrix tmp (nr, nc);
-                  is >> tmp;
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else if (nr == 0 || nc == 0)
-                matrix = FloatMatrix (nr, nc);
-              else
-                panic_impossible ();
-            }
-          else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
-        }
-      else
-        panic_impossible ();
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_float_matrix::save_binary (std::ostream& os, bool&)
-{
-
-  dim_vector d = dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims to differentiate with old format!!
-  int32_t tmp = - d.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i = 0; i < d.length (); i++)
-    {
-      tmp = d(i);
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-    }
-
-  FloatNDArray m = float_array_value ();
-  save_type st = LS_FLOAT;
-  if (d.numel () > 8192) // FIXME -- make this configurable.
-    {
-      float max_val, min_val;
-      if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  const float *mtmp = m.data ();
-  write_floats (os, mtmp, st, d.numel ());
-
-  return true;
-}
-
-bool
-octave_float_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format fmt)
-{
-  char tmp;
-  int32_t mdims;
-  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&mdims);
-  if (mdims < 0)
-    {
-      mdims = - mdims;
-      int32_t di;
-      dim_vector dv;
-      dv.resize (mdims);
-
-      for (int i = 0; i < mdims; i++)
-        {
-          if (! is.read (reinterpret_cast<char *> (&di), 4))
-            return false;
-          if (swap)
-            swap_bytes<4> (&di);
-          dv(i) = di;
-        }
-
-      // Convert an array with a single dimension to be a row vector.
-      // Octave should never write files like this, other software
-      // might.
-
-      if (mdims == 1)
-        {
-          mdims = 2;
-          dv.resize (mdims);
-          dv(1) = dv(0);
-          dv(0) = 1;
-        }
-
-      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-        return false;
-
-      FloatNDArray m(dv);
-      float *re = m.fortran_vec ();
-      read_floats (is, re, static_cast<save_type> (tmp), dv.numel (), swap, fmt);
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  else
-    {
-      int32_t nr, nc;
-      nr = mdims;
-      if (! is.read (reinterpret_cast<char *> (&nc), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&nc);
-      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-        return false;
-      FloatMatrix m (nr, nc);
-      float *re = m.fortran_vec ();
-      octave_idx_type len = nr * nc;
-      read_floats (is, re, static_cast<save_type> (tmp), len, swap, fmt);
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_float_matrix::save_hdf5 (hid_t loc_id, const char *name, bool)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  int rank = dv.length ();
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-  FloatNDArray m = array_value ();
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
-
-  space_hid = H5Screate_simple (rank, hdims, 0);
-
-  if (space_hid < 0) return false;
-
-  hid_t save_type_hid = H5T_NATIVE_FLOAT;
-
-#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
-  // hdf5 currently doesn't support float/integer conversions
-  else
-    {
-      float max_val, min_val;
-
-      if (m.all_integers (max_val, min_val))
-        save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
-    }
-#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  float *mtmp = m.fortran_vec ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, mtmp) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_float_matrix::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-      return (empty > 0);
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank < 1)
-    {
-      H5Sclose (space_id);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  if (rank == 1)
-    {
-      dv.resize (2);
-      dv(0) = 1;
-      dv(1) = hdims[0];
-    }
-  else
-    {
-      dv.resize (rank);
-      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
-        dv(j) = hdims[i];
-    }
-
-  FloatNDArray m (dv);
-  float *re = m.fortran_vec ();
-  if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, re) >= 0)
-    {
-      retval = true;
-      matrix = m;
-    }
-
-  H5Sclose (space_id);
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-void
-octave_float_matrix::print_raw (std::ostream& os,
-                          bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, matrix, pr_as_read_syntax,
-                         current_print_indent_level ());
-}
-
-mxArray *
-octave_float_matrix::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxSINGLE_CLASS, dims (), mxREAL);
-
-  float *pr = static_cast<float *> (retval->get_data ());
-
-  mwSize nel = numel ();
-
-  const float *p = matrix.data ();
-
-  for (mwIndex i = 0; i < nel; i++)
-    pr[i] = p[i];
-
-  return retval;
-}
-
-// This uses a smarter strategy for doing the complex->real mappers.  We
-// allocate an array for a real result and keep filling it until a complex
-// result is produced.
-static octave_value
-do_rc_map (const FloatNDArray& a, FloatComplex (&fcn) (float))
-{
-  octave_idx_type n = a.numel ();
-  NoAlias<FloatNDArray> rr (a.dims ());
-
-  for (octave_idx_type i = 0; i < n; i++)
-    {
-      octave_quit ();
-
-      FloatComplex tmp = fcn (a(i));
-      if (tmp.imag () == 0.0)
-        rr(i) = tmp.real ();
-      else
-        {
-          NoAlias<FloatComplexNDArray> rc (a.dims ());
-
-          for (octave_idx_type j = 0; j < i; j++)
-            rc(j) = rr(j);
-
-          rc(i) = tmp;
-
-          for (octave_idx_type j = i+1; j < n; j++)
-            {
-              octave_quit ();
-
-              rc(j) = fcn (a(j));
-            }
-
-          return new octave_float_complex_matrix (rc);
-        }
-    }
-
-  return rr;
-}
-
-octave_value
-octave_float_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_imag:
-      return FloatNDArray (matrix.dims (), 0.0);
-
-    case umap_real:
-    case umap_conj:
-      return matrix;
-
-    // Mappers handled specially.
-#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.FCN ())
-
-      ARRAY_METHOD_MAPPER (abs, abs);
-      ARRAY_METHOD_MAPPER (isnan, isnan);
-      ARRAY_METHOD_MAPPER (isinf, isinf);
-      ARRAY_METHOD_MAPPER (finite, isfinite);
-
-#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.map<TYPE> (FCN))
-
-#define RC_ARRAY_MAPPER(UMAP, TYPE, FCN) \
-    case umap_ ## UMAP: \
-      return do_rc_map (matrix, FCN)
-
-      RC_ARRAY_MAPPER (acos, FloatComplex, rc_acos);
-      RC_ARRAY_MAPPER (acosh, FloatComplex, rc_acosh);
-      ARRAY_MAPPER (angle, float, ::arg);
-      ARRAY_MAPPER (arg, float, ::arg);
-      RC_ARRAY_MAPPER (asin, FloatComplex, rc_asin);
-      ARRAY_MAPPER (asinh, float, ::asinhf);
-      ARRAY_MAPPER (atan, float, ::atanf);
-      RC_ARRAY_MAPPER (atanh, FloatComplex, rc_atanh);
-      ARRAY_MAPPER (erf, float, ::erff);
-      ARRAY_MAPPER (erfinv, float, ::erfinv);
-      ARRAY_MAPPER (erfcinv, float, ::erfcinv);
-      ARRAY_MAPPER (erfc, float, ::erfcf);
-      ARRAY_MAPPER (erfcx, float, ::erfcx);
-      ARRAY_MAPPER (gamma, float, xgamma);
-      RC_ARRAY_MAPPER (lgamma, FloatComplex, rc_lgamma);
-      ARRAY_MAPPER (cbrt, float, ::cbrtf);
-      ARRAY_MAPPER (ceil, float, ::ceilf);
-      ARRAY_MAPPER (cos, float, ::cosf);
-      ARRAY_MAPPER (cosh, float, ::coshf);
-      ARRAY_MAPPER (exp, float, ::expf);
-      ARRAY_MAPPER (expm1, float, ::expm1f);
-      ARRAY_MAPPER (fix, float, ::fix);
-      ARRAY_MAPPER (floor, float, ::floorf);
-      RC_ARRAY_MAPPER (log, FloatComplex, rc_log);
-      RC_ARRAY_MAPPER (log2, FloatComplex, rc_log2);
-      RC_ARRAY_MAPPER (log10, FloatComplex, rc_log10);
-      RC_ARRAY_MAPPER (log1p, FloatComplex, rc_log1p);
-      ARRAY_MAPPER (round, float, xround);
-      ARRAY_MAPPER (roundb, float, xroundb);
-      ARRAY_MAPPER (signum, float, ::signum);
-      ARRAY_MAPPER (sin, float, ::sinf);
-      ARRAY_MAPPER (sinh, float, ::sinhf);
-      RC_ARRAY_MAPPER (sqrt, FloatComplex, rc_sqrt);
-      ARRAY_MAPPER (tan, float, ::tanf);
-      ARRAY_MAPPER (tanh, float, ::tanhf);
-      ARRAY_MAPPER (isna, bool, octave_is_NA);
-
-    default:
-      return octave_base_value::map (umap);
-    }
-}
-
-DEFUN (single, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} single (@var{x})\n\
-Convert @var{x} to single precision type.\n\
-@seealso{double}\n\
-@end deftypefn")
-{
-  // The OCTAVE_TYPE_CONV_BODY3 macro declares retval, so they go
-  // inside their own scopes, and we don't declare retval here to
-  // avoid a shadowed declaration warning.
-
-  if (args.length () == 1)
-    {
-      if (args(0).is_diag_matrix ())
-        {
-          if (args(0).is_complex_type ())
-            {
-              OCTAVE_TYPE_CONV_BODY3 (single, octave_float_complex_diag_matrix, octave_float_complex);
-            }
-          else
-            {
-              OCTAVE_TYPE_CONV_BODY3 (single, octave_float_diag_matrix, octave_float_scalar);
-            }
-        }
-      else if (args(0).is_sparse_type ())
-        {
-          error ("single: sparse type does not support single precision");
-        }
-      else if (args(0).is_complex_type ())
-        {
-          OCTAVE_TYPE_CONV_BODY3 (single, octave_float_complex_matrix, octave_float_complex);
-        }
-      else
-        {
-          OCTAVE_TYPE_CONV_BODY3 (single, octave_float_matrix, octave_float_scalar);
-        }
-    }
-  else
-    print_usage ();
-
-  return octave_value ();
-}
-
-/*
-%!assert (class (single (1)), "single")
-%!assert (class (single (1 + i)), "single")
-%!assert (class (single (int8 (1))), "single")
-%!assert (class (single (uint8 (1))), "single")
-%!assert (class (single (int16 (1))), "single")
-%!assert (class (single (uint16 (1))), "single")
-%!assert (class (single (int32 (1))), "single")
-%!assert (class (single (uint32 (1))), "single")
-%!assert (class (single (int64 (1))), "single")
-%!assert (class (single (uint64 (1))), "single")
-%!assert (class (single (true)), "single")
-%!assert (class (single ("A")), "single")
-%!error (single (sparse (1)))
-%!test
-%! x = diag ([1 3 2]);
-%! y = single (x);
-%! assert (class (x), "double");
-%! assert (class (y), "single");
-%!test
-%! x = diag ([i 3 2]);
-%! y = single (x);
-%! assert (class (x), "double");
-%! assert (class (y), "single");
-*/
--- a/src/ov-flt-re-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_float_matrix_h)
-#define octave_float_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-typeinfo.h"
-
-#include "MatrixType.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Real matrix values.
-
-class
-OCTINTERP_API
-octave_float_matrix : public octave_base_matrix<FloatNDArray>
-{
-public:
-
-  octave_float_matrix (void)
-    : octave_base_matrix<FloatNDArray> () { }
-
-  octave_float_matrix (const FloatMatrix& m)
-    : octave_base_matrix<FloatNDArray> (m) { }
-
-  octave_float_matrix (const FloatMatrix& m, const MatrixType& t)
-    : octave_base_matrix<FloatNDArray> (m, t) { }
-
-  octave_float_matrix (const FloatNDArray& nda)
-    : octave_base_matrix<FloatNDArray> (nda) { }
-
-  octave_float_matrix (const Array<float>& m)
-    : octave_base_matrix<FloatNDArray> (FloatNDArray (m)) { }
-
-  octave_float_matrix (const FloatDiagMatrix& d)
-    : octave_base_matrix<FloatNDArray> (FloatMatrix (d)) { }
-
-  octave_float_matrix (const FloatRowVector& v)
-    : octave_base_matrix<FloatNDArray> (FloatMatrix (v)) { }
-
-  octave_float_matrix (const FloatColumnVector& v)
-    : octave_base_matrix<FloatNDArray> (FloatMatrix (v)) { }
-
-  octave_float_matrix (const octave_float_matrix& m)
-    : octave_base_matrix<FloatNDArray> (m) { }
-
-  ~octave_float_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_float_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_float_matrix (); }
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  idx_vector index_vector (void) const
-    { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
-
-  builtin_type_t builtin_type (void) const { return btyp_float; }
-
-  bool is_real_matrix (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_single_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  int8NDArray
-  int8_array_value (void) const { return int8NDArray (matrix); }
-
-  int16NDArray
-  int16_array_value (void) const { return int16NDArray (matrix); }
-
-  int32NDArray
-  int32_array_value (void) const { return int32NDArray (matrix); }
-
-  int64NDArray
-  int64_array_value (void) const { return int64NDArray (matrix); }
-
-  uint8NDArray
-  uint8_array_value (void) const { return uint8NDArray (matrix); }
-
-  uint16NDArray
-  uint16_array_value (void) const { return uint16NDArray (matrix); }
-
-  uint32NDArray
-  uint32_array_value (void) const { return uint32NDArray (matrix); }
-
-  uint64NDArray
-  uint64_array_value (void) const { return uint64NDArray (matrix); }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  float float_scalar_value (bool frc_str_conv = false) const
-    { return float_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  FloatMatrix float_matrix_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool warn = false) const;
-
-  charNDArray char_array_value (bool = false) const;
-
-  NDArray array_value (bool = false) const;
-
-  FloatNDArray float_array_value (bool = false) const { return matrix; }
-
-  SparseMatrix sparse_matrix_value (bool = false) const;
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
-
-  octave_value diag (octave_idx_type k = 0) const;
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  // Use matrix_ref here to clear index cache.
-  void increment (void) { matrix_ref () += 1.0; }
-
-  void decrement (void) { matrix_ref () -= 1.0; }
-
-  void changesign (void) { matrix_ref ().changesign (); }
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const { return matrix.mex_get_data (); }
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-int-traits.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_value_int_traits_h)
-#define octave_value_int_traits_h 1
-
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-
-template <class T>
-class
-octave_value_int_traits
-{
-public:
-  typedef T scalar_type;
-};
-
-#define OCTAVE_VALUE_INT_TRAITS(MT, ST) \
-  template<> \
-  class \
-  octave_value_int_traits<MT> \
-  { \
-  public: \
-    typedef ST scalar_type; \
-  }
-
-OCTAVE_VALUE_INT_TRAITS(int8NDArray, octave_int8_scalar);
-OCTAVE_VALUE_INT_TRAITS(int16NDArray, octave_int16_scalar);
-OCTAVE_VALUE_INT_TRAITS(int32NDArray, octave_int32_scalar);
-OCTAVE_VALUE_INT_TRAITS(int64NDArray, octave_int64_scalar);
-
-OCTAVE_VALUE_INT_TRAITS(uint8NDArray, octave_uint8_scalar);
-OCTAVE_VALUE_INT_TRAITS(uint16NDArray, octave_uint16_scalar);
-OCTAVE_VALUE_INT_TRAITS(uint32NDArray, octave_uint32_scalar);
-OCTAVE_VALUE_INT_TRAITS(uint64NDArray, octave_uint64_scalar);
-
-#endif
--- a/src/ov-int16.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ops.h"
-#include "ov-base.h"
-
-#ifdef HAVE_HDF5
-#define HDF5_SAVE_TYPE H5T_NATIVE_INT16
-#endif
-
-#include "ov-base-int.h"
-#include "ov-base-int.cc"
-#include "ov-int16.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-template class octave_base_matrix<int16NDArray>;
-
-template class octave_base_int_matrix<int16NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_int16_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int16_matrix,
-                                     "int16 matrix", "int16");
-
-template class octave_base_scalar<octave_int16>;
-
-template class octave_base_int_scalar<octave_int16>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_int16_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int16_scalar,
-                                     "int16 scalar", "int16");
-
-DEFUN (int16, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} int16 (@var{x})\n\
-Convert @var{x} to 16-bit integer type.\n\
-@end deftypefn")
-{
-  OCTAVE_TYPE_CONV_BODY (int16);
-}
-
-/*
-%!assert (class (int16 (1)), "int16")
-%!assert (int16 (1.25), int16 (1))
-%!assert (int16 (1.5), int16 (2))
-%!assert (int16 (-1.5), int16 (-2))
-%!assert (int16 (2^17), int16 (2^16-1))
-%!assert (int16 (-2^17), int16 (-2^16))
-*/
--- a/src/ov-int16.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_int16_h)
-#define octave_int16_h 1
-
-#define OCTAVE_INT_T octave_int16
-
-#define OCTAVE_VALUE_INT_MATRIX_T octave_int16_matrix
-#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int16_array_value
-
-#define OCTAVE_VALUE_INT_SCALAR_T octave_int16_scalar
-#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int16_scalar_value
-
-#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int16_type
-
-#define OCTAVE_INT_MX_CLASS mxINT16_CLASS
-
-#define OCTAVE_INT_BTYP btyp_int16
-
-#include "ov-intx.h"
-
-#undef OCTAVE_INT_T
-
-#undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_TYPE_PREDICATE_FUNCTION
-
-#undef OCTAVE_INT_MX_CLASS
-
-#undef OCTAVE_INT_BTYP
-
-#endif
--- a/src/ov-int32.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ops.h"
-#include "ov-base.h"
-
-#ifdef HAVE_HDF5
-#define HDF5_SAVE_TYPE H5T_NATIVE_INT32
-#endif
-
-#include "ov-base-int.h"
-#include "ov-base-int.cc"
-#include "ov-int32.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-template class octave_base_matrix<int32NDArray>;
-
-template class octave_base_int_matrix<int32NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_int32_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int32_matrix,
-                                     "int32 matrix", "int32");
-
-template class octave_base_scalar<octave_int32>;
-
-template class octave_base_int_scalar<octave_int32>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_int32_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int32_scalar,
-                                     "int32 scalar", "int32");
-
-DEFUN (int32, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} int32 (@var{x})\n\
-Convert @var{x} to 32-bit integer type.\n\
-@end deftypefn")
-{
-  OCTAVE_TYPE_CONV_BODY (int32);
-}
-
-/*
-%!assert (class (int32 (1)), "int32")
-%!assert (int32 (1.25), int32 (1))
-%!assert (int32 (1.5), int32 (2))
-%!assert (int32 (-1.5), int32 (-2))
-%!assert (int32 (2^33), int32 (2^32-1))
-%!assert (int32 (-2^33), int32 (-2^32))
-*/
--- a/src/ov-int32.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_int32_h)
-#define octave_int32_h 1
-
-#define OCTAVE_INT_T octave_int32
-
-#define OCTAVE_VALUE_INT_MATRIX_T octave_int32_matrix
-#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int32_array_value
-
-#define OCTAVE_VALUE_INT_SCALAR_T octave_int32_scalar
-#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int32_scalar_value
-
-#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int32_type
-
-#define OCTAVE_INT_MX_CLASS mxINT32_CLASS
-
-#define OCTAVE_INT_BTYP btyp_int32
-
-#include "ov-intx.h"
-
-#undef OCTAVE_INT_T
-
-#undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_TYPE_PREDICATE_FUNCTION
-
-#undef OCTAVE_INT_MX_CLASS
-
-#undef OCTAVE_INT_BTYP
-
-#endif
--- a/src/ov-int64.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ops.h"
-#include "ov-base.h"
-
-#ifdef HAVE_HDF5
-#define HDF5_SAVE_TYPE H5T_NATIVE_INT64
-#endif
-
-#include "ov-base-int.h"
-#include "ov-base-int.cc"
-#include "ov-int64.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-template class octave_base_matrix<int64NDArray>;
-
-template class octave_base_int_matrix<int64NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_int64_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int64_matrix,
-                                     "int64 matrix", "int64");
-
-template class octave_base_scalar<octave_int64>;
-
-template class octave_base_int_scalar<octave_int64>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_int64_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int64_scalar,
-                                     "int64 scalar", "int64");
-
-DEFUN (int64, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} int64 (@var{x})\n\
-Convert @var{x} to 64-bit integer type.\n\
-@end deftypefn")
-{
-  OCTAVE_TYPE_CONV_BODY (int64);
-}
-
-/*
-%!assert (class (int64 (1)), "int64")
-%!assert (int64 (1.25), int64 (1))
-%!assert (int64 (1.5), int64 (2))
-%!assert (int64 (-1.5), int64 (-2))
-%!assert (int64 (2^65), int64 (2^64-1))
-%!assert (int64 (-2^65), int64 (-2^64))
-*/
--- a/src/ov-int64.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_int64_h)
-#define octave_int64_h 1
-
-#define OCTAVE_INT_T octave_int64
-
-#define OCTAVE_VALUE_INT_MATRIX_T octave_int64_matrix
-#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int64_array_value
-
-#define OCTAVE_VALUE_INT_SCALAR_T octave_int64_scalar
-#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int64_scalar_value
-
-#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int64_type
-
-#define OCTAVE_INT_MX_CLASS mxINT64_CLASS
-
-#define OCTAVE_INT_BTYP btyp_int64
-
-#include "ov-intx.h"
-
-#undef OCTAVE_INT_T
-
-#undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_TYPE_PREDICATE_FUNCTION
-
-#undef OCTAVE_INT_MX_CLASS
-
-#undef OCTAVE_INT_BTYP
-
-#endif
--- a/src/ov-int8.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ops.h"
-#include "ov-base.h"
-
-#ifdef HAVE_HDF5
-#define HDF5_SAVE_TYPE H5T_NATIVE_INT8
-#endif
-
-#include "ov-base-int.h"
-#include "ov-base-int.cc"
-#include "ov-int8.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-template class octave_base_matrix<int8NDArray>;
-
-template class octave_base_int_matrix<int8NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_int8_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int8_matrix,
-                                     "int8 matrix", "int8");
-
-template class octave_base_scalar<octave_int8>;
-
-template class octave_base_int_scalar<octave_int8>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_int8_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int8_scalar,
-                                     "int8 scalar", "int8");
-
-DEFUN (int8, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} int8 (@var{x})\n\
-Convert @var{x} to 8-bit integer type.\n\
-@end deftypefn")
-{
-  OCTAVE_TYPE_CONV_BODY (int8);
-}
-
-/*
-%!assert (class (int8 (1)), "int8")
-%!assert (int8 (1.25), int8 (1))
-%!assert (int8 (1.5), int8 (2))
-%!assert (int8 (-1.5), int8 (-2))
-%!assert (int8 (2^9), int8 (2^8-1))
-%!assert (int8 (-2^9), int8 (-2^8))
-*/
--- a/src/ov-int8.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_int8_h)
-#define octave_int8_h 1
-
-#define OCTAVE_INT_T octave_int8
-
-#define OCTAVE_VALUE_INT_MATRIX_T octave_int8_matrix
-#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int8_array_value
-
-#define OCTAVE_VALUE_INT_SCALAR_T octave_int8_scalar
-#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int8_scalar_value
-
-#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int8_type
-
-#define OCTAVE_INT_MX_CLASS mxINT8_CLASS
-
-#define OCTAVE_INT_BTYP btyp_int8
-
-#include "ov-intx.h"
-
-#undef OCTAVE_INT_T
-
-#undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_TYPE_PREDICATE_FUNCTION
-
-#undef OCTAVE_INT_MX_CLASS
-
-#undef OCTAVE_INT_BTYP
-
-#endif
--- a/src/ov-intx.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,668 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-Copyright (C) 2010 VZLU Prague
-
-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/>.
-
-*/
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-base-int.h"
-#include "ov-typeinfo.h"
-#include "gripes.h"
-
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-
-class
-OCTINTERP_API
-OCTAVE_VALUE_INT_MATRIX_T
-  : public octave_base_int_matrix<intNDArray<OCTAVE_INT_T> >
-{
-public:
-
-  OCTAVE_VALUE_INT_MATRIX_T (void)
-    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > () { }
-
-  OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda)
-    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > (nda) { }
-
-  OCTAVE_VALUE_INT_MATRIX_T (const Array<OCTAVE_INT_T>& nda)
-    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> >
-        (intNDArray<OCTAVE_INT_T> (nda)) { }
-
-  ~OCTAVE_VALUE_INT_MATRIX_T (void) { }
-
-  octave_base_value *clone (void) const
-    { return new OCTAVE_VALUE_INT_MATRIX_T (*this); }
-
-  octave_base_value *empty_clone (void) const
-    { return new OCTAVE_VALUE_INT_MATRIX_T (); }
-
-  bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; }
-
-  bool is_integer_type (void) const { return true; }
-
-  builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
-
-public:
-
-  int8NDArray
-  int8_array_value (void) const { return int8NDArray (matrix); }
-
-  int16NDArray
-  int16_array_value (void) const { return int16NDArray (matrix); }
-
-  int32NDArray
-  int32_array_value (void) const { return int32NDArray (matrix); }
-
-  int64NDArray
-  int64_array_value (void) const { return int64NDArray (matrix); }
-
-  uint8NDArray
-  uint8_array_value (void) const { return uint8NDArray (matrix); }
-
-  uint16NDArray
-  uint16_array_value (void) const { return uint16NDArray (matrix); }
-
-  uint32NDArray
-  uint32_array_value (void) const { return uint32NDArray (matrix); }
-
-  uint64NDArray
-  uint64_array_value (void) const { return uint64NDArray (matrix); }
-
-  double
-  double_value (bool = false) const
-    {
-      double retval = lo_ieee_nan_value ();
-
-      if (numel () > 0)
-        {
-          gripe_implicit_conversion ("Octave:array-to-scalar",
-                                     type_name (), "real scalar");
-
-          retval = matrix(0).double_value ();
-        }
-      else
-        gripe_invalid_conversion (type_name (), "real scalar");
-
-      return retval;
-
-    }
-
-  float
-  float_value (bool = false) const
-    {
-      float retval = lo_ieee_float_nan_value ();
-
-      if (numel () > 0)
-        {
-          gripe_implicit_conversion ("Octave:array-to-scalar",
-                                     type_name (), "real scalar");
-
-          retval = matrix(0).float_value ();
-        }
-      else
-        gripe_invalid_conversion (type_name (), "real scalar");
-
-      return retval;
-
-    }
-
-  double scalar_value (bool = false) const { return double_value (); }
-
-  float float_scalar_value (bool = false) const { return float_value (); }
-
-  Matrix
-  matrix_value (bool = false) const
-    {
-      Matrix retval;
-      dim_vector dv = dims ();
-      if (dv.length () > 2)
-        error ("invalid conversion of %s to Matrix", type_name ().c_str ());
-      else
-        {
-          retval = Matrix (dv(0), dv(1));
-          double *vec = retval.fortran_vec ();
-          octave_idx_type nel = matrix.numel ();
-          for (octave_idx_type i = 0; i < nel; i++)
-            vec[i] = matrix(i).double_value ();
-        }
-      return retval;
-    }
-
-  FloatMatrix
-  float_matrix_value (bool = false) const
-    {
-      FloatMatrix retval;
-      dim_vector dv = dims ();
-      if (dv.length () > 2)
-        error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ());
-      else
-        {
-          retval = FloatMatrix (dv(0), dv(1));
-          float *vec = retval.fortran_vec ();
-          octave_idx_type nel = matrix.numel ();
-          for (octave_idx_type i = 0; i < nel; i++)
-            vec[i] = matrix(i).float_value ();
-        }
-      return retval;
-    }
-
-  ComplexMatrix
-  complex_matrix_value (bool = false) const
-    {
-      ComplexMatrix retval;
-      dim_vector dv = dims ();
-      if (dv.length () > 2)
-        error ("invalid conversion of %s to Matrix", type_name ().c_str ());
-      else
-        {
-          retval = ComplexMatrix (dv(0), dv(1));
-          Complex *vec = retval.fortran_vec ();
-          octave_idx_type nel = matrix.numel ();
-          for (octave_idx_type i = 0; i < nel; i++)
-            vec[i] = Complex (matrix(i).double_value ());
-        }
-      return retval;
-    }
-
-  FloatComplexMatrix
-  float_complex_matrix_value (bool = false) const
-    {
-      FloatComplexMatrix retval;
-      dim_vector dv = dims ();
-      if (dv.length () > 2)
-        error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ());
-      else
-        {
-          retval = FloatComplexMatrix (dv(0), dv(1));
-          FloatComplex *vec = retval.fortran_vec ();
-          octave_idx_type nel = matrix.numel ();
-          for (octave_idx_type i = 0; i < nel; i++)
-            vec[i] = FloatComplex (matrix(i).float_value ());
-        }
-      return retval;
-    }
-
-  NDArray
-  array_value (bool = false) const
-    {
-      NDArray retval (matrix.dims ());
-      double *vec = retval.fortran_vec ();
-      octave_idx_type nel = matrix.numel ();
-      for (octave_idx_type i = 0; i < nel; i++)
-        vec[i] = matrix(i).double_value ();
-      return retval;
-    }
-
-  FloatNDArray
-  float_array_value (bool = false) const
-    {
-      FloatNDArray retval (matrix.dims ());
-      float *vec = retval.fortran_vec ();
-      octave_idx_type nel = matrix.numel ();
-      for (octave_idx_type i = 0; i < nel; i++)
-        vec[i] = matrix(i).float_value ();
-      return retval;
-    }
-
-  ComplexNDArray
-  complex_array_value (bool = false) const
-    {
-      ComplexNDArray retval (matrix.dims ());
-      Complex *vec = retval.fortran_vec ();
-      octave_idx_type nel = matrix.numel ();
-      for (octave_idx_type i = 0; i < nel; i++)
-        vec[i] = Complex (matrix(i).double_value ());
-      return retval;
-    }
-
-  FloatComplexNDArray
-  float_complex_array_value (bool = false) const
-    {
-      FloatComplexNDArray retval (matrix.dims ());
-      FloatComplex *vec = retval.fortran_vec ();
-      octave_idx_type nel = matrix.numel ();
-      for (octave_idx_type i = 0; i < nel; i++)
-        vec[i] = FloatComplex (matrix(i).float_value ());
-      return retval;
-    }
-
-  boolNDArray
-  bool_array_value (bool warn = false) const
-  {
-    boolNDArray retval (dims ());
-
-    octave_idx_type nel = numel ();
-
-    if (warn && matrix.any_element_not_one_or_zero ())
-      gripe_logical_conversion ();
-
-    bool *vec = retval.fortran_vec ();
-    for (octave_idx_type i = 0; i < nel; i++)
-      vec[i] = matrix(i).bool_value ();
-
-    return retval;
-  }
-
-  charNDArray
-  char_array_value (bool = false) const
-  {
-    charNDArray retval (dims ());
-
-    octave_idx_type nel = numel ();
-
-    char *vec = retval.fortran_vec ();
-    for (octave_idx_type i = 0; i < nel; i++)
-      vec[i] = matrix(i).char_value ();
-
-    return retval;
-  }
-
-  // Use matrix_ref here to clear index cache.
-  void increment (void)
-   {
-     matrix_ref () += OCTAVE_INT_T (1);
-   }
-
-  void decrement (void)
-   {
-     matrix_ref () -= OCTAVE_INT_T (1);
-   }
-
-  void changesign (void)
-   {
-     matrix_ref ().changesign ();
-   }
-
-  idx_vector index_vector (void) const
-    { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const { return matrix.mex_get_data (); }
-
-  mxArray *as_mxArray (void) const
-  {
-    mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, dims (), mxREAL);
-
-    OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> (retval->get_data ());
-
-    mwSize nel = numel ();
-
-    const OCTAVE_INT_T *p = matrix.data ();
-
-    for (mwIndex i = 0; i < nel; i++)
-      pr[i] = p[i].value ();
-
-    return retval;
-  }
-
-  octave_value map (unary_mapper_t umap) const
-    {
-      switch (umap)
-        {
-        case umap_abs:
-          return matrix.abs ();
-        case umap_signum:
-          return matrix.signum ();
-        case umap_ceil:
-        case umap_conj:
-        case umap_fix:
-        case umap_floor:
-        case umap_real:
-        case umap_round:
-          return matrix;
-        case umap_imag:
-          return intNDArray<OCTAVE_INT_T> (matrix.dims (), OCTAVE_INT_T ());
-        case umap_isnan:
-        case umap_isna:
-        case umap_isinf:
-          return boolNDArray (matrix.dims (), false);
-        case umap_finite:
-          return boolNDArray (matrix.dims (), true);
-
-        default:
-          {
-            octave_matrix m (array_value ());
-            return m.map (umap);
-          }
-        }
-    }
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-class
-OCTINTERP_API
-OCTAVE_VALUE_INT_SCALAR_T
-  : public octave_base_int_scalar<OCTAVE_INT_T>
-{
-public:
-
-  OCTAVE_VALUE_INT_SCALAR_T (void)
-    : octave_base_int_scalar<OCTAVE_INT_T> () { }
-
-  OCTAVE_VALUE_INT_SCALAR_T (const OCTAVE_INT_T& nda)
-    : octave_base_int_scalar<OCTAVE_INT_T> (nda) { }
-
-  ~OCTAVE_VALUE_INT_SCALAR_T (void) { }
-
-  octave_base_value *clone (void) const
-    { return new OCTAVE_VALUE_INT_SCALAR_T (*this); }
-
-  octave_base_value *empty_clone (void) const
-    { return new OCTAVE_VALUE_INT_MATRIX_T (); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false)
-    {
-      // FIXME -- this doesn't solve the problem of
-      //
-      //   a = 1; a([1,1], [1,1], [1,1])
-      //
-      // and similar constructions.  Hmm...
-
-      // FIXME -- using this constructor avoids narrowing the
-      // 1x1 matrix back to a scalar value.  Need a better solution
-      // to this problem.
-
-      octave_value tmp
-        (new OCTAVE_VALUE_INT_MATRIX_T
-         (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ()));
-
-      return tmp.do_index_op (idx, resize_ok);
-    }
-
-  bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; }
-
-  bool is_integer_type (void) const { return true; }
-
-  builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
-
-public:
-
-  octave_int8
-  int8_scalar_value (void) const { return octave_int8 (scalar); }
-
-  octave_int16
-  int16_scalar_value (void) const { return octave_int16 (scalar); }
-
-  octave_int32
-  int32_scalar_value (void) const { return octave_int32 (scalar); }
-
-  octave_int64
-  int64_scalar_value (void) const { return octave_int64 (scalar); }
-
-  octave_uint8
-  uint8_scalar_value (void) const { return octave_uint8 (scalar); }
-
-  octave_uint16
-  uint16_scalar_value (void) const { return octave_uint16 (scalar); }
-
-  octave_uint32
-  uint32_scalar_value (void) const { return octave_uint32 (scalar); }
-
-  octave_uint64
-  uint64_scalar_value (void) const { return octave_uint64 (scalar); }
-
-  int8NDArray
-  int8_array_value (void) const
-    { return int8NDArray (dim_vector (1, 1), int8_scalar_value ()); }
-
-  int16NDArray
-  int16_array_value (void) const
-    { return int16NDArray (dim_vector (1, 1), int16_scalar_value ()); }
-
-  int32NDArray
-  int32_array_value (void) const
-    { return int32NDArray (dim_vector (1, 1), int32_scalar_value ()); }
-
-  int64NDArray
-  int64_array_value (void) const
-    { return int64NDArray (dim_vector (1, 1), int64_scalar_value ()); }
-
-  uint8NDArray
-  uint8_array_value (void) const
-    { return uint8NDArray (dim_vector (1, 1), uint8_scalar_value ()); }
-
-  uint16NDArray
-  uint16_array_value (void) const
-    { return uint16NDArray (dim_vector (1, 1), uint16_scalar_value ()); }
-
-  uint32NDArray
-  uint32_array_value (void) const
-    { return uint32NDArray (dim_vector (1, 1), uint32_scalar_value ()); }
-
-  uint64NDArray
-  uint64_array_value (void) const
-    { return uint64NDArray (dim_vector (1, 1), uint64_scalar_value ()); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const
-    {
-      if (fill)
-        {
-          intNDArray<OCTAVE_INT_T> retval (dv, 0);
-          if (dv.numel ())
-            retval(0) = scalar;
-          return retval;
-        }
-      else
-        {
-          intNDArray<OCTAVE_INT_T> retval (dv);
-          if (dv.numel ())
-            retval(0) = scalar;
-          return retval;
-        }
-    }
-
-  double double_value (bool = false) const { return scalar.double_value (); }
-
-  float float_value (bool = false) const { return scalar.float_value (); }
-
-  double scalar_value (bool = false) const { return scalar.double_value (); }
-
-  float float_scalar_value (bool = false) const { return scalar.float_value (); }
-
-  Matrix
-  matrix_value (bool = false) const
-    {
-      Matrix retval (1, 1);
-      retval(0,0) = scalar.double_value ();
-      return retval;
-    }
-
-  FloatMatrix
-  float_matrix_value (bool = false) const
-    {
-      FloatMatrix retval (1, 1);
-      retval(0,0) = scalar.float_value ();
-      return retval;
-    }
-
-  ComplexMatrix
-  complex_matrix_value (bool = false) const
-    {
-      ComplexMatrix retval (1, 1);
-      retval(0,0) = Complex (scalar.double_value ());
-      return retval;
-    }
-
-  FloatComplexMatrix
-  float_complex_matrix_value (bool = false) const
-    {
-      FloatComplexMatrix retval (1, 1);
-      retval(0,0) = FloatComplex (scalar.float_value ());
-      return retval;
-    }
-
-  NDArray
-  array_value (bool = false) const
-    {
-      NDArray retval (dim_vector (1, 1));
-      retval(0) = scalar.double_value ();
-      return retval;
-    }
-
-  FloatNDArray
-  float_array_value (bool = false) const
-    {
-      FloatNDArray retval (dim_vector (1, 1));
-      retval(0) = scalar.float_value ();
-      return retval;
-    }
-
-  ComplexNDArray
-  complex_array_value (bool = false) const
-    {
-      ComplexNDArray retval (dim_vector (1, 1));
-      retval(0) = FloatComplex (scalar.double_value ());
-      return retval;
-    }
-
-  FloatComplexNDArray
-  float_complex_array_value (bool = false) const
-    {
-      FloatComplexNDArray retval (dim_vector (1, 1));
-      retval(0) = FloatComplex (scalar.float_value ());
-      return retval;
-    }
-
-  bool bool_value (bool warn = false) const
-  {
-    if (warn && scalar != 0.0 && scalar != 1.0)
-      gripe_logical_conversion ();
-
-    return scalar.bool_value ();
-  }
-
-  boolNDArray
-  bool_array_value (bool warn = false) const
-  {
-    boolNDArray retval (dim_vector (1, 1));
-
-    if (warn && scalar != 0.0 && scalar != 1.0)
-      gripe_logical_conversion ();
-
-    retval(0) = scalar.bool_value ();
-
-    return retval;
-  }
-
-  charNDArray
-  char_array_value (bool = false) const
-  {
-    charNDArray retval (dim_vector (1, 1));
-    retval(0) = scalar.char_value ();
-    return retval;
-  }
-
-  void increment (void)
-   {
-     scalar += OCTAVE_INT_T (1);
-   }
-
-  void decrement (void)
-   {
-     scalar -= OCTAVE_INT_T (1);
-   }
-
-  idx_vector index_vector (void) const { return idx_vector (scalar); }
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, octave_idx_type skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      return os.write (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (),
-                       block_size, output_type, skip, flt_fmt);
-    }
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const { return scalar.mex_get_data (); }
-
-  mxArray *as_mxArray (void) const
-  {
-    mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, 1, 1, mxREAL);
-
-    OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> (retval->get_data ());
-
-    pr[0] = scalar.value ();
-
-    return retval;
-  }
-
-  octave_value map (unary_mapper_t umap) const
-    {
-      switch (umap)
-        {
-        case umap_abs:
-          return scalar.abs ();
-        case umap_signum:
-          return scalar.signum ();
-        case umap_ceil:
-        case umap_conj:
-        case umap_fix:
-        case umap_floor:
-        case umap_real:
-        case umap_round:
-          return scalar;
-        case umap_imag:
-          return OCTAVE_INT_T ();
-        case umap_isnan:
-        case umap_isna:
-        case umap_isinf:
-          return false;
-        case umap_finite:
-          return true;
-
-        default:
-          {
-            octave_scalar m (scalar_value ());
-            return m.map (umap);
-          }
-        }
-    }
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
--- a/src/ov-lazy-idx.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-/*
-
-Copyright (C) 2010-2012 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ov-lazy-idx.h"
-#include "ops.h"
-#include "ov-scalar.h"
-#include "ls-oct-ascii.h"
-#include "ls-oct-binary.h"
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_lazy_index, "lazy_index", "double");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_lazy_index&);
-
-  return v.full_value ().clone ();
-}
-
-octave_base_value::type_conv_info
-octave_lazy_index::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_lazy_index::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  switch (index.length (0))
-    {
-    case 1:
-      retval = new octave_scalar (static_cast<double> (index(0) + 1));
-      break;
-
-    case 0:
-      retval = new octave_matrix (NDArray (index.orig_dimensions ()));
-      break;
-
-    default:
-      break;
-    }
-
-  return retval;
-}
-
-octave_value
-octave_lazy_index::reshape (const dim_vector& new_dims) const
-{
-  return idx_vector (index.as_array ().reshape (new_dims),
-                     index.extent (0));
-}
-
-octave_value
-octave_lazy_index::permute (const Array<int>& vec, bool inv) const
-{
-  // If the conversion has already been made, forward the operation.
-  if (value.is_defined ())
-    return value.permute (vec, inv);
-  else
-    return idx_vector (index.as_array ().permute (vec, inv),
-                       index.extent (0));
-}
-
-octave_value
-octave_lazy_index::squeeze (void) const
-{
-  return idx_vector (index.as_array ().squeeze (),
-                     index.extent (0));
-}
-
-octave_value
-octave_lazy_index::sort (octave_idx_type dim, sortmode mode) const
-{
-  const dim_vector odims = index.orig_dimensions ();
-  // index_vector can employ a more efficient sorting algorithm.
-  if (mode == ASCENDING && odims.length () == 2
-      && (dim >= 0 && dim <= 1) && odims (1-dim) == 1)
-    return index_vector ().sorted ();
-  else
-    return idx_vector (index.as_array ().sort (dim, mode),
-                       index.extent (0));
-}
-
-octave_value
-octave_lazy_index::sort (Array<octave_idx_type> &sidx, octave_idx_type dim,
-                         sortmode mode) const
-{
-  const dim_vector odims = index.orig_dimensions ();
-  // index_vector can employ a more efficient sorting algorithm.
-  if (mode == ASCENDING && odims.length () == 2
-      && (dim >= 0 && dim <= 1) && odims (1-dim) == 1)
-    return index_vector ().sorted (sidx);
-  else
-    return idx_vector (index.as_array ().sort (sidx, dim, mode),
-                       index.extent (0));
-}
-
-sortmode
-octave_lazy_index::is_sorted (sortmode mode) const
-{
-  if (index.is_range ())
-    {
-      // Avoid the array conversion.
-      octave_idx_type inc = index.increment ();
-      if (inc == 0)
-        return (mode == UNSORTED ? ASCENDING : mode);
-      else if (inc > 0)
-        return (mode == DESCENDING ? UNSORTED : ASCENDING);
-      else
-        return (mode == ASCENDING ? UNSORTED : DESCENDING);
-    }
-  else
-    return index.as_array ().is_sorted (mode);
-}
-
-Array<octave_idx_type>
-octave_lazy_index::sort_rows_idx (sortmode mode) const
-{
-  return index.as_array ().sort_rows_idx (mode);
-}
-
-sortmode
-octave_lazy_index::is_sorted_rows (sortmode mode) const
-{
-  return index.as_array ().is_sorted_rows (mode);
-}
-
-static const std::string value_save_tag ("index_value");
-
-bool octave_lazy_index::save_ascii (std::ostream& os)
-{
-  return save_ascii_data (os, make_value (), value_save_tag, false, 0);
-}
-
-bool octave_lazy_index::load_ascii (std::istream& is)
-{
-  bool dummy;
-
-  std::string nm = read_ascii_data (is, std::string (), dummy, value, 0);
-
-  if (nm != value_save_tag)
-    error ("lazy_index: corrupted data on load");
-  else
-    index = value.index_vector ();
-
-  return ! error_state;
-}
-
-
-bool octave_lazy_index::save_binary (std::ostream& os, bool& save_as_floats)
-{
-  return save_binary_data (os, make_value (), value_save_tag,
-                           std::string (), false, save_as_floats);
-}
-
-bool octave_lazy_index::load_binary (std::istream& is, bool swap,
-                                     oct_mach_info::float_format fmt)
-{
-  bool dummy;
-  std::string doc;
-
-  std::string nm = read_binary_data (is, swap, fmt, std::string (),
-                                     dummy, value, doc);
-
-  if (nm != value_save_tag)
-    error ("lazy_index: corrupted data on load");
-  else
-    index = value.index_vector ();
-
-  return ! error_state;
-}
--- a/src/ov-lazy-idx.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
-
-Copyright (C) 2010-2012 VZLU Prague
-
-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_lazy_idx_h)
-#define octave_lazy_idx_h 1
-
-#include "ov-re-mat.h"
-
-// Lazy indices that stay in idx_vector form until the conversion to NDArray is
-// actually needed.
-
-class
-OCTINTERP_API
-octave_lazy_index : public octave_base_value
-{
-public:
-
-  octave_lazy_index (void)
-    : octave_base_value (), index (), value () { }
-
-  octave_lazy_index (const idx_vector& idx)
-    : octave_base_value (), index (idx), value () { }
-
-  octave_lazy_index (const octave_lazy_index& i)
-    : octave_base_value (), index (i.index), value (i.value) { }
-
-  ~octave_lazy_index (void) { }
-
-  octave_base_value *clone (void) const { return new octave_lazy_index (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  size_t byte_size (void) const { return numel () * sizeof (octave_idx_type); }
-
-  octave_value squeeze (void) const;
-
-  octave_value full_value (void) const { return make_value (); }
-
-  idx_vector index_vector (void) const
-    { return index; }
-
-  builtin_type_t builtin_type (void) const { return btyp_double; }
-
-  bool is_real_matrix (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    { return make_value ().subsref (type, idx); }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int)
-    { return subsref (type, idx); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false)
-    { return make_value ().do_index_op (idx, resize_ok); }
-
-  dim_vector dims (void) const { return index.orig_dimensions (); }
-
-  octave_idx_type numel (void) const { return index.length (0); }
-
-  octave_idx_type nnz (void) const { return numel (); }
-
-  octave_value reshape (const dim_vector& new_dims) const;
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const;
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const
-    { return make_value ().resize (dv, fill); }
-
-  octave_value all (int dim = 0) const { return make_value ().all (dim); }
-  octave_value any (int dim = 0) const { return make_value ().any (dim); }
-
-  MatrixType matrix_type (void) const { return make_value ().matrix_type (); }
-  MatrixType matrix_type (const MatrixType& _typ) const
-    { return make_value ().matrix_type (_typ); }
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
-
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const;
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const;
-
-  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const;
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
-
-  bool is_matrix_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return true; }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_true (void) const
-    { return make_value ().is_true (); }
-
-  bool print_as_scalar (void) const
-    { return make_value ().print_as_scalar (); }
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const
-    { make_value ().print (os, pr_as_read_syntax); }
-
-  void print_info (std::ostream& os, const std::string& prefix) const
-    { make_value ().print_info (os, prefix); }
-
-#define FORWARD_VALUE_QUERY(TYPE,NAME) \
-  TYPE \
-  NAME (void) const { return make_value ().NAME (); }
-
-  FORWARD_VALUE_QUERY (int8NDArray,  int8_array_value)
-  FORWARD_VALUE_QUERY (int16NDArray, int16_array_value)
-  FORWARD_VALUE_QUERY (int32NDArray, int32_array_value)
-  FORWARD_VALUE_QUERY (int64NDArray, int64_array_value)
-  FORWARD_VALUE_QUERY (uint8NDArray,  uint8_array_value)
-  FORWARD_VALUE_QUERY (uint16NDArray, uint16_array_value)
-  FORWARD_VALUE_QUERY (uint32NDArray, uint32_array_value)
-  FORWARD_VALUE_QUERY (uint64NDArray, uint64_array_value)
-
-#define FORWARD_VALUE_QUERY1(TYPE,NAME) \
-  TYPE \
-  NAME (bool flag = false) const { return make_value ().NAME (flag); }
-
-  FORWARD_VALUE_QUERY1 (double, double_value)
-
-  FORWARD_VALUE_QUERY1 (float, float_value)
-
-  FORWARD_VALUE_QUERY1 (double, scalar_value)
-
-  FORWARD_VALUE_QUERY1 (Matrix, matrix_value)
-
-  FORWARD_VALUE_QUERY1 (FloatMatrix, float_matrix_value)
-
-  FORWARD_VALUE_QUERY1 (Complex, complex_value)
-
-  FORWARD_VALUE_QUERY1 (FloatComplex, float_complex_value)
-
-  FORWARD_VALUE_QUERY1 (ComplexMatrix, complex_matrix_value)
-
-  FORWARD_VALUE_QUERY1 (FloatComplexMatrix, float_complex_matrix_value)
-
-  FORWARD_VALUE_QUERY1 (ComplexNDArray, complex_array_value)
-
-  FORWARD_VALUE_QUERY1 (FloatComplexNDArray, float_complex_array_value)
-
-  FORWARD_VALUE_QUERY1 (boolNDArray, bool_array_value)
-
-  FORWARD_VALUE_QUERY1 (charNDArray, char_array_value)
-
-  FORWARD_VALUE_QUERY1 (NDArray, array_value)
-
-  FORWARD_VALUE_QUERY1 (FloatNDArray, float_array_value)
-
-  FORWARD_VALUE_QUERY1 (SparseMatrix, sparse_matrix_value)
-
-  FORWARD_VALUE_QUERY1 (SparseComplexMatrix, sparse_complex_matrix_value)
-
-  octave_value diag (octave_idx_type k = 0) const
-    { return make_value ().diag (k); }
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const
-    { return make_value ().convert_to_str_internal (pad, force, type); }
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const
-    { return make_value ().print_raw (os, pr_as_read_syntax); }
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-  // HDF5 functions not defined.
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    { return make_value ().write (os, block_size, output_type, skip, flt_fmt); }
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const
-    { return make_value ().mex_get_data (); }
-
-  mxArray *as_mxArray (void) const
-    { return make_value ().as_mxArray (); }
-
-  octave_value map (unary_mapper_t umap) const
-    { return make_value ().map (umap); }
-
-private:
-  const octave_value& make_value (void) const
-    {
-      if (value.is_undefined ())
-        value = octave_value (index, false);
-
-      return value;
-    }
-
-  octave_value& make_value (void)
-    {
-      if (value.is_undefined ())
-        value = octave_value (index, false);
-
-      return value;
-    }
-
-  idx_vector index;
-  mutable octave_value value;
-
-  static octave_base_value *numeric_conversion_function (const octave_base_value&);
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
-
--- a/src/ov-mex-fcn.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "oct-shlib.h"
-
-#include <defaults.h>
-#include "dynamic-ld.h"
-#include "error.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "ov-mex-fcn.h"
-#include "ov.h"
-#include "profiler.h"
-#include "toplev.h"
-#include "unwind-prot.h"
-
-DEFINE_OCTAVE_ALLOCATOR (octave_mex_function);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_mex_function,
-                                     "mex function", "mex function");
-
-octave_mex_function::octave_mex_function
-  (void *fptr, bool fmex, const octave_shlib& shl,
-   const std::string& nm)
-  : octave_function (nm), mex_fcn_ptr (fptr), exit_fcn_ptr (0),
-    have_fmex (fmex), sh_lib (shl)
-{
-  mark_fcn_file_up_to_date (time_parsed ());
-
-  std::string file_name = fcn_file_name ();
-
-  system_fcn_file
-    = (! file_name.empty ()
-       && Voct_file_dir == file_name.substr (0, Voct_file_dir.length ()));
-}
-
-octave_mex_function::~octave_mex_function (void)
-{
-  if (exit_fcn_ptr)
-    (*exit_fcn_ptr) ();
-
-  octave_dynamic_loader::remove_mex (my_name, sh_lib);
-}
-
-std::string
-octave_mex_function::fcn_file_name (void) const
-{
-  return sh_lib.file_name ();
-}
-
-octave_time
-octave_mex_function::time_parsed (void) const
-{
-  return sh_lib.time_loaded ();
-}
-
-octave_value_list
-octave_mex_function::subsref (const std::string& type,
-                              const std::list<octave_value_list>& idx,
-                              int nargout)
-{
-  octave_value_list retval;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
-
-        retval = do_multi_index_op (tmp_nargout, idx.front ());
-      }
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  // FIXME -- perhaps there should be an
-  // octave_value_list::next_subsref member function?  See also
-  // octave_user_function::subsref.
-  //
-  // FIXME -- Note that if a function call returns multiple
-  // values, and there is further indexing to perform, then we are
-  // ignoring all but the first value.  Is this really what we want to
-  // do?  If it is not, then what should happen for stat("file").size,
-  // for exmaple?
-
-  if (idx.size () > 1)
-    retval = retval(0).next_subsref (nargout, type, idx);
-
-  return retval;
-}
-
-// FIXME -- shouldn't this declaration be a header file somewhere?
-extern octave_value_list
-call_mex (bool have_fmex, void *f, const octave_value_list& args,
-          int nargout, octave_mex_function *curr_mex_fcn);
-
-octave_value_list
-octave_mex_function::do_multi_index_op (int nargout,
-                                        const octave_value_list& args)
-{
-  octave_value_list retval;
-
-  if (error_state)
-    return retval;
-
-  if (args.has_magic_colon ())
-    ::error ("invalid use of colon in function argument list");
-  else
-    {
-      unwind_protect frame;
-
-      octave_call_stack::push (this);
-
-      frame.add_fcn (octave_call_stack::pop);
-
-      try
-        {
-          BEGIN_PROFILER_BLOCK (profiler_name ())
-          retval = call_mex (have_fmex, mex_fcn_ptr, args, nargout, this);
-          END_PROFILER_BLOCK
-        }
-      catch (octave_execution_exception)
-        {
-          gripe_library_execution_error ();
-        }
-    }
-
-  return retval;
-}
--- a/src/ov-mex-fcn.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_mex_function_h)
-#define octave_mex_function_h 1
-
-#include <string>
-
-#include "oct-shlib.h"
-
-#include "ov-fcn.h"
-#include "ov-builtin.h"
-#include "ov-typeinfo.h"
-
-class octave_shlib;
-
-class octave_value;
-class octave_value_list;
-
-// Dynamically-linked functions.
-
-class
-octave_mex_function : public octave_function
-{
-public:
-
-  octave_mex_function (void)
-    : mex_fcn_ptr (), exit_fcn_ptr (), have_fmex (), sh_lib (),
-      t_checked (), system_fcn_file () { }
-
-  octave_mex_function (void *fptr, bool fmex, const octave_shlib& shl,
-                       const std::string& nm = std::string ());
-
-  ~octave_mex_function (void);
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    {
-      octave_value_list tmp = subsref (type, idx, 1);
-      return tmp.length () > 0 ? tmp(0) : octave_value ();
-    }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout);
-
-  octave_function *function_value (bool = false) { return this; }
-
-  const octave_function *function_value (bool = false) const { return this; }
-
-  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
-
-  std::string fcn_file_name (void) const;
-
-  octave_time time_parsed (void) const;
-
-  octave_time time_checked (void) const { return t_checked; }
-
-  bool is_system_fcn_file (void) const { return system_fcn_file; }
-
-  bool is_builtin_function (void) const { return false; }
-
-  bool is_mex_function (void) const { return true; }
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args);
-
-  void atexit (void (*fcn) (void)) { exit_fcn_ptr = fcn; }
-
-  octave_shlib get_shlib (void) const
-    { return sh_lib; }
-
-private:
-
-  void *mex_fcn_ptr;
-
-  void (*exit_fcn_ptr) (void);
-
-  bool have_fmex;
-
-  octave_shlib sh_lib;
-
-  // The time the file was last checked to see if it needs to be
-  // parsed again.
-  mutable octave_time t_checked;
-
-  // True if this function came from a file that is considered to be a
-  // system function.  This affects whether we check the time stamp
-  // on the file to see if it has changed.
-  bool system_fcn_file;
-
-  // No copying!
-
-  octave_mex_function (const octave_mex_function& fn);
-
-  octave_mex_function& operator = (const octave_mex_function& fn);
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-null-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ov-null-mat.h"
-#include "ops.h"
-#include "defun.h"
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_matrix, "null_matrix", "double");
-
-const octave_value octave_null_matrix::instance (new octave_null_matrix ());
-
-static octave_base_value *
-default_null_matrix_numeric_conversion_function (const octave_base_value& a)
-{
-  // The cast is not necessary?
-  // CAST_CONV_ARG (const octave_null_matrix&);
-
-  return a.empty_clone ();
-}
-
-octave_base_value::type_conv_info
-octave_null_matrix::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_null_matrix_numeric_conversion_function,
-                                            octave_matrix::static_type_id ());
-}
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_str, "null_string", "char");
-
-const octave_value octave_null_str::instance (new octave_null_str ());
-
-static octave_base_value *
-default_null_str_numeric_conversion_function (const octave_base_value& a)
-{
-  // The cast is not necessary?
-  // CAST_CONV_ARG (const octave_null_str&);
-
-  return a.empty_clone ();
-}
-
-octave_base_value::type_conv_info
-octave_null_str::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_null_str_numeric_conversion_function,
-                                            octave_char_matrix_str::static_type_id ());
-}
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_null_sq_str, "null_sq_string", "char");
-
-const octave_value octave_null_sq_str::instance (new octave_null_sq_str ());
-
-static octave_base_value *
-default_null_sq_str_numeric_conversion_function (const octave_base_value& a)
-{
-  // The cast is not necessary?
-  // CAST_CONV_ARG (const octave_null_sq_str&);
-
-  return a.empty_clone ();
-}
-
-octave_base_value::type_conv_info
-octave_null_sq_str::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_null_sq_str_numeric_conversion_function,
-                                            octave_char_matrix_sq_str::static_type_id ());
-}
-
-DEFUN (isnull, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} isnull (@var{x})\n\
-Return true if @var{x} is a special null matrix, string, or single quoted\n\
-string.  Indexed assignment with such a value on the right-hand side should\n\
-delete array elements.  This function should be used when overloading\n\
-indexed assignment for user-defined classes instead of @code{isempty}, to\n\
-distinguish the cases:\n\
-\n\
-@table @asis\n\
-@item @code{A(I) = []}\n\
-This should delete elements if @code{I} is nonempty.\n\
-\n\
-@item @code{X = []; A(I) = X}\n\
-This should give an error if @code{I} is nonempty.\n\
-@end table\n\
-@seealso{isempty, isindex}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1 && args(0).is_defined ())
-    retval = args(0).is_null_value ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!assert (isnull ([]), true)
-%!assert (isnull ([1]), false)
-%!assert (isnull (zeros (0,3)), false)
-%!assert (isnull (""), true)
-%!assert (isnull ("A"), false)
-%!assert (isnull (''), true)
-%!assert (isnull ('A'), false)
-%!test
-%! x = [];
-%! assert (isnull (x), false);
-*/
--- a/src/ov-null-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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_null_matrix_h)
-#define octave_null_matrix_h 1
-
-#include "ov.h"
-#include "ov-re-mat.h"
-#include "ov-str-mat.h"
-
-// Design rationale:
-// The constructors are hidden. There is only one null matrix (or null string) object,
-// that can have shallow copies. Cloning the object returns just a normal empty matrix,
-// so all the shallow copies are, in fact, read-only. This conveniently ensures that any
-// attempt to fiddle with the null matrix destroys its special status.
-
-// The special [] value.
-
-class
-OCTINTERP_API
-octave_null_matrix : public octave_matrix
-{
-  octave_null_matrix (void) : octave_matrix () { }
-
-public:
-
-  static const octave_value instance;
-
-  bool is_null_value (void) const { return true; }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-private:
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-// The special "" value
-
-class
-OCTINTERP_API
-octave_null_str : public octave_char_matrix_str
-{
-  octave_null_str (void) : octave_char_matrix_str () { }
-
-public:
-
-  static const octave_value instance;
-
-  bool is_null_value (void) const { return true; }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-
-private:
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-// The special '' value
-
-class
-OCTINTERP_API
-octave_null_sq_str : public octave_char_matrix_sq_str
-{
-  octave_null_sq_str (void) : octave_char_matrix_sq_str () { }
-
-public:
-
-  static const octave_value instance;
-
-  bool is_null_value (void) const { return true; }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-private:
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-oncleanup.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-/*
-
-Copyright (C) 2010-2012 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "defun.h"
-#include "ov-oncleanup.h"
-#include "ov-fcn.h"
-#include "ov-usr-fcn.h"
-#include "pt-misc.h"
-#include "toplev.h"
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_oncleanup, "onCleanup",
-                                     "onCleanup");
-
-octave_oncleanup::octave_oncleanup (const octave_value& f)
-  : fcn (f)
-{
-  if (f.is_function_handle ())
-    {
-      octave_function *fptr = f.function_value (true);
-      if (fptr)
-        {
-          octave_user_function *uptr
-            = dynamic_cast<octave_user_function *> (fptr);
-
-          if (uptr != 0)
-            {
-              tree_parameter_list *pl = uptr->parameter_list ();
-
-              if (pl != 0 && pl->length () > 0)
-                warning ("onCleanup: cleanup action takes parameters");
-            }
-        }
-      else
-        error ("onCleanup: no default dispatch for function handle");
-    }
-  else
-    {
-      fcn = octave_value ();
-      error ("onCleanup: argument must be a function handle");
-    }
-}
-
-octave_oncleanup::~octave_oncleanup (void)
-{
-  if (fcn.is_undefined ())
-    return;
-
-  unwind_protect frame;
-
-  // Clear interrupts.
-  frame.protect_var (octave_interrupt_state);
-  octave_interrupt_state = 0;
-
-  // Disallow quit().
-  frame.protect_var (quit_allowed);
-  quit_allowed = false;
-
-  // Clear errors.
-  frame.protect_var (error_state);
-  error_state = 0;
-
-  try
-    {
-      // Run the actual code.
-      fcn.do_multi_index_op (0, octave_value_list ());
-    }
-  catch (octave_interrupt_exception)
-    {
-      // Swallow the interrupt.
-      warning ("onCleanup: interrupt occured in cleanup action");
-    }
-  catch (std::bad_alloc)
-    {
-      // Swallow the exception.
-      warning ("onCleanup: out of memory occured in cleanup action");
-    }
-  catch (...) // Yes, the black hole. We're in a d-tor.
-    {
-      // This shouldn't happen, in theory.
-      error ("onCleanup: internal error: unhandled exception in cleanup action");
-    }
-
-  // We don't want to ignore errors that occur in the cleanup code, so
-  // if an error is encountered there, leave error_state alone.
-  // Otherwise, set it back to what it was before.
-  if (error_state)
-    {
-      frame.discard_top ();
-      octave_call_stack::backtrace_error_message ();
-    }
-}
-
-octave_scalar_map
-octave_oncleanup::scalar_map_value (void) const
-{
-  octave_scalar_map retval;
-  retval.setfield ("task", fcn);
-  return retval;
-}
-
-static void
-warn_save_load (void)
-{
-  warning ("onCleanup: load and save not supported");
-}
-
-bool
-octave_oncleanup::save_ascii (std::ostream& /* os */)
-{
-  warn_save_load ();
-  return true;
-}
-
-bool
-octave_oncleanup::load_ascii (std::istream& /* is */)
-{
-  warn_save_load ();
-  return true;
-}
-
-bool
-octave_oncleanup::save_binary (std::ostream& /* os */, bool& /* save_as_floats */)
-{
-  warn_save_load ();
-  return true;
-}
-
-bool
-octave_oncleanup::load_binary (std::istream& /* is */, bool /* swap */,
-                               oct_mach_info::float_format /* fmt */)
-{
-  warn_save_load ();
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-bool
-octave_oncleanup::save_hdf5 (hid_t /* loc_id */, const char * /* name */,
-                             bool /* save_as_floats */)
-{
-  warn_save_load ();
-  return true;
-}
-
-bool
-octave_oncleanup::load_hdf5 (hid_t /* loc_id */, const char * /* name */)
-{
-  warn_save_load ();
-  return true;
-}
-#endif
-
-void
-octave_oncleanup::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-
-void
-octave_oncleanup::print_raw (std::ostream& os, bool pr_as_read_syntax) const
-{
-  os << "onCleanup (";
-  if (fcn.is_defined ())
-    fcn.print_raw (os, pr_as_read_syntax);
-  os << ")";
-}
-
-DEFUN (onCleanup, args, ,
-  "-*- texinfo -*-\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\
-clearing the last copy of the object.  Note that if multiple local onCleanup\n\
-variables are created, the order in which they are called is unspecified.\n\
-For similar functionality @xref{The @code{unwind_protect} Statement}.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    retval = octave_value (new octave_oncleanup (args(0)));
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!test
-%! old_wstate = warning ("query");
-%! unwind_protect
-%!   trigger = onCleanup (@() warning ("on", "__MY_WARNING__"));
-%!   warning ("off", "__MY_WARNING__");
-%!   assert ((warning ("query", "__MY_WARNING__")).state, "off");
-%!   clear trigger;
-%!   assert ((warning ("query", "__MY_WARNING__")).state, "on");
-%! unwind_protect_cleanup
-%!   warning (old_wstate);
-%! end_unwind_protect
-*/
--- a/src/ov-oncleanup.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
-
-Copyright (C) 2010-2012 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iosfwd>
-
-#include "ov-base.h"
-#include "ov-struct.h"
-#include "ov.h"
-
-static void
-gripe_internal (void)
-{
-  error ("onCleanup: internal error: cloning nonempty object");
-}
-
-class octave_oncleanup : public octave_base_value
-{
-public:
-  octave_oncleanup (void) : fcn () { }
-
-  octave_oncleanup (const octave_value& fcn);
-
-  octave_base_value *clone (void) const
-  {
-    if (fcn.is_defined ())
-      gripe_internal ();
-
-    return empty_clone ();
-  }
-
-  octave_base_value *empty_clone (void) const
-  {
-    return new octave_oncleanup ();
-  }
-
-  ~octave_oncleanup (void);
-
-  bool is_defined (void) const { return true; }
-
-  bool is_object (void) const { return true; } // do we want this?
-
-  octave_map map_value (void) const { return scalar_map_value (); }
-
-  octave_scalar_map scalar_map_value (void) const;
-
-  dim_vector dims (void) const
-  {
-    static dim_vector dv (1, 1);
-    return dv;
-  }
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-private:
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-
-protected:
-
-  octave_value fcn;
-};
--- a/src/ov-perm.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,449 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "byte-swap.h"
-
-#include "ov-perm.h"
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-#include "error.h"
-#include "gripes.h"
-#include "ops.h"
-#include "pr-output.h"
-
-#include "ls-oct-ascii.h"
-
-octave_value
-octave_perm_matrix::subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      retval = do_index_op (idx.front ());
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval.next_subsref (type, idx);
-}
-
-octave_value
-octave_perm_matrix::do_index_op (const octave_value_list& idx,
-                                 bool resize_ok)
-{
-  octave_value retval;
-  octave_idx_type nidx = idx.length ();
-  idx_vector idx0, idx1;
-  if (nidx == 2)
-    {
-      idx0 = idx(0).index_vector ();
-      idx1 = idx(1).index_vector ();
-    }
-
-  // This hack is to allow constructing permutation matrices using
-  // eye(n)(p,:), eye(n)(:,q) && eye(n)(p,q) where p & q are permutation
-  // vectors.
-  // Note that, for better consistency, eye(n)(:,:) still converts to a full
-  // matrix.
-  if (! error_state && nidx == 2)
-    {
-      bool left = idx0.is_permutation (matrix.rows ());
-      bool right = idx1.is_permutation (matrix.cols ());
-
-      if (left && right)
-        {
-          if (idx0.is_colon ()) left = false;
-          if (idx1.is_colon ()) right = false;
-          if (left || right)
-            {
-              PermMatrix p = matrix;
-              if (left)
-                p = PermMatrix (idx0, false) * p;
-              if (right)
-                p = p * PermMatrix (idx1, true);
-              retval = p;
-            }
-          else
-            {
-              retval = this;
-              this->count++;
-            }
-        }
-    }
-
-  // if error_state is set, we've already griped.
-  if (! error_state && ! retval.is_defined ())
-    {
-      if (nidx == 2 && ! resize_ok &&
-          idx0.is_scalar () && idx1.is_scalar ())
-        {
-          retval = matrix.checkelem (idx0(0), idx1(0));
-        }
-      else
-        retval = to_dense ().do_index_op (idx, resize_ok);
-    }
-
-  return retval;
-}
-
-bool
-octave_perm_matrix::is_true (void) const
-{
-  return to_dense ().is_true ();
-}
-
-double
-octave_perm_matrix::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (numel () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 type_name (), "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion (type_name (), "real scalar");
-
-  return retval;
-}
-
-float
-octave_perm_matrix::float_value (bool) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (numel () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 type_name (), "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion (type_name (), "real scalar");
-
-  return retval;
-}
-
-Complex
-octave_perm_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 type_name (), "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion (type_name (), "complex scalar");
-
-  return retval;
-}
-
-FloatComplex
-octave_perm_matrix::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 type_name (), "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion (type_name (), "complex scalar");
-
-  return retval;
-}
-
-#define FORWARD_MATRIX_VALUE(TYPE, PREFIX) \
-TYPE \
-octave_perm_matrix::PREFIX ## _value (bool frc_str_conv) const \
-{ \
-  return to_dense ().PREFIX ## _value (frc_str_conv); \
-}
-
-SparseMatrix
-octave_perm_matrix::sparse_matrix_value (bool) const
-{
-  return SparseMatrix (matrix);
-}
-
-SparseBoolMatrix
-octave_perm_matrix::sparse_bool_matrix_value (bool) const
-{
-  return SparseBoolMatrix (matrix);
-}
-
-SparseComplexMatrix
-octave_perm_matrix::sparse_complex_matrix_value (bool) const
-{
-  return SparseComplexMatrix (sparse_matrix_value ());
-}
-
-FORWARD_MATRIX_VALUE (Matrix, matrix)
-FORWARD_MATRIX_VALUE (FloatMatrix, float_matrix)
-FORWARD_MATRIX_VALUE (ComplexMatrix, complex_matrix)
-FORWARD_MATRIX_VALUE (FloatComplexMatrix, float_complex_matrix)
-
-FORWARD_MATRIX_VALUE (NDArray, array)
-FORWARD_MATRIX_VALUE (FloatNDArray, float_array)
-FORWARD_MATRIX_VALUE (ComplexNDArray, complex_array)
-FORWARD_MATRIX_VALUE (FloatComplexNDArray, float_complex_array)
-
-FORWARD_MATRIX_VALUE (boolNDArray, bool_array)
-FORWARD_MATRIX_VALUE (charNDArray, char_array)
-
-idx_vector
-octave_perm_matrix::index_vector (void) const
-{
-  return to_dense ().index_vector ();
-}
-
-octave_value
-octave_perm_matrix::convert_to_str_internal (bool pad, bool force, char type) const
-{
-  return to_dense ().convert_to_str_internal (pad, force, type);
-}
-
-bool
-octave_perm_matrix::save_ascii (std::ostream& os)
-{
-  typedef octave_int<octave_idx_type> idx_int_type;
-
-  os << "# size: " << matrix.rows () << "\n";
-  os << "# orient: " << (matrix.is_col_perm () ? 'c' : 'r') << '\n';
-
-  Array<octave_idx_type> pvec = matrix.pvec ();
-  octave_idx_type n = pvec.length ();
-  ColumnVector tmp (n);
-  for (octave_idx_type i = 0; i < n; i++) tmp(i) = pvec(i) + 1;
-  os << tmp;
-
-  return true;
-}
-
-bool
-octave_perm_matrix::load_ascii (std::istream& is)
-{
-  typedef octave_int<octave_idx_type> idx_int_type;
-  octave_idx_type n;
-  bool success = true;
-  char orient;
-
-  if (extract_keyword (is, "size", n, true)
-      && extract_keyword (is, "orient", orient, true))
-    {
-      bool colp = orient == 'c';
-      ColumnVector tmp (n);
-      is >> tmp;
-      if (!is)
-        {
-          error ("load: failed to load permutation matrix constant");
-          success = false;
-        }
-      else
-        {
-          Array<octave_idx_type> pvec (dim_vector (n, 1));
-          for (octave_idx_type i = 0; i < n; i++) pvec(i) = tmp(i) - 1;
-          matrix = PermMatrix (pvec, colp);
-
-          // Invalidate cache. Probably not necessary, but safe.
-          dense_cache = octave_value ();
-        }
-    }
-  else
-    {
-      error ("load: failed to extract size & orientation");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_perm_matrix::save_binary (std::ostream& os, bool&)
-{
-
-  int32_t sz = matrix.rows ();
-  bool colp = matrix.is_col_perm ();
-  os.write (reinterpret_cast<char *> (&sz), 4);
-  os.write (reinterpret_cast<char *> (&colp), 1);
-  os.write (reinterpret_cast<const char *> (matrix.data ()), matrix.byte_size ());
-
-  return true;
-}
-
-bool
-octave_perm_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format )
-{
-  int32_t sz;
-  bool colp;
-  if (! (is.read (reinterpret_cast<char *> (&sz), 4)
-         && is.read (reinterpret_cast<char *> (&colp), 1)))
-    return false;
-
-  MArray<octave_idx_type> m (dim_vector (sz, 1));
-
-  if (! is.read (reinterpret_cast<char *> (m.fortran_vec ()), m.byte_size ()))
-    return false;
-
-  if (swap)
-    {
-      int nel = m.numel ();
-      for (int i = 0; i < nel; i++)
-        switch (sizeof (octave_idx_type))
-          {
-          case 8:
-            swap_bytes<8> (&m(i));
-            break;
-          case 4:
-            swap_bytes<4> (&m(i));
-            break;
-          case 2:
-            swap_bytes<2> (&m(i));
-            break;
-          case 1:
-          default:
-            break;
-          }
-    }
-
-  matrix = PermMatrix (m, colp);
-  return true;
-}
-
-void
-octave_perm_matrix::print_raw (std::ostream& os,
-                               bool pr_as_read_syntax) const
-{
-  return octave_print_internal (os, matrix, pr_as_read_syntax,
-                                current_print_indent_level ());
-}
-
-mxArray *
-octave_perm_matrix::as_mxArray (void) const
-{
-  return to_dense ().as_mxArray ();
-}
-
-bool
-octave_perm_matrix::print_as_scalar (void) const
-{
-  dim_vector dv = dims ();
-
-  return (dv.all_ones () || dv.any_zero ());
-}
-
-void
-octave_perm_matrix::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-
-int
-octave_perm_matrix::write (octave_stream& os, int block_size,
-                                oct_data_conv::data_type output_type, int skip,
-                                oct_mach_info::float_format flt_fmt) const
-{
-  return to_dense ().write (os, block_size, output_type, skip, flt_fmt);
-}
-
-void
-octave_perm_matrix::print_info (std::ostream& os,
-                                    const std::string& prefix) const
-{
-  matrix.print_info (os, prefix);
-}
-
-
-octave_value
-octave_perm_matrix::to_dense (void) const
-{
-  if (! dense_cache.is_defined ())
-      dense_cache = Matrix (matrix);
-
-  return dense_cache;
-}
-
-DEFINE_OCTAVE_ALLOCATOR (octave_perm_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_perm_matrix,
-                                     "permutation matrix", "double");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_perm_matrix&);
-
-  return new octave_matrix (v.matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_perm_matrix::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_perm_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.nelem () == 1)
-    retval = new octave_scalar (matrix (0, 0));
-
-  return retval;
-}
-
--- a/src/ov-perm.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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_perm_matrix_h)
-#define octave_perm_matrix_h 1
-
-#include "mx-base.h"
-#include "str-vec.h"
-
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-#include "oct-obj.h"
-
-class
-OCTINTERP_API
-octave_perm_matrix : public octave_base_value
-{
-public:
-  octave_perm_matrix (void) : matrix (), dense_cache () { }
-
-  octave_perm_matrix (const PermMatrix& p) : matrix (p), dense_cache () { }
-
-  octave_base_value *clone (void) const { return new octave_perm_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_perm_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  size_t byte_size (void) const { return matrix.byte_size (); }
-
-  octave_value squeeze (void) const { return matrix; }
-
-  octave_value full_value (void) const { return to_dense (); }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int)
-    { return subsref (type, idx); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  dim_vector dims (void) const { return matrix.dims (); }
-
-  octave_idx_type nnz (void) const { return matrix.rows (); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return to_dense ().reshape (new_dims); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return to_dense ().permute (vec, inv); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const
-    { return to_dense ().resize (dv, fill); }
-
-  octave_value all (int dim = 0) const { return to_dense ().all (dim); }
-  octave_value any (int dim = 0) const { return to_dense ().any (dim); }
-
-  MatrixType matrix_type (void) const { return MatrixType::Permuted_Diagonal; }
-  MatrixType matrix_type (const MatrixType&) const
-    { return matrix_type (); }
-
-  octave_value diag (octave_idx_type k = 0) const
-    { return to_dense () .diag (k); }
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
-    { return to_dense ().sort (dim, mode); }
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const
-    { return to_dense ().sort (sidx, dim, mode); }
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const
-    { return to_dense ().is_sorted (mode); }
-
-  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
-    { return to_dense ().sort_rows_idx (mode); }
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
-    { return to_dense ().is_sorted_rows (mode); }
-
-  builtin_type_t builtin_type (void) const { return btyp_double; }
-
-  bool is_perm_matrix (void) const { return true; }
-
-  bool is_matrix_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return true; }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_real_matrix (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  bool is_true (void) const;
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  idx_vector index_vector (void) const;
-
-  PermMatrix perm_matrix_value (void) const
-    { return matrix; }
-
-  Matrix matrix_value (bool = false) const;
-
-  FloatMatrix float_matrix_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool warn = false) const;
-
-  charNDArray char_array_value (bool = false) const;
-
-  NDArray array_value (bool = false) const;
-
-  FloatNDArray float_array_value (bool = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const;
-
-  SparseBoolMatrix sparse_bool_matrix_value (bool = false) const;
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
-
-  int8NDArray
-  int8_array_value (void) const { return to_dense ().int8_array_value (); }
-
-  int16NDArray
-  int16_array_value (void) const { return to_dense ().int16_array_value (); }
-
-  int32NDArray
-  int32_array_value (void) const { return to_dense ().int32_array_value (); }
-
-  int64NDArray
-  int64_array_value (void) const { return to_dense ().int64_array_value (); }
-
-  uint8NDArray
-  uint8_array_value (void) const { return to_dense ().uint8_array_value (); }
-
-  uint16NDArray
-  uint16_array_value (void) const { return to_dense ().uint16_array_value (); }
-
-  uint32NDArray
-  uint32_array_value (void) const { return to_dense ().uint32_array_value (); }
-
-  uint64NDArray
-  uint64_array_value (void) const { return to_dense ().uint64_array_value (); }
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const;
-
-  mxArray *as_mxArray (void) const;
-
-  bool print_as_scalar (void) const;
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_info (std::ostream& os, const std::string& prefix) const;
-
-  octave_value map (unary_mapper_t umap) const
-    { return to_dense ().map (umap); }
-
-protected:
-
-  PermMatrix matrix;
-
-  virtual octave_value to_dense (void) const;
-
-  mutable octave_value dense_cache;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-range.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,691 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-
-#include "defun.h"
-#include "variables.h"
-#include "gripes.h"
-#include "ops.h"
-#include "oct-obj.h"
-#include "ov-range.h"
-#include "ov-re-mat.h"
-#include "ov-scalar.h"
-#include "pr-output.h"
-
-#include "byte-swap.h"
-#include "ls-ascii-helper.h"
-#include "ls-hdf5.h"
-#include "ls-utils.h"
-
-// If TRUE, allow ranges with non-integer elements as array indices.
-bool Vallow_noninteger_range_as_index = false;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_range);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_range, "range", "double");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_range&);
-
-  return new octave_matrix (v.matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_range::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_range::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  switch (range.nelem ())
-    {
-    case 1:
-      retval = new octave_scalar (range.base ());
-      break;
-
-    case 0:
-      retval = new octave_matrix (Matrix (1, 0));
-      break;
-
-    case -2:
-      retval = new octave_matrix (range.matrix_value ());
-      break;
-
-    default:
-      break;
-    }
-
-  return retval;
-}
-
-octave_value
-octave_range::subsref (const std::string& type,
-                       const std::list<octave_value_list>& idx)
-{
-  octave_value retval;
-
-  switch (type[0])
-    {
-    case '(':
-      retval = do_index_op (idx.front ());
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  return retval.next_subsref (type, idx);
-}
-
-octave_value
-octave_range::do_index_op (const octave_value_list& idx, bool resize_ok)
-{
-  if (idx.length () == 1 && ! resize_ok)
-    {
-      octave_value retval;
-
-      // The range can handle a single subscript.
-      idx_vector i = idx(0).index_vector ();
-      if (! error_state)
-        {
-          if (i.is_scalar () && i(0) < range.nelem ())
-            retval = range.elem (i(0));
-          else
-            retval = range.index (i);
-        }
-
-      return retval;
-    }
-  else
-    {
-      octave_value tmp (new octave_matrix (range.matrix_value ()));
-
-      return tmp.do_index_op (idx, resize_ok);
-    }
-}
-
-idx_vector
-octave_range::index_vector (void) const
-{
-  if (idx_cache)
-    return *idx_cache;
-  else
-    {
-      if (! Vallow_noninteger_range_as_index
-          || range.all_elements_are_ints ())
-        return set_idx_cache (idx_vector (range));
-      else
-        {
-          warning_with_id ("Octave:noninteger-range-as-index",
-                           "non-integer range used as index");
-
-          return octave_value (matrix_value ()).round ().index_vector ();
-        }
-    }
-}
-
-double
-octave_range::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  octave_idx_type nel = range.nelem ();
-
-  if (nel > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "range", "real scalar");
-
-      retval = range.base ();
-    }
-  else
-    gripe_invalid_conversion ("range", "real scalar");
-
-  return retval;
-}
-
-float
-octave_range::float_value (bool) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  octave_idx_type nel = range.nelem ();
-
-  if (nel > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "range", "real scalar");
-
-      retval = range.base ();
-    }
-  else
-    gripe_invalid_conversion ("range", "real scalar");
-
-  return retval;
-}
-
-charNDArray
-octave_range::char_array_value (bool) const
-{
-  const Matrix matrix = range.matrix_value ();
-  charNDArray retval (dims ());
-
-  octave_idx_type nel = numel ();
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    retval.elem (i) = static_cast<char>(matrix.elem (i));
-
-  return retval;
-}
-
-octave_value
-octave_range::all (int dim) const
-{
-  // FIXME -- this is a potential waste of memory.
-
-  Matrix m = range.matrix_value ();
-
-  return m.all (dim);
-}
-
-octave_value
-octave_range::any (int dim) const
-{
-  // FIXME -- this is a potential waste of memory.
-
-  Matrix m = range.matrix_value ();
-
-  return m.any (dim);
-}
-
-octave_value
-octave_range::diag (octave_idx_type k) const
-{
-  return (k == 0
-          ? octave_value (DiagMatrix (DiagArray2<double> (range.matrix_value ())))
-          : octave_value (range.diag (k)));
-}
-
-octave_value
-octave_range::diag (octave_idx_type m, octave_idx_type n) const
-{
-  Matrix mat = range.matrix_value ();
-
-  return mat.diag (m, n);
-}
-
-bool
-octave_range::is_true (void) const
-{
-  bool retval = false;
-
-  if (range.nelem () != 0)
-    {
-      // FIXME -- this is a potential waste of memory.
-
-      Matrix m ((range.matrix_value () . all ()) . all ());
-
-      retval = (m.rows () == 1 && m.columns () == 1 && m (0, 0) != 0.0);
-    }
-
-  return retval;
-}
-
-Complex
-octave_range::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  octave_idx_type nel = range.nelem ();
-
-  if (nel > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "range", "complex scalar");
-
-      retval = range.base ();
-    }
-  else
-    gripe_invalid_conversion ("range", "complex scalar");
-
-  return retval;
-}
-
-FloatComplex
-octave_range::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  octave_idx_type nel = range.nelem ();
-
-  if (nel > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "range", "complex scalar");
-
-      retval = range.base ();
-    }
-  else
-    gripe_invalid_conversion ("range", "complex scalar");
-
-  return retval;
-}
-
-boolNDArray
-octave_range::bool_array_value (bool warn) const
-{
-  Matrix m = range.matrix_value ();
-
-  if (m.any_element_is_nan ())
-    gripe_nan_to_logical_conversion ();
-  else if (warn && m.any_element_not_one_or_zero ())
-    gripe_logical_conversion ();
-
-  return boolNDArray (m);
-}
-
-octave_value
-octave_range::resize (const dim_vector& dv, bool fill) const
-{
-  NDArray retval = array_value ();
-  if (fill)
-    retval.resize (dv, 0);
-  else
-    retval.resize (dv);
-  return retval;
-}
-
-octave_value
-octave_range::convert_to_str_internal (bool pad, bool force, char type) const
-{
-  octave_value tmp (range.matrix_value ());
-  return tmp.convert_to_str (pad, force, type);
-}
-
-void
-octave_range::print (std::ostream& os, bool pr_as_read_syntax) const
-{
-  print_raw (os, pr_as_read_syntax);
-  newline (os);
-}
-
-void
-octave_range::print_raw (std::ostream& os, bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, range, pr_as_read_syntax,
-                         current_print_indent_level ());
-}
-
-bool
-octave_range::print_name_tag (std::ostream& os, const std::string& name) const
-{
-  bool retval = false;
-
-  octave_idx_type n = range.nelem ();
-
-  indent (os);
-
-  if (n == 0 || n == 1)
-    os << name << " = ";
-  else
-    {
-      os << name << " =";
-      newline (os);
-      if (! Vcompact_format)
-        newline (os);
-
-      retval = true;
-    }
-
-  return retval;
-}
-
-// Skip white space and comments on stream IS.
-
-static void
-skip_comments (std::istream& is)
-{
-  char c = '\0';
-  while (is.get (c))
-    {
-      if (c == ' ' || c == '\t' || c == '\n')
-        ; // Skip whitespace on way to beginning of next line.
-      else
-        break;
-    }
-
-  skip_until_newline (is, false);
-}
-
-bool
-octave_range::save_ascii (std::ostream& os)
-{
-  Range r = range_value ();
-  double base = r.base ();
-  double limit = r.limit ();
-  double inc = r.inc ();
-  octave_idx_type len = r.nelem ();
-
-  if (inc != 0)
-    os << "# base, limit, increment\n";
-  else
-    os << "# base, length, increment\n";
-
-  octave_write_double (os, base);
-  os << " ";
-  if (inc != 0)
-    octave_write_double (os, limit);
-  else
-    os << len;
-  os << " ";
-  octave_write_double (os, inc);
-  os << "\n";
-
-  return true;
-}
-
-bool
-octave_range::load_ascii (std::istream& is)
-{
-  // # base, limit, range comment added by save ().
-  skip_comments (is);
-
-  double base, limit, inc;
-  is >> base >> limit >> inc;
-
-  if (!is)
-    {
-      error ("load: failed to load range constant");
-      return false;
-    }
-
-  if (inc != 0)
-    range = Range (base, limit, inc);
-  else
-    range = Range (base, inc, static_cast<octave_idx_type> (limit));
-
-  return true;
-}
-
-bool
-octave_range::save_binary (std::ostream& os, bool& /* save_as_floats */)
-{
-  char tmp = LS_DOUBLE;
-  os.write (reinterpret_cast<char *> (&tmp), 1);
-  Range r = range_value ();
-  double bas = r.base ();
-  double lim = r.limit ();
-  double inc = r.inc ();
-  if (inc == 0)
-    lim = r.nelem ();
-
-  os.write (reinterpret_cast<char *> (&bas), 8);
-  os.write (reinterpret_cast<char *> (&lim), 8);
-  os.write (reinterpret_cast<char *> (&inc), 8);
-
-  return true;
-}
-
-bool
-octave_range::load_binary (std::istream& is, bool swap,
-                           oct_mach_info::float_format /* fmt */)
-{
-  char tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-    return false;
-  double bas, lim, inc;
-  if (! is.read (reinterpret_cast<char *> (&bas), 8))
-    return false;
-  if (swap)
-    swap_bytes<8> (&bas);
-  if (! is.read (reinterpret_cast<char *> (&lim), 8))
-    return false;
-  if (swap)
-    swap_bytes<8> (&lim);
-  if (! is.read (reinterpret_cast<char *> (&inc), 8))
-    return false;
-  if (swap)
-    swap_bytes<8> (&inc);
-  if (inc != 0)
-    range = Range (bas, lim, inc);
-  else
-    range = Range (bas, inc, static_cast<octave_idx_type> (lim));
-
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-// The following subroutines creates an HDF5 representation of the way
-// we will store Octave range types (triplets of floating-point numbers).
-// NUM_TYPE is the HDF5 numeric type to use for storage (e.g.
-// H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary
-// conversions are handled automatically by HDF5.
-
-static hid_t
-hdf5_make_range_type (hid_t num_type)
-{
-  hid_t type_id = H5Tcreate (H5T_COMPOUND, sizeof (double) * 3);
-
-  H5Tinsert (type_id, "base", 0 * sizeof (double), num_type);
-  H5Tinsert (type_id, "limit", 1 * sizeof (double), num_type);
-  H5Tinsert (type_id, "increment", 2 * sizeof (double), num_type);
-
-  return type_id;
-}
-
-bool
-octave_range::save_hdf5 (hid_t loc_id, const char *name,
-                         bool /* save_as_floats */)
-{
-  hsize_t dimens[3];
-  hid_t space_hid = -1, type_hid = -1, data_hid = -1;
-  bool retval = true;
-
-  space_hid = H5Screate_simple (0, dimens, 0);
-  if (space_hid < 0) return false;
-
-  type_hid = hdf5_make_range_type (H5T_NATIVE_DOUBLE);
-  if (type_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Tclose (type_hid);
-      return false;
-    }
-
-  Range r = range_value ();
-  double range_vals[3];
-  range_vals[0] = r.base ();
-  range_vals[1] = r.inc () != 0 ? r.limit () : r.nelem ();
-  range_vals[2] = r.inc ();
-
-  if (H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                range_vals) >= 0)
-    {
-      octave_idx_type nel = r.nelem ();
-      retval = hdf5_add_scalar_attr (data_hid, H5T_NATIVE_IDX,
-                                     "OCTAVE_RANGE_NELEM", &nel) >= 0;
-    }
-  else
-    retval = false;
-
-  H5Dclose (data_hid);
-  H5Tclose (type_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_range::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t type_hid = H5Dget_type (data_hid);
-
-  hid_t range_type = hdf5_make_range_type (H5T_NATIVE_DOUBLE);
-
-  if (! hdf5_types_compatible (type_hid, range_type))
-    {
-      H5Tclose (range_type);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  hid_t space_hid = H5Dget_space (data_hid);
-  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Tclose (range_type);
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  double rangevals[3];
-  if (H5Dread (data_hid, range_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-               rangevals) >= 0)
-    {
-      retval = true;
-      octave_idx_type nel;
-      if (hdf5_get_scalar_attr (data_hid, H5T_NATIVE_IDX,
-                                "OCTAVE_RANGE_NELEM", &nel))
-        range = Range (rangevals[0], rangevals[2], nel);
-      else
-        {
-          if (rangevals[2] != 0)
-            range = Range (rangevals[0], rangevals[1], rangevals[2]);
-          else
-            range = Range (rangevals[0], rangevals[2],
-                           static_cast<octave_idx_type> (rangevals[1]));
-        }
-    }
-
-  H5Tclose (range_type);
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_range::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxREAL);
-
-  double *pr = static_cast<double *> (retval->get_data ());
-
-  mwSize nel = numel ();
-
-  Matrix m = matrix_value ();
-
-  const double *p = m.data ();
-
-  for (mwSize i = 0; i < nel; i++)
-    pr[i] = p[i];
-
-  return retval;
-}
-
-DEFUN (allow_noninteger_range_as_index, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} allow_noninteger_range_as_index ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} allow_noninteger_range_as_index (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} allow_noninteger_range_as_index (@var{new_val}, \"local\")\n\
-Query or set the internal variable that controls whether non-integer\n\
-ranges are allowed as indices.  This might be useful for @sc{matlab}\n\
-compatibility; however, it is still not entirely compatible because\n\
-@sc{matlab} treats the range expression differently in different contexts.\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE (allow_noninteger_range_as_index);
-}
-
-/*
-%!test
-%! x = 0:10;
-%! save = allow_noninteger_range_as_index ();
-%! warn_state = warning ("query", "Octave:noninteger-range-as-index");
-%! unwind_protect
-%!   allow_noninteger_range_as_index (false);
-%!   fail ("x(2.1:5)");
-%!   assert (x(2:5), 1:4);
-%!   allow_noninteger_range_as_index (true);
-%!   warning ("off", "Octave:noninteger-range-as-index");
-%!   assert (x(2.49:5), 1:3);
-%!   assert (x(2.5:5), 2:4);
-%!   assert (x(2.51:5), 2:4);
-%! unwind_protect_cleanup
-%!   allow_noninteger_range_as_index (save);
-%!   warning (warn_state.state, warn_state.identifier);
-%! end_unwind_protect
-*/
--- a/src/ov-range.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_range_h)
-#define octave_range_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "Range.h"
-
-#include "lo-mappers.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Range values.
-
-class
-octave_range : public octave_base_value
-{
-public:
-
-  octave_range (void)
-    : octave_base_value (), range (), idx_cache () { }
-
-  octave_range (double base, double limit, double inc)
-    : octave_base_value (), range (base, limit, inc), idx_cache ()
-      {
-        if (range.nelem () < 0)
-          ::error ("invalid range");
-      }
-
-  octave_range (const Range& r)
-    : octave_base_value (), range (r), idx_cache ()
-      {
-        if (range.nelem () < 0 && range.nelem () != -2)
-          ::error ("invalid range");
-      }
-
-  octave_range (const octave_range& r)
-    : octave_base_value (), range (r.range),
-      idx_cache (r.idx_cache ? new idx_vector (*r.idx_cache) : 0)
-    { }
-
-  octave_range (const Range& r, const idx_vector& cache)
-    : octave_base_value (), range (r), idx_cache ()
-      {
-        set_idx_cache (cache);
-      }
-
-  ~octave_range (void) { clear_cached_info (); }
-
-  octave_base_value *clone (void) const { return new octave_range (*this); }
-
-  // A range is really just a special kind of real matrix object.  In
-  // the places where we need to call empty_clone, it makes more sense
-  // to create an empty matrix (0x0) instead of an empty range (1x0).
-  octave_base_value *empty_clone (void) const { return new octave_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int)
-    { return subsref (type, idx); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  idx_vector index_vector (void) const;
-
-  dim_vector dims (void) const
-    {
-      octave_idx_type n = range.nelem ();
-      return dim_vector (n > 0, n);
-    }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-
-  size_t byte_size (void) const { return 3 * sizeof (double); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return NDArray (array_value ().reshape (new_dims)); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return NDArray (array_value ().permute (vec, inv)); }
-
-  octave_value squeeze (void) const { return range; }
-
-  octave_value full_value (void) const { return range.matrix_value (); }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_range (void) const { return true; }
-
-  octave_value all (int dim = 0) const;
-
-  octave_value any (int dim = 0) const;
-
-  octave_value diag (octave_idx_type k = 0) const;
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
-    { return range.sort (dim, mode); }
-
-  octave_value sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const
-    { return range.sort (sidx, dim, mode); }
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const
-    { return range.is_sorted (mode); }
-
-  Array<octave_idx_type> sort_rows_idx (sortmode) const
-    { return Array<octave_idx_type> (dim_vector (1, 0)); }
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
-    { return mode ? mode : ASCENDING; }
-
-  builtin_type_t builtin_type (void) const { return btyp_double; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  bool is_numeric_type (void) const { return true; }
-
-  bool is_true (void) const;
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  float float_scalar_value (bool frc_str_conv = false) const
-    { return float_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const
-    { return range.matrix_value (); }
-
-  FloatMatrix float_matrix_value (bool = false) const
-    { return range.matrix_value (); }
-
-  NDArray array_value (bool = false) const
-    { return range.matrix_value (); }
-
-  FloatNDArray float_array_value (bool = false) const
-    { return FloatMatrix (range.matrix_value ()); }
-
-  charNDArray char_array_value (bool = false) const;
-
-  // FIXME -- it would be better to have Range::intXNDArray_value
-  // functions to avoid the intermediate conversion to a matrix
-  // object.
-
-  int8NDArray
-  int8_array_value (void) const { return int8NDArray (array_value ()); }
-
-  int16NDArray
-  int16_array_value (void) const { return int16NDArray (array_value ()); }
-
-  int32NDArray
-  int32_array_value (void) const { return int32NDArray (array_value ()); }
-
-  int64NDArray
-  int64_array_value (void) const { return int64NDArray (array_value ()); }
-
-  uint8NDArray
-  uint8_array_value (void) const { return uint8NDArray (array_value ()); }
-
-  uint16NDArray
-  uint16_array_value (void) const { return uint16NDArray (array_value ()); }
-
-  uint32NDArray
-  uint32_array_value (void) const { return uint32NDArray (array_value ()); }
-
-  uint64NDArray
-  uint64_array_value (void) const { return uint64NDArray (array_value ()); }
-
-  SparseMatrix sparse_matrix_value (bool = false) const
-    { return SparseMatrix (range.matrix_value ()); }
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-    { return SparseComplexMatrix (sparse_matrix_value ()); }
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool warn = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const
-    { return ComplexMatrix (range.matrix_value ()); }
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const
-    { return FloatComplexMatrix (range.matrix_value ()); }
-
-  ComplexNDArray complex_array_value (bool = false) const
-    { return ComplexMatrix (range.matrix_value ()); }
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const
-    { return FloatComplexMatrix (range.matrix_value ()); }
-
-  Range range_value (void) const { return range; }
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool print_name_tag (std::ostream& os, const std::string& name) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      // FIXME -- could be more memory efficient by having a
-      // special case of the octave_stream::write method for ranges.
-
-      return os.write (matrix_value (), block_size, output_type, skip,
-                       flt_fmt);
-    }
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const
-    {
-      octave_matrix m (matrix_value ());
-      return m.map (umap);
-    }
-
-private:
-
-  Range range;
-
-  idx_vector set_idx_cache (const idx_vector& idx) const
-    {
-      delete idx_cache;
-      idx_cache = idx ? new idx_vector (idx) : 0;
-      return idx;
-    }
-
-  void clear_cached_info (void) const
-    {
-      delete idx_cache; idx_cache = 0;
-    }
-
-  mutable idx_vector *idx_cache;
-
-  // No assignment.
-
-  octave_range& operator = (const octave_range&);
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-// If TRUE, allow ranges with non-integer elements as array indices.
-extern bool Vallow_noninteger_range_as_index;
-
-#endif
--- a/src/ov-re-diag.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "byte-swap.h"
-
-#include "ov-re-diag.h"
-#include "ov-flt-re-diag.h"
-#include "ov-base-diag.cc"
-#include "ov-scalar.h"
-#include "ov-re-mat.h"
-#include "ls-utils.h"
-
-template class octave_base_diag<DiagMatrix, Matrix>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_diag_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_diag_matrix, "diagonal matrix", "double");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_diag_matrix&);
-
-  return new octave_matrix (v.matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_diag_matrix::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_matrix::static_type_id ());
-}
-
-static octave_base_value *
-default_numeric_demotion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_diag_matrix&);
-
-  return new octave_float_diag_matrix (v.float_diag_matrix_value ());
-}
-
-octave_base_value::type_conv_info
-octave_diag_matrix::numeric_demotion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_demotion_function,
-                                            octave_float_diag_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_diag_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.nelem () == 1)
-    retval = new octave_scalar (matrix (0, 0));
-
-  return retval;
-}
-
-octave_value
-octave_diag_matrix::do_index_op (const octave_value_list& idx,
-                                 bool resize_ok)
-{
-  octave_value retval;
-
-  // This hack is to allow constructing permutation matrices using
-  // eye(n)(p,:), eye(n)(:,q) && eye(n)(p,q) where p & q are permutation
-  // vectors.
-  if (! resize_ok && idx.length () == 2 && matrix.is_multiple_of_identity (1))
-    {
-      idx_vector idx0 = idx(0).index_vector ();
-      idx_vector idx1 = idx(1).index_vector ();
-
-      if (! error_state)
-        {
-          bool left = idx0.is_permutation (matrix.rows ());
-          bool right = idx1.is_permutation (matrix.cols ());
-
-          if (left && right)
-            {
-              if (idx0.is_colon ()) left = false;
-              if (idx1.is_colon ()) right = false;
-              if (left && right)
-                retval = PermMatrix (idx0, false) * PermMatrix (idx1, true);
-              else if (left)
-                retval = PermMatrix (idx0, false);
-              else if (right)
-                retval = PermMatrix (idx1, true);
-              else
-                {
-                  retval = this;
-                  this->count++;
-                }
-            }
-        }
-    }
-
-  // if error_state is set, we've already griped.
-  if (! error_state && retval.is_undefined ())
-    retval = octave_base_diag<DiagMatrix, Matrix>::do_index_op (idx, resize_ok);
-
-  return retval;
-}
-
-DiagMatrix
-octave_diag_matrix::diag_matrix_value (bool) const
-{
-  return matrix;
-}
-
-FloatDiagMatrix
-octave_diag_matrix::float_diag_matrix_value (bool) const
-{
-  return FloatDiagMatrix (matrix);
-}
-
-ComplexDiagMatrix
-octave_diag_matrix::complex_diag_matrix_value (bool) const
-{
-  return ComplexDiagMatrix (matrix);
-}
-
-FloatComplexDiagMatrix
-octave_diag_matrix::float_complex_diag_matrix_value (bool) const
-{
-  return FloatComplexDiagMatrix (matrix);
-}
-
-octave_value
-octave_diag_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_abs:
-      return matrix.abs ();
-    case umap_real:
-    case umap_conj:
-      return matrix;
-    case umap_imag:
-      return DiagMatrix (matrix.rows (), matrix.cols (), 0.0);
-    case umap_sqrt:
-      {
-        ComplexColumnVector tmp = matrix.diag ().map<Complex> (rc_sqrt);
-        ComplexDiagMatrix retval (tmp);
-        retval.resize (matrix.rows (), matrix.columns ());
-        return retval;
-      }
-    default:
-      return to_dense ().map (umap);
-    }
-}
-
-bool
-octave_diag_matrix::save_binary (std::ostream& os, bool& save_as_floats)
-{
-
-  int32_t r = matrix.rows (), c = matrix.cols ();
-  os.write (reinterpret_cast<char *> (&r), 4);
-  os.write (reinterpret_cast<char *> (&c), 4);
-
-  Matrix m = Matrix (matrix.diag ());
-  save_type st = LS_DOUBLE;
-  if (save_as_floats)
-    {
-      if (m.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        st = LS_FLOAT;
-    }
-  else if (matrix.length () > 8192) // FIXME -- make this configurable.
-    {
-      double max_val, min_val;
-      if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  const double *mtmp = m.data ();
-  write_doubles (os, mtmp, st, m.numel ());
-
-  return true;
-}
-
-bool
-octave_diag_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format fmt)
-{
-  int32_t r, c;
-  char tmp;
-  if (! (is.read (reinterpret_cast<char *> (&r), 4)
-         && is.read (reinterpret_cast<char *> (&c), 4)
-         && is.read (reinterpret_cast<char *> (&tmp), 1)))
-    return false;
-  if (swap)
-    {
-      swap_bytes<4> (&r);
-      swap_bytes<4> (&c);
-    }
-
-  DiagMatrix m (r, c);
-  double *re = m.fortran_vec ();
-  octave_idx_type len = m.length ();
-  read_doubles (is, re, static_cast<save_type> (tmp), len, swap, fmt);
-  if (error_state || ! is)
-    return false;
-  matrix = m;
-
-  return true;
-}
-
-bool
-octave_diag_matrix::chk_valid_scalar (const octave_value& val,
-                                      double& x) const
-{
-  bool retval = val.is_real_scalar ();
-  if (retval)
-    x = val.double_value ();
-  return retval;
-}
--- a/src/ov-re-diag.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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_diag_matrix_h)
-#define octave_diag_matrix_h 1
-
-#include "ov-base.h"
-#include "ov-base-diag.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-
-// Real diagonal matrix values.
-
-class
-OCTINTERP_API
-octave_diag_matrix
-  : public octave_base_diag<DiagMatrix, Matrix>
-{
-public:
-
-  octave_diag_matrix (void)
-    : octave_base_diag<DiagMatrix, Matrix> () { }
-
-  octave_diag_matrix (const DiagMatrix& m)
-    : octave_base_diag<DiagMatrix, Matrix> (m) { }
-
-  octave_diag_matrix (const octave_diag_matrix& m)
-    : octave_base_diag<DiagMatrix, Matrix> (m) { }
-
-  ~octave_diag_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_diag_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_diag_matrix (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  type_conv_info numeric_demotion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  builtin_type_t builtin_type (void) const { return btyp_double; }
-
-  bool is_real_matrix (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  DiagMatrix diag_matrix_value (bool = false) const;
-
-  FloatDiagMatrix float_diag_matrix_value (bool = false) const;
-
-  ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
-
-  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-
-  bool chk_valid_scalar (const octave_value&,
-                         double&) const;
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-re-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1031 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-#include <vector>
-
-#include "data-conv.h"
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-#include "mach-info.h"
-#include "mx-base.h"
-#include "quit.h"
-#include "oct-locbuf.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-base-mat.cc"
-#include "ov-scalar.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-re-sparse.h"
-#include "ov-re-diag.h"
-#include "ov-cx-diag.h"
-#include "ov-lazy-idx.h"
-#include "ov-perm.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-#if ! defined (UCHAR_MAX)
-#define UCHAR_MAX 255
-#endif
-
-template class octave_base_matrix<NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_matrix, "matrix", "double");
-
-static octave_base_value *
-default_numeric_demotion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_matrix&);
-
-  return new octave_float_matrix (v.float_array_value ());
-}
-
-octave_base_value::type_conv_info
-octave_matrix::numeric_demotion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_demotion_function,
-                                            octave_float_matrix::static_type_id ());
-}
-
-octave_base_value *
-octave_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (matrix.nelem () == 1)
-    retval = new octave_scalar (matrix (0));
-
-  return retval;
-}
-
-double
-octave_matrix::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (numel () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "real matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real matrix", "real scalar");
-
-  return retval;
-}
-
-float
-octave_matrix::float_value (bool) const
-{
-  float retval = lo_ieee_float_nan_value ();
-
-  if (numel () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "real matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real matrix", "real scalar");
-
-  return retval;
-}
-
-// FIXME
-
-Matrix
-octave_matrix::matrix_value (bool) const
-{
-  return matrix.matrix_value ();
-}
-
-FloatMatrix
-octave_matrix::float_matrix_value (bool) const
-{
-  return FloatMatrix (matrix.matrix_value ());
-}
-
-Complex
-octave_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "real matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real matrix", "complex scalar");
-
-  return retval;
-}
-
-FloatComplex
-octave_matrix::float_complex_value (bool) const
-{
-  float tmp = lo_ieee_float_nan_value ();
-
-  FloatComplex retval (tmp, tmp);
-
-  if (rows () > 0 && columns () > 0)
-    {
-      gripe_implicit_conversion ("Octave:array-to-scalar",
-                                 "real matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real matrix", "complex scalar");
-
-  return retval;
-}
-
-// FIXME
-
-ComplexMatrix
-octave_matrix::complex_matrix_value (bool) const
-{
-  return ComplexMatrix (matrix.matrix_value ());
-}
-
-FloatComplexMatrix
-octave_matrix::float_complex_matrix_value (bool) const
-{
-  return FloatComplexMatrix (matrix.matrix_value ());
-}
-
-ComplexNDArray
-octave_matrix::complex_array_value (bool) const
-{
-  return ComplexNDArray (matrix);
-}
-
-FloatComplexNDArray
-octave_matrix::float_complex_array_value (bool) const
-{
-  return FloatComplexNDArray (matrix);
-}
-
-boolNDArray
-octave_matrix::bool_array_value (bool warn) const
-{
-  if (matrix.any_element_is_nan ())
-    gripe_nan_to_logical_conversion ();
-  else if (warn && matrix.any_element_not_one_or_zero ())
-    gripe_logical_conversion ();
-
-  return boolNDArray (matrix);
-}
-
-charNDArray
-octave_matrix::char_array_value (bool) const
-{
-  charNDArray retval (dims ());
-
-  octave_idx_type nel = numel ();
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    retval.elem (i) = static_cast<char>(matrix.elem (i));
-
-  return retval;
-}
-
-SparseMatrix
-octave_matrix::sparse_matrix_value (bool) const
-{
-  return SparseMatrix (matrix.matrix_value ());
-}
-
-SparseComplexMatrix
-octave_matrix::sparse_complex_matrix_value (bool) const
-{
-  // FIXME Need a SparseComplexMatrix (Matrix) constructor to make
-  // this function more efficient. Then this should become
-  // return SparseComplexMatrix (matrix.matrix_value ());
-  return SparseComplexMatrix (sparse_matrix_value ());
-}
-
-octave_value
-octave_matrix::diag (octave_idx_type k) const
-{
-  octave_value retval;
-  if (k == 0 && matrix.ndims () == 2
-      && (matrix.rows () == 1 || matrix.columns () == 1))
-    retval = DiagMatrix (DiagArray2<double> (matrix));
-  else
-    retval = octave_base_matrix<NDArray>::diag (k);
-
-  return retval;
-}
-
-octave_value
-octave_matrix::diag (octave_idx_type m, octave_idx_type n) const
-{
-  octave_value retval;
-
-  if (matrix.ndims () == 2
-      && (matrix.rows () == 1 || matrix.columns () == 1))
-    {
-      Matrix mat = matrix.matrix_value ();
-
-      retval = mat.diag (m, n);
-    }
-  else
-    error ("diag: expecting vector argument");
-
-  return retval;
-}
-
-// We override these two functions to allow reshaping both
-// the matrix and the index cache.
-octave_value
-octave_matrix::reshape (const dim_vector& new_dims) const
-{
-  if (idx_cache)
-    {
-      return new octave_matrix (matrix.reshape (new_dims),
-                                idx_vector (idx_cache->as_array ().reshape (new_dims),
-                                            idx_cache->extent (0)));
-    }
-  else
-    return octave_base_matrix<NDArray>::reshape (new_dims);
-}
-
-octave_value
-octave_matrix::squeeze (void) const
-{
-  if (idx_cache)
-    {
-      return new octave_matrix (matrix.squeeze (),
-                                idx_vector (idx_cache->as_array ().squeeze (),
-                                            idx_cache->extent (0)));
-    }
-  else
-    return octave_base_matrix<NDArray>::squeeze ();
-}
-
-octave_value
-octave_matrix::sort (octave_idx_type dim, sortmode mode) const
-{
-  if (idx_cache)
-    {
-      // This is a valid index matrix, so sort via integers because it's
-      // generally more efficient.
-      return octave_lazy_index (*idx_cache).sort (dim, mode);
-    }
-  else
-    return octave_base_matrix<NDArray>::sort (dim, mode);
-}
-
-octave_value
-octave_matrix::sort (Array<octave_idx_type> &sidx, octave_idx_type dim,
-                     sortmode mode) const
-{
-  if (idx_cache)
-    {
-      // This is a valid index matrix, so sort via integers because it's
-      // generally more efficient.
-      return octave_lazy_index (*idx_cache).sort (sidx, dim, mode);
-    }
-  else
-    return octave_base_matrix<NDArray>::sort (sidx, dim, mode);
-}
-
-sortmode
-octave_matrix::is_sorted (sortmode mode) const
-{
-  if (idx_cache)
-    {
-      // This is a valid index matrix, so check via integers because it's
-      // generally more efficient.
-      return idx_cache->as_array ().is_sorted (mode);
-    }
-  else
-    return octave_base_matrix<NDArray>::is_sorted (mode);
-}
-Array<octave_idx_type>
-octave_matrix::sort_rows_idx (sortmode mode) const
-{
-  if (idx_cache)
-    {
-      // This is a valid index matrix, so sort via integers because it's
-      // generally more efficient.
-      return octave_lazy_index (*idx_cache).sort_rows_idx (mode);
-    }
-  else
-    return octave_base_matrix<NDArray>::sort_rows_idx (mode);
-}
-
-sortmode
-octave_matrix::is_sorted_rows (sortmode mode) const
-{
-  if (idx_cache)
-    {
-      // This is a valid index matrix, so check via integers because it's
-      // generally more efficient.
-      return idx_cache->as_array ().is_sorted_rows (mode);
-    }
-  else
-    return octave_base_matrix<NDArray>::is_sorted_rows (mode);
-}
-
-octave_value
-octave_matrix::convert_to_str_internal (bool, bool, char type) const
-{
-  octave_value retval;
-  dim_vector dv = dims ();
-  octave_idx_type nel = dv.numel ();
-
-  charNDArray chm (dv);
-
-  bool warned = false;
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      octave_quit ();
-
-      double d = matrix (i);
-
-      if (xisnan (d))
-        {
-          gripe_nan_to_character_conversion ();
-          return retval;
-        }
-      else
-        {
-          int ival = NINT (d);
-
-          if (ival < 0 || ival > UCHAR_MAX)
-            {
-              // FIXME -- is there something
-              // better we could do?
-
-              ival = 0;
-
-              if (! warned)
-                {
-                  ::warning ("range error for conversion to character value");
-                  warned = true;
-                }
-            }
-
-          chm (i) = static_cast<char> (ival);
-        }
-    }
-
-  retval = octave_value (chm, type);
-
-  return retval;
-}
-
-bool
-octave_matrix::save_ascii (std::ostream& os)
-{
-  dim_vector d = dims ();
-
-  if (d.length () > 2)
-    {
-      NDArray tmp = array_value ();
-
-      os << "# ndims: " << d.length () << "\n";
-
-      for (int i=0; i < d.length (); i++)
-        os << " " << d (i);
-
-      os << "\n" << tmp;
-    }
-  else
-    {
-      // Keep this case, rather than use generic code above for backward
-      // compatiability. Makes load_ascii much more complex!!
-      os << "# rows: " << rows () << "\n"
-         << "# columns: " << columns () << "\n";
-
-      os << matrix_value ();
-    }
-
-  return true;
-}
-
-bool
-octave_matrix::load_ascii (std::istream& is)
-{
-  bool success = true;
-
-  string_vector keywords(2);
-
-  keywords[0] = "ndims";
-  keywords[1] = "rows";
-
-  std::string kw;
-  octave_idx_type val = 0;
-
-  if (extract_keyword (is, keywords, kw, val, true))
-    {
-      if (kw == "ndims")
-        {
-          int mdims = static_cast<int> (val);
-
-          if (mdims >= 0)
-            {
-              dim_vector dv;
-              dv.resize (mdims);
-
-              for (int i = 0; i < mdims; i++)
-                is >> dv(i);
-
-              if (is)
-                {
-                  NDArray tmp(dv);
-
-                  is >> tmp;
-
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else
-                {
-                  error ("load: failed to read dimensions");
-                  success = false;
-                }
-            }
-          else
-            {
-              error ("load: failed to extract number of dimensions");
-              success = false;
-            }
-        }
-      else if (kw == "rows")
-        {
-          octave_idx_type nr = val;
-          octave_idx_type nc = 0;
-
-          if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
-            {
-              if (nr > 0 && nc > 0)
-                {
-                  Matrix tmp (nr, nc);
-                  is >> tmp;
-                  if (is)
-                    matrix = tmp;
-                  else
-                    {
-                      error ("load: failed to load matrix constant");
-                      success = false;
-                    }
-                }
-              else if (nr == 0 || nc == 0)
-                matrix = Matrix (nr, nc);
-              else
-                panic_impossible ();
-            }
-          else
-            {
-              error ("load: failed to extract number of rows and columns");
-              success = false;
-            }
-        }
-      else
-        panic_impossible ();
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_matrix::save_binary (std::ostream& os, bool& save_as_floats)
-{
-
-  dim_vector d = dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims to differentiate with old format!!
-  int32_t tmp = - d.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i = 0; i < d.length (); i++)
-    {
-      tmp = d(i);
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-    }
-
-  NDArray m = array_value ();
-  save_type st = LS_DOUBLE;
-  if (save_as_floats)
-    {
-      if (m.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        st = LS_FLOAT;
-    }
-  else if (d.numel () > 8192) // FIXME -- make this configurable.
-    {
-      double max_val, min_val;
-      if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  const double *mtmp = m.data ();
-  write_doubles (os, mtmp, st, d.numel ());
-
-  return true;
-}
-
-bool
-octave_matrix::load_binary (std::istream& is, bool swap,
-                                 oct_mach_info::float_format fmt)
-{
-  char tmp;
-  int32_t mdims;
-  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&mdims);
-  if (mdims < 0)
-    {
-      mdims = - mdims;
-      int32_t di;
-      dim_vector dv;
-      dv.resize (mdims);
-
-      for (int i = 0; i < mdims; i++)
-        {
-          if (! is.read (reinterpret_cast<char *> (&di), 4))
-            return false;
-          if (swap)
-            swap_bytes<4> (&di);
-          dv(i) = di;
-        }
-
-      // Convert an array with a single dimension to be a row vector.
-      // Octave should never write files like this, other software
-      // might.
-
-      if (mdims == 1)
-        {
-          mdims = 2;
-          dv.resize (mdims);
-          dv(1) = dv(0);
-          dv(0) = 1;
-        }
-
-      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-        return false;
-
-      NDArray m(dv);
-      double *re = m.fortran_vec ();
-      read_doubles (is, re, static_cast<save_type> (tmp), dv.numel (), swap, fmt);
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  else
-    {
-      int32_t nr, nc;
-      nr = mdims;
-      if (! is.read (reinterpret_cast<char *> (&nc), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&nc);
-      if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-        return false;
-      Matrix m (nr, nc);
-      double *re = m.fortran_vec ();
-      octave_idx_type len = nr * nc;
-      read_doubles (is, re, static_cast<save_type> (tmp), len, swap, fmt);
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_matrix::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  int rank = dv.length ();
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-  NDArray m = array_value ();
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
-
-  space_hid = H5Screate_simple (rank, hdims, 0);
-
-  if (space_hid < 0) return false;
-
-  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
-
-  if (save_as_floats)
-    {
-      if (m.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        save_type_hid = H5T_NATIVE_FLOAT;
-    }
-#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
-  // hdf5 currently doesn't support float/integer conversions
-  else
-    {
-      double max_val, min_val;
-
-      if (m.all_integers (max_val, min_val))
-        save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
-    }
-#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  double *mtmp = m.fortran_vec ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, mtmp) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_matrix::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-      return (empty > 0);
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank < 1)
-    {
-      H5Sclose (space_id);
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  if (rank == 1)
-    {
-      dv.resize (2);
-      dv(0) = 1;
-      dv(1) = hdims[0];
-    }
-  else
-    {
-      dv.resize (rank);
-      for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
-        dv(j) = hdims[i];
-    }
-
-  NDArray m (dv);
-  double *re = m.fortran_vec ();
-  if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, re) >= 0)
-    {
-      retval = true;
-      matrix = m;
-    }
-
-  H5Sclose (space_id);
-  H5Dclose (data_hid);
-
-  return retval;
-}
-
-#endif
-
-void
-octave_matrix::print_raw (std::ostream& os,
-                          bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, matrix, pr_as_read_syntax,
-                         current_print_indent_level ());
-}
-
-mxArray *
-octave_matrix::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxREAL);
-
-  double *pr = static_cast<double *> (retval->get_data ());
-
-  mwSize nel = numel ();
-
-  const double *p = matrix.data ();
-
-  for (mwIndex i = 0; i < nel; i++)
-    pr[i] = p[i];
-
-  return retval;
-}
-
-// This uses a smarter strategy for doing the complex->real mappers.  We
-// allocate an array for a real result and keep filling it until a complex
-// result is produced.
-static octave_value
-do_rc_map (const NDArray& a, Complex (&fcn) (double))
-{
-  octave_idx_type n = a.numel ();
-  NoAlias<NDArray> rr (a.dims ());
-
-  for (octave_idx_type i = 0; i < n; i++)
-    {
-      octave_quit ();
-
-      Complex tmp = fcn (a(i));
-      if (tmp.imag () == 0.0)
-        rr(i) = tmp.real ();
-      else
-        {
-          NoAlias<ComplexNDArray> rc (a.dims ());
-
-          for (octave_idx_type j = 0; j < i; j++)
-            rc(j) = rr(j);
-
-          rc(i) = tmp;
-
-          for (octave_idx_type j = i+1; j < n; j++)
-            {
-              octave_quit ();
-
-              rc(j) = fcn (a(j));
-            }
-
-          return new octave_complex_matrix (rc);
-        }
-    }
-
-  return rr;
-}
-
-octave_value
-octave_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_imag:
-      return NDArray (matrix.dims (), 0.0);
-
-    case umap_real:
-    case umap_conj:
-      return matrix;
-
-    // Mappers handled specially.
-#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.FCN ())
-
-      ARRAY_METHOD_MAPPER (abs, abs);
-      ARRAY_METHOD_MAPPER (isnan, isnan);
-      ARRAY_METHOD_MAPPER (isinf, isinf);
-      ARRAY_METHOD_MAPPER (finite, isfinite);
-
-#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.map<TYPE> (FCN))
-
-#define RC_ARRAY_MAPPER(UMAP, TYPE, FCN) \
-    case umap_ ## UMAP: \
-      return do_rc_map (matrix, FCN)
-
-      RC_ARRAY_MAPPER (acos, Complex, rc_acos);
-      RC_ARRAY_MAPPER (acosh, Complex, rc_acosh);
-      ARRAY_MAPPER (angle, double, ::arg);
-      ARRAY_MAPPER (arg, double, ::arg);
-      RC_ARRAY_MAPPER (asin, Complex, rc_asin);
-      ARRAY_MAPPER (asinh, double, ::asinh);
-      ARRAY_MAPPER (atan, double, ::atan);
-      RC_ARRAY_MAPPER (atanh, Complex, rc_atanh);
-      ARRAY_MAPPER (erf, double, ::erf);
-      ARRAY_MAPPER (erfinv, double, ::erfinv);
-      ARRAY_MAPPER (erfcinv, double, ::erfcinv);
-      ARRAY_MAPPER (erfc, double, ::erfc);
-      ARRAY_MAPPER (erfcx, double, ::erfcx);
-      ARRAY_MAPPER (gamma, double, xgamma);
-      RC_ARRAY_MAPPER (lgamma, Complex, rc_lgamma);
-      ARRAY_MAPPER (cbrt, double, ::cbrt);
-      ARRAY_MAPPER (ceil, double, ::ceil);
-      ARRAY_MAPPER (cos, double, ::cos);
-      ARRAY_MAPPER (cosh, double, ::cosh);
-      ARRAY_MAPPER (exp, double, ::exp);
-      ARRAY_MAPPER (expm1, double, ::expm1);
-      ARRAY_MAPPER (fix, double, ::fix);
-      ARRAY_MAPPER (floor, double, ::floor);
-      RC_ARRAY_MAPPER (log, Complex, rc_log);
-      RC_ARRAY_MAPPER (log2, Complex, rc_log2);
-      RC_ARRAY_MAPPER (log10, Complex, rc_log10);
-      RC_ARRAY_MAPPER (log1p, Complex, rc_log1p);
-      ARRAY_MAPPER (round, double, xround);
-      ARRAY_MAPPER (roundb, double, xroundb);
-      ARRAY_MAPPER (signum, double, ::signum);
-      ARRAY_MAPPER (sin, double, ::sin);
-      ARRAY_MAPPER (sinh, double, ::sinh);
-      RC_ARRAY_MAPPER (sqrt, Complex, rc_sqrt);
-      ARRAY_MAPPER (tan, double, ::tan);
-      ARRAY_MAPPER (tanh, double, ::tanh);
-      ARRAY_MAPPER (isna, bool, octave_is_NA);
-
-    default:
-      if (umap >= umap_xisalnum && umap <= umap_xtoupper)
-        {
-          octave_value str_conv = convert_to_str (true, true);
-          return error_state ? octave_value () : str_conv.map (umap);
-        }
-      else
-        return octave_base_value::map (umap);
-    }
-}
-
-DEFUN (double, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} double (@var{x})\n\
-Convert @var{x} to double precision type.\n\
-@seealso{single}\n\
-@end deftypefn")
-{
-  // The OCTAVE_TYPE_CONV_BODY3 macro declares retval, so they go
-  // inside their own scopes, and we don't declare retval here to
-  // avoid a shadowed declaration warning.
-
-  if (args.length () == 1)
-    {
-      if (args(0).is_perm_matrix ())
-        {
-          OCTAVE_TYPE_CONV_BODY3 (double, octave_perm_matrix, octave_scalar);
-        }
-      else if (args(0).is_diag_matrix ())
-        {
-          if (args(0).is_complex_type ())
-            {
-              OCTAVE_TYPE_CONV_BODY3 (double, octave_complex_diag_matrix, octave_complex);
-            }
-          else
-            {
-              OCTAVE_TYPE_CONV_BODY3 (double, octave_diag_matrix, octave_scalar);
-            }
-        }
-      else if (args(0).is_sparse_type ())
-        {
-          if (args(0).is_complex_type ())
-            {
-              OCTAVE_TYPE_CONV_BODY3 (double, octave_sparse_complex_matrix, octave_complex);
-            }
-          else
-            {
-              OCTAVE_TYPE_CONV_BODY3 (double, octave_sparse_matrix, octave_scalar);
-            }
-        }
-      else if (args(0).is_complex_type ())
-        {
-          OCTAVE_TYPE_CONV_BODY3 (double, octave_complex_matrix, octave_complex);
-        }
-      else
-        {
-          OCTAVE_TYPE_CONV_BODY3 (double, octave_matrix, octave_scalar);
-        }
-    }
-  else
-    print_usage ();
-
-  return octave_value ();
-}
-
-/*
-%!assert (class (double (single (1))), "double")
-%!assert (class (double (single (1 + i))), "double")
-%!assert (class (double (int8 (1))), "double")
-%!assert (class (double (uint8 (1))), "double")
-%!assert (class (double (int16 (1))), "double")
-%!assert (class (double (uint16 (1))), "double")
-%!assert (class (double (int32 (1))), "double")
-%!assert (class (double (uint32 (1))), "double")
-%!assert (class (double (int64 (1))), "double")
-%!assert (class (double (uint64 (1))), "double")
-%!assert (class (double (true)), "double")
-%!assert (class (double ("A")), "double")
-%!test
-%! x = sparse (logical ([1 0; 0 1]));
-%! y = double (x);
-%! assert (class (x), "logical");
-%! assert (class (y), "double");
-%! assert (issparse (y));
-%!test
-%! x = diag (single ([1 3 2]));
-%! y = double (x);
-%! assert (class (x), "single");
-%! assert (class (y), "double");
-%!test
-%! x = diag (single ([i 3 2]));
-%! y = double (x);
-%! assert (class (x), "single");
-%! assert (class (y), "double");
-*/
--- a/src/ov-re-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_matrix_h)
-#define octave_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-base-mat.h"
-#include "ov-typeinfo.h"
-
-#include "MatrixType.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Real matrix values.
-
-class
-OCTINTERP_API
-octave_matrix : public octave_base_matrix<NDArray>
-{
-public:
-
-  octave_matrix (void)
-    : octave_base_matrix<NDArray> () { }
-
-  octave_matrix (const Matrix& m)
-    : octave_base_matrix<NDArray> (m) { }
-
-  octave_matrix (const Matrix& m, const MatrixType& t)
-    : octave_base_matrix<NDArray> (m, t) { }
-
-  octave_matrix (const NDArray& nda)
-    : octave_base_matrix<NDArray> (nda) { }
-
-  octave_matrix (const Array<double>& m)
-    : octave_base_matrix<NDArray> (NDArray (m)) { }
-
-  octave_matrix (const DiagMatrix& d)
-    : octave_base_matrix<NDArray> (Matrix (d)) { }
-
-  octave_matrix (const RowVector& v)
-    : octave_base_matrix<NDArray> (Matrix (v)) { }
-
-  octave_matrix (const ColumnVector& v)
-    : octave_base_matrix<NDArray> (Matrix (v)) { }
-
-  octave_matrix (const octave_matrix& m)
-    : octave_base_matrix<NDArray> (m) { }
-
-  octave_matrix (const Array<octave_idx_type>& idx,
-                 bool zero_based = false, bool cache_index = false)
-    : octave_base_matrix<NDArray> (NDArray (idx, zero_based))
-    {
-      // Auto-create cache to speed up subsequent indexing.
-      if (zero_based && cache_index)
-        set_idx_cache (idx_vector (idx));
-    }
-
-  octave_matrix (const NDArray& nda, const idx_vector& cache)
-    : octave_base_matrix<NDArray> (nda)
-    {
-      set_idx_cache (cache);
-    }
-
-  ~octave_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_matrix (); }
-
-  type_conv_info numeric_demotion_function (void) const;
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  idx_vector index_vector (void) const
-    { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
-
-  builtin_type_t builtin_type (void) const { return btyp_double; }
-
-  bool is_real_matrix (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  int8NDArray
-  int8_array_value (void) const { return int8NDArray (matrix); }
-
-  int16NDArray
-  int16_array_value (void) const { return int16NDArray (matrix); }
-
-  int32NDArray
-  int32_array_value (void) const { return int32NDArray (matrix); }
-
-  int64NDArray
-  int64_array_value (void) const { return int64NDArray (matrix); }
-
-  uint8NDArray
-  uint8_array_value (void) const { return uint8NDArray (matrix); }
-
-  uint16NDArray
-  uint16_array_value (void) const { return uint16NDArray (matrix); }
-
-  uint32NDArray
-  uint32_array_value (void) const { return uint32NDArray (matrix); }
-
-  uint64NDArray
-  uint64_array_value (void) const { return uint64NDArray (matrix); }
-
-  double double_value (bool = false) const;
-
-  float float_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  FloatMatrix float_matrix_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  FloatComplex float_complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool warn = false) const;
-
-  charNDArray char_array_value (bool = false) const;
-
-  NDArray array_value (bool = false) const { return matrix; }
-
-  FloatNDArray float_array_value (bool = false) const { return matrix; }
-
-  SparseMatrix sparse_matrix_value (bool = false) const;
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
-
-  octave_value diag (octave_idx_type k = 0) const;
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  octave_value reshape (const dim_vector& new_dims) const;
-
-  octave_value squeeze (void) const;
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const;
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const;
-
-  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const;
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
-
-  // Use matrix_ref here to clear index cache.
-  void increment (void) { matrix_ref () += 1.0; }
-
-  void decrement (void) { matrix_ref () -= 1.0; }
-
-  void changesign (void) { matrix_ref ().changesign (); }
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
-
-  // Unsafe.  This function exists to support the MEX interface.
-  // You should not use it anywhere else.
-  void *mex_get_data (void) const { return matrix.mex_get_data (); }
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-re-sparse.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,945 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-#include <vector>
-
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-#include "oct-locbuf.h"
-
-#include "ov-base.h"
-#include "ov-scalar.h"
-#include "gripes.h"
-
-#include "ls-hdf5.h"
-
-#include "ov-re-sparse.h"
-
-#include "ov-base-sparse.h"
-#include "ov-base-sparse.cc"
-
-#include "ov-bool-sparse.h"
-
-template class OCTINTERP_API octave_base_sparse<SparseMatrix>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_sparse_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparse_matrix, "sparse matrix", "double");
-
-idx_vector
-octave_sparse_matrix::index_vector (void) const
-{
-  if (matrix.numel () == matrix.nnz ())
-    return idx_vector (array_value ());
-  else
-    {
-      std::string nm = type_name ();
-      error ("%s type invalid as index value", nm.c_str ());
-      return idx_vector ();
-    }
-}
-
-octave_base_value *
-octave_sparse_matrix::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (Vsparse_auto_mutate)
-    {
-      // Don't use numel, since it can overflow for very large matrices
-      // Note that for the second test, this means it becomes approximative
-      // since it involves a cast to double to avoid issues of overflow
-      if (matrix.rows () == 1 && matrix.cols () == 1)
-        {
-          // Const copy of the matrix, so the right version of () operator used
-          const SparseMatrix tmp (matrix);
-
-          retval = new octave_scalar (tmp (0));
-        }
-      else if (matrix.cols () > 0 && matrix.rows () > 0
-               && (double (matrix.byte_size ()) > double (matrix.rows ())
-                   * double (matrix.cols ()) * sizeof (double)))
-        retval = new octave_matrix (matrix.matrix_value ());
-    }
-
-  return retval;
-}
-
-double
-octave_sparse_matrix::double_value (bool) const
-{
-  double retval = lo_ieee_nan_value ();
-
-  if (numel () > 0)
-    {
-      if (numel () > 1)
-        gripe_implicit_conversion ("Octave:array-to-scalar",
-                                   "real sparse matrix", "real scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real sparse matrix", "real scalar");
-
-  return retval;
-}
-
-Complex
-octave_sparse_matrix::complex_value (bool) const
-{
-  double tmp = lo_ieee_nan_value ();
-
-  Complex retval (tmp, tmp);
-
-  // FIXME -- maybe this should be a function, valid_as_scalar()
-  if (rows () > 0 && columns () > 0)
-    {
-      if (numel () > 1)
-        gripe_implicit_conversion ("Octave:array-to-scalar",
-                                   "real sparse matrix", "complex scalar");
-
-      retval = matrix (0, 0);
-    }
-  else
-    gripe_invalid_conversion ("real sparse matrix", "complex scalar");
-
-  return retval;
-}
-
-Matrix
-octave_sparse_matrix::matrix_value (bool) const
-{
-  return matrix.matrix_value ();
-}
-
-boolNDArray
-octave_sparse_matrix::bool_array_value (bool warn) const
-{
-  NDArray m = matrix.matrix_value ();
-
-  if (m.any_element_is_nan ())
-    gripe_nan_to_logical_conversion ();
-  else if (warn && m.any_element_not_one_or_zero ())
-    gripe_logical_conversion ();
-
-  return boolNDArray (m);
-}
-
-charNDArray
-octave_sparse_matrix::char_array_value (bool) const
-{
-  charNDArray retval (dims (), 0);
-  octave_idx_type nc = matrix.cols ();
-  octave_idx_type nr = matrix.rows ();
-
-  for (octave_idx_type j = 0; j < nc; j++)
-    for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++)
-      retval(matrix.ridx (i) + nr * j) = static_cast<char>(matrix.data (i));
-
-  return retval;
-}
-
-ComplexMatrix
-octave_sparse_matrix::complex_matrix_value (bool) const
-{
-  return ComplexMatrix (matrix.matrix_value ());
-}
-
-ComplexNDArray
-octave_sparse_matrix::complex_array_value (bool) const
-{
-  return ComplexNDArray (ComplexMatrix (matrix.matrix_value ()));
-}
-
-NDArray
-octave_sparse_matrix::array_value (bool) const
-{
-  return NDArray (matrix.matrix_value ());
-}
-
-SparseBoolMatrix
-octave_sparse_matrix::sparse_bool_matrix_value (bool warn) const
-{
-  if (matrix.any_element_is_nan ())
-    gripe_nan_to_logical_conversion ();
-  else if (warn && matrix.any_element_not_one_or_zero ())
-    gripe_logical_conversion ();
-
-  return mx_el_ne (matrix, 0.0);
-}
-
-octave_value
-octave_sparse_matrix::convert_to_str_internal (bool, bool, char type) const
-{
-  octave_value retval;
-  dim_vector dv = dims ();
-  octave_idx_type nel = dv.numel ();
-
-  if (nel == 0)
-    {
-      char s = '\0';
-      retval = octave_value (&s, type);
-    }
-  else
-    {
-      octave_idx_type nr = matrix.rows ();
-      octave_idx_type nc = matrix.cols ();
-      charNDArray chm (dv, static_cast<char> (0));
-
-      bool warned = false;
-
-      for (octave_idx_type j = 0; j < nc; j++)
-        for (octave_idx_type i = matrix.cidx (j);
-             i < matrix.cidx (j+1); i++)
-          {
-            octave_quit ();
-
-            double d = matrix.data (i);
-
-              if (xisnan (d))
-                {
-                  gripe_nan_to_character_conversion ();
-                  return retval;
-                }
-              else
-                {
-                  int ival = NINT (d);
-
-                  if (ival < 0 || ival > UCHAR_MAX)
-                    {
-                      // FIXME -- is there something
-                      // better we could do?
-
-                      ival = 0;
-
-                      if (! warned)
-                        {
-                          ::warning ("range error for conversion to character value");
-                          warned = true;
-                        }
-                    }
-
-                  chm (matrix.ridx (i) + j * nr) =
-                    static_cast<char> (ival);
-                }
-          }
-
-      retval = octave_value (chm, type);
-    }
-
-  return retval;
-}
-
-bool
-octave_sparse_matrix::save_binary (std::ostream& os, bool&save_as_floats)
-{
-  dim_vector d = this->dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Ensure that additional memory is deallocated
-  matrix.maybe_compress ();
-
-  int nr = d(0);
-  int nc = d(1);
-  int nz = nnz ();
-
-  int32_t itmp;
-  // Use negative value for ndims to be consistent with other formats
-  itmp= -2;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nr;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nc;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  itmp= nz;
-  os.write (reinterpret_cast<char *> (&itmp), 4);
-
-  save_type st = LS_DOUBLE;
-  if (save_as_floats)
-    {
-      if (matrix.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        st = LS_FLOAT;
-    }
-  else if (matrix.nnz () > 8192) // FIXME -- make this configurable.
-    {
-      double max_val, min_val;
-      if (matrix.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
-    }
-
-  // add one to the printed indices to go from
-  // zero-based to one-based arrays
-   for (int i = 0; i < nc+1; i++)
-     {
-       octave_quit ();
-       itmp = matrix.cidx (i);
-       os.write (reinterpret_cast<char *> (&itmp), 4);
-     }
-
-   for (int i = 0; i < nz; i++)
-     {
-       octave_quit ();
-       itmp = matrix.ridx (i);
-       os.write (reinterpret_cast<char *> (&itmp), 4);
-     }
-
-   write_doubles (os, matrix.data (), st, nz);
-
-  return true;
-}
-
-bool
-octave_sparse_matrix::load_binary (std::istream& is, bool swap,
-                                   oct_mach_info::float_format fmt)
-{
-  int32_t nz, nc, nr, tmp;
-  char ctmp;
-
-  if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-    return false;
-
-  if (swap)
-    swap_bytes<4> (&tmp);
-
-  if (tmp != -2) {
-    error ("load: only 2D sparse matrices are supported");
-    return false;
-  }
-
-  if (! is.read (reinterpret_cast<char *> (&nr), 4))
-    return false;
-  if (! is.read (reinterpret_cast<char *> (&nc), 4))
-    return false;
-  if (! is.read (reinterpret_cast<char *> (&nz), 4))
-    return false;
-
-  if (swap)
-    {
-      swap_bytes<4> (&nr);
-      swap_bytes<4> (&nc);
-      swap_bytes<4> (&nz);
-    }
-
-  SparseMatrix m (static_cast<octave_idx_type> (nr),
-                  static_cast<octave_idx_type> (nc),
-                  static_cast<octave_idx_type> (nz));
-
-  for (int i = 0; i < nc+1; i++)
-    {
-      octave_quit ();
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-      m.xcidx (i) = tmp;
-    }
-
-  for (int i = 0; i < nz; i++)
-    {
-      octave_quit ();
-      if (! is.read (reinterpret_cast<char *> (&tmp), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&tmp);
-      m.xridx (i) = tmp;
-    }
-
-  if (! is.read (reinterpret_cast<char *> (&ctmp), 1))
-    return false;
-
-  read_doubles (is, m.xdata (), static_cast<save_type> (ctmp), nz, swap, fmt);
-
-  if (error_state || ! is)
-    return false;
-
-  if (! m.indices_ok ())
-    return false;
-
-  matrix = m;
-
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_sparse_matrix::save_hdf5 (hid_t loc_id, const char *name,
-                                 bool save_as_floats)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  // Ensure that additional memory is deallocated
-  matrix.maybe_compress ();
-
-#if HAVE_HDF5_18
-  hid_t group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  hid_t group_hid = H5Gcreate (loc_id, name, 0);
-#endif
-  if (group_hid < 0)
-    return false;
-
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-  SparseMatrix m = sparse_matrix_value ();
-  octave_idx_type tmp;
-  hsize_t hdims[2];
-
-  space_hid = H5Screate_simple (0, hdims, 0);
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.rows ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                     &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.cols ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                     &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  tmp = m.nnz ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                     &tmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-
-  hdims[0] = m.cols () + 1;
-  hdims[1] = 1;
-
-  space_hid = H5Screate_simple (2, hdims, 0);
-
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  octave_idx_type * itmp = m.xcidx ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                     itmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-
-  hdims[0] = m.nnz ();
-  hdims[1] = 1;
-
-  space_hid = H5Screate_simple (2, hdims, 0);
-
-  if (space_hid < 0)
-    {
-      H5Gclose (group_hid);
-      return false;
-    }
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  itmp = m.xridx ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT,
-                     itmp) >= 0;
-  H5Dclose (data_hid);
-  if (!retval)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
-
-  if (save_as_floats)
-    {
-      if (m.too_large_for_float ())
-        {
-          warning ("save: some values too large to save as floats --");
-          warning ("save: saving as doubles instead");
-        }
-      else
-        save_type_hid = H5T_NATIVE_FLOAT;
-    }
-#if HAVE_HDF5_INT2FLOAT_CONVERSIONS
-  // hdf5 currently doesn't support float/integer conversions
-  else
-    {
-      double max_val, min_val;
-
-      if (m.all_integers (max_val, min_val))
-        save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
-    }
-#endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  double * dtmp = m.xdata ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, dtmp) >= 0;
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-  H5Gclose (group_hid);
-
-  return retval;
-}
-
-bool
-octave_sparse_matrix::load_hdf5 (hid_t loc_id, const char *name)
-{
-  octave_idx_type nr, nc, nz;
-  hid_t group_hid, data_hid, space_hid;
-  hsize_t rank;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-    return (empty > 0);
-
-#if HAVE_HDF5_18
-  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  group_hid = H5Gopen (loc_id, name);
-#endif
-  if (group_hid < 0) return false;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nr", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nr");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, &nr) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nc", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nc");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, &nc) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "nz", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "nz");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, &nz) < 0)
-    {
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Dclose (data_hid);
-
-  SparseMatrix m (static_cast<octave_idx_type> (nr),
-                  static_cast<octave_idx_type> (nc),
-                  static_cast<octave_idx_type> (nz));
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "cidx", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "cidx");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nc + 1
-      || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  octave_idx_type *itmp = m.xcidx ();
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, itmp) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "ridx", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "ridx");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  itmp = m.xridx ();
-  if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, itmp) < 0)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-
-#if HAVE_HDF5_18
-  data_hid = H5Dopen (group_hid, "data", H5P_DEFAULT);
-#else
-  data_hid = H5Dopen (group_hid, "data");
-#endif
-  space_hid = H5Dget_space (data_hid);
-  rank = H5Sget_simple_extent_ndims (space_hid);
-
-  if (rank != 2)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-  if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1)
-    {
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      H5Gclose (group_hid);
-      return false;
-    }
-
-  double *dtmp = m.xdata ();
-  bool retval = false;
-  if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, dtmp) >= 0
-      && m.indices_ok ())
-    {
-      retval = true;
-      matrix = m;
-    }
-
-  H5Sclose (space_hid);
-  H5Dclose (data_hid);
-  H5Gclose (group_hid);
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_sparse_matrix::as_mxArray (void) const
-{
-  mwSize nz = nzmax ();
-  mwSize nr = rows ();
-  mwSize nc = columns ();
-  mxArray *retval = new mxArray (mxDOUBLE_CLASS, nr, nc, nz, mxREAL);
-  double *pr = static_cast<double *> (retval->get_data ());
-  mwIndex *ir = retval->get_ir ();
-  mwIndex *jc = retval->get_jc ();
-
-  for (mwIndex i = 0; i < nz; i++)
-    {
-      pr[i] = matrix.data (i);
-      ir[i] = matrix.ridx (i);
-    }
-
-  for (mwIndex i = 0; i < nc + 1; i++)
-    jc[i] = matrix.cidx (i);
-
-  return retval;
-}
-
-octave_value
-octave_sparse_matrix::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_imag:
-      return SparseMatrix (matrix.rows (), matrix.cols (), 0.0);
-
-    case umap_real:
-    case umap_conj:
-      return matrix;
-
-    // Mappers handled specially.
-#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.FCN ())
-
-      ARRAY_METHOD_MAPPER (abs, abs);
-
-#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (matrix.map<TYPE> (FCN))
-
-      ARRAY_MAPPER (acos, Complex, rc_acos);
-      ARRAY_MAPPER (acosh, Complex, rc_acosh);
-      ARRAY_MAPPER (angle, double, ::arg);
-      ARRAY_MAPPER (arg, double, ::arg);
-      ARRAY_MAPPER (asin, Complex, rc_asin);
-      ARRAY_MAPPER (asinh, double, ::asinh);
-      ARRAY_MAPPER (atan, double, ::atan);
-      ARRAY_MAPPER (atanh, Complex, rc_atanh);
-      ARRAY_MAPPER (erf, double, ::erf);
-      ARRAY_MAPPER (erfinv, double, ::erfinv);
-      ARRAY_MAPPER (erfcinv, double, ::erfcinv);
-      ARRAY_MAPPER (erfc, double, ::erfc);
-      ARRAY_MAPPER (gamma, double, xgamma);
-      ARRAY_MAPPER (lgamma, Complex, rc_lgamma);
-      ARRAY_MAPPER (cbrt, double, ::cbrt);
-      ARRAY_MAPPER (ceil, double, ::ceil);
-      ARRAY_MAPPER (cos, double, ::cos);
-      ARRAY_MAPPER (cosh, double, ::cosh);
-      ARRAY_MAPPER (exp, double, ::exp);
-      ARRAY_MAPPER (expm1, double, ::expm1);
-      ARRAY_MAPPER (fix, double, ::fix);
-      ARRAY_MAPPER (floor, double, ::floor);
-      ARRAY_MAPPER (log, Complex, rc_log);
-      ARRAY_MAPPER (log2, Complex, rc_log2);
-      ARRAY_MAPPER (log10, Complex, rc_log10);
-      ARRAY_MAPPER (log1p, Complex, rc_log1p);
-      ARRAY_MAPPER (round, double, xround);
-      ARRAY_MAPPER (roundb, double, xroundb);
-      ARRAY_MAPPER (signum, double, ::signum);
-      ARRAY_MAPPER (sin, double, ::sin);
-      ARRAY_MAPPER (sinh, double, ::sinh);
-      ARRAY_MAPPER (sqrt, Complex, rc_sqrt);
-      ARRAY_MAPPER (tan, double, ::tan);
-      ARRAY_MAPPER (tanh, double, ::tanh);
-      ARRAY_MAPPER (isnan, bool, xisnan);
-      ARRAY_MAPPER (isna, bool, octave_is_NA);
-      ARRAY_MAPPER (isinf, bool, xisinf);
-      ARRAY_MAPPER (finite, bool, xfinite);
-
-    default: // Attempt to go via dense matrix.
-      return octave_base_sparse<SparseMatrix>::map (umap);
-    }
-}
--- a/src/ov-re-sparse.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 David Bateman
-Copyright (C) 1998-2004 Andy Adler
-
-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_sparse_matrix_h)
-#define octave_sparse_matrix_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-#include "dSparse.h"
-#include "MatrixType.h"
-#include "ov-base-sparse.h"
-#include "ov-cx-sparse.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-class
-OCTINTERP_API
-octave_sparse_matrix : public octave_base_sparse<SparseMatrix>
-{
-public:
-
-  octave_sparse_matrix (void)
-    : octave_base_sparse<SparseMatrix> () { }
-
-  octave_sparse_matrix (const Matrix& m)
-    : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { }
-
-  octave_sparse_matrix (const NDArray& m)
-    : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { }
-
-  octave_sparse_matrix (const SparseMatrix& m)
-    : octave_base_sparse<SparseMatrix> (m) { }
-
-  octave_sparse_matrix (const SparseMatrix& m, const MatrixType& t)
-    : octave_base_sparse<SparseMatrix> (m, t) { }
-
-  octave_sparse_matrix (const MSparse<double>& m)
-    : octave_base_sparse<SparseMatrix> (m) { }
-
-  octave_sparse_matrix (const MSparse<double>& m, const MatrixType& t)
-    : octave_base_sparse<SparseMatrix> (m, t) { }
-
-  octave_sparse_matrix (const Sparse<double>& m)
-    : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { }
-
-  octave_sparse_matrix (const Sparse<double>& m, const MatrixType& t)
-    : octave_base_sparse<SparseMatrix> (SparseMatrix (m), t) { }
-
-  octave_sparse_matrix (const octave_sparse_matrix& m)
-    : octave_base_sparse<SparseMatrix> (m) { }
-
-  ~octave_sparse_matrix (void) { }
-
-  octave_base_value *clone (void) const { return new octave_sparse_matrix (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_sparse_matrix (); }
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  idx_vector index_vector (void) const;
-
-  builtin_type_t builtin_type (void) const { return btyp_double; }
-
-  bool is_real_matrix (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  double double_value (bool = false) const;
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return double_value (frc_str_conv); }
-
-  Matrix matrix_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  boolNDArray bool_array_value (bool warn = false) const;
-
-  charNDArray char_array_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  NDArray array_value (bool = false) const;
-
-  SparseMatrix sparse_matrix_value (bool = false) const
-    { return matrix; }
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-    { return SparseComplexMatrix (matrix); }
-
-  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-#if 0
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
-#endif
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-private:
-  octave_value map (double (*fcn) (double)) const;
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-scalar.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "data-conv.h"
-#include "mach-info.h"
-#include "lo-specfun.h"
-#include "lo-mappers.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-stream.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-base.h"
-#include "ov-base-scalar.h"
-#include "ov-base-scalar.cc"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-#include "pr-output.h"
-#include "xdiv.h"
-#include "xpow.h"
-#include "ops.h"
-
-#include "ls-oct-ascii.h"
-#include "ls-hdf5.h"
-
-template class octave_base_scalar<double>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_scalar, "scalar", "double");
-
-static octave_base_value *
-default_numeric_demotion_function (const octave_base_value& a)
-{
-  CAST_CONV_ARG (const octave_scalar&);
-
-  return new octave_float_scalar (v.float_value ());
-}
-
-octave_base_value::type_conv_info
-octave_scalar::numeric_demotion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_demotion_function,
-                                            octave_float_scalar::static_type_id ());
-}
-
-octave_value
-octave_scalar::do_index_op (const octave_value_list& idx, bool resize_ok)
-{
-  // FIXME -- this doesn't solve the problem of
-  //
-  //   a = 1; a([1,1], [1,1], [1,1])
-  //
-  // and similar constructions.  Hmm...
-
-  // FIXME -- using this constructor avoids narrowing the
-  // 1x1 matrix back to a scalar value.  Need a better solution
-  // to this problem.
-
-  octave_value tmp (new octave_matrix (matrix_value ()));
-
-  return tmp.do_index_op (idx, resize_ok);
-}
-
-octave_value
-octave_scalar::resize (const dim_vector& dv, bool fill) const
-{
-  if (fill)
-    {
-      NDArray retval (dv, 0);
-
-      if (dv.numel ())
-        retval(0) = scalar;
-
-      return retval;
-    }
-  else
-    {
-      NDArray retval (dv);
-
-      if (dv.numel ())
-        retval(0) = scalar;
-
-      return retval;
-    }
-}
-
-octave_value
-octave_scalar::diag (octave_idx_type m, octave_idx_type n) const
-{
-  return DiagMatrix (Array<double> (dim_vector (1, 1), scalar), m, n);
-}
-
-octave_value
-octave_scalar::convert_to_str_internal (bool, bool, char type) const
-{
-  octave_value retval;
-
-  if (xisnan (scalar))
-    gripe_nan_to_character_conversion ();
-  else
-    {
-      int ival = NINT (scalar);
-
-      if (ival < 0 || ival > UCHAR_MAX)
-        {
-          // FIXME -- is there something better we could do?
-
-          ival = 0;
-
-          ::warning ("range error for conversion to character value");
-        }
-
-      retval = octave_value (std::string (1, static_cast<char> (ival)), type);
-    }
-
-  return retval;
-}
-
-bool
-octave_scalar::save_ascii (std::ostream& os)
-{
-  double d = double_value ();
-
-  octave_write_double (os, d);
-
-  os << "\n";
-
-  return true;
-}
-
-bool
-octave_scalar::load_ascii (std::istream& is)
-{
-  scalar = octave_read_value<double> (is);
-  if (!is)
-    {
-      error ("load: failed to load scalar constant");
-      return false;
-    }
-
-  return true;
-}
-
-bool
-octave_scalar::save_binary (std::ostream& os, bool& /* save_as_floats */)
-{
-  char tmp = LS_DOUBLE;
-  os.write (reinterpret_cast<char *> (&tmp), 1);
-  double dtmp = double_value ();
-  os.write (reinterpret_cast<char *> (&dtmp), 8);
-
-  return true;
-}
-
-bool
-octave_scalar::load_binary (std::istream& is, bool swap,
-                            oct_mach_info::float_format fmt)
-{
-  char tmp;
-  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
-    return false;
-
-  double dtmp;
-  read_doubles (is, &dtmp, static_cast<save_type> (tmp), 1, swap, fmt);
-  if (error_state || ! is)
-    return false;
-
-  scalar = dtmp;
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_scalar::save_hdf5 (hid_t loc_id, const char *name,
-                          bool /* save_as_floats */)
-{
-  hsize_t dimens[3];
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-
-  space_hid = H5Screate_simple (0, dimens, 0);
-  if (space_hid < 0) return false;
-
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  double tmp = double_value ();
-  retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, &tmp) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_scalar::load_hdf5 (hid_t loc_id, const char *name)
-{
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_id = H5Dget_space (data_hid);
-
-  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
-
-  if (rank != 0)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  double dtmp;
-  if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
-               H5P_DEFAULT, &dtmp) < 0)
-    {
-      H5Dclose (data_hid);
-      return false;
-    }
-
-  scalar = dtmp;
-
-  H5Dclose (data_hid);
-
-  return true;
-}
-
-#endif
-
-mxArray *
-octave_scalar::as_mxArray (void) const
-{
-  mxArray *retval = new mxArray (mxDOUBLE_CLASS, 1, 1, mxREAL);
-
-  double *pr = static_cast<double *> (retval->get_data ());
-
-  pr[0] = scalar;
-
-  return retval;
-}
-
-octave_value
-octave_scalar::map (unary_mapper_t umap) const
-{
-  switch (umap)
-    {
-    case umap_imag:
-      return 0.0;
-
-    case umap_real:
-    case umap_conj:
-      return scalar;
-
-#define SCALAR_MAPPER(UMAP, FCN) \
-    case umap_ ## UMAP: \
-      return octave_value (FCN (scalar))
-
-      SCALAR_MAPPER (abs, ::fabs);
-      SCALAR_MAPPER (acos, rc_acos);
-      SCALAR_MAPPER (acosh, rc_acosh);
-      SCALAR_MAPPER (angle, ::arg);
-      SCALAR_MAPPER (arg, ::arg);
-      SCALAR_MAPPER (asin, rc_asin);
-      SCALAR_MAPPER (asinh, ::asinh);
-      SCALAR_MAPPER (atan, ::atan);
-      SCALAR_MAPPER (atanh, rc_atanh);
-      SCALAR_MAPPER (erf, ::erf);
-      SCALAR_MAPPER (erfinv, ::erfinv);
-      SCALAR_MAPPER (erfcinv, ::erfcinv);
-      SCALAR_MAPPER (erfc, ::erfc);
-      SCALAR_MAPPER (erfcx, ::erfcx);
-      SCALAR_MAPPER (gamma, xgamma);
-      SCALAR_MAPPER (lgamma, rc_lgamma);
-      SCALAR_MAPPER (cbrt, ::cbrt);
-      SCALAR_MAPPER (ceil, ::ceil);
-      SCALAR_MAPPER (cos, ::cos);
-      SCALAR_MAPPER (cosh, ::cosh);
-      SCALAR_MAPPER (exp, ::exp);
-      SCALAR_MAPPER (expm1, ::expm1);
-      SCALAR_MAPPER (fix, ::fix);
-      SCALAR_MAPPER (floor, gnulib::floor);
-      SCALAR_MAPPER (log, rc_log);
-      SCALAR_MAPPER (log2, rc_log2);
-      SCALAR_MAPPER (log10, rc_log10);
-      SCALAR_MAPPER (log1p, rc_log1p);
-      SCALAR_MAPPER (round, xround);
-      SCALAR_MAPPER (roundb, xroundb);
-      SCALAR_MAPPER (signum, ::signum);
-      SCALAR_MAPPER (sin, ::sin);
-      SCALAR_MAPPER (sinh, ::sinh);
-      SCALAR_MAPPER (sqrt, rc_sqrt);
-      SCALAR_MAPPER (tan, ::tan);
-      SCALAR_MAPPER (tanh, ::tanh);
-      SCALAR_MAPPER (finite, xfinite);
-      SCALAR_MAPPER (isinf, xisinf);
-      SCALAR_MAPPER (isna, octave_is_NA);
-      SCALAR_MAPPER (isnan, xisnan);
-
-    default:
-      if (umap >= umap_xisalnum && umap <= umap_xtoupper)
-        {
-          octave_value str_conv = convert_to_str (true, true);
-          return error_state ? octave_value () : str_conv.map (umap);
-        }
-      else
-        return octave_base_value::map (umap);
-    }
-}
-
-bool
-octave_scalar::fast_elem_insert_self (void *where, builtin_type_t btyp) const
-{
-
-  // Support inline real->complex conversion.
-  if (btyp == btyp_double)
-    {
-      *(reinterpret_cast<double *>(where)) = scalar;
-      return true;
-    }
-  else if (btyp == btyp_complex)
-    {
-      *(reinterpret_cast<Complex *>(where)) = scalar;
-      return true;
-    }
-  else
-    return false;
-}
--- a/src/ov-scalar.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_scalar_h)
-#define octave_scalar_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "lo-ieee.h"
-#include "lo-mappers.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "str-vec.h"
-
-#include "gripes.h"
-#include "ov-base.h"
-#include "ov-re-mat.h"
-#include "ov-base-scalar.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Real scalar values.
-
-class
-OCTINTERP_API
-octave_scalar : public octave_base_scalar<double>
-{
-public:
-
-  octave_scalar (void)
-    : octave_base_scalar<double> (0.0) { }
-
-  octave_scalar (double d)
-    : octave_base_scalar<double> (d) { }
-
-  octave_scalar (const octave_scalar& s)
-    : octave_base_scalar<double> (s) { }
-
-  ~octave_scalar (void) { }
-
-  octave_base_value *clone (void) const { return new octave_scalar (*this); }
-
-  // We return an octave_matrix here instead of an octave_scalar so
-  // that in expressions like A(2,2,2) = 2 (for A previously
-  // undefined), A will be empty instead of a 1x1 object.
-  octave_base_value *empty_clone (void) const { return new octave_matrix (); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  type_conv_info numeric_demotion_function (void) const;
-
-  idx_vector index_vector (void) const { return idx_vector (scalar); }
-
-  octave_value any (int = 0) const
-    { return (scalar != 0 && ! lo_ieee_isnan (scalar)); }
-
-  builtin_type_t builtin_type (void) const { return btyp_double; }
-
-  bool is_real_scalar (void) const { return true; }
-
-  bool is_real_type (void) const { return true; }
-
-  bool is_double_type (void) const { return true; }
-
-  bool is_float_type (void) const { return true; }
-
-  int8NDArray
-  int8_array_value (void) const
-    { return int8NDArray (dim_vector (1, 1), scalar); }
-
-  int16NDArray
-  int16_array_value (void) const
-    { return int16NDArray (dim_vector (1, 1), scalar); }
-
-  int32NDArray
-  int32_array_value (void) const
-    { return int32NDArray (dim_vector (1, 1), scalar); }
-
-  int64NDArray
-  int64_array_value (void) const
-    { return int64NDArray (dim_vector (1, 1), scalar); }
-
-  uint8NDArray
-  uint8_array_value (void) const
-    { return uint8NDArray (dim_vector (1, 1), scalar); }
-
-  uint16NDArray
-  uint16_array_value (void) const
-    { return uint16NDArray (dim_vector (1, 1), scalar); }
-
-  uint32NDArray
-  uint32_array_value (void) const
-    { return uint32NDArray (dim_vector (1, 1), scalar); }
-
-  uint64NDArray
-  uint64_array_value (void) const
-    { return uint64NDArray (dim_vector (1, 1), scalar); }
-
-#define DEFINE_INT_SCALAR_VALUE(TYPE) \
-  octave_ ## TYPE \
-  TYPE ## _scalar_value (void) const \
-    { return octave_ ## TYPE (scalar); }
-
-  DEFINE_INT_SCALAR_VALUE (int8)
-  DEFINE_INT_SCALAR_VALUE (int16)
-  DEFINE_INT_SCALAR_VALUE (int32)
-  DEFINE_INT_SCALAR_VALUE (int64)
-  DEFINE_INT_SCALAR_VALUE (uint8)
-  DEFINE_INT_SCALAR_VALUE (uint16)
-  DEFINE_INT_SCALAR_VALUE (uint32)
-  DEFINE_INT_SCALAR_VALUE (uint64)
-
-#undef DEFINE_INT_SCALAR_VALUE
-
-  double double_value (bool = false) const { return scalar; }
-
-  float float_value (bool = false) const { return static_cast<float> (scalar); }
-
-  double scalar_value (bool = false) const { return scalar; }
-
-  float float_scalar_value (bool = false) const { return static_cast<float> (scalar); }
-
-  Matrix matrix_value (bool = false) const
-    { return Matrix (1, 1, scalar); }
-
-  FloatMatrix float_matrix_value (bool = false) const
-    { return FloatMatrix (1, 1, scalar); }
-
-  NDArray array_value (bool = false) const
-    { return NDArray (dim_vector (1, 1), scalar); }
-
-  FloatNDArray float_array_value (bool = false) const
-    { return FloatNDArray (dim_vector (1, 1), scalar); }
-
-  SparseMatrix sparse_matrix_value (bool = false) const
-    { return SparseMatrix (Matrix (1, 1, scalar)); }
-
-  // FIXME Need SparseComplexMatrix (Matrix) constructor!!!
-  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
-    { return SparseComplexMatrix (sparse_matrix_value ()); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-  Complex complex_value (bool = false) const { return scalar; }
-
-  FloatComplex float_complex_value (bool = false) const { return scalar; }
-
-  ComplexMatrix complex_matrix_value (bool = false) const
-    { return  ComplexMatrix (1, 1, Complex (scalar)); }
-
-  FloatComplexMatrix float_complex_matrix_value (bool = false) const
-    { return  FloatComplexMatrix (1, 1, FloatComplex (scalar)); }
-
-  ComplexNDArray complex_array_value (bool = false) const
-    { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); }
-
-  FloatComplexNDArray float_complex_array_value (bool = false) const
-    { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); }
-
-  charNDArray
-  char_array_value (bool = false) const
-  {
-    charNDArray retval (dim_vector (1, 1));
-    retval(0) = static_cast<char> (scalar);
-    return retval;
-  }
-
-  bool bool_value (bool warn = false) const
-  {
-    if (xisnan (scalar))
-      gripe_nan_to_logical_conversion ();
-    else if (warn && scalar != 0 && scalar != 1)
-      gripe_logical_conversion ();
-
-    return scalar;
-  }
-
-  boolNDArray bool_array_value (bool warn = false) const
-  {
-    if (xisnan (scalar))
-      gripe_nan_to_logical_conversion ();
-    else if (warn && scalar != 0 && scalar != 1)
-      gripe_logical_conversion ();
-
-    return boolNDArray (dim_vector (1, 1), scalar);
-  }
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const;
-
-  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
-
-  void increment (void) { ++scalar; }
-
-  void decrement (void) { --scalar; }
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    {
-      return os.write (array_value (), block_size, output_type,
-                       skip, flt_fmt);
-    }
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value map (unary_mapper_t umap) const;
-
-  bool fast_elem_insert_self (void *where, builtin_type_t btyp) const;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-str-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,777 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <cctype>
-
-#include <iostream>
-#include <vector>
-
-#include "data-conv.h"
-#include "lo-ieee.h"
-#include "mach-info.h"
-#include "mx-base.h"
-#include "oct-locbuf.h"
-
-#include "byte-swap.h"
-#include "defun.h"
-#include "gripes.h"
-#include "ls-ascii-helper.h"
-#include "ls-hdf5.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "oct-obj.h"
-#include "oct-stream.h"
-#include "ops.h"
-#include "ov-scalar.h"
-#include "ov-re-mat.h"
-#include "ov-str-mat.h"
-#include "pr-output.h"
-#include "pt-mat.h"
-#include "utils.h"
-
-DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix_str);
-DEFINE_OCTAVE_ALLOCATOR (octave_char_matrix_sq_str);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_str, "string", "char");
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_sq_str, "sq_string", "char");
-
-static octave_base_value *
-default_numeric_conversion_function (const octave_base_value& a)
-{
-  octave_base_value *retval = 0;
-
-  CAST_CONV_ARG (const octave_char_matrix_str&);
-
-  NDArray nda = v.array_value (true);
-
-  if (! error_state)
-    {
-      if (nda.numel () == 1)
-        retval = new octave_scalar (nda(0));
-      else
-        retval = new octave_matrix (nda);
-    }
-
-  return retval;
-}
-
-octave_base_value::type_conv_info
-octave_char_matrix_str::numeric_conversion_function (void) const
-{
-  return octave_base_value::type_conv_info (default_numeric_conversion_function,
-                                            octave_matrix::static_type_id ());
-}
-
-octave_value
-octave_char_matrix_str::do_index_op_internal (const octave_value_list& idx,
-                                              bool resize_ok, char type)
-{
-  octave_value retval;
-
-  octave_idx_type len = idx.length ();
-
-  switch (len)
-    {
-    case 0:
-      retval = octave_value (matrix, type);
-      break;
-
-    case 1:
-      {
-        idx_vector i = idx (0).index_vector ();
-
-        if (! error_state)
-          retval = octave_value (charNDArray (matrix.index (i, resize_ok)),
-                                 type);
-      }
-      break;
-
-    case 2:
-      {
-        idx_vector i = idx (0).index_vector ();
-        idx_vector j = idx (1).index_vector ();
-
-        if (! error_state)
-          retval = octave_value (charNDArray (matrix.index (i, j, resize_ok)),
-                                 type);
-      }
-      break;
-
-    default:
-      {
-        Array<idx_vector> idx_vec (dim_vector (len, 1));
-
-        for (octave_idx_type i = 0; i < len; i++)
-          idx_vec(i) = idx(i).index_vector ();
-
-        if (! error_state)
-          retval = octave_value (charNDArray (matrix.index (idx_vec, resize_ok)),
-                                 type);
-      }
-      break;
-    }
-
-  return retval;
-}
-
-octave_value
-octave_char_matrix_str::resize (const dim_vector& dv, bool fill) const
-{
-  charNDArray retval (matrix);
-  if (fill)
-    retval.resize (dv, 0);
-  else
-    retval.resize (dv);
-  return octave_value (retval, is_sq_string () ? '\'' : '"');
-}
-
-#define CHAR_MATRIX_CONV(T, INIT, TNAME, FCN) \
-  T retval INIT; \
- \
-  if (! force_string_conv) \
-    gripe_invalid_conversion ("string", TNAME); \
-  else \
-    { \
-      warning_with_id ("Octave:str-to-num", \
-                       "implicit conversion from %s to %s", \
-                       "string", TNAME); \
- \
-      retval = octave_char_matrix::FCN (); \
-    } \
- \
-  return retval
-
-double
-octave_char_matrix_str::double_value (bool force_string_conv) const
-{
-  CHAR_MATRIX_CONV (double, = 0, "real scalar", double_value);
-}
-
-Complex
-octave_char_matrix_str::complex_value (bool force_string_conv) const
-{
-  CHAR_MATRIX_CONV (Complex, = 0, "complex scalar", complex_value);
-}
-
-Matrix
-octave_char_matrix_str::matrix_value (bool force_string_conv) const
-{
-  CHAR_MATRIX_CONV (Matrix, , "real matrix", matrix_value);
-}
-
-ComplexMatrix
-octave_char_matrix_str::complex_matrix_value (bool force_string_conv) const
-{
-  CHAR_MATRIX_CONV (ComplexMatrix, , "complex matrix", complex_matrix_value);
-}
-
-NDArray
-octave_char_matrix_str::array_value (bool force_string_conv) const
-{
-  CHAR_MATRIX_CONV (NDArray, , "real N-d array", array_value);
-}
-
-ComplexNDArray
-octave_char_matrix_str::complex_array_value (bool force_string_conv) const
-{
-  CHAR_MATRIX_CONV (ComplexNDArray, , "complex N-d array",
-                    complex_array_value);
-}
-
-string_vector
-octave_char_matrix_str::all_strings (bool) const
-{
-  string_vector retval;
-
-  if (matrix.ndims () == 2)
-    {
-      charMatrix chm = matrix.matrix_value ();
-
-      octave_idx_type n = chm.rows ();
-
-      retval.resize (n);
-
-      for (octave_idx_type i = 0; i < n; i++)
-        retval[i] = chm.row_as_string (i);
-    }
-  else
-    error ("invalid conversion of charNDArray to string_vector");
-
-  return retval;
-}
-
-std::string
-octave_char_matrix_str::string_value (bool) const
-{
-  std::string retval;
-
-  if (matrix.ndims () == 2)
-    {
-      charMatrix chm = matrix.matrix_value ();
-
-      retval = chm.row_as_string (0);  // FIXME???
-    }
-  else
-    error ("invalid conversion of charNDArray to string");
-
-  return retval;
-}
-
-Array<std::string>
-octave_char_matrix_str::cellstr_value (void) const
-{
-  Array<std::string> retval;
-
-  if (matrix.ndims () == 2)
-    {
-      const charMatrix chm = matrix.matrix_value ();
-      octave_idx_type nr = chm.rows ();
-      retval.clear (nr, 1);
-      for (octave_idx_type i = 0; i < nr; i++)
-        retval.xelem (i) = chm.row_as_string (i);
-    }
-  else
-    error ("cellstr: cannot convert multidimensional arrays");
-
-  return retval;
-}
-
-void
-octave_char_matrix_str::print_raw (std::ostream& os, bool pr_as_read_syntax) const
-{
-  octave_print_internal (os, matrix, pr_as_read_syntax,
-                         current_print_indent_level (), true);
-}
-
-bool
-octave_char_matrix_str::save_ascii (std::ostream& os)
-{
-  dim_vector d = dims ();
-  if (d.length () > 2)
-    {
-      charNDArray tmp = char_array_value ();
-      os << "# ndims: " << d.length () << "\n";
-      for (int i=0; i < d.length (); i++)
-        os << " " << d (i);
-      os << "\n";
-      os.write (tmp.fortran_vec (), d.numel ());
-      os << "\n";
-    }
-  else
-    {
-      // Keep this case, rather than use generic code above for
-      // backward compatiability. Makes load_ascii much more complex!!
-      charMatrix chm = char_matrix_value ();
-      octave_idx_type elements = chm.rows ();
-      os << "# elements: " << elements << "\n";
-      for (octave_idx_type i = 0; i < elements; i++)
-        {
-          unsigned len = chm.cols ();
-          os << "# length: " << len << "\n";
-          std::string tstr = chm.row_as_string (i);
-          const char *tmp = tstr.data ();
-          if (tstr.length () > len)
-            panic_impossible ();
-          os.write (tmp, len);
-          os << "\n";
-        }
-    }
-
-  return true;
-}
-
-bool
-octave_char_matrix_str::load_ascii (std::istream& is)
-{
-  bool success = true;
-
-  string_vector keywords(3);
-
-  keywords[0] = "ndims";
-  keywords[1] = "elements";
-  keywords[2] = "length";
-
-  std::string kw;
-  int val = 0;
-
-  if (extract_keyword (is, keywords, kw, val, true))
-    {
-      if (kw == "ndims")
-        {
-          int mdims = val;
-
-          if (mdims >= 0)
-            {
-              dim_vector dv;
-              dv.resize (mdims);
-
-              for (int i = 0; i < mdims; i++)
-                is >> dv(i);
-
-              if (is)
-                {
-                  charNDArray tmp(dv);
-
-                  if (tmp.is_empty ())
-                    matrix = tmp;
-                  else
-                    {
-                      char *ftmp = tmp.fortran_vec ();
-
-                      skip_preceeding_newline (is);
-
-                      if (! is.read (ftmp, dv.numel ()) || !is)
-                        {
-                          error ("load: failed to load string constant");
-                          success = false;
-                        }
-                      else
-                        matrix = tmp;
-                    }
-                }
-              else
-                {
-                  error ("load: failed to read dimensions");
-                  success = false;
-                }
-            }
-          else
-            {
-              error ("load: failed to extract matrix size");
-              success = false;
-            }
-        }
-      else if (kw == "elements")
-        {
-          int elements = val;
-
-          if (elements >= 0)
-            {
-              // FIXME -- need to be able to get max length
-              // before doing anything.
-
-              charMatrix chm (elements, 0);
-              int max_len = 0;
-              for (int i = 0; i < elements; i++)
-                {
-                  int len;
-                  if (extract_keyword (is, "length", len) && len >= 0)
-                    {
-                      // Use this instead of a C-style character
-                      // buffer so that we can properly handle
-                      // embedded NUL characters.
-                      charMatrix tmp (1, len);
-                      char *ptmp = tmp.fortran_vec ();
-
-                      if (len > 0 && ! is.read (ptmp, len))
-                        {
-                          error ("load: failed to load string constant");
-                          success = false;
-                          break;
-                        }
-                      else
-                        {
-                          if (len > max_len)
-                            {
-                              max_len = len;
-                              chm.resize (elements, max_len, 0);
-                            }
-
-                          chm.insert (tmp, i, 0);
-                        }
-                    }
-                  else
-                    {
-                      error ("load: failed to extract string length for element %d",
-                             i+1);
-                      success = false;
-                    }
-                }
-
-              if (! error_state)
-                matrix = chm;
-            }
-          else
-            {
-              error ("load: failed to extract number of string elements");
-              success = false;
-            }
-        }
-      else if (kw == "length")
-        {
-          int len = val;
-
-          if (len >= 0)
-            {
-              // This is cruft for backward compatiability,
-              // but relatively harmless.
-
-              // Use this instead of a C-style character buffer so
-              // that we can properly handle embedded NUL characters.
-              charMatrix tmp (1, len);
-              char *ptmp = tmp.fortran_vec ();
-
-              if (len > 0 && ! is.read (ptmp, len))
-                {
-                  error ("load: failed to load string constant");
-                }
-              else
-                {
-                  if (is)
-                    matrix = tmp;
-                  else
-                    error ("load: failed to load string constant");
-                }
-            }
-        }
-      else
-        panic_impossible ();
-    }
-  else
-    {
-      error ("load: failed to extract number of rows and columns");
-      success = false;
-    }
-
-  return success;
-}
-
-bool
-octave_char_matrix_str::save_binary (std::ostream& os,
-                                     bool& /* save_as_floats */)
-{
-  dim_vector d = dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims to differentiate with old format!!
-  int32_t tmp = - d.length ();
-  os.write (reinterpret_cast<char *> (&tmp), 4);
-  for (int i=0; i < d.length (); i++)
-    {
-      tmp = d(i);
-      os.write (reinterpret_cast<char *> (&tmp), 4);
-    }
-
-  charNDArray m = char_array_value ();
-  os.write (m.fortran_vec (), d.numel ());
-  return true;
-}
-
-bool
-octave_char_matrix_str::load_binary (std::istream& is, bool swap,
-                                     oct_mach_info::float_format /* fmt */)
-{
-  int32_t elements;
-  if (! is.read (reinterpret_cast<char *> (&elements), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&elements);
-
-  if (elements < 0)
-    {
-      int32_t mdims = - elements;
-      int32_t di;
-      dim_vector dv;
-      dv.resize (mdims);
-
-      for (int i = 0; i < mdims; i++)
-        {
-          if (! is.read (reinterpret_cast<char *> (&di), 4))
-            return false;
-          if (swap)
-            swap_bytes<4> (&di);
-          dv(i) = di;
-        }
-
-      // Convert an array with a single dimension to be a row vector.
-      // Octave should never write files like this, other software
-      // might.
-
-      if (mdims == 1)
-        {
-          mdims = 2;
-          dv.resize (mdims);
-          dv(1) = dv(0);
-          dv(0) = 1;
-        }
-
-      charNDArray m(dv);
-      char *tmp = m.fortran_vec ();
-      is.read (tmp, dv.numel ());
-
-      if (error_state || ! is)
-        return false;
-      matrix = m;
-    }
-  else
-    {
-      charMatrix chm (elements, 0);
-      int max_len = 0;
-      for (int i = 0; i < elements; i++)
-        {
-          int32_t len;
-          if (! is.read (reinterpret_cast<char *> (&len), 4))
-            return false;
-          if (swap)
-            swap_bytes<4> (&len);
-          charMatrix btmp (1, len);
-          char *pbtmp = btmp.fortran_vec ();
-          if (! is.read (pbtmp, len))
-            return false;
-          if (len > max_len)
-            {
-              max_len = len;
-              chm.resize (elements, max_len, 0);
-            }
-          chm.insert (btmp, i, 0);
-        }
-      matrix = chm;
-    }
-  return true;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_char_matrix_str::save_hdf5 (hid_t loc_id, const char *name,
-                                   bool /* save_as_floats */)
-{
-  dim_vector dv = dims ();
-  int empty = save_hdf5_empty (loc_id, name, dv);
-  if (empty)
-    return (empty > 0);
-
-  int rank = dv.length ();
-  hid_t space_hid = -1, data_hid = -1;
-  bool retval = true;
-  charNDArray m = char_array_value ();
-
-  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-
-  // Octave uses column-major, while HDF5 uses row-major ordering
-  for (int i = 0; i < rank; i++)
-    hdims[i] = dv (rank-i-1);
-
-  space_hid = H5Screate_simple (rank, hdims, 0);
-  if (space_hid < 0)
-    return false;
-#if HAVE_HDF5_18
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
-                        H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
-                        H5P_DEFAULT);
-#endif
-  if (data_hid < 0)
-    {
-      H5Sclose (space_hid);
-      return false;
-    }
-
-  OCTAVE_LOCAL_BUFFER (char, s, dv.numel ());
-
-  for (int i = 0; i < dv.numel (); ++i)
-    s[i] = m(i);
-
-  retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
-                     H5P_DEFAULT, s) >= 0;
-
-  H5Dclose (data_hid);
-  H5Sclose (space_hid);
-
-  return retval;
-}
-
-bool
-octave_char_matrix_str::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  dim_vector dv;
-  int empty = load_hdf5_empty (loc_id, name, dv);
-  if (empty > 0)
-    matrix.resize (dv);
-  if (empty)
-    return (empty > 0);
-
-#if HAVE_HDF5_18
-  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t data_hid = H5Dopen (loc_id, name);
-#endif
-  hid_t space_hid = H5Dget_space (data_hid);
-  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
-  hid_t type_hid = H5Dget_type (data_hid);
-  hid_t type_class_hid = H5Tget_class (type_hid);
-
-  if (type_class_hid == H5T_INTEGER)
-    {
-      if (rank < 1)
-        {
-          H5Tclose (type_hid);
-          H5Sclose (space_hid);
-          H5Dclose (data_hid);
-          return false;
-        }
-
-      OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
-      OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
-
-      H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
-
-      // Octave uses column-major, while HDF5 uses row-major ordering
-      if (rank == 1)
-        {
-          dv.resize (2);
-          dv(0) = 1;
-          dv(1) = hdims[0];
-        }
-      else
-        {
-          dv.resize (rank);
-          for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
-            dv(j) = hdims[i];
-        }
-
-      charNDArray m (dv);
-      char *str = m.fortran_vec ();
-      if (H5Dread (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
-                   H5P_DEFAULT, str) >= 0)
-        {
-          retval = true;
-          matrix = m;
-        }
-
-      H5Tclose (type_hid);
-      H5Sclose (space_hid);
-      H5Dclose (data_hid);
-      return true;
-    }
-  else
-    {
-      // This is cruft for backward compatiability and easy data
-      // importation
-      if (rank == 0)
-        {
-          // a single string:
-          int slen = H5Tget_size (type_hid);
-          if (slen < 0)
-            {
-              H5Tclose (type_hid);
-              H5Sclose (space_hid);
-              H5Dclose (data_hid);
-              return false;
-            }
-          else
-            {
-              OCTAVE_LOCAL_BUFFER (char, s, slen);
-              // create datatype for (null-terminated) string
-              // to read into:
-              hid_t st_id = H5Tcopy (H5T_C_S1);
-              H5Tset_size (st_id, slen);
-              if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, s) < 0)
-                {
-                  H5Tclose (st_id);
-                  H5Tclose (type_hid);
-                  H5Sclose (space_hid);
-                  H5Dclose (data_hid);
-                  return false;
-                }
-
-              matrix = charMatrix (s);
-
-              H5Tclose (st_id);
-              H5Tclose (type_hid);
-              H5Sclose (space_hid);
-              H5Dclose (data_hid);
-              return true;
-            }
-        }
-      else if (rank == 1)
-        {
-          // string vector
-          hsize_t elements, maxdim;
-          H5Sget_simple_extent_dims (space_hid, &elements, &maxdim);
-          int slen = H5Tget_size (type_hid);
-          if (slen < 0)
-            {
-              H5Tclose (type_hid);
-              H5Sclose (space_hid);
-              H5Dclose (data_hid);
-              return false;
-            }
-          else
-            {
-              // hdf5 string arrays store strings of all the
-              // same physical length (I think), which is
-              // slightly wasteful, but oh well.
-
-              OCTAVE_LOCAL_BUFFER (char, s, elements * slen);
-
-              // create datatype for (null-terminated) string
-              // to read into:
-              hid_t st_id = H5Tcopy (H5T_C_S1);
-              H5Tset_size (st_id, slen);
-
-              if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, s) < 0)
-                {
-                  H5Tclose (st_id);
-                  H5Tclose (type_hid);
-                  H5Sclose (space_hid);
-                  H5Dclose (data_hid);
-                  return false;
-                }
-
-              charMatrix chm (elements, slen - 1);
-              for (hsize_t i = 0; i < elements; ++i)
-                {
-                  chm.insert (s + i*slen, i, 0);
-                }
-
-              matrix = chm;
-
-              H5Tclose (st_id);
-              H5Tclose (type_hid);
-              H5Sclose (space_hid);
-              H5Dclose (data_hid);
-              return true;
-            }
-        }
-      else
-        {
-          H5Tclose (type_hid);
-          H5Sclose (space_hid);
-          H5Dclose (data_hid);
-          return false;
-        }
-    }
-
-  return retval;
-}
-
-#endif
--- a/src/ov-str-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_char_matrix_str_h)
-#define octave_char_matrix_str_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-stream.h"
-#include "ov.h"
-#include "ov-ch-mat.h"
-#include "ov-re-mat.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Character matrix values with special properties for use as
-// strings.
-
-class
-OCTINTERP_API
-octave_char_matrix_str : public octave_char_matrix
-{
-public:
-
-  octave_char_matrix_str (void)
-    : octave_char_matrix () { }
-
-  octave_char_matrix_str (const charMatrix& chm)
-    : octave_char_matrix (chm) { }
-
-  octave_char_matrix_str (const charNDArray& chm)
-    : octave_char_matrix (chm) { }
-
-  octave_char_matrix_str (const Array<char>& chm)
-    : octave_char_matrix (chm) { }
-
-  octave_char_matrix_str (char c)
-    : octave_char_matrix (c) { }
-
-  octave_char_matrix_str (const char *s)
-    : octave_char_matrix (s) { }
-
-  octave_char_matrix_str (const std::string& s)
-    : octave_char_matrix (s) { }
-
-  octave_char_matrix_str (const string_vector& s)
-    : octave_char_matrix (s) { }
-
-  octave_char_matrix_str (const octave_char_matrix& chm)
-    : octave_char_matrix (chm) { }
-
-  octave_char_matrix_str (const octave_char_matrix_str& chms)
-    : octave_char_matrix (chms) { }
-
-  ~octave_char_matrix_str (void) { }
-
-  octave_base_value *clone (void) const { return new octave_char_matrix_str (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_char_matrix_str (); }
-
-  type_conv_info numeric_conversion_function (void) const;
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false)
-    { return do_index_op_internal (idx, resize_ok); }
-
-  octave_value squeeze (void) const
-    { return octave_value (charNDArray (matrix.squeeze ())); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return octave_value (charNDArray (matrix.reshape (new_dims))); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return octave_value (charNDArray (matrix.permute (vec, inv))); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const;
-
-  octave_value diag (octave_idx_type k = 0) const
-    { return octave_value (matrix.diag (k)); }
-
-  bool is_string (void) const { return true; }
-
-  bool is_numeric_type (void) const { return false; }
-
-  double double_value (bool = false) const;
-
-  Matrix matrix_value (bool = false) const;
-
-  NDArray array_value (bool = false) const;
-
-  Complex complex_value (bool = false) const;
-
-  ComplexMatrix complex_matrix_value (bool = false) const;
-
-  ComplexNDArray complex_array_value (bool = false) const;
-
-  string_vector all_strings (bool pad = false) const;
-
-  std::string string_value (bool force = false) const;
-
-  Array<std::string> cellstr_value (void) const;
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
-    { return octave_value (matrix.sort (dim, mode)); }
-
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const
-    { return octave_value (matrix.sort (sidx, dim, mode)); }
-
-  bool print_as_scalar (void) const { return (rows () <= 1); }
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  int write (octave_stream& os, int block_size,
-             oct_data_conv::data_type output_type, int skip,
-             oct_mach_info::float_format flt_fmt) const
-    { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
-
-protected:
-
-  octave_value do_index_op_internal (const octave_value_list& idx,
-                                     bool resize_ok, char type = '"');
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-typedef octave_char_matrix_str octave_char_matrix_dq_str;
-
-class
-octave_char_matrix_sq_str : public octave_char_matrix_str
-{
-public:
-
-  octave_char_matrix_sq_str (void)
-    : octave_char_matrix_str () { }
-
-  octave_char_matrix_sq_str (const charMatrix& chm)
-    : octave_char_matrix_str (chm) { }
-
-  octave_char_matrix_sq_str (const charNDArray& chm)
-    : octave_char_matrix_str (chm) { }
-
-  octave_char_matrix_sq_str (const Array<char>& chm)
-    : octave_char_matrix_str (chm) { }
-
-  octave_char_matrix_sq_str (char c)
-    : octave_char_matrix_str (c) { }
-
-  octave_char_matrix_sq_str (const char *s)
-    : octave_char_matrix_str (s) { }
-
-  octave_char_matrix_sq_str (const std::string& s)
-    : octave_char_matrix_str (s) { }
-
-  octave_char_matrix_sq_str (const string_vector& s)
-    : octave_char_matrix_str (s) { }
-
-  octave_char_matrix_sq_str (const octave_char_matrix_str& chm)
-    : octave_char_matrix_str (chm) { }
-
-  octave_char_matrix_sq_str (const octave_char_matrix_sq_str& chms)
-    : octave_char_matrix_str (chms) { }
-
-  ~octave_char_matrix_sq_str (void) { }
-
-  octave_base_value *clone (void) const { return new octave_char_matrix_sq_str (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_char_matrix_sq_str (); }
-
-  octave_value squeeze (void) const
-    { return octave_value (charNDArray (matrix.squeeze ()), '\''); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return octave_value (charNDArray (matrix.reshape (new_dims)), '\''); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return octave_value (charNDArray (matrix.permute (vec, inv)), '\''); }
-
-  octave_value resize (const dim_vector& dv, bool = false) const
-    {
-      charNDArray retval (matrix);
-      retval.resize (dv);
-      return octave_value (retval, '\'');
-    }
-
-  octave_value diag (octave_idx_type k = 0) const
-    { return octave_value (matrix.diag (k), '\''); }
-
-  bool is_sq_string (void) const { return true; }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false)
-    { return do_index_op_internal (idx, resize_ok, '\''); }
-
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
-    { return octave_value (matrix.sort (dim, mode), '\''); }
-
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                     sortmode mode = ASCENDING) const
-    { return octave_value (matrix.sort (sidx, dim, mode), '\''); }
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-struct.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2235 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "Cell.h"
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "oct-lvalue.h"
-#include "ov-struct.h"
-#include "unwind-prot.h"
-#include "utils.h"
-#include "variables.h"
-
-#include "Array-util.h"
-#include "oct-locbuf.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-oct-binary.h"
-#include "ls-hdf5.h"
-#include "ls-utils.h"
-#include "pr-output.h"
-
-DEFINE_OCTAVE_ALLOCATOR(octave_struct);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_struct, "struct", "struct");
-
-// How many levels of structure elements should we print?
-static int Vstruct_levels_to_print = 2;
-
-// TRUE means print struct array contents, up to the number of levels
-// specified by struct_levels_to_print.
-static bool Vprint_struct_array_contents = false;
-
-octave_base_value *
-octave_struct::try_narrowing_conversion (void)
-{
-  octave_base_value *retval = 0;
-
-  if (numel () == 1)
-    retval = new octave_scalar_struct (map.checkelem (0));
-
-  return retval;
-}
-
-Cell
-octave_struct::dotref (const octave_value_list& idx, bool auto_add)
-{
-  Cell retval;
-
-  assert (idx.length () == 1);
-
-  std::string nm = idx(0).string_value ();
-
-  octave_map::const_iterator p = map.seek (nm);
-
-  if (p != map.end ())
-    retval = map.contents (p);
-  else if (auto_add)
-    retval = (numel () == 0) ? Cell (dim_vector (1, 1)) : Cell (dims ());
-  else
-    error ("structure has no member `%s'", nm.c_str ());
-
-  return retval;
-}
-
-#if 0
-static void
-gripe_invalid_index1 (void)
-{
-  error ("invalid index for structure array");
-}
-#endif
-
-static void
-gripe_invalid_index_for_assignment (void)
-{
-  error ("invalid index for structure array assignment");
-}
-
-static void
-gripe_invalid_index_type (const std::string& nm, char t)
-{
-  error ("%s cannot be indexed with %c", nm.c_str (), t);
-}
-
-static void
-gripe_failed_assignment (void)
-{
-  error ("assignment to structure element failed");
-}
-
-octave_value_list
-octave_struct::subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx,
-                        int nargout)
-{
-  octave_value_list retval;
-
-  int skip = 1;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        if (type.length () > 1 && type[1] == '.')
-          {
-            std::list<octave_value_list>::const_iterator p = idx.begin ();
-            octave_value_list key_idx = *++p;
-
-            const Cell tmp = dotref (key_idx);
-
-            if (! error_state)
-              {
-                const Cell t = tmp.index (idx.front ());
-
-                retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
-
-                // We handled two index elements, so tell
-                // next_subsref to skip both of them.
-
-                skip++;
-              }
-          }
-        else
-          retval(0) = do_index_op (idx.front ());
-      }
-      break;
-
-    case '.':
-      {
-        if (map.numel () > 0)
-          {
-            const Cell t = dotref (idx.front ());
-
-            retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true);
-          }
-      }
-      break;
-
-    case '{':
-      gripe_invalid_index_type (type_name (), type[0]);
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  // FIXME -- perhaps there should be an
-  // octave_value_list::next_subsref member function?  See also
-  // octave_user_function::subsref.
-
-  if (idx.size () > 1)
-    retval = retval(0).next_subsref (nargout, type, idx, skip);
-
-  return retval;
-}
-
-octave_value
-octave_struct::subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx,
-                        bool auto_add)
-{
-  octave_value retval;
-
-  int skip = 1;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        if (type.length () > 1 && type[1] == '.')
-          {
-            std::list<octave_value_list>::const_iterator p = idx.begin ();
-            octave_value_list key_idx = *++p;
-
-            const Cell tmp = dotref (key_idx, auto_add);
-
-            if (! error_state)
-              {
-                const Cell t = tmp.index (idx.front (), auto_add);
-
-                retval = (t.length () == 1) ? t(0) : octave_value (t, true);
-
-                // We handled two index elements, so tell
-                // next_subsref to skip both of them.
-
-                skip++;
-              }
-          }
-        else
-          retval = do_index_op (idx.front (), auto_add);
-      }
-      break;
-
-    case '.':
-      {
-        if (map.numel () > 0)
-          {
-            const Cell t = dotref (idx.front (), auto_add);
-
-            retval = (t.length () == 1) ? t(0) : octave_value (t, true);
-          }
-      }
-      break;
-
-    case '{':
-      gripe_invalid_index_type (type_name (), type[0]);
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  // FIXME -- perhaps there should be an
-  // octave_value_list::next_subsref member function?  See also
-  // octave_user_function::subsref.
-
-  if (idx.size () > 1)
-    retval = retval.next_subsref (auto_add, type, idx, skip);
-
-  return retval;
-}
-
-/*
-%!test
-%! x(1).a.a = 1;
-%! x(2).a.a = 2;
-%! assert (size (x), [1, 2]);
-%! assert (x(1).a.a, 1);
-%! assert (x(2).a.a, 2);
-*/
-
-octave_value
-octave_struct::numeric_conv (const octave_value& val,
-                             const std::string& type)
-{
-  octave_value retval;
-
-  if (type.length () > 0 && type[0] == '.' && ! val.is_map ())
-    retval = octave_map ();
-  else
-    retval = val;
-
-  return retval;
-}
-
-octave_value
-octave_struct::subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs)
-{
-  octave_value retval;
-
-  int n = type.length ();
-
-  octave_value t_rhs = rhs;
-
-  if (idx.front ().empty ())
-    {
-      error ("missing index in indexed assignment");
-      return retval;
-    }
-
-  if (n > 1 && ! (type.length () == 2 && type[0] == '(' && type[1] == '.'))
-    {
-      switch (type[0])
-        {
-        case '(':
-          {
-            if (type.length () > 1 && type[1] == '.')
-              {
-                std::list<octave_value_list>::const_iterator p = idx.begin ();
-                octave_value_list t_idx = *p;
-
-                octave_value_list key_idx = *++p;
-
-                assert (key_idx.length () == 1);
-
-                std::string key = key_idx(0).string_value ();
-
-                std::list<octave_value_list> next_idx (idx);
-
-                // We handled two index elements, so subsasgn to
-                // needs to skip both of them.
-
-                next_idx.erase (next_idx.begin ());
-                next_idx.erase (next_idx.begin ());
-
-                std::string next_type = type.substr (2);
-
-                Cell tmpc (1, 1);
-                octave_map::iterator pkey = map.seek (key);
-                if (pkey != map.end ())
-                  {
-                    map.contents (pkey).make_unique ();
-                    tmpc = map.contents (pkey).index (idx.front (), true);
-                  }
-
-                // FIXME: better code reuse? cf. octave_cell::subsasgn and the case below.
-                if (! error_state)
-                  {
-                    if (tmpc.numel () == 1)
-                      {
-                        octave_value& tmp = tmpc(0);
-
-                        bool orig_undefined = tmp.is_undefined ();
-
-                        if (orig_undefined || tmp.is_zero_by_zero ())
-                          {
-                            tmp = octave_value::empty_conv (next_type, rhs);
-                            tmp.make_unique (); // probably a no-op.
-                          }
-                        else
-                          // optimization: ignore the copy still stored inside our map.
-                          tmp.make_unique (1);
-
-                        if (! error_state)
-                          t_rhs = (orig_undefined
-                                   ? tmp.undef_subsasgn (next_type, next_idx, rhs)
-                                   : tmp.subsasgn (next_type, next_idx, rhs));
-                      }
-                    else
-                      gripe_indexed_cs_list ();
-                  }
-              }
-            else
-              gripe_invalid_index_for_assignment ();
-          }
-          break;
-
-        case '.':
-          {
-            octave_value_list key_idx = idx.front ();
-
-            assert (key_idx.length () == 1);
-
-            std::string key = key_idx(0).string_value ();
-
-            std::list<octave_value_list> next_idx (idx);
-
-            next_idx.erase (next_idx.begin ());
-
-            std::string next_type = type.substr (1);
-
-            Cell tmpc (1, 1);
-            octave_map::iterator pkey = map.seek (key);
-            if (pkey != map.end ())
-              {
-                map.contents (pkey).make_unique ();
-                tmpc = map.contents (pkey);
-              }
-
-            // FIXME: better code reuse?
-            if (! error_state)
-              {
-                if (tmpc.numel () == 1)
-                  {
-                    octave_value& tmp = tmpc(0);
-
-                    bool orig_undefined = tmp.is_undefined ();
-
-                    if (orig_undefined || tmp.is_zero_by_zero ())
-                      {
-                        tmp = octave_value::empty_conv (next_type, rhs);
-                        tmp.make_unique (); // probably a no-op.
-                      }
-                    else
-                      // optimization: ignore the copy still stored inside our map.
-                      tmp.make_unique (1);
-
-                    if (! error_state)
-                      t_rhs = (orig_undefined
-                               ? tmp.undef_subsasgn (next_type, next_idx, rhs)
-                               : tmp.subsasgn (next_type, next_idx, rhs));
-                  }
-                else
-                  gripe_indexed_cs_list ();
-              }
-          }
-          break;
-
-        case '{':
-          gripe_invalid_index_type (type_name (), type[0]);
-          break;
-
-        default:
-          panic_impossible ();
-        }
-    }
-
-  if (! error_state)
-    {
-      switch (type[0])
-        {
-        case '(':
-          {
-            if (n > 1 && type[1] == '.')
-              {
-                std::list<octave_value_list>::const_iterator p = idx.begin ();
-                octave_value_list key_idx = *++p;
-                octave_value_list idxf = idx.front ();
-
-                assert (key_idx.length () == 1);
-
-                std::string key = key_idx(0).string_value ();
-
-                if (! error_state)
-                  {
-                    if (t_rhs.is_cs_list ())
-                      {
-                        Cell tmp_cell = Cell (t_rhs.list_value ());
-
-                        // Inquire the proper shape of the RHS.
-
-                        dim_vector didx = dims ().redim (idxf.length ());
-                        for (octave_idx_type k = 0; k < idxf.length (); k++)
-                          if (! idxf(k).is_magic_colon ()) didx(k) = idxf(k).numel ();
-
-                        if (didx.numel () == tmp_cell.numel ())
-                          tmp_cell = tmp_cell.reshape (didx);
-
-
-                        map.assign (idxf, key, tmp_cell);
-
-                        if (! error_state)
-                          {
-                            count++;
-                            retval = octave_value (this);
-                          }
-                        else
-                          gripe_failed_assignment ();
-                      }
-                    else
-                      {
-                        const octave_map& cmap = const_cast<const octave_map &> (map);
-                        // cast map to const reference to avoid forced key insertion.
-                        if (idxf.all_scalars ()
-                            || cmap.contents (key).index (idxf, true).numel () == 1)
-                          {
-                            map.assign (idxf, key, Cell (t_rhs.storable_value ()));
-                            if (! error_state)
-                              {
-                                count++;
-                                retval = octave_value (this);
-                              }
-                            else
-                              gripe_failed_assignment ();
-                          }
-                        else if (! error_state)
-                          gripe_nonbraced_cs_list_assignment ();
-                      }
-                  }
-                else
-                  gripe_failed_assignment ();
-              }
-            else
-              {
-                if (t_rhs.is_map () || t_rhs.is_object ())
-                  {
-                    octave_map rhs_map = t_rhs.map_value ();
-
-                    if (! error_state)
-                      {
-                        map.assign (idx.front (), rhs_map);
-
-                        if (! error_state)
-                          {
-                            count++;
-                            retval = octave_value (this);
-                          }
-                        else
-                          gripe_failed_assignment ();
-                      }
-                    else
-                      error ("invalid structure assignment");
-                  }
-                else
-                  {
-                    if (t_rhs.is_null_value ())
-                      {
-                        map.delete_elements (idx.front ());
-
-                        if (! error_state)
-                          {
-                            count++;
-                            retval = octave_value (this);
-                          }
-                        else
-                          gripe_failed_assignment ();
-                      }
-                    else
-                      error ("invalid structure assignment");
-                  }
-              }
-          }
-          break;
-
-        case '.':
-          {
-            octave_value_list key_idx = idx.front ();
-
-            assert (key_idx.length () == 1);
-
-            std::string key = key_idx(0).string_value ();
-
-            if (t_rhs.is_cs_list ())
-              {
-                Cell tmp_cell = Cell (t_rhs.list_value ());
-
-                // The shape of the RHS is irrelevant, we just want
-                // the number of elements to agree and to preserve the
-                // shape of the left hand side of the assignment.
-
-                if (numel () == tmp_cell.numel ())
-                  tmp_cell = tmp_cell.reshape (dims ());
-
-                map.setfield (key, tmp_cell);
-              }
-            else
-              {
-                Cell tmp_cell(1, 1);
-                tmp_cell(0) = t_rhs.storable_value ();
-                map.setfield (key, tmp_cell);
-              }
-
-            if (! error_state)
-              {
-                count++;
-                retval = octave_value (this);
-              }
-            else
-              gripe_failed_assignment ();
-          }
-          break;
-
-        case '{':
-          gripe_invalid_index_type (type_name (), type[0]);
-          break;
-
-        default:
-          panic_impossible ();
-        }
-    }
-  else
-    gripe_failed_assignment ();
-
-  retval.maybe_mutate ();
-
-  return retval;
-}
-
-octave_value
-octave_struct::do_index_op (const octave_value_list& idx, bool resize_ok)
-{
-  // octave_map handles indexing itself.
-  return map.index (idx, resize_ok);
-}
-
-size_t
-octave_struct::byte_size (void) const
-{
-  // Neglect the size of the fieldnames.
-
-  size_t retval = 0;
-
-  for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
-    {
-      std::string key = map.key (p);
-
-      octave_value val = octave_value (map.contents (p));
-
-      retval += val.byte_size ();
-    }
-
-  return retval;
-}
-
-void
-octave_struct::print (std::ostream& os, bool) const
-{
-  print_raw (os);
-}
-
-void
-octave_struct::print_raw (std::ostream& os, bool) const
-{
-  unwind_protect frame;
-
-  frame.protect_var (Vstruct_levels_to_print);
-
-  if (Vstruct_levels_to_print >= 0)
-    {
-      bool max_depth_reached = Vstruct_levels_to_print-- == 0;
-
-      bool print_fieldnames_only
-        = (max_depth_reached || ! Vprint_struct_array_contents);
-
-      increment_indent_level ();
-
-      newline (os);
-      indent (os);
-      dim_vector dv = dims ();
-      os << dv.str () << " struct array containing the fields:";
-      newline (os);
-
-      increment_indent_level ();
-
-      string_vector key_list = map.fieldnames ();
-
-      for (octave_idx_type i = 0; i < key_list.length (); i++)
-        {
-          std::string key = key_list[i];
-
-          Cell val = map.contents (key);
-
-          newline (os);
-
-          if (print_fieldnames_only)
-            {
-              indent (os);
-              os << key;
-            }
-          else
-            {
-              octave_value tmp (val);
-              tmp.print_with_name (os, key);
-            }
-        }
-
-      if (print_fieldnames_only)
-        newline (os);
-
-      decrement_indent_level ();
-      decrement_indent_level ();
-    }
-  else
-    {
-      indent (os);
-      os << "<structure>";
-      newline (os);
-    }
-}
-
-bool
-octave_struct::print_name_tag (std::ostream& os, const std::string& name) const
-{
-  bool retval = false;
-
-  indent (os);
-
-  if (Vstruct_levels_to_print < 0)
-    os << name << " = ";
-  else
-    {
-      os << name << " =";
-      newline (os);
-      retval = true;
-    }
-
-  return retval;
-}
-
-static bool
-scalar (const dim_vector& dims)
-{
-  return dims.length () == 2 && dims (0) == 1 && dims (1) == 1;
-}
-
-
-bool
-octave_struct::save_ascii (std::ostream& os)
-{
-  octave_map m = map_value ();
-
-  octave_idx_type nf = m.nfields ();
-
-  const dim_vector dv = dims ();
-
-  os << "# ndims: " << dv.length () << "\n";
-
-  for (int i = 0; i < dv.length (); i++)
-    os << " " << dv (i);
-  os << "\n";
-
-  os << "# length: " << nf << "\n";
-
-  // Iterating over the list of keys will preserve the order of the
-  // fields.
-  string_vector keys = m.fieldnames ();
-
-  for (octave_idx_type i = 0; i < nf; i++)
-    {
-      std::string key = keys(i);
-
-      octave_value val = map.contents (key);
-
-      bool b = save_ascii_data (os, val, key, false, 0);
-
-      if (! b)
-        return os;
-    }
-
-  return true;
-}
-
-bool
-octave_struct::load_ascii (std::istream& is)
-{
-  octave_idx_type len = 0;
-  dim_vector dv (1, 1);
-  bool success = true;
-
-  // KLUGE: earlier Octave versions did not save extra dimensions with struct,
-  // and as a result did not preserve dimensions for empty structs.
-  // The default dimensions were 1x1, which we want to preserve.
-  string_vector keywords(2);
-
-  keywords[0] = "ndims";
-  keywords[1] = "length";
-
-  std::string kw;
-
-  if (extract_keyword (is, keywords, kw, len, true))
-    {
-      if (kw == keywords[0])
-        {
-          int mdims = std::max (static_cast<int> (len), 2);
-          dv.resize (mdims);
-          for (int i = 0; i < mdims; i++)
-            is >> dv(i);
-
-          success = extract_keyword (is, keywords[1], len);
-        }
-    }
-  else
-    success = false;
-
-  if (success && len >= 0)
-    {
-      if (len > 0)
-        {
-          octave_map m (dv);
-
-          for (octave_idx_type j = 0; j < len; j++)
-            {
-              octave_value t2;
-              bool dummy;
-
-              // recurse to read cell elements
-              std::string nm
-                = read_ascii_data (is, std::string (), dummy, t2, j);
-
-              if (!is)
-                break;
-
-              Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
-
-              if (error_state)
-                {
-                  error ("load: internal error loading struct elements");
-                  return false;
-                }
-
-              m.setfield (nm, tcell);
-            }
-
-          if (is)
-            map = m;
-          else
-            {
-              error ("load: failed to load structure");
-              success = false;
-            }
-        }
-      else if (len == 0 )
-        map = octave_map (dv);
-      else
-        panic_impossible ();
-    }
-  else {
-    error ("load: failed to extract number of elements in structure");
-    success = false;
-  }
-
-  return success;
-}
-
-bool
-octave_struct::save_binary (std::ostream& os, bool& save_as_floats)
-{
-  octave_map m = map_value ();
-
-  octave_idx_type nf = m.nfields ();
-
-  dim_vector d = dims ();
-  if (d.length () < 1)
-    return false;
-
-  // Use negative value for ndims
-  int32_t di = - d.length ();
-  os.write (reinterpret_cast<char *> (&di), 4);
-  for (int i = 0; i < d.length (); i++)
-    {
-      di = d(i);
-      os.write (reinterpret_cast<char *> (&di), 4);
-    }
-
-  int32_t len = nf;
-  os.write (reinterpret_cast<char *> (&len), 4);
-
-  // Iterating over the list of keys will preserve the order of the
-  // fields.
-  string_vector keys = m.fieldnames ();
-
-  for (octave_idx_type i = 0; i < nf; i++)
-    {
-      std::string key = keys(i);
-
-      octave_value val = map.contents (key);
-
-      bool b = save_binary_data (os, val, key, "", 0, save_as_floats);
-
-      if (! b)
-        return os;
-    }
-
-  return true;
-}
-
-bool
-octave_struct::load_binary (std::istream& is, bool swap,
-                            oct_mach_info::float_format fmt)
-{
-  bool success = true;
-  int32_t len;
-  if (! is.read (reinterpret_cast<char *> (&len), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&len);
-
-  dim_vector dv (1, 1);
-
-  if (len < 0)
-    {
-      // We have explicit dimensions.
-      int mdims = -len;
-
-      int32_t di;
-      dv.resize (mdims);
-
-      for (int i = 0; i < mdims; i++)
-        {
-          if (! is.read (reinterpret_cast<char *> (&di), 4))
-            return false;
-          if (swap)
-            swap_bytes<4> (&di);
-          dv(i) = di;
-        }
-
-      if (! is.read (reinterpret_cast<char *> (&len), 4))
-        return false;
-      if (swap)
-        swap_bytes<4> (&len);
-    }
-
-  if (len > 0)
-    {
-      octave_map m (dv);
-
-      for (octave_idx_type j = 0; j < len; j++)
-        {
-          octave_value t2;
-          bool dummy;
-          std::string doc;
-
-          // recurse to read cell elements
-          std::string nm = read_binary_data (is, swap, fmt, std::string (),
-                                             dummy, t2, doc);
-
-          if (!is)
-            break;
-
-          Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
-
-          if (error_state)
-            {
-              error ("load: internal error loading struct elements");
-              return false;
-            }
-
-          m.setfield (nm, tcell);
-        }
-
-      if (is)
-        map = m;
-      else
-        {
-          error ("load: failed to load structure");
-          success = false;
-        }
-    }
-  else if (len == 0)
-    map = octave_map (dv);
-  else
-    success = false;
-
-  return success;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_struct::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
-{
-  hid_t data_hid = -1;
-
-#if HAVE_HDF5_18
-  data_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Gcreate (loc_id, name, 0);
-#endif
-  if (data_hid < 0) return false;
-
-  // recursively add each element of the structure to this group
-  octave_map m = map_value ();
-
-  octave_idx_type nf = m.nfields ();
-
-  // Iterating over the list of keys will preserve the order of the
-  // fields.
-  string_vector keys = m.fieldnames ();
-
-  for (octave_idx_type i = 0; i < nf; i++)
-    {
-      std::string key = keys(i);
-
-      octave_value val = map.contents (key);
-
-      bool retval2 = add_hdf5_data (data_hid, val, key, "", false,
-                                    save_as_floats);
-
-      if (! retval2)
-        break;
-    }
-
-  H5Gclose (data_hid);
-
-  return true;
-}
-
-bool
-octave_struct::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  hdf5_callback_data dsub;
-
-  herr_t retval2 = 0;
-  octave_map m (dim_vector (1, 1));
-  int current_item = 0;
-  hsize_t num_obj = 0;
-#if HAVE_HDF5_18
-  hid_t group_id = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t group_id = H5Gopen (loc_id, name);
-#endif
-  H5Gget_num_objs (group_id, &num_obj);
-  H5Gclose (group_id);
-
-  // FIXME -- fields appear to be sorted alphabetically on loading.
-  // Why is that happening?
-
-  while (current_item < static_cast<int> (num_obj)
-         && (retval2 = H5Giterate (loc_id, name, &current_item,
-                                   hdf5_read_next_data, &dsub)) > 0)
-    {
-      octave_value t2 = dsub.tc;
-
-      Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
-
-      if (error_state)
-        {
-          error ("load: internal error loading struct elements");
-          return false;
-        }
-
-      m.setfield (dsub.name, tcell);
-
-    }
-
-  if (retval2 >= 0)
-    {
-      map = m;
-      retval = true;
-    }
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_struct::as_mxArray (void) const
-{
-  int nf = nfields ();
-  string_vector kv = map_keys ();
-
-  OCTAVE_LOCAL_BUFFER (const char *, f, nf);
-
-  for (int i = 0; i < nf; i++)
-    f[i] = kv[i].c_str ();
-
-  mxArray *retval = new mxArray (dims (), nf, f);
-
-  mxArray **elts = static_cast<mxArray **> (retval->get_data ());
-
-  mwSize nel = numel ();
-
-  mwSize ntot = nf * nel;
-
-  for (int i = 0; i < nf; i++)
-    {
-      Cell c = map.contents (kv[i]);
-
-      const octave_value *p = c.data ();
-
-      mwIndex k = 0;
-      for (mwIndex j = i; j < ntot; j += nf)
-        elts[j] = new mxArray (p[k++]);
-    }
-
-  return retval;
-}
-
-octave_value
-octave_struct::fast_elem_extract (octave_idx_type n) const
-{
-  if (n < map.numel ())
-    return map.checkelem (n);
-  else
-    return octave_value ();
-}
-
-bool
-octave_struct::fast_elem_insert (octave_idx_type n,
-                                 const octave_value& x)
-{
-  bool retval = false;
-
-  if (n < map.numel ())
-    {
-      // To avoid copying the scalar struct, it just stores a pointer to
-      // itself.
-      const octave_scalar_map *sm_ptr;
-      void *here = reinterpret_cast<void *>(&sm_ptr);
-      return (x.get_rep ().fast_elem_insert_self (here, btyp_struct)
-              && map.fast_elem_insert (n, *sm_ptr));
-    }
-
-  return retval;
-}
-DEFINE_OCTAVE_ALLOCATOR(octave_scalar_struct);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_scalar_struct, "scalar struct", "struct");
-
-octave_value
-octave_scalar_struct::dotref (const octave_value_list& idx, bool auto_add)
-{
-  assert (idx.length () == 1);
-
-  std::string nm = idx(0).string_value ();
-
-  octave_value retval = map.getfield (nm);
-
-  if (! auto_add && retval.is_undefined ())
-    error ("structure has no member `%s'", nm.c_str ());
-
-  return retval;
-}
-
-octave_value
-octave_scalar_struct::subsref (const std::string& type,
-                               const std::list<octave_value_list>& idx)
-{
-  octave_value retval;
-
-  if (type[0] == '.')
-    {
-      int skip = 1;
-
-      retval = dotref (idx.front ());
-
-      if (idx.size () > 1)
-        retval = retval.next_subsref (type, idx, skip);
-    }
-  else
-    retval = to_array ().subsref (type, idx);
-
-  return retval;
-}
-
-octave_value_list
-octave_scalar_struct::subsref (const std::string& type,
-                               const std::list<octave_value_list>& idx,
-                               int nargout)
-{
-  octave_value_list retval;
-
-  if (type[0] == '.')
-    {
-      int skip = 1;
-
-      retval(0) = dotref (idx.front ());
-
-      if (idx.size () > 1)
-        retval = retval(0).next_subsref (nargout, type, idx, skip);
-    }
-  else
-    retval = to_array ().subsref (type, idx, nargout);
-
-  return retval;
-}
-
-octave_value
-octave_scalar_struct::subsref (const std::string& type,
-                               const std::list<octave_value_list>& idx,
-                               bool auto_add)
-{
-  octave_value retval;
-
-  if (type[0] == '.')
-    {
-      int skip = 1;
-
-      retval = dotref (idx.front (), auto_add);
-
-      if (idx.size () > 1)
-        retval = retval.next_subsref (auto_add, type, idx, skip);
-    }
-  else
-    retval = to_array ().subsref (type, idx, auto_add);
-
-  return retval;
-}
-
-/*
-%!test
-%! x(1).a.a = 1;
-%! x(2).a.a = 2;
-%! assert (size (x), [1, 2]);
-%! assert (x(1).a.a, 1);
-%! assert (x(2).a.a, 2);
-*/
-
-octave_value
-octave_scalar_struct::numeric_conv (const octave_value& val,
-                                    const std::string& type)
-{
-  octave_value retval;
-
-  if (type.length () > 0 && type[0] == '.' && ! val.is_map ())
-    retval = octave_map ();
-  else
-    retval = val;
-
-  return retval;
-}
-
-octave_value
-octave_scalar_struct::subsasgn (const std::string& type,
-                                const std::list<octave_value_list>& idx,
-                                const octave_value& rhs)
-{
-  octave_value retval;
-
-  if (idx.front ().empty ())
-    {
-      error ("missing index in indexed assignment");
-      return retval;
-    }
-
-  if (type[0] == '.')
-    {
-      int n = type.length ();
-
-      octave_value t_rhs = rhs;
-
-      octave_value_list key_idx = idx.front ();
-
-      assert (key_idx.length () == 1);
-
-      std::string key = key_idx(0).string_value ();
-
-      if (n > 1)
-        {
-          std::list<octave_value_list> next_idx (idx);
-
-          next_idx.erase (next_idx.begin ());
-
-          std::string next_type = type.substr (1);
-
-          octave_value tmp;
-          octave_map::iterator pkey = map.seek (key);
-          if (pkey != map.end ())
-            {
-              map.contents (pkey).make_unique ();
-              tmp = map.contents (pkey);
-            }
-
-          if (! error_state)
-            {
-              bool orig_undefined = tmp.is_undefined ();
-
-              if (orig_undefined || tmp.is_zero_by_zero ())
-                {
-                  tmp = octave_value::empty_conv (next_type, rhs);
-                  tmp.make_unique (); // probably a no-op.
-                }
-              else
-                // optimization: ignore the copy still stored inside our map.
-                tmp.make_unique (1);
-
-              if (! error_state)
-                t_rhs = (orig_undefined
-                         ? tmp.undef_subsasgn (next_type, next_idx, rhs)
-                         : tmp.subsasgn (next_type, next_idx, rhs));
-            }
-        }
-
-      if (! error_state)
-        map.setfield (key, t_rhs.storable_value ());
-      else
-        gripe_failed_assignment ();
-
-      count++;
-      retval = this;
-    }
-  else
-    {
-      // Forward this case to octave_struct.
-      octave_value tmp (new octave_struct (octave_map (map)));
-      retval = tmp.subsasgn (type, idx, rhs);
-    }
-
-  return retval;
-}
-
-octave_value
-octave_scalar_struct::do_index_op (const octave_value_list& idx, bool resize_ok)
-{
-  // octave_map handles indexing itself.
-  return octave_map (map).index (idx, resize_ok);
-}
-
-size_t
-octave_scalar_struct::byte_size (void) const
-{
-  // Neglect the size of the fieldnames.
-
-  size_t retval = 0;
-
-  for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
-    {
-      std::string key = map.key (p);
-
-      octave_value val = octave_value (map.contents (p));
-
-      retval += val.byte_size ();
-    }
-
-  return retval;
-}
-
-void
-octave_scalar_struct::print (std::ostream& os, bool) const
-{
-  print_raw (os);
-}
-
-void
-octave_scalar_struct::print_raw (std::ostream& os, bool) const
-{
-  unwind_protect frame;
-
-  frame.protect_var (Vstruct_levels_to_print);
-
-  if (Vstruct_levels_to_print >= 0)
-    {
-      bool max_depth_reached = Vstruct_levels_to_print-- == 0;
-
-      bool print_fieldnames_only = max_depth_reached;
-
-      increment_indent_level ();
-
-      if (! Vcompact_format)
-        newline (os);
-
-      indent (os);
-      os << "scalar structure containing the fields:";
-      newline (os);
-      if (! Vcompact_format)
-        newline (os);
-
-      increment_indent_level ();
-
-      string_vector key_list = map.fieldnames ();
-
-      for (octave_idx_type i = 0; i < key_list.length (); i++)
-        {
-          std::string key = key_list[i];
-
-          octave_value val = map.contents (key);
-
-          if (print_fieldnames_only)
-            {
-              indent (os);
-              os << key;
-              dim_vector dv = val.dims ();
-              os << ": " << dv.str () << " " << val.type_name ();
-              newline (os);
-            }
-          else
-            val.print_with_name (os, key);
-        }
-
-      decrement_indent_level ();
-      decrement_indent_level ();
-    }
-  else
-    {
-      indent (os);
-      os << "<structure>";
-      newline (os);
-    }
-}
-
-bool
-octave_scalar_struct::print_name_tag (std::ostream& os, const std::string& name) const
-{
-  bool retval = false;
-
-  indent (os);
-
-  if (Vstruct_levels_to_print < 0)
-    os << name << " = ";
-  else
-    {
-      os << name << " =";
-      newline (os);
-      retval = true;
-    }
-
-  return retval;
-}
-
-bool
-octave_scalar_struct::save_ascii (std::ostream& os)
-{
-  octave_map m = map_value ();
-
-  octave_idx_type nf = m.nfields ();
-
-  const dim_vector dv = dims ();
-
-  os << "# ndims: " << dv.length () << "\n";
-
-  for (int i = 0; i < dv.length (); i++)
-    os << " " << dv (i);
-  os << "\n";
-
-  os << "# length: " << nf << "\n";
-
-  // Iterating over the list of keys will preserve the order of the
-  // fields.
-  string_vector keys = m.fieldnames ();
-
-  for (octave_idx_type i = 0; i < nf; i++)
-    {
-      std::string key = keys(i);
-
-      octave_value val = map.contents (key);
-
-      bool b = save_ascii_data (os, val, key, false, 0);
-
-      if (! b)
-        return os;
-    }
-
-  return true;
-}
-
-bool
-octave_scalar_struct::load_ascii (std::istream& is)
-{
-  bool success = true;
-  octave_idx_type len = 0;
-
-  if (extract_keyword (is, "length", len) && len >= 0)
-    {
-      if (len > 0)
-        {
-          octave_scalar_map m;
-
-          for (octave_idx_type j = 0; j < len; j++)
-            {
-              octave_value t2;
-              bool dummy;
-
-              // recurse to read cell elements
-              std::string nm
-                = read_ascii_data (is, std::string (), dummy, t2, j);
-
-              if (!is)
-                break;
-
-              if (error_state)
-                {
-                  error ("load: internal error loading struct elements");
-                  return false;
-                }
-
-              m.setfield (nm, t2);
-            }
-
-          if (is)
-            map = m;
-          else
-            {
-              error ("load: failed to load structure");
-              success = false;
-            }
-        }
-      else if (len == 0)
-        map = octave_scalar_map ();
-      else
-        panic_impossible ();
-    }
-  else {
-    error ("load: failed to extract number of elements in structure");
-    success = false;
-  }
-
-  return success;
-}
-
-bool
-octave_scalar_struct::save_binary (std::ostream& os, bool& save_as_floats)
-{
-  octave_map m = map_value ();
-
-  octave_idx_type nf = m.nfields ();
-
-  int32_t len = nf;
-  os.write (reinterpret_cast<char *> (&len), 4);
-
-  // Iterating over the list of keys will preserve the order of the
-  // fields.
-  string_vector keys = m.fieldnames ();
-
-  for (octave_idx_type i = 0; i < nf; i++)
-    {
-      std::string key = keys(i);
-
-      octave_value val = map.contents (key);
-
-      bool b = save_binary_data (os, val, key, "", 0, save_as_floats);
-
-      if (! b)
-        return os;
-    }
-
-  return true;
-}
-
-bool
-octave_scalar_struct::load_binary (std::istream& is, bool swap,
-                                   oct_mach_info::float_format fmt)
-{
-  bool success = true;
-  int32_t len;
-  if (! is.read (reinterpret_cast<char *> (&len), 4))
-    return false;
-  if (swap)
-    swap_bytes<4> (&len);
-
-  dim_vector dv (1, 1);
-
-  if (len > 0)
-    {
-      octave_scalar_map m;
-
-      for (octave_idx_type j = 0; j < len; j++)
-        {
-          octave_value t2;
-          bool dummy;
-          std::string doc;
-
-          // recurse to read cell elements
-          std::string nm = read_binary_data (is, swap, fmt, std::string (),
-                                             dummy, t2, doc);
-
-          if (!is)
-            break;
-
-          if (error_state)
-            {
-              error ("load: internal error loading struct elements");
-              return false;
-            }
-
-          m.setfield (nm, t2);
-        }
-
-      if (is)
-        map = m;
-      else
-        {
-          error ("load: failed to load structure");
-          success = false;
-        }
-    }
-  else if (len == 0)
-    map = octave_scalar_map ();
-  else
-    success = false;
-
-  return success;
-}
-
-#if defined (HAVE_HDF5)
-
-bool
-octave_scalar_struct::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
-{
-  hid_t data_hid = -1;
-
-#if HAVE_HDF5_18
-  data_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
-#else
-  data_hid = H5Gcreate (loc_id, name, 0);
-#endif
-  if (data_hid < 0) return false;
-
-  // recursively add each element of the structure to this group
-  octave_scalar_map m = scalar_map_value ();
-
-  octave_idx_type nf = m.nfields ();
-
-  // Iterating over the list of keys will preserve the order of the
-  // fields.
-  string_vector keys = m.fieldnames ();
-
-  for (octave_idx_type i = 0; i < nf; i++)
-    {
-      std::string key = keys(i);
-
-      octave_value val = map.contents (key);
-
-      bool retval2 = add_hdf5_data (data_hid, val, key, "", false,
-                                    save_as_floats);
-
-      if (! retval2)
-        break;
-    }
-
-  H5Gclose (data_hid);
-
-  return true;
-}
-
-bool
-octave_scalar_struct::load_hdf5 (hid_t loc_id, const char *name)
-{
-  bool retval = false;
-
-  hdf5_callback_data dsub;
-
-  herr_t retval2 = 0;
-  octave_scalar_map m;
-  int current_item = 0;
-  hsize_t num_obj = 0;
-#if HAVE_HDF5_18
-  hid_t group_id = H5Gopen (loc_id, name, H5P_DEFAULT);
-#else
-  hid_t group_id = H5Gopen (loc_id, name);
-#endif
-  H5Gget_num_objs (group_id, &num_obj);
-  H5Gclose (group_id);
-
-  // FIXME -- fields appear to be sorted alphabetically on loading.
-  // Why is that happening?
-
-  while (current_item < static_cast<int> (num_obj)
-         && (retval2 = H5Giterate (loc_id, name, &current_item,
-                                   hdf5_read_next_data, &dsub)) > 0)
-    {
-      octave_value t2 = dsub.tc;
-
-      if (error_state)
-        {
-          error ("load: internal error loading struct elements");
-          return false;
-        }
-
-      m.setfield (dsub.name, t2);
-
-    }
-
-  if (retval2 >= 0)
-    {
-      map = m;
-      retval = true;
-    }
-
-  return retval;
-}
-
-#endif
-
-mxArray *
-octave_scalar_struct::as_mxArray (void) const
-{
-  int nf = nfields ();
-  string_vector kv = map_keys ();
-
-  OCTAVE_LOCAL_BUFFER (const char *, f, nf);
-
-  for (int i = 0; i < nf; i++)
-    f[i] = kv[i].c_str ();
-
-  mxArray *retval = new mxArray (dims (), nf, f);
-
-  mxArray **elts = static_cast<mxArray **> (retval->get_data ());
-
-  mwSize nel = numel ();
-
-  mwSize ntot = nf * nel;
-
-  for (int i = 0; i < nf; i++)
-    {
-      Cell c = map.contents (kv[i]);
-
-      const octave_value *p = c.data ();
-
-      mwIndex k = 0;
-      for (mwIndex j = i; j < ntot; j += nf)
-        elts[j] = new mxArray (p[k++]);
-    }
-
-  return retval;
-}
-
-
-octave_value
-octave_scalar_struct::to_array (void)
-{
-  return new octave_struct (octave_map (map));
-}
-
-bool
-octave_scalar_struct::fast_elem_insert_self (void *where, builtin_type_t btyp) const
-{
-
-  if (btyp == btyp_struct)
-    {
-      *(reinterpret_cast<const octave_scalar_map **>(where)) = &map;
-      return true;
-    }
-  else
-    return false;
-}
-
-DEFUN (struct, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} struct (\"field\", @var{value}, \"field\", @var{value}, @dots{})\n\
-\n\
-Create a structure and initialize its value.\n\
-\n\
-If the values are cell arrays, create a structure array and initialize\n\
-its values.  The dimensions of each cell array of values must match.\n\
-Singleton cells and non-cell values are repeated so that they fill\n\
-the entire array.  If the cells are empty, create an empty structure\n\
-array with the specified field names.\n\
-\n\
-If the argument is an object, return the underlying struct.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  // struct ([]) returns an empty struct.
-
-  // struct (empty_matrix) returns an empty struct with the same
-  // dimensions as the empty matrix.
-
-  // Note that struct () creates a 1x1 struct with no fields for
-  // compatibility with Matlab.
-
-  if (nargin == 1 && args(0).is_map ())
-    return args(0);
-
-  if (nargin == 1 && args(0).is_object ())
-    {
-      retval = args(0).map_value ();
-
-      return retval;
-    }
-
-  if ((nargin == 1 || nargin == 2)
-      && args(0).is_empty () && args(0).is_real_matrix ())
-    {
-      Cell fields;
-
-      if (nargin == 2)
-        {
-          if (args(1).is_cellstr ())
-            retval = octave_map (args(0).dims (), args(1).cellstr_value ());
-          else
-            error ("struct: expecting cell array of field names as second argument");
-        }
-      else
-        retval = octave_map (args(0).dims ());
-
-      return retval;
-    }
-
-  // Check for "field", VALUE pairs.
-
-  for (int i = 0; i < nargin; i += 2)
-    {
-      if (! args(i).is_string () || i + 1 >= nargin)
-        {
-          error ("struct: expecting alternating \"field\", VALUE pairs");
-          return retval;
-        }
-    }
-
-  // Check that the dimensions of the values correspond.
-
-  dim_vector dims (1, 1);
-
-  int first_dimensioned_value = 0;
-
-  for (int i = 1; i < nargin; i += 2)
-    {
-      if (args(i).is_cell ())
-        {
-          dim_vector argdims (args(i).dims ());
-
-          if (! scalar (argdims))
-            {
-              if (! first_dimensioned_value)
-                {
-                  dims = argdims;
-                  first_dimensioned_value = i + 1;
-                }
-              else if (dims != argdims)
-                {
-                  error ("struct: dimensions of parameter %d do not match those of parameter %d",
-                         first_dimensioned_value, i+1);
-                  return retval;
-                }
-            }
-        }
-    }
-
-  // Create the return value.
-
-  octave_map map (dims);
-
-  for (int i = 0; i < nargin; i+= 2)
-    {
-      // Get key.
-
-      std::string key (args(i).string_value ());
-
-      if (error_state)
-        return retval;
-
-      if (! valid_identifier (key))
-        {
-          error ("struct: invalid structure field name `%s'", key.c_str ());
-          return retval;
-        }
-
-      // Value may be v, { v }, or { v1, v2, ... }
-      // In the first two cases, we need to create a cell array of
-      // the appropriate dimensions filled with v.  In the last case,
-      // the cell array has already been determined to be of the
-      // correct dimensions.
-
-      if (args(i+1).is_cell ())
-        {
-          const Cell c (args(i+1).cell_value ());
-
-          if (error_state)
-            return retval;
-
-          if (scalar (c.dims ()))
-            map.setfield (key, Cell (dims, c(0)));
-          else
-            map.setfield (key, c);
-        }
-      else
-        map.setfield (key, Cell (dims, args(i+1)));
-
-      if (error_state)
-        return retval;
-    }
-
-  return octave_value (map);
-}
-
-/*
-%!shared x
-%! x(1).a=1;  x(2).a=2;  x(1).b=3;  x(2).b=3;
-%!assert (struct ("a",1, "b",3), x(1))
-%!assert (isempty (x([])))
-%!assert (isempty (struct ("a",{}, "b",{})))
-%!assert (struct ("a",{1,2}, "b",{3,3}), x)
-%!assert (struct ("a",{1,2}, "b",3), x)
-%!assert (struct ("a",{1,2}, "b",{3}), x)
-%!assert (struct ("b",3, "a",{1,2}), x)
-%!assert (struct ("b",{3}, "a",{1,2}), x)
-%!test x = struct ([]);
-%!assert (size (x), [0,0])
-%!assert (isstruct (x))
-%!assert (isempty (fieldnames (x)))
-%!fail ('struct ("a",{1,2},"b",{1,2,3})', 'dimensions of parameter 2 do not match those of parameter 4')
-%!fail ('struct (1,2,3,4)', 'struct: expecting alternating "field", VALUE pairs')
-%!fail ('struct ("1",2,"3")', 'struct: expecting alternating "field", VALUE pairs')
-*/
-
-DEFUN (isstruct, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} isstruct (@var{x})\n\
-Return true if @var{x} is a structure or a structure array.\n\
-@seealso{ismatrix, iscell, isa}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    retval = args(0).is_map ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (fieldnames, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} fieldnames (@var{struct})\n\
-Return a cell array of strings naming the elements of the structure\n\
-@var{struct}.  It is an error to call @code{fieldnames} with an\n\
-argument that is not a structure.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    {
-      octave_value arg = args(0);
-
-      if (arg.is_map () || arg.is_object ())
-        {
-          octave_map m = arg.map_value ();
-
-          string_vector keys = m.fieldnames ();
-
-          if (keys.length () == 0)
-            retval = Cell (0, 1);
-          else
-            retval = Cell (keys);
-        }
-      else
-        gripe_wrong_type_arg ("fieldnames", args(0));
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-## test preservation of fieldname order
-%!test
-%! x(3).d=1;  x(2).a=2; x(1).b=3;  x(2).c=3;
-%! assert (fieldnames (x), {"d"; "a"; "b"; "c"});
-*/
-
-DEFUN (isfield, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} isfield (@var{x}, @var{name})\n\
-Return true if the @var{x} is a structure and it\n\
-includes an element named @var{name}.  If @var{name} is a cell\n\
-array of strings then a logical array of equal dimension is returned.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 2)
-    {
-      retval = false;
-
-      if (args(0).is_map ())
-        {
-          octave_map m = args(0).map_value ();
-
-          // FIXME -- should this work for all types that can do
-          // structure reference operations?
-
-          if (args(1).is_string ())
-            {
-              std::string key = args(1).string_value ();
-
-              retval = m.isfield (key);
-            }
-          else if (args(1).is_cell ())
-            {
-              Cell c = args(1).cell_value ();
-              boolNDArray bm (c.dims ());
-              octave_idx_type n = bm.numel ();
-
-              for (octave_idx_type i = 0; i < n; i++)
-                {
-                  if (c(i).is_string ())
-                    {
-                      std::string key = c(i).string_value ();
-
-                      bm(i) = m.isfield (key);
-                    }
-                  else
-                    bm(i) = false;
-                }
-
-              retval = bm;
-            }
-        }
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (nfields, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} nfields (@var{s})\n\
-Return the number of fields of the structure @var{s}.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1 && args(0).is_map ())
-    {
-      retval = static_cast<double> (args(0).nfields ());
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-## test isfield
-%!test
-%! x(3).d=1;  x(2).a=2;  x(1).b=3;  x(2).c=3;
-%! assert (isfield (x, "b"));
-%!assert (isfield (struct ("a", "1"), "a"))
-%!assert (isfield ({1}, "c"), false)
-%!assert (isfield (struct ("a", "1"), 10), false)
-%!assert (isfield (struct ("a", "b"), "a "), false)
-%!assert (isfield (struct ("a", 1, "b", 2), {"a", "c"}), [true, false])
-*/
-
-DEFUN (cell2struct, args, ,
-       "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} cell2struct (@var{cell}, @var{fields}, @var{dim})\n\
-Convert @var{cell} to a structure.  The number of fields in @var{fields}\n\
-must match the number of elements in @var{cell} along dimension @var{dim},\n\
-that is @code{numel (@var{fields}) == size (@var{cell}, @var{dim})}.\n\
-If @var{dim} is omitted, a value of 1 is assumed.\n\
-\n\
-@example\n\
-@group\n\
-A = cell2struct (@{\"Peter\", \"Hannah\", \"Robert\";\n\
-                   185, 170, 168@},\n\
-                 @{\"Name\",\"Height\"@}, 1);\n\
-A(1)\n\
-   @result{}\n\
-      @{\n\
-        Name   = Peter\n\
-        Height = 185\n\
-      @}\n\
-\n\
-@end group\n\
-@end example\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 2 || nargin == 3)
-    {
-      if (! args(0).is_cell ())
-        {
-          error ("cell2struct: argument CELL must be of type cell");
-          return retval;
-        }
-
-      if (! (args(1).is_cellstr () || args(1).is_char_matrix ()))
-        {
-          error ("cell2struct: FIELDS must be a cell array of strings or a character matrix");
-          return retval;
-        }
-
-      const Cell vals = args(0).cell_value ();
-      const Array<std::string> fields = args(1).cellstr_value ();
-
-      octave_idx_type ext = 0;
-
-      int dim = 0;
-
-      if (nargin == 3)
-        {
-          if (args(2).is_real_scalar ())
-            {
-              dim = nargin == 2 ? 0 : args(2).int_value () - 1;
-
-              if (error_state)
-                return retval;
-            }
-          else
-            {
-              error ("cell2struct: DIM must be a real scalar");
-              return retval;
-            }
-        }
-
-      if (dim < 0)
-        {
-          error ("cell2struct: DIM must be a valid dimension");
-          return retval;
-        }
-
-      ext = vals.ndims () > dim ? vals.dims ()(dim) : 1;
-
-      if (ext != fields.numel ())
-        {
-          error ("cell2struct: number of FIELDS does not match dimension");
-          return retval;
-        }
-
-      int nd = std::max (dim+1, vals.ndims ());
-      // result dimensions.
-      dim_vector rdv = vals.dims ().redim (nd);
-
-      assert (ext == rdv(dim));
-      if (nd == 2)
-        {
-          rdv(0) = rdv(1-dim);
-          rdv(1) = 1;
-        }
-      else
-        {
-          for (int i =  dim + 1; i < nd; i++)
-            rdv(i-1) = rdv(i);
-
-          rdv.resize (nd-1);
-        }
-
-      octave_map map (rdv);
-      Array<idx_vector> ia (dim_vector (nd, 1), idx_vector::colon);
-
-      for (octave_idx_type i = 0; i < ext; i++)
-        {
-          ia(dim) = i;
-          map.setfield (fields(i), vals.index (ia).reshape (rdv));
-        }
-
-      retval = map;
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-## test cell2struct versus struct2cell
-%!test
-%! keys = cellstr (char (floor (rand (100,10)*24+65)))';
-%! vals = mat2cell (rand (100,1), ones (100,1), 1)';
-%! s = struct ([keys; vals]{:});
-%! t = cell2struct (vals, keys, 2);
-%! assert (s, t);
-%! assert (struct2cell (s), vals');
-%! assert (fieldnames (s), keys');
-
-%!assert (cell2struct ({1; 2}, {"a"; "b"}), struct ("a", 1, "b", 2));
-
-%!assert (cell2struct ({}, {"f"}, 3), struct ("f", {}));
-*/
-
-
-// So we can call Fcellstr directly.
-extern octave_value_list Fcellstr (const octave_value_list& args, int);
-
-DEFUN (rmfield, args, ,
-       "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} rmfield (@var{s}, @var{f})\n\
-Return a copy of the structure (array) @var{s} with the field @var{f}\n\
-removed.  If @var{f} is a cell array of strings or a character array, remove\n\
-the named fields.\n\
-@seealso{cellstr, iscellstr, setfield}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 2)
-    {
-      octave_map m = args(0).map_value ();
-
-      octave_value_list fval = Fcellstr (args(1), 1);
-
-      if (! error_state)
-        {
-          Cell fcell = fval(0).cell_value ();
-
-          for (int i = 0; i < fcell.numel (); i++)
-            {
-              std::string key = fcell(i).string_value ();
-
-              if (m.isfield (key))
-                m.rmfield (key);
-              else
-                {
-                  error ("rmfield: structure does not contain field %s",
-                         key.c_str ());
-
-                  break;
-                }
-            }
-
-          if (! error_state)
-            retval = m;
-        }
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-## test rmfield
-%!test
-%! x(3).d=1;  x(2).a=2;  x(1).b=3;  x(2).c=3;  x(6).f="abc123";
-%! y = rmfield (x, {"a", "f"});
-%! assert (fieldnames (y), {"d"; "b"; "c"});
-%! assert (size (y), [1, 6]);
-*/
-
-DEFUN (struct_levels_to_print, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} struct_levels_to_print ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} struct_levels_to_print (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} struct_levels_to_print (@var{new_val}, \"local\")\n\
-Query or set the internal variable that specifies the number of\n\
-structure levels to display.\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE_WITH_LIMITS (struct_levels_to_print,
-                                            -1, INT_MAX);
-}
-
-DEFUN (print_struct_array_contents, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} print_struct_array_contents ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} print_struct_array_contents (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} print_struct_array_contents (@var{new_val}, \"local\")\n\
-Query or set the internal variable that specifies whether to print struct\n\
-array contents.  If true, values of struct array elements are printed.\n\
-This variable does not affect scalar structures.  Their elements\n\
-are always printed.  In both cases, however, printing will be limited to\n\
-the number of levels specified by @var{struct_levels_to_print}.\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE (print_struct_array_contents);
-}
--- a/src/ov-struct.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,289 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_struct_h)
-#define octave_struct_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-
-#include "mx-base.h"
-#include "str-vec.h"
-
-#include "error.h"
-#include "oct-alloc.h"
-#include "oct-map.h"
-#include "ov-base.h"
-#include "ov-typeinfo.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-// Data structures.
-
-class
-octave_struct : public octave_base_value
-{
-public:
-
-  octave_struct (void)
-    : octave_base_value (), map () { }
-
-  octave_struct (const octave_map& m)
-    : octave_base_value (), map (m) { }
-
-  octave_struct (const octave_struct& s)
-    : octave_base_value (), map (s.map) { }
-
-  ~octave_struct (void) { }
-
-  octave_base_value *clone (void) const { return new octave_struct (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_struct (); }
-
-  octave_base_value *try_narrowing_conversion (void);
-
-  Cell dotref (const octave_value_list& idx, bool auto_add = false);
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    {
-      octave_value_list tmp = subsref (type, idx, 1);
-      return tmp.length () > 0 ? tmp(0) : octave_value ();
-    }
-
-  octave_value_list subsref (const std::string&,
-                             const std::list<octave_value_list>&, int);
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx,
-                        bool auto_add);
-
-  static octave_value numeric_conv (const octave_value& val,
-                                    const std::string& type);
-
-  octave_value subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs);
-
-  octave_value squeeze (void) const { return map.squeeze (); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return map.permute (vec, inv); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  dim_vector dims (void) const { return map.dims (); }
-
-  size_t byte_size (void) const;
-
-  // This is the number of elements in each field.  The total number
-  // of elements is numel () * nfields ().
-  octave_idx_type numel (void) const
-  {
-    return map.numel ();
-  }
-
-  octave_idx_type nfields (void) const { return map.nfields (); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return map.reshape (new_dims); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const
-    { octave_map tmap = map; tmap.resize (dv, fill); return tmap; }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_map (void) const { return true; }
-
-  builtin_type_t builtin_type (void) const { return btyp_struct; }
-
-  octave_map map_value (void) const { return map; }
-
-  string_vector map_keys (void) const { return map.fieldnames (); }
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool print_name_tag (std::ostream& os, const std::string& name) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  mxArray *as_mxArray (void) const;
-
-  octave_value
-  fast_elem_extract (octave_idx_type n) const;
-
-  bool
-  fast_elem_insert (octave_idx_type n, const octave_value& x);
-
-protected:
-
-  // The associative array used to manage the structure data.
-  octave_map map;
-
-private:
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-class
-octave_scalar_struct : public octave_base_value
-{
-public:
-
-  octave_scalar_struct (void)
-    : octave_base_value (), map () { }
-
-  octave_scalar_struct (const octave_scalar_map& m)
-    : octave_base_value (), map (m) { }
-
-  octave_scalar_struct (const octave_scalar_struct& s)
-    : octave_base_value (), map (s.map) { }
-
-  ~octave_scalar_struct (void) { }
-
-  octave_base_value *clone (void) const { return new octave_scalar_struct (*this); }
-  octave_base_value *empty_clone (void) const { return new octave_scalar_struct (); }
-
-  octave_value dotref (const octave_value_list& idx, bool auto_add = false);
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx, int);
-
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx,
-                        bool auto_add);
-
-  static octave_value numeric_conv (const octave_value& val,
-                                    const std::string& type);
-
-  octave_value subsasgn (const std::string& type,
-                         const std::list<octave_value_list>& idx,
-                         const octave_value& rhs);
-
-  octave_value squeeze (void) const { return map; }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return octave_map (map).permute (vec, inv); }
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false);
-
-  dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; }
-
-  size_t byte_size (void) const;
-
-  // This is the number of elements in each field.  The total number
-  // of elements is numel () * nfields ().
-  octave_idx_type numel (void) const
-  {
-    return 1;
-  }
-
-  octave_idx_type nfields (void) const { return map.nfields (); }
-
-  octave_value reshape (const dim_vector& new_dims) const
-    { return octave_map (map).reshape (new_dims); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const
-    { octave_map tmap = map; tmap.resize (dv, fill); return tmap; }
-
-  bool is_defined (void) const { return true; }
-
-  bool is_constant (void) const { return true; }
-
-  bool is_map (void) const { return true; }
-
-  builtin_type_t builtin_type (void) const { return btyp_struct; }
-
-  octave_map map_value (void) const { return map; }
-
-  octave_scalar_map scalar_map_value (void) const { return map; }
-
-  string_vector map_keys (void) const { return map.fieldnames (); }
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
-
-  bool print_name_tag (std::ostream& os, const std::string& name) const;
-
-  bool save_ascii (std::ostream& os);
-
-  bool load_ascii (std::istream& is);
-
-  bool save_binary (std::ostream& os, bool& save_as_floats);
-
-  bool load_binary (std::istream& is, bool swap,
-                    oct_mach_info::float_format fmt);
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
-
-  bool load_hdf5 (hid_t loc_id, const char *name);
-#endif
-
-  mxArray *as_mxArray (void) const;
-
-  bool fast_elem_insert_self (void *where, builtin_type_t btyp) const;
-
-protected:
-
-  // The associative array used to manage the structure data.
-  octave_scalar_map map;
-
-private:
-
-  octave_value to_array (void);
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov-type-conv.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_ov_type_conv_h)
-#define octave_ov_type_conv_h 1
-
-static
-octave_value
-octave_type_conv_body (const octave_value &arg, const std::string& name, int t_result)
-{
-  int t_arg = arg.type_id ();
-  octave_value retval;
-
-  if (t_arg == t_result || arg.class_name () == name)
-    {
-      retval = arg;
-    }
-  else
-    {
-      octave_base_value::type_conv_fcn cf1
-        = octave_value_typeinfo::lookup_type_conv_op (t_arg, t_result);
-
-      if (cf1)
-        {
-          octave_base_value *tmp (cf1 (*(arg.internal_rep ())));
-
-          if (tmp)
-            {
-              retval = octave_value (tmp);
-
-              retval.maybe_mutate ();
-            }
-        }
-      else
-        {
-          octave_base_value::type_conv_fcn cf2
-            = arg.numeric_conversion_function ();
-
-          if (cf2)
-            {
-              octave_base_value *tmp (cf2 (*(arg.internal_rep ())));
-
-              if (tmp)
-                {
-                  octave_value xarg (tmp);
-
-                  retval = octave_type_conv_body (xarg, name, t_result);
-                }
-            }
-        }
-    }
-
-  return retval;
-}
-
-
-#define OCTAVE_TYPE_CONV_BODY3(NAME, MATRIX_RESULT_T, SCALAR_RESULT_T) \
- \
-  octave_value retval; \
- \
-  int nargin = args.length (); \
- \
-  if (nargin == 1) \
-    { \
-      const octave_value arg = args(0); \
- \
-      int t_result = MATRIX_RESULT_T::static_type_id (); \
- \
-      retval = octave_type_conv_body (arg, #NAME, t_result); \
-      if (retval.is_undefined ()) \
-        { \
-          std::string arg_tname = arg.type_name (); \
- \
-          std::string result_tname = arg.numel () == 1 \
-            ? SCALAR_RESULT_T::static_type_name () \
-            : MATRIX_RESULT_T::static_type_name (); \
- \
-          gripe_invalid_conversion (arg_tname, result_tname); \
-        } \
-    } \
-  else \
-    print_usage (); \
- \
-  return retval
-
-#define OCTAVE_TYPE_CONV_BODY(NAME) \
-  OCTAVE_TYPE_CONV_BODY3 (NAME, octave_ ## NAME ## _matrix, \
-                          octave_ ## NAME ## _scalar)
-
-#endif
--- a/src/ov-typeinfo.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,707 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Array.h"
-#include "singleton-cleanup.h"
-
-#include "defun.h"
-#include "error.h"
-#include "ov-typeinfo.h"
-
-const int
-octave_value_typeinfo::init_tab_sz (16);
-
-octave_value_typeinfo *
-octave_value_typeinfo::instance (0);
-
-bool
-octave_value_typeinfo::instance_ok (void)
-{
-  bool retval = true;
-
-  if (! instance)
-    {
-      instance = new octave_value_typeinfo ();
-
-      if (instance)
-        singleton_cleanup_list::add (cleanup_instance);
-    }
-
-  if (! instance)
-    {
-      ::error ("unable to create value type info object!");
-
-      retval = false;
-    }
-
-  return retval;
-}
-
-int
-octave_value_typeinfo::register_type (const std::string& t_name,
-                                      const std::string& c_name,
-                                      const octave_value& val)
-{
-  return (instance_ok ())
-    ? instance->do_register_type (t_name, c_name, val) : -1;
-}
-
-bool
-octave_value_typeinfo::register_unary_class_op (octave_value::unary_op op,
-                                                octave_value_typeinfo::unary_class_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_unary_class_op (op, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_unary_op (octave_value::unary_op op,
-                                           int t, octave_value_typeinfo::unary_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_unary_op (op, t, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_non_const_unary_op (octave_value::unary_op op,
-                                                    int t,
-                                                    octave_value_typeinfo::non_const_unary_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_non_const_unary_op (op, t, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_binary_class_op (octave_value::binary_op op,
-                                                 octave_value_typeinfo::binary_class_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_binary_class_op (op, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_binary_op (octave_value::binary_op op,
-                                           int t1, int t2,
-                                           octave_value_typeinfo::binary_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_binary_op (op, t1, t2, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_binary_class_op (octave_value::compound_binary_op op,
-                                                 octave_value_typeinfo::binary_class_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_binary_class_op (op, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_binary_op (octave_value::compound_binary_op op,
-                                           int t1, int t2,
-                                           octave_value_typeinfo::binary_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_binary_op (op, t1, t2, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_cat_op (int t1, int t2, octave_value_typeinfo::cat_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_cat_op (t1, t2, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_assign_op (octave_value::assign_op op,
-                                           int t_lhs, int t_rhs,
-                                           octave_value_typeinfo::assign_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_assign_op (op, t_lhs, t_rhs, f) : -1;
-}
-
-bool
-octave_value_typeinfo::register_assignany_op (octave_value::assign_op op,
-                                              int t_lhs, octave_value_typeinfo::assignany_op_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_assignany_op (op, t_lhs, f) : -1;
-}
-
-bool
-octave_value_typeinfo::register_pref_assign_conv (int t_lhs, int t_rhs,
-                                                  int t_result)
-{
-  return (instance_ok ())
-    ? instance->do_register_pref_assign_conv (t_lhs, t_rhs, t_result) : false;
-}
-
-bool
-octave_value_typeinfo::register_type_conv_op (int t, int t_result,
-                                              octave_base_value::type_conv_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_type_conv_op (t, t_result, f) : false;
-}
-
-bool
-octave_value_typeinfo::register_widening_op (int t, int t_result,
-                                             octave_base_value::type_conv_fcn f)
-{
-  return (instance_ok ())
-    ? instance->do_register_widening_op (t, t_result, f) : false;
-}
-
-// FIXME -- we should also store all class names and provide a
-// way to list them (calling class with nargin == 0?).
-
-int
-octave_value_typeinfo::do_register_type (const std::string& t_name,
-                                         const std::string& /* c_name */,
-                                         const octave_value& val)
-{
-  int i = 0;
-
-  for (i = 0; i < num_types; i++)
-    if (t_name == types (i))
-      return i;
-
-  int len = types.length ();
-
-  if (i == len)
-    {
-      len *= 2;
-
-      types.resize (dim_vector (len, 1), std::string ());
-
-      vals.resize (dim_vector (len, 1), octave_value ());
-
-      unary_ops.resize (dim_vector (octave_value::num_unary_ops, len), 0);
-
-      non_const_unary_ops.resize
-        (dim_vector (octave_value::num_unary_ops, len), 0);
-
-      binary_ops.resize
-        (dim_vector (octave_value::num_binary_ops, len, len), 0);
-
-      compound_binary_ops.resize
-        (dim_vector (octave_value::num_compound_binary_ops, len, len), 0);
-
-      cat_ops.resize (dim_vector (len, len), 0);
-
-      assign_ops.resize
-        (dim_vector (octave_value::num_assign_ops, len, len), 0);
-
-      assignany_ops.resize
-        (dim_vector (octave_value::num_assign_ops, len), 0);
-
-      pref_assign_conv.resize (dim_vector (len, len), -1);
-
-      type_conv_ops.resize (dim_vector (len, len), 0);
-
-      widening_ops.resize (dim_vector (len, len), 0);
-    }
-
-  types (i) = t_name;
-
-  vals (i) = val;
-
-  num_types++;
-
-  return i;
-}
-
-bool
-octave_value_typeinfo::do_register_unary_class_op (octave_value::unary_op op,
-                                                   octave_value_typeinfo::unary_class_op_fcn f)
-{
-  if (lookup_unary_class_op (op))
-    {
-      std::string op_name = octave_value::unary_op_as_string (op);
-
-      warning ("duplicate unary operator `%s' for class dispatch",
-               op_name.c_str ());
-    }
-
-  unary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_unary_op (octave_value::unary_op op,
-                                             int t, octave_value_typeinfo::unary_op_fcn f)
-{
-  if (lookup_unary_op (op, t))
-    {
-      std::string op_name = octave_value::unary_op_as_string (op);
-      std::string type_name = types(t);
-
-      warning ("duplicate unary operator `%s' for type `%s'",
-               op_name.c_str (), type_name.c_str ());
-    }
-
-  unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_non_const_unary_op
-  (octave_value::unary_op op, int t, octave_value_typeinfo::non_const_unary_op_fcn f)
-{
-  if (lookup_non_const_unary_op (op, t))
-    {
-      std::string op_name = octave_value::unary_op_as_string (op);
-      std::string type_name = types(t);
-
-      warning ("duplicate unary operator `%s' for type `%s'",
-               op_name.c_str (), type_name.c_str ());
-    }
-
-  non_const_unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_binary_class_op (octave_value::binary_op op,
-                                                    octave_value_typeinfo::binary_class_op_fcn f)
-{
-  if (lookup_binary_class_op (op))
-    {
-      std::string op_name = octave_value::binary_op_as_string (op);
-
-      warning ("duplicate binary operator `%s' for class dispatch",
-               op_name.c_str ());
-    }
-
-  binary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_binary_op (octave_value::binary_op op,
-                                              int t1, int t2,
-                                              octave_value_typeinfo::binary_op_fcn f)
-{
-  if (lookup_binary_op (op, t1, t2))
-    {
-      std::string op_name = octave_value::binary_op_as_string (op);
-      std::string t1_name = types(t1);
-      std::string t2_name = types(t2);
-
-      warning ("duplicate binary operator `%s' for types `%s' and `%s'",
-               op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
-    }
-
-  binary_ops.checkelem (static_cast<int> (op), t1, t2) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_binary_class_op (octave_value::compound_binary_op op,
-                                                    octave_value_typeinfo::binary_class_op_fcn f)
-{
-  if (lookup_binary_class_op (op))
-    {
-      std::string op_name = octave_value::binary_op_fcn_name (op);
-
-      warning ("duplicate compound binary operator `%s' for class dispatch",
-               op_name.c_str ());
-    }
-
-  compound_binary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_binary_op (octave_value::compound_binary_op op,
-                                              int t1, int t2,
-                                              octave_value_typeinfo::binary_op_fcn f)
-{
-  if (lookup_binary_op (op, t1, t2))
-    {
-      std::string op_name = octave_value::binary_op_fcn_name (op);
-      std::string t1_name = types(t1);
-      std::string t2_name = types(t2);
-
-      warning ("duplicate compound binary operator `%s' for types `%s' and `%s'",
-               op_name.c_str (), t1_name.c_str (), t1_name.c_str ());
-    }
-
-  compound_binary_ops.checkelem (static_cast<int> (op), t1, t2) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_cat_op (int t1, int t2, octave_value_typeinfo::cat_op_fcn f)
-{
-  if (lookup_cat_op (t1, t2))
-    {
-      std::string t1_name = types(t1);
-      std::string t2_name = types(t2);
-
-      warning ("duplicate concatenation operator for types `%s' and `%s'",
-               t1_name.c_str (), t1_name.c_str ());
-    }
-
-  cat_ops.checkelem (t1, t2) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_assign_op (octave_value::assign_op op,
-                                              int t_lhs, int t_rhs,
-                                              octave_value_typeinfo::assign_op_fcn f)
-{
-  if (lookup_assign_op (op, t_lhs, t_rhs))
-    {
-      std::string op_name = octave_value::assign_op_as_string (op);
-      std::string t_lhs_name = types(t_lhs);
-      std::string t_rhs_name = types(t_rhs);
-
-      warning ("duplicate assignment operator `%s' for types `%s' and `%s'",
-               op_name.c_str (), t_lhs_name.c_str (), t_rhs_name.c_str ());
-    }
-
-  assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_assignany_op (octave_value::assign_op op,
-                                                 int t_lhs, octave_value_typeinfo::assignany_op_fcn f)
-{
-  if (lookup_assignany_op (op, t_lhs))
-    {
-      std::string op_name = octave_value::assign_op_as_string (op);
-      std::string t_lhs_name = types(t_lhs);
-
-      warning ("duplicate assignment operator `%s' for types `%s'",
-               op_name.c_str (), t_lhs_name.c_str ());
-    }
-
-  assignany_ops.checkelem (static_cast<int> (op), t_lhs) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_pref_assign_conv (int t_lhs, int t_rhs,
-                                                     int t_result)
-{
-  if (lookup_pref_assign_conv (t_lhs, t_rhs) >= 0)
-    {
-      std::string t_lhs_name = types(t_lhs);
-      std::string t_rhs_name = types(t_rhs);
-
-      warning ("overriding assignment conversion for types `%s' and `%s'",
-               t_lhs_name.c_str (), t_rhs_name.c_str ());
-    }
-
-  pref_assign_conv.checkelem (t_lhs, t_rhs) = t_result;
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_type_conv_op
-  (int t, int t_result, octave_base_value::type_conv_fcn f)
-{
-  if (lookup_type_conv_op (t, t_result))
-    {
-      std::string t_name = types(t);
-      std::string t_result_name = types(t_result);
-
-      warning ("overriding type conversion op for `%s' to `%s'",
-               t_name.c_str (), t_result_name.c_str ());
-    }
-
-  type_conv_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-bool
-octave_value_typeinfo::do_register_widening_op
-  (int t, int t_result, octave_base_value::type_conv_fcn f)
-{
-  if (lookup_widening_op (t, t_result))
-    {
-      std::string t_name = types(t);
-      std::string t_result_name = types(t_result);
-
-      warning ("overriding widening op for `%s' to `%s'",
-               t_name.c_str (), t_result_name.c_str ());
-    }
-
-  widening_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f);
-
-  return false;
-}
-
-octave_value
-octave_value_typeinfo::do_lookup_type (const std::string& nm)
-{
-  octave_value retval;
-
-  for (int i = 0; i < num_types; i++)
-    {
-      if (nm == types(i))
-        {
-          retval = vals(i);
-          retval.make_unique ();
-          break;
-        }
-    }
-
-  return retval;
-}
-
-octave_value_typeinfo::unary_class_op_fcn
-octave_value_typeinfo::do_lookup_unary_class_op (octave_value::unary_op op)
-{
-  void *f = unary_class_ops.checkelem (static_cast<int> (op));
-  return reinterpret_cast<octave_value_typeinfo::unary_class_op_fcn> (f);
-}
-
-octave_value_typeinfo::unary_op_fcn
-octave_value_typeinfo::do_lookup_unary_op (octave_value::unary_op op, int t)
-{
-  void *f = unary_ops.checkelem (static_cast<int> (op), t);
-  return reinterpret_cast<octave_value_typeinfo::unary_op_fcn> (f);
-}
-
-octave_value_typeinfo::non_const_unary_op_fcn
-octave_value_typeinfo::do_lookup_non_const_unary_op
-  (octave_value::unary_op op, int t)
-{
-  void *f = non_const_unary_ops.checkelem (static_cast<int> (op), t);
-  return reinterpret_cast<octave_value_typeinfo::non_const_unary_op_fcn> (f);
-}
-
-octave_value_typeinfo::binary_class_op_fcn
-octave_value_typeinfo::do_lookup_binary_class_op (octave_value::binary_op op)
-{
-  void *f = binary_class_ops.checkelem (static_cast<int> (op));
-  return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f);
-}
-
-octave_value_typeinfo::binary_op_fcn
-octave_value_typeinfo::do_lookup_binary_op (octave_value::binary_op op,
-                                            int t1, int t2)
-{
-  void *f = binary_ops.checkelem (static_cast<int> (op), t1, t2);
-  return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f);
-}
-
-octave_value_typeinfo::binary_class_op_fcn
-octave_value_typeinfo::do_lookup_binary_class_op (octave_value::compound_binary_op op)
-{
-  void *f = compound_binary_class_ops.checkelem (static_cast<int> (op));
-  return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f);
-}
-
-octave_value_typeinfo::binary_op_fcn
-octave_value_typeinfo::do_lookup_binary_op (octave_value::compound_binary_op op,
-                                            int t1, int t2)
-{
-  void *f = compound_binary_ops.checkelem (static_cast<int> (op), t1, t2);
-  return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f);
-}
-
-octave_value_typeinfo::cat_op_fcn
-octave_value_typeinfo::do_lookup_cat_op (int t1, int t2)
-{
-  void *f = cat_ops.checkelem (t1, t2);
-  return reinterpret_cast<octave_value_typeinfo::cat_op_fcn> (f);
-}
-
-octave_value_typeinfo::assign_op_fcn
-octave_value_typeinfo::do_lookup_assign_op (octave_value::assign_op op,
-                                            int t_lhs, int t_rhs)
-{
-  void *f = assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs);
-  return reinterpret_cast<octave_value_typeinfo::assign_op_fcn> (f);
-}
-
-octave_value_typeinfo::assignany_op_fcn
-octave_value_typeinfo::do_lookup_assignany_op (octave_value::assign_op op,
-                                               int t_lhs)
-{
-  void *f = assignany_ops.checkelem (static_cast<int> (op), t_lhs);
-  return reinterpret_cast<octave_value_typeinfo::assignany_op_fcn> (f);
-}
-
-int
-octave_value_typeinfo::do_lookup_pref_assign_conv (int t_lhs, int t_rhs)
-{
-  return pref_assign_conv.checkelem (t_lhs, t_rhs);
-}
-
-octave_base_value::type_conv_fcn
-octave_value_typeinfo::do_lookup_type_conv_op (int t, int t_result)
-{
-  void *f = type_conv_ops.checkelem (t, t_result);
-  return reinterpret_cast<octave_base_value::type_conv_fcn> (f);
-}
-
-octave_base_value::type_conv_fcn
-octave_value_typeinfo::do_lookup_widening_op (int t, int t_result)
-{
-  void *f = widening_ops.checkelem (t, t_result);
-  return reinterpret_cast<octave_base_value::type_conv_fcn> (f);
-}
-
-string_vector
-octave_value_typeinfo::do_installed_type_names (void)
-{
-  string_vector retval (num_types);
-
-  for (int i = 0; i < num_types; i++)
-    retval(i) = types(i);
-
-  return retval;
-}
-
-DEFUN (typeinfo, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} typeinfo ()\n\
-@deftypefnx {Built-in Function} {} typeinfo (@var{expr})\n\
-\n\
-Return the type of the expression @var{expr}, as a string.  If\n\
-@var{expr} is omitted, return an cell array of strings containing all the\n\
-currently installed data types.\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 0)
-    retval = Cell (octave_value_typeinfo::installed_type_names ());
-  else if (nargin == 1)
-    retval = args(0).type_name ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!assert (iscellstr (typeinfo ()))
-
-%!assert (typeinfo ({"cell"}), "cell")
-
-%!assert (typeinfo (1), "scalar")
-%!assert (typeinfo (double (1)), "scalar")
-%!assert (typeinfo (i), "complex scalar")
-
-%!assert (typeinfo ([1, 2]), "matrix")
-%!assert (typeinfo (double ([1, 2])), "matrix")
-%!assert (typeinfo (diag ([1, 2])), "diagonal matrix")
-%!assert (typeinfo ([i, 2]), "complex matrix")
-%!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix")
-
-%!assert (typeinfo (1:2), "range")
-
-%!assert (typeinfo (false), "bool")
-%!assert (typeinfo ([true, false]), "bool matrix")
-
-%!assert (typeinfo ("string"), "string")
-%!assert (typeinfo ('string'), "sq_string")
-
-%!assert (typeinfo (int8 (1)), "int8 scalar")
-%!assert (typeinfo (int16 (1)), "int16 scalar")
-%!assert (typeinfo (int32 (1)), "int32 scalar")
-%!assert (typeinfo (int64 (1)), "int64 scalar")
-%!assert (typeinfo (uint8 (1)), "uint8 scalar")
-%!assert (typeinfo (uint16 (1)), "uint16 scalar")
-%!assert (typeinfo (uint32 (1)), "uint32 scalar")
-%!assert (typeinfo (uint64 (1)), "uint64 scalar")
-
-%!assert (typeinfo (int8 ([1,2])), "int8 matrix")
-%!assert (typeinfo (int16 ([1,2])), "int16 matrix")
-%!assert (typeinfo (int32 ([1,2])), "int32 matrix")
-%!assert (typeinfo (int64 ([1,2])), "int64 matrix")
-%!assert (typeinfo (uint8 ([1,2])), "uint8 matrix")
-%!assert (typeinfo (uint16 ([1,2])), "uint16 matrix")
-%!assert (typeinfo (uint32 ([1,2])), "uint32 matrix")
-%!assert (typeinfo (uint64 ([1,2])), "uint64 matrix")
-
-%!assert (typeinfo (sparse ([true, false])), "sparse bool matrix")
-%!assert (typeinfo (logical (sparse (i * eye (10)))), "sparse bool matrix")
-%!assert (typeinfo (sparse ([1,2])), "sparse matrix")
-%!assert (typeinfo (sparse (eye (10))), "sparse matrix")
-%!assert (typeinfo (sparse ([i,2])), "sparse complex matrix")
-%!assert (typeinfo (sparse (i * eye (10))), "sparse complex matrix")
-
-%!test
-%! s(2).a = 1;
-%! assert (typeinfo (s), "struct");
-
-%!test
-%! s.a = 1;
-%! assert (typeinfo (s), "scalar struct");
-
-## FIXME: This doesn't work as a test for comma-separated list
-%!#test
-%! clist = {1, 2, 3};
-%! assert (typeinfo (clist{:}), "cs-list");
-
-%!assert (typeinfo (@sin), "function handle")
-%!assert (typeinfo (@(x) x), "function handle")
-
-%!assert (typeinfo (inline ("x^2")), "inline function")
-
-%!assert (typeinfo (single (1)), "float scalar")
-%!assert (typeinfo (single (i)), "float complex scalar")
-%!assert (typeinfo (single ([1, 2])), "float matrix")
-
-%!assert (typeinfo (single (diag ([1, 2]))), "float diagonal matrix")
-%!assert (typeinfo (diag (single ([1, 2]))), "float diagonal matrix")
-%!assert (typeinfo (single (diag ([i, 2]))), "float complex diagonal matrix")
-%!assert (typeinfo (diag (single ([i, 2]))), "float complex diagonal matrix")
-
-%!assert (typeinfo (eye(3)(:,[1 3 2])), "permutation matrix")
-%!test
-%! [l, u, p] = lu (rand (3));
-%! assert (typeinfo (p), "permutation matrix");
-
-%!assert (typeinfo ([]), "null_matrix")
-%!assert (typeinfo (""), "null_string")
-%!assert (typeinfo (''), "null_sq_string")
-
-%!error typeinfo ("foo", 1)
-*/
--- a/src/ov-typeinfo.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,327 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_value_typeinfo_h)
-#define octave_value_typeinfo_h 1
-
-#include <string>
-
-#include "Array.h"
-
-#include "ov.h"
-
-class string_vector;
-
-class
-OCTINTERP_API
-octave_value_typeinfo
-{
-public:
-
-  typedef octave_value (*unary_class_op_fcn) (const octave_value&);
-
-  typedef octave_value (*unary_op_fcn) (const octave_base_value&);
-
-  typedef void (*non_const_unary_op_fcn) (octave_base_value&);
-
-  typedef octave_value (*binary_class_op_fcn)
-    (const octave_value&, const octave_value&);
-
-  typedef octave_value (*binary_op_fcn)
-    (const octave_base_value&, const octave_base_value&);
-
-  typedef octave_value (*cat_op_fcn)
-    (octave_base_value&, const octave_base_value&,
-     const Array<octave_idx_type>& ra_idx);
-
-  typedef octave_value (*assign_op_fcn)
-    (octave_base_value&, const octave_value_list&, const octave_base_value&);
-
-  typedef octave_value (*assignany_op_fcn)
-    (octave_base_value&, const octave_value_list&, const octave_value&);
-
-  static bool instance_ok (void);
-
-  static int register_type (const std::string&, const std::string&,
-                            const octave_value&);
-
-  static bool register_unary_class_op (octave_value::unary_op,
-                                       unary_class_op_fcn);
-
-  static bool register_unary_op (octave_value::unary_op, int, unary_op_fcn);
-
-  static bool register_non_const_unary_op (octave_value::unary_op, int,
-                                           non_const_unary_op_fcn);
-
-  static bool register_binary_class_op (octave_value::binary_op,
-                                        binary_class_op_fcn);
-
-  static bool register_binary_op (octave_value::binary_op, int, int,
-                                  binary_op_fcn);
-
-  static bool register_binary_class_op (octave_value::compound_binary_op,
-                                        binary_class_op_fcn);
-
-  static bool register_binary_op (octave_value::compound_binary_op, int, int,
-                                  binary_op_fcn);
-
-  static bool register_cat_op (int, int, cat_op_fcn);
-
-  static bool register_assign_op (octave_value::assign_op, int, int,
-                                  assign_op_fcn);
-
-  static bool register_assignany_op (octave_value::assign_op, int,
-                                     assignany_op_fcn);
-
-  static bool register_pref_assign_conv (int, int, int);
-
-  static bool
-  register_type_conv_op (int, int, octave_base_value::type_conv_fcn);
-
-  static bool
-  register_widening_op (int, int, octave_base_value::type_conv_fcn);
-
-  static octave_value
-  lookup_type (const std::string& nm)
-  {
-    return instance->do_lookup_type (nm);
-  }
-
-  static unary_class_op_fcn
-  lookup_unary_class_op (octave_value::unary_op op)
-  {
-    return instance->do_lookup_unary_class_op (op);
-  }
-
-  static unary_op_fcn
-  lookup_unary_op (octave_value::unary_op op, int t)
-  {
-    return instance->do_lookup_unary_op (op, t);
-  }
-
-  static non_const_unary_op_fcn
-  lookup_non_const_unary_op (octave_value::unary_op op, int t)
-  {
-    return instance->do_lookup_non_const_unary_op (op, t);
-  }
-
-  static binary_class_op_fcn
-  lookup_binary_class_op (octave_value::binary_op op)
-  {
-    return instance->do_lookup_binary_class_op (op);
-  }
-
-  static binary_op_fcn
-  lookup_binary_op (octave_value::binary_op op, int t1, int t2)
-  {
-    return instance->do_lookup_binary_op (op, t1, t2);
-  }
-
-  static binary_class_op_fcn
-  lookup_binary_class_op (octave_value::compound_binary_op op)
-  {
-    return instance->do_lookup_binary_class_op (op);
-  }
-
-  static binary_op_fcn
-  lookup_binary_op (octave_value::compound_binary_op op, int t1, int t2)
-  {
-    return instance->do_lookup_binary_op (op, t1, t2);
-  }
-
-  static cat_op_fcn
-  lookup_cat_op (int t1, int t2)
-  {
-    return instance->do_lookup_cat_op (t1, t2);
-  }
-
-  static assign_op_fcn
-  lookup_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs)
-  {
-    return instance->do_lookup_assign_op (op, t_lhs, t_rhs);
-  }
-
-  static assignany_op_fcn
-  lookup_assignany_op (octave_value::assign_op op, int t_lhs)
-  {
-    return instance->do_lookup_assignany_op (op, t_lhs);
-  }
-
-  static int
-  lookup_pref_assign_conv (int t_lhs, int t_rhs)
-  {
-    return instance->do_lookup_pref_assign_conv (t_lhs, t_rhs);
-  }
-
-  static octave_base_value::type_conv_fcn
-  lookup_type_conv_op (int t, int t_result)
-  {
-    return instance->do_lookup_type_conv_op (t, t_result);
-  }
-
-  static octave_base_value::type_conv_fcn
-  lookup_widening_op (int t, int t_result)
-  {
-    return instance->do_lookup_widening_op (t, t_result);
-  }
-
-  static string_vector installed_type_names (void)
-  {
-    return instance->do_installed_type_names ();
-  }
-
-protected:
-
-  octave_value_typeinfo (void)
-    : num_types (0), types (dim_vector (init_tab_sz, 1), std::string ()),
-      vals (dim_vector (init_tab_sz, 1)),
-      unary_class_ops (dim_vector (octave_value::num_unary_ops, 1), 0),
-      unary_ops (dim_vector (octave_value::num_unary_ops, init_tab_sz), 0),
-      non_const_unary_ops (dim_vector (octave_value::num_unary_ops, init_tab_sz), 0),
-      binary_class_ops (dim_vector (octave_value::num_binary_ops, 1), 0),
-      binary_ops (dim_vector (octave_value::num_binary_ops, init_tab_sz, init_tab_sz), 0),
-      compound_binary_class_ops (dim_vector (octave_value::num_compound_binary_ops, 1), 0),
-      compound_binary_ops (dim_vector (octave_value::num_compound_binary_ops, init_tab_sz, init_tab_sz), 0),
-      cat_ops (dim_vector (init_tab_sz, init_tab_sz), 0),
-      assign_ops (dim_vector (octave_value::num_assign_ops, init_tab_sz, init_tab_sz), 0),
-      assignany_ops (dim_vector (octave_value::num_assign_ops, init_tab_sz), 0),
-      pref_assign_conv (dim_vector (init_tab_sz, init_tab_sz), -1),
-      type_conv_ops (dim_vector (init_tab_sz, init_tab_sz), 0),
-      widening_ops (dim_vector (init_tab_sz, init_tab_sz), 0)  { }
-
-  ~octave_value_typeinfo (void) { }
-
-private:
-
-  static const int init_tab_sz;
-
-  static octave_value_typeinfo *instance;
-
-  static void cleanup_instance (void) { delete instance; instance = 0; }
-
-  int num_types;
-
-  Array<std::string> types;
-
-  Array<octave_value> vals;
-
-  Array<void *> unary_class_ops;
-
-  Array<void *> unary_ops;
-
-  Array<void *> non_const_unary_ops;
-
-  Array<void *> binary_class_ops;
-
-  Array<void *> binary_ops;
-
-  Array<void *> compound_binary_class_ops;
-
-  Array<void *> compound_binary_ops;
-
-  Array<void *> cat_ops;
-
-  Array<void *> assign_ops;
-
-  Array<void *> assignany_ops;
-
-  Array<int> pref_assign_conv;
-
-  Array<void *> type_conv_ops;
-
-  Array<void *> widening_ops;
-
-  int do_register_type (const std::string&, const std::string&,
-                        const octave_value&);
-
-  bool do_register_unary_class_op (octave_value::unary_op, unary_class_op_fcn);
-
-  bool do_register_unary_op (octave_value::unary_op, int, unary_op_fcn);
-
-  bool do_register_non_const_unary_op (octave_value::unary_op, int,
-                                       non_const_unary_op_fcn);
-
-  bool do_register_binary_class_op (octave_value::binary_op,
-                                    binary_class_op_fcn);
-
-  bool do_register_binary_op (octave_value::binary_op, int, int,
-                              binary_op_fcn);
-
-  bool do_register_binary_class_op (octave_value::compound_binary_op,
-                                    binary_class_op_fcn);
-
-  bool do_register_binary_op (octave_value::compound_binary_op, int, int,
-                              binary_op_fcn);
-
-  bool do_register_cat_op (int, int, cat_op_fcn);
-
-  bool do_register_assign_op (octave_value::assign_op, int, int,
-                              assign_op_fcn);
-
-  bool do_register_assignany_op (octave_value::assign_op, int,
-                                 assignany_op_fcn);
-
-  bool do_register_pref_assign_conv (int, int, int);
-
-  bool do_register_type_conv_op (int, int, octave_base_value::type_conv_fcn);
-
-  bool do_register_widening_op (int, int, octave_base_value::type_conv_fcn);
-
-  octave_value do_lookup_type (const std::string& nm);
-
-  unary_class_op_fcn do_lookup_unary_class_op (octave_value::unary_op);
-
-  unary_op_fcn do_lookup_unary_op (octave_value::unary_op, int);
-
-  non_const_unary_op_fcn do_lookup_non_const_unary_op
-    (octave_value::unary_op, int);
-
-  binary_class_op_fcn do_lookup_binary_class_op (octave_value::binary_op);
-
-  binary_op_fcn do_lookup_binary_op (octave_value::binary_op, int, int);
-
-  binary_class_op_fcn do_lookup_binary_class_op (octave_value::compound_binary_op);
-
-  binary_op_fcn do_lookup_binary_op (octave_value::compound_binary_op, int, int);
-
-  cat_op_fcn do_lookup_cat_op (int, int);
-
-  assign_op_fcn do_lookup_assign_op (octave_value::assign_op, int, int);
-
-  assignany_op_fcn do_lookup_assignany_op (octave_value::assign_op, int);
-
-  int do_lookup_pref_assign_conv (int, int);
-
-  octave_base_value::type_conv_fcn do_lookup_type_conv_op (int, int);
-
-  octave_base_value::type_conv_fcn do_lookup_widening_op (int, int);
-
-  string_vector do_installed_type_names (void);
-
-  // No copying!
-
-  octave_value_typeinfo (const octave_value_typeinfo&);
-
-  octave_value_typeinfo& operator = (const octave_value_typeinfo&);
-};
-
-#endif
--- a/src/ov-uint16.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ops.h"
-#include "ov-base.h"
-
-#ifdef HAVE_HDF5
-#define HDF5_SAVE_TYPE H5T_NATIVE_UINT16
-#endif
-
-#include "ov-base-int.h"
-#include "ov-base-int.cc"
-#include "ov-uint16.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-template class octave_base_matrix<uint16NDArray>;
-
-template class octave_base_int_matrix<uint16NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_uint16_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint16_matrix,
-                                     "uint16 matrix", "uint16");
-
-template class octave_base_scalar<octave_uint16>;
-
-template class octave_base_int_scalar<octave_uint16>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_uint16_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint16_scalar,
-                                     "uint16 scalar", "uint16");
-
-DEFUN (uint16, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} uint16 (@var{x})\n\
-Convert @var{x} to unsigned 16-bit integer type.\n\
-@end deftypefn")
-{
-  OCTAVE_TYPE_CONV_BODY (uint16);
-}
-
-/*
-%!assert (class (uint16 (1)), "uint16")
-%!assert (uint16 (1.25), uint16 (1))
-%!assert (uint16 (1.5), uint16 (2))
-%!assert (uint16 (-1.5), uint16 (0))
-%!assert (uint16 (2^17), uint16 (2^16-1))
-%!assert (uint16 (-2^17), uint16 (0))
-*/
--- a/src/ov-uint16.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_uint16_h)
-#define octave_uint16_h 1
-
-#define OCTAVE_INT_T octave_uint16
-
-#define OCTAVE_VALUE_INT_MATRIX_T octave_uint16_matrix
-#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint16_array_value
-
-#define OCTAVE_VALUE_INT_SCALAR_T octave_uint16_scalar
-#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint16_scalar_value
-
-#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint16_type
-
-#define OCTAVE_INT_MX_CLASS mxUINT16_CLASS
-
-#define OCTAVE_INT_BTYP btyp_uint16
-
-#include "ov-intx.h"
-
-#undef OCTAVE_INT_T
-
-#undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_TYPE_PREDICATE_FUNCTION
-
-#undef OCTAVE_INT_MX_CLASS
-
-#undef OCTAVE_INT_BTYP
-
-#endif
--- a/src/ov-uint32.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ops.h"
-#include "ov-base.h"
-
-#ifdef HAVE_HDF5
-#define HDF5_SAVE_TYPE H5T_NATIVE_UINT32
-#endif
-
-#include "ov-base-int.h"
-#include "ov-base-int.cc"
-#include "ov-uint32.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-template class octave_base_matrix<uint32NDArray>;
-
-template class octave_base_int_matrix<uint32NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_uint32_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint32_matrix,
-                                     "uint32 matrix", "uint32");
-
-template class octave_base_scalar<octave_uint32>;
-
-template class octave_base_int_scalar<octave_uint32>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_uint32_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint32_scalar,
-                                     "uint32 scalar", "uint32");
-
-DEFUN (uint32, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} uint32 (@var{x})\n\
-Convert @var{x} to unsigned 32-bit integer type.\n\
-@end deftypefn")
-{
-  OCTAVE_TYPE_CONV_BODY (uint32);
-}
-
-/*
-%!assert (class (uint32 (1)), "uint32")
-%!assert (uint32 (1.25), uint32 (1))
-%!assert (uint32 (1.5), uint32 (2))
-%!assert (uint32 (-1.5), uint32 (0))
-%!assert (uint32 (2^33), uint32 (2^32-1))
-%!assert (uint32 (-2^33), uint32 (0))
-*/
--- a/src/ov-uint32.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_uint32_h)
-#define octave_uint32_h 1
-
-#define OCTAVE_INT_T octave_uint32
-
-#define OCTAVE_VALUE_INT_MATRIX_T octave_uint32_matrix
-#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint32_array_value
-
-#define OCTAVE_VALUE_INT_SCALAR_T octave_uint32_scalar
-#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint32_scalar_value
-
-#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint32_type
-
-#define OCTAVE_INT_MX_CLASS mxUINT32_CLASS
-
-#define OCTAVE_INT_BTYP btyp_uint32
-
-#include "ov-intx.h"
-
-#undef OCTAVE_INT_T
-
-#undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_TYPE_PREDICATE_FUNCTION
-
-#undef OCTAVE_INT_MX_CLASS
-
-#undef OCTAVE_INT_BTYP
-
-#endif
--- a/src/ov-uint64.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ops.h"
-#include "ov-base.h"
-
-#ifdef HAVE_HDF5
-#define HDF5_SAVE_TYPE H5T_NATIVE_UINT64
-#endif
-
-#include "ov-base-int.h"
-#include "ov-base-int.cc"
-#include "ov-uint64.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-template class octave_base_matrix<uint64NDArray>;
-
-template class octave_base_int_matrix<uint64NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_uint64_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint64_matrix,
-                                     "uint64 matrix", "uint64");
-
-template class octave_base_scalar<octave_uint64>;
-
-template class octave_base_int_scalar<octave_uint64>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_uint64_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint64_scalar,
-                                     "uint64 scalar", "uint64");
-
-DEFUN (uint64, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} uint64 (@var{x})\n\
-Convert @var{x} to unsigned 64-bit integer type.\n\
-@end deftypefn")
-{
-  OCTAVE_TYPE_CONV_BODY (uint64);
-}
-
-/*
-%!assert (class (uint64 (1)), "uint64")
-%!assert (uint64 (1.25), uint64 (1))
-%!assert (uint64 (1.5), uint64 (2))
-%!assert (uint64 (-1.5), uint64 (0))
-%!assert (uint64 (2^65), uint64 (2^64-1))
-%!assert (uint64 (-2^65), uint64 (0))
-*/
--- a/src/ov-uint64.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_uint64_h)
-#define octave_uint64_h 1
-
-#define OCTAVE_INT_T octave_uint64
-
-#define OCTAVE_VALUE_INT_MATRIX_T octave_uint64_matrix
-#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint64_array_value
-
-#define OCTAVE_VALUE_INT_SCALAR_T octave_uint64_scalar
-#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint64_scalar_value
-
-#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint64_type
-
-#define OCTAVE_INT_MX_CLASS mxUINT64_CLASS
-
-#define OCTAVE_INT_BTYP btyp_uint64
-
-#include "ov-intx.h"
-
-#undef OCTAVE_INT_T
-
-#undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_TYPE_PREDICATE_FUNCTION
-
-#undef OCTAVE_INT_MX_CLASS
-
-#undef OCTAVE_INT_BTYP
-
-#endif
--- a/src/ov-uint8.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <climits>
-
-#include <iostream>
-
-#include "lo-ieee.h"
-#include "lo-utils.h"
-#include "mx-base.h"
-#include "quit.h"
-
-#include "defun.h"
-#include "gripes.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ops.h"
-#include "ov-base.h"
-
-#ifdef HAVE_HDF5
-#define HDF5_SAVE_TYPE H5T_NATIVE_UINT8
-#endif
-
-#include "ov-base-int.h"
-#include "ov-base-int.cc"
-#include "ov-uint8.h"
-#include "ov-type-conv.h"
-#include "pr-output.h"
-#include "variables.h"
-
-#include "byte-swap.h"
-#include "ls-oct-ascii.h"
-#include "ls-utils.h"
-#include "ls-hdf5.h"
-
-template class octave_base_matrix<uint8NDArray>;
-
-template class octave_base_int_matrix<uint8NDArray>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_uint8_matrix);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint8_matrix,
-                                     "uint8 matrix", "uint8");
-
-template class octave_base_scalar<octave_uint8>;
-
-template class octave_base_int_scalar<octave_uint8>;
-
-DEFINE_OCTAVE_ALLOCATOR (octave_uint8_scalar);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint8_scalar,
-                                     "uint8 scalar", "uint8");
-
-DEFUN (uint8, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} uint8 (@var{x})\n\
-Convert @var{x} to unsigned 8-bit integer type.\n\
-@end deftypefn")
-{
-  OCTAVE_TYPE_CONV_BODY (uint8);
-}
-
-/*
-%!assert (class (uint8 (1)), "uint8")
-%!assert (uint8 (1.25), uint8 (1))
-%!assert (uint8 (1.5), uint8 (2))
-%!assert (uint8 (-1.5), uint8 (0))
-%!assert (uint8 (2^9), uint8 (2^8-1))
-%!assert (uint8 (-2^9), uint8 (0))
-*/
--- a/src/ov-uint8.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-
-Copyright (C) 2004-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_uint8_h)
-#define octave_uint8_h 1
-
-#define OCTAVE_INT_T octave_uint8
-
-#define OCTAVE_VALUE_INT_MATRIX_T octave_uint8_matrix
-#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint8_array_value
-
-#define OCTAVE_VALUE_INT_SCALAR_T octave_uint8_scalar
-#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint8_scalar_value
-
-#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint8_type
-
-#define OCTAVE_INT_MX_CLASS mxUINT8_CLASS
-
-#define OCTAVE_INT_BTYP btyp_uint8
-
-#include "ov-intx.h"
-
-#undef OCTAVE_INT_T
-
-#undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
-
-#undef OCTAVE_TYPE_PREDICATE_FUNCTION
-
-#undef OCTAVE_INT_MX_CLASS
-
-#undef OCTAVE_INT_BTYP
-
-#endif
--- a/src/ov-usr-fcn.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,966 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sstream>
-
-#include "str-vec.h"
-
-#include <defaults.h>
-#include "Cell.h"
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "input.h"
-#include "oct-obj.h"
-#include "ov-usr-fcn.h"
-#include "ov.h"
-#include "pager.h"
-#include "pt-eval.h"
-#include "pt-jump.h"
-#include "pt-misc.h"
-#include "pt-pr-code.h"
-#include "pt-stmt.h"
-#include "pt-walk.h"
-#include "symtab.h"
-#include "toplev.h"
-#include "unwind-prot.h"
-#include "utils.h"
-#include "parse.h"
-#include "profiler.h"
-#include "variables.h"
-#include "ov-fcn-handle.h"
-
-// Whether to optimize subsasgn method calls.
-static bool Voptimize_subsasgn_calls = true;
-
-// User defined scripts.
-
-DEFINE_OCTAVE_ALLOCATOR (octave_user_script);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_user_script,
-                                     "user-defined script",
-                                     "user-defined script");
-
-octave_user_script::octave_user_script (void)
-  : octave_user_code (), cmd_list (0), file_name (),
-    t_parsed (static_cast<time_t> (0)),
-    t_checked (static_cast<time_t> (0)),
-    call_depth (-1)
-{ }
-
-octave_user_script::octave_user_script (const std::string& fnm,
-                                        const std::string& nm,
-                                        tree_statement_list *cmds,
-                                        const std::string& ds)
-  : octave_user_code (nm, ds), cmd_list (cmds), file_name (fnm),
-    t_parsed (static_cast<time_t> (0)),
-    t_checked (static_cast<time_t> (0)),
-    call_depth (-1)
-{
-  if (cmd_list)
-    cmd_list->mark_as_script_body ();
-}
-
-octave_user_script::octave_user_script (const std::string& fnm,
-                                        const std::string& nm,
-                                        const std::string& ds)
-  : octave_user_code (nm, ds), cmd_list (0), file_name (fnm),
-    t_parsed (static_cast<time_t> (0)),
-    t_checked (static_cast<time_t> (0)),
-    call_depth (-1)
-{ }
-
-octave_user_script::~octave_user_script (void)
-{
-  delete cmd_list;
-}
-
-octave_value_list
-octave_user_script::subsref (const std::string&,
-                             const std::list<octave_value_list>&, int)
-{
-  octave_value_list retval;
-
-  ::error ("invalid use of script %s in index expression", file_name.c_str ());
-
-  return retval;
-}
-
-octave_value_list
-octave_user_script::do_multi_index_op (int nargout,
-                                       const octave_value_list& args)
-{
-  octave_value_list retval;
-
-  unwind_protect frame;
-
-  if (! error_state)
-    {
-      if (args.length () == 0 && nargout == 0)
-        {
-          if (cmd_list)
-            {
-              frame.protect_var (call_depth);
-              call_depth++;
-
-              if (call_depth < Vmax_recursion_depth)
-                {
-                  octave_call_stack::push (this);
-
-                  frame.add_fcn (octave_call_stack::pop);
-
-                  frame.protect_var (tree_evaluator::statement_context);
-                  tree_evaluator::statement_context = tree_evaluator::script;
-
-                  BEGIN_PROFILER_BLOCK (profiler_name ())
-                  cmd_list->accept (*current_evaluator);
-                  END_PROFILER_BLOCK
-
-                  if (tree_return_command::returning)
-                    tree_return_command::returning = 0;
-
-                  if (tree_break_command::breaking)
-                    tree_break_command::breaking--;
-
-                  if (error_state)
-                    octave_call_stack::backtrace_error_message ();
-                }
-              else
-                ::error ("max_recursion_depth exceeded");
-            }
-        }
-      else
-        error ("invalid call to script %s", file_name.c_str ());
-    }
-
-  return retval;
-}
-
-void
-octave_user_script::accept (tree_walker& tw)
-{
-  tw.visit_octave_user_script (*this);
-}
-
-// User defined functions.
-
-DEFINE_OCTAVE_ALLOCATOR (octave_user_function);
-
-DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_user_function,
-                                     "user-defined function",
-                                     "user-defined function");
-
-// Ugh.  This really needs to be simplified (code/data?
-// extrinsic/intrinsic state?).
-
-octave_user_function::octave_user_function
-  (symbol_table::scope_id sid, tree_parameter_list *pl,
-   tree_parameter_list *rl, tree_statement_list *cl)
-  : octave_user_code (std::string (), std::string ()),
-    param_list (pl), ret_list (rl), cmd_list (cl),
-    lead_comm (), trail_comm (), file_name (),
-    location_line (0), location_column (0),
-    parent_name (), t_parsed (static_cast<time_t> (0)),
-    t_checked (static_cast<time_t> (0)),
-    system_fcn_file (false), call_depth (-1),
-    num_named_args (param_list ? param_list->length () : 0),
-    subfunction (false), inline_function (false),
-    anonymous_function (false), nested_function (false),
-    class_constructor (false), class_method (false),
-    parent_scope (-1), local_scope (sid),
-    curr_unwind_protect_frame (0)
-{
-  if (cmd_list)
-    cmd_list->mark_as_function_body ();
-
-  if (local_scope >= 0)
-    symbol_table::set_curr_fcn (this, local_scope);
-}
-
-octave_user_function::~octave_user_function (void)
-{
-  delete param_list;
-  delete ret_list;
-  delete cmd_list;
-  delete lead_comm;
-  delete trail_comm;
-
-  symbol_table::erase_scope (local_scope);
-}
-
-octave_user_function *
-octave_user_function::define_ret_list (tree_parameter_list *t)
-{
-  ret_list = t;
-
-  return this;
-}
-
-void
-octave_user_function::stash_fcn_file_name (const std::string& nm)
-{
-  file_name = nm;
-}
-
-std::string
-octave_user_function::profiler_name (void) const
-{
-  std::ostringstream result;
-
-  if (is_inline_function ())
-    result << "inline@" << fcn_file_name ()
-           << ":" << location_line << ":" << location_column;
-  else if (is_anonymous_function ())
-    result << "anonymous@" << fcn_file_name ()
-           << ":" << location_line << ":" << location_column;
-  else if (is_subfunction ())
-    result << parent_fcn_name () << ">" << name ();
-  else
-    result << name ();
-
-  return result.str ();
-}
-
-void
-octave_user_function::mark_as_system_fcn_file (void)
-{
-  if (! file_name.empty ())
-    {
-      // We really should stash the whole path to the file we found,
-      // when we looked it up, to avoid possible race conditions...
-      // FIXME
-      //
-      // We probably also don't need to get the library directory
-      // every time, but since this function is only called when the
-      // function file is parsed, it probably doesn't matter that
-      // much.
-
-      std::string ff_name = fcn_file_in_path (file_name);
-
-      if (Vfcn_file_dir == ff_name.substr (0, Vfcn_file_dir.length ()))
-        system_fcn_file = true;
-    }
-  else
-    system_fcn_file = false;
-}
-
-bool
-octave_user_function::takes_varargs (void) const
-{
-  return (param_list && param_list->takes_varargs ());
-}
-
-bool
-octave_user_function::takes_var_return (void) const
-{
-  return (ret_list && ret_list->takes_varargs ());
-}
-
-void
-octave_user_function::lock_subfunctions (void)
-{
-  symbol_table::lock_subfunctions (local_scope);
-}
-
-void
-octave_user_function::unlock_subfunctions (void)
-{
-  symbol_table::unlock_subfunctions (local_scope);
-}
-
-octave_value_list
-octave_user_function::all_va_args (const octave_value_list& args)
-{
-  octave_value_list retval;
-
-  octave_idx_type n = args.length () - num_named_args;
-
-  if (n > 0)
-    retval = args.slice (num_named_args, n);
-
-  return retval;
-}
-
-octave_value_list
-octave_user_function::subsref (const std::string& type,
-                               const std::list<octave_value_list>& idx,
-                               int nargout)
-{
-  return octave_user_function::subsref (type, idx, nargout, 0);
-}
-
-octave_value_list
-octave_user_function::subsref (const std::string& type,
-                               const std::list<octave_value_list>& idx,
-                               int nargout, const std::list<octave_lvalue>* lvalue_list)
-{
-  octave_value_list retval;
-
-  switch (type[0])
-    {
-    case '(':
-      {
-        int tmp_nargout = (type.length () > 1 && nargout == 0) ? 1 : nargout;
-
-        retval = do_multi_index_op (tmp_nargout, idx.front (),
-                                    idx.size () == 1 ? lvalue_list : 0);
-      }
-      break;
-
-    case '{':
-    case '.':
-      {
-        std::string nm = type_name ();
-        error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
-      }
-      break;
-
-    default:
-      panic_impossible ();
-    }
-
-  // FIXME -- perhaps there should be an
-  // octave_value_list::next_subsref member function?  See also
-  // octave_builtin::subsref.
-
-  if (idx.size () > 1)
-    retval = retval(0).next_subsref (nargout, type, idx);
-
-  return retval;
-}
-
-octave_value_list
-octave_user_function::do_multi_index_op (int nargout,
-                                         const octave_value_list& args)
-{
-  return do_multi_index_op (nargout, args, 0);
-}
-
-octave_value_list
-octave_user_function::do_multi_index_op (int nargout,
-                                         const octave_value_list& args,
-                                         const std::list<octave_lvalue>* lvalue_list)
-{
-  octave_value_list retval;
-
-  if (error_state)
-    return retval;
-
-  if (! cmd_list)
-    return retval;
-
-  int nargin = args.length ();
-
-  unwind_protect frame;
-
-  frame.protect_var (call_depth);
-  call_depth++;
-
-  if (call_depth >= Vmax_recursion_depth)
-    {
-      ::error ("max_recursion_depth exceeded");
-      return retval;
-    }
-
-  // Save old and set current symbol table context, for
-  // eval_undefined_error().
-
-  int context = active_context ();
-
-  octave_call_stack::push (this, local_scope, context);
-  frame.add_fcn (octave_call_stack::pop);
-
-  if (call_depth > 0 && ! is_anonymous_function ())
-    {
-      symbol_table::push_context ();
-
-      frame.add_fcn (symbol_table::pop_context);
-    }
-
-  string_vector arg_names = args.name_tags ();
-
-  if (param_list && ! param_list->varargs_only ())
-    {
-      param_list->define_from_arg_vector (args);
-      if (error_state)
-        return retval;
-    }
-
-  // Force parameter list to be undefined when this function exits.
-  // Doing so decrements the reference counts on the values of local
-  // variables that are also named function parameters.
-
-  if (param_list)
-    frame.add_method (param_list, &tree_parameter_list::undefine);
-
-  // Force return list to be undefined when this function exits.
-  // Doing so decrements the reference counts on the values of local
-  // variables that are also named values returned by this function.
-
-  if (ret_list)
-    frame.add_method (ret_list, &tree_parameter_list::undefine);
-
-  if (call_depth == 0)
-    {
-      // Force symbols to be undefined again when this function
-      // exits.
-      //
-      // This cleanup function is added to the unwind_protect stack
-      // after the calls to clear the parameter lists so that local
-      // variables will be cleared before the parameter lists are
-      // cleared.  That way, any function parameters that have been
-      // declared global will be unmarked as global before they are
-      // undefined by the clear_param_list cleanup function.
-
-      frame.add_fcn (symbol_table::clear_variables);
-    }
-
-  bind_automatic_vars (arg_names, nargin, nargout, all_va_args (args),
-                       lvalue_list);
-
-  bool echo_commands = (Vecho_executing_commands & ECHO_FUNCTIONS);
-
-  if (echo_commands)
-    print_code_function_header ();
-
-  // Set pointer to the current unwind_protect frame to allow
-  // certain builtins register simple cleanup in a very optimized manner.
-  // This is *not* intended as a general-purpose on-cleanup mechanism,
-  frame.protect_var (curr_unwind_protect_frame);
-  curr_unwind_protect_frame = &frame;
-
-  // Evaluate the commands that make up the function.
-
-  frame.protect_var (tree_evaluator::statement_context);
-  tree_evaluator::statement_context = tree_evaluator::function;
-
-  bool special_expr = (is_inline_function () || is_anonymous_function ());
-
-  BEGIN_PROFILER_BLOCK (profiler_name ())
-
-  if (special_expr)
-    {
-      assert (cmd_list->length () == 1);
-
-      tree_statement *stmt = 0;
-
-      if ((stmt = cmd_list->front ())
-          && stmt->is_expression ())
-        {
-          tree_expression *expr = stmt->expression ();
-
-          retval = expr->rvalue (nargout);
-        }
-    }
-  else
-    cmd_list->accept (*current_evaluator);
-
-  END_PROFILER_BLOCK
-
-  if (echo_commands)
-    print_code_function_trailer ();
-
-  if (tree_return_command::returning)
-    tree_return_command::returning = 0;
-
-  if (tree_break_command::breaking)
-    tree_break_command::breaking--;
-
-  if (error_state)
-    {
-      octave_call_stack::backtrace_error_message ();
-      return retval;
-    }
-
-  // Copy return values out.
-
-  if (ret_list && ! special_expr)
-    {
-      ret_list->initialize_undefined_elements (my_name, nargout, Matrix ());
-
-      Cell varargout;
-
-      if (ret_list->takes_varargs ())
-        {
-          octave_value varargout_varval = symbol_table::varval ("varargout");
-
-          if (varargout_varval.is_defined ())
-            {
-              varargout = varargout_varval.cell_value ();
-
-              if (error_state)
-                error ("expecting varargout to be a cell array object");
-            }
-        }
-
-      if (! error_state)
-        retval = ret_list->convert_to_const_vector (nargout, varargout);
-    }
-
-  return retval;
-}
-
-void
-octave_user_function::accept (tree_walker& tw)
-{
-  tw.visit_octave_user_function (*this);
-}
-
-bool
-octave_user_function::subsasgn_optimization_ok (void)
-{
-  bool retval = false;
-  if (Voptimize_subsasgn_calls
-      && param_list->length () > 0 && ! param_list->varargs_only ()
-      && ret_list->length () == 1 && ! ret_list->takes_varargs ())
-    {
-      tree_identifier *par1 = param_list->front ()->ident ();
-      tree_identifier *ret1 = ret_list->front ()->ident ();
-      retval = par1->name () == ret1->name ();
-    }
-
-  return retval;
-}
-
-#if 0
-void
-octave_user_function::print_symtab_info (std::ostream& os) const
-{
-  symbol_table::print_info (os, local_scope);
-}
-#endif
-
-void
-octave_user_function::print_code_function_header (void)
-{
-  tree_print_code tpc (octave_stdout, VPS4);
-
-  tpc.visit_octave_user_function_header (*this);
-}
-
-void
-octave_user_function::print_code_function_trailer (void)
-{
-  tree_print_code tpc (octave_stdout, VPS4);
-
-  tpc.visit_octave_user_function_trailer (*this);
-}
-
-void
-octave_user_function::bind_automatic_vars
-  (const string_vector& arg_names, int nargin, int nargout,
-   const octave_value_list& va_args, const std::list<octave_lvalue> *lvalue_list)
-{
-  if (! arg_names.empty ())
-    {
-      // It is better to save this in the hidden variable .argn. and
-      // then use that in the inputname function instead of using argn,
-      // which might be redefined in a function.  Keep the old argn name
-      // for backward compatibility of functions that use it directly.
-
-      symbol_table::varref ("argn") = arg_names;
-      symbol_table::varref (".argn.") = Cell (arg_names);
-
-      symbol_table::mark_hidden (".argn.");
-
-      symbol_table::mark_automatic ("argn");
-      symbol_table::mark_automatic (".argn.");
-    }
-
-  symbol_table::varref (".nargin.") = nargin;
-  symbol_table::varref (".nargout.") = nargout;
-
-  symbol_table::mark_hidden (".nargin.");
-  symbol_table::mark_hidden (".nargout.");
-
-  symbol_table::mark_automatic (".nargin.");
-  symbol_table::mark_automatic (".nargout.");
-
-  if (takes_varargs ())
-    symbol_table::varref ("varargin") = va_args.cell_value ();
-
-  // Force .ignored. variable to be undefined by default.
-  symbol_table::varref (".ignored.") = octave_value ();
-
-  if (lvalue_list)
-    {
-      octave_idx_type nbh = 0;
-      for (std::list<octave_lvalue>::const_iterator p = lvalue_list->begin ();
-           p != lvalue_list->end (); p++)
-        nbh += p->is_black_hole ();
-
-      if (nbh > 0)
-        {
-          // Only assign the hidden variable if black holes actually present.
-          Matrix bh (1, nbh);
-          octave_idx_type k = 0, l = 0;
-          for (std::list<octave_lvalue>::const_iterator p = lvalue_list->begin ();
-               p != lvalue_list->end (); p++)
-            {
-              if (p->is_black_hole ())
-                bh(l++) = k+1;
-              k += p->numel ();
-            }
-
-          symbol_table::varref (".ignored.") = bh;
-        }
-    }
-
-  symbol_table::mark_hidden (".ignored.");
-  symbol_table::mark_automatic (".ignored.");
-}
-
-DEFUN (nargin, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} nargin ()\n\
-@deftypefnx {Built-in Function} {} nargin (@var{fcn})\n\
-Within a function, return the number of arguments passed to the function.\n\
-At the top level, return the number of command line arguments passed to\n\
-Octave.\n\
-\n\
-If called with the optional argument @var{fcn}, a function name or handle,\n\
-return the declared number of arguments that the function can accept.\n\
-If the last argument is @var{varargin} the returned value is negative.\n\
-This feature does not work on builtin functions.\n\
-@seealso{nargout, varargin, isargout, varargout, nthargout}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    {
-      octave_value func = args(0);
-
-      if (func.is_string ())
-        {
-          std::string name = func.string_value ();
-          func = symbol_table::find_function (name);
-          if (func.is_undefined ())
-            error ("nargout: invalid function name: %s", name.c_str ());
-        }
-
-      octave_function *fcn_val = func.function_value ();
-      if (fcn_val)
-        {
-          octave_user_function *fcn = fcn_val->user_function_value (true);
-
-          if (fcn)
-            {
-              tree_parameter_list *param_list = fcn->parameter_list ();
-
-              retval = param_list ? param_list->length () : 0;
-              if (fcn->takes_varargs ())
-                retval = -1 - retval;
-            }
-          else
-            {
-              // Matlab gives up for histc, so maybe it's ok we give up somtimes too.
-              error ("nargin: nargin information not available for builtin functions");
-            }
-        }
-      else
-        error ("nargin: FCN must be a string or function handle");
-    }
-  else if (nargin == 0)
-    {
-      retval = symbol_table::varval (".nargin.");
-
-      if (retval.is_undefined ())
-        retval = 0;
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (nargout, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} nargout ()\n\
-@deftypefnx {Built-in Function} {} nargout (@var{fcn})\n\
-Within a function, return the number of values the caller expects to\n\
-receive.  If called with the optional argument @var{fcn}, a function\n\
-name or handle, return the number of declared output values that the\n\
-function can produce.  If the final output argument is @var{varargout}\n\
-the returned value is negative.\n\
-\n\
-For example,\n\
-\n\
-@example\n\
-f ()\n\
-@end example\n\
-\n\
-@noindent\n\
-will cause @code{nargout} to return 0 inside the function @code{f} and\n\
-\n\
-@example\n\
-[s, t] = f ()\n\
-@end example\n\
-\n\
-@noindent\n\
-will cause @code{nargout} to return 2 inside the function\n\
-@code{f}.\n\
-\n\
-In the second usage,\n\
-\n\
-@example\n\
-nargout (@@histc) \% or nargout ('histc')\n\
-@end example\n\
-\n\
-@noindent\n\
-will return 2, because @code{histc} has two outputs, whereas\n\
-\n\
-@example\n\
-nargout (@@deal)\n\
-@end example\n\
-\n\
-@noindent\n\
-will return -1, because @code{deal} has a variable number of outputs.\n\
-\n\
-At the top level, @code{nargout} with no argument is undefined.\n\
-@code{nargout} does not work on builtin functions.\n\
-@code{nargout} returns -1 for all anonymous functions.\n\
-@seealso{nargin, varargin, isargout, varargout, nthargout}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    {
-      octave_value func = args(0);
-
-      if (func.is_string ())
-        {
-          std::string name = func.string_value ();
-          func = symbol_table::find_function (name);
-          if (func.is_undefined ())
-            error ("nargout: invalid function name: %s", name.c_str ());
-        }
-
-      if (func.is_inline_function ())
-        {
-          retval = 1;
-          return retval;
-        }
-
-      if (func.is_function_handle ())
-        {
-          octave_fcn_handle *fh = func.fcn_handle_value ();
-          std::string fh_nm = fh->fcn_name ();
-
-          if (fh_nm == octave_fcn_handle::anonymous)
-            {
-              retval = -1;
-              return retval;
-            }
-        }
-
-      octave_function *fcn_val = func.function_value ();
-      if (fcn_val)
-        {
-          octave_user_function *fcn = fcn_val->user_function_value (true);
-
-          if (fcn)
-            {
-              tree_parameter_list *ret_list = fcn->return_list ();
-          
-              retval = ret_list ? ret_list->length () : 0;
-
-              if (fcn->takes_var_return ())
-                retval = -1 - retval;
-            }
-          else
-            {
-              // JWE said this information is not available (currently, 2011-03-10)
-              // without making intrusive changes to Octave.
-              // Matlab gives up for histc, so maybe it's ok we give up somtimes too.
-              error ("nargout: nargout information not available for builtin functions.");
-            }
-        }
-      else
-        error ("nargout: FCN must be a string or function handle");
-    }
-  else if (nargin == 0)
-    {
-      if (! symbol_table::at_top_level ())
-        {
-          retval = symbol_table::varval (".nargout.");
-
-          if (retval.is_undefined ())
-            retval = 0;
-        }
-      else
-        error ("nargout: invalid call at top level");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (optimize_subsasgn_calls, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} optimize_subsasgn_calls ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} optimize_subsasgn_calls (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} optimize_subsasgn_calls (@var{new_val}, \"local\")\n\
-Query or set the internal flag for subsasgn method call optimizations.\n\
-If true, Octave will attempt to eliminate the redundant copying when calling\n\
-subsasgn method of a user-defined class.\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE (optimize_subsasgn_calls);
-}
-
-static bool val_in_table (const Matrix& table, double val)
-{
-  if (table.is_empty ())
-    return false;
-
-  octave_idx_type i = table.lookup (val, ASCENDING);
-  return (i > 0 && table(i-1) == val);
-}
-
-static bool isargout1 (int nargout, const Matrix& ignored, double k)
-{
-  if (k != xround (k) || k <= 0)
-    {
-      error ("isargout: K must be a positive integer");
-      return false;
-    }
-  else
-    return (k == 1 || k <= nargout) && ! val_in_table (ignored, k);
-}
-
-DEFUN (isargout, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} isargout (@var{k})\n\
-Within a function, return a logical value indicating whether the argument\n\
-@var{k} will be assigned on output to a variable.  If the result is false,\n\
-the argument has been ignored during the function call through the use of\n\
-the tilde (~) special output argument.  Functions can use @code{isargout} to\n\
-avoid performing unnecessary calculations for outputs which are unwanted.\n\
-\n\
-If @var{k} is outside the range @code{1:max (nargout)}, the function returns\n\
-false.  @var{k} can also be an array, in which case the function works\n\
-element-by-element and a logical array is returned.  At the top level,\n\
-@code{isargout} returns an error.\n\
-@seealso{nargout, nargin, varargin, varargout, nthargout}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1)
-    {
-      if (! symbol_table::at_top_level ())
-        {
-          int nargout1 = symbol_table::varval (".nargout.").int_value ();
-          if (error_state)
-            {
-              error ("isargout: internal error");
-              return retval;
-            }
-
-          Matrix ignored;
-          octave_value tmp = symbol_table::varval (".ignored.");
-          if (tmp.is_defined ())
-            ignored = tmp.matrix_value ();
-
-          if (args(0).is_scalar_type ())
-            {
-              double k = args(0).double_value ();
-              if (! error_state)
-                retval = isargout1 (nargout1, ignored, k);
-            }
-          else if (args(0).is_numeric_type ())
-            {
-              const NDArray ka = args(0).array_value ();
-              if (! error_state)
-                {
-                  boolNDArray r (ka.dims ());
-                  for (octave_idx_type i = 0; i < ka.numel () && ! error_state; i++)
-                    r(i) = isargout1 (nargout1, ignored, ka(i));
-
-                  retval = r;
-                }
-            }
-          else
-            gripe_wrong_type_arg ("isargout", args(0));
-        }
-      else
-        error ("isargout: invalid call at top level");
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!function [x, y] = try_isargout ()
-%!  if (isargout (1))
-%!    if (isargout (2))
-%!      x = 1; y = 2;
-%!    else
-%!      x = -1;
-%!    endif
-%!  else
-%!    if (isargout (2))
-%!      y = -2;
-%!    else
-%!      error ("no outputs requested");
-%!    endif
-%!  endif
-%!endfunction
-%!
-%!test
-%! [x, y] = try_isargout ();
-%! assert ([x, y], [1, 2]);
-%!
-%!test
-%! [x, ~] = try_isargout ();
-%! assert (x, -1);
-%!
-%!test
-%! [~, y] = try_isargout ();
-%! assert (y, -2);
-%!
-%!error [~, ~] = try_isargout ();
-%!
-%% Check to see that isargout isn't sticky:
-%!test
-%! [x, y] = try_isargout ();
-%! assert ([x, y], [1, 2]);
-*/
--- a/src/ov-usr-fcn.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,463 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_user_function_h)
-#define octave_user_function_h 1
-
-#include <ctime>
-
-#include <string>
-#include <stack>
-
-#include "comment-list.h"
-#include "oct-obj.h"
-#include "ov-fcn.h"
-#include "ov-typeinfo.h"
-#include "symtab.h"
-#include "unwind-prot.h"
-
-class string_vector;
-
-class octave_value;
-class tree_parameter_list;
-class tree_statement_list;
-class tree_va_return_list;
-class tree_walker;
-
-class
-octave_user_code : public octave_function
-{
-public:
-  octave_user_code (void)
-    : octave_function () { }
-
-  ~octave_user_code (void) { }
-
-  bool is_user_code (void) const { return true; }
-
-  virtual tree_statement_list *body (void) = 0;
-
-protected:
-
-  octave_user_code (const std::string& nm,
-                    const std::string& ds = std::string ())
-    : octave_function (nm, ds) { }
-
-private:
-
-  // No copying!
-
-  octave_user_code (const octave_user_code& f);
-
-  octave_user_code& operator = (const octave_user_code& f);
-};
-
-// Scripts.
-
-class
-octave_user_script : public octave_user_code
-{
-public:
-
-  octave_user_script (void);
-
-  octave_user_script (const std::string& fnm, const std::string& nm,
-                      tree_statement_list *cmds,
-                      const std::string& ds = std::string ());
-
-  octave_user_script (const std::string& fnm, const std::string& nm,
-                      const std::string& ds = std::string ());
-
-  ~octave_user_script (void);
-
-  octave_function *function_value (bool = false) { return this; }
-
-  octave_user_script *user_script_value (bool = false) { return this; }
-
-  octave_user_code *user_code_value (bool = false) { return this; }
-
-  // Scripts and user functions are both considered "scripts" because
-  // they are written in Octave's scripting language.
-
-  bool is_user_script (void) const { return true; }
-
-  void stash_fcn_file_name (const std::string& nm) { file_name = nm; }
-
-  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
-
-  void stash_fcn_file_time (const octave_time& t)
-    {
-      t_parsed = t;
-      mark_fcn_file_up_to_date (t);
-    }
-
-  std::string fcn_file_name (void) const { return file_name; }
-
-  octave_time time_parsed (void) const { return t_parsed; }
-
-  octave_time time_checked (void) const { return t_checked; }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    {
-      octave_value_list tmp = subsref (type, idx, 1);
-      return tmp.length () > 0 ? tmp(0) : octave_value ();
-    }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args);
-
-  tree_statement_list *body (void) { return cmd_list; }
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // The list of commands that make up the body of this function.
-  tree_statement_list *cmd_list;
-
-  // The name of the file we parsed.
-  std::string file_name;
-
-  // The time the file was parsed.
-  octave_time t_parsed;
-
-  // The time the file was last checked to see if it needs to be
-  // parsed again.
-  octave_time t_checked;
-
-  // Used to keep track of recursion depth.
-  int call_depth;
-
-  // No copying!
-
-  octave_user_script (const octave_user_script& f);
-
-  octave_user_script& operator = (const octave_user_script& f);
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-// User-defined functions.
-
-class
-octave_user_function : public octave_user_code
-{
-public:
-
-  octave_user_function (symbol_table::scope_id sid = -1,
-                        tree_parameter_list *pl = 0,
-                        tree_parameter_list *rl = 0,
-                        tree_statement_list *cl = 0);
-
-  ~octave_user_function (void);
-
-  symbol_table::context_id active_context () const
-  {
-    return is_anonymous_function ()
-      ? 0 : static_cast<symbol_table::context_id>(call_depth);
-  }
-
-  octave_function *function_value (bool = false) { return this; }
-
-  octave_user_function *user_function_value (bool = false) { return this; }
-
-  octave_user_code *user_code_value (bool = false) { return this; }
-
-  octave_user_function *define_param_list (tree_parameter_list *t);
-
-  octave_user_function *define_ret_list (tree_parameter_list *t);
-
-  void stash_fcn_file_name (const std::string& nm);
-
-  void stash_fcn_location (int line, int col)
-    {
-      location_line = line;
-      location_column = col;
-    }
-
-  void stash_parent_fcn_name (const std::string& p) { parent_name = p; }
-
-  void stash_parent_fcn_scope (symbol_table::scope_id ps) { parent_scope = ps; }
-
-  void stash_leading_comment (octave_comment_list *lc) { lead_comm = lc; }
-
-  void stash_trailing_comment (octave_comment_list *tc) { trail_comm = tc; }
-
-  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
-
-  void stash_fcn_file_time (const octave_time& t)
-    {
-      t_parsed = t;
-      mark_fcn_file_up_to_date (t);
-    }
-
-  std::string fcn_file_name (void) const { return file_name; }
-
-  std::string profiler_name (void) const;
-
-  std::string parent_fcn_name (void) const { return parent_name; }
-
-  symbol_table::scope_id parent_fcn_scope (void) const { return parent_scope; }
-
-  symbol_table::scope_id scope (void) { return local_scope; }
-
-  octave_time time_parsed (void) const { return t_parsed; }
-
-  octave_time time_checked (void) const { return t_checked; }
-
-  void mark_as_system_fcn_file (void);
-
-  bool is_system_fcn_file (void) const { return system_fcn_file; }
-
-  bool is_user_function (void) const { return true; }
-
-  void erase_subfunctions (void)
-    {
-      symbol_table::erase_subfunctions_in_scope (local_scope);
-    }
-
-  bool takes_varargs (void) const;
-
-  bool takes_var_return (void) const;
-
-  void mark_as_private_function (const std::string& cname = std::string ())
-    {
-      symbol_table::mark_subfunctions_in_scope_as_private (local_scope, cname);
-
-      octave_function::mark_as_private_function (cname);
-    }
-
-  void lock_subfunctions (void);
-
-  void unlock_subfunctions (void);
-
-  octave_value_list all_va_args (const octave_value_list& args);
-
-  void stash_function_name (const std::string& s) { my_name = s; }
-
-  void mark_as_subfunction (void) { subfunction = true; }
-
-  bool is_subfunction (void) const { return subfunction; }
-
-  void mark_as_inline_function (void) { inline_function = true; }
-
-  bool is_inline_function (void) const { return inline_function; }
-
-  void mark_as_anonymous_function (void) { anonymous_function = true; }
-
-  bool is_anonymous_function (void) const { return anonymous_function; }
-
-  bool is_anonymous_function_of_class
-    (const std::string& cname = std::string ()) const
-  {
-    return anonymous_function
-      ? (cname.empty ()
-         ? (! dispatch_class ().empty ())
-         : cname == dispatch_class ())
-      : false;
-  }
-
-  bool is_nested_function (void) const { return nested_function; }
-
-  void mark_as_nested_function (void) { nested_function = true; }
-
-  void mark_as_class_constructor (void) { class_constructor = true; }
-
-  bool is_class_constructor (const std::string& cname = std::string ()) const
-    {
-      return class_constructor
-        ? (cname.empty () ? true : cname == dispatch_class ()) : false;
-    }
-
-  void mark_as_class_method (void) { class_method = true; }
-
-  bool is_class_method (const std::string& cname = std::string ()) const
-    {
-      return class_method
-        ? (cname.empty () ? true : cname == dispatch_class ()) : false;
-    }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    {
-      octave_value_list tmp = subsref (type, idx, 1);
-      return tmp.length () > 0 ? tmp(0) : octave_value ();
-    }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout, const std::list<octave_lvalue>* lvalue_list);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& args,
-                     const std::list<octave_lvalue>* lvalue_list);
-
-  tree_parameter_list *parameter_list (void) { return param_list; }
-
-  tree_parameter_list *return_list (void) { return ret_list; }
-
-  tree_statement_list *body (void) { return cmd_list; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  bool subsasgn_optimization_ok (void);
-
-  void accept (tree_walker& tw);
-
-  template <class T>
-  bool local_protect (T& variable)
-    {
-      if (curr_unwind_protect_frame)
-        {
-          curr_unwind_protect_frame->protect_var (variable);
-          return true;
-        }
-      else
-        return false;
-    }
-
-#if 0
-  void print_symtab_info (std::ostream& os) const;
-#endif
-
-private:
-
-  // List of arguments for this function.  These are local variables.
-  tree_parameter_list *param_list;
-
-  // List of parameters we return.  These are also local variables in
-  // this function.
-  tree_parameter_list *ret_list;
-
-  // The list of commands that make up the body of this function.
-  tree_statement_list *cmd_list;
-
-  // The comments preceding the FUNCTION token.
-  octave_comment_list *lead_comm;
-
-  // The comments preceding the ENDFUNCTION token.
-  octave_comment_list *trail_comm;
-
-  // The name of the file we parsed.
-  std::string file_name;
-
-  // Location where this function was defined.
-  int location_line;
-  int location_column;
-
-  // The name of the parent function, if any.
-  std::string parent_name;
-
-  // The time the file was parsed.
-  octave_time t_parsed;
-
-  // The time the file was last checked to see if it needs to be
-  // parsed again.
-  octave_time t_checked;
-
-  // True if this function came from a file that is considered to be a
-  // system function.  This affects whether we check the time stamp
-  // on the file to see if it has changed.
-  bool system_fcn_file;
-
-  // Used to keep track of recursion depth.
-  int call_depth;
-
-  // The number of arguments that have names.
-  int num_named_args;
-
-  // TRUE means this subfunction of a primary function.
-  bool subfunction;
-
-  // TRUE means this is an inline function.
-  bool inline_function;
-
-  // TRUE means this is an anonymous function.
-  bool anonymous_function;
-
-  // TRUE means this is a nested function. (either a child or parent)
-  bool nested_function;
-
-  // TRUE means this function is the constructor for class object.
-  bool class_constructor;
-
-  // TRUE means this function is a method for a class.
-  bool class_method;
-
-  // The scope of the parent function, if any.
-  symbol_table::scope_id parent_scope;
-
-  symbol_table::scope_id local_scope;
-
-  // pointer to the current unwind_protect frame of this function.
-  unwind_protect *curr_unwind_protect_frame;
-
-#if 0
-  // The symbol record for argn in the local symbol table.
-  octave_value& argn_varref;
-
-  // The symbol record for nargin in the local symbol table.
-  octave_value& nargin_varref;
-
-  // The symbol record for nargout in the local symbol table.
-  octave_value& nargout_varref;
-
-  // The symbol record for varargin in the local symbol table.
-  octave_value& varargin_varref;
-#endif
-
-  void print_code_function_header (void);
-
-  void print_code_function_trailer (void);
-
-  void bind_automatic_vars (const string_vector& arg_names, int nargin,
-                            int nargout, const octave_value_list& va_args,
-                            const std::list<octave_lvalue> *lvalue_list);
-
-  // No copying!
-
-  octave_user_function (const octave_user_function& fn);
-
-  octave_user_function& operator = (const octave_user_function& fn);
-
-  DECLARE_OCTAVE_ALLOCATOR
-
-  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
-};
-
-#endif
--- a/src/ov.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3046 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "data-conv.h"
-#include "quit.h"
-#include "str-vec.h"
-
-#include "oct-obj.h"
-#include "oct-stream.h"
-#include "ov.h"
-#include "ov-base.h"
-#include "ov-bool.h"
-#include "ov-bool-mat.h"
-#include "ov-cell.h"
-#include "ov-scalar.h"
-#include "ov-float.h"
-#include "ov-re-mat.h"
-#include "ov-flt-re-mat.h"
-#include "ov-re-diag.h"
-#include "ov-flt-re-diag.h"
-#include "ov-perm.h"
-#include "ov-bool-sparse.h"
-#include "ov-cx-sparse.h"
-#include "ov-re-sparse.h"
-#include "ov-int8.h"
-#include "ov-int16.h"
-#include "ov-int32.h"
-#include "ov-int64.h"
-#include "ov-uint8.h"
-#include "ov-uint16.h"
-#include "ov-uint32.h"
-#include "ov-uint64.h"
-#include "ov-complex.h"
-#include "ov-flt-complex.h"
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-cx-diag.h"
-#include "ov-flt-cx-diag.h"
-#include "ov-ch-mat.h"
-#include "ov-str-mat.h"
-#include "ov-range.h"
-#include "ov-struct.h"
-#include "ov-class.h"
-#include "ov-oncleanup.h"
-#include "ov-cs-list.h"
-#include "ov-colon.h"
-#include "ov-builtin.h"
-#include "ov-dld-fcn.h"
-#include "ov-usr-fcn.h"
-#include "ov-fcn-handle.h"
-#include "ov-fcn-inline.h"
-#include "ov-typeinfo.h"
-#include "ov-null-mat.h"
-#include "ov-lazy-idx.h"
-
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "pager.h"
-#include "parse.h"
-#include "pr-output.h"
-#include "symtab.h"
-#include "utils.h"
-#include "variables.h"
-
-// We are likely to have a lot of octave_value objects to allocate, so
-// make the grow_size large.
-DEFINE_OCTAVE_ALLOCATOR2(octave_value, 1024);
-
-// FIXME
-
-// Octave's value type.
-
-std::string
-octave_value::unary_op_as_string (unary_op op)
-{
-  std::string retval;
-
-  switch (op)
-    {
-    case op_not:
-      retval = "!";
-      break;
-
-    case op_uplus:
-      retval = "+";
-      break;
-
-    case op_uminus:
-      retval = "-";
-      break;
-
-    case op_transpose:
-      retval = ".'";
-      break;
-
-    case op_hermitian:
-      retval = "'";
-      break;
-
-    case op_incr:
-      retval = "++";
-      break;
-
-    case op_decr:
-      retval = "--";
-      break;
-
-    default:
-      retval = "<unknown>";
-    }
-
-  return retval;
-}
-
-std::string
-octave_value::unary_op_fcn_name (unary_op op)
-{
-  std::string retval;
-
-  switch (op)
-    {
-    case op_not:
-      retval = "not";
-      break;
-
-    case op_uplus:
-      retval = "uplus";
-      break;
-
-    case op_uminus:
-      retval = "uminus";
-      break;
-
-    case op_transpose:
-      retval = "transpose";
-      break;
-
-    case op_hermitian:
-      retval = "ctranspose";
-      break;
-
-    default:
-      break;
-    }
-
-  return retval;
-}
-
-std::string
-octave_value::binary_op_as_string (binary_op op)
-{
-  std::string retval;
-
-  switch (op)
-    {
-    case op_add:
-      retval = "+";
-      break;
-
-    case op_sub:
-      retval = "-";
-      break;
-
-    case op_mul:
-      retval = "*";
-      break;
-
-    case op_div:
-      retval = "/";
-      break;
-
-    case op_pow:
-      retval = "^";
-      break;
-
-    case op_ldiv:
-      retval = "\\";
-      break;
-
-    case op_lshift:
-      retval = "<<";
-      break;
-
-    case op_rshift:
-      retval = ">>";
-      break;
-
-    case op_lt:
-      retval = "<";
-      break;
-
-    case op_le:
-      retval = "<=";
-      break;
-
-    case op_eq:
-      retval = "==";
-      break;
-
-    case op_ge:
-      retval = ">=";
-      break;
-
-    case op_gt:
-      retval = ">";
-      break;
-
-    case op_ne:
-      retval = "!=";
-      break;
-
-    case op_el_mul:
-      retval = ".*";
-      break;
-
-    case op_el_div:
-      retval = "./";
-      break;
-
-    case op_el_pow:
-      retval = ".^";
-      break;
-
-    case op_el_ldiv:
-      retval = ".\\";
-      break;
-
-    case op_el_and:
-      retval = "&";
-      break;
-
-    case op_el_or:
-      retval = "|";
-      break;
-
-    case op_struct_ref:
-      retval = ".";
-      break;
-
-    default:
-      retval = "<unknown>";
-    }
-
-  return retval;
-}
-
-std::string
-octave_value::binary_op_fcn_name (binary_op op)
-{
-  std::string retval;
-
-  switch (op)
-    {
-    case op_add:
-      retval = "plus";
-      break;
-
-    case op_sub:
-      retval = "minus";
-      break;
-
-    case op_mul:
-      retval = "mtimes";
-      break;
-
-    case op_div:
-      retval = "mrdivide";
-      break;
-
-    case op_pow:
-      retval = "mpower";
-      break;
-
-    case op_ldiv:
-      retval = "mldivide";
-      break;
-
-    case op_lt:
-      retval = "lt";
-      break;
-
-    case op_le:
-      retval = "le";
-      break;
-
-    case op_eq:
-      retval = "eq";
-      break;
-
-    case op_ge:
-      retval = "ge";
-      break;
-
-    case op_gt:
-      retval = "gt";
-      break;
-
-    case op_ne:
-      retval = "ne";
-      break;
-
-    case op_el_mul:
-      retval = "times";
-      break;
-
-    case op_el_div:
-      retval = "rdivide";
-      break;
-
-    case op_el_pow:
-      retval = "power";
-      break;
-
-    case op_el_ldiv:
-      retval = "ldivide";
-      break;
-
-    case op_el_and:
-      retval = "and";
-      break;
-
-    case op_el_or:
-      retval = "or";
-      break;
-
-    default:
-      break;
-    }
-
-  return retval;
-}
-
-std::string
-octave_value::binary_op_fcn_name (compound_binary_op op)
-{
-  std::string retval;
-
-  switch (op)
-    {
-    case op_trans_mul:
-      retval = "transtimes";
-      break;
-
-    case op_mul_trans:
-      retval = "timestrans";
-      break;
-
-    case op_herm_mul:
-      retval = "hermtimes";
-      break;
-
-    case op_mul_herm:
-      retval = "timesherm";
-      break;
-
-    case op_trans_ldiv:
-      retval = "transldiv";
-      break;
-
-    case op_herm_ldiv:
-      retval = "hermldiv";
-      break;
-
-    case op_el_and_not:
-      retval = "andnot";
-      break;
-
-    case op_el_or_not:
-      retval = "ornot";
-      break;
-
-    case op_el_not_and:
-      retval = "notand";
-      break;
-
-    case op_el_not_or:
-      retval = "notor";
-      break;
-
-    default:
-      break;
-    }
-
-  return retval;
-}
-
-std::string
-octave_value::assign_op_as_string (assign_op op)
-{
-  std::string retval;
-
-  switch (op)
-    {
-    case op_asn_eq:
-      retval = "=";
-      break;
-
-    case op_add_eq:
-      retval = "+=";
-      break;
-
-    case op_sub_eq:
-      retval = "-=";
-      break;
-
-    case op_mul_eq:
-      retval = "*=";
-      break;
-
-    case op_div_eq:
-      retval = "/=";
-      break;
-
-    case op_ldiv_eq:
-      retval = "\\=";
-      break;
-
-    case op_pow_eq:
-      retval = "^=";
-      break;
-
-    case op_lshift_eq:
-      retval = "<<=";
-      break;
-
-    case op_rshift_eq:
-      retval = ">>=";
-      break;
-
-    case op_el_mul_eq:
-      retval = ".*=";
-      break;
-
-    case op_el_div_eq:
-      retval = "./=";
-      break;
-
-    case op_el_ldiv_eq:
-      retval = ".\\=";
-      break;
-
-    case op_el_pow_eq:
-      retval = ".^=";
-      break;
-
-    case op_el_and_eq:
-      retval = "&=";
-      break;
-
-    case op_el_or_eq:
-      retval = "|=";
-      break;
-
-    default:
-      retval = "<unknown>";
-    }
-
-  return retval;
-}
-
-octave_value::assign_op
-octave_value::binary_op_to_assign_op (binary_op op)
-{
-  assign_op retval;
-
-  switch (op)
-    {
-    case op_add:
-      retval = op_add_eq;
-      break;
-    case op_sub:
-      retval = op_sub_eq;
-      break;
-    case op_mul:
-      retval = op_mul_eq;
-      break;
-    case op_div:
-      retval = op_div_eq;
-      break;
-    case op_el_mul:
-      retval = op_el_mul_eq;
-      break;
-    case op_el_div:
-      retval = op_el_div_eq;
-      break;
-    case op_el_and:
-      retval = op_el_and_eq;
-      break;
-    case op_el_or:
-      retval = op_el_or_eq;
-      break;
-    default:
-      retval = unknown_assign_op;
-    }
-
-  return retval;
-}
-
-octave_value::octave_value (short int i)
-  : rep (new octave_scalar (i))
-{
-}
-
-octave_value::octave_value (unsigned short int i)
-  : rep (new octave_scalar (i))
-{
-}
-
-octave_value::octave_value (int i)
-  : rep (new octave_scalar (i))
-{
-}
-
-octave_value::octave_value (unsigned int i)
-  : rep (new octave_scalar (i))
-{
-}
-
-octave_value::octave_value (long int i)
-  : rep (new octave_scalar (i))
-{
-}
-
-octave_value::octave_value (unsigned long int i)
-  : rep (new octave_scalar (i))
-{
-}
-
-#if defined (HAVE_LONG_LONG_INT)
-octave_value::octave_value (long long int i)
-  : rep (new octave_scalar (i))
-{
-}
-#endif
-
-#if defined (HAVE_UNSIGNED_LONG_LONG_INT)
-octave_value::octave_value (unsigned long long int i)
-  : rep (new octave_scalar (i))
-{
-}
-#endif
-
-octave_value::octave_value (octave_time t)
-  : rep (new octave_scalar (t.double_value ()))
-{
-}
-
-octave_value::octave_value (double d)
-  : rep (new octave_scalar (d))
-{
-}
-
-octave_value::octave_value (float d)
-  : rep (new octave_float_scalar (d))
-{
-}
-
-octave_value::octave_value (const Cell& c, bool is_csl)
-  : rep (is_csl
-         ? dynamic_cast<octave_base_value *> (new octave_cs_list (c))
-         : dynamic_cast<octave_base_value *> (new octave_cell (c)))
-{
-}
-
-octave_value::octave_value (const Array<octave_value>& a, bool is_csl)
-  : rep (is_csl
-         ? dynamic_cast<octave_base_value *> (new octave_cs_list (Cell (a)))
-         : dynamic_cast<octave_base_value *> (new octave_cell (Cell (a))))
-{
-}
-
-octave_value::octave_value (const Matrix& m, const MatrixType& t)
-  : rep (new octave_matrix (m, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatMatrix& m, const MatrixType& t)
-  : rep (new octave_float_matrix (m, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const NDArray& a)
-  : rep (new octave_matrix (a))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatNDArray& a)
-  : rep (new octave_float_matrix (a))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<double>& a)
-  : rep (new octave_matrix (a))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<float>& a)
-  : rep (new octave_float_matrix (a))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const DiagMatrix& d)
-  : rep (new octave_diag_matrix (d))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatDiagMatrix& d)
-  : rep (new octave_float_diag_matrix (d))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const RowVector& v)
-  : rep (new octave_matrix (v))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatRowVector& v)
-  : rep (new octave_float_matrix (v))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const ColumnVector& v)
-  : rep (new octave_matrix (v))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatColumnVector& v)
-  : rep (new octave_float_matrix (v))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Complex& C)
-  : rep (new octave_complex (C))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatComplex& C)
-  : rep (new octave_float_complex (C))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const ComplexMatrix& m, const MatrixType& t)
-  : rep (new octave_complex_matrix (m, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatComplexMatrix& m, const MatrixType& t)
-  : rep (new octave_float_complex_matrix (m, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const ComplexNDArray& a)
-  : rep (new octave_complex_matrix (a))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatComplexNDArray& a)
-  : rep (new octave_float_complex_matrix (a))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<Complex>& a)
-  : rep (new octave_complex_matrix (a))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<FloatComplex>& a)
-  : rep (new octave_float_complex_matrix (a))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const ComplexDiagMatrix& d)
-  : rep (new octave_complex_diag_matrix (d))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatComplexDiagMatrix& d)
-  : rep (new octave_float_complex_diag_matrix (d))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const ComplexRowVector& v)
-  : rep (new octave_complex_matrix (v))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatComplexRowVector& v)
-  : rep (new octave_float_complex_matrix (v))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const ComplexColumnVector& v)
-  : rep (new octave_complex_matrix (v))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const FloatComplexColumnVector& v)
-  : rep (new octave_float_complex_matrix (v))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const PermMatrix& p)
-  : rep (new octave_perm_matrix (p))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (bool b)
-  : rep (new octave_bool (b))
-{
-}
-
-octave_value::octave_value (const boolMatrix& bm, const MatrixType& t)
-  : rep (new octave_bool_matrix (bm, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const boolNDArray& bnda)
-  : rep (new octave_bool_matrix (bnda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<bool>& bnda)
-  : rep (new octave_bool_matrix (bnda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (char c, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (c)
-         : new octave_char_matrix_sq_str (c))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const char *s, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (s)
-         : new octave_char_matrix_sq_str (s))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const std::string& s, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (s)
-         : new octave_char_matrix_sq_str (s))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const string_vector& s, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (s)
-         : new octave_char_matrix_sq_str (s))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const charMatrix& chm, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (chm)
-         : new octave_char_matrix_sq_str (chm))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const charNDArray& chm, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (chm)
-         : new octave_char_matrix_sq_str (chm))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<char>& chm, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (chm)
-         : new octave_char_matrix_sq_str (chm))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const charMatrix& chm, bool, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (chm)
-         : new octave_char_matrix_sq_str (chm))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const charNDArray& chm, bool, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (chm)
-         : new octave_char_matrix_sq_str (chm))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<char>& chm, bool, char type)
-  : rep (type == '"'
-         ? new octave_char_matrix_dq_str (chm)
-         : new octave_char_matrix_sq_str (chm))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const SparseMatrix& m, const MatrixType &t)
-  : rep (new octave_sparse_matrix (m, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Sparse<double>& m, const MatrixType &t)
-  : rep (new octave_sparse_matrix (m, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const SparseComplexMatrix& m, const MatrixType &t)
-  : rep (new octave_sparse_complex_matrix (m, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Sparse<Complex>& m, const MatrixType &t)
-  : rep (new octave_sparse_complex_matrix (m, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const SparseBoolMatrix& bm, const MatrixType &t)
-  : rep (new octave_sparse_bool_matrix (bm, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Sparse<bool>& bm, const MatrixType &t)
-  : rep (new octave_sparse_bool_matrix (bm, t))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_int8& i)
-  : rep (new octave_int8_scalar (i))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_uint8& i)
-  : rep (new octave_uint8_scalar (i))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_int16& i)
-  : rep (new octave_int16_scalar (i))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_uint16& i)
-  : rep (new octave_uint16_scalar (i))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_int32& i)
-  : rep (new octave_int32_scalar (i))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_uint32& i)
-  : rep (new octave_uint32_scalar (i))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_int64& i)
-  : rep (new octave_int64_scalar (i))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_uint64& i)
-  : rep (new octave_uint64_scalar (i))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const int8NDArray& inda)
-  : rep (new octave_int8_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_int8>& inda)
-  : rep (new octave_int8_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const uint8NDArray& inda)
-  : rep (new octave_uint8_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_uint8>& inda)
-  : rep (new octave_uint8_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const int16NDArray& inda)
-  : rep (new octave_int16_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_int16>& inda)
-  : rep (new octave_int16_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const uint16NDArray& inda)
-  : rep (new octave_uint16_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_uint16>& inda)
-  : rep (new octave_uint16_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const int32NDArray& inda)
-  : rep (new octave_int32_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_int32>& inda)
-  : rep (new octave_int32_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const uint32NDArray& inda)
-  : rep (new octave_uint32_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_uint32>& inda)
-  : rep (new octave_uint32_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const int64NDArray& inda)
-  : rep (new octave_int64_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_int64>& inda)
-  : rep (new octave_int64_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const uint64NDArray& inda)
-  : rep (new octave_uint64_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_uint64>& inda)
-  : rep (new octave_uint64_matrix (inda))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<octave_idx_type>& inda, bool zero_based,
-                            bool cache_index)
-  : rep (new octave_matrix (inda, zero_based, cache_index))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const idx_vector& idx, bool lazy)
-  : rep ()
-{
-  double scalar;
-  Range range;
-  NDArray array;
-  boolNDArray mask;
-  idx_vector::idx_class_type idx_class;
-
-  if (lazy)
-    {
-      // Only make lazy indices out of ranges and index vectors.
-      switch (idx.idx_class ())
-        {
-        case idx_vector::class_range:
-        case idx_vector::class_vector:
-          rep = new octave_lazy_index (idx);
-          maybe_mutate ();
-          return;
-        default:
-          break;
-        }
-    }
-
-  idx.unconvert (idx_class, scalar, range, array, mask);
-
-  switch (idx_class)
-    {
-    case idx_vector::class_colon:
-      rep = new octave_magic_colon ();
-      break;
-    case idx_vector::class_range:
-      rep = new octave_range (range, idx);
-      break;
-    case idx_vector::class_scalar:
-      rep = new octave_scalar (scalar);
-      break;
-    case idx_vector::class_vector:
-      rep = new octave_matrix (array, idx);
-      break;
-    case idx_vector::class_mask:
-      rep = new octave_bool_matrix (mask, idx);
-      break;
-    default:
-      assert (false);
-      break;
-    }
-
-  // FIXME: needed?
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Array<std::string>& cellstr)
-  : rep (new octave_cell (cellstr))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (double base, double limit, double inc)
-  : rep (new octave_range (base, limit, inc))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Range& r)
-  : rep (new octave_range (r))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_map& m)
-  : rep (new octave_struct (m))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const octave_scalar_map& m)
-  : rep (new octave_scalar_struct (m))
-{
-}
-
-octave_value::octave_value (const Octave_map& m)
-  : rep (new octave_struct (m))
-{
-  maybe_mutate ();
-}
-
-octave_value::octave_value (const Octave_map& m, const std::string& id,
-                            const std::list<std::string>& plist)
-  : rep (new octave_class (m, id, plist))
-{
-}
-
-octave_value::octave_value (const octave_value_list& l, bool)
-  : rep (new octave_cs_list (l))
-{
-}
-
-octave_value::octave_value (octave_value::magic_colon)
-  : rep (new octave_magic_colon ())
-{
-}
-
-octave_value::octave_value (octave_base_value *new_rep, bool borrow)
-  : rep (new_rep)
-{
-  if (borrow)
-    rep->count++;
-}
-
-octave_value::octave_value (octave_base_value *new_rep, int xcount)
-  : rep (new_rep)
-{
-  rep->count = xcount;
-}
-
-octave_base_value *
-octave_value::clone (void) const
-{
-  return rep->clone ();
-}
-
-void
-octave_value::maybe_mutate (void)
-{
-  octave_base_value *tmp = rep->try_narrowing_conversion ();
-
-  if (tmp && tmp != rep)
-    {
-      if (--rep->count == 0)
-        delete rep;
-
-      rep = tmp;
-    }
-}
-
-octave_value
-octave_value::single_subsref (const std::string& type,
-                              const octave_value_list& idx)
-{
-  std::list<octave_value_list> i;
-
-  i.push_back (idx);
-
-  return rep->subsref (type, i);
-}
-
-octave_value_list
-octave_value::subsref (const std::string& type,
-                       const std::list<octave_value_list>& idx, int nargout)
-{
-  if (nargout == 1)
-    return rep->subsref (type, idx);
-  else
-    return rep->subsref (type, idx, nargout);
-}
-
-octave_value_list
-octave_value::subsref (const std::string& type,
-                       const std::list<octave_value_list>& idx, int nargout,
-                       const std::list<octave_lvalue> *lvalue_list)
-{
-  if (lvalue_list)
-    return rep->subsref (type, idx, nargout, lvalue_list);
-  else
-    return subsref (type, idx, nargout);
-}
-
-octave_value
-octave_value::next_subsref (const std::string& type,
-                            const std::list<octave_value_list>& idx,
-                            size_t skip)
-{
-  if (! error_state && idx.size () > skip)
-    {
-      std::list<octave_value_list> new_idx (idx);
-      for (size_t i = 0; i < skip; i++)
-        new_idx.erase (new_idx.begin ());
-      return subsref (type.substr (skip), new_idx);
-    }
-  else
-    return *this;
-}
-
-octave_value_list
-octave_value::next_subsref (int nargout, const std::string& type,
-                            const std::list<octave_value_list>& idx,
-                            size_t skip)
-{
-  if (! error_state && idx.size () > skip)
-    {
-      std::list<octave_value_list> new_idx (idx);
-      for (size_t i = 0; i < skip; i++)
-        new_idx.erase (new_idx.begin ());
-      return subsref (type.substr (skip), new_idx, nargout);
-    }
-  else
-    return *this;
-}
-
-octave_value
-octave_value::next_subsref (bool auto_add, const std::string& type,
-                            const std::list<octave_value_list>& idx,
-                            size_t skip)
-{
-  if (! error_state && idx.size () > skip)
-    {
-      std::list<octave_value_list> new_idx (idx);
-      for (size_t i = 0; i < skip; i++)
-        new_idx.erase (new_idx.begin ());
-      return subsref (type.substr (skip), new_idx, auto_add);
-    }
-  else
-    return *this;
-}
-
-octave_value_list
-octave_value::do_multi_index_op (int nargout, const octave_value_list& idx)
-{
-  return rep->do_multi_index_op (nargout, idx);
-}
-
-octave_value_list
-octave_value::do_multi_index_op (int nargout, const octave_value_list& idx,
-                                 const std::list<octave_lvalue> *lvalue_list)
-{
-  return rep->do_multi_index_op (nargout, idx, lvalue_list);
-}
-
-#if 0
-static void
-gripe_assign_failed (const std::string& on, const std::string& tn1,
-                     const std::string& tn2)
-{
-  error ("assignment failed for `%s %s %s'",
-         tn1.c_str (), on.c_str (), tn2.c_str ());
-}
-#endif
-
-static void
-gripe_assign_failed_or_no_method (const std::string& on,
-                                  const std::string& tn1,
-                                  const std::string& tn2)
-{
-  error ("assignment failed, or no method for `%s %s %s'",
-         tn1.c_str (), on.c_str (), tn2.c_str ());
-}
-
-octave_value
-octave_value::subsasgn (const std::string& type,
-                        const std::list<octave_value_list>& idx,
-                        const octave_value& rhs)
-{
-  return rep->subsasgn (type, idx, rhs);
-}
-
-octave_value
-octave_value::undef_subsasgn (const std::string& type,
-                              const std::list<octave_value_list>& idx,
-                              const octave_value& rhs)
-{
-  return rep->undef_subsasgn (type, idx, rhs);
-}
-
-octave_value&
-octave_value::assign (assign_op op, const std::string& type,
-                      const std::list<octave_value_list>& idx,
-                      const octave_value& rhs)
-{
-  octave_value retval;
-
-  make_unique ();
-
-  octave_value t_rhs = rhs;
-
-  if (op != op_asn_eq)
-    {
-      if (is_defined ())
-        {
-          octave_value t = subsref (type, idx);
-
-          if (! error_state)
-            {
-              binary_op binop = op_eq_to_binary_op (op);
-
-              if (! error_state)
-                t_rhs = do_binary_op (binop, t, rhs);
-            }
-        }
-      else
-        error ("in computed assignment A(index) OP= X, A must be defined first");
-    }
-
-  if (! error_state)
-    {
-      octave_value tmp = subsasgn (type, idx, t_rhs);
-
-      if (error_state)
-        gripe_assign_failed_or_no_method (assign_op_as_string (op_asn_eq),
-                                          type_name (), rhs.type_name ());
-      else
-        *this = tmp;
-    }
-
-  return *this;
-}
-
-octave_value&
-octave_value::assign (assign_op op, const octave_value& rhs)
-{
-  if (op == op_asn_eq)
-    // Regularize a null matrix if stored into a variable.
-    operator = (rhs.storable_value ());
-  else if (is_defined ())
-    {
-      octave_value_typeinfo::assign_op_fcn f = 0;
-
-      // Only attempt to operate in-place if this variable is unshared.
-      if (rep->count == 1)
-        {
-          int tthis = this->type_id ();
-          int trhs = rhs.type_id ();
-
-          f = octave_value_typeinfo::lookup_assign_op (op, tthis, trhs);
-        }
-
-      if (f)
-        {
-          try
-            {
-              f (*rep, octave_value_list (), *rhs.rep);
-              maybe_mutate (); // Usually unnecessary, but may be needed (complex arrays).
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        {
-
-          binary_op binop = op_eq_to_binary_op (op);
-
-          if (! error_state)
-            {
-              octave_value t = do_binary_op (binop, *this, rhs);
-
-              if (! error_state)
-                operator = (t);
-            }
-        }
-    }
-  else
-    error ("in computed assignment A OP= X, A must be defined first");
-
-  return *this;
-}
-
-octave_idx_type
-octave_value::length (void) const
-{
-  octave_idx_type retval = 0;
-
-  const dim_vector dv = dims ();
-
-  for (int i = 0; i < dv.length (); i++)
-    {
-      if (dv(i) == 0)
-        {
-          retval = 0;
-          break;
-        }
-
-      if (dv(i) > retval)
-        retval = dv(i);
-    }
-
-  return retval;
-}
-
-bool
-octave_value::is_equal (const octave_value& test) const
-{
-  bool retval = false;
-
-  // If there is no op_eq for these types, we can't compare values.
-
-  if (rows () == test.rows () && columns () == test.columns ())
-    {
-      octave_value tmp = do_binary_op (octave_value::op_eq, *this, test);
-
-      // Empty array also means a match.
-      if (! error_state && tmp.is_defined ())
-        retval = tmp.is_true () || tmp.is_empty ();
-    }
-
-  return retval;
-}
-
-Cell
-octave_value::cell_value (void) const
-{
-  return rep->cell_value ();
-}
-
-// Define the idx_type_value function here instead of in ov.h to avoid
-// needing definitions for the SIZEOF_X macros in ov.h.
-
-octave_idx_type
-octave_value::idx_type_value (bool req_int, bool frc_str_conv) const
-{
-#if SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_LONG
-  return long_value (req_int, frc_str_conv);
-#elif SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_INT
-  return int_value (req_int, frc_str_conv);
-#else
-#error "no octave_value extractor for octave_idx_type"
-#endif
-}
-
-octave_map
-octave_value::map_value (void) const
-{
-  return rep->map_value ();
-}
-
-octave_scalar_map
-octave_value::scalar_map_value (void) const
-{
-  return rep->scalar_map_value ();
-}
-
-octave_function *
-octave_value::function_value (bool silent) const
-{
-  return rep->function_value (silent);
-}
-
-octave_user_function *
-octave_value::user_function_value (bool silent) const
-{
-  return rep->user_function_value (silent);
-}
-
-octave_user_script *
-octave_value::user_script_value (bool silent) const
-{
-  return rep->user_script_value (silent);
-}
-
-octave_user_code *
-octave_value::user_code_value (bool silent) const
-{
-  return rep->user_code_value (silent);
-}
-
-octave_fcn_handle *
-octave_value::fcn_handle_value (bool silent) const
-{
-  return rep->fcn_handle_value (silent);
-}
-
-octave_fcn_inline *
-octave_value::fcn_inline_value (bool silent) const
-{
-  return rep->fcn_inline_value (silent);
-}
-
-octave_value_list
-octave_value::list_value (void) const
-{
-  return rep->list_value ();
-}
-
-static dim_vector
-make_vector_dims (const dim_vector& dv, bool force_vector_conversion,
-                  const std::string& my_type, const std::string& wanted_type)
-{
-  dim_vector retval (dv);
-  retval.chop_trailing_singletons ();
-  octave_idx_type nel = dv.numel ();
-
-  if (retval.length () > 2 || (retval(0) != 1 && retval(1) != 1))
-    {
-      if (!force_vector_conversion)
-        gripe_implicit_conversion ("Octave:array-to-vector",
-                                   my_type.c_str (), wanted_type.c_str ());
-      retval = dim_vector (nel, 1);
-    }
-
-  return retval;
-}
-
-ColumnVector
-octave_value::column_vector_value (bool force_string_conv,
-                                   bool frc_vec_conv) const
-{
-  return ColumnVector (vector_value (force_string_conv,
-                                     frc_vec_conv));
-}
-
-ComplexColumnVector
-octave_value::complex_column_vector_value (bool force_string_conv,
-                                           bool frc_vec_conv) const
-{
-  return ComplexColumnVector (complex_vector_value (force_string_conv,
-                                                    frc_vec_conv));
-}
-
-RowVector
-octave_value::row_vector_value (bool force_string_conv,
-                                bool frc_vec_conv) const
-{
-  return RowVector (vector_value (force_string_conv,
-                                  frc_vec_conv));
-}
-
-ComplexRowVector
-octave_value::complex_row_vector_value (bool force_string_conv,
-                                        bool frc_vec_conv) const
-{
-  return ComplexRowVector (complex_vector_value (force_string_conv,
-                                                 frc_vec_conv));
-}
-
-Array<double>
-octave_value::vector_value (bool force_string_conv,
-                            bool force_vector_conversion) const
-{
-  Array<double> retval = array_value (force_string_conv);
-
-  if (error_state)
-    return retval;
-  else
-    return retval.reshape (make_vector_dims (retval.dims (),
-                                             force_vector_conversion,
-                                             type_name (), "real vector"));
-}
-
-template <class T>
-static Array<int>
-convert_to_int_array (const Array<octave_int<T> >& A)
-{
-  Array<int> retval (A.dims ());
-  octave_idx_type n = A.numel ();
-
-  for (octave_idx_type i = 0; i < n; i++)
-    retval.xelem (i) = octave_int<int> (A.xelem (i));
-
-  return retval;
-}
-
-Array<int>
-octave_value::int_vector_value (bool force_string_conv, bool require_int,
-                                bool force_vector_conversion) const
-{
-  Array<int> retval;
-
-  if (is_integer_type ())
-    {
-      if (is_int32_type ())
-        retval = convert_to_int_array (int32_array_value ());
-      else if (is_int64_type ())
-        retval = convert_to_int_array (int64_array_value ());
-      else if (is_int16_type ())
-        retval = convert_to_int_array (int16_array_value ());
-      else if (is_int8_type ())
-        retval = convert_to_int_array (int8_array_value ());
-      else if (is_uint32_type ())
-        retval = convert_to_int_array (uint32_array_value ());
-      else if (is_uint64_type ())
-        retval = convert_to_int_array (uint64_array_value ());
-      else if (is_uint16_type ())
-        retval = convert_to_int_array (uint16_array_value ());
-      else if (is_uint8_type ())
-        retval = convert_to_int_array (uint8_array_value ());
-      else
-        retval = array_value (force_string_conv);
-    }
-  else
-    {
-      const NDArray a = array_value (force_string_conv);
-      if (! error_state)
-        {
-          if (require_int)
-            {
-              retval.resize (a.dims ());
-              for (octave_idx_type i = 0; i < a.numel (); i++)
-                {
-                  double ai = a.elem (i);
-                  int v = static_cast<int> (ai);
-                  if (ai == v)
-                    retval.xelem (i) = v;
-                  else
-                    {
-                      error_with_cfn ("conversion to integer value failed");
-                      break;
-                    }
-                }
-            }
-          else
-            retval = Array<int> (a);
-        }
-    }
-
-
-  if (error_state)
-    return retval;
-  else
-    return retval.reshape (make_vector_dims (retval.dims (),
-                                             force_vector_conversion,
-                                             type_name (), "integer vector"));
-}
-
-template <class T>
-static Array<octave_idx_type>
-convert_to_octave_idx_type_array (const Array<octave_int<T> >& A)
-{
-  Array<octave_idx_type> retval (A.dims ());
-  octave_idx_type n = A.numel ();
-
-  for (octave_idx_type i = 0; i < n; i++)
-    retval.xelem (i) = octave_int<octave_idx_type> (A.xelem (i));
-
-  return retval;
-}
-
-Array<octave_idx_type>
-octave_value::octave_idx_type_vector_value (bool require_int,
-                                            bool force_string_conv,
-                                            bool force_vector_conversion) const
-{
-  Array<octave_idx_type> retval;
-
-  if (is_integer_type ())
-    {
-      if (is_int32_type ())
-        retval = convert_to_octave_idx_type_array (int32_array_value ());
-      else if (is_int64_type ())
-        retval = convert_to_octave_idx_type_array (int64_array_value ());
-      else if (is_int16_type ())
-        retval = convert_to_octave_idx_type_array (int16_array_value ());
-      else if (is_int8_type ())
-        retval = convert_to_octave_idx_type_array (int8_array_value ());
-      else if (is_uint32_type ())
-        retval = convert_to_octave_idx_type_array (uint32_array_value ());
-      else if (is_uint64_type ())
-        retval = convert_to_octave_idx_type_array (uint64_array_value ());
-      else if (is_uint16_type ())
-        retval = convert_to_octave_idx_type_array (uint16_array_value ());
-      else if (is_uint8_type ())
-        retval = convert_to_octave_idx_type_array (uint8_array_value ());
-      else
-        retval = array_value (force_string_conv);
-    }
-  else
-    {
-      const NDArray a = array_value (force_string_conv);
-      if (! error_state)
-        {
-          if (require_int)
-            {
-              retval.resize (a.dims ());
-              for (octave_idx_type i = 0; i < a.numel (); i++)
-                {
-                  double ai = a.elem (i);
-                  octave_idx_type v = static_cast<octave_idx_type> (ai);
-                  if (ai == v)
-                    retval.xelem (i) = v;
-                  else
-                    {
-                      error_with_cfn ("conversion to integer value failed");
-                      break;
-                    }
-                }
-            }
-          else
-            retval = Array<octave_idx_type> (a);
-        }
-    }
-
-
-  if (error_state)
-    return retval;
-  else
-    return retval.reshape (make_vector_dims (retval.dims (),
-                                             force_vector_conversion,
-                                             type_name (), "integer vector"));
-}
-
-Array<Complex>
-octave_value::complex_vector_value (bool force_string_conv,
-                                    bool force_vector_conversion) const
-{
-  Array<Complex> retval = complex_array_value (force_string_conv);
-
-  if (error_state)
-    return retval;
-  else
-    return retval.reshape (make_vector_dims (retval.dims (),
-                                             force_vector_conversion,
-                                             type_name (), "complex vector"));
-}
-
-FloatColumnVector
-octave_value::float_column_vector_value (bool force_string_conv,
-                                         bool frc_vec_conv) const
-{
-  return FloatColumnVector (float_vector_value (force_string_conv,
-                                                frc_vec_conv));
-}
-
-FloatComplexColumnVector
-octave_value::float_complex_column_vector_value (bool force_string_conv,
-                                                 bool frc_vec_conv) const
-{
-  return FloatComplexColumnVector (float_complex_vector_value (force_string_conv,
-                                                               frc_vec_conv));
-}
-
-FloatRowVector
-octave_value::float_row_vector_value (bool force_string_conv,
-                                      bool frc_vec_conv) const
-{
-  return FloatRowVector (float_vector_value (force_string_conv,
-                                             frc_vec_conv));
-}
-
-FloatComplexRowVector
-octave_value::float_complex_row_vector_value (bool force_string_conv,
-                                              bool frc_vec_conv) const
-{
-  return FloatComplexRowVector (float_complex_vector_value (force_string_conv,
-                                                           frc_vec_conv));
-}
-
-Array<float>
-octave_value::float_vector_value (bool force_string_conv,
-                                  bool force_vector_conversion) const
-{
-  Array<float> retval = float_array_value (force_string_conv);
-
-  if (error_state)
-    return retval;
-  else
-    return retval.reshape (make_vector_dims (retval.dims (),
-                                             force_vector_conversion,
-                                             type_name (), "real vector"));
-}
-
-Array<FloatComplex>
-octave_value::float_complex_vector_value (bool force_string_conv,
-                                          bool force_vector_conversion) const
-{
-  Array<FloatComplex> retval = float_complex_array_value (force_string_conv);
-
-  if (error_state)
-    return retval;
-  else
-    return retval.reshape (make_vector_dims (retval.dims (),
-                                             force_vector_conversion,
-                                             type_name (), "complex vector"));
-}
-
-octave_value
-octave_value::storable_value (void) const
-{
-  octave_value retval = *this;
-  if (is_null_value ())
-    retval = octave_value (rep->empty_clone ());
-  else
-    retval.maybe_economize ();
-
-  return retval;
-}
-
-void
-octave_value::make_storable_value (void)
-{
-  if (is_null_value ())
-    {
-      octave_base_value *rc = rep->empty_clone ();
-      if (--rep->count == 0)
-        delete rep;
-      rep = rc;
-    }
-  else
-    maybe_economize ();
-}
-
-int
-octave_value::write (octave_stream& os, int block_size,
-                     oct_data_conv::data_type output_type, int skip,
-                     oct_mach_info::float_format flt_fmt) const
-{
-  return rep->write (os, block_size, output_type, skip, flt_fmt);
-}
-
-static void
-gripe_binary_op (const std::string& on, const std::string& tn1,
-                 const std::string& tn2)
-{
-  error ("binary operator `%s' not implemented for `%s' by `%s' operations",
-         on.c_str (), tn1.c_str (), tn2.c_str ());
-}
-
-static void
-gripe_binary_op_conv (const std::string& on)
-{
-  error ("type conversion failed for binary operator `%s'", on.c_str ());
-}
-
-octave_value
-do_binary_op (octave_value::binary_op op,
-              const octave_value& v1, const octave_value& v2)
-{
-  octave_value retval;
-
-  int t1 = v1.type_id ();
-  int t2 = v2.type_id ();
-
-  if (t1 == octave_class::static_type_id ()
-      || t2 == octave_class::static_type_id ())
-    {
-      octave_value_typeinfo::binary_class_op_fcn f
-        = octave_value_typeinfo::lookup_binary_class_op (op);
-
-      if (f)
-        {
-          try
-            {
-              retval = f (v1, v2);
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        gripe_binary_op (octave_value::binary_op_as_string (op),
-                         v1.class_name (), v2.class_name ());
-    }
-  else
-    {
-      // FIXME -- we need to handle overloading operators for built-in
-      // classes (double, char, int8, etc.)
-
-      octave_value_typeinfo::binary_op_fcn f
-        = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
-
-      if (f)
-        {
-          try
-            {
-              retval = f (*v1.rep, *v2.rep);
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        {
-          octave_value tv1;
-          octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
-
-          octave_value tv2;
-          octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
-
-          // Try biased (one-sided) conversions first.
-          if (cf2.type_id () >= 0 &&
-              octave_value_typeinfo::lookup_binary_op (op, t1, cf2.type_id ()))
-            cf1 = 0;
-          else if (cf1.type_id () >= 0 &&
-                   octave_value_typeinfo::lookup_binary_op (op, cf1.type_id (), t2))
-            cf2 = 0;
-
-          if (cf1)
-            {
-              octave_base_value *tmp = cf1 (*v1.rep);
-
-              if (tmp)
-                {
-                  tv1 = octave_value (tmp);
-                  t1 = tv1.type_id ();
-                }
-              else
-                {
-                  gripe_binary_op_conv (octave_value::binary_op_as_string (op));
-                  return retval;
-                }
-            }
-          else
-            tv1 = v1;
-
-          if (cf2)
-            {
-              octave_base_value *tmp = cf2 (*v2.rep);
-
-              if (tmp)
-                {
-                  tv2 = octave_value (tmp);
-                  t2 = tv2.type_id ();
-                }
-              else
-                {
-                  gripe_binary_op_conv (octave_value::binary_op_as_string (op));
-                  return retval;
-                }
-            }
-          else
-            tv2 = v2;
-
-          if (cf1 || cf2)
-            {
-              retval = do_binary_op (op, tv1, tv2);
-            }
-          else
-            {
-              //demote double -> single and try again
-              cf1 = tv1.numeric_demotion_function ();
-
-              cf2 = tv2.numeric_demotion_function ();
-
-              // Try biased (one-sided) conversions first.
-              if (cf2.type_id () >= 0
-                  && octave_value_typeinfo::lookup_binary_op (op, t1, cf2.type_id ()))
-                cf1 = 0;
-              else if (cf1.type_id () >= 0
-                       && octave_value_typeinfo::lookup_binary_op (op, cf1.type_id (), t2))
-                cf2 = 0;
-
-              if (cf1)
-                {
-                  octave_base_value *tmp = cf1 (*tv1.rep);
-
-                  if (tmp)
-                    {
-                      tv1 = octave_value (tmp);
-                      t1 = tv1.type_id ();
-                    }
-                  else
-                    {
-                      gripe_binary_op_conv (octave_value::binary_op_as_string (op));
-                      return retval;
-                    }
-                }
-
-              if (cf2)
-                {
-                  octave_base_value *tmp = cf2 (*tv2.rep);
-
-                  if (tmp)
-                    {
-                      tv2 = octave_value (tmp);
-                      t2 = tv2.type_id ();
-                    }
-                  else
-                    {
-                      gripe_binary_op_conv (octave_value::binary_op_as_string (op));
-                      return retval;
-                    }
-                }
-
-              if (cf1 || cf2)
-                {
-                  f = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
-
-                  if (f)
-                    {
-                      try
-                        {
-                          retval = f (*tv1.rep, *tv2.rep);
-                        }
-                      catch (octave_execution_exception)
-                        {
-                          gripe_library_execution_error ();
-                        }
-                    }
-                  else
-                    gripe_binary_op (octave_value::binary_op_as_string (op),
-                                     v1.type_name (), v2.type_name ());
-                }
-              else
-                gripe_binary_op (octave_value::binary_op_as_string (op),
-                                 v1.type_name (), v2.type_name ());
-            }
-        }
-    }
-
-  return retval;
-}
-
-static octave_value
-decompose_binary_op (octave_value::compound_binary_op op,
-                     const octave_value& v1, const octave_value& v2)
-{
-  octave_value retval;
-
-  switch (op)
-    {
-    case octave_value::op_trans_mul:
-      retval = do_binary_op (octave_value::op_mul,
-                             do_unary_op (octave_value::op_transpose, v1),
-                             v2);
-      break;
-    case octave_value::op_mul_trans:
-      retval = do_binary_op (octave_value::op_mul,
-                             v1,
-                             do_unary_op (octave_value::op_transpose, v2));
-      break;
-    case octave_value::op_herm_mul:
-      retval = do_binary_op (octave_value::op_mul,
-                             do_unary_op (octave_value::op_hermitian, v1),
-                             v2);
-      break;
-    case octave_value::op_mul_herm:
-      retval = do_binary_op (octave_value::op_mul,
-                             v1,
-                             do_unary_op (octave_value::op_hermitian, v2));
-      break;
-    case octave_value::op_trans_ldiv:
-      retval = do_binary_op (octave_value::op_ldiv,
-                             do_unary_op (octave_value::op_transpose, v1),
-                             v2);
-      break;
-    case octave_value::op_herm_ldiv:
-      retval = do_binary_op (octave_value::op_ldiv,
-                             do_unary_op (octave_value::op_hermitian, v1),
-                             v2);
-      break;
-    case octave_value::op_el_not_and:
-      retval = do_binary_op (octave_value::op_el_and,
-                             do_unary_op (octave_value::op_not, v1),
-                             v2);
-      break;
-    case octave_value::op_el_not_or:
-      retval = do_binary_op (octave_value::op_el_or,
-                             do_unary_op (octave_value::op_not, v1),
-                             v2);
-      break;
-    case octave_value::op_el_and_not:
-      retval = do_binary_op (octave_value::op_el_and,
-                             v1,
-                             do_unary_op (octave_value::op_not, v2));
-      break;
-    case octave_value::op_el_or_not:
-      retval = do_binary_op (octave_value::op_el_or,
-                             v1,
-                             do_unary_op (octave_value::op_not, v2));
-      break;
-    default:
-      error ("invalid compound operator");
-      break;
-    }
-
-  return retval;
-}
-
-octave_value
-do_binary_op (octave_value::compound_binary_op op,
-              const octave_value& v1, const octave_value& v2)
-{
-  octave_value retval;
-
-  int t1 = v1.type_id ();
-  int t2 = v2.type_id ();
-
-  if (t1 == octave_class::static_type_id ()
-      || t2 == octave_class::static_type_id ())
-    {
-      octave_value_typeinfo::binary_class_op_fcn f
-        = octave_value_typeinfo::lookup_binary_class_op (op);
-
-      if (f)
-        {
-          try
-            {
-              retval = f (v1, v2);
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        retval = decompose_binary_op (op, v1, v2);
-    }
-  else
-    {
-      octave_value_typeinfo::binary_op_fcn f
-        = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
-
-      if (f)
-        {
-          try
-            {
-              retval = f (*v1.rep, *v2.rep);
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        retval = decompose_binary_op (op, v1, v2);
-    }
-
-  return retval;
-}
-
-static void
-gripe_cat_op (const std::string& tn1, const std::string& tn2)
-{
-  error ("concatenation operator not implemented for `%s' by `%s' operations",
-         tn1.c_str (), tn2.c_str ());
-}
-
-static void
-gripe_cat_op_conv (void)
-{
-  error ("type conversion failed for concatenation operator");
-}
-
-octave_value
-do_cat_op (const octave_value& v1, const octave_value& v2,
-           const Array<octave_idx_type>& ra_idx)
-{
-  octave_value retval;
-
-  // Can't rapid return for concatenation with an empty object here as
-  // something like cat(1,[],single([]) must return the correct type.
-
-  int t1 = v1.type_id ();
-  int t2 = v2.type_id ();
-
-  octave_value_typeinfo::cat_op_fcn f
-    = octave_value_typeinfo::lookup_cat_op (t1, t2);
-
-  if (f)
-    {
-      try
-        {
-          retval = f (*v1.rep, *v2.rep, ra_idx);
-        }
-      catch (octave_execution_exception)
-        {
-          gripe_library_execution_error ();
-        }
-    }
-  else
-    {
-      octave_value tv1;
-      octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
-
-      octave_value tv2;
-      octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
-
-      // Try biased (one-sided) conversions first.
-      if (cf2.type_id () >= 0
-          && octave_value_typeinfo::lookup_cat_op (t1, cf2.type_id ()))
-        cf1 = 0;
-      else if (cf1.type_id () >= 0
-               && octave_value_typeinfo::lookup_cat_op (cf1.type_id (), t2))
-        cf2 = 0;
-
-      if (cf1)
-        {
-          octave_base_value *tmp = cf1 (*v1.rep);
-
-          if (tmp)
-            {
-              tv1 = octave_value (tmp);
-              t1 = tv1.type_id ();
-            }
-          else
-            {
-              gripe_cat_op_conv ();
-              return retval;
-            }
-        }
-      else
-        tv1 = v1;
-
-      if (cf2)
-        {
-          octave_base_value *tmp = cf2 (*v2.rep);
-
-          if (tmp)
-            {
-              tv2 = octave_value (tmp);
-              t2 = tv2.type_id ();
-            }
-          else
-            {
-              gripe_cat_op_conv ();
-              return retval;
-            }
-        }
-      else
-        tv2 = v2;
-
-      if (cf1 || cf2)
-        {
-          retval = do_cat_op (tv1, tv2, ra_idx);
-        }
-      else
-        gripe_cat_op (v1.type_name (), v2.type_name ());
-    }
-
-  return retval;
-}
-
-void
-octave_value::print_info (std::ostream& os, const std::string& prefix) const
-{
-  os << prefix << "type_name: " << type_name () << "\n"
-     << prefix << "count:     " << get_count () << "\n"
-     << prefix << "rep info:  ";
-
-  rep->print_info (os, prefix + " ");
-}
-
-static void
-gripe_unary_op (const std::string& on, const std::string& tn)
-{
-  error ("unary operator `%s' not implemented for `%s' operands",
-         on.c_str (), tn.c_str ());
-}
-
-static void
-gripe_unary_op_conv (const std::string& on)
-{
-  error ("type conversion failed for unary operator `%s'", on.c_str ());
-}
-
-octave_value
-do_unary_op (octave_value::unary_op op, const octave_value& v)
-{
-  octave_value retval;
-
-  int t = v.type_id ();
-
-  if (t == octave_class::static_type_id ())
-    {
-      octave_value_typeinfo::unary_class_op_fcn f
-        = octave_value_typeinfo::lookup_unary_class_op (op);
-
-      if (f)
-        {
-          try
-            {
-              retval = f (v);
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        gripe_unary_op (octave_value::unary_op_as_string (op),
-                        v.class_name ());
-    }
-  else
-    {
-      // FIXME -- we need to handle overloading operators for built-in
-      // classes (double, char, int8, etc.)
-
-      octave_value_typeinfo::unary_op_fcn f
-        = octave_value_typeinfo::lookup_unary_op (op, t);
-
-      if (f)
-        {
-          try
-            {
-              retval = f (*v.rep);
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        {
-          octave_value tv;
-          octave_base_value::type_conv_fcn cf
-            = v.numeric_conversion_function ();
-
-          if (cf)
-            {
-              octave_base_value *tmp = cf (*v.rep);
-
-              if (tmp)
-                {
-                  tv = octave_value (tmp);
-                  retval = do_unary_op (op, tv);
-                }
-              else
-                gripe_unary_op_conv (octave_value::unary_op_as_string (op));
-            }
-          else
-            gripe_unary_op (octave_value::unary_op_as_string (op),
-                            v.type_name ());
-        }
-    }
-
-  return retval;
-}
-
-static void
-gripe_unary_op_conversion_failed (const std::string& op,
-                                  const std::string& tn)
-{
-  error ("operator %s: type conversion for `%s' failed",
-         op.c_str (), tn.c_str ());
-}
-
-octave_value&
-octave_value::do_non_const_unary_op (unary_op op)
-{
-  if (op == op_incr || op == op_decr)
-    {
-      // We want the gripe just here, because in the other branch this should
-      // not happen, and if it did anyway (internal error), the message would
-      // be confusing.
-      if (is_undefined ())
-        {
-          std::string op_str = unary_op_as_string (op);
-          error ("in x%s or %sx, x must be defined first",
-                 op_str.c_str (), op_str.c_str ());
-          return *this;
-        }
-
-      // Genuine.
-      int t = type_id ();
-
-      octave_value_typeinfo::non_const_unary_op_fcn f
-        = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
-
-      if (f)
-        {
-          make_unique ();
-
-          try
-            {
-              f (*rep);
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        {
-          octave_base_value::type_conv_fcn cf = numeric_conversion_function ();
-
-          if (cf)
-            {
-              octave_base_value *tmp = cf (*rep);
-
-              if (tmp)
-                {
-                  octave_base_value *old_rep = rep;
-                  rep = tmp;
-
-                  t = type_id ();
-
-                  f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
-
-                  if (f)
-                    {
-                      try
-                        {
-                          f (*rep);
-                        }
-                      catch (octave_execution_exception)
-                        {
-                          gripe_library_execution_error ();
-                        }
-
-                      if (old_rep && --old_rep->count == 0)
-                        delete old_rep;
-                    }
-                  else
-                    {
-                      if (old_rep)
-                        {
-                          if (--rep->count == 0)
-                            delete rep;
-
-                          rep = old_rep;
-                        }
-
-                      gripe_unary_op (octave_value::unary_op_as_string (op),
-                                      type_name ());
-                    }
-                }
-              else
-                gripe_unary_op_conversion_failed
-                  (octave_value::unary_op_as_string (op), type_name ());
-            }
-          else
-            gripe_unary_op (octave_value::unary_op_as_string (op), type_name ());
-        }
-    }
-  else
-    {
-      // Non-genuine.
-      int t = type_id ();
-
-      octave_value_typeinfo::non_const_unary_op_fcn f = 0;
-
-      // Only attempt to operate in-place if this variable is unshared.
-      if (rep->count == 1)
-        f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
-
-      if (f)
-        {
-          try
-            {
-              f (*rep);
-            }
-          catch (octave_execution_exception)
-            {
-              gripe_library_execution_error ();
-            }
-        }
-      else
-        *this = do_unary_op (op, *this);
-    }
-
-  return *this;
-}
-
-octave_value&
-octave_value::do_non_const_unary_op (unary_op op, const std::string& type,
-                                     const std::list<octave_value_list>& idx)
-{
-  if (idx.empty ())
-    do_non_const_unary_op (op);
-  else
-    {
-      // FIXME -- only do the following stuff if we can't find a
-      // specific function to call to handle the op= operation for the
-      // types we have.
-
-      assign_op assop = unary_op_to_assign_op (op);
-
-      assign (assop, type, idx, 1.0);
-    }
-
-  return *this;
-}
-
-octave_value::assign_op
-octave_value::unary_op_to_assign_op (unary_op op)
-{
-  assign_op binop = unknown_assign_op;
-
-  switch (op)
-    {
-    case op_incr:
-      binop = op_add_eq;
-      break;
-
-    case op_decr:
-      binop = op_sub_eq;
-      break;
-
-    default:
-      {
-        std::string on = unary_op_as_string (op);
-        error ("operator %s: no assign operator found", on.c_str ());
-      }
-    }
-
-  return binop;
-}
-
-octave_value::binary_op
-octave_value::op_eq_to_binary_op (assign_op op)
-{
-  binary_op binop = unknown_binary_op;
-
-  switch (op)
-    {
-    case op_add_eq:
-      binop = op_add;
-      break;
-
-    case op_sub_eq:
-      binop = op_sub;
-      break;
-
-    case op_mul_eq:
-      binop = op_mul;
-      break;
-
-    case op_div_eq:
-      binop = op_div;
-      break;
-
-    case op_ldiv_eq:
-      binop = op_ldiv;
-      break;
-
-    case op_pow_eq:
-      binop = op_pow;
-      break;
-
-    case op_lshift_eq:
-      binop = op_lshift;
-      break;
-
-    case op_rshift_eq:
-      binop = op_rshift;
-      break;
-
-    case op_el_mul_eq:
-      binop = op_el_mul;
-      break;
-
-    case op_el_div_eq:
-      binop = op_el_div;
-      break;
-
-    case op_el_ldiv_eq:
-      binop = op_el_ldiv;
-      break;
-
-    case op_el_pow_eq:
-      binop = op_el_pow;
-      break;
-
-    case op_el_and_eq:
-      binop = op_el_and;
-      break;
-
-    case op_el_or_eq:
-      binop = op_el_or;
-      break;
-
-    default:
-      {
-        std::string on = assign_op_as_string (op);
-        error ("operator %s: no binary operator found", on.c_str ());
-      }
-    }
-
-  return binop;
-}
-
-octave_value
-octave_value::empty_conv (const std::string& type, const octave_value& rhs)
-{
-  octave_value retval;
-
-  if (type.length () > 0)
-    {
-      switch (type[0])
-        {
-        case '(':
-          {
-            if (type.length () > 1 && type[1] == '.')
-              retval = octave_map ();
-            else
-              retval = octave_value (rhs.empty_clone ());
-          }
-          break;
-
-        case '{':
-          retval = Cell ();
-          break;
-
-        case '.':
-          retval = octave_scalar_map ();
-          break;
-
-        default:
-          panic_impossible ();
-        }
-    }
-  else
-    retval = octave_value (rhs.empty_clone ());
-
-  return retval;
-}
-
-void
-install_types (void)
-{
-  octave_base_value::register_type ();
-  octave_cell::register_type ();
-  octave_scalar::register_type ();
-  octave_complex::register_type ();
-  octave_matrix::register_type ();
-  octave_diag_matrix::register_type ();
-  octave_complex_matrix::register_type ();
-  octave_complex_diag_matrix::register_type ();
-  octave_range::register_type ();
-  octave_bool::register_type ();
-  octave_bool_matrix::register_type ();
-  octave_char_matrix_str::register_type ();
-  octave_char_matrix_sq_str::register_type ();
-  octave_int8_scalar::register_type ();
-  octave_int16_scalar::register_type ();
-  octave_int32_scalar::register_type ();
-  octave_int64_scalar::register_type ();
-  octave_uint8_scalar::register_type ();
-  octave_uint16_scalar::register_type ();
-  octave_uint32_scalar::register_type ();
-  octave_uint64_scalar::register_type ();
-  octave_int8_matrix::register_type ();
-  octave_int16_matrix::register_type ();
-  octave_int32_matrix::register_type ();
-  octave_int64_matrix::register_type ();
-  octave_uint8_matrix::register_type ();
-  octave_uint16_matrix::register_type ();
-  octave_uint32_matrix::register_type ();
-  octave_uint64_matrix::register_type ();
-  octave_sparse_bool_matrix::register_type ();
-  octave_sparse_matrix::register_type ();
-  octave_sparse_complex_matrix::register_type ();
-  octave_struct::register_type ();
-  octave_scalar_struct::register_type ();
-  octave_class::register_type ();
-  octave_cs_list::register_type ();
-  octave_magic_colon::register_type ();
-  octave_builtin::register_type ();
-  octave_user_function::register_type ();
-  octave_dld_function::register_type ();
-  octave_fcn_handle::register_type ();
-  octave_fcn_inline::register_type ();
-  octave_float_scalar::register_type ();
-  octave_float_complex::register_type ();
-  octave_float_matrix::register_type ();
-  octave_float_diag_matrix::register_type ();
-  octave_float_complex_matrix::register_type ();
-  octave_float_complex_diag_matrix::register_type ();
-  octave_perm_matrix::register_type ();
-  octave_null_matrix::register_type ();
-  octave_null_str::register_type ();
-  octave_null_sq_str::register_type ();
-  octave_lazy_index::register_type ();
-  octave_oncleanup::register_type ();
-}
-
-DEFUN (sizeof, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} sizeof (@var{val})\n\
-Return the size of @var{val} in bytes.\n\
-@seealso{whos}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    retval = args(0).byte_size ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!assert (sizeof (uint64 (ones (3))), 72)
-%!assert (sizeof (double (zeros (2,4))), 64)
-%!assert (sizeof ({"foo", "bar", "baaz"}), 10)
-*/
-
-static void
-decode_subscripts (const char* name, const octave_value& arg,
-                   std::string& type_string,
-                   std::list<octave_value_list>& idx)
-{
-  const octave_map m = arg.map_value ();
-
-  if (! error_state
-      && m.nfields () == 2 && m.contains ("type") && m.contains ("subs"))
-    {
-      octave_idx_type nel = m.numel ();
-
-      type_string = std::string (nel, '\0');
-      idx = std::list<octave_value_list> ();
-
-      if (nel == 0)
-        return;
-
-      const Cell type = m.contents ("type");
-      const Cell subs = m.contents ("subs");
-
-      for (int k = 0; k < nel; k++)
-        {
-          std::string item = type(k).string_value ();
-
-          if (! error_state)
-            {
-              if (item == "{}")
-                type_string[k] = '{';
-              else if (item == "()")
-                type_string[k] = '(';
-              else if (item == ".")
-                type_string[k] = '.';
-              else
-                {
-                  error ("%s: invalid indexing type `%s'", name, item.c_str ());
-                  return;
-                }
-            }
-          else
-            {
-              error ("%s: expecting type(%d) to be a character string",
-                     name, k+1);
-              return;
-            }
-
-          octave_value_list idx_item;
-
-          if (subs(k).is_string ())
-            idx_item(0) = subs(k);
-          else if (subs(k).is_cell ())
-            {
-              Cell subs_cell = subs(k).cell_value ();
-
-              for (int n = 0; n < subs_cell.length (); n++)
-                {
-                  if (subs_cell(n).is_string ()
-                      && subs_cell(n).string_value () == ":")
-                    idx_item(n) = octave_value(octave_value::magic_colon_t);
-                  else
-                    idx_item(n) = subs_cell(n);
-                }
-            }
-          else
-            {
-              error ("%s: expecting subs(%d) to be a character string or cell array",
-                     name, k+1);
-              return;
-            }
-
-          idx.push_back (idx_item);
-        }
-    }
-  else
-    error ("%s: second argument must be a structure with fields `type' and `subs'", name);
-}
-
-DEFUN (subsref, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} subsref (@var{val}, @var{idx})\n\
-Perform the subscripted element selection operation according to\n\
-the subscript specified by @var{idx}.\n\
-\n\
-The subscript @var{idx} is expected to be a structure array with\n\
-fields @samp{type} and @samp{subs}.  Valid values for @samp{type}\n\
-are @samp{\"()\"}, @samp{\"@{@}\"}, and @samp{\".\"}.\n\
-The @samp{subs} field may be either @samp{\":\"} or a cell array\n\
-of index values.\n\
-\n\
-The following example shows how to extract the two first columns of\n\
-a matrix\n\
-\n\
-@example\n\
-@group\n\
-val = magic (3)\n\
-    @result{} val = [ 8   1   6\n\
-               3   5   7\n\
-               4   9   2 ]\n\
-idx.type = \"()\";\n\
-idx.subs = @{\":\", 1:2@};\n\
-subsref (val, idx)\n\
-     @result{} [ 8   1\n\
-          3   5\n\
-          4   9 ]\n\
-@end group\n\
-@end example\n\
-\n\
-@noindent\n\
-Note that this is the same as writing @code{val(:,1:2)}.\n\
-\n\
-If @var{idx} is an empty structure array with fields @samp{type}\n\
-and @samp{subs}, return @var{val}.\n\
-@seealso{subsasgn, substruct}\n\
-@end deftypefn")
-{
-  octave_value_list retval;
-
-  if (args.length () == 2)
-    {
-      std::string type;
-      std::list<octave_value_list> idx;
-
-      decode_subscripts ("subsref", args(1), type, idx);
-
-      if (! error_state)
-        {
-          octave_value arg0 = args(0);
-
-          if (type.empty ())
-            retval = arg0;
-          else
-            retval = arg0.subsref (type, idx, nargout);
-        }
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-DEFUN (subsasgn, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} subsasgn (@var{val}, @var{idx}, @var{rhs})\n\
-Perform the subscripted assignment operation according to\n\
-the subscript specified by @var{idx}.\n\
-\n\
-The subscript @var{idx} is expected to be a structure array with\n\
-fields @samp{type} and @samp{subs}.  Valid values for @samp{type}\n\
-are @samp{\"()\"}, @samp{\"@{@}\"}, and @samp{\".\"}.\n\
-The @samp{subs} field may be either @samp{\":\"} or a cell array\n\
-of index values.\n\
-\n\
-The following example shows how to set the two first columns of a\n\
-3-by-3 matrix to zero.\n\
-\n\
-@example\n\
-@group\n\
-val = magic (3);\n\
-idx.type = \"()\";\n\
-idx.subs = @{\":\", 1:2@};\n\
-subsasgn (val, idx, 0)\n\
-     @result{}  [ 0   0   6\n\
-           0   0   7\n\
-           0   0   2 ]\n\
-@end group\n\
-@end example\n\
-\n\
-Note that this is the same as writing @code{val(:,1:2) = 0}.\n\
-\n\
-If @var{idx} is an empty structure array with fields @samp{type}\n\
-and @samp{subs}, return @var{rhs}.\n\
-@seealso{subsref, substruct}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 3)
-    {
-      std::string type;
-      std::list<octave_value_list> idx;
-
-      decode_subscripts ("subsasgn", args(1), type, idx);
-
-      if (! error_state)
-        {
-          if (type.empty ())
-            {
-              // Regularize a null matrix if stored into a variable.
-
-              retval = args(2).storable_value ();
-            }
-          else
-            {
-              octave_value arg0 = args(0);
-
-              arg0.make_unique ();
-
-              if (! error_state)
-                retval= arg0.subsasgn (type, idx, args(2));
-            }
-        }
-    }
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!test
-%! a = reshape ([1:25], 5,5);
-%! idx1 = substruct ("()", {3, 3});
-%! idx2 = substruct ("()", {2:2:5, 2:2:5});
-%! idx3 = substruct ("()", {":", [1,5]});
-%! idx4 = struct ("type", {}, "subs", {});
-%! assert (subsref (a, idx1), 13);
-%! assert (subsref (a, idx2), [7 17; 9 19]);
-%! assert (subsref (a, idx3), [1:5; 21:25]');
-%! assert (subsref (a, idx4), a);
-%! a = subsasgn (a, idx1, 0);
-%! a = subsasgn (a, idx2, 0);
-%! a = subsasgn (a, idx3, 0);
-%!# a = subsasgn (a, idx4, 0);
-%! b = [0    6   11   16    0
-%!      0    0   12    0    0
-%!      0    8    0   18    0
-%!      0    0   14    0    0
-%!      0   10   15   20    0];
-%! assert (a, b);
-
-%!test
-%! c = num2cell (reshape ([1:25],5,5));
-%! idx1 = substruct  ("{}", {3, 3});
-%! idx2 = substruct  ("()", {2:2:5, 2:2:5});
-%! idx3 = substruct  ("()", {":", [1,5]});
-%! idx2p = substruct ("{}", {2:2:5, 2:2:5});
-%! idx3p = substruct ("{}", {":", [1,5]});
-%! idx4 = struct ("type", {}, "subs", {});
-%! assert ({ subsref(c, idx1) }, {13});
-%! assert ({ subsref(c, idx2p) }, {7 9 17 19});
-%! assert ({ subsref(c, idx3p) }, num2cell ([1:5, 21:25]));
-%! assert (subsref (c, idx4), c);
-%! c = subsasgn (c, idx1, 0);
-%! c = subsasgn (c, idx2, 0);
-%! c = subsasgn (c, idx3, 0);
-%!# c = subsasgn (c, idx4, 0);
-%! d = {0    6   11   16    0
-%!      0    0   12    0    0
-%!      0    8    0   18    0
-%!      0    0   14    0    0
-%!      0   10   15   20    0};
-%! assert (c, d);
-
-%!test
-%! s.a = "ohai";
-%! s.b = "dere";
-%! s.c = 42;
-%! idx1 = substruct (".", "a");
-%! idx2 = substruct (".", "b");
-%! idx3 = substruct (".", "c");
-%! idx4 = struct ("type", {}, "subs", {});
-%! assert (subsref (s, idx1), "ohai");
-%! assert (subsref (s, idx2), "dere");
-%! assert (subsref (s, idx3), 42);
-%! assert (subsref (s, idx4), s);
-%! s = subsasgn (s, idx1, "Hello");
-%! s = subsasgn (s, idx2, "There");
-%! s = subsasgn (s, idx3, 163);
-%!# s = subsasgn (s, idx4, 163);
-%! t.a = "Hello";
-%! t.b = "There";
-%! t.c = 163;
-%! assert (s, t);
-*/
-
-DEFUN (is_sq_string, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} is_sq_string (@var{x})\n\
-Return true if @var{x} is a single-quoted character string.\n\
-@seealso{is_dq_string, ischar}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    retval = args(0).is_sq_string ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!assert (is_sq_string ('foo'), true)
-%!assert (is_sq_string ("foo"), false)
-%!assert (is_sq_string (1.0), false)
-%!assert (is_sq_string ({2.0}), false)
-
-%!error is_sq_string ()
-%!error is_sq_string ('foo', 2)
-*/
-
-DEFUN (is_dq_string, args, ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} is_dq_string (@var{x})\n\
-Return true if @var{x} is a double-quoted character string.\n\
-@seealso{is_sq_string, ischar}\n\
-@end deftypefn")
-{
-  octave_value retval;
-
-  if (args.length () == 1)
-    retval = args(0).is_dq_string ();
-  else
-    print_usage ();
-
-  return retval;
-}
-
-/*
-%!assert (is_dq_string ("foo"), true)
-%!assert (is_dq_string ('foo'), false)
-%!assert (is_dq_string (1.0), false)
-%!assert (is_dq_string ({2.0}), false)
-
-%!error is_dq_string ()
-%!error is_dq_string ("foo", 2)
-*/
--- a/src/ov.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1394 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-Copyright (C) 2009-2010 VZLU Prague
-
-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_value_h)
-#define octave_value_h 1
-
-#include <cstdlib>
-
-#include <iosfwd>
-#include <string>
-#include <list>
-
-#include "Range.h"
-#include "data-conv.h"
-#include "idx-vector.h"
-#include "mach-info.h"
-#include "mxarray.h"
-#include "mx-base.h"
-#include "oct-alloc.h"
-#include "oct-time.h"
-#include "str-vec.h"
-
-#include "oct-hdf5.h"
-#include "oct-sort.h"
-
-class Cell;
-class octave_map;
-class octave_scalar_map;
-class Octave_map;
-class octave_stream;
-class octave_function;
-class octave_user_function;
-class octave_fcn_handle;
-class octave_fcn_inline;
-class octave_value_list;
-class octave_lvalue;
-
-#include "ov-base.h"
-
-// Constants.
-
-class octave_value;
-
-class
-OCTINTERP_API
-octave_value
-{
-public:
-
-  enum unary_op
-  {
-    op_not,            // not
-    op_uplus,          // uplus
-    op_uminus,         // uminus
-    op_transpose,      // transpose
-    op_hermitian,      // ctranspose
-    op_incr,
-    op_decr,
-    num_unary_ops,
-    unknown_unary_op
-  };
-
-  enum binary_op
-  {
-    op_add,            // plus
-    op_sub,            // minus
-    op_mul,            // mtimes
-    op_div,            // mrdivide
-    op_pow,            // mpower
-    op_ldiv,           // mldivide
-    op_lshift,
-    op_rshift,
-    op_lt,             // lt
-    op_le,             // le
-    op_eq,             // eq
-    op_ge,             // ge
-    op_gt,             // gt
-    op_ne,             // ne
-    op_el_mul,         // times
-    op_el_div,         // rdivide
-    op_el_pow,         // power
-    op_el_ldiv,        // ldivide
-    op_el_and,         // and
-    op_el_or,          // or
-    op_struct_ref,
-    num_binary_ops,
-    unknown_binary_op
-  };
-
-  enum compound_binary_op
-  {
-    // ** compound operations **
-    op_trans_mul,
-    op_mul_trans,
-    op_herm_mul,
-    op_mul_herm,
-    op_trans_ldiv,
-    op_herm_ldiv,
-    op_el_not_and,
-    op_el_not_or,
-    op_el_and_not,
-    op_el_or_not,
-    num_compound_binary_ops,
-    unknown_compound_binary_op
-  };
-
-  enum assign_op
-  {
-    op_asn_eq,
-    op_add_eq,
-    op_sub_eq,
-    op_mul_eq,
-    op_div_eq,
-    op_ldiv_eq,
-    op_pow_eq,
-    op_lshift_eq,
-    op_rshift_eq,
-    op_el_mul_eq,
-    op_el_div_eq,
-    op_el_ldiv_eq,
-    op_el_pow_eq,
-    op_el_and_eq,
-    op_el_or_eq,
-    num_assign_ops,
-    unknown_assign_op
-  };
-
-  static assign_op binary_op_to_assign_op (binary_op);
-
-  static std::string unary_op_as_string (unary_op);
-  static std::string unary_op_fcn_name (unary_op);
-
-  static std::string binary_op_as_string (binary_op);
-  static std::string binary_op_fcn_name (binary_op);
-
-  static std::string binary_op_fcn_name (compound_binary_op);
-
-  static std::string assign_op_as_string (assign_op);
-
-  static octave_value empty_conv (const std::string& type,
-                                  const octave_value& rhs = octave_value ());
-
-  enum magic_colon { magic_colon_t };
-
-  octave_value (void)
-    {
-      static octave_base_value nil_rep;
-      rep = &nil_rep;
-      rep->count++;
-    }
-
-  octave_value (short int i);
-  octave_value (unsigned short int i);
-  octave_value (int i);
-  octave_value (unsigned int i);
-  octave_value (long int i);
-  octave_value (unsigned long int i);
-
-  // FIXME -- these are kluges.  They turn into doubles
-  // internally, which will break for very large values.  We just use
-  // them to store things like 64-bit ino_t, etc, and hope that those
-  // values are never actually larger than can be represented exactly
-  // in a double.
-
-#if defined (HAVE_LONG_LONG_INT)
-  octave_value (long long int i);
-#endif
-#if defined (HAVE_UNSIGNED_LONG_LONG_INT)
-  octave_value (unsigned long long int i);
-#endif
-
-  octave_value (octave_time t);
-  octave_value (double d);
-  octave_value (float d);
-  octave_value (const Array<octave_value>& a, bool is_cs_list = false);
-  octave_value (const Cell& c, bool is_cs_list = false);
-  octave_value (const Matrix& m, const MatrixType& t = MatrixType ());
-  octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType ());
-  octave_value (const NDArray& nda);
-  octave_value (const FloatNDArray& nda);
-  octave_value (const Array<double>& m);
-  octave_value (const Array<float>& m);
-  octave_value (const DiagMatrix& d);
-  octave_value (const FloatDiagMatrix& d);
-  octave_value (const RowVector& v);
-  octave_value (const FloatRowVector& v);
-  octave_value (const ColumnVector& v);
-  octave_value (const FloatColumnVector& v);
-  octave_value (const Complex& C);
-  octave_value (const FloatComplex& C);
-  octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType ());
-  octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixType ());
-  octave_value (const ComplexNDArray& cnda);
-  octave_value (const FloatComplexNDArray& cnda);
-  octave_value (const Array<Complex>& m);
-  octave_value (const Array<FloatComplex>& m);
-  octave_value (const ComplexDiagMatrix& d);
-  octave_value (const FloatComplexDiagMatrix& d);
-  octave_value (const ComplexRowVector& v);
-  octave_value (const FloatComplexRowVector& v);
-  octave_value (const ComplexColumnVector& v);
-  octave_value (const FloatComplexColumnVector& v);
-  octave_value (const PermMatrix& p);
-  octave_value (bool b);
-  octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType ());
-  octave_value (const boolNDArray& bnda);
-  octave_value (const Array<bool>& bnda);
-  octave_value (char c, char type = '\'');
-  octave_value (const char *s, char type = '\'');
-  octave_value (const std::string& s, char type = '\'');
-  octave_value (const string_vector& s, char type = '\'');
-  octave_value (const charMatrix& chm,  char type = '\'');
-  octave_value (const charNDArray& chnda, char type = '\'');
-  octave_value (const Array<char>& chnda, char type = '\'');
-  octave_value (const charMatrix& chm, bool is_string,
-                char type = '\'') GCC_ATTR_DEPRECATED;
-  octave_value (const charNDArray& chnda, bool is_string,
-                char type = '\'') GCC_ATTR_DEPRECATED;
-  octave_value (const Array<char>& chnda, bool is_string,
-                char type = '\'') GCC_ATTR_DEPRECATED;
-  octave_value (const SparseMatrix& m, const MatrixType& t = MatrixType ());
-  octave_value (const Sparse<double>& m, const MatrixType& t = MatrixType ());
-  octave_value (const SparseComplexMatrix& m,
-                const MatrixType& t = MatrixType ());
-  octave_value (const Sparse<Complex>& m, const MatrixType& t = MatrixType ());
-  octave_value (const SparseBoolMatrix& bm,
-                const MatrixType& t = MatrixType ());
-  octave_value (const Sparse<bool>& m, const MatrixType& t = MatrixType ());
-  octave_value (const octave_int8& i);
-  octave_value (const octave_int16& i);
-  octave_value (const octave_int32& i);
-  octave_value (const octave_int64& i);
-  octave_value (const octave_uint8& i);
-  octave_value (const octave_uint16& i);
-  octave_value (const octave_uint32& i);
-  octave_value (const octave_uint64& i);
-  octave_value (const int8NDArray& inda);
-  octave_value (const Array<octave_int8>& inda);
-  octave_value (const int16NDArray& inda);
-  octave_value (const Array<octave_int16>& inda);
-  octave_value (const int32NDArray& inda);
-  octave_value (const Array<octave_int32>& inda);
-  octave_value (const int64NDArray& inda);
-  octave_value (const Array<octave_int64>& inda);
-  octave_value (const uint8NDArray& inda);
-  octave_value (const Array<octave_uint8>& inda);
-  octave_value (const uint16NDArray& inda);
-  octave_value (const Array<octave_uint16>& inda);
-  octave_value (const uint32NDArray& inda);
-  octave_value (const Array<octave_uint32>& inda);
-  octave_value (const uint64NDArray& inda);
-  octave_value (const Array<octave_uint64>& inda);
-  octave_value (const Array<octave_idx_type>& inda,
-                bool zero_based = false, bool cache_index = false);
-  octave_value (const Array<std::string>& cellstr);
-  octave_value (const idx_vector& idx, bool lazy = true);
-  octave_value (double base, double limit, double inc);
-  octave_value (const Range& r);
-  octave_value (const octave_map& m);
-  octave_value (const octave_scalar_map& m);
-  octave_value (const Octave_map& m);
-  octave_value (const Octave_map& m, const std::string& id,
-                const std::list<std::string>& plist);
-  octave_value (const octave_value_list& m, bool = false);
-  octave_value (octave_value::magic_colon);
-
-  octave_value (octave_base_value *new_rep, bool borrow = false);
-  octave_value (octave_base_value *new_rep, int xcount) GCC_ATTR_DEPRECATED;
-
-  // Copy constructor.
-
-  octave_value (const octave_value& a)
-    {
-      rep = a.rep;
-      rep->count++;
-    }
-
-  // This should only be called for derived types.
-
-  octave_base_value *clone (void) const;
-
-  octave_base_value *empty_clone (void) const
-    { return rep->empty_clone (); }
-
-  // Delete the representation of this constant if the count drops to
-  // zero.
-
-  ~octave_value (void)
-  {
-    if (--rep->count == 0)
-      delete rep;
-  }
-
-  void make_unique (void)
-    {
-      if (rep->count > 1)
-        {
-          octave_base_value *r = rep->unique_clone ();
-
-          if (--rep->count == 0)
-            delete rep;
-
-          rep = r;
-        }
-    }
-
-  // This uniquifies the value if it is referenced by more than a certain
-  // number of shallow copies. This is useful for optimizations where we
-  // know a certain copy, typically within a cell array, to be obsolete.
-  void make_unique (int obsolete_copies)
-    {
-      if (rep->count > obsolete_copies + 1)
-        {
-          octave_base_value *r = rep->unique_clone ();
-
-          if (--rep->count == 0)
-            delete rep;
-
-          rep = r;
-        }
-    }
-
-  // Simple assignment.
-
-  octave_value& operator = (const octave_value& a)
-    {
-      if (rep != a.rep)
-        {
-          if (--rep->count == 0)
-            delete rep;
-
-          rep = a.rep;
-          rep->count++;
-        }
-
-      return *this;
-    }
-
-  octave_idx_type get_count (void) const { return rep->count; }
-
-  octave_base_value::type_conv_info numeric_conversion_function (void) const
-    { return rep->numeric_conversion_function (); }
-
-  octave_base_value::type_conv_info numeric_demotion_function (void) const
-    { return rep->numeric_demotion_function (); }
-
-  void maybe_mutate (void);
-
-  octave_value squeeze (void) const
-    { return rep->squeeze (); }
-
-  // The result of full().
-  octave_value full_value (void) const
-    { return rep->full_value (); }
-
-  octave_base_value *try_narrowing_conversion (void)
-    { return rep->try_narrowing_conversion (); }
-
-  // Close to dims (), but can be overloaded for classes.
-  Matrix size (void)
-    { return rep->size (); }
-
-  octave_idx_type numel (const octave_value_list& idx)
-    { return rep->numel (idx); }
-
-  octave_value single_subsref (const std::string& type,
-                               const octave_value_list& idx);
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx)
-    { return rep->subsref (type, idx); }
-
-  octave_value subsref (const std::string& type,
-                        const std::list<octave_value_list>& idx,
-                        bool auto_add)
-    { return rep->subsref (type, idx, auto_add); }
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout);
-
-  octave_value_list subsref (const std::string& type,
-                             const std::list<octave_value_list>& idx,
-                             int nargout,
-                             const std::list<octave_lvalue> *lvalue_list);
-
-  octave_value next_subsref (const std::string& type, const
-                             std::list<octave_value_list>& idx,
-                             size_t skip = 1);
-
-  octave_value_list next_subsref (int nargout,
-                                  const std::string& type, const
-                                  std::list<octave_value_list>& idx,
-                                  size_t skip = 1);
-
-  octave_value next_subsref (bool auto_add, const std::string& type, const
-                             std::list<octave_value_list>& idx,
-                             size_t skip = 1);
-
-  octave_value do_index_op (const octave_value_list& idx,
-                            bool resize_ok = false)
-    { return rep->do_index_op (idx, resize_ok); }
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& idx);
-
-  octave_value_list
-  do_multi_index_op (int nargout, const octave_value_list& idx,
-                     const std::list<octave_lvalue> *lvalue_list);
-
-  octave_value subsasgn (const std::string& type,
-                                 const std::list<octave_value_list>& idx,
-                                 const octave_value& rhs);
-
-  octave_value undef_subsasgn (const std::string& type,
-                               const std::list<octave_value_list>& idx,
-                               const octave_value& rhs);
-
-  octave_value& assign (assign_op op, const std::string& type,
-                       const std::list<octave_value_list>& idx,
-                       const octave_value& rhs);
-
-  octave_value& assign (assign_op, const octave_value& rhs);
-
-  idx_vector index_vector (void) const
-    { return rep->index_vector (); }
-
-  // Size.
-
-  dim_vector dims (void) const
-    { return rep->dims (); }
-
-  octave_idx_type rows (void) const { return rep->rows (); }
-
-  octave_idx_type columns (void) const { return rep->columns (); }
-
-  octave_idx_type length (void) const;
-
-  int ndims (void) const { return rep->ndims (); }
-
-  bool all_zero_dims (void) const { return dims ().all_zero (); }
-
-  octave_idx_type numel (void) const
-    { return rep->numel (); }
-
-  octave_idx_type capacity (void) const
-    { return rep->capacity (); }
-
-  size_t byte_size (void) const
-    { return rep->byte_size (); }
-
-  octave_idx_type nnz (void) const { return rep->nnz (); }
-
-  octave_idx_type nzmax (void) const { return rep->nzmax (); }
-
-  octave_idx_type nfields (void) const { return rep->nfields (); }
-
-  octave_value reshape (const dim_vector& dv) const
-    { return rep->reshape (dv); }
-
-  octave_value permute (const Array<int>& vec, bool inv = false) const
-    { return rep->permute (vec, inv); }
-
-  octave_value ipermute (const Array<int>& vec) const
-    { return rep->permute (vec, true); }
-
-  octave_value resize (const dim_vector& dv, bool fill = false) const
-    { return rep->resize (dv, fill);}
-
-  MatrixType matrix_type (void) const
-  { return rep->matrix_type (); }
-
-  MatrixType matrix_type (const MatrixType& typ) const
-  { return rep->matrix_type (typ); }
-
-  // Does this constant have a type?  Both of these are provided since
-  // it is sometimes more natural to write is_undefined() instead of
-  // ! is_defined().
-
-  bool is_defined (void) const
-    { return rep->is_defined (); }
-
-  bool is_undefined (void) const
-    { return ! is_defined (); }
-
-  bool is_empty (void) const
-    { return rep->is_empty (); }
-
-  bool is_cell (void) const
-    { return rep->is_cell (); }
-
-  bool is_cellstr (void) const
-    { return rep->is_cellstr (); }
-
-  bool is_real_scalar (void) const
-    { return rep->is_real_scalar (); }
-
-  bool is_real_matrix (void) const
-    { return rep->is_real_matrix (); }
-
-  bool is_real_nd_array (void) const
-    { return rep->is_real_nd_array (); }
-
-  bool is_complex_scalar (void) const
-    { return rep->is_complex_scalar (); }
-
-  bool is_complex_matrix (void) const
-    { return rep->is_complex_matrix (); }
-
-  bool is_bool_scalar (void) const
-    { return rep->is_bool_scalar (); }
-
-  bool is_bool_matrix (void) const
-    { return rep->is_bool_matrix (); }
-
-  bool is_char_matrix (void) const
-    { return rep->is_char_matrix (); }
-
-  bool is_diag_matrix (void) const
-    { return rep->is_diag_matrix (); }
-
-  bool is_perm_matrix (void) const
-    { return rep->is_perm_matrix (); }
-
-  bool is_string (void) const
-    { return rep->is_string (); }
-
-  bool is_sq_string (void) const
-    { return rep->is_sq_string (); }
-
-  bool is_dq_string (void) const
-    { return rep->is_string () && ! rep->is_sq_string (); }
-
-  bool is_range (void) const
-    { return rep->is_range (); }
-
-  bool is_map (void) const
-    { return rep->is_map (); }
-
-  bool is_object (void) const
-    { return rep->is_object (); }
-
-  bool is_cs_list (void) const
-    { return rep->is_cs_list (); }
-
-  bool is_magic_colon (void) const
-    { return rep->is_magic_colon (); }
-
-  bool is_null_value (void) const
-    { return rep->is_null_value (); }
-
-  // Are any or all of the elements in this constant nonzero?
-
-  octave_value all (int dim = 0) const
-    { return rep->all (dim); }
-
-  octave_value any (int dim = 0) const
-    { return rep->any (dim); }
-
-  builtin_type_t builtin_type (void) const
-    { return rep->builtin_type (); }
-
-  // Floating point types.
-
-  bool is_double_type (void) const
-    { return rep->is_double_type (); }
-
-  bool is_single_type (void) const
-    { return rep->is_single_type (); }
-
-  bool is_float_type (void) const
-    { return rep->is_float_type (); }
-
-  // Integer types.
-
-  bool is_int8_type (void) const
-    { return rep->is_int8_type (); }
-
-  bool is_int16_type (void) const
-    { return rep->is_int16_type (); }
-
-  bool is_int32_type (void) const
-    { return rep->is_int32_type (); }
-
-  bool is_int64_type (void) const
-   { return rep->is_int64_type (); }
-
-  bool is_uint8_type (void) const
-    { return rep->is_uint8_type (); }
-
-  bool is_uint16_type (void) const
-    { return rep->is_uint16_type (); }
-
-  bool is_uint32_type (void) const
-    { return rep->is_uint32_type (); }
-
-  bool is_uint64_type (void) const
-    { return rep->is_uint64_type (); }
-
-  // Other type stuff.
-
-  bool is_bool_type (void) const
-    { return rep->is_bool_type (); }
-
-  bool is_integer_type (void) const
-    { return rep->is_integer_type (); }
-
-  bool is_real_type (void) const
-    { return rep->is_real_type (); }
-
-  bool is_complex_type (void) const
-    { return rep->is_complex_type (); }
-
-  bool is_scalar_type (void) const
-    { return rep->is_scalar_type (); }
-
-  bool is_matrix_type (void) const
-    { return rep->is_matrix_type (); }
-
-  bool is_numeric_type (void) const
-    { return rep->is_numeric_type (); }
-
-  bool is_sparse_type (void) const
-    { return rep->is_sparse_type (); }
-
-  // Does this constant correspond to a truth value?
-
-  bool is_true (void) const
-    { return rep->is_true (); }
-
-  // Do two constants match (in a switch statement)?
-
-  bool is_equal (const octave_value&) const;
-
-  // Are the dimensions of this constant zero by zero?
-
-  bool is_zero_by_zero (void) const
-    { return (rows () == 0 && columns () == 0); }
-
-  bool is_constant (void) const
-    { return rep->is_constant (); }
-
-  bool is_function_handle (void) const
-    { return rep->is_function_handle (); }
-
-  bool is_anonymous_function (void) const
-    { return rep->is_anonymous_function (); }
-
-  bool is_inline_function (void) const
-    { return rep->is_inline_function (); }
-
-  bool is_function (void) const
-    { return rep->is_function (); }
-
-  bool is_user_script (void) const
-    { return rep->is_user_script (); }
-
-  bool is_user_function (void) const
-    { return rep->is_user_function (); }
-
-  bool is_user_code (void) const
-    { return rep->is_user_code (); }
-
-  bool is_builtin_function (void) const
-    { return rep->is_builtin_function (); }
-
-  bool is_dld_function (void) const
-    { return rep->is_dld_function (); }
-
-  bool is_mex_function (void) const
-    { return rep->is_mex_function (); }
-
-  void erase_subfunctions (void) { rep->erase_subfunctions (); }
-
-  // Values.
-
-  octave_value eval (void) { return *this; }
-
-  short int
-  short_value (bool req_int = false, bool frc_str_conv = false) const
-    { return rep->short_value (req_int, frc_str_conv); }
-
-  unsigned short int
-  ushort_value (bool req_int = false, bool frc_str_conv = false) const
-    { return rep->ushort_value (req_int, frc_str_conv); }
-
-  int int_value (bool req_int = false, bool frc_str_conv = false) const
-    { return rep->int_value (req_int, frc_str_conv); }
-
-  unsigned int
-  uint_value (bool req_int = false, bool frc_str_conv = false) const
-    { return rep->uint_value (req_int, frc_str_conv); }
-
-  int nint_value (bool frc_str_conv = false) const
-    { return rep->nint_value (frc_str_conv); }
-
-  long int
-  long_value (bool req_int = false, bool frc_str_conv = false) const
-    { return rep->long_value (req_int, frc_str_conv); }
-
-  unsigned long int
-  ulong_value (bool req_int = false, bool frc_str_conv = false) const
-    { return rep->ulong_value (req_int, frc_str_conv); }
-
-  octave_idx_type
-  idx_type_value (bool req_int = false, bool frc_str_conv = false) const;
-
-  double double_value (bool frc_str_conv = false) const
-    { return rep->double_value (frc_str_conv); }
-
-  float float_value (bool frc_str_conv = false) const
-    { return rep->float_value (frc_str_conv); }
-
-  double scalar_value (bool frc_str_conv = false) const
-    { return rep->scalar_value (frc_str_conv); }
-
-  float float_scalar_value (bool frc_str_conv = false) const
-    { return rep->float_scalar_value (frc_str_conv); }
-
-  Cell cell_value (void) const;
-
-  Matrix matrix_value (bool frc_str_conv = false) const
-    { return rep->matrix_value (frc_str_conv); }
-
-  FloatMatrix float_matrix_value (bool frc_str_conv = false) const
-    { return rep->float_matrix_value (frc_str_conv); }
-
-  NDArray array_value (bool frc_str_conv = false) const
-    { return rep->array_value (frc_str_conv); }
-
-  FloatNDArray float_array_value (bool frc_str_conv = false) const
-    { return rep->float_array_value (frc_str_conv); }
-
-  Complex complex_value (bool frc_str_conv = false) const
-    { return rep->complex_value (frc_str_conv); }
-
-  FloatComplex float_complex_value (bool frc_str_conv = false) const
-    { return rep->float_complex_value (frc_str_conv); }
-
-  ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const
-    { return rep->complex_matrix_value (frc_str_conv); }
-
-  FloatComplexMatrix float_complex_matrix_value (bool frc_str_conv = false) const
-    { return rep->float_complex_matrix_value (frc_str_conv); }
-
-  ComplexNDArray complex_array_value (bool frc_str_conv = false) const
-    { return rep->complex_array_value (frc_str_conv); }
-
-  FloatComplexNDArray float_complex_array_value (bool frc_str_conv = false) const
-    { return rep->float_complex_array_value (frc_str_conv); }
-
-  bool bool_value (bool warn = false) const
-    { return rep->bool_value (warn); }
-
-  boolMatrix bool_matrix_value (bool warn = false) const
-    { return rep->bool_matrix_value (warn); }
-
-  boolNDArray bool_array_value (bool warn = false) const
-    { return rep->bool_array_value (warn); }
-
-  charMatrix char_matrix_value (bool frc_str_conv = false) const
-    { return rep->char_matrix_value (frc_str_conv); }
-
-  charNDArray char_array_value (bool frc_str_conv = false) const
-    { return rep->char_array_value (frc_str_conv); }
-
-  SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const
-    { return rep->sparse_matrix_value (frc_str_conv); }
-
-  SparseComplexMatrix sparse_complex_matrix_value (bool frc_str_conv = false) const
-    { return rep->sparse_complex_matrix_value (frc_str_conv); }
-
-  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const
-    { return rep->sparse_bool_matrix_value (warn); }
-
-  DiagMatrix diag_matrix_value (bool force = false) const
-    { return rep->diag_matrix_value (force); }
-
-  FloatDiagMatrix float_diag_matrix_value (bool force = false) const
-    { return rep->float_diag_matrix_value (force); }
-
-  ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const
-    { return rep->complex_diag_matrix_value (force); }
-
-  FloatComplexDiagMatrix float_complex_diag_matrix_value (bool force = false) const
-    { return rep->float_complex_diag_matrix_value (force); }
-
-  PermMatrix perm_matrix_value (void) const
-    { return rep->perm_matrix_value (); }
-
-  octave_int8 int8_scalar_value (void) const
-    { return rep->int8_scalar_value (); }
-
-  octave_int16 int16_scalar_value (void) const
-    { return rep->int16_scalar_value (); }
-
-  octave_int32 int32_scalar_value (void) const
-    { return rep->int32_scalar_value (); }
-
-  octave_int64 int64_scalar_value (void) const
-    { return rep->int64_scalar_value (); }
-
-  octave_uint8 uint8_scalar_value (void) const
-    { return rep->uint8_scalar_value (); }
-
-  octave_uint16 uint16_scalar_value (void) const
-    { return rep->uint16_scalar_value (); }
-
-  octave_uint32 uint32_scalar_value (void) const
-    { return rep->uint32_scalar_value (); }
-
-  octave_uint64 uint64_scalar_value (void) const
-    { return rep->uint64_scalar_value (); }
-
-  int8NDArray int8_array_value (void) const
-    { return rep->int8_array_value (); }
-
-  int16NDArray int16_array_value (void) const
-    { return rep->int16_array_value (); }
-
-  int32NDArray int32_array_value (void) const
-    { return rep->int32_array_value (); }
-
-  int64NDArray int64_array_value (void) const
-    { return rep->int64_array_value (); }
-
-  uint8NDArray uint8_array_value (void) const
-    { return rep->uint8_array_value (); }
-
-  uint16NDArray uint16_array_value (void) const
-    { return rep->uint16_array_value (); }
-
-  uint32NDArray uint32_array_value (void) const
-    { return rep->uint32_array_value (); }
-
-  uint64NDArray uint64_array_value (void) const
-    { return rep->uint64_array_value (); }
-
-  string_vector all_strings (bool pad = false) const
-    { return rep->all_strings (pad); }
-
-  std::string string_value (bool force = false) const
-    { return rep->string_value (force); }
-
-  Array<std::string> cellstr_value (void) const
-    { return rep->cellstr_value (); }
-
-  Range range_value (void) const
-    { return rep->range_value (); }
-
-  octave_map map_value (void) const;
-
-  octave_scalar_map scalar_map_value (void) const;
-
-  string_vector map_keys (void) const
-    { return rep->map_keys (); }
-
-  size_t nparents (void) const
-    { return rep->nparents (); }
-
-  std::list<std::string> parent_class_name_list (void) const
-    { return rep->parent_class_name_list (); }
-
-  string_vector parent_class_names (void) const
-    { return rep->parent_class_names (); }
-
-  octave_base_value *
-  find_parent_class (const std::string& parent_class_name)
-    { return rep->find_parent_class (parent_class_name); }
-
-  octave_function *function_value (bool silent = false) const;
-
-  octave_user_function *user_function_value (bool silent = false) const;
-
-  octave_user_script *user_script_value (bool silent = false) const;
-
-  octave_user_code *user_code_value (bool silent = false) const;
-
-  octave_fcn_handle *fcn_handle_value (bool silent = false) const;
-
-  octave_fcn_inline *fcn_inline_value (bool silent = false) const;
-
-  octave_value_list list_value (void) const;
-
-  ColumnVector column_vector_value (bool frc_str_conv = false,
-                             bool frc_vec_conv = false) const;
-
-  ComplexColumnVector
-  complex_column_vector_value (bool frc_str_conv = false,
-                        bool frc_vec_conv = false) const;
-
-  RowVector row_vector_value (bool frc_str_conv = false,
-                              bool frc_vec_conv = false) const;
-
-  ComplexRowVector
-  complex_row_vector_value (bool frc_str_conv = false,
-                            bool frc_vec_conv = false) const;
-
-
-  FloatColumnVector float_column_vector_value (bool frc_str_conv = false,
-                             bool frc_vec_conv = false) const;
-
-  FloatComplexColumnVector
-  float_complex_column_vector_value (bool frc_str_conv = false,
-                        bool frc_vec_conv = false) const;
-
-  FloatRowVector float_row_vector_value (bool frc_str_conv = false,
-                              bool frc_vec_conv = false) const;
-
-  FloatComplexRowVector
-  float_complex_row_vector_value (bool frc_str_conv = false,
-                            bool frc_vec_conv = false) const;
-
-
-
-
-  Array<int> int_vector_value (bool req_int = false,
-                               bool frc_str_conv = false,
-                               bool frc_vec_conv = false) const;
-
-  Array<octave_idx_type>
-  octave_idx_type_vector_value (bool req_int = false,
-                                bool frc_str_conv = false,
-                                bool frc_vec_conv = false) const;
-
-  Array<double> vector_value (bool frc_str_conv = false,
-                              bool frc_vec_conv = false) const;
-
-  Array<Complex> complex_vector_value (bool frc_str_conv = false,
-                                       bool frc_vec_conv = false) const;
-
-  Array<float> float_vector_value (bool frc_str_conv = false,
-                              bool frc_vec_conv = false) const;
-
-  Array<FloatComplex> float_complex_vector_value (bool frc_str_conv = false,
-                                       bool frc_vec_conv = false) const;
-
-  // Possibly economize a lazy-indexed value.
-
-  void maybe_economize (void)
-    { rep->maybe_economize (); }
-
-  // The following two hook conversions are called on any octave_value prior to
-  // storing it to a "permanent" location, like a named variable, a cell or a
-  // struct component, or a return value of a function.
-
-  octave_value storable_value (void) const;
-
-  // Ditto, but in place, i.e. equivalent to *this = this->storable_value (),
-  // but possibly more efficient.
-
-  void make_storable_value (void);
-
-  // Conversions.  These should probably be private.  If a user of this
-  // class wants a certain kind of constant, he should simply ask for
-  // it, and we should convert it if possible.
-
-  octave_value convert_to_str (bool pad = false, bool force = false,
-                               char type = '\'') const
-    { return rep->convert_to_str (pad, force, type); }
-
-  octave_value
-  convert_to_str_internal (bool pad, bool force, char type) const
-    { return rep->convert_to_str_internal (pad, force, type); }
-
-  void convert_to_row_or_column_vector (void)
-    { rep->convert_to_row_or_column_vector (); }
-
-  bool print_as_scalar (void) const
-    { return rep->print_as_scalar (); }
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false) const
-    { rep->print (os, pr_as_read_syntax); }
-
-  void print_raw (std::ostream& os,
-                          bool pr_as_read_syntax = false) const
-    { rep->print_raw (os, pr_as_read_syntax); }
-
-  bool print_name_tag (std::ostream& os, const std::string& name) const
-    { return rep->print_name_tag (os, name); }
-
-  void print_with_name (std::ostream& os, const std::string& name) const
-  { rep->print_with_name (os, name, true); }
-
-  int type_id (void) const { return rep->type_id (); }
-
-  std::string type_name (void) const { return rep->type_name (); }
-
-  std::string class_name (void) const { return rep->class_name (); }
-
-  // Unary and binary operations.
-
-  friend OCTINTERP_API octave_value do_unary_op (unary_op op,
-                                   const octave_value& a);
-
-  octave_value& do_non_const_unary_op (unary_op op);
-
-  octave_value& do_non_const_unary_op (unary_op op, const std::string& type,
-                                      const std::list<octave_value_list>& idx);
-
-  friend OCTINTERP_API octave_value do_binary_op (binary_op op,
-                                    const octave_value& a,
-                                    const octave_value& b);
-
-  friend OCTINTERP_API octave_value do_binary_op (compound_binary_op op,
-                                                  const octave_value& a,
-                                                  const octave_value& b);
-
-  friend OCTINTERP_API octave_value do_cat_op (const octave_value& a,
-                                 const octave_value& b,
-                                 const Array<octave_idx_type>& ra_idx);
-
-  const octave_base_value& get_rep (void) const { return *rep; }
-
-  bool is_copy_of (const octave_value &val) const { return rep == val.rep; }
-
-  void print_info (std::ostream& os,
-                           const std::string& prefix = std::string ()) const;
-
-  bool save_ascii (std::ostream& os) { return rep->save_ascii (os); }
-
-  bool load_ascii (std::istream& is) { return rep->load_ascii (is); }
-
-  bool save_binary (std::ostream& os, bool& save_as_floats)
-    { return rep->save_binary (os, save_as_floats); }
-
-  bool load_binary (std::istream& is, bool swap,
-                            oct_mach_info::float_format fmt)
-    { return rep->load_binary (is, swap, fmt); }
-
-#if defined (HAVE_HDF5)
-  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats)
-    { return rep->save_hdf5 (loc_id, name, save_as_floats); }
-
-  bool load_hdf5 (hid_t loc_id, const char *name)
-    { return rep->load_hdf5 (loc_id, name); }
-#endif
-
-  int write (octave_stream& os, int block_size,
-                     oct_data_conv::data_type output_type, int skip,
-                     oct_mach_info::float_format flt_fmt) const;
-
-  octave_base_value *internal_rep (void) const { return rep; }
-
-  // Unsafe.  These functions exist to support the MEX interface.
-  // You should not use them anywhere else.
-  void *mex_get_data (void) const { return rep->mex_get_data (); }
-
-  octave_idx_type *mex_get_ir (void) const { return rep->mex_get_ir (); }
-
-  octave_idx_type *mex_get_jc (void) const { return rep->mex_get_jc (); }
-
-  mxArray *as_mxArray (void) const { return rep->as_mxArray (); }
-
-  octave_value diag (octave_idx_type k = 0) const
-    { return rep->diag (k); }
-
-  octave_value diag (octave_idx_type m, octave_idx_type n) const
-    { return rep->diag (m, n); }
-
-  octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
-    { return rep->sort (dim, mode); }
-  octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                 sortmode mode = ASCENDING) const
-    { return rep->sort (sidx, dim, mode); }
-
-  sortmode is_sorted (sortmode mode = UNSORTED) const
-    { return rep->is_sorted (mode); }
-
-  Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const
-    { return rep->sort_rows_idx (mode); }
-
-  sortmode is_sorted_rows (sortmode mode = UNSORTED) const
-    { return rep->is_sorted_rows (mode); }
-
-  void lock (void) { rep->lock (); }
-
-  void unlock (void) { rep->unlock (); }
-
-  bool islocked (void) const { return rep->islocked (); }
-
-  void dump (std::ostream& os) const { rep->dump (os); }
-
-#define MAPPER_FORWARD(F) \
-  octave_value F (void) const { return rep->map (octave_base_value::umap_ ## F); }
-
-  MAPPER_FORWARD (abs)
-  MAPPER_FORWARD (acos)
-  MAPPER_FORWARD (acosh)
-  MAPPER_FORWARD (angle)
-  MAPPER_FORWARD (arg)
-  MAPPER_FORWARD (asin)
-  MAPPER_FORWARD (asinh)
-  MAPPER_FORWARD (atan)
-  MAPPER_FORWARD (atanh)
-  MAPPER_FORWARD (cbrt)
-  MAPPER_FORWARD (ceil)
-  MAPPER_FORWARD (conj)
-  MAPPER_FORWARD (cos)
-  MAPPER_FORWARD (cosh)
-  MAPPER_FORWARD (erf)
-  MAPPER_FORWARD (erfinv)
-  MAPPER_FORWARD (erfcinv)
-  MAPPER_FORWARD (erfc)
-  MAPPER_FORWARD (erfcx)
-  MAPPER_FORWARD (exp)
-  MAPPER_FORWARD (expm1)
-  MAPPER_FORWARD (finite)
-  MAPPER_FORWARD (fix)
-  MAPPER_FORWARD (floor)
-  MAPPER_FORWARD (gamma)
-  MAPPER_FORWARD (imag)
-  MAPPER_FORWARD (isinf)
-  MAPPER_FORWARD (isna)
-  MAPPER_FORWARD (isnan)
-  MAPPER_FORWARD (lgamma)
-  MAPPER_FORWARD (log)
-  MAPPER_FORWARD (log2)
-  MAPPER_FORWARD (log10)
-  MAPPER_FORWARD (log1p)
-  MAPPER_FORWARD (real)
-  MAPPER_FORWARD (round)
-  MAPPER_FORWARD (roundb)
-  MAPPER_FORWARD (signum)
-  MAPPER_FORWARD (sin)
-  MAPPER_FORWARD (sinh)
-  MAPPER_FORWARD (sqrt)
-  MAPPER_FORWARD (tan)
-  MAPPER_FORWARD (tanh)
-
-  // These functions are prefixed with X to avoid potential macro
-  // conflicts.
-
-  MAPPER_FORWARD (xisalnum)
-  MAPPER_FORWARD (xisalpha)
-  MAPPER_FORWARD (xisascii)
-  MAPPER_FORWARD (xiscntrl)
-  MAPPER_FORWARD (xisdigit)
-  MAPPER_FORWARD (xisgraph)
-  MAPPER_FORWARD (xislower)
-  MAPPER_FORWARD (xisprint)
-  MAPPER_FORWARD (xispunct)
-  MAPPER_FORWARD (xisspace)
-  MAPPER_FORWARD (xisupper)
-  MAPPER_FORWARD (xisxdigit)
-  MAPPER_FORWARD (xtoascii)
-  MAPPER_FORWARD (xtolower)
-  MAPPER_FORWARD (xtoupper)
-
-#undef MAPPER_FORWARD
-
-  octave_value map (octave_base_value::unary_mapper_t umap) const
-    { return rep->map (umap); }
-
-  // Extract the n-th element, aka val(n). Result is undefined if val is not an
-  // array type or n is out of range. Never error.
-  octave_value
-  fast_elem_extract (octave_idx_type n) const
-    { return rep->fast_elem_extract (n); }
-
-  // Assign the n-th element, aka val(n) = x. Returns false if val is not an
-  // array type, x is not a matching scalar type, or n is out of range.
-  // Never error.
-  virtual bool
-  fast_elem_insert (octave_idx_type n, const octave_value& x)
-    {
-      make_unique ();
-      return rep->fast_elem_insert (n, x);
-    }
-
-protected:
-
-  // The real representation.
-  octave_base_value *rep;
-
-private:
-
-  assign_op unary_op_to_assign_op (unary_op op);
-
-  binary_op op_eq_to_binary_op (assign_op op);
-
-  // This declaration protects against constructing octave_value from
-  // const octave_base_value* which actually silently calls octave_value (bool).
-  octave_value (const octave_base_value *);
-
-  DECLARE_OCTAVE_ALLOCATOR
-};
-
-// Publish externally used friend functions.
-
-extern OCTINTERP_API octave_value
-do_unary_op (octave_value::unary_op op, const octave_value& a);
-
-extern OCTINTERP_API octave_value
-do_binary_op (octave_value::binary_op op,
-              const octave_value& a, const octave_value& b);
-
-extern OCTINTERP_API octave_value
-do_binary_op (octave_value::compound_binary_op op,
-              const octave_value& a, const octave_value& b);
-
-#define OV_UNOP_FN(name) \
-  inline octave_value \
-  name (const octave_value& a) \
-  { \
-    return do_unary_op (octave_value::name, a); \
-  }
-
-#define OV_UNOP_OP(name, op) \
-  inline octave_value \
-  operator op (const octave_value& a) \
-  { \
-    return name (a); \
-  }
-
-#define OV_UNOP_FN_OP(name, op) \
-  OV_UNOP_FN (name) \
-  OV_UNOP_OP (name, op)
-
-OV_UNOP_FN_OP (op_not, !)
-OV_UNOP_FN_OP (op_uplus, +)
-OV_UNOP_FN_OP (op_uminus, -)
-
-OV_UNOP_FN (op_transpose)
-OV_UNOP_FN (op_hermitian)
-
-// No simple way to define these for prefix and suffix ops?
-//
-//   incr
-//   decr
-
-#define OV_BINOP_FN(name) \
-  inline octave_value \
-  name (const octave_value& a1, const octave_value& a2) \
-  { \
-    return do_binary_op (octave_value::name, a1, a2); \
-  }
-
-#define OV_BINOP_OP(name, op) \
-  inline octave_value \
-  operator op (const octave_value& a1, const octave_value& a2) \
-  { \
-    return name (a1, a2); \
-  }
-
-#define OV_BINOP_FN_OP(name, op) \
-  OV_BINOP_FN (name) \
-  OV_BINOP_OP (name, op)
-
-OV_BINOP_FN_OP (op_add, +)
-OV_BINOP_FN_OP (op_sub, -)
-OV_BINOP_FN_OP (op_mul, *)
-OV_BINOP_FN_OP (op_div, /)
-
-OV_BINOP_FN (op_pow)
-OV_BINOP_FN (op_ldiv)
-OV_BINOP_FN (op_lshift)
-OV_BINOP_FN (op_rshift)
-
-OV_BINOP_FN_OP (op_lt, <)
-OV_BINOP_FN_OP (op_le, <=)
-OV_BINOP_FN_OP (op_eq, ==)
-OV_BINOP_FN_OP (op_ge, >=)
-OV_BINOP_FN_OP (op_gt, >)
-OV_BINOP_FN_OP (op_ne, !=)
-
-OV_BINOP_FN (op_el_mul)
-OV_BINOP_FN (op_el_div)
-OV_BINOP_FN (op_el_pow)
-OV_BINOP_FN (op_el_ldiv)
-OV_BINOP_FN (op_el_and)
-OV_BINOP_FN (op_el_or)
-
-OV_BINOP_FN (op_struct_ref)
-
-#define OV_COMP_BINOP_FN(name) \
-  inline octave_value \
-  name (const octave_value& a1, const octave_value& a2) \
-  { \
-    return do_binary_op (octave_value::name, a1, a2); \
-  }
-
-OV_COMP_BINOP_FN (op_trans_mul)
-OV_COMP_BINOP_FN (op_mul_trans)
-OV_COMP_BINOP_FN (op_herm_mul)
-OV_COMP_BINOP_FN (op_mul_herm)
-
-extern OCTINTERP_API void install_types (void);
-
-// This will eventually go away, but for now it can be used to
-// simplify the transition to the new octave_value class hierarchy,
-// which uses octave_base_value instead of octave_value for the type
-// of octave_value::rep.
-#define OV_REP_TYPE octave_base_value
-
-// Templated value extractors.
-template<class Value>
-inline Value octave_value_extract (const octave_value&)
-  { assert (false); }
-
-#define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \
-template<> \
-inline VALUE octave_value_extract<VALUE> (const octave_value& v) \
-  { return v.MPREFIX ## _value (); }
-
-DEF_VALUE_EXTRACTOR (double, scalar)
-DEF_VALUE_EXTRACTOR (float, float_scalar)
-DEF_VALUE_EXTRACTOR (Complex, complex)
-DEF_VALUE_EXTRACTOR (FloatComplex, float_complex)
-DEF_VALUE_EXTRACTOR (bool, bool)
-
-DEF_VALUE_EXTRACTOR (octave_int8, int8_scalar)
-DEF_VALUE_EXTRACTOR (octave_int16, int16_scalar)
-DEF_VALUE_EXTRACTOR (octave_int32, int32_scalar)
-DEF_VALUE_EXTRACTOR (octave_int64, int64_scalar)
-DEF_VALUE_EXTRACTOR (octave_uint8, uint8_scalar)
-DEF_VALUE_EXTRACTOR (octave_uint16, uint16_scalar)
-DEF_VALUE_EXTRACTOR (octave_uint32, uint32_scalar)
-DEF_VALUE_EXTRACTOR (octave_uint64, uint64_scalar)
-
-
-DEF_VALUE_EXTRACTOR (NDArray, array)
-DEF_VALUE_EXTRACTOR (FloatNDArray, float_array)
-DEF_VALUE_EXTRACTOR (ComplexNDArray, complex_array)
-DEF_VALUE_EXTRACTOR (FloatComplexNDArray, float_complex_array)
-DEF_VALUE_EXTRACTOR (boolNDArray, bool_array)
-
-DEF_VALUE_EXTRACTOR (charNDArray, char_array)
-DEF_VALUE_EXTRACTOR (int8NDArray, int8_array)
-DEF_VALUE_EXTRACTOR (int16NDArray, int16_array)
-DEF_VALUE_EXTRACTOR (int32NDArray, int32_array)
-DEF_VALUE_EXTRACTOR (int64NDArray, int64_array)
-DEF_VALUE_EXTRACTOR (uint8NDArray, uint8_array)
-DEF_VALUE_EXTRACTOR (uint16NDArray, uint16_array)
-DEF_VALUE_EXTRACTOR (uint32NDArray, uint32_array)
-DEF_VALUE_EXTRACTOR (uint64NDArray, uint64_array)
-
-DEF_VALUE_EXTRACTOR (Matrix, matrix)
-DEF_VALUE_EXTRACTOR (FloatMatrix, float_matrix)
-DEF_VALUE_EXTRACTOR (ComplexMatrix, complex_matrix)
-DEF_VALUE_EXTRACTOR (FloatComplexMatrix, float_complex_matrix)
-DEF_VALUE_EXTRACTOR (boolMatrix, bool_matrix)
-
-DEF_VALUE_EXTRACTOR (ColumnVector, column_vector)
-DEF_VALUE_EXTRACTOR (FloatColumnVector, float_column_vector)
-DEF_VALUE_EXTRACTOR (ComplexColumnVector, complex_column_vector)
-DEF_VALUE_EXTRACTOR (FloatComplexColumnVector, float_complex_column_vector)
-
-DEF_VALUE_EXTRACTOR (RowVector, row_vector)
-DEF_VALUE_EXTRACTOR (FloatRowVector, float_row_vector)
-DEF_VALUE_EXTRACTOR (ComplexRowVector, complex_row_vector)
-DEF_VALUE_EXTRACTOR (FloatComplexRowVector, float_complex_row_vector)
-
-DEF_VALUE_EXTRACTOR (DiagMatrix, diag_matrix)
-DEF_VALUE_EXTRACTOR (FloatDiagMatrix, float_diag_matrix)
-DEF_VALUE_EXTRACTOR (ComplexDiagMatrix, complex_diag_matrix)
-DEF_VALUE_EXTRACTOR (FloatComplexDiagMatrix, float_complex_diag_matrix)
-DEF_VALUE_EXTRACTOR (PermMatrix, perm_matrix)
-
-DEF_VALUE_EXTRACTOR (SparseMatrix, sparse_matrix)
-DEF_VALUE_EXTRACTOR (SparseComplexMatrix, sparse_complex_matrix)
-DEF_VALUE_EXTRACTOR (SparseBoolMatrix, sparse_bool_matrix)
-#undef DEF_VALUE_EXTRACTOR
-
-#define DEF_DUMMY_VALUE_EXTRACTOR(VALUE,DEFVAL) \
-template<> \
-inline VALUE octave_value_extract<VALUE> (const octave_value&) \
-  { assert (false); return DEFVAL; }
-
-DEF_DUMMY_VALUE_EXTRACTOR (char, 0)
-DEF_DUMMY_VALUE_EXTRACTOR (octave_value, octave_value ())
-#undef DEF_DUMMY_VALUE_EXTRACTOR
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/module.mk	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,61 @@
+EXTRA_DIST += \
+  parse-tree/module.mk
+
+PT_INCLUDES = \
+  parse-tree/pt-all.h \
+  parse-tree/pt-arg-list.h \
+  parse-tree/pt-assign.h \
+  parse-tree/pt-binop.h \
+  parse-tree/pt-bp.h \
+  parse-tree/pt-cbinop.h \
+  parse-tree/pt-cell.h \
+  parse-tree/pt-check.h \
+  parse-tree/pt-cmd.h \
+  parse-tree/pt-colon.h \
+  parse-tree/pt-const.h \
+  parse-tree/pt-decl.h \
+  parse-tree/pt-eval.h \
+  parse-tree/pt-except.h \
+  parse-tree/pt-exp.h \
+  parse-tree/pt-fcn-handle.h \
+  parse-tree/pt-id.h \
+  parse-tree/pt-idx.h \
+  parse-tree/pt-jump.h \
+  parse-tree/pt-loop.h \
+  parse-tree/pt-mat.h \
+  parse-tree/pt-misc.h \
+  parse-tree/pt-pr-code.h \
+  parse-tree/pt-select.h \
+  parse-tree/pt-stmt.h \
+  parse-tree/pt-unop.h \
+  parse-tree/pt-walk.h \
+  parse-tree/pt.h
+
+PARSE_TREE_SRC = \
+  parse-tree/pt-arg-list.cc \
+  parse-tree/pt-assign.cc \
+  parse-tree/pt-binop.cc \
+  parse-tree/pt-bp.cc \
+  parse-tree/pt-cbinop.cc \
+  parse-tree/pt-cell.cc \
+  parse-tree/pt-check.cc \
+  parse-tree/pt-cmd.cc \
+  parse-tree/pt-colon.cc \
+  parse-tree/pt-const.cc \
+  parse-tree/pt-decl.cc \
+  parse-tree/pt-eval.cc \
+  parse-tree/pt-except.cc \
+  parse-tree/pt-exp.cc \
+  parse-tree/pt-fcn-handle.cc \
+  parse-tree/pt-id.cc \
+  parse-tree/pt-idx.cc \
+  parse-tree/pt-jump.cc \
+  parse-tree/pt-loop.cc \
+  parse-tree/pt-mat.cc \
+  parse-tree/pt-misc.cc \
+  parse-tree/pt-pr-code.cc \
+  parse-tree/pt-select.cc \
+  parse-tree/pt-stmt.cc \
+  parse-tree/pt-unop.cc \
+  parse-tree/pt.cc
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-all.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,54 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_all_h)
+#define octave_tree_all_h 1
+
+#include "pt.h"
+#include "pt-arg-list.h"
+#include "pt-assign.h"
+#include "pt-bp.h"
+#include "pt-binop.h"
+#include "pt-cbinop.h"
+#include "pt-check.h"
+#include "pt-cmd.h"
+#include "pt-colon.h"
+#include "pt-const.h"
+#include "pt-decl.h"
+#include "pt-except.h"
+#include "pt-exp.h"
+#include "pt-fcn-handle.h"
+#include "pt-id.h"
+#include "pt-idx.h"
+#include "pt-jump.h"
+#include "pt-loop.h"
+#include "pt-mat.h"
+#include "pt-cell.h"
+#include "pt-misc.h"
+#include "pt-pr-code.h"
+#include "pt-select.h"
+#include "pt-stmt.h"
+#include "pt-unop.h"
+#include "pt-pr-code.h"
+#include "pt-walk.h"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-arg-list.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,286 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <string>
+
+#include "str-vec.h"
+
+#include "defun.h"
+#include "error.h"
+#include "oct-lvalue.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "ov-usr-fcn.h"
+#include "parse.h"
+#include "pt-arg-list.h"
+#include "pt-exp.h"
+#include "pt-id.h"
+#include "pt-pr-code.h"
+#include "pt-walk.h"
+#include "toplev.h"
+#include "unwind-prot.h"
+
+// Argument lists.
+
+tree_argument_list::~tree_argument_list (void)
+{
+  while (! empty ())
+    {
+      iterator p = begin ();
+      delete *p;
+      erase (p);
+    }
+}
+
+bool
+tree_argument_list::has_magic_end (void) const
+{
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      tree_expression *elt = *p;
+
+      if (elt && elt->has_magic_end ())
+        return true;
+    }
+
+  return false;
+}
+
+void
+tree_argument_list::append (const element_type& s)
+{
+  octave_base_list<tree_expression *>::append (s);
+
+  if (! list_includes_magic_end && s && s->has_magic_end ())
+    list_includes_magic_end = true;
+
+  if (! list_includes_magic_tilde && s && s->is_identifier ())
+    {
+      tree_identifier *id = dynamic_cast<tree_identifier *> (s);
+      list_includes_magic_tilde = id && id->is_black_hole ();
+    }
+}
+
+bool
+tree_argument_list::all_elements_are_constant (void) const
+{
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      tree_expression *elt = *p;
+
+      if (! elt->is_constant ())
+        return false;
+    }
+
+  return true;
+}
+
+static const octave_value *indexed_object = 0;
+static int index_position = 0;
+static int num_indices = 0;
+
+DEFCONSTFUN (__end__, , ,
+  "internal function")
+{
+  octave_value retval;
+
+  if (indexed_object)
+    {
+      if (indexed_object->is_object ())
+        {
+          octave_value_list args;
+
+          args(2) = num_indices;
+          args(1) = index_position + 1;
+          args(0) = *indexed_object;
+
+          std::string class_name = indexed_object->class_name ();
+
+          octave_value meth = symbol_table::find_method ("end", class_name);
+
+          if (meth.is_defined ())
+            return feval (meth.function_value (), args, 1);
+        }
+
+      dim_vector dv = indexed_object->dims ();
+      int ndims = dv.length ();
+
+      if (num_indices < ndims)
+        {
+          for (int i = num_indices; i < ndims; i++)
+            dv(num_indices-1) *= dv(i);
+
+          if (num_indices == 1)
+            {
+              ndims = 2;
+              dv.resize (ndims);
+              dv(1) = 1;
+            }
+          else
+            {
+              ndims = num_indices;
+              dv.resize (ndims);
+            }
+        }
+
+      if (index_position < ndims)
+        retval = dv(index_position);
+      else
+        retval = 1;
+    }
+  else
+    ::error ("invalid use of end");
+
+  return retval;
+}
+
+octave_value_list
+tree_argument_list::convert_to_const_vector (const octave_value *object)
+{
+  // END doesn't make sense for functions.  Maybe we need a different
+  // way of asking an octave_value object this question?
+
+  bool stash_object = (list_includes_magic_end
+                       && object
+                       && ! (object->is_function ()
+                             || object->is_function_handle ()));
+
+  unwind_protect frame;
+
+  if (stash_object)
+    {
+      frame.protect_var (indexed_object);
+
+      indexed_object = object;
+    }
+
+  int len = length ();
+
+  std::list<octave_value_list> args;
+
+  iterator p = begin ();
+  for (int k = 0; k < len; k++)
+    {
+      if (stash_object)
+        {
+          frame.protect_var (index_position);
+          frame.protect_var (num_indices);
+
+          index_position = k;
+          num_indices = len;
+        }
+
+      tree_expression *elt = *p++;
+
+      if (elt)
+        {
+          octave_value tmp = elt->rvalue1 ();
+
+          if (error_state)
+            {
+              ::error ("evaluating argument list element number %d", k+1);
+              args.clear ();
+              break;
+            }
+          else
+            {
+              if (tmp.is_cs_list ())
+                args.push_back (tmp.list_value ());
+              else if (tmp.is_defined ())
+                args.push_back (tmp);
+            }
+        }
+      else
+        {
+          args.push_back (octave_value ());
+          break;
+        }
+    }
+
+  return args;
+}
+
+std::list<octave_lvalue>
+tree_argument_list::lvalue_list (void)
+{
+  std::list<octave_lvalue> retval;
+
+  for (tree_argument_list::iterator p = begin ();
+       p != end ();
+       p++)
+    {
+      tree_expression *elt = *p;
+
+      retval.push_back (elt->lvalue ());
+    }
+
+  return retval;
+}
+
+string_vector
+tree_argument_list::get_arg_names (void) const
+{
+  int len = length ();
+
+  string_vector retval (len);
+
+  int k = 0;
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      tree_expression *elt = *p;
+
+      retval(k++) = elt->str_print_code ();
+    }
+
+  return retval;
+}
+
+tree_argument_list *
+tree_argument_list::dup (symbol_table::scope_id scope,
+                         symbol_table::context_id context) const
+{
+  tree_argument_list *new_list = new tree_argument_list ();
+
+  new_list->list_includes_magic_end = list_includes_magic_end;
+  new_list->simple_assign_lhs = simple_assign_lhs;
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_expression *elt = *p;
+
+      new_list->append (elt ? elt->dup (scope, context) : 0);
+    }
+
+  return new_list;
+}
+
+void
+tree_argument_list::accept (tree_walker& tw)
+{
+  tw.visit_argument_list (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-arg-list.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,105 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_arg_list_h)
+#define octave_tree_arg_list_h 1
+
+#include <list>
+
+class octave_value_list;
+class octave_lvalue;
+class tree_expression;
+class tree_walker;
+
+#include "str-vec.h"
+
+#include "base-list.h"
+
+// Argument lists.  Used to hold the list of expressions that are the
+// arguments in a function call or index expression.
+
+class
+tree_argument_list : public octave_base_list<tree_expression *>
+{
+public:
+
+  typedef tree_expression* element_type;
+
+  tree_argument_list (void)
+    : list_includes_magic_end (false), list_includes_magic_tilde (false),
+    simple_assign_lhs (false) { }
+
+  tree_argument_list (tree_expression *t)
+    : list_includes_magic_end (false), list_includes_magic_tilde (false),
+    simple_assign_lhs (false)
+  { append (t); }
+
+  ~tree_argument_list (void);
+
+  bool has_magic_end (void) const;
+
+  bool has_magic_tilde (void) const
+    { return list_includes_magic_tilde; }
+
+  tree_expression *remove_front (void)
+    {
+      iterator p = begin ();
+      tree_expression *retval = *p;
+      erase (p);
+      return retval;
+    }
+
+  void append (const element_type& s);
+
+  void mark_as_simple_assign_lhs (void) { simple_assign_lhs = true; }
+
+  bool is_simple_assign_lhs (void) { return simple_assign_lhs; }
+
+  bool all_elements_are_constant (void) const;
+
+  octave_value_list convert_to_const_vector (const octave_value *object = 0);
+
+  std::list<octave_lvalue> lvalue_list (void);
+
+  string_vector get_arg_names (void) const;
+
+  tree_argument_list *dup (symbol_table::scope_id scope,
+                           symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  bool list_includes_magic_end;
+
+  bool list_includes_magic_tilde;
+
+  bool simple_assign_lhs;
+
+  // No copying!
+
+  tree_argument_list (const tree_argument_list&);
+
+  tree_argument_list& operator = (const tree_argument_list&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-assign.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,530 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <set>
+
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "input.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "pager.h"
+#include "ov.h"
+#include "pt-arg-list.h"
+#include "pt-bp.h"
+#include "pt-assign.h"
+#include "pt-walk.h"
+#include "utils.h"
+#include "variables.h"
+
+// Simple assignment expressions.
+
+// FIXME -- the following variable and the function that uses it
+// should be removed from some future version of Octave.
+
+static const char *former_built_in_variables[] =
+{
+  "DEFAULT_EXEC_PATH",
+  "DEFAULT_LOADPATH",
+  "EDITOR",
+  "EXEC_PATH",
+  "FFTW_WISDOM_PROGRAM",
+  "IMAGEPATH",
+  "INFO_FILE",
+  "INFO_PROGRAM",
+  "LOADPATH",
+  "MAKEINFO_PROGRAM",
+  "PAGER",
+  "PS1",
+  "PS2",
+  "PS4",
+  "__kluge_procbuf_delay__",
+  "automatic_replot",
+  "beep_on_error",
+  "completion_append_char",
+  "crash_dumps_octave_core",
+  "current_script_file_name",
+  "debug_on_error",
+  "debug_on_interrupt",
+  "debug_on_warning",
+  "debug_symtab_lookups",
+  "default_save_options",
+  "echo_executing_commands",
+  "fixed_point_format",
+  "gnuplot_binary",
+  "gnuplot_command_axes",
+  "gnuplot_command_end",
+  "gnuplot_command_plot",
+  "gnuplot_command_replot",
+  "gnuplot_command_splot",
+  "gnuplot_command_title",
+  "gnuplot_command_using",
+  "gnuplot_command_with",
+  "gnuplot_has_frames",
+  "history_file",
+  "history_size",
+  "ignore_function_time_stamp",
+  "max_recursion_depth",
+  "octave_core_file_format",
+  "octave_core_file_limit",
+  "octave_core_file_name",
+  "output_max_field_width",
+  "output_precision",
+  "page_output_immediately",
+  "page_screen_output",
+  "print_answer_id_name",
+  "print_empty_dimensions",
+  "print_rhs_assign_val",
+  "save_header_format_string",
+  "save_precision",
+  "saving_history",
+  "sighup_dumps_octave_core",
+  "sigterm_dumps_octave_core",
+  "silent_functions",
+  "split_long_rows",
+  "string_fill_char",
+  "struct_levels_to_print",
+  "suppress_verbose_help_message",
+  "variables_can_hide_functions",
+  "warn_assign_as_truth_value",
+  "warn_associativity_change",
+  "warn_divide_by_zero",
+  "warn_empty_list_elements",
+  "warn_fortran_indexing",
+  "warn_function_name_clash",
+  "warn_future_time_stamp",
+  "warn_imag_to_real",
+  "warn_matlab_incompatible",
+  "warn_missing_semicolon",
+  "warn_neg_dim_as_zero",
+  "warn_num_to_str",
+  "warn_precedence_change",
+  "warn_reload_forces_clear",
+  "warn_resize_on_range_error",
+  "warn_separator_insert",
+  "warn_single_quote_string",
+  "warn_str_to_num",
+  "warn_undefined_return_values",
+  "warn_variable_switch_label",
+  "whos_line_format",
+  0,
+};
+
+static void
+maybe_warn_former_built_in_variable (const std::string& nm)
+{
+  static bool initialized = false;
+
+  static std::set<std::string> vars;
+
+  if (! initialized)
+    {
+      const char **p = former_built_in_variables;
+
+      while (*p)
+        vars.insert (*p++);
+
+      initialized = true;
+    }
+
+  if (vars.find (nm) != vars.end ())
+    {
+      const char *nm_c_str = nm.c_str ();
+
+      warning_with_id ("Octave:built-in-variable-assignment",
+                       "\
+In recent versions of Octave, %s is a function instead\n\
+of a built-in variable.\n\n\
+By assigning to %s, you have created a variable that hides\n\
+the function %s. To remove the variable and restore the \n\
+function, type \"clear %s\"\n",
+                       nm_c_str, nm_c_str, nm_c_str, nm_c_str);
+    }
+}
+
+tree_simple_assignment::tree_simple_assignment
+  (tree_expression *le, tree_expression *re,
+   bool plhs, int l, int c, octave_value::assign_op t)
+    : tree_expression (l, c), lhs (le), rhs (re), preserve (plhs), etype (t),
+      first_execution (true) { }
+
+tree_simple_assignment::~tree_simple_assignment (void)
+{
+  if (! preserve)
+    delete lhs;
+
+  delete rhs;
+}
+
+octave_value_list
+tree_simple_assignment::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("invalid number of output arguments for expression X = RHS");
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+octave_value
+tree_simple_assignment::rvalue1 (int)
+{
+  octave_value retval;
+
+  if (first_execution && lhs)
+    maybe_warn_former_built_in_variable (lhs->name ());
+
+  if (error_state)
+    return retval;
+
+  if (rhs)
+    {
+      octave_value rhs_val = rhs->rvalue1 ();
+
+      if (! error_state)
+        {
+          if (rhs_val.is_undefined ())
+            {
+              error ("value on right hand side of assignment is undefined");
+              return retval;
+            }
+          else
+            {
+              if (rhs_val.is_cs_list ())
+                {
+                  const octave_value_list lst = rhs_val.list_value ();
+
+                  if (! lst.empty ())
+                    rhs_val = lst(0);
+                  else
+                    {
+                      error ("invalid number of elements on RHS of assignment");
+                      return retval;
+                    }
+                }
+
+              octave_lvalue ult = lhs->lvalue ();
+
+              if (ult.numel () != 1)
+                gripe_nonbraced_cs_list_assignment ();
+
+              if (! error_state)
+                {
+                  ult.assign (etype, rhs_val);
+
+                  if (! error_state)
+                    {
+                      if (etype == octave_value::op_asn_eq)
+                        retval = rhs_val;
+                      else
+                        retval = ult.value ();
+
+                      if (print_result ())
+                        {
+                          // We clear any index here so that we can
+                          // get the new value of the referenced
+                          // object below, instead of the indexed
+                          // value (which should be the same as the
+                          // right hand side value).
+
+                          ult.clear_index ();
+
+                          octave_value lhs_val = ult.value ();
+
+                          if (! error_state)
+                            lhs_val.print_with_name (octave_stdout,
+                                                     lhs->name ());
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+  first_execution = false;
+
+  return retval;
+}
+
+std::string
+tree_simple_assignment::oper (void) const
+{
+  return octave_value::assign_op_as_string (etype);
+}
+
+tree_expression *
+tree_simple_assignment::dup (symbol_table::scope_id scope,
+                             symbol_table::context_id context) const
+{
+  tree_simple_assignment *new_sa
+    = new tree_simple_assignment (lhs ? lhs->dup (scope, context) : 0,
+                                  rhs ? rhs->dup (scope, context) : 0,
+                                  preserve, etype);
+
+  new_sa->copy_base (*this);
+
+  return new_sa;
+}
+
+void
+tree_simple_assignment::accept (tree_walker& tw)
+{
+  tw.visit_simple_assignment (*this);
+}
+
+// Multi-valued assignment expressions.
+
+tree_multi_assignment::tree_multi_assignment
+  (tree_argument_list *lst, tree_expression *r,
+   bool plhs, int l, int c)
+    : tree_expression (l, c), lhs (lst), rhs (r), preserve (plhs),
+      first_execution (true) { }
+
+tree_multi_assignment::~tree_multi_assignment (void)
+{
+  if (! preserve)
+    delete lhs;
+
+  delete rhs;
+}
+
+octave_value
+tree_multi_assignment::rvalue1 (int nargout)
+{
+  octave_value retval;
+
+  const octave_value_list tmp = rvalue (nargout);
+
+  if (! tmp.empty ())
+    retval = tmp(0);
+
+  return retval;
+}
+
+// FIXME -- this works, but it would look a little better if
+// it were broken up into a couple of separate functions.
+
+octave_value_list
+tree_multi_assignment::rvalue (int)
+{
+  octave_value_list retval;
+
+  if (error_state)
+    return retval;
+
+  if (first_execution)
+    {
+      for (tree_argument_list::iterator p = lhs->begin (); p != lhs->end (); p++)
+        {
+          tree_expression *lhs_expr = *p;
+
+          if (lhs_expr)
+            maybe_warn_former_built_in_variable (lhs_expr->name ());
+        }
+    }
+
+  if (rhs)
+    {
+      std::list<octave_lvalue> lvalue_list = lhs->lvalue_list ();
+
+      if (error_state)
+        return retval;
+
+      octave_idx_type n_out = 0;
+
+      for (std::list<octave_lvalue>::const_iterator p = lvalue_list.begin ();
+           p != lvalue_list.end ();
+           p++)
+        n_out += p->numel ();
+
+      // The following trick is used to keep rhs_val constant.
+      const octave_value_list rhs_val1 = rhs->rvalue (n_out, &lvalue_list);
+      const octave_value_list rhs_val = (rhs_val1.length () == 1 && rhs_val1(0).is_cs_list ()
+                                         ? rhs_val1(0).list_value () : rhs_val1);
+
+      if (error_state)
+        return retval;
+
+      octave_idx_type k = 0;
+
+      octave_idx_type n = rhs_val.length ();
+
+      // To avoid copying per elements and possible optimizations, we
+      // postpone joining the final values.
+      std::list<octave_value_list> retval_list;
+
+      tree_argument_list::iterator q = lhs->begin ();
+
+      for (std::list<octave_lvalue>::iterator p = lvalue_list.begin ();
+           p != lvalue_list.end ();
+           p++)
+        {
+          tree_expression *lhs_elt = *q++;
+
+          octave_lvalue ult = *p;
+
+          octave_idx_type nel = ult.numel ();
+
+          if (nel != 1)
+            {
+              if (k + nel <= n)
+                {
+                  // This won't do a copy.
+                  octave_value_list ovl  = rhs_val.slice (k, nel);
+
+                  ult.assign (octave_value::op_asn_eq, octave_value (ovl, true));
+
+                  if (! error_state)
+                    {
+                      retval_list.push_back (ovl);
+
+                      k += nel;
+                    }
+                }
+              else
+                error ("some elements undefined in return list");
+            }
+          else
+            {
+              if (k < n)
+                {
+                  ult.assign (octave_value::op_asn_eq, rhs_val(k));
+
+                  if (ult.is_black_hole ())
+                    {
+                      k++;
+                      continue;
+                    }
+                  else if (! error_state)
+                    {
+                      retval_list.push_back (rhs_val(k));
+
+                      k++;
+                    }
+                }
+              else
+                {
+                  // This can happen for a function like
+                  //
+                  //   function varargout = f ()
+                  //     varargout{1} = nargout;
+                  //   endfunction
+                  //
+                  // called with
+                  //
+                  //    [a, ~] = f ();
+                  //
+                  // Then the list of of RHS values will contain one
+                  // element but we are iterating over the list of all
+                  // RHS values.  We shouldn't complain that a value we
+                  // don't need is missing from the list.
+
+                  if (ult.is_black_hole ())
+                    {
+                      k++;
+                      continue;
+                    }
+                  else
+                    error ("element number %d undefined in return list", k+1);
+                }
+            }
+
+          if (error_state)
+            break;
+          else if (print_result ())
+            {
+              // We clear any index here so that we can get
+              // the new value of the referenced object below,
+              // instead of the indexed value (which should be
+              // the same as the right hand side value).
+
+              ult.clear_index ();
+
+              octave_value lhs_val = ult.value ();
+
+              if (! error_state)
+                lhs_val.print_with_name (octave_stdout,
+                                         lhs_elt->name ());
+            }
+
+          if (error_state)
+            break;
+
+        }
+
+      // Concatenate return values.
+      retval = retval_list;
+
+    }
+
+  first_execution = false;
+
+  return retval;
+}
+
+/*
+%!function varargout = f ()
+%!  varargout{1} = nargout;
+%!endfunction
+%!
+%!test
+%! [a, ~] = f ();
+%! assert (a, 2);
+%!test
+%! [a, ~, ~, ~, ~] = f ();
+%! assert (a, 5);
+*/
+
+std::string
+tree_multi_assignment::oper (void) const
+{
+  return octave_value::assign_op_as_string (op_type ());
+}
+
+tree_expression *
+tree_multi_assignment::dup (symbol_table::scope_id scope,
+                            symbol_table::context_id context) const
+{
+  tree_multi_assignment *new_ma
+    = new tree_multi_assignment (lhs ? lhs->dup (scope, context) : 0,
+                                 rhs ? rhs->dup (scope, context) : 0,
+                                 preserve);
+
+  new_ma->copy_base (*this);
+
+  return new_ma;
+}
+
+void
+tree_multi_assignment::accept (tree_walker& tw)
+{
+  tw.visit_multi_assignment (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-assign.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,173 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_assign_h)
+#define octave_tree_assign_h 1
+
+#include <iosfwd>
+#include <string>
+
+class tree_argument_list;
+class tree_walker;
+
+class octave_value;
+class octave_value_list;
+class octave_lvalue;
+
+#include "ov.h"
+#include "pt-exp.h"
+#include "symtab.h"
+
+// Simple assignment expressions.
+
+class
+tree_simple_assignment : public tree_expression
+{
+public:
+
+  tree_simple_assignment (bool plhs = false, int l = -1, int c = -1,
+                          octave_value::assign_op t = octave_value::op_asn_eq)
+    : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), ans_ass (),
+      etype (t), first_execution (true) { }
+
+  tree_simple_assignment (tree_expression *le, tree_expression *re,
+                          bool plhs = false, int l = -1, int c = -1,
+                          octave_value::assign_op t = octave_value::op_asn_eq);
+
+  ~tree_simple_assignment (void);
+
+  bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  bool is_assignment_expression (void) const { return true; }
+
+  std::string oper (void) const;
+
+  tree_expression *left_hand_side (void) { return lhs; }
+
+  tree_expression *right_hand_side (void) { return rhs; }
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  octave_value::assign_op op_type (void) const { return etype; }
+
+private:
+
+  void do_assign (octave_lvalue& ult, const octave_value_list& args,
+                  const octave_value& rhs_val);
+
+  void do_assign (octave_lvalue& ult, const octave_value& rhs_val);
+
+  // The left hand side of the assignment.
+  tree_expression *lhs;
+
+  // The right hand side of the assignment.
+  tree_expression *rhs;
+
+  // True if we should not delete the lhs.
+  bool preserve;
+
+  // True if this is an assignment to the automatic variable ans.
+  bool ans_ass;
+
+  // The type of the expression.
+  octave_value::assign_op etype;
+
+  // true only on first rvalue() call.
+  bool first_execution;
+
+  // No copying!
+
+  tree_simple_assignment (const tree_simple_assignment&);
+
+  tree_simple_assignment& operator = (const tree_simple_assignment&);
+};
+
+// Multi-valued assignment expressions.
+
+class
+tree_multi_assignment : public tree_expression
+{
+public:
+
+  tree_multi_assignment (bool plhs = false, int l = -1, int c = -1)
+    : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs),
+      first_execution (true) { }
+
+  tree_multi_assignment (tree_argument_list *lst, tree_expression *r,
+                         bool plhs = false, int l = -1, int c = -1);
+
+  ~tree_multi_assignment (void);
+
+  bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
+
+  bool is_assignment_expression (void) const { return true; }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  std::string oper (void) const;
+
+  tree_argument_list *left_hand_side (void) { return lhs; }
+
+  tree_expression *right_hand_side (void) { return rhs; }
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  octave_value::assign_op op_type (void) const { return octave_value::op_asn_eq; }
+
+private:
+
+  // The left hand side of the assignment.
+  tree_argument_list *lhs;
+
+  // The right hand side of the assignment.
+  tree_expression *rhs;
+
+  // True if we should not delete the lhs.
+  bool preserve;
+
+  // true only on first rvalue() call.
+  bool first_execution;
+
+  // No copying!
+
+  tree_multi_assignment (const tree_multi_assignment&);
+
+  tree_multi_assignment& operator = (const tree_multi_assignment&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-binop.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,315 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "defun.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "profiler.h"
+#include "pt-binop.h"
+#include "pt-bp.h"
+#include "pt-walk.h"
+#include "variables.h"
+
+// TRUE means we mark | and & expressions for braindead short-circuit
+// behavior.
+static bool Vdo_braindead_shortcircuit_evaluation;
+
+// Binary expressions.
+
+octave_value_list
+tree_binary_expression::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("binary operator `%s': invalid number of output arguments",
+           oper () . c_str ());
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+octave_value
+tree_binary_expression::rvalue1 (int)
+{
+  octave_value retval;
+
+  if (error_state)
+    return retval;
+
+  if (Vdo_braindead_shortcircuit_evaluation
+      && eligible_for_braindead_shortcircuit)
+    {
+      if (op_lhs)
+        {
+          octave_value a = op_lhs->rvalue1 ();
+
+          if (! error_state)
+            {
+              if (a.ndims () == 2 && a.rows () == 1 && a.columns () == 1)
+                {
+                  bool result = false;
+
+                  bool a_true = a.is_true ();
+
+                  if (! error_state)
+                    {
+                      if (a_true)
+                        {
+                          if (etype == octave_value::op_el_or)
+                            {
+                              result = true;
+                              goto done;
+                            }
+                        }
+                      else
+                        {
+                          if (etype == octave_value::op_el_and)
+                            goto done;
+                        }
+
+                      if (op_rhs)
+                        {
+                          octave_value b = op_rhs->rvalue1 ();
+
+                          if (! error_state)
+                            result = b.is_true ();
+                        }
+
+                    done:
+
+                      if (! error_state)
+                        return octave_value (result);
+                    }
+                }
+            }
+        }
+    }
+
+  if (op_lhs)
+    {
+      octave_value a = op_lhs->rvalue1 ();
+
+      if (! error_state && a.is_defined () && op_rhs)
+        {
+          octave_value b = op_rhs->rvalue1 ();
+
+          if (! error_state && b.is_defined ())
+            {
+              BEGIN_PROFILER_BLOCK ("binary " + oper ())
+
+              // Note: The profiler does not catch the braindead
+              // short-circuit evaluation code above, but that should be
+              // ok. The evaluation of operands and the operator itself
+              // is entangled and it's not clear where to start/stop
+              // timing the operator to make it reasonable.
+
+              retval = ::do_binary_op (etype, a, b);
+
+              if (error_state)
+                retval = octave_value ();
+
+              END_PROFILER_BLOCK
+            }
+        }
+    }
+
+  return retval;
+}
+
+std::string
+tree_binary_expression::oper (void) const
+{
+  return octave_value::binary_op_as_string (etype);
+}
+
+tree_expression *
+tree_binary_expression::dup (symbol_table::scope_id scope,
+                             symbol_table::context_id context) const
+{
+  tree_binary_expression *new_be
+    = new tree_binary_expression (op_lhs ? op_lhs->dup (scope, context) : 0,
+                                  op_rhs ? op_rhs->dup (scope, context) : 0,
+                                  line (), column (), etype);
+
+  new_be->copy_base (*this);
+
+  return new_be;
+}
+
+void
+tree_binary_expression::accept (tree_walker& tw)
+{
+  tw.visit_binary_expression (*this);
+}
+
+// Boolean expressions.
+
+octave_value_list
+tree_boolean_expression::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("binary operator `%s': invalid number of output arguments",
+           oper () . c_str ());
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+octave_value
+tree_boolean_expression::rvalue1 (int)
+{
+  octave_value retval;
+
+  if (error_state)
+    return retval;
+
+  bool result = false;
+
+  // This evaluation is not caught by the profiler, since we can't find
+  // a reasonable place where to time. Note that we don't want to
+  // include evaluation of LHS or RHS into the timing, but this is
+  // entangled together with short-circuit evaluation here.
+
+  if (op_lhs)
+    {
+      octave_value a = op_lhs->rvalue1 ();
+
+      if (! error_state)
+        {
+          bool a_true = a.is_true ();
+
+          if (! error_state)
+            {
+              if (a_true)
+                {
+                  if (etype == bool_or)
+                    {
+                      result = true;
+                      goto done;
+                    }
+                }
+              else
+                {
+                  if (etype == bool_and)
+                    goto done;
+                }
+
+              if (op_rhs)
+                {
+                  octave_value b = op_rhs->rvalue1 ();
+
+                  if (! error_state)
+                    result = b.is_true ();
+                }
+
+            done:
+
+              if (! error_state)
+                retval = octave_value (result);
+            }
+        }
+    }
+
+  return retval;
+}
+
+std::string
+tree_boolean_expression::oper (void) const
+{
+  std::string retval = "<unknown>";
+
+  switch (etype)
+    {
+    case bool_and:
+      retval = "&&";
+      break;
+
+    case bool_or:
+      retval = "||";
+      break;
+
+    default:
+      break;
+    }
+
+  return retval;
+}
+
+tree_expression *
+tree_boolean_expression::dup (symbol_table::scope_id scope,
+                              symbol_table::context_id context) const
+{
+  tree_boolean_expression *new_be
+    = new tree_boolean_expression (op_lhs ? op_lhs->dup (scope, context) : 0,
+                                   op_rhs ? op_rhs->dup (scope, context) : 0,
+                                   line (), column (), etype);
+
+  new_be->copy_base (*this);
+
+  return new_be;
+}
+
+DEFUN (do_braindead_shortcircuit_evaluation, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} do_braindead_shortcircuit_evaluation ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} do_braindead_shortcircuit_evaluation (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} do_braindead_shortcircuit_evaluation (@var{new_val}, \"local\")\n\
+Query or set the internal variable that controls whether Octave will\n\
+do short-circuit evaluation of @samp{|} and @samp{&} operators inside the\n\
+conditions of if or while statements.\n\
+\n\
+This feature is only provided for compatibility with @sc{matlab} and should\n\
+not be used unless you are porting old code that relies on this feature.\n\
+\n\
+To obtain short-circuit behavior for logical expressions in new programs,\n\
+you should always use the @samp{&&} and @samp{||} operators.\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (do_braindead_shortcircuit_evaluation);
+}
+
+/*
+%!test
+%! x = 0;
+%! do_braindead_shortcircuit_evaluation (0);
+%! if (1 | (x = 1))
+%! endif
+%! assert (x, 1);
+%! do_braindead_shortcircuit_evaluation (1);
+%! if (1 | (x = 0))
+%! endif
+%! assert (x, 1);
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-binop.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,183 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_binop_h)
+#define octave_tree_binop_h 1
+
+#include <string>
+
+class tree_walker;
+
+class octave_value;
+class octave_value_list;
+class octave_lvalue;
+
+#include "ov.h"
+#include "pt-exp.h"
+#include "symtab.h"
+
+// Binary expressions.
+
+class
+tree_binary_expression : public tree_expression
+{
+public:
+
+  tree_binary_expression (int l = -1, int c = -1,
+                          octave_value::binary_op t
+                            = octave_value::unknown_binary_op)
+    : tree_expression (l, c), op_lhs (0), op_rhs (0), etype (t),
+      eligible_for_braindead_shortcircuit (false) { }
+
+  tree_binary_expression (tree_expression *a, tree_expression *b,
+                          int l = -1, int c = -1,
+                          octave_value::binary_op t
+                            = octave_value::unknown_binary_op)
+    : tree_expression (l, c), op_lhs (a), op_rhs (b), etype (t),
+      eligible_for_braindead_shortcircuit (false) { }
+
+  ~tree_binary_expression (void)
+    {
+      delete op_lhs;
+      delete op_rhs;
+    }
+
+  void mark_braindead_shortcircuit (const std::string& file)
+    {
+      if (etype == octave_value::op_el_and
+          || etype == octave_value::op_el_or)
+        {
+          if (file.empty ())
+            warning_with_id ("Octave:possible-matlab-short-circuit-operator",
+                             "possible Matlab-style short-circuit operator at line %d, column %d",
+                             line (), column ());
+          else
+            warning_with_id ("Octave:possible-matlab-short-circuit-operator",
+                             "%s: possible Matlab-style short-circuit operator at line %d, column %d",
+                             file.c_str (), line (), column ());
+
+          eligible_for_braindead_shortcircuit = true;
+
+          op_lhs->mark_braindead_shortcircuit (file);
+          op_rhs->mark_braindead_shortcircuit (file);
+        }
+    }
+
+  bool has_magic_end (void) const
+    {
+      return ((op_lhs && op_lhs->has_magic_end ())
+              || (op_rhs && op_rhs->has_magic_end ()));
+    }
+
+  bool is_binary_expression (void) const { return true; }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  std::string oper (void) const;
+
+  octave_value::binary_op op_type (void) const { return etype; }
+
+  tree_expression *lhs (void) { return op_lhs; }
+  tree_expression *rhs (void) { return op_rhs; }
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+protected:
+
+  // The operands for the expression.
+  tree_expression *op_lhs;
+  tree_expression *op_rhs;
+
+private:
+
+  // The type of the expression.
+  octave_value::binary_op etype;
+
+  // TRUE if this is an | or & expression in the condition of an IF
+  // or WHILE statement.
+  bool eligible_for_braindead_shortcircuit;
+
+  // No copying!
+
+  tree_binary_expression (const tree_binary_expression&);
+
+  tree_binary_expression& operator = (const tree_binary_expression&);
+};
+
+// Boolean expressions.
+
+class
+tree_boolean_expression : public tree_binary_expression
+{
+public:
+
+  enum type
+    {
+      unknown,
+      bool_and,
+      bool_or
+    };
+
+  tree_boolean_expression (int l = -1, int c = -1, type t = unknown)
+    : tree_binary_expression (l, c), etype (t) { }
+
+  tree_boolean_expression (tree_expression *a, tree_expression *b,
+                           int l = -1, int c = -1, type t = unknown)
+    : tree_binary_expression (a, b, l, c), etype (t) { }
+
+  ~tree_boolean_expression (void) { }
+
+  bool is_boolean_expression (void) const { return true; }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  std::string oper (void) const;
+
+  type op_type (void) const { return etype; }
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+private:
+
+  // The type of the expression.
+  type etype;
+
+  // No copying!
+
+  tree_boolean_expression (const tree_boolean_expression&);
+
+  tree_boolean_expression& operator = (const tree_boolean_expression&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-bp.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,501 @@
+/*
+
+Copyright (C) 2001-2012 Ben Sapp
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ov-usr-fcn.h"
+#include "pager.h"
+#include "pt-all.h"
+
+// TRUE means SIGINT should put us in the debugger at the next
+// available breakpoint.
+bool octave_debug_on_interrupt_state = false;
+
+void
+tree_breakpoint::visit_while_command (tree_while_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+
+  if (! found)
+    {
+      tree_statement_list *lst = cmd.body ();
+
+      if (lst)
+        lst->accept (*this);
+    }
+}
+
+void
+tree_breakpoint::visit_do_until_command (tree_do_until_command& cmd)
+{
+  if (! found)
+    {
+      tree_statement_list *lst = cmd.body ();
+
+      if (lst)
+        lst->accept (*this);
+
+      if (! found)
+        {
+          if (cmd.line () >= line)
+            take_action (cmd);
+        }
+    }
+}
+
+void
+tree_breakpoint::visit_argument_list (tree_argument_list&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_binary_expression (tree_binary_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_break_command (tree_break_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+}
+
+void
+tree_breakpoint::visit_colon_expression (tree_colon_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_continue_command (tree_continue_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+}
+
+void
+tree_breakpoint::do_decl_command (tree_decl_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+}
+
+void
+tree_breakpoint::visit_global_command (tree_global_command& cmd)
+{
+  do_decl_command (cmd);
+}
+
+void
+tree_breakpoint::visit_persistent_command (tree_persistent_command& cmd)
+{
+  do_decl_command (cmd);
+}
+
+void
+tree_breakpoint::visit_decl_elt (tree_decl_elt&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_decl_init_list (tree_decl_init_list&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_simple_for_command (tree_simple_for_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+
+  if (! found)
+    {
+      tree_statement_list *lst = cmd.body ();
+
+      if (lst)
+        lst->accept (*this);
+    }
+}
+
+void
+tree_breakpoint::visit_complex_for_command (tree_complex_for_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+
+  if (! found)
+    {
+      tree_statement_list *lst = cmd.body ();
+
+      if (lst)
+        lst->accept (*this);
+    }
+}
+
+void
+tree_breakpoint::visit_octave_user_script (octave_user_script& fcn)
+{
+  tree_statement_list *cmd_list = fcn.body ();
+
+  if (cmd_list)
+    cmd_list->accept (*this);
+}
+
+void
+tree_breakpoint::visit_octave_user_function (octave_user_function& fcn)
+{
+  tree_statement_list *cmd_list = fcn.body ();
+
+  if (cmd_list)
+    cmd_list->accept (*this);
+}
+
+void
+tree_breakpoint::visit_octave_user_function_header (octave_user_function&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_octave_user_function_trailer (octave_user_function&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_function_def (tree_function_def& fdef)
+{
+  octave_value fcn = fdef.function ();
+
+  octave_function *f = fcn.function_value ();
+
+  if (f)
+    f->accept (*this);
+}
+
+void
+tree_breakpoint::visit_identifier (tree_identifier&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_if_clause (tree_if_clause&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_if_command (tree_if_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+
+  if (! found)
+    {
+      tree_if_command_list *lst = cmd.cmd_list ();
+
+      if (lst)
+        lst->accept (*this);
+    }
+}
+
+void
+tree_breakpoint::visit_if_command_list (tree_if_command_list& lst)
+{
+  for (tree_if_command_list::iterator p = lst.begin (); p != lst.end (); p++)
+    {
+      tree_if_clause *t = *p;
+
+      if (t->line () >= line)
+        take_action (*t);
+
+      if (! found)
+        {
+          tree_statement_list *stmt_lst = t->commands ();
+
+          if (stmt_lst)
+            stmt_lst->accept (*this);
+        }
+
+      if (found)
+        break;
+    }
+}
+
+void
+tree_breakpoint::visit_index_expression (tree_index_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_matrix (tree_matrix&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_cell (tree_cell&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_multi_assignment (tree_multi_assignment&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_no_op_command (tree_no_op_command& cmd)
+{
+  if (cmd.is_end_of_fcn_or_script () && cmd.line () >= line)
+    take_action (cmd);
+}
+
+void
+tree_breakpoint::visit_anon_fcn_handle (tree_anon_fcn_handle&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_constant (tree_constant&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_fcn_handle (tree_fcn_handle&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_parameter_list (tree_parameter_list&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_postfix_expression (tree_postfix_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_prefix_expression (tree_prefix_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_return_command (tree_return_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+}
+
+void
+tree_breakpoint::visit_return_list (tree_return_list&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_simple_assignment (tree_simple_assignment&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_statement (tree_statement& stmt)
+{
+  if (stmt.is_command ())
+    {
+      tree_command *cmd = stmt.command ();
+
+      cmd->accept (*this);
+    }
+  else
+    {
+      if (stmt.line () >= line)
+        take_action (stmt);
+    }
+}
+
+void
+tree_breakpoint::visit_statement_list (tree_statement_list& lst)
+{
+  for (tree_statement_list::iterator p = lst.begin (); p != lst.end (); p++)
+    {
+      tree_statement *elt = *p;
+
+      if (elt)
+        {
+          elt->accept (*this);
+
+          if (found)
+            break;
+        }
+    }
+}
+
+void
+tree_breakpoint::visit_switch_case (tree_switch_case&)
+{
+  panic_impossible ();
+}
+
+void
+tree_breakpoint::visit_switch_case_list (tree_switch_case_list& lst)
+{
+  for (tree_switch_case_list::iterator p = lst.begin (); p != lst.end (); p++)
+    {
+      tree_switch_case *t = *p;
+
+      if (t->line () >= line)
+        take_action (*t);
+
+      if (! found)
+        {
+          tree_statement_list *stmt_lst = t->commands ();
+
+          if (stmt_lst)
+            stmt_lst->accept (*this);
+        }
+
+      if (found)
+        break;
+    }
+}
+
+void
+tree_breakpoint::visit_switch_command (tree_switch_command& cmd)
+{
+  if (cmd.line () >= line)
+    take_action (cmd);
+
+  if (! found)
+    {
+      tree_switch_case_list *lst = cmd.case_list ();
+
+      if (lst)
+        lst->accept (*this);
+    }
+}
+
+void
+tree_breakpoint::visit_try_catch_command (tree_try_catch_command& cmd)
+{
+  tree_statement_list *try_code = cmd.body ();
+
+  if (try_code)
+    try_code->accept (*this);
+
+  if (! found)
+    {
+      tree_statement_list *catch_code = cmd.cleanup ();
+
+      if (catch_code)
+        catch_code->accept (*this);
+    }
+}
+
+void
+tree_breakpoint::visit_unwind_protect_command (tree_unwind_protect_command& cmd)
+{
+  tree_statement_list *body = cmd.body ();
+
+  if (body)
+    body->accept (*this);
+
+  if (! found)
+    {
+      tree_statement_list *cleanup = cmd.cleanup ();
+
+      if (cleanup)
+        cleanup->accept (*this);
+    }
+}
+
+void
+tree_breakpoint::take_action (tree& tr)
+{
+  if (act == set)
+    {
+      tr.set_breakpoint ();
+      line = tr.line ();
+      found = true;
+    }
+  else if (act == clear)
+    {
+      if (tr.is_breakpoint ())
+        {
+          tr.delete_breakpoint ();
+          found = true;
+        }
+    }
+  else if (act == list)
+    {
+      if (tr.is_breakpoint ())
+        bp_list.append (octave_value (tr.line ()));
+    }
+  else
+    panic_impossible ();
+}
+
+void
+tree_breakpoint::take_action (tree_statement& stmt)
+{
+  int lineno = stmt.line ();
+
+  if (act == set)
+    {
+      stmt.set_breakpoint ();
+      line = lineno;
+      found = true;
+    }
+  else if (act == clear)
+    {
+      if (stmt.is_breakpoint ())
+        {
+          stmt.delete_breakpoint ();
+          found = true;
+        }
+    }
+  else if (act == list)
+    {
+      if (stmt.is_breakpoint ())
+        bp_list.append (octave_value (lineno));
+    }
+  else
+    panic_impossible ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-bp.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,170 @@
+/*
+
+Copyright (C) 2001-2012 Ben Sapp
+
+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_bp_h)
+#define octave_tree_bp_h 1
+
+#include "input.h"
+#include "ov-usr-fcn.h"
+#include "pt-walk.h"
+#include "pt-pr-code.h"
+#include "toplev.h"
+
+class tree;
+class tree_decl_command;
+
+class
+tree_breakpoint : public tree_walker
+{
+ public:
+
+  enum action { set = 1, clear = 2, list = 3 };
+
+  tree_breakpoint (int l, action a)
+    : line (l), act (a), found (false), bp_list () { }
+
+  ~tree_breakpoint (void) { }
+
+  bool success (void) const { return found; }
+
+  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_while_command (tree_while_command&);
+
+  void visit_do_until_command (tree_do_until_command&);
+
+  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_anon_fcn_handle (tree_anon_fcn_handle&);
+
+  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&);
+
+  octave_value_list get_list (void) { return bp_list; }
+
+  int get_line (void) { return line; }
+
+ private:
+
+  void do_decl_command (tree_decl_command&);
+
+  void take_action (tree& tr);
+
+  void take_action (tree_statement& stmt);
+
+  // Statement line number we are looking for.
+  int line;
+
+  // What to do.
+  action act;
+
+  // Have we already found the line?
+  bool found;
+
+  // List of breakpoint line numbers.
+  octave_value_list bp_list;
+
+  // No copying!
+
+  tree_breakpoint (const tree_breakpoint&);
+
+  tree_breakpoint& operator = (const tree_breakpoint&);
+};
+
+// TRUE means SIGINT should put us in the debugger at the next
+// available breakpoint.
+extern bool octave_debug_on_interrupt_state;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-cbinop.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,223 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "pt-cbinop.h"
+#include "pt-bp.h"
+#include "pt-unop.h"
+#include "pt-walk.h"
+
+// If a tree expression is a transpose or hermitian transpose, return
+// the argument and corresponding operator.
+
+static octave_value::unary_op
+strip_trans_herm (tree_expression *&exp)
+{
+  if (exp->is_unary_expression ())
+    {
+      tree_unary_expression *uexp =
+        dynamic_cast<tree_unary_expression *> (exp);
+
+      octave_value::unary_op op = uexp->op_type ();
+
+      if (op == octave_value::op_transpose
+          || op == octave_value::op_hermitian)
+        exp = uexp->operand ();
+      else
+        op = octave_value::unknown_unary_op;
+
+      return op;
+    }
+  else
+    return octave_value::unknown_unary_op;
+}
+
+static octave_value::unary_op
+strip_not (tree_expression *&exp)
+{
+  if (exp->is_unary_expression ())
+    {
+      tree_unary_expression *uexp =
+        dynamic_cast<tree_unary_expression *> (exp);
+
+      octave_value::unary_op op = uexp->op_type ();
+
+      if (op == octave_value::op_not)
+        exp = uexp->operand ();
+      else
+        op = octave_value::unknown_unary_op;
+
+      return op;
+    }
+  else
+    return octave_value::unknown_unary_op;
+}
+
+// Possibly convert multiplication to trans_mul, mul_trans, herm_mul,
+// or mul_herm.
+
+static octave_value::compound_binary_op
+simplify_mul_op (tree_expression *&a, tree_expression *&b)
+{
+  octave_value::compound_binary_op retop
+    = octave_value::unknown_compound_binary_op;
+
+  octave_value::unary_op opa = strip_trans_herm (a);
+
+  if (opa == octave_value::op_hermitian)
+    retop = octave_value::op_herm_mul;
+  else if (opa == octave_value::op_transpose)
+    retop = octave_value::op_trans_mul;
+  else
+    {
+      octave_value::unary_op opb = strip_trans_herm (b);
+
+      if (opb == octave_value::op_hermitian)
+        retop = octave_value::op_mul_herm;
+      else if (opb == octave_value::op_transpose)
+        retop = octave_value::op_mul_trans;
+    }
+
+  return retop;
+}
+
+// Possibly convert left division to trans_ldiv or herm_ldiv.
+
+static octave_value::compound_binary_op
+simplify_ldiv_op (tree_expression *&a, tree_expression *&)
+{
+  octave_value::compound_binary_op retop
+    = octave_value::unknown_compound_binary_op;
+
+  octave_value::unary_op opa = strip_trans_herm (a);
+
+  if (opa == octave_value::op_hermitian)
+    retop = octave_value::op_herm_ldiv;
+  else if (opa == octave_value::op_transpose)
+    retop = octave_value::op_trans_ldiv;
+
+  return retop;
+}
+
+// Possibly contract and/or with negation.
+
+static octave_value::compound_binary_op
+simplify_and_or_op (tree_expression *&a, tree_expression *&b, octave_value::binary_op op)
+{
+  octave_value::compound_binary_op retop
+    = octave_value::unknown_compound_binary_op;
+
+  octave_value::unary_op opa = strip_not (a);
+
+  if (opa == octave_value::op_not)
+    {
+      if (op == octave_value::op_el_and)
+        retop = octave_value::op_el_not_and;
+      else if (op == octave_value::op_el_or)
+        retop = octave_value::op_el_not_or;
+    }
+  else
+    {
+      octave_value::unary_op opb = strip_not (b);
+
+      if (opb == octave_value::op_not)
+        {
+          if (op == octave_value::op_el_and)
+            retop = octave_value::op_el_and_not;
+          else if (op == octave_value::op_el_or)
+            retop = octave_value::op_el_or_not;
+        }
+    }
+
+  return retop;
+}
+
+tree_binary_expression *
+maybe_compound_binary_expression (tree_expression *a, tree_expression *b,
+                                  int l, int c, octave_value::binary_op t)
+{
+  tree_expression *ca = a, *cb = b;
+  octave_value::compound_binary_op ct;
+
+  switch (t)
+    {
+    case octave_value::op_mul:
+      ct = simplify_mul_op (ca, cb);
+      break;
+
+    case octave_value::op_ldiv:
+      ct = simplify_ldiv_op (ca, cb);
+      break;
+
+    case octave_value::op_el_and:
+    case octave_value::op_el_or:
+      ct = simplify_and_or_op (ca, cb, t);
+      break;
+
+    default:
+      ct = octave_value::unknown_compound_binary_op;
+      break;
+    }
+
+  tree_binary_expression *ret = (ct == octave_value::unknown_compound_binary_op)
+    ? new tree_binary_expression (a, b, l, c, t)
+    : new tree_compound_binary_expression (a, b, l, c, t, ca, cb, ct);
+
+  return ret;
+}
+
+octave_value
+tree_compound_binary_expression::rvalue1 (int)
+{
+  octave_value retval;
+
+  if (error_state)
+    return retval;
+
+  if (op_lhs)
+    {
+      octave_value a = op_lhs->rvalue1 ();
+
+      if (! error_state && a.is_defined () && op_rhs)
+        {
+          octave_value b = op_rhs->rvalue1 ();
+
+          if (! error_state && b.is_defined ())
+            {
+              retval = ::do_binary_op (etype, a, b);
+
+              if (error_state)
+                retval = octave_value ();
+            }
+        }
+    }
+
+  return retval;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-cbinop.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,79 @@
+/*
+
+Copyright (C) 2008-2012 Jaroslav Hajek
+
+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_cbinop_h)
+#define octave_tree_cbinop_h 1
+
+#include <string>
+
+class tree_walker;
+
+class octave_value;
+class octave_value_list;
+class octave_lvalue;
+
+#include "ov.h"
+#include "pt-binop.h"
+#include "symtab.h"
+
+// Binary expressions that can be reduced to compound operations
+
+class
+tree_compound_binary_expression : public tree_binary_expression
+{
+public:
+
+  tree_compound_binary_expression (tree_expression *a, tree_expression *b,
+                                   int l, int c,
+                                   octave_value::binary_op t,
+                                   tree_expression *ca, tree_expression *cb,
+                                   octave_value::compound_binary_op ct)
+    : tree_binary_expression (a, b, l, c, t), op_lhs (ca), op_rhs (cb),
+      etype (ct) { }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value::compound_binary_op cop_type (void) const { return etype; }
+
+private:
+
+  tree_expression *op_lhs;
+  tree_expression *op_rhs;
+  octave_value::compound_binary_op etype;
+
+  // No copying!
+
+  tree_compound_binary_expression (const tree_compound_binary_expression&);
+
+  tree_compound_binary_expression& operator =
+    (const tree_compound_binary_expression&);
+};
+
+// a "virtual constructor"
+
+tree_binary_expression *
+maybe_compound_binary_expression (tree_expression *a, tree_expression *b,
+                                  int l = -1, int c = -1,
+                                  octave_value::binary_op t
+                                  = octave_value::unknown_binary_op);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-cell.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,126 @@
+/*
+
+Copyright (C) 1999-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "Cell.h"
+#include "defun.h"
+#include "error.h"
+#include "oct-obj.h"
+#include "pt-arg-list.h"
+#include "pt-bp.h"
+#include "pt-exp.h"
+#include "pt-cell.h"
+#include "pt-walk.h"
+#include "utils.h"
+#include "ov.h"
+#include "variables.h"
+
+octave_value
+tree_cell::rvalue1 (int)
+{
+  octave_value retval;
+
+  octave_idx_type nr = length ();
+  octave_idx_type nc = -1;
+
+  Cell val;
+
+  int i = 0;
+
+  for (iterator p = begin (); p != end (); p++)
+    {
+      tree_argument_list *elt = *p;
+
+      octave_value_list row = elt->convert_to_const_vector ();
+
+      if (nr == 1)
+        // Optimize the single row case.
+        val = row.cell_value ();
+      else if (nc < 0)
+        {
+          nc = row.length ();
+
+          val = Cell (nr, nc);
+        }
+      else
+        {
+          octave_idx_type this_nc = row.length ();
+
+          if (nc != this_nc)
+            {
+              ::error ("number of columns must match");
+              return retval;
+            }
+        }
+
+      for (octave_idx_type j = 0; j < nc; j++)
+        val(i,j) = row(j);
+
+      i++;
+    }
+
+  retval = val;
+
+  return retval;
+}
+
+octave_value_list
+tree_cell::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("invalid number of output arguments for cell array");
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+tree_expression *
+tree_cell::dup (symbol_table::scope_id scope,
+                symbol_table::context_id context) const
+{
+  tree_cell *new_cell = new tree_cell (0, line (), column ());
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_argument_list *elt = *p;
+
+      new_cell->append (elt ? elt->dup (scope, context) : 0);
+    }
+
+  new_cell->copy_base (*this);
+
+  return new_cell;
+}
+
+void
+tree_cell::accept (tree_walker& tw)
+{
+  tw.visit_cell (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-cell.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,69 @@
+/*
+
+Copyright (C) 1999-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_cell_h)
+#define octave_tree_cell_h 1
+
+#include <iosfwd>
+
+class octave_value;
+class octave_value_list;
+class tree_argument_list;
+
+class tree_walker;
+
+#include "pt-mat.h"
+#include "symtab.h"
+
+// General cells.
+
+class
+tree_cell : public tree_matrix
+{
+public:
+
+  tree_cell (tree_argument_list *row = 0, int l = -1, int c = -1)
+    : tree_matrix (row, l, c) { }
+
+  ~tree_cell (void) { }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int);
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_cell (const tree_cell&);
+
+  tree_cell& operator = (const tree_cell&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-check.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,561 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "input.h"
+#include "ov-usr-fcn.h"
+#include "pt-all.h"
+
+void
+tree_checker::visit_argument_list (tree_argument_list& lst)
+{
+  tree_argument_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_expression *elt = *p++;
+
+      if (elt)
+        {
+          if (do_lvalue_check && ! elt->lvalue_ok ())
+            gripe ("invalid lvalue in multiple assignment", elt->line ());
+        }
+    }
+}
+
+void
+tree_checker::visit_binary_expression (tree_binary_expression& expr)
+{
+  tree_expression *op1 = expr.lhs ();
+
+  if (op1)
+    op1->accept (*this);
+
+  tree_expression *op2 = expr.rhs ();
+
+  if (op2)
+    op2->accept (*this);
+}
+
+void
+tree_checker::visit_break_command (tree_break_command&)
+{
+}
+
+void
+tree_checker::visit_colon_expression (tree_colon_expression& expr)
+{
+  tree_expression *op1 = expr.base ();
+
+  if (op1)
+    op1->accept (*this);
+
+  tree_expression *op3 = expr.increment ();
+
+  if (op3)
+    op3->accept (*this);
+
+  tree_expression *op2 = expr.limit ();
+
+  if (op2)
+    op2->accept (*this);
+}
+
+void
+tree_checker::visit_continue_command (tree_continue_command&)
+{
+}
+
+void
+tree_checker::do_decl_command (tree_decl_command& cmd)
+{
+  tree_decl_init_list *init_list = cmd.initializer_list ();
+
+  if (init_list)
+    init_list->accept (*this);
+}
+
+void
+tree_checker::visit_global_command (tree_global_command& cmd)
+{
+  do_decl_command (cmd);
+}
+
+void
+tree_checker::visit_persistent_command (tree_persistent_command& cmd)
+{
+  do_decl_command (cmd);
+}
+
+void
+tree_checker::visit_decl_elt (tree_decl_elt& cmd)
+{
+  tree_identifier *id = cmd.ident ();
+
+  if (id)
+    id->accept (*this);
+
+  tree_expression *expr = cmd.expression ();
+
+  if (expr)
+    expr->accept (*this);
+}
+
+void
+tree_checker::visit_decl_init_list (tree_decl_init_list& lst)
+{
+  tree_decl_init_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_decl_elt *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_simple_for_command (tree_simple_for_command& cmd)
+{
+  tree_expression *lhs = cmd.left_hand_side ();
+
+  if (lhs)
+    {
+      if (! lhs->lvalue_ok ())
+        gripe ("invalid lvalue in for command", cmd.line ());
+    }
+
+  tree_expression *expr = cmd.control_expr ();
+
+  if (expr)
+    expr->accept (*this);
+
+  tree_expression *maxproc = cmd.maxproc_expr ();
+
+  if (maxproc)
+    maxproc->accept (*this);
+
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    list->accept (*this);
+}
+
+void
+tree_checker::visit_complex_for_command (tree_complex_for_command& cmd)
+{
+  tree_argument_list *lhs = cmd.left_hand_side ();
+
+  if (lhs)
+    {
+      int len = lhs->length ();
+
+      if (len == 0 || len > 2)
+        gripe ("invalid number of output arguments in for command",
+               cmd.line ());
+
+      do_lvalue_check = true;
+
+      lhs->accept (*this);
+
+      do_lvalue_check = false;
+    }
+
+  tree_expression *expr = cmd.control_expr ();
+
+  if (expr)
+    expr->accept (*this);
+
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    list->accept (*this);
+}
+
+void
+tree_checker::visit_octave_user_script (octave_user_script& fcn)
+{
+  tree_statement_list *cmd_list = fcn.body ();
+
+  if (cmd_list)
+    cmd_list->accept (*this);
+}
+
+void
+tree_checker::visit_octave_user_function (octave_user_function& fcn)
+{
+  tree_statement_list *cmd_list = fcn.body ();
+
+  if (cmd_list)
+    cmd_list->accept (*this);
+}
+
+void
+tree_checker::visit_function_def (tree_function_def& fdef)
+{
+  octave_value fcn = fdef.function ();
+
+  octave_function *f = fcn.function_value ();
+
+  if (f)
+    f->accept (*this);
+}
+
+void
+tree_checker::visit_identifier (tree_identifier& /* id */)
+{
+}
+
+void
+tree_checker::visit_if_clause (tree_if_clause& cmd)
+{
+  tree_expression *expr = cmd.condition ();
+
+  if (expr)
+    expr->accept (*this);
+
+  tree_statement_list *list = cmd.commands ();
+
+  if (list)
+    list->accept (*this);
+}
+
+void
+tree_checker::visit_if_command (tree_if_command& cmd)
+{
+  tree_if_command_list *list = cmd.cmd_list ();
+
+  if (list)
+    list->accept (*this);
+}
+
+void
+tree_checker::visit_if_command_list (tree_if_command_list& lst)
+{
+  tree_if_command_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_if_clause *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_index_expression (tree_index_expression& expr)
+{
+  tree_expression *e = expr.expression ();
+
+  if (e)
+    e->accept (*this);
+
+  std::list<tree_argument_list *> lst = expr.arg_lists ();
+
+  std::list<tree_argument_list *>::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_argument_list *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_matrix (tree_matrix& lst)
+{
+  tree_matrix::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_argument_list *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_cell (tree_cell& lst)
+{
+  tree_matrix::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_argument_list *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_multi_assignment (tree_multi_assignment& expr)
+{
+  tree_argument_list *lhs = expr.left_hand_side ();
+
+  if (lhs)
+    {
+      do_lvalue_check = true;
+
+      lhs->accept (*this);
+
+      do_lvalue_check = false;
+    }
+
+  tree_expression *rhs = expr.right_hand_side ();
+
+  if (rhs)
+    rhs->accept (*this);
+}
+
+void
+tree_checker::visit_no_op_command (tree_no_op_command& /* cmd */)
+{
+}
+
+void
+tree_checker::visit_anon_fcn_handle (tree_anon_fcn_handle& /* afh */)
+{
+}
+
+void
+tree_checker::visit_constant (tree_constant& /* val */)
+{
+}
+
+void
+tree_checker::visit_fcn_handle (tree_fcn_handle& /* fh */)
+{
+}
+
+void
+tree_checker::visit_parameter_list (tree_parameter_list& lst)
+{
+  tree_parameter_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_decl_elt *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_postfix_expression (tree_postfix_expression& expr)
+{
+  tree_expression *e = expr.operand ();
+
+  if (e)
+    e->accept (*this);
+}
+
+void
+tree_checker::visit_prefix_expression (tree_prefix_expression& expr)
+{
+  tree_expression *e = expr.operand ();
+
+  if (e)
+    e->accept (*this);
+}
+
+void
+tree_checker::visit_return_command (tree_return_command&)
+{
+}
+
+void
+tree_checker::visit_return_list (tree_return_list& lst)
+{
+  tree_return_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_index_expression *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_simple_assignment (tree_simple_assignment& expr)
+{
+  tree_expression *lhs = expr.left_hand_side ();
+
+  if (lhs)
+    {
+      if (! lhs->lvalue_ok ())
+        gripe ("invalid lvalue in assignment", expr.line ());
+    }
+
+  tree_expression *rhs = expr.right_hand_side ();
+
+  if (rhs)
+    rhs->accept (*this);
+}
+
+void
+tree_checker::visit_statement (tree_statement& stmt)
+{
+  tree_command *cmd = stmt.command ();
+
+  if (cmd)
+    cmd->accept (*this);
+  else
+    {
+      tree_expression *expr = stmt.expression ();
+
+      if (expr)
+        expr->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_statement_list (tree_statement_list& lst)
+{
+  for (tree_statement_list::iterator p = lst.begin (); p != lst.end (); p++)
+    {
+      tree_statement *elt = *p;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_switch_case (tree_switch_case& cs)
+{
+  tree_expression *label = cs.case_label ();
+
+  if (label)
+    label->accept (*this);
+
+  tree_statement_list *list = cs.commands ();
+
+  if (list)
+    list->accept (*this);
+}
+
+void
+tree_checker::visit_switch_case_list (tree_switch_case_list& lst)
+{
+  tree_switch_case_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_switch_case *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_checker::visit_switch_command (tree_switch_command& cmd)
+{
+  tree_expression *expr = cmd.switch_value ();
+
+  if (expr)
+    expr->accept (*this);
+
+  tree_switch_case_list *list = cmd.case_list ();
+
+  if (list)
+    list->accept (*this);
+}
+
+void
+tree_checker::visit_try_catch_command (tree_try_catch_command& cmd)
+{
+  tree_statement_list *try_code = cmd.body ();
+
+  if (try_code)
+    try_code->accept (*this);
+
+  tree_statement_list *catch_code = cmd.cleanup ();
+
+  if (catch_code)
+    catch_code->accept (*this);
+}
+
+void
+tree_checker::visit_unwind_protect_command
+  (tree_unwind_protect_command& cmd)
+{
+  tree_statement_list *unwind_protect_code = cmd.body ();
+
+  if (unwind_protect_code)
+    unwind_protect_code->accept (*this);
+
+  tree_statement_list *cleanup_code = cmd.cleanup ();
+
+  if (cleanup_code)
+    cleanup_code->accept (*this);
+}
+
+void
+tree_checker::visit_while_command (tree_while_command& cmd)
+{
+  tree_expression *expr = cmd.condition ();
+
+  if (expr)
+    expr->accept (*this);
+
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    list->accept (*this);
+}
+
+void
+tree_checker::visit_do_until_command (tree_do_until_command& cmd)
+{
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    list->accept (*this);
+
+  tree_expression *expr = cmd.condition ();
+
+  if (expr)
+    expr->accept (*this);
+}
+
+void
+tree_checker::gripe (const std::string& msg, int line)
+{
+  if (curr_fcn_file_name.empty ())
+    error ("%s", msg.c_str ());
+  else
+    error ("%s: %d: %s", curr_fcn_file_name.c_str (), line, msg.c_str ());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-check.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,139 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_checker_h)
+#define octave_tree_checker_h 1
+
+#include "pt-walk.h"
+
+class tree_decl_command;
+
+// How to check the semantics of the code that the parse trees represent.
+
+class
+tree_checker : public tree_walker
+{
+public:
+
+  tree_checker (void)
+    : do_lvalue_check (false) { }
+
+  ~tree_checker (void) { }
+
+  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_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_anon_fcn_handle (tree_anon_fcn_handle&);
+
+  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&);
+
+private:
+
+  bool do_lvalue_check;
+
+  void do_decl_command (tree_decl_command&);
+
+  void gripe (const std::string& msg, int line);
+
+  // No copying!
+
+  tree_checker (const tree_checker&);
+
+  tree_checker& operator = (const tree_checker&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-cmd.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,58 @@
+/*
+
+Copyright (C) 1994-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "pt-cmd.h"
+#include "pt-walk.h"
+
+// No-op.
+
+tree_command *
+tree_no_op_command::dup (symbol_table::scope_id,
+                         symbol_table::context_id) const
+{
+  return new tree_no_op_command (orig_cmd, line (), column ());
+}
+
+void
+tree_no_op_command::accept (tree_walker& tw)
+{
+  tw.visit_no_op_command (*this);
+}
+
+// Function definition.
+
+tree_command *
+tree_function_def::dup (symbol_table::scope_id,
+                        symbol_table::context_id) const
+{
+  return new tree_function_def (fcn, line (), column ());
+}
+
+void
+tree_function_def::accept (tree_walker& tw)
+{
+  tw.visit_function_def (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-cmd.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,127 @@
+/*
+
+Copyright (C) 1994-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_cmd_h)
+#define octave_tree_cmd_h 1
+
+#include <string>
+
+class tree_walker;
+
+#include "ov-fcn.h"
+#include "pt.h"
+#include "pt-bp.h"
+#include "symtab.h"
+
+// A base class for commands.
+
+class
+tree_command : public tree
+{
+public:
+
+  tree_command (int l = -1, int c = -1)
+    : tree (l, c) { }
+
+  virtual ~tree_command (void) { }
+
+  virtual tree_command *dup (symbol_table::scope_id,
+                             symbol_table::context_id context) const = 0;
+
+private:
+
+  // No copying!
+
+  tree_command (const tree_command&);
+
+  tree_command& operator = (const tree_command&);
+};
+
+// No-op.
+
+class
+tree_no_op_command : public tree_command
+{
+public:
+
+  tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1)
+    : tree_command (l, c), eof (cmd == "endfunction" || cmd == "endscript"),
+      orig_cmd (cmd) { }
+
+  ~tree_no_op_command (void) { }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  bool is_end_of_fcn_or_script (void) const { return eof; }
+
+  std::string original_command (void) { return orig_cmd; }
+
+private:
+
+  bool eof;
+
+  std::string orig_cmd;
+
+  // No copying!
+
+  tree_no_op_command (const tree_no_op_command&);
+
+  tree_no_op_command& operator = (const tree_no_op_command&);
+};
+
+// Function definition.
+
+class
+tree_function_def : public tree_command
+{
+public:
+
+  tree_function_def (octave_function *f, int l = -1, int c = -1)
+    : tree_command (l, c), fcn (f) { }
+
+  ~tree_function_def (void) { }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  octave_value function (void) { return fcn; }
+
+private:
+
+  octave_value fcn;
+
+  tree_function_def (const octave_value& v, int l = -1, int c = -1)
+    : tree_command (l, c), fcn (v) { }
+
+  // No copying!
+
+  tree_function_def (const tree_function_def&);
+
+  tree_function_def& operator = (const tree_function_def&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-colon.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,285 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "oct-obj.h"
+#include "pager.h"
+#include "ov.h"
+#include "pt-bp.h"
+#include "pt-colon.h"
+#include "pt-walk.h"
+
+// Colon expressions.
+
+tree_colon_expression *
+tree_colon_expression::append (tree_expression *t)
+{
+  tree_colon_expression *retval = 0;
+
+  if (op_base)
+    {
+      if (op_limit)
+        {
+          if (op_increment)
+            ::error ("invalid colon expression");
+          else
+            {
+              // Stupid syntax:
+              //
+              // base : limit
+              // base : increment : limit
+
+              op_increment = op_limit;
+              op_limit = t;
+            }
+        }
+      else
+        op_limit = t;
+
+      retval = this;
+    }
+  else
+    ::error ("invalid colon expression");
+
+  return retval;
+}
+
+octave_value_list
+tree_colon_expression::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("invalid number of output arguments for colon expression");
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+octave_value
+tree_colon_expression::make_range (const Matrix& m_base,
+                                   const Matrix& m_limit,
+                                   const Matrix& m_increment,
+                                   bool result_is_str, bool dq_str) const
+{
+  octave_value retval;
+
+  bool base_empty = m_base.is_empty ();
+  bool limit_empty = m_limit.is_empty ();
+  bool increment_empty = m_increment.is_empty ();
+
+  if (base_empty || limit_empty || increment_empty)
+    retval = Range ();
+  else
+    {
+      retval = Range (m_base(0), m_limit(0), m_increment(0));
+
+      if (result_is_str)
+        retval = retval.convert_to_str (false, true, dq_str ? '"' : '\'');
+    }
+
+  return retval;
+}
+
+octave_value
+tree_colon_expression::make_range (const octave_value& ov_base,
+                                   const octave_value& ov_limit,
+                                   const octave_value& ov_increment) const
+{
+  octave_value retval;
+
+  if (ov_base.is_object () || ov_limit.is_object () ||
+      ov_increment.is_object ())
+    {
+      octave_value_list tmp1;
+      tmp1(2) = ov_limit;
+      tmp1(1) = ov_increment;
+      tmp1(0) = ov_base;
+
+      octave_value fcn = symbol_table::find_function ("colon", tmp1);
+
+      if (fcn.is_defined ())
+        {
+          octave_value_list tmp2 = fcn.do_multi_index_op (1, tmp1);
+
+          if (! error_state)
+            retval = tmp2 (0);
+        }
+      else
+        ::error ("can not find overloaded colon function");
+    }
+  else
+    {
+      bool result_is_str = (ov_base.is_string () && ov_limit.is_string ());
+      bool dq_str = (ov_base.is_dq_string () || ov_limit.is_dq_string ());
+
+      Matrix m_base = ov_base.matrix_value (true);
+
+      if (error_state)
+        eval_error ("invalid base value in colon expression");
+      else
+        {
+          Matrix m_limit = ov_limit.matrix_value (true);
+
+          if (error_state)
+            eval_error ("invalid limit value in colon expression");
+          else
+            {
+              Matrix m_increment = ov_increment.matrix_value (true);
+
+              if (error_state)
+                eval_error ("invalid increment value in colon expression");
+              else
+                retval = make_range (m_base, m_limit, m_increment,
+                                     result_is_str, dq_str);
+            }
+        }
+    }
+
+  return retval;
+}
+
+octave_value
+tree_colon_expression::rvalue1 (int)
+{
+  octave_value retval;
+
+  if (error_state || ! op_base || ! op_limit)
+    return retval;
+
+  octave_value ov_base = op_base->rvalue1 ();
+
+  if (error_state || ov_base.is_undefined ())
+    eval_error ("invalid base value in colon expression");
+  else
+    {
+      octave_value ov_limit = op_limit->rvalue1 ();
+
+      if (error_state || ov_limit.is_undefined ())
+        eval_error ("invalid limit value in colon expression");
+      else if (ov_base.is_object () || ov_limit.is_object ())
+        {
+          octave_value_list tmp1;
+
+          if (op_increment)
+            {
+              octave_value ov_increment = op_increment->rvalue1 ();
+
+              if (error_state || ov_increment.is_undefined ())
+                eval_error ("invalid increment value in colon expression");
+              else
+                {
+                  tmp1(2) = ov_limit;
+                  tmp1(1) = ov_increment;
+                  tmp1(0) = ov_base;
+                }
+            }
+          else
+            {
+              tmp1(1) = ov_limit;
+              tmp1(0) = ov_base;
+            }
+
+          if (!error_state)
+            {
+              octave_value fcn = symbol_table::find_function ("colon", tmp1);
+
+              if (fcn.is_defined ())
+                {
+                  octave_value_list tmp2 = fcn.do_multi_index_op (1, tmp1);
+
+                  if (! error_state)
+                    retval = tmp2 (0);
+                }
+              else
+                ::error ("can not find overloaded colon function");
+            }
+        }
+      else
+        {
+          octave_value ov_increment = 1.0;
+
+          if (op_increment)
+            {
+              ov_increment = op_increment->rvalue1 ();
+
+              if (error_state || ov_increment.is_undefined ())
+                eval_error ("invalid increment value in colon expression");
+            }
+
+          if (! error_state)
+            retval = make_range (ov_base, ov_limit, ov_increment);
+        }
+    }
+
+  return retval;
+}
+
+void
+tree_colon_expression::eval_error (const std::string& s) const
+{
+  ::error ("%s", s.c_str ());
+}
+
+int
+tree_colon_expression::line (void) const
+{
+  return (op_base ? op_base->line ()
+          : (op_increment ? op_increment->line ()
+             : (op_limit ? op_limit->line ()
+                : -1)));
+}
+
+int
+tree_colon_expression::column (void) const
+{
+  return (op_base ? op_base->column ()
+          : (op_increment ? op_increment->column ()
+             : (op_limit ? op_limit->column ()
+                : -1)));
+}
+
+tree_expression *
+tree_colon_expression::dup (symbol_table::scope_id scope,
+                            symbol_table::context_id context) const
+{
+  tree_colon_expression *new_ce = new
+    tree_colon_expression (op_base ? op_base->dup (scope, context) : 0,
+                           op_limit ? op_limit->dup (scope, context) : 0,
+                           op_increment ? op_increment->dup (scope, context) : 0,
+                           line (), column ());
+
+  new_ce->copy_base (*new_ce);
+
+  return new_ce;
+}
+
+void
+tree_colon_expression::accept (tree_walker& tw)
+{
+  tw.visit_colon_expression (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-colon.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,124 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_colon_h)
+#define octave_tree_colon 1
+
+#include <string>
+
+class tree_walker;
+
+class octave_value;
+class octave_value_list;
+class octave_lvalue;
+
+#include "pt-exp.h"
+#include "symtab.h"
+
+// Colon expressions.
+
+class
+tree_colon_expression : public tree_expression
+{
+public:
+
+  tree_colon_expression (int l = -1, int c = -1)
+    : tree_expression (l, c), op_base (0), op_limit (0),
+      op_increment (0), save_base (false) { }
+
+  tree_colon_expression (tree_expression *e, int l = -1, int c = -1)
+    : tree_expression (l, c), op_base (e), op_limit (0),
+      op_increment (0), save_base (false) { }
+
+  tree_colon_expression (tree_expression *bas, tree_expression *lim,
+                         tree_expression *inc, int l = -1, int c = -1)
+    : tree_expression (l, c), op_base (bas), op_limit (lim),
+      op_increment (inc), save_base (false) { }
+
+  ~tree_colon_expression (void)
+    {
+      if (! save_base)
+        delete op_base;
+
+      delete op_limit;
+      delete op_increment;
+    }
+
+  bool has_magic_end (void) const
+    {
+      return ((op_base && op_base->has_magic_end ())
+              || (op_limit && op_limit->has_magic_end ())
+              || (op_increment && op_increment->has_magic_end ()));
+    }
+
+  void preserve_base (void) { save_base = true; }
+
+  tree_colon_expression *append (tree_expression *t);
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  void eval_error (const std::string& s) const;
+
+  tree_expression *base (void) { return op_base; }
+
+  tree_expression *limit (void) { return op_limit; }
+
+  tree_expression *increment (void) { return op_increment; }
+
+  int line (void) const;
+  int column (void) const;
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // The components of the expression.
+  tree_expression *op_base;
+  tree_expression *op_limit;
+  tree_expression *op_increment;
+
+  bool save_base;
+
+  octave_value
+  make_range (const Matrix& m_base, const Matrix& m_limit,
+              const Matrix& m_increment, bool result_is_str,
+              bool dq_str) const;
+
+  octave_value
+  make_range (const octave_value& ov_base, const octave_value& ov_limit,
+              const octave_value& ov_increment) const;
+
+  // No copying!
+
+  tree_colon_expression (const tree_colon_expression&);
+
+  tree_colon_expression& operator = (const tree_colon_expression&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-const.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,87 @@
+/*
+
+Copyright (C) 1993-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "error.h"
+#include "oct-obj.h"
+#include "pager.h"
+#include "pt-const.h"
+#include "pt-walk.h"
+
+// We are likely to have a lot of tree_constant objects to allocate,
+// so make the grow_size large.
+DEFINE_OCTAVE_ALLOCATOR2 (tree_constant, 1024);
+
+void
+tree_constant::print (std::ostream& os, bool pr_as_read_syntax, bool pr_orig_text)
+{
+  if (pr_orig_text && ! orig_text.empty ())
+    os << orig_text;
+  else
+    val.print (os, pr_as_read_syntax);
+}
+
+void
+tree_constant::print_raw (std::ostream& os, bool pr_as_read_syntax,
+                          bool pr_orig_text)
+{
+  if (pr_orig_text && ! orig_text.empty ())
+    os << orig_text;
+  else
+    val.print_raw (os, pr_as_read_syntax);
+}
+
+octave_value_list
+tree_constant::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("invalid number of output arguments for constant expression");
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+tree_expression *
+tree_constant::dup (symbol_table::scope_id,
+                    symbol_table::context_id) const
+{
+  tree_constant *new_tc
+    = new tree_constant (val, orig_text, line (), column ());
+
+  new_tc->copy_base (*this);
+
+  return new_tc;
+}
+
+void
+tree_constant::accept (tree_walker& tw)
+{
+  tw.visit_constant (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-const.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,105 @@
+/*
+
+Copyright (C) 1993-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_const_h)
+#define octave_tree_const_h 1
+
+#include <iosfwd>
+#include <string>
+
+#include "oct-alloc.h"
+
+class octave_value_list;
+class tree_walker;
+
+#include "ov.h"
+#include "pt-bp.h"
+#include "pt-exp.h"
+#include "symtab.h"
+
+class
+tree_constant : public tree_expression
+{
+public:
+
+  tree_constant (int l = -1, int c = -1)
+    : tree_expression (l, c), val (), orig_text () { }
+
+  tree_constant (const octave_value& v, int l = -1, int c = -1)
+    : tree_expression (l, c), val (v), orig_text () { }
+
+  tree_constant (const octave_value& v, const std::string& ot,
+                 int l = -1, int c = -1)
+    : tree_expression (l, c), val (v), orig_text (ot) { }
+
+  ~tree_constant (void) { }
+
+  bool has_magic_end (void) const { return false; }
+
+  // Type.  It would be nice to eliminate the need for this.
+
+  bool is_constant (void) const { return true; }
+
+  void maybe_mutate (void) { val.maybe_mutate (); }
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false,
+              bool pr_orig_txt = true);
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false,
+                  bool pr_orig_txt = true);
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int = 1) { return val; }
+
+  octave_value_list rvalue (int nargout);
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  // Store the original text corresponding to this constant for later
+  // pretty printing.
+
+  void stash_original_text (const std::string& s) { orig_text = s; }
+
+  std::string original_text (void) const { return orig_text; }
+
+private:
+
+  // The actual value that this constant refers to.
+  octave_value val;
+
+  // The original text form of this constant.
+  std::string orig_text;
+
+  // No copying!
+
+  tree_constant (const tree_constant&);
+
+  tree_constant& operator = (const tree_constant&);
+
+  DECLARE_OCTAVE_ALLOCATOR
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-decl.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,147 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "defun.h"
+#include "error.h"
+#include "pt-cmd.h"
+#include "ov.h"
+#include "oct-lvalue.h"
+#include "pt-bp.h"
+#include "pt-decl.h"
+#include "pt-exp.h"
+#include "pt-id.h"
+#include "pt-walk.h"
+#include "utils.h"
+#include "variables.h"
+
+// Declarations (global, static, etc.).
+
+tree_decl_elt::~tree_decl_elt (void)
+{
+  delete id;
+  delete expr;
+}
+
+bool
+tree_decl_elt::eval (void)
+{
+  bool retval = false;
+
+  if (id && expr)
+    {
+      octave_lvalue ult = id->lvalue ();
+
+      octave_value init_val = expr->rvalue1 ();
+
+      if (! error_state)
+        {
+          ult.assign (octave_value::op_asn_eq, init_val);
+
+          retval = true;
+        }
+    }
+
+  return retval;
+}
+
+tree_decl_elt *
+tree_decl_elt::dup (symbol_table::scope_id scope,
+                    symbol_table::context_id context) const
+{
+  return new tree_decl_elt (id ? id->dup (scope, context) : 0,
+                            expr ? expr->dup (scope, context) : 0);
+}
+
+void
+tree_decl_elt::accept (tree_walker& tw)
+{
+  tw.visit_decl_elt (*this);
+}
+
+// Initializer lists for declaration statements.
+
+tree_decl_init_list *
+tree_decl_init_list::dup (symbol_table::scope_id scope,
+                          symbol_table::context_id context) const
+{
+  tree_decl_init_list *new_dil = new tree_decl_init_list ();
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_decl_elt *elt = *p;
+
+      new_dil->append (elt ? elt->dup (scope, context) : 0);
+    }
+
+  return new_dil;
+}
+
+void
+tree_decl_init_list::accept (tree_walker& tw)
+{
+  tw.visit_decl_init_list (*this);
+}
+
+// Base class for declaration commands (global, static).
+
+tree_decl_command::~tree_decl_command (void)
+{
+  delete init_list;
+}
+
+// Global.
+
+tree_command *
+tree_global_command::dup (symbol_table::scope_id scope,
+                          symbol_table::context_id context) const
+{
+  return
+    new tree_global_command (init_list ? init_list->dup (scope, context) : 0,
+                             line (), column ());
+}
+
+void
+tree_global_command::accept (tree_walker& tw)
+{
+  tw.visit_global_command (*this);
+}
+
+// Static.
+
+tree_command *
+tree_persistent_command::dup (symbol_table::scope_id scope,
+                          symbol_table::context_id context) const
+{
+  return
+    new tree_persistent_command (init_list ? init_list->dup (scope, context) : 0,
+                                 line (), column ());
+}
+
+void
+tree_persistent_command::accept (tree_walker& tw)
+{
+  tw.visit_persistent_command (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-decl.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,241 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_decl_h)
+#define octave_tree_decl_h 1
+
+class tree_expression;
+class tree_identifier;
+
+class tree_walker;
+
+#include <string>
+
+#include "base-list.h"
+#include "oct-lvalue.h"
+#include "pt-cmd.h"
+#include "pt-id.h"
+#include "symtab.h"
+
+// List of expressions that make up a declaration statement.
+
+class
+tree_decl_elt
+{
+public:
+
+  tree_decl_elt (tree_identifier *i = 0, tree_expression *e = 0)
+    : id (i), expr (e) { }
+
+  ~tree_decl_elt (void);
+
+  bool eval (void);
+
+  bool is_defined (void) { return id ? id->is_defined () : false; }
+
+  bool is_variable (void) { return id ? id->is_variable () : false; }
+
+  void mark_as_formal_parameter (void)
+  {
+    if (id)
+      id->mark_as_formal_parameter ();
+  }
+
+  bool lvalue_ok (void) { return id ? id->lvalue_ok () : false; }
+
+  // Do not allow functions to return null values.
+  octave_value rvalue1 (int nargout = 1)
+  {
+    return id ? id->rvalue1 (nargout).storable_value () : octave_value ();
+  }
+
+  octave_value_list rvalue (int nargout)
+  {
+    octave_value_list retval;
+
+    if (nargout > 1)
+      error ("invalid number of output arguments in declaration list");
+    else
+      retval = rvalue1 (nargout);
+
+    return retval;
+  }
+
+  octave_lvalue lvalue (void) { return id ? id->lvalue () : octave_lvalue (); }
+
+  tree_identifier *ident (void) { return id; }
+
+  tree_expression *expression (void) { return expr; }
+
+  tree_decl_elt *dup (symbol_table::scope_id scope,
+                      symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // An identifier to tag with the declared property.
+  tree_identifier *id;
+
+  // An initializer expression (may be zero);
+  tree_expression *expr;
+
+  // No copying!
+
+  tree_decl_elt (const tree_decl_elt&);
+
+  tree_decl_elt& operator = (const tree_decl_elt&);
+};
+
+class
+tree_decl_init_list : public octave_base_list<tree_decl_elt *>
+{
+public:
+
+  tree_decl_init_list (void) { }
+
+  tree_decl_init_list (tree_decl_elt *t) { append (t); }
+
+  ~tree_decl_init_list (void)
+    {
+      while (! empty ())
+        {
+          iterator p = begin ();
+          delete *p;
+          erase (p);
+        }
+    }
+
+  tree_decl_init_list *dup (symbol_table::scope_id scope,
+                            symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_decl_init_list (const tree_decl_init_list&);
+
+  tree_decl_init_list& operator = (const tree_decl_init_list&);
+};
+
+// Base class for declaration commands -- global, static, etc.
+
+class
+tree_decl_command : public tree_command
+{
+public:
+
+  tree_decl_command (const std::string& n, int l = -1, int c = -1)
+    : tree_command (l, c), cmd_name (n), init_list (0) { }
+
+  tree_decl_command (const std::string& n, tree_decl_init_list *t,
+                     int l = -1, int c = -1)
+    : tree_command (l, c), cmd_name (n), init_list (t) { }
+
+  ~tree_decl_command (void);
+
+  tree_decl_init_list *initializer_list (void) { return init_list; }
+
+  std::string name (void) { return cmd_name; }
+
+protected:
+
+  // The name of this command -- global, static, etc.
+  std::string cmd_name;
+
+  // The list of variables or initializers in this declaration command.
+  tree_decl_init_list *init_list;
+
+private:
+
+  // No copying!
+
+  tree_decl_command (const tree_decl_command&);
+
+  tree_decl_command& operator = (const tree_decl_command&);
+};
+
+// Global.
+
+class
+tree_global_command : public tree_decl_command
+{
+public:
+
+  tree_global_command (int l = -1, int c = -1)
+    : tree_decl_command ("global", l, c) { }
+
+  tree_global_command (tree_decl_init_list *t, int l = -1, int c = -1)
+    : tree_decl_command ("global", t, l, c) { }
+
+  ~tree_global_command (void) { }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  static void do_init (tree_decl_elt& elt);
+
+  // No copying!
+
+  tree_global_command (const tree_global_command&);
+
+  tree_global_command& operator = (const tree_global_command&);
+};
+
+// Persistent.
+
+class
+tree_persistent_command : public tree_decl_command
+{
+public:
+
+  tree_persistent_command (int l = -1, int c = -1)
+    : tree_decl_command ("persistent", l, c) { }
+
+  tree_persistent_command (tree_decl_init_list *t, int l = -1, int c = -1)
+    : tree_decl_command ("persistent", t, l, c) { }
+
+  ~tree_persistent_command (void) { }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  static void do_init (tree_decl_elt& elt);
+
+  // No copying!
+
+  tree_persistent_command (const tree_persistent_command&);
+
+  tree_persistent_command& operator = (const tree_persistent_command&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-eval.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1265 @@
+/*
+
+Copyright (C) 2009-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cctype>
+
+#include <iostream>
+
+#include <fstream>
+#include <typeinfo>
+
+#include "debug.h"
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "input.h"
+#include "ov-fcn-handle.h"
+#include "ov-usr-fcn.h"
+#include "variables.h"
+#include "pt-all.h"
+#include "pt-eval.h"
+#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;
+
+int tree_evaluator::dbstep_flag = 0;
+
+size_t tree_evaluator::current_frame = 0;
+
+bool tree_evaluator::debug_mode = false;
+
+tree_evaluator::stmt_list_type tree_evaluator::statement_context
+  = tree_evaluator::other;
+
+bool tree_evaluator::in_loop_command = false;
+
+// Maximum nesting level for functions, scripts, or sourced files called
+// recursively.
+int Vmax_recursion_depth = 256;
+
+// If TRUE, turn off printing of results in functions (as if a
+// semicolon has been appended to each statement).
+static bool Vsilent_functions = false;
+
+// Normal evaluator.
+
+void
+tree_evaluator::visit_anon_fcn_handle (tree_anon_fcn_handle&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_argument_list (tree_argument_list&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_binary_expression (tree_binary_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_break_command (tree_break_command& cmd)
+{
+  if (! error_state)
+    {
+      if (debug_mode)
+        do_breakpoint (cmd.is_breakpoint ());
+
+      if (statement_context == function || statement_context == script
+          || in_loop_command)
+        tree_break_command::breaking = 1;
+    }
+}
+
+void
+tree_evaluator::visit_colon_expression (tree_colon_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_continue_command (tree_continue_command& cmd)
+{
+  if (! error_state)
+    {
+      if (debug_mode)
+        do_breakpoint (cmd.is_breakpoint ());
+
+      if (statement_context == function || statement_context == script
+          || in_loop_command)
+        tree_continue_command::continuing = 1;
+    }
+}
+
+void
+tree_evaluator::reset_debug_state (void)
+{
+  debug_mode = bp_table::have_breakpoints () || Vdebugging;
+
+  dbstep_flag = 0;
+}
+
+static inline void
+do_global_init (tree_decl_elt& elt)
+{
+  tree_identifier *id = elt.ident ();
+
+  if (id)
+    {
+      id->mark_global ();
+
+      if (! error_state)
+        {
+          octave_lvalue ult = id->lvalue ();
+
+          if (ult.is_undefined ())
+            {
+              tree_expression *expr = elt.expression ();
+
+              octave_value init_val;
+
+              if (expr)
+                init_val = expr->rvalue1 ();
+              else
+                init_val = Matrix ();
+
+              ult.assign (octave_value::op_asn_eq, init_val);
+            }
+        }
+    }
+}
+
+static inline void
+do_static_init (tree_decl_elt& elt)
+{
+  tree_identifier *id = elt.ident ();
+
+  if (id)
+    {
+      id->mark_as_static ();
+
+      octave_lvalue ult = id->lvalue ();
+
+      if (ult.is_undefined ())
+        {
+          tree_expression *expr = elt.expression ();
+
+          octave_value init_val;
+
+          if (expr)
+            init_val = expr->rvalue1 ();
+          else
+            init_val = Matrix ();
+
+          ult.assign (octave_value::op_asn_eq, init_val);
+        }
+    }
+}
+
+void
+tree_evaluator::do_decl_init_list (decl_elt_init_fcn fcn,
+                                   tree_decl_init_list *init_list)
+{
+  if (init_list)
+    {
+      for (tree_decl_init_list::iterator p = init_list->begin ();
+           p != init_list->end (); p++)
+        {
+          tree_decl_elt *elt = *p;
+
+          fcn (*elt);
+
+          if (error_state)
+            break;
+        }
+    }
+}
+
+void
+tree_evaluator::visit_global_command (tree_global_command& cmd)
+{
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint ());
+
+  do_decl_init_list (do_global_init, cmd.initializer_list ());
+}
+
+void
+tree_evaluator::visit_persistent_command (tree_persistent_command& cmd)
+{
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint ());
+
+  do_decl_init_list (do_static_init, cmd.initializer_list ());
+}
+
+void
+tree_evaluator::visit_decl_elt (tree_decl_elt&)
+{
+  panic_impossible ();
+}
+
+#if 0
+bool
+tree_decl_elt::eval (void)
+{
+  bool retval = false;
+
+  if (id && expr)
+    {
+      octave_lvalue ult = id->lvalue ();
+
+      octave_value init_val = expr->rvalue1 ();
+
+      if (! error_state)
+       {
+         ult.assign (octave_value::op_asn_eq, init_val);
+
+         retval = true;
+       }
+    }
+
+  return retval;
+}
+#endif
+
+void
+tree_evaluator::visit_decl_init_list (tree_decl_init_list&)
+{
+  panic_impossible ();
+}
+
+// Decide if it's time to quit a for or while loop.
+static inline bool
+quit_loop_now (void)
+{
+  octave_quit ();
+
+  // Maybe handle `continue N' someday...
+
+  if (tree_continue_command::continuing)
+    tree_continue_command::continuing--;
+
+  bool quit = (error_state
+               || tree_return_command::returning
+               || tree_break_command::breaking
+               || tree_continue_command::continuing);
+
+  if (tree_break_command::breaking)
+    tree_break_command::breaking--;
+
+  return quit;
+}
+
+void
+tree_evaluator::visit_simple_for_command (tree_simple_for_command& cmd)
+{
+  if (error_state)
+    return;
+
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint ());
+
+  // FIXME -- need to handle PARFOR loops here using cmd.in_parallel ()
+  // and cmd.maxproc_expr ();
+
+  unwind_protect frame;
+
+  frame.protect_var (in_loop_command);
+
+  in_loop_command = true;
+
+  tree_expression *expr = cmd.control_expr ();
+
+  octave_value rhs = expr->rvalue1 ();
+
+#if HAVE_LLVM
+  if (jiter.execute (cmd, rhs))
+    return;
+#endif
+
+  if (error_state || rhs.is_undefined ())
+    return;
+
+  {
+    tree_expression *lhs = cmd.left_hand_side ();
+
+    octave_lvalue ult = lhs->lvalue ();
+
+    if (error_state)
+      return;
+
+    tree_statement_list *loop_body = cmd.body ();
+
+    if (rhs.is_range ())
+      {
+        Range rng = rhs.range_value ();
+
+        octave_idx_type steps = rng.nelem ();
+        double b = rng.base ();
+        double increment = rng.inc ();
+
+        for (octave_idx_type i = 0; i < steps; i++)
+          {
+            // Use multiplication here rather than declaring a
+            // temporary variable outside the loop and using
+            //
+            //   tmp_val += increment
+            //
+            // to avoid problems with limited precision.  Also, this
+            // is consistent with the way Range::matrix_value is
+            // implemented.
+
+            octave_value val (b + i * increment);
+
+            ult.assign (octave_value::op_asn_eq, val);
+
+            if (! error_state && loop_body)
+              loop_body->accept (*this);
+
+            if (quit_loop_now ())
+              break;
+          }
+      }
+    else if (rhs.is_scalar_type ())
+      {
+        ult.assign (octave_value::op_asn_eq, rhs);
+
+        if (! error_state && loop_body)
+          loop_body->accept (*this);
+
+        // Maybe decrement break and continue states.
+        quit_loop_now ();
+      }
+    else if (rhs.is_matrix_type () || rhs.is_cell () || rhs.is_string ()
+             || rhs.is_map ())
+      {
+        // A matrix or cell is reshaped to 2 dimensions and iterated by
+        // columns.
+
+        dim_vector dv = rhs.dims ().redim (2);
+
+        octave_idx_type nrows = dv(0), steps = dv(1);
+
+        if (steps > 0)
+          {
+            octave_value arg = rhs;
+            if (rhs.ndims () > 2)
+              arg = arg.reshape (dv);
+
+            // for row vectors, use single index to speed things up.
+            octave_value_list idx;
+            octave_idx_type iidx;
+            if (nrows == 1)
+              {
+                idx.resize (1);
+                iidx = 0;
+              }
+            else
+              {
+                idx.resize (2);
+                idx(0) = octave_value::magic_colon_t;
+                iidx = 1;
+              }
+
+            for (octave_idx_type i = 1; i <= steps; i++)
+              {
+                // do_index_op expects one-based indices.
+                idx(iidx) = i;
+                octave_value val = arg.do_index_op (idx);
+
+                ult.assign (octave_value::op_asn_eq, val);
+
+                if (! error_state && loop_body)
+                  loop_body->accept (*this);
+
+                if (quit_loop_now ())
+                  break;
+              }
+          }
+      }
+    else
+      {
+        ::error ("invalid type in for loop expression near line %d, column %d",
+                 cmd.line (), cmd.column ());
+      }
+  }
+}
+
+void
+tree_evaluator::visit_complex_for_command (tree_complex_for_command& cmd)
+{
+  if (error_state)
+    return;
+
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint ());
+
+  unwind_protect frame;
+
+  frame.protect_var (in_loop_command);
+
+  in_loop_command = true;
+
+  tree_expression *expr = cmd.control_expr ();
+
+  octave_value rhs = expr->rvalue1 ();
+
+  if (error_state || rhs.is_undefined ())
+    return;
+
+  if (rhs.is_map ())
+    {
+      // Cycle through structure elements.  First element of id_list
+      // is set to value and the second is set to the name of the
+      // structure element.
+
+      tree_argument_list *lhs = cmd.left_hand_side ();
+
+      tree_argument_list::iterator p = lhs->begin ();
+
+      tree_expression *elt = *p++;
+
+      octave_lvalue val_ref = elt->lvalue ();
+
+      elt = *p;
+
+      octave_lvalue key_ref = elt->lvalue ();
+
+      const octave_map tmp_val = rhs.map_value ();
+
+      tree_statement_list *loop_body = cmd.body ();
+
+      string_vector keys = tmp_val.keys ();
+
+      octave_idx_type nel = keys.numel ();
+
+      for (octave_idx_type i = 0; i < nel; i++)
+        {
+          std::string key = keys[i];
+
+          const Cell val_lst = tmp_val.contents (key);
+
+          octave_idx_type n = val_lst.numel ();
+
+          octave_value val = (n == 1) ? val_lst(0) : octave_value (val_lst);
+
+          val_ref.assign (octave_value::op_asn_eq, val);
+          key_ref.assign (octave_value::op_asn_eq, key);
+
+          if (! error_state && loop_body)
+            loop_body->accept (*this);
+
+          if (quit_loop_now ())
+            break;
+        }
+    }
+  else
+    error ("in statement `for [X, Y] = VAL', VAL must be a structure");
+}
+
+void
+tree_evaluator::visit_octave_user_script (octave_user_script&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_octave_user_function (octave_user_function&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_octave_user_function_header (octave_user_function&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_octave_user_function_trailer (octave_user_function&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_function_def (tree_function_def& cmd)
+{
+  octave_value fcn = cmd.function ();
+
+  octave_function *f = fcn.function_value ();
+
+  if (f)
+    {
+      std::string nm = f->name ();
+
+      symbol_table::install_cmdline_function (nm, fcn);
+
+      // Make sure that any variable with the same name as the new
+      // function is cleared.
+
+      symbol_table::varref (nm) = octave_value ();
+    }
+}
+
+void
+tree_evaluator::visit_identifier (tree_identifier&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_if_clause (tree_if_clause&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_if_command (tree_if_command& cmd)
+{
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint ());
+
+  tree_if_command_list *lst = cmd.cmd_list ();
+
+  if (lst)
+    lst->accept (*this);
+}
+
+void
+tree_evaluator::visit_if_command_list (tree_if_command_list& lst)
+{
+  for (tree_if_command_list::iterator p = lst.begin (); p != lst.end (); p++)
+    {
+      tree_if_clause *tic = *p;
+
+      tree_expression *expr = tic->condition ();
+
+      if (debug_mode && ! tic->is_else_clause ())
+        do_breakpoint (tic->is_breakpoint ());
+
+      if (tic->is_else_clause () || expr->is_logically_true ("if"))
+        {
+          if (! error_state)
+            {
+              tree_statement_list *stmt_lst = tic->commands ();
+
+              if (stmt_lst)
+                stmt_lst->accept (*this);
+            }
+
+          break;
+        }
+    }
+}
+
+void
+tree_evaluator::visit_index_expression (tree_index_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_matrix (tree_matrix&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_cell (tree_cell&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_multi_assignment (tree_multi_assignment&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_no_op_command (tree_no_op_command& cmd)
+{
+  if (debug_mode && cmd.is_end_of_fcn_or_script ())
+    do_breakpoint (cmd.is_breakpoint (), true);
+}
+
+void
+tree_evaluator::visit_constant (tree_constant&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_fcn_handle (tree_fcn_handle&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_parameter_list (tree_parameter_list&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_postfix_expression (tree_postfix_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_prefix_expression (tree_prefix_expression&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_return_command (tree_return_command& cmd)
+{
+  if (! error_state)
+    {
+      if (debug_mode)
+        do_breakpoint (cmd.is_breakpoint ());
+
+      // Act like dbcont.
+
+      if (Vdebugging
+          && octave_call_stack::current_frame () == current_frame)
+        {
+          Vdebugging = false;
+
+          reset_debug_state ();
+        }
+      else if (statement_context == function || statement_context == script
+               || in_loop_command)
+        tree_return_command::returning = 1;
+    }
+}
+
+void
+tree_evaluator::visit_return_list (tree_return_list&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_simple_assignment (tree_simple_assignment&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_statement (tree_statement& stmt)
+{
+  tree_command *cmd = stmt.command ();
+  tree_expression *expr = stmt.expression ();
+
+  if (cmd || expr)
+    {
+      if (statement_context == function || statement_context == script)
+        {
+          // Skip commands issued at a debug> prompt to avoid disturbing
+          // the state of the program we are debugging.
+
+          if (! Vdebugging)
+            octave_call_stack::set_statement (&stmt);
+
+          // FIXME -- we need to distinguish functions from scripts to
+          // get this right.
+          if ((statement_context == script
+               && ((Vecho_executing_commands & ECHO_SCRIPTS)
+                   || (Vecho_executing_commands & ECHO_FUNCTIONS)))
+              || (statement_context == function
+                  && (Vecho_executing_commands & ECHO_FUNCTIONS)))
+            stmt.echo_code ();
+        }
+
+      try
+        {
+          if (cmd)
+            cmd->accept (*this);
+          else
+            {
+              if (debug_mode)
+                do_breakpoint (expr->is_breakpoint ());
+
+              if ((statement_context == function || statement_context == script)
+                  && Vsilent_functions)
+                expr->set_print_flag (false);
+
+              // FIXME -- maybe all of this should be packaged in
+              // one virtual function that returns a flag saying whether
+              // or not the expression will take care of binding ans and
+              // printing the result.
+
+              // FIXME -- it seems that we should just have to
+              // call expr->rvalue1 () and that should take care of
+              // everything, binding ans as necessary?
+
+              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 ());
+
+              octave_value tmp_result = expr->rvalue1 (0);
+
+              if (do_bind_ans && ! (error_state || tmp_result.is_undefined ()))
+                bind_ans (tmp_result, expr->print_result ());
+
+              //              if (tmp_result.is_defined ())
+              //                result_values(0) = tmp_result;
+            }
+        }
+      catch (octave_execution_exception)
+        {
+          gripe_library_execution_error ();
+        }
+    }
+}
+
+void
+tree_evaluator::visit_statement_list (tree_statement_list& lst)
+{
+  static octave_value_list empty_list;
+
+  if (error_state)
+    return;
+
+  tree_statement_list::iterator p = lst.begin ();
+
+  if (p != lst.end ())
+    {
+      while (true)
+        {
+          tree_statement *elt = *p++;
+
+          if (elt)
+            {
+              octave_quit ();
+
+              elt->accept (*this);
+
+              if (error_state)
+                break;
+
+              if (tree_break_command::breaking
+                  || tree_continue_command::continuing)
+                break;
+
+              if (tree_return_command::returning)
+                break;
+
+              if (p == lst.end ())
+                break;
+              else
+                {
+                  // Clear preivous values before next statement is
+                  // evaluated so that we aren't holding an extra
+                  // reference to a value that may be used next.  For
+                  // example, in code like this:
+                  //
+                  //   X = rand (N);  ## refcount for X should be 1
+                  //                  ## after this statement
+                  //
+                  //   X(idx) = val;  ## no extra copy of X should be
+                  //                  ## needed, but we will be faked
+                  //                  ## out if retval is not cleared
+                  //                  ## between statements here
+
+                  //              result_values = empty_list;
+                }
+            }
+          else
+            error ("invalid statement found in statement list!");
+        }
+    }
+}
+
+void
+tree_evaluator::visit_switch_case (tree_switch_case&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_switch_case_list (tree_switch_case_list&)
+{
+  panic_impossible ();
+}
+
+void
+tree_evaluator::visit_switch_command (tree_switch_command& cmd)
+{
+  if (debug_mode)
+    do_breakpoint (cmd.is_breakpoint ());
+
+  tree_expression *expr = cmd.switch_value ();
+
+  if (expr)
+    {
+      octave_value val = expr->rvalue1 ();
+
+      tree_switch_case_list *lst = cmd.case_list ();
+
+      if (! error_state && lst)
+        {
+          for (tree_switch_case_list::iterator p = lst->begin ();
+               p != lst->end (); p++)
+            {
+              tree_switch_case *t = *p;
+
+              if (debug_mode && ! t->is_default_case ())
+                do_breakpoint (t->is_breakpoint ());
+
+              if (t->is_default_case () || t->label_matches (val))
+                {
+                  if (error_state)
+                    break;
+
+                  tree_statement_list *stmt_lst = t->commands ();
+
+                  if (stmt_lst)
+                    stmt_lst->accept (*this);
+
+                  break;
+                }
+            }
+        }
+    }
+  else
+    ::error ("missing value in switch command near line %d, column %d",
+             cmd.line (), cmd.column ());
+}
+
+void
+tree_evaluator::visit_try_catch_command (tree_try_catch_command& cmd)
+{
+  unwind_protect frame;
+
+  frame.protect_var (buffer_error_messages);
+  frame.protect_var (Vdebug_on_error);
+  frame.protect_var (Vdebug_on_warning);
+
+  buffer_error_messages++;
+  Vdebug_on_error = false;
+  Vdebug_on_warning = false;
+
+  tree_statement_list *catch_code = cmd.cleanup ();
+
+  // The catch code is *not* added to unwind_protect stack; it doesn't need
+  // to be run on interrupts.
+
+  tree_statement_list *try_code = cmd.body ();
+
+  if (try_code)
+    {
+      try_code->accept (*this);
+      // FIXME: should std::bad_alloc be handled here?
+    }
+
+  if (error_state)
+    {
+      error_state = 0;
+
+      if (catch_code)
+        {
+          // Set up for letting the user print any messages from errors that
+          // occurred in the body of the try_catch statement.
+
+          buffer_error_messages--;
+
+          if (catch_code)
+            catch_code->accept (*this);
+        }
+    }
+}
+
+void
+tree_evaluator::do_unwind_protect_cleanup_code (tree_statement_list *list)
+{
+  unwind_protect frame;
+
+  frame.protect_var (octave_interrupt_state);
+  octave_interrupt_state = 0;
+
+  // We want to run the cleanup code without error_state being set,
+  // but we need to restore its value, so that any errors encountered
+  // in the first part of the unwind_protect are not completely
+  // ignored.
+
+  frame.protect_var (error_state);
+  error_state = 0;
+
+  // We want to preserve the last statement indicator for possible
+  // backtracking.
+  frame.add_fcn (octave_call_stack::set_statement,
+                 octave_call_stack::current_statement ());
+
+  // Similarly, if we have seen a return or break statement, allow all
+  // the cleanup code to run before returning or handling the break.
+  // We don't have to worry about continue statements because they can
+  // only occur in loops.
+
+  frame.protect_var (tree_return_command::returning);
+  tree_return_command::returning = 0;
+
+  frame.protect_var (tree_break_command::breaking);
+  tree_break_command::breaking = 0;
+
+  if (list)
+    list->accept (*this);
+
+  // The unwind_protects are popped off the stack in the reverse of
+  // the order they are pushed on.
+
+  // FIXME -- these statements say that if we see a break or
+  // return statement in the cleanup block, that we want to use the
+  // new value of the breaking or returning flag instead of restoring
+  // the previous value.  Is that the right thing to do?  I think so.
+  // Consider the case of
+  //
+  //   function foo ()
+  //     unwind_protect
+  //       stderr << "1: this should always be executed\n";
+  //       break;
+  //       stderr << "1: this should never be executed\n";
+  //     unwind_protect_cleanup
+  //       stderr << "2: this should always be executed\n";
+  //       return;
+  //       stderr << "2: this should never be executed\n";
+  //     end_unwind_protect
+  //   endfunction
+  //
+  // If we reset the value of the breaking flag, both the returning
+  // flag and the breaking flag will be set, and we shouldn't have
+  // both.  So, use the most recent one.  If there is no return or
+  // break in the cleanup block, the values should be reset to
+  // whatever they were when the cleanup block was entered.
+
+  if (tree_break_command::breaking || tree_return_command::returning)
+    {
+      frame.discard_top (2);
+    }
+  else
+    {
+      frame.run_top (2);
+    }
+
+  // We don't want to ignore errors that occur in the cleanup code, so
+  // if an error is encountered there, leave error_state alone.
+  // Otherwise, set it back to what it was before.
+
+  if (error_state)
+    frame.discard_top (2);
+  else
+    frame.run_top (2);
+
+  frame.run ();
+}
+
+void
+tree_evaluator::visit_unwind_protect_command (tree_unwind_protect_command& cmd)
+{
+  tree_statement_list *cleanup_code = cmd.cleanup ();
+
+  tree_statement_list *unwind_protect_code = cmd.body ();
+
+  if (unwind_protect_code)
+    {
+      try
+        {
+          unwind_protect_code->accept (*this);
+        }
+      catch (...)
+        {
+          // Run the cleanup code on exceptions, so that it is run even in case
+          // of interrupt or out-of-memory.
+          do_unwind_protect_cleanup_code (cleanup_code);
+          // FIXME: should error_state be checked here?
+          // We want to rethrow the exception, even if error_state is set, so
+          // that interrupts continue.
+          throw;
+        }
+
+      do_unwind_protect_cleanup_code (cleanup_code);
+    }
+}
+
+void
+tree_evaluator::visit_while_command (tree_while_command& cmd)
+{
+  if (error_state)
+    return;
+
+#if HAVE_LLVM
+  if (jiter.execute (cmd))
+    return;
+#endif
+
+  unwind_protect frame;
+
+  frame.protect_var (in_loop_command);
+
+  in_loop_command = true;
+
+  tree_expression *expr = cmd.condition ();
+
+  if (! expr)
+    panic_impossible ();
+
+  for (;;)
+    {
+      if (debug_mode)
+        do_breakpoint (cmd.is_breakpoint ());
+
+      if (expr->is_logically_true ("while"))
+        {
+          tree_statement_list *loop_body = cmd.body ();
+
+          if (loop_body)
+            {
+              loop_body->accept (*this);
+
+              if (error_state)
+                return;
+            }
+
+          if (quit_loop_now ())
+            break;
+        }
+      else
+        break;
+    }
+}
+
+void
+tree_evaluator::visit_do_until_command (tree_do_until_command& cmd)
+{
+  if (error_state)
+    return;
+
+  unwind_protect frame;
+
+  frame.protect_var (in_loop_command);
+
+  in_loop_command = true;
+
+  tree_expression *expr = cmd.condition ();
+
+  if (! expr)
+    panic_impossible ();
+
+  for (;;)
+    {
+      tree_statement_list *loop_body = cmd.body ();
+
+      if (loop_body)
+        {
+          loop_body->accept (*this);
+
+          if (error_state)
+            return;
+        }
+
+      if (quit_loop_now ())
+        break;
+
+      if (debug_mode)
+        do_breakpoint (cmd.is_breakpoint ());
+
+      if (expr->is_logically_true ("do-until"))
+        break;
+    }
+}
+
+void
+tree_evaluator::do_breakpoint (tree_statement& stmt) const
+{
+  do_breakpoint (stmt.is_breakpoint (), stmt.is_end_of_fcn_or_script ());
+}
+
+void
+tree_evaluator::do_breakpoint (bool is_breakpoint,
+                               bool is_end_of_fcn_or_script) const
+{
+  bool break_on_this_statement = false;
+
+  // Don't decrement break flag unless we are in the same frame as we
+  // were when we saw the "dbstep N" command.
+
+  if (dbstep_flag > 1)
+    {
+      if (octave_call_stack::current_frame () == current_frame)
+        {
+          // Don't allow dbstep N to step past end of current frame.
+
+          if (is_end_of_fcn_or_script)
+            dbstep_flag = 1;
+          else
+            dbstep_flag--;
+        }
+    }
+
+  if (octave_debug_on_interrupt_state)
+    {
+      break_on_this_statement = true;
+
+      octave_debug_on_interrupt_state = false;
+
+      current_frame = octave_call_stack::current_frame ();
+    }
+  else if (is_breakpoint)
+    {
+      break_on_this_statement = true;
+
+      dbstep_flag = 0;
+
+      current_frame = octave_call_stack::current_frame ();
+    }
+  else if (dbstep_flag == 1)
+    {
+      if (octave_call_stack::current_frame () == current_frame)
+        {
+          // We get here if we are doing a "dbstep" or a "dbstep N"
+          // and the count has reached 1 and we are in the current
+          // debugging frame.
+
+          break_on_this_statement = true;
+
+          dbstep_flag = 0;
+        }
+    }
+  else if (dbstep_flag == -1)
+    {
+      // We get here if we are doing a "dbstep in".
+
+      break_on_this_statement = true;
+
+      dbstep_flag = 0;
+
+      current_frame = octave_call_stack::current_frame ();
+    }
+  else if (dbstep_flag == -2)
+    {
+      // We get here if we are doing a "dbstep out".
+
+      if (is_end_of_fcn_or_script)
+        dbstep_flag = -1;
+    }
+
+  if (break_on_this_statement)
+    do_keyboard ();
+
+}
+
+// ARGS is currently unused, but since the do_keyboard function in
+// input.cc accepts an argument list, we preserve it here so that the
+// interface won't have to change if we decide to use it in the future.
+
+octave_value
+tree_evaluator::do_keyboard (const octave_value_list& args) const
+{
+  return ::do_keyboard (args);
+}
+
+DEFUN (max_recursion_depth, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} max_recursion_depth ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} max_recursion_depth (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} max_recursion_depth (@var{new_val}, \"local\")\n\
+Query or set the internal limit on the number of times a function may\n\
+be called recursively.  If the limit is exceeded, an error message is\n\
+printed and control returns to the top level.\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (max_recursion_depth);
+}
+
+/*
+%!test
+%! orig_val = max_recursion_depth ();
+%! old_val = max_recursion_depth (2*orig_val);
+%! assert (orig_val, old_val);
+%! assert (max_recursion_depth (), 2*orig_val);
+%! max_recursion_depth (orig_val);
+%! assert (max_recursion_depth (), orig_val);
+
+%!error (max_recursion_depth (1, 2))
+*/
+
+DEFUN (silent_functions, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} silent_functions ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} silent_functions (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} silent_functions (@var{new_val}, \"local\")\n\
+Query or set the internal variable that controls whether internal\n\
+output from a function is suppressed.  If this option is disabled,\n\
+Octave will display the results produced by evaluating expressions\n\
+within a function body that are not terminated with a semicolon.\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (silent_functions);
+}
+
+/*
+%!test
+%! orig_val = silent_functions ();
+%! old_val = silent_functions (! orig_val);
+%! assert (orig_val, old_val);
+%! assert (silent_functions (), ! orig_val);
+%! silent_functions (orig_val);
+%! assert (silent_functions (), orig_val);
+
+%!error (silent_functions (1, 2))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-eval.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,190 @@
+/*
+
+Copyright (C) 2009-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_eval_h)
+#define octave_tree_eval_h 1
+
+#include <stack>
+#include <string>
+
+#include "comment-list.h"
+#include "oct-obj.h"
+#include "pt-walk.h"
+
+class tree_expression;
+
+// How to evaluate the code that the parse trees represent.
+
+class
+OCTINTERP_API
+tree_evaluator : public tree_walker
+{
+public:
+
+  typedef void (*decl_elt_init_fcn) (tree_decl_elt&);
+
+  tree_evaluator (void) { }
+
+  ~tree_evaluator (void) { }
+
+  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 do_unwind_protect_cleanup_code (tree_statement_list *list);
+
+  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&);
+
+  static void reset_debug_state (void);
+
+  // If > 0, stop executing at the (N-1)th stopping point, counting
+  //         from the the current execution point in the current frame.
+  //
+  // If < 0, stop executing at the next possible stopping point.
+  static int dbstep_flag;
+
+  // The number of the stack frame we are currently debugging.
+  static size_t current_frame;
+
+  static bool debug_mode;
+
+  // Possible types of evaluation contexts.
+  enum stmt_list_type
+  {
+    function,  // function body
+    script,    // script file
+    other      // command-line input or eval string
+  };
+
+  // The context for the current evaluation.
+  static stmt_list_type statement_context;
+
+  // TRUE means we are evaluating some kind of looping construct.
+  static bool in_loop_command;
+
+private:
+
+  void do_decl_init_list (decl_elt_init_fcn fcn,
+                          tree_decl_init_list *init_list);
+
+  void do_breakpoint (tree_statement& stmt) const;
+
+  void do_breakpoint (bool is_breakpoint,
+                      bool is_end_of_fcn_or_script = false) const;
+
+  virtual octave_value
+  do_keyboard (const octave_value_list& args = octave_value_list ()) const;
+
+  // No copying!
+
+  tree_evaluator (const tree_evaluator&);
+
+  tree_evaluator& operator = (const tree_evaluator&);
+};
+
+extern tree_evaluator *current_evaluator;
+
+// Maximum nesting level for functions, scripts, or sourced files called
+// recursively.
+extern int Vmax_recursion_depth;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-except.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,100 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "quit.h"
+
+#include "error.h"
+#include "oct-lvalue.h"
+#include "ov.h"
+#include "pt-bp.h"
+#include "pt-cmd.h"
+#include "pt-except.h"
+#include "pt-exp.h"
+#include "pt-jump.h"
+#include "pt-stmt.h"
+#include "pt-walk.h"
+#include "unwind-prot.h"
+#include "variables.h"
+
+// Simple exception handling.
+
+tree_try_catch_command::~tree_try_catch_command (void)
+{
+  delete try_code;
+  delete catch_code;
+  delete lead_comm;
+  delete mid_comm;
+  delete trail_comm;
+}
+
+tree_command *
+tree_try_catch_command::dup (symbol_table::scope_id scope,
+                             symbol_table::context_id context) const
+{
+  return new
+    tree_try_catch_command (try_code ? try_code->dup (scope, context) : 0,
+                            catch_code ? catch_code->dup (scope, context) : 0,
+                            lead_comm ? lead_comm->dup () : 0,
+                            mid_comm ? mid_comm->dup () : 0,
+                            trail_comm ? trail_comm->dup () : 0,
+                            line (), column ());
+}
+
+void
+tree_try_catch_command::accept (tree_walker& tw)
+{
+  tw.visit_try_catch_command (*this);
+}
+
+// Simple exception handling.
+
+tree_unwind_protect_command::~tree_unwind_protect_command (void)
+{
+  delete unwind_protect_code;
+  delete cleanup_code;
+  delete lead_comm;
+  delete mid_comm;
+  delete trail_comm;
+}
+
+tree_command *
+tree_unwind_protect_command::dup (symbol_table::scope_id scope,
+                                  symbol_table::context_id context) const
+{
+  return new tree_unwind_protect_command
+    (unwind_protect_code ? unwind_protect_code->dup (scope, context) : 0,
+     cleanup_code ? cleanup_code->dup (scope, context) : 0,
+     lead_comm ? lead_comm->dup () : 0,
+     mid_comm ? mid_comm->dup () : 0,
+     trail_comm ? trail_comm->dup () : 0,
+     line (), column ());
+}
+
+void
+tree_unwind_protect_command::accept (tree_walker& tw)
+{
+  tw.visit_unwind_protect_command (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-except.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,156 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_except_h)
+#define octave_tree_except_h 1
+
+class tree_statement_list;
+
+class tree_walker;
+
+#include "comment-list.h"
+#include "pt-cmd.h"
+#include "symtab.h"
+
+// Simple exception handling.
+
+class
+tree_try_catch_command : public tree_command
+{
+public:
+
+  tree_try_catch_command (int l = -1, int c = -1)
+    : tree_command (l, c), try_code (0), catch_code (0), lead_comm (0),
+      mid_comm (0), trail_comm (0) { }
+
+  tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc,
+                          octave_comment_list *cl = 0,
+                          octave_comment_list *cm = 0,
+                          octave_comment_list *ct = 0,
+                          int l = -1, int c = -1)
+    : tree_command (l, c), try_code (tc), catch_code (cc),
+      lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
+
+  ~tree_try_catch_command (void);
+
+  tree_statement_list *body (void) { return try_code; }
+
+  tree_statement_list *cleanup (void) { return catch_code; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  octave_comment_list *middle_comment (void) { return mid_comm; }
+
+  octave_comment_list *trailing_comment (void) { return trail_comm; }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // The first block of code to attempt to execute.
+  tree_statement_list *try_code;
+
+  // The code to execute if an error occurs in the first block.
+  tree_statement_list *catch_code;
+
+  // Comment preceding TRY token.
+  octave_comment_list *lead_comm;
+
+  // Comment preceding CATCH token.
+  octave_comment_list *mid_comm;
+
+  // Comment preceding END_TRY_CATCH token.
+  octave_comment_list *trail_comm;
+
+  // No copying!
+
+  tree_try_catch_command (const tree_try_catch_command&);
+
+  tree_try_catch_command& operator = (const tree_try_catch_command&);
+};
+
+// Simple exception handling.
+
+class
+tree_unwind_protect_command : public tree_command
+{
+public:
+
+  tree_unwind_protect_command (int l = -1, int c = -1)
+    : tree_command (l, c), unwind_protect_code (0), cleanup_code (0),
+      lead_comm (0), mid_comm (0), trail_comm (0) { }
+
+  tree_unwind_protect_command (tree_statement_list *tc,
+                               tree_statement_list *cc,
+                               octave_comment_list *cl = 0,
+                               octave_comment_list *cm = 0,
+                               octave_comment_list *ct = 0,
+                               int l = -1, int c = -1)
+    : tree_command (l, c), unwind_protect_code (tc), cleanup_code (cc),
+      lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
+
+  ~tree_unwind_protect_command (void);
+
+  tree_statement_list *body (void) { return unwind_protect_code; }
+
+  tree_statement_list *cleanup (void) { return cleanup_code; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  octave_comment_list *middle_comment (void) { return mid_comm; }
+
+  octave_comment_list *trailing_comment (void) { return trail_comm; }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // The first body of code to attempt to execute.
+  tree_statement_list *unwind_protect_code;
+
+  // The body of code to execute no matter what happens in the first
+  // body of code.
+  tree_statement_list *cleanup_code;
+
+  // Comment preceding UNWIND_PROTECT token.
+  octave_comment_list *lead_comm;
+
+  // Comment preceding UNWIND_PROTECT_CLEANUP token.
+  octave_comment_list *mid_comm;
+
+  // Comment preceding END_UNWIND_PROTECT token.
+  octave_comment_list *trail_comm;
+
+  // No copying!
+
+  tree_unwind_protect_command (const tree_unwind_protect_command&);
+
+  tree_unwind_protect_command& operator = (const tree_unwind_protect_command&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-exp.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,88 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <string>
+
+#include "error.h"
+#include "pager.h"
+#include "oct-lvalue.h"
+#include "ov.h"
+#include "pt-exp.h"
+
+// Expressions.
+
+bool
+tree_expression::is_logically_true (const char *warn_for)
+{
+  bool expr_value = false;
+
+  octave_value t1 = rvalue1 ();
+
+  if (! error_state)
+    {
+      if (t1.is_defined ())
+        return t1.is_true ();
+      else
+        ::error ("%s: undefined value used in conditional expression",
+                 warn_for);
+    }
+
+  return expr_value;
+}
+
+octave_value
+tree_expression::rvalue1 (int)
+{
+  ::error ("invalid rvalue function called in expression");
+  return octave_value ();
+}
+
+octave_value_list
+tree_expression::rvalue (int)
+{
+  ::error ("invalid rvalue function called in expression");
+  return octave_value_list ();
+}
+
+octave_value_list
+tree_expression::rvalue (int nargout, const std::list<octave_lvalue> *)
+{
+  return rvalue (nargout);
+}
+
+octave_lvalue
+tree_expression::lvalue (void)
+{
+  ::error ("invalid lvalue function called in expression");
+  return octave_lvalue ();
+}
+
+std::string
+tree_expression::original_text (void) const
+{
+  return std::string ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-exp.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,151 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_expr_h)
+#define octave_tree_expr_h 1
+
+#include <string>
+#include <list>
+
+class octave_value;
+class octave_lvalue;
+
+#include "pt.h"
+#include "symtab.h"
+
+// A base class for expressions.
+
+class
+tree_expression : public tree
+{
+public:
+
+  tree_expression (int l = -1, int c = -1)
+    : tree (l, c), num_parens (0), postfix_indexed (false),
+      print_flag (false) { }
+
+  virtual ~tree_expression (void) { }
+
+  virtual bool has_magic_end (void) const = 0;
+
+  virtual tree_expression *dup (symbol_table::scope_id,
+                                symbol_table::context_id context) const = 0;
+
+  virtual bool is_constant (void) const { return false; }
+
+  virtual bool is_matrix_constant (void) const { return false; }
+
+  virtual bool is_identifier (void) const { return false; }
+
+  virtual bool is_index_expression (void) const { return false; }
+
+  virtual bool is_assignment_expression (void) const { return false; }
+
+  virtual bool is_prefix_expression (void) const { return false; }
+
+  virtual bool is_unary_expression (void) const { return false; }
+
+  virtual bool is_binary_expression (void) const { return false; }
+
+  virtual bool is_boolean_expression (void) const { return false; }
+
+  virtual bool is_logically_true (const char *);
+
+  virtual bool lvalue_ok (void) const { return false; }
+
+  virtual bool rvalue_ok (void) const { return false; }
+
+  virtual octave_value rvalue1 (int nargout = 1);
+
+  virtual octave_value_list rvalue (int nargout);
+
+  virtual octave_value_list rvalue (int nargout,
+                                    const std::list<octave_lvalue> *lvalue_list);
+
+  virtual octave_lvalue lvalue (void);
+
+  int paren_count (void) const { return num_parens; }
+
+  bool is_postfix_indexed (void) const { return postfix_indexed; }
+
+  bool print_result (void) const { return print_flag; }
+
+  virtual std::string oper (void) const { return "<unknown>"; }
+
+  virtual std::string name (void) const { return "<unknown>"; }
+
+  virtual std::string original_text (void) const;
+
+  virtual void mark_braindead_shortcircuit (const std::string&) { }
+
+  tree_expression *mark_in_parens (void)
+    {
+      num_parens++;
+      return this;
+    }
+
+  tree_expression *mark_postfix_indexed (void)
+    {
+      postfix_indexed = true;
+      return this;
+    }
+
+  tree_expression *set_print_flag (bool print)
+    {
+      print_flag = print;
+      return this;
+    }
+
+  virtual void copy_base (const tree_expression& e)
+    {
+      num_parens = e.num_parens;
+      postfix_indexed = e.postfix_indexed;
+      print_flag = e.print_flag;
+    }
+
+protected:
+
+  // A count of the number of times this expression appears directly
+  // inside a set of parentheses.
+  //
+  //   (((e1)) + e2)  ==> 2 for expression e1
+  //                  ==> 1 for expression ((e1)) + e2
+  //                  ==> 0 for expression e2
+  int num_parens;
+
+  // A flag that says whether this expression has an index associated
+  // with it.  See the code in tree_identifier::rvalue for the rationale.
+  bool postfix_indexed;
+
+  // Print result of rvalue for this expression?
+  bool print_flag;
+
+private:
+
+  // No copying!
+
+  tree_expression (const tree_expression&);
+
+  tree_expression& operator = (const tree_expression&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-fcn-handle.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,207 @@
+/*
+
+Copyright (C) 2003-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "error.h"
+#include "oct-obj.h"
+#include "ov-fcn-handle.h"
+#include "pt-fcn-handle.h"
+#include "pager.h"
+#include "pt-const.h"
+#include "pt-walk.h"
+#include "variables.h"
+
+void
+tree_fcn_handle::print (std::ostream& os, bool pr_as_read_syntax,
+                        bool pr_orig_text)
+{
+  print_raw (os, pr_as_read_syntax, pr_orig_text);
+}
+
+void
+tree_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax,
+                            bool pr_orig_text)
+{
+  os << ((pr_as_read_syntax || pr_orig_text) ? "@" : "") << nm;
+}
+
+octave_value
+tree_fcn_handle::rvalue1 (int)
+{
+  return make_fcn_handle (nm);
+}
+
+octave_value_list
+tree_fcn_handle::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("invalid number of output arguments for function handle expression");
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+tree_expression *
+tree_fcn_handle::dup (symbol_table::scope_id,
+                      symbol_table::context_id) const
+{
+  tree_fcn_handle *new_fh = new tree_fcn_handle (nm, line (), column ());
+
+  new_fh->copy_base (*this);
+
+  return new_fh;
+}
+
+void
+tree_fcn_handle::accept (tree_walker& tw)
+{
+  tw.visit_fcn_handle (*this);
+}
+
+octave_value
+tree_anon_fcn_handle::rvalue1 (int)
+{
+  // FIXME -- should CMD_LIST be limited to a single expression?
+  // I think that is what Matlab does.
+
+  tree_parameter_list *param_list = parameter_list ();
+  tree_parameter_list *ret_list = return_list ();
+  tree_statement_list *cmd_list = body ();
+  symbol_table::scope_id this_scope = scope ();
+
+  symbol_table::scope_id new_scope = symbol_table::dup_scope (this_scope);
+
+  if (new_scope > 0)
+    symbol_table::inherit (new_scope, symbol_table::current_scope (),
+                           symbol_table::current_context ());
+
+  octave_user_function *uf
+    = new octave_user_function (new_scope,
+                                param_list ? param_list->dup (new_scope, 0) : 0,
+                                ret_list ? ret_list->dup (new_scope, 0) : 0,
+                                cmd_list ? cmd_list->dup (new_scope, 0) : 0);
+
+  octave_function *curr_fcn = octave_call_stack::current ();
+
+  if (curr_fcn)
+    {
+      // FIXME -- maybe it would be better to just stash curr_fcn
+      // instead of individual bits of info about it?
+
+      uf->stash_parent_fcn_name (curr_fcn->name ());
+      uf->stash_dir_name (curr_fcn->dir_name ());
+
+      symbol_table::scope_id parent_scope = curr_fcn->parent_fcn_scope ();
+
+      if (parent_scope < 0)
+        parent_scope = curr_fcn->scope ();
+
+      uf->stash_parent_fcn_scope (parent_scope);
+
+      if (curr_fcn->is_class_method () || curr_fcn->is_class_constructor ())
+        uf->stash_dispatch_class (curr_fcn->dispatch_class ());
+    }
+
+  uf->mark_as_anonymous_function ();
+  uf->stash_fcn_file_name (file_name);
+  uf->stash_fcn_location (line (), column ());
+
+  octave_value ov_fcn (uf);
+
+  octave_value fh (octave_fcn_binder::maybe_binder (ov_fcn));
+
+  return fh;
+}
+
+/*
+%!function r = __f2 (f, x)
+%!  r = f (x);
+%!endfunction
+%!function f = __f1 (k)
+%!  f = @(x) __f2 (@(y) y-k, x);
+%!endfunction
+
+%!assert ((__f1 (3)) (10) == 7)
+
+%!test
+%! g = @(t) feval (@(x) t*x, 2);
+%! assert (g(0.5) == 1);
+
+%!test
+%! h = @(x) sin (x);
+%! g = @(f, x) h (x);
+%! f = @() g (@(x) h, pi);
+%! assert (f () == sin (pi));
+*/
+
+octave_value_list
+tree_anon_fcn_handle::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("invalid number of output arguments for anonymous function handle expression");
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+tree_expression *
+tree_anon_fcn_handle::dup (symbol_table::scope_id,
+                           symbol_table::context_id) const
+{
+  tree_parameter_list *param_list = parameter_list ();
+  tree_parameter_list *ret_list = return_list ();
+  tree_statement_list *cmd_list = body ();
+  symbol_table::scope_id this_scope = scope ();
+
+  symbol_table::scope_id new_scope = symbol_table::dup_scope (this_scope);
+
+  if (new_scope > 0)
+    symbol_table::inherit (new_scope, symbol_table::current_scope (),
+                           symbol_table::current_context ());
+
+  tree_anon_fcn_handle *new_afh = new
+    tree_anon_fcn_handle (param_list ? param_list->dup (new_scope, 0) : 0,
+                          ret_list ? ret_list->dup (new_scope, 0) : 0,
+                          cmd_list ? cmd_list->dup (new_scope, 0) : 0,
+                          new_scope, line (), column ());
+
+  new_afh->copy_base (*this);
+
+  return new_afh;
+}
+
+void
+tree_anon_fcn_handle::accept (tree_walker& tw)
+{
+  tw.visit_anon_fcn_handle (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-fcn-handle.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,156 @@
+/*
+
+Copyright (C) 2003-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_fcn_handle_h)
+#define octave_fcn_handle_h 1
+
+#include <iosfwd>
+#include <string>
+
+#include "pt-bp.h"
+#include "pt-exp.h"
+#include "pt-misc.h"
+#include "pt-stmt.h"
+#include "symtab.h"
+
+class octave_value_list;
+
+class tree_walker;
+
+#include "ov.h"
+#include "ov-usr-fcn.h"
+#include "symtab.h"
+
+class
+tree_fcn_handle : public tree_expression
+{
+public:
+
+  tree_fcn_handle (int l = -1, int c = -1)
+    : tree_expression (l, c), nm () { }
+
+  tree_fcn_handle (const std::string& n, int l = -1, int c = -1)
+    : tree_expression (l, c), nm (n) { }
+
+  ~tree_fcn_handle (void) { }
+
+  bool has_magic_end (void) const { return false; }
+
+  void print (std::ostream& os, bool pr_as_read_syntax = false,
+              bool pr_orig_txt = true);
+
+  void print_raw (std::ostream& os, bool pr_as_read_syntax = false,
+                  bool pr_orig_txt = true);
+
+  std::string name (void) const { return nm; }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // The name of this function handle.
+  std::string nm;
+
+  // No copying!
+
+  tree_fcn_handle (const tree_fcn_handle&);
+
+  tree_fcn_handle& operator = (const tree_fcn_handle&);
+};
+
+class
+tree_anon_fcn_handle : public tree_expression
+{
+public:
+
+  tree_anon_fcn_handle (int l = -1, int c = -1)
+    : tree_expression (l, c), fcn (0), file_name () { }
+
+  tree_anon_fcn_handle (tree_parameter_list *pl, tree_parameter_list *rl,
+                        tree_statement_list *cl, symbol_table::scope_id sid,
+                        int l = -1, int c = -1)
+    : tree_expression (l, c),
+      fcn (new octave_user_function (sid, pl, rl, cl)),
+      file_name () { }
+
+  ~tree_anon_fcn_handle (void) { delete fcn; }
+
+  bool has_magic_end (void) const { return false; }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  tree_parameter_list *parameter_list (void) const
+  {
+    return fcn ? fcn->parameter_list () : 0;
+  }
+
+  tree_parameter_list *return_list (void) const
+  {
+    return fcn ? fcn->return_list () : 0;
+  }
+
+  tree_statement_list *body (void) const
+  {
+    return fcn ? fcn->body () : 0;
+  }
+
+  symbol_table::scope_id scope (void) const
+  {
+    return fcn ? fcn->scope () : -1;
+  }
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  void stash_file_name (const std::string& file) { file_name = file; }
+
+private:
+
+  // The function.
+  octave_user_function *fcn;
+
+  // Filename where the handle was defined.
+  std::string file_name;
+
+  // No copying!
+
+  tree_anon_fcn_handle (const tree_anon_fcn_handle&);
+
+  tree_anon_fcn_handle& operator = (const tree_anon_fcn_handle&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-id.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,145 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "pager.h"
+#include "pt-bp.h"
+#include "pt-const.h"
+#include "pt-id.h"
+#include "pt-walk.h"
+#include "symtab.h"
+#include "utils.h"
+#include "variables.h"
+
+// Symbols from the symbol table.
+
+void
+tree_identifier::eval_undefined_error (void)
+{
+  int l = line ();
+  int c = column ();
+
+  maybe_missing_function_hook (name ());
+  if (error_state)
+    return;
+
+  if (l == -1 && c == -1)
+    ::error_with_id ("Octave:undefined-function",
+                     "`%s' undefined", name ().c_str ());
+  else
+    ::error_with_id ("Octave:undefined-function",
+                     "`%s' undefined near line %d column %d",
+                     name ().c_str (), l, c);
+}
+
+octave_value_list
+tree_identifier::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (error_state)
+    return retval;
+
+  octave_value val = sym->find ();
+
+  if (val.is_defined ())
+    {
+      // GAGME -- this would be cleaner if we required
+      // parens to indicate function calls.
+      //
+      // If this identifier refers to a function, we need to know
+      // whether it is indexed so that we can do the same thing
+      // for `f' and `f()'.  If the index is present, return the
+      // function object and let tree_index_expression::rvalue
+      // handle indexing.  Otherwise, arrange to call the function
+      // here, so that we don't return the function definition as
+      // a value.
+
+      if (val.is_function () && ! is_postfix_indexed ())
+        {
+          octave_value_list tmp_args;
+
+          retval = val.do_multi_index_op (nargout, tmp_args);
+        }
+      else
+        {
+          if (print_result () && nargout == 0)
+            val.print_with_name (octave_stdout, name ());
+
+          retval = val;
+        }
+    }
+  else
+    eval_undefined_error ();
+
+  return retval;
+}
+
+octave_value
+tree_identifier::rvalue1 (int nargout)
+{
+  octave_value retval;
+
+  octave_value_list tmp = rvalue (nargout);
+
+  if (! tmp.empty ())
+    retval = tmp(0);
+
+  return retval;
+}
+
+octave_lvalue
+tree_identifier::lvalue (void)
+{
+  return octave_lvalue (&(sym->varref ()));
+}
+
+tree_identifier *
+tree_identifier::dup (symbol_table::scope_id sc,
+                      symbol_table::context_id) const
+{
+  // The new tree_identifier object contains a symbol_record
+  // entry from the duplicated scope.
+
+  // FIXME -- is this the best way?
+  symbol_table::symbol_record new_sym
+    = symbol_table::find_symbol (name (), sc);
+
+  tree_identifier *new_id
+    = new tree_identifier (new_sym, line (), column ());
+
+  new_id->copy_base (*this);
+
+  return new_id;
+}
+
+void
+tree_identifier::accept (tree_walker& tw)
+{
+  tw.visit_identifier (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-id.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,155 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_identifier_h)
+#define octave_tree_identifier_h 1
+
+#include <iosfwd>
+#include <string>
+
+class octave_value;
+class octave_value_list;
+class octave_function;
+
+class tree_walker;
+
+#include "pt-bp.h"
+#include "pt-exp.h"
+#include "symtab.h"
+
+// Symbols from the symbol table.
+
+class
+tree_identifier : public tree_expression
+{
+  friend class tree_index_expression;
+
+public:
+
+  tree_identifier (int l = -1, int c = -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, sc) { }
+
+  ~tree_identifier (void) { }
+
+  bool has_magic_end (void) const { return (name () == "__end__"); }
+
+  bool is_identifier (void) const { return true; }
+
+  // The name doesn't change with scope, so use sym instead of
+  // accessing it through sym so that this function may remain const.
+  std::string name (void) const { return sym.name (); }
+
+  bool is_defined (void) { return sym->is_defined (); }
+
+  virtual bool is_variable (void) { return sym->is_variable (); }
+
+  virtual bool is_black_hole (void) { return false; }
+
+  // Try to find a definition for an identifier.  Here's how:
+  //
+  //   * If the identifier is already defined and is a function defined
+  //     in an function file that has been modified since the last time
+  //     we parsed it, parse it again.
+  //
+  //   * If the identifier is not defined, try to find a builtin
+  //     variable or an already compiled function with the same name.
+  //
+  //   * If the identifier is still undefined, try looking for an
+  //     function file to parse.
+  //
+  //   * On systems that support dynamic linking, we prefer .oct files,
+  //     then .mex files, then .m files.
+
+  octave_value
+  do_lookup (const octave_value_list& args = octave_value_list ())
+  {
+    return sym->find (args);
+  }
+
+  void mark_global (void) { sym->mark_global (); }
+
+  void mark_as_static (void) { sym->init_persistent (); }
+
+  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.
+
+  bool lvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  octave_lvalue lvalue (void);
+
+  void eval_undefined_error (void);
+
+  tree_identifier *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  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_reference sym;
+
+  // No copying!
+
+  tree_identifier (const tree_identifier&);
+
+  tree_identifier& operator = (const tree_identifier&);
+};
+
+class tree_black_hole : public tree_identifier
+{
+public:
+
+  tree_black_hole (int l = -1, int c = -1)
+    : tree_identifier (l, c) { }
+
+  std::string name (void) const { return "~"; }
+
+  bool is_variable (void) { return false; }
+
+  bool is_black_hole (void) { return true; }
+
+  tree_black_hole *dup (void) const
+    { return new tree_black_hole; }
+
+  octave_lvalue lvalue (void)
+    {
+      return octave_lvalue (0); // black hole lvalue
+    }
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-idx.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,687 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Cell.h"
+#include "error.h"
+#include "oct-map.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ov.h"
+#include "pager.h"
+#include "pt-arg-list.h"
+#include "pt-bp.h"
+#include "pt-id.h"
+#include "pt-idx.h"
+#include "pt-walk.h"
+#include "utils.h"
+#include "variables.h"
+#include "gripes.h"
+
+// Index expressions.
+
+tree_index_expression::tree_index_expression (int l, int c)
+  : tree_expression (l, c), expr (0), args (0), type (),
+    arg_nm (), dyn_field () { }
+
+tree_index_expression::tree_index_expression (tree_expression *e,
+                                              tree_argument_list *lst,
+                                              int l, int c, char t)
+  : tree_expression (l, c), expr (e), args (0), type (),
+    arg_nm (), dyn_field ()
+{
+  append (lst, t);
+}
+
+tree_index_expression::tree_index_expression (tree_expression *e,
+                                              const std::string& n,
+                                              int l, int c)
+  : tree_expression (l, c), expr (e), args (0), type (),
+    arg_nm (), dyn_field ()
+{
+  append (n);
+}
+
+tree_index_expression::tree_index_expression (tree_expression *e,
+                                              tree_expression *df,
+                                              int l, int c)
+  : tree_expression (l, c), expr (e), args (0), type (),
+    arg_nm (), dyn_field ()
+{
+  append (df);
+}
+
+void
+tree_index_expression::append (tree_argument_list *lst, char t)
+{
+  args.push_back (lst);
+  type.append (1, t);
+  arg_nm.push_back (lst ? lst->get_arg_names () : string_vector ());
+  dyn_field.push_back (static_cast<tree_expression *> (0));
+
+  if (lst && lst->has_magic_tilde ())
+    error ("invalid use of empty argument (~) in index expression");
+}
+
+void
+tree_index_expression::append (const std::string& n)
+{
+  args.push_back (static_cast<tree_argument_list *> (0));
+  type.append (".");
+  arg_nm.push_back (n);
+  dyn_field.push_back (static_cast<tree_expression *> (0));
+}
+
+void
+tree_index_expression::append (tree_expression *df)
+{
+  args.push_back (static_cast<tree_argument_list *> (0));
+  type.append (".");
+  arg_nm.push_back ("");
+  dyn_field.push_back (df);
+}
+
+tree_index_expression::~tree_index_expression (void)
+{
+  delete expr;
+
+  while (! args.empty ())
+    {
+      std::list<tree_argument_list *>::iterator p = args.begin ();
+      delete *p;
+      args.erase (p);
+    }
+
+  while (! dyn_field.empty ())
+    {
+      std::list<tree_expression *>::iterator p = dyn_field.begin ();
+      delete *p;
+      dyn_field.erase (p);
+    }
+}
+
+bool
+tree_index_expression::has_magic_end (void) const
+{
+  for (std::list<tree_argument_list *>::const_iterator p = args.begin ();
+       p != args.end ();
+       p++)
+    {
+      tree_argument_list *elt = *p;
+
+      if (elt && elt->has_magic_end ())
+        return true;
+    }
+
+  return false;
+}
+
+// This is useful for printing the name of the variable in an indexed
+// assignment.
+
+std::string
+tree_index_expression::name (void) const
+{
+  return expr->name ();
+}
+
+static Cell
+make_subs_cell (tree_argument_list *args, const string_vector& arg_nm)
+{
+  Cell retval;
+
+  octave_value_list arg_values;
+
+  if (args)
+    arg_values = args->convert_to_const_vector ();
+
+  if (! error_state)
+    {
+      int n = arg_values.length ();
+
+      if (n > 0)
+        {
+          arg_values.stash_name_tags (arg_nm);
+
+          retval.resize (dim_vector (1, n));
+
+          for (int i = 0; i < n; i++)
+            retval(0,i) = arg_values(i);
+        }
+    }
+
+  return retval;
+}
+
+static inline octave_value_list
+make_value_list (tree_argument_list *args, const string_vector& arg_nm,
+                 const octave_value *object, bool rvalue = true)
+{
+  octave_value_list retval;
+
+  if (args)
+    {
+      if (rvalue && object && args->has_magic_end () && object->is_undefined ())
+        gripe_invalid_inquiry_subscript ();
+      else
+        retval = args->convert_to_const_vector (object);
+    }
+
+  if (! error_state)
+    {
+      octave_idx_type n = retval.length ();
+
+      if (n > 0)
+        retval.stash_name_tags (arg_nm);
+    }
+
+  return retval;
+}
+
+std::string
+tree_index_expression::get_struct_index
+  (std::list<string_vector>::const_iterator p_arg_nm,
+   std::list<tree_expression *>::const_iterator p_dyn_field) const
+{
+  std::string fn = (*p_arg_nm)(0);
+
+  if (fn.empty ())
+    {
+      tree_expression *df = *p_dyn_field;
+
+      if (df)
+        {
+          octave_value t = df->rvalue1 ();
+
+          if (! error_state)
+            {
+              fn = t.string_value ();
+
+              if (! valid_identifier (fn))
+                ::error ("invalid structure field name `%s'", fn.c_str ());
+            }
+        }
+      else
+        panic_impossible ();
+    }
+
+  return fn;
+}
+
+octave_map
+tree_index_expression::make_arg_struct (void) const
+{
+  int n = args.size ();
+
+  Cell type_field (n, 1);
+  Cell subs_field (n, 1);
+
+  std::list<tree_argument_list *>::const_iterator p_args = args.begin ();
+  std::list<string_vector>::const_iterator p_arg_nm = arg_nm.begin ();
+  std::list<tree_expression *>::const_iterator p_dyn_field = dyn_field.begin ();
+
+  octave_map m;
+
+  for (int i = 0; i < n; i++)
+    {
+      switch (type[i])
+        {
+        case '(':
+          subs_field(i) = make_subs_cell (*p_args, *p_arg_nm);
+          break;
+
+        case '{':
+          subs_field(i) = make_subs_cell (*p_args, *p_arg_nm);
+          break;
+
+        case '.':
+          subs_field(i) = get_struct_index (p_arg_nm, p_dyn_field);
+          break;
+
+        default:
+          panic_impossible ();
+        }
+
+      if (error_state)
+        return m;
+
+      p_args++;
+      p_arg_nm++;
+      p_dyn_field++;
+    }
+
+  m.assign ("type", type_field);
+  m.assign ("subs", subs_field);
+
+  return m;
+}
+
+octave_value_list
+tree_index_expression::rvalue (int nargout)
+{
+  return tree_index_expression::rvalue (nargout, 0);
+}
+
+octave_value_list
+tree_index_expression::rvalue (int nargout, const std::list<octave_lvalue> *lvalue_list)
+{
+  octave_value_list retval;
+
+  if (error_state)
+    return retval;
+
+  octave_value first_expr_val;
+
+  octave_value_list first_args;
+
+  bool have_args = false;
+
+  if (expr->is_identifier () && type[0] == '(')
+    {
+      tree_identifier *id = dynamic_cast<tree_identifier *> (expr);
+
+      if (! (id->is_variable () || args.empty ()))
+        {
+          tree_argument_list *al = *(args.begin ());
+
+          size_t n = al ? al->length () : 0;
+
+          if (n > 0)
+            {
+              string_vector anm = *(arg_nm.begin ());
+              have_args = true;
+              first_args = al -> convert_to_const_vector ();
+              first_args.stash_name_tags (anm);
+
+              if (! error_state)
+                first_expr_val = id->do_lookup  (first_args);
+            }
+        }
+    }
+
+  if (! error_state)
+    {
+      if (first_expr_val.is_undefined ())
+        first_expr_val = expr->rvalue1 ();
+
+      octave_value tmp = first_expr_val;
+      octave_idx_type tmpi = 0;
+
+      std::list<octave_value_list> idx;
+
+      int n = args.size ();
+
+      std::list<tree_argument_list *>::iterator p_args = args.begin ();
+      std::list<string_vector>::iterator p_arg_nm = arg_nm.begin ();
+      std::list<tree_expression *>::iterator p_dyn_field = dyn_field.begin ();
+
+      for (int i = 0; i < n; i++)
+        {
+          if (i > 0)
+            {
+              tree_argument_list *al = *p_args;
+
+              // In Matlab, () can only be followed by . In Octave, we do not
+              // enforce this for rvalue expressions, but we'll split the
+              // evaluation at this point. This will, hopefully, allow Octave's
+              // looser rules apply smoothly for Matlab overloaded subsref
+              // codes.
+              bool force_split = type[i-1] == '(' && type[i] != '.';
+
+              if (force_split || (al && al->has_magic_end ()))
+                {
+                  // We have an expression like
+                  //
+                  //   x{end}.a(end)
+                  //
+                  // and we are looking at the argument list that
+                  // contains the second (or third, etc.) "end" token,
+                  // so we must evaluate everything up to the point of
+                  // that argument list so we can pass the appropriate
+                  // value to the built-in __end__ function.
+
+                  const octave_value_list tmp_list
+                    = tmp.subsref (type.substr (tmpi, i - tmpi), idx, nargout);
+
+                  tmp = tmp_list.length () ? tmp_list(0) : octave_value ();
+                  tmpi = i;
+                  idx.clear ();
+
+                  if (tmp.is_cs_list ())
+                    gripe_indexed_cs_list ();
+
+                  if (error_state)
+                    break;
+                }
+            }
+
+          switch (type[i])
+            {
+            case '(':
+              if (have_args)
+                {
+                  idx.push_back (first_args);
+                  have_args = false;
+                }
+              else
+                idx.push_back (make_value_list (*p_args, *p_arg_nm, &tmp));
+              break;
+
+            case '{':
+              idx.push_back (make_value_list (*p_args, *p_arg_nm, &tmp));
+              break;
+
+            case '.':
+              idx.push_back (octave_value (get_struct_index (p_arg_nm, p_dyn_field)));
+              break;
+
+            default:
+              panic_impossible ();
+            }
+
+          if (error_state)
+            break;
+
+          p_args++;
+          p_arg_nm++;
+          p_dyn_field++;
+        }
+
+      if (! error_state)
+        retval = tmp.subsref (type.substr (tmpi, n - tmpi), idx, nargout,
+                              lvalue_list);
+    }
+
+  return retval;
+}
+
+octave_value
+tree_index_expression::rvalue1 (int nargout)
+{
+  octave_value retval;
+
+  const octave_value_list tmp = rvalue (nargout);
+
+  if (! tmp.empty ())
+    retval = tmp(0);
+
+  return retval;
+}
+
+octave_lvalue
+tree_index_expression::lvalue (void)
+{
+  octave_lvalue retval;
+
+  std::list<octave_value_list> idx;
+  std::string tmp_type;
+
+  int n = args.size ();
+
+  std::list<tree_argument_list *>::iterator p_args = args.begin ();
+  std::list<string_vector>::iterator p_arg_nm = arg_nm.begin ();
+  std::list<tree_expression *>::iterator p_dyn_field = dyn_field.begin ();
+
+  retval = expr->lvalue ();
+
+  if (! error_state)
+    {
+      const octave_value *tro = retval.object ();
+
+      octave_value tmp;
+
+      if (tro)
+        tmp = *tro;
+
+      octave_idx_type tmpi = 0;
+      std::list<octave_value_list> tmpidx;
+
+      for (int i = 0; i < n; i++)
+        {
+          if (retval.numel () != 1)
+            gripe_indexed_cs_list ();
+          else if (tmpi < i)
+            {
+              tmp = tmp.subsref (type.substr (tmpi, i - tmpi), tmpidx, true);
+              tmpidx.clear ();
+            }
+
+          if (error_state)
+            break;
+
+          switch (type[i])
+            {
+            case '(':
+              {
+                octave_value_list tidx
+                  = make_value_list (*p_args, *p_arg_nm, &tmp, false);
+
+                idx.push_back (tidx);
+
+                if (i < n - 1)
+                  {
+                    if (type[i+1] == '.')
+                      {
+                        tmpidx.push_back (tidx);
+                        tmpi = i+1;
+                      }
+                    else
+                      error ("() must be followed by . or close the index chain");
+                  }
+              }
+              break;
+
+            case '{':
+              {
+                octave_value_list tidx
+                  = make_value_list (*p_args, *p_arg_nm, &tmp, false);
+
+                if (tmp.is_undefined ())
+                  {
+                    if (tidx.has_magic_colon ())
+                      gripe_invalid_inquiry_subscript ();
+                    else
+                      tmp = Cell ();
+                  }
+                else if (tmp.is_zero_by_zero ()
+                         && (tmp.is_matrix_type () || tmp.is_string ()))
+                  {
+                    tmp = Cell ();
+                  }
+
+                retval.numel (tmp.numel (tidx));
+
+                if (error_state)
+                  break;
+
+                idx.push_back (tidx);
+                tmpidx.push_back (tidx);
+                tmpi = i;
+              }
+              break;
+
+            case '.':
+              {
+                octave_value tidx = get_struct_index (p_arg_nm, p_dyn_field);
+                if (error_state)
+                  break;
+
+                bool autoconv = (tmp.is_zero_by_zero ()
+                                 && (tmp.is_matrix_type () || tmp.is_string ()
+                                     || tmp.is_cell ()));
+
+                if (i > 0 && type[i-1] == '(')
+                  {
+                    octave_value_list pidx = idx.back ();
+
+                    // Use octave_map, not octave_scalar_map so that the
+                    // dimensions are 0x0, not 1x1.
+                    if (tmp.is_undefined ())
+                      {
+                        if (pidx.has_magic_colon ())
+                          gripe_invalid_inquiry_subscript ();
+                        else
+                          tmp = octave_map ();
+                      }
+                    else if (autoconv)
+                      tmp = octave_map ();
+
+                    retval.numel (tmp.numel (pidx));
+
+                    tmpi = i-1;
+                    tmpidx.push_back (tidx);
+                  }
+                else
+                  {
+                    if (tmp.is_undefined () || autoconv)
+                      {
+                        tmpi = i+1;
+                        tmp = octave_value ();
+                      }
+                    else
+                      {
+                        retval.numel (tmp.numel (octave_value_list ()));
+
+                        tmpi = i;
+                        tmpidx.push_back (tidx);
+                      }
+                  }
+
+                if (error_state)
+                  break;
+
+                idx.push_back (tidx);
+              }
+              break;
+
+            default:
+              panic_impossible ();
+            }
+
+          if (idx.back ().empty ())
+            error ("invalid empty index list");
+
+          if (error_state)
+            break;
+
+          p_args++;
+          p_arg_nm++;
+          p_dyn_field++;
+        }
+
+      if (! error_state)
+        retval.set_index (type, idx);
+
+    }
+
+  return retval;
+}
+
+/*
+%!test
+%! clear x;
+%! clear y;
+%! y = 3;
+%! x(y(end)) = 1;
+%! assert (x, [0, 0, 1]);
+%! clear x;
+%! clear y;
+%! y = {3};
+%! x(y{end}) = 1;
+%! assert (x, [0, 0, 1]);
+
+%!test
+%! x = {1, 2, 3};
+%! [x{:}] = deal (4, 5, 6);
+%! assert (x, {4, 5, 6});
+
+%!test
+%! [x.a, x.b.c] = deal (1, 2);
+%! assert (x.a == 1 && x.b.c == 2);
+
+%!test
+%! [x.a, x(2).b] = deal (1, 2);
+%! assert (x(1).a == 1 && isempty (x(2).a) && isempty (x(1).b) && x(2).b == 2);
+
+%!test
+%! x = struct (zeros (0, 1), {"a", "b"});
+%! x(2).b = 1;
+%! assert (x(2).b == 1);
+
+%!test
+%! x = struct (zeros (0, 1), {"a", "b"});
+%! x(2).b = 1;
+%! assert (x(2).b == 1);
+*/
+
+tree_index_expression *
+tree_index_expression::dup (symbol_table::scope_id scope,
+                            symbol_table::context_id context) const
+{
+  tree_index_expression *new_idx_expr
+    = new tree_index_expression (line (), column ());
+
+  new_idx_expr->expr = expr ? expr->dup (scope, context) : 0;
+
+  std::list<tree_argument_list *> new_args;
+
+  for (std::list<tree_argument_list *>::const_iterator p = args.begin ();
+       p != args.end ();
+       p++)
+    {
+      const tree_argument_list *elt = *p;
+
+      new_args.push_back (elt ? elt->dup (scope, context) : 0);
+    }
+
+  new_idx_expr->args = new_args;
+
+  new_idx_expr->type = type;
+
+  new_idx_expr->arg_nm = arg_nm;
+
+  std::list<tree_expression *> new_dyn_field;
+
+  for (std::list<tree_expression *>::const_iterator p = dyn_field.begin ();
+       p != dyn_field.end ();
+       p++)
+    {
+      const tree_expression *elt = *p;
+
+      new_dyn_field.push_back (elt ? elt->dup (scope, context) : 0);
+    }
+
+  new_idx_expr->dyn_field = new_dyn_field;
+
+  new_idx_expr->copy_base (*this);
+
+  return new_idx_expr;
+}
+
+void
+tree_index_expression::accept (tree_walker& tw)
+{
+  tw.visit_index_expression (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-idx.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,131 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_index_h)
+#define octave_tree_index_h 1
+
+#include <list>
+
+class tree_argument_list;
+
+class tree_walker;
+
+class octave_map;
+class octave_value;
+class octave_value_list;
+class octave_lvalue;
+
+#include "str-vec.h"
+
+#include "pt-exp.h"
+#include "symtab.h"
+
+// Index expressions.
+
+class
+tree_index_expression : public tree_expression
+{
+public:
+
+  tree_index_expression (tree_expression *e = 0, tree_argument_list *lst = 0,
+                         int l = -1, int c = -1, char t = '(');
+
+  tree_index_expression (tree_expression *e, const std::string& n,
+                         int l = -1, int c = -1);
+
+  tree_index_expression (tree_expression *e, tree_expression* df,
+                         int l = -1, int c = -1);
+
+  ~tree_index_expression (void);
+
+  bool has_magic_end (void) const;
+
+  void append (tree_argument_list *lst = 0, char t = '(');
+
+  void append (const std::string& n);
+
+  void append (tree_expression *df);
+
+  bool is_index_expression (void) const { return true; }
+
+  std::string name (void) const;
+
+  tree_expression *expression (void) { return expr; }
+
+  std::list<tree_argument_list *> arg_lists (void) { return args; }
+
+  std::string type_tags (void) { return type; }
+
+  std::list<string_vector> arg_names (void) { return arg_nm; }
+
+  bool lvalue_ok (void) const { return expr->lvalue_ok (); }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  octave_value_list rvalue (int nargout, const std::list<octave_lvalue> *lvalue_list);
+
+  octave_lvalue lvalue (void);
+
+  tree_index_expression *dup (symbol_table::scope_id scope,
+                              symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // The LHS of this index expression.
+  tree_expression *expr;
+
+  // The indices (only valid if type == paren || type == brace).
+  std::list<tree_argument_list *> args;
+
+  // The type of this index expression.
+  std::string type;
+
+  // The names of the arguments.  Used for constant struct element
+  // references.
+  std::list<string_vector> arg_nm;
+
+  // The list of dynamic field names, if any.
+  std::list<tree_expression *> dyn_field;
+
+  tree_index_expression (int l, int c);
+
+  octave_map make_arg_struct (void) const;
+
+  std::string
+  get_struct_index
+    (std::list<string_vector>::const_iterator p_arg_nm,
+     std::list<tree_expression *>::const_iterator p_dyn_field) const;
+
+  // No copying!
+
+  tree_index_expression (const tree_index_expression&);
+
+  tree_index_expression& operator = (const tree_index_expression&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-jump.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,87 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "oct-obj.h"
+#include "pt-bp.h"
+#include "pt-jump.h"
+#include "pt-walk.h"
+
+class octave_value_list;
+
+// Break.
+
+// Nonzero means we're breaking out of a loop or function body.
+int tree_break_command::breaking = 0;
+
+tree_command *
+tree_break_command::dup (symbol_table::scope_id,
+                         symbol_table::context_id) const
+{
+  return new tree_break_command (line (), column ());
+}
+
+void
+tree_break_command::accept (tree_walker& tw)
+{
+  tw.visit_break_command (*this);
+}
+
+// Continue.
+
+// Nonzero means we're jumping to the end of a loop.
+int tree_continue_command::continuing = 0;
+
+tree_command *
+tree_continue_command::dup (symbol_table::scope_id,
+                            symbol_table::context_id) const
+{
+  return new tree_continue_command (line (), column ());
+}
+
+void
+tree_continue_command::accept (tree_walker& tw)
+{
+  tw.visit_continue_command (*this);
+}
+
+// Return.
+
+// Nonzero means we're returning from a function.
+int tree_return_command::returning = 0;
+
+tree_command *
+tree_return_command::dup (symbol_table::scope_id,
+                          symbol_table::context_id) const
+{
+  return new tree_return_command (line (), column ());
+}
+
+void
+tree_return_command::accept (tree_walker& tw)
+{
+  tw.visit_return_command (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-jump.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,115 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_jump_h)
+#define octave_tree_jump_h 1
+
+class tree_walker;
+
+#include "pt-cmd.h"
+#include "symtab.h"
+
+// Break.
+
+class
+tree_break_command : public tree_command
+{
+public:
+
+  tree_break_command (int l = -1, int c = -1)
+    : tree_command (l, c) { }
+
+  ~tree_break_command (void) { }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  static int breaking;
+
+private:
+
+  // No copying!
+
+  tree_break_command (const tree_break_command&);
+
+  tree_break_command& operator = (const tree_break_command&);
+};
+
+// Continue.
+
+class
+tree_continue_command : public tree_command
+{
+public:
+
+  tree_continue_command (int l = -1, int c = -1)
+    : tree_command (l, c) { }
+
+  ~tree_continue_command (void) { }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  static int continuing;
+
+private:
+
+  // No copying!
+
+  tree_continue_command (const tree_continue_command&);
+
+  tree_continue_command& operator = (const tree_continue_command&);
+};
+
+// Return.
+
+class
+tree_return_command : public tree_command
+{
+public:
+
+  tree_return_command (int l = -1, int c = -1)
+    : tree_command (l, c) { }
+
+  ~tree_return_command (void) { }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+  static int returning;
+
+private:
+
+  // No copying!
+
+  tree_return_command (const tree_return_command&);
+
+  tree_return_command& operator = (const tree_return_command&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-loop.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,153 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "quit.h"
+
+#include "error.h"
+#include "gripes.h"
+#include "oct-map.h"
+#include "oct-lvalue.h"
+#include "ov.h"
+#include "pt-arg-list.h"
+#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"
+#include "pt-walk.h"
+#include "unwind-prot.h"
+
+// While.
+
+tree_while_command::~tree_while_command (void)
+{
+  delete expr;
+  delete list;
+  delete lead_comm;
+  delete trail_comm;
+#ifdef HAVE_LLVM
+  delete compiled;
+#endif
+}
+
+tree_command *
+tree_while_command::dup (symbol_table::scope_id scope,
+                         symbol_table::context_id context) const
+{
+  return new tree_while_command (expr ? expr->dup (scope, context) : 0,
+                                 list ? list->dup (scope, context) : 0,
+                                 lead_comm ? lead_comm->dup () : 0,
+                                 trail_comm ? trail_comm->dup (): 0,
+                                 line (), column ());
+}
+
+void
+tree_while_command::accept (tree_walker& tw)
+{
+  tw.visit_while_command (*this);
+}
+
+// Do-Until
+
+tree_command *
+tree_do_until_command::dup (symbol_table::scope_id scope,
+                            symbol_table::context_id context) const
+{
+  return new tree_do_until_command (expr ? expr->dup (scope, context) : 0,
+                                    list ? list->dup (scope, context) : 0,
+                                    lead_comm ? lead_comm->dup () : 0,
+                                    trail_comm ? trail_comm->dup (): 0,
+                                    line (), column ());
+}
+
+void
+tree_do_until_command::accept (tree_walker& tw)
+{
+  tw.visit_do_until_command (*this);
+}
+
+// For.
+
+tree_simple_for_command::~tree_simple_for_command (void)
+{
+  delete lhs;
+  delete expr;
+  delete maxproc;
+  delete list;
+  delete lead_comm;
+  delete trail_comm;
+#ifdef HAVE_LLVM
+  delete compiled;
+#endif
+}
+
+tree_command *
+tree_simple_for_command::dup (symbol_table::scope_id scope,
+                              symbol_table::context_id context) const
+{
+  return new tree_simple_for_command
+    (parallel, lhs ? lhs->dup (scope, context) : 0,
+     expr ? expr->dup (scope, context) : 0,
+     maxproc ? maxproc->dup (scope, context) : 0,
+     list ? list->dup (scope, context) : 0,
+     lead_comm ? lead_comm->dup () : 0,
+     trail_comm ? trail_comm->dup () : 0, line (), column ());
+}
+
+void
+tree_simple_for_command::accept (tree_walker& tw)
+{
+  tw.visit_simple_for_command (*this);
+}
+
+tree_complex_for_command::~tree_complex_for_command (void)
+{
+  delete lhs;
+  delete expr;
+  delete list;
+  delete lead_comm;
+  delete trail_comm;
+}
+
+tree_command *
+tree_complex_for_command::dup (symbol_table::scope_id scope,
+                               symbol_table::context_id context) const
+{
+  return new tree_complex_for_command (lhs ? lhs->dup (scope, context) : 0,
+                                       expr ? expr->dup (scope, context) : 0,
+                                       list ? list->dup (scope, context) : 0,
+                                       lead_comm ? lead_comm->dup () : 0,
+                                       trail_comm ? trail_comm->dup () : 0,
+                                       line (), column ());
+}
+
+void
+tree_complex_for_command::accept (tree_walker& tw)
+{
+  tw.visit_complex_for_command (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-loop.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,328 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_loop_h)
+#define octave_tree_loop_h 1
+
+class octave_value;
+class octave_lvalue;
+
+class tree_argument_list;
+class tree_expression;
+class tree_statement_list;
+
+class tree_walker;
+
+#include "comment-list.h"
+#include "pt-cmd.h"
+#include "symtab.h"
+
+class jit_info;
+
+// While.
+
+class
+tree_while_command : public tree_command
+{
+public:
+
+  tree_while_command (int l = -1, int c = -1)
+    : tree_command (l, c), expr (0), list (0), lead_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)
+#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)
+#ifdef HAVE_LLVM
+    , compiled (0)
+#endif
+  { }
+
+  ~tree_while_command (void);
+
+  tree_expression *condition (void) { return expr; }
+
+  tree_statement_list *body (void) { return list; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  octave_comment_list *trailing_comment (void) { return trail_comm; }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  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.
+  tree_expression *expr;
+
+  // List of commands to execute.
+  tree_statement_list *list;
+
+  // Comment preceding WHILE token.
+  octave_comment_list *lead_comm;
+
+  // Comment preceding ENDWHILE token.
+  octave_comment_list *trail_comm;
+
+private:
+
+#ifdef HAVE_LLVM
+  // compiled version of the loop
+  jit_info *compiled;
+#endif
+
+  // No copying!
+
+  tree_while_command (const tree_while_command&);
+
+  tree_while_command& operator = (const tree_while_command&);
+};
+
+// Do-Until.
+
+class
+tree_do_until_command : public tree_while_command
+{
+public:
+
+  tree_do_until_command (int l = -1, int c = -1)
+    : tree_while_command (l, c) { }
+
+  tree_do_until_command (tree_expression *e,
+                         octave_comment_list *lc = 0,
+                         octave_comment_list *tc = 0,
+                         int l = -1, int c = -1)
+    : tree_while_command (e, lc, tc, l, c) { }
+
+  tree_do_until_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_while_command (e, lst, lc, tc, l, c) { }
+
+  ~tree_do_until_command (void) { }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_do_until_command (const tree_do_until_command&);
+
+  tree_do_until_command& operator = (const tree_do_until_command&);
+};
+
+// For.
+
+class
+tree_simple_for_command : public tree_command
+{
+public:
+
+  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)
+#ifdef HAVE_LLVM
+    , compiled (0)
+#endif
+  { }
+
+  tree_simple_for_command (bool parallel_arg, tree_expression *le,
+                           tree_expression *re,
+                           tree_expression *maxproc_arg,
+                           tree_statement_list *lst,
+                           octave_comment_list *lc = 0,
+                           octave_comment_list *tc = 0,
+                           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)
+#ifdef HAVE_LLVM
+    , compiled (0)
+#endif
+  { }
+
+  ~tree_simple_for_command (void);
+
+  bool in_parallel (void) { return parallel; }
+
+  tree_expression *left_hand_side (void) { return lhs; }
+
+  tree_expression *control_expr (void) { return expr; }
+
+  tree_expression *maxproc_expr (void) { return maxproc; }
+
+  tree_statement_list *body (void) { return list; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  octave_comment_list *trailing_comment (void) { return trail_comm; }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  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;
+
+  // Expression to modify.
+  tree_expression *lhs;
+
+  // Expression to evaluate.
+  tree_expression *expr;
+
+  // Expression to tell how many processors should be used (only valid
+  // if parallel is TRUE).
+  tree_expression *maxproc;
+
+  // List of commands to execute.
+  tree_statement_list *list;
+
+  // Comment preceding FOR token.
+  octave_comment_list *lead_comm;
+
+  // 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&);
+
+  tree_simple_for_command& operator = (const tree_simple_for_command&);
+};
+
+class
+tree_complex_for_command : public tree_command
+{
+public:
+
+  tree_complex_for_command (int l = -1, int c = -1)
+    : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0),
+      trail_comm (0) { }
+
+  tree_complex_for_command (tree_argument_list *le, tree_expression *re,
+                            tree_statement_list *lst,
+                            octave_comment_list *lc = 0,
+                            octave_comment_list *tc = 0,
+                            int l = -1, int c = -1)
+    : tree_command (l, c), lhs (le), expr (re), list (lst),
+      lead_comm (lc), trail_comm (tc) { }
+
+  ~tree_complex_for_command (void);
+
+  tree_argument_list *left_hand_side (void) { return lhs; }
+
+  tree_expression *control_expr (void) { return expr; }
+
+  tree_statement_list *body (void) { return list; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  octave_comment_list *trailing_comment (void) { return trail_comm; }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // Expression to modify.
+  tree_argument_list *lhs;
+
+  // Expression to evaluate.
+  tree_expression *expr;
+
+  // List of commands to execute.
+  tree_statement_list *list;
+
+  // Comment preceding FOR token.
+  octave_comment_list *lead_comm;
+
+  // Comment preceding ENDFOR token.
+  octave_comment_list *trail_comm;
+
+  // No copying!
+
+  tree_complex_for_command (const tree_complex_for_command&);
+
+  tree_complex_for_command& operator = (const tree_complex_for_command&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-mat.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1431 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+
+#include "quit.h"
+
+#include "data.h"
+#include "defun.h"
+#include "error.h"
+#include "oct-obj.h"
+#include "pt-arg-list.h"
+#include "pt-bp.h"
+#include "pt-exp.h"
+#include "pt-mat.h"
+#include "pt-walk.h"
+#include "utils.h"
+#include "ov.h"
+#include "variables.h"
+
+#include "ov-cx-mat.h"
+#include "ov-flt-cx-mat.h"
+#include "ov-re-sparse.h"
+#include "ov-cx-sparse.h"
+
+// The character to fill with when creating string arrays.
+char Vstring_fill_char = ' ';
+
+// General matrices.  This list type is much more work to handle than
+// constant matrices, but it allows us to construct matrices from
+// other matrices, variables, and functions.
+
+// But first, some internal classes that make our job much easier.
+
+class
+tm_row_const
+{
+private:
+
+  class
+  tm_row_const_rep : public octave_base_list<octave_value>
+  {
+  public:
+
+    tm_row_const_rep (void)
+      : count (1), dv (0, 0), all_str (false),
+        all_sq_str (false), all_dq_str (false),
+        some_str (false), all_real (false), all_cmplx (false),
+        all_mt (true), any_cell (false), any_sparse (false),
+        any_class (false), all_1x1 (false),
+        first_elem_is_struct (false), class_nm (), ok (false)
+    { }
+
+    tm_row_const_rep (const tree_argument_list& row)
+      : count (1), dv (0, 0), all_str (false), all_sq_str (false),
+        some_str (false), all_real (false), all_cmplx (false),
+        all_mt (true), any_cell (false), any_sparse (false),
+        any_class (false), all_1x1 (! row.empty ()),
+        first_elem_is_struct (false), class_nm (), ok (false)
+    { init (row); }
+
+    ~tm_row_const_rep (void) { }
+
+    octave_refcount<int> count;
+
+    dim_vector dv;
+
+    bool all_str;
+    bool all_sq_str;
+    bool all_dq_str;
+    bool some_str;
+    bool all_real;
+    bool all_cmplx;
+    bool all_mt;
+    bool any_cell;
+    bool any_sparse;
+    bool any_class;
+    bool all_1x1;
+    bool first_elem_is_struct;
+
+    std::string class_nm;
+
+    bool ok;
+
+    void do_init_element (const octave_value&, bool&);
+
+    void init (const tree_argument_list&);
+
+    void cellify (void);
+
+  private:
+
+    tm_row_const_rep (const tm_row_const_rep&);
+
+    tm_row_const_rep& operator = (const tm_row_const_rep&);
+
+  };
+
+public:
+
+  typedef tm_row_const_rep::iterator iterator;
+  typedef tm_row_const_rep::const_iterator const_iterator;
+
+  tm_row_const (void)
+    : rep (0) { }
+
+  tm_row_const (const tree_argument_list& row)
+    : rep (new tm_row_const_rep (row)) { }
+
+  tm_row_const (const tm_row_const& x)
+    : rep (x.rep)
+  {
+    if (rep)
+      rep->count++;
+  }
+
+  tm_row_const& operator = (const tm_row_const& x)
+  {
+    if (this != &x && rep != x.rep)
+      {
+        if (rep && --rep->count == 0)
+          delete rep;
+
+        rep = x.rep;
+
+        if (rep)
+          rep->count++;
+      }
+
+    return *this;
+  }
+
+  ~tm_row_const (void)
+  {
+    if (rep && --rep->count == 0)
+      delete rep;
+  }
+
+  octave_idx_type rows (void) { return rep->dv(0); }
+  octave_idx_type cols (void) { return rep->dv(1); }
+
+  bool empty (void) const { return rep->empty (); }
+
+  size_t length (void) const { return rep->length (); }
+
+  dim_vector dims (void) { return rep->dv; }
+
+  bool all_strings_p (void) const { return rep->all_str; }
+  bool all_sq_strings_p (void) const { return rep->all_sq_str; }
+  bool all_dq_strings_p (void) const { return rep->all_dq_str; }
+  bool some_strings_p (void) const { return rep->some_str; }
+  bool all_real_p (void) const { return rep->all_real; }
+  bool all_complex_p (void) const { return rep->all_cmplx; }
+  bool all_empty_p (void) const { return rep->all_mt; }
+  bool any_cell_p (void) const { return rep->any_cell; }
+  bool any_sparse_p (void) const { return rep->any_sparse; }
+  bool any_class_p (void) const { return rep->any_class; }
+  bool all_1x1_p (void) const { return rep->all_1x1; }
+  bool first_elem_struct_p (void) const { return rep->first_elem_is_struct; }
+
+  std::string class_name (void) const { return rep->class_nm; }
+
+  void cellify (void) { rep->cellify (); }
+
+  operator bool () const { return (rep && rep->ok); }
+
+  iterator begin (void) { return rep->begin (); }
+  const_iterator begin (void) const { return rep->begin (); }
+
+  iterator end (void) { return rep->end (); }
+  const_iterator end (void) const { return rep->end (); }
+
+private:
+
+  tm_row_const_rep *rep;
+};
+
+std::string
+get_concat_class (const std::string& c1, const std::string& c2)
+{
+  std::string retval = octave_base_value::static_class_name ();
+
+  if (c1 == c2)
+    retval = c1;
+  else if (c1.empty ())
+    retval = c2;
+  else if (c2.empty ())
+    retval = c1;
+  else if (c1 == "class" || c2 == "class")
+    retval = "class";
+  else
+    {
+      bool c1_is_int = (c1 == "int8" || c1 == "uint8"
+                        || c1 == "int16" || c1 == "uint16"
+                        || c1 == "int32" || c1 == "uint32"
+                        || c1 == "int64" || c1 == "uint64");
+      bool c2_is_int = (c2 == "int8" || c2 == "uint8"
+                        || c2 == "int16" || c2 == "uint16"
+                        || c2 == "int32" || c2 == "uint32"
+                        || c2 == "int64" || c2 == "uint64");
+
+      bool c1_is_char = (c1 == "char");
+      bool c2_is_char = (c2 == "char");
+
+      bool c1_is_double = (c1 == "double");
+      bool c2_is_double = (c2 == "double");
+
+      bool c1_is_single = (c1 == "single");
+      bool c2_is_single = (c2 == "single");
+
+      bool c1_is_logical = (c1 == "logical");
+      bool c2_is_logical = (c2 == "logical");
+
+      bool c1_is_built_in_type
+        = (c1_is_int || c1_is_char || c1_is_double || c1_is_single
+           || c1_is_logical);
+
+      bool c2_is_built_in_type
+        = (c2_is_int || c2_is_char ||  c2_is_double || c2_is_single
+           || c2_is_logical);
+
+      // Order is important here...
+
+      if (c1 == "struct" && c2 == c1)
+        retval = c1;
+      else if (c1 == "cell" || c2 == "cell")
+        retval = "cell";
+      else if (c1_is_char && c2_is_built_in_type)
+        retval = c1;
+      else if (c2_is_char && c1_is_built_in_type)
+        retval = c2;
+      else if (c1_is_int && c2_is_built_in_type)
+        retval = c1;
+      else if (c2_is_int && c1_is_built_in_type)
+        retval = c2;
+      else if (c1_is_single && c2_is_built_in_type)
+        retval = c1;
+      else if (c2_is_single && c1_is_built_in_type)
+        retval = c2;
+      else if (c1_is_double && c2_is_built_in_type)
+        retval = c1;
+      else if (c2_is_double && c1_is_built_in_type)
+        retval = c2;
+      else if (c1_is_logical && c2_is_logical)
+        retval = c1;
+    }
+
+  return retval;
+}
+
+static void
+eval_error (const char *msg, const dim_vector& x, const dim_vector& y)
+{
+  ::error ("%s (%s vs %s)", msg, x.str ().c_str (), y.str ().c_str ());
+}
+
+void
+tm_row_const::tm_row_const_rep::do_init_element (const octave_value& val,
+                                                 bool& first_elem)
+{
+  std::string this_elt_class_nm
+    = val.is_object () ? std::string ("class") : val.class_name ();
+
+  class_nm = get_concat_class (class_nm, this_elt_class_nm);
+
+  dim_vector this_elt_dv = val.dims ();
+
+  if (! this_elt_dv.zero_by_zero ())
+    {
+      all_mt = false;
+
+      if (first_elem)
+        {
+          if (val.is_map ())
+            first_elem_is_struct = true;
+
+          first_elem = false;
+        }
+    }
+
+  append (val);
+
+  if (all_str && ! val.is_string ())
+    all_str = false;
+
+  if (all_sq_str && ! val.is_sq_string ())
+    all_sq_str = false;
+
+  if (all_dq_str && ! val.is_dq_string ())
+    all_dq_str = false;
+
+  if (! some_str && val.is_string ())
+    some_str = true;
+
+  if (all_real && ! val.is_real_type ())
+    all_real = false;
+
+  if (all_cmplx && ! (val.is_complex_type () || val.is_real_type ()))
+    all_cmplx = false;
+
+  if (!any_cell && val.is_cell ())
+    any_cell = true;
+
+  if (!any_sparse && val.is_sparse_type ())
+    any_sparse = true;
+
+  if (!any_class && val.is_object ())
+    any_class = true;
+
+  all_1x1 = all_1x1 && val.numel () == 1;
+}
+
+void
+tm_row_const::tm_row_const_rep::init (const tree_argument_list& row)
+{
+  all_str = true;
+  all_sq_str = true;
+  all_dq_str = true;
+  all_real = true;
+  all_cmplx = true;
+  any_cell = false;
+  any_sparse = false;
+  any_class = false;
+
+  bool first_elem = true;
+
+  for (tree_argument_list::const_iterator p = row.begin ();
+       p != row.end ();
+       p++)
+    {
+      octave_quit ();
+
+      tree_expression *elt = *p;
+
+      octave_value tmp = elt->rvalue1 ();
+
+      if (error_state || tmp.is_undefined ())
+        {
+          ok = ! error_state;
+          return;
+        }
+      else
+        {
+          if (tmp.is_cs_list ())
+            {
+              octave_value_list tlst = tmp.list_value ();
+
+              for (octave_idx_type i = 0; i < tlst.length (); i++)
+                {
+                  octave_quit ();
+
+                  do_init_element (tlst(i), first_elem);
+                }
+            }
+          else
+            do_init_element (tmp, first_elem);
+        }
+    }
+
+  if (any_cell && ! any_class && ! first_elem_is_struct)
+    cellify ();
+
+  first_elem = true;
+
+  for (iterator p = begin (); p != end (); p++)
+    {
+      octave_quit ();
+
+      octave_value val = *p;
+
+      dim_vector this_elt_dv = val.dims ();
+
+      if (! this_elt_dv.zero_by_zero ())
+        {
+          all_mt = false;
+
+          if (first_elem)
+            {
+              first_elem = false;
+              dv = this_elt_dv;
+            }
+          else if (! dv.hvcat (this_elt_dv, 1))
+            {
+              eval_error ("horizontal dimensions mismatch", dv, this_elt_dv);
+              break;
+            }
+        }
+    }
+
+  ok = ! error_state;
+}
+
+void
+tm_row_const::tm_row_const_rep::cellify (void)
+{
+  bool elt_changed = false;
+
+  for (iterator p = begin (); p != end (); p++)
+    {
+      octave_quit ();
+
+      if (! p->is_cell ())
+        {
+          elt_changed = true;
+
+          *p = Cell (*p);
+        }
+    }
+
+  if (elt_changed)
+    {
+      bool first_elem = true;
+
+      for (iterator p = begin (); p != end (); p++)
+        {
+          octave_quit ();
+
+          octave_value val = *p;
+
+          dim_vector this_elt_dv = val.dims ();
+
+          if (! this_elt_dv.zero_by_zero ())
+            {
+              if (first_elem)
+                {
+                  first_elem = false;
+                  dv = this_elt_dv;
+                }
+              else if (! dv.hvcat (this_elt_dv, 1))
+                {
+                  eval_error ("horizontal dimensions mismatch", dv, this_elt_dv);
+                  break;
+                }
+            }
+        }
+    }
+}
+
+class
+tm_const : public octave_base_list<tm_row_const>
+{
+public:
+
+  tm_const (const tree_matrix& tm)
+    : dv (0, 0), all_str (false), all_sq_str (false), all_dq_str (false),
+      some_str (false), all_real (false), all_cmplx (false),
+      all_mt (true), any_cell (false), any_sparse (false),
+      any_class (false), class_nm (), ok (false)
+  { init (tm); }
+
+  ~tm_const (void) { }
+
+  octave_idx_type rows (void) const { return dv.elem (0); }
+  octave_idx_type cols (void) const { return dv.elem (1); }
+
+  dim_vector dims (void) const { return dv; }
+
+  bool all_strings_p (void) const { return all_str; }
+  bool all_sq_strings_p (void) const { return all_sq_str; }
+  bool all_dq_strings_p (void) const { return all_dq_str; }
+  bool some_strings_p (void) const { return some_str; }
+  bool all_real_p (void) const { return all_real; }
+  bool all_complex_p (void) const { return all_cmplx; }
+  bool all_empty_p (void) const { return all_mt; }
+  bool any_cell_p (void) const { return any_cell; }
+  bool any_sparse_p (void) const { return any_sparse; }
+  bool any_class_p (void) const { return any_class; }
+  bool all_1x1_p (void) const { return all_1x1; }
+
+  std::string class_name (void) const { return class_nm; }
+
+  operator bool () const { return ok; }
+
+private:
+
+  dim_vector dv;
+
+  bool all_str;
+  bool all_sq_str;
+  bool all_dq_str;
+  bool some_str;
+  bool all_real;
+  bool all_cmplx;
+  bool all_mt;
+  bool any_cell;
+  bool any_sparse;
+  bool any_class;
+  bool all_1x1;
+
+  std::string class_nm;
+
+  bool ok;
+
+  tm_const (void);
+
+  tm_const (const tm_const&);
+
+  tm_const& operator = (const tm_const&);
+
+  void init (const tree_matrix& tm);
+};
+
+void
+tm_const::init (const tree_matrix& tm)
+{
+  all_str = true;
+  all_sq_str = true;
+  all_dq_str = true;
+  all_real = true;
+  all_cmplx = true;
+  any_cell = false;
+  any_sparse = false;
+  any_class = false;
+  all_1x1 = ! tm.empty ();
+
+  bool first_elem = true;
+  bool first_elem_is_struct = false;
+
+  // Just eval and figure out if what we have is complex or all
+  // strings.  We can't check columns until we know that this is a
+  // numeric matrix -- collections of strings can have elements of
+  // different lengths.
+
+  for (tree_matrix::const_iterator p = tm.begin (); p != tm.end (); p++)
+    {
+      octave_quit ();
+
+      tree_argument_list *elt = *p;
+
+      tm_row_const tmp (*elt);
+
+      if (first_elem)
+        {
+          first_elem_is_struct = tmp.first_elem_struct_p ();
+
+          first_elem = false;
+        }
+
+      if (tmp && ! tmp.empty ())
+        {
+          if (all_str && ! tmp.all_strings_p ())
+            all_str = false;
+
+          if (all_sq_str && ! tmp.all_sq_strings_p ())
+            all_sq_str = false;
+
+          if (all_dq_str && ! tmp.all_dq_strings_p ())
+            all_dq_str = false;
+
+          if (! some_str && tmp.some_strings_p ())
+            some_str = true;
+
+          if (all_real && ! tmp.all_real_p ())
+            all_real = false;
+
+          if (all_cmplx && ! tmp.all_complex_p ())
+            all_cmplx = false;
+
+          if (all_mt && ! tmp.all_empty_p ())
+            all_mt = false;
+
+          if (!any_cell && tmp.any_cell_p ())
+            any_cell = true;
+
+          if (!any_sparse && tmp.any_sparse_p ())
+            any_sparse = true;
+
+          if (!any_class && tmp.any_class_p ())
+            any_class = true;
+
+          all_1x1 = all_1x1 && tmp.all_1x1_p ();
+
+          append (tmp);
+        }
+      else
+        break;
+    }
+
+  if (! error_state)
+    {
+      if (any_cell && ! any_class && ! first_elem_is_struct)
+        {
+          for (iterator q = begin (); q != end (); q++)
+            {
+              octave_quit ();
+
+              q->cellify ();
+            }
+        }
+
+      first_elem = true;
+
+      for (iterator q = begin (); q != end (); q++)
+        {
+          octave_quit ();
+
+          tm_row_const elt = *q;
+
+          octave_idx_type this_elt_nr = elt.rows ();
+          octave_idx_type this_elt_nc = elt.cols ();
+
+          std::string this_elt_class_nm = elt.class_name ();
+          class_nm = get_concat_class (class_nm, this_elt_class_nm);
+
+          dim_vector this_elt_dv = elt.dims ();
+
+          all_mt = false;
+
+          if (first_elem)
+            {
+              first_elem = false;
+
+              dv = this_elt_dv;
+            }
+          else if (all_str && dv.length () == 2
+                   && this_elt_dv.length () == 2)
+            {
+              // FIXME: this is Octave's specialty. Character matrices allow
+              // rows of unequal length.
+              if (this_elt_nc > cols ())
+                dv(1) = this_elt_nc;
+              dv(0) += this_elt_nr;
+            }
+          else if (! dv.hvcat (this_elt_dv, 0))
+            {
+              eval_error ("vertical dimensions mismatch", dv, this_elt_dv);
+              return;
+            }
+        }
+    }
+
+  ok = ! error_state;
+}
+
+tree_matrix::~tree_matrix (void)
+{
+  while (! empty ())
+    {
+      iterator p = begin ();
+      delete *p;
+      erase (p);
+    }
+}
+
+bool
+tree_matrix::has_magic_end (void) const
+{
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      octave_quit ();
+
+      tree_argument_list *elt = *p;
+
+      if (elt && elt->has_magic_end ())
+        return true;
+    }
+
+  return false;
+}
+
+bool
+tree_matrix::all_elements_are_constant (void) const
+{
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      octave_quit ();
+
+      tree_argument_list *elt = *p;
+
+      if (! elt->all_elements_are_constant ())
+        return false;
+    }
+
+  return true;
+}
+
+octave_value_list
+tree_matrix::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("invalid number of output arguments for matrix list");
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+void
+maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p)
+{
+  if (! (all_dq_strings_p || all_sq_strings_p))
+    warning_with_id ("Octave:mixed-string-concat",
+                     "concatenation of different character string types may have unintended consequences");
+}
+
+template<class TYPE, class T>
+static void
+single_type_concat (Array<T>& result,
+                    tm_const& tmp)
+{
+  octave_idx_type r = 0, c = 0;
+
+  for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
+    {
+      tm_row_const row = *p;
+      // Skip empty arrays to allow looser rules.
+      if (row.dims ().any_zero ())
+        continue;
+
+      for (tm_row_const::iterator q = row.begin ();
+           q != row.end ();
+           q++)
+        {
+          octave_quit ();
+
+          TYPE ra = octave_value_extract<TYPE> (*q);
+
+          // Skip empty arrays to allow looser rules.
+          if (! error_state)
+            {
+              if (! ra.is_empty ())
+                {
+                  result.insert (ra, r, c);
+
+                  if (! error_state)
+                    c += ra.columns ();
+                  else
+                    return;
+                }
+            }
+          else
+            return;
+        }
+
+      r += row.rows ();
+      c = 0;
+    }
+}
+
+template<class TYPE, class T>
+static void
+single_type_concat (Array<T>& result,
+                    const dim_vector& dv,
+                    tm_const& tmp)
+{
+  if (dv.any_zero ())
+    {
+      result = Array<T> (dv);
+      return;
+    }
+
+  if (tmp.length () == 1)
+    {
+      // If possible, forward the operation to liboctave.
+      // Single row.
+      tm_row_const& row = tmp.front ();
+      if (! (equal_types<T, char>::value || equal_types<T, octave_value>::value)
+          && row.all_1x1_p ())
+        {
+          // Optimize all scalars case.
+          result.clear (dv);
+          assert (static_cast<size_t> (result.numel ()) == row.length ());
+          octave_idx_type i = 0;
+          for (tm_row_const::iterator q = row.begin ();
+               q != row.end () && ! error_state; q++)
+             result(i++) = octave_value_extract<T> (*q);
+
+          return;
+        }
+
+      octave_idx_type ncols = row.length (), i = 0;
+      OCTAVE_LOCAL_BUFFER (Array<T>, array_list, ncols);
+
+      for (tm_row_const::iterator q = row.begin ();
+           q != row.end () && ! error_state;
+           q++)
+        {
+          octave_quit ();
+
+          array_list[i] = octave_value_extract<TYPE> (*q);
+          i++;
+        }
+
+      if (! error_state)
+        result = Array<T>::cat (-2, ncols, array_list);
+    }
+  else
+    {
+      result = Array<T> (dv);
+      single_type_concat<TYPE> (result, tmp);
+    }
+}
+
+template<class TYPE, class T>
+static void
+single_type_concat (Sparse<T>& result,
+                    const dim_vector& dv,
+                    tm_const& tmp)
+{
+  if (dv.any_zero ())
+    {
+      result = Sparse<T> (dv);
+      return;
+    }
+
+  // Sparse matrices require preallocation for efficient indexing; besides,
+  // only horizontal concatenation can be efficiently handled by indexing.
+  // So we just cat all rows through liboctave, then cat the final column.
+  octave_idx_type nrows = tmp.length (), j = 0;
+  OCTAVE_LOCAL_BUFFER (Sparse<T>, sparse_row_list, nrows);
+  for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
+    {
+      tm_row_const row = *p;
+      octave_idx_type ncols = row.length (), i = 0;
+      OCTAVE_LOCAL_BUFFER (Sparse<T>, sparse_list, ncols);
+
+      for (tm_row_const::iterator q = row.begin ();
+           q != row.end () && ! error_state;
+           q++)
+        {
+          octave_quit ();
+
+          sparse_list[i] = octave_value_extract<TYPE> (*q);
+          i++;
+        }
+
+      Sparse<T> stmp = Sparse<T>::cat (-2, ncols, sparse_list);
+      sparse_row_list[j] = stmp;
+      j++;
+    }
+
+  result = Sparse<T>::cat (-1, nrows, sparse_row_list);
+}
+
+template<class MAP>
+static void
+single_type_concat (octave_map& result,
+                    const dim_vector& dv,
+                    tm_const& tmp)
+{
+  if (dv.any_zero ())
+    {
+      result = octave_map (dv);
+      return;
+    }
+
+  octave_idx_type nrows = tmp.length (), j = 0;
+  OCTAVE_LOCAL_BUFFER (octave_map, map_row_list, nrows);
+  for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
+    {
+      tm_row_const row = *p;
+      octave_idx_type ncols = row.length (), i = 0;
+      OCTAVE_LOCAL_BUFFER (MAP, map_list, ncols);
+
+      for (tm_row_const::iterator q = row.begin ();
+           q != row.end () && ! error_state;
+           q++)
+        {
+          octave_quit ();
+
+          map_list[i] = octave_value_extract<MAP> (*q);
+          i++;
+        }
+
+      octave_map mtmp = octave_map::cat (-2, ncols, map_list);
+      map_row_list[j] = mtmp;
+      j++;
+    }
+
+  result = octave_map::cat (-1, nrows, map_row_list);
+}
+
+template<class TYPE>
+static octave_value
+do_single_type_concat (const dim_vector& dv,
+                       tm_const& tmp)
+{
+  TYPE result;
+
+  single_type_concat<TYPE> (result, dv, tmp);
+
+  return result;
+}
+
+template<>
+octave_value
+do_single_type_concat<octave_map> (const dim_vector& dv,
+                                   tm_const& tmp)
+{
+  octave_map result;
+
+  if (tmp.all_1x1_p ())
+    single_type_concat<octave_scalar_map> (result, dv, tmp);
+  else
+    single_type_concat<octave_map> (result, dv, tmp);
+
+  return result;
+}
+
+static octave_value
+do_class_concat (tm_const& tmc)
+{
+  octave_value retval;
+
+  octave_value_list rows (tmc.length (), octave_value ());
+
+  octave_idx_type j = 0;
+  for (tm_const::iterator p = tmc.begin (); p != tmc.end (); p++)
+    {
+      octave_quit ();
+
+      tm_row_const tmrc = *p;
+
+      if (tmrc.length () == 1)
+        rows(j++) = *(tmrc.begin ());
+      else
+        {
+          octave_value_list row (tmrc.length (), octave_value ());
+
+          octave_idx_type i = 0;
+          for (tm_row_const::iterator q = tmrc.begin (); q != tmrc.end (); q++)
+            row(i++) = *q;
+
+          rows(j++) = do_class_concat (row, "horzcat", 1);
+        }
+    }
+
+  if (! error_state)
+    {
+      if (rows.length () == 1)
+        retval = rows(0);
+      else
+        retval = do_class_concat (rows, "vertcat", 0);
+    }
+
+  return retval;
+}
+
+octave_value
+tree_matrix::rvalue1 (int)
+{
+  octave_value retval = Matrix ();
+
+  bool all_sq_strings_p = false;
+  bool all_dq_strings_p = false;
+  bool all_empty_p = false;
+  bool all_real_p = false;
+  bool any_sparse_p = false;
+  bool any_class_p = false;
+  bool frc_str_conv = false;
+
+  tm_const tmp (*this);
+
+  if (tmp && ! tmp.empty ())
+    {
+      dim_vector dv = tmp.dims ();
+      all_sq_strings_p = tmp.all_sq_strings_p ();
+      all_dq_strings_p = tmp.all_dq_strings_p ();
+      all_empty_p = tmp.all_empty_p ();
+      all_real_p = tmp.all_real_p ();
+      any_sparse_p = tmp.any_sparse_p ();
+      any_class_p = tmp.any_class_p ();
+      frc_str_conv = tmp.some_strings_p ();
+
+      // Try to speed up the common cases.
+
+      std::string result_type = tmp.class_name ();
+
+      if (any_class_p)
+        {
+          retval = do_class_concat (tmp);
+        }
+      else if (result_type == "double")
+        {
+          if (any_sparse_p)
+            {
+              if (all_real_p)
+                retval = do_single_type_concat<SparseMatrix> (dv, tmp);
+              else
+                retval = do_single_type_concat<SparseComplexMatrix> (dv, tmp);
+            }
+          else
+            {
+              if (all_real_p)
+                retval = do_single_type_concat<NDArray> (dv, tmp);
+              else
+                retval = do_single_type_concat<ComplexNDArray> (dv, tmp);
+            }
+        }
+      else if (result_type == "single")
+        {
+          if (all_real_p)
+            retval = do_single_type_concat<FloatNDArray> (dv, tmp);
+          else
+            retval = do_single_type_concat<FloatComplexNDArray> (dv, tmp);
+        }
+      else if (result_type == "char")
+        {
+          char type = all_dq_strings_p ? '"' : '\'';
+
+          maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p);
+
+          charNDArray result (dv, Vstring_fill_char);
+
+          single_type_concat<charNDArray> (result, tmp);
+
+          retval = octave_value (result, type);
+        }
+      else if (result_type == "logical")
+        {
+          if (any_sparse_p)
+            retval = do_single_type_concat<SparseBoolMatrix> (dv, tmp);
+          else
+            retval = do_single_type_concat<boolNDArray> (dv, tmp);
+        }
+      else if (result_type == "int8")
+        retval = do_single_type_concat<int8NDArray> (dv, tmp);
+      else if (result_type == "int16")
+        retval = do_single_type_concat<int16NDArray> (dv, tmp);
+      else if (result_type == "int32")
+        retval = do_single_type_concat<int32NDArray> (dv, tmp);
+      else if (result_type == "int64")
+        retval = do_single_type_concat<int64NDArray> (dv, tmp);
+      else if (result_type == "uint8")
+        retval = do_single_type_concat<uint8NDArray> (dv, tmp);
+      else if (result_type == "uint16")
+        retval = do_single_type_concat<uint16NDArray> (dv, tmp);
+      else if (result_type == "uint32")
+        retval = do_single_type_concat<uint32NDArray> (dv, tmp);
+      else if (result_type == "uint64")
+        retval = do_single_type_concat<uint64NDArray> (dv, tmp);
+      else if (result_type == "cell")
+        retval = do_single_type_concat<Cell> (dv, tmp);
+      else if (result_type == "struct")
+        retval = do_single_type_concat<octave_map> (dv, tmp);
+      else
+        {
+          // The line below might seem crazy, since we take a copy of
+          // the first argument, resize it to be empty and then resize
+          // it to be full. This is done since it means that there is
+          // no recopying of data, as would happen if we used a single
+          // resize.  It should be noted that resize operation is also
+          // significantly slower than the do_cat_op function, so it
+          // makes sense to have an empty matrix and copy all data.
+          //
+          // We might also start with a empty octave_value using
+          //
+          //    ctmp = octave_value_typeinfo::lookup_type
+          //          (tmp.begin() -> begin() -> type_name());
+          //
+          // and then directly resize. However, for some types there
+          // might be some additional setup needed, and so this should
+          // be avoided.
+
+          octave_value ctmp;
+
+          // Find the first non-empty object
+
+          if (any_sparse_p)
+            {
+              // Start with sparse matrix to avoid issues memory issues
+              // with things like [ones(1,4),sprandn(1e8,4,1e-4)]
+              if (all_real_p)
+                ctmp = octave_sparse_matrix ().resize (dv);
+              else
+                ctmp = octave_sparse_complex_matrix ().resize (dv);
+            }
+          else
+            {
+              for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
+                {
+                  octave_quit ();
+
+                  tm_row_const row = *p;
+
+                  for (tm_row_const::iterator q = row.begin ();
+                       q != row.end (); q++)
+                    {
+                      octave_quit ();
+
+                      ctmp = *q;
+
+                      if (! ctmp.all_zero_dims ())
+                        goto found_non_empty;
+                    }
+                }
+
+              ctmp = (*(tmp.begin () -> begin ()));
+
+            found_non_empty:
+
+              if (! all_empty_p)
+                ctmp = ctmp.resize (dim_vector (0,0)).resize (dv);
+            }
+
+          if (! error_state)
+            {
+              // Now, extract the values from the individual elements and
+              // insert them in the result matrix.
+
+              int dv_len = dv.length ();
+              octave_idx_type ntmp = dv_len > 1 ? dv_len : 2;
+              Array<octave_idx_type> ra_idx (dim_vector (ntmp, 1), 0);
+
+              for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
+                {
+                  octave_quit ();
+
+                  tm_row_const row = *p;
+
+                  for (tm_row_const::iterator q = row.begin ();
+                       q != row.end ();
+                       q++)
+                    {
+                      octave_quit ();
+
+                      octave_value elt = *q;
+
+                      if (elt.is_empty ())
+                        continue;
+
+                      ctmp = do_cat_op (ctmp, elt, ra_idx);
+
+                      if (error_state)
+                        goto done;
+
+                      ra_idx (1) += elt.columns ();
+                    }
+
+                  ra_idx (0) += row.rows ();
+                  ra_idx (1) = 0;
+                }
+
+              retval = ctmp;
+
+              if (frc_str_conv && ! retval.is_string ())
+                retval = retval.convert_to_str ();
+            }
+        }
+    }
+
+done:
+  return retval;
+}
+
+tree_expression *
+tree_matrix::dup (symbol_table::scope_id scope,
+                  symbol_table::context_id context) const
+{
+  tree_matrix *new_matrix = new tree_matrix (0, line (), column ());
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_argument_list *elt = *p;
+
+      new_matrix->append (elt ? elt->dup (scope, context) : 0);
+    }
+
+  new_matrix->copy_base (*this);
+
+  return new_matrix;
+}
+
+void
+tree_matrix::accept (tree_walker& tw)
+{
+  tw.visit_matrix (*this);
+}
+
+/*
+## test concatenation with all zero matrices
+%!assert ([ "" 65*ones(1,10) ], "AAAAAAAAAA");
+%!assert ([ 65*ones(1,10) "" ], "AAAAAAAAAA");
+
+%!test
+%! c = {"foo"; "bar"; "bazoloa"};
+%! assert ([c; "a"; "bc"; "def"], {"foo"; "bar"; "bazoloa"; "a"; "bc"; "def"});
+
+%!assert (class ([int64(1), int64(1)]), "int64")
+%!assert (class ([int64(1), int32(1)]), "int64")
+%!assert (class ([int64(1), int16(1)]), "int64")
+%!assert (class ([int64(1), int8(1)]), "int64")
+%!assert (class ([int64(1), uint64(1)]), "int64")
+%!assert (class ([int64(1), uint32(1)]), "int64")
+%!assert (class ([int64(1), uint16(1)]), "int64")
+%!assert (class ([int64(1), uint8(1)]), "int64")
+%!assert (class ([int64(1), single(1)]), "int64")
+%!assert (class ([int64(1), double(1)]), "int64")
+%!assert (class ([int64(1), cell(1)]), "cell")
+%!assert (class ([int64(1), true]), "int64")
+%!assert (class ([int64(1), "a"]), "char")
+
+%!assert (class ([int32(1), int64(1)]), "int32")
+%!assert (class ([int32(1), int32(1)]), "int32")
+%!assert (class ([int32(1), int16(1)]), "int32")
+%!assert (class ([int32(1), int8(1)]), "int32")
+%!assert (class ([int32(1), uint64(1)]), "int32")
+%!assert (class ([int32(1), uint32(1)]), "int32")
+%!assert (class ([int32(1), uint16(1)]), "int32")
+%!assert (class ([int32(1), uint8(1)]), "int32")
+%!assert (class ([int32(1), single(1)]), "int32")
+%!assert (class ([int32(1), double(1)]), "int32")
+%!assert (class ([int32(1), cell(1)]), "cell")
+%!assert (class ([int32(1), true]), "int32")
+%!assert (class ([int32(1), "a"]), "char")
+
+%!assert (class ([int16(1), int64(1)]), "int16")
+%!assert (class ([int16(1), int32(1)]), "int16")
+%!assert (class ([int16(1), int16(1)]), "int16")
+%!assert (class ([int16(1), int8(1)]), "int16")
+%!assert (class ([int16(1), uint64(1)]), "int16")
+%!assert (class ([int16(1), uint32(1)]), "int16")
+%!assert (class ([int16(1), uint16(1)]), "int16")
+%!assert (class ([int16(1), uint8(1)]), "int16")
+%!assert (class ([int16(1), single(1)]), "int16")
+%!assert (class ([int16(1), double(1)]), "int16")
+%!assert (class ([int16(1), cell(1)]), "cell")
+%!assert (class ([int16(1), true]), "int16")
+%!assert (class ([int16(1), "a"]), "char")
+
+%!assert (class ([int8(1), int64(1)]), "int8")
+%!assert (class ([int8(1), int32(1)]), "int8")
+%!assert (class ([int8(1), int16(1)]), "int8")
+%!assert (class ([int8(1), int8(1)]), "int8")
+%!assert (class ([int8(1), uint64(1)]), "int8")
+%!assert (class ([int8(1), uint32(1)]), "int8")
+%!assert (class ([int8(1), uint16(1)]), "int8")
+%!assert (class ([int8(1), uint8(1)]), "int8")
+%!assert (class ([int8(1), single(1)]), "int8")
+%!assert (class ([int8(1), double(1)]), "int8")
+%!assert (class ([int8(1), cell(1)]), "cell")
+%!assert (class ([int8(1), true]), "int8")
+%!assert (class ([int8(1), "a"]), "char")
+
+%!assert (class ([uint64(1), int64(1)]), "uint64")
+%!assert (class ([uint64(1), int32(1)]), "uint64")
+%!assert (class ([uint64(1), int16(1)]), "uint64")
+%!assert (class ([uint64(1), int8(1)]), "uint64")
+%!assert (class ([uint64(1), uint64(1)]), "uint64")
+%!assert (class ([uint64(1), uint32(1)]), "uint64")
+%!assert (class ([uint64(1), uint16(1)]), "uint64")
+%!assert (class ([uint64(1), uint8(1)]), "uint64")
+%!assert (class ([uint64(1), single(1)]), "uint64")
+%!assert (class ([uint64(1), double(1)]), "uint64")
+%!assert (class ([uint64(1), cell(1)]), "cell")
+%!assert (class ([uint64(1), true]), "uint64")
+%!assert (class ([uint64(1), "a"]), "char")
+
+%!assert (class ([uint32(1), int64(1)]), "uint32")
+%!assert (class ([uint32(1), int32(1)]), "uint32")
+%!assert (class ([uint32(1), int16(1)]), "uint32")
+%!assert (class ([uint32(1), int8(1)]), "uint32")
+%!assert (class ([uint32(1), uint64(1)]), "uint32")
+%!assert (class ([uint32(1), uint32(1)]), "uint32")
+%!assert (class ([uint32(1), uint16(1)]), "uint32")
+%!assert (class ([uint32(1), uint8(1)]), "uint32")
+%!assert (class ([uint32(1), single(1)]), "uint32")
+%!assert (class ([uint32(1), double(1)]), "uint32")
+%!assert (class ([uint32(1), cell(1)]), "cell")
+%!assert (class ([uint32(1), true]), "uint32")
+%!assert (class ([uint32(1), "a"]), "char")
+
+%!assert (class ([uint16(1), int64(1)]), "uint16")
+%!assert (class ([uint16(1), int32(1)]), "uint16")
+%!assert (class ([uint16(1), int16(1)]), "uint16")
+%!assert (class ([uint16(1), int8(1)]), "uint16")
+%!assert (class ([uint16(1), uint64(1)]), "uint16")
+%!assert (class ([uint16(1), uint32(1)]), "uint16")
+%!assert (class ([uint16(1), uint16(1)]), "uint16")
+%!assert (class ([uint16(1), uint8(1)]), "uint16")
+%!assert (class ([uint16(1), single(1)]), "uint16")
+%!assert (class ([uint16(1), double(1)]), "uint16")
+%!assert (class ([uint16(1), cell(1)]), "cell")
+%!assert (class ([uint16(1), true]), "uint16")
+%!assert (class ([uint16(1), "a"]), "char")
+
+%!assert (class ([uint8(1), int64(1)]), "uint8")
+%!assert (class ([uint8(1), int32(1)]), "uint8")
+%!assert (class ([uint8(1), int16(1)]), "uint8")
+%!assert (class ([uint8(1), int8(1)]), "uint8")
+%!assert (class ([uint8(1), uint64(1)]), "uint8")
+%!assert (class ([uint8(1), uint32(1)]), "uint8")
+%!assert (class ([uint8(1), uint16(1)]), "uint8")
+%!assert (class ([uint8(1), uint8(1)]), "uint8")
+%!assert (class ([uint8(1), single(1)]), "uint8")
+%!assert (class ([uint8(1), double(1)]), "uint8")
+%!assert (class ([uint8(1), cell(1)]), "cell")
+%!assert (class ([uint8(1), true]), "uint8")
+%!assert (class ([uint8(1), "a"]), "char")
+
+%!assert (class ([single(1), int64(1)]), "int64")
+%!assert (class ([single(1), int32(1)]), "int32")
+%!assert (class ([single(1), int16(1)]), "int16")
+%!assert (class ([single(1), int8(1)]), "int8")
+%!assert (class ([single(1), uint64(1)]), "uint64")
+%!assert (class ([single(1), uint32(1)]), "uint32")
+%!assert (class ([single(1), uint16(1)]), "uint16")
+%!assert (class ([single(1), uint8(1)]), "uint8")
+%!assert (class ([single(1), single(1)]), "single")
+%!assert (class ([single(1), double(1)]), "single")
+%!assert (class ([single(1), cell(1)]), "cell")
+%!assert (class ([single(1), true]), "single")
+%!assert (class ([single(1), "a"]), "char")
+
+%!assert (class ([double(1), int64(1)]), "int64")
+%!assert (class ([double(1), int32(1)]), "int32")
+%!assert (class ([double(1), int16(1)]), "int16")
+%!assert (class ([double(1), int8(1)]), "int8")
+%!assert (class ([double(1), uint64(1)]), "uint64")
+%!assert (class ([double(1), uint32(1)]), "uint32")
+%!assert (class ([double(1), uint16(1)]), "uint16")
+%!assert (class ([double(1), uint8(1)]), "uint8")
+%!assert (class ([double(1), single(1)]), "single")
+%!assert (class ([double(1), double(1)]), "double")
+%!assert (class ([double(1), cell(1)]), "cell")
+%!assert (class ([double(1), true]), "double")
+%!assert (class ([double(1), "a"]), "char")
+
+%!assert (class ([cell(1), int64(1)]), "cell")
+%!assert (class ([cell(1), int32(1)]), "cell")
+%!assert (class ([cell(1), int16(1)]), "cell")
+%!assert (class ([cell(1), int8(1)]), "cell")
+%!assert (class ([cell(1), uint64(1)]), "cell")
+%!assert (class ([cell(1), uint32(1)]), "cell")
+%!assert (class ([cell(1), uint16(1)]), "cell")
+%!assert (class ([cell(1), uint8(1)]), "cell")
+%!assert (class ([cell(1), single(1)]), "cell")
+%!assert (class ([cell(1), double(1)]), "cell")
+%!assert (class ([cell(1), cell(1)]), "cell")
+%!assert (class ([cell(1), true]), "cell")
+%!assert (class ([cell(1), "a"]), "cell")
+
+%!assert (class ([true, int64(1)]), "int64")
+%!assert (class ([true, int32(1)]), "int32")
+%!assert (class ([true, int16(1)]), "int16")
+%!assert (class ([true, int8(1)]), "int8")
+%!assert (class ([true, uint64(1)]), "uint64")
+%!assert (class ([true, uint32(1)]), "uint32")
+%!assert (class ([true, uint16(1)]), "uint16")
+%!assert (class ([true, uint8(1)]), "uint8")
+%!assert (class ([true, single(1)]), "single")
+%!assert (class ([true, double(1)]), "double")
+%!assert (class ([true, cell(1)]), "cell")
+%!assert (class ([true, true]), "logical")
+%!assert (class ([true, "a"]), "char")
+
+%!assert (class (["a", int64(1)]), "char")
+%!assert (class (["a", int32(1)]), "char")
+%!assert (class (["a", int16(1)]), "char")
+%!assert (class (["a", int8(1)]), "char")
+%!assert (class (["a", int64(1)]), "char")
+%!assert (class (["a", int32(1)]), "char")
+%!assert (class (["a", int16(1)]), "char")
+%!assert (class (["a", int8(1)]), "char")
+%!assert (class (["a", single(1)]), "char")
+%!assert (class (["a", double(1)]), "char")
+%!assert (class (["a", cell(1)]), "cell")
+%!assert (class (["a", true]), "char")
+%!assert (class (["a", "a"]), "char")
+
+%!assert (class ([cell(1), struct("foo", "bar")]), "cell")
+%!error [struct("foo", "bar"), cell(1)]
+*/
+
+DEFUN (string_fill_char, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} string_fill_char ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} string_fill_char (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} string_fill_char (@var{new_val}, \"local\")\n\
+Query or set the internal variable used to pad all rows of a character\n\
+matrix to the same length.  It must be a single character.  The default\n\
+value is @code{\" \"} (a single space).  For example:\n\
+\n\
+@example\n\
+@group\n\
+string_fill_char (\"X\");\n\
+[ \"these\"; \"are\"; \"strings\" ]\n\
+      @result{}  \"theseXX\"\n\
+          \"areXXXX\"\n\
+          \"strings\"\n\
+@end group\n\
+@end example\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\
+variable value is restored when exiting the function.\n\
+@end deftypefn")
+{
+  return SET_INTERNAL_VARIABLE (string_fill_char);
+}
+
+/*
+## string_fill_char() function call must be outside of %!test block
+## due to the way a %!test block is wrapped inside a function
+%!shared orig_val, old_val
+%! orig_val = string_fill_char ();
+%! old_val  = string_fill_char ("X");
+%!test
+%! assert (orig_val, old_val);
+%! assert (string_fill_char (), "X");
+%! assert (["these"; "are"; "strings"], ["theseXX"; "areXXXX"; "strings"]);
+%! string_fill_char (orig_val);
+%! assert (string_fill_char (), orig_val);
+
+%!error (string_fill_char (1, 2))
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-mat.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,95 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_mat_h)
+#define octave_tree_mat_h 1
+
+#include <iosfwd>
+
+class octave_value;
+class octave_value_list;
+class tree_argument_list;
+
+class tree_walker;
+
+#include "base-list.h"
+#include "pt-exp.h"
+#include "symtab.h"
+
+// General matrices.  This allows us to construct matrices from
+// other matrices, variables, and functions.
+
+class
+tree_matrix : public tree_expression,
+              public octave_base_list<tree_argument_list *>
+{
+public:
+
+  tree_matrix (tree_argument_list *row = 0, int l = -1, int c = -1)
+    : tree_expression (l, c)
+  {
+    if (row)
+      append (row);
+  }
+
+  ~tree_matrix (void);
+
+  bool has_magic_end (void) const;
+
+  bool all_elements_are_constant (void) const;
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_matrix (const tree_matrix&);
+
+  tree_matrix& operator = (const tree_matrix&);
+};
+
+// The character to fill with when creating string arrays.
+extern char Vstring_fill_char;
+
+extern std::string
+get_concat_class (const std::string& c1, const std::string& c2);
+
+extern void
+maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p);
+
+extern std::string
+get_concat_class (const std::string& c1, const std::string& c2);
+
+extern void
+maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-misc.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,353 @@
+/*
+
+Copyright (C) 1994-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Cell.h"
+
+#include "defun.h"
+#include "error.h"
+#include "ov.h"
+#include "oct-lvalue.h"
+#include "pt-id.h"
+#include "pt-idx.h"
+#include "pt-misc.h"
+#include "pt-walk.h"
+#include "utils.h"
+
+// Parameter lists.
+
+tree_parameter_list::~tree_parameter_list (void)
+{
+  while (! empty ())
+    {
+      iterator p = begin ();
+      delete *p;
+      erase (p);
+    }
+}
+
+void
+tree_parameter_list::mark_as_formal_parameters (void)
+{
+  for (iterator p = begin (); p != end (); p++)
+    {
+      tree_decl_elt *elt = *p;
+      elt->mark_as_formal_parameter ();
+    }
+}
+
+bool
+tree_parameter_list::validate (in_or_out type)
+{
+  bool retval = true;
+
+  std::set<std::string> dict;
+
+  for (iterator p = begin (); p != end (); p++)
+    {
+      tree_decl_elt *elt = *p;
+
+      tree_identifier *id = elt->ident ();
+
+      if (id)
+        {
+          std::string name = id->name ();
+
+          if (id->is_black_hole ())
+            {
+              if (type != in)
+                error ("invalid use of ~ in output list");
+            }
+          else if (dict.find (name) != dict.end ())
+            {
+              retval = false;
+              error ("`%s' appears more than once in parameter list",
+                     name.c_str ());
+              break;
+            }
+          else
+            dict.insert (name);
+        }
+    }
+
+  if (! error_state)
+    {
+      std::string va_type = (type == in ? "varargin" : "varargout");
+
+      size_t len = length ();
+
+      if (len > 0)
+        {
+          tree_decl_elt *elt = back ();
+
+          tree_identifier *id = elt->ident ();
+
+          if (id && id->name () == va_type)
+            {
+              if (len == 1)
+                mark_varargs_only ();
+              else
+                mark_varargs ();
+
+              iterator p = end ();
+              --p;
+              delete *p;
+              erase (p);
+            }
+        }
+    }
+
+  return retval;
+}
+
+void
+tree_parameter_list::initialize_undefined_elements (const std::string& warnfor,
+                                                    int nargout, const octave_value& val)
+{
+  bool warned = false;
+
+  int count = 0;
+
+  octave_value tmp = symbol_table::varval (".ignored.");
+  const Matrix ignored = tmp.is_defined () ? tmp.matrix_value () : Matrix ();
+
+  octave_idx_type k = 0;
+
+  for (iterator p = begin (); p != end (); p++)
+    {
+      if (++count > nargout)
+        break;
+
+      tree_decl_elt *elt = *p;
+
+      if (! elt->is_variable ())
+        {
+          if (! warned)
+            {
+              warned = true;
+
+              while (k < ignored.numel ())
+                {
+                  octave_idx_type l = ignored (k);
+                  if (l == count)
+                    {
+                      warned = false;
+                      break;
+                    }
+                  else if (l > count)
+                    break;
+                  else
+                    k++;
+                }
+
+              if (warned)
+                {
+                  warning_with_id
+                    ("Octave:undefined-return-values",
+                     "%s: some elements in list of return values are undefined",
+                     warnfor.c_str ());
+                }
+            }
+
+          octave_lvalue lval = elt->lvalue ();
+
+          lval.assign (octave_value::op_asn_eq, val);
+        }
+    }
+}
+
+void
+tree_parameter_list::define_from_arg_vector (const octave_value_list& args)
+{
+  int nargin = args.length ();
+
+  int expected_nargin = length ();
+
+  iterator p = begin ();
+
+  for (int i = 0; i < expected_nargin; i++)
+    {
+      tree_decl_elt *elt = *p++;
+
+      octave_lvalue ref = elt->lvalue ();
+
+      if (i < nargin)
+        {
+          if (args(i).is_defined () && args(i).is_magic_colon ())
+            {
+              if (! elt->eval ())
+                {
+                  ::error ("no default value for argument %d\n", i+1);
+                  return;
+                }
+            }
+          else
+            ref.define (args(i));
+        }
+      else
+        elt->eval ();
+    }
+}
+
+void
+tree_parameter_list::undefine (void)
+{
+  int len = length ();
+
+  iterator p = begin ();
+
+  for (int i = 0; i < len; i++)
+    {
+      tree_decl_elt *elt = *p++;
+
+      octave_lvalue ref = elt->lvalue ();
+
+      ref.assign (octave_value::op_asn_eq, octave_value ());
+    }
+}
+
+octave_value_list
+tree_parameter_list::convert_to_const_vector (int nargout,
+                                              const Cell& varargout)
+{
+  octave_idx_type vlen = varargout.numel ();
+  int len = length ();
+
+  // Special case. Will do a shallow copy.
+  if (len == 0)
+    return varargout;
+  else if (nargout <= len)
+    {
+      octave_value_list retval (nargout);
+
+      int i = 0;
+
+      for (iterator p = begin (); p != end (); p++)
+        {
+          tree_decl_elt *elt = *p;
+          if (elt->is_defined ())
+            retval(i++) = elt->rvalue1 ();
+          else
+            break;
+        }
+
+      return retval;
+    }
+  else
+    {
+      octave_value_list retval (len + vlen);
+
+      int i = 0;
+
+      for (iterator p = begin (); p != end (); p++)
+        {
+          tree_decl_elt *elt = *p;
+          retval(i++) = elt->rvalue1 ();
+        }
+
+      for (octave_idx_type j = 0; j < vlen; j++)
+        retval(i++) = varargout(j);
+
+      return retval;
+    }
+}
+
+bool
+tree_parameter_list::is_defined (void)
+{
+  bool status = true;
+
+  for (iterator p = begin (); p != end (); p++)
+    {
+      tree_decl_elt *elt = *p;
+
+      if (! elt->is_variable ())
+        {
+          status = false;
+          break;
+        }
+    }
+
+  return status;
+}
+
+tree_parameter_list *
+tree_parameter_list::dup (symbol_table::scope_id scope,
+                          symbol_table::context_id context) const
+{
+  tree_parameter_list *new_list = new tree_parameter_list ();
+
+  if (takes_varargs ())
+    new_list->mark_varargs ();
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_decl_elt *elt = *p;
+
+      new_list->append (elt->dup (scope, context));
+    }
+
+  return new_list;
+}
+
+void
+tree_parameter_list::accept (tree_walker& tw)
+{
+  tw.visit_parameter_list (*this);
+}
+
+// Return lists.
+
+tree_return_list::~tree_return_list (void)
+{
+  while (! empty ())
+    {
+      iterator p = begin ();
+      delete *p;
+      erase (p);
+    }
+}
+
+tree_return_list *
+tree_return_list::dup (symbol_table::scope_id scope,
+                       symbol_table::context_id context) const
+{
+  tree_return_list *new_list = new tree_return_list ();
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_index_expression *elt = *p;
+
+      new_list->append (elt->dup (scope, context));
+    }
+
+  return new_list;
+}
+
+void
+tree_return_list::accept (tree_walker& tw)
+{
+  tw.visit_return_list (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-misc.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,149 @@
+/*
+
+Copyright (C) 1994-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_misc_h)
+#define octave_tree_misc_h 1
+
+class Cell;
+
+class octave_value;
+class octave_value_list;
+
+class tree_identifier;
+class tree_index_expression;
+class tree_va_return_list;
+
+class tree_walker;
+
+#include "base-list.h"
+#include "pt-decl.h"
+#include "symtab.h"
+
+// Parameter lists.  Used to hold the list of input and output
+// parameters in a function definition.  Elements are identifiers
+// only.
+
+class
+tree_parameter_list : public octave_base_list<tree_decl_elt *>
+{
+public:
+
+  enum in_or_out
+    {
+      in = 1,
+      out = 2
+    };
+
+  tree_parameter_list (void)
+    : marked_for_varargs (0) { }
+
+  tree_parameter_list (tree_decl_elt *t)
+    : marked_for_varargs (0) { append (t); }
+
+  ~tree_parameter_list (void);
+
+  void mark_as_formal_parameters (void);
+
+  bool validate (in_or_out type);
+
+  bool takes_varargs (void) const { return marked_for_varargs != 0; }
+
+  bool varargs_only (void) { return (marked_for_varargs < 0); }
+
+  void initialize_undefined_elements (const std::string& warnfor,
+                                      int nargout, const octave_value& val);
+
+  void define_from_arg_vector (const octave_value_list& args);
+
+  void undefine (void);
+
+  bool is_defined (void);
+
+  octave_value_list convert_to_const_vector (int nargout, const Cell& varargout);
+
+  tree_parameter_list *dup (symbol_table::scope_id scope,
+                            symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  int marked_for_varargs;
+
+  void mark_varargs (void) { marked_for_varargs = 1; }
+
+  void mark_varargs_only (void) { marked_for_varargs = -1; }
+
+  // No copying!
+
+  tree_parameter_list (const tree_parameter_list&);
+
+  tree_parameter_list& operator = (const tree_parameter_list&);
+};
+
+// Return lists.  Used to hold the right hand sides of multiple
+// assignment expressions.
+
+class
+tree_return_list : public octave_base_list<tree_index_expression *>
+{
+public:
+
+  tree_return_list (void) { }
+
+  tree_return_list (tree_index_expression *t) { append (t); }
+
+  ~tree_return_list (void);
+
+  tree_return_list *dup (symbol_table::scope_id scope,
+                         symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_return_list (const tree_return_list&);
+
+  tree_return_list& operator = (const tree_return_list&);
+};
+
+class
+tree_va_return_list : public octave_base_list<octave_value>
+{
+public:
+
+  tree_va_return_list (void) { }
+
+  ~tree_va_return_list (void) { }
+
+private:
+
+  // No copying!
+
+  tree_va_return_list (const tree_va_return_list&);
+
+  tree_va_return_list& operator = (const tree_va_return_list&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-pr-code.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,1322 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cctype>
+
+#include <iostream>
+
+#include "comment-list.h"
+#include "error.h"
+#include "ov-usr-fcn.h"
+#include "pr-output.h"
+#include "pt-all.h"
+
+void
+tree_print_code::visit_anon_fcn_handle (tree_anon_fcn_handle& afh)
+{
+  indent ();
+
+  print_parens (afh, "(");
+
+  os << "@(";
+
+  tree_parameter_list *param_list = afh.parameter_list ();
+
+  if (param_list)
+    param_list->accept (*this);
+
+  os << ") ";
+
+  print_fcn_handle_body (afh.body ());
+
+  print_parens (afh, ")");
+}
+
+void
+tree_print_code::visit_argument_list (tree_argument_list& lst)
+{
+  tree_argument_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_expression *elt = *p++;
+
+      if (elt)
+        {
+          elt->accept (*this);
+
+          if (p != lst.end ())
+            os << ", ";
+        }
+    }
+}
+
+void
+tree_print_code::visit_binary_expression (tree_binary_expression& expr)
+{
+  indent ();
+
+  print_parens (expr, "(");
+
+  tree_expression *op1 = expr.lhs ();
+
+  if (op1)
+    op1->accept (*this);
+
+  os << " " << expr.oper () << " ";
+
+  tree_expression *op2 = expr.rhs ();
+
+  if (op2)
+    op2->accept (*this);
+
+  print_parens (expr, ")");
+}
+
+void
+tree_print_code::visit_break_command (tree_break_command&)
+{
+  indent ();
+
+  os << "break";
+}
+
+void
+tree_print_code::visit_colon_expression (tree_colon_expression& expr)
+{
+  indent ();
+
+  print_parens (expr, "(");
+
+  tree_expression *op1 = expr.base ();
+
+  if (op1)
+    op1->accept (*this);
+
+  // Stupid syntax.
+
+  tree_expression *op3 = expr.increment ();
+
+  if (op3)
+    {
+      os << ":";
+      op3->accept (*this);
+    }
+
+  tree_expression *op2 = expr.limit ();
+
+  if (op2)
+    {
+      os << ":";
+      op2->accept (*this);
+    }
+
+  print_parens (expr, ")");
+}
+
+void
+tree_print_code::visit_continue_command (tree_continue_command&)
+{
+  indent ();
+
+  os << "continue";
+}
+
+void
+tree_print_code::do_decl_command (tree_decl_command& cmd)
+{
+  indent ();
+
+  os << cmd.name () << " ";
+
+  tree_decl_init_list *init_list = cmd.initializer_list ();
+
+  if (init_list)
+    init_list->accept (*this);
+}
+
+void
+tree_print_code::visit_global_command (tree_global_command& cmd)
+{
+  do_decl_command (cmd);
+}
+
+void
+tree_print_code::visit_persistent_command (tree_persistent_command& cmd)
+{
+  do_decl_command (cmd);
+}
+
+void
+tree_print_code::visit_decl_elt (tree_decl_elt& cmd)
+{
+  tree_identifier *id = cmd.ident ();
+
+  if (id)
+    id->accept (*this);
+
+  tree_expression *expr = cmd.expression ();
+
+  if (expr)
+    {
+      os << " = ";
+
+      expr->accept (*this);
+    }
+}
+
+void
+tree_print_code::visit_decl_init_list (tree_decl_init_list& lst)
+{
+  tree_decl_init_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_decl_elt *elt = *p++;
+
+      if (elt)
+        {
+          elt->accept (*this);
+
+          if (p != lst.end ())
+            os << ", ";
+        }
+    }
+}
+
+void
+tree_print_code::visit_simple_for_command (tree_simple_for_command& cmd)
+{
+  print_comment_list (cmd.leading_comment ());
+
+  indent ();
+
+  os << (cmd.in_parallel () ? "parfor " : "for ");
+
+  tree_expression *lhs = cmd.left_hand_side ();
+
+  tree_expression *maxproc = cmd.maxproc_expr ();
+
+  if (maxproc)
+    os << "(";
+
+  if (lhs)
+    lhs->accept (*this);
+
+  os << " = ";
+
+  tree_expression *expr = cmd.control_expr ();
+
+  if (expr)
+    expr->accept (*this);
+
+  if (maxproc)
+    {
+      os << ", ";
+      maxproc->accept (*this);
+      os << ")";
+    }
+
+  newline ();
+
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    {
+      increment_indent_level ();
+
+      list->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.trailing_comment ());
+
+  indent ();
+
+  os << (cmd.in_parallel () ? "endparfor" : "endfor");
+}
+
+void
+tree_print_code::visit_complex_for_command (tree_complex_for_command& cmd)
+{
+  print_comment_list (cmd.leading_comment ());
+
+  indent ();
+
+  os << "for [";
+  nesting.push ('[');
+
+  tree_argument_list *lhs = cmd.left_hand_side ();
+
+  if (lhs)
+    lhs->accept (*this);
+
+  nesting.pop ();
+  os << "] = ";
+
+  tree_expression *expr = cmd.control_expr ();
+
+  if (expr)
+    expr->accept (*this);
+
+  newline ();
+
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    {
+      increment_indent_level ();
+
+      list->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.trailing_comment ());
+
+  indent ();
+
+  os << "endfor";
+}
+
+void
+tree_print_code::visit_octave_user_script (octave_user_script& fcn)
+{
+  reset ();
+
+  tree_statement_list *cmd_list = fcn.body ();
+
+  if (cmd_list)
+    cmd_list->accept (*this);
+}
+
+void
+tree_print_code::visit_octave_user_function (octave_user_function& fcn)
+{
+  reset ();
+
+  visit_octave_user_function_header (fcn);
+
+  tree_statement_list *cmd_list = fcn.body ();
+
+  if (cmd_list)
+    {
+      increment_indent_level ();
+
+      cmd_list->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  visit_octave_user_function_trailer (fcn);
+}
+
+void
+tree_print_code::visit_octave_user_function_header (octave_user_function& fcn)
+{
+  octave_comment_list *leading_comment = fcn.leading_comment ();
+
+  if (leading_comment)
+    {
+      print_comment_list (leading_comment);
+      newline ();
+    }
+
+  indent ();
+
+  os << "function ";
+
+  tree_parameter_list *ret_list = fcn.return_list ();
+
+  if (ret_list)
+    {
+      bool takes_var_return = fcn.takes_var_return ();
+
+      int len = ret_list->length ();
+
+      if (len > 1 || takes_var_return)
+        {
+          os << "[";
+          nesting.push ('[');
+        }
+
+      ret_list->accept (*this);
+
+      if (takes_var_return)
+        {
+          if (len > 0)
+            os << ", ";
+
+          os << "varargout";
+        }
+
+      if (len > 1 || takes_var_return)
+        {
+          nesting.pop ();
+          os << "]";
+        }
+
+      os << " = ";
+    }
+
+  std::string fcn_name = fcn.name ();
+
+  os << (fcn_name.empty () ? std::string ("(empty)") : fcn_name) << " ";
+
+  tree_parameter_list *param_list = fcn.parameter_list ();
+
+  if (param_list)
+    {
+      bool takes_varargs = fcn.takes_varargs ();
+
+      int len = param_list->length ();
+
+      if (len > 0 || takes_varargs)
+        {
+          os << "(";
+          nesting.push ('(');
+        }
+
+      param_list->accept (*this);
+
+      if (takes_varargs)
+        {
+          if (len > 0)
+            os << ", ";
+
+          os << "varargin";
+        }
+
+      if (len > 0 || takes_varargs)
+        {
+          nesting.pop ();
+          os << ")";
+          newline ();
+        }
+    }
+  else
+    {
+      os << "()";
+      newline ();
+    }
+}
+
+void
+tree_print_code::visit_octave_user_function_trailer (octave_user_function& fcn)
+{
+  print_indented_comment (fcn.trailing_comment ());
+
+  newline ();
+}
+
+void
+tree_print_code::visit_function_def (tree_function_def& fdef)
+{
+  indent ();
+
+  octave_value fcn = fdef.function ();
+
+  octave_function *f = fcn.function_value ();
+
+  if (f)
+    f->accept (*this);
+}
+
+void
+tree_print_code::visit_identifier (tree_identifier& id)
+{
+  indent ();
+
+  print_parens (id, "(");
+
+  std::string nm = id.name ();
+  os << (nm.empty () ? std::string ("(empty)") : nm);
+
+  print_parens (id, ")");
+}
+
+void
+tree_print_code::visit_if_clause (tree_if_clause& cmd)
+{
+  tree_expression *expr = cmd.condition ();
+
+  if (expr)
+    expr->accept (*this);
+
+  newline ();
+
+  tree_statement_list *list = cmd.commands ();
+
+  if (list)
+    {
+      increment_indent_level ();
+
+      list->accept (*this);
+
+      decrement_indent_level ();
+    }
+}
+
+void
+tree_print_code::visit_if_command (tree_if_command& cmd)
+{
+  print_comment_list (cmd.leading_comment ());
+
+  indent ();
+
+  os << "if ";
+
+  tree_if_command_list *list = cmd.cmd_list ();
+
+  if (list)
+    list->accept (*this);
+
+  print_indented_comment (cmd.trailing_comment ());
+
+  indent ();
+
+  os << "endif";
+}
+
+void
+tree_print_code::visit_if_command_list (tree_if_command_list& lst)
+{
+  tree_if_command_list::iterator p = lst.begin ();
+
+  bool first_elt = true;
+
+  while (p != lst.end ())
+    {
+      tree_if_clause *elt = *p++;
+
+      if (elt)
+        {
+          if (! first_elt)
+            {
+              print_indented_comment (elt->leading_comment ());
+
+              indent ();
+
+              if (elt->is_else_clause ())
+                os << "else";
+              else
+                os << "elseif ";
+            }
+
+          elt->accept (*this);
+        }
+
+      first_elt = false;
+    }
+}
+
+void
+tree_print_code::visit_index_expression (tree_index_expression& expr)
+{
+  indent ();
+
+  print_parens (expr, "(");
+
+  tree_expression *e = expr.expression ();
+
+  if (e)
+    e->accept (*this);
+
+  std::list<tree_argument_list *> arg_lists = expr.arg_lists ();
+  std::string type_tags = expr.type_tags ();
+  std::list<string_vector> arg_names = expr.arg_names ();
+
+  int n = type_tags.length ();
+
+  std::list<tree_argument_list *>::iterator p_arg_lists = arg_lists.begin ();
+  std::list<string_vector>::iterator p_arg_names = arg_names.begin ();
+
+  for (int i = 0; i < n; i++)
+    {
+      switch (type_tags[i])
+        {
+        case '(':
+          {
+            char nc = nesting.top ();
+            if ((nc == '[' || nc == '{') && expr.paren_count () == 0)
+              os << "(";
+            else
+              os << " (";
+            nesting.push ('(');
+
+            tree_argument_list *l = *p_arg_lists;
+            if (l)
+              l->accept (*this);
+
+            nesting.pop ();
+            os << ")";
+          }
+          break;
+
+        case '{':
+          {
+            char nc = nesting.top ();
+            if ((nc == '[' || nc == '{') && expr.paren_count () == 0)
+              os << "{";
+            else
+              os << " {";
+            // We only care about whitespace inside [] and {} when we
+            // are defining matrix and cell objects, not when indexing.
+            nesting.push ('(');
+
+            tree_argument_list *l = *p_arg_lists;
+            if (l)
+              l->accept (*this);
+
+            nesting.pop ();
+            os << "}";
+          }
+          break;
+
+        case '.':
+          {
+            string_vector nm = *p_arg_names;
+            assert (nm.length () == 1);
+            os << "." << nm(0);
+          }
+          break;
+
+        default:
+          panic_impossible ();
+        }
+
+      p_arg_lists++;
+      p_arg_names++;
+    }
+
+  print_parens (expr, ")");
+}
+
+void
+tree_print_code::visit_matrix (tree_matrix& lst)
+{
+  indent ();
+
+  print_parens (lst, "(");
+
+  os << "[";
+  nesting.push ('[');
+
+  tree_matrix::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_argument_list *elt = *p++;
+
+      if (elt)
+        {
+          elt->accept (*this);
+
+          if (p != lst.end ())
+            os << "; ";
+        }
+    }
+
+  nesting.pop ();
+  os << "]";
+
+  print_parens (lst, ")");
+}
+
+void
+tree_print_code::visit_cell (tree_cell& lst)
+{
+  indent ();
+
+  print_parens (lst, "(");
+
+  os << "{";
+  nesting.push ('{');
+
+  tree_cell::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_argument_list *elt = *p++;
+
+      if (elt)
+        {
+          elt->accept (*this);
+
+          if (p != lst.end ())
+            os << "; ";
+        }
+    }
+
+  nesting.pop ();
+  os << "}";
+
+  print_parens (lst, ")");
+}
+
+void
+tree_print_code::visit_multi_assignment (tree_multi_assignment& expr)
+{
+  indent ();
+
+  print_parens (expr, "(");
+
+  tree_argument_list *lhs = expr.left_hand_side ();
+
+  if (lhs)
+    {
+      int len = lhs->length ();
+
+      if (len > 1)
+        {
+          os << "[";
+          nesting.push ('[');
+        }
+
+      lhs->accept (*this);
+
+      if (len > 1)
+        {
+          nesting.pop ();
+          os << "]";
+        }
+    }
+
+  os << " " << expr.oper () << " ";
+
+  tree_expression *rhs = expr.right_hand_side ();
+
+  if (rhs)
+    rhs->accept (*this);
+
+  print_parens (expr, ")");
+}
+
+void
+tree_print_code::visit_no_op_command (tree_no_op_command& cmd)
+{
+  indent ();
+
+  os << cmd.original_command ();
+}
+
+void
+tree_print_code::visit_constant (tree_constant& val)
+{
+  indent ();
+
+  print_parens (val, "(");
+
+  val.print_raw (os, true, print_original_text);
+
+  print_parens (val, ")");
+}
+
+void
+tree_print_code::visit_fcn_handle (tree_fcn_handle& fh)
+{
+  indent ();
+
+  print_parens (fh, "(");
+
+  fh.print_raw (os, true, print_original_text);
+
+  print_parens (fh, ")");
+}
+
+void
+tree_print_code::visit_parameter_list (tree_parameter_list& lst)
+{
+  tree_parameter_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_decl_elt *elt = *p++;
+
+      if (elt)
+        {
+          elt->accept (*this);
+
+          if (p != lst.end ())
+            os << ", ";
+        }
+    }
+}
+
+void
+tree_print_code::visit_postfix_expression (tree_postfix_expression& expr)
+{
+  indent ();
+
+  print_parens (expr, "(");
+
+  tree_expression *e = expr.operand ();
+
+  if (e)
+    e->accept (*this);
+
+  os << expr.oper ();
+
+  print_parens (expr, ")");
+}
+
+void
+tree_print_code::visit_prefix_expression (tree_prefix_expression& expr)
+{
+  indent ();
+
+  print_parens (expr, "(");
+
+  os << expr.oper ();
+
+  tree_expression *e = expr.operand ();
+
+  if (e)
+    e->accept (*this);
+
+  print_parens (expr, ")");
+}
+
+void
+tree_print_code::visit_return_command (tree_return_command&)
+{
+  indent ();
+
+  os << "return";
+}
+
+void
+tree_print_code::visit_return_list (tree_return_list& lst)
+{
+  tree_return_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_index_expression *elt = *p++;
+
+      if (elt)
+        {
+          elt->accept (*this);
+
+          if (p != lst.end ())
+            os << ", ";
+        }
+    }
+}
+
+void
+tree_print_code::visit_simple_assignment (tree_simple_assignment& expr)
+{
+  indent ();
+
+  print_parens (expr, "(");
+
+  tree_expression *lhs = expr.left_hand_side ();
+
+  if (lhs)
+    lhs->accept (*this);
+
+  os << " " << expr.oper () << " ";
+
+  tree_expression *rhs = expr.right_hand_side ();
+
+  if (rhs)
+    rhs->accept (*this);
+
+  print_parens (expr, ")");
+}
+
+void
+tree_print_code::visit_statement (tree_statement& stmt)
+{
+  print_comment_list (stmt.comment_text ());
+
+  tree_command *cmd = stmt.command ();
+
+  if (cmd)
+    {
+      cmd->accept (*this);
+
+      if (! stmt.print_result ())
+        {
+          os << ";";
+          newline (" ");
+        }
+      else
+        newline ();
+    }
+  else
+    {
+      tree_expression *expr = stmt.expression ();
+
+      if (expr)
+        {
+          expr->accept (*this);
+
+          if (! stmt.print_result ())
+            {
+              os << ";";
+              newline (" ");
+            }
+          else
+            newline ();
+        }
+    }
+}
+
+void
+tree_print_code::visit_statement_list (tree_statement_list& lst)
+{
+  for (tree_statement_list::iterator p = lst.begin (); p != lst.end (); p++)
+    {
+      tree_statement *elt = *p;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_print_code::visit_switch_case (tree_switch_case& cs)
+{
+  print_comment_list (cs.leading_comment ());
+
+  indent ();
+
+  if (cs.is_default_case ())
+    os << "otherwise";
+  else
+    os << "case ";
+
+  tree_expression *label = cs.case_label ();
+
+  if (label)
+    label->accept (*this);
+
+  newline ();
+
+  tree_statement_list *list = cs.commands ();
+
+  if (list)
+    {
+      increment_indent_level ();
+
+      list->accept (*this);
+
+      newline ();
+
+      decrement_indent_level ();
+    }
+}
+
+void
+tree_print_code::visit_switch_case_list (tree_switch_case_list& lst)
+{
+  tree_switch_case_list::iterator p = lst.begin ();
+
+  while (p != lst.end ())
+    {
+      tree_switch_case *elt = *p++;
+
+      if (elt)
+        elt->accept (*this);
+    }
+}
+
+void
+tree_print_code::visit_switch_command (tree_switch_command& cmd)
+{
+  print_comment_list (cmd.leading_comment ());
+
+  indent ();
+
+  os << "switch ";
+
+  tree_expression *expr = cmd.switch_value ();
+
+  if (expr)
+    expr->accept (*this);
+
+  newline ();
+
+  tree_switch_case_list *list = cmd.case_list ();
+
+  if (list)
+    {
+      increment_indent_level ();
+
+      list->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.leading_comment ());
+
+  indent ();
+
+  os << "endswitch";
+}
+
+void
+tree_print_code::visit_try_catch_command (tree_try_catch_command& cmd)
+{
+  print_comment_list (cmd.leading_comment ());
+
+  indent ();
+
+  os << "try";
+
+  newline ();
+
+  tree_statement_list *try_code = cmd.body ();
+
+  if (try_code)
+    {
+      increment_indent_level ();
+
+      try_code->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.middle_comment ());
+
+  indent ();
+
+  os << "catch";
+
+  newline ();
+
+  tree_statement_list *catch_code = cmd.cleanup ();
+
+  if (catch_code)
+    {
+      increment_indent_level ();
+
+      catch_code->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.trailing_comment ());
+
+  indent ();
+
+  os << "end_try_catch";
+}
+
+void
+tree_print_code::visit_unwind_protect_command
+  (tree_unwind_protect_command& cmd)
+{
+  print_comment_list (cmd.leading_comment ());
+
+  indent ();
+
+  os << "unwind_protect";
+
+  newline ();
+
+  tree_statement_list *unwind_protect_code = cmd.body ();
+
+  if (unwind_protect_code)
+    {
+      increment_indent_level ();
+
+      unwind_protect_code->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.middle_comment ());
+
+  indent ();
+
+  os << "unwind_protect_cleanup";
+
+  newline ();
+
+  tree_statement_list *cleanup_code = cmd.cleanup ();
+
+  if (cleanup_code)
+    {
+      increment_indent_level ();
+
+      cleanup_code->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.trailing_comment ());
+
+  indent ();
+
+  os << "end_unwind_protect";
+}
+
+void
+tree_print_code::visit_while_command (tree_while_command& cmd)
+{
+  print_comment_list (cmd.leading_comment ());
+
+  indent ();
+
+  os << "while ";
+
+  tree_expression *expr = cmd.condition ();
+
+  if (expr)
+    expr->accept (*this);
+
+  newline ();
+
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    {
+      increment_indent_level ();
+
+      list->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.trailing_comment ());
+
+  indent ();
+
+  os << "endwhile";
+}
+
+void
+tree_print_code::visit_do_until_command (tree_do_until_command& cmd)
+{
+  print_comment_list (cmd.leading_comment ());
+
+  indent ();
+
+  os << "do";
+
+  newline ();
+
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    {
+      increment_indent_level ();
+
+      list->accept (*this);
+
+      decrement_indent_level ();
+    }
+
+  print_indented_comment (cmd.trailing_comment ());
+
+  indent ();
+
+  os << "until";
+
+  tree_expression *expr = cmd.condition ();
+
+  if (expr)
+    expr->accept (*this);
+
+  newline ();
+}
+
+void
+tree_print_code::print_fcn_handle_body (tree_statement_list *b)
+{
+  if (b)
+    {
+      assert (b->length () == 1);
+
+      tree_statement *s = b->front ();
+
+      if (s)
+        {
+          if (s->is_expression ())
+            {
+              tree_expression *e = s->expression ();
+
+              if (e)
+                {
+                  suppress_newlines++;
+                  e->accept (*this);
+                  suppress_newlines--;
+                }
+            }
+          else
+            {
+              tree_command *c = s->command ();
+
+              suppress_newlines++;
+              c->accept (*this);
+              suppress_newlines--;
+            }
+        }
+    }
+}
+
+// Each print_code() function should call this before printing
+// anything.
+//
+// This doesn't need to be fast, but isn't there a better way?
+
+void
+tree_print_code::indent (void)
+{
+  assert (curr_print_indent_level >= 0);
+
+  if (beginning_of_line)
+    {
+      os << prefix;
+
+      for (int i = 0; i < curr_print_indent_level; i++)
+        os << " ";
+
+      beginning_of_line = false;
+    }
+}
+
+// All print_code() functions should use this to print new lines.
+
+void
+tree_print_code::newline (const char *alt_txt)
+{
+  if (suppress_newlines)
+    os << alt_txt;
+  else
+    {
+      os << "\n";
+
+      beginning_of_line = true;
+    }
+}
+
+// For ressetting print_code state.
+
+void
+tree_print_code::reset (void)
+{
+  beginning_of_line = true;
+  curr_print_indent_level = 0;
+  while (nesting.top () != 'n')
+    nesting.pop ();
+}
+
+void
+tree_print_code::print_parens (const tree_expression& expr, const char *txt)
+{
+  int n = expr.paren_count ();
+
+  for (int i = 0; i < n; i++)
+    os << txt;
+}
+
+void
+tree_print_code::print_comment_elt (const octave_comment_elt& elt)
+{
+  bool printed_something = false;
+
+  bool prev_char_was_newline = false;
+
+  std::string comment = elt.text ();
+
+  size_t len = comment.length ();
+
+  size_t i = 0;
+
+  while (i < len && comment[i++] == '\n')
+    ; /* Skip leading new lines. */
+  i--;
+
+  while (i < len)
+    {
+      char c = comment[i++];
+
+      if (c == '\n')
+        {
+          if (prev_char_was_newline)
+            os << "##";
+
+          newline ();
+
+          prev_char_was_newline = true;
+        }
+      else
+        {
+          if (beginning_of_line)
+            {
+              printed_something = true;
+
+              indent ();
+
+              os << "##";
+
+              if (! (isspace (c) || c == '!'))
+                os << " ";
+            }
+
+          os << static_cast<char> (c);
+
+          prev_char_was_newline = false;
+        }
+    }
+
+  if (printed_something && ! beginning_of_line)
+    newline ();
+}
+
+void
+tree_print_code::print_comment_list (octave_comment_list *comment_list)
+{
+  if (comment_list)
+    {
+      octave_comment_list::iterator p = comment_list->begin ();
+
+      while (p != comment_list->end ())
+        {
+          octave_comment_elt elt = *p++;
+
+          print_comment_elt (elt);
+
+          if (p != comment_list->end ())
+            newline ();
+        }
+    }
+}
+
+void
+tree_print_code::print_indented_comment (octave_comment_list *comment_list)
+{
+  increment_indent_level ();
+
+  print_comment_list (comment_list);
+
+  decrement_indent_level ();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-pr-code.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,196 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_print_code_h)
+#define octave_tree_print_code_h 1
+
+#include <stack>
+#include <string>
+
+#include "comment-list.h"
+#include "pt-walk.h"
+
+class tree_decl_command;
+class tree_expression;
+
+// How to print the code that the parse trees represent.
+
+class
+tree_print_code : public tree_walker
+{
+public:
+
+  tree_print_code (std::ostream& os_arg,
+                   const std::string& pfx = std::string (),
+                   bool pr_orig_txt = true)
+    : os (os_arg), prefix (pfx), nesting (),
+      print_original_text (pr_orig_txt),
+      curr_print_indent_level (0), beginning_of_line (true),
+      suppress_newlines (0)
+  {
+    // For "none".
+    nesting.push ('n');
+  }
+
+  ~tree_print_code (void) { }
+
+  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&);
+
+  void print_fcn_handle_body (tree_statement_list *);
+
+private:
+
+  std::ostream& os;
+
+  std::string prefix;
+
+  std::stack<char> nesting;
+
+  bool print_original_text;
+
+  // Current indentation.
+  int curr_print_indent_level;
+
+  // TRUE means we are at the beginning of a line.
+  bool beginning_of_line;
+
+  // Nonzero means we are not printing newlines and indenting.
+  int suppress_newlines;
+
+  void do_decl_command (tree_decl_command& cmd);
+
+  void reset_indent_level (void) { curr_print_indent_level = 0; }
+
+  void increment_indent_level (void) { curr_print_indent_level += 2; }
+
+  void decrement_indent_level (void) { curr_print_indent_level -= 2; }
+
+  void newline (const char *alt_txt = ", ");
+
+  void indent (void);
+
+  void reset (void);
+
+  void print_parens (const tree_expression& expr, const char *txt);
+
+  void print_comment_list (octave_comment_list *comment_list);
+
+  void print_comment_elt (const octave_comment_elt& comment_elt);
+
+  void print_indented_comment (octave_comment_list *comment_list);
+
+  // Must create with an output stream!
+
+  tree_print_code (void);
+
+  // No copying!
+
+  tree_print_code (const tree_print_code&);
+
+  tree_print_code& operator = (const tree_print_code&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-select.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,223 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "oct-obj.h"
+#include "ov.h"
+#include "pt-cmd.h"
+#include "pt-exp.h"
+#include "pt-select.h"
+#include "pt-stmt.h"
+#include "pt-walk.h"
+#include "Cell.h"
+#include "ov-typeinfo.h"
+
+// If clauses.
+
+tree_if_clause::~tree_if_clause (void)
+{
+  delete expr;
+  delete list;
+  delete lead_comm;
+}
+
+tree_if_clause *
+tree_if_clause::dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const
+{
+  return new tree_if_clause (expr ? expr->dup (scope, context) : 0,
+                             list ? list->dup (scope, context) : 0,
+                             lead_comm ? lead_comm->dup () : 0);
+}
+
+void
+tree_if_clause::accept (tree_walker& tw)
+{
+  tw.visit_if_clause (*this);
+}
+
+// List of if commands.
+
+tree_if_command_list *
+tree_if_command_list::dup (symbol_table::scope_id scope,
+                           symbol_table::context_id context) const
+{
+  tree_if_command_list *new_icl = new tree_if_command_list ();
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_if_clause *elt = *p;
+
+      new_icl->append (elt ? elt->dup (scope, context) : 0);
+    }
+
+  return new_icl;
+}
+
+void
+tree_if_command_list::accept (tree_walker& tw)
+{
+  tw.visit_if_command_list (*this);
+}
+
+// If.
+
+tree_if_command::~tree_if_command (void)
+{
+  delete list;
+  delete lead_comm;
+  delete trail_comm;
+}
+
+tree_command *
+tree_if_command::dup (symbol_table::scope_id scope,
+                      symbol_table::context_id context) const
+{
+  return new tree_if_command (list ? list->dup (scope, context) : 0,
+                              lead_comm ? lead_comm->dup () : 0,
+                              trail_comm ? trail_comm->dup () : 0,
+                              line (), column ());
+}
+
+void
+tree_if_command::accept (tree_walker& tw)
+{
+  tw.visit_if_command (*this);
+}
+
+// Switch cases.
+
+tree_switch_case::~tree_switch_case (void)
+{
+  delete label;
+  delete list;
+  delete lead_comm;
+}
+
+
+bool
+tree_switch_case::label_matches (const octave_value& val)
+{
+  octave_value label_value = label->rvalue1 ();
+
+  if (! error_state && label_value.is_defined () )
+    {
+      if (label_value.is_cell ())
+        {
+          Cell cell (label_value.cell_value ());
+
+          for (octave_idx_type i = 0; i < cell.rows (); i++)
+            {
+              for (octave_idx_type j = 0; j < cell.columns (); j++)
+                {
+                  bool match = val.is_equal (cell(i,j));
+
+                  if (error_state)
+                    return false;
+                  else if (match)
+                    return true;
+                }
+            }
+        }
+      else
+        {
+          bool match = val.is_equal (label_value);
+
+          if (error_state)
+            return false;
+          else
+            return match;
+        }
+    }
+
+  return false;
+}
+
+tree_switch_case *
+tree_switch_case::dup (symbol_table::scope_id scope,
+                       symbol_table::context_id context) const
+{
+  return new tree_switch_case (label ? label->dup (scope, context) : 0,
+                               list ? list->dup (scope, context) : 0,
+                               lead_comm ? lead_comm->dup () : 0);
+}
+
+void
+tree_switch_case::accept (tree_walker& tw)
+{
+  tw.visit_switch_case (*this);
+}
+
+// List of switch cases.
+
+tree_switch_case_list *
+tree_switch_case_list::dup (symbol_table::scope_id scope,
+                            symbol_table::context_id context) const
+{
+  tree_switch_case_list *new_scl = new tree_switch_case_list ();
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_switch_case *elt = *p;
+
+      new_scl->append (elt ? elt->dup (scope, context) : 0);
+    }
+
+  return new_scl;
+}
+
+void
+tree_switch_case_list::accept (tree_walker& tw)
+{
+  tw.visit_switch_case_list (*this);
+}
+
+// Switch.
+
+tree_switch_command::~tree_switch_command (void)
+{
+  delete expr;
+  delete list;
+  delete lead_comm;
+  delete trail_comm;
+}
+
+tree_command *
+tree_switch_command::dup (symbol_table::scope_id scope,
+                          symbol_table::context_id context) const
+{
+  return new tree_switch_command (expr ? expr->dup (scope, context) : 0,
+                                  list ? list->dup (scope, context) : 0,
+                                  lead_comm ? lead_comm->dup () : 0,
+                                  trail_comm ? trail_comm->dup () : 0,
+                                  line (), column ());
+}
+
+void
+tree_switch_command::accept (tree_walker& tw)
+{
+  tw.visit_switch_command (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-select.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,302 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_select_h)
+#define octave_tree_select_h 1
+
+class expression;
+class tree_statement_list;
+
+class tree_walker;
+
+#include "base-list.h"
+#include "comment-list.h"
+#include "pt-cmd.h"
+#include "symtab.h"
+
+// If.
+
+class
+tree_if_clause : public tree
+{
+public:
+
+  tree_if_clause (int l = -1, int c = -1)
+    : tree (l, c), expr (0), list (0), lead_comm (0) { }
+
+  tree_if_clause (tree_statement_list *sl, octave_comment_list *lc = 0,
+                  int l = -1, int c = -1)
+    : tree (l, c), expr (0), list (sl), lead_comm (lc) { }
+
+  tree_if_clause (tree_expression *e, tree_statement_list *sl,
+                  octave_comment_list *lc = 0,
+                  int l = -1, int c = -1)
+    : tree (l, c), expr (e), list (sl), lead_comm (lc) { }
+
+  ~tree_if_clause (void);
+
+  bool is_else_clause (void) { return ! expr; }
+
+  tree_expression *condition (void) { return expr; }
+
+  tree_statement_list *commands (void) { return list; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  tree_if_clause *dup (symbol_table::scope_id scope,
+                       symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // The condition to test.
+  tree_expression *expr;
+
+  // The list of statements to evaluate if expr is true.
+  tree_statement_list *list;
+
+  // Comment preceding ELSE or ELSEIF token.
+  octave_comment_list *lead_comm;
+
+  // No copying!
+
+  tree_if_clause (const tree_if_clause&);
+
+  tree_if_clause& operator = (const tree_if_clause&);
+};
+
+class
+tree_if_command_list : public octave_base_list<tree_if_clause *>
+{
+public:
+
+  tree_if_command_list (void) { }
+
+  tree_if_command_list (tree_if_clause *t) { append (t); }
+
+  ~tree_if_command_list (void)
+    {
+      while (! empty ())
+        {
+          iterator p = begin ();
+          delete *p;
+          erase (p);
+        }
+    }
+
+  tree_if_command_list *dup (symbol_table::scope_id scope,
+                             symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_if_command_list (const tree_if_command_list&);
+
+  tree_if_command_list& operator = (const tree_if_command_list&);
+};
+
+class
+tree_if_command : public tree_command
+{
+public:
+
+  tree_if_command (int l = -1, int c = -1)
+    : tree_command (l, c), list (0), lead_comm (0), trail_comm (0) { }
+
+  tree_if_command (tree_if_command_list *lst, octave_comment_list *lc,
+                   octave_comment_list *tc, int l = -1, int c = -1)
+    : tree_command (l, c), list (lst), lead_comm (lc), trail_comm (tc) { }
+
+  ~tree_if_command (void);
+
+  tree_if_command_list *cmd_list (void) { return list; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  octave_comment_list *trailing_comment (void) { return trail_comm; }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // List of if commands (if, elseif, elseif, ... else, endif)
+  tree_if_command_list *list;
+
+  // Comment preceding IF token.
+  octave_comment_list *lead_comm;
+
+  // Comment preceding ENDIF token.
+  octave_comment_list *trail_comm;
+
+  // No copying!
+
+  tree_if_command (const tree_if_command&);
+
+  tree_if_command& operator = (const tree_if_command&);
+};
+
+// Switch.
+
+class
+tree_switch_case : public tree
+{
+public:
+
+  tree_switch_case (int l = -1, int c = -1)
+    : tree (l, c), label (0), list (0), lead_comm (0) { }
+
+  tree_switch_case (tree_statement_list *sl, octave_comment_list *lc = 0,
+                    int l = -1, int c = -1)
+    : tree (l, c), label (0), list (sl), lead_comm (lc) { }
+
+  tree_switch_case (tree_expression *e, tree_statement_list *sl,
+                    octave_comment_list *lc = 0,
+                    int l = -1, int c = -1)
+    : tree (l, c), label (e), list (sl), lead_comm (lc) { }
+
+  ~tree_switch_case (void);
+
+  bool is_default_case (void) { return ! label; }
+
+  bool label_matches (const octave_value& val);
+
+  tree_expression *case_label (void) { return label; }
+
+  tree_statement_list *commands (void) { return list; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  tree_switch_case *dup (symbol_table::scope_id scope,
+                         symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // The case label.
+  tree_expression *label;
+
+  // The list of statements to evaluate if the label matches.
+  tree_statement_list *list;
+
+  // Comment preceding CASE or OTHERWISE token.
+  octave_comment_list *lead_comm;
+
+  // No copying!
+
+  tree_switch_case (const tree_switch_case&);
+
+  tree_switch_case& operator = (const tree_switch_case&);
+};
+
+class
+tree_switch_case_list : public octave_base_list<tree_switch_case *>
+{
+public:
+
+  tree_switch_case_list (void) { }
+
+  tree_switch_case_list (tree_switch_case *t) { append (t); }
+
+  ~tree_switch_case_list (void)
+    {
+      while (! empty ())
+        {
+          iterator p = begin ();
+          delete *p;
+          erase (p);
+        }
+    }
+
+  tree_switch_case_list *dup (symbol_table::scope_id scope,
+                              symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_switch_case_list (const tree_switch_case_list&);
+
+  tree_switch_case_list& operator = (const tree_switch_case_list&);
+};
+
+class
+tree_switch_command : public tree_command
+{
+public:
+
+  tree_switch_command (int l = -1, int c = -1)
+    : tree_command (l, c), expr (0), list (0), lead_comm (0),
+      trail_comm (0) { }
+
+  tree_switch_command (tree_expression *e, tree_switch_case_list *lst,
+                       octave_comment_list *lc, octave_comment_list *tc,
+                       int l = -1, int c = -1)
+    : tree_command (l, c), expr (e), list (lst), lead_comm (lc),
+      trail_comm (tc) { }
+
+  ~tree_switch_command (void);
+
+  tree_expression *switch_value (void) { return expr; }
+
+  tree_switch_case_list *case_list (void) { return list; }
+
+  octave_comment_list *leading_comment (void) { return lead_comm; }
+
+  octave_comment_list *trailing_comment (void) { return trail_comm; }
+
+  tree_command *dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // Value on which to switch.
+  tree_expression *expr;
+
+  // List of cases (case 1, case 2, ..., default)
+  tree_switch_case_list *list;
+
+  // Comment preceding SWITCH token.
+  octave_comment_list *lead_comm;
+
+  // Comment preceding ENDSWITCH token.
+  octave_comment_list *trail_comm;
+
+  // No copying!
+
+  tree_switch_command (const tree_switch_command&);
+
+  tree_switch_command& operator = (const tree_switch_command&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-stmt.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,216 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <typeinfo>
+
+#include "quit.h"
+
+#include "defun.h"
+#include "error.h"
+#include "gripes.h"
+#include "ov.h"
+#include "oct-lvalue.h"
+#include "input.h"
+#include "pager.h"
+#include "pt-bp.h"
+#include "pt-cmd.h"
+#include "pt-id.h"
+#include "pt-idx.h"
+#include "pt-jump.h"
+#include "pt-pr-code.h"
+#include "pt-stmt.h"
+#include "pt-walk.h"
+#include "unwind-prot.h"
+#include "utils.h"
+#include "variables.h"
+
+// A list of commands to be executed.
+
+tree_statement::~tree_statement (void)
+{
+  delete cmd;
+  delete expr;
+  delete comm;
+}
+
+void
+tree_statement::set_print_flag (bool print_flag)
+{
+  if (expr)
+    expr->set_print_flag (print_flag);
+}
+
+bool
+tree_statement::print_result (void)
+{
+  return expr && expr->print_result ();
+}
+
+void
+tree_statement::set_breakpoint (void)
+{
+  if (cmd)
+    cmd->set_breakpoint ();
+  else if (expr)
+    expr->set_breakpoint ();
+}
+
+void
+tree_statement::delete_breakpoint (void)
+{
+  if (cmd)
+    cmd->delete_breakpoint ();
+  else if (expr)
+    expr->delete_breakpoint ();
+}
+
+bool
+tree_statement::is_breakpoint (void) const
+{
+  return cmd ? cmd->is_breakpoint () : (expr ? expr->is_breakpoint () : false);
+}
+
+int
+tree_statement::line (void) const
+{
+  return cmd ? cmd->line () : (expr ? expr->line () : -1);
+}
+
+int
+tree_statement::column (void) const
+{
+  return cmd ? cmd->column () : (expr ? expr->column () : -1);
+}
+
+void
+tree_statement::echo_code (void)
+{
+  tree_print_code tpc (octave_stdout, VPS4);
+
+  accept (tpc);
+}
+
+bool
+tree_statement::is_end_of_fcn_or_script (void) const
+{
+  bool retval = false;
+
+  if (cmd)
+    {
+      tree_no_op_command *no_op_cmd
+        = dynamic_cast<tree_no_op_command *> (cmd);
+
+      if (no_op_cmd)
+        retval = no_op_cmd->is_end_of_fcn_or_script ();
+    }
+
+  return retval;
+}
+
+tree_statement *
+tree_statement::dup (symbol_table::scope_id scope,
+                     symbol_table::context_id context) const
+{
+  tree_statement *new_stmt = new tree_statement ();
+
+  new_stmt->cmd = cmd ? cmd->dup (scope, context) : 0;
+
+  new_stmt->expr = expr ? expr->dup (scope, context) : 0;
+
+  new_stmt->comm = comm ? comm->dup () : 0;
+
+  return new_stmt;
+}
+
+void
+tree_statement::accept (tree_walker& tw)
+{
+  tw.visit_statement (*this);
+}
+
+int
+tree_statement_list::set_breakpoint (int line)
+{
+  tree_breakpoint tbp (line, tree_breakpoint::set);
+  accept (tbp);
+
+  return tbp.get_line ();
+}
+
+void
+tree_statement_list::delete_breakpoint (int line)
+{
+  if (line < 0)
+    {
+      octave_value_list bp_lst = list_breakpoints ();
+
+      int len = bp_lst.length ();
+
+      for (int i = 0; i < len; i++)
+        {
+          tree_breakpoint tbp (i, tree_breakpoint::clear);
+          accept (tbp);
+        }
+    }
+  else
+    {
+      tree_breakpoint tbp (line, tree_breakpoint::clear);
+      accept (tbp);
+    }
+}
+
+octave_value_list
+tree_statement_list::list_breakpoints (void)
+{
+  tree_breakpoint tbp (0, tree_breakpoint::list);
+  accept (tbp);
+
+  return tbp.get_list ();
+}
+
+tree_statement_list *
+tree_statement_list::dup (symbol_table::scope_id scope,
+                          symbol_table::context_id context) const
+{
+  tree_statement_list *new_list = new tree_statement_list ();
+
+  new_list->function_body = function_body;
+
+  for (const_iterator p = begin (); p != end (); p++)
+    {
+      const tree_statement *elt = *p;
+
+      new_list->append (elt ? elt->dup (scope, context) : 0);
+    }
+
+  return new_list;
+}
+
+void
+tree_statement_list::accept (tree_walker& tw)
+{
+  tw.visit_statement_list (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-stmt.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,186 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_stmt_h)
+#define octave_tree_stmt_h 1
+
+class octave_value_list;
+
+class tree_command;
+class tree_expression;
+
+class tree_walker;
+
+#include <deque>
+
+#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 : public tree
+{
+public:
+
+  tree_statement (void)
+    : cmd (0), expr (0), comm (0) { }
+
+  tree_statement (tree_command *c, octave_comment_list *cl)
+    : cmd (c), expr (0), comm (cl) { }
+
+  tree_statement (tree_expression *e, octave_comment_list *cl)
+    : cmd (0), expr (e), comm (cl) { }
+
+  ~tree_statement (void);
+
+  void set_print_flag (bool print_flag);
+
+  bool print_result (void);
+
+  bool is_command (void) const { return cmd != 0; }
+
+  bool is_expression (void) const { return expr != 0; }
+
+  void set_breakpoint (void);
+
+  void delete_breakpoint (void);
+
+  bool is_breakpoint (void) const;
+
+  int line (void) const;
+  int column (void) const;
+
+  void echo_code (void);
+
+  tree_command *command (void) { return cmd; }
+
+  tree_expression *expression (void) { return expr; }
+
+  octave_comment_list *comment_text (void) { return comm; }
+
+  bool is_null_statement (void) const { return ! (cmd || expr || comm); }
+
+  bool is_end_of_fcn_or_script (void) const;
+
+  // Allow modification of this statement.  Note that there is no
+  // checking.  If you use these, are you sure you knwo what you are
+  // doing?
+
+  void set_command (tree_command *c) { cmd = c; }
+
+  void set_expression (tree_expression *e) { expr = e; }
+
+  tree_statement *dup (symbol_table::scope_id scope,
+                       symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // Only one of cmd or expr can be valid at once.
+
+  // Command to execute.
+  tree_command *cmd;
+
+  // Expression to evaluate.
+  tree_expression *expr;
+
+  // Comment associated with this statement.
+  octave_comment_list *comm;
+
+  // No copying!
+  tree_statement (const tree_statement&);
+
+  tree_statement& operator = (const tree_statement&);
+};
+
+// A list of statements to evaluate.
+
+class
+tree_statement_list : public octave_base_list<tree_statement *>
+{
+public:
+
+  tree_statement_list (void)
+    : function_body (false), anon_function_body (false),
+      script_body (false) { }
+
+  tree_statement_list (tree_statement *s)
+    : function_body (false), anon_function_body (false),
+      script_body (false) { append (s); }
+
+  ~tree_statement_list (void)
+    {
+      while (! empty ())
+        {
+          iterator p = begin ();
+          delete *p;
+          erase (p);
+        }
+    }
+
+  void mark_as_function_body (void) { function_body = true; }
+
+  void mark_as_anon_function_body (void) { anon_function_body = true; }
+
+  void mark_as_script_body (void) { script_body = true; }
+
+  bool is_function_body (void) const { return function_body; }
+
+  bool is_anon_function_body (void) const { return anon_function_body; }
+
+  bool is_script_body (void) const { return script_body; }
+
+  int set_breakpoint (int line);
+
+  void delete_breakpoint (int line);
+
+  octave_value_list list_breakpoints (void);
+
+  tree_statement_list *dup (symbol_table::scope_id scope,
+                            symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // Does this list of statements make up the body of a function?
+  bool function_body;
+
+  // Does this list of statements make up the body of a function?
+  bool anon_function_body;
+
+  // Does this list of statements make up the body of a script?
+  bool script_body;
+
+  // No copying!
+
+  tree_statement_list (const tree_statement_list&);
+
+  tree_statement_list& operator = (const tree_statement_list&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-unop.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,208 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "error.h"
+#include "oct-obj.h"
+#include "oct-lvalue.h"
+#include "ov.h"
+#include "profiler.h"
+#include "pt-bp.h"
+#include "pt-unop.h"
+#include "pt-walk.h"
+
+// Unary expressions.
+
+std::string
+tree_unary_expression::oper (void) const
+{
+  return octave_value::unary_op_as_string (etype);
+}
+
+// Prefix expressions.
+
+octave_value_list
+tree_prefix_expression::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("prefix operator `%s': invalid number of output arguments",
+           oper () . c_str ());
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+octave_value
+tree_prefix_expression::rvalue1 (int)
+{
+  octave_value retval;
+
+  if (error_state)
+    return retval;
+
+  if (op)
+    {
+      if (etype == octave_value::op_incr || etype == octave_value::op_decr)
+        {
+          octave_lvalue ref = op->lvalue ();
+
+          if (! error_state)
+            {
+              BEGIN_PROFILER_BLOCK ("prefix " + oper ())
+
+              ref.do_unary_op (etype);
+
+              if (! error_state)
+                retval = ref.value ();
+
+              END_PROFILER_BLOCK
+            }
+        }
+      else
+        {
+          octave_value val = op->rvalue1 ();
+
+          if (! error_state && val.is_defined ())
+            {
+              BEGIN_PROFILER_BLOCK ("prefix " + oper ())
+
+              // Attempt to do the operation in-place if it is unshared
+              // (a temporary expression).
+              if (val.get_count () == 1)
+                retval = val.do_non_const_unary_op (etype);
+              else
+                retval = ::do_unary_op (etype, val);
+
+              if (error_state)
+                retval = octave_value ();
+
+              END_PROFILER_BLOCK
+            }
+        }
+    }
+
+  return retval;
+}
+
+tree_expression *
+tree_prefix_expression::dup (symbol_table::scope_id scope,
+                             symbol_table::context_id context) const
+{
+  tree_prefix_expression *new_pe
+    = new tree_prefix_expression (op ? op->dup (scope, context) : 0,
+                                  line (), column (), etype);
+
+  new_pe->copy_base (*this);
+
+  return new_pe;
+}
+
+void
+tree_prefix_expression::accept (tree_walker& tw)
+{
+  tw.visit_prefix_expression (*this);
+}
+
+// Postfix expressions.
+
+octave_value_list
+tree_postfix_expression::rvalue (int nargout)
+{
+  octave_value_list retval;
+
+  if (nargout > 1)
+    error ("postfix operator `%s': invalid number of output arguments",
+           oper () . c_str ());
+  else
+    retval = rvalue1 (nargout);
+
+  return retval;
+}
+
+octave_value
+tree_postfix_expression::rvalue1 (int)
+{
+  octave_value retval;
+
+  if (error_state)
+    return retval;
+
+  if (op)
+    {
+      if (etype == octave_value::op_incr || etype == octave_value::op_decr)
+        {
+          octave_lvalue ref = op->lvalue ();
+
+          if (! error_state)
+            {
+              retval = ref.value ();
+
+              BEGIN_PROFILER_BLOCK ("postfix " + oper ())
+              ref.do_unary_op (etype);
+              END_PROFILER_BLOCK
+            }
+        }
+      else
+        {
+          octave_value val = op->rvalue1 ();
+
+          if (! error_state && val.is_defined ())
+            {
+              BEGIN_PROFILER_BLOCK ("postfix " + oper ())
+
+              retval = ::do_unary_op (etype, val);
+
+              if (error_state)
+                retval = octave_value ();
+
+              END_PROFILER_BLOCK
+            }
+        }
+    }
+
+  return retval;
+}
+
+tree_expression *
+tree_postfix_expression::dup (symbol_table::scope_id scope,
+                              symbol_table::context_id context) const
+{
+  tree_postfix_expression *new_pe
+    = new tree_postfix_expression (op ? op->dup (scope, context) : 0,
+                                   line (), column (), etype);
+
+  new_pe->copy_base (*this);
+
+  return new_pe;
+}
+
+void
+tree_postfix_expression::accept (tree_walker& tw)
+{
+  tw.visit_postfix_expression (*this);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-unop.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,157 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_unop_h)
+#define octave_tree_unop_h 1
+
+#include <string>
+
+class tree_walker;
+
+class octave_value;
+class octave_value_list;
+class octave_lvalue;
+
+#include "pt-exp.h"
+#include "symtab.h"
+
+// Unary expressions.
+
+class
+tree_unary_expression : public tree_expression
+{
+public:
+
+  tree_unary_expression (int l = -1, int c = -1,
+                         octave_value::unary_op t
+                           = octave_value::unknown_unary_op)
+    : tree_expression (l, c), op (0), etype (t)  { }
+
+  tree_unary_expression (tree_expression *e, int l = -1, int c = -1,
+                         octave_value::unary_op t
+                           = octave_value::unknown_unary_op)
+    : tree_expression (l, c), op (e), etype (t) { }
+
+  ~tree_unary_expression (void) { delete op; }
+
+  bool is_unary_expression (void) const { return true; }
+
+  bool has_magic_end (void) const { return (op && op->has_magic_end ()); }
+
+  tree_expression *operand (void) { return op; }
+
+  std::string oper (void) const;
+
+  octave_value::unary_op op_type (void) const { return etype; }
+
+protected:
+
+  // The operand for the expression.
+  tree_expression *op;
+
+  // The type of the expression.
+  octave_value::unary_op etype;
+
+private:
+
+  // No copying!
+
+  tree_unary_expression (const tree_unary_expression&);
+
+  tree_unary_expression& operator = (const tree_unary_expression&);
+};
+
+// Prefix expressions.
+
+class
+tree_prefix_expression : public tree_unary_expression
+{
+public:
+
+  tree_prefix_expression (int l = -1, int c = -1)
+    : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
+
+  tree_prefix_expression (tree_expression *e, int l = -1, int c = -1,
+                          octave_value::unary_op t
+                            = octave_value::unknown_unary_op)
+    : tree_unary_expression (e, l, c, t) { }
+
+  ~tree_prefix_expression (void) { }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_prefix_expression (const tree_prefix_expression&);
+
+  tree_prefix_expression& operator = (const tree_prefix_expression&);
+};
+
+// Postfix expressions.
+
+class
+tree_postfix_expression : public tree_unary_expression
+{
+public:
+
+  tree_postfix_expression (int l = -1, int c = -1)
+    : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
+
+  tree_postfix_expression (tree_expression *e, int l = -1, int c = -1,
+                           octave_value::unary_op t
+                             = octave_value::unknown_unary_op)
+    : tree_unary_expression (e, l, c, t) { }
+
+  ~tree_postfix_expression (void) { }
+
+  bool rvalue_ok (void) const { return true; }
+
+  octave_value rvalue1 (int nargout = 1);
+
+  octave_value_list rvalue (int nargout);
+
+  tree_expression *dup (symbol_table::scope_id scope,
+                        symbol_table::context_id context) const;
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // No copying!
+
+  tree_postfix_expression (const tree_postfix_expression&);
+
+  tree_postfix_expression& operator = (const tree_postfix_expression&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt-walk.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,211 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_walker_h)
+#define octave_tree_walker_h 1
+
+class tree_anon_fcn_handle;
+class tree_argument_list;
+class tree_binary_expression;
+class tree_break_command;
+class tree_colon_expression;
+class tree_continue_command;
+class tree_global_command;
+class tree_persistent_command;
+class tree_decl_elt;
+class tree_decl_init_list;
+class tree_simple_for_command;
+class tree_complex_for_command;
+class octave_user_script;
+class octave_user_function;
+class tree_function_def;
+class tree_identifier;
+class tree_if_clause;
+class tree_if_command;
+class tree_if_command_list;
+class tree_switch_case;
+class tree_switch_case_list;
+class tree_switch_command;
+class tree_index_expression;
+class tree_matrix;
+class tree_cell;
+class tree_multi_assignment;
+class tree_no_op_command;
+class tree_constant;
+class tree_fcn_handle;
+class tree_parameter_list;
+class tree_postfix_expression;
+class tree_prefix_expression;
+class tree_return_command;
+class tree_return_list;
+class tree_simple_assignment;
+class tree_statement;
+class tree_statement_list;
+class tree_try_catch_command;
+class tree_unwind_protect_command;
+class tree_while_command;
+class tree_do_until_command;
+
+class
+tree_walker
+{
+public:
+
+  virtual void
+  visit_anon_fcn_handle (tree_anon_fcn_handle&) = 0;
+
+  virtual void
+  visit_argument_list (tree_argument_list&) = 0;
+
+  virtual void
+  visit_binary_expression (tree_binary_expression&) = 0;
+
+  virtual void
+  visit_break_command (tree_break_command&) = 0;
+
+  virtual void
+  visit_colon_expression (tree_colon_expression&) = 0;
+
+  virtual void
+  visit_continue_command (tree_continue_command&) = 0;
+
+  virtual void
+  visit_global_command (tree_global_command&) = 0;
+
+  virtual void
+  visit_persistent_command (tree_persistent_command&) = 0;
+
+  virtual void
+  visit_decl_elt (tree_decl_elt&) = 0;
+
+  virtual void
+  visit_decl_init_list (tree_decl_init_list&) = 0;
+
+  virtual void
+  visit_simple_for_command (tree_simple_for_command&) = 0;
+
+  virtual void
+  visit_complex_for_command (tree_complex_for_command&) = 0;
+
+  virtual void
+  visit_octave_user_script (octave_user_script&) = 0;
+
+  virtual void
+  visit_octave_user_function (octave_user_function&) = 0;
+
+  virtual void
+  visit_function_def (tree_function_def&) = 0;
+
+  virtual void
+  visit_identifier (tree_identifier&) = 0;
+
+  virtual void
+  visit_if_clause (tree_if_clause&) = 0;
+
+  virtual void
+  visit_if_command (tree_if_command&) = 0;
+
+  virtual void
+  visit_if_command_list (tree_if_command_list&) = 0;
+
+  virtual void
+  visit_switch_case (tree_switch_case&) = 0;
+
+  virtual void
+  visit_switch_case_list (tree_switch_case_list&) = 0;
+
+  virtual void
+  visit_switch_command (tree_switch_command&) = 0;
+
+  virtual void
+  visit_index_expression (tree_index_expression&) = 0;
+
+  virtual void
+  visit_matrix (tree_matrix&) = 0;
+
+  virtual void
+  visit_cell (tree_cell&) = 0;
+
+  virtual void
+  visit_multi_assignment (tree_multi_assignment&) = 0;
+
+  virtual void
+  visit_no_op_command (tree_no_op_command&) = 0;
+
+  virtual void
+  visit_constant (tree_constant&) = 0;
+
+  virtual void
+  visit_fcn_handle (tree_fcn_handle&) = 0;
+
+  virtual void
+  visit_parameter_list (tree_parameter_list&) = 0;
+
+  virtual void
+  visit_postfix_expression (tree_postfix_expression&) = 0;
+
+  virtual void
+  visit_prefix_expression (tree_prefix_expression&) = 0;
+
+  virtual void
+  visit_return_command (tree_return_command&) = 0;
+
+  virtual void
+  visit_return_list (tree_return_list&) = 0;
+
+  virtual void
+  visit_simple_assignment (tree_simple_assignment&) = 0;
+
+  virtual void
+  visit_statement (tree_statement&) = 0;
+
+  virtual void
+  visit_statement_list (tree_statement_list&) = 0;
+
+  virtual void
+  visit_try_catch_command (tree_try_catch_command&) = 0;
+
+  virtual void
+  visit_unwind_protect_command (tree_unwind_protect_command&) = 0;
+
+  virtual void
+  visit_while_command (tree_while_command&) = 0;
+
+  virtual void
+  visit_do_until_command (tree_do_until_command&) = 0;
+
+protected:
+
+  tree_walker (void) { }
+
+  virtual ~tree_walker (void) { }
+
+private:
+
+  // No copying!
+
+  tree_walker (const tree_walker&);
+
+  tree_walker& operator = (const tree_walker&);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,50 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <sstream>
+#include <string>
+
+#include "ov-fcn.h"
+#include "pt.h"
+#include "pt-pr-code.h"
+
+// Hide the details of the string buffer so that we are less likely to
+// create a memory leak.
+
+std::string
+tree::str_print_code (void)
+{
+  std::ostringstream buf;
+
+  tree_print_code tpc (buf);
+
+  accept (tpc);
+
+  std::string retval = buf.str ();
+
+  return retval;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parse-tree/pt.h	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,80 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_tree_h)
+#define octave_tree_h 1
+
+#include <string>
+
+#include <iosfwd>
+
+class octave_function;
+class tree_walker;
+
+// Base class for the parse tree.
+
+class
+tree
+{
+public:
+
+  tree (int l = -1, int c = -1)
+    : line_num (l), column_num (c), bp (false) { }
+
+  virtual ~tree (void) { }
+
+  virtual int line (void) const { return line_num; }
+
+  virtual int column (void) const { return column_num; }
+
+  void line (int l) { line_num = l; }
+
+  void column (int c) { column_num = c; }
+
+  virtual void set_breakpoint (void) { bp = true; }
+
+  virtual void delete_breakpoint (void) { bp = false; }
+
+  bool is_breakpoint (void) const { return bp; }
+
+  std::string str_print_code (void);
+
+  virtual void accept (tree_walker& tw) = 0;
+
+private:
+
+  // The input line and column where we found the text that was
+  // eventually converted to this tree node.
+  int line_num;
+  int column_num;
+
+  // Breakpoint flag.
+  bool bp;
+
+  // No copying!
+
+  tree (const tree&);
+
+  tree& operator = (const tree&);
+};
+
+#endif
--- a/src/pt-all.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_all_h)
-#define octave_tree_all_h 1
-
-#include "pt.h"
-#include "pt-arg-list.h"
-#include "pt-assign.h"
-#include "pt-bp.h"
-#include "pt-binop.h"
-#include "pt-cbinop.h"
-#include "pt-check.h"
-#include "pt-cmd.h"
-#include "pt-colon.h"
-#include "pt-const.h"
-#include "pt-decl.h"
-#include "pt-except.h"
-#include "pt-exp.h"
-#include "pt-fcn-handle.h"
-#include "pt-id.h"
-#include "pt-idx.h"
-#include "pt-jump.h"
-#include "pt-loop.h"
-#include "pt-mat.h"
-#include "pt-cell.h"
-#include "pt-misc.h"
-#include "pt-pr-code.h"
-#include "pt-select.h"
-#include "pt-stmt.h"
-#include "pt-unop.h"
-#include "pt-pr-code.h"
-#include "pt-walk.h"
-
-#endif
--- a/src/pt-arg-list.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <string>
-
-#include "str-vec.h"
-
-#include "defun.h"
-#include "error.h"
-#include "oct-lvalue.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "ov-usr-fcn.h"
-#include "parse.h"
-#include "pt-arg-list.h"
-#include "pt-exp.h"
-#include "pt-id.h"
-#include "pt-pr-code.h"
-#include "pt-walk.h"
-#include "toplev.h"
-#include "unwind-prot.h"
-
-// Argument lists.
-
-tree_argument_list::~tree_argument_list (void)
-{
-  while (! empty ())
-    {
-      iterator p = begin ();
-      delete *p;
-      erase (p);
-    }
-}
-
-bool
-tree_argument_list::has_magic_end (void) const
-{
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      tree_expression *elt = *p;
-
-      if (elt && elt->has_magic_end ())
-        return true;
-    }
-
-  return false;
-}
-
-void
-tree_argument_list::append (const element_type& s)
-{
-  octave_base_list<tree_expression *>::append (s);
-
-  if (! list_includes_magic_end && s && s->has_magic_end ())
-    list_includes_magic_end = true;
-
-  if (! list_includes_magic_tilde && s && s->is_identifier ())
-    {
-      tree_identifier *id = dynamic_cast<tree_identifier *> (s);
-      list_includes_magic_tilde = id && id->is_black_hole ();
-    }
-}
-
-bool
-tree_argument_list::all_elements_are_constant (void) const
-{
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      tree_expression *elt = *p;
-
-      if (! elt->is_constant ())
-        return false;
-    }
-
-  return true;
-}
-
-static const octave_value *indexed_object = 0;
-static int index_position = 0;
-static int num_indices = 0;
-
-DEFCONSTFUN (__end__, , ,
-  "internal function")
-{
-  octave_value retval;
-
-  if (indexed_object)
-    {
-      if (indexed_object->is_object ())
-        {
-          octave_value_list args;
-
-          args(2) = num_indices;
-          args(1) = index_position + 1;
-          args(0) = *indexed_object;
-
-          std::string class_name = indexed_object->class_name ();
-
-          octave_value meth = symbol_table::find_method ("end", class_name);
-
-          if (meth.is_defined ())
-            return feval (meth.function_value (), args, 1);
-        }
-
-      dim_vector dv = indexed_object->dims ();
-      int ndims = dv.length ();
-
-      if (num_indices < ndims)
-        {
-          for (int i = num_indices; i < ndims; i++)
-            dv(num_indices-1) *= dv(i);
-
-          if (num_indices == 1)
-            {
-              ndims = 2;
-              dv.resize (ndims);
-              dv(1) = 1;
-            }
-          else
-            {
-              ndims = num_indices;
-              dv.resize (ndims);
-            }
-        }
-
-      if (index_position < ndims)
-        retval = dv(index_position);
-      else
-        retval = 1;
-    }
-  else
-    ::error ("invalid use of end");
-
-  return retval;
-}
-
-octave_value_list
-tree_argument_list::convert_to_const_vector (const octave_value *object)
-{
-  // END doesn't make sense for functions.  Maybe we need a different
-  // way of asking an octave_value object this question?
-
-  bool stash_object = (list_includes_magic_end
-                       && object
-                       && ! (object->is_function ()
-                             || object->is_function_handle ()));
-
-  unwind_protect frame;
-
-  if (stash_object)
-    {
-      frame.protect_var (indexed_object);
-
-      indexed_object = object;
-    }
-
-  int len = length ();
-
-  std::list<octave_value_list> args;
-
-  iterator p = begin ();
-  for (int k = 0; k < len; k++)
-    {
-      if (stash_object)
-        {
-          frame.protect_var (index_position);
-          frame.protect_var (num_indices);
-
-          index_position = k;
-          num_indices = len;
-        }
-
-      tree_expression *elt = *p++;
-
-      if (elt)
-        {
-          octave_value tmp = elt->rvalue1 ();
-
-          if (error_state)
-            {
-              ::error ("evaluating argument list element number %d", k+1);
-              args.clear ();
-              break;
-            }
-          else
-            {
-              if (tmp.is_cs_list ())
-                args.push_back (tmp.list_value ());
-              else if (tmp.is_defined ())
-                args.push_back (tmp);
-            }
-        }
-      else
-        {
-          args.push_back (octave_value ());
-          break;
-        }
-    }
-
-  return args;
-}
-
-std::list<octave_lvalue>
-tree_argument_list::lvalue_list (void)
-{
-  std::list<octave_lvalue> retval;
-
-  for (tree_argument_list::iterator p = begin ();
-       p != end ();
-       p++)
-    {
-      tree_expression *elt = *p;
-
-      retval.push_back (elt->lvalue ());
-    }
-
-  return retval;
-}
-
-string_vector
-tree_argument_list::get_arg_names (void) const
-{
-  int len = length ();
-
-  string_vector retval (len);
-
-  int k = 0;
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      tree_expression *elt = *p;
-
-      retval(k++) = elt->str_print_code ();
-    }
-
-  return retval;
-}
-
-tree_argument_list *
-tree_argument_list::dup (symbol_table::scope_id scope,
-                         symbol_table::context_id context) const
-{
-  tree_argument_list *new_list = new tree_argument_list ();
-
-  new_list->list_includes_magic_end = list_includes_magic_end;
-  new_list->simple_assign_lhs = simple_assign_lhs;
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_expression *elt = *p;
-
-      new_list->append (elt ? elt->dup (scope, context) : 0);
-    }
-
-  return new_list;
-}
-
-void
-tree_argument_list::accept (tree_walker& tw)
-{
-  tw.visit_argument_list (*this);
-}
--- a/src/pt-arg-list.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_arg_list_h)
-#define octave_tree_arg_list_h 1
-
-#include <list>
-
-class octave_value_list;
-class octave_lvalue;
-class tree_expression;
-class tree_walker;
-
-#include "str-vec.h"
-
-#include "base-list.h"
-
-// Argument lists.  Used to hold the list of expressions that are the
-// arguments in a function call or index expression.
-
-class
-tree_argument_list : public octave_base_list<tree_expression *>
-{
-public:
-
-  typedef tree_expression* element_type;
-
-  tree_argument_list (void)
-    : list_includes_magic_end (false), list_includes_magic_tilde (false),
-    simple_assign_lhs (false) { }
-
-  tree_argument_list (tree_expression *t)
-    : list_includes_magic_end (false), list_includes_magic_tilde (false),
-    simple_assign_lhs (false)
-  { append (t); }
-
-  ~tree_argument_list (void);
-
-  bool has_magic_end (void) const;
-
-  bool has_magic_tilde (void) const
-    { return list_includes_magic_tilde; }
-
-  tree_expression *remove_front (void)
-    {
-      iterator p = begin ();
-      tree_expression *retval = *p;
-      erase (p);
-      return retval;
-    }
-
-  void append (const element_type& s);
-
-  void mark_as_simple_assign_lhs (void) { simple_assign_lhs = true; }
-
-  bool is_simple_assign_lhs (void) { return simple_assign_lhs; }
-
-  bool all_elements_are_constant (void) const;
-
-  octave_value_list convert_to_const_vector (const octave_value *object = 0);
-
-  std::list<octave_lvalue> lvalue_list (void);
-
-  string_vector get_arg_names (void) const;
-
-  tree_argument_list *dup (symbol_table::scope_id scope,
-                           symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  bool list_includes_magic_end;
-
-  bool list_includes_magic_tilde;
-
-  bool simple_assign_lhs;
-
-  // No copying!
-
-  tree_argument_list (const tree_argument_list&);
-
-  tree_argument_list& operator = (const tree_argument_list&);
-};
-
-#endif
--- a/src/pt-assign.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,530 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <set>
-
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "input.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "pager.h"
-#include "ov.h"
-#include "pt-arg-list.h"
-#include "pt-bp.h"
-#include "pt-assign.h"
-#include "pt-walk.h"
-#include "utils.h"
-#include "variables.h"
-
-// Simple assignment expressions.
-
-// FIXME -- the following variable and the function that uses it
-// should be removed from some future version of Octave.
-
-static const char *former_built_in_variables[] =
-{
-  "DEFAULT_EXEC_PATH",
-  "DEFAULT_LOADPATH",
-  "EDITOR",
-  "EXEC_PATH",
-  "FFTW_WISDOM_PROGRAM",
-  "IMAGEPATH",
-  "INFO_FILE",
-  "INFO_PROGRAM",
-  "LOADPATH",
-  "MAKEINFO_PROGRAM",
-  "PAGER",
-  "PS1",
-  "PS2",
-  "PS4",
-  "__kluge_procbuf_delay__",
-  "automatic_replot",
-  "beep_on_error",
-  "completion_append_char",
-  "crash_dumps_octave_core",
-  "current_script_file_name",
-  "debug_on_error",
-  "debug_on_interrupt",
-  "debug_on_warning",
-  "debug_symtab_lookups",
-  "default_save_options",
-  "echo_executing_commands",
-  "fixed_point_format",
-  "gnuplot_binary",
-  "gnuplot_command_axes",
-  "gnuplot_command_end",
-  "gnuplot_command_plot",
-  "gnuplot_command_replot",
-  "gnuplot_command_splot",
-  "gnuplot_command_title",
-  "gnuplot_command_using",
-  "gnuplot_command_with",
-  "gnuplot_has_frames",
-  "history_file",
-  "history_size",
-  "ignore_function_time_stamp",
-  "max_recursion_depth",
-  "octave_core_file_format",
-  "octave_core_file_limit",
-  "octave_core_file_name",
-  "output_max_field_width",
-  "output_precision",
-  "page_output_immediately",
-  "page_screen_output",
-  "print_answer_id_name",
-  "print_empty_dimensions",
-  "print_rhs_assign_val",
-  "save_header_format_string",
-  "save_precision",
-  "saving_history",
-  "sighup_dumps_octave_core",
-  "sigterm_dumps_octave_core",
-  "silent_functions",
-  "split_long_rows",
-  "string_fill_char",
-  "struct_levels_to_print",
-  "suppress_verbose_help_message",
-  "variables_can_hide_functions",
-  "warn_assign_as_truth_value",
-  "warn_associativity_change",
-  "warn_divide_by_zero",
-  "warn_empty_list_elements",
-  "warn_fortran_indexing",
-  "warn_function_name_clash",
-  "warn_future_time_stamp",
-  "warn_imag_to_real",
-  "warn_matlab_incompatible",
-  "warn_missing_semicolon",
-  "warn_neg_dim_as_zero",
-  "warn_num_to_str",
-  "warn_precedence_change",
-  "warn_reload_forces_clear",
-  "warn_resize_on_range_error",
-  "warn_separator_insert",
-  "warn_single_quote_string",
-  "warn_str_to_num",
-  "warn_undefined_return_values",
-  "warn_variable_switch_label",
-  "whos_line_format",
-  0,
-};
-
-static void
-maybe_warn_former_built_in_variable (const std::string& nm)
-{
-  static bool initialized = false;
-
-  static std::set<std::string> vars;
-
-  if (! initialized)
-    {
-      const char **p = former_built_in_variables;
-
-      while (*p)
-        vars.insert (*p++);
-
-      initialized = true;
-    }
-
-  if (vars.find (nm) != vars.end ())
-    {
-      const char *nm_c_str = nm.c_str ();
-
-      warning_with_id ("Octave:built-in-variable-assignment",
-                       "\
-In recent versions of Octave, %s is a function instead\n\
-of a built-in variable.\n\n\
-By assigning to %s, you have created a variable that hides\n\
-the function %s. To remove the variable and restore the \n\
-function, type \"clear %s\"\n",
-                       nm_c_str, nm_c_str, nm_c_str, nm_c_str);
-    }
-}
-
-tree_simple_assignment::tree_simple_assignment
-  (tree_expression *le, tree_expression *re,
-   bool plhs, int l, int c, octave_value::assign_op t)
-    : tree_expression (l, c), lhs (le), rhs (re), preserve (plhs), etype (t),
-      first_execution (true) { }
-
-tree_simple_assignment::~tree_simple_assignment (void)
-{
-  if (! preserve)
-    delete lhs;
-
-  delete rhs;
-}
-
-octave_value_list
-tree_simple_assignment::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("invalid number of output arguments for expression X = RHS");
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-octave_value
-tree_simple_assignment::rvalue1 (int)
-{
-  octave_value retval;
-
-  if (first_execution && lhs)
-    maybe_warn_former_built_in_variable (lhs->name ());
-
-  if (error_state)
-    return retval;
-
-  if (rhs)
-    {
-      octave_value rhs_val = rhs->rvalue1 ();
-
-      if (! error_state)
-        {
-          if (rhs_val.is_undefined ())
-            {
-              error ("value on right hand side of assignment is undefined");
-              return retval;
-            }
-          else
-            {
-              if (rhs_val.is_cs_list ())
-                {
-                  const octave_value_list lst = rhs_val.list_value ();
-
-                  if (! lst.empty ())
-                    rhs_val = lst(0);
-                  else
-                    {
-                      error ("invalid number of elements on RHS of assignment");
-                      return retval;
-                    }
-                }
-
-              octave_lvalue ult = lhs->lvalue ();
-
-              if (ult.numel () != 1)
-                gripe_nonbraced_cs_list_assignment ();
-
-              if (! error_state)
-                {
-                  ult.assign (etype, rhs_val);
-
-                  if (! error_state)
-                    {
-                      if (etype == octave_value::op_asn_eq)
-                        retval = rhs_val;
-                      else
-                        retval = ult.value ();
-
-                      if (print_result ())
-                        {
-                          // We clear any index here so that we can
-                          // get the new value of the referenced
-                          // object below, instead of the indexed
-                          // value (which should be the same as the
-                          // right hand side value).
-
-                          ult.clear_index ();
-
-                          octave_value lhs_val = ult.value ();
-
-                          if (! error_state)
-                            lhs_val.print_with_name (octave_stdout,
-                                                     lhs->name ());
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-  first_execution = false;
-
-  return retval;
-}
-
-std::string
-tree_simple_assignment::oper (void) const
-{
-  return octave_value::assign_op_as_string (etype);
-}
-
-tree_expression *
-tree_simple_assignment::dup (symbol_table::scope_id scope,
-                             symbol_table::context_id context) const
-{
-  tree_simple_assignment *new_sa
-    = new tree_simple_assignment (lhs ? lhs->dup (scope, context) : 0,
-                                  rhs ? rhs->dup (scope, context) : 0,
-                                  preserve, etype);
-
-  new_sa->copy_base (*this);
-
-  return new_sa;
-}
-
-void
-tree_simple_assignment::accept (tree_walker& tw)
-{
-  tw.visit_simple_assignment (*this);
-}
-
-// Multi-valued assignment expressions.
-
-tree_multi_assignment::tree_multi_assignment
-  (tree_argument_list *lst, tree_expression *r,
-   bool plhs, int l, int c)
-    : tree_expression (l, c), lhs (lst), rhs (r), preserve (plhs),
-      first_execution (true) { }
-
-tree_multi_assignment::~tree_multi_assignment (void)
-{
-  if (! preserve)
-    delete lhs;
-
-  delete rhs;
-}
-
-octave_value
-tree_multi_assignment::rvalue1 (int nargout)
-{
-  octave_value retval;
-
-  const octave_value_list tmp = rvalue (nargout);
-
-  if (! tmp.empty ())
-    retval = tmp(0);
-
-  return retval;
-}
-
-// FIXME -- this works, but it would look a little better if
-// it were broken up into a couple of separate functions.
-
-octave_value_list
-tree_multi_assignment::rvalue (int)
-{
-  octave_value_list retval;
-
-  if (error_state)
-    return retval;
-
-  if (first_execution)
-    {
-      for (tree_argument_list::iterator p = lhs->begin (); p != lhs->end (); p++)
-        {
-          tree_expression *lhs_expr = *p;
-
-          if (lhs_expr)
-            maybe_warn_former_built_in_variable (lhs_expr->name ());
-        }
-    }
-
-  if (rhs)
-    {
-      std::list<octave_lvalue> lvalue_list = lhs->lvalue_list ();
-
-      if (error_state)
-        return retval;
-
-      octave_idx_type n_out = 0;
-
-      for (std::list<octave_lvalue>::const_iterator p = lvalue_list.begin ();
-           p != lvalue_list.end ();
-           p++)
-        n_out += p->numel ();
-
-      // The following trick is used to keep rhs_val constant.
-      const octave_value_list rhs_val1 = rhs->rvalue (n_out, &lvalue_list);
-      const octave_value_list rhs_val = (rhs_val1.length () == 1 && rhs_val1(0).is_cs_list ()
-                                         ? rhs_val1(0).list_value () : rhs_val1);
-
-      if (error_state)
-        return retval;
-
-      octave_idx_type k = 0;
-
-      octave_idx_type n = rhs_val.length ();
-
-      // To avoid copying per elements and possible optimizations, we
-      // postpone joining the final values.
-      std::list<octave_value_list> retval_list;
-
-      tree_argument_list::iterator q = lhs->begin ();
-
-      for (std::list<octave_lvalue>::iterator p = lvalue_list.begin ();
-           p != lvalue_list.end ();
-           p++)
-        {
-          tree_expression *lhs_elt = *q++;
-
-          octave_lvalue ult = *p;
-
-          octave_idx_type nel = ult.numel ();
-
-          if (nel != 1)
-            {
-              if (k + nel <= n)
-                {
-                  // This won't do a copy.
-                  octave_value_list ovl  = rhs_val.slice (k, nel);
-
-                  ult.assign (octave_value::op_asn_eq, octave_value (ovl, true));
-
-                  if (! error_state)
-                    {
-                      retval_list.push_back (ovl);
-
-                      k += nel;
-                    }
-                }
-              else
-                error ("some elements undefined in return list");
-            }
-          else
-            {
-              if (k < n)
-                {
-                  ult.assign (octave_value::op_asn_eq, rhs_val(k));
-
-                  if (ult.is_black_hole ())
-                    {
-                      k++;
-                      continue;
-                    }
-                  else if (! error_state)
-                    {
-                      retval_list.push_back (rhs_val(k));
-
-                      k++;
-                    }
-                }
-              else
-                {
-                  // This can happen for a function like
-                  //
-                  //   function varargout = f ()
-                  //     varargout{1} = nargout;
-                  //   endfunction
-                  //
-                  // called with
-                  //
-                  //    [a, ~] = f ();
-                  //
-                  // Then the list of of RHS values will contain one
-                  // element but we are iterating over the list of all
-                  // RHS values.  We shouldn't complain that a value we
-                  // don't need is missing from the list.
-
-                  if (ult.is_black_hole ())
-                    {
-                      k++;
-                      continue;
-                    }
-                  else
-                    error ("element number %d undefined in return list", k+1);
-                }
-            }
-
-          if (error_state)
-            break;
-          else if (print_result ())
-            {
-              // We clear any index here so that we can get
-              // the new value of the referenced object below,
-              // instead of the indexed value (which should be
-              // the same as the right hand side value).
-
-              ult.clear_index ();
-
-              octave_value lhs_val = ult.value ();
-
-              if (! error_state)
-                lhs_val.print_with_name (octave_stdout,
-                                         lhs_elt->name ());
-            }
-
-          if (error_state)
-            break;
-
-        }
-
-      // Concatenate return values.
-      retval = retval_list;
-
-    }
-
-  first_execution = false;
-
-  return retval;
-}
-
-/*
-%!function varargout = f ()
-%!  varargout{1} = nargout;
-%!endfunction
-%!
-%!test
-%! [a, ~] = f ();
-%! assert (a, 2);
-%!test
-%! [a, ~, ~, ~, ~] = f ();
-%! assert (a, 5);
-*/
-
-std::string
-tree_multi_assignment::oper (void) const
-{
-  return octave_value::assign_op_as_string (op_type ());
-}
-
-tree_expression *
-tree_multi_assignment::dup (symbol_table::scope_id scope,
-                            symbol_table::context_id context) const
-{
-  tree_multi_assignment *new_ma
-    = new tree_multi_assignment (lhs ? lhs->dup (scope, context) : 0,
-                                 rhs ? rhs->dup (scope, context) : 0,
-                                 preserve);
-
-  new_ma->copy_base (*this);
-
-  return new_ma;
-}
-
-void
-tree_multi_assignment::accept (tree_walker& tw)
-{
-  tw.visit_multi_assignment (*this);
-}
--- a/src/pt-assign.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_assign_h)
-#define octave_tree_assign_h 1
-
-#include <iosfwd>
-#include <string>
-
-class tree_argument_list;
-class tree_walker;
-
-class octave_value;
-class octave_value_list;
-class octave_lvalue;
-
-#include "ov.h"
-#include "pt-exp.h"
-#include "symtab.h"
-
-// Simple assignment expressions.
-
-class
-tree_simple_assignment : public tree_expression
-{
-public:
-
-  tree_simple_assignment (bool plhs = false, int l = -1, int c = -1,
-                          octave_value::assign_op t = octave_value::op_asn_eq)
-    : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), ans_ass (),
-      etype (t), first_execution (true) { }
-
-  tree_simple_assignment (tree_expression *le, tree_expression *re,
-                          bool plhs = false, int l = -1, int c = -1,
-                          octave_value::assign_op t = octave_value::op_asn_eq);
-
-  ~tree_simple_assignment (void);
-
-  bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  bool is_assignment_expression (void) const { return true; }
-
-  std::string oper (void) const;
-
-  tree_expression *left_hand_side (void) { return lhs; }
-
-  tree_expression *right_hand_side (void) { return rhs; }
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  octave_value::assign_op op_type (void) const { return etype; }
-
-private:
-
-  void do_assign (octave_lvalue& ult, const octave_value_list& args,
-                  const octave_value& rhs_val);
-
-  void do_assign (octave_lvalue& ult, const octave_value& rhs_val);
-
-  // The left hand side of the assignment.
-  tree_expression *lhs;
-
-  // The right hand side of the assignment.
-  tree_expression *rhs;
-
-  // True if we should not delete the lhs.
-  bool preserve;
-
-  // True if this is an assignment to the automatic variable ans.
-  bool ans_ass;
-
-  // The type of the expression.
-  octave_value::assign_op etype;
-
-  // true only on first rvalue() call.
-  bool first_execution;
-
-  // No copying!
-
-  tree_simple_assignment (const tree_simple_assignment&);
-
-  tree_simple_assignment& operator = (const tree_simple_assignment&);
-};
-
-// Multi-valued assignment expressions.
-
-class
-tree_multi_assignment : public tree_expression
-{
-public:
-
-  tree_multi_assignment (bool plhs = false, int l = -1, int c = -1)
-    : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs),
-      first_execution (true) { }
-
-  tree_multi_assignment (tree_argument_list *lst, tree_expression *r,
-                         bool plhs = false, int l = -1, int c = -1);
-
-  ~tree_multi_assignment (void);
-
-  bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); }
-
-  bool is_assignment_expression (void) const { return true; }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  std::string oper (void) const;
-
-  tree_argument_list *left_hand_side (void) { return lhs; }
-
-  tree_expression *right_hand_side (void) { return rhs; }
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  octave_value::assign_op op_type (void) const { return octave_value::op_asn_eq; }
-
-private:
-
-  // The left hand side of the assignment.
-  tree_argument_list *lhs;
-
-  // The right hand side of the assignment.
-  tree_expression *rhs;
-
-  // True if we should not delete the lhs.
-  bool preserve;
-
-  // true only on first rvalue() call.
-  bool first_execution;
-
-  // No copying!
-
-  tree_multi_assignment (const tree_multi_assignment&);
-
-  tree_multi_assignment& operator = (const tree_multi_assignment&);
-};
-
-#endif
--- a/src/pt-binop.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,315 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "defun.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "profiler.h"
-#include "pt-binop.h"
-#include "pt-bp.h"
-#include "pt-walk.h"
-#include "variables.h"
-
-// TRUE means we mark | and & expressions for braindead short-circuit
-// behavior.
-static bool Vdo_braindead_shortcircuit_evaluation;
-
-// Binary expressions.
-
-octave_value_list
-tree_binary_expression::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("binary operator `%s': invalid number of output arguments",
-           oper () . c_str ());
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-octave_value
-tree_binary_expression::rvalue1 (int)
-{
-  octave_value retval;
-
-  if (error_state)
-    return retval;
-
-  if (Vdo_braindead_shortcircuit_evaluation
-      && eligible_for_braindead_shortcircuit)
-    {
-      if (op_lhs)
-        {
-          octave_value a = op_lhs->rvalue1 ();
-
-          if (! error_state)
-            {
-              if (a.ndims () == 2 && a.rows () == 1 && a.columns () == 1)
-                {
-                  bool result = false;
-
-                  bool a_true = a.is_true ();
-
-                  if (! error_state)
-                    {
-                      if (a_true)
-                        {
-                          if (etype == octave_value::op_el_or)
-                            {
-                              result = true;
-                              goto done;
-                            }
-                        }
-                      else
-                        {
-                          if (etype == octave_value::op_el_and)
-                            goto done;
-                        }
-
-                      if (op_rhs)
-                        {
-                          octave_value b = op_rhs->rvalue1 ();
-
-                          if (! error_state)
-                            result = b.is_true ();
-                        }
-
-                    done:
-
-                      if (! error_state)
-                        return octave_value (result);
-                    }
-                }
-            }
-        }
-    }
-
-  if (op_lhs)
-    {
-      octave_value a = op_lhs->rvalue1 ();
-
-      if (! error_state && a.is_defined () && op_rhs)
-        {
-          octave_value b = op_rhs->rvalue1 ();
-
-          if (! error_state && b.is_defined ())
-            {
-              BEGIN_PROFILER_BLOCK ("binary " + oper ())
-
-              // Note: The profiler does not catch the braindead
-              // short-circuit evaluation code above, but that should be
-              // ok. The evaluation of operands and the operator itself
-              // is entangled and it's not clear where to start/stop
-              // timing the operator to make it reasonable.
-
-              retval = ::do_binary_op (etype, a, b);
-
-              if (error_state)
-                retval = octave_value ();
-
-              END_PROFILER_BLOCK
-            }
-        }
-    }
-
-  return retval;
-}
-
-std::string
-tree_binary_expression::oper (void) const
-{
-  return octave_value::binary_op_as_string (etype);
-}
-
-tree_expression *
-tree_binary_expression::dup (symbol_table::scope_id scope,
-                             symbol_table::context_id context) const
-{
-  tree_binary_expression *new_be
-    = new tree_binary_expression (op_lhs ? op_lhs->dup (scope, context) : 0,
-                                  op_rhs ? op_rhs->dup (scope, context) : 0,
-                                  line (), column (), etype);
-
-  new_be->copy_base (*this);
-
-  return new_be;
-}
-
-void
-tree_binary_expression::accept (tree_walker& tw)
-{
-  tw.visit_binary_expression (*this);
-}
-
-// Boolean expressions.
-
-octave_value_list
-tree_boolean_expression::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("binary operator `%s': invalid number of output arguments",
-           oper () . c_str ());
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-octave_value
-tree_boolean_expression::rvalue1 (int)
-{
-  octave_value retval;
-
-  if (error_state)
-    return retval;
-
-  bool result = false;
-
-  // This evaluation is not caught by the profiler, since we can't find
-  // a reasonable place where to time. Note that we don't want to
-  // include evaluation of LHS or RHS into the timing, but this is
-  // entangled together with short-circuit evaluation here.
-
-  if (op_lhs)
-    {
-      octave_value a = op_lhs->rvalue1 ();
-
-      if (! error_state)
-        {
-          bool a_true = a.is_true ();
-
-          if (! error_state)
-            {
-              if (a_true)
-                {
-                  if (etype == bool_or)
-                    {
-                      result = true;
-                      goto done;
-                    }
-                }
-              else
-                {
-                  if (etype == bool_and)
-                    goto done;
-                }
-
-              if (op_rhs)
-                {
-                  octave_value b = op_rhs->rvalue1 ();
-
-                  if (! error_state)
-                    result = b.is_true ();
-                }
-
-            done:
-
-              if (! error_state)
-                retval = octave_value (result);
-            }
-        }
-    }
-
-  return retval;
-}
-
-std::string
-tree_boolean_expression::oper (void) const
-{
-  std::string retval = "<unknown>";
-
-  switch (etype)
-    {
-    case bool_and:
-      retval = "&&";
-      break;
-
-    case bool_or:
-      retval = "||";
-      break;
-
-    default:
-      break;
-    }
-
-  return retval;
-}
-
-tree_expression *
-tree_boolean_expression::dup (symbol_table::scope_id scope,
-                              symbol_table::context_id context) const
-{
-  tree_boolean_expression *new_be
-    = new tree_boolean_expression (op_lhs ? op_lhs->dup (scope, context) : 0,
-                                   op_rhs ? op_rhs->dup (scope, context) : 0,
-                                   line (), column (), etype);
-
-  new_be->copy_base (*this);
-
-  return new_be;
-}
-
-DEFUN (do_braindead_shortcircuit_evaluation, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} do_braindead_shortcircuit_evaluation ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} do_braindead_shortcircuit_evaluation (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} do_braindead_shortcircuit_evaluation (@var{new_val}, \"local\")\n\
-Query or set the internal variable that controls whether Octave will\n\
-do short-circuit evaluation of @samp{|} and @samp{&} operators inside the\n\
-conditions of if or while statements.\n\
-\n\
-This feature is only provided for compatibility with @sc{matlab} and should\n\
-not be used unless you are porting old code that relies on this feature.\n\
-\n\
-To obtain short-circuit behavior for logical expressions in new programs,\n\
-you should always use the @samp{&&} and @samp{||} operators.\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE (do_braindead_shortcircuit_evaluation);
-}
-
-/*
-%!test
-%! x = 0;
-%! do_braindead_shortcircuit_evaluation (0);
-%! if (1 | (x = 1))
-%! endif
-%! assert (x, 1);
-%! do_braindead_shortcircuit_evaluation (1);
-%! if (1 | (x = 0))
-%! endif
-%! assert (x, 1);
-*/
--- a/src/pt-binop.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_binop_h)
-#define octave_tree_binop_h 1
-
-#include <string>
-
-class tree_walker;
-
-class octave_value;
-class octave_value_list;
-class octave_lvalue;
-
-#include "ov.h"
-#include "pt-exp.h"
-#include "symtab.h"
-
-// Binary expressions.
-
-class
-tree_binary_expression : public tree_expression
-{
-public:
-
-  tree_binary_expression (int l = -1, int c = -1,
-                          octave_value::binary_op t
-                            = octave_value::unknown_binary_op)
-    : tree_expression (l, c), op_lhs (0), op_rhs (0), etype (t),
-      eligible_for_braindead_shortcircuit (false) { }
-
-  tree_binary_expression (tree_expression *a, tree_expression *b,
-                          int l = -1, int c = -1,
-                          octave_value::binary_op t
-                            = octave_value::unknown_binary_op)
-    : tree_expression (l, c), op_lhs (a), op_rhs (b), etype (t),
-      eligible_for_braindead_shortcircuit (false) { }
-
-  ~tree_binary_expression (void)
-    {
-      delete op_lhs;
-      delete op_rhs;
-    }
-
-  void mark_braindead_shortcircuit (const std::string& file)
-    {
-      if (etype == octave_value::op_el_and
-          || etype == octave_value::op_el_or)
-        {
-          if (file.empty ())
-            warning_with_id ("Octave:possible-matlab-short-circuit-operator",
-                             "possible Matlab-style short-circuit operator at line %d, column %d",
-                             line (), column ());
-          else
-            warning_with_id ("Octave:possible-matlab-short-circuit-operator",
-                             "%s: possible Matlab-style short-circuit operator at line %d, column %d",
-                             file.c_str (), line (), column ());
-
-          eligible_for_braindead_shortcircuit = true;
-
-          op_lhs->mark_braindead_shortcircuit (file);
-          op_rhs->mark_braindead_shortcircuit (file);
-        }
-    }
-
-  bool has_magic_end (void) const
-    {
-      return ((op_lhs && op_lhs->has_magic_end ())
-              || (op_rhs && op_rhs->has_magic_end ()));
-    }
-
-  bool is_binary_expression (void) const { return true; }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  std::string oper (void) const;
-
-  octave_value::binary_op op_type (void) const { return etype; }
-
-  tree_expression *lhs (void) { return op_lhs; }
-  tree_expression *rhs (void) { return op_rhs; }
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-protected:
-
-  // The operands for the expression.
-  tree_expression *op_lhs;
-  tree_expression *op_rhs;
-
-private:
-
-  // The type of the expression.
-  octave_value::binary_op etype;
-
-  // TRUE if this is an | or & expression in the condition of an IF
-  // or WHILE statement.
-  bool eligible_for_braindead_shortcircuit;
-
-  // No copying!
-
-  tree_binary_expression (const tree_binary_expression&);
-
-  tree_binary_expression& operator = (const tree_binary_expression&);
-};
-
-// Boolean expressions.
-
-class
-tree_boolean_expression : public tree_binary_expression
-{
-public:
-
-  enum type
-    {
-      unknown,
-      bool_and,
-      bool_or
-    };
-
-  tree_boolean_expression (int l = -1, int c = -1, type t = unknown)
-    : tree_binary_expression (l, c), etype (t) { }
-
-  tree_boolean_expression (tree_expression *a, tree_expression *b,
-                           int l = -1, int c = -1, type t = unknown)
-    : tree_binary_expression (a, b, l, c), etype (t) { }
-
-  ~tree_boolean_expression (void) { }
-
-  bool is_boolean_expression (void) const { return true; }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  std::string oper (void) const;
-
-  type op_type (void) const { return etype; }
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-private:
-
-  // The type of the expression.
-  type etype;
-
-  // No copying!
-
-  tree_boolean_expression (const tree_boolean_expression&);
-
-  tree_boolean_expression& operator = (const tree_boolean_expression&);
-};
-
-#endif
--- a/src/pt-bp.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,501 +0,0 @@
-/*
-
-Copyright (C) 2001-2012 Ben Sapp
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "ov-usr-fcn.h"
-#include "pager.h"
-#include "pt-all.h"
-
-// TRUE means SIGINT should put us in the debugger at the next
-// available breakpoint.
-bool octave_debug_on_interrupt_state = false;
-
-void
-tree_breakpoint::visit_while_command (tree_while_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-
-  if (! found)
-    {
-      tree_statement_list *lst = cmd.body ();
-
-      if (lst)
-        lst->accept (*this);
-    }
-}
-
-void
-tree_breakpoint::visit_do_until_command (tree_do_until_command& cmd)
-{
-  if (! found)
-    {
-      tree_statement_list *lst = cmd.body ();
-
-      if (lst)
-        lst->accept (*this);
-
-      if (! found)
-        {
-          if (cmd.line () >= line)
-            take_action (cmd);
-        }
-    }
-}
-
-void
-tree_breakpoint::visit_argument_list (tree_argument_list&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_binary_expression (tree_binary_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_break_command (tree_break_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-}
-
-void
-tree_breakpoint::visit_colon_expression (tree_colon_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_continue_command (tree_continue_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-}
-
-void
-tree_breakpoint::do_decl_command (tree_decl_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-}
-
-void
-tree_breakpoint::visit_global_command (tree_global_command& cmd)
-{
-  do_decl_command (cmd);
-}
-
-void
-tree_breakpoint::visit_persistent_command (tree_persistent_command& cmd)
-{
-  do_decl_command (cmd);
-}
-
-void
-tree_breakpoint::visit_decl_elt (tree_decl_elt&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_decl_init_list (tree_decl_init_list&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_simple_for_command (tree_simple_for_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-
-  if (! found)
-    {
-      tree_statement_list *lst = cmd.body ();
-
-      if (lst)
-        lst->accept (*this);
-    }
-}
-
-void
-tree_breakpoint::visit_complex_for_command (tree_complex_for_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-
-  if (! found)
-    {
-      tree_statement_list *lst = cmd.body ();
-
-      if (lst)
-        lst->accept (*this);
-    }
-}
-
-void
-tree_breakpoint::visit_octave_user_script (octave_user_script& fcn)
-{
-  tree_statement_list *cmd_list = fcn.body ();
-
-  if (cmd_list)
-    cmd_list->accept (*this);
-}
-
-void
-tree_breakpoint::visit_octave_user_function (octave_user_function& fcn)
-{
-  tree_statement_list *cmd_list = fcn.body ();
-
-  if (cmd_list)
-    cmd_list->accept (*this);
-}
-
-void
-tree_breakpoint::visit_octave_user_function_header (octave_user_function&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_octave_user_function_trailer (octave_user_function&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_function_def (tree_function_def& fdef)
-{
-  octave_value fcn = fdef.function ();
-
-  octave_function *f = fcn.function_value ();
-
-  if (f)
-    f->accept (*this);
-}
-
-void
-tree_breakpoint::visit_identifier (tree_identifier&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_if_clause (tree_if_clause&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_if_command (tree_if_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-
-  if (! found)
-    {
-      tree_if_command_list *lst = cmd.cmd_list ();
-
-      if (lst)
-        lst->accept (*this);
-    }
-}
-
-void
-tree_breakpoint::visit_if_command_list (tree_if_command_list& lst)
-{
-  for (tree_if_command_list::iterator p = lst.begin (); p != lst.end (); p++)
-    {
-      tree_if_clause *t = *p;
-
-      if (t->line () >= line)
-        take_action (*t);
-
-      if (! found)
-        {
-          tree_statement_list *stmt_lst = t->commands ();
-
-          if (stmt_lst)
-            stmt_lst->accept (*this);
-        }
-
-      if (found)
-        break;
-    }
-}
-
-void
-tree_breakpoint::visit_index_expression (tree_index_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_matrix (tree_matrix&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_cell (tree_cell&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_multi_assignment (tree_multi_assignment&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_no_op_command (tree_no_op_command& cmd)
-{
-  if (cmd.is_end_of_fcn_or_script () && cmd.line () >= line)
-    take_action (cmd);
-}
-
-void
-tree_breakpoint::visit_anon_fcn_handle (tree_anon_fcn_handle&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_constant (tree_constant&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_fcn_handle (tree_fcn_handle&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_parameter_list (tree_parameter_list&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_postfix_expression (tree_postfix_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_prefix_expression (tree_prefix_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_return_command (tree_return_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-}
-
-void
-tree_breakpoint::visit_return_list (tree_return_list&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_simple_assignment (tree_simple_assignment&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_statement (tree_statement& stmt)
-{
-  if (stmt.is_command ())
-    {
-      tree_command *cmd = stmt.command ();
-
-      cmd->accept (*this);
-    }
-  else
-    {
-      if (stmt.line () >= line)
-        take_action (stmt);
-    }
-}
-
-void
-tree_breakpoint::visit_statement_list (tree_statement_list& lst)
-{
-  for (tree_statement_list::iterator p = lst.begin (); p != lst.end (); p++)
-    {
-      tree_statement *elt = *p;
-
-      if (elt)
-        {
-          elt->accept (*this);
-
-          if (found)
-            break;
-        }
-    }
-}
-
-void
-tree_breakpoint::visit_switch_case (tree_switch_case&)
-{
-  panic_impossible ();
-}
-
-void
-tree_breakpoint::visit_switch_case_list (tree_switch_case_list& lst)
-{
-  for (tree_switch_case_list::iterator p = lst.begin (); p != lst.end (); p++)
-    {
-      tree_switch_case *t = *p;
-
-      if (t->line () >= line)
-        take_action (*t);
-
-      if (! found)
-        {
-          tree_statement_list *stmt_lst = t->commands ();
-
-          if (stmt_lst)
-            stmt_lst->accept (*this);
-        }
-
-      if (found)
-        break;
-    }
-}
-
-void
-tree_breakpoint::visit_switch_command (tree_switch_command& cmd)
-{
-  if (cmd.line () >= line)
-    take_action (cmd);
-
-  if (! found)
-    {
-      tree_switch_case_list *lst = cmd.case_list ();
-
-      if (lst)
-        lst->accept (*this);
-    }
-}
-
-void
-tree_breakpoint::visit_try_catch_command (tree_try_catch_command& cmd)
-{
-  tree_statement_list *try_code = cmd.body ();
-
-  if (try_code)
-    try_code->accept (*this);
-
-  if (! found)
-    {
-      tree_statement_list *catch_code = cmd.cleanup ();
-
-      if (catch_code)
-        catch_code->accept (*this);
-    }
-}
-
-void
-tree_breakpoint::visit_unwind_protect_command (tree_unwind_protect_command& cmd)
-{
-  tree_statement_list *body = cmd.body ();
-
-  if (body)
-    body->accept (*this);
-
-  if (! found)
-    {
-      tree_statement_list *cleanup = cmd.cleanup ();
-
-      if (cleanup)
-        cleanup->accept (*this);
-    }
-}
-
-void
-tree_breakpoint::take_action (tree& tr)
-{
-  if (act == set)
-    {
-      tr.set_breakpoint ();
-      line = tr.line ();
-      found = true;
-    }
-  else if (act == clear)
-    {
-      if (tr.is_breakpoint ())
-        {
-          tr.delete_breakpoint ();
-          found = true;
-        }
-    }
-  else if (act == list)
-    {
-      if (tr.is_breakpoint ())
-        bp_list.append (octave_value (tr.line ()));
-    }
-  else
-    panic_impossible ();
-}
-
-void
-tree_breakpoint::take_action (tree_statement& stmt)
-{
-  int lineno = stmt.line ();
-
-  if (act == set)
-    {
-      stmt.set_breakpoint ();
-      line = lineno;
-      found = true;
-    }
-  else if (act == clear)
-    {
-      if (stmt.is_breakpoint ())
-        {
-          stmt.delete_breakpoint ();
-          found = true;
-        }
-    }
-  else if (act == list)
-    {
-      if (stmt.is_breakpoint ())
-        bp_list.append (octave_value (lineno));
-    }
-  else
-    panic_impossible ();
-}
--- a/src/pt-bp.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
-
-Copyright (C) 2001-2012 Ben Sapp
-
-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_bp_h)
-#define octave_tree_bp_h 1
-
-#include "input.h"
-#include "ov-usr-fcn.h"
-#include "pt-walk.h"
-#include "pt-pr-code.h"
-#include "toplev.h"
-
-class tree;
-class tree_decl_command;
-
-class
-tree_breakpoint : public tree_walker
-{
- public:
-
-  enum action { set = 1, clear = 2, list = 3 };
-
-  tree_breakpoint (int l, action a)
-    : line (l), act (a), found (false), bp_list () { }
-
-  ~tree_breakpoint (void) { }
-
-  bool success (void) const { return found; }
-
-  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_while_command (tree_while_command&);
-
-  void visit_do_until_command (tree_do_until_command&);
-
-  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_anon_fcn_handle (tree_anon_fcn_handle&);
-
-  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&);
-
-  octave_value_list get_list (void) { return bp_list; }
-
-  int get_line (void) { return line; }
-
- private:
-
-  void do_decl_command (tree_decl_command&);
-
-  void take_action (tree& tr);
-
-  void take_action (tree_statement& stmt);
-
-  // Statement line number we are looking for.
-  int line;
-
-  // What to do.
-  action act;
-
-  // Have we already found the line?
-  bool found;
-
-  // List of breakpoint line numbers.
-  octave_value_list bp_list;
-
-  // No copying!
-
-  tree_breakpoint (const tree_breakpoint&);
-
-  tree_breakpoint& operator = (const tree_breakpoint&);
-};
-
-// TRUE means SIGINT should put us in the debugger at the next
-// available breakpoint.
-extern bool octave_debug_on_interrupt_state;
-
-#endif
--- a/src/pt-cbinop.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "pt-cbinop.h"
-#include "pt-bp.h"
-#include "pt-unop.h"
-#include "pt-walk.h"
-
-// If a tree expression is a transpose or hermitian transpose, return
-// the argument and corresponding operator.
-
-static octave_value::unary_op
-strip_trans_herm (tree_expression *&exp)
-{
-  if (exp->is_unary_expression ())
-    {
-      tree_unary_expression *uexp =
-        dynamic_cast<tree_unary_expression *> (exp);
-
-      octave_value::unary_op op = uexp->op_type ();
-
-      if (op == octave_value::op_transpose
-          || op == octave_value::op_hermitian)
-        exp = uexp->operand ();
-      else
-        op = octave_value::unknown_unary_op;
-
-      return op;
-    }
-  else
-    return octave_value::unknown_unary_op;
-}
-
-static octave_value::unary_op
-strip_not (tree_expression *&exp)
-{
-  if (exp->is_unary_expression ())
-    {
-      tree_unary_expression *uexp =
-        dynamic_cast<tree_unary_expression *> (exp);
-
-      octave_value::unary_op op = uexp->op_type ();
-
-      if (op == octave_value::op_not)
-        exp = uexp->operand ();
-      else
-        op = octave_value::unknown_unary_op;
-
-      return op;
-    }
-  else
-    return octave_value::unknown_unary_op;
-}
-
-// Possibly convert multiplication to trans_mul, mul_trans, herm_mul,
-// or mul_herm.
-
-static octave_value::compound_binary_op
-simplify_mul_op (tree_expression *&a, tree_expression *&b)
-{
-  octave_value::compound_binary_op retop
-    = octave_value::unknown_compound_binary_op;
-
-  octave_value::unary_op opa = strip_trans_herm (a);
-
-  if (opa == octave_value::op_hermitian)
-    retop = octave_value::op_herm_mul;
-  else if (opa == octave_value::op_transpose)
-    retop = octave_value::op_trans_mul;
-  else
-    {
-      octave_value::unary_op opb = strip_trans_herm (b);
-
-      if (opb == octave_value::op_hermitian)
-        retop = octave_value::op_mul_herm;
-      else if (opb == octave_value::op_transpose)
-        retop = octave_value::op_mul_trans;
-    }
-
-  return retop;
-}
-
-// Possibly convert left division to trans_ldiv or herm_ldiv.
-
-static octave_value::compound_binary_op
-simplify_ldiv_op (tree_expression *&a, tree_expression *&)
-{
-  octave_value::compound_binary_op retop
-    = octave_value::unknown_compound_binary_op;
-
-  octave_value::unary_op opa = strip_trans_herm (a);
-
-  if (opa == octave_value::op_hermitian)
-    retop = octave_value::op_herm_ldiv;
-  else if (opa == octave_value::op_transpose)
-    retop = octave_value::op_trans_ldiv;
-
-  return retop;
-}
-
-// Possibly contract and/or with negation.
-
-static octave_value::compound_binary_op
-simplify_and_or_op (tree_expression *&a, tree_expression *&b, octave_value::binary_op op)
-{
-  octave_value::compound_binary_op retop
-    = octave_value::unknown_compound_binary_op;
-
-  octave_value::unary_op opa = strip_not (a);
-
-  if (opa == octave_value::op_not)
-    {
-      if (op == octave_value::op_el_and)
-        retop = octave_value::op_el_not_and;
-      else if (op == octave_value::op_el_or)
-        retop = octave_value::op_el_not_or;
-    }
-  else
-    {
-      octave_value::unary_op opb = strip_not (b);
-
-      if (opb == octave_value::op_not)
-        {
-          if (op == octave_value::op_el_and)
-            retop = octave_value::op_el_and_not;
-          else if (op == octave_value::op_el_or)
-            retop = octave_value::op_el_or_not;
-        }
-    }
-
-  return retop;
-}
-
-tree_binary_expression *
-maybe_compound_binary_expression (tree_expression *a, tree_expression *b,
-                                  int l, int c, octave_value::binary_op t)
-{
-  tree_expression *ca = a, *cb = b;
-  octave_value::compound_binary_op ct;
-
-  switch (t)
-    {
-    case octave_value::op_mul:
-      ct = simplify_mul_op (ca, cb);
-      break;
-
-    case octave_value::op_ldiv:
-      ct = simplify_ldiv_op (ca, cb);
-      break;
-
-    case octave_value::op_el_and:
-    case octave_value::op_el_or:
-      ct = simplify_and_or_op (ca, cb, t);
-      break;
-
-    default:
-      ct = octave_value::unknown_compound_binary_op;
-      break;
-    }
-
-  tree_binary_expression *ret = (ct == octave_value::unknown_compound_binary_op)
-    ? new tree_binary_expression (a, b, l, c, t)
-    : new tree_compound_binary_expression (a, b, l, c, t, ca, cb, ct);
-
-  return ret;
-}
-
-octave_value
-tree_compound_binary_expression::rvalue1 (int)
-{
-  octave_value retval;
-
-  if (error_state)
-    return retval;
-
-  if (op_lhs)
-    {
-      octave_value a = op_lhs->rvalue1 ();
-
-      if (! error_state && a.is_defined () && op_rhs)
-        {
-          octave_value b = op_rhs->rvalue1 ();
-
-          if (! error_state && b.is_defined ())
-            {
-              retval = ::do_binary_op (etype, a, b);
-
-              if (error_state)
-                retval = octave_value ();
-            }
-        }
-    }
-
-  return retval;
-}
-
-
--- a/src/pt-cbinop.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
-
-Copyright (C) 2008-2012 Jaroslav Hajek
-
-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_cbinop_h)
-#define octave_tree_cbinop_h 1
-
-#include <string>
-
-class tree_walker;
-
-class octave_value;
-class octave_value_list;
-class octave_lvalue;
-
-#include "ov.h"
-#include "pt-binop.h"
-#include "symtab.h"
-
-// Binary expressions that can be reduced to compound operations
-
-class
-tree_compound_binary_expression : public tree_binary_expression
-{
-public:
-
-  tree_compound_binary_expression (tree_expression *a, tree_expression *b,
-                                   int l, int c,
-                                   octave_value::binary_op t,
-                                   tree_expression *ca, tree_expression *cb,
-                                   octave_value::compound_binary_op ct)
-    : tree_binary_expression (a, b, l, c, t), op_lhs (ca), op_rhs (cb),
-      etype (ct) { }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value::compound_binary_op cop_type (void) const { return etype; }
-
-private:
-
-  tree_expression *op_lhs;
-  tree_expression *op_rhs;
-  octave_value::compound_binary_op etype;
-
-  // No copying!
-
-  tree_compound_binary_expression (const tree_compound_binary_expression&);
-
-  tree_compound_binary_expression& operator =
-    (const tree_compound_binary_expression&);
-};
-
-// a "virtual constructor"
-
-tree_binary_expression *
-maybe_compound_binary_expression (tree_expression *a, tree_expression *b,
-                                  int l = -1, int c = -1,
-                                  octave_value::binary_op t
-                                  = octave_value::unknown_binary_op);
-
-#endif
--- a/src/pt-cell.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
-
-Copyright (C) 1999-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "Cell.h"
-#include "defun.h"
-#include "error.h"
-#include "oct-obj.h"
-#include "pt-arg-list.h"
-#include "pt-bp.h"
-#include "pt-exp.h"
-#include "pt-cell.h"
-#include "pt-walk.h"
-#include "utils.h"
-#include "ov.h"
-#include "variables.h"
-
-octave_value
-tree_cell::rvalue1 (int)
-{
-  octave_value retval;
-
-  octave_idx_type nr = length ();
-  octave_idx_type nc = -1;
-
-  Cell val;
-
-  int i = 0;
-
-  for (iterator p = begin (); p != end (); p++)
-    {
-      tree_argument_list *elt = *p;
-
-      octave_value_list row = elt->convert_to_const_vector ();
-
-      if (nr == 1)
-        // Optimize the single row case.
-        val = row.cell_value ();
-      else if (nc < 0)
-        {
-          nc = row.length ();
-
-          val = Cell (nr, nc);
-        }
-      else
-        {
-          octave_idx_type this_nc = row.length ();
-
-          if (nc != this_nc)
-            {
-              ::error ("number of columns must match");
-              return retval;
-            }
-        }
-
-      for (octave_idx_type j = 0; j < nc; j++)
-        val(i,j) = row(j);
-
-      i++;
-    }
-
-  retval = val;
-
-  return retval;
-}
-
-octave_value_list
-tree_cell::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("invalid number of output arguments for cell array");
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-tree_expression *
-tree_cell::dup (symbol_table::scope_id scope,
-                symbol_table::context_id context) const
-{
-  tree_cell *new_cell = new tree_cell (0, line (), column ());
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_argument_list *elt = *p;
-
-      new_cell->append (elt ? elt->dup (scope, context) : 0);
-    }
-
-  new_cell->copy_base (*this);
-
-  return new_cell;
-}
-
-void
-tree_cell::accept (tree_walker& tw)
-{
-  tw.visit_cell (*this);
-}
--- a/src/pt-cell.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
-
-Copyright (C) 1999-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_cell_h)
-#define octave_tree_cell_h 1
-
-#include <iosfwd>
-
-class octave_value;
-class octave_value_list;
-class tree_argument_list;
-
-class tree_walker;
-
-#include "pt-mat.h"
-#include "symtab.h"
-
-// General cells.
-
-class
-tree_cell : public tree_matrix
-{
-public:
-
-  tree_cell (tree_argument_list *row = 0, int l = -1, int c = -1)
-    : tree_matrix (row, l, c) { }
-
-  ~tree_cell (void) { }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int);
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_cell (const tree_cell&);
-
-  tree_cell& operator = (const tree_cell&);
-};
-
-#endif
--- a/src/pt-check.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,561 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "input.h"
-#include "ov-usr-fcn.h"
-#include "pt-all.h"
-
-void
-tree_checker::visit_argument_list (tree_argument_list& lst)
-{
-  tree_argument_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_expression *elt = *p++;
-
-      if (elt)
-        {
-          if (do_lvalue_check && ! elt->lvalue_ok ())
-            gripe ("invalid lvalue in multiple assignment", elt->line ());
-        }
-    }
-}
-
-void
-tree_checker::visit_binary_expression (tree_binary_expression& expr)
-{
-  tree_expression *op1 = expr.lhs ();
-
-  if (op1)
-    op1->accept (*this);
-
-  tree_expression *op2 = expr.rhs ();
-
-  if (op2)
-    op2->accept (*this);
-}
-
-void
-tree_checker::visit_break_command (tree_break_command&)
-{
-}
-
-void
-tree_checker::visit_colon_expression (tree_colon_expression& expr)
-{
-  tree_expression *op1 = expr.base ();
-
-  if (op1)
-    op1->accept (*this);
-
-  tree_expression *op3 = expr.increment ();
-
-  if (op3)
-    op3->accept (*this);
-
-  tree_expression *op2 = expr.limit ();
-
-  if (op2)
-    op2->accept (*this);
-}
-
-void
-tree_checker::visit_continue_command (tree_continue_command&)
-{
-}
-
-void
-tree_checker::do_decl_command (tree_decl_command& cmd)
-{
-  tree_decl_init_list *init_list = cmd.initializer_list ();
-
-  if (init_list)
-    init_list->accept (*this);
-}
-
-void
-tree_checker::visit_global_command (tree_global_command& cmd)
-{
-  do_decl_command (cmd);
-}
-
-void
-tree_checker::visit_persistent_command (tree_persistent_command& cmd)
-{
-  do_decl_command (cmd);
-}
-
-void
-tree_checker::visit_decl_elt (tree_decl_elt& cmd)
-{
-  tree_identifier *id = cmd.ident ();
-
-  if (id)
-    id->accept (*this);
-
-  tree_expression *expr = cmd.expression ();
-
-  if (expr)
-    expr->accept (*this);
-}
-
-void
-tree_checker::visit_decl_init_list (tree_decl_init_list& lst)
-{
-  tree_decl_init_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_decl_elt *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_simple_for_command (tree_simple_for_command& cmd)
-{
-  tree_expression *lhs = cmd.left_hand_side ();
-
-  if (lhs)
-    {
-      if (! lhs->lvalue_ok ())
-        gripe ("invalid lvalue in for command", cmd.line ());
-    }
-
-  tree_expression *expr = cmd.control_expr ();
-
-  if (expr)
-    expr->accept (*this);
-
-  tree_expression *maxproc = cmd.maxproc_expr ();
-
-  if (maxproc)
-    maxproc->accept (*this);
-
-  tree_statement_list *list = cmd.body ();
-
-  if (list)
-    list->accept (*this);
-}
-
-void
-tree_checker::visit_complex_for_command (tree_complex_for_command& cmd)
-{
-  tree_argument_list *lhs = cmd.left_hand_side ();
-
-  if (lhs)
-    {
-      int len = lhs->length ();
-
-      if (len == 0 || len > 2)
-        gripe ("invalid number of output arguments in for command",
-               cmd.line ());
-
-      do_lvalue_check = true;
-
-      lhs->accept (*this);
-
-      do_lvalue_check = false;
-    }
-
-  tree_expression *expr = cmd.control_expr ();
-
-  if (expr)
-    expr->accept (*this);
-
-  tree_statement_list *list = cmd.body ();
-
-  if (list)
-    list->accept (*this);
-}
-
-void
-tree_checker::visit_octave_user_script (octave_user_script& fcn)
-{
-  tree_statement_list *cmd_list = fcn.body ();
-
-  if (cmd_list)
-    cmd_list->accept (*this);
-}
-
-void
-tree_checker::visit_octave_user_function (octave_user_function& fcn)
-{
-  tree_statement_list *cmd_list = fcn.body ();
-
-  if (cmd_list)
-    cmd_list->accept (*this);
-}
-
-void
-tree_checker::visit_function_def (tree_function_def& fdef)
-{
-  octave_value fcn = fdef.function ();
-
-  octave_function *f = fcn.function_value ();
-
-  if (f)
-    f->accept (*this);
-}
-
-void
-tree_checker::visit_identifier (tree_identifier& /* id */)
-{
-}
-
-void
-tree_checker::visit_if_clause (tree_if_clause& cmd)
-{
-  tree_expression *expr = cmd.condition ();
-
-  if (expr)
-    expr->accept (*this);
-
-  tree_statement_list *list = cmd.commands ();
-
-  if (list)
-    list->accept (*this);
-}
-
-void
-tree_checker::visit_if_command (tree_if_command& cmd)
-{
-  tree_if_command_list *list = cmd.cmd_list ();
-
-  if (list)
-    list->accept (*this);
-}
-
-void
-tree_checker::visit_if_command_list (tree_if_command_list& lst)
-{
-  tree_if_command_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_if_clause *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_index_expression (tree_index_expression& expr)
-{
-  tree_expression *e = expr.expression ();
-
-  if (e)
-    e->accept (*this);
-
-  std::list<tree_argument_list *> lst = expr.arg_lists ();
-
-  std::list<tree_argument_list *>::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_argument_list *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_matrix (tree_matrix& lst)
-{
-  tree_matrix::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_argument_list *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_cell (tree_cell& lst)
-{
-  tree_matrix::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_argument_list *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_multi_assignment (tree_multi_assignment& expr)
-{
-  tree_argument_list *lhs = expr.left_hand_side ();
-
-  if (lhs)
-    {
-      do_lvalue_check = true;
-
-      lhs->accept (*this);
-
-      do_lvalue_check = false;
-    }
-
-  tree_expression *rhs = expr.right_hand_side ();
-
-  if (rhs)
-    rhs->accept (*this);
-}
-
-void
-tree_checker::visit_no_op_command (tree_no_op_command& /* cmd */)
-{
-}
-
-void
-tree_checker::visit_anon_fcn_handle (tree_anon_fcn_handle& /* afh */)
-{
-}
-
-void
-tree_checker::visit_constant (tree_constant& /* val */)
-{
-}
-
-void
-tree_checker::visit_fcn_handle (tree_fcn_handle& /* fh */)
-{
-}
-
-void
-tree_checker::visit_parameter_list (tree_parameter_list& lst)
-{
-  tree_parameter_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_decl_elt *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_postfix_expression (tree_postfix_expression& expr)
-{
-  tree_expression *e = expr.operand ();
-
-  if (e)
-    e->accept (*this);
-}
-
-void
-tree_checker::visit_prefix_expression (tree_prefix_expression& expr)
-{
-  tree_expression *e = expr.operand ();
-
-  if (e)
-    e->accept (*this);
-}
-
-void
-tree_checker::visit_return_command (tree_return_command&)
-{
-}
-
-void
-tree_checker::visit_return_list (tree_return_list& lst)
-{
-  tree_return_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_index_expression *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_simple_assignment (tree_simple_assignment& expr)
-{
-  tree_expression *lhs = expr.left_hand_side ();
-
-  if (lhs)
-    {
-      if (! lhs->lvalue_ok ())
-        gripe ("invalid lvalue in assignment", expr.line ());
-    }
-
-  tree_expression *rhs = expr.right_hand_side ();
-
-  if (rhs)
-    rhs->accept (*this);
-}
-
-void
-tree_checker::visit_statement (tree_statement& stmt)
-{
-  tree_command *cmd = stmt.command ();
-
-  if (cmd)
-    cmd->accept (*this);
-  else
-    {
-      tree_expression *expr = stmt.expression ();
-
-      if (expr)
-        expr->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_statement_list (tree_statement_list& lst)
-{
-  for (tree_statement_list::iterator p = lst.begin (); p != lst.end (); p++)
-    {
-      tree_statement *elt = *p;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_switch_case (tree_switch_case& cs)
-{
-  tree_expression *label = cs.case_label ();
-
-  if (label)
-    label->accept (*this);
-
-  tree_statement_list *list = cs.commands ();
-
-  if (list)
-    list->accept (*this);
-}
-
-void
-tree_checker::visit_switch_case_list (tree_switch_case_list& lst)
-{
-  tree_switch_case_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_switch_case *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_checker::visit_switch_command (tree_switch_command& cmd)
-{
-  tree_expression *expr = cmd.switch_value ();
-
-  if (expr)
-    expr->accept (*this);
-
-  tree_switch_case_list *list = cmd.case_list ();
-
-  if (list)
-    list->accept (*this);
-}
-
-void
-tree_checker::visit_try_catch_command (tree_try_catch_command& cmd)
-{
-  tree_statement_list *try_code = cmd.body ();
-
-  if (try_code)
-    try_code->accept (*this);
-
-  tree_statement_list *catch_code = cmd.cleanup ();
-
-  if (catch_code)
-    catch_code->accept (*this);
-}
-
-void
-tree_checker::visit_unwind_protect_command
-  (tree_unwind_protect_command& cmd)
-{
-  tree_statement_list *unwind_protect_code = cmd.body ();
-
-  if (unwind_protect_code)
-    unwind_protect_code->accept (*this);
-
-  tree_statement_list *cleanup_code = cmd.cleanup ();
-
-  if (cleanup_code)
-    cleanup_code->accept (*this);
-}
-
-void
-tree_checker::visit_while_command (tree_while_command& cmd)
-{
-  tree_expression *expr = cmd.condition ();
-
-  if (expr)
-    expr->accept (*this);
-
-  tree_statement_list *list = cmd.body ();
-
-  if (list)
-    list->accept (*this);
-}
-
-void
-tree_checker::visit_do_until_command (tree_do_until_command& cmd)
-{
-  tree_statement_list *list = cmd.body ();
-
-  if (list)
-    list->accept (*this);
-
-  tree_expression *expr = cmd.condition ();
-
-  if (expr)
-    expr->accept (*this);
-}
-
-void
-tree_checker::gripe (const std::string& msg, int line)
-{
-  if (curr_fcn_file_name.empty ())
-    error ("%s", msg.c_str ());
-  else
-    error ("%s: %d: %s", curr_fcn_file_name.c_str (), line, msg.c_str ());
-}
--- a/src/pt-check.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_checker_h)
-#define octave_tree_checker_h 1
-
-#include "pt-walk.h"
-
-class tree_decl_command;
-
-// How to check the semantics of the code that the parse trees represent.
-
-class
-tree_checker : public tree_walker
-{
-public:
-
-  tree_checker (void)
-    : do_lvalue_check (false) { }
-
-  ~tree_checker (void) { }
-
-  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_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_anon_fcn_handle (tree_anon_fcn_handle&);
-
-  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&);
-
-private:
-
-  bool do_lvalue_check;
-
-  void do_decl_command (tree_decl_command&);
-
-  void gripe (const std::string& msg, int line);
-
-  // No copying!
-
-  tree_checker (const tree_checker&);
-
-  tree_checker& operator = (const tree_checker&);
-};
-
-#endif
--- a/src/pt-cmd.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-
-Copyright (C) 1994-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pt-cmd.h"
-#include "pt-walk.h"
-
-// No-op.
-
-tree_command *
-tree_no_op_command::dup (symbol_table::scope_id,
-                         symbol_table::context_id) const
-{
-  return new tree_no_op_command (orig_cmd, line (), column ());
-}
-
-void
-tree_no_op_command::accept (tree_walker& tw)
-{
-  tw.visit_no_op_command (*this);
-}
-
-// Function definition.
-
-tree_command *
-tree_function_def::dup (symbol_table::scope_id,
-                        symbol_table::context_id) const
-{
-  return new tree_function_def (fcn, line (), column ());
-}
-
-void
-tree_function_def::accept (tree_walker& tw)
-{
-  tw.visit_function_def (*this);
-}
--- a/src/pt-cmd.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
-
-Copyright (C) 1994-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_cmd_h)
-#define octave_tree_cmd_h 1
-
-#include <string>
-
-class tree_walker;
-
-#include "ov-fcn.h"
-#include "pt.h"
-#include "pt-bp.h"
-#include "symtab.h"
-
-// A base class for commands.
-
-class
-tree_command : public tree
-{
-public:
-
-  tree_command (int l = -1, int c = -1)
-    : tree (l, c) { }
-
-  virtual ~tree_command (void) { }
-
-  virtual tree_command *dup (symbol_table::scope_id,
-                             symbol_table::context_id context) const = 0;
-
-private:
-
-  // No copying!
-
-  tree_command (const tree_command&);
-
-  tree_command& operator = (const tree_command&);
-};
-
-// No-op.
-
-class
-tree_no_op_command : public tree_command
-{
-public:
-
-  tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1)
-    : tree_command (l, c), eof (cmd == "endfunction" || cmd == "endscript"),
-      orig_cmd (cmd) { }
-
-  ~tree_no_op_command (void) { }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  bool is_end_of_fcn_or_script (void) const { return eof; }
-
-  std::string original_command (void) { return orig_cmd; }
-
-private:
-
-  bool eof;
-
-  std::string orig_cmd;
-
-  // No copying!
-
-  tree_no_op_command (const tree_no_op_command&);
-
-  tree_no_op_command& operator = (const tree_no_op_command&);
-};
-
-// Function definition.
-
-class
-tree_function_def : public tree_command
-{
-public:
-
-  tree_function_def (octave_function *f, int l = -1, int c = -1)
-    : tree_command (l, c), fcn (f) { }
-
-  ~tree_function_def (void) { }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  octave_value function (void) { return fcn; }
-
-private:
-
-  octave_value fcn;
-
-  tree_function_def (const octave_value& v, int l = -1, int c = -1)
-    : tree_command (l, c), fcn (v) { }
-
-  // No copying!
-
-  tree_function_def (const tree_function_def&);
-
-  tree_function_def& operator = (const tree_function_def&);
-};
-
-#endif
--- a/src/pt-colon.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "oct-obj.h"
-#include "pager.h"
-#include "ov.h"
-#include "pt-bp.h"
-#include "pt-colon.h"
-#include "pt-walk.h"
-
-// Colon expressions.
-
-tree_colon_expression *
-tree_colon_expression::append (tree_expression *t)
-{
-  tree_colon_expression *retval = 0;
-
-  if (op_base)
-    {
-      if (op_limit)
-        {
-          if (op_increment)
-            ::error ("invalid colon expression");
-          else
-            {
-              // Stupid syntax:
-              //
-              // base : limit
-              // base : increment : limit
-
-              op_increment = op_limit;
-              op_limit = t;
-            }
-        }
-      else
-        op_limit = t;
-
-      retval = this;
-    }
-  else
-    ::error ("invalid colon expression");
-
-  return retval;
-}
-
-octave_value_list
-tree_colon_expression::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("invalid number of output arguments for colon expression");
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-octave_value
-tree_colon_expression::make_range (const Matrix& m_base,
-                                   const Matrix& m_limit,
-                                   const Matrix& m_increment,
-                                   bool result_is_str, bool dq_str) const
-{
-  octave_value retval;
-
-  bool base_empty = m_base.is_empty ();
-  bool limit_empty = m_limit.is_empty ();
-  bool increment_empty = m_increment.is_empty ();
-
-  if (base_empty || limit_empty || increment_empty)
-    retval = Range ();
-  else
-    {
-      retval = Range (m_base(0), m_limit(0), m_increment(0));
-
-      if (result_is_str)
-        retval = retval.convert_to_str (false, true, dq_str ? '"' : '\'');
-    }
-
-  return retval;
-}
-
-octave_value
-tree_colon_expression::make_range (const octave_value& ov_base,
-                                   const octave_value& ov_limit,
-                                   const octave_value& ov_increment) const
-{
-  octave_value retval;
-
-  if (ov_base.is_object () || ov_limit.is_object () ||
-      ov_increment.is_object ())
-    {
-      octave_value_list tmp1;
-      tmp1(2) = ov_limit;
-      tmp1(1) = ov_increment;
-      tmp1(0) = ov_base;
-
-      octave_value fcn = symbol_table::find_function ("colon", tmp1);
-
-      if (fcn.is_defined ())
-        {
-          octave_value_list tmp2 = fcn.do_multi_index_op (1, tmp1);
-
-          if (! error_state)
-            retval = tmp2 (0);
-        }
-      else
-        ::error ("can not find overloaded colon function");
-    }
-  else
-    {
-      bool result_is_str = (ov_base.is_string () && ov_limit.is_string ());
-      bool dq_str = (ov_base.is_dq_string () || ov_limit.is_dq_string ());
-
-      Matrix m_base = ov_base.matrix_value (true);
-
-      if (error_state)
-        eval_error ("invalid base value in colon expression");
-      else
-        {
-          Matrix m_limit = ov_limit.matrix_value (true);
-
-          if (error_state)
-            eval_error ("invalid limit value in colon expression");
-          else
-            {
-              Matrix m_increment = ov_increment.matrix_value (true);
-
-              if (error_state)
-                eval_error ("invalid increment value in colon expression");
-              else
-                retval = make_range (m_base, m_limit, m_increment,
-                                     result_is_str, dq_str);
-            }
-        }
-    }
-
-  return retval;
-}
-
-octave_value
-tree_colon_expression::rvalue1 (int)
-{
-  octave_value retval;
-
-  if (error_state || ! op_base || ! op_limit)
-    return retval;
-
-  octave_value ov_base = op_base->rvalue1 ();
-
-  if (error_state || ov_base.is_undefined ())
-    eval_error ("invalid base value in colon expression");
-  else
-    {
-      octave_value ov_limit = op_limit->rvalue1 ();
-
-      if (error_state || ov_limit.is_undefined ())
-        eval_error ("invalid limit value in colon expression");
-      else if (ov_base.is_object () || ov_limit.is_object ())
-        {
-          octave_value_list tmp1;
-
-          if (op_increment)
-            {
-              octave_value ov_increment = op_increment->rvalue1 ();
-
-              if (error_state || ov_increment.is_undefined ())
-                eval_error ("invalid increment value in colon expression");
-              else
-                {
-                  tmp1(2) = ov_limit;
-                  tmp1(1) = ov_increment;
-                  tmp1(0) = ov_base;
-                }
-            }
-          else
-            {
-              tmp1(1) = ov_limit;
-              tmp1(0) = ov_base;
-            }
-
-          if (!error_state)
-            {
-              octave_value fcn = symbol_table::find_function ("colon", tmp1);
-
-              if (fcn.is_defined ())
-                {
-                  octave_value_list tmp2 = fcn.do_multi_index_op (1, tmp1);
-
-                  if (! error_state)
-                    retval = tmp2 (0);
-                }
-              else
-                ::error ("can not find overloaded colon function");
-            }
-        }
-      else
-        {
-          octave_value ov_increment = 1.0;
-
-          if (op_increment)
-            {
-              ov_increment = op_increment->rvalue1 ();
-
-              if (error_state || ov_increment.is_undefined ())
-                eval_error ("invalid increment value in colon expression");
-            }
-
-          if (! error_state)
-            retval = make_range (ov_base, ov_limit, ov_increment);
-        }
-    }
-
-  return retval;
-}
-
-void
-tree_colon_expression::eval_error (const std::string& s) const
-{
-  ::error ("%s", s.c_str ());
-}
-
-int
-tree_colon_expression::line (void) const
-{
-  return (op_base ? op_base->line ()
-          : (op_increment ? op_increment->line ()
-             : (op_limit ? op_limit->line ()
-                : -1)));
-}
-
-int
-tree_colon_expression::column (void) const
-{
-  return (op_base ? op_base->column ()
-          : (op_increment ? op_increment->column ()
-             : (op_limit ? op_limit->column ()
-                : -1)));
-}
-
-tree_expression *
-tree_colon_expression::dup (symbol_table::scope_id scope,
-                            symbol_table::context_id context) const
-{
-  tree_colon_expression *new_ce = new
-    tree_colon_expression (op_base ? op_base->dup (scope, context) : 0,
-                           op_limit ? op_limit->dup (scope, context) : 0,
-                           op_increment ? op_increment->dup (scope, context) : 0,
-                           line (), column ());
-
-  new_ce->copy_base (*new_ce);
-
-  return new_ce;
-}
-
-void
-tree_colon_expression::accept (tree_walker& tw)
-{
-  tw.visit_colon_expression (*this);
-}
--- a/src/pt-colon.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_colon_h)
-#define octave_tree_colon 1
-
-#include <string>
-
-class tree_walker;
-
-class octave_value;
-class octave_value_list;
-class octave_lvalue;
-
-#include "pt-exp.h"
-#include "symtab.h"
-
-// Colon expressions.
-
-class
-tree_colon_expression : public tree_expression
-{
-public:
-
-  tree_colon_expression (int l = -1, int c = -1)
-    : tree_expression (l, c), op_base (0), op_limit (0),
-      op_increment (0), save_base (false) { }
-
-  tree_colon_expression (tree_expression *e, int l = -1, int c = -1)
-    : tree_expression (l, c), op_base (e), op_limit (0),
-      op_increment (0), save_base (false) { }
-
-  tree_colon_expression (tree_expression *bas, tree_expression *lim,
-                         tree_expression *inc, int l = -1, int c = -1)
-    : tree_expression (l, c), op_base (bas), op_limit (lim),
-      op_increment (inc), save_base (false) { }
-
-  ~tree_colon_expression (void)
-    {
-      if (! save_base)
-        delete op_base;
-
-      delete op_limit;
-      delete op_increment;
-    }
-
-  bool has_magic_end (void) const
-    {
-      return ((op_base && op_base->has_magic_end ())
-              || (op_limit && op_limit->has_magic_end ())
-              || (op_increment && op_increment->has_magic_end ()));
-    }
-
-  void preserve_base (void) { save_base = true; }
-
-  tree_colon_expression *append (tree_expression *t);
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  void eval_error (const std::string& s) const;
-
-  tree_expression *base (void) { return op_base; }
-
-  tree_expression *limit (void) { return op_limit; }
-
-  tree_expression *increment (void) { return op_increment; }
-
-  int line (void) const;
-  int column (void) const;
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // The components of the expression.
-  tree_expression *op_base;
-  tree_expression *op_limit;
-  tree_expression *op_increment;
-
-  bool save_base;
-
-  octave_value
-  make_range (const Matrix& m_base, const Matrix& m_limit,
-              const Matrix& m_increment, bool result_is_str,
-              bool dq_str) const;
-
-  octave_value
-  make_range (const octave_value& ov_base, const octave_value& ov_limit,
-              const octave_value& ov_increment) const;
-
-  // No copying!
-
-  tree_colon_expression (const tree_colon_expression&);
-
-  tree_colon_expression& operator = (const tree_colon_expression&);
-};
-
-#endif
--- a/src/pt-const.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
-
-Copyright (C) 1993-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "error.h"
-#include "oct-obj.h"
-#include "pager.h"
-#include "pt-const.h"
-#include "pt-walk.h"
-
-// We are likely to have a lot of tree_constant objects to allocate,
-// so make the grow_size large.
-DEFINE_OCTAVE_ALLOCATOR2 (tree_constant, 1024);
-
-void
-tree_constant::print (std::ostream& os, bool pr_as_read_syntax, bool pr_orig_text)
-{
-  if (pr_orig_text && ! orig_text.empty ())
-    os << orig_text;
-  else
-    val.print (os, pr_as_read_syntax);
-}
-
-void
-tree_constant::print_raw (std::ostream& os, bool pr_as_read_syntax,
-                          bool pr_orig_text)
-{
-  if (pr_orig_text && ! orig_text.empty ())
-    os << orig_text;
-  else
-    val.print_raw (os, pr_as_read_syntax);
-}
-
-octave_value_list
-tree_constant::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("invalid number of output arguments for constant expression");
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-tree_expression *
-tree_constant::dup (symbol_table::scope_id,
-                    symbol_table::context_id) const
-{
-  tree_constant *new_tc
-    = new tree_constant (val, orig_text, line (), column ());
-
-  new_tc->copy_base (*this);
-
-  return new_tc;
-}
-
-void
-tree_constant::accept (tree_walker& tw)
-{
-  tw.visit_constant (*this);
-}
--- a/src/pt-const.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-
-Copyright (C) 1993-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_const_h)
-#define octave_tree_const_h 1
-
-#include <iosfwd>
-#include <string>
-
-#include "oct-alloc.h"
-
-class octave_value_list;
-class tree_walker;
-
-#include "ov.h"
-#include "pt-bp.h"
-#include "pt-exp.h"
-#include "symtab.h"
-
-class
-tree_constant : public tree_expression
-{
-public:
-
-  tree_constant (int l = -1, int c = -1)
-    : tree_expression (l, c), val (), orig_text () { }
-
-  tree_constant (const octave_value& v, int l = -1, int c = -1)
-    : tree_expression (l, c), val (v), orig_text () { }
-
-  tree_constant (const octave_value& v, const std::string& ot,
-                 int l = -1, int c = -1)
-    : tree_expression (l, c), val (v), orig_text (ot) { }
-
-  ~tree_constant (void) { }
-
-  bool has_magic_end (void) const { return false; }
-
-  // Type.  It would be nice to eliminate the need for this.
-
-  bool is_constant (void) const { return true; }
-
-  void maybe_mutate (void) { val.maybe_mutate (); }
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false,
-              bool pr_orig_txt = true);
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false,
-                  bool pr_orig_txt = true);
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int = 1) { return val; }
-
-  octave_value_list rvalue (int nargout);
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  // Store the original text corresponding to this constant for later
-  // pretty printing.
-
-  void stash_original_text (const std::string& s) { orig_text = s; }
-
-  std::string original_text (void) const { return orig_text; }
-
-private:
-
-  // The actual value that this constant refers to.
-  octave_value val;
-
-  // The original text form of this constant.
-  std::string orig_text;
-
-  // No copying!
-
-  tree_constant (const tree_constant&);
-
-  tree_constant& operator = (const tree_constant&);
-
-  DECLARE_OCTAVE_ALLOCATOR
-};
-
-#endif
--- a/src/pt-decl.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "defun.h"
-#include "error.h"
-#include "pt-cmd.h"
-#include "ov.h"
-#include "oct-lvalue.h"
-#include "pt-bp.h"
-#include "pt-decl.h"
-#include "pt-exp.h"
-#include "pt-id.h"
-#include "pt-walk.h"
-#include "utils.h"
-#include "variables.h"
-
-// Declarations (global, static, etc.).
-
-tree_decl_elt::~tree_decl_elt (void)
-{
-  delete id;
-  delete expr;
-}
-
-bool
-tree_decl_elt::eval (void)
-{
-  bool retval = false;
-
-  if (id && expr)
-    {
-      octave_lvalue ult = id->lvalue ();
-
-      octave_value init_val = expr->rvalue1 ();
-
-      if (! error_state)
-        {
-          ult.assign (octave_value::op_asn_eq, init_val);
-
-          retval = true;
-        }
-    }
-
-  return retval;
-}
-
-tree_decl_elt *
-tree_decl_elt::dup (symbol_table::scope_id scope,
-                    symbol_table::context_id context) const
-{
-  return new tree_decl_elt (id ? id->dup (scope, context) : 0,
-                            expr ? expr->dup (scope, context) : 0);
-}
-
-void
-tree_decl_elt::accept (tree_walker& tw)
-{
-  tw.visit_decl_elt (*this);
-}
-
-// Initializer lists for declaration statements.
-
-tree_decl_init_list *
-tree_decl_init_list::dup (symbol_table::scope_id scope,
-                          symbol_table::context_id context) const
-{
-  tree_decl_init_list *new_dil = new tree_decl_init_list ();
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_decl_elt *elt = *p;
-
-      new_dil->append (elt ? elt->dup (scope, context) : 0);
-    }
-
-  return new_dil;
-}
-
-void
-tree_decl_init_list::accept (tree_walker& tw)
-{
-  tw.visit_decl_init_list (*this);
-}
-
-// Base class for declaration commands (global, static).
-
-tree_decl_command::~tree_decl_command (void)
-{
-  delete init_list;
-}
-
-// Global.
-
-tree_command *
-tree_global_command::dup (symbol_table::scope_id scope,
-                          symbol_table::context_id context) const
-{
-  return
-    new tree_global_command (init_list ? init_list->dup (scope, context) : 0,
-                             line (), column ());
-}
-
-void
-tree_global_command::accept (tree_walker& tw)
-{
-  tw.visit_global_command (*this);
-}
-
-// Static.
-
-tree_command *
-tree_persistent_command::dup (symbol_table::scope_id scope,
-                          symbol_table::context_id context) const
-{
-  return
-    new tree_persistent_command (init_list ? init_list->dup (scope, context) : 0,
-                                 line (), column ());
-}
-
-void
-tree_persistent_command::accept (tree_walker& tw)
-{
-  tw.visit_persistent_command (*this);
-}
--- a/src/pt-decl.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_decl_h)
-#define octave_tree_decl_h 1
-
-class tree_expression;
-class tree_identifier;
-
-class tree_walker;
-
-#include <string>
-
-#include "base-list.h"
-#include "oct-lvalue.h"
-#include "pt-cmd.h"
-#include "pt-id.h"
-#include "symtab.h"
-
-// List of expressions that make up a declaration statement.
-
-class
-tree_decl_elt
-{
-public:
-
-  tree_decl_elt (tree_identifier *i = 0, tree_expression *e = 0)
-    : id (i), expr (e) { }
-
-  ~tree_decl_elt (void);
-
-  bool eval (void);
-
-  bool is_defined (void) { return id ? id->is_defined () : false; }
-
-  bool is_variable (void) { return id ? id->is_variable () : false; }
-
-  void mark_as_formal_parameter (void)
-  {
-    if (id)
-      id->mark_as_formal_parameter ();
-  }
-
-  bool lvalue_ok (void) { return id ? id->lvalue_ok () : false; }
-
-  // Do not allow functions to return null values.
-  octave_value rvalue1 (int nargout = 1)
-  {
-    return id ? id->rvalue1 (nargout).storable_value () : octave_value ();
-  }
-
-  octave_value_list rvalue (int nargout)
-  {
-    octave_value_list retval;
-
-    if (nargout > 1)
-      error ("invalid number of output arguments in declaration list");
-    else
-      retval = rvalue1 (nargout);
-
-    return retval;
-  }
-
-  octave_lvalue lvalue (void) { return id ? id->lvalue () : octave_lvalue (); }
-
-  tree_identifier *ident (void) { return id; }
-
-  tree_expression *expression (void) { return expr; }
-
-  tree_decl_elt *dup (symbol_table::scope_id scope,
-                      symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // An identifier to tag with the declared property.
-  tree_identifier *id;
-
-  // An initializer expression (may be zero);
-  tree_expression *expr;
-
-  // No copying!
-
-  tree_decl_elt (const tree_decl_elt&);
-
-  tree_decl_elt& operator = (const tree_decl_elt&);
-};
-
-class
-tree_decl_init_list : public octave_base_list<tree_decl_elt *>
-{
-public:
-
-  tree_decl_init_list (void) { }
-
-  tree_decl_init_list (tree_decl_elt *t) { append (t); }
-
-  ~tree_decl_init_list (void)
-    {
-      while (! empty ())
-        {
-          iterator p = begin ();
-          delete *p;
-          erase (p);
-        }
-    }
-
-  tree_decl_init_list *dup (symbol_table::scope_id scope,
-                            symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_decl_init_list (const tree_decl_init_list&);
-
-  tree_decl_init_list& operator = (const tree_decl_init_list&);
-};
-
-// Base class for declaration commands -- global, static, etc.
-
-class
-tree_decl_command : public tree_command
-{
-public:
-
-  tree_decl_command (const std::string& n, int l = -1, int c = -1)
-    : tree_command (l, c), cmd_name (n), init_list (0) { }
-
-  tree_decl_command (const std::string& n, tree_decl_init_list *t,
-                     int l = -1, int c = -1)
-    : tree_command (l, c), cmd_name (n), init_list (t) { }
-
-  ~tree_decl_command (void);
-
-  tree_decl_init_list *initializer_list (void) { return init_list; }
-
-  std::string name (void) { return cmd_name; }
-
-protected:
-
-  // The name of this command -- global, static, etc.
-  std::string cmd_name;
-
-  // The list of variables or initializers in this declaration command.
-  tree_decl_init_list *init_list;
-
-private:
-
-  // No copying!
-
-  tree_decl_command (const tree_decl_command&);
-
-  tree_decl_command& operator = (const tree_decl_command&);
-};
-
-// Global.
-
-class
-tree_global_command : public tree_decl_command
-{
-public:
-
-  tree_global_command (int l = -1, int c = -1)
-    : tree_decl_command ("global", l, c) { }
-
-  tree_global_command (tree_decl_init_list *t, int l = -1, int c = -1)
-    : tree_decl_command ("global", t, l, c) { }
-
-  ~tree_global_command (void) { }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  static void do_init (tree_decl_elt& elt);
-
-  // No copying!
-
-  tree_global_command (const tree_global_command&);
-
-  tree_global_command& operator = (const tree_global_command&);
-};
-
-// Persistent.
-
-class
-tree_persistent_command : public tree_decl_command
-{
-public:
-
-  tree_persistent_command (int l = -1, int c = -1)
-    : tree_decl_command ("persistent", l, c) { }
-
-  tree_persistent_command (tree_decl_init_list *t, int l = -1, int c = -1)
-    : tree_decl_command ("persistent", t, l, c) { }
-
-  ~tree_persistent_command (void) { }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  static void do_init (tree_decl_elt& elt);
-
-  // No copying!
-
-  tree_persistent_command (const tree_persistent_command&);
-
-  tree_persistent_command& operator = (const tree_persistent_command&);
-};
-
-#endif
--- a/src/pt-eval.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1265 +0,0 @@
-/*
-
-Copyright (C) 2009-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <cctype>
-
-#include <iostream>
-
-#include <fstream>
-#include <typeinfo>
-
-#include "debug.h"
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "input.h"
-#include "ov-fcn-handle.h"
-#include "ov-usr-fcn.h"
-#include "variables.h"
-#include "pt-all.h"
-#include "pt-eval.h"
-#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;
-
-int tree_evaluator::dbstep_flag = 0;
-
-size_t tree_evaluator::current_frame = 0;
-
-bool tree_evaluator::debug_mode = false;
-
-tree_evaluator::stmt_list_type tree_evaluator::statement_context
-  = tree_evaluator::other;
-
-bool tree_evaluator::in_loop_command = false;
-
-// Maximum nesting level for functions, scripts, or sourced files called
-// recursively.
-int Vmax_recursion_depth = 256;
-
-// If TRUE, turn off printing of results in functions (as if a
-// semicolon has been appended to each statement).
-static bool Vsilent_functions = false;
-
-// Normal evaluator.
-
-void
-tree_evaluator::visit_anon_fcn_handle (tree_anon_fcn_handle&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_argument_list (tree_argument_list&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_binary_expression (tree_binary_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_break_command (tree_break_command& cmd)
-{
-  if (! error_state)
-    {
-      if (debug_mode)
-        do_breakpoint (cmd.is_breakpoint ());
-
-      if (statement_context == function || statement_context == script
-          || in_loop_command)
-        tree_break_command::breaking = 1;
-    }
-}
-
-void
-tree_evaluator::visit_colon_expression (tree_colon_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_continue_command (tree_continue_command& cmd)
-{
-  if (! error_state)
-    {
-      if (debug_mode)
-        do_breakpoint (cmd.is_breakpoint ());
-
-      if (statement_context == function || statement_context == script
-          || in_loop_command)
-        tree_continue_command::continuing = 1;
-    }
-}
-
-void
-tree_evaluator::reset_debug_state (void)
-{
-  debug_mode = bp_table::have_breakpoints () || Vdebugging;
-
-  dbstep_flag = 0;
-}
-
-static inline void
-do_global_init (tree_decl_elt& elt)
-{
-  tree_identifier *id = elt.ident ();
-
-  if (id)
-    {
-      id->mark_global ();
-
-      if (! error_state)
-        {
-          octave_lvalue ult = id->lvalue ();
-
-          if (ult.is_undefined ())
-            {
-              tree_expression *expr = elt.expression ();
-
-              octave_value init_val;
-
-              if (expr)
-                init_val = expr->rvalue1 ();
-              else
-                init_val = Matrix ();
-
-              ult.assign (octave_value::op_asn_eq, init_val);
-            }
-        }
-    }
-}
-
-static inline void
-do_static_init (tree_decl_elt& elt)
-{
-  tree_identifier *id = elt.ident ();
-
-  if (id)
-    {
-      id->mark_as_static ();
-
-      octave_lvalue ult = id->lvalue ();
-
-      if (ult.is_undefined ())
-        {
-          tree_expression *expr = elt.expression ();
-
-          octave_value init_val;
-
-          if (expr)
-            init_val = expr->rvalue1 ();
-          else
-            init_val = Matrix ();
-
-          ult.assign (octave_value::op_asn_eq, init_val);
-        }
-    }
-}
-
-void
-tree_evaluator::do_decl_init_list (decl_elt_init_fcn fcn,
-                                   tree_decl_init_list *init_list)
-{
-  if (init_list)
-    {
-      for (tree_decl_init_list::iterator p = init_list->begin ();
-           p != init_list->end (); p++)
-        {
-          tree_decl_elt *elt = *p;
-
-          fcn (*elt);
-
-          if (error_state)
-            break;
-        }
-    }
-}
-
-void
-tree_evaluator::visit_global_command (tree_global_command& cmd)
-{
-  if (debug_mode)
-    do_breakpoint (cmd.is_breakpoint ());
-
-  do_decl_init_list (do_global_init, cmd.initializer_list ());
-}
-
-void
-tree_evaluator::visit_persistent_command (tree_persistent_command& cmd)
-{
-  if (debug_mode)
-    do_breakpoint (cmd.is_breakpoint ());
-
-  do_decl_init_list (do_static_init, cmd.initializer_list ());
-}
-
-void
-tree_evaluator::visit_decl_elt (tree_decl_elt&)
-{
-  panic_impossible ();
-}
-
-#if 0
-bool
-tree_decl_elt::eval (void)
-{
-  bool retval = false;
-
-  if (id && expr)
-    {
-      octave_lvalue ult = id->lvalue ();
-
-      octave_value init_val = expr->rvalue1 ();
-
-      if (! error_state)
-       {
-         ult.assign (octave_value::op_asn_eq, init_val);
-
-         retval = true;
-       }
-    }
-
-  return retval;
-}
-#endif
-
-void
-tree_evaluator::visit_decl_init_list (tree_decl_init_list&)
-{
-  panic_impossible ();
-}
-
-// Decide if it's time to quit a for or while loop.
-static inline bool
-quit_loop_now (void)
-{
-  octave_quit ();
-
-  // Maybe handle `continue N' someday...
-
-  if (tree_continue_command::continuing)
-    tree_continue_command::continuing--;
-
-  bool quit = (error_state
-               || tree_return_command::returning
-               || tree_break_command::breaking
-               || tree_continue_command::continuing);
-
-  if (tree_break_command::breaking)
-    tree_break_command::breaking--;
-
-  return quit;
-}
-
-void
-tree_evaluator::visit_simple_for_command (tree_simple_for_command& cmd)
-{
-  if (error_state)
-    return;
-
-  if (debug_mode)
-    do_breakpoint (cmd.is_breakpoint ());
-
-  // FIXME -- need to handle PARFOR loops here using cmd.in_parallel ()
-  // and cmd.maxproc_expr ();
-
-  unwind_protect frame;
-
-  frame.protect_var (in_loop_command);
-
-  in_loop_command = true;
-
-  tree_expression *expr = cmd.control_expr ();
-
-  octave_value rhs = expr->rvalue1 ();
-
-#if HAVE_LLVM
-  if (jiter.execute (cmd, rhs))
-    return;
-#endif
-
-  if (error_state || rhs.is_undefined ())
-    return;
-
-  {
-    tree_expression *lhs = cmd.left_hand_side ();
-
-    octave_lvalue ult = lhs->lvalue ();
-
-    if (error_state)
-      return;
-
-    tree_statement_list *loop_body = cmd.body ();
-
-    if (rhs.is_range ())
-      {
-        Range rng = rhs.range_value ();
-
-        octave_idx_type steps = rng.nelem ();
-        double b = rng.base ();
-        double increment = rng.inc ();
-
-        for (octave_idx_type i = 0; i < steps; i++)
-          {
-            // Use multiplication here rather than declaring a
-            // temporary variable outside the loop and using
-            //
-            //   tmp_val += increment
-            //
-            // to avoid problems with limited precision.  Also, this
-            // is consistent with the way Range::matrix_value is
-            // implemented.
-
-            octave_value val (b + i * increment);
-
-            ult.assign (octave_value::op_asn_eq, val);
-
-            if (! error_state && loop_body)
-              loop_body->accept (*this);
-
-            if (quit_loop_now ())
-              break;
-          }
-      }
-    else if (rhs.is_scalar_type ())
-      {
-        ult.assign (octave_value::op_asn_eq, rhs);
-
-        if (! error_state && loop_body)
-          loop_body->accept (*this);
-
-        // Maybe decrement break and continue states.
-        quit_loop_now ();
-      }
-    else if (rhs.is_matrix_type () || rhs.is_cell () || rhs.is_string ()
-             || rhs.is_map ())
-      {
-        // A matrix or cell is reshaped to 2 dimensions and iterated by
-        // columns.
-
-        dim_vector dv = rhs.dims ().redim (2);
-
-        octave_idx_type nrows = dv(0), steps = dv(1);
-
-        if (steps > 0)
-          {
-            octave_value arg = rhs;
-            if (rhs.ndims () > 2)
-              arg = arg.reshape (dv);
-
-            // for row vectors, use single index to speed things up.
-            octave_value_list idx;
-            octave_idx_type iidx;
-            if (nrows == 1)
-              {
-                idx.resize (1);
-                iidx = 0;
-              }
-            else
-              {
-                idx.resize (2);
-                idx(0) = octave_value::magic_colon_t;
-                iidx = 1;
-              }
-
-            for (octave_idx_type i = 1; i <= steps; i++)
-              {
-                // do_index_op expects one-based indices.
-                idx(iidx) = i;
-                octave_value val = arg.do_index_op (idx);
-
-                ult.assign (octave_value::op_asn_eq, val);
-
-                if (! error_state && loop_body)
-                  loop_body->accept (*this);
-
-                if (quit_loop_now ())
-                  break;
-              }
-          }
-      }
-    else
-      {
-        ::error ("invalid type in for loop expression near line %d, column %d",
-                 cmd.line (), cmd.column ());
-      }
-  }
-}
-
-void
-tree_evaluator::visit_complex_for_command (tree_complex_for_command& cmd)
-{
-  if (error_state)
-    return;
-
-  if (debug_mode)
-    do_breakpoint (cmd.is_breakpoint ());
-
-  unwind_protect frame;
-
-  frame.protect_var (in_loop_command);
-
-  in_loop_command = true;
-
-  tree_expression *expr = cmd.control_expr ();
-
-  octave_value rhs = expr->rvalue1 ();
-
-  if (error_state || rhs.is_undefined ())
-    return;
-
-  if (rhs.is_map ())
-    {
-      // Cycle through structure elements.  First element of id_list
-      // is set to value and the second is set to the name of the
-      // structure element.
-
-      tree_argument_list *lhs = cmd.left_hand_side ();
-
-      tree_argument_list::iterator p = lhs->begin ();
-
-      tree_expression *elt = *p++;
-
-      octave_lvalue val_ref = elt->lvalue ();
-
-      elt = *p;
-
-      octave_lvalue key_ref = elt->lvalue ();
-
-      const octave_map tmp_val = rhs.map_value ();
-
-      tree_statement_list *loop_body = cmd.body ();
-
-      string_vector keys = tmp_val.keys ();
-
-      octave_idx_type nel = keys.numel ();
-
-      for (octave_idx_type i = 0; i < nel; i++)
-        {
-          std::string key = keys[i];
-
-          const Cell val_lst = tmp_val.contents (key);
-
-          octave_idx_type n = val_lst.numel ();
-
-          octave_value val = (n == 1) ? val_lst(0) : octave_value (val_lst);
-
-          val_ref.assign (octave_value::op_asn_eq, val);
-          key_ref.assign (octave_value::op_asn_eq, key);
-
-          if (! error_state && loop_body)
-            loop_body->accept (*this);
-
-          if (quit_loop_now ())
-            break;
-        }
-    }
-  else
-    error ("in statement `for [X, Y] = VAL', VAL must be a structure");
-}
-
-void
-tree_evaluator::visit_octave_user_script (octave_user_script&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_octave_user_function (octave_user_function&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_octave_user_function_header (octave_user_function&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_octave_user_function_trailer (octave_user_function&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_function_def (tree_function_def& cmd)
-{
-  octave_value fcn = cmd.function ();
-
-  octave_function *f = fcn.function_value ();
-
-  if (f)
-    {
-      std::string nm = f->name ();
-
-      symbol_table::install_cmdline_function (nm, fcn);
-
-      // Make sure that any variable with the same name as the new
-      // function is cleared.
-
-      symbol_table::varref (nm) = octave_value ();
-    }
-}
-
-void
-tree_evaluator::visit_identifier (tree_identifier&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_if_clause (tree_if_clause&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_if_command (tree_if_command& cmd)
-{
-  if (debug_mode)
-    do_breakpoint (cmd.is_breakpoint ());
-
-  tree_if_command_list *lst = cmd.cmd_list ();
-
-  if (lst)
-    lst->accept (*this);
-}
-
-void
-tree_evaluator::visit_if_command_list (tree_if_command_list& lst)
-{
-  for (tree_if_command_list::iterator p = lst.begin (); p != lst.end (); p++)
-    {
-      tree_if_clause *tic = *p;
-
-      tree_expression *expr = tic->condition ();
-
-      if (debug_mode && ! tic->is_else_clause ())
-        do_breakpoint (tic->is_breakpoint ());
-
-      if (tic->is_else_clause () || expr->is_logically_true ("if"))
-        {
-          if (! error_state)
-            {
-              tree_statement_list *stmt_lst = tic->commands ();
-
-              if (stmt_lst)
-                stmt_lst->accept (*this);
-            }
-
-          break;
-        }
-    }
-}
-
-void
-tree_evaluator::visit_index_expression (tree_index_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_matrix (tree_matrix&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_cell (tree_cell&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_multi_assignment (tree_multi_assignment&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_no_op_command (tree_no_op_command& cmd)
-{
-  if (debug_mode && cmd.is_end_of_fcn_or_script ())
-    do_breakpoint (cmd.is_breakpoint (), true);
-}
-
-void
-tree_evaluator::visit_constant (tree_constant&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_fcn_handle (tree_fcn_handle&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_parameter_list (tree_parameter_list&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_postfix_expression (tree_postfix_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_prefix_expression (tree_prefix_expression&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_return_command (tree_return_command& cmd)
-{
-  if (! error_state)
-    {
-      if (debug_mode)
-        do_breakpoint (cmd.is_breakpoint ());
-
-      // Act like dbcont.
-
-      if (Vdebugging
-          && octave_call_stack::current_frame () == current_frame)
-        {
-          Vdebugging = false;
-
-          reset_debug_state ();
-        }
-      else if (statement_context == function || statement_context == script
-               || in_loop_command)
-        tree_return_command::returning = 1;
-    }
-}
-
-void
-tree_evaluator::visit_return_list (tree_return_list&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_simple_assignment (tree_simple_assignment&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_statement (tree_statement& stmt)
-{
-  tree_command *cmd = stmt.command ();
-  tree_expression *expr = stmt.expression ();
-
-  if (cmd || expr)
-    {
-      if (statement_context == function || statement_context == script)
-        {
-          // Skip commands issued at a debug> prompt to avoid disturbing
-          // the state of the program we are debugging.
-
-          if (! Vdebugging)
-            octave_call_stack::set_statement (&stmt);
-
-          // FIXME -- we need to distinguish functions from scripts to
-          // get this right.
-          if ((statement_context == script
-               && ((Vecho_executing_commands & ECHO_SCRIPTS)
-                   || (Vecho_executing_commands & ECHO_FUNCTIONS)))
-              || (statement_context == function
-                  && (Vecho_executing_commands & ECHO_FUNCTIONS)))
-            stmt.echo_code ();
-        }
-
-      try
-        {
-          if (cmd)
-            cmd->accept (*this);
-          else
-            {
-              if (debug_mode)
-                do_breakpoint (expr->is_breakpoint ());
-
-              if ((statement_context == function || statement_context == script)
-                  && Vsilent_functions)
-                expr->set_print_flag (false);
-
-              // FIXME -- maybe all of this should be packaged in
-              // one virtual function that returns a flag saying whether
-              // or not the expression will take care of binding ans and
-              // printing the result.
-
-              // FIXME -- it seems that we should just have to
-              // call expr->rvalue1 () and that should take care of
-              // everything, binding ans as necessary?
-
-              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 ());
-
-              octave_value tmp_result = expr->rvalue1 (0);
-
-              if (do_bind_ans && ! (error_state || tmp_result.is_undefined ()))
-                bind_ans (tmp_result, expr->print_result ());
-
-              //              if (tmp_result.is_defined ())
-              //                result_values(0) = tmp_result;
-            }
-        }
-      catch (octave_execution_exception)
-        {
-          gripe_library_execution_error ();
-        }
-    }
-}
-
-void
-tree_evaluator::visit_statement_list (tree_statement_list& lst)
-{
-  static octave_value_list empty_list;
-
-  if (error_state)
-    return;
-
-  tree_statement_list::iterator p = lst.begin ();
-
-  if (p != lst.end ())
-    {
-      while (true)
-        {
-          tree_statement *elt = *p++;
-
-          if (elt)
-            {
-              octave_quit ();
-
-              elt->accept (*this);
-
-              if (error_state)
-                break;
-
-              if (tree_break_command::breaking
-                  || tree_continue_command::continuing)
-                break;
-
-              if (tree_return_command::returning)
-                break;
-
-              if (p == lst.end ())
-                break;
-              else
-                {
-                  // Clear preivous values before next statement is
-                  // evaluated so that we aren't holding an extra
-                  // reference to a value that may be used next.  For
-                  // example, in code like this:
-                  //
-                  //   X = rand (N);  ## refcount for X should be 1
-                  //                  ## after this statement
-                  //
-                  //   X(idx) = val;  ## no extra copy of X should be
-                  //                  ## needed, but we will be faked
-                  //                  ## out if retval is not cleared
-                  //                  ## between statements here
-
-                  //              result_values = empty_list;
-                }
-            }
-          else
-            error ("invalid statement found in statement list!");
-        }
-    }
-}
-
-void
-tree_evaluator::visit_switch_case (tree_switch_case&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_switch_case_list (tree_switch_case_list&)
-{
-  panic_impossible ();
-}
-
-void
-tree_evaluator::visit_switch_command (tree_switch_command& cmd)
-{
-  if (debug_mode)
-    do_breakpoint (cmd.is_breakpoint ());
-
-  tree_expression *expr = cmd.switch_value ();
-
-  if (expr)
-    {
-      octave_value val = expr->rvalue1 ();
-
-      tree_switch_case_list *lst = cmd.case_list ();
-
-      if (! error_state && lst)
-        {
-          for (tree_switch_case_list::iterator p = lst->begin ();
-               p != lst->end (); p++)
-            {
-              tree_switch_case *t = *p;
-
-              if (debug_mode && ! t->is_default_case ())
-                do_breakpoint (t->is_breakpoint ());
-
-              if (t->is_default_case () || t->label_matches (val))
-                {
-                  if (error_state)
-                    break;
-
-                  tree_statement_list *stmt_lst = t->commands ();
-
-                  if (stmt_lst)
-                    stmt_lst->accept (*this);
-
-                  break;
-                }
-            }
-        }
-    }
-  else
-    ::error ("missing value in switch command near line %d, column %d",
-             cmd.line (), cmd.column ());
-}
-
-void
-tree_evaluator::visit_try_catch_command (tree_try_catch_command& cmd)
-{
-  unwind_protect frame;
-
-  frame.protect_var (buffer_error_messages);
-  frame.protect_var (Vdebug_on_error);
-  frame.protect_var (Vdebug_on_warning);
-
-  buffer_error_messages++;
-  Vdebug_on_error = false;
-  Vdebug_on_warning = false;
-
-  tree_statement_list *catch_code = cmd.cleanup ();
-
-  // The catch code is *not* added to unwind_protect stack; it doesn't need
-  // to be run on interrupts.
-
-  tree_statement_list *try_code = cmd.body ();
-
-  if (try_code)
-    {
-      try_code->accept (*this);
-      // FIXME: should std::bad_alloc be handled here?
-    }
-
-  if (error_state)
-    {
-      error_state = 0;
-
-      if (catch_code)
-        {
-          // Set up for letting the user print any messages from errors that
-          // occurred in the body of the try_catch statement.
-
-          buffer_error_messages--;
-
-          if (catch_code)
-            catch_code->accept (*this);
-        }
-    }
-}
-
-void
-tree_evaluator::do_unwind_protect_cleanup_code (tree_statement_list *list)
-{
-  unwind_protect frame;
-
-  frame.protect_var (octave_interrupt_state);
-  octave_interrupt_state = 0;
-
-  // We want to run the cleanup code without error_state being set,
-  // but we need to restore its value, so that any errors encountered
-  // in the first part of the unwind_protect are not completely
-  // ignored.
-
-  frame.protect_var (error_state);
-  error_state = 0;
-
-  // We want to preserve the last statement indicator for possible
-  // backtracking.
-  frame.add_fcn (octave_call_stack::set_statement,
-                 octave_call_stack::current_statement ());
-
-  // Similarly, if we have seen a return or break statement, allow all
-  // the cleanup code to run before returning or handling the break.
-  // We don't have to worry about continue statements because they can
-  // only occur in loops.
-
-  frame.protect_var (tree_return_command::returning);
-  tree_return_command::returning = 0;
-
-  frame.protect_var (tree_break_command::breaking);
-  tree_break_command::breaking = 0;
-
-  if (list)
-    list->accept (*this);
-
-  // The unwind_protects are popped off the stack in the reverse of
-  // the order they are pushed on.
-
-  // FIXME -- these statements say that if we see a break or
-  // return statement in the cleanup block, that we want to use the
-  // new value of the breaking or returning flag instead of restoring
-  // the previous value.  Is that the right thing to do?  I think so.
-  // Consider the case of
-  //
-  //   function foo ()
-  //     unwind_protect
-  //       stderr << "1: this should always be executed\n";
-  //       break;
-  //       stderr << "1: this should never be executed\n";
-  //     unwind_protect_cleanup
-  //       stderr << "2: this should always be executed\n";
-  //       return;
-  //       stderr << "2: this should never be executed\n";
-  //     end_unwind_protect
-  //   endfunction
-  //
-  // If we reset the value of the breaking flag, both the returning
-  // flag and the breaking flag will be set, and we shouldn't have
-  // both.  So, use the most recent one.  If there is no return or
-  // break in the cleanup block, the values should be reset to
-  // whatever they were when the cleanup block was entered.
-
-  if (tree_break_command::breaking || tree_return_command::returning)
-    {
-      frame.discard_top (2);
-    }
-  else
-    {
-      frame.run_top (2);
-    }
-
-  // We don't want to ignore errors that occur in the cleanup code, so
-  // if an error is encountered there, leave error_state alone.
-  // Otherwise, set it back to what it was before.
-
-  if (error_state)
-    frame.discard_top (2);
-  else
-    frame.run_top (2);
-
-  frame.run ();
-}
-
-void
-tree_evaluator::visit_unwind_protect_command (tree_unwind_protect_command& cmd)
-{
-  tree_statement_list *cleanup_code = cmd.cleanup ();
-
-  tree_statement_list *unwind_protect_code = cmd.body ();
-
-  if (unwind_protect_code)
-    {
-      try
-        {
-          unwind_protect_code->accept (*this);
-        }
-      catch (...)
-        {
-          // Run the cleanup code on exceptions, so that it is run even in case
-          // of interrupt or out-of-memory.
-          do_unwind_protect_cleanup_code (cleanup_code);
-          // FIXME: should error_state be checked here?
-          // We want to rethrow the exception, even if error_state is set, so
-          // that interrupts continue.
-          throw;
-        }
-
-      do_unwind_protect_cleanup_code (cleanup_code);
-    }
-}
-
-void
-tree_evaluator::visit_while_command (tree_while_command& cmd)
-{
-  if (error_state)
-    return;
-
-#if HAVE_LLVM
-  if (jiter.execute (cmd))
-    return;
-#endif
-
-  unwind_protect frame;
-
-  frame.protect_var (in_loop_command);
-
-  in_loop_command = true;
-
-  tree_expression *expr = cmd.condition ();
-
-  if (! expr)
-    panic_impossible ();
-
-  for (;;)
-    {
-      if (debug_mode)
-        do_breakpoint (cmd.is_breakpoint ());
-
-      if (expr->is_logically_true ("while"))
-        {
-          tree_statement_list *loop_body = cmd.body ();
-
-          if (loop_body)
-            {
-              loop_body->accept (*this);
-
-              if (error_state)
-                return;
-            }
-
-          if (quit_loop_now ())
-            break;
-        }
-      else
-        break;
-    }
-}
-
-void
-tree_evaluator::visit_do_until_command (tree_do_until_command& cmd)
-{
-  if (error_state)
-    return;
-
-  unwind_protect frame;
-
-  frame.protect_var (in_loop_command);
-
-  in_loop_command = true;
-
-  tree_expression *expr = cmd.condition ();
-
-  if (! expr)
-    panic_impossible ();
-
-  for (;;)
-    {
-      tree_statement_list *loop_body = cmd.body ();
-
-      if (loop_body)
-        {
-          loop_body->accept (*this);
-
-          if (error_state)
-            return;
-        }
-
-      if (quit_loop_now ())
-        break;
-
-      if (debug_mode)
-        do_breakpoint (cmd.is_breakpoint ());
-
-      if (expr->is_logically_true ("do-until"))
-        break;
-    }
-}
-
-void
-tree_evaluator::do_breakpoint (tree_statement& stmt) const
-{
-  do_breakpoint (stmt.is_breakpoint (), stmt.is_end_of_fcn_or_script ());
-}
-
-void
-tree_evaluator::do_breakpoint (bool is_breakpoint,
-                               bool is_end_of_fcn_or_script) const
-{
-  bool break_on_this_statement = false;
-
-  // Don't decrement break flag unless we are in the same frame as we
-  // were when we saw the "dbstep N" command.
-
-  if (dbstep_flag > 1)
-    {
-      if (octave_call_stack::current_frame () == current_frame)
-        {
-          // Don't allow dbstep N to step past end of current frame.
-
-          if (is_end_of_fcn_or_script)
-            dbstep_flag = 1;
-          else
-            dbstep_flag--;
-        }
-    }
-
-  if (octave_debug_on_interrupt_state)
-    {
-      break_on_this_statement = true;
-
-      octave_debug_on_interrupt_state = false;
-
-      current_frame = octave_call_stack::current_frame ();
-    }
-  else if (is_breakpoint)
-    {
-      break_on_this_statement = true;
-
-      dbstep_flag = 0;
-
-      current_frame = octave_call_stack::current_frame ();
-    }
-  else if (dbstep_flag == 1)
-    {
-      if (octave_call_stack::current_frame () == current_frame)
-        {
-          // We get here if we are doing a "dbstep" or a "dbstep N"
-          // and the count has reached 1 and we are in the current
-          // debugging frame.
-
-          break_on_this_statement = true;
-
-          dbstep_flag = 0;
-        }
-    }
-  else if (dbstep_flag == -1)
-    {
-      // We get here if we are doing a "dbstep in".
-
-      break_on_this_statement = true;
-
-      dbstep_flag = 0;
-
-      current_frame = octave_call_stack::current_frame ();
-    }
-  else if (dbstep_flag == -2)
-    {
-      // We get here if we are doing a "dbstep out".
-
-      if (is_end_of_fcn_or_script)
-        dbstep_flag = -1;
-    }
-
-  if (break_on_this_statement)
-    do_keyboard ();
-
-}
-
-// ARGS is currently unused, but since the do_keyboard function in
-// input.cc accepts an argument list, we preserve it here so that the
-// interface won't have to change if we decide to use it in the future.
-
-octave_value
-tree_evaluator::do_keyboard (const octave_value_list& args) const
-{
-  return ::do_keyboard (args);
-}
-
-DEFUN (max_recursion_depth, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} max_recursion_depth ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} max_recursion_depth (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} max_recursion_depth (@var{new_val}, \"local\")\n\
-Query or set the internal limit on the number of times a function may\n\
-be called recursively.  If the limit is exceeded, an error message is\n\
-printed and control returns to the top level.\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE (max_recursion_depth);
-}
-
-/*
-%!test
-%! orig_val = max_recursion_depth ();
-%! old_val = max_recursion_depth (2*orig_val);
-%! assert (orig_val, old_val);
-%! assert (max_recursion_depth (), 2*orig_val);
-%! max_recursion_depth (orig_val);
-%! assert (max_recursion_depth (), orig_val);
-
-%!error (max_recursion_depth (1, 2))
-*/
-
-DEFUN (silent_functions, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} silent_functions ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} silent_functions (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} silent_functions (@var{new_val}, \"local\")\n\
-Query or set the internal variable that controls whether internal\n\
-output from a function is suppressed.  If this option is disabled,\n\
-Octave will display the results produced by evaluating expressions\n\
-within a function body that are not terminated with a semicolon.\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE (silent_functions);
-}
-
-/*
-%!test
-%! orig_val = silent_functions ();
-%! old_val = silent_functions (! orig_val);
-%! assert (orig_val, old_val);
-%! assert (silent_functions (), ! orig_val);
-%! silent_functions (orig_val);
-%! assert (silent_functions (), orig_val);
-
-%!error (silent_functions (1, 2))
-*/
--- a/src/pt-eval.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
-
-Copyright (C) 2009-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_eval_h)
-#define octave_tree_eval_h 1
-
-#include <stack>
-#include <string>
-
-#include "comment-list.h"
-#include "oct-obj.h"
-#include "pt-walk.h"
-
-class tree_expression;
-
-// How to evaluate the code that the parse trees represent.
-
-class
-OCTINTERP_API
-tree_evaluator : public tree_walker
-{
-public:
-
-  typedef void (*decl_elt_init_fcn) (tree_decl_elt&);
-
-  tree_evaluator (void) { }
-
-  ~tree_evaluator (void) { }
-
-  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 do_unwind_protect_cleanup_code (tree_statement_list *list);
-
-  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&);
-
-  static void reset_debug_state (void);
-
-  // If > 0, stop executing at the (N-1)th stopping point, counting
-  //         from the the current execution point in the current frame.
-  //
-  // If < 0, stop executing at the next possible stopping point.
-  static int dbstep_flag;
-
-  // The number of the stack frame we are currently debugging.
-  static size_t current_frame;
-
-  static bool debug_mode;
-
-  // Possible types of evaluation contexts.
-  enum stmt_list_type
-  {
-    function,  // function body
-    script,    // script file
-    other      // command-line input or eval string
-  };
-
-  // The context for the current evaluation.
-  static stmt_list_type statement_context;
-
-  // TRUE means we are evaluating some kind of looping construct.
-  static bool in_loop_command;
-
-private:
-
-  void do_decl_init_list (decl_elt_init_fcn fcn,
-                          tree_decl_init_list *init_list);
-
-  void do_breakpoint (tree_statement& stmt) const;
-
-  void do_breakpoint (bool is_breakpoint,
-                      bool is_end_of_fcn_or_script = false) const;
-
-  virtual octave_value
-  do_keyboard (const octave_value_list& args = octave_value_list ()) const;
-
-  // No copying!
-
-  tree_evaluator (const tree_evaluator&);
-
-  tree_evaluator& operator = (const tree_evaluator&);
-};
-
-extern tree_evaluator *current_evaluator;
-
-// Maximum nesting level for functions, scripts, or sourced files called
-// recursively.
-extern int Vmax_recursion_depth;
-
-#endif
--- a/src/pt-except.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "quit.h"
-
-#include "error.h"
-#include "oct-lvalue.h"
-#include "ov.h"
-#include "pt-bp.h"
-#include "pt-cmd.h"
-#include "pt-except.h"
-#include "pt-exp.h"
-#include "pt-jump.h"
-#include "pt-stmt.h"
-#include "pt-walk.h"
-#include "unwind-prot.h"
-#include "variables.h"
-
-// Simple exception handling.
-
-tree_try_catch_command::~tree_try_catch_command (void)
-{
-  delete try_code;
-  delete catch_code;
-  delete lead_comm;
-  delete mid_comm;
-  delete trail_comm;
-}
-
-tree_command *
-tree_try_catch_command::dup (symbol_table::scope_id scope,
-                             symbol_table::context_id context) const
-{
-  return new
-    tree_try_catch_command (try_code ? try_code->dup (scope, context) : 0,
-                            catch_code ? catch_code->dup (scope, context) : 0,
-                            lead_comm ? lead_comm->dup () : 0,
-                            mid_comm ? mid_comm->dup () : 0,
-                            trail_comm ? trail_comm->dup () : 0,
-                            line (), column ());
-}
-
-void
-tree_try_catch_command::accept (tree_walker& tw)
-{
-  tw.visit_try_catch_command (*this);
-}
-
-// Simple exception handling.
-
-tree_unwind_protect_command::~tree_unwind_protect_command (void)
-{
-  delete unwind_protect_code;
-  delete cleanup_code;
-  delete lead_comm;
-  delete mid_comm;
-  delete trail_comm;
-}
-
-tree_command *
-tree_unwind_protect_command::dup (symbol_table::scope_id scope,
-                                  symbol_table::context_id context) const
-{
-  return new tree_unwind_protect_command
-    (unwind_protect_code ? unwind_protect_code->dup (scope, context) : 0,
-     cleanup_code ? cleanup_code->dup (scope, context) : 0,
-     lead_comm ? lead_comm->dup () : 0,
-     mid_comm ? mid_comm->dup () : 0,
-     trail_comm ? trail_comm->dup () : 0,
-     line (), column ());
-}
-
-void
-tree_unwind_protect_command::accept (tree_walker& tw)
-{
-  tw.visit_unwind_protect_command (*this);
-}
--- a/src/pt-except.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_except_h)
-#define octave_tree_except_h 1
-
-class tree_statement_list;
-
-class tree_walker;
-
-#include "comment-list.h"
-#include "pt-cmd.h"
-#include "symtab.h"
-
-// Simple exception handling.
-
-class
-tree_try_catch_command : public tree_command
-{
-public:
-
-  tree_try_catch_command (int l = -1, int c = -1)
-    : tree_command (l, c), try_code (0), catch_code (0), lead_comm (0),
-      mid_comm (0), trail_comm (0) { }
-
-  tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc,
-                          octave_comment_list *cl = 0,
-                          octave_comment_list *cm = 0,
-                          octave_comment_list *ct = 0,
-                          int l = -1, int c = -1)
-    : tree_command (l, c), try_code (tc), catch_code (cc),
-      lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
-
-  ~tree_try_catch_command (void);
-
-  tree_statement_list *body (void) { return try_code; }
-
-  tree_statement_list *cleanup (void) { return catch_code; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  octave_comment_list *middle_comment (void) { return mid_comm; }
-
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // The first block of code to attempt to execute.
-  tree_statement_list *try_code;
-
-  // The code to execute if an error occurs in the first block.
-  tree_statement_list *catch_code;
-
-  // Comment preceding TRY token.
-  octave_comment_list *lead_comm;
-
-  // Comment preceding CATCH token.
-  octave_comment_list *mid_comm;
-
-  // Comment preceding END_TRY_CATCH token.
-  octave_comment_list *trail_comm;
-
-  // No copying!
-
-  tree_try_catch_command (const tree_try_catch_command&);
-
-  tree_try_catch_command& operator = (const tree_try_catch_command&);
-};
-
-// Simple exception handling.
-
-class
-tree_unwind_protect_command : public tree_command
-{
-public:
-
-  tree_unwind_protect_command (int l = -1, int c = -1)
-    : tree_command (l, c), unwind_protect_code (0), cleanup_code (0),
-      lead_comm (0), mid_comm (0), trail_comm (0) { }
-
-  tree_unwind_protect_command (tree_statement_list *tc,
-                               tree_statement_list *cc,
-                               octave_comment_list *cl = 0,
-                               octave_comment_list *cm = 0,
-                               octave_comment_list *ct = 0,
-                               int l = -1, int c = -1)
-    : tree_command (l, c), unwind_protect_code (tc), cleanup_code (cc),
-      lead_comm (cl), mid_comm (cm), trail_comm (ct) { }
-
-  ~tree_unwind_protect_command (void);
-
-  tree_statement_list *body (void) { return unwind_protect_code; }
-
-  tree_statement_list *cleanup (void) { return cleanup_code; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  octave_comment_list *middle_comment (void) { return mid_comm; }
-
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // The first body of code to attempt to execute.
-  tree_statement_list *unwind_protect_code;
-
-  // The body of code to execute no matter what happens in the first
-  // body of code.
-  tree_statement_list *cleanup_code;
-
-  // Comment preceding UNWIND_PROTECT token.
-  octave_comment_list *lead_comm;
-
-  // Comment preceding UNWIND_PROTECT_CLEANUP token.
-  octave_comment_list *mid_comm;
-
-  // Comment preceding END_UNWIND_PROTECT token.
-  octave_comment_list *trail_comm;
-
-  // No copying!
-
-  tree_unwind_protect_command (const tree_unwind_protect_command&);
-
-  tree_unwind_protect_command& operator = (const tree_unwind_protect_command&);
-};
-
-#endif
--- a/src/pt-exp.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <string>
-
-#include "error.h"
-#include "pager.h"
-#include "oct-lvalue.h"
-#include "ov.h"
-#include "pt-exp.h"
-
-// Expressions.
-
-bool
-tree_expression::is_logically_true (const char *warn_for)
-{
-  bool expr_value = false;
-
-  octave_value t1 = rvalue1 ();
-
-  if (! error_state)
-    {
-      if (t1.is_defined ())
-        return t1.is_true ();
-      else
-        ::error ("%s: undefined value used in conditional expression",
-                 warn_for);
-    }
-
-  return expr_value;
-}
-
-octave_value
-tree_expression::rvalue1 (int)
-{
-  ::error ("invalid rvalue function called in expression");
-  return octave_value ();
-}
-
-octave_value_list
-tree_expression::rvalue (int)
-{
-  ::error ("invalid rvalue function called in expression");
-  return octave_value_list ();
-}
-
-octave_value_list
-tree_expression::rvalue (int nargout, const std::list<octave_lvalue> *)
-{
-  return rvalue (nargout);
-}
-
-octave_lvalue
-tree_expression::lvalue (void)
-{
-  ::error ("invalid lvalue function called in expression");
-  return octave_lvalue ();
-}
-
-std::string
-tree_expression::original_text (void) const
-{
-  return std::string ();
-}
--- a/src/pt-exp.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_expr_h)
-#define octave_tree_expr_h 1
-
-#include <string>
-#include <list>
-
-class octave_value;
-class octave_lvalue;
-
-#include "pt.h"
-#include "symtab.h"
-
-// A base class for expressions.
-
-class
-tree_expression : public tree
-{
-public:
-
-  tree_expression (int l = -1, int c = -1)
-    : tree (l, c), num_parens (0), postfix_indexed (false),
-      print_flag (false) { }
-
-  virtual ~tree_expression (void) { }
-
-  virtual bool has_magic_end (void) const = 0;
-
-  virtual tree_expression *dup (symbol_table::scope_id,
-                                symbol_table::context_id context) const = 0;
-
-  virtual bool is_constant (void) const { return false; }
-
-  virtual bool is_matrix_constant (void) const { return false; }
-
-  virtual bool is_identifier (void) const { return false; }
-
-  virtual bool is_index_expression (void) const { return false; }
-
-  virtual bool is_assignment_expression (void) const { return false; }
-
-  virtual bool is_prefix_expression (void) const { return false; }
-
-  virtual bool is_unary_expression (void) const { return false; }
-
-  virtual bool is_binary_expression (void) const { return false; }
-
-  virtual bool is_boolean_expression (void) const { return false; }
-
-  virtual bool is_logically_true (const char *);
-
-  virtual bool lvalue_ok (void) const { return false; }
-
-  virtual bool rvalue_ok (void) const { return false; }
-
-  virtual octave_value rvalue1 (int nargout = 1);
-
-  virtual octave_value_list rvalue (int nargout);
-
-  virtual octave_value_list rvalue (int nargout,
-                                    const std::list<octave_lvalue> *lvalue_list);
-
-  virtual octave_lvalue lvalue (void);
-
-  int paren_count (void) const { return num_parens; }
-
-  bool is_postfix_indexed (void) const { return postfix_indexed; }
-
-  bool print_result (void) const { return print_flag; }
-
-  virtual std::string oper (void) const { return "<unknown>"; }
-
-  virtual std::string name (void) const { return "<unknown>"; }
-
-  virtual std::string original_text (void) const;
-
-  virtual void mark_braindead_shortcircuit (const std::string&) { }
-
-  tree_expression *mark_in_parens (void)
-    {
-      num_parens++;
-      return this;
-    }
-
-  tree_expression *mark_postfix_indexed (void)
-    {
-      postfix_indexed = true;
-      return this;
-    }
-
-  tree_expression *set_print_flag (bool print)
-    {
-      print_flag = print;
-      return this;
-    }
-
-  virtual void copy_base (const tree_expression& e)
-    {
-      num_parens = e.num_parens;
-      postfix_indexed = e.postfix_indexed;
-      print_flag = e.print_flag;
-    }
-
-protected:
-
-  // A count of the number of times this expression appears directly
-  // inside a set of parentheses.
-  //
-  //   (((e1)) + e2)  ==> 2 for expression e1
-  //                  ==> 1 for expression ((e1)) + e2
-  //                  ==> 0 for expression e2
-  int num_parens;
-
-  // A flag that says whether this expression has an index associated
-  // with it.  See the code in tree_identifier::rvalue for the rationale.
-  bool postfix_indexed;
-
-  // Print result of rvalue for this expression?
-  bool print_flag;
-
-private:
-
-  // No copying!
-
-  tree_expression (const tree_expression&);
-
-  tree_expression& operator = (const tree_expression&);
-};
-
-#endif
--- a/src/pt-fcn-handle.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
-
-Copyright (C) 2003-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "error.h"
-#include "oct-obj.h"
-#include "ov-fcn-handle.h"
-#include "pt-fcn-handle.h"
-#include "pager.h"
-#include "pt-const.h"
-#include "pt-walk.h"
-#include "variables.h"
-
-void
-tree_fcn_handle::print (std::ostream& os, bool pr_as_read_syntax,
-                        bool pr_orig_text)
-{
-  print_raw (os, pr_as_read_syntax, pr_orig_text);
-}
-
-void
-tree_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax,
-                            bool pr_orig_text)
-{
-  os << ((pr_as_read_syntax || pr_orig_text) ? "@" : "") << nm;
-}
-
-octave_value
-tree_fcn_handle::rvalue1 (int)
-{
-  return make_fcn_handle (nm);
-}
-
-octave_value_list
-tree_fcn_handle::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("invalid number of output arguments for function handle expression");
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-tree_expression *
-tree_fcn_handle::dup (symbol_table::scope_id,
-                      symbol_table::context_id) const
-{
-  tree_fcn_handle *new_fh = new tree_fcn_handle (nm, line (), column ());
-
-  new_fh->copy_base (*this);
-
-  return new_fh;
-}
-
-void
-tree_fcn_handle::accept (tree_walker& tw)
-{
-  tw.visit_fcn_handle (*this);
-}
-
-octave_value
-tree_anon_fcn_handle::rvalue1 (int)
-{
-  // FIXME -- should CMD_LIST be limited to a single expression?
-  // I think that is what Matlab does.
-
-  tree_parameter_list *param_list = parameter_list ();
-  tree_parameter_list *ret_list = return_list ();
-  tree_statement_list *cmd_list = body ();
-  symbol_table::scope_id this_scope = scope ();
-
-  symbol_table::scope_id new_scope = symbol_table::dup_scope (this_scope);
-
-  if (new_scope > 0)
-    symbol_table::inherit (new_scope, symbol_table::current_scope (),
-                           symbol_table::current_context ());
-
-  octave_user_function *uf
-    = new octave_user_function (new_scope,
-                                param_list ? param_list->dup (new_scope, 0) : 0,
-                                ret_list ? ret_list->dup (new_scope, 0) : 0,
-                                cmd_list ? cmd_list->dup (new_scope, 0) : 0);
-
-  octave_function *curr_fcn = octave_call_stack::current ();
-
-  if (curr_fcn)
-    {
-      // FIXME -- maybe it would be better to just stash curr_fcn
-      // instead of individual bits of info about it?
-
-      uf->stash_parent_fcn_name (curr_fcn->name ());
-      uf->stash_dir_name (curr_fcn->dir_name ());
-
-      symbol_table::scope_id parent_scope = curr_fcn->parent_fcn_scope ();
-
-      if (parent_scope < 0)
-        parent_scope = curr_fcn->scope ();
-
-      uf->stash_parent_fcn_scope (parent_scope);
-
-      if (curr_fcn->is_class_method () || curr_fcn->is_class_constructor ())
-        uf->stash_dispatch_class (curr_fcn->dispatch_class ());
-    }
-
-  uf->mark_as_anonymous_function ();
-  uf->stash_fcn_file_name (file_name);
-  uf->stash_fcn_location (line (), column ());
-
-  octave_value ov_fcn (uf);
-
-  octave_value fh (octave_fcn_binder::maybe_binder (ov_fcn));
-
-  return fh;
-}
-
-/*
-%!function r = __f2 (f, x)
-%!  r = f (x);
-%!endfunction
-%!function f = __f1 (k)
-%!  f = @(x) __f2 (@(y) y-k, x);
-%!endfunction
-
-%!assert ((__f1 (3)) (10) == 7)
-
-%!test
-%! g = @(t) feval (@(x) t*x, 2);
-%! assert (g(0.5) == 1);
-
-%!test
-%! h = @(x) sin (x);
-%! g = @(f, x) h (x);
-%! f = @() g (@(x) h, pi);
-%! assert (f () == sin (pi));
-*/
-
-octave_value_list
-tree_anon_fcn_handle::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("invalid number of output arguments for anonymous function handle expression");
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-tree_expression *
-tree_anon_fcn_handle::dup (symbol_table::scope_id,
-                           symbol_table::context_id) const
-{
-  tree_parameter_list *param_list = parameter_list ();
-  tree_parameter_list *ret_list = return_list ();
-  tree_statement_list *cmd_list = body ();
-  symbol_table::scope_id this_scope = scope ();
-
-  symbol_table::scope_id new_scope = symbol_table::dup_scope (this_scope);
-
-  if (new_scope > 0)
-    symbol_table::inherit (new_scope, symbol_table::current_scope (),
-                           symbol_table::current_context ());
-
-  tree_anon_fcn_handle *new_afh = new
-    tree_anon_fcn_handle (param_list ? param_list->dup (new_scope, 0) : 0,
-                          ret_list ? ret_list->dup (new_scope, 0) : 0,
-                          cmd_list ? cmd_list->dup (new_scope, 0) : 0,
-                          new_scope, line (), column ());
-
-  new_afh->copy_base (*this);
-
-  return new_afh;
-}
-
-void
-tree_anon_fcn_handle::accept (tree_walker& tw)
-{
-  tw.visit_anon_fcn_handle (*this);
-}
--- a/src/pt-fcn-handle.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
-
-Copyright (C) 2003-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_fcn_handle_h)
-#define octave_fcn_handle_h 1
-
-#include <iosfwd>
-#include <string>
-
-#include "pt-bp.h"
-#include "pt-exp.h"
-#include "pt-misc.h"
-#include "pt-stmt.h"
-#include "symtab.h"
-
-class octave_value_list;
-
-class tree_walker;
-
-#include "ov.h"
-#include "ov-usr-fcn.h"
-#include "symtab.h"
-
-class
-tree_fcn_handle : public tree_expression
-{
-public:
-
-  tree_fcn_handle (int l = -1, int c = -1)
-    : tree_expression (l, c), nm () { }
-
-  tree_fcn_handle (const std::string& n, int l = -1, int c = -1)
-    : tree_expression (l, c), nm (n) { }
-
-  ~tree_fcn_handle (void) { }
-
-  bool has_magic_end (void) const { return false; }
-
-  void print (std::ostream& os, bool pr_as_read_syntax = false,
-              bool pr_orig_txt = true);
-
-  void print_raw (std::ostream& os, bool pr_as_read_syntax = false,
-                  bool pr_orig_txt = true);
-
-  std::string name (void) const { return nm; }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // The name of this function handle.
-  std::string nm;
-
-  // No copying!
-
-  tree_fcn_handle (const tree_fcn_handle&);
-
-  tree_fcn_handle& operator = (const tree_fcn_handle&);
-};
-
-class
-tree_anon_fcn_handle : public tree_expression
-{
-public:
-
-  tree_anon_fcn_handle (int l = -1, int c = -1)
-    : tree_expression (l, c), fcn (0), file_name () { }
-
-  tree_anon_fcn_handle (tree_parameter_list *pl, tree_parameter_list *rl,
-                        tree_statement_list *cl, symbol_table::scope_id sid,
-                        int l = -1, int c = -1)
-    : tree_expression (l, c),
-      fcn (new octave_user_function (sid, pl, rl, cl)),
-      file_name () { }
-
-  ~tree_anon_fcn_handle (void) { delete fcn; }
-
-  bool has_magic_end (void) const { return false; }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  tree_parameter_list *parameter_list (void) const
-  {
-    return fcn ? fcn->parameter_list () : 0;
-  }
-
-  tree_parameter_list *return_list (void) const
-  {
-    return fcn ? fcn->return_list () : 0;
-  }
-
-  tree_statement_list *body (void) const
-  {
-    return fcn ? fcn->body () : 0;
-  }
-
-  symbol_table::scope_id scope (void) const
-  {
-    return fcn ? fcn->scope () : -1;
-  }
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  void stash_file_name (const std::string& file) { file_name = file; }
-
-private:
-
-  // The function.
-  octave_user_function *fcn;
-
-  // Filename where the handle was defined.
-  std::string file_name;
-
-  // No copying!
-
-  tree_anon_fcn_handle (const tree_anon_fcn_handle&);
-
-  tree_anon_fcn_handle& operator = (const tree_anon_fcn_handle&);
-};
-
-#endif
--- a/src/pt-id.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "pager.h"
-#include "pt-bp.h"
-#include "pt-const.h"
-#include "pt-id.h"
-#include "pt-walk.h"
-#include "symtab.h"
-#include "utils.h"
-#include "variables.h"
-
-// Symbols from the symbol table.
-
-void
-tree_identifier::eval_undefined_error (void)
-{
-  int l = line ();
-  int c = column ();
-
-  maybe_missing_function_hook (name ());
-  if (error_state)
-    return;
-
-  if (l == -1 && c == -1)
-    ::error_with_id ("Octave:undefined-function",
-                     "`%s' undefined", name ().c_str ());
-  else
-    ::error_with_id ("Octave:undefined-function",
-                     "`%s' undefined near line %d column %d",
-                     name ().c_str (), l, c);
-}
-
-octave_value_list
-tree_identifier::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (error_state)
-    return retval;
-
-  octave_value val = sym->find ();
-
-  if (val.is_defined ())
-    {
-      // GAGME -- this would be cleaner if we required
-      // parens to indicate function calls.
-      //
-      // If this identifier refers to a function, we need to know
-      // whether it is indexed so that we can do the same thing
-      // for `f' and `f()'.  If the index is present, return the
-      // function object and let tree_index_expression::rvalue
-      // handle indexing.  Otherwise, arrange to call the function
-      // here, so that we don't return the function definition as
-      // a value.
-
-      if (val.is_function () && ! is_postfix_indexed ())
-        {
-          octave_value_list tmp_args;
-
-          retval = val.do_multi_index_op (nargout, tmp_args);
-        }
-      else
-        {
-          if (print_result () && nargout == 0)
-            val.print_with_name (octave_stdout, name ());
-
-          retval = val;
-        }
-    }
-  else
-    eval_undefined_error ();
-
-  return retval;
-}
-
-octave_value
-tree_identifier::rvalue1 (int nargout)
-{
-  octave_value retval;
-
-  octave_value_list tmp = rvalue (nargout);
-
-  if (! tmp.empty ())
-    retval = tmp(0);
-
-  return retval;
-}
-
-octave_lvalue
-tree_identifier::lvalue (void)
-{
-  return octave_lvalue (&(sym->varref ()));
-}
-
-tree_identifier *
-tree_identifier::dup (symbol_table::scope_id sc,
-                      symbol_table::context_id) const
-{
-  // The new tree_identifier object contains a symbol_record
-  // entry from the duplicated scope.
-
-  // FIXME -- is this the best way?
-  symbol_table::symbol_record new_sym
-    = symbol_table::find_symbol (name (), sc);
-
-  tree_identifier *new_id
-    = new tree_identifier (new_sym, line (), column ());
-
-  new_id->copy_base (*this);
-
-  return new_id;
-}
-
-void
-tree_identifier::accept (tree_walker& tw)
-{
-  tw.visit_identifier (*this);
-}
--- a/src/pt-id.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_identifier_h)
-#define octave_tree_identifier_h 1
-
-#include <iosfwd>
-#include <string>
-
-class octave_value;
-class octave_value_list;
-class octave_function;
-
-class tree_walker;
-
-#include "pt-bp.h"
-#include "pt-exp.h"
-#include "symtab.h"
-
-// Symbols from the symbol table.
-
-class
-tree_identifier : public tree_expression
-{
-  friend class tree_index_expression;
-
-public:
-
-  tree_identifier (int l = -1, int c = -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, sc) { }
-
-  ~tree_identifier (void) { }
-
-  bool has_magic_end (void) const { return (name () == "__end__"); }
-
-  bool is_identifier (void) const { return true; }
-
-  // The name doesn't change with scope, so use sym instead of
-  // accessing it through sym so that this function may remain const.
-  std::string name (void) const { return sym.name (); }
-
-  bool is_defined (void) { return sym->is_defined (); }
-
-  virtual bool is_variable (void) { return sym->is_variable (); }
-
-  virtual bool is_black_hole (void) { return false; }
-
-  // Try to find a definition for an identifier.  Here's how:
-  //
-  //   * If the identifier is already defined and is a function defined
-  //     in an function file that has been modified since the last time
-  //     we parsed it, parse it again.
-  //
-  //   * If the identifier is not defined, try to find a builtin
-  //     variable or an already compiled function with the same name.
-  //
-  //   * If the identifier is still undefined, try looking for an
-  //     function file to parse.
-  //
-  //   * On systems that support dynamic linking, we prefer .oct files,
-  //     then .mex files, then .m files.
-
-  octave_value
-  do_lookup (const octave_value_list& args = octave_value_list ())
-  {
-    return sym->find (args);
-  }
-
-  void mark_global (void) { sym->mark_global (); }
-
-  void mark_as_static (void) { sym->init_persistent (); }
-
-  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.
-
-  bool lvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  octave_lvalue lvalue (void);
-
-  void eval_undefined_error (void);
-
-  tree_identifier *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  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_reference sym;
-
-  // No copying!
-
-  tree_identifier (const tree_identifier&);
-
-  tree_identifier& operator = (const tree_identifier&);
-};
-
-class tree_black_hole : public tree_identifier
-{
-public:
-
-  tree_black_hole (int l = -1, int c = -1)
-    : tree_identifier (l, c) { }
-
-  std::string name (void) const { return "~"; }
-
-  bool is_variable (void) { return false; }
-
-  bool is_black_hole (void) { return true; }
-
-  tree_black_hole *dup (void) const
-    { return new tree_black_hole; }
-
-  octave_lvalue lvalue (void)
-    {
-      return octave_lvalue (0); // black hole lvalue
-    }
-};
-
-#endif
--- a/src/pt-idx.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,687 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Cell.h"
-#include "error.h"
-#include "oct-map.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ov.h"
-#include "pager.h"
-#include "pt-arg-list.h"
-#include "pt-bp.h"
-#include "pt-id.h"
-#include "pt-idx.h"
-#include "pt-walk.h"
-#include "utils.h"
-#include "variables.h"
-#include "gripes.h"
-
-// Index expressions.
-
-tree_index_expression::tree_index_expression (int l, int c)
-  : tree_expression (l, c), expr (0), args (0), type (),
-    arg_nm (), dyn_field () { }
-
-tree_index_expression::tree_index_expression (tree_expression *e,
-                                              tree_argument_list *lst,
-                                              int l, int c, char t)
-  : tree_expression (l, c), expr (e), args (0), type (),
-    arg_nm (), dyn_field ()
-{
-  append (lst, t);
-}
-
-tree_index_expression::tree_index_expression (tree_expression *e,
-                                              const std::string& n,
-                                              int l, int c)
-  : tree_expression (l, c), expr (e), args (0), type (),
-    arg_nm (), dyn_field ()
-{
-  append (n);
-}
-
-tree_index_expression::tree_index_expression (tree_expression *e,
-                                              tree_expression *df,
-                                              int l, int c)
-  : tree_expression (l, c), expr (e), args (0), type (),
-    arg_nm (), dyn_field ()
-{
-  append (df);
-}
-
-void
-tree_index_expression::append (tree_argument_list *lst, char t)
-{
-  args.push_back (lst);
-  type.append (1, t);
-  arg_nm.push_back (lst ? lst->get_arg_names () : string_vector ());
-  dyn_field.push_back (static_cast<tree_expression *> (0));
-
-  if (lst && lst->has_magic_tilde ())
-    error ("invalid use of empty argument (~) in index expression");
-}
-
-void
-tree_index_expression::append (const std::string& n)
-{
-  args.push_back (static_cast<tree_argument_list *> (0));
-  type.append (".");
-  arg_nm.push_back (n);
-  dyn_field.push_back (static_cast<tree_expression *> (0));
-}
-
-void
-tree_index_expression::append (tree_expression *df)
-{
-  args.push_back (static_cast<tree_argument_list *> (0));
-  type.append (".");
-  arg_nm.push_back ("");
-  dyn_field.push_back (df);
-}
-
-tree_index_expression::~tree_index_expression (void)
-{
-  delete expr;
-
-  while (! args.empty ())
-    {
-      std::list<tree_argument_list *>::iterator p = args.begin ();
-      delete *p;
-      args.erase (p);
-    }
-
-  while (! dyn_field.empty ())
-    {
-      std::list<tree_expression *>::iterator p = dyn_field.begin ();
-      delete *p;
-      dyn_field.erase (p);
-    }
-}
-
-bool
-tree_index_expression::has_magic_end (void) const
-{
-  for (std::list<tree_argument_list *>::const_iterator p = args.begin ();
-       p != args.end ();
-       p++)
-    {
-      tree_argument_list *elt = *p;
-
-      if (elt && elt->has_magic_end ())
-        return true;
-    }
-
-  return false;
-}
-
-// This is useful for printing the name of the variable in an indexed
-// assignment.
-
-std::string
-tree_index_expression::name (void) const
-{
-  return expr->name ();
-}
-
-static Cell
-make_subs_cell (tree_argument_list *args, const string_vector& arg_nm)
-{
-  Cell retval;
-
-  octave_value_list arg_values;
-
-  if (args)
-    arg_values = args->convert_to_const_vector ();
-
-  if (! error_state)
-    {
-      int n = arg_values.length ();
-
-      if (n > 0)
-        {
-          arg_values.stash_name_tags (arg_nm);
-
-          retval.resize (dim_vector (1, n));
-
-          for (int i = 0; i < n; i++)
-            retval(0,i) = arg_values(i);
-        }
-    }
-
-  return retval;
-}
-
-static inline octave_value_list
-make_value_list (tree_argument_list *args, const string_vector& arg_nm,
-                 const octave_value *object, bool rvalue = true)
-{
-  octave_value_list retval;
-
-  if (args)
-    {
-      if (rvalue && object && args->has_magic_end () && object->is_undefined ())
-        gripe_invalid_inquiry_subscript ();
-      else
-        retval = args->convert_to_const_vector (object);
-    }
-
-  if (! error_state)
-    {
-      octave_idx_type n = retval.length ();
-
-      if (n > 0)
-        retval.stash_name_tags (arg_nm);
-    }
-
-  return retval;
-}
-
-std::string
-tree_index_expression::get_struct_index
-  (std::list<string_vector>::const_iterator p_arg_nm,
-   std::list<tree_expression *>::const_iterator p_dyn_field) const
-{
-  std::string fn = (*p_arg_nm)(0);
-
-  if (fn.empty ())
-    {
-      tree_expression *df = *p_dyn_field;
-
-      if (df)
-        {
-          octave_value t = df->rvalue1 ();
-
-          if (! error_state)
-            {
-              fn = t.string_value ();
-
-              if (! valid_identifier (fn))
-                ::error ("invalid structure field name `%s'", fn.c_str ());
-            }
-        }
-      else
-        panic_impossible ();
-    }
-
-  return fn;
-}
-
-octave_map
-tree_index_expression::make_arg_struct (void) const
-{
-  int n = args.size ();
-
-  Cell type_field (n, 1);
-  Cell subs_field (n, 1);
-
-  std::list<tree_argument_list *>::const_iterator p_args = args.begin ();
-  std::list<string_vector>::const_iterator p_arg_nm = arg_nm.begin ();
-  std::list<tree_expression *>::const_iterator p_dyn_field = dyn_field.begin ();
-
-  octave_map m;
-
-  for (int i = 0; i < n; i++)
-    {
-      switch (type[i])
-        {
-        case '(':
-          subs_field(i) = make_subs_cell (*p_args, *p_arg_nm);
-          break;
-
-        case '{':
-          subs_field(i) = make_subs_cell (*p_args, *p_arg_nm);
-          break;
-
-        case '.':
-          subs_field(i) = get_struct_index (p_arg_nm, p_dyn_field);
-          break;
-
-        default:
-          panic_impossible ();
-        }
-
-      if (error_state)
-        return m;
-
-      p_args++;
-      p_arg_nm++;
-      p_dyn_field++;
-    }
-
-  m.assign ("type", type_field);
-  m.assign ("subs", subs_field);
-
-  return m;
-}
-
-octave_value_list
-tree_index_expression::rvalue (int nargout)
-{
-  return tree_index_expression::rvalue (nargout, 0);
-}
-
-octave_value_list
-tree_index_expression::rvalue (int nargout, const std::list<octave_lvalue> *lvalue_list)
-{
-  octave_value_list retval;
-
-  if (error_state)
-    return retval;
-
-  octave_value first_expr_val;
-
-  octave_value_list first_args;
-
-  bool have_args = false;
-
-  if (expr->is_identifier () && type[0] == '(')
-    {
-      tree_identifier *id = dynamic_cast<tree_identifier *> (expr);
-
-      if (! (id->is_variable () || args.empty ()))
-        {
-          tree_argument_list *al = *(args.begin ());
-
-          size_t n = al ? al->length () : 0;
-
-          if (n > 0)
-            {
-              string_vector anm = *(arg_nm.begin ());
-              have_args = true;
-              first_args = al -> convert_to_const_vector ();
-              first_args.stash_name_tags (anm);
-
-              if (! error_state)
-                first_expr_val = id->do_lookup  (first_args);
-            }
-        }
-    }
-
-  if (! error_state)
-    {
-      if (first_expr_val.is_undefined ())
-        first_expr_val = expr->rvalue1 ();
-
-      octave_value tmp = first_expr_val;
-      octave_idx_type tmpi = 0;
-
-      std::list<octave_value_list> idx;
-
-      int n = args.size ();
-
-      std::list<tree_argument_list *>::iterator p_args = args.begin ();
-      std::list<string_vector>::iterator p_arg_nm = arg_nm.begin ();
-      std::list<tree_expression *>::iterator p_dyn_field = dyn_field.begin ();
-
-      for (int i = 0; i < n; i++)
-        {
-          if (i > 0)
-            {
-              tree_argument_list *al = *p_args;
-
-              // In Matlab, () can only be followed by . In Octave, we do not
-              // enforce this for rvalue expressions, but we'll split the
-              // evaluation at this point. This will, hopefully, allow Octave's
-              // looser rules apply smoothly for Matlab overloaded subsref
-              // codes.
-              bool force_split = type[i-1] == '(' && type[i] != '.';
-
-              if (force_split || (al && al->has_magic_end ()))
-                {
-                  // We have an expression like
-                  //
-                  //   x{end}.a(end)
-                  //
-                  // and we are looking at the argument list that
-                  // contains the second (or third, etc.) "end" token,
-                  // so we must evaluate everything up to the point of
-                  // that argument list so we can pass the appropriate
-                  // value to the built-in __end__ function.
-
-                  const octave_value_list tmp_list
-                    = tmp.subsref (type.substr (tmpi, i - tmpi), idx, nargout);
-
-                  tmp = tmp_list.length () ? tmp_list(0) : octave_value ();
-                  tmpi = i;
-                  idx.clear ();
-
-                  if (tmp.is_cs_list ())
-                    gripe_indexed_cs_list ();
-
-                  if (error_state)
-                    break;
-                }
-            }
-
-          switch (type[i])
-            {
-            case '(':
-              if (have_args)
-                {
-                  idx.push_back (first_args);
-                  have_args = false;
-                }
-              else
-                idx.push_back (make_value_list (*p_args, *p_arg_nm, &tmp));
-              break;
-
-            case '{':
-              idx.push_back (make_value_list (*p_args, *p_arg_nm, &tmp));
-              break;
-
-            case '.':
-              idx.push_back (octave_value (get_struct_index (p_arg_nm, p_dyn_field)));
-              break;
-
-            default:
-              panic_impossible ();
-            }
-
-          if (error_state)
-            break;
-
-          p_args++;
-          p_arg_nm++;
-          p_dyn_field++;
-        }
-
-      if (! error_state)
-        retval = tmp.subsref (type.substr (tmpi, n - tmpi), idx, nargout,
-                              lvalue_list);
-    }
-
-  return retval;
-}
-
-octave_value
-tree_index_expression::rvalue1 (int nargout)
-{
-  octave_value retval;
-
-  const octave_value_list tmp = rvalue (nargout);
-
-  if (! tmp.empty ())
-    retval = tmp(0);
-
-  return retval;
-}
-
-octave_lvalue
-tree_index_expression::lvalue (void)
-{
-  octave_lvalue retval;
-
-  std::list<octave_value_list> idx;
-  std::string tmp_type;
-
-  int n = args.size ();
-
-  std::list<tree_argument_list *>::iterator p_args = args.begin ();
-  std::list<string_vector>::iterator p_arg_nm = arg_nm.begin ();
-  std::list<tree_expression *>::iterator p_dyn_field = dyn_field.begin ();
-
-  retval = expr->lvalue ();
-
-  if (! error_state)
-    {
-      const octave_value *tro = retval.object ();
-
-      octave_value tmp;
-
-      if (tro)
-        tmp = *tro;
-
-      octave_idx_type tmpi = 0;
-      std::list<octave_value_list> tmpidx;
-
-      for (int i = 0; i < n; i++)
-        {
-          if (retval.numel () != 1)
-            gripe_indexed_cs_list ();
-          else if (tmpi < i)
-            {
-              tmp = tmp.subsref (type.substr (tmpi, i - tmpi), tmpidx, true);
-              tmpidx.clear ();
-            }
-
-          if (error_state)
-            break;
-
-          switch (type[i])
-            {
-            case '(':
-              {
-                octave_value_list tidx
-                  = make_value_list (*p_args, *p_arg_nm, &tmp, false);
-
-                idx.push_back (tidx);
-
-                if (i < n - 1)
-                  {
-                    if (type[i+1] == '.')
-                      {
-                        tmpidx.push_back (tidx);
-                        tmpi = i+1;
-                      }
-                    else
-                      error ("() must be followed by . or close the index chain");
-                  }
-              }
-              break;
-
-            case '{':
-              {
-                octave_value_list tidx
-                  = make_value_list (*p_args, *p_arg_nm, &tmp, false);
-
-                if (tmp.is_undefined ())
-                  {
-                    if (tidx.has_magic_colon ())
-                      gripe_invalid_inquiry_subscript ();
-                    else
-                      tmp = Cell ();
-                  }
-                else if (tmp.is_zero_by_zero ()
-                         && (tmp.is_matrix_type () || tmp.is_string ()))
-                  {
-                    tmp = Cell ();
-                  }
-
-                retval.numel (tmp.numel (tidx));
-
-                if (error_state)
-                  break;
-
-                idx.push_back (tidx);
-                tmpidx.push_back (tidx);
-                tmpi = i;
-              }
-              break;
-
-            case '.':
-              {
-                octave_value tidx = get_struct_index (p_arg_nm, p_dyn_field);
-                if (error_state)
-                  break;
-
-                bool autoconv = (tmp.is_zero_by_zero ()
-                                 && (tmp.is_matrix_type () || tmp.is_string ()
-                                     || tmp.is_cell ()));
-
-                if (i > 0 && type[i-1] == '(')
-                  {
-                    octave_value_list pidx = idx.back ();
-
-                    // Use octave_map, not octave_scalar_map so that the
-                    // dimensions are 0x0, not 1x1.
-                    if (tmp.is_undefined ())
-                      {
-                        if (pidx.has_magic_colon ())
-                          gripe_invalid_inquiry_subscript ();
-                        else
-                          tmp = octave_map ();
-                      }
-                    else if (autoconv)
-                      tmp = octave_map ();
-
-                    retval.numel (tmp.numel (pidx));
-
-                    tmpi = i-1;
-                    tmpidx.push_back (tidx);
-                  }
-                else
-                  {
-                    if (tmp.is_undefined () || autoconv)
-                      {
-                        tmpi = i+1;
-                        tmp = octave_value ();
-                      }
-                    else
-                      {
-                        retval.numel (tmp.numel (octave_value_list ()));
-
-                        tmpi = i;
-                        tmpidx.push_back (tidx);
-                      }
-                  }
-
-                if (error_state)
-                  break;
-
-                idx.push_back (tidx);
-              }
-              break;
-
-            default:
-              panic_impossible ();
-            }
-
-          if (idx.back ().empty ())
-            error ("invalid empty index list");
-
-          if (error_state)
-            break;
-
-          p_args++;
-          p_arg_nm++;
-          p_dyn_field++;
-        }
-
-      if (! error_state)
-        retval.set_index (type, idx);
-
-    }
-
-  return retval;
-}
-
-/*
-%!test
-%! clear x;
-%! clear y;
-%! y = 3;
-%! x(y(end)) = 1;
-%! assert (x, [0, 0, 1]);
-%! clear x;
-%! clear y;
-%! y = {3};
-%! x(y{end}) = 1;
-%! assert (x, [0, 0, 1]);
-
-%!test
-%! x = {1, 2, 3};
-%! [x{:}] = deal (4, 5, 6);
-%! assert (x, {4, 5, 6});
-
-%!test
-%! [x.a, x.b.c] = deal (1, 2);
-%! assert (x.a == 1 && x.b.c == 2);
-
-%!test
-%! [x.a, x(2).b] = deal (1, 2);
-%! assert (x(1).a == 1 && isempty (x(2).a) && isempty (x(1).b) && x(2).b == 2);
-
-%!test
-%! x = struct (zeros (0, 1), {"a", "b"});
-%! x(2).b = 1;
-%! assert (x(2).b == 1);
-
-%!test
-%! x = struct (zeros (0, 1), {"a", "b"});
-%! x(2).b = 1;
-%! assert (x(2).b == 1);
-*/
-
-tree_index_expression *
-tree_index_expression::dup (symbol_table::scope_id scope,
-                            symbol_table::context_id context) const
-{
-  tree_index_expression *new_idx_expr
-    = new tree_index_expression (line (), column ());
-
-  new_idx_expr->expr = expr ? expr->dup (scope, context) : 0;
-
-  std::list<tree_argument_list *> new_args;
-
-  for (std::list<tree_argument_list *>::const_iterator p = args.begin ();
-       p != args.end ();
-       p++)
-    {
-      const tree_argument_list *elt = *p;
-
-      new_args.push_back (elt ? elt->dup (scope, context) : 0);
-    }
-
-  new_idx_expr->args = new_args;
-
-  new_idx_expr->type = type;
-
-  new_idx_expr->arg_nm = arg_nm;
-
-  std::list<tree_expression *> new_dyn_field;
-
-  for (std::list<tree_expression *>::const_iterator p = dyn_field.begin ();
-       p != dyn_field.end ();
-       p++)
-    {
-      const tree_expression *elt = *p;
-
-      new_dyn_field.push_back (elt ? elt->dup (scope, context) : 0);
-    }
-
-  new_idx_expr->dyn_field = new_dyn_field;
-
-  new_idx_expr->copy_base (*this);
-
-  return new_idx_expr;
-}
-
-void
-tree_index_expression::accept (tree_walker& tw)
-{
-  tw.visit_index_expression (*this);
-}
--- a/src/pt-idx.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_index_h)
-#define octave_tree_index_h 1
-
-#include <list>
-
-class tree_argument_list;
-
-class tree_walker;
-
-class octave_map;
-class octave_value;
-class octave_value_list;
-class octave_lvalue;
-
-#include "str-vec.h"
-
-#include "pt-exp.h"
-#include "symtab.h"
-
-// Index expressions.
-
-class
-tree_index_expression : public tree_expression
-{
-public:
-
-  tree_index_expression (tree_expression *e = 0, tree_argument_list *lst = 0,
-                         int l = -1, int c = -1, char t = '(');
-
-  tree_index_expression (tree_expression *e, const std::string& n,
-                         int l = -1, int c = -1);
-
-  tree_index_expression (tree_expression *e, tree_expression* df,
-                         int l = -1, int c = -1);
-
-  ~tree_index_expression (void);
-
-  bool has_magic_end (void) const;
-
-  void append (tree_argument_list *lst = 0, char t = '(');
-
-  void append (const std::string& n);
-
-  void append (tree_expression *df);
-
-  bool is_index_expression (void) const { return true; }
-
-  std::string name (void) const;
-
-  tree_expression *expression (void) { return expr; }
-
-  std::list<tree_argument_list *> arg_lists (void) { return args; }
-
-  std::string type_tags (void) { return type; }
-
-  std::list<string_vector> arg_names (void) { return arg_nm; }
-
-  bool lvalue_ok (void) const { return expr->lvalue_ok (); }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  octave_value_list rvalue (int nargout, const std::list<octave_lvalue> *lvalue_list);
-
-  octave_lvalue lvalue (void);
-
-  tree_index_expression *dup (symbol_table::scope_id scope,
-                              symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // The LHS of this index expression.
-  tree_expression *expr;
-
-  // The indices (only valid if type == paren || type == brace).
-  std::list<tree_argument_list *> args;
-
-  // The type of this index expression.
-  std::string type;
-
-  // The names of the arguments.  Used for constant struct element
-  // references.
-  std::list<string_vector> arg_nm;
-
-  // The list of dynamic field names, if any.
-  std::list<tree_expression *> dyn_field;
-
-  tree_index_expression (int l, int c);
-
-  octave_map make_arg_struct (void) const;
-
-  std::string
-  get_struct_index
-    (std::list<string_vector>::const_iterator p_arg_nm,
-     std::list<tree_expression *>::const_iterator p_dyn_field) const;
-
-  // No copying!
-
-  tree_index_expression (const tree_index_expression&);
-
-  tree_index_expression& operator = (const tree_index_expression&);
-};
-
-#endif
--- a/src/pt-jump.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "oct-obj.h"
-#include "pt-bp.h"
-#include "pt-jump.h"
-#include "pt-walk.h"
-
-class octave_value_list;
-
-// Break.
-
-// Nonzero means we're breaking out of a loop or function body.
-int tree_break_command::breaking = 0;
-
-tree_command *
-tree_break_command::dup (symbol_table::scope_id,
-                         symbol_table::context_id) const
-{
-  return new tree_break_command (line (), column ());
-}
-
-void
-tree_break_command::accept (tree_walker& tw)
-{
-  tw.visit_break_command (*this);
-}
-
-// Continue.
-
-// Nonzero means we're jumping to the end of a loop.
-int tree_continue_command::continuing = 0;
-
-tree_command *
-tree_continue_command::dup (symbol_table::scope_id,
-                            symbol_table::context_id) const
-{
-  return new tree_continue_command (line (), column ());
-}
-
-void
-tree_continue_command::accept (tree_walker& tw)
-{
-  tw.visit_continue_command (*this);
-}
-
-// Return.
-
-// Nonzero means we're returning from a function.
-int tree_return_command::returning = 0;
-
-tree_command *
-tree_return_command::dup (symbol_table::scope_id,
-                          symbol_table::context_id) const
-{
-  return new tree_return_command (line (), column ());
-}
-
-void
-tree_return_command::accept (tree_walker& tw)
-{
-  tw.visit_return_command (*this);
-}
--- a/src/pt-jump.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_jump_h)
-#define octave_tree_jump_h 1
-
-class tree_walker;
-
-#include "pt-cmd.h"
-#include "symtab.h"
-
-// Break.
-
-class
-tree_break_command : public tree_command
-{
-public:
-
-  tree_break_command (int l = -1, int c = -1)
-    : tree_command (l, c) { }
-
-  ~tree_break_command (void) { }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  static int breaking;
-
-private:
-
-  // No copying!
-
-  tree_break_command (const tree_break_command&);
-
-  tree_break_command& operator = (const tree_break_command&);
-};
-
-// Continue.
-
-class
-tree_continue_command : public tree_command
-{
-public:
-
-  tree_continue_command (int l = -1, int c = -1)
-    : tree_command (l, c) { }
-
-  ~tree_continue_command (void) { }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  static int continuing;
-
-private:
-
-  // No copying!
-
-  tree_continue_command (const tree_continue_command&);
-
-  tree_continue_command& operator = (const tree_continue_command&);
-};
-
-// Return.
-
-class
-tree_return_command : public tree_command
-{
-public:
-
-  tree_return_command (int l = -1, int c = -1)
-    : tree_command (l, c) { }
-
-  ~tree_return_command (void) { }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-  static int returning;
-
-private:
-
-  // No copying!
-
-  tree_return_command (const tree_return_command&);
-
-  tree_return_command& operator = (const tree_return_command&);
-};
-
-#endif
--- a/src/pt-loop.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "quit.h"
-
-#include "error.h"
-#include "gripes.h"
-#include "oct-map.h"
-#include "oct-lvalue.h"
-#include "ov.h"
-#include "pt-arg-list.h"
-#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"
-#include "pt-walk.h"
-#include "unwind-prot.h"
-
-// While.
-
-tree_while_command::~tree_while_command (void)
-{
-  delete expr;
-  delete list;
-  delete lead_comm;
-  delete trail_comm;
-#ifdef HAVE_LLVM
-  delete compiled;
-#endif
-}
-
-tree_command *
-tree_while_command::dup (symbol_table::scope_id scope,
-                         symbol_table::context_id context) const
-{
-  return new tree_while_command (expr ? expr->dup (scope, context) : 0,
-                                 list ? list->dup (scope, context) : 0,
-                                 lead_comm ? lead_comm->dup () : 0,
-                                 trail_comm ? trail_comm->dup (): 0,
-                                 line (), column ());
-}
-
-void
-tree_while_command::accept (tree_walker& tw)
-{
-  tw.visit_while_command (*this);
-}
-
-// Do-Until
-
-tree_command *
-tree_do_until_command::dup (symbol_table::scope_id scope,
-                            symbol_table::context_id context) const
-{
-  return new tree_do_until_command (expr ? expr->dup (scope, context) : 0,
-                                    list ? list->dup (scope, context) : 0,
-                                    lead_comm ? lead_comm->dup () : 0,
-                                    trail_comm ? trail_comm->dup (): 0,
-                                    line (), column ());
-}
-
-void
-tree_do_until_command::accept (tree_walker& tw)
-{
-  tw.visit_do_until_command (*this);
-}
-
-// For.
-
-tree_simple_for_command::~tree_simple_for_command (void)
-{
-  delete lhs;
-  delete expr;
-  delete maxproc;
-  delete list;
-  delete lead_comm;
-  delete trail_comm;
-#ifdef HAVE_LLVM
-  delete compiled;
-#endif
-}
-
-tree_command *
-tree_simple_for_command::dup (symbol_table::scope_id scope,
-                              symbol_table::context_id context) const
-{
-  return new tree_simple_for_command
-    (parallel, lhs ? lhs->dup (scope, context) : 0,
-     expr ? expr->dup (scope, context) : 0,
-     maxproc ? maxproc->dup (scope, context) : 0,
-     list ? list->dup (scope, context) : 0,
-     lead_comm ? lead_comm->dup () : 0,
-     trail_comm ? trail_comm->dup () : 0, line (), column ());
-}
-
-void
-tree_simple_for_command::accept (tree_walker& tw)
-{
-  tw.visit_simple_for_command (*this);
-}
-
-tree_complex_for_command::~tree_complex_for_command (void)
-{
-  delete lhs;
-  delete expr;
-  delete list;
-  delete lead_comm;
-  delete trail_comm;
-}
-
-tree_command *
-tree_complex_for_command::dup (symbol_table::scope_id scope,
-                               symbol_table::context_id context) const
-{
-  return new tree_complex_for_command (lhs ? lhs->dup (scope, context) : 0,
-                                       expr ? expr->dup (scope, context) : 0,
-                                       list ? list->dup (scope, context) : 0,
-                                       lead_comm ? lead_comm->dup () : 0,
-                                       trail_comm ? trail_comm->dup () : 0,
-                                       line (), column ());
-}
-
-void
-tree_complex_for_command::accept (tree_walker& tw)
-{
-  tw.visit_complex_for_command (*this);
-}
--- a/src/pt-loop.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,328 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_loop_h)
-#define octave_tree_loop_h 1
-
-class octave_value;
-class octave_lvalue;
-
-class tree_argument_list;
-class tree_expression;
-class tree_statement_list;
-
-class tree_walker;
-
-#include "comment-list.h"
-#include "pt-cmd.h"
-#include "symtab.h"
-
-class jit_info;
-
-// While.
-
-class
-tree_while_command : public tree_command
-{
-public:
-
-  tree_while_command (int l = -1, int c = -1)
-    : tree_command (l, c), expr (0), list (0), lead_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)
-#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)
-#ifdef HAVE_LLVM
-    , compiled (0)
-#endif
-  { }
-
-  ~tree_while_command (void);
-
-  tree_expression *condition (void) { return expr; }
-
-  tree_statement_list *body (void) { return list; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  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.
-  tree_expression *expr;
-
-  // List of commands to execute.
-  tree_statement_list *list;
-
-  // Comment preceding WHILE token.
-  octave_comment_list *lead_comm;
-
-  // Comment preceding ENDWHILE token.
-  octave_comment_list *trail_comm;
-
-private:
-
-#ifdef HAVE_LLVM
-  // compiled version of the loop
-  jit_info *compiled;
-#endif
-
-  // No copying!
-
-  tree_while_command (const tree_while_command&);
-
-  tree_while_command& operator = (const tree_while_command&);
-};
-
-// Do-Until.
-
-class
-tree_do_until_command : public tree_while_command
-{
-public:
-
-  tree_do_until_command (int l = -1, int c = -1)
-    : tree_while_command (l, c) { }
-
-  tree_do_until_command (tree_expression *e,
-                         octave_comment_list *lc = 0,
-                         octave_comment_list *tc = 0,
-                         int l = -1, int c = -1)
-    : tree_while_command (e, lc, tc, l, c) { }
-
-  tree_do_until_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_while_command (e, lst, lc, tc, l, c) { }
-
-  ~tree_do_until_command (void) { }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_do_until_command (const tree_do_until_command&);
-
-  tree_do_until_command& operator = (const tree_do_until_command&);
-};
-
-// For.
-
-class
-tree_simple_for_command : public tree_command
-{
-public:
-
-  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)
-#ifdef HAVE_LLVM
-    , compiled (0)
-#endif
-  { }
-
-  tree_simple_for_command (bool parallel_arg, tree_expression *le,
-                           tree_expression *re,
-                           tree_expression *maxproc_arg,
-                           tree_statement_list *lst,
-                           octave_comment_list *lc = 0,
-                           octave_comment_list *tc = 0,
-                           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)
-#ifdef HAVE_LLVM
-    , compiled (0)
-#endif
-  { }
-
-  ~tree_simple_for_command (void);
-
-  bool in_parallel (void) { return parallel; }
-
-  tree_expression *left_hand_side (void) { return lhs; }
-
-  tree_expression *control_expr (void) { return expr; }
-
-  tree_expression *maxproc_expr (void) { return maxproc; }
-
-  tree_statement_list *body (void) { return list; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  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;
-
-  // Expression to modify.
-  tree_expression *lhs;
-
-  // Expression to evaluate.
-  tree_expression *expr;
-
-  // Expression to tell how many processors should be used (only valid
-  // if parallel is TRUE).
-  tree_expression *maxproc;
-
-  // List of commands to execute.
-  tree_statement_list *list;
-
-  // Comment preceding FOR token.
-  octave_comment_list *lead_comm;
-
-  // 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&);
-
-  tree_simple_for_command& operator = (const tree_simple_for_command&);
-};
-
-class
-tree_complex_for_command : public tree_command
-{
-public:
-
-  tree_complex_for_command (int l = -1, int c = -1)
-    : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0),
-      trail_comm (0) { }
-
-  tree_complex_for_command (tree_argument_list *le, tree_expression *re,
-                            tree_statement_list *lst,
-                            octave_comment_list *lc = 0,
-                            octave_comment_list *tc = 0,
-                            int l = -1, int c = -1)
-    : tree_command (l, c), lhs (le), expr (re), list (lst),
-      lead_comm (lc), trail_comm (tc) { }
-
-  ~tree_complex_for_command (void);
-
-  tree_argument_list *left_hand_side (void) { return lhs; }
-
-  tree_expression *control_expr (void) { return expr; }
-
-  tree_statement_list *body (void) { return list; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // Expression to modify.
-  tree_argument_list *lhs;
-
-  // Expression to evaluate.
-  tree_expression *expr;
-
-  // List of commands to execute.
-  tree_statement_list *list;
-
-  // Comment preceding FOR token.
-  octave_comment_list *lead_comm;
-
-  // Comment preceding ENDFOR token.
-  octave_comment_list *trail_comm;
-
-  // No copying!
-
-  tree_complex_for_command (const tree_complex_for_command&);
-
-  tree_complex_for_command& operator = (const tree_complex_for_command&);
-};
-
-#endif
--- a/src/pt-mat.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1431 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-
-#include "quit.h"
-
-#include "data.h"
-#include "defun.h"
-#include "error.h"
-#include "oct-obj.h"
-#include "pt-arg-list.h"
-#include "pt-bp.h"
-#include "pt-exp.h"
-#include "pt-mat.h"
-#include "pt-walk.h"
-#include "utils.h"
-#include "ov.h"
-#include "variables.h"
-
-#include "ov-cx-mat.h"
-#include "ov-flt-cx-mat.h"
-#include "ov-re-sparse.h"
-#include "ov-cx-sparse.h"
-
-// The character to fill with when creating string arrays.
-char Vstring_fill_char = ' ';
-
-// General matrices.  This list type is much more work to handle than
-// constant matrices, but it allows us to construct matrices from
-// other matrices, variables, and functions.
-
-// But first, some internal classes that make our job much easier.
-
-class
-tm_row_const
-{
-private:
-
-  class
-  tm_row_const_rep : public octave_base_list<octave_value>
-  {
-  public:
-
-    tm_row_const_rep (void)
-      : count (1), dv (0, 0), all_str (false),
-        all_sq_str (false), all_dq_str (false),
-        some_str (false), all_real (false), all_cmplx (false),
-        all_mt (true), any_cell (false), any_sparse (false),
-        any_class (false), all_1x1 (false),
-        first_elem_is_struct (false), class_nm (), ok (false)
-    { }
-
-    tm_row_const_rep (const tree_argument_list& row)
-      : count (1), dv (0, 0), all_str (false), all_sq_str (false),
-        some_str (false), all_real (false), all_cmplx (false),
-        all_mt (true), any_cell (false), any_sparse (false),
-        any_class (false), all_1x1 (! row.empty ()),
-        first_elem_is_struct (false), class_nm (), ok (false)
-    { init (row); }
-
-    ~tm_row_const_rep (void) { }
-
-    octave_refcount<int> count;
-
-    dim_vector dv;
-
-    bool all_str;
-    bool all_sq_str;
-    bool all_dq_str;
-    bool some_str;
-    bool all_real;
-    bool all_cmplx;
-    bool all_mt;
-    bool any_cell;
-    bool any_sparse;
-    bool any_class;
-    bool all_1x1;
-    bool first_elem_is_struct;
-
-    std::string class_nm;
-
-    bool ok;
-
-    void do_init_element (const octave_value&, bool&);
-
-    void init (const tree_argument_list&);
-
-    void cellify (void);
-
-  private:
-
-    tm_row_const_rep (const tm_row_const_rep&);
-
-    tm_row_const_rep& operator = (const tm_row_const_rep&);
-
-  };
-
-public:
-
-  typedef tm_row_const_rep::iterator iterator;
-  typedef tm_row_const_rep::const_iterator const_iterator;
-
-  tm_row_const (void)
-    : rep (0) { }
-
-  tm_row_const (const tree_argument_list& row)
-    : rep (new tm_row_const_rep (row)) { }
-
-  tm_row_const (const tm_row_const& x)
-    : rep (x.rep)
-  {
-    if (rep)
-      rep->count++;
-  }
-
-  tm_row_const& operator = (const tm_row_const& x)
-  {
-    if (this != &x && rep != x.rep)
-      {
-        if (rep && --rep->count == 0)
-          delete rep;
-
-        rep = x.rep;
-
-        if (rep)
-          rep->count++;
-      }
-
-    return *this;
-  }
-
-  ~tm_row_const (void)
-  {
-    if (rep && --rep->count == 0)
-      delete rep;
-  }
-
-  octave_idx_type rows (void) { return rep->dv(0); }
-  octave_idx_type cols (void) { return rep->dv(1); }
-
-  bool empty (void) const { return rep->empty (); }
-
-  size_t length (void) const { return rep->length (); }
-
-  dim_vector dims (void) { return rep->dv; }
-
-  bool all_strings_p (void) const { return rep->all_str; }
-  bool all_sq_strings_p (void) const { return rep->all_sq_str; }
-  bool all_dq_strings_p (void) const { return rep->all_dq_str; }
-  bool some_strings_p (void) const { return rep->some_str; }
-  bool all_real_p (void) const { return rep->all_real; }
-  bool all_complex_p (void) const { return rep->all_cmplx; }
-  bool all_empty_p (void) const { return rep->all_mt; }
-  bool any_cell_p (void) const { return rep->any_cell; }
-  bool any_sparse_p (void) const { return rep->any_sparse; }
-  bool any_class_p (void) const { return rep->any_class; }
-  bool all_1x1_p (void) const { return rep->all_1x1; }
-  bool first_elem_struct_p (void) const { return rep->first_elem_is_struct; }
-
-  std::string class_name (void) const { return rep->class_nm; }
-
-  void cellify (void) { rep->cellify (); }
-
-  operator bool () const { return (rep && rep->ok); }
-
-  iterator begin (void) { return rep->begin (); }
-  const_iterator begin (void) const { return rep->begin (); }
-
-  iterator end (void) { return rep->end (); }
-  const_iterator end (void) const { return rep->end (); }
-
-private:
-
-  tm_row_const_rep *rep;
-};
-
-std::string
-get_concat_class (const std::string& c1, const std::string& c2)
-{
-  std::string retval = octave_base_value::static_class_name ();
-
-  if (c1 == c2)
-    retval = c1;
-  else if (c1.empty ())
-    retval = c2;
-  else if (c2.empty ())
-    retval = c1;
-  else if (c1 == "class" || c2 == "class")
-    retval = "class";
-  else
-    {
-      bool c1_is_int = (c1 == "int8" || c1 == "uint8"
-                        || c1 == "int16" || c1 == "uint16"
-                        || c1 == "int32" || c1 == "uint32"
-                        || c1 == "int64" || c1 == "uint64");
-      bool c2_is_int = (c2 == "int8" || c2 == "uint8"
-                        || c2 == "int16" || c2 == "uint16"
-                        || c2 == "int32" || c2 == "uint32"
-                        || c2 == "int64" || c2 == "uint64");
-
-      bool c1_is_char = (c1 == "char");
-      bool c2_is_char = (c2 == "char");
-
-      bool c1_is_double = (c1 == "double");
-      bool c2_is_double = (c2 == "double");
-
-      bool c1_is_single = (c1 == "single");
-      bool c2_is_single = (c2 == "single");
-
-      bool c1_is_logical = (c1 == "logical");
-      bool c2_is_logical = (c2 == "logical");
-
-      bool c1_is_built_in_type
-        = (c1_is_int || c1_is_char || c1_is_double || c1_is_single
-           || c1_is_logical);
-
-      bool c2_is_built_in_type
-        = (c2_is_int || c2_is_char ||  c2_is_double || c2_is_single
-           || c2_is_logical);
-
-      // Order is important here...
-
-      if (c1 == "struct" && c2 == c1)
-        retval = c1;
-      else if (c1 == "cell" || c2 == "cell")
-        retval = "cell";
-      else if (c1_is_char && c2_is_built_in_type)
-        retval = c1;
-      else if (c2_is_char && c1_is_built_in_type)
-        retval = c2;
-      else if (c1_is_int && c2_is_built_in_type)
-        retval = c1;
-      else if (c2_is_int && c1_is_built_in_type)
-        retval = c2;
-      else if (c1_is_single && c2_is_built_in_type)
-        retval = c1;
-      else if (c2_is_single && c1_is_built_in_type)
-        retval = c2;
-      else if (c1_is_double && c2_is_built_in_type)
-        retval = c1;
-      else if (c2_is_double && c1_is_built_in_type)
-        retval = c2;
-      else if (c1_is_logical && c2_is_logical)
-        retval = c1;
-    }
-
-  return retval;
-}
-
-static void
-eval_error (const char *msg, const dim_vector& x, const dim_vector& y)
-{
-  ::error ("%s (%s vs %s)", msg, x.str ().c_str (), y.str ().c_str ());
-}
-
-void
-tm_row_const::tm_row_const_rep::do_init_element (const octave_value& val,
-                                                 bool& first_elem)
-{
-  std::string this_elt_class_nm
-    = val.is_object () ? std::string ("class") : val.class_name ();
-
-  class_nm = get_concat_class (class_nm, this_elt_class_nm);
-
-  dim_vector this_elt_dv = val.dims ();
-
-  if (! this_elt_dv.zero_by_zero ())
-    {
-      all_mt = false;
-
-      if (first_elem)
-        {
-          if (val.is_map ())
-            first_elem_is_struct = true;
-
-          first_elem = false;
-        }
-    }
-
-  append (val);
-
-  if (all_str && ! val.is_string ())
-    all_str = false;
-
-  if (all_sq_str && ! val.is_sq_string ())
-    all_sq_str = false;
-
-  if (all_dq_str && ! val.is_dq_string ())
-    all_dq_str = false;
-
-  if (! some_str && val.is_string ())
-    some_str = true;
-
-  if (all_real && ! val.is_real_type ())
-    all_real = false;
-
-  if (all_cmplx && ! (val.is_complex_type () || val.is_real_type ()))
-    all_cmplx = false;
-
-  if (!any_cell && val.is_cell ())
-    any_cell = true;
-
-  if (!any_sparse && val.is_sparse_type ())
-    any_sparse = true;
-
-  if (!any_class && val.is_object ())
-    any_class = true;
-
-  all_1x1 = all_1x1 && val.numel () == 1;
-}
-
-void
-tm_row_const::tm_row_const_rep::init (const tree_argument_list& row)
-{
-  all_str = true;
-  all_sq_str = true;
-  all_dq_str = true;
-  all_real = true;
-  all_cmplx = true;
-  any_cell = false;
-  any_sparse = false;
-  any_class = false;
-
-  bool first_elem = true;
-
-  for (tree_argument_list::const_iterator p = row.begin ();
-       p != row.end ();
-       p++)
-    {
-      octave_quit ();
-
-      tree_expression *elt = *p;
-
-      octave_value tmp = elt->rvalue1 ();
-
-      if (error_state || tmp.is_undefined ())
-        {
-          ok = ! error_state;
-          return;
-        }
-      else
-        {
-          if (tmp.is_cs_list ())
-            {
-              octave_value_list tlst = tmp.list_value ();
-
-              for (octave_idx_type i = 0; i < tlst.length (); i++)
-                {
-                  octave_quit ();
-
-                  do_init_element (tlst(i), first_elem);
-                }
-            }
-          else
-            do_init_element (tmp, first_elem);
-        }
-    }
-
-  if (any_cell && ! any_class && ! first_elem_is_struct)
-    cellify ();
-
-  first_elem = true;
-
-  for (iterator p = begin (); p != end (); p++)
-    {
-      octave_quit ();
-
-      octave_value val = *p;
-
-      dim_vector this_elt_dv = val.dims ();
-
-      if (! this_elt_dv.zero_by_zero ())
-        {
-          all_mt = false;
-
-          if (first_elem)
-            {
-              first_elem = false;
-              dv = this_elt_dv;
-            }
-          else if (! dv.hvcat (this_elt_dv, 1))
-            {
-              eval_error ("horizontal dimensions mismatch", dv, this_elt_dv);
-              break;
-            }
-        }
-    }
-
-  ok = ! error_state;
-}
-
-void
-tm_row_const::tm_row_const_rep::cellify (void)
-{
-  bool elt_changed = false;
-
-  for (iterator p = begin (); p != end (); p++)
-    {
-      octave_quit ();
-
-      if (! p->is_cell ())
-        {
-          elt_changed = true;
-
-          *p = Cell (*p);
-        }
-    }
-
-  if (elt_changed)
-    {
-      bool first_elem = true;
-
-      for (iterator p = begin (); p != end (); p++)
-        {
-          octave_quit ();
-
-          octave_value val = *p;
-
-          dim_vector this_elt_dv = val.dims ();
-
-          if (! this_elt_dv.zero_by_zero ())
-            {
-              if (first_elem)
-                {
-                  first_elem = false;
-                  dv = this_elt_dv;
-                }
-              else if (! dv.hvcat (this_elt_dv, 1))
-                {
-                  eval_error ("horizontal dimensions mismatch", dv, this_elt_dv);
-                  break;
-                }
-            }
-        }
-    }
-}
-
-class
-tm_const : public octave_base_list<tm_row_const>
-{
-public:
-
-  tm_const (const tree_matrix& tm)
-    : dv (0, 0), all_str (false), all_sq_str (false), all_dq_str (false),
-      some_str (false), all_real (false), all_cmplx (false),
-      all_mt (true), any_cell (false), any_sparse (false),
-      any_class (false), class_nm (), ok (false)
-  { init (tm); }
-
-  ~tm_const (void) { }
-
-  octave_idx_type rows (void) const { return dv.elem (0); }
-  octave_idx_type cols (void) const { return dv.elem (1); }
-
-  dim_vector dims (void) const { return dv; }
-
-  bool all_strings_p (void) const { return all_str; }
-  bool all_sq_strings_p (void) const { return all_sq_str; }
-  bool all_dq_strings_p (void) const { return all_dq_str; }
-  bool some_strings_p (void) const { return some_str; }
-  bool all_real_p (void) const { return all_real; }
-  bool all_complex_p (void) const { return all_cmplx; }
-  bool all_empty_p (void) const { return all_mt; }
-  bool any_cell_p (void) const { return any_cell; }
-  bool any_sparse_p (void) const { return any_sparse; }
-  bool any_class_p (void) const { return any_class; }
-  bool all_1x1_p (void) const { return all_1x1; }
-
-  std::string class_name (void) const { return class_nm; }
-
-  operator bool () const { return ok; }
-
-private:
-
-  dim_vector dv;
-
-  bool all_str;
-  bool all_sq_str;
-  bool all_dq_str;
-  bool some_str;
-  bool all_real;
-  bool all_cmplx;
-  bool all_mt;
-  bool any_cell;
-  bool any_sparse;
-  bool any_class;
-  bool all_1x1;
-
-  std::string class_nm;
-
-  bool ok;
-
-  tm_const (void);
-
-  tm_const (const tm_const&);
-
-  tm_const& operator = (const tm_const&);
-
-  void init (const tree_matrix& tm);
-};
-
-void
-tm_const::init (const tree_matrix& tm)
-{
-  all_str = true;
-  all_sq_str = true;
-  all_dq_str = true;
-  all_real = true;
-  all_cmplx = true;
-  any_cell = false;
-  any_sparse = false;
-  any_class = false;
-  all_1x1 = ! tm.empty ();
-
-  bool first_elem = true;
-  bool first_elem_is_struct = false;
-
-  // Just eval and figure out if what we have is complex or all
-  // strings.  We can't check columns until we know that this is a
-  // numeric matrix -- collections of strings can have elements of
-  // different lengths.
-
-  for (tree_matrix::const_iterator p = tm.begin (); p != tm.end (); p++)
-    {
-      octave_quit ();
-
-      tree_argument_list *elt = *p;
-
-      tm_row_const tmp (*elt);
-
-      if (first_elem)
-        {
-          first_elem_is_struct = tmp.first_elem_struct_p ();
-
-          first_elem = false;
-        }
-
-      if (tmp && ! tmp.empty ())
-        {
-          if (all_str && ! tmp.all_strings_p ())
-            all_str = false;
-
-          if (all_sq_str && ! tmp.all_sq_strings_p ())
-            all_sq_str = false;
-
-          if (all_dq_str && ! tmp.all_dq_strings_p ())
-            all_dq_str = false;
-
-          if (! some_str && tmp.some_strings_p ())
-            some_str = true;
-
-          if (all_real && ! tmp.all_real_p ())
-            all_real = false;
-
-          if (all_cmplx && ! tmp.all_complex_p ())
-            all_cmplx = false;
-
-          if (all_mt && ! tmp.all_empty_p ())
-            all_mt = false;
-
-          if (!any_cell && tmp.any_cell_p ())
-            any_cell = true;
-
-          if (!any_sparse && tmp.any_sparse_p ())
-            any_sparse = true;
-
-          if (!any_class && tmp.any_class_p ())
-            any_class = true;
-
-          all_1x1 = all_1x1 && tmp.all_1x1_p ();
-
-          append (tmp);
-        }
-      else
-        break;
-    }
-
-  if (! error_state)
-    {
-      if (any_cell && ! any_class && ! first_elem_is_struct)
-        {
-          for (iterator q = begin (); q != end (); q++)
-            {
-              octave_quit ();
-
-              q->cellify ();
-            }
-        }
-
-      first_elem = true;
-
-      for (iterator q = begin (); q != end (); q++)
-        {
-          octave_quit ();
-
-          tm_row_const elt = *q;
-
-          octave_idx_type this_elt_nr = elt.rows ();
-          octave_idx_type this_elt_nc = elt.cols ();
-
-          std::string this_elt_class_nm = elt.class_name ();
-          class_nm = get_concat_class (class_nm, this_elt_class_nm);
-
-          dim_vector this_elt_dv = elt.dims ();
-
-          all_mt = false;
-
-          if (first_elem)
-            {
-              first_elem = false;
-
-              dv = this_elt_dv;
-            }
-          else if (all_str && dv.length () == 2
-                   && this_elt_dv.length () == 2)
-            {
-              // FIXME: this is Octave's specialty. Character matrices allow
-              // rows of unequal length.
-              if (this_elt_nc > cols ())
-                dv(1) = this_elt_nc;
-              dv(0) += this_elt_nr;
-            }
-          else if (! dv.hvcat (this_elt_dv, 0))
-            {
-              eval_error ("vertical dimensions mismatch", dv, this_elt_dv);
-              return;
-            }
-        }
-    }
-
-  ok = ! error_state;
-}
-
-tree_matrix::~tree_matrix (void)
-{
-  while (! empty ())
-    {
-      iterator p = begin ();
-      delete *p;
-      erase (p);
-    }
-}
-
-bool
-tree_matrix::has_magic_end (void) const
-{
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      octave_quit ();
-
-      tree_argument_list *elt = *p;
-
-      if (elt && elt->has_magic_end ())
-        return true;
-    }
-
-  return false;
-}
-
-bool
-tree_matrix::all_elements_are_constant (void) const
-{
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      octave_quit ();
-
-      tree_argument_list *elt = *p;
-
-      if (! elt->all_elements_are_constant ())
-        return false;
-    }
-
-  return true;
-}
-
-octave_value_list
-tree_matrix::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("invalid number of output arguments for matrix list");
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-void
-maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p)
-{
-  if (! (all_dq_strings_p || all_sq_strings_p))
-    warning_with_id ("Octave:mixed-string-concat",
-                     "concatenation of different character string types may have unintended consequences");
-}
-
-template<class TYPE, class T>
-static void
-single_type_concat (Array<T>& result,
-                    tm_const& tmp)
-{
-  octave_idx_type r = 0, c = 0;
-
-  for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
-    {
-      tm_row_const row = *p;
-      // Skip empty arrays to allow looser rules.
-      if (row.dims ().any_zero ())
-        continue;
-
-      for (tm_row_const::iterator q = row.begin ();
-           q != row.end ();
-           q++)
-        {
-          octave_quit ();
-
-          TYPE ra = octave_value_extract<TYPE> (*q);
-
-          // Skip empty arrays to allow looser rules.
-          if (! error_state)
-            {
-              if (! ra.is_empty ())
-                {
-                  result.insert (ra, r, c);
-
-                  if (! error_state)
-                    c += ra.columns ();
-                  else
-                    return;
-                }
-            }
-          else
-            return;
-        }
-
-      r += row.rows ();
-      c = 0;
-    }
-}
-
-template<class TYPE, class T>
-static void
-single_type_concat (Array<T>& result,
-                    const dim_vector& dv,
-                    tm_const& tmp)
-{
-  if (dv.any_zero ())
-    {
-      result = Array<T> (dv);
-      return;
-    }
-
-  if (tmp.length () == 1)
-    {
-      // If possible, forward the operation to liboctave.
-      // Single row.
-      tm_row_const& row = tmp.front ();
-      if (! (equal_types<T, char>::value || equal_types<T, octave_value>::value)
-          && row.all_1x1_p ())
-        {
-          // Optimize all scalars case.
-          result.clear (dv);
-          assert (static_cast<size_t> (result.numel ()) == row.length ());
-          octave_idx_type i = 0;
-          for (tm_row_const::iterator q = row.begin ();
-               q != row.end () && ! error_state; q++)
-             result(i++) = octave_value_extract<T> (*q);
-
-          return;
-        }
-
-      octave_idx_type ncols = row.length (), i = 0;
-      OCTAVE_LOCAL_BUFFER (Array<T>, array_list, ncols);
-
-      for (tm_row_const::iterator q = row.begin ();
-           q != row.end () && ! error_state;
-           q++)
-        {
-          octave_quit ();
-
-          array_list[i] = octave_value_extract<TYPE> (*q);
-          i++;
-        }
-
-      if (! error_state)
-        result = Array<T>::cat (-2, ncols, array_list);
-    }
-  else
-    {
-      result = Array<T> (dv);
-      single_type_concat<TYPE> (result, tmp);
-    }
-}
-
-template<class TYPE, class T>
-static void
-single_type_concat (Sparse<T>& result,
-                    const dim_vector& dv,
-                    tm_const& tmp)
-{
-  if (dv.any_zero ())
-    {
-      result = Sparse<T> (dv);
-      return;
-    }
-
-  // Sparse matrices require preallocation for efficient indexing; besides,
-  // only horizontal concatenation can be efficiently handled by indexing.
-  // So we just cat all rows through liboctave, then cat the final column.
-  octave_idx_type nrows = tmp.length (), j = 0;
-  OCTAVE_LOCAL_BUFFER (Sparse<T>, sparse_row_list, nrows);
-  for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
-    {
-      tm_row_const row = *p;
-      octave_idx_type ncols = row.length (), i = 0;
-      OCTAVE_LOCAL_BUFFER (Sparse<T>, sparse_list, ncols);
-
-      for (tm_row_const::iterator q = row.begin ();
-           q != row.end () && ! error_state;
-           q++)
-        {
-          octave_quit ();
-
-          sparse_list[i] = octave_value_extract<TYPE> (*q);
-          i++;
-        }
-
-      Sparse<T> stmp = Sparse<T>::cat (-2, ncols, sparse_list);
-      sparse_row_list[j] = stmp;
-      j++;
-    }
-
-  result = Sparse<T>::cat (-1, nrows, sparse_row_list);
-}
-
-template<class MAP>
-static void
-single_type_concat (octave_map& result,
-                    const dim_vector& dv,
-                    tm_const& tmp)
-{
-  if (dv.any_zero ())
-    {
-      result = octave_map (dv);
-      return;
-    }
-
-  octave_idx_type nrows = tmp.length (), j = 0;
-  OCTAVE_LOCAL_BUFFER (octave_map, map_row_list, nrows);
-  for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
-    {
-      tm_row_const row = *p;
-      octave_idx_type ncols = row.length (), i = 0;
-      OCTAVE_LOCAL_BUFFER (MAP, map_list, ncols);
-
-      for (tm_row_const::iterator q = row.begin ();
-           q != row.end () && ! error_state;
-           q++)
-        {
-          octave_quit ();
-
-          map_list[i] = octave_value_extract<MAP> (*q);
-          i++;
-        }
-
-      octave_map mtmp = octave_map::cat (-2, ncols, map_list);
-      map_row_list[j] = mtmp;
-      j++;
-    }
-
-  result = octave_map::cat (-1, nrows, map_row_list);
-}
-
-template<class TYPE>
-static octave_value
-do_single_type_concat (const dim_vector& dv,
-                       tm_const& tmp)
-{
-  TYPE result;
-
-  single_type_concat<TYPE> (result, dv, tmp);
-
-  return result;
-}
-
-template<>
-octave_value
-do_single_type_concat<octave_map> (const dim_vector& dv,
-                                   tm_const& tmp)
-{
-  octave_map result;
-
-  if (tmp.all_1x1_p ())
-    single_type_concat<octave_scalar_map> (result, dv, tmp);
-  else
-    single_type_concat<octave_map> (result, dv, tmp);
-
-  return result;
-}
-
-static octave_value
-do_class_concat (tm_const& tmc)
-{
-  octave_value retval;
-
-  octave_value_list rows (tmc.length (), octave_value ());
-
-  octave_idx_type j = 0;
-  for (tm_const::iterator p = tmc.begin (); p != tmc.end (); p++)
-    {
-      octave_quit ();
-
-      tm_row_const tmrc = *p;
-
-      if (tmrc.length () == 1)
-        rows(j++) = *(tmrc.begin ());
-      else
-        {
-          octave_value_list row (tmrc.length (), octave_value ());
-
-          octave_idx_type i = 0;
-          for (tm_row_const::iterator q = tmrc.begin (); q != tmrc.end (); q++)
-            row(i++) = *q;
-
-          rows(j++) = do_class_concat (row, "horzcat", 1);
-        }
-    }
-
-  if (! error_state)
-    {
-      if (rows.length () == 1)
-        retval = rows(0);
-      else
-        retval = do_class_concat (rows, "vertcat", 0);
-    }
-
-  return retval;
-}
-
-octave_value
-tree_matrix::rvalue1 (int)
-{
-  octave_value retval = Matrix ();
-
-  bool all_sq_strings_p = false;
-  bool all_dq_strings_p = false;
-  bool all_empty_p = false;
-  bool all_real_p = false;
-  bool any_sparse_p = false;
-  bool any_class_p = false;
-  bool frc_str_conv = false;
-
-  tm_const tmp (*this);
-
-  if (tmp && ! tmp.empty ())
-    {
-      dim_vector dv = tmp.dims ();
-      all_sq_strings_p = tmp.all_sq_strings_p ();
-      all_dq_strings_p = tmp.all_dq_strings_p ();
-      all_empty_p = tmp.all_empty_p ();
-      all_real_p = tmp.all_real_p ();
-      any_sparse_p = tmp.any_sparse_p ();
-      any_class_p = tmp.any_class_p ();
-      frc_str_conv = tmp.some_strings_p ();
-
-      // Try to speed up the common cases.
-
-      std::string result_type = tmp.class_name ();
-
-      if (any_class_p)
-        {
-          retval = do_class_concat (tmp);
-        }
-      else if (result_type == "double")
-        {
-          if (any_sparse_p)
-            {
-              if (all_real_p)
-                retval = do_single_type_concat<SparseMatrix> (dv, tmp);
-              else
-                retval = do_single_type_concat<SparseComplexMatrix> (dv, tmp);
-            }
-          else
-            {
-              if (all_real_p)
-                retval = do_single_type_concat<NDArray> (dv, tmp);
-              else
-                retval = do_single_type_concat<ComplexNDArray> (dv, tmp);
-            }
-        }
-      else if (result_type == "single")
-        {
-          if (all_real_p)
-            retval = do_single_type_concat<FloatNDArray> (dv, tmp);
-          else
-            retval = do_single_type_concat<FloatComplexNDArray> (dv, tmp);
-        }
-      else if (result_type == "char")
-        {
-          char type = all_dq_strings_p ? '"' : '\'';
-
-          maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p);
-
-          charNDArray result (dv, Vstring_fill_char);
-
-          single_type_concat<charNDArray> (result, tmp);
-
-          retval = octave_value (result, type);
-        }
-      else if (result_type == "logical")
-        {
-          if (any_sparse_p)
-            retval = do_single_type_concat<SparseBoolMatrix> (dv, tmp);
-          else
-            retval = do_single_type_concat<boolNDArray> (dv, tmp);
-        }
-      else if (result_type == "int8")
-        retval = do_single_type_concat<int8NDArray> (dv, tmp);
-      else if (result_type == "int16")
-        retval = do_single_type_concat<int16NDArray> (dv, tmp);
-      else if (result_type == "int32")
-        retval = do_single_type_concat<int32NDArray> (dv, tmp);
-      else if (result_type == "int64")
-        retval = do_single_type_concat<int64NDArray> (dv, tmp);
-      else if (result_type == "uint8")
-        retval = do_single_type_concat<uint8NDArray> (dv, tmp);
-      else if (result_type == "uint16")
-        retval = do_single_type_concat<uint16NDArray> (dv, tmp);
-      else if (result_type == "uint32")
-        retval = do_single_type_concat<uint32NDArray> (dv, tmp);
-      else if (result_type == "uint64")
-        retval = do_single_type_concat<uint64NDArray> (dv, tmp);
-      else if (result_type == "cell")
-        retval = do_single_type_concat<Cell> (dv, tmp);
-      else if (result_type == "struct")
-        retval = do_single_type_concat<octave_map> (dv, tmp);
-      else
-        {
-          // The line below might seem crazy, since we take a copy of
-          // the first argument, resize it to be empty and then resize
-          // it to be full. This is done since it means that there is
-          // no recopying of data, as would happen if we used a single
-          // resize.  It should be noted that resize operation is also
-          // significantly slower than the do_cat_op function, so it
-          // makes sense to have an empty matrix and copy all data.
-          //
-          // We might also start with a empty octave_value using
-          //
-          //    ctmp = octave_value_typeinfo::lookup_type
-          //          (tmp.begin() -> begin() -> type_name());
-          //
-          // and then directly resize. However, for some types there
-          // might be some additional setup needed, and so this should
-          // be avoided.
-
-          octave_value ctmp;
-
-          // Find the first non-empty object
-
-          if (any_sparse_p)
-            {
-              // Start with sparse matrix to avoid issues memory issues
-              // with things like [ones(1,4),sprandn(1e8,4,1e-4)]
-              if (all_real_p)
-                ctmp = octave_sparse_matrix ().resize (dv);
-              else
-                ctmp = octave_sparse_complex_matrix ().resize (dv);
-            }
-          else
-            {
-              for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
-                {
-                  octave_quit ();
-
-                  tm_row_const row = *p;
-
-                  for (tm_row_const::iterator q = row.begin ();
-                       q != row.end (); q++)
-                    {
-                      octave_quit ();
-
-                      ctmp = *q;
-
-                      if (! ctmp.all_zero_dims ())
-                        goto found_non_empty;
-                    }
-                }
-
-              ctmp = (*(tmp.begin () -> begin ()));
-
-            found_non_empty:
-
-              if (! all_empty_p)
-                ctmp = ctmp.resize (dim_vector (0,0)).resize (dv);
-            }
-
-          if (! error_state)
-            {
-              // Now, extract the values from the individual elements and
-              // insert them in the result matrix.
-
-              int dv_len = dv.length ();
-              octave_idx_type ntmp = dv_len > 1 ? dv_len : 2;
-              Array<octave_idx_type> ra_idx (dim_vector (ntmp, 1), 0);
-
-              for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++)
-                {
-                  octave_quit ();
-
-                  tm_row_const row = *p;
-
-                  for (tm_row_const::iterator q = row.begin ();
-                       q != row.end ();
-                       q++)
-                    {
-                      octave_quit ();
-
-                      octave_value elt = *q;
-
-                      if (elt.is_empty ())
-                        continue;
-
-                      ctmp = do_cat_op (ctmp, elt, ra_idx);
-
-                      if (error_state)
-                        goto done;
-
-                      ra_idx (1) += elt.columns ();
-                    }
-
-                  ra_idx (0) += row.rows ();
-                  ra_idx (1) = 0;
-                }
-
-              retval = ctmp;
-
-              if (frc_str_conv && ! retval.is_string ())
-                retval = retval.convert_to_str ();
-            }
-        }
-    }
-
-done:
-  return retval;
-}
-
-tree_expression *
-tree_matrix::dup (symbol_table::scope_id scope,
-                  symbol_table::context_id context) const
-{
-  tree_matrix *new_matrix = new tree_matrix (0, line (), column ());
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_argument_list *elt = *p;
-
-      new_matrix->append (elt ? elt->dup (scope, context) : 0);
-    }
-
-  new_matrix->copy_base (*this);
-
-  return new_matrix;
-}
-
-void
-tree_matrix::accept (tree_walker& tw)
-{
-  tw.visit_matrix (*this);
-}
-
-/*
-## test concatenation with all zero matrices
-%!assert ([ "" 65*ones(1,10) ], "AAAAAAAAAA");
-%!assert ([ 65*ones(1,10) "" ], "AAAAAAAAAA");
-
-%!test
-%! c = {"foo"; "bar"; "bazoloa"};
-%! assert ([c; "a"; "bc"; "def"], {"foo"; "bar"; "bazoloa"; "a"; "bc"; "def"});
-
-%!assert (class ([int64(1), int64(1)]), "int64")
-%!assert (class ([int64(1), int32(1)]), "int64")
-%!assert (class ([int64(1), int16(1)]), "int64")
-%!assert (class ([int64(1), int8(1)]), "int64")
-%!assert (class ([int64(1), uint64(1)]), "int64")
-%!assert (class ([int64(1), uint32(1)]), "int64")
-%!assert (class ([int64(1), uint16(1)]), "int64")
-%!assert (class ([int64(1), uint8(1)]), "int64")
-%!assert (class ([int64(1), single(1)]), "int64")
-%!assert (class ([int64(1), double(1)]), "int64")
-%!assert (class ([int64(1), cell(1)]), "cell")
-%!assert (class ([int64(1), true]), "int64")
-%!assert (class ([int64(1), "a"]), "char")
-
-%!assert (class ([int32(1), int64(1)]), "int32")
-%!assert (class ([int32(1), int32(1)]), "int32")
-%!assert (class ([int32(1), int16(1)]), "int32")
-%!assert (class ([int32(1), int8(1)]), "int32")
-%!assert (class ([int32(1), uint64(1)]), "int32")
-%!assert (class ([int32(1), uint32(1)]), "int32")
-%!assert (class ([int32(1), uint16(1)]), "int32")
-%!assert (class ([int32(1), uint8(1)]), "int32")
-%!assert (class ([int32(1), single(1)]), "int32")
-%!assert (class ([int32(1), double(1)]), "int32")
-%!assert (class ([int32(1), cell(1)]), "cell")
-%!assert (class ([int32(1), true]), "int32")
-%!assert (class ([int32(1), "a"]), "char")
-
-%!assert (class ([int16(1), int64(1)]), "int16")
-%!assert (class ([int16(1), int32(1)]), "int16")
-%!assert (class ([int16(1), int16(1)]), "int16")
-%!assert (class ([int16(1), int8(1)]), "int16")
-%!assert (class ([int16(1), uint64(1)]), "int16")
-%!assert (class ([int16(1), uint32(1)]), "int16")
-%!assert (class ([int16(1), uint16(1)]), "int16")
-%!assert (class ([int16(1), uint8(1)]), "int16")
-%!assert (class ([int16(1), single(1)]), "int16")
-%!assert (class ([int16(1), double(1)]), "int16")
-%!assert (class ([int16(1), cell(1)]), "cell")
-%!assert (class ([int16(1), true]), "int16")
-%!assert (class ([int16(1), "a"]), "char")
-
-%!assert (class ([int8(1), int64(1)]), "int8")
-%!assert (class ([int8(1), int32(1)]), "int8")
-%!assert (class ([int8(1), int16(1)]), "int8")
-%!assert (class ([int8(1), int8(1)]), "int8")
-%!assert (class ([int8(1), uint64(1)]), "int8")
-%!assert (class ([int8(1), uint32(1)]), "int8")
-%!assert (class ([int8(1), uint16(1)]), "int8")
-%!assert (class ([int8(1), uint8(1)]), "int8")
-%!assert (class ([int8(1), single(1)]), "int8")
-%!assert (class ([int8(1), double(1)]), "int8")
-%!assert (class ([int8(1), cell(1)]), "cell")
-%!assert (class ([int8(1), true]), "int8")
-%!assert (class ([int8(1), "a"]), "char")
-
-%!assert (class ([uint64(1), int64(1)]), "uint64")
-%!assert (class ([uint64(1), int32(1)]), "uint64")
-%!assert (class ([uint64(1), int16(1)]), "uint64")
-%!assert (class ([uint64(1), int8(1)]), "uint64")
-%!assert (class ([uint64(1), uint64(1)]), "uint64")
-%!assert (class ([uint64(1), uint32(1)]), "uint64")
-%!assert (class ([uint64(1), uint16(1)]), "uint64")
-%!assert (class ([uint64(1), uint8(1)]), "uint64")
-%!assert (class ([uint64(1), single(1)]), "uint64")
-%!assert (class ([uint64(1), double(1)]), "uint64")
-%!assert (class ([uint64(1), cell(1)]), "cell")
-%!assert (class ([uint64(1), true]), "uint64")
-%!assert (class ([uint64(1), "a"]), "char")
-
-%!assert (class ([uint32(1), int64(1)]), "uint32")
-%!assert (class ([uint32(1), int32(1)]), "uint32")
-%!assert (class ([uint32(1), int16(1)]), "uint32")
-%!assert (class ([uint32(1), int8(1)]), "uint32")
-%!assert (class ([uint32(1), uint64(1)]), "uint32")
-%!assert (class ([uint32(1), uint32(1)]), "uint32")
-%!assert (class ([uint32(1), uint16(1)]), "uint32")
-%!assert (class ([uint32(1), uint8(1)]), "uint32")
-%!assert (class ([uint32(1), single(1)]), "uint32")
-%!assert (class ([uint32(1), double(1)]), "uint32")
-%!assert (class ([uint32(1), cell(1)]), "cell")
-%!assert (class ([uint32(1), true]), "uint32")
-%!assert (class ([uint32(1), "a"]), "char")
-
-%!assert (class ([uint16(1), int64(1)]), "uint16")
-%!assert (class ([uint16(1), int32(1)]), "uint16")
-%!assert (class ([uint16(1), int16(1)]), "uint16")
-%!assert (class ([uint16(1), int8(1)]), "uint16")
-%!assert (class ([uint16(1), uint64(1)]), "uint16")
-%!assert (class ([uint16(1), uint32(1)]), "uint16")
-%!assert (class ([uint16(1), uint16(1)]), "uint16")
-%!assert (class ([uint16(1), uint8(1)]), "uint16")
-%!assert (class ([uint16(1), single(1)]), "uint16")
-%!assert (class ([uint16(1), double(1)]), "uint16")
-%!assert (class ([uint16(1), cell(1)]), "cell")
-%!assert (class ([uint16(1), true]), "uint16")
-%!assert (class ([uint16(1), "a"]), "char")
-
-%!assert (class ([uint8(1), int64(1)]), "uint8")
-%!assert (class ([uint8(1), int32(1)]), "uint8")
-%!assert (class ([uint8(1), int16(1)]), "uint8")
-%!assert (class ([uint8(1), int8(1)]), "uint8")
-%!assert (class ([uint8(1), uint64(1)]), "uint8")
-%!assert (class ([uint8(1), uint32(1)]), "uint8")
-%!assert (class ([uint8(1), uint16(1)]), "uint8")
-%!assert (class ([uint8(1), uint8(1)]), "uint8")
-%!assert (class ([uint8(1), single(1)]), "uint8")
-%!assert (class ([uint8(1), double(1)]), "uint8")
-%!assert (class ([uint8(1), cell(1)]), "cell")
-%!assert (class ([uint8(1), true]), "uint8")
-%!assert (class ([uint8(1), "a"]), "char")
-
-%!assert (class ([single(1), int64(1)]), "int64")
-%!assert (class ([single(1), int32(1)]), "int32")
-%!assert (class ([single(1), int16(1)]), "int16")
-%!assert (class ([single(1), int8(1)]), "int8")
-%!assert (class ([single(1), uint64(1)]), "uint64")
-%!assert (class ([single(1), uint32(1)]), "uint32")
-%!assert (class ([single(1), uint16(1)]), "uint16")
-%!assert (class ([single(1), uint8(1)]), "uint8")
-%!assert (class ([single(1), single(1)]), "single")
-%!assert (class ([single(1), double(1)]), "single")
-%!assert (class ([single(1), cell(1)]), "cell")
-%!assert (class ([single(1), true]), "single")
-%!assert (class ([single(1), "a"]), "char")
-
-%!assert (class ([double(1), int64(1)]), "int64")
-%!assert (class ([double(1), int32(1)]), "int32")
-%!assert (class ([double(1), int16(1)]), "int16")
-%!assert (class ([double(1), int8(1)]), "int8")
-%!assert (class ([double(1), uint64(1)]), "uint64")
-%!assert (class ([double(1), uint32(1)]), "uint32")
-%!assert (class ([double(1), uint16(1)]), "uint16")
-%!assert (class ([double(1), uint8(1)]), "uint8")
-%!assert (class ([double(1), single(1)]), "single")
-%!assert (class ([double(1), double(1)]), "double")
-%!assert (class ([double(1), cell(1)]), "cell")
-%!assert (class ([double(1), true]), "double")
-%!assert (class ([double(1), "a"]), "char")
-
-%!assert (class ([cell(1), int64(1)]), "cell")
-%!assert (class ([cell(1), int32(1)]), "cell")
-%!assert (class ([cell(1), int16(1)]), "cell")
-%!assert (class ([cell(1), int8(1)]), "cell")
-%!assert (class ([cell(1), uint64(1)]), "cell")
-%!assert (class ([cell(1), uint32(1)]), "cell")
-%!assert (class ([cell(1), uint16(1)]), "cell")
-%!assert (class ([cell(1), uint8(1)]), "cell")
-%!assert (class ([cell(1), single(1)]), "cell")
-%!assert (class ([cell(1), double(1)]), "cell")
-%!assert (class ([cell(1), cell(1)]), "cell")
-%!assert (class ([cell(1), true]), "cell")
-%!assert (class ([cell(1), "a"]), "cell")
-
-%!assert (class ([true, int64(1)]), "int64")
-%!assert (class ([true, int32(1)]), "int32")
-%!assert (class ([true, int16(1)]), "int16")
-%!assert (class ([true, int8(1)]), "int8")
-%!assert (class ([true, uint64(1)]), "uint64")
-%!assert (class ([true, uint32(1)]), "uint32")
-%!assert (class ([true, uint16(1)]), "uint16")
-%!assert (class ([true, uint8(1)]), "uint8")
-%!assert (class ([true, single(1)]), "single")
-%!assert (class ([true, double(1)]), "double")
-%!assert (class ([true, cell(1)]), "cell")
-%!assert (class ([true, true]), "logical")
-%!assert (class ([true, "a"]), "char")
-
-%!assert (class (["a", int64(1)]), "char")
-%!assert (class (["a", int32(1)]), "char")
-%!assert (class (["a", int16(1)]), "char")
-%!assert (class (["a", int8(1)]), "char")
-%!assert (class (["a", int64(1)]), "char")
-%!assert (class (["a", int32(1)]), "char")
-%!assert (class (["a", int16(1)]), "char")
-%!assert (class (["a", int8(1)]), "char")
-%!assert (class (["a", single(1)]), "char")
-%!assert (class (["a", double(1)]), "char")
-%!assert (class (["a", cell(1)]), "cell")
-%!assert (class (["a", true]), "char")
-%!assert (class (["a", "a"]), "char")
-
-%!assert (class ([cell(1), struct("foo", "bar")]), "cell")
-%!error [struct("foo", "bar"), cell(1)]
-*/
-
-DEFUN (string_fill_char, args, nargout,
-  "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} string_fill_char ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} string_fill_char (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} string_fill_char (@var{new_val}, \"local\")\n\
-Query or set the internal variable used to pad all rows of a character\n\
-matrix to the same length.  It must be a single character.  The default\n\
-value is @code{\" \"} (a single space).  For example:\n\
-\n\
-@example\n\
-@group\n\
-string_fill_char (\"X\");\n\
-[ \"these\"; \"are\"; \"strings\" ]\n\
-      @result{}  \"theseXX\"\n\
-          \"areXXXX\"\n\
-          \"strings\"\n\
-@end group\n\
-@end example\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\
-variable value is restored when exiting the function.\n\
-@end deftypefn")
-{
-  return SET_INTERNAL_VARIABLE (string_fill_char);
-}
-
-/*
-## string_fill_char() function call must be outside of %!test block
-## due to the way a %!test block is wrapped inside a function
-%!shared orig_val, old_val
-%! orig_val = string_fill_char ();
-%! old_val  = string_fill_char ("X");
-%!test
-%! assert (orig_val, old_val);
-%! assert (string_fill_char (), "X");
-%! assert (["these"; "are"; "strings"], ["theseXX"; "areXXXX"; "strings"]);
-%! string_fill_char (orig_val);
-%! assert (string_fill_char (), orig_val);
-
-%!error (string_fill_char (1, 2))
-*/
--- a/src/pt-mat.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_mat_h)
-#define octave_tree_mat_h 1
-
-#include <iosfwd>
-
-class octave_value;
-class octave_value_list;
-class tree_argument_list;
-
-class tree_walker;
-
-#include "base-list.h"
-#include "pt-exp.h"
-#include "symtab.h"
-
-// General matrices.  This allows us to construct matrices from
-// other matrices, variables, and functions.
-
-class
-tree_matrix : public tree_expression,
-              public octave_base_list<tree_argument_list *>
-{
-public:
-
-  tree_matrix (tree_argument_list *row = 0, int l = -1, int c = -1)
-    : tree_expression (l, c)
-  {
-    if (row)
-      append (row);
-  }
-
-  ~tree_matrix (void);
-
-  bool has_magic_end (void) const;
-
-  bool all_elements_are_constant (void) const;
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_matrix (const tree_matrix&);
-
-  tree_matrix& operator = (const tree_matrix&);
-};
-
-// The character to fill with when creating string arrays.
-extern char Vstring_fill_char;
-
-extern std::string
-get_concat_class (const std::string& c1, const std::string& c2);
-
-extern void
-maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p);
-
-extern std::string
-get_concat_class (const std::string& c1, const std::string& c2);
-
-extern void
-maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p);
-
-#endif
--- a/src/pt-misc.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +0,0 @@
-/*
-
-Copyright (C) 1994-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Cell.h"
-
-#include "defun.h"
-#include "error.h"
-#include "ov.h"
-#include "oct-lvalue.h"
-#include "pt-id.h"
-#include "pt-idx.h"
-#include "pt-misc.h"
-#include "pt-walk.h"
-#include "utils.h"
-
-// Parameter lists.
-
-tree_parameter_list::~tree_parameter_list (void)
-{
-  while (! empty ())
-    {
-      iterator p = begin ();
-      delete *p;
-      erase (p);
-    }
-}
-
-void
-tree_parameter_list::mark_as_formal_parameters (void)
-{
-  for (iterator p = begin (); p != end (); p++)
-    {
-      tree_decl_elt *elt = *p;
-      elt->mark_as_formal_parameter ();
-    }
-}
-
-bool
-tree_parameter_list::validate (in_or_out type)
-{
-  bool retval = true;
-
-  std::set<std::string> dict;
-
-  for (iterator p = begin (); p != end (); p++)
-    {
-      tree_decl_elt *elt = *p;
-
-      tree_identifier *id = elt->ident ();
-
-      if (id)
-        {
-          std::string name = id->name ();
-
-          if (id->is_black_hole ())
-            {
-              if (type != in)
-                error ("invalid use of ~ in output list");
-            }
-          else if (dict.find (name) != dict.end ())
-            {
-              retval = false;
-              error ("`%s' appears more than once in parameter list",
-                     name.c_str ());
-              break;
-            }
-          else
-            dict.insert (name);
-        }
-    }
-
-  if (! error_state)
-    {
-      std::string va_type = (type == in ? "varargin" : "varargout");
-
-      size_t len = length ();
-
-      if (len > 0)
-        {
-          tree_decl_elt *elt = back ();
-
-          tree_identifier *id = elt->ident ();
-
-          if (id && id->name () == va_type)
-            {
-              if (len == 1)
-                mark_varargs_only ();
-              else
-                mark_varargs ();
-
-              iterator p = end ();
-              --p;
-              delete *p;
-              erase (p);
-            }
-        }
-    }
-
-  return retval;
-}
-
-void
-tree_parameter_list::initialize_undefined_elements (const std::string& warnfor,
-                                                    int nargout, const octave_value& val)
-{
-  bool warned = false;
-
-  int count = 0;
-
-  octave_value tmp = symbol_table::varval (".ignored.");
-  const Matrix ignored = tmp.is_defined () ? tmp.matrix_value () : Matrix ();
-
-  octave_idx_type k = 0;
-
-  for (iterator p = begin (); p != end (); p++)
-    {
-      if (++count > nargout)
-        break;
-
-      tree_decl_elt *elt = *p;
-
-      if (! elt->is_variable ())
-        {
-          if (! warned)
-            {
-              warned = true;
-
-              while (k < ignored.numel ())
-                {
-                  octave_idx_type l = ignored (k);
-                  if (l == count)
-                    {
-                      warned = false;
-                      break;
-                    }
-                  else if (l > count)
-                    break;
-                  else
-                    k++;
-                }
-
-              if (warned)
-                {
-                  warning_with_id
-                    ("Octave:undefined-return-values",
-                     "%s: some elements in list of return values are undefined",
-                     warnfor.c_str ());
-                }
-            }
-
-          octave_lvalue lval = elt->lvalue ();
-
-          lval.assign (octave_value::op_asn_eq, val);
-        }
-    }
-}
-
-void
-tree_parameter_list::define_from_arg_vector (const octave_value_list& args)
-{
-  int nargin = args.length ();
-
-  int expected_nargin = length ();
-
-  iterator p = begin ();
-
-  for (int i = 0; i < expected_nargin; i++)
-    {
-      tree_decl_elt *elt = *p++;
-
-      octave_lvalue ref = elt->lvalue ();
-
-      if (i < nargin)
-        {
-          if (args(i).is_defined () && args(i).is_magic_colon ())
-            {
-              if (! elt->eval ())
-                {
-                  ::error ("no default value for argument %d\n", i+1);
-                  return;
-                }
-            }
-          else
-            ref.define (args(i));
-        }
-      else
-        elt->eval ();
-    }
-}
-
-void
-tree_parameter_list::undefine (void)
-{
-  int len = length ();
-
-  iterator p = begin ();
-
-  for (int i = 0; i < len; i++)
-    {
-      tree_decl_elt *elt = *p++;
-
-      octave_lvalue ref = elt->lvalue ();
-
-      ref.assign (octave_value::op_asn_eq, octave_value ());
-    }
-}
-
-octave_value_list
-tree_parameter_list::convert_to_const_vector (int nargout,
-                                              const Cell& varargout)
-{
-  octave_idx_type vlen = varargout.numel ();
-  int len = length ();
-
-  // Special case. Will do a shallow copy.
-  if (len == 0)
-    return varargout;
-  else if (nargout <= len)
-    {
-      octave_value_list retval (nargout);
-
-      int i = 0;
-
-      for (iterator p = begin (); p != end (); p++)
-        {
-          tree_decl_elt *elt = *p;
-          if (elt->is_defined ())
-            retval(i++) = elt->rvalue1 ();
-          else
-            break;
-        }
-
-      return retval;
-    }
-  else
-    {
-      octave_value_list retval (len + vlen);
-
-      int i = 0;
-
-      for (iterator p = begin (); p != end (); p++)
-        {
-          tree_decl_elt *elt = *p;
-          retval(i++) = elt->rvalue1 ();
-        }
-
-      for (octave_idx_type j = 0; j < vlen; j++)
-        retval(i++) = varargout(j);
-
-      return retval;
-    }
-}
-
-bool
-tree_parameter_list::is_defined (void)
-{
-  bool status = true;
-
-  for (iterator p = begin (); p != end (); p++)
-    {
-      tree_decl_elt *elt = *p;
-
-      if (! elt->is_variable ())
-        {
-          status = false;
-          break;
-        }
-    }
-
-  return status;
-}
-
-tree_parameter_list *
-tree_parameter_list::dup (symbol_table::scope_id scope,
-                          symbol_table::context_id context) const
-{
-  tree_parameter_list *new_list = new tree_parameter_list ();
-
-  if (takes_varargs ())
-    new_list->mark_varargs ();
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_decl_elt *elt = *p;
-
-      new_list->append (elt->dup (scope, context));
-    }
-
-  return new_list;
-}
-
-void
-tree_parameter_list::accept (tree_walker& tw)
-{
-  tw.visit_parameter_list (*this);
-}
-
-// Return lists.
-
-tree_return_list::~tree_return_list (void)
-{
-  while (! empty ())
-    {
-      iterator p = begin ();
-      delete *p;
-      erase (p);
-    }
-}
-
-tree_return_list *
-tree_return_list::dup (symbol_table::scope_id scope,
-                       symbol_table::context_id context) const
-{
-  tree_return_list *new_list = new tree_return_list ();
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_index_expression *elt = *p;
-
-      new_list->append (elt->dup (scope, context));
-    }
-
-  return new_list;
-}
-
-void
-tree_return_list::accept (tree_walker& tw)
-{
-  tw.visit_return_list (*this);
-}
--- a/src/pt-misc.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-
-Copyright (C) 1994-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_misc_h)
-#define octave_tree_misc_h 1
-
-class Cell;
-
-class octave_value;
-class octave_value_list;
-
-class tree_identifier;
-class tree_index_expression;
-class tree_va_return_list;
-
-class tree_walker;
-
-#include "base-list.h"
-#include "pt-decl.h"
-#include "symtab.h"
-
-// Parameter lists.  Used to hold the list of input and output
-// parameters in a function definition.  Elements are identifiers
-// only.
-
-class
-tree_parameter_list : public octave_base_list<tree_decl_elt *>
-{
-public:
-
-  enum in_or_out
-    {
-      in = 1,
-      out = 2
-    };
-
-  tree_parameter_list (void)
-    : marked_for_varargs (0) { }
-
-  tree_parameter_list (tree_decl_elt *t)
-    : marked_for_varargs (0) { append (t); }
-
-  ~tree_parameter_list (void);
-
-  void mark_as_formal_parameters (void);
-
-  bool validate (in_or_out type);
-
-  bool takes_varargs (void) const { return marked_for_varargs != 0; }
-
-  bool varargs_only (void) { return (marked_for_varargs < 0); }
-
-  void initialize_undefined_elements (const std::string& warnfor,
-                                      int nargout, const octave_value& val);
-
-  void define_from_arg_vector (const octave_value_list& args);
-
-  void undefine (void);
-
-  bool is_defined (void);
-
-  octave_value_list convert_to_const_vector (int nargout, const Cell& varargout);
-
-  tree_parameter_list *dup (symbol_table::scope_id scope,
-                            symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  int marked_for_varargs;
-
-  void mark_varargs (void) { marked_for_varargs = 1; }
-
-  void mark_varargs_only (void) { marked_for_varargs = -1; }
-
-  // No copying!
-
-  tree_parameter_list (const tree_parameter_list&);
-
-  tree_parameter_list& operator = (const tree_parameter_list&);
-};
-
-// Return lists.  Used to hold the right hand sides of multiple
-// assignment expressions.
-
-class
-tree_return_list : public octave_base_list<tree_index_expression *>
-{
-public:
-
-  tree_return_list (void) { }
-
-  tree_return_list (tree_index_expression *t) { append (t); }
-
-  ~tree_return_list (void);
-
-  tree_return_list *dup (symbol_table::scope_id scope,
-                         symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_return_list (const tree_return_list&);
-
-  tree_return_list& operator = (const tree_return_list&);
-};
-
-class
-tree_va_return_list : public octave_base_list<octave_value>
-{
-public:
-
-  tree_va_return_list (void) { }
-
-  ~tree_va_return_list (void) { }
-
-private:
-
-  // No copying!
-
-  tree_va_return_list (const tree_va_return_list&);
-
-  tree_va_return_list& operator = (const tree_va_return_list&);
-};
-
-#endif
--- a/src/pt-pr-code.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1322 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <cctype>
-
-#include <iostream>
-
-#include "comment-list.h"
-#include "error.h"
-#include "ov-usr-fcn.h"
-#include "pr-output.h"
-#include "pt-all.h"
-
-void
-tree_print_code::visit_anon_fcn_handle (tree_anon_fcn_handle& afh)
-{
-  indent ();
-
-  print_parens (afh, "(");
-
-  os << "@(";
-
-  tree_parameter_list *param_list = afh.parameter_list ();
-
-  if (param_list)
-    param_list->accept (*this);
-
-  os << ") ";
-
-  print_fcn_handle_body (afh.body ());
-
-  print_parens (afh, ")");
-}
-
-void
-tree_print_code::visit_argument_list (tree_argument_list& lst)
-{
-  tree_argument_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_expression *elt = *p++;
-
-      if (elt)
-        {
-          elt->accept (*this);
-
-          if (p != lst.end ())
-            os << ", ";
-        }
-    }
-}
-
-void
-tree_print_code::visit_binary_expression (tree_binary_expression& expr)
-{
-  indent ();
-
-  print_parens (expr, "(");
-
-  tree_expression *op1 = expr.lhs ();
-
-  if (op1)
-    op1->accept (*this);
-
-  os << " " << expr.oper () << " ";
-
-  tree_expression *op2 = expr.rhs ();
-
-  if (op2)
-    op2->accept (*this);
-
-  print_parens (expr, ")");
-}
-
-void
-tree_print_code::visit_break_command (tree_break_command&)
-{
-  indent ();
-
-  os << "break";
-}
-
-void
-tree_print_code::visit_colon_expression (tree_colon_expression& expr)
-{
-  indent ();
-
-  print_parens (expr, "(");
-
-  tree_expression *op1 = expr.base ();
-
-  if (op1)
-    op1->accept (*this);
-
-  // Stupid syntax.
-
-  tree_expression *op3 = expr.increment ();
-
-  if (op3)
-    {
-      os << ":";
-      op3->accept (*this);
-    }
-
-  tree_expression *op2 = expr.limit ();
-
-  if (op2)
-    {
-      os << ":";
-      op2->accept (*this);
-    }
-
-  print_parens (expr, ")");
-}
-
-void
-tree_print_code::visit_continue_command (tree_continue_command&)
-{
-  indent ();
-
-  os << "continue";
-}
-
-void
-tree_print_code::do_decl_command (tree_decl_command& cmd)
-{
-  indent ();
-
-  os << cmd.name () << " ";
-
-  tree_decl_init_list *init_list = cmd.initializer_list ();
-
-  if (init_list)
-    init_list->accept (*this);
-}
-
-void
-tree_print_code::visit_global_command (tree_global_command& cmd)
-{
-  do_decl_command (cmd);
-}
-
-void
-tree_print_code::visit_persistent_command (tree_persistent_command& cmd)
-{
-  do_decl_command (cmd);
-}
-
-void
-tree_print_code::visit_decl_elt (tree_decl_elt& cmd)
-{
-  tree_identifier *id = cmd.ident ();
-
-  if (id)
-    id->accept (*this);
-
-  tree_expression *expr = cmd.expression ();
-
-  if (expr)
-    {
-      os << " = ";
-
-      expr->accept (*this);
-    }
-}
-
-void
-tree_print_code::visit_decl_init_list (tree_decl_init_list& lst)
-{
-  tree_decl_init_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_decl_elt *elt = *p++;
-
-      if (elt)
-        {
-          elt->accept (*this);
-
-          if (p != lst.end ())
-            os << ", ";
-        }
-    }
-}
-
-void
-tree_print_code::visit_simple_for_command (tree_simple_for_command& cmd)
-{
-  print_comment_list (cmd.leading_comment ());
-
-  indent ();
-
-  os << (cmd.in_parallel () ? "parfor " : "for ");
-
-  tree_expression *lhs = cmd.left_hand_side ();
-
-  tree_expression *maxproc = cmd.maxproc_expr ();
-
-  if (maxproc)
-    os << "(";
-
-  if (lhs)
-    lhs->accept (*this);
-
-  os << " = ";
-
-  tree_expression *expr = cmd.control_expr ();
-
-  if (expr)
-    expr->accept (*this);
-
-  if (maxproc)
-    {
-      os << ", ";
-      maxproc->accept (*this);
-      os << ")";
-    }
-
-  newline ();
-
-  tree_statement_list *list = cmd.body ();
-
-  if (list)
-    {
-      increment_indent_level ();
-
-      list->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.trailing_comment ());
-
-  indent ();
-
-  os << (cmd.in_parallel () ? "endparfor" : "endfor");
-}
-
-void
-tree_print_code::visit_complex_for_command (tree_complex_for_command& cmd)
-{
-  print_comment_list (cmd.leading_comment ());
-
-  indent ();
-
-  os << "for [";
-  nesting.push ('[');
-
-  tree_argument_list *lhs = cmd.left_hand_side ();
-
-  if (lhs)
-    lhs->accept (*this);
-
-  nesting.pop ();
-  os << "] = ";
-
-  tree_expression *expr = cmd.control_expr ();
-
-  if (expr)
-    expr->accept (*this);
-
-  newline ();
-
-  tree_statement_list *list = cmd.body ();
-
-  if (list)
-    {
-      increment_indent_level ();
-
-      list->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.trailing_comment ());
-
-  indent ();
-
-  os << "endfor";
-}
-
-void
-tree_print_code::visit_octave_user_script (octave_user_script& fcn)
-{
-  reset ();
-
-  tree_statement_list *cmd_list = fcn.body ();
-
-  if (cmd_list)
-    cmd_list->accept (*this);
-}
-
-void
-tree_print_code::visit_octave_user_function (octave_user_function& fcn)
-{
-  reset ();
-
-  visit_octave_user_function_header (fcn);
-
-  tree_statement_list *cmd_list = fcn.body ();
-
-  if (cmd_list)
-    {
-      increment_indent_level ();
-
-      cmd_list->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  visit_octave_user_function_trailer (fcn);
-}
-
-void
-tree_print_code::visit_octave_user_function_header (octave_user_function& fcn)
-{
-  octave_comment_list *leading_comment = fcn.leading_comment ();
-
-  if (leading_comment)
-    {
-      print_comment_list (leading_comment);
-      newline ();
-    }
-
-  indent ();
-
-  os << "function ";
-
-  tree_parameter_list *ret_list = fcn.return_list ();
-
-  if (ret_list)
-    {
-      bool takes_var_return = fcn.takes_var_return ();
-
-      int len = ret_list->length ();
-
-      if (len > 1 || takes_var_return)
-        {
-          os << "[";
-          nesting.push ('[');
-        }
-
-      ret_list->accept (*this);
-
-      if (takes_var_return)
-        {
-          if (len > 0)
-            os << ", ";
-
-          os << "varargout";
-        }
-
-      if (len > 1 || takes_var_return)
-        {
-          nesting.pop ();
-          os << "]";
-        }
-
-      os << " = ";
-    }
-
-  std::string fcn_name = fcn.name ();
-
-  os << (fcn_name.empty () ? std::string ("(empty)") : fcn_name) << " ";
-
-  tree_parameter_list *param_list = fcn.parameter_list ();
-
-  if (param_list)
-    {
-      bool takes_varargs = fcn.takes_varargs ();
-
-      int len = param_list->length ();
-
-      if (len > 0 || takes_varargs)
-        {
-          os << "(";
-          nesting.push ('(');
-        }
-
-      param_list->accept (*this);
-
-      if (takes_varargs)
-        {
-          if (len > 0)
-            os << ", ";
-
-          os << "varargin";
-        }
-
-      if (len > 0 || takes_varargs)
-        {
-          nesting.pop ();
-          os << ")";
-          newline ();
-        }
-    }
-  else
-    {
-      os << "()";
-      newline ();
-    }
-}
-
-void
-tree_print_code::visit_octave_user_function_trailer (octave_user_function& fcn)
-{
-  print_indented_comment (fcn.trailing_comment ());
-
-  newline ();
-}
-
-void
-tree_print_code::visit_function_def (tree_function_def& fdef)
-{
-  indent ();
-
-  octave_value fcn = fdef.function ();
-
-  octave_function *f = fcn.function_value ();
-
-  if (f)
-    f->accept (*this);
-}
-
-void
-tree_print_code::visit_identifier (tree_identifier& id)
-{
-  indent ();
-
-  print_parens (id, "(");
-
-  std::string nm = id.name ();
-  os << (nm.empty () ? std::string ("(empty)") : nm);
-
-  print_parens (id, ")");
-}
-
-void
-tree_print_code::visit_if_clause (tree_if_clause& cmd)
-{
-  tree_expression *expr = cmd.condition ();
-
-  if (expr)
-    expr->accept (*this);
-
-  newline ();
-
-  tree_statement_list *list = cmd.commands ();
-
-  if (list)
-    {
-      increment_indent_level ();
-
-      list->accept (*this);
-
-      decrement_indent_level ();
-    }
-}
-
-void
-tree_print_code::visit_if_command (tree_if_command& cmd)
-{
-  print_comment_list (cmd.leading_comment ());
-
-  indent ();
-
-  os << "if ";
-
-  tree_if_command_list *list = cmd.cmd_list ();
-
-  if (list)
-    list->accept (*this);
-
-  print_indented_comment (cmd.trailing_comment ());
-
-  indent ();
-
-  os << "endif";
-}
-
-void
-tree_print_code::visit_if_command_list (tree_if_command_list& lst)
-{
-  tree_if_command_list::iterator p = lst.begin ();
-
-  bool first_elt = true;
-
-  while (p != lst.end ())
-    {
-      tree_if_clause *elt = *p++;
-
-      if (elt)
-        {
-          if (! first_elt)
-            {
-              print_indented_comment (elt->leading_comment ());
-
-              indent ();
-
-              if (elt->is_else_clause ())
-                os << "else";
-              else
-                os << "elseif ";
-            }
-
-          elt->accept (*this);
-        }
-
-      first_elt = false;
-    }
-}
-
-void
-tree_print_code::visit_index_expression (tree_index_expression& expr)
-{
-  indent ();
-
-  print_parens (expr, "(");
-
-  tree_expression *e = expr.expression ();
-
-  if (e)
-    e->accept (*this);
-
-  std::list<tree_argument_list *> arg_lists = expr.arg_lists ();
-  std::string type_tags = expr.type_tags ();
-  std::list<string_vector> arg_names = expr.arg_names ();
-
-  int n = type_tags.length ();
-
-  std::list<tree_argument_list *>::iterator p_arg_lists = arg_lists.begin ();
-  std::list<string_vector>::iterator p_arg_names = arg_names.begin ();
-
-  for (int i = 0; i < n; i++)
-    {
-      switch (type_tags[i])
-        {
-        case '(':
-          {
-            char nc = nesting.top ();
-            if ((nc == '[' || nc == '{') && expr.paren_count () == 0)
-              os << "(";
-            else
-              os << " (";
-            nesting.push ('(');
-
-            tree_argument_list *l = *p_arg_lists;
-            if (l)
-              l->accept (*this);
-
-            nesting.pop ();
-            os << ")";
-          }
-          break;
-
-        case '{':
-          {
-            char nc = nesting.top ();
-            if ((nc == '[' || nc == '{') && expr.paren_count () == 0)
-              os << "{";
-            else
-              os << " {";
-            // We only care about whitespace inside [] and {} when we
-            // are defining matrix and cell objects, not when indexing.
-            nesting.push ('(');
-
-            tree_argument_list *l = *p_arg_lists;
-            if (l)
-              l->accept (*this);
-
-            nesting.pop ();
-            os << "}";
-          }
-          break;
-
-        case '.':
-          {
-            string_vector nm = *p_arg_names;
-            assert (nm.length () == 1);
-            os << "." << nm(0);
-          }
-          break;
-
-        default:
-          panic_impossible ();
-        }
-
-      p_arg_lists++;
-      p_arg_names++;
-    }
-
-  print_parens (expr, ")");
-}
-
-void
-tree_print_code::visit_matrix (tree_matrix& lst)
-{
-  indent ();
-
-  print_parens (lst, "(");
-
-  os << "[";
-  nesting.push ('[');
-
-  tree_matrix::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_argument_list *elt = *p++;
-
-      if (elt)
-        {
-          elt->accept (*this);
-
-          if (p != lst.end ())
-            os << "; ";
-        }
-    }
-
-  nesting.pop ();
-  os << "]";
-
-  print_parens (lst, ")");
-}
-
-void
-tree_print_code::visit_cell (tree_cell& lst)
-{
-  indent ();
-
-  print_parens (lst, "(");
-
-  os << "{";
-  nesting.push ('{');
-
-  tree_cell::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_argument_list *elt = *p++;
-
-      if (elt)
-        {
-          elt->accept (*this);
-
-          if (p != lst.end ())
-            os << "; ";
-        }
-    }
-
-  nesting.pop ();
-  os << "}";
-
-  print_parens (lst, ")");
-}
-
-void
-tree_print_code::visit_multi_assignment (tree_multi_assignment& expr)
-{
-  indent ();
-
-  print_parens (expr, "(");
-
-  tree_argument_list *lhs = expr.left_hand_side ();
-
-  if (lhs)
-    {
-      int len = lhs->length ();
-
-      if (len > 1)
-        {
-          os << "[";
-          nesting.push ('[');
-        }
-
-      lhs->accept (*this);
-
-      if (len > 1)
-        {
-          nesting.pop ();
-          os << "]";
-        }
-    }
-
-  os << " " << expr.oper () << " ";
-
-  tree_expression *rhs = expr.right_hand_side ();
-
-  if (rhs)
-    rhs->accept (*this);
-
-  print_parens (expr, ")");
-}
-
-void
-tree_print_code::visit_no_op_command (tree_no_op_command& cmd)
-{
-  indent ();
-
-  os << cmd.original_command ();
-}
-
-void
-tree_print_code::visit_constant (tree_constant& val)
-{
-  indent ();
-
-  print_parens (val, "(");
-
-  val.print_raw (os, true, print_original_text);
-
-  print_parens (val, ")");
-}
-
-void
-tree_print_code::visit_fcn_handle (tree_fcn_handle& fh)
-{
-  indent ();
-
-  print_parens (fh, "(");
-
-  fh.print_raw (os, true, print_original_text);
-
-  print_parens (fh, ")");
-}
-
-void
-tree_print_code::visit_parameter_list (tree_parameter_list& lst)
-{
-  tree_parameter_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_decl_elt *elt = *p++;
-
-      if (elt)
-        {
-          elt->accept (*this);
-
-          if (p != lst.end ())
-            os << ", ";
-        }
-    }
-}
-
-void
-tree_print_code::visit_postfix_expression (tree_postfix_expression& expr)
-{
-  indent ();
-
-  print_parens (expr, "(");
-
-  tree_expression *e = expr.operand ();
-
-  if (e)
-    e->accept (*this);
-
-  os << expr.oper ();
-
-  print_parens (expr, ")");
-}
-
-void
-tree_print_code::visit_prefix_expression (tree_prefix_expression& expr)
-{
-  indent ();
-
-  print_parens (expr, "(");
-
-  os << expr.oper ();
-
-  tree_expression *e = expr.operand ();
-
-  if (e)
-    e->accept (*this);
-
-  print_parens (expr, ")");
-}
-
-void
-tree_print_code::visit_return_command (tree_return_command&)
-{
-  indent ();
-
-  os << "return";
-}
-
-void
-tree_print_code::visit_return_list (tree_return_list& lst)
-{
-  tree_return_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_index_expression *elt = *p++;
-
-      if (elt)
-        {
-          elt->accept (*this);
-
-          if (p != lst.end ())
-            os << ", ";
-        }
-    }
-}
-
-void
-tree_print_code::visit_simple_assignment (tree_simple_assignment& expr)
-{
-  indent ();
-
-  print_parens (expr, "(");
-
-  tree_expression *lhs = expr.left_hand_side ();
-
-  if (lhs)
-    lhs->accept (*this);
-
-  os << " " << expr.oper () << " ";
-
-  tree_expression *rhs = expr.right_hand_side ();
-
-  if (rhs)
-    rhs->accept (*this);
-
-  print_parens (expr, ")");
-}
-
-void
-tree_print_code::visit_statement (tree_statement& stmt)
-{
-  print_comment_list (stmt.comment_text ());
-
-  tree_command *cmd = stmt.command ();
-
-  if (cmd)
-    {
-      cmd->accept (*this);
-
-      if (! stmt.print_result ())
-        {
-          os << ";";
-          newline (" ");
-        }
-      else
-        newline ();
-    }
-  else
-    {
-      tree_expression *expr = stmt.expression ();
-
-      if (expr)
-        {
-          expr->accept (*this);
-
-          if (! stmt.print_result ())
-            {
-              os << ";";
-              newline (" ");
-            }
-          else
-            newline ();
-        }
-    }
-}
-
-void
-tree_print_code::visit_statement_list (tree_statement_list& lst)
-{
-  for (tree_statement_list::iterator p = lst.begin (); p != lst.end (); p++)
-    {
-      tree_statement *elt = *p;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_print_code::visit_switch_case (tree_switch_case& cs)
-{
-  print_comment_list (cs.leading_comment ());
-
-  indent ();
-
-  if (cs.is_default_case ())
-    os << "otherwise";
-  else
-    os << "case ";
-
-  tree_expression *label = cs.case_label ();
-
-  if (label)
-    label->accept (*this);
-
-  newline ();
-
-  tree_statement_list *list = cs.commands ();
-
-  if (list)
-    {
-      increment_indent_level ();
-
-      list->accept (*this);
-
-      newline ();
-
-      decrement_indent_level ();
-    }
-}
-
-void
-tree_print_code::visit_switch_case_list (tree_switch_case_list& lst)
-{
-  tree_switch_case_list::iterator p = lst.begin ();
-
-  while (p != lst.end ())
-    {
-      tree_switch_case *elt = *p++;
-
-      if (elt)
-        elt->accept (*this);
-    }
-}
-
-void
-tree_print_code::visit_switch_command (tree_switch_command& cmd)
-{
-  print_comment_list (cmd.leading_comment ());
-
-  indent ();
-
-  os << "switch ";
-
-  tree_expression *expr = cmd.switch_value ();
-
-  if (expr)
-    expr->accept (*this);
-
-  newline ();
-
-  tree_switch_case_list *list = cmd.case_list ();
-
-  if (list)
-    {
-      increment_indent_level ();
-
-      list->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.leading_comment ());
-
-  indent ();
-
-  os << "endswitch";
-}
-
-void
-tree_print_code::visit_try_catch_command (tree_try_catch_command& cmd)
-{
-  print_comment_list (cmd.leading_comment ());
-
-  indent ();
-
-  os << "try";
-
-  newline ();
-
-  tree_statement_list *try_code = cmd.body ();
-
-  if (try_code)
-    {
-      increment_indent_level ();
-
-      try_code->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.middle_comment ());
-
-  indent ();
-
-  os << "catch";
-
-  newline ();
-
-  tree_statement_list *catch_code = cmd.cleanup ();
-
-  if (catch_code)
-    {
-      increment_indent_level ();
-
-      catch_code->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.trailing_comment ());
-
-  indent ();
-
-  os << "end_try_catch";
-}
-
-void
-tree_print_code::visit_unwind_protect_command
-  (tree_unwind_protect_command& cmd)
-{
-  print_comment_list (cmd.leading_comment ());
-
-  indent ();
-
-  os << "unwind_protect";
-
-  newline ();
-
-  tree_statement_list *unwind_protect_code = cmd.body ();
-
-  if (unwind_protect_code)
-    {
-      increment_indent_level ();
-
-      unwind_protect_code->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.middle_comment ());
-
-  indent ();
-
-  os << "unwind_protect_cleanup";
-
-  newline ();
-
-  tree_statement_list *cleanup_code = cmd.cleanup ();
-
-  if (cleanup_code)
-    {
-      increment_indent_level ();
-
-      cleanup_code->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.trailing_comment ());
-
-  indent ();
-
-  os << "end_unwind_protect";
-}
-
-void
-tree_print_code::visit_while_command (tree_while_command& cmd)
-{
-  print_comment_list (cmd.leading_comment ());
-
-  indent ();
-
-  os << "while ";
-
-  tree_expression *expr = cmd.condition ();
-
-  if (expr)
-    expr->accept (*this);
-
-  newline ();
-
-  tree_statement_list *list = cmd.body ();
-
-  if (list)
-    {
-      increment_indent_level ();
-
-      list->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.trailing_comment ());
-
-  indent ();
-
-  os << "endwhile";
-}
-
-void
-tree_print_code::visit_do_until_command (tree_do_until_command& cmd)
-{
-  print_comment_list (cmd.leading_comment ());
-
-  indent ();
-
-  os << "do";
-
-  newline ();
-
-  tree_statement_list *list = cmd.body ();
-
-  if (list)
-    {
-      increment_indent_level ();
-
-      list->accept (*this);
-
-      decrement_indent_level ();
-    }
-
-  print_indented_comment (cmd.trailing_comment ());
-
-  indent ();
-
-  os << "until";
-
-  tree_expression *expr = cmd.condition ();
-
-  if (expr)
-    expr->accept (*this);
-
-  newline ();
-}
-
-void
-tree_print_code::print_fcn_handle_body (tree_statement_list *b)
-{
-  if (b)
-    {
-      assert (b->length () == 1);
-
-      tree_statement *s = b->front ();
-
-      if (s)
-        {
-          if (s->is_expression ())
-            {
-              tree_expression *e = s->expression ();
-
-              if (e)
-                {
-                  suppress_newlines++;
-                  e->accept (*this);
-                  suppress_newlines--;
-                }
-            }
-          else
-            {
-              tree_command *c = s->command ();
-
-              suppress_newlines++;
-              c->accept (*this);
-              suppress_newlines--;
-            }
-        }
-    }
-}
-
-// Each print_code() function should call this before printing
-// anything.
-//
-// This doesn't need to be fast, but isn't there a better way?
-
-void
-tree_print_code::indent (void)
-{
-  assert (curr_print_indent_level >= 0);
-
-  if (beginning_of_line)
-    {
-      os << prefix;
-
-      for (int i = 0; i < curr_print_indent_level; i++)
-        os << " ";
-
-      beginning_of_line = false;
-    }
-}
-
-// All print_code() functions should use this to print new lines.
-
-void
-tree_print_code::newline (const char *alt_txt)
-{
-  if (suppress_newlines)
-    os << alt_txt;
-  else
-    {
-      os << "\n";
-
-      beginning_of_line = true;
-    }
-}
-
-// For ressetting print_code state.
-
-void
-tree_print_code::reset (void)
-{
-  beginning_of_line = true;
-  curr_print_indent_level = 0;
-  while (nesting.top () != 'n')
-    nesting.pop ();
-}
-
-void
-tree_print_code::print_parens (const tree_expression& expr, const char *txt)
-{
-  int n = expr.paren_count ();
-
-  for (int i = 0; i < n; i++)
-    os << txt;
-}
-
-void
-tree_print_code::print_comment_elt (const octave_comment_elt& elt)
-{
-  bool printed_something = false;
-
-  bool prev_char_was_newline = false;
-
-  std::string comment = elt.text ();
-
-  size_t len = comment.length ();
-
-  size_t i = 0;
-
-  while (i < len && comment[i++] == '\n')
-    ; /* Skip leading new lines. */
-  i--;
-
-  while (i < len)
-    {
-      char c = comment[i++];
-
-      if (c == '\n')
-        {
-          if (prev_char_was_newline)
-            os << "##";
-
-          newline ();
-
-          prev_char_was_newline = true;
-        }
-      else
-        {
-          if (beginning_of_line)
-            {
-              printed_something = true;
-
-              indent ();
-
-              os << "##";
-
-              if (! (isspace (c) || c == '!'))
-                os << " ";
-            }
-
-          os << static_cast<char> (c);
-
-          prev_char_was_newline = false;
-        }
-    }
-
-  if (printed_something && ! beginning_of_line)
-    newline ();
-}
-
-void
-tree_print_code::print_comment_list (octave_comment_list *comment_list)
-{
-  if (comment_list)
-    {
-      octave_comment_list::iterator p = comment_list->begin ();
-
-      while (p != comment_list->end ())
-        {
-          octave_comment_elt elt = *p++;
-
-          print_comment_elt (elt);
-
-          if (p != comment_list->end ())
-            newline ();
-        }
-    }
-}
-
-void
-tree_print_code::print_indented_comment (octave_comment_list *comment_list)
-{
-  increment_indent_level ();
-
-  print_comment_list (comment_list);
-
-  decrement_indent_level ();
-}
--- a/src/pt-pr-code.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_print_code_h)
-#define octave_tree_print_code_h 1
-
-#include <stack>
-#include <string>
-
-#include "comment-list.h"
-#include "pt-walk.h"
-
-class tree_decl_command;
-class tree_expression;
-
-// How to print the code that the parse trees represent.
-
-class
-tree_print_code : public tree_walker
-{
-public:
-
-  tree_print_code (std::ostream& os_arg,
-                   const std::string& pfx = std::string (),
-                   bool pr_orig_txt = true)
-    : os (os_arg), prefix (pfx), nesting (),
-      print_original_text (pr_orig_txt),
-      curr_print_indent_level (0), beginning_of_line (true),
-      suppress_newlines (0)
-  {
-    // For "none".
-    nesting.push ('n');
-  }
-
-  ~tree_print_code (void) { }
-
-  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&);
-
-  void print_fcn_handle_body (tree_statement_list *);
-
-private:
-
-  std::ostream& os;
-
-  std::string prefix;
-
-  std::stack<char> nesting;
-
-  bool print_original_text;
-
-  // Current indentation.
-  int curr_print_indent_level;
-
-  // TRUE means we are at the beginning of a line.
-  bool beginning_of_line;
-
-  // Nonzero means we are not printing newlines and indenting.
-  int suppress_newlines;
-
-  void do_decl_command (tree_decl_command& cmd);
-
-  void reset_indent_level (void) { curr_print_indent_level = 0; }
-
-  void increment_indent_level (void) { curr_print_indent_level += 2; }
-
-  void decrement_indent_level (void) { curr_print_indent_level -= 2; }
-
-  void newline (const char *alt_txt = ", ");
-
-  void indent (void);
-
-  void reset (void);
-
-  void print_parens (const tree_expression& expr, const char *txt);
-
-  void print_comment_list (octave_comment_list *comment_list);
-
-  void print_comment_elt (const octave_comment_elt& comment_elt);
-
-  void print_indented_comment (octave_comment_list *comment_list);
-
-  // Must create with an output stream!
-
-  tree_print_code (void);
-
-  // No copying!
-
-  tree_print_code (const tree_print_code&);
-
-  tree_print_code& operator = (const tree_print_code&);
-};
-
-#endif
--- a/src/pt-select.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "oct-obj.h"
-#include "ov.h"
-#include "pt-cmd.h"
-#include "pt-exp.h"
-#include "pt-select.h"
-#include "pt-stmt.h"
-#include "pt-walk.h"
-#include "Cell.h"
-#include "ov-typeinfo.h"
-
-// If clauses.
-
-tree_if_clause::~tree_if_clause (void)
-{
-  delete expr;
-  delete list;
-  delete lead_comm;
-}
-
-tree_if_clause *
-tree_if_clause::dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const
-{
-  return new tree_if_clause (expr ? expr->dup (scope, context) : 0,
-                             list ? list->dup (scope, context) : 0,
-                             lead_comm ? lead_comm->dup () : 0);
-}
-
-void
-tree_if_clause::accept (tree_walker& tw)
-{
-  tw.visit_if_clause (*this);
-}
-
-// List of if commands.
-
-tree_if_command_list *
-tree_if_command_list::dup (symbol_table::scope_id scope,
-                           symbol_table::context_id context) const
-{
-  tree_if_command_list *new_icl = new tree_if_command_list ();
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_if_clause *elt = *p;
-
-      new_icl->append (elt ? elt->dup (scope, context) : 0);
-    }
-
-  return new_icl;
-}
-
-void
-tree_if_command_list::accept (tree_walker& tw)
-{
-  tw.visit_if_command_list (*this);
-}
-
-// If.
-
-tree_if_command::~tree_if_command (void)
-{
-  delete list;
-  delete lead_comm;
-  delete trail_comm;
-}
-
-tree_command *
-tree_if_command::dup (symbol_table::scope_id scope,
-                      symbol_table::context_id context) const
-{
-  return new tree_if_command (list ? list->dup (scope, context) : 0,
-                              lead_comm ? lead_comm->dup () : 0,
-                              trail_comm ? trail_comm->dup () : 0,
-                              line (), column ());
-}
-
-void
-tree_if_command::accept (tree_walker& tw)
-{
-  tw.visit_if_command (*this);
-}
-
-// Switch cases.
-
-tree_switch_case::~tree_switch_case (void)
-{
-  delete label;
-  delete list;
-  delete lead_comm;
-}
-
-
-bool
-tree_switch_case::label_matches (const octave_value& val)
-{
-  octave_value label_value = label->rvalue1 ();
-
-  if (! error_state && label_value.is_defined () )
-    {
-      if (label_value.is_cell ())
-        {
-          Cell cell (label_value.cell_value ());
-
-          for (octave_idx_type i = 0; i < cell.rows (); i++)
-            {
-              for (octave_idx_type j = 0; j < cell.columns (); j++)
-                {
-                  bool match = val.is_equal (cell(i,j));
-
-                  if (error_state)
-                    return false;
-                  else if (match)
-                    return true;
-                }
-            }
-        }
-      else
-        {
-          bool match = val.is_equal (label_value);
-
-          if (error_state)
-            return false;
-          else
-            return match;
-        }
-    }
-
-  return false;
-}
-
-tree_switch_case *
-tree_switch_case::dup (symbol_table::scope_id scope,
-                       symbol_table::context_id context) const
-{
-  return new tree_switch_case (label ? label->dup (scope, context) : 0,
-                               list ? list->dup (scope, context) : 0,
-                               lead_comm ? lead_comm->dup () : 0);
-}
-
-void
-tree_switch_case::accept (tree_walker& tw)
-{
-  tw.visit_switch_case (*this);
-}
-
-// List of switch cases.
-
-tree_switch_case_list *
-tree_switch_case_list::dup (symbol_table::scope_id scope,
-                            symbol_table::context_id context) const
-{
-  tree_switch_case_list *new_scl = new tree_switch_case_list ();
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_switch_case *elt = *p;
-
-      new_scl->append (elt ? elt->dup (scope, context) : 0);
-    }
-
-  return new_scl;
-}
-
-void
-tree_switch_case_list::accept (tree_walker& tw)
-{
-  tw.visit_switch_case_list (*this);
-}
-
-// Switch.
-
-tree_switch_command::~tree_switch_command (void)
-{
-  delete expr;
-  delete list;
-  delete lead_comm;
-  delete trail_comm;
-}
-
-tree_command *
-tree_switch_command::dup (symbol_table::scope_id scope,
-                          symbol_table::context_id context) const
-{
-  return new tree_switch_command (expr ? expr->dup (scope, context) : 0,
-                                  list ? list->dup (scope, context) : 0,
-                                  lead_comm ? lead_comm->dup () : 0,
-                                  trail_comm ? trail_comm->dup () : 0,
-                                  line (), column ());
-}
-
-void
-tree_switch_command::accept (tree_walker& tw)
-{
-  tw.visit_switch_command (*this);
-}
--- a/src/pt-select.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,302 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_select_h)
-#define octave_tree_select_h 1
-
-class expression;
-class tree_statement_list;
-
-class tree_walker;
-
-#include "base-list.h"
-#include "comment-list.h"
-#include "pt-cmd.h"
-#include "symtab.h"
-
-// If.
-
-class
-tree_if_clause : public tree
-{
-public:
-
-  tree_if_clause (int l = -1, int c = -1)
-    : tree (l, c), expr (0), list (0), lead_comm (0) { }
-
-  tree_if_clause (tree_statement_list *sl, octave_comment_list *lc = 0,
-                  int l = -1, int c = -1)
-    : tree (l, c), expr (0), list (sl), lead_comm (lc) { }
-
-  tree_if_clause (tree_expression *e, tree_statement_list *sl,
-                  octave_comment_list *lc = 0,
-                  int l = -1, int c = -1)
-    : tree (l, c), expr (e), list (sl), lead_comm (lc) { }
-
-  ~tree_if_clause (void);
-
-  bool is_else_clause (void) { return ! expr; }
-
-  tree_expression *condition (void) { return expr; }
-
-  tree_statement_list *commands (void) { return list; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  tree_if_clause *dup (symbol_table::scope_id scope,
-                       symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // The condition to test.
-  tree_expression *expr;
-
-  // The list of statements to evaluate if expr is true.
-  tree_statement_list *list;
-
-  // Comment preceding ELSE or ELSEIF token.
-  octave_comment_list *lead_comm;
-
-  // No copying!
-
-  tree_if_clause (const tree_if_clause&);
-
-  tree_if_clause& operator = (const tree_if_clause&);
-};
-
-class
-tree_if_command_list : public octave_base_list<tree_if_clause *>
-{
-public:
-
-  tree_if_command_list (void) { }
-
-  tree_if_command_list (tree_if_clause *t) { append (t); }
-
-  ~tree_if_command_list (void)
-    {
-      while (! empty ())
-        {
-          iterator p = begin ();
-          delete *p;
-          erase (p);
-        }
-    }
-
-  tree_if_command_list *dup (symbol_table::scope_id scope,
-                             symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_if_command_list (const tree_if_command_list&);
-
-  tree_if_command_list& operator = (const tree_if_command_list&);
-};
-
-class
-tree_if_command : public tree_command
-{
-public:
-
-  tree_if_command (int l = -1, int c = -1)
-    : tree_command (l, c), list (0), lead_comm (0), trail_comm (0) { }
-
-  tree_if_command (tree_if_command_list *lst, octave_comment_list *lc,
-                   octave_comment_list *tc, int l = -1, int c = -1)
-    : tree_command (l, c), list (lst), lead_comm (lc), trail_comm (tc) { }
-
-  ~tree_if_command (void);
-
-  tree_if_command_list *cmd_list (void) { return list; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // List of if commands (if, elseif, elseif, ... else, endif)
-  tree_if_command_list *list;
-
-  // Comment preceding IF token.
-  octave_comment_list *lead_comm;
-
-  // Comment preceding ENDIF token.
-  octave_comment_list *trail_comm;
-
-  // No copying!
-
-  tree_if_command (const tree_if_command&);
-
-  tree_if_command& operator = (const tree_if_command&);
-};
-
-// Switch.
-
-class
-tree_switch_case : public tree
-{
-public:
-
-  tree_switch_case (int l = -1, int c = -1)
-    : tree (l, c), label (0), list (0), lead_comm (0) { }
-
-  tree_switch_case (tree_statement_list *sl, octave_comment_list *lc = 0,
-                    int l = -1, int c = -1)
-    : tree (l, c), label (0), list (sl), lead_comm (lc) { }
-
-  tree_switch_case (tree_expression *e, tree_statement_list *sl,
-                    octave_comment_list *lc = 0,
-                    int l = -1, int c = -1)
-    : tree (l, c), label (e), list (sl), lead_comm (lc) { }
-
-  ~tree_switch_case (void);
-
-  bool is_default_case (void) { return ! label; }
-
-  bool label_matches (const octave_value& val);
-
-  tree_expression *case_label (void) { return label; }
-
-  tree_statement_list *commands (void) { return list; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  tree_switch_case *dup (symbol_table::scope_id scope,
-                         symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // The case label.
-  tree_expression *label;
-
-  // The list of statements to evaluate if the label matches.
-  tree_statement_list *list;
-
-  // Comment preceding CASE or OTHERWISE token.
-  octave_comment_list *lead_comm;
-
-  // No copying!
-
-  tree_switch_case (const tree_switch_case&);
-
-  tree_switch_case& operator = (const tree_switch_case&);
-};
-
-class
-tree_switch_case_list : public octave_base_list<tree_switch_case *>
-{
-public:
-
-  tree_switch_case_list (void) { }
-
-  tree_switch_case_list (tree_switch_case *t) { append (t); }
-
-  ~tree_switch_case_list (void)
-    {
-      while (! empty ())
-        {
-          iterator p = begin ();
-          delete *p;
-          erase (p);
-        }
-    }
-
-  tree_switch_case_list *dup (symbol_table::scope_id scope,
-                              symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_switch_case_list (const tree_switch_case_list&);
-
-  tree_switch_case_list& operator = (const tree_switch_case_list&);
-};
-
-class
-tree_switch_command : public tree_command
-{
-public:
-
-  tree_switch_command (int l = -1, int c = -1)
-    : tree_command (l, c), expr (0), list (0), lead_comm (0),
-      trail_comm (0) { }
-
-  tree_switch_command (tree_expression *e, tree_switch_case_list *lst,
-                       octave_comment_list *lc, octave_comment_list *tc,
-                       int l = -1, int c = -1)
-    : tree_command (l, c), expr (e), list (lst), lead_comm (lc),
-      trail_comm (tc) { }
-
-  ~tree_switch_command (void);
-
-  tree_expression *switch_value (void) { return expr; }
-
-  tree_switch_case_list *case_list (void) { return list; }
-
-  octave_comment_list *leading_comment (void) { return lead_comm; }
-
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // Value on which to switch.
-  tree_expression *expr;
-
-  // List of cases (case 1, case 2, ..., default)
-  tree_switch_case_list *list;
-
-  // Comment preceding SWITCH token.
-  octave_comment_list *lead_comm;
-
-  // Comment preceding ENDSWITCH token.
-  octave_comment_list *trail_comm;
-
-  // No copying!
-
-  tree_switch_command (const tree_switch_command&);
-
-  tree_switch_command& operator = (const tree_switch_command&);
-};
-
-#endif
--- a/src/pt-stmt.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <typeinfo>
-
-#include "quit.h"
-
-#include "defun.h"
-#include "error.h"
-#include "gripes.h"
-#include "ov.h"
-#include "oct-lvalue.h"
-#include "input.h"
-#include "pager.h"
-#include "pt-bp.h"
-#include "pt-cmd.h"
-#include "pt-id.h"
-#include "pt-idx.h"
-#include "pt-jump.h"
-#include "pt-pr-code.h"
-#include "pt-stmt.h"
-#include "pt-walk.h"
-#include "unwind-prot.h"
-#include "utils.h"
-#include "variables.h"
-
-// A list of commands to be executed.
-
-tree_statement::~tree_statement (void)
-{
-  delete cmd;
-  delete expr;
-  delete comm;
-}
-
-void
-tree_statement::set_print_flag (bool print_flag)
-{
-  if (expr)
-    expr->set_print_flag (print_flag);
-}
-
-bool
-tree_statement::print_result (void)
-{
-  return expr && expr->print_result ();
-}
-
-void
-tree_statement::set_breakpoint (void)
-{
-  if (cmd)
-    cmd->set_breakpoint ();
-  else if (expr)
-    expr->set_breakpoint ();
-}
-
-void
-tree_statement::delete_breakpoint (void)
-{
-  if (cmd)
-    cmd->delete_breakpoint ();
-  else if (expr)
-    expr->delete_breakpoint ();
-}
-
-bool
-tree_statement::is_breakpoint (void) const
-{
-  return cmd ? cmd->is_breakpoint () : (expr ? expr->is_breakpoint () : false);
-}
-
-int
-tree_statement::line (void) const
-{
-  return cmd ? cmd->line () : (expr ? expr->line () : -1);
-}
-
-int
-tree_statement::column (void) const
-{
-  return cmd ? cmd->column () : (expr ? expr->column () : -1);
-}
-
-void
-tree_statement::echo_code (void)
-{
-  tree_print_code tpc (octave_stdout, VPS4);
-
-  accept (tpc);
-}
-
-bool
-tree_statement::is_end_of_fcn_or_script (void) const
-{
-  bool retval = false;
-
-  if (cmd)
-    {
-      tree_no_op_command *no_op_cmd
-        = dynamic_cast<tree_no_op_command *> (cmd);
-
-      if (no_op_cmd)
-        retval = no_op_cmd->is_end_of_fcn_or_script ();
-    }
-
-  return retval;
-}
-
-tree_statement *
-tree_statement::dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const
-{
-  tree_statement *new_stmt = new tree_statement ();
-
-  new_stmt->cmd = cmd ? cmd->dup (scope, context) : 0;
-
-  new_stmt->expr = expr ? expr->dup (scope, context) : 0;
-
-  new_stmt->comm = comm ? comm->dup () : 0;
-
-  return new_stmt;
-}
-
-void
-tree_statement::accept (tree_walker& tw)
-{
-  tw.visit_statement (*this);
-}
-
-int
-tree_statement_list::set_breakpoint (int line)
-{
-  tree_breakpoint tbp (line, tree_breakpoint::set);
-  accept (tbp);
-
-  return tbp.get_line ();
-}
-
-void
-tree_statement_list::delete_breakpoint (int line)
-{
-  if (line < 0)
-    {
-      octave_value_list bp_lst = list_breakpoints ();
-
-      int len = bp_lst.length ();
-
-      for (int i = 0; i < len; i++)
-        {
-          tree_breakpoint tbp (i, tree_breakpoint::clear);
-          accept (tbp);
-        }
-    }
-  else
-    {
-      tree_breakpoint tbp (line, tree_breakpoint::clear);
-      accept (tbp);
-    }
-}
-
-octave_value_list
-tree_statement_list::list_breakpoints (void)
-{
-  tree_breakpoint tbp (0, tree_breakpoint::list);
-  accept (tbp);
-
-  return tbp.get_list ();
-}
-
-tree_statement_list *
-tree_statement_list::dup (symbol_table::scope_id scope,
-                          symbol_table::context_id context) const
-{
-  tree_statement_list *new_list = new tree_statement_list ();
-
-  new_list->function_body = function_body;
-
-  for (const_iterator p = begin (); p != end (); p++)
-    {
-      const tree_statement *elt = *p;
-
-      new_list->append (elt ? elt->dup (scope, context) : 0);
-    }
-
-  return new_list;
-}
-
-void
-tree_statement_list::accept (tree_walker& tw)
-{
-  tw.visit_statement_list (*this);
-}
--- a/src/pt-stmt.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_stmt_h)
-#define octave_tree_stmt_h 1
-
-class octave_value_list;
-
-class tree_command;
-class tree_expression;
-
-class tree_walker;
-
-#include <deque>
-
-#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 : public tree
-{
-public:
-
-  tree_statement (void)
-    : cmd (0), expr (0), comm (0) { }
-
-  tree_statement (tree_command *c, octave_comment_list *cl)
-    : cmd (c), expr (0), comm (cl) { }
-
-  tree_statement (tree_expression *e, octave_comment_list *cl)
-    : cmd (0), expr (e), comm (cl) { }
-
-  ~tree_statement (void);
-
-  void set_print_flag (bool print_flag);
-
-  bool print_result (void);
-
-  bool is_command (void) const { return cmd != 0; }
-
-  bool is_expression (void) const { return expr != 0; }
-
-  void set_breakpoint (void);
-
-  void delete_breakpoint (void);
-
-  bool is_breakpoint (void) const;
-
-  int line (void) const;
-  int column (void) const;
-
-  void echo_code (void);
-
-  tree_command *command (void) { return cmd; }
-
-  tree_expression *expression (void) { return expr; }
-
-  octave_comment_list *comment_text (void) { return comm; }
-
-  bool is_null_statement (void) const { return ! (cmd || expr || comm); }
-
-  bool is_end_of_fcn_or_script (void) const;
-
-  // Allow modification of this statement.  Note that there is no
-  // checking.  If you use these, are you sure you knwo what you are
-  // doing?
-
-  void set_command (tree_command *c) { cmd = c; }
-
-  void set_expression (tree_expression *e) { expr = e; }
-
-  tree_statement *dup (symbol_table::scope_id scope,
-                       symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // Only one of cmd or expr can be valid at once.
-
-  // Command to execute.
-  tree_command *cmd;
-
-  // Expression to evaluate.
-  tree_expression *expr;
-
-  // Comment associated with this statement.
-  octave_comment_list *comm;
-
-  // No copying!
-  tree_statement (const tree_statement&);
-
-  tree_statement& operator = (const tree_statement&);
-};
-
-// A list of statements to evaluate.
-
-class
-tree_statement_list : public octave_base_list<tree_statement *>
-{
-public:
-
-  tree_statement_list (void)
-    : function_body (false), anon_function_body (false),
-      script_body (false) { }
-
-  tree_statement_list (tree_statement *s)
-    : function_body (false), anon_function_body (false),
-      script_body (false) { append (s); }
-
-  ~tree_statement_list (void)
-    {
-      while (! empty ())
-        {
-          iterator p = begin ();
-          delete *p;
-          erase (p);
-        }
-    }
-
-  void mark_as_function_body (void) { function_body = true; }
-
-  void mark_as_anon_function_body (void) { anon_function_body = true; }
-
-  void mark_as_script_body (void) { script_body = true; }
-
-  bool is_function_body (void) const { return function_body; }
-
-  bool is_anon_function_body (void) const { return anon_function_body; }
-
-  bool is_script_body (void) const { return script_body; }
-
-  int set_breakpoint (int line);
-
-  void delete_breakpoint (int line);
-
-  octave_value_list list_breakpoints (void);
-
-  tree_statement_list *dup (symbol_table::scope_id scope,
-                            symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // Does this list of statements make up the body of a function?
-  bool function_body;
-
-  // Does this list of statements make up the body of a function?
-  bool anon_function_body;
-
-  // Does this list of statements make up the body of a script?
-  bool script_body;
-
-  // No copying!
-
-  tree_statement_list (const tree_statement_list&);
-
-  tree_statement_list& operator = (const tree_statement_list&);
-};
-
-#endif
--- a/src/pt-unop.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-#include "oct-obj.h"
-#include "oct-lvalue.h"
-#include "ov.h"
-#include "profiler.h"
-#include "pt-bp.h"
-#include "pt-unop.h"
-#include "pt-walk.h"
-
-// Unary expressions.
-
-std::string
-tree_unary_expression::oper (void) const
-{
-  return octave_value::unary_op_as_string (etype);
-}
-
-// Prefix expressions.
-
-octave_value_list
-tree_prefix_expression::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("prefix operator `%s': invalid number of output arguments",
-           oper () . c_str ());
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-octave_value
-tree_prefix_expression::rvalue1 (int)
-{
-  octave_value retval;
-
-  if (error_state)
-    return retval;
-
-  if (op)
-    {
-      if (etype == octave_value::op_incr || etype == octave_value::op_decr)
-        {
-          octave_lvalue ref = op->lvalue ();
-
-          if (! error_state)
-            {
-              BEGIN_PROFILER_BLOCK ("prefix " + oper ())
-
-              ref.do_unary_op (etype);
-
-              if (! error_state)
-                retval = ref.value ();
-
-              END_PROFILER_BLOCK
-            }
-        }
-      else
-        {
-          octave_value val = op->rvalue1 ();
-
-          if (! error_state && val.is_defined ())
-            {
-              BEGIN_PROFILER_BLOCK ("prefix " + oper ())
-
-              // Attempt to do the operation in-place if it is unshared
-              // (a temporary expression).
-              if (val.get_count () == 1)
-                retval = val.do_non_const_unary_op (etype);
-              else
-                retval = ::do_unary_op (etype, val);
-
-              if (error_state)
-                retval = octave_value ();
-
-              END_PROFILER_BLOCK
-            }
-        }
-    }
-
-  return retval;
-}
-
-tree_expression *
-tree_prefix_expression::dup (symbol_table::scope_id scope,
-                             symbol_table::context_id context) const
-{
-  tree_prefix_expression *new_pe
-    = new tree_prefix_expression (op ? op->dup (scope, context) : 0,
-                                  line (), column (), etype);
-
-  new_pe->copy_base (*this);
-
-  return new_pe;
-}
-
-void
-tree_prefix_expression::accept (tree_walker& tw)
-{
-  tw.visit_prefix_expression (*this);
-}
-
-// Postfix expressions.
-
-octave_value_list
-tree_postfix_expression::rvalue (int nargout)
-{
-  octave_value_list retval;
-
-  if (nargout > 1)
-    error ("postfix operator `%s': invalid number of output arguments",
-           oper () . c_str ());
-  else
-    retval = rvalue1 (nargout);
-
-  return retval;
-}
-
-octave_value
-tree_postfix_expression::rvalue1 (int)
-{
-  octave_value retval;
-
-  if (error_state)
-    return retval;
-
-  if (op)
-    {
-      if (etype == octave_value::op_incr || etype == octave_value::op_decr)
-        {
-          octave_lvalue ref = op->lvalue ();
-
-          if (! error_state)
-            {
-              retval = ref.value ();
-
-              BEGIN_PROFILER_BLOCK ("postfix " + oper ())
-              ref.do_unary_op (etype);
-              END_PROFILER_BLOCK
-            }
-        }
-      else
-        {
-          octave_value val = op->rvalue1 ();
-
-          if (! error_state && val.is_defined ())
-            {
-              BEGIN_PROFILER_BLOCK ("postfix " + oper ())
-
-              retval = ::do_unary_op (etype, val);
-
-              if (error_state)
-                retval = octave_value ();
-
-              END_PROFILER_BLOCK
-            }
-        }
-    }
-
-  return retval;
-}
-
-tree_expression *
-tree_postfix_expression::dup (symbol_table::scope_id scope,
-                              symbol_table::context_id context) const
-{
-  tree_postfix_expression *new_pe
-    = new tree_postfix_expression (op ? op->dup (scope, context) : 0,
-                                   line (), column (), etype);
-
-  new_pe->copy_base (*this);
-
-  return new_pe;
-}
-
-void
-tree_postfix_expression::accept (tree_walker& tw)
-{
-  tw.visit_postfix_expression (*this);
-}
--- a/src/pt-unop.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_unop_h)
-#define octave_tree_unop_h 1
-
-#include <string>
-
-class tree_walker;
-
-class octave_value;
-class octave_value_list;
-class octave_lvalue;
-
-#include "pt-exp.h"
-#include "symtab.h"
-
-// Unary expressions.
-
-class
-tree_unary_expression : public tree_expression
-{
-public:
-
-  tree_unary_expression (int l = -1, int c = -1,
-                         octave_value::unary_op t
-                           = octave_value::unknown_unary_op)
-    : tree_expression (l, c), op (0), etype (t)  { }
-
-  tree_unary_expression (tree_expression *e, int l = -1, int c = -1,
-                         octave_value::unary_op t
-                           = octave_value::unknown_unary_op)
-    : tree_expression (l, c), op (e), etype (t) { }
-
-  ~tree_unary_expression (void) { delete op; }
-
-  bool is_unary_expression (void) const { return true; }
-
-  bool has_magic_end (void) const { return (op && op->has_magic_end ()); }
-
-  tree_expression *operand (void) { return op; }
-
-  std::string oper (void) const;
-
-  octave_value::unary_op op_type (void) const { return etype; }
-
-protected:
-
-  // The operand for the expression.
-  tree_expression *op;
-
-  // The type of the expression.
-  octave_value::unary_op etype;
-
-private:
-
-  // No copying!
-
-  tree_unary_expression (const tree_unary_expression&);
-
-  tree_unary_expression& operator = (const tree_unary_expression&);
-};
-
-// Prefix expressions.
-
-class
-tree_prefix_expression : public tree_unary_expression
-{
-public:
-
-  tree_prefix_expression (int l = -1, int c = -1)
-    : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
-
-  tree_prefix_expression (tree_expression *e, int l = -1, int c = -1,
-                          octave_value::unary_op t
-                            = octave_value::unknown_unary_op)
-    : tree_unary_expression (e, l, c, t) { }
-
-  ~tree_prefix_expression (void) { }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_prefix_expression (const tree_prefix_expression&);
-
-  tree_prefix_expression& operator = (const tree_prefix_expression&);
-};
-
-// Postfix expressions.
-
-class
-tree_postfix_expression : public tree_unary_expression
-{
-public:
-
-  tree_postfix_expression (int l = -1, int c = -1)
-    : tree_unary_expression (l, c, octave_value::unknown_unary_op) { }
-
-  tree_postfix_expression (tree_expression *e, int l = -1, int c = -1,
-                           octave_value::unary_op t
-                             = octave_value::unknown_unary_op)
-    : tree_unary_expression (e, l, c, t) { }
-
-  ~tree_postfix_expression (void) { }
-
-  bool rvalue_ok (void) const { return true; }
-
-  octave_value rvalue1 (int nargout = 1);
-
-  octave_value_list rvalue (int nargout);
-
-  tree_expression *dup (symbol_table::scope_id scope,
-                        symbol_table::context_id context) const;
-
-  void accept (tree_walker& tw);
-
-private:
-
-  // No copying!
-
-  tree_postfix_expression (const tree_postfix_expression&);
-
-  tree_postfix_expression& operator = (const tree_postfix_expression&);
-};
-
-#endif
--- a/src/pt-walk.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_walker_h)
-#define octave_tree_walker_h 1
-
-class tree_anon_fcn_handle;
-class tree_argument_list;
-class tree_binary_expression;
-class tree_break_command;
-class tree_colon_expression;
-class tree_continue_command;
-class tree_global_command;
-class tree_persistent_command;
-class tree_decl_elt;
-class tree_decl_init_list;
-class tree_simple_for_command;
-class tree_complex_for_command;
-class octave_user_script;
-class octave_user_function;
-class tree_function_def;
-class tree_identifier;
-class tree_if_clause;
-class tree_if_command;
-class tree_if_command_list;
-class tree_switch_case;
-class tree_switch_case_list;
-class tree_switch_command;
-class tree_index_expression;
-class tree_matrix;
-class tree_cell;
-class tree_multi_assignment;
-class tree_no_op_command;
-class tree_constant;
-class tree_fcn_handle;
-class tree_parameter_list;
-class tree_postfix_expression;
-class tree_prefix_expression;
-class tree_return_command;
-class tree_return_list;
-class tree_simple_assignment;
-class tree_statement;
-class tree_statement_list;
-class tree_try_catch_command;
-class tree_unwind_protect_command;
-class tree_while_command;
-class tree_do_until_command;
-
-class
-tree_walker
-{
-public:
-
-  virtual void
-  visit_anon_fcn_handle (tree_anon_fcn_handle&) = 0;
-
-  virtual void
-  visit_argument_list (tree_argument_list&) = 0;
-
-  virtual void
-  visit_binary_expression (tree_binary_expression&) = 0;
-
-  virtual void
-  visit_break_command (tree_break_command&) = 0;
-
-  virtual void
-  visit_colon_expression (tree_colon_expression&) = 0;
-
-  virtual void
-  visit_continue_command (tree_continue_command&) = 0;
-
-  virtual void
-  visit_global_command (tree_global_command&) = 0;
-
-  virtual void
-  visit_persistent_command (tree_persistent_command&) = 0;
-
-  virtual void
-  visit_decl_elt (tree_decl_elt&) = 0;
-
-  virtual void
-  visit_decl_init_list (tree_decl_init_list&) = 0;
-
-  virtual void
-  visit_simple_for_command (tree_simple_for_command&) = 0;
-
-  virtual void
-  visit_complex_for_command (tree_complex_for_command&) = 0;
-
-  virtual void
-  visit_octave_user_script (octave_user_script&) = 0;
-
-  virtual void
-  visit_octave_user_function (octave_user_function&) = 0;
-
-  virtual void
-  visit_function_def (tree_function_def&) = 0;
-
-  virtual void
-  visit_identifier (tree_identifier&) = 0;
-
-  virtual void
-  visit_if_clause (tree_if_clause&) = 0;
-
-  virtual void
-  visit_if_command (tree_if_command&) = 0;
-
-  virtual void
-  visit_if_command_list (tree_if_command_list&) = 0;
-
-  virtual void
-  visit_switch_case (tree_switch_case&) = 0;
-
-  virtual void
-  visit_switch_case_list (tree_switch_case_list&) = 0;
-
-  virtual void
-  visit_switch_command (tree_switch_command&) = 0;
-
-  virtual void
-  visit_index_expression (tree_index_expression&) = 0;
-
-  virtual void
-  visit_matrix (tree_matrix&) = 0;
-
-  virtual void
-  visit_cell (tree_cell&) = 0;
-
-  virtual void
-  visit_multi_assignment (tree_multi_assignment&) = 0;
-
-  virtual void
-  visit_no_op_command (tree_no_op_command&) = 0;
-
-  virtual void
-  visit_constant (tree_constant&) = 0;
-
-  virtual void
-  visit_fcn_handle (tree_fcn_handle&) = 0;
-
-  virtual void
-  visit_parameter_list (tree_parameter_list&) = 0;
-
-  virtual void
-  visit_postfix_expression (tree_postfix_expression&) = 0;
-
-  virtual void
-  visit_prefix_expression (tree_prefix_expression&) = 0;
-
-  virtual void
-  visit_return_command (tree_return_command&) = 0;
-
-  virtual void
-  visit_return_list (tree_return_list&) = 0;
-
-  virtual void
-  visit_simple_assignment (tree_simple_assignment&) = 0;
-
-  virtual void
-  visit_statement (tree_statement&) = 0;
-
-  virtual void
-  visit_statement_list (tree_statement_list&) = 0;
-
-  virtual void
-  visit_try_catch_command (tree_try_catch_command&) = 0;
-
-  virtual void
-  visit_unwind_protect_command (tree_unwind_protect_command&) = 0;
-
-  virtual void
-  visit_while_command (tree_while_command&) = 0;
-
-  virtual void
-  visit_do_until_command (tree_do_until_command&) = 0;
-
-protected:
-
-  tree_walker (void) { }
-
-  virtual ~tree_walker (void) { }
-
-private:
-
-  // No copying!
-
-  tree_walker (const tree_walker&);
-
-  tree_walker& operator = (const tree_walker&);
-};
-
-#endif
--- a/src/pt.cc	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <sstream>
-#include <string>
-
-#include "ov-fcn.h"
-#include "pt.h"
-#include "pt-pr-code.h"
-
-// Hide the details of the string buffer so that we are less likely to
-// create a memory leak.
-
-std::string
-tree::str_print_code (void)
-{
-  std::ostringstream buf;
-
-  tree_print_code tpc (buf);
-
-  accept (tpc);
-
-  std::string retval = buf.str ();
-
-  return retval;
-}
--- a/src/pt.h	Mon Jul 30 13:05:29 2012 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-
-Copyright (C) 1996-2012 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_tree_h)
-#define octave_tree_h 1
-
-#include <string>
-
-#include <iosfwd>
-
-class octave_function;
-class tree_walker;
-
-// Base class for the parse tree.
-
-class
-tree
-{
-public:
-
-  tree (int l = -1, int c = -1)
-    : line_num (l), column_num (c), bp (false) { }
-
-  virtual ~tree (void) { }
-
-  virtual int line (void) const { return line_num; }
-
-  virtual int column (void) const { return column_num; }
-
-  void line (int l) { line_num = l; }
-
-  void column (int c) { column_num = c; }
-
-  virtual void set_breakpoint (void) { bp = true; }
-
-  virtual void delete_breakpoint (void) { bp = false; }
-
-  bool is_breakpoint (void) const { return bp; }
-
-  std::string str_print_code (void);
-
-  virtual void accept (tree_walker& tw) = 0;
-
-private:
-
-  // The input line and column where we found the text that was
-  // eventually converted to this tree node.
-  int line_num;
-  int column_num;
-
-  // Breakpoint flag.
-  bool bp;
-
-  // No copying!
-
-  tree (const tree&);
-
-  tree& operator = (const tree&);
-};
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/template-inst/Array-jit.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/template-inst/Array-os.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,47 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// Instantiate Arrays of octave_stream objects.
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Array.h"
+#include "Array.cc"
+
+extern template class OCTAVE_API Array<bool>;
+extern template class OCTAVE_API Array<octave_idx_type>;
+
+#include "oct-stream.h"
+
+typedef scanf_format_elt* scanf_format_elt_ptr;
+typedef printf_format_elt* printf_format_elt_ptr;
+
+NO_INSTANTIATE_ARRAY_SORT (scanf_format_elt_ptr);
+INSTANTIATE_ARRAY (scanf_format_elt_ptr, OCTINTERP_API);
+
+NO_INSTANTIATE_ARRAY_SORT (printf_format_elt_ptr);
+INSTANTIATE_ARRAY (printf_format_elt_ptr, OCTINTERP_API);
+
+NO_INSTANTIATE_ARRAY_SORT (octave_stream);
+INSTANTIATE_ARRAY (octave_stream, OCTINTERP_API);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/template-inst/Array-sym.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,39 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// Instantiate Arrays of octave_child objects.
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Array.h"
+#include "Array.cc"
+
+#include "oct-obj.h"
+#include "symtab.h"
+
+typedef symbol_record* symbol_record_ptr;
+
+NO_INSTANTIATE_ARRAY_SORT (symbol_record_ptr);
+
+INSTANTIATE_ARRAY (symbol_record_ptr, OCTINTERP_API);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/template-inst/Array-tc.cc	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,38 @@
+/*
+
+Copyright (C) 1996-2012 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// Instantiate Arrays of octave_values.
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Array.h"
+#include "Array.cc"
+
+#include "ov.h"
+
+#include "oct-sort.cc"
+
+NO_INSTANTIATE_ARRAY_SORT (octave_value);
+
+INSTANTIATE_ARRAY (octave_value, OCTINTERP_API);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/template-inst/module.mk	Mon Jul 30 15:29:19 2012 -0700
@@ -0,0 +1,6 @@
+EXTRA_DIST += template-inst/module.mk
+
+TEMPLATE_INST_SRC = \
+  template-inst/Array-os.cc \
+  template-inst/Array-tc.cc \
+  template-inst/Array-jit.cc