Mercurial > hg > octave-nkf
annotate liboctave/array/MatrixType.h @ 20442:a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
* liboctave/array/Array.h (Array::length): deprecate for ::numel.
* liboctave/array/Sparse.h (Sparse::length): deprecate for ::numel.
* libgui/graphics/QtHandlesUtils.cc, libgui/src/octave-qt-link.cc,
libinterp/corefcn/Cell.cc, libinterp/corefcn/__contourc__.cc,
libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc,
libinterp/corefcn/cellfun.cc, libinterp/corefcn/daspk.cc,
libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/gl-render.h, libinterp/corefcn/graphics.cc,
libinterp/corefcn/graphics.in.h, libinterp/corefcn/help.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/load-path.cc, libinterp/corefcn/load-save.cc,
libinterp/corefcn/ls-oct-ascii.h, libinterp/corefcn/lsode.cc,
libinterp/corefcn/matrix_type.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-map.h,
libinterp/corefcn/oct-obj.h, libinterp/corefcn/oct-stream.cc,
libinterp/corefcn/oct-stream.h, libinterp/corefcn/pr-output.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/rand.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/strfns.cc,
libinterp/corefcn/sub2ind.cc, libinterp/corefcn/symtab.h,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/tsearch.cc,
libinterp/corefcn/urlwrite.cc, libinterp/corefcn/utils.cc,
libinterp/corefcn/variables.cc, libinterp/corefcn/xdiv.cc,
libinterp/corefcn/xpow.cc, libinterp/dldfcn/__glpk__.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__magick_read__.cc,
libinterp/dldfcn/audiodevinfo.cc, libinterp/dldfcn/ccolamd.cc,
libinterp/dldfcn/colamd.cc, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-class.h,
libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-java.cc,
libinterp/octave-value/ov-perm.cc, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov.cc,
libinterp/operators/op-int.h, libinterp/parse-tree/pt-pr-code.cc,
liboctave/array/Array-util.cc, liboctave/array/Array.cc,
liboctave/array/CColVector.cc, liboctave/array/CDiagMatrix.cc,
liboctave/array/CMatrix.cc, liboctave/array/CRowVector.cc,
liboctave/array/DiagArray2.cc, liboctave/array/DiagArray2.h,
liboctave/array/MArray.cc, liboctave/array/PermMatrix.cc,
liboctave/array/PermMatrix.h, liboctave/array/Sparse.cc,
liboctave/array/boolMatrix.cc, liboctave/array/chMatrix.cc,
liboctave/array/chNDArray.cc, liboctave/array/dColVector.cc,
liboctave/array/dDiagMatrix.cc, liboctave/array/dMatrix.cc,
liboctave/array/dRowVector.cc, liboctave/array/fCColVector.cc,
liboctave/array/fCDiagMatrix.cc, liboctave/array/fCMatrix.cc,
liboctave/array/fCRowVector.cc, liboctave/array/fColVector.cc,
liboctave/array/fDiagMatrix.cc, liboctave/array/fMatrix.cc,
liboctave/array/fRowVector.cc, liboctave/array/idx-vector.cc,
liboctave/array/intNDArray.cc, liboctave/numeric/CmplxCHOL.cc,
liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxQR.cc,
liboctave/numeric/DASPK.cc, liboctave/numeric/DASRT.cc,
liboctave/numeric/DASSL.cc, liboctave/numeric/LSODE.cc,
liboctave/numeric/ODES.cc, liboctave/numeric/ODES.h,
liboctave/numeric/base-dae.h, liboctave/numeric/base-lu.cc,
liboctave/numeric/dbleCHOL.cc, liboctave/numeric/dbleLU.cc,
liboctave/numeric/dbleQR.cc, liboctave/numeric/eigs-base.cc,
liboctave/numeric/fCmplxCHOL.cc, liboctave/numeric/fCmplxLU.cc,
liboctave/numeric/fCmplxQR.cc, liboctave/numeric/floatCHOL.cc,
liboctave/numeric/floatLU.cc, liboctave/numeric/floatQR.cc,
liboctave/numeric/lo-specfun.cc, liboctave/numeric/oct-rand.cc,
liboctave/numeric/oct-spparms.cc, liboctave/numeric/sparse-base-chol.cc,
liboctave/operators/mx-inlines.cc, liboctave/system/file-ops.cc,
liboctave/util/glob-match.h, liboctave/util/kpse.cc,
liboctave/util/lo-regexp.cc, liboctave/util/oct-glob.cc,
liboctave/util/pathsearch.cc, liboctave/util/str-vec.cc,
liboctave/util/str-vec.h, liboctave/util/url-transfer.cc: replace all usage
of Array::length() and Sparse::length() with ::numel().
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sat, 30 May 2015 03:14:07 +0100 |
parents | 17d647821d61 |
children |
rev | line source |
---|---|
5785 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
3 Copyright (C) 2006-2015 David Bateman |
5785 | 4 Copyright (C) 2006 Andy Adler |
5 | |
7016 | 6 This file is part of Octave. |
7 | |
5785 | 8 Octave is free software; you can redistribute it and/or modify it |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5785 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5785 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_MatrixType_h) | |
25 #define octave_MatrixType_h | |
26 | |
27 class Matrix; | |
28 class ComplexMatrix; | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
29 class FloatMatrix; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
30 class FloatComplexMatrix; |
5785 | 31 class SparseMatrix; |
32 class SparseComplexMatrix; | |
33 | |
34 class | |
6108 | 35 OCTAVE_API |
5785 | 36 MatrixType |
37 { | |
38 public: | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
39 enum matrix_type |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
40 { |
5785 | 41 Unknown = 0, |
42 Full, | |
43 Diagonal, | |
44 Permuted_Diagonal, | |
45 Upper, | |
46 Lower, | |
47 Permuted_Upper, | |
48 Permuted_Lower, | |
49 Banded, | |
50 Hermitian, | |
51 Banded_Hermitian, | |
52 Tridiagonal, | |
53 Tridiagonal_Hermitian, | |
54 Rectangular | |
55 }; | |
56 | |
57 MatrixType (void); | |
6376 | 58 |
5785 | 59 MatrixType (const MatrixType &a); |
60 | |
61 MatrixType (const Matrix &a); | |
62 | |
63 MatrixType (const ComplexMatrix &a); | |
64 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
65 MatrixType (const FloatMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
66 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
67 MatrixType (const FloatComplexMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
68 |
5785 | 69 MatrixType (const SparseMatrix &a); |
70 | |
71 MatrixType (const SparseComplexMatrix &a); | |
72 | |
73 MatrixType (const matrix_type t, bool _full = false); | |
74 | |
75 MatrixType (const matrix_type t, const octave_idx_type np, | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
76 const octave_idx_type *p, bool _full = false); |
5785 | 77 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
78 MatrixType (const matrix_type t, const octave_idx_type ku, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
79 const octave_idx_type kl, bool _full = false); |
5785 | 80 |
81 ~MatrixType (void); | |
82 | |
83 MatrixType& operator = (const MatrixType& a); | |
84 | |
85 int type (bool quiet = true); | |
86 | |
87 int type (const Matrix &a); | |
88 | |
89 int type (const ComplexMatrix &a); | |
90 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
91 int type (const FloatMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
92 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
93 int type (const FloatComplexMatrix &a); |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
94 |
5785 | 95 int type (const SparseMatrix &a); |
96 | |
97 int type (const SparseComplexMatrix &a); | |
98 | |
99 double band_density (void) const { return bandden; } | |
100 | |
101 int nupper (void) const { return upper_band; } | |
102 | |
103 int nlower (void) const { return lower_band; } | |
104 | |
105 bool is_dense (void) const { return dense; } | |
106 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
107 bool is_diagonal (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
108 { return (typ == Diagonal || typ == Permuted_Diagonal); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
109 |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
110 bool is_upper_triangular (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
111 { return (typ == Upper || typ == Permuted_Upper); } |
5785 | 112 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
113 bool is_lower_triangular (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
114 { return (typ == Lower || typ == Permuted_Lower); } |
5785 | 115 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
116 bool is_banded (void) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
117 { return (typ == Banded || typ == Banded_Hermitian); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
118 |
5785 | 119 bool is_tridiagonal (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
120 { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
121 |
5785 | 122 bool is_hermitian (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
123 { |
20071
17d647821d61
maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents:
19898
diff
changeset
|
124 return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian |
17d647821d61
maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents:
19898
diff
changeset
|
125 || typ == Hermitian); |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 } |
5785 | 127 |
128 bool is_rectangular (void) const { return (typ == Rectangular); } | |
129 | |
130 bool is_known (void) const { return (typ != Unknown); } | |
131 | |
132 bool is_unknown (void) const { return (typ == Unknown); } | |
133 | |
134 void info (void) const; | |
135 | |
136 octave_idx_type * triangular_perm (void) const { return perm; } | |
137 | |
138 void invalidate_type (void) { typ = Unknown; } | |
139 | |
140 void mark_as_diagonal (void) { typ = Diagonal; } | |
141 | |
142 void mark_as_permuted_diagonal (void) { typ = Permuted_Diagonal; } | |
143 | |
144 void mark_as_upper_triangular (void) { typ = Upper; } | |
145 | |
146 void mark_as_lower_triangular (void) { typ = Lower; } | |
147 | |
148 void mark_as_tridiagonal (void) {typ = Tridiagonal; } | |
149 | |
150 void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
151 { typ = Banded; upper_band = ku; lower_band = kl; } |
5785 | 152 |
153 void mark_as_full (void) { typ = Full; } | |
154 | |
155 void mark_as_rectangular (void) { typ = Rectangular; } | |
156 | |
157 void mark_as_dense (void) { dense = true; } | |
158 | |
159 void mark_as_not_dense (void) { dense = false; } | |
160 | |
161 void mark_as_symmetric (void); | |
162 | |
163 void mark_as_unsymmetric (void); | |
164 | |
165 void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p); | |
166 | |
167 void mark_as_unpermuted (void); | |
168 | |
169 MatrixType transpose (void) const; | |
170 | |
171 private: | |
172 void type (int new_typ) { typ = static_cast<matrix_type>(new_typ); } | |
173 | |
174 matrix_type typ; | |
175 double sp_bandden; | |
176 double bandden; | |
177 octave_idx_type upper_band; | |
178 octave_idx_type lower_band; | |
179 bool dense; | |
180 bool full; | |
181 octave_idx_type nperm; | |
182 octave_idx_type *perm; | |
183 }; | |
184 | |
185 #endif |