GNU Octave  3.8.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-cx-sparse.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2013 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
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_cx_sparse_h)
25 #define octave_ov_cx_sparse_h 1
26 
27 #include <cstdlib>
28 
29 #include <iosfwd>
30 #include <string>
31 
32 #include "mx-base.h"
33 #include "oct-alloc.h"
34 #include "str-vec.h"
35 
36 #include "error.h"
37 #include "oct-stream.h"
38 #include "ov-base.h"
39 #include "ov-typeinfo.h"
40 
41 #include "CSparse.h"
42 #include "ov-base-sparse.h"
43 #include "ov-re-sparse.h"
44 
45 class octave_value_list;
46 
47 class tree_walker;
48 
49 class
52 {
53 public:
54 
57 
60 
63 
66 
68  const MatrixType &t)
70 
73 
75  const MatrixType &t)
77 
79  const MatrixType &t)
81 
84 
87 
89 
90  octave_base_value *clone (void) const
91  { return new octave_sparse_complex_matrix (*this); }
92  octave_base_value *empty_clone (void) const
93  { return new octave_sparse_complex_matrix (); }
94 
95  octave_base_value *try_narrowing_conversion (void);
96 
97  builtin_type_t builtin_type (void) const { return btyp_complex; }
98 
99  bool is_complex_matrix (void) const { return true; }
100 
101  bool is_complex_type (void) const { return true; }
102 
103  bool is_double_type (void) const { return true; }
104 
105  bool is_float_type (void) const { return true; }
106 
107  double double_value (bool = false) const;
108 
109  double scalar_value (bool frc_str_conv = false) const
110  { return double_value (frc_str_conv); }
111 
112  Matrix matrix_value (bool = false) const;
113 
114  Complex complex_value (bool = false) const;
115 
116  ComplexMatrix complex_matrix_value (bool = false) const;
117 
118  ComplexNDArray complex_array_value (bool = false) const;
119 
120  charNDArray char_array_value (bool frc_str_conv = false) const;
121 
122  SparseMatrix sparse_matrix_value (bool = false) const;
123 
124  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
125  { return matrix; }
126 
127  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
128 
129 #if 0
130  int write (octave_stream& os, int block_size,
131  oct_data_conv::data_type output_type, int skip,
132  oct_mach_info::float_format flt_fmt) const
133  {
134  // Yes, for compatibility, we drop the imaginary part here.
135  return os.write (matrix_value (true), block_size, output_type,
136  skip, flt_fmt);
137  }
138 #endif
139 
140  bool save_binary (std::ostream& os, bool& save_as_floats);
141 
142  bool load_binary (std::istream& is, bool swap,
144 
145 #if defined (HAVE_HDF5)
146  bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
147 
148  bool load_hdf5 (hid_t loc_id, const char *name);
149 #endif
150 
151  mxArray *as_mxArray (void) const;
152 
153  octave_value map (unary_mapper_t umap) const;
154 
155 private:
156 
158 
160 };
161 
162 #endif