GNU Octave  4.2.1
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-bool-sparse.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2004-2017 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_bool_sparse_h)
25 #define octave_ov_bool_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 "boolSparse.h"
43 #include "ov-base-sparse.h"
44 #include "ov-re-sparse.h"
45 
46 class octave_value_list;
47 
48 class tree_walker;
49 
50 class
53 {
54 public:
55 
58 
61 
63  const MatrixType& t)
64  : octave_base_sparse<SparseBoolMatrix> (bnda, t) { }
65 
68 
71 
74 
77 
79 
80  octave_base_value *clone (void) const
81  { return new octave_sparse_bool_matrix (*this); }
83  { return new octave_sparse_bool_matrix (); }
84 
85  type_conv_info numeric_conversion_function (void) const;
86 
87  octave_base_value *try_narrowing_conversion (void);
88 
89  // FIXME: Adapt idx_vector to allow sparse logical indexing without overflow!
90  idx_vector index_vector (bool /* require_integers */ = false) const
91  {
92  return idx_vector (matrix);
93  }
94 
95  builtin_type_t builtin_type (void) const { return btyp_bool; }
96 
97  bool is_bool_matrix (void) const { return true; }
98 
99  bool is_bool_type (void) const { return true; }
100 
101  bool is_real_type (void) const { return true; }
102 
103  bool is_numeric_type (void) const { return false; }
104 
105  double double_value (bool = false) const;
106 
107  double scalar_value (bool frc_str_conv = false) const
108  { return double_value (frc_str_conv); }
109 
110  Matrix matrix_value (bool = false) const;
111 
112  NDArray array_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 = false) const;
121 
122  boolMatrix bool_matrix_value (bool = false) const;
123 
124  boolNDArray bool_array_value (bool = false) const;
125 
126  SparseMatrix sparse_matrix_value (bool = false) const;
127 
128  SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
129 
131  { return matrix; }
132 
133  octave_value convert_to_str_internal (bool pad, bool force, char type) const;
134 
135  octave_value as_double (void) 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 (void) const;
147 
148  // Mapper functions are converted to double for treatment
150  {
151  octave_sparse_matrix m (sparse_matrix_value ());
152  return m.map (umap);
153  }
154 
155 protected:
156 
158 };
159 
160 #endif
octave_value map(unary_mapper_t umap) const
octave_base_value * clone(void) const
octave_base_value * empty_clone(void) const
idx_vector index_vector(bool=false) const
octave_sparse_bool_matrix(const SparseBoolMatrix &bnda)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the then the first element defines the pivoting tolerance for the unsymmetric the values defined such that for full matrix
Definition: lu.cc:138
SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
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:935
builtin_type_t
Definition: ov-base.h:61
bool is_bool_matrix(void) const
octave_value map(unary_mapper_t umap) const
bool is_real_type(void) const
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
bool swap
Definition: load-save.cc:725
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:148
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
#define OCTINTERP_API
Definition: mexproto.h:69
octave_sparse_bool_matrix(const boolNDArray &m)
builtin_type_t builtin_type(void) const
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
bool save_as_floats
Definition: load-save.cc:1581
double scalar_value(bool frc_str_conv=false) const
int64_t octave_hdf5_id
idx type
Definition: ov.cc:3129
Definition: dMatrix.h:37
bool is_bool_type(void) const
bool is_numeric_type(void) const
octave_sparse_bool_matrix(const Sparse< bool > &a)
octave_sparse_bool_matrix(const boolMatrix &m)
std::complex< double > Complex
Definition: oct-cmplx.h:31
write the output to stdout if nargout is
Definition: load-save.cc:1576
octave_sparse_bool_matrix(const SparseBoolMatrix &bnda, const MatrixType &t)
octave_sparse_bool_matrix(const octave_sparse_bool_matrix &bm)