annotate liboctave/array/DiagArray2.h @ 17769:49a5a4be04a1

maint: Use GNU style coding conventions for code in liboctave/ * liboctave/array/Array-C.cc, liboctave/array/Array-b.cc, liboctave/array/Array-ch.cc, liboctave/array/Array-d.cc, liboctave/array/Array-f.cc, liboctave/array/Array-fC.cc, liboctave/array/Array-util.cc, liboctave/array/Array-util.h, liboctave/array/Array.cc, liboctave/array/Array.h, liboctave/array/Array3.h, liboctave/array/CColVector.cc, liboctave/array/CColVector.h, liboctave/array/CDiagMatrix.cc, liboctave/array/CDiagMatrix.h, liboctave/array/CMatrix.cc, liboctave/array/CMatrix.h, liboctave/array/CNDArray.cc, liboctave/array/CNDArray.h, liboctave/array/CRowVector.cc, liboctave/array/CRowVector.h, liboctave/array/CSparse.cc, liboctave/array/CSparse.h, liboctave/array/DiagArray2.h, liboctave/array/MArray.cc, liboctave/array/MArray.h, liboctave/array/MDiagArray2.cc, liboctave/array/MDiagArray2.h, liboctave/array/MSparse.cc, liboctave/array/MSparse.h, liboctave/array/MatrixType.cc, liboctave/array/MatrixType.h, liboctave/array/PermMatrix.h, liboctave/array/Range.cc, liboctave/array/Range.h, liboctave/array/Sparse.cc, liboctave/array/Sparse.h, liboctave/array/boolMatrix.cc, liboctave/array/boolMatrix.h, liboctave/array/boolNDArray.cc, liboctave/array/boolNDArray.h, liboctave/array/boolSparse.cc, liboctave/array/boolSparse.h, liboctave/array/chMatrix.cc, liboctave/array/chMatrix.h, liboctave/array/chNDArray.cc, liboctave/array/chNDArray.h, liboctave/array/dColVector.h, liboctave/array/dDiagMatrix.cc, liboctave/array/dDiagMatrix.h, liboctave/array/dMatrix.cc, liboctave/array/dMatrix.h, liboctave/array/dNDArray.cc, liboctave/array/dNDArray.h, liboctave/array/dRowVector.h, liboctave/array/dSparse.cc, liboctave/array/dSparse.h, liboctave/array/dim-vector.cc, liboctave/array/dim-vector.h, liboctave/array/fCColVector.cc, liboctave/array/fCColVector.h, liboctave/array/fCDiagMatrix.cc, liboctave/array/fCDiagMatrix.h, liboctave/array/fCMatrix.cc, liboctave/array/fCMatrix.h, liboctave/array/fCNDArray.cc, liboctave/array/fCNDArray.h, liboctave/array/fCRowVector.cc, liboctave/array/fCRowVector.h, liboctave/array/fColVector.h, liboctave/array/fDiagMatrix.cc, liboctave/array/fDiagMatrix.h, liboctave/array/fMatrix.cc, liboctave/array/fMatrix.h, liboctave/array/fNDArray.cc, liboctave/array/fNDArray.h, liboctave/array/fRowVector.h, liboctave/array/idx-vector.cc, liboctave/array/idx-vector.h, liboctave/array/intNDArray.cc, liboctave/array/intNDArray.h, liboctave/cruft/misc/blaswrap.c, liboctave/cruft/misc/quit.cc, liboctave/numeric/CmplxCHOL.cc, liboctave/numeric/CmplxCHOL.h, liboctave/numeric/CmplxGEPBAL.cc, liboctave/numeric/CmplxGEPBAL.h, liboctave/numeric/CmplxHESS.h, liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxLU.h, liboctave/numeric/CmplxQR.cc, liboctave/numeric/CmplxQRP.cc, liboctave/numeric/CmplxQRP.h, liboctave/numeric/CmplxSCHUR.h, liboctave/numeric/CmplxSVD.cc, liboctave/numeric/CmplxSVD.h, liboctave/numeric/CollocWt.h, liboctave/numeric/DAE.h, liboctave/numeric/DAEFunc.h, liboctave/numeric/DAERT.h, liboctave/numeric/DAERTFunc.h, liboctave/numeric/DASPK.cc, liboctave/numeric/DASRT.cc, liboctave/numeric/DASRT.h, liboctave/numeric/DASSL.cc, liboctave/numeric/DET.h, liboctave/numeric/EIG.cc, liboctave/numeric/EIG.h, liboctave/numeric/LSODE.cc, liboctave/numeric/ODE.h, liboctave/numeric/ODEFunc.h, liboctave/numeric/ODES.h, liboctave/numeric/ODESFunc.h, liboctave/numeric/Quad.cc, liboctave/numeric/Quad.h, liboctave/numeric/SparseCmplxCHOL.h, liboctave/numeric/SparseCmplxLU.cc, liboctave/numeric/SparseCmplxLU.h, liboctave/numeric/SparseCmplxQR.cc, liboctave/numeric/SparseCmplxQR.h, liboctave/numeric/SparseQR.cc, liboctave/numeric/SparseQR.h, liboctave/numeric/SparsedbleCHOL.h, liboctave/numeric/SparsedbleLU.cc, liboctave/numeric/SparsedbleLU.h, liboctave/numeric/base-aepbal.h, liboctave/numeric/base-dae.h, liboctave/numeric/base-de.h, liboctave/numeric/base-lu.cc, liboctave/numeric/base-lu.h, liboctave/numeric/base-min.h, liboctave/numeric/base-qr.h, liboctave/numeric/bsxfun.h, liboctave/numeric/dbleCHOL.cc, liboctave/numeric/dbleCHOL.h, liboctave/numeric/dbleGEPBAL.h, liboctave/numeric/dbleHESS.h, liboctave/numeric/dbleLU.cc, liboctave/numeric/dbleLU.h, liboctave/numeric/dbleQR.cc, liboctave/numeric/dbleQRP.cc, liboctave/numeric/dbleQRP.h, liboctave/numeric/dbleSCHUR.cc, liboctave/numeric/dbleSCHUR.h, liboctave/numeric/dbleSVD.cc, liboctave/numeric/dbleSVD.h, liboctave/numeric/eigs-base.cc, liboctave/numeric/fCmplxAEPBAL.cc, liboctave/numeric/fCmplxAEPBAL.h, liboctave/numeric/fCmplxCHOL.cc, liboctave/numeric/fCmplxCHOL.h, liboctave/numeric/fCmplxGEPBAL.cc, liboctave/numeric/fCmplxGEPBAL.h, liboctave/numeric/fCmplxHESS.h, liboctave/numeric/fCmplxLU.cc, liboctave/numeric/fCmplxLU.h, liboctave/numeric/fCmplxQR.cc, liboctave/numeric/fCmplxQR.h, liboctave/numeric/fCmplxQRP.cc, liboctave/numeric/fCmplxQRP.h, liboctave/numeric/fCmplxSCHUR.cc, liboctave/numeric/fCmplxSCHUR.h, liboctave/numeric/fCmplxSVD.h, liboctave/numeric/fEIG.cc, liboctave/numeric/fEIG.h, liboctave/numeric/floatCHOL.cc, liboctave/numeric/floatCHOL.h, liboctave/numeric/floatGEPBAL.cc, liboctave/numeric/floatGEPBAL.h, liboctave/numeric/floatHESS.h, liboctave/numeric/floatLU.cc, liboctave/numeric/floatLU.h, liboctave/numeric/floatQR.cc, liboctave/numeric/floatQRP.cc, liboctave/numeric/floatQRP.h, liboctave/numeric/floatSCHUR.cc, liboctave/numeric/floatSCHUR.h, liboctave/numeric/floatSVD.cc, liboctave/numeric/floatSVD.h, liboctave/numeric/lo-mappers.cc, liboctave/numeric/lo-mappers.h, liboctave/numeric/lo-specfun.cc, liboctave/numeric/lo-specfun.h, liboctave/numeric/oct-convn.cc, liboctave/numeric/oct-fftw.cc, liboctave/numeric/oct-fftw.h, liboctave/numeric/oct-norm.cc, liboctave/numeric/oct-rand.cc, liboctave/numeric/oct-rand.h, liboctave/numeric/randgamma.c, liboctave/numeric/randgamma.h, liboctave/numeric/randmtzig.c, liboctave/numeric/randpoisson.c, liboctave/numeric/randpoisson.h, liboctave/numeric/sparse-base-chol.h, liboctave/numeric/sparse-base-lu.h, liboctave/numeric/sparse-dmsolve.cc, liboctave/operators/Sparse-diag-op-defs.h, liboctave/operators/Sparse-op-defs.h, liboctave/operators/mx-inlines.cc, liboctave/system/dir-ops.h, liboctave/system/file-ops.cc, liboctave/system/file-stat.cc, liboctave/system/file-stat.h, liboctave/system/lo-sysdep.cc, liboctave/system/lo-sysdep.h, liboctave/system/mach-info.cc, liboctave/system/mach-info.h, liboctave/system/oct-env.cc, liboctave/system/oct-group.cc, liboctave/system/oct-syscalls.cc, liboctave/system/oct-syscalls.h, liboctave/system/oct-time.h, liboctave/system/tempname.c, liboctave/util/action-container.h, liboctave/util/base-list.h, liboctave/util/cmd-edit.cc, liboctave/util/cmd-edit.h, liboctave/util/cmd-hist.cc, liboctave/util/cmd-hist.h, liboctave/util/data-conv.cc, liboctave/util/data-conv.h, liboctave/util/kpse.cc, liboctave/util/lo-array-gripes.cc, liboctave/util/lo-cieee.c, liboctave/util/lo-regexp.cc, liboctave/util/lo-utils.cc, liboctave/util/oct-alloc.cc, liboctave/util/oct-base64.cc, liboctave/util/oct-binmap.h, liboctave/util/oct-cmplx.h, liboctave/util/oct-glob.cc, liboctave/util/oct-inttypes.cc, liboctave/util/oct-inttypes.h, liboctave/util/oct-locbuf.cc, liboctave/util/oct-locbuf.h, liboctave/util/oct-mem.h, liboctave/util/oct-mutex.cc, liboctave/util/oct-refcount.h, liboctave/util/oct-shlib.cc, liboctave/util/oct-shlib.h, liboctave/util/oct-sort.cc, liboctave/util/oct-sort.h, liboctave/util/pathsearch.cc, liboctave/util/pathsearch.h, liboctave/util/sparse-util.cc, liboctave/util/str-vec.cc, liboctave/util/str-vec.h, liboctave/util/unwind-prot.h, liboctave/util/url-transfer.cc, liboctave/util/url-transfer.h: Use GNU style coding conventions.
author Rik <rik@octave.org>
date Sat, 26 Oct 2013 18:57:05 -0700
parents d63878346099
children 2e0613dadfee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1993
1b57120c997b [project @ 1996-03-03 01:16:15 by jwe]
jwe
parents: 1988
diff changeset
1 // Template array classes
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
2 /*
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
3
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 15431
diff changeset
4 Copyright (C) 1996-2013 John W. Eaton
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10521
diff changeset
5 Copyright (C) 2008-2009 Jaroslav Hajek
10521
4d1fc073fbb7 add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents: 10364
diff changeset
6 Copyright (C) 2010 VZLU Prague
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
7
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
8 This file is part of Octave.
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
9
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
10 Octave is free software; you can redistribute it and/or modify it
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
11 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5775
diff changeset
12 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5775
diff changeset
13 option) any later version.
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
14
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
15 Octave is distributed in the hope that it will be useful, but WITHOUT
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
18 for more details.
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
19
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
20 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5775
diff changeset
21 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5775
diff changeset
22 <http://www.gnu.org/licenses/>.
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
23
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
24 */
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
25
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
26 #if !defined (octave_DiagArray2_h)
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
27 #define octave_DiagArray2_h 1
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
28
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
29 #include <cassert>
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
30 #include <cstdlib>
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
31
4645
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4513
diff changeset
32 #include "Array.h"
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
33
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
34 // Array<T> is inherited privately so that some methods, like index, don't
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
35 // produce unexpected results.
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
36
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
37 template <class T>
3585
d9803711e047 [project @ 2000-02-08 04:35:39 by jwe]
jwe
parents: 2847
diff changeset
38 class
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
39 DiagArray2 : protected Array<T>
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
40 {
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
41 protected:
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
42 octave_idx_type d1, d2;
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
43
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
44 public:
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
45
14128
6258e5cd0f56 Use typename keyword to refer to templates
Elias Pipping <pipping@exherbo.org>
parents: 11586
diff changeset
46 using typename Array<T>::element_type;
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
47
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
48 DiagArray2 (void)
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
49 : Array<T> (), d1 (0), d2 (0) { }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
50
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
51 DiagArray2 (octave_idx_type r, octave_idx_type c)
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
52 : Array<T> (dim_vector (std::min (r, c), 1)), d1 (r), d2 (c) { }
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4192
diff changeset
53
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
54 DiagArray2 (octave_idx_type r, octave_idx_type c, const T& val)
11570
57632dea2446 attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
55 : Array<T> (dim_vector (std::min (r, c), 1), val), d1 (r), d2 (c) { }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
56
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
57 explicit DiagArray2 (const Array<T>& a)
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10312
diff changeset
58 : Array<T> (a.as_column ()), d1 (a.numel ()), d2 (a.numel ()) { }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
59
10363
a0728e81ed25 improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents: 10362
diff changeset
60 DiagArray2 (const Array<T>& a, octave_idx_type r, octave_idx_type c);
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10358
diff changeset
61
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
62 DiagArray2 (const DiagArray2<T>& a)
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
63 : Array<T> (a), d1 (a.d1), d2 (a.d2) { }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
64
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
65 template <class U>
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
66 DiagArray2 (const DiagArray2<U>& a)
15428
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14628
diff changeset
67 : Array<T> (a.extract_diag ()), d1 (a.dim1 ()), d2 (a.dim2 ()) { }
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
68
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
69 ~DiagArray2 (void) { }
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
70
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
71 DiagArray2<T>& operator = (const DiagArray2<T>& a)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
72 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
73 if (this != &a)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
74 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
75 Array<T>::operator = (a);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
76 d1 = a.d1;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
77 d2 = a.d2;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
78 }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
79
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
80 return *this;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
81 }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
82
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
83 octave_idx_type dim1 (void) const { return d1; }
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
84 octave_idx_type dim2 (void) const { return d2; }
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
85
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
86 octave_idx_type rows (void) const { return dim1 (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
87 octave_idx_type cols (void) const { return dim2 (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
88 octave_idx_type columns (void) const { return dim2 (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
89
9698
7c6d5d8c8d37 fix diag*diag multiplication
Jaroslav Hajek <highegg@gmail.com>
parents: 9612
diff changeset
90 octave_idx_type diag_length (void) const { return Array<T>::length (); }
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
91 // FIXME: a dangerous ambiguity?
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
92 octave_idx_type length (void) const { return Array<T>::length (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
93 octave_idx_type nelem (void) const { return dim1 () * dim2 (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
94 octave_idx_type numel (void) const { return nelem (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
95
10358
72fab01e5d68 improve some size_t queries
Jaroslav Hajek <highegg@gmail.com>
parents: 10352
diff changeset
96 size_t byte_size (void) const { return Array<T>::byte_size (); }
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
97
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
98 dim_vector dims (void) const { return dim_vector (d1, d2); }
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
99
15431
3e101e8b3dac Tweak deprecated attribute placement (cset:21467c7fc08f) to allow code to compile
Rik <rik@octave.org>
parents: 15430
diff changeset
100 Array<T> diag (octave_idx_type k = 0) const GCC_ATTR_DEPRECATED;
15428
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14628
diff changeset
101 Array<T> extract_diag (octave_idx_type k = 0) const;
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14628
diff changeset
102 DiagArray2<T> build_diag_matrix () const
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14628
diff changeset
103 {
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14628
diff changeset
104 return DiagArray2<T> (array_value ());
fd5c0159b588 Fix diag handling of diagvectors (bug #37411)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14628
diff changeset
105 }
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
106
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
107 // Warning: the non-const two-index versions will silently ignore assignments
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
108 // to off-diagonal elements.
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
109
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
110 T elem (octave_idx_type r, octave_idx_type c) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
111 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
112 return (r == c) ? Array<T>::elem (r) : T (0);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
113 }
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
114
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
115 T& elem (octave_idx_type r, octave_idx_type c)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
116 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
117 static T zero (0);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
118 return (r == c) ? Array<T>::elem (r) : zero;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
119 }
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
120
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
121 T dgelem (octave_idx_type i) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
122 { return Array<T>::elem (i); }
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
123
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
124 T& dgelem (octave_idx_type i)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
125 { return Array<T>::elem (i); }
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
126
14628
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
127 T checkelem (octave_idx_type r, octave_idx_type c) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
128 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
129 return check_idx (r, c) ? elem (r, c) : T (0);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
130 }
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
131
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
132 T operator () (octave_idx_type r, octave_idx_type c) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
133 {
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
134 #if defined (BOUNDS_CHECKING)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
135 return checkelem (r, c);
14628
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
136 #else
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
137 return elem (r, c);
14590
6250e1232c9c Implement proper op() indexing for diagonal matrices (bug #36368)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
138 #endif
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
139 }
14628
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
140
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
141 T& checkelem (octave_idx_type r, octave_idx_type c)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
142 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
143 static T zero (0);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
144 return check_idx (r, c) ? elem (r, c) : zero;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
145 }
14590
6250e1232c9c Implement proper op() indexing for diagonal matrices (bug #36368)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
146
6250e1232c9c Implement proper op() indexing for diagonal matrices (bug #36368)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
147 T& operator () (octave_idx_type r, octave_idx_type c)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
148 {
14590
6250e1232c9c Implement proper op() indexing for diagonal matrices (bug #36368)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
149 #if defined (BOUNDS_CHECKING)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
150 return checkelem (r, c);
14628
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
151 #else
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
152 return elem (r, c);
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
153 #endif
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
154 }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
155
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
156 // No checking.
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
157
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8314
diff changeset
158 T xelem (octave_idx_type r, octave_idx_type c) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
159 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
160 return (r == c) ? Array<T>::xelem (r) : T (0);
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
161 }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
162
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
163 T& dgxelem (octave_idx_type i)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
164 { return Array<T>::xelem (i); }
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
165
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
166 T dgxelem (octave_idx_type i) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
167 { return Array<T>::xelem (i); }
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
168
14616
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
169 void resize (octave_idx_type n, octave_idx_type m, const T& rfv);
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
170 void resize (octave_idx_type n, octave_idx_type m)
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
171 {
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
172 resize (n, m, Array<T>::resize_fill_value ());
13cc11418393 improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
173 }
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
174
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
175 DiagArray2<T> transpose (void) const;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
176 DiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const;
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
177
10363
a0728e81ed25 improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents: 10362
diff changeset
178 Array<T> array_value (void) const;
8524
937921654627 clean up Array and DiagArray2
Jaroslav Hajek <highegg@gmail.com>
parents: 8375
diff changeset
179
8375
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
180 const T *data (void) const { return Array<T>::data (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
181
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
182 const T *fortran_vec (void) const { return Array<T>::fortran_vec (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
183
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
184 T *fortran_vec (void) { return Array<T>::fortran_vec (); }
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
185
e3c9102431a9 fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
186 void print_info (std::ostream& os, const std::string& prefix) const
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
187 { Array<T>::print_info (os, prefix); }
14628
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
188
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
189 private:
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
190
63ae976ac2e7 preserve DiagArray2 interface for stable release series
John W. Eaton <jwe@octave.org>
parents: 14590
diff changeset
191 bool check_idx (octave_idx_type r, octave_idx_type c) const;
1988
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
192 };
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
193
7b56630a1e05 [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents:
diff changeset
194 #endif