Mercurial > hg > octave-nkf
annotate libinterp/octave-value/ov-base-sparse.cc @ 18702:fa53284d4511 draft lyh
Fix warnings
author | LYH <lyh.kernel@gmail.com> |
---|---|
date | Fri, 21 Mar 2014 14:59:39 -0400 |
parents | b7d3e1f762e1 |
children | bcd71a2531d3 |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
16804
diff
changeset
|
3 Copyright (C) 2004-2013 David Bateman |
11523 | 4 Copyright (C) 1998-2004 Andy Adler |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10513
diff
changeset
|
5 Copyright (C) 2010 VZLU Prague |
7016 | 6 |
7 This file is part of Octave. | |
5164 | 8 |
9 Octave is free software; you can redistribute it and/or modify it | |
10 under the terms of the GNU General Public License as published by the | |
7016 | 11 Free Software Foundation; either version 3 of the License, or (at your |
12 option) any later version. | |
5164 | 13 |
14 Octave is distributed in the hope that it will be useful, but WITHOUT | |
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
7016 | 20 along with Octave; see the file COPYING. If not, see |
21 <http://www.gnu.org/licenses/>. | |
5164 | 22 |
23 */ | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include <config.h> | |
27 #endif | |
28 | |
7644
91d7440211e7
display percentage of elements that are nonzero when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
29 #include <iomanip> |
5164 | 30 #include <iostream> |
31 | |
32 #include "oct-obj.h" | |
33 #include "ov-base.h" | |
34 #include "quit.h" | |
35 #include "pr-output.h" | |
36 | |
37 #include "byte-swap.h" | |
38 #include "ls-oct-ascii.h" | |
39 #include "ls-utils.h" | |
40 #include "ls-hdf5.h" | |
41 | |
42 #include "boolSparse.h" | |
43 #include "ov-base-sparse.h" | |
5731 | 44 #include "pager.h" |
17818
f1b59ef34eda
attempt to avoid setting persistent state on i/o streams (bug #40396)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
45 #include "utils.h" |
5164 | 46 |
47 template <class T> | |
48 octave_value | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
49 octave_base_sparse<T>::do_index_op (const octave_value_list& idx, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
50 bool resize_ok) |
5164 | 51 { |
52 octave_value retval; | |
53 | |
5275 | 54 octave_idx_type n_idx = idx.length (); |
5164 | 55 |
56 switch (n_idx) | |
57 { | |
58 case 0: | |
5539 | 59 retval = matrix; |
5164 | 60 break; |
61 | |
62 case 1: | |
63 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
64 idx_vector i = idx (0).index_vector (); |
5164 | 65 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
66 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
67 retval = octave_value (matrix.index (i, resize_ok)); |
5164 | 68 } |
69 break; | |
70 | |
10421
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
71 case 2: |
5164 | 72 { |
10421
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
73 idx_vector i = idx (0).index_vector (); |
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
74 |
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
75 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
76 { |
10421
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
77 idx_vector j = idx (1).index_vector (); |
5164 | 78 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
79 if (! error_state) |
10421
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
80 retval = octave_value (matrix.index (i, j, resize_ok)); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
81 } |
5164 | 82 } |
83 break; | |
10421
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
84 default: |
99e9bae2d81e
improve sparse indexing interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10350
diff
changeset
|
85 error ("sparse indexing needs 1 or 2 indices"); |
5164 | 86 } |
87 | |
88 return retval; | |
89 } | |
90 | |
91 template <class T> | |
92 octave_value | |
93 octave_base_sparse<T>::subsref (const std::string& type, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
94 const std::list<octave_value_list>& idx) |
5164 | 95 { |
96 octave_value retval; | |
97 | |
98 switch (type[0]) | |
99 { | |
100 case '(': | |
101 retval = do_index_op (idx.front ()); | |
102 break; | |
103 | |
104 case '{': | |
105 case '.': | |
106 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
107 std::string nm = type_name (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
108 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); |
5164 | 109 } |
110 break; | |
111 | |
112 default: | |
113 panic_impossible (); | |
114 } | |
115 | |
116 return retval.next_subsref (type, idx); | |
117 } | |
118 | |
119 template <class T> | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
120 octave_value |
5164 | 121 octave_base_sparse<T>::subsasgn (const std::string& type, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
122 const std::list<octave_value_list>& idx, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
123 const octave_value& rhs) |
5164 | 124 { |
125 octave_value retval; | |
126 | |
127 switch (type[0]) | |
128 { | |
129 case '(': | |
130 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
131 if (type.length () == 1) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
132 retval = numeric_assign (type, idx, rhs); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
133 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
134 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
135 std::string nm = type_name (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
136 error ("in indexed assignment of %s, last lhs index must be ()", |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
137 nm.c_str ()); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
138 } |
5164 | 139 } |
140 break; | |
141 | |
142 case '{': | |
143 case '.': | |
144 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
145 if (is_empty ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
146 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
147 octave_value tmp = octave_value::empty_conv (type, rhs); |
5164 | 148 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
149 retval = tmp.subsasgn (type, idx, rhs); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
150 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
151 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
152 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
153 std::string nm = type_name (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
154 error ("%s cannot be indexed with %c", nm.c_str (), type[0]); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
155 } |
5164 | 156 } |
157 break; | |
158 | |
159 default: | |
160 panic_impossible (); | |
161 } | |
162 | |
163 return retval; | |
164 } | |
165 | |
166 template <class T> | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
167 void |
5164 | 168 octave_base_sparse<T>::assign (const octave_value_list& idx, const T& rhs) |
169 { | |
10512
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
170 |
5275 | 171 octave_idx_type len = idx.length (); |
5164 | 172 |
10512
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
173 switch (len) |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
174 { |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
175 case 1: |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
176 { |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
177 idx_vector i = idx (0).index_vector (); |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
178 |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
179 if (! error_state) |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
180 matrix.assign (i, rhs); |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
181 |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
182 break; |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
183 } |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
184 |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
185 case 2: |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
186 { |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
187 idx_vector i = idx (0).index_vector (); |
5164 | 188 |
10512
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
189 if (! error_state) |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
190 { |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
191 idx_vector j = idx (1).index_vector (); |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
192 |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
193 if (! error_state) |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
194 matrix.assign (i, j, rhs); |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
195 } |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
196 |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
197 break; |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
198 } |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
199 |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
200 default: |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
201 error ("sparse indexing needs 1 or 2 indices"); |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
202 } |
aac9f4265048
rewrite sparse indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
10490
diff
changeset
|
203 |
5322 | 204 |
205 // Invalidate matrix type. | |
206 typ.invalidate_type (); | |
5164 | 207 } |
208 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
209 template <class MT> |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
210 void |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
211 octave_base_sparse<MT>::delete_elements (const octave_value_list& idx) |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
212 { |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
213 octave_idx_type len = idx.length (); |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
214 |
10490
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
215 switch (len) |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
216 { |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
217 case 1: |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
218 { |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
219 idx_vector i = idx (0).index_vector (); |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
220 |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
221 if (! error_state) |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
222 matrix.delete_elements (i); |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
223 |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
224 break; |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
225 } |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
226 |
10490
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
227 case 2: |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
228 { |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
229 idx_vector i = idx (0).index_vector (); |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
230 |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
231 if (! error_state) |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
232 { |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
233 idx_vector j = idx (1).index_vector (); |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
234 |
10490
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
235 if (! error_state) |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
236 matrix.delete_elements (i, j); |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
237 } |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
238 |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
239 break; |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
240 } |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
241 |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
242 default: |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
243 error ("sparse indexing needs 1 or 2 indices"); |
fdccd69d26bd
rewrite sparse null assignment (part 2)
Jaroslav Hajek <highegg@gmail.com>
parents:
10421
diff
changeset
|
244 } |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
245 |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
246 // Invalidate the matrix type |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
247 typ.invalidate_type (); |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
248 } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7644
diff
changeset
|
249 |
5731 | 250 template <class T> |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
251 octave_value |
5731 | 252 octave_base_sparse<T>::resize (const dim_vector& dv, bool) const |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
253 { |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
254 T retval (matrix); |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
255 retval.resize (dv); |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
256 return retval; |
5731 | 257 } |
5164 | 258 |
259 template <class T> | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
260 bool |
5164 | 261 octave_base_sparse<T>::is_true (void) const |
262 { | |
263 bool retval = false; | |
264 dim_vector dv = matrix.dims (); | |
5275 | 265 octave_idx_type nel = dv.numel (); |
10513
c5005bc2b7a9
implement working spalloc
Jaroslav Hajek <highegg@gmail.com>
parents:
10512
diff
changeset
|
266 octave_idx_type nz = nnz (); |
5164 | 267 |
268 if (nz == nel && nel > 0) | |
269 { | |
270 T t1 (matrix.reshape (dim_vector (nel, 1))); | |
271 | |
272 SparseBoolMatrix t2 = t1.all (); | |
273 | |
274 retval = t2(0); | |
275 } | |
276 | |
277 return retval; | |
278 } | |
279 | |
280 template <class T> | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
281 bool |
5164 | 282 octave_base_sparse<T>::print_as_scalar (void) const |
283 { | |
284 dim_vector dv = dims (); | |
285 | |
286 return (dv.all_ones () || dv.any_zero ()); | |
287 } | |
288 | |
289 template <class T> | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
290 void |
5164 | 291 octave_base_sparse<T>::print (std::ostream& os, bool pr_as_read_syntax) const |
292 { | |
293 print_raw (os, pr_as_read_syntax); | |
294 newline (os); | |
295 } | |
296 | |
297 template <class T> | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
298 void |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
299 octave_base_sparse<T>::print_info (std::ostream& os, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
300 const std::string& prefix) const |
5164 | 301 { |
302 matrix.print_info (os, prefix); | |
303 } | |
304 | |
305 template <class T> | |
306 void | |
307 octave_base_sparse<T>::print_raw (std::ostream& os, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
308 bool pr_as_read_syntax) const |
5164 | 309 { |
17818
f1b59ef34eda
attempt to avoid setting persistent state on i/o streams (bug #40396)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
310 octave_preserve_stream_state stream_state (os); |
f1b59ef34eda
attempt to avoid setting persistent state on i/o streams (bug #40396)
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
311 |
5275 | 312 octave_idx_type nr = matrix.rows (); |
313 octave_idx_type nc = matrix.cols (); | |
5604 | 314 octave_idx_type nz = nnz (); |
5164 | 315 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
316 // FIXME: this should probably all be handled by a |
5355 | 317 // separate octave_print_internal function that can handle format |
318 // compact, loose, etc. | |
319 | |
320 os << "Compressed Column Sparse (rows = " << nr | |
321 << ", cols = " << nc | |
7644
91d7440211e7
display percentage of elements that are nonzero when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
322 << ", nnz = " << nz; |
91d7440211e7
display percentage of elements that are nonzero when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
323 |
14566
aa491bd9e19b
avoid unnecessary index overflow error when printing sparse array (bug #35148)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
324 // Avoid calling numel here since it can easily overflow |
aa491bd9e19b
avoid unnecessary index overflow error when printing sparse array (bug #35148)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
325 // octave_idx_type even when there is no real problem storing the |
aa491bd9e19b
avoid unnecessary index overflow error when printing sparse array (bug #35148)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
326 // sparse array. |
aa491bd9e19b
avoid unnecessary index overflow error when printing sparse array (bug #35148)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
327 |
aa491bd9e19b
avoid unnecessary index overflow error when printing sparse array (bug #35148)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
328 double dnr = nr; |
aa491bd9e19b
avoid unnecessary index overflow error when printing sparse array (bug #35148)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
329 double dnc = nc; |
aa491bd9e19b
avoid unnecessary index overflow error when printing sparse array (bug #35148)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
330 double dnel = dnr * dnc; |
7644
91d7440211e7
display percentage of elements that are nonzero when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
331 |
91d7440211e7
display percentage of elements that are nonzero when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
332 if (dnel > 0) |
11439
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
333 { |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
334 double pct = (nz / dnel * 100); |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
335 |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
336 int prec = 2; |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
337 |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
338 // Display at least 2 significant figures and up to 4 as we |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
339 // approach 100%. Avoid having limited precision of the display |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
340 // result in reporting 100% for matrices that are not actually |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
341 // 100% full. |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
342 |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
343 if (pct == 100) |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
344 prec = 3; |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
345 else |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
346 { |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
347 if (pct > 99.9) |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
348 prec = 4; |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
349 else if (pct > 99) |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
350 prec = 3; |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
351 |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
352 if (pct > 99.99) |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
353 pct = 99.99; |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
354 } |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
355 |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
356 os << " [" << std::setprecision (prec) << pct << "%]"; |
c2f44cba24c9
improve display of percentage full when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
10527
diff
changeset
|
357 } |
7644
91d7440211e7
display percentage of elements that are nonzero when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
358 |
91d7440211e7
display percentage of elements that are nonzero when printing sparse matrices
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
359 os << ")\n"; |
5164 | 360 |
361 // add one to the printed indices to go from | |
362 // zero-based to one-based arrays | |
363 | |
364 if (nz != 0) | |
365 { | |
5275 | 366 for (octave_idx_type j = 0; j < nc; j++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
367 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
368 octave_quit (); |
5355 | 369 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
370 // FIXME: is there an easy way to get the max row |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
371 // and column indices so we can set the width appropriately |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
372 // and line up the columns here? Similarly, we should look |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
373 // at all the nonzero values and display them with the same |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
374 // formatting rules that apply to columns of a matrix. |
5355 | 375 |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14566
diff
changeset
|
376 for (octave_idx_type i = matrix.cidx (j); i < matrix.cidx (j+1); i++) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
377 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
378 os << "\n"; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
379 os << " (" << matrix.ridx (i)+1 << ", " << j+1 << ") -> "; |
5355 | 380 |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14566
diff
changeset
|
381 octave_print_internal (os, matrix.data (i), pr_as_read_syntax); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
382 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
383 } |
5164 | 384 } |
385 } | |
386 | |
387 template <class T> | |
388 bool | |
6974 | 389 octave_base_sparse<T>::save_ascii (std::ostream& os) |
5164 | 390 { |
391 dim_vector dv = this->dims (); | |
392 | |
393 // Ensure that additional memory is deallocated | |
394 matrix.maybe_compress (); | |
395 | |
10527
b4d2080b6df7
Replace nzmax by nnz as needed
David Bateman <dbateman@free.fr>
parents:
10521
diff
changeset
|
396 os << "# nnz: " << nnz () << "\n"; |
5164 | 397 os << "# rows: " << dv (0) << "\n"; |
398 os << "# columns: " << dv (1) << "\n"; | |
399 | |
400 os << this->matrix; | |
401 | |
402 return true; | |
403 } | |
404 | |
405 template <class T> | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
406 bool |
5164 | 407 octave_base_sparse<T>::load_ascii (std::istream& is) |
408 { | |
5275 | 409 octave_idx_type nz = 0; |
410 octave_idx_type nr = 0; | |
411 octave_idx_type nc = 0; | |
5164 | 412 bool success = true; |
413 | |
414 if (extract_keyword (is, "nnz", nz, true) && | |
415 extract_keyword (is, "rows", nr, true) && | |
416 extract_keyword (is, "columns", nc, true)) | |
417 { | |
418 T tmp (nr, nc, nz); | |
419 | |
420 is >> tmp; | |
421 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
422 if (!is) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
423 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
424 error ("load: failed to load matrix constant"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
425 success = false; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
426 } |
5164 | 427 |
428 matrix = tmp; | |
429 } | |
430 else | |
431 { | |
432 error ("load: failed to extract number of rows and columns"); | |
433 success = false; | |
434 } | |
435 | |
436 return success; | |
437 } | |
438 | |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
439 template <class T> |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
440 octave_value |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
441 octave_base_sparse<T>::map (octave_base_value::unary_mapper_t umap) const |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
442 { |
18195
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17818
diff
changeset
|
443 if (umap == umap_xtolower || umap == umap_xtoupper) |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17818
diff
changeset
|
444 return matrix; |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17818
diff
changeset
|
445 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
446 // Try the map on the dense value. |
18195
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17818
diff
changeset
|
447 // FIXME: We should probably be smarter about this, especially for the |
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17818
diff
changeset
|
448 // cases that are expected to return sparse matrices. |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
449 octave_value retval = this->full_value ().map (umap); |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
450 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
451 // Sparsify the result if possible. |
18195
1b6db9303933
allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents:
17818
diff
changeset
|
452 |
18196
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
453 switch (umap) |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
454 { |
18196
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
455 case umap_xisalnum: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
456 case umap_xisalpha: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
457 case umap_xisascii: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
458 case umap_xiscntrl: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
459 case umap_xisdigit: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
460 case umap_xisgraph: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
461 case umap_xislower: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
462 case umap_xisprint: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
463 case umap_xispunct: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
464 case umap_xisspace: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
465 case umap_xisupper: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
466 case umap_xisxdigit: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
467 case umap_xtoascii: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
468 // FIXME: intentionally skip this step for string mappers. |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
469 // Is this wanted? |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
470 break; |
18196
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
471 |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
472 default: |
18196
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
473 { |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
474 switch (retval.builtin_type ()) |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
475 { |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
476 case btyp_double: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
477 retval = retval.sparse_matrix_value (); |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
478 break; |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
479 |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
480 case btyp_complex: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
481 retval = retval.sparse_complex_matrix_value (); |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
482 break; |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
483 |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
484 case btyp_bool: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
485 retval = retval.sparse_bool_matrix_value (); |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
486 break; |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
487 |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
488 default: |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
489 break; |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
490 } |
0d5721873d6b
avoid some tests that rely on ordering of enum values
John W. Eaton <jwe@octave.org>
parents:
18195
diff
changeset
|
491 } |
9813
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
492 } |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
493 |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
494 return retval; |
8fa32b527d9a
improve & partially revert previous change
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
495 } |