comparison liboctave/array/dim-vector.cc @ 19010:3fb030666878 draft default tip dspies

Added special-case logical-indexing function * logical-index.h (New file) : Logical-indexing function. May be called on octave_value types via call_bool_index * nz-iterators.h : Add base-class nz_iterator for iterator types. Array has template bool for whether to internally store row-col or compute on the fly Add skip_ahead method which skips forward to the next nonzero after its argument Add flat_index for computing octave_idx_type index of current position (with assertion failure in the case of overflow) Move is_zero to separate file * ov-base-diag.cc, ov-base-mat.cc, ov-base-sparse.cc, ov-perm.cc (do_index_op): Add call to call_bool_index in logical-index.h * Array.h : Move forward-declaration for array_iterator to separate header file * dim-vector.cc (dim_max): Refers to idx-bounds.h (max_idx) * array-iter-decl.h (New file): Header file for forward declaration of array-iterator * direction.h : Add constants fdirc and bdirc to avoid having to reconstruct them * dv-utils.h, dv-utils.cc (New files) : Utility functions for querying and constructing dim-vectors * idx-bounds.h (New file) : Utility constants and functions for determining whether things will overflow the maximum allowed bounds * interp-idx.h (New function : to_flat_idx) : Converts row-col pair to linear index of octave_idx_type * is-zero.h (New file) : Function for determining whether an element is zero * logical-index.tst : Add tests for correct return-value dimensions and large sparse matrix behavior
author David Spies <dnspies@gmail.com>
date Fri, 25 Jul 2014 13:39:31 -0600
parents 8e056300994b
children
comparison
equal deleted inserted replaced
19009:8d47ce2053f2 19010:3fb030666878
25 #include <config.h> 25 #include <config.h>
26 #endif 26 #endif
27 27
28 #include <iostream> 28 #include <iostream>
29 29
30 #include "idx-bounds.h"
30 #include "dim-vector.h" 31 #include "dim-vector.h"
31 32
32 // The maximum allowed value for a dimension extent. This will normally be a 33 // The maximum allowed value for a dimension extent. This will normally be a
33 // tiny bit off the maximum value of octave_idx_type. 34 // tiny bit off the maximum value of octave_idx_type.
34 // Currently 1 is subtracted to allow safe conversion of any 2D Array into 35 // Currently 1 is subtracted to allow safe conversion of any 2D Array into
35 // Sparse, but this offset may change in the future. 36 // Sparse, but this offset may change in the future.
36 octave_idx_type 37 octave_idx_type
37 dim_vector::dim_max (void) 38 dim_vector::dim_max (void)
38 { 39 {
39 return std::numeric_limits<octave_idx_type>::max () - 1; 40 return max_idx;
40 } 41 }
41 42
42 void 43 void
43 dim_vector::chop_all_singletons (void) 44 dim_vector::chop_all_singletons (void)
44 { 45 {