# HG changeset patch # User Carnë Draug # Date 1432431697 -3600 # Node ID 00cf2847355d9ee3c167ed7e71400b4860ce31ac # Parent 9f484edd8767da34dc26fbab1e9970205734ad1c Deprecate Array::nelem() and Range::nelem() in favour of ::numel(). * liboctave/array/Array.h (Array::nelem) deprecate in favour of numel(). (Array::capacity, Array:: length): change to call numel() directly. These methods will be deprecated soon. * liboctave/array/PermMatrix.h (PermMatrix::nelem): deprecate in favour of numel(). * liboctave/array/Range.h (Range::numel) new method to replace nelem(). (Range::nelem) deprecate in favour of the new method numel. * liboctave/array/Sparse.h (Sparse::nelem) deprecate in favour of nzmax(). This one is secially bad because unlike the other classes, it is different from numel(). * libinterp/corefcn/debug.cc, libinterp/corefcn/jit-typeinfo.cc, libinterp/corefcn/ls-mat4.cc, libinterp/corefcn/lu.cc, libinterp/corefcn/luinc.cc, libinterp/corefcn/max.cc, libinterp/corefcn/pr-output.cc, libinterp/corefcn/rand.cc, libinterp/corefcn/xpow.cc, libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/audioread.cc, libinterp/octave-value/ov-base-int.cc, libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-flt-re-mat.cc, libinterp/octave-value/ov-perm.cc, libinterp/octave-value/ov-range.cc, libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-mat.cc, libinterp/parse-tree/pt-eval.cc, liboctave/array/Array.cc, liboctave/array/CNDArray.cc, liboctave/array/Range.cc, liboctave/array/dNDArray.cc, liboctave/array/fCNDArray.cc, liboctave/array/fNDArray.cc, liboctave/array/idx-vector.cc, liboctave/array/intNDArray.cc, liboctave/numeric/SparseCmplxLU.cc, liboctave/numeric/SparsedbleLU.cc: replace use of nelem() with numel(). diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/debug.cc --- a/libinterp/corefcn/debug.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/debug.cc Sun May 24 02:41:37 2015 +0100 @@ -263,7 +263,7 @@ if (error_state) break; - for (octave_idx_type j = 0; j < arg.nelem (); j++) + for (octave_idx_type j = 0; j < arg.numel (); j++) { int line = static_cast (arg.elem (j)); if (error_state) diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/jit-typeinfo.cc --- a/libinterp/corefcn/jit-typeinfo.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/jit-typeinfo.cc Sun May 24 02:41:37 2015 +0100 @@ -257,7 +257,7 @@ double value) { NDArray *array = mat->array; - if (array->nelem () < index) + if (array->numel () < index) array->resize1 (index); double *data = array->fortran_vec (); diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/ls-mat4.cc --- a/libinterp/corefcn/ls-mat4.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/ls-mat4.cc Sun May 24 02:41:37 2015 +0100 @@ -498,7 +498,7 @@ Range r = tc.range_value (); double base = r.base (); double inc = r.inc (); - octave_idx_type nel = r.nelem (); + octave_idx_type nel = r.numel (); for (octave_idx_type i = 0; i < nel; i++) { double x = base + i * inc; diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/lu.cc --- a/libinterp/corefcn/lu.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/lu.cc Sun May 24 02:41:37 2015 +0100 @@ -177,13 +177,13 @@ { if (!issparse) error ("lu: can not define pivoting threshold THRES for full matrices"); - else if (tmp.nelem () == 1) + else if (tmp.numel () == 1) { thres.resize (1,2); thres(0) = tmp(0); thres(1) = tmp(0); } - else if (tmp.nelem () == 2) + else if (tmp.numel () == 2) thres = tmp; else error ("lu: expecting 2-element vector for THRES"); diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/luinc.cc --- a/libinterp/corefcn/luinc.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/luinc.cc Sun May 24 02:41:37 2015 +0100 @@ -154,12 +154,12 @@ { thresh = tmp.matrix_value (); - if (thresh.nelem () == 1) + if (thresh.numel () == 1) { thresh.resize (1,2); thresh(1) = thresh(0); } - else if (thresh.nelem () != 2) + else if (thresh.numel () != 2) { error ("luinc: expecting 2-element vector for thresh"); return retval; diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/max.cc --- a/libinterp/corefcn/max.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/max.cc Sun May 24 02:41:37 2015 +0100 @@ -271,7 +271,7 @@ if (arg.is_range () && (dim == -1 || dim == 1)) { Range range = arg.range_value (); - if (range.nelem () < 1) + if (range.numel () < 1) { retval(0) = arg; if (nargout > 1) @@ -282,14 +282,14 @@ retval(0) = range.min (); if (nargout > 1) retval(1) = static_cast - (range.inc () < 0 ? range.nelem () : 1); + (range.inc () < 0 ? range.numel () : 1); } else { retval(0) = range.max (); if (nargout > 1) retval(1) = static_cast - (range.inc () >= 0 ? range.nelem () : 1); + (range.inc () >= 0 ? range.numel () : 1); } } else if (arg.is_sparse_type ()) diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/pr-output.cc --- a/libinterp/corefcn/pr-output.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/pr-output.cc Sun May 24 02:41:37 2015 +0100 @@ -2664,7 +2664,7 @@ double base = r.base (); double increment = r.inc (); double limit = r.limit (); - octave_idx_type num_elem = r.nelem (); + octave_idx_type num_elem = r.numel (); if (plus_format && ! pr_as_read_syntax) { diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/rand.cc --- a/libinterp/corefcn/rand.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/rand.cc Sun May 24 02:41:37 2015 +0100 @@ -190,7 +190,7 @@ if (r.all_elements_are_ints ()) { - octave_idx_type n = r.nelem (); + octave_idx_type n = r.numel (); dims.resize (n); diff -r 9f484edd8767 -r 00cf2847355d libinterp/corefcn/xpow.cc --- a/libinterp/corefcn/xpow.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/corefcn/xpow.cc Sun May 24 02:41:37 2015 +0100 @@ -705,10 +705,10 @@ // Only optimize powers with ranges that are integer and monotonic in // magnitude. - if (r.nelem () > 1 && r.all_elements_are_ints () + if (r.numel () > 1 && r.all_elements_are_ints () && same_sign (r.base (), r.limit ())) { - octave_idx_type n = r.nelem (); + octave_idx_type n = r.numel (); Matrix result (1, n); if (same_sign (r.base (), r.inc ())) { @@ -940,10 +940,10 @@ // Only optimize powers with ranges that are integer and monotonic in // magnitude. - if (r.nelem () > 1 && r.all_elements_are_ints () + if (r.numel () > 1 && r.all_elements_are_ints () && same_sign (r.base (), r.limit ())) { - octave_idx_type n = r.nelem (); + octave_idx_type n = r.numel (); ComplexMatrix result (1, n); if (same_sign (r.base (), r.inc ())) diff -r 9f484edd8767 -r 00cf2847355d libinterp/dldfcn/__magick_read__.cc --- a/libinterp/dldfcn/__magick_read__.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/dldfcn/__magick_read__.cc Sun May 24 02:41:37 2015 +0100 @@ -177,8 +177,8 @@ (region["row_cache"] + rows.inc () -1) - cols.inc (); // The actual height and width of the output image - region["row_out"] = rows.nelem (); - region["col_out"] = cols.nelem (); + region["row_out"] = rows.numel (); + region["col_out"] = cols.numel (); return region; } @@ -776,7 +776,7 @@ } // Fix indexes from base 1 to base 0, and at the same time, make // sure none of the indexes is outside the range of image number. - const octave_idx_type n = frameidx.nelem (); + const octave_idx_type n = frameidx.numel (); for (octave_idx_type i = 0; i < n; i++) { frameidx(i)--; @@ -798,7 +798,7 @@ { const unsigned int nRows = imvec[frameidx(0)].rows (); const unsigned int nCols = imvec[frameidx(0)].columns (); - const octave_idx_type n = frameidx.nelem (); + const octave_idx_type n = frameidx.numel (); for (octave_idx_type frame = 0; frame < n; frame++) { if (nRows != imvec[frameidx(frame)].rows () diff -r 9f484edd8767 -r 00cf2847355d libinterp/dldfcn/audioread.cc --- a/libinterp/dldfcn/audioread.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/dldfcn/audioread.cc Sun May 24 02:41:37 2015 +0100 @@ -115,7 +115,7 @@ if (error_state) return retval; - if (range.nelem () != 2) + if (range.numel () != 2) { error ("audioread: invalid specification for range of frames"); return retval; diff -r 9f484edd8767 -r 00cf2847355d libinterp/octave-value/ov-base-int.cc --- a/libinterp/octave-value/ov-base-int.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/octave-value/ov-base-int.cc Sun May 24 02:41:37 2015 +0100 @@ -129,7 +129,7 @@ { octave_base_value *retval = 0; - if (this->matrix.nelem () == 1) + if (this->matrix.numel () == 1) retval = new typename octave_value_int_traits::scalar_type (this->matrix (0)); diff -r 9f484edd8767 -r 00cf2847355d libinterp/octave-value/ov-bool-mat.cc --- a/libinterp/octave-value/ov-bool-mat.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/octave-value/ov-bool-mat.cc Sun May 24 02:41:37 2015 +0100 @@ -252,7 +252,7 @@ if (is) { - for (octave_idx_type i = 0; i < btmp.nelem (); i++) + for (octave_idx_type i = 0; i < btmp.numel (); i++) btmp.elem (i) = (tmp.elem (i) != 0.); matrix = btmp; @@ -344,7 +344,7 @@ boolNDArray m = bool_array_value (); bool *mtmp = m.fortran_vec (); - octave_idx_type nel = m.nelem (); + octave_idx_type nel = m.numel (); OCTAVE_LOCAL_BUFFER (char, htmp, nel); for (octave_idx_type i = 0; i < nel; i++) @@ -448,7 +448,7 @@ return false; } - octave_idx_type nel = m.nelem (); + octave_idx_type nel = m.numel (); bool *mtmp = m.fortran_vec (); OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel); diff -r 9f484edd8767 -r 00cf2847355d libinterp/octave-value/ov-flt-re-mat.cc --- a/libinterp/octave-value/ov-flt-re-mat.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/octave-value/ov-flt-re-mat.cc Sun May 24 02:41:37 2015 +0100 @@ -80,7 +80,7 @@ { octave_base_value *retval = 0; - if (matrix.nelem () == 1) + if (matrix.numel () == 1) retval = new octave_float_scalar (matrix (0)); return retval; diff -r 9f484edd8767 -r 00cf2847355d libinterp/octave-value/ov-perm.cc --- a/libinterp/octave-value/ov-perm.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/octave-value/ov-perm.cc Sun May 24 02:41:37 2015 +0100 @@ -439,7 +439,7 @@ { octave_base_value *retval = 0; - if (matrix.nelem () == 1) + if (matrix.numel () == 1) retval = new octave_scalar (matrix (0, 0)); return retval; diff -r 9f484edd8767 -r 00cf2847355d libinterp/octave-value/ov-range.cc --- a/libinterp/octave-value/ov-range.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/octave-value/ov-range.cc Sun May 24 02:41:37 2015 +0100 @@ -72,7 +72,7 @@ { octave_base_value *retval = 0; - switch (range.nelem ()) + switch (range.numel ()) { case 1: retval = new octave_scalar (range.base ()); @@ -131,7 +131,7 @@ idx_vector i = idx(0).index_vector (); if (! error_state) { - if (i.is_scalar () && i(0) < range.nelem ()) + if (i.is_scalar () && i(0) < range.numel ()) retval = range.elem (i(0)); else retval = range.index (i); @@ -173,7 +173,7 @@ { double retval = lo_ieee_nan_value (); - octave_idx_type nel = range.nelem (); + octave_idx_type nel = range.numel (); if (nel > 0) { @@ -193,7 +193,7 @@ { float retval = lo_ieee_float_nan_value (); - octave_idx_type nel = range.nelem (); + octave_idx_type nel = range.numel (); if (nel > 0) { @@ -264,7 +264,7 @@ { bool retval = false; - if (range.nelem () != 0) + if (range.numel () != 0) { // FIXME: this is a potential waste of memory. @@ -283,7 +283,7 @@ Complex retval (tmp, tmp); - octave_idx_type nel = range.nelem (); + octave_idx_type nel = range.numel (); if (nel > 0) { @@ -305,7 +305,7 @@ FloatComplex retval (tmp, tmp); - octave_idx_type nel = range.nelem (); + octave_idx_type nel = range.numel (); if (nel > 0) { @@ -370,7 +370,7 @@ { bool retval = false; - octave_idx_type n = range.nelem (); + octave_idx_type n = range.numel (); indent (os); @@ -392,7 +392,7 @@ void octave_range::short_disp (std::ostream& os) const { - octave_idx_type len = range.nelem (); + octave_idx_type len = range.numel (); if (len == 0) os << "[]"; @@ -434,7 +434,7 @@ double base = r.base (); double limit = r.limit (); double inc = r.inc (); - octave_idx_type len = r.nelem (); + octave_idx_type len = r.numel (); if (inc != 0) os << "# base, limit, increment\n"; @@ -487,7 +487,7 @@ double lim = r.limit (); double inc = r.inc (); if (inc == 0) - lim = r.nelem (); + lim = r.numel (); os.write (reinterpret_cast (&bas), 8); os.write (reinterpret_cast (&lim), 8); @@ -583,13 +583,13 @@ Range r = range_value (); double range_vals[3]; range_vals[0] = r.base (); - range_vals[1] = r.inc () != 0 ? r.limit () : r.nelem (); + range_vals[1] = r.inc () != 0 ? r.limit () : r.numel (); range_vals[2] = r.inc (); if (H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, range_vals) >= 0) { - octave_idx_type nel = r.nelem (); + octave_idx_type nel = r.numel (); retval = hdf5_add_scalar_attr (data_hid, H5T_NATIVE_IDX, "OCTAVE_RANGE_NELEM", &nel) >= 0; } @@ -693,7 +693,7 @@ octave_value octave_range::fast_elem_extract (octave_idx_type n) const { - return (n < range.nelem ()) ? octave_value (range.elem (n)) + return (n < range.numel ()) ? octave_value (range.elem (n)) : octave_value (); } diff -r 9f484edd8767 -r 00cf2847355d libinterp/octave-value/ov-range.h --- a/libinterp/octave-value/ov-range.h Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/octave-value/ov-range.h Sun May 24 02:41:37 2015 +0100 @@ -58,14 +58,14 @@ octave_range (double base, double limit, double inc) : octave_base_value (), range (base, limit, inc), idx_cache () { - if (range.nelem () < 0) + if (range.numel () < 0) ::error ("invalid range"); } octave_range (const Range& r) : octave_base_value (), range (r), idx_cache () { - if (range.nelem () < 0 && range.nelem () != -2) + if (range.numel () < 0 && range.numel () != -2) ::error ("invalid range"); } @@ -107,7 +107,7 @@ dim_vector dims (void) const { - octave_idx_type n = range.nelem (); + octave_idx_type n = range.numel (); return dim_vector (n > 0, n); } diff -r 9f484edd8767 -r 00cf2847355d libinterp/octave-value/ov-re-mat.cc --- a/libinterp/octave-value/ov-re-mat.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/octave-value/ov-re-mat.cc Sun May 24 02:41:37 2015 +0100 @@ -95,7 +95,7 @@ { octave_base_value *retval = 0; - if (matrix.nelem () == 1) + if (matrix.numel () == 1) retval = new octave_scalar (matrix (0)); return retval; diff -r 9f484edd8767 -r 00cf2847355d libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc Mon May 25 16:48:47 2015 -0700 +++ b/libinterp/parse-tree/pt-eval.cc Sun May 24 02:41:37 2015 +0100 @@ -337,7 +337,7 @@ { Range rng = rhs.range_value (); - octave_idx_type steps = rng.nelem (); + octave_idx_type steps = rng.numel (); for (octave_idx_type i = 0; i < steps; i++) { diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/Array.cc --- a/liboctave/array/Array.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/Array.cc Sun May 24 02:41:37 2015 +0100 @@ -2231,7 +2231,7 @@ Array::nnz (void) const { const T *src = data (); - octave_idx_type nel = nelem (); + octave_idx_type nel = numel (); octave_idx_type retval = 0; const T zero = T (); for (octave_idx_type i = 0; i < nel; i++) @@ -2247,7 +2247,7 @@ { Array retval; const T *src = data (); - octave_idx_type nel = nelem (); + octave_idx_type nel = numel (); const T zero = T (); if (n < 0 || n >= nel) { diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/Array.h --- a/liboctave/array/Array.h Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/Array.h Sun May 24 02:41:37 2015 +0100 @@ -252,11 +252,13 @@ // Number of elements in the array. These are all synonyms. //@{ //! Number of elements in the array. - //! Synonymous with length(), nelem(), and numel(). - octave_idx_type capacity (void) const { return slice_len; } + //! Synonymous with numel(). + octave_idx_type capacity (void) const { return numel (); } //! Number of elements in the array. - /*! Synonymous with capacity(), nelem(), and numel(). + /*! Synonymous with capacity() and numel(). + + @note This method is deprecated in favour of numel(). @note This is @em not the same as @c %length() at the Octave interpreter. @@ -264,15 +266,16 @@ length of the greatest dimension. This method returns the total number of elements. */ - octave_idx_type length (void) const { return capacity (); } + octave_idx_type length (void) const { return numel (); } //! Number of elements in the array. - //! Synonymous with capacity(), length(), and numel(). - octave_idx_type nelem (void) const { return capacity (); } + //! Synonymous with capacity() and numel(). + //! @note This method is deprecated in favour of numel(). + GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return numel (); } //! Number of elements in the array. - //! Synonymous with capacity(), length(), and nelem(). - octave_idx_type numel (void) const { return nelem (); } + //! Synonymous with capacity(). + octave_idx_type numel (void) const { return slice_len; } //@} //! Return the array as a column vector. diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/CNDArray.cc --- a/liboctave/array/CNDArray.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/CNDArray.cc Sun May 24 02:41:37 2015 +0100 @@ -535,7 +535,7 @@ bool ComplexNDArray::all_integers (double& max_val, double& min_val) const { - octave_idx_type nel = nelem (); + octave_idx_type nel = numel (); if (nel > 0) { @@ -846,7 +846,7 @@ std::ostream& operator << (std::ostream& os, const ComplexNDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); for (octave_idx_type i = 0; i < nel; i++) { @@ -860,7 +860,7 @@ std::istream& operator >> (std::istream& is, ComplexNDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); if (nel > 0) { diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/PermMatrix.h --- a/liboctave/array/PermMatrix.h Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/PermMatrix.h Sun May 24 02:41:37 2015 +0100 @@ -61,8 +61,8 @@ // FIXME: a dangerous ambiguity? octave_idx_type length (void) const { return perm_length (); } - octave_idx_type nelem (void) const { return dim1 () * dim2 (); } - octave_idx_type numel (void) const { return nelem (); } + GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return numel (); } + octave_idx_type numel (void) const { return dim1 () * dim2 (); } size_t byte_size (void) const { return Array::byte_size (); } diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/Range.cc --- a/liboctave/array/Range.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/Range.cc Sun May 24 02:41:37 2015 +0100 @@ -44,24 +44,24 @@ // or fewer elements only the base needs to be an integer return (! (xisnan (rng_base) || xisnan (rng_inc)) - && (NINTbig (rng_base) == rng_base || rng_nelem < 1) - && (NINTbig (rng_inc) == rng_inc || rng_nelem <= 1)); + && (NINTbig (rng_base) == rng_base || rng_numel < 1) + && (NINTbig (rng_inc) == rng_inc || rng_numel <= 1)); } Matrix Range::matrix_value (void) const { - if (rng_nelem > 0 && cache.nelem () == 0) + if (rng_numel > 0 && cache.numel () == 0) { - cache.resize (1, rng_nelem); + cache.resize (1, rng_numel); double b = rng_base; double increment = rng_inc; - if (rng_nelem > 0) + if (rng_numel > 0) { // The first element must always be *exactly* the base. // E.g, -0 would otherwise become +0 in the loop (-0 + 0*increment). cache(0) = b; - for (octave_idx_type i = 1; i < rng_nelem; i++) + for (octave_idx_type i = 1; i < rng_numel; i++) cache(i) = b + i * increment; } @@ -72,9 +72,9 @@ // elements. The tests need equality (>= rng_limit or <= rng_limit) // to have expressions like -5:1:-0 result in a -0 endpoint. - if ((rng_inc > 0 && cache(rng_nelem-1) >= rng_limit) - || (rng_inc < 0 && cache(rng_nelem-1) <= rng_limit)) - cache(rng_nelem-1) = rng_limit; + if ((rng_inc > 0 && cache(rng_numel-1) >= rng_limit) + || (rng_inc < 0 && cache(rng_numel-1) <= rng_limit)) + cache(rng_numel-1) = rng_limit; } return cache; @@ -83,12 +83,12 @@ double Range::checkelem (octave_idx_type i) const { - if (i < 0 || i >= rng_nelem) - gripe_index_out_of_range (1, 1, i+1, rng_nelem); + if (i < 0 || i >= rng_numel) + gripe_index_out_of_range (1, 1, i+1, rng_numel); if (i == 0) return rng_base; - else if (i < rng_nelem - 1) + else if (i < rng_numel - 1) return rng_base + i * rng_inc; else { @@ -109,7 +109,7 @@ #else if (i == 0) return rng_base; - else if (i < rng_nelem - 1) + else if (i < rng_numel - 1) return rng_base + i * rng_inc; else { @@ -158,11 +158,11 @@ { Array retval; - octave_idx_type n = rng_nelem; + octave_idx_type n = rng_numel; if (i.is_colon ()) { - retval = matrix_value ().reshape (dim_vector (rng_nelem, 1)); + retval = matrix_value ().reshape (dim_vector (rng_numel, 1)); } else { @@ -181,26 +181,26 @@ // idx_vector loop across all values in i, // executing __rangeidx_helper (i) for each i i.loop (n, __rangeidx_helper (retval.fortran_vec (), - rng_base, rng_inc, rng_limit, rng_nelem)); + rng_base, rng_inc, rng_limit, rng_numel)); } return retval; } -// NOTE: max and min only return useful values if nelem > 0. -// do_minmax_body() in max.cc avoids calling Range::min/max if nelem == 0. +// NOTE: max and min only return useful values if numel > 0. +// do_minmax_body() in max.cc avoids calling Range::min/max if numel == 0. double Range::min (void) const { double retval = 0.0; - if (rng_nelem > 0) + if (rng_numel > 0) { if (rng_inc > 0) retval = rng_base; else { - retval = rng_base + (rng_nelem - 1) * rng_inc; + retval = rng_base + (rng_numel - 1) * rng_inc; // See the note in the matrix_value method above. if (retval <= rng_limit) @@ -215,11 +215,11 @@ Range::max (void) const { double retval = 0.0; - if (rng_nelem > 0) + if (rng_numel > 0) { if (rng_inc > 0) { - retval = rng_base + (rng_nelem - 1) * rng_inc; + retval = rng_base + (rng_numel - 1) * rng_inc; // See the note in the matrix_value method above. if (retval >= rng_limit) @@ -255,7 +255,7 @@ void Range::sort_internal (Array& sidx, bool ascending) { - octave_idx_type nel = nelem (); + octave_idx_type nel = numel (); sidx.resize (dim_vector (1, nel)); @@ -336,9 +336,9 @@ sortmode Range::is_sorted (sortmode mode) const { - if (rng_nelem > 1 && rng_inc > 0) + if (rng_numel > 1 && rng_inc > 0) mode = (mode == DESCENDING) ? UNSORTED : ASCENDING; - else if (rng_nelem > 1 && rng_inc < 0) + else if (rng_numel > 1 && rng_inc < 0) mode = (mode == ASCENDING) ? UNSORTED : DESCENDING; else mode = mode ? mode : ASCENDING; @@ -351,7 +351,7 @@ { double b = a.base (); double increment = a.inc (); - octave_idx_type num_elem = a.nelem (); + octave_idx_type num_elem = a.numel (); if (num_elem > 1) { @@ -377,7 +377,7 @@ if (is) { is >> a.rng_inc; - a.rng_nelem = a.nelem_internal (); + a.rng_numel = a.numel_internal (); } } @@ -387,13 +387,13 @@ Range operator - (const Range& r) { - return Range (-r.base (), -r.limit (), -r.inc (), r.nelem ()); + return Range (-r.base (), -r.limit (), -r.inc (), r.numel ()); } Range operator + (double x, const Range& r) { - Range result (x + r.base (), x + r.limit (), r.inc (), r.nelem ()); - if (result.rng_nelem < 0) + Range result (x + r.base (), x + r.limit (), r.inc (), r.numel ()); + if (result.rng_numel < 0) result.cache = x + r.matrix_value (); return result; @@ -401,8 +401,8 @@ Range operator + (const Range& r, double x) { - Range result (r.base () + x, r.limit () + x, r.inc (), r.nelem ()); - if (result.rng_nelem < 0) + Range result (r.base () + x, r.limit () + x, r.inc (), r.numel ()); + if (result.rng_numel < 0) result.cache = r.matrix_value () + x; return result; @@ -410,8 +410,8 @@ Range operator - (double x, const Range& r) { - Range result (x - r.base (), x - r.limit (), -r.inc (), r.nelem ()); - if (result.rng_nelem < 0) + Range result (x - r.base (), x - r.limit (), -r.inc (), r.numel ()); + if (result.rng_numel < 0) result.cache = x - r.matrix_value (); return result; @@ -419,8 +419,8 @@ Range operator - (const Range& r, double x) { - Range result (r.base () - x, r.limit () - x, r.inc (), r.nelem ()); - if (result.rng_nelem < 0) + Range result (r.base () - x, r.limit () - x, r.inc (), r.numel ()); + if (result.rng_numel < 0) result.cache = r.matrix_value () - x; return result; @@ -428,8 +428,8 @@ Range operator * (double x, const Range& r) { - Range result (x * r.base (), x * r.limit (), x * r.inc (), r.nelem ()); - if (result.rng_nelem < 0) + Range result (x * r.base (), x * r.limit (), x * r.inc (), r.numel ()); + if (result.rng_numel < 0) result.cache = x * r.matrix_value (); return result; @@ -437,8 +437,8 @@ Range operator * (const Range& r, double x) { - Range result (r.base () * x, r.limit () * x, r.inc () * x, r.nelem ()); - if (result.rng_nelem < 0) + Range result (r.base () * x, r.limit () * x, r.inc () * x, r.numel ()); + if (result.rng_numel < 0) result.cache = r.matrix_value () * x; return result; @@ -524,7 +524,7 @@ } octave_idx_type -Range::nelem_internal (void) const +Range::numel_internal (void) const { octave_idx_type retval = -1; diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/Range.h --- a/liboctave/array/Range.h Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/Range.h Sun May 24 02:41:37 2015 +0100 @@ -35,33 +35,34 @@ public: Range (void) - : rng_base (0), rng_limit (0), rng_inc (0), rng_nelem (0), cache (1, 0) { } + : rng_base (0), rng_limit (0), rng_inc (0), rng_numel (0), cache (1, 0) { } Range (const Range& r) : rng_base (r.rng_base), rng_limit (r.rng_limit), rng_inc (r.rng_inc), - rng_nelem (r.rng_nelem), cache (r.cache) { } + rng_numel (r.rng_numel), cache (r.cache) { } Range (double b, double l) : rng_base (b), rng_limit (l), rng_inc (1), - rng_nelem (nelem_internal ()), cache () { } + rng_numel (numel_internal ()), cache () { } Range (double b, double l, double i) : rng_base (b), rng_limit (l), rng_inc (i), - rng_nelem (nelem_internal ()), cache () { } + rng_numel (numel_internal ()), cache () { } // For operators' usage (to preserve element count). Range (double b, double i, octave_idx_type n) : rng_base (b), rng_limit (b + (n-1) * i), rng_inc (i), - rng_nelem (n), cache () + rng_numel (n), cache () { if (! xfinite (b) || ! xfinite (i) || ! xfinite (rng_limit)) - rng_nelem = -2; + rng_numel = -2; } double base (void) const { return rng_base; } double limit (void) const { return rng_limit; } double inc (void) const { return rng_inc; } - octave_idx_type nelem (void) const { return rng_nelem; } + GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return numel (); } + octave_idx_type numel (void) const { return rng_numel; } bool all_elements_are_ints (void) const; @@ -137,11 +138,11 @@ double rng_limit; double rng_inc; - octave_idx_type rng_nelem; + octave_idx_type rng_numel; mutable Matrix cache; - octave_idx_type nelem_internal (void) const; + octave_idx_type numel_internal (void) const; void clear_cache (void) const { cache.resize (0, 0); } @@ -150,10 +151,10 @@ // For operators' usage (to allow all values to be set directly). Range (double b, double l, double i, octave_idx_type n) : rng_base (b), rng_limit (l), rng_inc (i), - rng_nelem (n), cache () + rng_numel (n), cache () { if (! xfinite (b) || ! xfinite (i) || ! xfinite (l)) - rng_nelem = -2; + rng_numel = -2; } }; diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/Sparse.h --- a/liboctave/array/Sparse.h Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/Sparse.h Sun May 24 02:41:37 2015 +0100 @@ -254,7 +254,7 @@ return dimensions.safe_numel (); } - octave_idx_type nelem (void) const { return capacity (); } + GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return capacity (); } octave_idx_type length (void) const { return numel (); } octave_idx_type dim1 (void) const { return dimensions(0); } diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/dNDArray.cc --- a/liboctave/array/dNDArray.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/dNDArray.cc Sun May 24 02:41:37 2015 +0100 @@ -596,7 +596,7 @@ bool NDArray::all_integers (double& max_val, double& min_val) const { - octave_idx_type nel = nelem (); + octave_idx_type nel = numel (); if (nel > 0) { @@ -872,7 +872,7 @@ std::ostream& operator << (std::ostream& os, const NDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); for (octave_idx_type i = 0; i < nel; i++) { @@ -886,7 +886,7 @@ std::istream& operator >> (std::istream& is, NDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); if (nel > 0) { diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/fCNDArray.cc --- a/liboctave/array/fCNDArray.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/fCNDArray.cc Sun May 24 02:41:37 2015 +0100 @@ -532,7 +532,7 @@ bool FloatComplexNDArray::all_integers (float& max_val, float& min_val) const { - octave_idx_type nel = nelem (); + octave_idx_type nel = numel (); if (nel > 0) { @@ -857,7 +857,7 @@ std::ostream& operator << (std::ostream& os, const FloatComplexNDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); for (octave_idx_type i = 0; i < nel; i++) { @@ -871,7 +871,7 @@ std::istream& operator >> (std::istream& is, FloatComplexNDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); if (nel > 0) { diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/fNDArray.cc --- a/liboctave/array/fNDArray.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/fNDArray.cc Sun May 24 02:41:37 2015 +0100 @@ -556,7 +556,7 @@ bool FloatNDArray::all_integers (float& max_val, float& min_val) const { - octave_idx_type nel = nelem (); + octave_idx_type nel = numel (); if (nel > 0) { @@ -843,7 +843,7 @@ std::ostream& operator << (std::ostream& os, const FloatNDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); for (octave_idx_type i = 0; i < nel; i++) { @@ -857,7 +857,7 @@ std::istream& operator >> (std::istream& is, FloatNDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); if (nel > 0) { diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/idx-vector.cc --- a/liboctave/array/idx-vector.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/idx-vector.cc Sun May 24 02:41:37 2015 +0100 @@ -121,7 +121,7 @@ } idx_vector::idx_range_rep::idx_range_rep (const Range& r) - : start (0), len (r.nelem ()), step (1) + : start (0), len (r.numel ()), step (1) { if (len < 0) { diff -r 9f484edd8767 -r 00cf2847355d liboctave/array/intNDArray.cc --- a/liboctave/array/intNDArray.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/array/intNDArray.cc Sun May 24 02:41:37 2015 +0100 @@ -49,7 +49,7 @@ bool intNDArray::any_element_not_one_or_zero (void) const { - octave_idx_type nel = this->nelem (); + octave_idx_type nel = this->numel (); for (octave_idx_type i = 0; i < nel; i++) { @@ -143,7 +143,7 @@ std::ostream& operator << (std::ostream& os, const intNDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); for (octave_idx_type i = 0; i < nel; i++) os << " " << a.elem (i) << "\n"; @@ -155,7 +155,7 @@ std::istream& operator >> (std::istream& is, intNDArray& a) { - octave_idx_type nel = a.nelem (); + octave_idx_type nel = a.numel (); if (nel > 0) { @@ -183,7 +183,7 @@ intNDArray intNDArray::abs (void) const { - octave_idx_type nel = this->nelem (); + octave_idx_type nel = this->numel (); intNDArray ret (this->dims ()); for (octave_idx_type i = 0; i < nel; i++) @@ -199,7 +199,7 @@ intNDArray intNDArray::signum (void) const { - octave_idx_type nel = this->nelem (); + octave_idx_type nel = this->numel (); intNDArray ret (this->dims ()); for (octave_idx_type i = 0; i < nel; i++) diff -r 9f484edd8767 -r 00cf2847355d liboctave/numeric/SparseCmplxLU.cc --- a/liboctave/numeric/SparseCmplxLU.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/numeric/SparseCmplxLU.cc Sun May 24 02:41:37 2015 +0100 @@ -58,7 +58,7 @@ double tmp = octave_sparse_params::get_key ("spumoni"); if (!xisnan (tmp)) Control (UMFPACK_PRL) = tmp; - if (piv_thres.nelem () == 2) + if (piv_thres.numel () == 2) { tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0)); if (!xisnan (tmp)) @@ -267,7 +267,7 @@ double tmp = octave_sparse_params::get_key ("spumoni"); if (!xisnan (tmp)) Control (UMFPACK_PRL) = tmp; - if (piv_thres.nelem () == 2) + if (piv_thres.numel () == 2) { tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0)); if (!xisnan (tmp)) diff -r 9f484edd8767 -r 00cf2847355d liboctave/numeric/SparsedbleLU.cc --- a/liboctave/numeric/SparsedbleLU.cc Mon May 25 16:48:47 2015 -0700 +++ b/liboctave/numeric/SparsedbleLU.cc Sun May 24 02:41:37 2015 +0100 @@ -57,7 +57,7 @@ if (!xisnan (tmp)) Control (UMFPACK_PRL) = tmp; - if (piv_thres.nelem () == 2) + if (piv_thres.numel () == 2) { tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0)); if (!xisnan (tmp)) @@ -253,7 +253,7 @@ if (!xisnan (tmp)) Control (UMFPACK_PRL) = tmp; - if (piv_thres.nelem () == 2) + if (piv_thres.numel () == 2) { tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0)); if (!xisnan (tmp))