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_map;
00045 class octave_value_list;
00046
00047 class tree_walker;
00048
00049
00050
00051 class
00052 OCTINTERP_API
00053 octave_complex_matrix : public octave_base_matrix<ComplexNDArray>
00054 {
00055 public:
00056
00057 octave_complex_matrix (void)
00058 : octave_base_matrix<ComplexNDArray> () { }
00059
00060 octave_complex_matrix (const ComplexNDArray& m)
00061 : octave_base_matrix<ComplexNDArray> (m) { }
00062
00063 octave_complex_matrix (const ComplexMatrix& m)
00064 : octave_base_matrix<ComplexNDArray> (m) { }
00065
00066 octave_complex_matrix (const ComplexMatrix& m, const MatrixType& t)
00067 : octave_base_matrix<ComplexNDArray> (m, t) { }
00068
00069 octave_complex_matrix (const Array<Complex>& m)
00070 : octave_base_matrix<ComplexNDArray> (ComplexNDArray (m)) { }
00071
00072 octave_complex_matrix (const ComplexDiagMatrix& d)
00073 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (d)) { }
00074
00075 octave_complex_matrix (const ComplexRowVector& v)
00076 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { }
00077
00078 octave_complex_matrix (const ComplexColumnVector& v)
00079 : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { }
00080
00081 octave_complex_matrix (const octave_complex_matrix& cm)
00082 : octave_base_matrix<ComplexNDArray> (cm) { }
00083
00084 ~octave_complex_matrix (void) { }
00085
00086 octave_base_value *clone (void) const { return new octave_complex_matrix (*this); }
00087 octave_base_value *empty_clone (void) const { return new octave_complex_matrix (); }
00088
00089 type_conv_info numeric_demotion_function (void) const;
00090
00091 octave_base_value *try_narrowing_conversion (void);
00092
00093 builtin_type_t builtin_type (void) const { return btyp_complex; }
00094
00095 bool is_complex_matrix (void) const { return true; }
00096
00097 bool is_complex_type (void) const { return true; }
00098
00099 bool is_double_type (void) const { return true; }
00100
00101 bool is_float_type (void) const { return true; }
00102
00103 double double_value (bool = false) const;
00104
00105 float float_value (bool = false) const;
00106
00107 double scalar_value (bool frc_str_conv = false) const
00108 { return double_value (frc_str_conv); }
00109
00110 float float_scalar_value (bool frc_str_conv = false) const
00111 { return float_value (frc_str_conv); }
00112
00113 Matrix matrix_value (bool = false) const;
00114
00115 FloatMatrix float_matrix_value (bool = false) const;
00116
00117 Complex complex_value (bool = false) const;
00118
00119 FloatComplex float_complex_value (bool = false) const;
00120
00121 ComplexMatrix complex_matrix_value (bool = false) const;
00122
00123 FloatComplexMatrix float_complex_matrix_value (bool = false) const;
00124
00125 ComplexNDArray complex_array_value (bool = false) const { return matrix; }
00126
00127 FloatComplexNDArray float_complex_array_value (bool = false) const;
00128
00129 charNDArray char_array_value (bool frc_str_conv = false) const;
00130
00131 SparseMatrix sparse_matrix_value (bool = false) const;
00132
00133 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
00134
00135 octave_value diag (octave_idx_type k = 0) const;
00136
00137 void increment (void) { matrix += Complex (1.0); }
00138
00139 void decrement (void) { matrix -= Complex (1.0); }
00140
00141 void changesign (void) { matrix.changesign (); }
00142
00143 bool save_ascii (std::ostream& os);
00144
00145 bool load_ascii (std::istream& is);
00146
00147 bool save_binary (std::ostream& os, bool& save_as_floats);
00148
00149 bool load_binary (std::istream& is, bool swap,
00150 oct_mach_info::float_format fmt);
00151
00152 #if defined (HAVE_HDF5)
00153 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
00154
00155 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug);
00156 #endif
00157
00158 int write (octave_stream& os, int block_size,
00159 oct_data_conv::data_type output_type, int skip,
00160 oct_mach_info::float_format flt_fmt) const
00161 {
00162
00163 return os.write (matrix_value (true), block_size, output_type,
00164 skip, flt_fmt);
00165 }
00166
00167 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
00168
00169 mxArray *as_mxArray (void) const;
00170
00171 octave_value erf (void) const;
00172 octave_value erfc (void) const;
00173 octave_value gamma (void) const;
00174 octave_value lgamma (void) const;
00175 octave_value abs (void) const;
00176 octave_value acos (void) const;
00177 octave_value acosh (void) const;
00178 octave_value angle (void) const;
00179 octave_value arg (void) const;
00180 octave_value asin (void) const;
00181 octave_value asinh (void) const;
00182 octave_value atan (void) const;
00183 octave_value atanh (void) const;
00184 octave_value ceil (void) const;
00185 octave_value conj (void) const;
00186 octave_value cos (void) const;
00187 octave_value cosh (void) const;
00188 octave_value exp (void) const;
00189 octave_value expm1 (void) const;
00190 octave_value fix (void) const;
00191 octave_value floor (void) const;
00192 octave_value imag (void) const;
00193 octave_value log (void) const;
00194 octave_value log2 (void) const;
00195 octave_value log10 (void) const;
00196 octave_value log1p (void) const;
00197 octave_value real (void) const;
00198 octave_value round (void) const;
00199 octave_value roundb (void) const;
00200 octave_value signum (void) const;
00201 octave_value sin (void) const;
00202 octave_value sinh (void) const;
00203 octave_value sqrt (void) const;
00204 octave_value tan (void) const;
00205 octave_value tanh (void) const;
00206 octave_value finite (void) const;
00207 octave_value isinf (void) const;
00208 octave_value isna (void) const;
00209 octave_value isnan (void) const;
00210
00211 private:
00212
00213 DECLARE_OCTAVE_ALLOCATOR
00214
00215 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
00216 };
00217
00218 #endif
00219
00220
00221
00222
00223
00224