comparison liboctave/util/nz-iterators.h @ 19009:8d47ce2053f2 draft

Added safety checks to Array::xelem There's no reason to have a method which never checks invariants, ever. Added debugging checks to Array::xelem to help catch and debug out-of-bounds errors and reference overlap * configure.ac: Added configuration option for uniqueness-checking with xelem * jit-typeinfo.cc (octave_jit_paren_scalar): Call const Array::xelem rather than Array::xelem * Array-util.h, Array-util.cc (check_out_of_range): Extract common pattern to method (check_index): Methods to check index is in-bounds (compute_index): Added bool parameter check. does not check bounds when check is false and BOUNDS_CHECKING is off * Array.h, Array.cc (xelem): Use methods from Array-util.h to compute indices (is_unique): Check if this is the only reference to data * CmplxQR.cc, dbleQR.cc, fCmplxQR.cc, floatQR.cc (form): Move second assignment to after the call to xelem * lo-array-gripes.h, lo-array-gripes.cc (gripe_modifying_nonunique): Added error message for when non-const xelem is called on non-unique array
author David Spies <dnspies@gmail.com>
date Mon, 14 Jul 2014 13:07:59 -0600
parents 2e0613dadfee
children 3fb030666878
comparison
equal deleted inserted replaced
19008:80ca3b05d77c 19009:8d47ce2053f2
243 } 243 }
244 244
245 double 245 double
246 interp_idx (void) const 246 interp_idx (void) const
247 { 247 {
248 return to_interp_idx (row (), col (), mat.rows ()); 248 return to_interp_idx (row (), col (), mat.dims ());
249 } 249 }
250 octave_idx_type 250 octave_idx_type
251 col (void) const 251 col (void) const
252 { 252 {
253 return coli; 253 return coli;
311 } 311 }
312 312
313 double 313 double
314 interp_idx (void) const 314 interp_idx (void) const
315 { 315 {
316 return to_interp_idx (row (), col (), mat.rows ()); 316 return to_interp_idx (row (), col (), mat.dims ());
317 } 317 }
318 octave_idx_type 318 octave_idx_type
319 col (void) const 319 col (void) const
320 { 320 {
321 return my_idx; 321 return my_idx;
367 } 367 }
368 368
369 octave_idx_type 369 octave_idx_type
370 interp_idx (void) const 370 interp_idx (void) const
371 { 371 {
372 return to_interp_idx (row (), col (), mat.rows ()); 372 return to_interp_idx (row (), col (), mat.dims ());
373 } 373 }
374 octave_idx_type 374 octave_idx_type
375 col (void) const 375 col (void) const
376 { 376 {
377 return my_idx; 377 return my_idx;