annotate liboctave/array/MatrixType.cc @ 31771:21f9b34eb893

maint: Eliminate "(void)" in C++ function prototypes/declarations. * mk-opts.pl, external.txi, embedded.cc, make_int.cc, standalone.cc, standalonebuiltin.cc, 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, ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, Object.cc, Object.h, ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, Table.cc, Table.h, TextControl.cc, TextControl.h, TextEdit.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, gl-select.cc, gl-select.h, qopengl-functions.h, qt-graphics-toolkit.h, qdialog.cpp, qfontdialog.cpp, qprintdialog_win.cpp, liboctgui-build-info.h, liboctgui-build-info.in.cc, color-picker.cc, color-picker.h, command-widget.cc, command-widget.h, community-news.cc, community-news.h, dialog.cc, dialog.h, documentation-bookmarks.cc, documentation-bookmarks.h, documentation-dock-widget.cc, documentation-dock-widget.h, documentation.cc, documentation.h, dw-main-window.cc, dw-main-window.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, gui-preferences.cc, gui-preferences.h, gui-settings.cc, gui-settings.h, history-dock-widget.cc, history-dock-widget.h, interpreter-qobject.cc, interpreter-qobject.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, news-reader.cc, news-reader.h, octave-dock-widget.cc, octave-dock-widget.h, octave-qobject.cc, octave-qobject.h, qt-application.cc, qt-application.h, qt-interpreter-events.cc, qt-interpreter-events.h, release-notes.cc, release-notes.h, set-path-dialog.cc, set-path-dialog.h, set-path-model.cc, set-path-model.h, settings-dialog.cc, settings-dialog.h, shortcuts-tree-widget.cc, shortcuts-tree-widget.h, tab-bar.cc, tab-bar.h, terminal-dock-widget.cc, terminal-dock-widget.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, Cell.cc, Cell.h, __contourc__.cc, __magick_read__.cc, auto-shlib.cc, auto-shlib.h, base-text-renderer.h, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, debug.cc, defaults.cc, defaults.h, defun.cc, display.cc, display.h, dynamic-ld.cc, dynamic-ld.h, environment.cc, environment.h, error.cc, error.h, errwarn.cc, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, ft-text-renderer.cc, ft-text-renderer.h, genprops.awk, gh-manager.cc, gh-manager.h, gl-render.cc, gl-render.h, gl2ps-print.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gtk-manager.cc, gtk-manager.h, help.cc, help.h, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, jsondecode.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, ls-hdf5.cc, ls-hdf5.h, mxarray.h, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc, oct-fstrm.h, oct-handle.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, pager.cc, pager.h, pr-flt-fmt.cc, pr-flt-fmt.h, pr-output.cc, pr-output.h, procstream.cc, procstream.h, settings.cc, settings.h, sighandlers.cc, sighandlers.h, stack-frame.cc, stack-frame.h, svd.cc, syminfo.cc, syminfo.h, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, toplev.cc, url-handle-manager.cc, url-handle-manager.h, variables.cc, xpow.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, audiodevinfo.cc, gzip.cc, liboctinterp-build-info.h, liboctinterp-build-info.in.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, 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.h, ov-complex.cc, ov-complex.h, 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.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-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-lazy-idx.h, ov-legacy-range.cc, ov-legacy-range.h, ov-magic-int.cc, ov-magic-int.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-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, ovl.h, octave.cc, octave.h, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.h, 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-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.h, pt.cc, pt.h, token.cc, token.h, usage.h, Array-base.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.cc, MArray.h, MDiagArray2.h, MSparse.h, MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc, Range.h, Sparse-b.cc, Sparse.cc, Sparse.h, boolMatrix.cc, boolMatrix.h, boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h, chMatrix.h, 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, intNDArray.cc, intNDArray.h, liboctave-build-info.h, liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK.cc, DASPK.h, DASRT.cc, DASRT.h, DASSL.cc, DASSL.h, DET.h, EIG.h, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h, Quad.h, aepbalance.cc, aepbalance.h, base-dae.h, base-de.h, chol.cc, chol.h, eigs-base.cc, fEIG.h, gepbalance.h, gsvd.cc, gsvd.h, hess.h, lu.cc, lu.h, oct-fftw.cc, oct-fftw.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randmtzig.cc, randmtzig.h, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.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, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.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, caseless-str.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, data-conv.cc, file-info.h, glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-regexp.h, oct-inttypes.cc, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, oct-sparse.cc, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, singleton-cleanup.cc, singleton-cleanup.h, str-vec.cc, str-vec.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h, version.cc, version.in.h, cxx-signal-helpers.cc, acinclude.m4, 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, octave-svgconvert.cc, shared-fcns.h: maint: Eliminate "(void)" in C++ function prototypes/declarations.
author Rik <rik@octave.org>
date Tue, 24 Jan 2023 17:19:44 -0800
parents 597f3ee61a48
children 2e484f9f1f18
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
31706
597f3ee61a48 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
3 // Copyright (C) 2006-2023 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21202
diff changeset
27 # include "config.h"
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
28 #endif
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
29
26569
0e77df67b522 Add static compile-time checking of printf functions in liboctave.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26435
diff changeset
30 #include <cinttypes>
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
31 #include <vector>
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
32
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
33 #include "MatrixType.h"
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
34 #include "dMatrix.h"
19269
65554f5847ac don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 18676
diff changeset
35 #include "fMatrix.h"
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
36 #include "CMatrix.h"
19269
65554f5847ac don't include oct-locbuf.h in header files unnecessarily
John W. Eaton <jwe@octave.org>
parents: 18676
diff changeset
37 #include "fCMatrix.h"
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
38 #include "dSparse.h"
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
39 #include "CSparse.h"
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
40 #include "oct-spparms.h"
8377
25bc2d31e1bf improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents: 7798
diff changeset
41 #include "oct-locbuf.h"
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
42
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
43 static void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
44 warn_cached ()
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
45 {
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
46 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
47 ("Octave:matrix-type-info", "using cached matrix type");
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
48 }
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
49
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
50 static void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
51 warn_invalid ()
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
52 {
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
53 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
54 ("Octave:matrix-type-info", "invalid matrix type");
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
55 }
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
56
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
57 static void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
58 warn_calculating_sparse_type ()
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
59 {
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
60 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
61 ("Octave:matrix-type-info", "calculating sparse matrix type");
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
62 }
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
63
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
64 // FIXME: There is a large code duplication here
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
65
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
66 MatrixType::MatrixType ()
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
67 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
68 m_sp_bandden (octave::sparse_params::get_bandden ()),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
69 m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
70 m_dense (false), m_full (false), m_nperm (0), m_perm (nullptr) { }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
71
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
72 MatrixType::MatrixType (const MatrixType& a)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
73 : m_type (a.m_type), m_sp_bandden (a.m_sp_bandden), m_bandden (a.m_bandden),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
74 m_upper_band (a.m_upper_band), m_lower_band (a.m_lower_band),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
75 m_dense (a.m_dense), m_full (a.m_full),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
76 m_nperm (a.m_nperm), m_perm (nullptr)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
77 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
78 if (m_nperm != 0)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
79 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
80 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
81 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
82 m_perm[i] = a.m_perm[i];
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
83 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
84 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
85
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
86 template <typename T>
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
87 MatrixType::matrix_type
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10314
diff changeset
88 matrix_real_probe (const MArray<T>& a)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
89 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
90 MatrixType::matrix_type m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
91 octave_idx_type nrows = a.rows ();
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
92 octave_idx_type ncols = a.cols ();
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
93
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
94 const T zero = 0;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
95
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
96 if (ncols == nrows)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
97 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
98 bool upper = true;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
99 bool lower = true;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
100 bool hermitian = true;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
101
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
102 // do the checks for lower/upper/hermitian all in one pass.
15022
e47b4e8c2714 maint: Use space after OCTAVE_LOCAL_BUFFER invocation in liboctave source code.
Rik <rik@octave.org>
parents: 15020
diff changeset
103 OCTAVE_LOCAL_BUFFER (T, diag, ncols);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
104
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
105 for (octave_idx_type j = 0;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
106 j < ncols && upper; j++)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
107 {
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
108 T d = a.elem (j, j);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
109 upper = upper && (d != zero);
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
110 lower = lower && (d != zero);
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
111 hermitian = hermitian && (d > zero);
10713
0e05ed9f2a62 improve some MatrixType code
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
112 diag[j] = d;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
113 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
114
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
115 for (octave_idx_type j = 0;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
116 j < ncols && (upper || lower || hermitian); j++)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
117 {
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
118 for (octave_idx_type i = 0; i < j; i++)
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
119 {
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
120 T aij = a.elem (i, j);
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
121 T aji = a.elem (j, i);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
122 lower = lower && (aij == zero);
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
123 upper = upper && (aji == zero);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
124 hermitian = hermitian && (aij == aji
10713
0e05ed9f2a62 improve some MatrixType code
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
125 && aij*aij < diag[i]*diag[j]);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
126 }
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
127 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
128
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
129 if (upper)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
130 m_type = MatrixType::Upper;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
131 else if (lower)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
132 m_type = MatrixType::Lower;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
133 else if (hermitian)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
134 m_type = MatrixType::Hermitian;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
135 else
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
136 m_type = MatrixType::Full;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
137 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
138 else
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
139 m_type = MatrixType::Rectangular;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
140
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
141 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
142 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
143
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
144 template <typename T>
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
145 MatrixType::matrix_type
23534
b6498c088fca maint: Don't write '> >' for declaration of templates that use templates.
Rik <rik@octave.org>
parents: 23433
diff changeset
146 matrix_complex_probe (const MArray<std::complex<T>>& a)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
147 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
148 MatrixType::matrix_type m_type = MatrixType::Unknown;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
149 octave_idx_type nrows = a.rows ();
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
150 octave_idx_type ncols = a.cols ();
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
151
10713
0e05ed9f2a62 improve some MatrixType code
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
152 const T zero = 0;
0e05ed9f2a62 improve some MatrixType code
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
153 // get the real type
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
154
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
155 if (ncols == nrows)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
156 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
157 bool upper = true;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
158 bool lower = true;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
159 bool hermitian = true;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
160
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
161 // do the checks for lower/upper/hermitian all in one pass.
15022
e47b4e8c2714 maint: Use space after OCTAVE_LOCAL_BUFFER invocation in liboctave source code.
Rik <rik@octave.org>
parents: 15020
diff changeset
162 OCTAVE_LOCAL_BUFFER (T, diag, ncols);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
163
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
164 for (octave_idx_type j = 0;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
165 j < ncols && upper; j++)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
166 {
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
167 std::complex<T> d = a.elem (j, j);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
168 upper = upper && (d != zero);
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
169 lower = lower && (d != zero);
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
170 hermitian = hermitian && (d.real () > zero && d.imag () == zero);
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
171 diag[j] = d.real ();
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
172 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
173
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
174 for (octave_idx_type j = 0;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
175 j < ncols && (upper || lower || hermitian); j++)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
176 {
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
177 for (octave_idx_type i = 0; i < j; i++)
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
178 {
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
179 std::complex<T> aij = a.elem (i, j);
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
180 std::complex<T> aji = a.elem (j, i);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
181 lower = lower && (aij == zero);
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
182 upper = upper && (aji == zero);
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22246
diff changeset
183 hermitian = hermitian && (aij == octave::math::conj (aji)
10713
0e05ed9f2a62 improve some MatrixType code
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
184 && std::norm (aij) < diag[i]*diag[j]);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
185 }
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
186 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
187
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
188 if (upper)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
189 m_type = MatrixType::Upper;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
190 else if (lower)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
191 m_type = MatrixType::Lower;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
192 else if (hermitian)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
193 m_type = MatrixType::Hermitian;
26435
590643c853bd MatrixType.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
194 else
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
195 m_type = MatrixType::Full;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
196 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
197 else
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
198 m_type = MatrixType::Rectangular;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
199
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
200 return m_type;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
201 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
202
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
203 MatrixType::MatrixType (const Matrix& a)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
204 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
205 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
206 m_dense (false), m_full (true), m_nperm (0), m_perm (nullptr)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
207 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
208 m_type = matrix_real_probe (a);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
209 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
210
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
211 MatrixType::MatrixType (const ComplexMatrix& a)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
212 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
213 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
214 m_dense (false), m_full (true), m_nperm (0), m_perm (nullptr)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
215 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
216 m_type = matrix_complex_probe (a);
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
217 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
218
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
219 MatrixType::MatrixType (const FloatMatrix& a)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
220 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
221 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
222 m_dense (false), m_full (true), m_nperm (0), m_perm (nullptr)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
223 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
224 m_type = matrix_real_probe (a);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
225 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
226
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
227 MatrixType::MatrixType (const FloatComplexMatrix& a)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
228 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
229 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
230 m_dense (false), m_full (true), m_nperm (0), m_perm (nullptr)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
231 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
232 m_type = matrix_complex_probe (a);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
233 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
234
22246
fa917f1f0faf MatrixType: remove duplicate code for SparseMatrix and ComplexSparseMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22241
diff changeset
235
fa917f1f0faf MatrixType: remove duplicate code for SparseMatrix and ComplexSparseMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22241
diff changeset
236 template <typename T>
fa917f1f0faf MatrixType: remove duplicate code for SparseMatrix and ComplexSparseMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22241
diff changeset
237 MatrixType::MatrixType (const MSparse<T>& a)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
238 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
239 m_sp_bandden (0), m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
240 m_dense (false), m_full (false), m_nperm (0), m_perm (nullptr)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
241 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
242 octave_idx_type nrows = a.rows ();
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
243 octave_idx_type ncols = a.cols ();
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
244 octave_idx_type nm = (ncols < nrows ? ncols : nrows);
10506
bdf5d85cfc5e replace nzmax by nnz where appropriate in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10350
diff changeset
245 octave_idx_type nnz = a.nnz ();
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
246
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
247 if (octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
248 warn_calculating_sparse_type ();
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
249
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
250 m_sp_bandden = octave::sparse_params::get_bandden ();
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
251 bool maybe_hermitian = false;
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
252 m_type = MatrixType::Full;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
253
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
254 if (nnz == nm)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
255 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
256 matrix_type tmp_typ = MatrixType::Diagonal;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
257 octave_idx_type i;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
258 // Maybe the matrix is diagonal
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
259 for (i = 0; i < nm; i++)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
260 {
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
261 if (a.cidx (i+1) != a.cidx (i) + 1)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
262 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
263 tmp_typ = MatrixType::Full;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
264 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
265 }
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
266 if (a.ridx (i) != i)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
267 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
268 tmp_typ = MatrixType::Permuted_Diagonal;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
269 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
270 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
271 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
272
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
273 if (tmp_typ == MatrixType::Permuted_Diagonal)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
274 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
275 std::vector<bool> found (nrows);
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
276
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
277 for (octave_idx_type j = 0; j < i; j++)
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
278 found[j] = true;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
279 for (octave_idx_type j = i; j < nrows; j++)
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
280 found[j] = false;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
281
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
282 for (octave_idx_type j = i; j < nm; j++)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
283 {
19864
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
284 if ((a.cidx (j+1) > a.cidx (j) + 1)
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
285 || ((a.cidx (j+1) == a.cidx (j) + 1) && found[a.ridx (j)]))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
286 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
287 tmp_typ = MatrixType::Full;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
288 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
289 }
15020
560317fd5977 maint: Cuddle open bracket used for indexing C++ arrays in source code.
Rik <rik@octave.org>
parents: 15018
diff changeset
290 found[a.ridx (j)] = true;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
291 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
292 }
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
293 m_type = tmp_typ;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
294 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
295
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
296 if (m_type == MatrixType::Full)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
297 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
298 // Search for banded, upper and lower triangular matrices
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
299 bool singular = false;
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
300 m_upper_band = 0;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
301 m_lower_band = 0;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
302 for (octave_idx_type j = 0; j < ncols; j++)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
303 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
304 bool zero_on_diagonal = false;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
305 if (j < nrows)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
306 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
307 zero_on_diagonal = true;
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
308 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
309 if (a.ridx (i) == j)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
310 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
311 zero_on_diagonal = false;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
312 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
313 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
314 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
315
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
316 if (zero_on_diagonal)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
317 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
318 singular = true;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
319 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
320 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
321
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
322 if (a.cidx (j+1) != a.cidx (j))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
323 {
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
324 octave_idx_type ru = a.ridx (a.cidx (j));
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
325 octave_idx_type rl = a.ridx (a.cidx (j+1)-1);
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
326
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
327 if (j - ru > m_upper_band)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
328 m_upper_band = j - ru;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
329
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
330 if (rl - j > m_lower_band)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
331 m_lower_band = rl - j;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
332 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
333 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
334
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 19864
diff changeset
335 if (! singular)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
336 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
337 m_bandden = double (nnz) /
30394
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
338 (double (ncols) * (double (m_lower_band) +
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
339 double (m_upper_band)) -
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
340 0.5 * double (m_upper_band + 1) * double (m_upper_band) -
f3f3e3793fb5 maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30085
diff changeset
341 0.5 * double (m_lower_band + 1) * double (m_lower_band));
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
342
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
343 if (nrows == ncols && m_sp_bandden != 1. && m_bandden > m_sp_bandden)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
344 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
345 if (m_upper_band == 1 && m_lower_band == 1)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
346 m_type = MatrixType::Tridiagonal;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
347 else
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
348 m_type = MatrixType::Banded;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
349
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 26569
diff changeset
350 octave_idx_type nnz_in_band
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
351 = ((m_upper_band + m_lower_band + 1) * nrows
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
352 - (1 + m_upper_band) * m_upper_band / 2
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
353 - (1 + m_lower_band) * m_lower_band / 2);
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 26569
diff changeset
354
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
355 if (nnz_in_band == nnz)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
356 m_dense = true;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
357 else
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
358 m_dense = false;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
359 }
22241
71d86e88589f chol2inv: fix support for sparse matrices by fixing MatrixType (bug #36437)
Barbara Locsi <locsi.barbara@gmail.com>
parents: 22022
diff changeset
360
71d86e88589f chol2inv: fix support for sparse matrices by fixing MatrixType (bug #36437)
Barbara Locsi <locsi.barbara@gmail.com>
parents: 22022
diff changeset
361 // If a matrix is Banded but also Upper/Lower, set to the latter.
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
362 if (m_upper_band == 0)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
363 m_type = MatrixType::Lower;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
364 else if (m_lower_band == 0)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
365 m_type = MatrixType::Upper;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
366
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
367 if (m_upper_band == m_lower_band && nrows == ncols)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
368 maybe_hermitian = true;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
369 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
370
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
371 if (m_type == MatrixType::Full)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
372 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
373 // Search for a permuted triangular matrix, and test if
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
374 // permutation is singular
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
375
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
376 // FIXME: Perhaps this should be based on a dmperm algorithm?
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
377 bool found = false;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
378
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
379 m_nperm = ncols;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
380 m_perm = new octave_idx_type [ncols];
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
381
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
382 for (octave_idx_type i = 0; i < ncols; i++)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
383 m_perm[i] = -1;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
384
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
385 for (octave_idx_type i = 0; i < nm; i++)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
386 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
387 found = false;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
388
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
389 for (octave_idx_type j = 0; j < ncols; j++)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
390 {
19864
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
391 if ((a.cidx (j+1) - a.cidx (j)) > 0
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
392 && (a.ridx (a.cidx (j+1)-1) == i))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
393 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
394 m_perm[i] = j;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
395 found = true;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
396 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
397 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
398 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
399
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 19864
diff changeset
400 if (! found)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
401 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
402 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
403
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
404 if (found)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
405 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
406 m_type = MatrixType::Permuted_Upper;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
407 if (ncols > nrows)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
408 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
409 octave_idx_type k = nrows;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
410 for (octave_idx_type i = 0; i < ncols; i++)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
411 if (m_perm[i] == -1)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
412 m_perm[i] = k++;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
413 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
414 }
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
415 else if (a.cidx (nm) == a.cidx (ncols))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
416 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
417 m_nperm = nrows;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
418 delete [] m_perm;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
419 m_perm = new octave_idx_type [nrows];
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
420 OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, nrows);
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
421
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
422 for (octave_idx_type i = 0; i < nrows; i++)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
423 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
424 m_perm[i] = -1;
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
425 tmp[i] = -1;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
426 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
427
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
428 for (octave_idx_type j = 0; j < ncols; j++)
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
429 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
430 m_perm[a.ridx (i)] = j;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
431
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
432 found = true;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
433 for (octave_idx_type i = 0; i < nm; i++)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
434 if (m_perm[i] == -1)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
435 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
436 found = false;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
437 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
438 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
439 else
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
440 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
441 tmp[m_perm[i]] = 1;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
442 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
443
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
444 if (found)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
445 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
446 octave_idx_type k = ncols;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
447 for (octave_idx_type i = 0; i < nrows; i++)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
448 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
449 if (tmp[i] == -1)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
450 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
451 if (k < nrows)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
452 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
453 m_perm[k++] = i;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
454 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
455 else
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
456 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
457 found = false;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
458 break;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
459 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
460 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
461 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
462 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
463
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
464 if (found)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
465 m_type = MatrixType::Permuted_Lower;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
466 else
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
467 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
468 delete [] m_perm;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
469 m_nperm = 0;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
470 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
471 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
472 else
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
473 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
474 delete [] m_perm;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
475 m_nperm = 0;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
476 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
477 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
478
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
479 // FIXME: Disable lower under-determined and upper over-determined
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
480 // problems as being detected, and force to treat as singular
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
481 // as this seems to cause issues.
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
482 if (((m_type == MatrixType::Lower
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
483 || m_type == MatrixType::Permuted_Lower)
19864
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
484 && nrows > ncols)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
485 || ((m_type == MatrixType::Upper
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
486 || m_type == MatrixType::Permuted_Upper)
19864
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
487 && nrows < ncols))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
488 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
489 if (m_type == MatrixType::Permuted_Upper
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
490 || m_type == MatrixType::Permuted_Lower)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
491 delete [] m_perm;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
492 m_nperm = 0;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
493 m_type = MatrixType::Rectangular;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
494 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
495
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
496 if (m_type == MatrixType::Full && ncols != nrows)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
497 m_type = MatrixType::Rectangular;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
498
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
499 if (maybe_hermitian && (m_type == MatrixType::Full
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
500 || m_type == MatrixType::Tridiagonal
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
501 || m_type == MatrixType::Banded))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
502 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
503 bool is_herm = true;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
504
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
505 // first, check whether the diagonal is positive & extract it
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
506 ColumnVector diag (ncols);
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
507
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
508 for (octave_idx_type j = 0; is_herm && j < ncols; j++)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
509 {
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
510 is_herm = false;
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
511 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
512 {
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
513 if (a.ridx (i) == j)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
514 {
22246
fa917f1f0faf MatrixType: remove duplicate code for SparseMatrix and ComplexSparseMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22241
diff changeset
515 T d = a.data (i);
23708
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23534
diff changeset
516 is_herm = (std::real (d) > 0.0
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23534
diff changeset
517 && std::imag (d) == 0.0);
750e42a35adc Use imag, real, arg from std library for Complex types.
Rik <rik@octave.org>
parents: 23534
diff changeset
518 diag(j) = std::real (d);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
519 break;
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
520 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
521 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
522 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
523
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
524 // next, check symmetry and 2x2 positiveness
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
525
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
526 for (octave_idx_type j = 0; is_herm && j < ncols; j++)
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
527 for (octave_idx_type i = a.cidx (j); is_herm && i < a.cidx (j+1); i++)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
528 {
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
529 octave_idx_type k = a.ridx (i);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
530 is_herm = k == j;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
531 if (is_herm)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
532 continue;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
533
22246
fa917f1f0faf MatrixType: remove duplicate code for SparseMatrix and ComplexSparseMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22241
diff changeset
534 T d = a.data (i);
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
535 if (std::norm (d) < diag(j)*diag(k))
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
536 {
22274
edcad35c364f don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents: 22246
diff changeset
537 d = octave::math::conj (d);
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
538 for (octave_idx_type l = a.cidx (k); l < a.cidx (k+1); l++)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
539 {
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
540 if (a.ridx (l) == j)
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
541 {
15018
3d8ace26c5b4 maint: Use Octave coding conventions for cuddled parentheses in liboctave/.
Rik <rik@octave.org>
parents: 14846
diff changeset
542 is_herm = a.data (l) == d;
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
543 break;
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
544 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
545 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
546 }
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
547 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
548
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
549 if (is_herm)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
550 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
551 if (m_type == MatrixType::Full)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
552 m_type = MatrixType::Hermitian;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
553 else if (m_type == MatrixType::Banded)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
554 m_type = MatrixType::Banded_Hermitian;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
555 else
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
556 m_type = MatrixType::Tridiagonal_Hermitian;
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
557 }
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
558 }
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
559 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
560 }
22246
fa917f1f0faf MatrixType: remove duplicate code for SparseMatrix and ComplexSparseMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22241
diff changeset
561
fa917f1f0faf MatrixType: remove duplicate code for SparseMatrix and ComplexSparseMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22241
diff changeset
562
5892
13aa80fc7839 [project @ 2006-07-15 18:15:58 by jwe]
jwe
parents: 5785
diff changeset
563 MatrixType::MatrixType (const matrix_type t, bool _full)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
564 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
565 m_sp_bandden (octave::sparse_params::get_bandden ()),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
566 m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
567 m_dense (false), m_full (_full), m_nperm (0), m_perm (nullptr)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
568 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
569 if (t == MatrixType::Unknown || t == MatrixType::Full
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
570 || t == MatrixType::Diagonal || t == MatrixType::Permuted_Diagonal
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
571 || t == MatrixType::Upper || t == MatrixType::Lower
7798
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
572 || t == MatrixType::Tridiagonal || t == MatrixType::Tridiagonal_Hermitian
42c42c640108 improved matrix_type check
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
573 || t == MatrixType::Rectangular)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
574 m_type = t;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
575 else
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
576 warn_invalid ();
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
577 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
578
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
579 MatrixType::MatrixType (const matrix_type t, const octave_idx_type np,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
580 const octave_idx_type *p, bool _full)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
581 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
582 m_sp_bandden (octave::sparse_params::get_bandden ()),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
583 m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
584 m_dense (false), m_full (_full), m_nperm (0), m_perm (nullptr)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
585 {
19864
17d647821d61 maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
586 if ((t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower)
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23708
diff changeset
587 && np > 0 && p != nullptr)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
588 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
589 m_type = t;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
590 m_nperm = np;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
591 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
592 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
593 m_perm[i] = p[i];
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
594 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
595 else
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
596 warn_invalid ();
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
597 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
598
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
599 MatrixType::MatrixType (const matrix_type t, const octave_idx_type ku,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
600 const octave_idx_type kl, bool _full)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
601 : m_type (MatrixType::Unknown),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
602 m_sp_bandden (octave::sparse_params::get_bandden ()),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
603 m_bandden (0), m_upper_band (0), m_lower_band (0),
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
604 m_dense (false), m_full (_full), m_nperm (0), m_perm (nullptr)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
605 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
606 if (t == MatrixType::Banded || t == MatrixType::Banded_Hermitian)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
607 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
608 m_type = t;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
609 m_upper_band = ku;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
610 m_lower_band = kl;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
611 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
612 else
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
613 warn_invalid ();
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
614 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
615
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
616 MatrixType::~MatrixType ()
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
617 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
618 if (m_nperm != 0)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
619 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
620 delete [] m_perm;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
621 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
622 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
623
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
624 MatrixType&
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
625 MatrixType::operator = (const MatrixType& a)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
626 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
627 if (this != &a)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
628 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
629 m_type = a.m_type;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
630 m_sp_bandden = a.m_sp_bandden;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
631 m_bandden = a.m_bandden;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
632 m_upper_band = a.m_upper_band;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
633 m_lower_band = a.m_lower_band;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
634 m_dense = a.m_dense;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
635 m_full = a.m_full;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
636
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
637 if (m_nperm)
12564
61cd086e9aeb Correct slight logical mistake in memleak patch (bug #32804)
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12563
diff changeset
638 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
639 delete[] m_perm;
12564
61cd086e9aeb Correct slight logical mistake in memleak patch (bug #32804)
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12563
diff changeset
640 }
61cd086e9aeb Correct slight logical mistake in memleak patch (bug #32804)
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12563
diff changeset
641
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
642 if (a.m_nperm != 0)
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
643 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
644 m_perm = new octave_idx_type [a.m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
645 for (octave_idx_type i = 0; i < a.m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
646 m_perm[i] = a.m_perm[i];
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
647 }
12563
681bb733f4f4 MatrixType:: plug memory leak (bug #32804).
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11586
diff changeset
648
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
649 m_nperm = a.m_nperm;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
650 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
651
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
652 return *this;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
653 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
654
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
655 int
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
656 MatrixType::type (bool quiet)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
657 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
658 if (m_type != MatrixType::Unknown
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
659 && (m_full || m_sp_bandden == octave::sparse_params::get_bandden ()))
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
660 {
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
661 if (! quiet && octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
662 warn_cached ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
663
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
664 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
665 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
666
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
667 if (m_type != MatrixType::Unknown
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
668 && octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
669 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
670 ("Octave:matrix-type-info", "invalidating matrix type");
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
671
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
672 m_type = MatrixType::Unknown;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
673
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
674 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
675 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
676
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
677 int
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
678 MatrixType::type (const SparseMatrix& a)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
679 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
680 if (m_type != MatrixType::Unknown
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
681 && (m_full || m_sp_bandden == octave::sparse_params::get_bandden ()))
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
682 {
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
683 if (octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
684 warn_cached ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
685
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
686 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
687 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
688
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
689 MatrixType tmp_typ (a);
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
690 m_type = tmp_typ.m_type;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
691 m_sp_bandden = tmp_typ.m_sp_bandden;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
692 m_bandden = tmp_typ.m_bandden;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
693 m_upper_band = tmp_typ.m_upper_band;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
694 m_lower_band = tmp_typ.m_lower_band;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
695 m_dense = tmp_typ.m_dense;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
696 m_full = tmp_typ.m_full;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
697 m_nperm = tmp_typ.m_nperm;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
698
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
699 if (m_nperm != 0)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
700 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
701 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
702 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
703 m_perm[i] = tmp_typ.m_perm[i];
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
704 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
705
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
706 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
707 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
708
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
709 int
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
710 MatrixType::type (const SparseComplexMatrix& a)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
711 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
712 if (m_type != MatrixType::Unknown
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
713 && (m_full || m_sp_bandden == octave::sparse_params::get_bandden ()))
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
714 {
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
715 if (octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
716 warn_cached ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
717
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
718 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
719 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
720
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
721 MatrixType tmp_typ (a);
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
722 m_type = tmp_typ.m_type;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
723 m_sp_bandden = tmp_typ.m_sp_bandden;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
724 m_bandden = tmp_typ.m_bandden;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
725 m_upper_band = tmp_typ.m_upper_band;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
726 m_lower_band = tmp_typ.m_lower_band;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
727 m_dense = tmp_typ.m_dense;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
728 m_full = tmp_typ.m_full;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
729 m_nperm = tmp_typ.m_nperm;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
730
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
731 if (m_nperm != 0)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
732 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
733 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
734 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
735 m_perm[i] = tmp_typ.m_perm[i];
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
736 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
737
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
738 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
739 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
740
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
741 int
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
742 MatrixType::type (const Matrix& a)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
743 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
744 if (m_type != MatrixType::Unknown)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
745 {
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
746 if (octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
747 warn_cached ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
748
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
749 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
750 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
751
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
752 MatrixType tmp_typ (a);
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
753 m_type = tmp_typ.m_type;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
754 m_full = tmp_typ.m_full;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
755 m_nperm = tmp_typ.m_nperm;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
756
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
757 if (m_nperm != 0)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
758 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
759 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
760 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
761 m_perm[i] = tmp_typ.m_perm[i];
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
762 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
763
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
764 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
765 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
766
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
767 int
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
768 MatrixType::type (const ComplexMatrix& a)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
769 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
770 if (m_type != MatrixType::Unknown)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
771 {
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
772 if (octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
773 warn_cached ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
774
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
775 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
776 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
777
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
778 MatrixType tmp_typ (a);
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
779 m_type = tmp_typ.m_type;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
780 m_full = tmp_typ.m_full;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
781 m_nperm = tmp_typ.m_nperm;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
782
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
783 if (m_nperm != 0)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
784 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
785 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
786 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
787 m_perm[i] = tmp_typ.m_perm[i];
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
788 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
789
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
790 return m_type;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
791 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
792
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
793 int
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
794 MatrixType::type (const FloatMatrix& a)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
795 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
796 if (m_type != MatrixType::Unknown)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
797 {
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
798 if (octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
799 warn_cached ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
800
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
801 return m_type;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
802 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
803
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
804 MatrixType tmp_typ (a);
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
805 m_type = tmp_typ.m_type;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
806 m_full = tmp_typ.m_full;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
807 m_nperm = tmp_typ.m_nperm;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
808
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
809 if (m_nperm != 0)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
810 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
811 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
812 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
813 m_perm[i] = tmp_typ.m_perm[i];
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
814 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
815
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
816 return m_type;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
817 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
818
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
819 int
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
820 MatrixType::type (const FloatComplexMatrix& a)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
821 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
822 if (m_type != MatrixType::Unknown)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
823 {
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
824 if (octave::sparse_params::get_key ("spumoni") != 0.)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
825 warn_cached ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
826
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
827 return m_type;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
828 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
829
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
830 MatrixType tmp_typ (a);
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
831 m_type = tmp_typ.m_type;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
832 m_full = tmp_typ.m_full;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
833 m_nperm = tmp_typ.m_nperm;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
834
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
835 if (m_nperm != 0)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
836 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
837 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
838 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
839 m_perm[i] = tmp_typ.m_perm[i];
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
840 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
841
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
842 return m_type;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
843 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
844
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
845 void
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
846 MatrixType::info () const
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
847 {
29872
df2cdf42a909 update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents: 29603
diff changeset
848 if (octave::sparse_params::get_key ("spumoni") != 0.)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
849 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
850 if (m_type == MatrixType::Unknown)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
851 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
852 ("Octave:matrix-type-info", "unknown matrix type");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
853 else if (m_type == MatrixType::Diagonal)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
854 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
855 ("Octave:matrix-type-info", "diagonal sparse matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
856 else if (m_type == MatrixType::Permuted_Diagonal)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
857 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
858 ("Octave:matrix-type-info", "permuted diagonal sparse matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
859 else if (m_type == MatrixType::Upper)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
860 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
861 ("Octave:matrix-type-info", "upper triangular matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
862 else if (m_type == MatrixType::Lower)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
863 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
864 ("Octave:matrix-type-info", "lower triangular matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
865 else if (m_type == MatrixType::Permuted_Upper)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
866 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
867 ("Octave:matrix-type-info", "permuted upper triangular matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
868 else if (m_type == MatrixType::Permuted_Lower)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
869 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
870 ("Octave:matrix-type-info", "permuted lower triangular Matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
871 else if (m_type == MatrixType::Banded)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
872 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
873 ("Octave:matrix-type-info",
26569
0e77df67b522 Add static compile-time checking of printf functions in liboctave.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26435
diff changeset
874 "banded sparse matrix %" OCTAVE_IDX_TYPE_FORMAT "-1-"
0e77df67b522 Add static compile-time checking of printf functions in liboctave.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26435
diff changeset
875 "%" OCTAVE_IDX_TYPE_FORMAT " (density %f)",
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
876 m_lower_band, m_upper_band, m_bandden);
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
877 else if (m_type == MatrixType::Banded_Hermitian)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
878 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
879 ("Octave:matrix-type-info",
26569
0e77df67b522 Add static compile-time checking of printf functions in liboctave.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26435
diff changeset
880 "banded hermitian/symmetric sparse matrix %" OCTAVE_IDX_TYPE_FORMAT
0e77df67b522 Add static compile-time checking of printf functions in liboctave.
Markus Mützel <markus.muetzel@gmx.de>
parents: 26435
diff changeset
881 "-1-%" OCTAVE_IDX_TYPE_FORMAT " (density %f)",
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
882 m_lower_band, m_upper_band, m_bandden);
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
883 else if (m_type == MatrixType::Hermitian)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
884 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
885 ("Octave:matrix-type-info", "hermitian/symmetric matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
886 else if (m_type == MatrixType::Tridiagonal)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
887 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
888 ("Octave:matrix-type-info", "tridiagonal sparse matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
889 else if (m_type == MatrixType::Tridiagonal_Hermitian)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
890 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
891 ("Octave:matrix-type-info",
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
892 "hermitian/symmetric tridiagonal sparse matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
893 else if (m_type == MatrixType::Rectangular)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
894 (*current_liboctave_warning_with_id_handler)
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
895 ("Octave:matrix-type-info", "rectangular/singular matrix");
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
896 else if (m_type == MatrixType::Full)
19410
95c533ed464b use warning IDs for all warnings in liboctave
John W. Eaton <jwe@octave.org>
parents: 19269
diff changeset
897 (*current_liboctave_warning_with_id_handler)
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
898 ("Octave:matrix-type-info", "m_full matrix");
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
899 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
900 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
901
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
902 void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
903 MatrixType::mark_as_symmetric ()
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
904 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
905 if (m_type == MatrixType::Tridiagonal
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
906 || m_type == MatrixType::Tridiagonal_Hermitian)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
907 m_type = MatrixType::Tridiagonal_Hermitian;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
908 else if (m_type == MatrixType::Banded
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
909 || m_type == MatrixType::Banded_Hermitian)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
910 m_type = MatrixType::Banded_Hermitian;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
911 else if (m_type == MatrixType::Full || m_type == MatrixType::Hermitian
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
912 || m_type == MatrixType::Unknown)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
913 m_type = MatrixType::Hermitian;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
914 else
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
915 (*current_liboctave_error_handler)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
916 ("Can not mark current matrix type as symmetric");
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
917 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
918
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
919 void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
920 MatrixType::mark_as_unsymmetric ()
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
921 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
922 if (m_type == MatrixType::Tridiagonal
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
923 || m_type == MatrixType::Tridiagonal_Hermitian)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
924 m_type = MatrixType::Tridiagonal;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
925 else if (m_type == MatrixType::Banded
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
926 || m_type == MatrixType::Banded_Hermitian)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
927 m_type = MatrixType::Banded;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
928 else if (m_type == MatrixType::Full || m_type == MatrixType::Hermitian
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
929 || m_type == MatrixType::Unknown)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
930 m_type = MatrixType::Full;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
931 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
932
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
933 void
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
934 MatrixType::mark_as_permuted (const octave_idx_type np,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
935 const octave_idx_type *p)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
936 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
937 m_nperm = np;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
938 m_perm = new octave_idx_type [m_nperm];
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
939 for (octave_idx_type i = 0; i < m_nperm; i++)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
940 m_perm[i] = p[i];
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
941
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
942 if (m_type == MatrixType::Diagonal
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
943 || m_type == MatrixType::Permuted_Diagonal)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
944 m_type = MatrixType::Permuted_Diagonal;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
945 else if (m_type == MatrixType::Upper || m_type == MatrixType::Permuted_Upper)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
946 m_type = MatrixType::Permuted_Upper;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
947 else if (m_type == MatrixType::Lower || m_type == MatrixType::Permuted_Lower)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
948 m_type = MatrixType::Permuted_Lower;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
949 else
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
950 (*current_liboctave_error_handler)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
951 ("Can not mark current matrix type as symmetric");
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
952 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
953
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
954 void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
955 MatrixType::mark_as_unpermuted ()
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
956 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
957 if (m_nperm)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
958 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
959 m_nperm = 0;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
960 delete [] m_perm;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
961 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
962
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
963 if (m_type == MatrixType::Diagonal
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
964 || m_type == MatrixType::Permuted_Diagonal)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
965 m_type = MatrixType::Diagonal;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
966 else if (m_type == MatrixType::Upper || m_type == MatrixType::Permuted_Upper)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
967 m_type = MatrixType::Upper;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
968 else if (m_type == MatrixType::Lower || m_type == MatrixType::Permuted_Lower)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
969 m_type = MatrixType::Lower;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
970 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
971
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
972 MatrixType
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
973 MatrixType::transpose () const
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
974 {
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
975 MatrixType retval (*this);
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
976 if (m_type == MatrixType::Upper)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
977 retval.m_type = MatrixType::Lower;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
978 else if (m_type == MatrixType::Permuted_Upper)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
979 retval.m_type = MatrixType::Permuted_Lower;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
980 else if (m_type == MatrixType::Lower)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
981 retval.m_type = MatrixType::Upper;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
982 else if (m_type == MatrixType::Permuted_Lower)
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
983 retval.m_type = MatrixType::Permuted_Upper;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
984 else if (m_type == MatrixType::Banded)
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
985 {
30085
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
986 retval.m_upper_band = m_lower_band;
46001ac1b6b1 maint: use "m_" prefix for member variables in class MatrixType.
Rik <rik@octave.org>
parents: 29872
diff changeset
987 retval.m_lower_band = m_upper_band;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
988 }
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
989
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
990 return retval;
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents:
diff changeset
991 }
22275
e70183e8264f * MatrixType.cc: Instantiate template constructors we need.
John W. Eaton <jwe@octave.org>
parents: 22274
diff changeset
992
e70183e8264f * MatrixType.cc: Instantiate template constructors we need.
John W. Eaton <jwe@octave.org>
parents: 22274
diff changeset
993 // Instantiate MatrixType template constructors that we need.
e70183e8264f * MatrixType.cc: Instantiate template constructors we need.
John W. Eaton <jwe@octave.org>
parents: 22274
diff changeset
994
e70183e8264f * MatrixType.cc: Instantiate template constructors we need.
John W. Eaton <jwe@octave.org>
parents: 22274
diff changeset
995 template MatrixType::MatrixType (const MSparse<double>&);
e70183e8264f * MatrixType.cc: Instantiate template constructors we need.
John W. Eaton <jwe@octave.org>
parents: 22274
diff changeset
996 template MatrixType::MatrixType (const MSparse<Complex>&);