GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-cx-sparse.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2018 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
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License 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 <https://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 "octave-config.h"
28 
29 #include <cstdlib>
30 
31 #include <iosfwd>
32 #include <string>
33 
34 #include "mx-base.h"
35 #include "str-vec.h"
36 
37 #include "error.h"
38 #include "oct-stream.h"
39 #include "ov-base.h"
40 #include "ov-typeinfo.h"
41 
42 #include "CSparse.h"
43 #include "ov-base-sparse.h"
44 #include "ov-re-sparse.h"
45 
46 class octave_value_list;
47 
48 class
49 OCTINTERP_API
51 {
52 public:
53 
56 
59 
62 
65 
67  const MatrixType& t)
69 
72 
74  const MatrixType& t)
76 
78  const MatrixType& t)
80 
83 
86 
87  ~octave_sparse_complex_matrix (void) = default;
88 
89  octave_base_value * clone (void) const
90  { return new octave_sparse_complex_matrix (*this); }
92  { return new octave_sparse_complex_matrix (); }
93 
94  octave_base_value * try_narrowing_conversion (void);
95 
96  builtin_type_t builtin_type (void) const { return btyp_complex; }
97 
98  bool is_complex_matrix (void) const { return true; }
99 
100  bool iscomplex (void) const { return true; }
101 
102  bool is_double_type (void) const { return true; }
103 
104  bool isfloat (void) const { return true; }
105 
106  double double_value (bool = false) const;
107 
108  double scalar_value (bool frc_str_conv = false) const
109  { return double_value (frc_str_conv); }
110 
111  Matrix matrix_value (bool = false) const;
112 
113  Complex complex_value (bool = false) const;
114 
115  ComplexMatrix complex_matrix_value (bool = false) const;
116 
117  ComplexNDArray complex_array_value (bool = false) const;
118 
119  charNDArray char_array_value (bool frc_str_conv = false) const;
120 
121  SparseMatrix sparse_matrix_value (bool = false) const;
122 
124  { return matrix; }
125 
126  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
127 
128  octave_value as_double (void) const;
129 
130 #if 0
131  int write (octave::stream& os, int block_size,
132  oct_data_conv::data_type output_type, int skip,
134  {
135  // Yes, for compatibility, we drop the imaginary part here.
136  return os.write (matrix_value (true), block_size, output_type,
137  skip, flt_fmt);
138  }
139 #endif
140 
141  bool save_binary (std::ostream& os, bool& save_as_floats);
142 
143  bool load_binary (std::istream& is, bool swap,
145 
146  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
147 
148  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
149 
150  mxArray * as_mxArray (void) const;
151 
152  octave_value map (unary_mapper_t umap) const;
153 
154 private:
155 
157 };
158 
159 #endif
octave_idx_type write(const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)
Definition: oct-stream.cc:6704
octave_sparse_complex_matrix(const octave_sparse_complex_matrix &cm)
Definition: ov-cx-sparse.h:84
octave_base_value * clone(void) const
Definition: ov-cx-sparse.h:89
bool is_complex_matrix(void) const
Definition: ov-cx-sparse.h:98
characters Given a string matrix
Definition: hex2num.cc:155
bool is_double_type(void) const
Definition: ov-cx-sparse.h:102
bool iscomplex(void) const
Definition: ov-cx-sparse.h:100
octave_sparse_complex_matrix(const Sparse< Complex > &m, const MatrixType &t)
Definition: ov-cx-sparse.h:77
double scalar_value(bool frc_str_conv=false) const
Definition: ov-cx-sparse.h:108
builtin_type_t builtin_type(void) const
Definition: ov-cx-sparse.h:96
octave_sparse_complex_matrix(const Sparse< Complex > &m)
Definition: ov-cx-sparse.h:81
octave::mach_info::float_format flt_fmt
Definition: load-save.cc:736
octave_sparse_complex_matrix(const ComplexMatrix &m)
Definition: ov-cx-sparse.h:60
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:997
octave_base_value * empty_clone(void) const
Definition: ov-cx-sparse.h:91
octave_sparse_complex_matrix(const ComplexNDArray &m)
Definition: ov-cx-sparse.h:57
builtin_type_t
Definition: ov-base.h:71
static double as_double(time_t sec, long usec)
Definition: oct-time.h:34
bool swap
Definition: load-save.cc:738
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:158
nd deftypefn *std::string name
Definition: sysdep.cc:647
bool save_as_floats
Definition: load-save.cc:1617
octave_sparse_complex_matrix(const SparseComplexMatrix &m)
Definition: ov-cx-sparse.h:63
octave_sparse_complex_matrix(const MSparse< Complex > &m, const MatrixType &t)
Definition: ov-cx-sparse.h:73
int64_t octave_hdf5_id
Definition: dMatrix.h:36
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-cx-sparse.h:123
octave_sparse_complex_matrix(const SparseComplexMatrix &m, const MatrixType &t)
Definition: ov-cx-sparse.h:66
octave_map map(dims)
octave_sparse_complex_matrix(const MSparse< Complex > &m)
Definition: ov-cx-sparse.h:70
std::complex< double > Complex
Definition: oct-cmplx.h:31
write the output to stdout if nargout is
Definition: load-save.cc:1612
octave::stream os
Definition: file-io.cc:627