Mercurial > octave
annotate libinterp/octave-value/ov-cx-mat.h @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | 7854d5752dd2 |
children | b3ca7f891750 |
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 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3 // Copyright (C) 1996-2022 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 //////////////////////////////////////////////////////////////////////// |
2376 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19863
diff
changeset
|
26 #if ! defined (octave_ov_cx_mat_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
27 #define octave_ov_cx_mat_h 1 |
2376 | 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 |
2376 | 31 #include <cstdlib> |
32 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
33 #include <iosfwd> |
2376 | 34 #include <string> |
35 | |
36 #include "mx-base.h" | |
37 #include "str-vec.h" | |
38 | |
39 #include "error.h" | |
4944 | 40 #include "oct-stream.h" |
2376 | 41 #include "ov-base.h" |
3219 | 42 #include "ov-base-mat.h" |
2376 | 43 #include "ov-typeinfo.h" |
44 | |
5785 | 45 #include "MatrixType.h" |
46 | |
2376 | 47 class octave_value_list; |
48 | |
2477 | 49 // Complex matrix values. |
2376 | 50 |
51 class | |
6693 | 52 OCTINTERP_API |
4513 | 53 octave_complex_matrix : public octave_base_matrix<ComplexNDArray> |
2376 | 54 { |
55 public: | |
56 | |
57 octave_complex_matrix (void) | |
4513 | 58 : octave_base_matrix<ComplexNDArray> () { } |
59 | |
60 octave_complex_matrix (const ComplexNDArray& m) | |
61 : octave_base_matrix<ComplexNDArray> (m) { } | |
2376 | 62 |
63 octave_complex_matrix (const ComplexMatrix& m) | |
4513 | 64 : octave_base_matrix<ComplexNDArray> (m) { } |
2376 | 65 |
5785 | 66 octave_complex_matrix (const ComplexMatrix& m, const MatrixType& t) |
67 : octave_base_matrix<ComplexNDArray> (m, t) { } | |
68 | |
9732
b4fdfee405b5
remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
69 octave_complex_matrix (const Array<Complex>& m) |
4911 | 70 : octave_base_matrix<ComplexNDArray> (ComplexNDArray (m)) { } |
71 | |
2376 | 72 octave_complex_matrix (const ComplexDiagMatrix& d) |
4513 | 73 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (d)) { } |
2376 | 74 |
3418 | 75 octave_complex_matrix (const ComplexRowVector& v) |
4513 | 76 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { } |
2376 | 77 |
3418 | 78 octave_complex_matrix (const ComplexColumnVector& v) |
4513 | 79 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { } |
2376 | 80 |
81 octave_complex_matrix (const octave_complex_matrix& cm) | |
4513 | 82 : octave_base_matrix<ComplexNDArray> (cm) { } |
2376 | 83 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
84 ~octave_complex_matrix (void) = default; |
2376 | 85 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
86 octave_base_value * clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 { return new octave_complex_matrix (*this); } |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
88 octave_base_value * empty_clone (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
89 { return new octave_complex_matrix (); } |
2376 | 90 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
91 type_conv_info numeric_demotion_function (void) const; |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
92 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
93 octave_base_value * try_narrowing_conversion (void); |
2410 | 94 |
9685 | 95 builtin_type_t builtin_type (void) const { return btyp_complex; } |
96 | |
2376 | 97 bool is_complex_matrix (void) const { return true; } |
98 | |
23581
c3075ae020e1
maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents:
23446
diff
changeset
|
99 bool iscomplex (void) const { return true; } |
2376 | 100 |
5895 | 101 bool is_double_type (void) const { return true; } |
102 | |
23585
570170b6eb09
maint: Deprecate is_float_type and replace with isfloat.
Rik <rik@octave.org>
parents:
23581
diff
changeset
|
103 bool isfloat (void) const { return true; } |
7576 | 104 |
3145 | 105 double double_value (bool = false) const; |
2376 | 106 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
107 float float_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
108 |
3145 | 109 double scalar_value (bool frc_str_conv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
110 { return double_value (frc_str_conv); } |
2916 | 111 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
112 float float_scalar_value (bool frc_str_conv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
113 { return float_value (frc_str_conv); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
114 |
19728
928ecc95f395
implement missing complex array extraction function
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
115 NDArray array_value (bool = false) const; |
928ecc95f395
implement missing complex array extraction function
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
116 |
2376 | 117 Matrix matrix_value (bool = false) const; |
118 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
119 FloatMatrix float_matrix_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
120 |
2376 | 121 Complex complex_value (bool = false) const; |
122 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
123 FloatComplex float_complex_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
124 |
2376 | 125 ComplexMatrix complex_matrix_value (bool = false) const; |
126 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
127 FloatComplexMatrix float_complex_matrix_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
128 |
4550 | 129 ComplexNDArray complex_array_value (bool = false) const { return matrix; } |
4543 | 130 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
131 FloatComplexNDArray float_complex_array_value (bool = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7740
diff
changeset
|
132 |
9853
8d9e4752441a
implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
133 boolNDArray bool_array_value (bool warn = false) const; |
8d9e4752441a
implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
134 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
135 charNDArray char_array_value (bool frc_str_conv = false) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
136 |
5164 | 137 SparseMatrix sparse_matrix_value (bool = false) const; |
138 | |
139 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | |
140 | |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
141 octave_value as_double (void) const; |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
142 octave_value as_single (void) const; |
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
143 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
144 octave_value diag (octave_idx_type k = 0) const; |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
145 |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
146 octave_value diag (octave_idx_type m, octave_idx_type n) const; |
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
147 |
3107 | 148 void increment (void) { matrix += Complex (1.0); } |
2376 | 149 |
3107 | 150 void decrement (void) { matrix -= Complex (1.0); } |
2376 | 151 |
9607
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
8950
diff
changeset
|
152 void changesign (void) { matrix.changesign (); } |
1be3c73ed7b5
reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents:
8950
diff
changeset
|
153 |
6974 | 154 bool save_ascii (std::ostream& os); |
4687 | 155 |
156 bool load_ascii (std::istream& is); | |
157 | |
26399
586413770c7f
pass save_as_floats by value in octave_value save_binary functions
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
158 bool save_binary (std::ostream& os, bool save_as_floats); |
4687 | 159 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
160 bool load_binary (std::istream& is, bool swap, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
161 octave::mach_info::float_format fmt); |
4687 | 162 |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19728
diff
changeset
|
163 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); |
4687 | 164 |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19728
diff
changeset
|
165 bool load_hdf5 (octave_hdf5_id loc_id, const char *name); |
4687 | 166 |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
167 int write (octave::stream& os, int block_size, |
10313 | 168 oct_data_conv::data_type output_type, int skip, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
169 octave::mach_info::float_format flt_fmt) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
170 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
171 // Yes, for compatibility, we drop the imaginary part here. |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
172 return os.write (matrix_value (true), block_size, output_type, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
173 skip, flt_fmt); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
174 } |
4944 | 175 |
4643 | 176 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
177 | |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
178 mxArray * as_mxArray (bool interleaved) const; |
5900 | 179 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9732
diff
changeset
|
180 octave_value map (unary_mapper_t umap) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
181 |
2376 | 182 private: |
183 | |
3219 | 184 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2376 | 185 }; |
186 | |
187 #endif |