Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined (octave_complex_matrix_h)
00025 #define octave_complex_matrix_h 1
00026
00027 #include <cstdlib>
00028
00029 #include <iosfwd>
00030 #include <string>
00031
00032 #include "mx-base.h"
00033 #include "oct-alloc.h"
00034 #include "str-vec.h"
00035
00036 #include "error.h"
00037 #include "oct-stream.h"
00038 #include "ov-base.h"
00039 #include "ov-base-mat.h"
00040 #include "ov-typeinfo.h"
00041
00042 #include "MatrixType.h"
00043
00044 class octave_value_list;
00045
00046 class tree_walker;
00047
00048
00049
00050 class
00051 OCTINTERP_API
00052 octave_complex_matrix : public octave_base_matrix<ComplexNDArray>
00053 {
00054 public:
00055
00056 octave_complex_matrix (void)
00057 : octave_base_matrix<ComplexNDArray> () { }
00058
00059 octave_complex_matrix (const ComplexNDArray& m)
00060 : octave_base_matrix<ComplexNDArray> (m) { }
00061
00062 octave_complex_matrix (const ComplexMatrix& m)
00063 : octave_base_matrix<ComplexNDArray> (m) { }
00064
00065 octave_complex_matrix (const ComplexMatrix& m, const MatrixType& t)
00066 : octave_base_matrix<ComplexNDArray> (m, t) { }
00067
00068 octave_complex_matrix (const Array<Complex>& m)
00069 : octave_base_matrix<ComplexNDArray> (ComplexNDArray (m)) { }
00070
00071 octave_complex_matrix (const ComplexDiagMatrix& d)
00072 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (d)) { }
00073
00074 octave_complex_matrix (const ComplexRowVector& v)
00075 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { }
00076
00077 octave_complex_matrix (const ComplexColumnVector& v)
00078 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { }
00079
00080 octave_complex_matrix (const octave_complex_matrix& cm)
00081 : octave_base_matrix<ComplexNDArray> (cm) { }
00082
00083 ~octave_complex_matrix (void) { }
00084
00085 octave_base_value *clone (void) const { return new octave_complex_matrix (*this); }
00086 octave_base_value *empty_clone (void) const { return new octave_complex_matrix (); }
00087
00088 type_conv_info numeric_demotion_function (void) const;
00089
00090 octave_base_value *try_narrowing_conversion (void);
00091
00092 builtin_type_t builtin_type (void) const { return btyp_complex; }
00093
00094 bool is_complex_matrix (void) const { return true; }
00095
00096 bool is_complex_type (void) const { return true; }
00097
00098 bool is_double_type (void) const { return true; }
00099
00100 bool is_float_type (void) const { return true; }
00101
00102 double double_value (bool = false) const;
00103
00104 float float_value (bool = false) const;
00105
00106 double scalar_value (bool frc_str_conv = false) const
00107 { return double_value (frc_str_conv); }
00108
00109 float float_scalar_value (bool frc_str_conv = false) const
00110 { return float_value (frc_str_conv); }
00111
00112 Matrix matrix_value (bool = false) const;
00113
00114 FloatMatrix float_matrix_value (bool = false) const;
00115
00116 Complex complex_value (bool = false) const;
00117
00118 FloatComplex float_complex_value (bool = false) const;
00119
00120 ComplexMatrix complex_matrix_value (bool = false) const;
00121
00122 FloatComplexMatrix float_complex_matrix_value (bool = false) const;
00123
00124 ComplexNDArray complex_array_value (bool = false) const { return matrix; }
00125
00126 FloatComplexNDArray float_complex_array_value (bool = false) const;
00127
00128 boolNDArray bool_array_value (bool warn = false) const;
00129
00130 charNDArray char_array_value (bool frc_str_conv = false) const;
00131
00132 SparseMatrix sparse_matrix_value (bool = false) const;
00133
00134 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
00135
00136 octave_value diag (octave_idx_type k = 0) const;
00137
00138 void increment (void) { matrix += Complex (1.0); }
00139
00140 void decrement (void) { matrix -= Complex (1.0); }
00141
00142 void changesign (void) { matrix.changesign (); }
00143
00144 bool save_ascii (std::ostream& os);
00145
00146 bool load_ascii (std::istream& is);
00147
00148 bool save_binary (std::ostream& os, bool& save_as_floats);
00149
00150 bool load_binary (std::istream& is, bool swap,
00151 oct_mach_info::float_format fmt);
00152
00153 #if defined (HAVE_HDF5)
00154 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
00155
00156 bool load_hdf5 (hid_t loc_id, const char *name);
00157 #endif
00158
00159 int write (octave_stream& os, int block_size,
00160 oct_data_conv::data_type output_type, int skip,
00161 oct_mach_info::float_format flt_fmt) const
00162 {
00163
00164 return os.write (matrix_value (true), block_size, output_type,
00165 skip, flt_fmt);
00166 }
00167
00168 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
00169
00170 mxArray *as_mxArray (void) const;
00171
00172 octave_value map (unary_mapper_t umap) const;
00173
00174 private:
00175
00176 DECLARE_OCTAVE_ALLOCATOR
00177
00178 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
00179 };
00180
00181 #endif