GNU Octave  8.1.0
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) 1998-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_ov_cx_sparse_h)
27 #define octave_ov_cx_sparse_h 1
28 
29 #include "octave-config.h"
30 
31 #include <cstdlib>
32 
33 #include <iosfwd>
34 #include <string>
35 
36 #include "mx-base.h"
37 #include "str-vec.h"
38 
39 #include "error.h"
40 #include "oct-stream.h"
41 #include "ov-base.h"
42 #include "ov-typeinfo.h"
43 
44 #include "CSparse.h"
45 #include "ov-base-sparse.h"
46 #include "ov-re-sparse.h"
47 
48 class octave_value_list;
49 
50 class
51 OCTINTERP_API
53 {
54 public:
55 
58 
61 
64 
67 
69  const MatrixType& t)
71 
74 
76  const MatrixType& t)
78 
80  const MatrixType& t)
82 
85 
88 
90 
91  octave_base_value * clone (void) const
92  { return new octave_sparse_complex_matrix (*this); }
94  { return new octave_sparse_complex_matrix (); }
95 
96  octave_base_value * try_narrowing_conversion (void);
97 
98  builtin_type_t builtin_type (void) const { return btyp_complex; }
99 
100  bool is_complex_matrix (void) const { return true; }
101 
102  bool iscomplex (void) const { return true; }
103 
104  bool is_double_type (void) const { return true; }
105 
106  bool isfloat (void) const { return true; }
107 
108  double double_value (bool = false) const;
109 
110  double scalar_value (bool frc_str_conv = false) const
111  { return double_value (frc_str_conv); }
112 
113  Matrix matrix_value (bool = false) const;
114 
115  Complex complex_value (bool = false) const;
116 
117  ComplexMatrix complex_matrix_value (bool = false) const;
118 
119  ComplexNDArray complex_array_value (bool = false) const;
120 
121  charNDArray char_array_value (bool frc_str_conv = false) const;
122 
123  SparseMatrix sparse_matrix_value (bool = false) const;
124 
126  { return matrix; }
127 
128  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
129 
130  octave_value as_double (void) const;
131 
132 #if 0
133  int write (octave::stream& os, int block_size,
134  oct_data_conv::data_type output_type, int skip,
135  octave::mach_info::float_format flt_fmt) const
136  {
137  // Yes, for compatibility, we drop the imaginary part here.
138  return os.write (matrix_value (true), block_size, output_type,
139  skip, flt_fmt);
140  }
141 #endif
142 
143  bool save_binary (std::ostream& os, bool save_as_floats);
144 
145  bool load_binary (std::istream& is, bool swap,
147 
148  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
149 
150  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
151 
152  mxArray * as_mxArray (bool interleaved) const;
153 
154  octave_value map (unary_mapper_t umap) const;
155 
156 private:
157 
159 };
160 
161 #endif
Definition: dMatrix.h:42
Definition: Sparse.h:49
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-cx-sparse.h:125
~octave_sparse_complex_matrix(void)=default
double scalar_value(bool frc_str_conv=false) const
Definition: ov-cx-sparse.h:110
bool iscomplex(void) const
Definition: ov-cx-sparse.h:102
octave_sparse_complex_matrix(const octave_sparse_complex_matrix &cm)
Definition: ov-cx-sparse.h:86
octave_sparse_complex_matrix(const SparseComplexMatrix &m, const MatrixType &t)
Definition: ov-cx-sparse.h:68
octave_base_value * empty_clone(void) const
Definition: ov-cx-sparse.h:93
octave_sparse_complex_matrix(const MSparse< Complex > &m)
Definition: ov-cx-sparse.h:72
bool is_double_type(void) const
Definition: ov-cx-sparse.h:104
bool is_complex_matrix(void) const
Definition: ov-cx-sparse.h:100
octave_sparse_complex_matrix(const MSparse< Complex > &m, const MatrixType &t)
Definition: ov-cx-sparse.h:75
octave_sparse_complex_matrix(const SparseComplexMatrix &m)
Definition: ov-cx-sparse.h:65
octave_sparse_complex_matrix(const ComplexNDArray &m)
Definition: ov-cx-sparse.h:59
octave_base_value * clone(void) const
Definition: ov-cx-sparse.h:91
octave_sparse_complex_matrix(const ComplexMatrix &m)
Definition: ov-cx-sparse.h:62
octave_sparse_complex_matrix(const Sparse< Complex > &m)
Definition: ov-cx-sparse.h:83
builtin_type_t builtin_type(void) const
Definition: ov-cx-sparse.h:98
octave_sparse_complex_matrix(const Sparse< Complex > &m, const MatrixType &t)
Definition: ov-cx-sparse.h:79
float_format
Definition: mach-info.h:38
T octave_idx_type m
Definition: mx-inlines.cc:773
std::complex< double > Complex
Definition: oct-cmplx.h:33
int64_t octave_hdf5_id
static double as_double(OCTAVE_TIME_T sec, long usec)
Definition: oct-time.h:35
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:181
builtin_type_t
Definition: ov-base.h:83
@ btyp_complex
Definition: ov-base.h:86