comparison libinterp/octave-value/ov-bool-sparse.h @ 15195:2fc554ffbc28

split libinterp from src * libinterp: New directory. Move all files from src directory here except Makefile.am, main.cc, main-cli.cc, mkoctfile.in.cc, mkoctfilr.in.sh, octave-config.in.cc, octave-config.in.sh. * libinterp/Makefile.am: New file, extracted from src/Makefile.am. * src/Makefile.am: Delete everything except targets and definitions needed to build and link main and utility programs. * Makefile.am (SUBDIRS): Include libinterp in the list. * autogen.sh: Run config-module.sh in libinterp/dldfcn directory, not src/dldfcn directory. * configure.ac (AC_CONFIG_SRCDIR): Use libinterp/octave.cc, not src/octave.cc. (DL_LDFLAGS, LIBOCTINTERP): Use libinterp, not src. (AC_CONFIG_FILES): Include libinterp/Makefile in the list. * find-docstring-files.sh: Look in libinterp, not src. * gui/src/Makefile.am (liboctgui_la_CPPFLAGS): Find header files in libinterp, not src.
author John W. Eaton <jwe@octave.org>
date Sat, 18 Aug 2012 16:23:39 -0400
parents src/octave-value/ov-bool-sparse.h@46b19589b593
children 8fce0ed4894a
comparison
equal deleted inserted replaced
15194:0f0b795044c3 15195:2fc554ffbc28
1 /*
2
3 Copyright (C) 2004-2012 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_sparse_bool_matrix_h)
25 #define octave_sparse_bool_matrix_h 1
26
27 #include <cstdlib>
28
29 #include <iosfwd>
30 #include <string>
31
32 #include "mx-base.h"
33 #include "oct-alloc.h"
34 #include "str-vec.h"
35
36 #include "error.h"
37 #include "oct-stream.h"
38 #include "ov-base.h"
39 #include "ov-typeinfo.h"
40
41 #include "boolSparse.h"
42 #include "ov-base-sparse.h"
43 #include "ov-re-sparse.h"
44
45 class octave_value_list;
46
47 class tree_walker;
48
49 class
50 OCTINTERP_API
51 octave_sparse_bool_matrix : public octave_base_sparse<SparseBoolMatrix>
52 {
53 public:
54
55 octave_sparse_bool_matrix (void)
56 : octave_base_sparse<SparseBoolMatrix> () { }
57
58 octave_sparse_bool_matrix (const SparseBoolMatrix& bnda)
59 : octave_base_sparse<SparseBoolMatrix> (bnda) { }
60
61 octave_sparse_bool_matrix (const SparseBoolMatrix& bnda,
62 const MatrixType& t)
63 : octave_base_sparse<SparseBoolMatrix> (bnda, t) { }
64
65 octave_sparse_bool_matrix (const boolNDArray& m)
66 : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { }
67
68 octave_sparse_bool_matrix (const boolMatrix& m)
69 : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { }
70
71 octave_sparse_bool_matrix (const Sparse<bool>& a)
72 : octave_base_sparse<SparseBoolMatrix> (a) { }
73
74 octave_sparse_bool_matrix (const octave_sparse_bool_matrix& bm)
75 : octave_base_sparse<SparseBoolMatrix> (bm) { }
76
77 ~octave_sparse_bool_matrix (void) { }
78
79 octave_base_value *clone (void) const { return new octave_sparse_bool_matrix (*this); }
80 octave_base_value *empty_clone (void) const { return new octave_sparse_bool_matrix (); }
81
82 type_conv_info numeric_conversion_function (void) const;
83
84 octave_base_value *try_narrowing_conversion (void);
85
86 // FIXME Adapt idx_vector to allow sparse logical indexing!!
87 idx_vector index_vector (void) const
88 { return idx_vector (bool_array_value ()); }
89
90 builtin_type_t builtin_type (void) const { return btyp_bool; }
91
92 bool is_bool_matrix (void) const { return true; }
93
94 bool is_bool_type (void) const { return true; }
95
96 bool is_real_type (void) const { return true; }
97
98 bool is_numeric_type (void) const { return false; }
99
100 double double_value (bool = false) const;
101
102 double scalar_value (bool frc_str_conv = false) const
103 { return double_value (frc_str_conv); }
104
105 Matrix matrix_value (bool = false) const;
106
107 NDArray array_value (bool = false) const;
108
109 Complex complex_value (bool = false) const;
110
111 ComplexMatrix complex_matrix_value (bool = false) const;
112
113 ComplexNDArray complex_array_value (bool = false) const;
114
115 charNDArray char_array_value (bool = false) const;
116
117 boolMatrix bool_matrix_value (bool = false) const;
118
119 boolNDArray bool_array_value (bool = false) const;
120
121 SparseMatrix sparse_matrix_value (bool = false) const;
122
123 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
124
125 SparseBoolMatrix sparse_bool_matrix_value (bool = false) const
126 { return matrix; }
127
128 octave_value convert_to_str_internal (bool pad, bool force, char type) const;
129
130 bool save_binary (std::ostream& os, bool& save_as_floats);
131
132 bool load_binary (std::istream& is, bool swap,
133 oct_mach_info::float_format fmt);
134
135 #if defined (HAVE_HDF5)
136 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
137
138 bool load_hdf5 (hid_t loc_id, const char *name);
139 #endif
140
141 mxArray *as_mxArray (void) const;
142
143 // Mapper functions are converted to double for treatment
144 octave_value map (unary_mapper_t umap) const
145 {
146 octave_sparse_matrix m (sparse_matrix_value ());
147 return m.map (umap);
148 }
149
150 protected:
151
152 DECLARE_OCTAVE_ALLOCATOR
153
154 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
155 };
156
157 #endif