GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-flt-cx-mat.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2015 John W. Eaton
4 Copyright (C) 2009-2010 VZLU Prague
5 
6 This file is part of Octave.
7 
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
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
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
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_ov_flt_cx_mat_h)
25 #define octave_ov_flt_cx_mat_h 1
26 
27 #include <cstdlib>
28 
29 #include <iosfwd>
30 #include <string>
31 
32 #include "mx-base.h"
33 #include "str-vec.h"
34 
35 #include "error.h"
36 #include "oct-stream.h"
37 #include "ov-base.h"
38 #include "ov-base-mat.h"
39 #include "ov-typeinfo.h"
40 
41 #include "MatrixType.h"
42 
43 class octave_value_list;
44 
45 class tree_walker;
46 
47 // Complex matrix values.
48 
49 class
52 {
53 public:
54 
57 
60 
63 
66 
69 
72 
75 
78 
81 
83 
84  octave_base_value *clone (void) const
85  { return new octave_float_complex_matrix (*this); }
87  { return new octave_float_complex_matrix (); }
88 
89  octave_base_value *try_narrowing_conversion (void);
90 
92 
93  bool is_complex_matrix (void) const { return true; }
94 
95  bool is_complex_type (void) const { return true; }
96 
97  bool is_single_type (void) const { return true; }
98 
99  bool is_float_type (void) const { return true; }
100 
101  double double_value (bool = false) const;
102 
103  float float_value (bool = false) const;
104 
105  double scalar_value (bool frc_str_conv = false) const
106  { return double_value (frc_str_conv); }
107 
108  float float_scalar_value (bool frc_str_conv = false) const
109  { return float_value (frc_str_conv); }
110 
111  Matrix matrix_value (bool = false) const;
112 
113  FloatMatrix float_matrix_value (bool = false) const;
114 
115  Complex complex_value (bool = false) const;
116 
117  FloatComplex float_complex_value (bool = false) const;
118 
119  ComplexMatrix complex_matrix_value (bool = false) const;
120 
121  FloatComplexMatrix float_complex_matrix_value (bool = false) const;
122 
123  ComplexNDArray complex_array_value (bool = false) const { return matrix; }
124 
125  FloatComplexNDArray float_complex_array_value (bool = false) const;
126 
127  boolNDArray bool_array_value (bool warn = false) const;
128 
129  charNDArray char_array_value (bool frc_str_conv = false) const;
130 
131  SparseMatrix sparse_matrix_value (bool = false) const;
132 
133  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
134 
135  octave_value diag (octave_idx_type k = 0) const;
136 
137  octave_value diag (octave_idx_type m, octave_idx_type n) const;
138 
139  void increment (void) { matrix += FloatComplex (1.0); }
140 
141  void decrement (void) { matrix -= FloatComplex (1.0); }
142 
143  void changesign (void) { matrix.changesign (); }
144 
145  bool save_ascii (std::ostream& os);
146 
147  bool load_ascii (std::istream& is);
148 
149  bool save_binary (std::ostream& os, bool& save_as_floats);
150 
151  bool load_binary (std::istream& is, bool swap,
153 
154  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
155 
156  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
157 
158  int write (octave_stream& os, int block_size,
159  oct_data_conv::data_type output_type, int skip,
160  oct_mach_info::float_format flt_fmt) const
161  {
162  // Yes, for compatibility, we drop the imaginary part here.
163  return os.write (matrix_value (true), block_size, output_type,
164  skip, flt_fmt);
165  }
166 
167  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
168 
169  mxArray *as_mxArray (void) const;
170 
171  octave_value map (unary_mapper_t umap) const;
172 
173 private:
174 
175 
177 };
178 
179 #endif
double scalar_value(bool frc_str_conv=false) const
octave_base_value * clone(void) const
Definition: ov-flt-cx-mat.h:84
octave_float_complex_matrix(const Array< FloatComplex > &m)
Definition: ov-flt-cx-mat.h:67
bool is_single_type(void) const
Definition: ov-flt-cx-mat.h:97
builtin_type_t
Definition: ov-base.h:59
F77_RET_T const double const double double * d
ComplexNDArray complex_array_value(bool=false) const
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:142
float float_scalar_value(bool frc_str_conv=false) const
#define OCTINTERP_API
Definition: mexproto.h:66
octave_float_complex_matrix(const octave_float_complex_matrix &cm)
Definition: ov-flt-cx-mat.h:79
bool is_complex_type(void) const
Definition: ov-flt-cx-mat.h:95
Definition: dMatrix.h:35
int write(octave_stream &os, int block_size, oct_data_conv::data_type output_type, int skip, oct_mach_info::float_format flt_fmt) const
builtin_type_t builtin_type(void) const
Definition: ov-flt-cx-mat.h:91
octave_float_complex_matrix(const FloatComplexRowVector &v)
Definition: ov-flt-cx-mat.h:73
octave_float_complex_matrix(const FloatComplexMatrix &m, const MatrixType &t)
Definition: ov-flt-cx-mat.h:64
octave_float_complex_matrix(const FloatComplexMatrix &m)
Definition: ov-flt-cx-mat.h:61
octave_idx_type write(const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, oct_mach_info::float_format flt_fmt)
Definition: oct-stream.cc:3546
octave_float_complex_matrix(const FloatComplexColumnVector &v)
Definition: ov-flt-cx-mat.h:76
std::complex< float > FloatComplex
Definition: oct-cmplx.h:30
std::complex< double > Complex
Definition: oct-cmplx.h:29
bool is_float_type(void) const
Definition: ov-flt-cx-mat.h:99
octave_base_value * empty_clone(void) const
Definition: ov-flt-cx-mat.h:86
octave_float_complex_matrix(const FloatComplexNDArray &m)
Definition: ov-flt-cx-mat.h:58
octave_float_complex_matrix(const FloatComplexDiagMatrix &d)
Definition: ov-flt-cx-mat.h:70
bool is_complex_matrix(void) const
Definition: ov-flt-cx-mat.h:93