Mercurial > hg > octave-lyh
annotate src/ov-re-sparse.h @ 9852:aabf7a8c2e57
implement sparse logical conversion
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 23 Nov 2009 10:00:29 +0100 |
parents | f80c566bc751 |
children | b3089dba88bf |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
8920 | 3 Copyright (C) 2004, 2005, 2006, 2007, 2008 David Bateman |
7016 | 4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler |
5 | |
6 This file is part of Octave. | |
5164 | 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5164 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5164 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_sparse_matrix_h) | |
25 #define octave_sparse_matrix_h 1 | |
26 | |
27 #include <cstdlib> | |
28 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
29 #include <iosfwd> |
5164 | 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 "dSparse.h" | |
5785 | 42 #include "MatrixType.h" |
5164 | 43 #include "ov-base-sparse.h" |
44 #include "ov-cx-sparse.h" | |
45 | |
46 class Octave_map; | |
47 class octave_value_list; | |
48 | |
49 class tree_walker; | |
50 | |
51 class | |
6109 | 52 OCTINTERP_API |
5164 | 53 octave_sparse_matrix : public octave_base_sparse<SparseMatrix> |
54 { | |
55 public: | |
56 | |
57 octave_sparse_matrix (void) | |
58 : octave_base_sparse<SparseMatrix> () { } | |
59 | |
60 octave_sparse_matrix (const Matrix& m) | |
61 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
62 | |
63 octave_sparse_matrix (const NDArray& m) | |
64 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
65 | |
66 octave_sparse_matrix (const SparseMatrix& m) | |
67 : octave_base_sparse<SparseMatrix> (m) { } | |
68 | |
5785 | 69 octave_sparse_matrix (const SparseMatrix& m, const MatrixType& t) |
5164 | 70 : octave_base_sparse<SparseMatrix> (m, t) { } |
71 | |
72 octave_sparse_matrix (const MSparse<double>& m) | |
73 : octave_base_sparse<SparseMatrix> (m) { } | |
74 | |
6863 | 75 octave_sparse_matrix (const MSparse<double>& m, const MatrixType& t) |
76 : octave_base_sparse<SparseMatrix> (m, t) { } | |
77 | |
78 octave_sparse_matrix (const Sparse<double>& m) | |
79 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
80 | |
81 octave_sparse_matrix (const Sparse<double>& m, const MatrixType& t) | |
82 : octave_base_sparse<SparseMatrix> (SparseMatrix (m), t) { } | |
83 | |
5164 | 84 octave_sparse_matrix (const octave_sparse_matrix& m) |
85 : octave_base_sparse<SparseMatrix> (m) { } | |
86 | |
87 ~octave_sparse_matrix (void) { } | |
88 | |
5759 | 89 octave_base_value *clone (void) const { return new octave_sparse_matrix (*this); } |
90 octave_base_value *empty_clone (void) const { return new octave_sparse_matrix (); } | |
5164 | 91 |
5759 | 92 octave_base_value *try_narrowing_conversion (void); |
5164 | 93 |
5282 | 94 idx_vector index_vector (void) const; |
5164 | 95 |
9685 | 96 builtin_type_t builtin_type (void) const { return btyp_double; } |
97 | |
5164 | 98 bool is_real_matrix (void) const { return true; } |
99 | |
100 bool is_real_type (void) const { return true; } | |
101 | |
5895 | 102 bool is_double_type (void) const { return true; } |
103 | |
7576 | 104 bool is_float_type (void) const { return true; } |
105 | |
5164 | 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 | |
5943 | 115 boolNDArray bool_array_value (bool warn = false) const; |
5898 | 116 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
117 charNDArray char_array_value (bool = false) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
118 |
5164 | 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 | |
128 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |
129 { return SparseComplexMatrix (matrix); } | |
130 | |
9852
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
131 SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const; |
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
132 |
5322 | 133 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
5282 | 134 |
5164 | 135 #if 0 |
136 int write (octave_stream& os, int block_size, | |
137 oct_data_conv::data_type output_type, int skip, | |
138 oct_mach_info::float_format flt_fmt) const | |
139 { return os.write (matrix, block_size, output_type, skip, flt_fmt); } | |
140 #endif | |
141 | |
142 bool save_binary (std::ostream& os, bool& save_as_floats); | |
143 | |
144 bool load_binary (std::istream& is, bool swap, | |
145 oct_mach_info::float_format fmt); | |
146 | |
147 #if defined (HAVE_HDF5) | |
148 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
149 | |
150 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); | |
151 #endif | |
152 | |
5900 | 153 mxArray *as_mxArray (void) const; |
154 | |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
155 octave_value map (unary_mapper_t umap) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
156 |
5164 | 157 private: |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
158 octave_value map (double (*fcn) (double)) const; |
5164 | 159 |
160 DECLARE_OCTAVE_ALLOCATOR | |
161 | |
162 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
163 }; | |
164 | |
165 #endif | |
166 | |
167 /* | |
168 ;;; Local Variables: *** | |
169 ;;; mode: C++ *** | |
170 ;;; End: *** | |
171 */ |