annotate liboctave/array/Array.h @ 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 980f39c3ab90
children ce2eb28e0a6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
1 /*
ee01ac1c7acc [project @ 1993-11-16 09:56:54 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) 1993-2017 John W. Eaton
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11507
diff changeset
4 Copyright (C) 2008-2009 Jaroslav Hajek
10521
4d1fc073fbb7 add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents: 10366
diff changeset
5 Copyright (C) 2010 VZLU Prague
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
6
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
7 This file is part of Octave.
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
8
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23795
diff changeset
9 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
10 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: 23795
diff changeset
11 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
12 (at your option) any later version.
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
13
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
15 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
17 GNU General Public License for more details.
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
18
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
19 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: 6884
diff changeset
20 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: 23795
diff changeset
21 <https://www.gnu.org/licenses/>.
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
22
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
23 */
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
24
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20232
diff changeset
25 #if ! defined (octave_Array_h)
382
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 376
diff changeset
26 #define octave_Array_h 1
e02d6b664394 [project @ 1994-03-09 21:08:03 by jwe]
jwe
parents: 376
diff changeset
27
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
28 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21229
diff changeset
29
1366
f75432dff006 [project @ 1995-09-05 23:56:42 by jwe]
jwe
parents: 1359
diff changeset
30 #include <cassert>
4152
f14251d33b01 [project @ 2002-11-06 18:41:50 by jwe]
jwe
parents: 4066
diff changeset
31 #include <cstddef>
3613
0a93682f89c8 [project @ 2000-03-17 10:58:25 by jwe]
jwe
parents: 3585
diff changeset
32
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8503
diff changeset
33 #include <algorithm>
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
34 #include <iosfwd>
23443
3f1bf237908b maint: Eliminate <cfloat.h> header from liboctave files.
Rik <rik@octave.org>
parents: 23420
diff changeset
35 #include <string>
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
36
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
37 #include "dim-vector.h"
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
38 #include "idx-vector.h"
22139
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
39 #include "lo-error.h"
8725
d5af326a3ede [mq]: sort-traits
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
40 #include "lo-traits.h"
3613
0a93682f89c8 [project @ 2000-03-17 10:58:25 by jwe]
jwe
parents: 3585
diff changeset
41 #include "lo-utils.h"
23443
3f1bf237908b maint: Eliminate <cfloat.h> header from liboctave files.
Rik <rik@octave.org>
parents: 23420
diff changeset
42 #include "oct-refcount.h"
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
43 #include "oct-sort.h"
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
44 #include "quit.h"
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
45
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
46 //! N Dimensional Array with copy-on-write semantics.
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
47 /*!
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
48 The Array class is at the root of Octave. It provides a container
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
49 with an arbitrary number of dimensions. The operator () provides
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
50 access to individual elements via subscript and linear indexing.
22276
dd0d2a27e5b3 doc: fix indexing note on doxygen docs for Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22273
diff changeset
51 Indexing starts at 0. Arrays are column-major order as in Fortran.
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
52
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
53 @code{.cc}
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
54 // 3 D Array with 10 rows, 20 columns, and 5 pages, filled with 7.0
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
55 Array<double> A Array<double (dim_vector (10, 20, 5), 7.0);
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
56
22276
dd0d2a27e5b3 doc: fix indexing note on doxygen docs for Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22273
diff changeset
57 // set value for row 0, column 10, and page 3
dd0d2a27e5b3 doc: fix indexing note on doxygen docs for Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22273
diff changeset
58 A(0, 10, 3) = 2.5;
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
59
22276
dd0d2a27e5b3 doc: fix indexing note on doxygen docs for Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22273
diff changeset
60 // get value for row 1, column 2, and page 0
dd0d2a27e5b3 doc: fix indexing note on doxygen docs for Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22273
diff changeset
61 double v = A(1, 2, 0);
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
62
22276
dd0d2a27e5b3 doc: fix indexing note on doxygen docs for Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22273
diff changeset
63 // get value for 25th element (row 4, column 3, page 1)
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
64 double v = A(24);
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
65 @endcode
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
66
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
67 ## Notes on STL compatibility
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
68
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
69 ### size() and length()
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
70
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
71 To access the total number of elements in an Array, use numel()
22279
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
72 which is short for number of elements and is equivalent to the
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
73 Octave function with same name.
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
74
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
75 @code{.cc}
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
76 Array<int> A (dim_vector (10, 20, 4), 1);
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
77
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
78 octave_idx_type n = A.numel (); // returns 800 (10x20x4)
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
79
22279
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
80 octave_idx_type nr = A.size (0); // returns 10 (number of rows/dimension 0)
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
81 octave_idx_type nc = A.size (1); // returns 20 (number of columns)
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
82 octave_idx_type nc = A.size (2); // returns 4 (size of dimension 3)
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
83 octave_idx_type l6 = A.size (6); // returns 1 (implicit singleton dimension)
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
84
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
85 // Alternatively, get a dim_vector which represents the dimensions.
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
86 dim_vector dims = A.dims ();
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
87 @endcode
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
88
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
89 The methods size() and length() as they exist in the STL cause
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
90 confusion in the context of a N dimensional array.
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
91
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
92 The size() of an array is the length of all dimensions. In Octave,
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
93 the size() function returns a row vector with the length of each
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
94 dimension, or the size of a specific dimension. Only the latter is
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
95 present in liboctave.
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
96
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
97 Since there is more than 1 dimension, length() would not make sense
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
98 without expliciting which dimension. If the function existed, which
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
99 length should it return? Octave length() function returns the length
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
100 of the longest dimension which is an odd definition, only useful for
22279
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
101 vectors and square matrices. The alternatives numel(), rows(),
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
102 columns(), and size(d) are more explict and recommended.
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
103
22279
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
104 ### size_type
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
105
22279
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
106 Array::size_type is `octave_idx_type` which is a typedef for `int`
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
107 or `long int`, depending whether Octave was configured for 64-bit
22273
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
108 indexing.
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
109
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
110 This is a signed integer which may cause problems when mixed with
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
111 STL containers. The reason is that Octave interacts with Fortran
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
112 routines, providing an interface many Fortran numeric libraries.
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
113
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
114 ## Subclasses
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
115
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
116 The following subclasses specializations, will be of most use:
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
117 - Matrix: Array<double> with only 2 dimensions
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
118 - ComplexMatrix: Array<std::complex<double>> with only 2 dimensions
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
119 - boolNDArray: N dimensional Array<bool>
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
120 - ColumnVector: Array<double> with 1 column
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
121 - string_vector: Array<std::string> with 1 column
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
122 - Cell: Array<octave_value>, equivalent to an Octave cell.
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
123
91c5442ea9fd doc: doxygen explaining Array<T>.
Carnë Draug <carandraug@octave.org>
parents: 22139
diff changeset
124 */
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
125 template <typename T>
3585
d9803711e047 [project @ 2000-02-08 04:35:39 by jwe]
jwe
parents: 3569
diff changeset
126 class
d9803711e047 [project @ 2000-02-08 04:35:39 by jwe]
jwe
parents: 3569
diff changeset
127 Array
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
128 {
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 2847
diff changeset
129 protected:
1619
1a35c8c91349 [project @ 1995-11-04 11:07:21 by jwe]
jwe
parents: 1574
diff changeset
130
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
131 //! The real representation of all arrays.
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
132 class ArrayRep
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
133 {
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
134 public:
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
135
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
136 T *data;
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
137 octave_idx_type len;
23012
27e4ec3b0b49 move octave_refcount inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
138 octave::refcount<int> count;
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
139
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
140 ArrayRep (T *d, octave_idx_type l)
19381
af41e41ad28e replace oct-mem.h inline indirections by standard function calls.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19330
diff changeset
141 : data (new T [l]), len (l), count (1)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
142 {
23420
1fee389bd04b Use std::copy_n rather than std::copy for clarity in liboctave/array.
Rik <rik@octave.org>
parents: 23401
diff changeset
143 std::copy_n (d, l, data);
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
144 }
10364
96ed7c629bbd remove dangerous pointer-acquiring Array ctors
Jaroslav Hajek <highegg@gmail.com>
parents: 10358
diff changeset
145
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
146 template <typename U>
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
147 ArrayRep (U *d, octave_idx_type l)
19381
af41e41ad28e replace oct-mem.h inline indirections by standard function calls.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19330
diff changeset
148 : data (new T [l]), len (l), count (1)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
149 {
23420
1fee389bd04b Use std::copy_n rather than std::copy for clarity in liboctave/array.
Rik <rik@octave.org>
parents: 23401
diff changeset
150 std::copy_n (d, l, data);
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
151 }
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
152
23401
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23386
diff changeset
153 // Use new instead of setting data to 0 so that fortran_vec and
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23386
diff changeset
154 // data always return valid addresses, even for zero-size arrays.
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23386
diff changeset
155
e0c20a22da7e eliminate some errors exposed by -fsanitize=undefined
John W. Eaton <jwe@octave.org>
parents: 23386
diff changeset
156 ArrayRep (void) : data (new T [0]), len (0), count (1) { }
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
157
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
158 explicit ArrayRep (octave_idx_type n)
19381
af41e41ad28e replace oct-mem.h inline indirections by standard function calls.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19330
diff changeset
159 : data (new T [n]), len (n), count (1) { }
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
160
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
161 explicit ArrayRep (octave_idx_type n, const T& val)
19381
af41e41ad28e replace oct-mem.h inline indirections by standard function calls.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19330
diff changeset
162 : data (new T [n]), len (n), count (1)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
163 {
19381
af41e41ad28e replace oct-mem.h inline indirections by standard function calls.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19330
diff changeset
164 std::fill_n (data, n, val);
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
165 }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
166
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
167 ArrayRep (const ArrayRep& a)
19381
af41e41ad28e replace oct-mem.h inline indirections by standard function calls.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19330
diff changeset
168 : data (new T [a.len]), len (a.len), count (1)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
169 {
23420
1fee389bd04b Use std::copy_n rather than std::copy for clarity in liboctave/array.
Rik <rik@octave.org>
parents: 23401
diff changeset
170 std::copy_n (a.data, a.len, data);
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
171 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
172
19381
af41e41ad28e replace oct-mem.h inline indirections by standard function calls.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19330
diff changeset
173 ~ArrayRep (void) { delete [] data; }
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
174
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20229
diff changeset
175 octave_idx_type numel (void) const { return len; }
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
176
4517
b4449b1193ac [project @ 2003-09-20 02:06:06 by jwe]
jwe
parents: 4513
diff changeset
177 private:
b4449b1193ac [project @ 2003-09-20 02:06:06 by jwe]
jwe
parents: 4513
diff changeset
178
b4449b1193ac [project @ 2003-09-20 02:06:06 by jwe]
jwe
parents: 4513
diff changeset
179 // No assignment!
b4449b1193ac [project @ 2003-09-20 02:06:06 by jwe]
jwe
parents: 4513
diff changeset
180
b4449b1193ac [project @ 2003-09-20 02:06:06 by jwe]
jwe
parents: 4513
diff changeset
181 ArrayRep& operator = (const ArrayRep& a);
1735
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
182 };
d2ee993d40cd [project @ 1996-01-12 07:46:09 by jwe]
jwe
parents: 1703
diff changeset
183
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
184 //--------------------------------------------------------------------
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
185
6884
1cbb8b606d63 [project @ 2007-09-10 20:43:26 by jwe]
jwe
parents: 6881
diff changeset
186 public:
1cbb8b606d63 [project @ 2007-09-10 20:43:26 by jwe]
jwe
parents: 6881
diff changeset
187
9556
948795dc1974 make a few Array methods inline
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
188 void make_unique (void)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
189 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
190 if (rep->count > 1)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
191 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
192 ArrayRep *r = new ArrayRep (slice_data, slice_len);
13985
43cc49c7abd1 Use thread-safe atomic reference counting (GCC and MSVC).
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12125
diff changeset
193
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
194 if (--rep->count == 0)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
195 delete rep;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
196
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
197 rep = r;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
198 slice_data = rep->data;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
199 }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
200 }
238
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 228
diff changeset
201
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5775
diff changeset
202 typedef T element_type;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5775
diff changeset
203
22279
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
204 typedef T value_type;
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
205
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
206 //! Used for operator(), and returned by numel() and size()
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
207 //! (beware: signed integer)
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
208 typedef octave_idx_type size_type;
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
209
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9921
diff changeset
210 typedef typename ref_param<T>::type crefT;
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9921
diff changeset
211
8725
d5af326a3ede [mq]: sort-traits
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
212 typedef bool (*compare_fcn_type) (typename ref_param<T>::type,
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
213 typename ref_param<T>::type);
8725
d5af326a3ede [mq]: sort-traits
John W. Eaton <jwe@octave.org>
parents: 8721
diff changeset
214
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8523
diff changeset
215 protected:
4902
bd043a433918 [project @ 2004-06-14 18:46:20 by jwe]
jwe
parents: 4834
diff changeset
216
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
217 dim_vector dimensions;
4518
382cb0ed8c14 [project @ 2003-09-20 18:08:40 by jwe]
jwe
parents: 4517
diff changeset
218
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
219 typename Array<T>::ArrayRep *rep;
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
220
8531
b01fef323c24 add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents: 8524
diff changeset
221 // Rationale:
b01fef323c24 add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents: 8524
diff changeset
222 // slice_data is a pointer to rep->data, denoting together with slice_len the
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
223 // actual portion of the data referenced by this Array<T> object. This
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
224 // allows to make shallow copies not only of a whole array, but also of
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
225 // contiguous subranges. Every time rep is directly manipulated, slice_data
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
226 // and slice_len need to be properly updated.
8531
b01fef323c24 add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents: 8524
diff changeset
227
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23446
diff changeset
228 T *slice_data;
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8503
diff changeset
229 octave_idx_type slice_len;
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8503
diff changeset
230
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
231 //! slice constructor
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8503
diff changeset
232 Array (const Array<T>& a, const dim_vector& dv,
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8503
diff changeset
233 octave_idx_type l, octave_idx_type u)
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
234 : dimensions (dv), rep(a.rep), slice_data (a.slice_data+l), slice_len (u-l)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
235 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
236 rep->count++;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
237 dimensions.chop_trailing_singletons ();
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
238 }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
239
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
240 private:
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
241
21573
f3f8e1d3e399 avoid mulitple definitions of static function-scope vars (bug #47372)
John W. Eaton <jwe@octave.org>
parents: 20212
diff changeset
242 static typename Array<T>::ArrayRep *nil_rep (void);
238
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 228
diff changeset
243
14951
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
244 protected:
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
245
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
246 //! For jit support
14951
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
247 Array (T *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep)
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
248 : dimensions (adims),
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
249 rep (reinterpret_cast<typename Array<T>::ArrayRep *> (arep)),
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
250 slice_data (sdata), slice_len (slen) { }
14951
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
251
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
252 public:
238
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 228
diff changeset
253
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
254 //! Empty ctor (0 by 0).
1550
d89532de8e72 [project @ 1995-10-08 01:12:20 by jwe]
jwe
parents: 1366
diff changeset
255 Array (void)
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
256 : dimensions (), rep (nil_rep ()), slice_data (rep->data),
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
257 slice_len (rep->len)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
258 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
259 rep->count++;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
260 }
1550
d89532de8e72 [project @ 1995-10-08 01:12:20 by jwe]
jwe
parents: 1366
diff changeset
261
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
262 //! nD uninitialized ctor.
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
263 explicit Array (const dim_vector& dv)
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
264 : dimensions (dv),
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
265 rep (new typename Array<T>::ArrayRep (dv.safe_numel ())),
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
266 slice_data (rep->data), slice_len (rep->len)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
267 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
268 dimensions.chop_trailing_singletons ();
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
269 }
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
270
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
271 //! nD initialized ctor.
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
272 explicit Array (const dim_vector& dv, const T& val)
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
273 : dimensions (dv),
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
274 rep (new typename Array<T>::ArrayRep (dv.safe_numel ())),
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
275 slice_data (rep->data), slice_len (rep->len)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
276 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
277 fill (val);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
278 dimensions.chop_trailing_singletons ();
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
279 }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
280
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
281 //! Reshape constructor.
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
282 Array (const Array<T>& a, const dim_vector& dv);
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
283
22139
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
284 //! Constructor from standard library sequence containers.
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
285 template<template <typename...> class Container>
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
286 Array (const Container<T>& a, const dim_vector& dv);
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
287
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
288 //! Type conversion case.
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
289 template <typename U>
4902
bd043a433918 [project @ 2004-06-14 18:46:20 by jwe]
jwe
parents: 4834
diff changeset
290 Array (const Array<U>& a)
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
291 : dimensions (a.dims ()),
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20229
diff changeset
292 rep (new typename Array<T>::ArrayRep (a.data (), a.numel ())),
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
293 slice_data (rep->data), slice_len (rep->len)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
294 { }
4902
bd043a433918 [project @ 2004-06-14 18:46:20 by jwe]
jwe
parents: 4834
diff changeset
295
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
296 //! No type conversion case.
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
297 Array (const Array<T>& a)
11507
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
298 : dimensions (a.dimensions), rep (a.rep), slice_data (a.slice_data),
c3ad80f4ce36 Array.h, Array.cc: more constructor fixes
John W. Eaton <jwe@octave.org>
parents: 11010
diff changeset
299 slice_len (a.slice_len)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
300 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
301 rep->count++;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
302 }
1550
d89532de8e72 [project @ 1995-10-08 01:12:20 by jwe]
jwe
parents: 1366
diff changeset
303
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
304 public:
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
305
15216
dd7c37ceb800 avoid GCC warning by declaring Array destructor virtual
John W. Eaton <jwe@octave.org>
parents: 15212
diff changeset
306 virtual ~Array (void)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
307 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
308 if (--rep->count == 0)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
309 delete rep;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
310 }
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
311
9556
948795dc1974 make a few Array methods inline
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
312 Array<T>& operator = (const Array<T>& a)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
313 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
314 if (this != &a)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
315 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
316 if (--rep->count == 0)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
317 delete rep;
9556
948795dc1974 make a few Array methods inline
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
318
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
319 rep = a.rep;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
320 rep->count++;
9556
948795dc1974 make a few Array methods inline
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
321
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
322 dimensions = a.dimensions;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
323 slice_data = a.slice_data;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
324 slice_len = a.slice_len;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
325 }
9556
948795dc1974 make a few Array methods inline
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
326
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
327 return *this;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
328 }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
329
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
330 void fill (const T& val);
9624
3fc7272937ce implement Array<T>::clear overloads
Jaroslav Hajek <highegg@gmail.com>
parents: 9556
diff changeset
331
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9341
diff changeset
332 void clear (void);
9624
3fc7272937ce implement Array<T>::clear overloads
Jaroslav Hajek <highegg@gmail.com>
parents: 9556
diff changeset
333 void clear (const dim_vector& dv);
3fc7272937ce implement Array<T>::clear overloads
Jaroslav Hajek <highegg@gmail.com>
parents: 9556
diff changeset
334
3fc7272937ce implement Array<T>::clear overloads
Jaroslav Hajek <highegg@gmail.com>
parents: 9556
diff changeset
335 void clear (octave_idx_type r, octave_idx_type c)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
336 { clear (dim_vector (r, c)); }
238
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 228
diff changeset
337
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
338 // Number of elements in the array. These are all synonyms.
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
339 //@{
20212
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
340 //! Number of elements in the array.
20228
00cf2847355d Deprecate Array::nelem() and Range::nelem() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20212
diff changeset
341 //! Synonymous with numel().
20229
5dfaaaae784f Deprecate Array::capacity() and Sparse::capacity() for numel() and nzmax().
Carnë Draug <carandraug@octave.org>
parents: 20228
diff changeset
342 //! @note This method is deprecated in favour of numel().
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
343 OCTAVE_DEPRECATED (4.4, "use 'numel' instead")
21134
2e5c1f766ac9 provide replacement hints for deprecated C++ functions
John W. Eaton <jwe@octave.org>
parents: 21131
diff changeset
344 octave_idx_type capacity (void) const { return numel (); }
20212
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
345
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
346 //! Number of elements in the array.
20229
5dfaaaae784f Deprecate Array::capacity() and Sparse::capacity() for numel() and nzmax().
Carnë Draug <carandraug@octave.org>
parents: 20228
diff changeset
347 /*! Synonymous with numel().
20228
00cf2847355d Deprecate Array::nelem() and Range::nelem() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20212
diff changeset
348 @note This method is deprecated in favour of numel().
20212
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
349
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
350 @note
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
351 This is @em not the same as @c %length() at the Octave interpreter.
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
352 At the Octave interpreter, the function @c %length() returns the
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
353 length of the greatest dimension. This method returns the total
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
354 number of elements.
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
355 */
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
356 OCTAVE_DEPRECATED (4.4, "use 'numel' instead")
21134
2e5c1f766ac9 provide replacement hints for deprecated C++ functions
John W. Eaton <jwe@octave.org>
parents: 21131
diff changeset
357 octave_idx_type length (void) const { return numel (); }
20212
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
358
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
359 //! Number of elements in the array.
20229
5dfaaaae784f Deprecate Array::capacity() and Sparse::capacity() for numel() and nzmax().
Carnë Draug <carandraug@octave.org>
parents: 20228
diff changeset
360 //! Synonymous with numel().
20228
00cf2847355d Deprecate Array::nelem() and Range::nelem() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20212
diff changeset
361 //! @note This method is deprecated in favour of numel().
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
362 OCTAVE_DEPRECATED (4.4, "use 'numel' instead")
21134
2e5c1f766ac9 provide replacement hints for deprecated C++ functions
John W. Eaton <jwe@octave.org>
parents: 21131
diff changeset
363 octave_idx_type nelem (void) const { return numel (); }
20212
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
364
6af35d4f1ba4 doxygen: document Array::length() and similar methods (bug #45138)
Piotr Held <pjheld@gmail.com>
parents: 19861
diff changeset
365 //! Number of elements in the array.
20228
00cf2847355d Deprecate Array::nelem() and Range::nelem() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20212
diff changeset
366 octave_idx_type numel (void) const { return slice_len; }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
367 //@}
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
368
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
369 //! Return the array as a column vector.
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
370 Array<T> as_column (void) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
371 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
372 Array<T> retval (*this);
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21574
diff changeset
373 if (dimensions.ndims () != 2 || dimensions(1) != 1)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
374 retval.dimensions = dim_vector (numel (), 1);
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
375
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
376 return retval;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
377 }
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
378
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
379 //! Return the array as a row vector.
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
380 Array<T> as_row (void) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
381 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
382 Array<T> retval (*this);
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21574
diff changeset
383 if (dimensions.ndims () != 2 || dimensions(0) != 1)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
384 retval.dimensions = dim_vector (1, numel ());
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
385
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
386 return retval;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
387 }
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
388
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
389 //! Return the array as a matrix.
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
390 Array<T> as_matrix (void) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
391 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
392 Array<T> retval (*this);
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21574
diff changeset
393 if (dimensions.ndims () != 2)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
394 retval.dimensions = dimensions.redim (2);
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
395
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
396 return retval;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
397 }
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
398
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
399 //! @name First dimension
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19326
diff changeset
400 //!
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
401 //! Get the first dimension of the array (number of rows)
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
402 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
403 octave_idx_type dim1 (void) const { return dimensions(0); }
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
404 octave_idx_type rows (void) const { return dim1 (); }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
405 //@}
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
406
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
407 //! @name Second dimension
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
408 //!
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
409 //! Get the second dimension of the array (number of columns)
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
410 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
411 octave_idx_type dim2 (void) const { return dimensions(1); }
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
412 octave_idx_type cols (void) const { return dim2 (); }
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
413 octave_idx_type columns (void) const { return dim2 (); }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
414 //@}
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
415
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
416 //! @name Third dimension
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19326
diff changeset
417 //!
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
418 //! Get the third dimension of the array (number of pages)
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
419 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
420 octave_idx_type dim3 (void) const { return dimensions(2); }
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
421 octave_idx_type pages (void) const { return dim3 (); }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
422 //@}
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
423
22279
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
424 //! Size of the specified dimension.
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
425 /*!
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
426 Dimensions beyond the Array number of dimensions return 1 as
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
427 those are implicit singleton dimensions.
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
428
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
429 Equivalent to Octave's `size (A, DIM)`
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
430 */
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
431 size_type size (const size_type d) const
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
432 {
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
433 // Should we throw for negative values?
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
434 // Should >= ndims () be handled by dim_vector operator() instead ?
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
435 return d >= ndims () ? 1 : dimensions(d);
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
436 }
3bb1dc8b723e Array: new typedef size_type and value_type, and new method size(dimension).
Carnë Draug <carandraug@octave.org>
parents: 22276
diff changeset
437
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
438 size_t byte_size (void) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
439 { return static_cast<size_t> (numel ()) * sizeof (T); }
4902
bd043a433918 [project @ 2004-06-14 18:46:20 by jwe]
jwe
parents: 4834
diff changeset
440
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
441 //! Return a const-reference so that dims ()(i) works efficiently.
9026
6890d411a0b8 adjust some array dim query methods
Jaroslav Hajek <highegg@gmail.com>
parents: 9025
diff changeset
442 const dim_vector& dims (void) const { return dimensions; }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
443
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
444 //! Chop off leading singleton dimensions
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4530
diff changeset
445 Array<T> squeeze (void) const;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
446
10366
e5ae13b8b2c2 improve Array indexing error messages
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
447 octave_idx_type compute_index (octave_idx_type i, octave_idx_type j) const;
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
448 octave_idx_type compute_index (octave_idx_type i, octave_idx_type j,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
449 octave_idx_type k) const;
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
450 octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx) const;
4517
b4449b1193ac [project @ 2003-09-20 02:06:06 by jwe]
jwe
parents: 4513
diff changeset
451
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
452 octave_idx_type compute_index_unchecked (const Array<octave_idx_type>& ra_idx)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
453 const
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20229
diff changeset
454 { return dimensions.compute_index (ra_idx.data (), ra_idx.numel ()); }
10645
8645b7087859 abstract scalar index checking off Array<T> (prep for struct optimizations)
Jaroslav Hajek <highegg@gmail.com>
parents: 10636
diff changeset
455
2108
2b67abb63030 [project @ 1996-04-30 10:44:17 by jwe]
jwe
parents: 2049
diff changeset
456 // No checking, even for multiple references, ever.
2b67abb63030 [project @ 1996-04-30 10:44:17 by jwe]
jwe
parents: 2049
diff changeset
457
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14981
diff changeset
458 T& xelem (octave_idx_type n) { return slice_data[n]; }
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14981
diff changeset
459 crefT xelem (octave_idx_type n) const { return slice_data[n]; }
2108
2b67abb63030 [project @ 1996-04-30 10:44:17 by jwe]
jwe
parents: 2049
diff changeset
460
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
461 T& xelem (octave_idx_type i, octave_idx_type j)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
462 { return xelem (dim1 ()*j+i); }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
463 crefT xelem (octave_idx_type i, octave_idx_type j) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
464 { return xelem (dim1 ()*j+i); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
465
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
466 T& xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
467 { return xelem (i, dim2 ()*k+j); }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11574
diff changeset
468 crefT xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
469 { return xelem (i, dim2 ()*k+j); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
470
6867
83619ae96c1d [project @ 2007-09-06 12:08:44 by dbateman]
dbateman
parents: 6708
diff changeset
471 T& xelem (const Array<octave_idx_type>& ra_idx)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
472 { return xelem (compute_index_unchecked (ra_idx)); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
473
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9921
diff changeset
474 crefT xelem (const Array<octave_idx_type>& ra_idx) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
475 { return xelem (compute_index_unchecked (ra_idx)); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
476
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
477 // FIXME: would be nice to fix this so that we don't unnecessarily force
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
478 // a copy, but that is not so easy, and I see no clean way to do it.
2006
95e952f72d66 [project @ 1996-03-04 00:33:32 by jwe]
jwe
parents: 2005
diff changeset
479
10366
e5ae13b8b2c2 improve Array indexing error messages
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
480 T& checkelem (octave_idx_type n);
23487
af2f1f3dbe06 eliminate --enable-bounds-check configure option
John W. Eaton <jwe@octave.org>
parents: 23461
diff changeset
481
10366
e5ae13b8b2c2 improve Array indexing error messages
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
482 T& checkelem (octave_idx_type i, octave_idx_type j);
23487
af2f1f3dbe06 eliminate --enable-bounds-check configure option
John W. Eaton <jwe@octave.org>
parents: 23461
diff changeset
483
10366
e5ae13b8b2c2 improve Array indexing error messages
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
484 T& checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k);
23487
af2f1f3dbe06 eliminate --enable-bounds-check configure option
John W. Eaton <jwe@octave.org>
parents: 23461
diff changeset
485
10366
e5ae13b8b2c2 improve Array indexing error messages
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
486 T& checkelem (const Array<octave_idx_type>& ra_idx);
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
487
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
488 T& elem (octave_idx_type n)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
489 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
490 make_unique ();
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
491 return xelem (n);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
492 }
2306
2fbf9bb1cd7a [project @ 1996-07-09 16:49:03 by jwe]
jwe
parents: 2109
diff changeset
493
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14616
diff changeset
494 T& elem (octave_idx_type i, octave_idx_type j) { return elem (dim1 ()*j+i); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
495
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
496 T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
497 { return elem (i, dim2 ()*k+j); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
498
6867
83619ae96c1d [project @ 2007-09-06 12:08:44 by dbateman]
dbateman
parents: 6708
diff changeset
499 T& elem (const Array<octave_idx_type>& ra_idx)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
500 { return Array<T>::elem (compute_index_unchecked (ra_idx)); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
501
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
502 T& operator () (octave_idx_type n) { return elem (n); }
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
503 T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j); }
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
504 T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
505 { return elem (i, j, k); }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
506 T& operator () (const Array<octave_idx_type>& ra_idx)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
507 { return elem (ra_idx); }
2006
95e952f72d66 [project @ 1996-03-04 00:33:32 by jwe]
jwe
parents: 2005
diff changeset
508
10366
e5ae13b8b2c2 improve Array indexing error messages
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
509 crefT checkelem (octave_idx_type n) const;
23487
af2f1f3dbe06 eliminate --enable-bounds-check configure option
John W. Eaton <jwe@octave.org>
parents: 23461
diff changeset
510
10366
e5ae13b8b2c2 improve Array indexing error messages
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
511 crefT checkelem (octave_idx_type i, octave_idx_type j) const;
23487
af2f1f3dbe06 eliminate --enable-bounds-check configure option
John W. Eaton <jwe@octave.org>
parents: 23461
diff changeset
512
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
513 crefT checkelem (octave_idx_type i, octave_idx_type j,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
514 octave_idx_type k) const;
23487
af2f1f3dbe06 eliminate --enable-bounds-check configure option
John W. Eaton <jwe@octave.org>
parents: 23461
diff changeset
515
10366
e5ae13b8b2c2 improve Array indexing error messages
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
516 crefT checkelem (const Array<octave_idx_type>& ra_idx) const;
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
517
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9921
diff changeset
518 crefT elem (octave_idx_type n) const { return xelem (n); }
2306
2fbf9bb1cd7a [project @ 1996-07-09 16:49:03 by jwe]
jwe
parents: 2109
diff changeset
519
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
520 crefT elem (octave_idx_type i, octave_idx_type j) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
521 { return xelem (i, j); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
522
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
523 crefT elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
524 { return xelem (i, j, k); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
525
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9921
diff changeset
526 crefT elem (const Array<octave_idx_type>& ra_idx) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
527 { return Array<T>::xelem (compute_index_unchecked (ra_idx)); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
528
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9921
diff changeset
529 crefT operator () (octave_idx_type n) const { return elem (n); }
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
530 crefT operator () (octave_idx_type i, octave_idx_type j) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
531 { return elem (i, j); }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
532 crefT operator () (octave_idx_type i, octave_idx_type j,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
533 octave_idx_type k) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
534 { return elem (i, j, k); }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
535 crefT operator () (const Array<octave_idx_type>& ra_idx) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
536 { return elem (ra_idx); }
2006
95e952f72d66 [project @ 1996-03-04 00:33:32 by jwe]
jwe
parents: 2005
diff changeset
537
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
538 // Fast extractors. All of these produce shallow copies.
9731
7b9cbaad68d6 extend Array<T>
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
539
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
540 //! Extract column: A(:,k+1).
9731
7b9cbaad68d6 extend Array<T>
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
541 Array<T> column (octave_idx_type k) const;
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
542 //! Extract page: A(:,:,k+1).
9731
7b9cbaad68d6 extend Array<T>
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
543 Array<T> page (octave_idx_type k) const;
7b9cbaad68d6 extend Array<T>
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
544
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
545 //! Extract a slice from this array as a column vector: A(:)(lo+1:up).
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
546 //! Must be 0 <= lo && up <= numel. May be up < lo.
9731
7b9cbaad68d6 extend Array<T>
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
547 Array<T> linear_slice (octave_idx_type lo, octave_idx_type up) const;
7b9cbaad68d6 extend Array<T>
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
548
10352
a3635bc1ea19 remove Array2
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
549 Array<T> reshape (octave_idx_type nr, octave_idx_type nc) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
550 { return Array<T> (*this, dim_vector (nr, nc)); }
10352
a3635bc1ea19 remove Array2
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
551
9731
7b9cbaad68d6 extend Array<T>
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
552 Array<T> reshape (const dim_vector& new_dims) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
553 { return Array<T> (*this, new_dims); }
4567
fc30061d01da [project @ 2003-10-29 20:11:15 by jwe]
jwe
parents: 4559
diff changeset
554
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
555 Array<T> permute (const Array<octave_idx_type>& vec, bool inv = false) const;
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
556 Array<T> ipermute (const Array<octave_idx_type>& vec) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
557 { return permute (vec, true); }
4593
77566be8b9e9 [project @ 2003-11-11 17:25:42 by jwe]
jwe
parents: 4587
diff changeset
558
23593
a8361bc2361a maint: Deprecate is_square and replace with issquare.
Rik <rik@octave.org>
parents: 23592
diff changeset
559 bool issquare (void) const { return (dim1 () == dim2 ()); }
a8361bc2361a maint: Deprecate is_square and replace with issquare.
Rik <rik@octave.org>
parents: 23592
diff changeset
560
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
561 OCTAVE_DEPRECATED (4.4, "use 'issquare' instead")
23593
a8361bc2361a maint: Deprecate is_square and replace with issquare.
Rik <rik@octave.org>
parents: 23592
diff changeset
562 bool is_square (void) const
a8361bc2361a maint: Deprecate is_square and replace with issquare.
Rik <rik@octave.org>
parents: 23592
diff changeset
563 { return issquare (); }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
564
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23487
diff changeset
565 bool isempty (void) const { return numel () == 0; }
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23487
diff changeset
566
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
567 OCTAVE_DEPRECATED (4.4, "use 'isempty' instead")
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23487
diff changeset
568 bool is_empty (void) const
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23487
diff changeset
569 { return isempty (); }
4559
802818bfac91 [project @ 2003-10-28 19:13:43 by jwe]
jwe
parents: 4548
diff changeset
570
23592
80e3bfb7bd5a maint: Deprecate is_vector and replace with isvector.
Rik <rik@octave.org>
parents: 23588
diff changeset
571 bool isvector (void) const { return dimensions.isvector (); }
80e3bfb7bd5a maint: Deprecate is_vector and replace with isvector.
Rik <rik@octave.org>
parents: 23588
diff changeset
572
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
573 OCTAVE_DEPRECATED (4.4, "use 'isvector' instead")
23592
80e3bfb7bd5a maint: Deprecate is_vector and replace with isvector.
Rik <rik@octave.org>
parents: 23588
diff changeset
574 bool is_vector (void) const
80e3bfb7bd5a maint: Deprecate is_vector and replace with isvector.
Rik <rik@octave.org>
parents: 23588
diff changeset
575 { return isvector (); }
9026
6890d411a0b8 adjust some array dim query methods
Jaroslav Hajek <highegg@gmail.com>
parents: 9025
diff changeset
576
23386
f1ea44e92df8 improve compatibility for single index indexing (bug #50776)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
577 bool is_nd_vector (void) const { return dimensions.is_nd_vector (); }
f1ea44e92df8 improve compatibility for single index indexing (bug #50776)
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
578
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
579 Array<T> transpose (void) const;
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23615
diff changeset
580 Array<T> hermitian (T (*fcn) (const T&) = nullptr) const;
238
780cbbc57b7c [project @ 1993-11-30 20:23:04 by jwe]
jwe
parents: 228
diff changeset
581
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23443
diff changeset
582 const T * data (void) const { return slice_data; }
228
ee01ac1c7acc [project @ 1993-11-16 09:56:54 by jwe]
jwe
parents:
diff changeset
583
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23443
diff changeset
584 const T * fortran_vec (void) const { return data (); }
3952
945e8c160191 [project @ 2002-05-23 17:18:12 by jwe]
jwe
parents: 3944
diff changeset
585
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23443
diff changeset
586 T * fortran_vec (void);
1560
27a03373de41 [project @ 1995-10-12 07:22:26 by jwe]
jwe
parents: 1550
diff changeset
587
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9341
diff changeset
588 bool is_shared (void) { return rep->count > 1; }
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9341
diff changeset
589
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21574
diff changeset
590 int ndims (void) const { return dimensions.ndims (); }
1560
27a03373de41 [project @ 1995-10-12 07:22:26 by jwe]
jwe
parents: 1550
diff changeset
591
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
592 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
593 //! Indexing without resizing.
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
594 Array<T> index (const idx_vector& i) const;
1560
27a03373de41 [project @ 1995-10-12 07:22:26 by jwe]
jwe
parents: 1550
diff changeset
595
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
596 Array<T> index (const idx_vector& i, const idx_vector& j) const;
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
597
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
598 Array<T> index (const Array<idx_vector>& ia) const;
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
599 //@}
1560
27a03373de41 [project @ 1995-10-12 07:22:26 by jwe]
jwe
parents: 1550
diff changeset
600
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
601 virtual T resize_fill_value (void) const;
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
602
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
603 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
604 //! Resizing (with fill).
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19326
diff changeset
605 void resize2 (octave_idx_type nr, octave_idx_type nc, const T& rfv);
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19326
diff changeset
606 void resize2 (octave_idx_type nr, octave_idx_type nc)
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
607 {
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
608 resize2 (nr, nc, resize_fill_value ());
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
609 }
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
610
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19326
diff changeset
611 void resize1 (octave_idx_type n, const T& rfv);
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19326
diff changeset
612 void resize1 (octave_idx_type n) { resize1 (n, resize_fill_value ()); }
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19326
diff changeset
613
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
614 void resize (const dim_vector& dv, const T& rfv);
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
615 void resize (const dim_vector& dv) { resize (dv, resize_fill_value ()); }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
616 //@}
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
617
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
618 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
619 //! Indexing with possible resizing and fill
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
620
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
621 // FIXME: this is really a corner case, that should better be
8333
9238637cb81c style fixes
John W. Eaton <jwe@octave.org>
parents: 8290
diff changeset
622 // handled directly in liboctinterp.
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
623
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
624 Array<T> index (const idx_vector& i, bool resize_ok, const T& rfv) const;
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
625 Array<T> index (const idx_vector& i, bool resize_ok) const
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
626 {
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
627 return index (i, resize_ok, resize_fill_value ());
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
628 }
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
629
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
630 Array<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
631 const T& rfv) const;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
632 Array<T> index (const idx_vector& i, const idx_vector& j,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
633 bool resize_ok) const
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
634 {
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
635 return index (i, j, resize_ok, resize_fill_value ());
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
636 }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
637
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
638 Array<T> index (const Array<idx_vector>& ia, bool resize_ok,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
639 const T& rfv) const;
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
640 Array<T> index (const Array<idx_vector>& ia, bool resize_ok) const
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
641 {
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
642 return index (ia, resize_ok, resize_fill_value ());
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
643 }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
644 //@}
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
645
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
646 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
647 //! Indexed assignment (always with resize & fill).
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
648 void assign (const idx_vector& i, const Array<T>& rhs, const T& rfv);
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
649 void assign (const idx_vector& i, const Array<T>& rhs)
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
650 {
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
651 assign (i, rhs, resize_fill_value ());
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
652 }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
653
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
654 void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
655 const T& rfv);
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
656 void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs)
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
657 {
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
658 assign (i, j, rhs, resize_fill_value ());
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
659 }
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
660
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
661 void assign (const Array<idx_vector>& ia, const Array<T>& rhs, const T& rfv);
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
662 void assign (const Array<idx_vector>& ia, const Array<T>& rhs)
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
663 {
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
664 assign (ia, rhs, resize_fill_value ());
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
665 }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
666 //@}
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
667
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
668 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
669 //! Deleting elements.
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
670
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
671 //! A(I) = [] (with a single subscript)
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
672 void delete_elements (const idx_vector& i);
4530
e8d87fefd144 [project @ 2003-10-07 04:02:04 by jwe]
jwe
parents: 4518
diff changeset
673
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
674 //! A(:,...,I,...,:) = [] (>= 2 subscripts, one of them is non-colon)
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
675 void delete_elements (int dim, const idx_vector& i);
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
676
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
677 //! Dispatcher to the above two.
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
678 void delete_elements (const Array<idx_vector>& ia);
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
679 //@}
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
680
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
681 //! Insert an array into another at a specified position. If
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
682 //! size (a) is [d1 d2 ... dN] and idx is [i1 i2 ... iN], this
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
683 //! method is equivalent to x(i1:i1+d1-1, i2:i2+d2-1, ... ,
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
684 //! iN:iN+dN-1) = a.
10115
ed49cef7e005 simplify Array::insert methods
Jaroslav Hajek <highegg@gmail.com>
parents: 10095
diff changeset
685 Array<T>& insert (const Array<T>& a, const Array<octave_idx_type>& idx);
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3836
diff changeset
686
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
687 //! This is just a special case for idx = [r c 0 ...]
8290
7cbe01c21986 improve dense array indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8179
diff changeset
688 Array<T>& insert (const Array<T>& a, octave_idx_type r, octave_idx_type c);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
689
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8503
diff changeset
690 void maybe_economize (void)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
691 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
692 if (rep->count == 1 && slice_len != rep->len)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
693 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
694 ArrayRep *new_rep = new ArrayRep (slice_data, slice_len);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
695 delete rep;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
696 rep = new_rep;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
697 slice_data = rep->data;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
698 }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
699 }
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8503
diff changeset
700
4517
b4449b1193ac [project @ 2003-09-20 02:06:06 by jwe]
jwe
parents: 4513
diff changeset
701 void print_info (std::ostream& os, const std::string& prefix) const;
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5775
diff changeset
702
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
703 //! Give a pointer to the data in mex format. Unsafe. This function
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
704 //! exists to support the MEX interface. You should not use it
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
705 //! anywhere else.
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23443
diff changeset
706 void * mex_get_data (void) const { return const_cast<T *> (data ()); }
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7017
diff changeset
707
9725
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9653
diff changeset
708 Array<T> sort (int dim = 0, sortmode mode = ASCENDING) const;
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9653
diff changeset
709 Array<T> sort (Array<octave_idx_type> &sidx, int dim = 0,
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
710 sortmode mode = ASCENDING) const;
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
711
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
712 //! Ordering is auto-detected or can be specified.
23588
0549061d35b9 maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents: 23577
diff changeset
713 sortmode issorted (sortmode mode = UNSORTED) const;
0549061d35b9 maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents: 23577
diff changeset
714
23615
be7b884ac589 use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents: 23593
diff changeset
715 OCTAVE_DEPRECATED (4.4, "use 'issorted' instead")
23588
0549061d35b9 maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents: 23577
diff changeset
716 sortmode is_sorted (sortmode mode = UNSORTED) const
0549061d35b9 maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents: 23577
diff changeset
717 { return issorted (mode); }
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8700
diff changeset
718
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
719 //! Sort by rows returns only indices.
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8700
diff changeset
720 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const;
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8700
diff changeset
721
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
722 //! Ordering is auto-detected or can be specified.
8721
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8700
diff changeset
723 sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
e9cb742df9eb imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents: 8700
diff changeset
724
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
725 //! @brief Do a binary lookup in a sorted array. Must not contain NaNs.
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
726 //! Mode can be specified or is auto-detected by comparing 1st and last element.
8814
de16ebeef93d improve lookup, provide Array<T>::lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8725
diff changeset
727 octave_idx_type lookup (const T& value, sortmode mode = UNSORTED) const;
de16ebeef93d improve lookup, provide Array<T>::lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8725
diff changeset
728
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
729 //! Ditto, but for an array of values, specializing on the case when values
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
730 //! are sorted. NaNs get the value N.
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
731 Array<octave_idx_type> lookup (const Array<T>& values,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
732 sortmode mode = UNSORTED) const;
9341
9fd5c56ce57a extend lookup capabilities
Jaroslav Hajek <highegg@gmail.com>
parents: 9201
diff changeset
733
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
734 //! Count nonzero elements.
9878
ead4f9c82a9a implement Array<T>::nnz
Jaroslav Hajek <highegg@gmail.com>
parents: 9840
diff changeset
735 octave_idx_type nnz (void) const;
ead4f9c82a9a implement Array<T>::nnz
Jaroslav Hajek <highegg@gmail.com>
parents: 9840
diff changeset
736
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
737 //! Find indices of (at most n) nonzero elements. If n is specified,
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
738 //! backward specifies search from backward.
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
739 Array<octave_idx_type> find (octave_idx_type n = -1,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
740 bool backward = false) const;
9025
484756d558d6 add Array<T>::find
Jaroslav Hajek <highegg@gmail.com>
parents: 8998
diff changeset
741
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
742 //! Returns the n-th element in increasing order, using the same
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
743 //! ordering as used for sort. n can either be a scalar index or a
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
744 //! contiguous range.
9725
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9653
diff changeset
745 Array<T> nth_element (const idx_vector& n, int dim = 0) const;
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9653
diff changeset
746
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
747 //! Get the kth super or subdiagonal. The zeroth diagonal is the
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
748 //! ordinary diagonal.
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
749 Array<T> diag (octave_idx_type k = 0) const;
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
750
14557
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
751 Array<T> diag (octave_idx_type m, octave_idx_type n) const;
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
752
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
753 //! Concatenation along a specified (0-based) dimension, equivalent
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
754 //! to cat(). dim = -1 corresponds to dim = 0 and dim = -2
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
755 //! corresponds to dim = 1, but apply the looser matching rules of
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
756 //! vertcat/horzcat.
10531
2dd8ea8bfd71 basic cat functionality in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
757 static Array<T>
2dd8ea8bfd71 basic cat functionality in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
758 cat (int dim, octave_idx_type n, const Array<T> *array_list);
2dd8ea8bfd71 basic cat functionality in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
759
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
760 //! Apply function fcn to each element of the Array<T>. This function
21567
3d25f9f4a62b maint: Eliminate Britishicisms in the code.
Rik <rik@octave.org>
parents: 21244
diff changeset
761 //! is optimized with a manually unrolled loop.
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
762 template <typename U, typename F>
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
763 Array<U>
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
764 map (F fcn) const
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
765 {
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20229
diff changeset
766 octave_idx_type len = numel ();
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
767
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
768 const T *m = data ();
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
769
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
770 Array<U> result (dims ());
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
771 U *p = result.fortran_vec ();
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
772
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
773 octave_idx_type i;
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
774 for (i = 0; i < len - 3; i += 4)
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
775 {
10312
cbc402e64d83 untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
776 octave_quit ();
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
777
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
778 p[i] = fcn (m[i]);
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
779 p[i+1] = fcn (m[i+1]);
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
780 p[i+2] = fcn (m[i+2]);
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
781 p[i+3] = fcn (m[i+3]);
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
782 }
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
783
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 10115
diff changeset
784 octave_quit ();
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
785
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
786 for (; i < len; i++)
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
787 p[i] = fcn (m[i]);
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
788
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
789 return result;
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7463
diff changeset
790 }
8998
a48fba01e4ac optimize isnan/isinf/isfinite mappers
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
791
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
792 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
793 //! Overloads for function references.
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
794 template <typename U>
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
795 Array<U>
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
796 map (U (&fcn) (T)) const
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
797 { return map<U, U (&) (T)> (fcn); }
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
798
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
799 template <typename U>
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
800 Array<U>
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
801 map (U (&fcn) (const T&)) const
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
802 { return map<U, U (&) (const T&)> (fcn); }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
803 //@}
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9800
diff changeset
804
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
805 //! Generic any/all test functionality with arbitrary predicate.
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
806 template <typename F, bool zero>
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
807 bool test (F fcn) const
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
808 {
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20229
diff changeset
809 return any_all_test<F, T, zero> (fcn, data (), numel ());
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
810 }
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
811
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
812 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
813 //! Simpler calls.
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
814 template <typename F>
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
815 bool test_any (F fcn) const
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
816 { return test<F, false> (fcn); }
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
817
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
818 template <typename F>
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
819 bool test_all (F fcn) const
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
820 { return test<F, true> (fcn); }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
821 //@}
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
822
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
823 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
824 //! Overloads for function references.
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
825 bool test_any (bool (&fcn) (T)) const
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
826 { return test<bool (&) (T), false> (fcn); }
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
827
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
828 bool test_any (bool (&fcn) (const T&)) const
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
829 { return test<bool (&) (const T&), false> (fcn); }
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
830
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
831 bool test_all (bool (&fcn) (T)) const
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
832 { return test<bool (&) (T), true> (fcn); }
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
833
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
834 bool test_all (bool (&fcn) (const T&)) const
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
835 { return test<bool (&) (const T&), true> (fcn); }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
836 //@}
11010
9478b216752e simplify more array tests
Jaroslav Hajek <highegg@gmail.com>
parents: 10716
diff changeset
837
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
838 template <typename U> friend class Array;
9201
472f0e22aa60 guard against implicit instantiation
Jaroslav Hajek <highegg@gmail.com>
parents: 9046
diff changeset
839
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
840 //! Returns true if this->dims () == dv, and if so, replaces this->dimensions
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
841 //! by a shallow copy of dv. This is useful for maintaining several arrays
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
842 //! with supposedly equal dimensions (e.g. structs in the interpreter).
10674
e3064439d6b4 new Array method for internal use
Jaroslav Hajek <highegg@gmail.com>
parents: 10673
diff changeset
843 bool optimize_dimensions (const dim_vector& dv);
e3064439d6b4 new Array method for internal use
Jaroslav Hajek <highegg@gmail.com>
parents: 10673
diff changeset
844
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
845 //@{
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
846 //! WARNING: Only call these functions from jit
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19326
diff changeset
847
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23443
diff changeset
848 int * jit_ref_count (void) { return rep->count.get (); }
14951
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
849
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23443
diff changeset
850 T * jit_slice_data (void) const { return slice_data; }
14951
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
851
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23443
diff changeset
852 octave_idx_type * jit_dimensions (void) const { return dimensions.to_jit (); }
14951
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
853
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23443
diff changeset
854 void * jit_array_rep (void) const { return rep; }
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
855 //@}
14951
4c9fd3e31436 Start of jit support for double matricies
Max Brister <max@2bass.com>
parents: 14616
diff changeset
856
9201
472f0e22aa60 guard against implicit instantiation
Jaroslav Hajek <highegg@gmail.com>
parents: 9046
diff changeset
857 private:
472f0e22aa60 guard against implicit instantiation
Jaroslav Hajek <highegg@gmail.com>
parents: 9046
diff changeset
858 static void instantiation_guard ();
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4461
diff changeset
859 };
4459
75ee1995d2b4 [project @ 2003-07-11 17:46:41 by jwe]
jwe
parents: 4192
diff changeset
860
22139
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
861 // We use a variadic template for template template parameter so that
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
862 // we don't have to specify all the template parameters and limit this
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
863 // to Container<T>. http://stackoverflow.com/a/20499809/1609556
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
864 template<typename T>
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
865 template<template <typename...> class Container>
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
866 Array<T>::Array (const Container<T>& a, const dim_vector& dv)
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
867 : dimensions (dv), rep (new typename Array<T>::ArrayRep (dv.safe_numel ())),
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
868 slice_data (rep->data), slice_len (rep->len)
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
869 {
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
870 if (dimensions.safe_numel () != octave_idx_type (a.size ()))
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
871 {
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
872 std::string new_dims_str = dimensions.str ();
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
873
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
874 (*current_liboctave_error_handler)
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
875 ("reshape: can't reshape %i elements into %s array",
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
876 a.size (), new_dims_str.c_str ());
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
877 }
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
878
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
879 octave_idx_type i = 0;
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
880 for (const T& x : a)
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
881 slice_data[i++] = x;
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
882
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
883 dimensions.chop_trailing_singletons ();
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
884 }
f8212eb6da00 Array: add constructor from std sequence containers (patch 9047)
Carnë Draug <carandraug@octave.org>
parents: 22022
diff changeset
885
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
886 //! This is a simple wrapper template that will subclass an Array<T>
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
887 //! type or any later type derived from it and override the default
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21660
diff changeset
888 //! non-const operator() to not check for the array's uniqueness. It
19006
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
889 //! is, however, the user's responsibility to ensure the array is
96751a74bbbb Start doxygenising sources
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17769
diff changeset
890 //! actually unaliased whenever elements are accessed.
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
891 template <typename ArrayClass>
9653
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
892 class NoAlias : public ArrayClass
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
893 {
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
894 typedef typename ArrayClass::element_type T;
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
895 public:
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
896 NoAlias () : ArrayClass () { }
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
897
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
898 // FIXME: this would be simpler once C++0x is available
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
899 template <typename X>
9653
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
900 explicit NoAlias (X x) : ArrayClass (x) { }
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
901
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
902 template <typename X, typename Y>
9653
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
903 explicit NoAlias (X x, Y y) : ArrayClass (x, y) { }
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
904
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
905 template <typename X, typename Y, typename Z>
9653
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
906 explicit NoAlias (X x, Y y, Z z) : ArrayClass (x, y, z) { }
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
907
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
908 T& operator () (octave_idx_type n)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
909 { return ArrayClass::xelem (n); }
9653
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
910 T& operator () (octave_idx_type i, octave_idx_type j)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
911 { return ArrayClass::xelem (i, j); }
9653
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
912 T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
913 { return ArrayClass::xelem (i, j, k); }
9653
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
914 T& operator () (const Array<octave_idx_type>& ra_idx)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
915 { return ArrayClass::xelem (ra_idx); }
9653
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
916 };
e087d7c77ff9 improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9624
diff changeset
917
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21134
diff changeset
918 template <typename T>
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9731
diff changeset
919 std::ostream&
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9731
diff changeset
920 operator << (std::ostream& os, const Array<T>& a);
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9731
diff changeset
921
9773
01f897d8a130 optimize memory manipulation by arrays & indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
922 #endif