GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ov-bool-sparse.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1998-2025 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_bool_sparse_h)
27#define octave_ov_bool_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 "boolSparse.h"
45#include "ov-base-sparse.h"
46#include "ov-re-sparse.h"
47
49
50extern template class OCTINTERP_EXTERN_TEMPLATE_API
52
54{
55public:
56
59
62
66
69
72
75
78
80
82 { return new octave_sparse_bool_matrix (*this); }
85
86 type_conv_info numeric_conversion_function () const;
87
88 // FIXME: Adapt idx_vector to allow sparse logical indexing without overflow!
89 octave::idx_vector index_vector (bool /* require_integers */ = false) const
90 {
91 return octave::idx_vector (matrix);
92 }
93
95
96 bool is_bool_matrix () const { return true; }
97
98 bool islogical () const { return true; }
99
100 bool isreal () const { return true; }
101
102 bool isnumeric () const { return false; }
103
104 double double_value (bool = false) const;
105
106 double scalar_value (bool frc_str_conv = false) const
107 { return double_value (frc_str_conv); }
108
109 Matrix matrix_value (bool = false) const;
110
111 NDArray array_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 = false) const;
120
121 boolMatrix bool_matrix_value (bool = false) const;
122
123 boolNDArray bool_array_value (bool = false) const;
124
125 SparseMatrix sparse_matrix_value (bool = false) const;
126
127 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
128
130 { return matrix; }
131
132 octave_value convert_to_str_internal (bool pad, bool force, char type) const;
133
134 octave_value as_double () const;
135
136 bool save_binary (std::ostream& os, bool save_as_floats);
137
138 bool load_binary (std::istream& is, bool swap,
139 octave::mach_info::float_format fmt);
140
141 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
142
143 bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
144
145 mxArray * as_mxArray (bool interleaved) const;
146
147 // Mapper functions are converted to double for treatment
149 {
150 octave_sparse_matrix m (sparse_matrix_value ());
151 return m.map (umap);
152 }
153
154protected:
155
157};
158
159#endif
~octave_sparse_bool_matrix()=default
octave_value map(unary_mapper_t umap) const
octave_sparse_bool_matrix(const boolNDArray &m)
octave_base_value * clone() const
octave::idx_vector index_vector(bool=false) const
octave_sparse_bool_matrix(const octave_sparse_bool_matrix &bm)
octave_sparse_bool_matrix(const SparseBoolMatrix &bnda, const MatrixType &t)
octave_sparse_bool_matrix(const SparseBoolMatrix &bnda)
double scalar_value(bool frc_str_conv=false) const
octave_sparse_bool_matrix(const Sparse< bool > &a)
SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
octave_sparse_bool_matrix(const boolMatrix &m)
octave_base_value * empty_clone() const
builtin_type_t builtin_type() const
octave_value map(unary_mapper_t umap) const
Array< octave_value > array_value() const
Definition ovl.h:88
std::complex< double > Complex
Definition oct-cmplx.h:33
int64_t octave_hdf5_id
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA_API(API)
Definition ov-base.h:185
builtin_type_t
Definition ov-base.h:83
@ btyp_bool
Definition ov-base.h:96