Mercurial > octave
annotate liboctave/array/dColVector.h @ 33657:6f2baadfdb3d bytecode-interpreter tip
maint: Merge default to bytecode-interpreter.
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Tue, 04 Jun 2024 20:06:05 -0400 |
parents | 4b601ca024d5 |
children |
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 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31855
diff
changeset
|
3 // Copyright (C) 1994-2024 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 //////////////////////////////////////////////////////////////////////// |
458 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
26 #if ! defined (octave_dColVector_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
27 #define octave_dColVector_h 1 |
458 | 28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
30 |
1214 | 31 #include "MArray.h" |
458 | 32 #include "mx-defs.h" |
33 | |
32628
ae4e19c0a2b1
maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents:
31855
diff
changeset
|
34 class OCTAVE_API ColumnVector : public MArray<double> |
458 | 35 { |
36 public: | |
37 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
38 ColumnVector () : MArray<double> (dim_vector (0, 1)) { } |
3585 | 39 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
40 explicit ColumnVector (octave_idx_type n) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
41 : MArray<double> (dim_vector (n, 1)) { } |
3585 | 42 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11574
diff
changeset
|
43 explicit ColumnVector (const dim_vector& dv) |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
44 : MArray<double> (dv.as_column ()) { } |
9612
66970dd627f6
further liboctave design improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
45 |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
46 ColumnVector (octave_idx_type n, double val) |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
47 : MArray<double> (dim_vector (n, 1), val) { } |
3585 | 48 |
49 ColumnVector (const ColumnVector& a) : MArray<double> (a) { } | |
50 | |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
51 ColumnVector (const MArray<double>& a) : MArray<double> (a.as_column ()) { } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
52 ColumnVector (const Array<double>& a) : MArray<double> (a.as_column ()) { } |
458 | 53 |
54 ColumnVector& operator = (const ColumnVector& a) | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
55 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
56 MArray<double>::operator = (a); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
58 } |
458 | 59 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
60 ~ColumnVector () = default; |
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
61 |
29646
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
62 OCTAVE_API bool operator == (const ColumnVector& a) const; |
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
63 OCTAVE_API bool operator != (const ColumnVector& a) const; |
458 | 64 |
1359 | 65 // destructive insert/delete/reorder operations |
458 | 66 |
29646
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
67 OCTAVE_API ColumnVector& insert (const ColumnVector& a, octave_idx_type r); |
458 | 68 |
29646
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
69 OCTAVE_API ColumnVector& fill (double val); |
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
70 OCTAVE_API ColumnVector& |
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
71 fill (double val, octave_idx_type r1, octave_idx_type r2); |
458 | 72 |
29646
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
73 OCTAVE_API ColumnVector stack (const ColumnVector& a) const; |
458 | 74 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
75 OCTAVE_API RowVector transpose () const; |
458 | 76 |
6108 | 77 friend OCTAVE_API ColumnVector real (const ComplexColumnVector& a); |
78 friend OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | |
1205 | 79 |
1359 | 80 // resize is the destructive equivalent for this one |
458 | 81 |
29646
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
82 OCTAVE_API ColumnVector |
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
83 extract (octave_idx_type r1, octave_idx_type r2) const; |
458 | 84 |
29646
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
85 OCTAVE_API ColumnVector |
3e8bc8bee8e9
liboctave/array: Add visibility flags to functions declared in headers (bug #60567).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
86 extract_n (octave_idx_type r1, octave_idx_type n) const; |
4316 | 87 |
1359 | 88 // matrix by column vector -> column vector operations |
458 | 89 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 friend OCTAVE_API ColumnVector operator * (const Matrix& a, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
91 const ColumnVector& b); |
458 | 92 |
1359 | 93 // diagonal matrix by column vector -> column vector operations |
458 | 94 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
95 friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
96 const ColumnVector& b); |
458 | 97 |
1359 | 98 // other operations |
458 | 99 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
100 OCTAVE_API double min () const; |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
101 OCTAVE_API double max () const; |
458 | 102 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
103 OCTAVE_API ColumnVector abs () const; |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
104 |
1359 | 105 // i/o |
458 | 106 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
107 friend OCTAVE_API std::ostream& operator << (std::ostream& os, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
108 const ColumnVector& a); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
109 friend OCTAVE_API std::istream& operator >> (std::istream& is, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
110 ColumnVector& a); |
458 | 111 |
14616
13cc11418393
improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
112 void resize (octave_idx_type n, const double& rfv = 0) |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
113 { |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
114 Array<double>::resize (dim_vector (n, 1), rfv); |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
115 } |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
116 |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
117 void clear (octave_idx_type n) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
118 { Array<double>::clear (n, 1); } |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
119 |
458 | 120 }; |
121 | |
5508 | 122 // Publish externally used friend functions. |
123 | |
6108 | 124 extern OCTAVE_API ColumnVector real (const ComplexColumnVector& a); |
125 extern OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | |
5508 | 126 |
3573 | 127 MARRAY_FORWARD_DEFS (MArray, ColumnVector, double) |
128 | |
458 | 129 #endif |