Mercurial > hg > octave-nkf
diff liboctave/Array-util.h @ 10645:8645b7087859
abstract scalar index checking off Array<T> (prep for struct optimizations)
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 20 May 2010 15:10:34 +0200 |
parents | aac9f4265048 |
children | 0de5cc44e690 |
line wrap: on
line diff
--- a/liboctave/Array-util.h +++ b/liboctave/Array-util.h @@ -47,7 +47,20 @@ extern OCTAVE_API bool any_ones (const Array<octave_idx_type>& arr); -extern OCTAVE_API octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims); +// These four compute a linear index for given dimensions, throwing +// exceptions on invalid indices. +extern OCTAVE_API octave_idx_type +compute_index (octave_idx_type n, const dim_vector& dims); + +extern OCTAVE_API octave_idx_type +compute_index (octave_idx_type i, octave_idx_type j, const dim_vector& dims); + +extern OCTAVE_API octave_idx_type +compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k, + const dim_vector& dims); + +extern OCTAVE_API octave_idx_type +compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims); extern OCTAVE_API Array<octave_idx_type> conv_to_int_array (const Array<idx_vector>& a);