comparison liboctave/boolSparse.cc @ 11586:12df7854fa7c

strip trailing whitespace from source files
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:24:59 -0500
parents 0e414f837c58
children 72c96de7a403
comparison
equal deleted inserted replaced
11585:1473d0cf86d2 11586:12df7854fa7c
101 { 101 {
102 octave_idx_type nr = rows (); 102 octave_idx_type nr = rows ();
103 octave_idx_type nc = cols (); 103 octave_idx_type nc = cols ();
104 octave_idx_type nz1 = nnz (); 104 octave_idx_type nz1 = nnz ();
105 octave_idx_type nz2 = nr*nc - nz1; 105 octave_idx_type nz2 = nr*nc - nz1;
106 106
107 SparseBoolMatrix r (nr, nc, nz2); 107 SparseBoolMatrix r (nr, nc, nz2);
108 108
109 octave_idx_type ii = 0; 109 octave_idx_type ii = 0;
110 octave_idx_type jj = 0; 110 octave_idx_type jj = 0;
111 r.cidx (0) = 0; 111 r.cidx (0) = 0;
112 for (octave_idx_type i = 0; i < nc; i++) 112 for (octave_idx_type i = 0; i < nc; i++)
113 { 113 {
257 { 257 {
258 octave_idx_type nc = a.cols (); 258 octave_idx_type nc = a.cols ();
259 259
260 // add one to the printed indices to go from 260 // add one to the printed indices to go from
261 // zero-based to one-based arrays 261 // zero-based to one-based arrays
262 for (octave_idx_type j = 0; j < nc; j++) 262 for (octave_idx_type j = 0; j < nc; j++)
263 { 263 {
264 octave_quit (); 264 octave_quit ();
265 for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) 265 for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++)
266 os << a.ridx(i) + 1 << " " << j + 1 << " " << a.data(i) << "\n"; 266 os << a.ridx(i) + 1 << " " << j + 1 << " " << a.data(i) << "\n";
267 } 267 }
268 268
269 return os; 269 return os;
270 } 270 }
271 271
272 std::istream& 272 std::istream&
273 operator >> (std::istream& is, SparseBoolMatrix& a) 273 operator >> (std::istream& is, SparseBoolMatrix& a)
276 276
277 return read_sparse_matrix<elt_type> (is, a, octave_read_value<bool>); 277 return read_sparse_matrix<elt_type> (is, a, octave_read_value<bool>);
278 } 278 }
279 279
280 SparseBoolMatrix 280 SparseBoolMatrix
281 SparseBoolMatrix::squeeze (void) const 281 SparseBoolMatrix::squeeze (void) const
282 { 282 {
283 return Sparse<bool>::squeeze (); 283 return Sparse<bool>::squeeze ();
284 } 284 }
285 285
286 SparseBoolMatrix 286 SparseBoolMatrix
287 SparseBoolMatrix::index (const idx_vector& i, bool resize_ok) const 287 SparseBoolMatrix::index (const idx_vector& i, bool resize_ok) const
288 { 288 {
289 return Sparse<bool>::index (i, resize_ok); 289 return Sparse<bool>::index (i, resize_ok);
290 } 290 }
291 291
292 SparseBoolMatrix 292 SparseBoolMatrix
293 SparseBoolMatrix::index (const idx_vector& i, const idx_vector& j, bool resize_ok) const 293 SparseBoolMatrix::index (const idx_vector& i, const idx_vector& j, bool resize_ok) const
294 { 294 {
295 return Sparse<bool>::index (i, j, resize_ok); 295 return Sparse<bool>::index (i, j, resize_ok);
296 } 296 }
297 297
298 SparseBoolMatrix 298 SparseBoolMatrix
299 SparseBoolMatrix::reshape (const dim_vector& new_dims) const 299 SparseBoolMatrix::reshape (const dim_vector& new_dims) const
300 { 300 {
301 return Sparse<bool>::reshape (new_dims); 301 return Sparse<bool>::reshape (new_dims);
302 } 302 }