annotate libinterp/octave-value/ov.cc @ 24534:194eb4bd202b

maint: Update punctuation for GPL v3 license text. * COPYING, Makefile.am, README, bootstrap, bootstrap.conf, OctJavaQry.java, changelog.tmpl, check-subst-vars.in.sh, find-defun-files.sh, find-files-with-tests.sh, get-source-mtime.sh, mk-hg-id.sh, mk-octave-config-h.sh, mk-opts.pl, stl_algo.h-fixed, subst-config-vals.in.sh, subst-cross-config-vals.in.sh, subst-default-vals.in.sh, subst-script-vals.in.sh, configure.ac, Doxyfile.in, arith.txi, audio.txi, basics.txi, bugs.txi, config-images.sh, container.txi, cp-idx.txi, data.txi, debug.txi, diagperm.txi, diffeq.txi, add_to_aspell_dict, mk_undocumented_list, spellcheck, errors.txi, eval.txi, expr.txi, external.txi, fn-idx.txi, func.txi, genpropdoc.m, geometry.txi, geometryimages.m, grammar.txi, gui.txi, image.txi, images.awk, install.txi, interp.txi, interpimages.m, intro.txi, io.txi, linalg.txi, macros.texi, matrix.txi, mk-doc-cache.pl, mkcontrib.awk, mkoctfile.1, munge-texi.pl, nonlin.txi, numbers.txi, obsolete.txi, octave-cli.1, octave-config.1, octave.1, octave.css, octave.texi, oop.txi, op-idx.txi, optim.txi, package.txi, plot.txi, plotimages.m, poly.txi, preface.txi, quad.txi, set.txi, signal.txi, sparse.txi, sparseimages.m, splineimages.m, stats.txi, stmt.txi, strings.txi, system.txi, testfun.txi, var.txi, vectorize.txi, array.texi, bugs.texi, cp-idx.texi, dae.texi, diffeq.texi, error.texi, factor.texi, fn-idx.texi, gpl.texi, install.texi, intro.texi, liboctave.texi, matvec.texi, nleqn.texi, nlfunc.texi, ode.texi, optim.texi, preface.texi, quad.texi, range.texi, refcard-a4.tex, refcard-legal.tex, refcard-letter.tex, refcard.tex, HACKING.md, octave.appdata.xml.in, Backend.cc, Backend.h, BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h, ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h, GenericEventNotify.h, KeyMap.cc, KeyMap.h, ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, MouseModeActionGroup.cc, MouseModeActionGroup.h, Object.cc, Object.h, ObjectFactory.cc, ObjectFactory.h, ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc, TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, __init_qt__.cc, __init_qt__.h, annotation-dialog.cc, annotation-dialog.h, gl-select.cc, gl-select.h, liboctgui-build-info.h, liboctgui-build-info.in.cc, mk-default-qt-settings.in.sh, QTerminal.cc, QTerminal.h, BlockArray.cpp, BlockArray.h, Character.h, CharacterColor.h, Emulation.cpp, Emulation.h, Filter.cpp, Filter.h, History.cpp, History.h, KeyboardTranslator.cpp, KeyboardTranslator.h, QUnixTerminalImpl.cpp, QUnixTerminalImpl.h, Screen.cpp, Screen.h, ScreenWindow.cpp, ScreenWindow.h, SelfListener.cpp, SelfListener.h, TerminalCharacterDecoder.cpp, TerminalCharacterDecoder.h, TerminalModel.cpp, TerminalModel.h, TerminalView.cpp, TerminalView.h, Vt102Emulation.cpp, Vt102Emulation.h, kpty.cpp, kpty.h, kpty_p.h, QTerminalColors.cpp, QTerminalColors.h, QWinTerminalImpl.cpp, QWinTerminalImpl.h, main.cpp, color-picker.cc, color-picker.h, dialog.cc, dialog.h, documentation-dock-widget.cc, documentation-dock-widget.h, external-editor-interface.cc, external-editor-interface.h, files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc, find-files-dialog.h, find-files-model.cc, find-files-model.h, history-dock-widget.cc, history-dock-widget.h, file-editor-interface.h, file-editor-tab.cc, file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc, find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc, octave-qscintilla.h, octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc, main-window.h, octave-cmd.cc, octave-cmd.h, octave-dock-widget.cc, octave-dock-widget.h, octave-gui.cc, octave-gui.h, octave-qt-link.cc, octave-qt-link.h, octave-settings.h, texinfo-parser.cc, texinfo-parser.h, webinfo.cc, webinfo.h, resource-manager.cc, resource-manager.h, settings-dialog.cc, settings-dialog.h, shortcut-manager.cc, shortcut-manager.h, terminal-dock-widget.cc, terminal-dock-widget.h, thread-manager.cc, thread-manager.h, variable-editor-model.cc, variable-editor-model.h, variable-editor.cc, variable-editor.h, welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-model.h, workspace-view.cc, workspace-view.h, build-env.h, build-env.in.cc, builtins.h, Cell.cc, Cell.h, __contourc__.cc, __dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __luinc__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc, base-text-renderer.h, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, cdisplay.c, cdisplay.h, cellfun.cc, coct-hdf5-types.c, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, default-defs.in.h, defaults.cc, defaults.h, defun-dld.h, defun-int.h, defun.cc, defun.h, det.cc, dirfns.cc, dirfns.h, display.cc, display.h, dlmread.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.cc, errwarn.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, file-io.h, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gammainc.cc, gcd.cc, genprops.awk, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-handle.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gripes.cc, gripes.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, kron.cc, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-hdf5.cc, ls-hdf5.h, ls-mat-ascii.cc, ls-mat-ascii.h, ls-mat4.cc, ls-mat4.h, ls-mat5.cc, ls-mat5.h, ls-oct-binary.cc, ls-oct-binary.h, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex.cc, mex.h, mexproto.h, mgorth.cc, mk-errno-list.sh, mk-mxarray-h.in.sh, mxarray.in.h, nproc.cc, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc, oct-fstrm.h, oct-handle.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hdf5.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, oct-obj.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.in.yy, oct.h, octave-default-image.h, octave-link.cc, octave-link.h, ordschur.cc, pager.cc, pager.h, pinv.cc, pr-output.cc, pr-output.h, procstream.cc, procstream.h, psi.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, toplev.h, tril.cc, tsearch.cc, txt-eng.cc, txt-eng.h, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, workspace-element.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, zfstream.cc, zfstream.h, deprecated-config.h, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc, config-module.awk, config-module.sh, convhulln.cc, dmperm.cc, fftw.cc, gzip.cc, oct-qhull.h, qr.cc, symbfact.cc, symrcm.cc, liboctinterp-build-info.h, liboctinterp-build-info.in.cc, mk-build-env-features.sh, mk-builtins.pl, mk-doc.pl, mk-pkg-add.sh, mk-version-h.in.sh, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-colon.cc, ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.cc, ov-cs-list.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.cc, ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-int-traits.h, ov-int16.cc, ov-int16.h, ov-int32.cc, ov-int32.h, ov-int64.cc, ov-int64.h, ov-int8.cc, ov-int8.h, ov-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-lazy-idx.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc, ov-null-mat.h, ov-oncleanup.cc, ov-oncleanup.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-typeinfo.cc, ov-typeinfo.h, ov-uint16.cc, ov-uint16.h, ov-uint32.cc, ov-uint32.h, ov-uint64.cc, ov-uint64.h, ov-uint8.cc, ov-uint8.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, ovl.h, octave.cc, octave.h, op-kw-docs, mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cdm-cm.cc, op-cdm-cs.cc, op-cdm-dm.cc, op-cdm-m.cc, op-cdm-s.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cdm.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-dm.cc, op-cm-m.cc, op-cm-pm.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-cdm.cc, op-dm-cm.cc, op-dm-cs.cc, op-dm-dm.cc, op-dm-m.cc, op-dm-s.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcdm-fcm.cc, op-fcdm-fcs.cc, op-fcdm-fdm.cc, op-fcdm-fm.cc, op-fcdm-fs.cc, op-fcm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fdm.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcm-pm.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fcdm.cc, op-fdm-fcm.cc, op-fdm-fcs.cc, op-fdm-fdm.cc, op-fdm-fm.cc, op-fdm-fs.cc, op-fm-fcdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fdm.cc, op-fm-fm.cc, op-fm-fs.cc, op-fm-pm.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-int.h, op-m-cdm.cc, op-m-cm.cc, op-m-cs.cc, op-m-dm.cc, op-m-m.cc, op-m-pm.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-cm.cc, op-pm-fcm.cc, op-pm-fm.cc, op-pm-m.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h, options-usage.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.cc, jit-util.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.in.yy, octave.gperf, parse.h, profiler.cc, profiler.h, pt-all.h, pt-arg-list.cc, pt-arg-list.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-funcall.cc, pt-funcall.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jit.cc, pt-jit.h, pt-jump.cc, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Array-jit.cc, Array-tc.cc, version.cc, version.in.h, Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc, Array-fC.cc, Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc, Array-util.cc, Array-util.h, Array-voidp.cc, Array.cc, Array.h, CColVector.cc, CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc, CMatrix.h, CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, CSparse.cc, CSparse.h, DiagArray2.cc, DiagArray2.h, MArray-C.cc, MArray-d.cc, MArray-f.cc, MArray-fC.cc, MArray-i.cc, MArray-s.cc, MArray.cc, MArray.h, MDiagArray2.cc, MDiagArray2.h, MSparse-C.cc, MSparse-d.cc, MSparse.cc, MSparse.h, Matrix.h, MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc, Range.h, Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, Sparse.cc, Sparse.h, boolMatrix.cc, boolMatrix.h, boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h, chMatrix.cc, chMatrix.h, chNDArray.cc, chNDArray.h, dColVector.cc, dColVector.h, dDiagMatrix.cc, dDiagMatrix.h, dMatrix.cc, dMatrix.h, dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h, dSparse.cc, dSparse.h, dim-vector.cc, dim-vector.h, fCColVector.cc, fCColVector.h, fCDiagMatrix.cc, fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h, fCNDArray.cc, fCNDArray.h, fCRowVector.cc, fCRowVector.h, fColVector.cc, fColVector.h, fDiagMatrix.cc, fDiagMatrix.h, fMatrix.cc, fMatrix.h, fNDArray.cc, fNDArray.h, fRowVector.cc, fRowVector.h, idx-vector.cc, idx-vector.h, int16NDArray.cc, int16NDArray.h, int32NDArray.cc, int32NDArray.h, int64NDArray.cc, int64NDArray.h, int8NDArray.cc, int8NDArray.h, intNDArray.cc, intNDArray.h, uint16NDArray.cc, uint16NDArray.h, uint32NDArray.cc, uint32NDArray.h, uint64NDArray.cc, uint64NDArray.h, uint8NDArray.cc, uint8NDArray.h, cconv2.f, cdotc3.f, cmatm3.f, csconv2.f, dconv2.f, ddot3.f, dmatm3.f, sconv2.f, sdot3.f, smatm3.f, zconv2.f, zdconv2.f, zdotc3.f, zmatm3.f, crsf2csf.f, zrsf2csf.f, mk-f77-def.in.sh, liboctave-build-info.h, liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK-opts.in, DASPK.cc, DASPK.h, DASRT-opts.in, DASRT.cc, DASRT.h, DASSL-opts.in, DASSL.cc, DASSL.h, DET.h, EIG.cc, EIG.h, LSODE-opts.in, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.cc, ODES.h, ODESFunc.h, Quad-opts.in, Quad.cc, Quad.h, aepbalance.cc, aepbalance.h, base-dae.h, base-de.h, base-min.h, bsxfun-decl.h, bsxfun-defs.cc, bsxfun.h, chol.cc, chol.h, eigs-base.cc, eigs-base.h, fEIG.cc, fEIG.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-amos-proto.h, lo-arpack-proto.h, lo-blas-proto.h, lo-fftpack-proto.h, lo-lapack-proto.h, lo-mappers.cc, lo-mappers.h, lo-qrupdate-proto.h, lo-ranlib-proto.h, lo-slatec-proto.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-dmsolve.cc, sparse-dmsolve.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, Sparse-diag-op-defs.h, Sparse-op-decls.h, Sparse-op-defs.h, Sparse-perm-op-defs.h, config-ops.sh, mk-ops.awk, mx-base.h, mx-defs.h, mx-ext.h, mx-inlines.cc, mx-op-decl.h, mx-op-defs.h, mx-ops, smx-ops, vx-ops, child-list.cc, child-list.h, cmach-info.c, cmach-info.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-passwd.cc, oct-passwd.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.h, base-list.h, blaswrap.c, byte-swap.h, caseless-str.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, cquit.c, data-conv.cc, data-conv.h, f2c-main.c, f77-fcn.c, f77-fcn.h, file-info.cc, file-info.h, functor.h, glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-array-gripes.cc, lo-array-gripes.h, lo-cutils.c, lo-cutils.h, lo-error.c, lo-error.h, lo-hash.cc, lo-hash.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-traits.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-glob.cc, oct-glob.h, oct-inttypes-fwd.h, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-rl-edit.c, oct-rl-edit.h, oct-rl-hist.c, oct-rl-hist.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, oct-sparse.cc, oct-sparse.h, oct-string.cc, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, singleton-cleanup.cc, singleton-cleanup.h, sparse-sort.cc, sparse-sort.h, sparse-util.cc, sparse-util.h, str-vec.cc, str-vec.h, sun-utils.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h, areadlink-wrapper.c, areadlink-wrapper.h, async-system-wrapper.c, async-system-wrapper.h, base64-wrappers.c, base64-wrappers.h, canonicalize-file-name-wrapper.c, canonicalize-file-name-wrapper.h, dirent-wrappers.c, dirent-wrappers.h, fcntl-wrappers.c, fcntl-wrappers.h, filepos-wrappers.c, filepos-wrappers.h, fpucw-wrappers.c, fpucw-wrappers.h, gen-tempname-wrapper.c, gen-tempname-wrapper.h, getopt-wrapper.c, getopt-wrapper.h, glob-wrappers.c, glob-wrappers.h, hash-wrappers.c, hash-wrappers.h, localcharset-wrapper.c, localcharset-wrapper.h, math-wrappers.c, math-wrappers.h, mkostemp-wrapper.c, mkostemp-wrapper.h, nanosleep-wrapper.c, nanosleep-wrapper.h, nproc-wrapper.c, nproc-wrapper.h, octave-popen2.c, octave-popen2.h, putenv-wrapper.c, putenv-wrapper.h, set-program-name-wrapper.c, set-program-name-wrapper.h, signal-wrappers.c, signal-wrappers.h, stat-wrappers.c, stat-wrappers.h, strdup-wrapper.c, strdup-wrapper.h, strftime-wrapper.c, strftime-wrapper.h, strmode-wrapper.c, strmode-wrapper.h, strptime-wrapper.c, strptime-wrapper.h, time-wrappers.c, time-wrappers.h, tmpfile-wrapper.c, tmpfile-wrapper.h, uname-wrapper.c, uname-wrapper.h, uniconv-wrappers.c, uniconv-wrappers.h, unistd-wrappers.c, unistd-wrappers.h, unsetenv-wrapper.c, unsetenv-wrapper.h, vasprintf-wrapper.c, vasprintf-wrapper.h, wait-for-input.c, wait-for-input.h, wait-wrappers.c, wait-wrappers.h, acinclude.m4, ax_blas.m4, ax_lapack.m4, ax_openmp.m4, ax_pthread.m4, octave_blas_f77_func.m4, pkg.m4, oct-conf-post.in.h, run-octave.in, Map.m, ascii.m, binary.m, cd.m, close.m, delete.m, dir.m, disp.m, ftp.m, loadobj.m, mget.m, mkdir.m, mput.m, rename.m, rmdir.m, saveobj.m, __get_properties__.m, audioplayer.m, disp.m, get.m, isplaying.m, pause.m, play.m, playblocking.m, resume.m, set.m, stop.m, subsasgn.m, subsref.m, __get_properties__.m, audiorecorder.m, disp.m, get.m, getaudiodata.m, getplayer.m, isrecording.m, pause.m, play.m, record.m, recordblocking.m, resume.m, set.m, stop.m, subsasgn.m, subsref.m, lin2mu.m, mu2lin.m, record.m, sound.m, soundsc.m, bitmax.m, chop.m, comma.m, isstr.m, mahalanobis.m, md5sum.m, octave_config_info.m, onenormest.m, paren.m, semicolon.m, sleep.m, usleep.m, wavread.m, wavwrite.m, acosd.m, acot.m, acotd.m, acoth.m, acsc.m, acscd.m, acsch.m, asec.m, asecd.m, asech.m, asind.m, atan2d.m, atand.m, cosd.m, cot.m, cotd.m, coth.m, csc.m, cscd.m, csch.m, sec.m, secd.m, sech.m, sind.m, tand.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m, bitget.m, bitset.m, blkdiag.m, cart2pol.m, cart2sph.m, cell2mat.m, celldisp.m, circshift.m, common_size.m, cplxpair.m, cumtrapz.m, curl.m, dblquad.m, deal.m, deg2rad.m, del2.m, divergence.m, flip.m, flipdim.m, fliplr.m, flipud.m, gradient.m, idivide.m, int2str.m, integral.m, integral2.m, integral3.m, interp1.m, interp2.m, interp3.m, interpft.m, interpn.m, isequal.m, isequaln.m, logspace.m, nextpow2.m, num2str.m, pol2cart.m, polyarea.m, postpad.m, prepad.m, __splinen__.m, quad2d.m, quadgk.m, quadl.m, quadv.m, rad2deg.m, randi.m, rat.m, repelem.m, repmat.m, rot90.m, rotdim.m, shift.m, shiftdim.m, sortrows.m, sph2cart.m, structfun.m, subsindex.m, trapz.m, triplequad.m, xor.m, convhull.m, delaunay.m, delaunayn.m, dsearch.m, dsearchn.m, griddata.m, griddata3.m, griddatan.m, inpolygon.m, rectint.m, tsearchn.m, voronoi.m, voronoin.m, dialog.m, errordlg.m, getappdata.m, guidata.m, guihandles.m, helpdlg.m, inputdlg.m, isappdata.m, listdlg.m, msgbox.m, __file_filter__.m, __fltk_file_filter__.m, __get_funcname__.m, __is_function__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiobject_split_args__.m, __uiputfile_fltk__.m, questdlg.m, rmappdata.m, setappdata.m, uibuttongroup.m, uicontextmenu.m, uicontrol.m, uigetdir.m, uigetfile.m, uimenu.m, uipanel.m, uipushtool.m, uiputfile.m, uiresume.m, uitoggletool.m, uitoolbar.m, uiwait.m, waitbar.m, waitforbuttonpress.m, warndlg.m, __gripe_missing_component__.m, __makeinfo__.m, __unimplemented__.m, ans.m, debug.m, doc.m, doc_cache_create.m, error_ids.m, get_first_help_sentence.m, help.m, lookfor.m, print_usage.m, __additional_help_message__.m, __strip_html_tags__.m, slash.m, type.m, warning_ids.m, which.m, autumn.m, bone.m, brighten.m, cmpermute.m, cmunique.m, colorcube.m, colormap.m, contrast.m, cool.m, copper.m, cubehelix.m, flag.m, frame2im.m, getframe.m, gray.m, gray2ind.m, hot.m, hsv.m, hsv2rgb.m, im2double.m, im2frame.m, image.m, imagesc.m, imfinfo.m, imformats.m, imread.m, imshow.m, imwrite.m, ind2gray.m, ind2rgb.m, iscolormap.m, jet.m, lines.m, ntsc2rgb.m, ocean.m, pink.m, prism.m, __imfinfo__.m, __imread__.m, __imwrite__.m, colorspace_conversion_input_check.m, colorspace_conversion_revert.m, imageIO.m, imwrite_filename.m, ind2x.m, rainbow.m, rgb2hsv.m, rgb2ind.m, rgb2ntsc.m, rgbplot.m, spinmap.m, spring.m, summer.m, viridis.m, white.m, winter.m, beep.m, csvread.m, csvwrite.m, dlmwrite.m, fileread.m, importdata.m, is_valid_file_id.m, strread.m, textread.m, javaArray.m, java_get.m, java_set.m, javaaddpath.m, javachk.m, javaclasspath.m, javamem.m, javarmpath.m, ClassHelper.java, Matrix.java, OctClassLoader.java, Octave.java, OctaveReference.java, usejava.m, bandwidth.m, commutation_matrix.m, cond.m, condeig.m, condest.m, cross.m, duplication_matrix.m, expm.m, gls.m, housh.m, isbanded.m, isdefinite.m, isdiag.m, ishermitian.m, issymmetric.m, istril.m, istriu.m, krylov.m, linsolve.m, logm.m, lscov.m, normest.m, normest1.m, null.m, ols.m, orth.m, planerot.m, qzhess.m, rank.m, rref.m, subspace.m, trace.m, vech.m, vecnorm.m, bug_report.m, bunzip2.m, cast.m, citation.m, compare_versions.m, computer.m, copyfile.m, delete.m, desktop.m, dir.m, dos.m, edit.m, fact.m, fieldnames.m, fileattrib.m, fileparts.m, fullfile.m, genvarname.m, getfield.m, grabcode.m, gunzip.m, info.m, inputParser.m, inputname.m, isdeployed.m, isdir.m, ismac.m, ispc.m, isunix.m, license.m, list_primes.m, loadobj.m, ls.m, ls_command.m, menu.m, methods.m, mex.m, mexext.m, mkdir.m, mkoctfile.m, movefile.m, namelengthmax.m, nargchk.m, narginchk.m, nargoutchk.m, news.m, nthargout.m, open.m, orderfields.m, pack.m, parseparams.m, perl.m, __publish_html_output__.m, __publish_latex_output__.m, __w2mpth__.m, display_info_file.m, publish.m, python.m, recycle.m, run.m, saveobj.m, setfield.m, substruct.m, swapbytes.m, symvar.m, tar.m, tempdir.m, tmpnam.m, unix.m, unpack.m, untar.m, unzip.m, validateattributes.m, ver.m, version.m, what.m, zip.m, mk-doc.pl, mk-pkg-add.sh, decic.m, ode15i.m, ode15s.m, ode23.m, ode45.m, odeget.m, odeplot.m, odeset.m, AbsRel_norm.m, check_default_input.m, integrate_adaptive.m, kahan.m, ode_event_handler.m, odedefaults.m, odemergeopts.m, runge_kutta_23.m, runge_kutta_45_dorpri.m, runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m, fminsearch.m, fminunc.m, fsolve.m, fzero.m, glpk.m, humps.m, lsqnonneg.m, optimget.m, optimset.m, pqpnonneg.m, __fdjac__.m, qp.m, sqp.m, import.m, matlabroot.m, pathdef.m, getsavepath.m, savepath.m, pkg.m, build.m, configure_make.m, default_prefix.m, describe.m, dirempty.m, get_description.m, get_forge_download.m, get_forge_pkg.m, get_unsatisfied_deps.m, getarch.m, getarchdir.m, install.m, installed_packages.m, list_forge_packages.m, load_packages.m, load_packages_and_dependencies.m, rebuild.m, save_order.m, uninstall.m, unload_packages.m, __clabel__.m, __getlegenddata__.m, __rotate_around_axis__.m, annotation.m, axis.m, box.m, camlookat.m, camorbit.m, campos.m, camroll.m, camtarget.m, camup.m, camva.m, camzoom.m, caxis.m, clabel.m, daspect.m, datetick.m, diffuse.m, grid.m, gtext.m, hidden.m, legend.m, lighting.m, material.m, orient.m, pbaspect.m, __axis_label__.m, __axis_limits__.m, rticks.m, shading.m, specular.m, text.m, thetaticks.m, title.m, view.m, whitebg.m, xlabel.m, xlim.m, xticklabels.m, xticks.m, ylabel.m, ylim.m, yticklabels.m, yticks.m, zlabel.m, zlim.m, zticklabels.m, zticks.m, area.m, bar.m, barh.m, camlight.m, colorbar.m, comet.m, comet3.m, compass.m, contour.m, contour3.m, contourc.m, contourf.m, cylinder.m, ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, fplot.m, hist.m, isocaps.m, isocolors.m, isonormals.m, isosurface.m, light.m, line.m, loglog.m, loglogerr.m, mesh.m, meshc.m, meshz.m, pareto.m, patch.m, pcolor.m, peaks.m, pie.m, pie3.m, plot.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, __add_datasource__.m, __bar__.m, __calc_isovalue_from_data__.m, __contour__.m, __errplot__.m, __ezplot__.m, __interp_cube__.m, __line__.m, __marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __quiver__.m, __scatter__.m, __stem__.m, __unite_shared_vertices__.m, quiver.m, quiver3.m, rectangle.m, reducepatch.m, reducevolume.m, ribbon.m, rose.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, shrinkfaces.m, slice.m, smooth3.m, sombrero.m, sphere.m, stairs.m, stem.m, stem3.m, stemleaf.m, surf.m, surface.m, surfc.m, surfl.m, surfnorm.m, tetramesh.m, trimesh.m, triplot.m, trisurf.m, waterfall.m, __actual_axis_position__.m, __default_plot_options__.m, __gnuplot_drawnow__.m, __next_line_color__.m, __next_line_style__.m, __opengl_info__.m, __plt_get_axis_arg__.m, __pltopt__.m, allchild.m, ancestor.m, axes.m, cla.m, clf.m, close.m, closereq.m, colstyle.m, copyobj.m, figure.m, findall.m, findfigs.m, findobj.m, gca.m, gcbf.m, gcbo.m, gcf.m, gco.m, ginput.m, gnuplot_binary.in.m, graphics_toolkit.m, groot.m, hdl2struct.m, hggroup.m, hgload.m, hgsave.m, hgtransform.m, hold.m, isaxes.m, isfigure.m, isgraphics.m, ishandle.m, ishold.m, isprop.m, linkaxes.m, linkprop.m, meshgrid.m, ndgrid.m, newplot.m, pan.m, print.m, printd.m, __add_default_menu__.m, __ghostscript__.m, __gnuplot_draw_axes__.m, __gnuplot_draw_figure__.m, __gnuplot_get_var__.m, __gnuplot_ginput__.m, __gnuplot_has_feature__.m, __gnuplot_has_terminal__.m, __gnuplot_open_stream__.m, __gnuplot_print__.m, __gnuplot_version__.m, __opengl_print__.m, __print_parse_opts__.m, __set_default_mouse_modes__.m, refresh.m, refreshdata.m, rotate.m, rotate3d.m, saveas.m, shg.m, struct2hdl.m, subplot.m, zoom.m, compan.m, conv.m, deconv.m, mkpp.m, mpoles.m, padecoef.m, pchip.m, poly.m, polyaffine.m, polyder.m, polyeig.m, polyfit.m, polygcd.m, polyint.m, polyout.m, polyreduce.m, polyval.m, polyvalm.m, ppder.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, unmkpp.m, addpref.m, getpref.m, ispref.m, prefdir.m, preferences.m, loadprefs.m, prefsfile.m, saveprefs.m, rmpref.m, setpref.m, style.css, profexplore.m, profexport.m, profile.m, profshow.m, intersect.m, ismember.m, powerset.m, validsetargs.m, setdiff.m, setxor.m, union.m, unique.m, arch_fit.m, arch_rnd.m, arch_test.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m, diffpara.m, durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, filter2.m, fractdiff.m, freqz.m, freqz_plot.m, hamming.m, hanning.m, hurst.m, ifftshift.m, periodogram.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m, triangle_sw.m, sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m, stft.m, synthesis.m, unwrap.m, yulewalker.m, bicg.m, bicgstab.m, cgs.m, colperm.m, eigs.m, etreeplot.m, gmres.m, gplot.m, ichol.m, ilu.m, nonzeros.m, pcg.m, pcr.m, __sprand__.m, qmr.m, spaugment.m, spconvert.m, spdiags.m, speye.m, spfun.m, spones.m, sprand.m, sprandn.m, sprandsym.m, spstats.m, spy.m, svds.m, treelayout.m, treeplot.m, bessel.m, beta.m, betaln.m, ellipke.m, expint.m, factor.m, factorial.m, isprime.m, lcm.m, legendre.m, nchoosek.m, nthroot.m, perms.m, pow2.m, primes.m, reallog.m, realpow.m, realsqrt.m, gallery.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m, rosser.m, toeplitz.m, vander.m, wilkinson.m, __finish__.m, center.m, cloglog.m, corr.m, corrcoef.m, cov.m, crosstab.m, histc.m, iqr.m, kendall.m, kurtosis.m, logit.m, mean.m, meansq.m, median.m, mode.m, moment.m, ppplot.m, prctile.m, probit.m, qqplot.m, quantile.m, range.m, ranks.m, run_count.m, runlength.m, skewness.m, spearman.m, statistics.m, std.m, var.m, zscore.m, betacdf.m, betainv.m, betapdf.m, betarnd.m, binocdf.m, binoinv.m, binopdf.m, binornd.m, cauchy_cdf.m, cauchy_inv.m, cauchy_pdf.m, cauchy_rnd.m, chi2cdf.m, chi2inv.m, chi2pdf.m, chi2rnd.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m, discrete_rnd.m, empirical_cdf.m, empirical_inv.m, empirical_pdf.m, empirical_rnd.m, expcdf.m, expinv.m, exppdf.m, exprnd.m, fcdf.m, finv.m, fpdf.m, frnd.m, gamcdf.m, gaminv.m, gampdf.m, gamrnd.m, geocdf.m, geoinv.m, geopdf.m, geornd.m, hygecdf.m, hygeinv.m, hygepdf.m, hygernd.m, kolmogorov_smirnov_cdf.m, laplace_cdf.m, laplace_inv.m, laplace_pdf.m, laplace_rnd.m, logistic_cdf.m, logistic_inv.m, logistic_pdf.m, logistic_rnd.m, logncdf.m, logninv.m, lognpdf.m, lognrnd.m, nbincdf.m, nbininv.m, nbinpdf.m, nbinrnd.m, normcdf.m, norminv.m, normpdf.m, normrnd.m, poisscdf.m, poissinv.m, poisspdf.m, poissrnd.m, stdnormal_cdf.m, stdnormal_inv.m, stdnormal_pdf.m, stdnormal_rnd.m, tcdf.m, tinv.m, tpdf.m, trnd.m, unidcdf.m, unidinv.m, unidpdf.m, unidrnd.m, unifcdf.m, unifinv.m, unifpdf.m, unifrnd.m, wblcdf.m, wblinv.m, wblpdf.m, wblrnd.m, wienrnd.m, logistic_regression.m, logistic_regression_derivatives.m, logistic_regression_likelihood.m, anova.m, bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m, cor_test.m, f_test_regression.m, hotelling_test.m, hotelling_test_2.m, kolmogorov_smirnov_test.m, kolmogorov_smirnov_test_2.m, kruskal_wallis_test.m, manova.m, mcnemar_test.m, prop_test_2.m, run_test.m, sign_test.m, t_test.m, t_test_2.m, t_test_regression.m, u_test.m, var_test.m, welch_test.m, wilcoxon_test.m, z_test.m, z_test_2.m, base2dec.m, bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m, erase.m, findstr.m, hex2dec.m, index.m, isletter.m, isstring.m, isstrprop.m, mat2str.m, native2unicode.m, ostrsplit.m, regexptranslate.m, rindex.m, str2num.m, strcat.m, strchr.m, strjoin.m, strjust.m, strmatch.m, strsplit.m, strtok.m, strtrim.m, strtrunc.m, substr.m, unicode2native.m, untabify.m, validatestring.m, __have_feature__.m, __printf_assert__.m, __prog_output_assert__.m, __run_test_suite__.m, assert.m, demo.m, example.m, fail.m, compare_plot_demos.m, dump_demos.m, html_compare_plot_demos.m, rundemos.m, runtests.m, speed.m, test.m, addtodate.m, asctime.m, calendar.m, clock.m, ctime.m, date.m, datenum.m, datestr.m, datevec.m, eomday.m, etime.m, is_leap_year.m, now.m, weekday.m, display-available.c, display-available.h, main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc, octave-build-info.h, octave-build-info.in.cc, octave-config.in.cc, shared-fcns.h, args.tst, bug-31371.tst, bug-35448.tst, bug-35881.tst, bug-36025.tst, bug-38236.tst, bug-38565.tst, bug-38576.tst, bug-38691.tst, bug-41723.tst, bug-44940.tst, bug-46330.tst, bug-46660.tst, bug-50014.tst, bug-50035.tst, bug-50716.tst, bug-51192.tst, bug-51532.tst, bug-51534.tst, bug-51599.tst, bug-52075.tst, class-concat.tst, classdef-multiple-inheritance.tst, classdef.tst, classes.tst, colormaps.tst, command.tst, complex.tst, ctor-vs-method.tst, deprecate-props.tst, diag-perm.tst, error.tst, eval-catch.tst, fcn-handle-derived-resolution.tst, fntests.m, for.tst, func.tst, global.tst, if.tst, index.tst, io.tst, jit.tst, leftdiv.tst, line-continue.tst, logical-index.tst, mk-bc-overloads-tst.sh, mk-conv-tst.sh, mk-sparse-tst.sh, nest.tst, null-assign.tst, parser.tst, prefer.tst, publish.tst, range.tst, recursion.tst, return.tst, show-failures.awk, single-index.tst, slice.tst, struct.tst, switch.tst, system.tst, transpose.tst, try.tst, unwind.tst, while.tst: Changed punctuation of GPL license text to match that suggested by FSF.
author Rik <rik@octave.org>
date Sat, 06 Jan 2018 07:57:19 -0800
parents 5aec653c88e7
children 46440078d73b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1 /*
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 1996-2017 John W. Eaton
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10871
diff changeset
4 Copyright (C) 2009-2010 VZLU Prague
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
5
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
7
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23881
diff changeset
8 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
9 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23881
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
11 (at your option) any later version.
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
12
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
13 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
14 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
16 GNU General Public License for more details.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
17
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6867
diff changeset
19 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23881
diff changeset
20 <https://www.gnu.org/licenses/>.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
21
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
22 */
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
23
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21660
diff changeset
24 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21295
diff changeset
25 # include "config.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
26 #endif
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
27
4970
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
28 #include "data-conv.h"
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
29 #include "quit.h"
2942
026f342c2019 [project @ 1997-05-08 02:20:57 by jwe]
jwe
parents: 2909
diff changeset
30 #include "str-vec.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
31
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20939
diff changeset
32 #include "ovl.h"
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
33 #include "oct-stream.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
34 #include "ov.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
35 #include "ov-base.h"
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
36 #include "ov-bool.h"
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
37 #include "ov-bool-mat.h"
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
38 #include "ov-cell.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
39 #include "ov-scalar.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
40 #include "ov-float.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
41 #include "ov-re-mat.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
42 #include "ov-flt-re-mat.h"
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
43 #include "ov-re-diag.h"
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
44 #include "ov-flt-re-diag.h"
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
45 #include "ov-perm.h"
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
46 #include "ov-bool-sparse.h"
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
47 #include "ov-cx-sparse.h"
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
48 #include "ov-re-sparse.h"
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
49 #include "ov-int8.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
50 #include "ov-int16.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
51 #include "ov-int32.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
52 #include "ov-int64.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
53 #include "ov-uint8.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
54 #include "ov-uint16.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
55 #include "ov-uint32.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
56 #include "ov-uint64.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
57 #include "ov-complex.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
58 #include "ov-flt-complex.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
59 #include "ov-cx-mat.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
60 #include "ov-flt-cx-mat.h"
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
61 #include "ov-cx-diag.h"
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
62 #include "ov-flt-cx-diag.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
63 #include "ov-ch-mat.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
64 #include "ov-str-mat.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
65 #include "ov-range.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
66 #include "ov-struct.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
67 #include "ov-class.h"
15037
56b8eb7c9c04 improvements in parsing classdef
John W. Eaton <jwe@octave.org>
parents: 14861
diff changeset
68 #include "ov-classdef.h"
14015
77adde2e79ac fix include file name
John W. Eaton <jwe@octave.org>
parents: 14013
diff changeset
69 #include "ov-oncleanup.h"
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3961
diff changeset
70 #include "ov-cs-list.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
71 #include "ov-colon.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
72 #include "ov-builtin.h"
4649
f7ce581b27fb [project @ 2003-11-23 21:46:44 by jwe]
jwe
parents: 4645
diff changeset
73 #include "ov-dld-fcn.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
74 #include "ov-usr-fcn.h"
4342
813effe14ee1 [project @ 2003-02-20 08:35:55 by jwe]
jwe
parents: 4276
diff changeset
75 #include "ov-fcn-handle.h"
4966
91b61d27b9b4 [project @ 2004-09-07 02:01:22 by jwe]
jwe
parents: 4965
diff changeset
76 #include "ov-fcn-inline.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
77 #include "ov-typeinfo.h"
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
78 #include "ov-null-mat.h"
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
79 #include "ov-lazy-idx.h"
15754
bf77f7f66bdf register octave_java type at Octave startup
John W. Eaton <jwe@octave.org>
parents: 15467
diff changeset
80 #include "ov-java.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
81
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
82 #include "defun.h"
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
83 #include "error.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21078
diff changeset
84 #include "errwarn.h"
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23589
diff changeset
85 #include "interpreter-private.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
86 #include "pager.h"
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
87 #include "parse.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
88 #include "pr-output.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
89 #include "symtab.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
90 #include "utils.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
91 #include "variables.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
92
2477
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
93 // We are likely to have a lot of octave_value objects to allocate, so
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
94 // make the grow_size large.
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
95
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
96 // If TRUE, don't create special diagonal matrix objects.
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
97
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
98 static bool Vdisable_diagonal_matrix = false;
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
99
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
100 // If TRUE, don't create special permutation matrix objects.
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
101
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
102 static bool Vdisable_permutation_matrix = false;
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
103
19394
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
104 // If TRUE, don't create special range objects.
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
105
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
106 static bool Vdisable_range = false;
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
107
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5759
diff changeset
108 // FIXME
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
109
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
110 // Octave's value type.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
111
21573
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20163
diff changeset
112 octave_base_value *
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20163
diff changeset
113 octave_value::nil_rep (void)
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20163
diff changeset
114 {
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20163
diff changeset
115 static octave_base_value nr;
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20163
diff changeset
116 return &nr;
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20163
diff changeset
117 }
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20163
diff changeset
118
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
119 std::string
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
120 octave_value::unary_op_as_string (unary_op op)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
121 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
122 switch (op)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
123 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
124 case op_not:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
125 return "!";
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
126
4965
c0d8e8afa82f [project @ 2004-09-06 20:19:57 by jwe]
jwe
parents: 4944
diff changeset
127 case op_uplus:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
128 return "+";
4965
c0d8e8afa82f [project @ 2004-09-06 20:19:57 by jwe]
jwe
parents: 4944
diff changeset
129
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
130 case op_uminus:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
131 return "-";
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
132
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
133 case op_transpose:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
134 return ".'";
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
135
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
136 case op_hermitian:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
137 return "'";
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
138
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
139 case op_incr:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
140 return "++";
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
141
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
142 case op_decr:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
143 return "--";
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
144
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
145 default:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
146 return "<unknown>";
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
147 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
148 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
149
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
150 std::string
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
151 octave_value::unary_op_fcn_name (unary_op op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
152 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
153 switch (op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
154 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
155 case op_not:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
156 return "not";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
157
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
158 case op_uplus:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
159 return "uplus";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
160
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
161 case op_uminus:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
162 return "uminus";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
163
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
164 case op_transpose:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
165 return "transpose";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
166
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
167 case op_hermitian:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
168 return "ctranspose";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
169
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
170 default:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
171 return "<unknown>";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
172 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
173 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
174
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
175 std::string
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
176 octave_value::binary_op_as_string (binary_op op)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
177 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
178 switch (op)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
179 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
180 case op_add:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
181 return "+";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
182
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
183 case op_sub:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
184 return "-";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
185
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
186 case op_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
187 return "*";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
188
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
189 case op_div:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
190 return "/";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
191
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
192 case op_pow:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
193 return "^";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
194
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
195 case op_ldiv:
23804
8057d3f0673d Use C++11 raw string literals to avoid escaping backslashes in strings.
Rik <rik@octave.org>
parents: 23795
diff changeset
196 return R"(\)";
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
197
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
198 case op_lt:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
199 return "<";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
200
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
201 case op_le:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
202 return "<=";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
203
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
204 case op_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
205 return "==";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
206
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
207 case op_ge:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
208 return ">=";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
209
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
210 case op_gt:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
211 return ">";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
212
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
213 case op_ne:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
214 return "!=";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
215
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
216 case op_el_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
217 return ".*";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
218
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
219 case op_el_div:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
220 return "./";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
221
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
222 case op_el_pow:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
223 return ".^";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
224
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
225 case op_el_ldiv:
23804
8057d3f0673d Use C++11 raw string literals to avoid escaping backslashes in strings.
Rik <rik@octave.org>
parents: 23795
diff changeset
226 return R"(.\)";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
227
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
228 case op_el_and:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
229 return "&";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
230
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
231 case op_el_or:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
232 return "|";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
233
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
234 case op_struct_ref:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
235 return ".";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
236
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
237 default:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
238 return "<unknown>";
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
239 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
240 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
241
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
242 std::string
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
243 octave_value::binary_op_fcn_name (binary_op op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
244 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
245 switch (op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
246 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
247 case op_add:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
248 return "plus";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
249
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
250 case op_sub:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
251 return "minus";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
252
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
253 case op_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
254 return "mtimes";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
255
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
256 case op_div:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
257 return "mrdivide";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
258
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
259 case op_pow:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
260 return "mpower";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
261
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
262 case op_ldiv:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
263 return "mldivide";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
264
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
265 case op_lt:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
266 return "lt";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
267
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
268 case op_le:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
269 return "le";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
270
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
271 case op_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
272 return "eq";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
273
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
274 case op_ge:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
275 return "ge";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
276
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
277 case op_gt:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
278 return "gt";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
279
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
280 case op_ne:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
281 return "ne";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
282
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
283 case op_el_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
284 return "times";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
285
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
286 case op_el_div:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
287 return "rdivide";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
288
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
289 case op_el_pow:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
290 return "power";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
291
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
292 case op_el_ldiv:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
293 return "ldivide";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
294
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
295 case op_el_and:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
296 return "and";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
297
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
298 case op_el_or:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
299 return "or";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
300
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
301 default:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
302 return "<unknown>";
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
303 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
304 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
305
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
306 std::string
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
307 octave_value::binary_op_fcn_name (compound_binary_op op)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
308 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
309 switch (op)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
310 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
311 case op_trans_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
312 return "transtimes";
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
313
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
314 case op_mul_trans:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
315 return "timestrans";
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
316
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
317 case op_herm_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
318 return "hermtimes";
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
319
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
320 case op_mul_herm:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
321 return "timesherm";
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
322
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
323 case op_trans_ldiv:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
324 return "transldiv";
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
325
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
326 case op_herm_ldiv:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
327 return "hermldiv";
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
328
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
329 case op_el_and_not:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
330 return "andnot";
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
331
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
332 case op_el_or_not:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
333 return "ornot";
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
334
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
335 case op_el_not_and:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
336 return "notand";
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
337
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
338 case op_el_not_or:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
339 return "notor";
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
340
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
341 default:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
342 return "<unknown>";
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
343 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
344 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
345
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
346 std::string
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
347 octave_value::assign_op_as_string (assign_op op)
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
348 {
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
349 switch (op)
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
350 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
351 case op_asn_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
352 return "=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
353
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
354 case op_add_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
355 return "+=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
356
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
357 case op_sub_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
358 return "-=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
359
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
360 case op_mul_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
361 return "*=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
362
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
363 case op_div_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
364 return "/=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
365
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
366 case op_ldiv_eq:
23804
8057d3f0673d Use C++11 raw string literals to avoid escaping backslashes in strings.
Rik <rik@octave.org>
parents: 23795
diff changeset
367 return R"(\=)";
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
368
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
369 case op_pow_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
370 return "^=";
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
371
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
372 case op_el_mul_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
373 return ".*=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
374
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
375 case op_el_div_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
376 return "./=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
377
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
378 case op_el_ldiv_eq:
23804
8057d3f0673d Use C++11 raw string literals to avoid escaping backslashes in strings.
Rik <rik@octave.org>
parents: 23795
diff changeset
379 return R"(.\=)";
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
380
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
381 case op_el_pow_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
382 return ".^=";
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
383
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
384 case op_el_and_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
385 return "&=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
386
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
387 case op_el_or_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
388 return "|=";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
389
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
390 default:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
391 return "<unknown>";
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
392 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
393 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
394
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
395 octave_value::binary_op
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
396 octave_value::assign_op_to_binary_op (assign_op op)
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
397 {
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
398 switch (op)
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
399 {
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
400 case op_add_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
401 return op_add;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
402
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
403 case op_sub_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
404 return op_sub;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
405
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
406 case op_mul_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
407 return op_mul;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
408
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
409 case op_div_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
410 return op_div;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
411
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
412 case op_ldiv_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
413 return op_ldiv;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
414
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
415 case op_pow_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
416 return op_pow;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
417
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
418 case op_el_mul_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
419 return op_el_mul;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
420
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
421 case op_el_div_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
422 return op_el_div;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
423
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
424 case op_el_ldiv_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
425 return op_el_ldiv;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
426
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
427 case op_el_pow_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
428 return op_el_pow;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
429
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
430 case op_el_and_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
431 return op_el_and;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
432
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
433 case op_el_or_eq:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
434 return op_el_or;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
435
15140
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
436 default:
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
437 return unknown_binary_op;
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
438 }
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
439 }
6ea86e1d0f5f Support +=, -=, *=, ect. in JIT
Max Brister <max@2bass.com>
parents: 15057
diff changeset
440
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
441 octave_value::assign_op
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
442 octave_value::binary_op_to_assign_op (binary_op op)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
443 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
444 switch (op)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
445 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
446 case op_add:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
447 return op_add_eq;
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
448
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
449 case op_sub:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
450 return op_sub_eq;
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
451
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
452 case op_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
453 return op_mul_eq;
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
454
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
455 case op_div:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
456 return op_div_eq;
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
457
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
458 case op_el_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
459 return op_el_mul_eq;
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
460
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
461 case op_el_div:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
462 return op_el_div_eq;
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
463
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
464 case op_el_and:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
465 return op_el_and_eq;
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
466
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
467 case op_el_or:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
468 return op_el_or_eq;
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
469
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
470 default:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
471 return unknown_assign_op;
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
472 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
473 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
474
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
475 octave_value::octave_value (short int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
476 : rep (new octave_scalar (i))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
477 { }
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
478
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
479 octave_value::octave_value (unsigned short int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
480 : rep (new octave_scalar (i))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
481 { }
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
482
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
483 octave_value::octave_value (int i)
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
484 : rep (new octave_scalar (i))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
485 { }
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
486
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
487 octave_value::octave_value (unsigned int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
488 : rep (new octave_scalar (i))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
489 { }
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
490
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
491 octave_value::octave_value (long int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
492 : rep (new octave_scalar (i))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
493 { }
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
494
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
495 octave_value::octave_value (unsigned long int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
496 : rep (new octave_scalar (i))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
497 { }
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
498
21354
06d15e4e611a move public data type macros to octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21317
diff changeset
499 #if defined (OCTAVE_HAVE_LONG_LONG_INT)
4353
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
500 octave_value::octave_value (long long int i)
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
501 : rep (new octave_scalar (i))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
502 { }
4353
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
503 #endif
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
504
21354
06d15e4e611a move public data type macros to octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21317
diff changeset
505 #if defined (OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT)
4353
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
506 octave_value::octave_value (unsigned long long int i)
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
507 : rep (new octave_scalar (i))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
508 { }
4353
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
509 #endif
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
510
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
511 octave_value::octave_value (octave::sys::time t)
7065
97db94ae2cf0 [project @ 2007-10-25 05:50:55 by jwe]
jwe
parents: 7064
diff changeset
512 : rep (new octave_scalar (t.double_value ()))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
513 { }
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
514
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
515 octave_value::octave_value (double d)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
516 : rep (new octave_scalar (d))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
517 { }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
518
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
519 octave_value::octave_value (float d)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
520 : rep (new octave_float_scalar (d))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
521 { }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
522
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
523 octave_value::octave_value (const Cell& c, bool is_csl)
5477
9e59c91ddc99 [project @ 2005-09-30 05:26:38 by jwe]
jwe
parents: 5354
diff changeset
524 : rep (is_csl
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
525 ? dynamic_cast<octave_base_value *> (new octave_cs_list (c))
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
526 : dynamic_cast<octave_base_value *> (new octave_cell (c)))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
527 { }
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
528
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
529 octave_value::octave_value (const Array<octave_value>& a, bool is_csl)
5477
9e59c91ddc99 [project @ 2005-09-30 05:26:38 by jwe]
jwe
parents: 5354
diff changeset
530 : rep (is_csl
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
531 ? dynamic_cast<octave_base_value *> (new octave_cs_list (Cell (a)))
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
532 : dynamic_cast<octave_base_value *> (new octave_cell (Cell (a))))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
533 { }
5147
47e4c91e5799 [project @ 2005-02-16 21:06:19 by jwe]
jwe
parents: 5146
diff changeset
534
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
535 octave_value::octave_value (const Matrix& m, const MatrixType& t)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
536 : rep (new octave_matrix (m, t))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
537 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
538 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
539 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
540
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
541 octave_value::octave_value (const FloatMatrix& m, const MatrixType& t)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
542 : rep (new octave_float_matrix (m, t))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
543 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
544 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
545 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
546
4507
65f47f8a92a2 [project @ 2003-09-10 15:48:02 by jwe]
jwe
parents: 4505
diff changeset
547 octave_value::octave_value (const NDArray& a)
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
548 : rep (new octave_matrix (a))
4478
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
549 {
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
550 maybe_mutate ();
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
551 }
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
552
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
553 octave_value::octave_value (const FloatNDArray& a)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
554 : rep (new octave_float_matrix (a))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
555 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
556 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
557 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
558
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
559 octave_value::octave_value (const Array<double>& a)
4911
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
560 : rep (new octave_matrix (a))
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
561 {
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
562 maybe_mutate ();
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
563 }
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
564
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
565 octave_value::octave_value (const Array<float>& a)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
566 : rep (new octave_float_matrix (a))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
567 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
568 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
569 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
570
15428
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
571 octave_value::octave_value (const DiagArray2<double>& d)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
572 : rep (Vdisable_diagonal_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
573 ? dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (d)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
574 : dynamic_cast<octave_base_value *> (new octave_diag_matrix (d)))
15428
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
575 {
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
576 maybe_mutate ();
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
577 }
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
578
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
579 octave_value::octave_value (const DiagArray2<float>& d)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
580 : rep (Vdisable_diagonal_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
581 ? dynamic_cast<octave_base_value *> (new octave_float_matrix (FloatMatrix (d)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
582 : dynamic_cast<octave_base_value *> (new octave_float_diag_matrix (d)))
15428
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
583 {
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
584 maybe_mutate ();
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
585 }
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
586
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
587 octave_value::octave_value (const DiagArray2<Complex>& d)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
588 : rep (Vdisable_diagonal_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
589 ? dynamic_cast<octave_base_value *> (new octave_complex_matrix (ComplexMatrix (d)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
590 : dynamic_cast<octave_base_value *> (new octave_complex_diag_matrix (d)))
15428
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
591 {
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
592 maybe_mutate ();
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
593 }
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
594
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
595 octave_value::octave_value (const DiagArray2<FloatComplex>& d)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
596 : rep (Vdisable_diagonal_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
597 ? dynamic_cast<octave_base_value *> (new octave_float_complex_matrix (FloatComplexMatrix (d)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
598 : dynamic_cast<octave_base_value *> (new octave_float_complex_diag_matrix (d)))
15428
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
599 {
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
600 maybe_mutate ();
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
601 }
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
602
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
603 octave_value::octave_value (const DiagMatrix& d)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
604 : rep (Vdisable_diagonal_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
605 ? dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (d)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
606 : dynamic_cast<octave_base_value *> (new octave_diag_matrix (d)))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
607 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
608 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
609 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
610
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
611 octave_value::octave_value (const FloatDiagMatrix& d)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
612 : rep (Vdisable_diagonal_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
613 ? dynamic_cast<octave_base_value *> (new octave_float_matrix (FloatMatrix (d)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
614 : dynamic_cast<octave_base_value *> (new octave_float_diag_matrix (d)))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
615 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
616 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
617 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
618
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
619 octave_value::octave_value (const RowVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
620 : rep (new octave_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
621 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
622 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
623 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
624
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
625 octave_value::octave_value (const FloatRowVector& v)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
626 : rep (new octave_float_matrix (v))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
627 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
628 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
629 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
630
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
631 octave_value::octave_value (const ColumnVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
632 : rep (new octave_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
633 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
634 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
635 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
636
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
637 octave_value::octave_value (const FloatColumnVector& v)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
638 : rep (new octave_float_matrix (v))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
639 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
640 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
641 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
642
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
643 octave_value::octave_value (const Complex& C)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
644 : rep (new octave_complex (C))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
645 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
646 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
647 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
648
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
649 octave_value::octave_value (const FloatComplex& C)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
650 : rep (new octave_float_complex (C))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
651 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
652 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
653 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
654
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
655 octave_value::octave_value (const ComplexMatrix& m, const MatrixType& t)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
656 : rep (new octave_complex_matrix (m, t))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
657 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
658 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
659 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
660
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
661 octave_value::octave_value (const FloatComplexMatrix& m, const MatrixType& t)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
662 : rep (new octave_float_complex_matrix (m, t))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
663 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
664 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
665 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
666
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
667 octave_value::octave_value (const ComplexNDArray& a)
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
668 : rep (new octave_complex_matrix (a))
4478
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
669 {
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
670 maybe_mutate ();
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
671 }
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
672
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
673 octave_value::octave_value (const FloatComplexNDArray& a)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
674 : rep (new octave_float_complex_matrix (a))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
675 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
676 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
677 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
678
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
679 octave_value::octave_value (const Array<Complex>& a)
4911
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
680 : rep (new octave_complex_matrix (a))
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
681 {
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
682 maybe_mutate ();
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
683 }
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
684
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
685 octave_value::octave_value (const Array<FloatComplex>& a)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
686 : rep (new octave_float_complex_matrix (a))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
687 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
688 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
689 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
690
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
691 octave_value::octave_value (const ComplexDiagMatrix& d)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
692 : rep (Vdisable_diagonal_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
693 ? dynamic_cast<octave_base_value *> (new octave_complex_matrix (ComplexMatrix (d)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
694 : dynamic_cast<octave_base_value *> (new octave_complex_diag_matrix (d)))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
695 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
696 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
697 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
698
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
699 octave_value::octave_value (const FloatComplexDiagMatrix& d)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
700 : rep (Vdisable_diagonal_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
701 ? dynamic_cast<octave_base_value *> (new octave_float_complex_matrix (FloatComplexMatrix (d)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
702 : dynamic_cast<octave_base_value *> (new octave_float_complex_diag_matrix (d)))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
703 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
704 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
705 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
706
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
707 octave_value::octave_value (const ComplexRowVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
708 : rep (new octave_complex_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
709 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
710 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
711 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
712
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
713 octave_value::octave_value (const FloatComplexRowVector& v)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
714 : rep (new octave_float_complex_matrix (v))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
715 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
716 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
717 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
718
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
719 octave_value::octave_value (const ComplexColumnVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
720 : rep (new octave_complex_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
721 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
722 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
723 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
724
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
725 octave_value::octave_value (const FloatComplexColumnVector& v)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
726 : rep (new octave_float_complex_matrix (v))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
727 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
728 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
729 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
730
8960
93f18f166aba remove float perm matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
731 octave_value::octave_value (const PermMatrix& p)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
732 : rep (Vdisable_permutation_matrix
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
733 ? dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (p)))
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
734 : dynamic_cast<octave_base_value *> (new octave_perm_matrix (p)))
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
735 {
8960
93f18f166aba remove float perm matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
736 maybe_mutate ();
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
737 }
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
738
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
739 octave_value::octave_value (bool b)
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
740 : rep (new octave_bool (b))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
741 { }
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
742
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
743 octave_value::octave_value (const boolMatrix& bm, const MatrixType& t)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
744 : rep (new octave_bool_matrix (bm, t))
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
745 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
746 maybe_mutate ();
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
747 }
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
748
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
749 octave_value::octave_value (const boolNDArray& bnda)
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
750 : rep (new octave_bool_matrix (bnda))
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
751 {
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
752 maybe_mutate ();
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
753 }
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
754
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
755 octave_value::octave_value (const Array<bool>& bnda)
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
756 : rep (new octave_bool_matrix (bnda))
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
757 {
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
758 maybe_mutate ();
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
759 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
760
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
761 octave_value::octave_value (char c, char type)
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
762 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
763 ? new octave_char_matrix_dq_str (c)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
764 : new octave_char_matrix_sq_str (c))
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
765 {
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
766 maybe_mutate ();
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
767 }
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
768
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
769 octave_value::octave_value (const char *s, char type)
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
770 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
771 ? new octave_char_matrix_dq_str (s)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
772 : new octave_char_matrix_sq_str (s))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
773 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
774 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
775 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
776
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
777 octave_value::octave_value (const std::string& s, char type)
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
778 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
779 ? new octave_char_matrix_dq_str (s)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
780 : new octave_char_matrix_sq_str (s))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
781 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
782 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
783 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
784
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
785 octave_value::octave_value (const string_vector& s, char type)
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
786 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
787 ? new octave_char_matrix_dq_str (s)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
788 : new octave_char_matrix_sq_str (s))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
789 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
790 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
791 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
792
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
793 octave_value::octave_value (const charMatrix& chm, char type)
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
794 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
795 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
796 : new octave_char_matrix_sq_str (chm))
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
797 {
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
798 maybe_mutate ();
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
799 }
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
800
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
801 octave_value::octave_value (const charNDArray& chm, char type)
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
802 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
803 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
804 : new octave_char_matrix_sq_str (chm))
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
805 {
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
806 maybe_mutate ();
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
807 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
808
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
809 octave_value::octave_value (const Array<char>& chm, char type)
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
810 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
811 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
812 : new octave_char_matrix_sq_str (chm))
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
813 {
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
814 maybe_mutate ();
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
815 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
816
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23352
diff changeset
817 octave_value::octave_value (const SparseMatrix& m, const MatrixType& t)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
818 : rep (new octave_sparse_matrix (m, t))
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
819 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
820 maybe_mutate ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
821 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
822
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23352
diff changeset
823 octave_value::octave_value (const Sparse<double>& m, const MatrixType& t)
6863
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
824 : rep (new octave_sparse_matrix (m, t))
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
825 {
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
826 maybe_mutate ();
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
827 }
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
828
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23352
diff changeset
829 octave_value::octave_value (const SparseComplexMatrix& m, const MatrixType& t)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
830 : rep (new octave_sparse_complex_matrix (m, t))
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
831 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
832 maybe_mutate ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
833 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
834
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23352
diff changeset
835 octave_value::octave_value (const Sparse<Complex>& m, const MatrixType& t)
6863
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
836 : rep (new octave_sparse_complex_matrix (m, t))
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
837 {
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
838 maybe_mutate ();
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
839 }
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
840
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23352
diff changeset
841 octave_value::octave_value (const SparseBoolMatrix& bm, const MatrixType& t)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
842 : rep (new octave_sparse_bool_matrix (bm, t))
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
843 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
844 maybe_mutate ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
845 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
846
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23352
diff changeset
847 octave_value::octave_value (const Sparse<bool>& bm, const MatrixType& t)
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
848 : rep (new octave_sparse_bool_matrix (bm, t))
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
849 {
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
850 maybe_mutate ();
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
851 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
852
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
853 octave_value::octave_value (const octave_int8& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
854 : rep (new octave_int8_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
855 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
856 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
857 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
858
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
859 octave_value::octave_value (const octave_uint8& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
860 : rep (new octave_uint8_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
861 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
862 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
863 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
864
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
865 octave_value::octave_value (const octave_int16& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
866 : rep (new octave_int16_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
867 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
868 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
869 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
870
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
871 octave_value::octave_value (const octave_uint16& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
872 : rep (new octave_uint16_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
873 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
874 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
875 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
876
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
877 octave_value::octave_value (const octave_int32& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
878 : rep (new octave_int32_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
879 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
880 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
881 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
882
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
883 octave_value::octave_value (const octave_uint32& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
884 : rep (new octave_uint32_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
885 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
886 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
887 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
888
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
889 octave_value::octave_value (const octave_int64& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
890 : rep (new octave_int64_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
891 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
892 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
893 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
894
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
895 octave_value::octave_value (const octave_uint64& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
896 : rep (new octave_uint64_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
897 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
898 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
899 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
900
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
901 octave_value::octave_value (const int8NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
902 : rep (new octave_int8_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
903 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
904 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
905 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
906
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
907 octave_value::octave_value (const Array<octave_int8>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
908 : rep (new octave_int8_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
909 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
910 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
911 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
912
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
913 octave_value::octave_value (const uint8NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
914 : rep (new octave_uint8_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
915 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
916 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
917 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
918
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
919 octave_value::octave_value (const Array<octave_uint8>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
920 : rep (new octave_uint8_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
921 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
922 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
923 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
924
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
925 octave_value::octave_value (const int16NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
926 : rep (new octave_int16_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
927 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
928 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
929 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
930
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
931 octave_value::octave_value (const Array<octave_int16>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
932 : rep (new octave_int16_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
933 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
934 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
935 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
936
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
937 octave_value::octave_value (const uint16NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
938 : rep (new octave_uint16_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
939 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
940 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
941 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
942
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
943 octave_value::octave_value (const Array<octave_uint16>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
944 : rep (new octave_uint16_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
945 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
946 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
947 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
948
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
949 octave_value::octave_value (const int32NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
950 : rep (new octave_int32_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
951 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
952 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
953 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
954
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
955 octave_value::octave_value (const Array<octave_int32>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
956 : rep (new octave_int32_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
957 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
958 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
959 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
960
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
961 octave_value::octave_value (const uint32NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
962 : rep (new octave_uint32_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
963 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
964 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
965 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
966
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
967 octave_value::octave_value (const Array<octave_uint32>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
968 : rep (new octave_uint32_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
969 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
970 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
971 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
972
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
973 octave_value::octave_value (const int64NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
974 : rep (new octave_int64_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
975 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
976 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
977 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
978
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
979 octave_value::octave_value (const Array<octave_int64>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
980 : rep (new octave_int64_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
981 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
982 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
983 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
984
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
985 octave_value::octave_value (const uint64NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
986 : rep (new octave_uint64_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
987 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
988 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
989 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
990
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
991 octave_value::octave_value (const Array<octave_uint64>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
992 : rep (new octave_uint64_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
993 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
994 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
995 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
996
9351
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
997 octave_value::octave_value (const Array<octave_idx_type>& inda, bool zero_based,
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
998 bool cache_index)
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
999 : rep (new octave_matrix (inda, zero_based, cache_index))
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1000 {
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1001 maybe_mutate ();
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1002 }
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1003
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1004 octave_value::octave_value (const idx_vector& idx, bool lazy)
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1005 : rep ()
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1006 {
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1007 double scalar;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1008 Range range;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1009 NDArray array;
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1010 boolNDArray mask;
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1011 idx_vector::idx_class_type idx_class;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1012
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1013 if (lazy)
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1014 {
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1015 // Only make lazy indices out of ranges and index vectors.
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1016 switch (idx.idx_class ())
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1017 {
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1018 case idx_vector::class_range:
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1019 case idx_vector::class_vector:
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1020 rep = new octave_lazy_index (idx);
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1021 maybe_mutate ();
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1022 return;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
1023
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1024 default:
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1025 break;
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1026 }
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1027 }
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1028
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1029 idx.unconvert (idx_class, scalar, range, array, mask);
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1030
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1031 switch (idx_class)
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1032 {
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1033 case idx_vector::class_colon:
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1034 rep = new octave_magic_colon ();
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1035 break;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
1036
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1037 case idx_vector::class_range:
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1038 rep = new octave_range (range, idx);
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1039 break;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
1040
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1041 case idx_vector::class_scalar:
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1042 rep = new octave_scalar (scalar);
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1043 break;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
1044
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1045 case idx_vector::class_vector:
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1046 rep = new octave_matrix (array, idx);
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1047 break;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
1048
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1049 case idx_vector::class_mask:
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1050 rep = new octave_bool_matrix (mask, idx);
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1051 break;
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
1052
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1053 default:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
1054 panic_impossible ();
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1055 break;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1056 }
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1057
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1058 // FIXME: needed?
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1059 maybe_mutate ();
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1060 }
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1061
9725
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1062 octave_value::octave_value (const Array<std::string>& cellstr)
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1063 : rep (new octave_cell (cellstr))
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1064 {
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1065 maybe_mutate ();
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1066 }
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1067
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1068 octave_value::octave_value (double base, double limit, double inc)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1069 : rep (new octave_range (base, limit, inc))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1070 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1071 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1072 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1073
19394
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
1074 octave_value::octave_value (const Range& r, bool force_range)
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
1075 : rep (force_range || ! Vdisable_range
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
1076 ? dynamic_cast<octave_base_value *> (new octave_range (r))
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
1077 : dynamic_cast<octave_base_value *> (new octave_matrix (r.matrix_value ())))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1078 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1079 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1080 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1081
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1082 octave_value::octave_value (const octave_map& m)
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1083 : rep (new octave_struct (m))
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1084 {
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1085 maybe_mutate ();
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1086 }
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1087
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1088 octave_value::octave_value (const octave_scalar_map& m)
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1089 : rep (new octave_scalar_struct (m))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
1090 { }
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1091
23678
dcba41788495 new struct/map constructors
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
1092 octave_value::octave_value (const std::map<std::string, octave_value>& m)
dcba41788495 new struct/map constructors
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
1093 : rep (new octave_scalar_struct (m))
dcba41788495 new struct/map constructors
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
1094 { }
dcba41788495 new struct/map constructors
John W. Eaton <jwe@octave.org>
parents: 23614
diff changeset
1095
18402
4c064d3d2750 Remove Octave_map class deprecated in 3.8.
Rik <rik@octave.org>
parents: 18306
diff changeset
1096 octave_value::octave_value (const octave_map& m, const std::string& id,
4c064d3d2750 Remove Octave_map class deprecated in 3.8.
Rik <rik@octave.org>
parents: 18306
diff changeset
1097 const std::list<std::string>& plist)
4c064d3d2750 Remove Octave_map class deprecated in 3.8.
Rik <rik@octave.org>
parents: 18306
diff changeset
1098 : rep (new octave_class (m, id, plist))
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1099 {
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1100 maybe_mutate ();
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1101 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1102
18402
4c064d3d2750 Remove Octave_map class deprecated in 3.8.
Rik <rik@octave.org>
parents: 18306
diff changeset
1103 octave_value::octave_value (const octave_scalar_map& m, const std::string& id,
13294
7dce7e110511 make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents: 13101
diff changeset
1104 const std::list<std::string>& plist)
7dce7e110511 make concatenation of class objects work
John W. Eaton <jwe@octave.org>
parents: 13101
diff changeset
1105 : rep (new octave_class (m, id, plist))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
1106 { }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1107
10232
0efd486813fe remove deprecated list datatype
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
1108 octave_value::octave_value (const octave_value_list& l, bool)
0efd486813fe remove deprecated list datatype
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
1109 : rep (new octave_cs_list (l))
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
1110 { }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1111
23352
778fdffc09df deprecate "octave_value (octave_value_list, bool)" constructor
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1112 octave_value::octave_value (const octave_value_list& l)
778fdffc09df deprecate "octave_value (octave_value_list, bool)" constructor
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1113 : rep (new octave_cs_list (l))
778fdffc09df deprecate "octave_value (octave_value_list, bool)" constructor
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1114 { }
778fdffc09df deprecate "octave_value (octave_value_list, bool)" constructor
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
1115
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1116 octave_value::octave_value (octave_value::magic_colon)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1117 : rep (new octave_magic_colon ())
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22390
diff changeset
1118 { }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1119
9728
70925b11ba46 again allow the obsolete syntax for cellfun
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
1120 octave_value::octave_value (octave_base_value *new_rep, bool borrow)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1121 : rep (new_rep)
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1122 {
9728
70925b11ba46 again allow the obsolete syntax for cellfun
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
1123 if (borrow)
70925b11ba46 again allow the obsolete syntax for cellfun
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
1124 rep->count++;
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1125 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1126
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5758
diff changeset
1127 octave_base_value *
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1128 octave_value::clone (void) const
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1129 {
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1130 return rep->clone ();
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1131 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1132
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1133 void
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1134 octave_value::maybe_mutate (void)
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1135 {
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5758
diff changeset
1136 octave_base_value *tmp = rep->try_narrowing_conversion ();
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1137
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1138 if (tmp && tmp != rep)
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1139 {
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1140 if (--rep->count == 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1141 delete rep;
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1142
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1143 rep = tmp;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1144 }
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1145 }
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1146
22283
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1147 DEFUN (double, args, ,
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1148 doc: /* -*- texinfo -*-
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1149 @deftypefn {} {} double (@var{x})
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1150 Convert @var{x} to double precision type.
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1151 @seealso{single}
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1152 @end deftypefn */)
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1153 {
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1154 if (args.length () != 1)
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1155 print_usage ();
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1156
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1157 return ovl (args(0).as_double ());
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1158 }
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1159
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1160 /*
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1161 %!assert (class (double (single (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1162 %!assert (class (double (single (1 + i))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1163 %!assert (class (double (int8 (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1164 %!assert (class (double (uint8 (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1165 %!assert (class (double (int16 (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1166 %!assert (class (double (uint16 (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1167 %!assert (class (double (int32 (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1168 %!assert (class (double (uint32 (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1169 %!assert (class (double (int64 (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1170 %!assert (class (double (uint64 (1))), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1171 %!assert (class (double (true)), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1172 %!assert (class (double ("A")), "double")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1173 %!test
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1174 %! x = sparse (logical ([1 0; 0 1]));
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1175 %! y = double (x);
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1176 %! assert (class (x), "logical");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1177 %! assert (class (y), "double");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1178 %! assert (issparse (y));
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1179 %!test
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1180 %! x = diag (single ([1 3 2]));
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1181 %! y = double (x);
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1182 %! assert (class (x), "single");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1183 %! assert (class (y), "double");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1184 %!test
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1185 %! x = diag (single ([i 3 2]));
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1186 %! y = double (x);
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1187 %! assert (class (x), "single");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1188 %! assert (class (y), "double");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1189 */
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1190
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1191 DEFUN (single, args, ,
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1192 doc: /* -*- texinfo -*-
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1193 @deftypefn {} {} single (@var{x})
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1194 Convert @var{x} to single precision type.
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1195 @seealso{double}
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1196 @end deftypefn */)
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1197 {
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1198 if (args.length () != 1)
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1199 print_usage ();
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1200
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1201 return args(0).as_single ();
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1202
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1203 return ovl ();
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1204 }
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1205
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1206 /*
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1207 %!assert (class (single (1)), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1208 %!assert (class (single (1 + i)), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1209 %!assert (class (single (int8 (1))), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1210 %!assert (class (single (uint8 (1))), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1211 %!assert (class (single (int16 (1))), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1212 %!assert (class (single (uint16 (1))), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1213 %!assert (class (single (int32 (1))), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1214 %!assert (class (single (uint32 (1))), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1215 %!assert (class (single (int64 (1))), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1216 %!assert (class (single (uint64 (1))), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1217 %!assert (class (single (true)), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1218 %!assert (class (single ("A")), "single")
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1219 %!error (single (sparse (1)))
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1220 %!test
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1221 %! x = diag ([1 3 2]);
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1222 %! y = single (x);
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1223 %! assert (class (x), "double");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1224 %! assert (class (y), "single");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1225 %!test
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1226 %! x = diag ([i 3 2]);
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1227 %! y = single (x);
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1228 %! assert (class (x), "double");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1229 %! assert (class (y), "single");
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1230 */
564203123065 move single and double type conversion functions to ov.cc
John W. Eaton <jwe@octave.org>
parents: 22197
diff changeset
1231
22296
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1232 DEFUN (int8, args, ,
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1233 doc: /* -*- texinfo -*-
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1234 @deftypefn {} {} int8 (@var{x})
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1235 Convert @var{x} to 8-bit integer type.
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1236 @seealso{uint8, int16, uint16, int32, uint32, int64, uint64}
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1237 @end deftypefn */)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1238 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1239 if (args.length () != 1)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1240 print_usage ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1241
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1242 return args(0).as_int8 ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1243 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1244
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1245 /*
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1246 %!assert (class (int8 (1)), "int8")
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1247 %!assert (int8 (1.25), int8 (1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1248 %!assert (int8 (1.5), int8 (2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1249 %!assert (int8 (-1.5), int8 (-2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1250 %!assert (int8 (2^9), int8 (2^8-1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1251 %!assert (int8 (-2^9), int8 (-2^8))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1252 */
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1253
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1254 DEFUN (int16, args, ,
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1255 doc: /* -*- texinfo -*-
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1256 @deftypefn {} {} int16 (@var{x})
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1257 Convert @var{x} to 16-bit integer type.
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1258 @seealso{int8, uint8, uint16, int32, uint32, int64, uint64}
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1259 @end deftypefn */)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1260 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1261 if (args.length () != 1)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1262 print_usage ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1263
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1264 return args(0).as_int16 ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1265 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1266
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1267 /*
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1268 %!assert (class (int16 (1)), "int16")
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1269 %!assert (int16 (1.25), int16 (1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1270 %!assert (int16 (1.5), int16 (2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1271 %!assert (int16 (-1.5), int16 (-2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1272 %!assert (int16 (2^17), int16 (2^16-1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1273 %!assert (int16 (-2^17), int16 (-2^16))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1274 */
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1275
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1276 DEFUN (int32, args, ,
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1277 doc: /* -*- texinfo -*-
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1278 @deftypefn {} {} int32 (@var{x})
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1279 Convert @var{x} to 32-bit integer type.
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1280 @seealso{int8, uint8, int16, uint16, uint32, int64, uint64}
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1281 @end deftypefn */)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1282 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1283 if (args.length () != 1)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1284 print_usage ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1285
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1286 return args(0).as_int32 ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1287 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1288
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1289 /*
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1290 %!assert (class (int32 (1)), "int32")
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1291 %!assert (int32 (1.25), int32 (1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1292 %!assert (int32 (1.5), int32 (2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1293 %!assert (int32 (-1.5), int32 (-2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1294 %!assert (int32 (2^33), int32 (2^32-1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1295 %!assert (int32 (-2^33), int32 (-2^32))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1296 */
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1297
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1298 DEFUN (int64, args, ,
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1299 doc: /* -*- texinfo -*-
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1300 @deftypefn {} {} int64 (@var{x})
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1301 Convert @var{x} to 64-bit integer type.
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1302 @seealso{int8, uint8, int16, uint16, int32, uint32, uint64}
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1303 @end deftypefn */)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1304 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1305 if (args.length () != 1)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1306 print_usage ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1307
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1308 return args(0).as_int64 ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1309 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1310
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1311 /*
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1312 %!assert (class (int64 (1)), "int64")
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1313 %!assert (int64 (1.25), int64 (1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1314 %!assert (int64 (1.5), int64 (2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1315 %!assert (int64 (-1.5), int64 (-2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1316 %!assert (int64 (2^65), int64 (2^64-1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1317 %!assert (int64 (-2^65), int64 (-2^64))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1318 */
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1319
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1320 DEFUN (uint8, args, ,
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1321 doc: /* -*- texinfo -*-
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1322 @deftypefn {} {} uint8 (@var{x})
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1323 Convert @var{x} to unsigned 8-bit integer type.
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1324 @seealso{int8, int16, uint16, int32, uint32, int64, uint64}
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1325 @end deftypefn */)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1326 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1327 if (args.length () != 1)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1328 print_usage ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1329
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1330 return args(0).as_uint8 ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1331 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1332
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1333 /*
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1334 %!assert (class (uint8 (1)), "uint8")
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1335 %!assert (uint8 (1.25), uint8 (1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1336 %!assert (uint8 (1.5), uint8 (2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1337 %!assert (uint8 (-1.5), uint8 (0))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1338 %!assert (uint8 (2^9), uint8 (2^8-1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1339 %!assert (uint8 (-2^9), uint8 (0))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1340 */
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1341
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1342 DEFUN (uint16, args, ,
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1343 doc: /* -*- texinfo -*-
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1344 @deftypefn {} {} uint16 (@var{x})
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1345 Convert @var{x} to unsigned 16-bit integer type.
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1346 @seealso{int8, uint8, int16, int32, uint32, int64, uint64}
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1347 @end deftypefn */)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1348 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1349 if (args.length () != 1)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1350 print_usage ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1351
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1352 return args(0).as_uint16 ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1353 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1354
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1355 /*
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1356 %!assert (class (uint16 (1)), "uint16")
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1357 %!assert (uint16 (1.25), uint16 (1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1358 %!assert (uint16 (1.5), uint16 (2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1359 %!assert (uint16 (-1.5), uint16 (0))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1360 %!assert (uint16 (2^17), uint16 (2^16-1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1361 %!assert (uint16 (-2^17), uint16 (0))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1362 */
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1363
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1364 DEFUN (uint32, args, ,
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1365 doc: /* -*- texinfo -*-
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1366 @deftypefn {} {} uint32 (@var{x})
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1367 Convert @var{x} to unsigned 32-bit integer type.
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1368 @seealso{int8, uint8, int16, uint16, int32, int64, uint64}
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1369 @end deftypefn */)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1370 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1371 if (args.length () != 1)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1372 print_usage ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1373
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1374 return args(0).as_uint32 ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1375 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1376
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1377 /*
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1378 %!assert (class (uint32 (1)), "uint32")
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1379 %!assert (uint32 (1.25), uint32 (1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1380 %!assert (uint32 (1.5), uint32 (2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1381 %!assert (uint32 (-1.5), uint32 (0))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1382 %!assert (uint32 (2^33), uint32 (2^32-1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1383 %!assert (uint32 (-2^33), uint32 (0))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1384 */
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1385
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1386 DEFUN (uint64, args, ,
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1387 doc: /* -*- texinfo -*-
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1388 @deftypefn {} {} uint64 (@var{x})
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1389 Convert @var{x} to unsigned 64-bit integer type.
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1390 @seealso{int8, uint8, int16, uint16, int32, uint32, int64}
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1391 @end deftypefn */)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1392 {
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1393 if (args.length () != 1)
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1394 print_usage ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1395
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1396 return args(0).as_uint64 ();
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1397 }
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1398
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1399 /*
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1400 %!assert (class (uint64 (1)), "uint64")
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1401 %!assert (uint64 (1.25), uint64 (1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1402 %!assert (uint64 (1.5), uint64 (2))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1403 %!assert (uint64 (-1.5), uint64 (0))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1404 %!assert (uint64 (2^65), uint64 (2^64-1))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1405 %!assert (uint64 (-2^65), uint64 (0))
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1406 */
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1407
8b18f46f6427 revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents: 22283
diff changeset
1408 octave_value
4271
be631c1720ea [project @ 2003-01-03 19:36:04 by jwe]
jwe
parents: 4257
diff changeset
1409 octave_value::single_subsref (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1410 const octave_value_list& idx)
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1411 {
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1412 std::list<octave_value_list> i;
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1413
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1414 i.push_back (idx);
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1415
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1416 return rep->subsref (type, i);
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1417 }
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1418
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1419 octave_value_list
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1420 octave_value::subsref (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1421 const std::list<octave_value_list>& idx, int nargout)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1422 {
23502
c6714ae1c06c eliminate remaining do_multi_index_op methods
John W. Eaton <jwe@octave.org>
parents: 23481
diff changeset
1423 return rep->subsref (type, idx, nargout);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1424 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1425
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1426 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1427 octave_value::next_subsref (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1428 const std::list<octave_value_list>& idx,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1429 size_t skip)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1430 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1431 if (idx.size () > skip)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1432 {
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
1433 std::list<octave_value_list> new_idx (idx);
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
1434 for (size_t i = 0; i < skip; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1435 new_idx.erase (new_idx.begin ());
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1436 return subsref (type.substr (skip), new_idx);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1437 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1438 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1439 return *this;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1440 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1441
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1442 octave_value_list
4994
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1443 octave_value::next_subsref (int nargout, const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1444 const std::list<octave_value_list>& idx,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1445 size_t skip)
4994
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1446 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1447 if (idx.size () > skip)
4994
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1448 {
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1449 std::list<octave_value_list> new_idx (idx);
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1450 for (size_t i = 0; i < skip; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1451 new_idx.erase (new_idx.begin ());
4994
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1452 return subsref (type.substr (skip), new_idx, nargout);
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1453 }
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1454 else
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1455 return *this;
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1456 }
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1457
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1458 octave_value
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1459 octave_value::next_subsref (bool auto_add, const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1460 const std::list<octave_value_list>& idx,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1461 size_t skip)
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1462 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1463 if (idx.size () > skip)
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1464 {
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1465 std::list<octave_value_list> new_idx (idx);
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1466 for (size_t i = 0; i < skip; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1467 new_idx.erase (new_idx.begin ());
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1468 return subsref (type.substr (skip), new_idx, auto_add);
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1469 }
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1470 else
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1471 return *this;
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1472 }
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1473
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1474 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1475 octave_value::subsasgn (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1476 const std::list<octave_value_list>& idx,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1477 const octave_value& rhs)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1478 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1479 return rep->subsasgn (type, idx, rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1480 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1481
12171
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1482 octave_value
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1483 octave_value::undef_subsasgn (const std::string& type,
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1484 const std::list<octave_value_list>& idx,
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1485 const octave_value& rhs)
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1486 {
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1487 return rep->undef_subsasgn (type, idx, rhs);
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1488 }
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1489
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1490 octave_value&
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1491 octave_value::assign (assign_op op, const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1492 const std::list<octave_value_list>& idx,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1493 const octave_value& rhs)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1494 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1495 make_unique ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1496
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1497 octave_value t_rhs = rhs;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1498
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1499 if (op != op_asn_eq)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1500 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
1501 if (! is_defined ())
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1502 error ("in computed assignment A(index) OP= X, A must be defined first");
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
1503
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
1504 octave_value t = subsref (type, idx);
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
1505
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
1506 binary_op binop = op_eq_to_binary_op (op);
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
1507
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
1508 t_rhs = do_binary_op (binop, t, rhs);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1509 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1510
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
1511 *this = subsasgn (type, idx, t_rhs);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1512
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1513 return *this;
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1514 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1515
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1516 octave_value&
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1517 octave_value::assign (assign_op op, const octave_value& rhs)
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1518 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
1519 if (op == op_asn_eq)
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1520 // Regularize a null matrix if stored into a variable.
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1521 operator = (rhs.storable_value ());
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1522 else if (is_defined ())
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1523 {
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23693
diff changeset
1524 octave_value_typeinfo::assign_op_fcn f = nullptr;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1525
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1526 // Only attempt to operate in-place if this variable is unshared.
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1527 if (rep->count == 1)
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1528 {
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1529 int tthis = this->type_id ();
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1530 int trhs = rhs.type_id ();
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1531
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1532 f = octave_value_typeinfo::lookup_assign_op (op, tthis, trhs);
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1533 }
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1534
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1535 if (f)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1536 {
20535
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
1537 f (*rep, octave_value_list (), *rhs.rep);
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
1538 // Usually unnecessary, but may be needed (complex arrays).
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
1539 maybe_mutate ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1540 }
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1541 else
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1542 {
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1543
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1544 binary_op binop = op_eq_to_binary_op (op);
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1545
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1546 octave_value t = do_binary_op (binop, *this, rhs);
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1547
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1548 operator = (t);
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1549 }
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1550 }
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1551 else
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1552 error ("in computed assignment A OP= X, A must be defined first");
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1553
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1554 return *this;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1555 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1556
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5164
diff changeset
1557 octave_idx_type
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1558 octave_value::length (void) const
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1559 {
10654
984b8b6bee02 simplify octave_value::length
Jaroslav Hajek <highegg@gmail.com>
parents: 10614
diff changeset
1560 octave_idx_type retval = 0;
984b8b6bee02 simplify octave_value::length
Jaroslav Hajek <highegg@gmail.com>
parents: 10614
diff changeset
1561
984b8b6bee02 simplify octave_value::length
Jaroslav Hajek <highegg@gmail.com>
parents: 10614
diff changeset
1562 const dim_vector dv = dims ();
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
1563
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21574
diff changeset
1564 for (int i = 0; i < dv.ndims (); i++)
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1565 {
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
1566 if (dv(i) == 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1567 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1568 retval = 0;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1569 break;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1570 }
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
1571
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1572 if (dv(i) > retval)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1573 retval = dv(i);
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1574 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1575
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1576 return retval;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1577 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1578
8346
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1579 bool
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1580 octave_value::is_equal (const octave_value& test) const
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1581 {
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1582 bool retval = false;
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1583
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1584 // If there is no op_eq for these types, we can't compare values.
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1585
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1586 if (rows () == test.rows () && columns () == test.columns ())
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1587 {
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1588 octave_value tmp = do_binary_op (octave_value::op_eq, *this, test);
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1589
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1590 // Empty array also means a match.
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1591 if (tmp.is_defined ())
21990
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1592 {
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
1593 if (tmp.isempty ())
21990
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1594 retval = true;
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1595 else
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1596 {
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1597 // Reshape into a vector and call all() explicitly,
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1598 // to avoid Octave:array-as-logical warning.
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1599 tmp = tmp.reshape (dim_vector (tmp.numel (), 1));
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1600 retval = tmp.all ().is_true ();
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1601 }
efce657ceb86 Provide a warning when an array is used in an if/while/until (bug #43098).
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21966
diff changeset
1602 }
8346
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1603 }
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1604
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1605 return retval;
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1606 }
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1607
8017
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1608 // Define the idx_type_value function here instead of in ov.h to avoid
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1609 // needing definitions for the SIZEOF_X macros in ov.h.
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1610
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1611 octave_idx_type
8024
dc36eb214129 ov.cc (octave_value::idx_type_value): don't include default argument value in definition
John W. Eaton <jwe@octave.org>
parents: 8017
diff changeset
1612 octave_value::idx_type_value (bool req_int, bool frc_str_conv) const
8017
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1613 {
21229
a83e7a384ee0 create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
1614 #if defined (OCTAVE_ENABLE_64)
16323
e769440b39db provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents: 16091
diff changeset
1615 return int64_value (req_int, frc_str_conv);
e769440b39db provide int64 extractors for octave_value class
John W. Eaton <jwe@octave.org>
parents: 16091
diff changeset
1616 #else
8017
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1617 return int_value (req_int, frc_str_conv);
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1618 #endif
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1619 }
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1620
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1621 Cell
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1622 octave_value::cell_value (void) const
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1623 {
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1624 return rep->cell_value ();
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1625 }
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1626
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1627 octave_map
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1628 octave_value::map_value (void) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1629 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1630 return rep->map_value ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1631 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1632
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1633 octave_scalar_map
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1634 octave_value::scalar_map_value (void) const
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1635 {
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1636 return rep->scalar_map_value ();
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1637 }
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1638
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1639 octave_function *
7761
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1640 octave_value::function_value (bool silent) const
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1641 {
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1642 return rep->function_value (silent);
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1643 }
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1644
23881
5aec653c88e7 new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
1645 octave_classdef *
5aec653c88e7 new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
1646 octave_value::classdef_object_value (bool silent) const
5aec653c88e7 new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
1647 {
5aec653c88e7 new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
1648 return rep->classdef_object_value (silent);
5aec653c88e7 new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
1649 }
5aec653c88e7 new function for accessing classdef objects
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
1650
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1651 octave_user_function *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1652 octave_value::user_function_value (bool silent) const
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1653 {
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1654 return rep->user_function_value (silent);
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1655 }
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1656
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1657 octave_user_script *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1658 octave_value::user_script_value (bool silent) const
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1659 {
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1660 return rep->user_script_value (silent);
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1661 }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1662
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1663 octave_user_code *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1664 octave_value::user_code_value (bool silent) const
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1665 {
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1666 return rep->user_code_value (silent);
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1667 }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1668
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
1669 octave_fcn_handle *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1670 octave_value::fcn_handle_value (bool silent) const
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1671 {
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1672 return rep->fcn_handle_value (silent);
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1673 }
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1674
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1675 octave_fcn_inline *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1676 octave_value::fcn_inline_value (bool silent) const
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1677 {
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1678 return rep->fcn_inline_value (silent);
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1679 }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1680
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1681 octave_value_list
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1682 octave_value::list_value (void) const
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1683 {
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1684 return rep->list_value ();
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1685 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1686
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1687 static dim_vector
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1688 make_vector_dims (const dim_vector& dv, bool force_vector_conversion,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1689 const std::string& my_type, const std::string& wanted_type)
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1690 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1691 dim_vector retval (dv);
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1692 retval.chop_trailing_singletons ();
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1693 octave_idx_type nel = dv.numel ();
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1694
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21574
diff changeset
1695 if (retval.ndims () > 2 || (retval(0) != 1 && retval(1) != 1))
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1696 {
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20940
diff changeset
1697 if (! force_vector_conversion)
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21078
diff changeset
1698 warn_implicit_conversion ("Octave:array-to-vector",
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21078
diff changeset
1699 my_type.c_str (), wanted_type.c_str ());
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10325
diff changeset
1700 retval = dim_vector (nel, 1);
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1701 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1702
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1703 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1704 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1705
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1706 ColumnVector
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1707 octave_value::column_vector_value (bool force_string_conv,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1708 bool frc_vec_conv) const
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1709 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1710 return ColumnVector (vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1711 frc_vec_conv));
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1712 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1713
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1714 ComplexColumnVector
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1715 octave_value::complex_column_vector_value (bool force_string_conv,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1716 bool frc_vec_conv) const
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1717 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1718 return ComplexColumnVector (complex_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1719 frc_vec_conv));
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1720 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1721
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1722 RowVector
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1723 octave_value::row_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1724 bool frc_vec_conv) const
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1725 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1726 return RowVector (vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1727 frc_vec_conv));
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1728 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1729
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1730 ComplexRowVector
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1731 octave_value::complex_row_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1732 bool frc_vec_conv) const
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1733 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1734 return ComplexRowVector (complex_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1735 frc_vec_conv));
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1736 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1737
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1738 Array<double>
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1739 octave_value::vector_value (bool force_string_conv,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1740 bool force_vector_conversion) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1741 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1742 Array<double> retval = array_value (force_string_conv);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1743
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1744 return retval.reshape (make_vector_dims (retval.dims (),
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1745 force_vector_conversion,
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1746 type_name (), "real vector"));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1747 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1748
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21129
diff changeset
1749 template <typename T>
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1750 static Array<int>
23534
b6498c088fca maint: Don't write '> >' for declaration of templates that use templates.
Rik <rik@octave.org>
parents: 23502
diff changeset
1751 convert_to_int_array (const Array<octave_int<T>>& A)
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1752 {
7999
f7f2d867c523 style fixes
John W. Eaton <jwe@octave.org>
parents: 7997
diff changeset
1753 Array<int> retval (A.dims ());
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1754 octave_idx_type n = A.numel ();
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1755
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1756 for (octave_idx_type i = 0; i < n; i++)
7999
f7f2d867c523 style fixes
John W. Eaton <jwe@octave.org>
parents: 7997
diff changeset
1757 retval.xelem (i) = octave_int<int> (A.xelem (i));
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 8024
diff changeset
1758
7999
f7f2d867c523 style fixes
John W. Eaton <jwe@octave.org>
parents: 7997
diff changeset
1759 return retval;
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1760 }
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1761
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1762 Array<int>
20743
b6408331bfa2 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20741
diff changeset
1763 octave_value::int_vector_value (bool require_int, bool force_string_conv,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1764 bool force_vector_conversion) const
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1765 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1766 Array<int> retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1767
23580
2230f9e10fb3 maint: Deprecate is_integer_type and replace with isinteger.
Rik <rik@octave.org>
parents: 23577
diff changeset
1768 if (isinteger ())
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1769 {
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1770 if (is_int32_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1771 retval = convert_to_int_array (int32_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1772 else if (is_int64_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1773 retval = convert_to_int_array (int64_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1774 else if (is_int16_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1775 retval = convert_to_int_array (int16_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1776 else if (is_int8_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1777 retval = convert_to_int_array (int8_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1778 else if (is_uint32_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1779 retval = convert_to_int_array (uint32_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1780 else if (is_uint64_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1781 retval = convert_to_int_array (uint64_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1782 else if (is_uint16_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1783 retval = convert_to_int_array (uint16_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1784 else if (is_uint8_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1785 retval = convert_to_int_array (uint8_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1786 else
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1787 retval = array_value (force_string_conv);
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1788 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1789 else
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1790 {
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1791 const NDArray a = array_value (force_string_conv);
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1792
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1793 if (require_int)
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1794 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1795 retval.resize (a.dims ());
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1796 for (octave_idx_type i = 0; i < a.numel (); i++)
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1797 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1798 double ai = a.elem (i);
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1799 int v = static_cast<int> (ai);
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1800 if (ai == v)
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1801 retval.xelem (i) = v;
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1802 else
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1803 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1804 error_with_cfn ("conversion to integer value failed");
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1805 break;
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1806 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1807 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1808 }
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1809 else
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1810 retval = Array<int> (a);
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1811 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1812
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1813 return retval.reshape (make_vector_dims (retval.dims (),
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1814 force_vector_conversion,
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1815 type_name (), "integer vector"));
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1816 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1817
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21129
diff changeset
1818 template <typename T>
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1819 static Array<octave_idx_type>
23534
b6498c088fca maint: Don't write '> >' for declaration of templates that use templates.
Rik <rik@octave.org>
parents: 23502
diff changeset
1820 convert_to_octave_idx_type_array (const Array<octave_int<T>>& A)
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1821 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1822 Array<octave_idx_type> retval (A.dims ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1823 octave_idx_type n = A.numel ();
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1824
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1825 for (octave_idx_type i = 0; i < n; i++)
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1826 retval.xelem (i) = octave_int<octave_idx_type> (A.xelem (i));
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1827
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1828 return retval;
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1829 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1830
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1831 Array<octave_idx_type>
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1832 octave_value::octave_idx_type_vector_value (bool require_int,
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1833 bool force_string_conv,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1834 bool force_vector_conversion) const
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1835 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1836 Array<octave_idx_type> retval;
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1837
23580
2230f9e10fb3 maint: Deprecate is_integer_type and replace with isinteger.
Rik <rik@octave.org>
parents: 23577
diff changeset
1838 if (isinteger ())
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1839 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1840 if (is_int32_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1841 retval = convert_to_octave_idx_type_array (int32_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1842 else if (is_int64_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1843 retval = convert_to_octave_idx_type_array (int64_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1844 else if (is_int16_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1845 retval = convert_to_octave_idx_type_array (int16_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1846 else if (is_int8_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1847 retval = convert_to_octave_idx_type_array (int8_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1848 else if (is_uint32_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1849 retval = convert_to_octave_idx_type_array (uint32_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1850 else if (is_uint64_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1851 retval = convert_to_octave_idx_type_array (uint64_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1852 else if (is_uint16_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1853 retval = convert_to_octave_idx_type_array (uint16_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1854 else if (is_uint8_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1855 retval = convert_to_octave_idx_type_array (uint8_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1856 else
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1857 retval = array_value (force_string_conv);
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1858 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1859 else
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1860 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1861 const NDArray a = array_value (force_string_conv);
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1862
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1863 if (require_int)
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1864 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1865 retval.resize (a.dims ());
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1866 for (octave_idx_type i = 0; i < a.numel (); i++)
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1867 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1868 double ai = a.elem (i);
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1869 octave_idx_type v = static_cast<octave_idx_type> (ai);
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1870 if (ai == v)
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1871 retval.xelem (i) = v;
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1872 else
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1873 {
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1874 error_with_cfn ("conversion to integer value failed");
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1875 break;
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1876 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1877 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1878 }
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1879 else
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1880 retval = Array<octave_idx_type> (a);
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1881 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1882
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1883 return retval.reshape (make_vector_dims (retval.dims (),
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1884 force_vector_conversion,
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1885 type_name (), "integer vector"));
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1886 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1887
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1888 Array<Complex>
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1889 octave_value::complex_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1890 bool force_vector_conversion) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1891 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1892 Array<Complex> retval = complex_array_value (force_string_conv);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1893
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1894 return retval.reshape (make_vector_dims (retval.dims (),
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1895 force_vector_conversion,
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1896 type_name (), "complex vector"));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1897 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1898
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1899 FloatColumnVector
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1900 octave_value::float_column_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1901 bool frc_vec_conv) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1902 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1903 return FloatColumnVector (float_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1904 frc_vec_conv));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1905 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1906
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1907 FloatComplexColumnVector
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1908 octave_value::float_complex_column_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1909 bool frc_vec_conv) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1910 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1911 return
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1912 FloatComplexColumnVector (float_complex_vector_value (force_string_conv,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1913 frc_vec_conv));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1914 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1915
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1916 FloatRowVector
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1917 octave_value::float_row_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1918 bool frc_vec_conv) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1919 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1920 return FloatRowVector (float_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1921 frc_vec_conv));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1922 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1923
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1924 FloatComplexRowVector
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1925 octave_value::float_complex_row_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1926 bool frc_vec_conv) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1927 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1928 return FloatComplexRowVector (float_complex_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1929 frc_vec_conv));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1930 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1931
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1932 Array<float>
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1933 octave_value::float_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1934 bool force_vector_conversion) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1935 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1936 Array<float> retval = float_array_value (force_string_conv);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1937
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1938 return retval.reshape (make_vector_dims (retval.dims (),
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1939 force_vector_conversion,
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1940 type_name (), "real vector"));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1941 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1942
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1943 Array<FloatComplex>
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1944 octave_value::float_complex_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1945 bool force_vector_conversion) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1946 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1947 Array<FloatComplex> retval = float_complex_array_value (force_string_conv);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1948
20560
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1949 return retval.reshape (make_vector_dims (retval.dims (),
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1950 force_vector_conversion,
56fee8f84fe7 eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20535
diff changeset
1951 type_name (), "complex vector"));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1952 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1953
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
1954 // NAME can't always be "x ## FCN" because some of the original
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
1955 // value extraction functions perform implicit type conversions that we
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
1956 // wish to avoid for these functions.
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
1957
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1958 #define XVALUE_EXTRACTOR(TYPE, NAME, FCN) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1959 TYPE \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1960 octave_value::NAME (const char *fmt, ...) const \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1961 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1962 TYPE retval; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1963 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1964 try \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1965 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1966 retval = FCN (); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1967 } \
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
1968 catch (octave::execution_exception& e) \
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1969 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1970 if (fmt) \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1971 { \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1972 va_list args; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1973 va_start (args, fmt); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1974 verror (e, fmt, args); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1975 va_end (args); \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1976 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1977 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1978 throw e; \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1979 } \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1980 \
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21990
diff changeset
1981 return retval; \
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
1982 }
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
1983
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1984 XVALUE_EXTRACTOR (short int, xshort_value, short_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1985
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1986 XVALUE_EXTRACTOR (unsigned short int, xushort_value, ushort_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1987
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1988 XVALUE_EXTRACTOR (int, xint_value, int_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1989
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1990 XVALUE_EXTRACTOR (unsigned int, xuint_value, uint_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1991
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1992 XVALUE_EXTRACTOR (int, xnint_value, nint_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1993
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1994 XVALUE_EXTRACTOR (long int, xlong_value, long_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1995
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1996 XVALUE_EXTRACTOR (unsigned long int, xulong_value, ulong_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1997
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1998 XVALUE_EXTRACTOR (int64_t, xint64_value, int64_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
1999
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2000 XVALUE_EXTRACTOR (uint64_t, xuint64_value, uint64_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2001
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2002 XVALUE_EXTRACTOR (octave_idx_type, xidx_type_value, idx_type_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2003
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2004 XVALUE_EXTRACTOR (double, xdouble_value, double_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2005 XVALUE_EXTRACTOR (float, xfloat_value, float_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2006
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2007 XVALUE_EXTRACTOR (double, xscalar_value, scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2008 XVALUE_EXTRACTOR (float, xfloat_scalar_value, float_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2009
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2010 XVALUE_EXTRACTOR (Matrix, xmatrix_value, matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2011 XVALUE_EXTRACTOR (FloatMatrix, xfloat_matrix_value, float_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2012
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2013 XVALUE_EXTRACTOR (NDArray, xarray_value, array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2014 XVALUE_EXTRACTOR (FloatNDArray, xfloat_array_value, float_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2015
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2016 XVALUE_EXTRACTOR (Complex, xcomplex_value, complex_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2017 XVALUE_EXTRACTOR (FloatComplex, xfloat_complex_value, float_complex_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2018
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2019 XVALUE_EXTRACTOR (ComplexMatrix, xcomplex_matrix_value, complex_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2020 XVALUE_EXTRACTOR (FloatComplexMatrix, xfloat_complex_matrix_value, float_complex_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2021
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2022 XVALUE_EXTRACTOR (ComplexNDArray, xcomplex_array_value, complex_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2023 XVALUE_EXTRACTOR (FloatComplexNDArray, xfloat_complex_array_value, float_complex_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2024
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2025 XVALUE_EXTRACTOR (bool, xbool_value, bool_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2026 XVALUE_EXTRACTOR (boolMatrix, xbool_matrix_value, bool_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2027 XVALUE_EXTRACTOR (boolNDArray, xbool_array_value, bool_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2028
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2029 XVALUE_EXTRACTOR (charMatrix, xchar_matrix_value, char_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2030 XVALUE_EXTRACTOR (charNDArray, xchar_array_value, char_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2031
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2032 XVALUE_EXTRACTOR (SparseMatrix, xsparse_matrix_value, sparse_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2033 XVALUE_EXTRACTOR (SparseComplexMatrix, xsparse_complex_matrix_value, sparse_complex_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2034 XVALUE_EXTRACTOR (SparseBoolMatrix, xsparse_bool_matrix_value, sparse_bool_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2035
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2036 XVALUE_EXTRACTOR (DiagMatrix, xdiag_matrix_value, diag_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2037 XVALUE_EXTRACTOR (FloatDiagMatrix, xfloat_diag_matrix_value, float_diag_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2038 XVALUE_EXTRACTOR (ComplexDiagMatrix, xcomplex_diag_matrix_value, complex_diag_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2039 XVALUE_EXTRACTOR (FloatComplexDiagMatrix, xfloat_complex_diag_matrix_value, float_complex_diag_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2040
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2041 XVALUE_EXTRACTOR (PermMatrix, xperm_matrix_value, perm_matrix_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2042
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2043 XVALUE_EXTRACTOR (octave_int8, xint8_scalar_value, int8_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2044 XVALUE_EXTRACTOR (octave_int16, xint16_scalar_value, int16_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2045 XVALUE_EXTRACTOR (octave_int32, xint32_scalar_value, int32_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2046 XVALUE_EXTRACTOR (octave_int64, xint64_scalar_value, int64_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2047
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2048 XVALUE_EXTRACTOR (octave_uint8, xuint8_scalar_value, uint8_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2049 XVALUE_EXTRACTOR (octave_uint16, xuint16_scalar_value, uint16_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2050 XVALUE_EXTRACTOR (octave_uint32, xuint32_scalar_value, uint32_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2051 XVALUE_EXTRACTOR (octave_uint64, xuint64_scalar_value, uint64_scalar_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2052
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2053 XVALUE_EXTRACTOR (int8NDArray, xint8_array_value, int8_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2054 XVALUE_EXTRACTOR (int16NDArray, xint16_array_value, int16_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2055 XVALUE_EXTRACTOR (int32NDArray, xint32_array_value, int32_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2056 XVALUE_EXTRACTOR (int64NDArray, xint64_array_value, int64_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2057
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2058 XVALUE_EXTRACTOR (uint8NDArray, xuint8_array_value, uint8_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2059 XVALUE_EXTRACTOR (uint16NDArray, xuint16_array_value, uint16_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2060 XVALUE_EXTRACTOR (uint32NDArray, xuint32_array_value, uint32_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2061 XVALUE_EXTRACTOR (uint64NDArray, xuint64_array_value, uint64_array_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2062
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
2063 XVALUE_EXTRACTOR (std::string, xstring_value, rep->xstring_value)
20990
fc9cca99b2de Deprecate all_strings, replace with string_vector_value.
Rik <rik@octave.org>
parents: 20978
diff changeset
2064 XVALUE_EXTRACTOR (string_vector, xstring_vector_value, string_vector_value)
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2065
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2066 XVALUE_EXTRACTOR (Cell, xcell_value, cell_value)
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
2067 XVALUE_EXTRACTOR (Array<std::string>, xcellstr_value, cellstr_value)
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
2068
20703
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2069 XVALUE_EXTRACTOR (Range, xrange_value, range_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2070
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2071 XVALUE_EXTRACTOR (octave_map, xmap_value, map_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2072 XVALUE_EXTRACTOR (octave_scalar_map, xscalar_map_value, scalar_map_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2073
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2074 XVALUE_EXTRACTOR (ColumnVector, xcolumn_vector_value, column_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2075 XVALUE_EXTRACTOR (ComplexColumnVector, xcomplex_column_vector_value, complex_column_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2076
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2077 XVALUE_EXTRACTOR (RowVector, xrow_vector_value, row_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2078 XVALUE_EXTRACTOR (ComplexRowVector, xcomplex_row_vector_value, complex_row_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2079
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2080 XVALUE_EXTRACTOR (FloatColumnVector, xfloat_column_vector_value, float_column_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2081 XVALUE_EXTRACTOR (FloatComplexColumnVector, xfloat_complex_column_vector_value, float_complex_column_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2082
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2083 XVALUE_EXTRACTOR (FloatRowVector, xfloat_row_vector_value, float_row_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2084 XVALUE_EXTRACTOR (FloatComplexRowVector, xfloat_complex_row_vector_value, float_complex_row_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2085
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2086 XVALUE_EXTRACTOR (Array<int>, xint_vector_value, int_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2087 XVALUE_EXTRACTOR (Array<octave_idx_type>, xoctave_idx_type_vector_value, octave_idx_type_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2088
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2089 XVALUE_EXTRACTOR (Array<double>, xvector_value, vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2090 XVALUE_EXTRACTOR (Array<Complex>, xcomplex_vector_value, complex_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2091
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2092 XVALUE_EXTRACTOR (Array<float>, xfloat_vector_value, float_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2093 XVALUE_EXTRACTOR (Array<FloatComplex>, xfloat_complex_vector_value, float_complex_vector_value)
85e5efae848a eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
2094
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2095 XVALUE_EXTRACTOR (octave_function *, xfunction_value, function_value)
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2096 XVALUE_EXTRACTOR (octave_user_function *, xuser_function_value, user_function_value)
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2097 XVALUE_EXTRACTOR (octave_user_script *, xuser_script_value, user_script_value)
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2098 XVALUE_EXTRACTOR (octave_user_code *, xuser_code_value, user_code_value)
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2099 XVALUE_EXTRACTOR (octave_fcn_handle *, xfcn_handle_value, fcn_handle_value)
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2100 XVALUE_EXTRACTOR (octave_fcn_inline *, xfcn_inline_value, fcn_inline_value)
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2101
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2102 XVALUE_EXTRACTOR (octave_value_list, xlist_value, list_value)
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2103
20700
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
2104 #undef XVALUE_EXTRACTOR
68e3a747ca02 rename octave_value value extractors that accept error message args
John W. Eaton <jwe@octave.org>
parents: 20687
diff changeset
2105
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2106 octave_value
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
2107 octave_value::storable_value (void) const
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2108 {
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
2109 octave_value retval = *this;
23589
63950abd2f81 maint: Deprecate is_null_type and replace with isnull.
Rik <rik@octave.org>
parents: 23587
diff changeset
2110 if (isnull ())
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
2111 retval = octave_value (rep->empty_clone ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2112 else
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
2113 retval.maybe_economize ();
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
2114
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
2115 return retval;
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2116 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2117
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2118 void
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2119 octave_value::make_storable_value (void)
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2120 {
23589
63950abd2f81 maint: Deprecate is_null_type and replace with isnull.
Rik <rik@octave.org>
parents: 23587
diff changeset
2121 if (isnull ())
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2122 {
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2123 octave_base_value *rc = rep->empty_clone ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2124 if (--rep->count == 0)
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2125 delete rep;
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2126 rep = rc;
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2127 }
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
2128 else
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
2129 maybe_economize ();
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2130 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2131
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
2132 int
23059
b98ebcd7f11c move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
2133 octave_value::write (octave::stream& os, int block_size,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2134 oct_data_conv::data_type output_type, int skip,
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21730
diff changeset
2135 octave::mach_info::float_format flt_fmt) const
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
2136 {
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
2137 return rep->write (os, block_size, output_type, skip, flt_fmt);
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
2138 }
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
2139
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2140 OCTAVE_NORETURN static void
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2141 err_binary_op (const std::string& on, const std::string& tn1,
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2142 const std::string& tn2)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2143 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 15428
diff changeset
2144 error ("binary operator '%s' not implemented for '%s' by '%s' operations",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2145 on.c_str (), tn1.c_str (), tn2.c_str ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2146 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2147
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2148 OCTAVE_NORETURN static void
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2149 err_binary_op_conv (const std::string& on)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2150 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 15428
diff changeset
2151 error ("type conversion failed for binary operator '%s'", on.c_str ());
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2152 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2153
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2154 octave_value
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2155 do_binary_op (octave_value::binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2156 const octave_value& v1, const octave_value& v2)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2157 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2158 octave_value retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2159
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2160 int t1 = v1.type_id ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2161 int t2 = v2.type_id ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2162
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2163 if (t1 == octave_class::static_type_id ()
18306
122239398a03 Partial support for operator overload in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17856
diff changeset
2164 || t2 == octave_class::static_type_id ()
122239398a03 Partial support for operator overload in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17856
diff changeset
2165 || t1 == octave_classdef::static_type_id ()
122239398a03 Partial support for operator overload in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17856
diff changeset
2166 || t2 == octave_classdef::static_type_id ())
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2167 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2168 octave_value_typeinfo::binary_class_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2169 = octave_value_typeinfo::lookup_binary_class_op (op);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2170
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2171 if (! f)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2172 err_binary_op (octave_value::binary_op_as_string (op),
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2173 v1.class_name (), v2.class_name ());
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2174
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2175 retval = f (v1, v2);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2176 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2177 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2178 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2179 // FIXME: we need to handle overloading operators for built-in
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2180 // classes (double, char, int8, etc.)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2181
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2182 octave_value_typeinfo::binary_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2183 = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2184
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2185 if (f)
20535
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
2186 retval = f (*v1.rep, *v2.rep);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2187 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2188 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2189 octave_value tv1;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2190 octave_base_value::type_conv_info cf1 =
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2191 v1.numeric_conversion_function ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2192
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2193 octave_value tv2;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2194 octave_base_value::type_conv_info cf2 =
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2195 v2.numeric_conversion_function ();
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2196
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2197 // Try biased (one-sided) conversions first.
19864
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
2198 if (cf2.type_id () >= 0
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
2199 && octave_value_typeinfo::lookup_binary_op (op, t1,
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
2200 cf2.type_id ()))
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23693
diff changeset
2201 cf1 = nullptr;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2202 else if (cf1.type_id () >= 0
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2203 && octave_value_typeinfo::lookup_binary_op (op,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2204 cf1.type_id (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2205 t2))
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23693
diff changeset
2206 cf2 = nullptr;
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2207
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2208 if (cf1)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2209 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2210 octave_base_value *tmp = cf1 (*v1.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2211
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2212 if (! tmp)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2213 err_binary_op_conv (octave_value::binary_op_as_string (op));
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2214
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2215 tv1 = octave_value (tmp);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2216 t1 = tv1.type_id ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2217 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2218 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2219 tv1 = v1;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2220
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2221 if (cf2)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2222 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2223 octave_base_value *tmp = cf2 (*v2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2224
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2225 if (! tmp)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2226 err_binary_op_conv (octave_value::binary_op_as_string (op));
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2227
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2228 tv2 = octave_value (tmp);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2229 t2 = tv2.type_id ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2230 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2231 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2232 tv2 = v2;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2233
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2234 if (cf1 || cf2)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2235 {
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2236 retval = do_binary_op (op, tv1, tv2);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2237 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2238 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2239 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2240 //demote double -> single and try again
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2241 cf1 = tv1.numeric_demotion_function ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2242
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2243 cf2 = tv2.numeric_demotion_function ();
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2244
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2245 // Try biased (one-sided) conversions first.
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2246 if (cf2.type_id () >= 0
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2247 && octave_value_typeinfo::lookup_binary_op (op, t1,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2248 cf2.type_id ()))
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23693
diff changeset
2249 cf1 = nullptr;
19864
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
2250 else if (cf1.type_id () >= 0
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
2251 && octave_value_typeinfo::lookup_binary_op (op,
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
2252 cf1.type_id (),
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
2253 t2))
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23693
diff changeset
2254 cf2 = nullptr;
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2255
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2256 if (cf1)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2257 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2258 octave_base_value *tmp = cf1 (*tv1.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2259
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2260 if (! tmp)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2261 err_binary_op_conv (octave_value::binary_op_as_string (op));
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2262
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2263 tv1 = octave_value (tmp);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2264 t1 = tv1.type_id ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2265 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2266
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2267 if (cf2)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2268 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2269 octave_base_value *tmp = cf2 (*tv2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2270
21129
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21121
diff changeset
2271 if (! tmp)
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21121
diff changeset
2272 err_binary_op_conv (octave_value::binary_op_as_string (op));
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21121
diff changeset
2273
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21121
diff changeset
2274 tv2 = octave_value (tmp);
228b65504557 maint: Eliminate useless statements after err_XXX.
Rik <rik@octave.org>
parents: 21121
diff changeset
2275 t2 = tv2.type_id ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2276 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2277
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2278 if (! cf1 && ! cf2)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2279 err_binary_op (octave_value::binary_op_as_string (op),
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2280 v1.type_name (), v2.type_name ());
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2281
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2282 f = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2283
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2284 if (! f)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2285 err_binary_op (octave_value::binary_op_as_string (op),
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2286 v1.type_name (), v2.type_name ());
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2287
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2288 retval = f (*tv1.rep, *tv2.rep);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2289 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2290 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2291 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2292
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2293 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2294 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2295
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2296 static octave_value
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2297 decompose_binary_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2298 const octave_value& v1, const octave_value& v2)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2299 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2300 switch (op)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2301 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2302 case octave_value::op_trans_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2303 return do_binary_op (octave_value::op_mul,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2304 do_unary_op (octave_value::op_transpose, v1), v2);
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2305
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2306 case octave_value::op_mul_trans:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2307 return do_binary_op (octave_value::op_mul,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2308 v1, do_unary_op (octave_value::op_transpose, v2));
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2309
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2310 case octave_value::op_herm_mul:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2311 return do_binary_op (octave_value::op_mul,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2312 do_unary_op (octave_value::op_hermitian, v1), v2);
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2313
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2314 case octave_value::op_mul_herm:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2315 return do_binary_op (octave_value::op_mul,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2316 v1, do_unary_op (octave_value::op_hermitian, v2));
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2317
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2318 case octave_value::op_trans_ldiv:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2319 return do_binary_op (octave_value::op_ldiv,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2320 do_unary_op (octave_value::op_transpose, v1), v2);
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2321
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2322 case octave_value::op_herm_ldiv:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2323 return do_binary_op (octave_value::op_ldiv,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2324 do_unary_op (octave_value::op_hermitian, v1), v2);
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2325
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2326 case octave_value::op_el_not_and:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2327 return do_binary_op (octave_value::op_el_and,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2328 do_unary_op (octave_value::op_not, v1), v2);
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2329
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2330 case octave_value::op_el_not_or:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2331 return do_binary_op (octave_value::op_el_or,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2332 do_unary_op (octave_value::op_not, v1), v2);
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2333
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2334 case octave_value::op_el_and_not:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2335 return do_binary_op (octave_value::op_el_and,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2336 v1, do_unary_op (octave_value::op_not, v2));
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2337
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2338 case octave_value::op_el_or_not:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2339 return do_binary_op (octave_value::op_el_or,
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2340 v1, do_unary_op (octave_value::op_not, v2));
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2341
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2342 default:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2343 error ("invalid compound operator");
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2344 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2345 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2346
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2347 octave_value
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2348 do_binary_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2349 const octave_value& v1, const octave_value& v2)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2350 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2351 octave_value retval;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2352
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2353 int t1 = v1.type_id ();
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2354 int t2 = v2.type_id ();
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2355
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2356 if (t1 == octave_class::static_type_id ()
18306
122239398a03 Partial support for operator overload in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17856
diff changeset
2357 || t2 == octave_class::static_type_id ()
122239398a03 Partial support for operator overload in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17856
diff changeset
2358 || t1 == octave_classdef::static_type_id ()
122239398a03 Partial support for operator overload in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17856
diff changeset
2359 || t2 == octave_classdef::static_type_id ())
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2360 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2361 octave_value_typeinfo::binary_class_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2362 = octave_value_typeinfo::lookup_binary_class_op (op);
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2363
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2364 if (f)
20535
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
2365 retval = f (v1, v2);
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2366 else
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2367 retval = decompose_binary_op (op, v1, v2);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2368 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2369 else
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2370 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2371 octave_value_typeinfo::binary_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2372 = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2373
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2374 if (f)
20535
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
2375 retval = f (*v1.rep, *v2.rep);
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2376 else
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2377 retval = decompose_binary_op (op, v1, v2);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2378 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2379
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2380 return retval;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2381 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2382
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2383 OCTAVE_NORETURN static void
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2384 err_cat_op (const std::string& tn1, const std::string& tn2)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2385 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 15428
diff changeset
2386 error ("concatenation operator not implemented for '%s' by '%s' operations",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2387 tn1.c_str (), tn2.c_str ());
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2388 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2389
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2390 OCTAVE_NORETURN static void
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2391 err_cat_op_conv (void)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2392 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2393 error ("type conversion failed for concatenation operator");
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2394 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2395
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2396 octave_value
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2397 do_cat_op (const octave_value& v1, const octave_value& v2,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2398 const Array<octave_idx_type>& ra_idx)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2399 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2400 octave_value retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2401
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7800
diff changeset
2402 // Can't rapid return for concatenation with an empty object here as
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7800
diff changeset
2403 // something like cat(1,[],single([]) must return the correct type.
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
2404
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2405 int t1 = v1.type_id ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2406 int t2 = v2.type_id ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2407
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5758
diff changeset
2408 octave_value_typeinfo::cat_op_fcn f
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5758
diff changeset
2409 = octave_value_typeinfo::lookup_cat_op (t1, t2);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2410
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2411 if (f)
20535
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
2412 retval = f (*v1.rep, *v2.rep, ra_idx);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2413 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2414 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2415 octave_value tv1;
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2416 octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2417
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2418 octave_value tv2;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2419 octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2420
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2421 // Try biased (one-sided) conversions first.
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2422 if (cf2.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2423 && octave_value_typeinfo::lookup_cat_op (t1, cf2.type_id ()))
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23693
diff changeset
2424 cf1 = nullptr;
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2425 else if (cf1.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2426 && octave_value_typeinfo::lookup_cat_op (cf1.type_id (), t2))
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23693
diff changeset
2427 cf2 = nullptr;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2428
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2429 if (cf1)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2430 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2431 octave_base_value *tmp = cf1 (*v1.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2432
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2433 if (! tmp)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2434 err_cat_op_conv ();
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2435
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2436 tv1 = octave_value (tmp);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2437 t1 = tv1.type_id ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2438 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2439 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2440 tv1 = v1;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2441
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2442 if (cf2)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2443 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2444 octave_base_value *tmp = cf2 (*v2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2445
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2446 if (! tmp)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2447 err_cat_op_conv ();
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2448
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2449 tv2 = octave_value (tmp);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2450 t2 = tv2.type_id ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2451 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2452 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2453 tv2 = v2;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2454
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2455 if (! cf1 && ! cf2)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2456 err_cat_op (v1.type_name (), v2.type_name ());
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2457
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2458 retval = do_cat_op (tv1, tv2, ra_idx);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2459 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2460
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2461 return retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2462 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2463
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2464 octave_value
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2465 do_colon_op (const octave_value& base, const octave_value& increment,
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2466 const octave_value& limit, bool is_for_cmd_expr)
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2467 {
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2468 octave_value retval;
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2469
23587
0c468af9dc00 maint: Deprecate is_object and replace with isobject.
Rik <rik@octave.org>
parents: 23580
diff changeset
2470 if (base.isobject () || increment.isobject () || limit.isobject ())
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2471 {
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2472 std::string dispatch_type;
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2473
23587
0c468af9dc00 maint: Deprecate is_object and replace with isobject.
Rik <rik@octave.org>
parents: 23580
diff changeset
2474 if (base.isobject ())
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2475 dispatch_type = base.class_name ();
23587
0c468af9dc00 maint: Deprecate is_object and replace with isobject.
Rik <rik@octave.org>
parents: 23580
diff changeset
2476 else if (increment.is_defined () && increment.isobject ())
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2477 dispatch_type = increment.class_name ();
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2478 else
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2479 dispatch_type = limit.class_name ();
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2480
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23678
diff changeset
2481 octave::symbol_table& symtab = octave::__get_symbol_table__ ("do_colon_op");
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23589
diff changeset
2482
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23589
diff changeset
2483 octave_value meth = symtab.find_method ("colon", dispatch_type);
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19749
diff changeset
2484
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2485 if (! meth.is_defined ())
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2486 error ("colon method not defined for %s class", dispatch_type.c_str ());
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2487
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2488 octave_value_list args;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2489
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2490 if (increment.is_defined ())
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19749
diff changeset
2491 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2492 args(2) = limit;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2493 args(1) = increment;
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19749
diff changeset
2494 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19749
diff changeset
2495 else
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2496 args(1) = limit;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2497
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2498 args(0) = base;
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2499
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23059
diff changeset
2500 octave_value_list tmp = octave::feval (meth.function_value (), args, 1);
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2501
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2502 if (tmp.length () > 0)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20955
diff changeset
2503 retval = tmp(0);
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2504 }
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2505 else
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2506 {
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2507 bool result_is_str = (base.is_string () && limit.is_string ());
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2508 bool dq_str = (base.is_dq_string () || limit.is_dq_string ());
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2509
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2510 Matrix m_base, m_limit, m_increment;
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2511
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2512 try
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2513 {
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2514 m_base = base.matrix_value (true);
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2515 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
2516 catch (octave::execution_exception& e)
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2517 {
20756
200ae1d650b7 propagate octave_execution_exception objects through try/catch blocks
John W. Eaton <jwe@octave.org>
parents: 20743
diff changeset
2518 error (e, "invalid base value in colon expression");
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2519 }
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2520
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2521 try
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2522 {
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2523 m_limit = limit.matrix_value (true);
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2524 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
2525 catch (octave::execution_exception& e)
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2526 {
20756
200ae1d650b7 propagate octave_execution_exception objects through try/catch blocks
John W. Eaton <jwe@octave.org>
parents: 20743
diff changeset
2527 error (e, "invalid limit value in colon expression");
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2528 }
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2529
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2530 try
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2531 {
20741
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2532 m_increment = (increment.is_defined ()
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2533 ? increment.matrix_value (true)
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2534 : Matrix (1, 1, 1.0));
a5ab31b52ae8 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20704
diff changeset
2535 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
2536 catch (octave::execution_exception& e)
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2537 {
20756
200ae1d650b7 propagate octave_execution_exception objects through try/catch blocks
John W. Eaton <jwe@octave.org>
parents: 20743
diff changeset
2538 error (e, "invalid increment value in colon expression");
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2539 }
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2540
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
2541 bool base_empty = m_base.isempty ();
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
2542 bool limit_empty = m_limit.isempty ();
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23576
diff changeset
2543 bool increment_empty = m_increment.isempty ();
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2544
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2545 if (base_empty || limit_empty || increment_empty)
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2546 retval = Range ();
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2547 else
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2548 {
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2549 Range r (m_base(0), m_limit(0), m_increment(0));
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2550
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2551 // For compatibility with Matlab, don't allow the range used in
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2552 // a FOR loop expression to be converted to a Matrix.
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2553
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2554 retval = octave_value (r, is_for_cmd_expr);
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2555
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2556 if (result_is_str)
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23449
diff changeset
2557 retval = (retval.convert_to_str (false, true, dq_str ? '"' : '\''));
19749
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2558 }
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2559 }
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2560
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2561 return retval;
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2562 }
c913247c85a8 make colon function work (bug #44290)
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
2563
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2564 void
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2565 octave_value::print_info (std::ostream& os, const std::string& prefix) const
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2566 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2567 os << prefix << "type_name: " << type_name () << "\n"
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2568 << prefix << "count: " << get_count () << "\n"
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2569 << prefix << "rep info: ";
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2570
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23804
diff changeset
2571 rep->print_info (os, prefix + ' ');
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2572 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2573
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2574 OCTAVE_NORETURN static void
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2575 err_unary_op (const std::string& on, const std::string& tn)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2576 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 15428
diff changeset
2577 error ("unary operator '%s' not implemented for '%s' operands",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2578 on.c_str (), tn.c_str ());
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2579 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2580
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2581 OCTAVE_NORETURN static void
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2582 err_unary_op_conv (const std::string& on)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2583 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 15428
diff changeset
2584 error ("type conversion failed for unary operator '%s'", on.c_str ());
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2585 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2586
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2587 octave_value
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2588 do_unary_op (octave_value::unary_op op, const octave_value& v)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2589 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2590 octave_value retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2591
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2592 int t = v.type_id ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2593
18306
122239398a03 Partial support for operator overload in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17856
diff changeset
2594 if (t == octave_class::static_type_id ()
122239398a03 Partial support for operator overload in classdef.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17856
diff changeset
2595 || t == octave_classdef::static_type_id ())
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2596 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2597 octave_value_typeinfo::unary_class_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2598 = octave_value_typeinfo::lookup_unary_class_op (op);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2599
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2600 if (! f)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2601 err_unary_op (octave_value::unary_op_as_string (op), v.class_name ());
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2602
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2603 retval = f (v);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2604 }
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2605 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2606 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2607 // FIXME: we need to handle overloading operators for built-in
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2608 // classes (double, char, int8, etc.)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2609
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2610 octave_value_typeinfo::unary_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2611 = octave_value_typeinfo::lookup_unary_op (op, t);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2612
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2613 if (f)
20535
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
2614 retval = f (*v.rep);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2615 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2616 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2617 octave_value tv;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2618 octave_base_value::type_conv_fcn cf
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2619 = v.numeric_conversion_function ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2620
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2621 if (! cf)
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2622 err_unary_op (octave_value::unary_op_as_string (op),
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2623 v.type_name ());
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2624
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2625 octave_base_value *tmp = cf (*v.rep);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2626
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2627 if (! tmp)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2628 err_unary_op_conv (octave_value::unary_op_as_string (op));
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2629
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2630 tv = octave_value (tmp);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2631 retval = do_unary_op (op, tv);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2632 }
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2633 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2634
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2635 return retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2636 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2637
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2638 OCTAVE_NORETURN static void
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2639 err_unary_op_conversion_failed (const std::string& op,
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2640 const std::string& tn)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2641 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 15428
diff changeset
2642 error ("operator %s: type conversion for '%s' failed",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2643 op.c_str (), tn.c_str ());
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2644 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2645
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2646 octave_value&
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2647 octave_value::do_non_const_unary_op (unary_op op)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2648 {
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2649 if (op == op_incr || op == op_decr)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2650 {
21102
dfcb9d74b253 Rename local gripe_XXX functions to err_XXX or warn_XXX.
Rik <rik@octave.org>
parents: 21100
diff changeset
2651 // We want the error just here, because in the other branch this should
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2652 // not happen, and if it did anyway (internal error), the message would
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2653 // be confusing.
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2654 if (is_undefined ())
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2655 {
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2656 std::string op_str = unary_op_as_string (op);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2657 error ("in x%s or %sx, x must be defined first",
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2658 op_str.c_str (), op_str.c_str ());
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2659 return *this;
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2660 }
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2661
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2662 // Genuine.
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2663 int t = type_id ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2664
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2665 octave_value_typeinfo::non_const_unary_op_fcn f
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2666 = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2667
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2668 if (f)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2669 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2670 make_unique ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2671
20535
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
2672 f (*rep);
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2673 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2674 else
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2675 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2676 octave_base_value::type_conv_fcn cf = numeric_conversion_function ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2677
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2678 if (! cf)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2679 err_unary_op (octave_value::unary_op_as_string (op), type_name ());
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2680
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2681 octave_base_value *tmp = cf (*rep);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2682
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2683 if (! tmp)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2684 err_unary_op_conversion_failed
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2685 (octave_value::unary_op_as_string (op), type_name ());
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2686
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2687 octave_base_value *old_rep = rep;
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2688 rep = tmp;
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2689
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2690 t = type_id ();
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2691
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2692 f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2693
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2694 if (f)
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2695 {
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2696 f (*rep);
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2697
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2698 if (old_rep && --old_rep->count == 0)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2699 delete old_rep;
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2700 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2701 else
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2702 {
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2703 if (old_rep)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2704 {
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2705 if (--rep->count == 0)
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2706 delete rep;
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2707
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2708 rep = old_rep;
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2709 }
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2710
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2711 err_unary_op (octave_value::unary_op_as_string (op),
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2712 type_name ());
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21102
diff changeset
2713 }
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2714 }
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2715 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2716 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2717 {
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2718 // Non-genuine.
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2719 int t = type_id ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2720
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23693
diff changeset
2721 octave_value_typeinfo::non_const_unary_op_fcn f = nullptr;
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2722
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2723 // Only attempt to operate in-place if this variable is unshared.
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2724 if (rep->count == 1)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2725 f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2726
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2727 if (f)
20535
b70cc4bd8109 begin removal of global error_state variable
John W. Eaton <jwe@octave.org>
parents: 20232
diff changeset
2728 f (*rep);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2729 else
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2730 *this = do_unary_op (op, *this);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2731 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2732
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2733 return *this;
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2734 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2735
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2736 octave_value&
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
2737 octave_value::do_non_const_unary_op (unary_op op, const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2738 const std::list<octave_value_list>& idx)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2739 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2740 if (idx.empty ())
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2741 do_non_const_unary_op (op);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2742 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2743 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2744 // FIXME: only do the following stuff if we can't find a
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2745 // specific function to call to handle the op= operation for the
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2746 // types we have.
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2747
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2748 assign_op assop = unary_op_to_assign_op (op);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2749
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2750 assign (assop, type, idx, 1.0);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2751 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2752
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2753 return *this;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2754 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2755
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2756 octave_value::assign_op
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2757 octave_value::unary_op_to_assign_op (unary_op op)
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2758 {
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2759 switch (op)
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2760 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2761 case op_incr:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2762 return op_add_eq;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2763
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2764 case op_decr:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2765 return op_sub_eq;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2766
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2767 default:
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2768 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2769 std::string on = unary_op_as_string (op);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2770 error ("operator %s: no assign operator found", on.c_str ());
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2771 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2772 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2773 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2774
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2775 octave_value::binary_op
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2776 octave_value::op_eq_to_binary_op (assign_op op)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2777 {
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2778 switch (op)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2779 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2780 case op_add_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2781 return op_add;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2782
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2783 case op_sub_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2784 return op_sub;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2785
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2786 case op_mul_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2787 return op_mul;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2788
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2789 case op_div_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2790 return op_div;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2791
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2792 case op_ldiv_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2793 return op_ldiv;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2794
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2795 case op_pow_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2796 return op_pow;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2797
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2798 case op_el_mul_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2799 return op_el_mul;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2800
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2801 case op_el_div_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2802 return op_el_div;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2803
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2804 case op_el_ldiv_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2805 return op_el_ldiv;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2806
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2807 case op_el_pow_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2808 return op_el_pow;
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2809
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2810 case op_el_and_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2811 return op_el_and;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2812
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2813 case op_el_or_eq:
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2814 return op_el_or;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2815
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2816 default:
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2817 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2818 std::string on = assign_op_as_string (op);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2819 error ("operator %s: no binary operator found", on.c_str ());
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2820 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2821 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2822 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2823
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2824 octave_value
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2825 octave_value::empty_conv (const std::string& type, const octave_value& rhs)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2826 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2827 if (type.length () > 0)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2828 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2829 switch (type[0])
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2830 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2831 case '(':
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2832 if (type.length () > 1 && type[1] == '.')
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2833 return octave_map ();
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2834 else
21295
29a0e9e70879 * ov.h: Fix typo in previous change.
John W. Eaton <jwe@octave.org>
parents: 21294
diff changeset
2835 return octave_value (rhs.empty_clone ());
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2836
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2837 case '{':
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2838 return Cell ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2839
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2840 case '.':
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2841 return octave_scalar_map ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2842
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2843 default:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2844 panic_impossible ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2845 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2846 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2847 else
21293
350caa6afadf * ov.cc: Use consistent style for switch statements.
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
2848 return octave_value (rhs.empty_clone ());
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2849 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2850
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2851 void
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2852 install_types (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2853 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2854 octave_base_value::register_type ();
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3546
diff changeset
2855 octave_cell::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2856 octave_scalar::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2857 octave_complex::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2858 octave_matrix::register_type ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
2859 octave_diag_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2860 octave_complex_matrix::register_type ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
2861 octave_complex_diag_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2862 octave_range::register_type ();
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
2863 octave_bool::register_type ();
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
2864 octave_bool_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2865 octave_char_matrix_str::register_type ();
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
2866 octave_char_matrix_sq_str::register_type ();
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2867 octave_int8_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2868 octave_int16_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2869 octave_int32_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2870 octave_int64_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2871 octave_uint8_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2872 octave_uint16_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2873 octave_uint32_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2874 octave_uint64_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2875 octave_int8_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2876 octave_int16_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2877 octave_int32_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2878 octave_int64_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2879 octave_uint8_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2880 octave_uint16_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2881 octave_uint32_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2882 octave_uint64_matrix::register_type ();
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
2883 octave_sparse_bool_matrix::register_type ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
2884 octave_sparse_matrix::register_type ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
2885 octave_sparse_complex_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2886 octave_struct::register_type ();
10753
bee1b1a2e29a yield compatible dims from cell2struct + more fixes. build & tests OK
Jaroslav Hajek <highegg@gmail.com>
parents: 10742
diff changeset
2887 octave_scalar_struct::register_type ();
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2888 octave_class::register_type ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3961
diff changeset
2889 octave_cs_list::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2890 octave_magic_colon::register_type ();
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
2891 octave_builtin::register_type ();
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
2892 octave_user_function::register_type ();
4649
f7ce581b27fb [project @ 2003-11-23 21:46:44 by jwe]
jwe
parents: 4645
diff changeset
2893 octave_dld_function::register_type ();
4643
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
2894 octave_fcn_handle::register_type ();
4966
91b61d27b9b4 [project @ 2004-09-07 02:01:22 by jwe]
jwe
parents: 4965
diff changeset
2895 octave_fcn_inline::register_type ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
2896 octave_float_scalar::register_type ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
2897 octave_float_complex::register_type ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
2898 octave_float_matrix::register_type ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
2899 octave_float_diag_matrix::register_type ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
2900 octave_float_complex_matrix::register_type ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
2901 octave_float_complex_diag_matrix::register_type ();
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
2902 octave_perm_matrix::register_type ();
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2903 octave_null_matrix::register_type ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2904 octave_null_str::register_type ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2905 octave_null_sq_str::register_type ();
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
2906 octave_lazy_index::register_type ();
14013
1734ebe27134 move onCleanup function and class to liboctinterp
John W. Eaton <jwe@octave.org>
parents: 13932
diff changeset
2907 octave_oncleanup::register_type ();
15754
bf77f7f66bdf register octave_java type at Octave startup
John W. Eaton <jwe@octave.org>
parents: 15467
diff changeset
2908 octave_java::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2909 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2910
4791
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2911 DEFUN (sizeof, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2912 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2913 @deftypefn {} {} sizeof (@var{val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2914 Return the size of @var{val} in bytes.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2915 @seealso{whos}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2916 @end deftypefn */)
4791
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2917 {
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
2918 if (args.length () != 1)
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5785
diff changeset
2919 print_usage ();
4791
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2920
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20893
diff changeset
2921 return ovl (args(0).byte_size ());
4791
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2922 }
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2923
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
2924 /*
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
2925 %!assert (sizeof (uint64 (ones (3))), 72)
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
2926 %!assert (sizeof (double (zeros (2,4))), 64)
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
2927 %!assert (sizeof ({"foo", "bar", "baaz"}), 10)
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
2928 */
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
2929
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
2930 static void
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23433
diff changeset
2931 decode_subscripts (const char *name, const octave_value& arg,
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
2932 std::string& type_string,
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
2933 std::list<octave_value_list>& idx)
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
2934 {
20704
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20703
diff changeset
2935 const octave_map m = arg.xmap_value ("%s: second argument must be a structure with fields 'type' and 'subs'", name);
571508c1ed06 eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents: 20703
diff changeset
2936
20978
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2937 if (m.nfields () != 2 || ! m.contains ("type") || ! m.contains ("subs"))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2938 error ("%s: second argument must be a structure with fields 'type' and 'subs'",
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2939 name);
20978
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2940
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2941 octave_idx_type nel = m.numel ();
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2942
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2943 type_string = std::string (nel, '\0');
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2944 idx = std::list<octave_value_list> ();
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2945
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2946 if (nel == 0)
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2947 return;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2948
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2949 const Cell type = m.contents ("type");
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2950 const Cell subs = m.contents ("subs");
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2951
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2952 for (int k = 0; k < nel; k++)
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2953 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2954 std::string item = type(k).xstring_value ("%s: type(%d) must be a string", name, k+1);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2955
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2956 if (item == "{}")
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2957 type_string[k] = '{';
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2958 else if (item == "()")
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2959 type_string[k] = '(';
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2960 else if (item == ".")
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2961 type_string[k] = '.';
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2962 else
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2963 error ("%s: invalid indexing type '%s'", name, item.c_str ());
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2964
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2965 octave_value_list idx_item;
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2966
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2967 if (subs(k).is_string ())
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2968 idx_item(0) = subs(k);
23576
00e518162fda maint: Deprecate is_cell and replace with iscell.
Rik <rik@octave.org>
parents: 23534
diff changeset
2969 else if (subs(k).iscell ())
20978
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2970 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2971 Cell subs_cell = subs(k).cell_value ();
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2972
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2973 for (int n = 0; n < subs_cell.numel (); n++)
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2974 {
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2975 if (subs_cell(n).is_string ()
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2976 && subs_cell(n).string_value () == ":")
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2977 idx_item(n) = octave_value(octave_value::magic_colon_t);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2978 else
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2979 idx_item(n) = subs_cell(n);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2980 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2981 }
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2982 else
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2983 error ("%s: subs(%d) must be a string or cell array", name, k+1);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2984
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2985 idx.push_back (idx_item);
a5b500efca9f maint: invert if/else/error instances.
John W. Eaton <jwe@octave.org>
parents: 20962
diff changeset
2986 }
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
2987 }
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
2988
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2989 DEFUN (subsref, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2990 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2991 @deftypefn {} {} subsref (@var{val}, @var{idx})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2992 Perform the subscripted element selection operation on @var{val} according
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2993 to the subscript specified by @var{idx}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2994
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2995 The subscript @var{idx} must be a structure array with fields @samp{type}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2996 and @samp{subs}. Valid values for @samp{type} are @qcode{"()"},
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2997 @qcode{"@{@}"}, and @qcode{"."}. The @samp{subs} field may be either
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2998 @qcode{":"} or a cell array of index values.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
2999
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3000 The following example shows how to extract the first two columns of a matrix
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3001
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3002 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3003 @group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3004 val = magic (3)
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3005 @result{} val = [ 8 1 6
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3006 3 5 7
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3007 4 9 2 ]
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3008 idx.type = "()";
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3009 idx.subs = @{":", 1:2@};
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3010 subsref (val, idx)
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3011 @result{} [ 8 1
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3012 3 5
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3013 4 9 ]
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3014 @end group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3015 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3016
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3017 @noindent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3018 Note that this is the same as writing @code{val(:, 1:2)}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3019
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3020 If @var{idx} is an empty structure array with fields @samp{type} and
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3021 @samp{subs}, return @var{val}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3022 @seealso{subsasgn, substruct}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3023 @end deftypefn */)
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3024 {
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3025 if (args.length () != 2)
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3026 print_usage ();
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3027
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3028 std::string type;
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3029 std::list<octave_value_list> idx;
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3030
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3031 decode_subscripts ("subsref", args(1), type, idx);
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3032
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3033 octave_value arg0 = args(0);
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3034
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3035 if (type.empty ())
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20893
diff changeset
3036 return ovl (arg0);
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3037 else
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20893
diff changeset
3038 return arg0.subsref (type, idx, nargout);
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3039 }
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3040
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3041 DEFUN (subsasgn, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3042 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3043 @deftypefn {} {} subsasgn (@var{val}, @var{idx}, @var{rhs})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3044 Perform the subscripted assignment operation according to the subscript
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3045 specified by @var{idx}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3046
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3047 The subscript @var{idx} must be a structure array with fields @samp{type}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3048 and @samp{subs}. Valid values for @samp{type} are @qcode{"()"},
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3049 @qcode{"@{@}"}, and @qcode{"."}. The @samp{subs} field may be either
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3050 @qcode{":"} or a cell array of index values.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3051
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3052 The following example shows how to set the two first columns of a 3-by-3
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3053 matrix to zero.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3054
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3055 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3056 @group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3057 val = magic (3);
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3058 idx.type = "()";
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3059 idx.subs = @{":", 1:2@};
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3060 subsasgn (val, idx, 0)
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3061 @result{} [ 0 0 6
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3062 0 0 7
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3063 0 0 2 ]
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3064 @end group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3065 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3066
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3067 Note that this is the same as writing @code{val(:, 1:2) = 0}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3068
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3069 If @var{idx} is an empty structure array with fields @samp{type} and
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3070 @samp{subs}, return @var{rhs}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3071 @seealso{subsref, substruct, optimize_subsasgn_calls}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3072 @end deftypefn */)
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3073 {
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3074 if (args.length () != 3)
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3075 print_usage ();
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3076
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3077 std::string type;
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3078 std::list<octave_value_list> idx;
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3079
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3080 decode_subscripts ("subsasgn", args(1), type, idx);
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3081
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3082 if (type.empty ())
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3083 {
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3084 // Regularize a null matrix if stored into a variable.
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20893
diff changeset
3085 return ovl (args(2).storable_value ());
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3086 }
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3087 else
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3088 {
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3089 octave_value arg0 = args(0);
22390
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3090 octave_value arg2 = args(2);
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3091
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3092 arg0.make_unique ();
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3093
22390
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3094 bool arg2_null = arg2.is_zero_by_zero () && arg2.is_double_type ();
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3095
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3096 return ovl (arg0.subsasgn (type, idx, (arg2_null
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3097 ? octave_null_matrix::instance
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3098 : arg2)));
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3099 }
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
3100 }
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3101
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3102 /*
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3103 %!test
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3104 %! a = reshape ([1:25], 5,5);
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3105 %! idx1 = substruct ("()", {3, 3});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3106 %! idx2 = substruct ("()", {2:2:5, 2:2:5});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3107 %! idx3 = substruct ("()", {":", [1,5]});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3108 %! idx4 = struct ("type", {}, "subs", {});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3109 %! assert (subsref (a, idx1), 13);
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3110 %! assert (subsref (a, idx2), [7 17; 9 19]);
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3111 %! assert (subsref (a, idx3), [1:5; 21:25]');
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3112 %! assert (subsref (a, idx4), a);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3113 %! a = subsasgn (a, idx1, 0);
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3114 %! a = subsasgn (a, idx2, 0);
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3115 %! a = subsasgn (a, idx3, 0);
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3116 %!# a = subsasgn (a, idx4, 0);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3117 %! b = [0 6 11 16 0
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3118 %! 0 0 12 0 0
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3119 %! 0 8 0 18 0
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3120 %! 0 0 14 0 0
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3121 %! 0 10 15 20 0];
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3122 %! assert (a, b);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3123
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3124 %!test
22390
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3125 %! x = 1:10;
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3126 %! assert (subsasgn (x, substruct ("()", {1}), zeros (0, 0)), 2:10);
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3127
6cbbd550aa91 allow subsasgn (x, idx, zeros(0,0)) to remove elements (bug #48867)
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
3128 %!test
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3129 %! c = num2cell (reshape ([1:25],5,5));
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3130 %! idx1 = substruct ("{}", {3, 3});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3131 %! idx2 = substruct ("()", {2:2:5, 2:2:5});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3132 %! idx3 = substruct ("()", {":", [1,5]});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3133 %! idx2p = substruct ("{}", {2:2:5, 2:2:5});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3134 %! idx3p = substruct ("{}", {":", [1,5]});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3135 %! idx4 = struct ("type", {}, "subs", {});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3136 %! assert ({ subsref(c, idx1) }, {13});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3137 %! assert ({ subsref(c, idx2p) }, {7 9 17 19});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3138 %! assert ({ subsref(c, idx3p) }, num2cell ([1:5, 21:25]));
14861
f7afecdd87ef maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents: 14528
diff changeset
3139 %! assert (subsref (c, idx4), c);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3140 %! c = subsasgn (c, idx1, 0);
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3141 %! c = subsasgn (c, idx2, 0);
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3142 %! c = subsasgn (c, idx3, 0);
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3143 %!# c = subsasgn (c, idx4, 0);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3144 %! d = {0 6 11 16 0
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3145 %! 0 0 12 0 0
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3146 %! 0 8 0 18 0
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3147 %! 0 0 14 0 0
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3148 %! 0 10 15 20 0};
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3149 %! assert (c, d);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3150
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3151 %!test
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3152 %! s.a = "ohai";
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3153 %! s.b = "dere";
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3154 %! s.c = 42;
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3155 %! idx1 = substruct (".", "a");
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3156 %! idx2 = substruct (".", "b");
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3157 %! idx3 = substruct (".", "c");
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3158 %! idx4 = struct ("type", {}, "subs", {});
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3159 %! assert (subsref (s, idx1), "ohai");
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3160 %! assert (subsref (s, idx2), "dere");
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3161 %! assert (subsref (s, idx3), 42);
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3162 %! assert (subsref (s, idx4), s);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3163 %! s = subsasgn (s, idx1, "Hello");
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3164 %! s = subsasgn (s, idx2, "There");
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3165 %! s = subsasgn (s, idx3, 163);
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3166 %!# s = subsasgn (s, idx4, 163);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3167 %! t.a = "Hello";
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3168 %! t.b = "There";
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3169 %! t.c = 163;
13932
6ead4dc1ca55 subsref, subsasgn: allow empty subscript structs
John W. Eaton <jwe@octave.org>
parents: 13793
diff changeset
3170 %! assert (s, t);
13100
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3171 */
06bf445ee778 Add 6 tests for ov.cc
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 12642
diff changeset
3172
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3173 DEFUN (is_sq_string, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3174 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3175 @deftypefn {} {} is_sq_string (@var{x})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3176 Return true if @var{x} is a single-quoted character string.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3177 @seealso{is_dq_string, ischar}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3178 @end deftypefn */)
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3179 {
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3180 if (args.length () != 1)
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3181 print_usage ();
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3182
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20893
diff changeset
3183 return ovl (args(0).is_sq_string ());
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3184 }
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3185
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3186 /*
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3187 %!assert (is_sq_string ('foo'), true)
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3188 %!assert (is_sq_string ("foo"), false)
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3189 %!assert (is_sq_string (1.0), false)
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3190 %!assert (is_sq_string ({2.0}), false)
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3191
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3192 %!error is_sq_string ()
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3193 %!error is_sq_string ('foo', 2)
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3194 */
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3195
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3196 DEFUN (is_dq_string, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3197 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3198 @deftypefn {} {} is_dq_string (@var{x})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3199 Return true if @var{x} is a double-quoted character string.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3200 @seealso{is_sq_string, ischar}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3201 @end deftypefn */)
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3202 {
20797
492738d32c60 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20785
diff changeset
3203 if (args.length () != 1)
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3204 print_usage ();
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3205
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20893
diff changeset
3206 return ovl (args(0).is_dq_string ());
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3207 }
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3208
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3209 /*
14429
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3210 %!assert (is_dq_string ("foo"), true)
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3211 %!assert (is_dq_string ('foo'), false)
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3212 %!assert (is_dq_string (1.0), false)
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3213 %!assert (is_dq_string ({2.0}), false)
eff4a5933e28 Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14360
diff changeset
3214
13712
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3215 %!error is_dq_string ()
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3216 %!error is_dq_string ("foo", 2)
f80473f24553 new functions is_sq_string and is_dq_string
John W. Eaton <jwe@octave.org>
parents: 13294
diff changeset
3217 */
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3218
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3219 DEFUN (disable_permutation_matrix, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3220 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3221 @deftypefn {} {@var{val} =} disable_permutation_matrix ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3222 @deftypefnx {} {@var{old_val} =} disable_permutation_matrix (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3223 @deftypefnx {} {} disable_permutation_matrix (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3224 Query or set the internal variable that controls whether permutation
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3225 matrices are stored in a special space-efficient format.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3226
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3227 The default value is true. If this option is disabled Octave will store
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3228 permutation matrices as full matrices.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3229
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3230 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3231 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3232 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3233 @seealso{disable_range, disable_diagonal_matrix}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3234 @end deftypefn */)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3235 {
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3236 return SET_INTERNAL_VARIABLE (disable_permutation_matrix);
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3237 }
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3238
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3239 /*
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3240 %!function p = __test_dpm__ (dpm)
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3241 %! disable_permutation_matrix (dpm, "local");
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3242 %! [~, ~, p] = lu ([1,2;3,4]);
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3243 %!endfunction
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3244
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3245 %!assert (typeinfo (__test_dpm__ (false)), "permutation matrix")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3246 %!assert (typeinfo (__test_dpm__ (true)), "matrix")
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3247 */
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3248
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3249 DEFUN (disable_diagonal_matrix, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3250 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3251 @deftypefn {} {@var{val} =} disable_diagonal_matrix ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3252 @deftypefnx {} {@var{old_val} =} disable_diagonal_matrix (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3253 @deftypefnx {} {} disable_diagonal_matrix (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3254 Query or set the internal variable that controls whether diagonal
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3255 matrices are stored in a special space-efficient format.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3256
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3257 The default value is true. If this option is disabled Octave will store
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3258 diagonal matrices as full matrices.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3259
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3260 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3261 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3262 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3263 @seealso{disable_range, disable_permutation_matrix}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3264 @end deftypefn */)
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3265 {
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3266 return SET_INTERNAL_VARIABLE (disable_diagonal_matrix);
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3267 }
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3268
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3269 /*
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3270 %!function [x, xi, fx, fxi] = __test_ddm__ (ddm)
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3271 %! disable_diagonal_matrix (ddm, "local");
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3272 %! x = eye (2);
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3273 %! xi = x*i;
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3274 %! fx = single (x);
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3275 %! fxi = single (xi);
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3276 %!endfunction
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3277
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3278 %!shared x, xi, fx, fxi
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3279 %! [x, xi, fx, fxi] = __test_ddm__ (false);
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3280 %!assert (typeinfo (x), "diagonal matrix")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3281 %!assert (typeinfo (xi), "complex diagonal matrix")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3282 %!assert (typeinfo (fx), "float diagonal matrix")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3283 %!assert (typeinfo (fxi), "float complex diagonal matrix")
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3284
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3285 %!shared x, xi, fx, fxi
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3286 %! [x, xi, fx, fxi] = __test_ddm__ (true);
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3287 %!assert (typeinfo (x), "matrix")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3288 %!assert (typeinfo (xi), "complex matrix")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3289 %!assert (typeinfo (fx), "float matrix")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3290 %!assert (typeinfo (fxi), "float complex matrix")
19391
385499581a5e allow disabling of permutation and diagonal matrices
John W. Eaton <jwe@octave.org>
parents: 18537
diff changeset
3291 */
19394
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3292
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3293 DEFUN (disable_range, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3294 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3295 @deftypefn {} {@var{val} =} disable_range ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3296 @deftypefnx {} {@var{old_val} =} disable_range (@var{new_val})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3297 @deftypefnx {} {} disable_range (@var{new_val}, "local")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3298 Query or set the internal variable that controls whether ranges are stored
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3299 in a special space-efficient format.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3300
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3301 The default value is true. If this option is disabled Octave will store
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3302 ranges as full matrices.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3303
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3304 When called from inside a function with the @qcode{"local"} option, the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3305 variable is changed locally for the function and any subroutines it calls.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3306 The original variable value is restored when exiting the function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3307 @seealso{disable_diagonal_matrix, disable_permutation_matrix}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
3308 @end deftypefn */)
19394
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3309 {
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3310 return SET_INTERNAL_VARIABLE (disable_range);
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3311 }
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3312
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3313 /*
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3314 %!function r = __test_dr__ (dr)
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3315 %! disable_range (dr, "local");
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3316 %! ## Constant folding will produce range for 1:13.
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3317 %! base = 1;
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3318 %! limit = 13;
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3319 %! r = base:limit;
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3320 %!endfunction
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3321
21317
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3322 %!assert (typeinfo (__test_dr__ (false)), "range")
a4faec57f4c8 maint: remove semicolon after %!assert tests to follow Octave conventions.
Rik <rik@octave.org>
parents: 21301
diff changeset
3323 %!assert (typeinfo (__test_dr__ (true)), "matrix")
19394
b39cbe9f3bb0 allow ranges to be disabled
John W. Eaton <jwe@octave.org>
parents: 19391
diff changeset
3324 */