GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-re-sparse.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1998-2024 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_re_sparse_h)
27 #define octave_ov_re_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 "dSparse.h"
45 #include "MatrixType.h"
46 #include "ov-base-sparse.h"
47 #include "ov-cx-sparse.h"
48 
49 class octave_value_list;
50 
51 class
52 OCTINTERP_API
54 {
55 public:
56 
59 
62 
65 
68 
71 
74 
77 
80 
83 
86 
87  ~octave_sparse_matrix () = default;
88 
90  { return new octave_sparse_matrix (*this); }
92  { return new octave_sparse_matrix (); }
93 
94  octave::idx_vector index_vector (bool require_integers = false) const;
95 
97 
98  bool is_real_matrix () const { return true; }
99 
100  bool isreal () const { return true; }
101 
102  bool is_double_type () const { return true; }
103 
104  bool isfloat () 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  boolNDArray bool_array_value (bool warn = false) const;
116 
117  charNDArray char_array_value (bool = false) const;
118 
119  ComplexMatrix complex_matrix_value (bool = false) const;
120 
121  ComplexNDArray complex_array_value (bool = false) const;
122 
123  NDArray array_value (bool = false) const;
124 
125  SparseMatrix sparse_matrix_value (bool = false) const
126  { return matrix; }
127 
129  { return SparseComplexMatrix (matrix); }
130 
131  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
132 
133  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
134 
135  octave_value as_double () const;
136 
137  bool save_binary (std::ostream& os, bool save_as_floats);
138 
139  bool load_binary (std::istream& is, bool swap,
141 
142  bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
143 
144  bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
145 
146  mxArray * as_mxArray (bool interleaved) const;
147 
148  octave_value map (unary_mapper_t umap) const;
149 
150 private:
151  octave_value map (double (*fcn) (double)) const;
152 
154 };
155 
156 #endif
Definition: dMatrix.h:42
Definition: Sparse.h:49
octave_sparse_matrix(const Sparse< double > &m)
Definition: ov-re-sparse.h:78
bool isfloat() const
Definition: ov-re-sparse.h:104
bool is_real_matrix() const
Definition: ov-re-sparse.h:98
octave_sparse_matrix(const SparseMatrix &m)
Definition: ov-re-sparse.h:66
octave_sparse_matrix(const Matrix &m)
Definition: ov-re-sparse.h:60
octave_sparse_matrix(const Sparse< double > &m, const MatrixType &t)
Definition: ov-re-sparse.h:81
bool is_double_type() const
Definition: ov-re-sparse.h:102
octave_sparse_matrix(const MSparse< double > &m)
Definition: ov-re-sparse.h:72
bool isreal() const
Definition: ov-re-sparse.h:100
builtin_type_t builtin_type() const
Definition: ov-re-sparse.h:96
octave_sparse_matrix(const NDArray &m)
Definition: ov-re-sparse.h:63
octave_base_value * empty_clone() const
Definition: ov-re-sparse.h:91
~octave_sparse_matrix()=default
octave_sparse_matrix(const octave_sparse_matrix &m)
Definition: ov-re-sparse.h:84
SparseMatrix sparse_matrix_value(bool=false) const
Definition: ov-re-sparse.h:125
octave_sparse_matrix(const SparseMatrix &m, const MatrixType &t)
Definition: ov-re-sparse.h:69
double scalar_value(bool frc_str_conv=false) const
Definition: ov-re-sparse.h:108
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-re-sparse.h:128
octave_base_value * clone() const
Definition: ov-re-sparse.h:89
octave_sparse_matrix(const MSparse< double > &m, const MatrixType &t)
Definition: ov-re-sparse.h:75
Array< octave_value > array_value() const
Definition: ovl.h:90
octave::idx_vector idx_vector
Definition: idx-vector.h:1022
float_format
Definition: mach-info.h:38
T octave_idx_type m
Definition: mx-inlines.cc:781
std::complex< double > Complex
Definition: oct-cmplx.h:33
int64_t octave_hdf5_id
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:181
builtin_type_t
Definition: ov-base.h:83
@ btyp_double
Definition: ov-base.h:84