GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ov-flt-cx-mat.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2025 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_ov_flt_cx_mat_h)
27#define octave_ov_flt_cx_mat_h 1
28
29#include "octave-config.h"
30
31#include <cstdlib>
32
33#include <iosfwd>
34#include <string>
35
36#include "mx-base.h"
37#include "str-vec.h"
38
39#include "error.h"
40#include "oct-stream.h"
41#include "ov-base.h"
42#include "ov-base-mat.h"
43#include "ov-typeinfo.h"
44
45#include "MatrixType.h"
46
48
49// Complex matrix values.
50
51extern template class OCTINTERP_EXTERN_TEMPLATE_API octave_base_matrix<FloatComplexNDArray>;
52
54{
55public:
56
59
62
65
68
71
74
77
80
83
85
87 { return new octave_float_complex_matrix (*this); }
90
91 octave_base_value * try_narrowing_conversion ();
92
94
95 bool is_complex_matrix () const { return true; }
96
97 bool iscomplex () const { return true; }
98
99 bool is_single_type () const { return true; }
100
101 bool isfloat () const { return true; }
102
103 double double_value (bool = false) const;
104
105 float float_value (bool = false) const;
106
107 double scalar_value (bool frc_str_conv = false) const
108 { return double_value (frc_str_conv); }
109
110 float float_scalar_value (bool frc_str_conv = false) const
111 { return float_value (frc_str_conv); }
112
113 Matrix matrix_value (bool = false) const;
114
115 FloatMatrix float_matrix_value (bool = false) const;
116
117 Complex complex_value (bool = false) const;
118
119 FloatComplex float_complex_value (bool = false) const;
120
121 ComplexMatrix complex_matrix_value (bool = false) const;
122
123 FloatComplexMatrix float_complex_matrix_value (bool = false) const;
124
125 ComplexNDArray complex_array_value (bool = false) const { return m_matrix; }
126
127 FloatComplexNDArray float_complex_array_value (bool = false) const;
128
129 boolNDArray bool_array_value (bool warn = false) const;
130
131 charNDArray char_array_value (bool frc_str_conv = false) const;
132
133 SparseMatrix sparse_matrix_value (bool = false) const;
134
135 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
136
137 octave_value as_double () const;
138 octave_value as_single () const;
139
140 octave_value diag (octave_idx_type k = 0) const;
141
143
144 void increment () { m_matrix += FloatComplex (1.0); }
145
146 void decrement () { m_matrix -= FloatComplex (1.0); }
147
148 void changesign () { m_matrix.changesign (); }
149
150 bool save_ascii (std::ostream& os);
151
152 bool load_ascii (std::istream& is);
153
154 bool save_binary (std::ostream& os, bool save_as_floats);
155
156 bool load_binary (std::istream& is, bool swap,
157 octave::mach_info::float_format fmt);
158
159 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
160
161 bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
162
163 int write (octave::stream& os, int block_size,
164 oct_data_conv::data_type output_type, int skip,
165 octave::mach_info::float_format flt_fmt) const
166 {
167 // Yes, for compatibility, we drop the imaginary part here.
168 return os.write (matrix_value (true), block_size, output_type,
169 skip, flt_fmt);
170 }
171
172 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
173
174 mxArray * as_mxArray (bool interleaved) const;
175
176 octave_value map (unary_mapper_t umap) const;
177
178private:
179
181};
182
183#endif
N Dimensional Array with copy-on-write semantics.
Definition Array.h:130
octave_base_value * clone() const
octave_float_complex_matrix(const FloatComplexDiagMatrix &d)
octave_float_complex_matrix(const FloatComplexMatrix &m)
octave_float_complex_matrix(const octave_float_complex_matrix &cm)
builtin_type_t builtin_type() const
octave_float_complex_matrix(const Array< FloatComplex > &m)
octave_base_value * empty_clone() const
ComplexNDArray complex_array_value(bool=false) const
octave_float_complex_matrix(const FloatComplexNDArray &m)
double scalar_value(bool frc_str_conv=false) const
int write(octave::stream &os, int block_size, oct_data_conv::data_type output_type, int skip, octave::mach_info::float_format flt_fmt) const
octave_float_complex_matrix(const FloatComplexMatrix &m, const MatrixType &t)
octave_float_complex_matrix(const FloatComplexColumnVector &v)
float float_scalar_value(bool frc_str_conv=false) const
~octave_float_complex_matrix()=default
octave_float_complex_matrix(const FloatComplexRowVector &v)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
std::complex< double > Complex
Definition oct-cmplx.h:33
std::complex< float > FloatComplex
Definition oct-cmplx.h:34
int64_t octave_hdf5_id
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA_API(API)
Definition ov-base.h:185
builtin_type_t
Definition ov-base.h:83
@ btyp_float_complex
Definition ov-base.h:87