comparison liboctave/array/fColVector.cc @ 20267:a9574e3c6e9e

Deprecate Array::length() and Sparse::length() in favour of ::numel(). * liboctave/array/Array.h (Array::length): deprecate for ::numel. * liboctave/array/Sparse.h (Sparse::length): deprecate for ::numel. * libgui/graphics/QtHandlesUtils.cc, libgui/src/octave-qt-link.cc, libinterp/corefcn/Cell.cc, libinterp/corefcn/__contourc__.cc, libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc, libinterp/corefcn/cellfun.cc, libinterp/corefcn/daspk.cc, libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc, libinterp/corefcn/data.cc, libinterp/corefcn/filter.cc, libinterp/corefcn/find.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/gl-render.h, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/help.cc, libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc, libinterp/corefcn/load-path.cc, libinterp/corefcn/load-save.cc, libinterp/corefcn/ls-oct-ascii.h, libinterp/corefcn/lsode.cc, libinterp/corefcn/matrix_type.cc, libinterp/corefcn/oct-hist.cc, libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h, libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h, libinterp/corefcn/pr-output.cc, libinterp/corefcn/quadcc.cc, libinterp/corefcn/rand.cc, libinterp/corefcn/regexp.cc, libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc, libinterp/corefcn/symtab.h, libinterp/corefcn/syscalls.cc, libinterp/corefcn/tsearch.cc, libinterp/corefcn/urlwrite.cc, libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc, libinterp/corefcn/xdiv.cc, libinterp/corefcn/xpow.cc, libinterp/dldfcn/__glpk__.cc, libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/audiodevinfo.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/colamd.cc, libinterp/octave-value/ov-cell.cc, libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-perm.cc, libinterp/octave-value/ov-struct.cc, libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov.cc, libinterp/operators/op-int.h, libinterp/parse-tree/pt-pr-code.cc, liboctave/array/Array-util.cc, liboctave/array/Array.cc, liboctave/array/CColVector.cc, liboctave/array/CDiagMatrix.cc, liboctave/array/CMatrix.cc, liboctave/array/CRowVector.cc, liboctave/array/DiagArray2.cc, liboctave/array/DiagArray2.h, liboctave/array/MArray.cc, liboctave/array/PermMatrix.cc, liboctave/array/PermMatrix.h, liboctave/array/Sparse.cc, liboctave/array/boolMatrix.cc, liboctave/array/chMatrix.cc, liboctave/array/chNDArray.cc, liboctave/array/dColVector.cc, liboctave/array/dDiagMatrix.cc, liboctave/array/dMatrix.cc, liboctave/array/dRowVector.cc, liboctave/array/fCColVector.cc, liboctave/array/fCDiagMatrix.cc, liboctave/array/fCMatrix.cc, liboctave/array/fCRowVector.cc, liboctave/array/fColVector.cc, liboctave/array/fDiagMatrix.cc, liboctave/array/fMatrix.cc, liboctave/array/fRowVector.cc, liboctave/array/idx-vector.cc, liboctave/array/intNDArray.cc, liboctave/numeric/CmplxCHOL.cc, liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxQR.cc, liboctave/numeric/DASPK.cc, liboctave/numeric/DASRT.cc, liboctave/numeric/DASSL.cc, liboctave/numeric/LSODE.cc, liboctave/numeric/ODES.cc, liboctave/numeric/ODES.h, liboctave/numeric/base-dae.h, liboctave/numeric/base-lu.cc, liboctave/numeric/dbleCHOL.cc, liboctave/numeric/dbleLU.cc, liboctave/numeric/dbleQR.cc, liboctave/numeric/eigs-base.cc, liboctave/numeric/fCmplxCHOL.cc, liboctave/numeric/fCmplxLU.cc, liboctave/numeric/fCmplxQR.cc, liboctave/numeric/floatCHOL.cc, liboctave/numeric/floatLU.cc, liboctave/numeric/floatQR.cc, liboctave/numeric/lo-specfun.cc, liboctave/numeric/oct-rand.cc, liboctave/numeric/oct-spparms.cc, liboctave/numeric/sparse-base-chol.cc, liboctave/operators/mx-inlines.cc, liboctave/system/file-ops.cc, liboctave/util/glob-match.h, liboctave/util/kpse.cc, liboctave/util/lo-regexp.cc, liboctave/util/oct-glob.cc, liboctave/util/pathsearch.cc, liboctave/util/str-vec.cc, liboctave/util/str-vec.h, liboctave/util/url-transfer.cc: replace all usage of Array::length() and Sparse::length() with ::numel().
author Carnë Draug <carandraug@octave.org>
date Sat, 30 May 2015 03:14:07 +0100
parents 4197fc428c7d
children
comparison
equal deleted inserted replaced
20266:83792dd9bcc1 20267:a9574e3c6e9e
52 // Column Vector class. 52 // Column Vector class.
53 53
54 bool 54 bool
55 FloatColumnVector::operator == (const FloatColumnVector& a) const 55 FloatColumnVector::operator == (const FloatColumnVector& a) const
56 { 56 {
57 octave_idx_type len = length (); 57 octave_idx_type len = numel ();
58 if (len != a.length ()) 58 if (len != a.numel ())
59 return 0; 59 return 0;
60 return mx_inline_equal (len, data (), a.data ()); 60 return mx_inline_equal (len, data (), a.data ());
61 } 61 }
62 62
63 bool 63 bool
67 } 67 }
68 68
69 FloatColumnVector& 69 FloatColumnVector&
70 FloatColumnVector::insert (const FloatColumnVector& a, octave_idx_type r) 70 FloatColumnVector::insert (const FloatColumnVector& a, octave_idx_type r)
71 { 71 {
72 octave_idx_type a_len = a.length (); 72 octave_idx_type a_len = a.numel ();
73 73
74 if (r < 0 || r + a_len > length ()) 74 if (r < 0 || r + a_len > numel ())
75 { 75 {
76 (*current_liboctave_error_handler) ("range error for insert"); 76 (*current_liboctave_error_handler) ("range error for insert");
77 return *this; 77 return *this;
78 } 78 }
79 79
89 } 89 }
90 90
91 FloatColumnVector& 91 FloatColumnVector&
92 FloatColumnVector::fill (float val) 92 FloatColumnVector::fill (float val)
93 { 93 {
94 octave_idx_type len = length (); 94 octave_idx_type len = numel ();
95 95
96 if (len > 0) 96 if (len > 0)
97 { 97 {
98 make_unique (); 98 make_unique ();
99 99
105 } 105 }
106 106
107 FloatColumnVector& 107 FloatColumnVector&
108 FloatColumnVector::fill (float val, octave_idx_type r1, octave_idx_type r2) 108 FloatColumnVector::fill (float val, octave_idx_type r1, octave_idx_type r2)
109 { 109 {
110 octave_idx_type len = length (); 110 octave_idx_type len = numel ();
111 111
112 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) 112 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len)
113 { 113 {
114 (*current_liboctave_error_handler) ("range error for fill"); 114 (*current_liboctave_error_handler) ("range error for fill");
115 return *this; 115 return *this;
129 } 129 }
130 130
131 FloatColumnVector 131 FloatColumnVector
132 FloatColumnVector::stack (const FloatColumnVector& a) const 132 FloatColumnVector::stack (const FloatColumnVector& a) const
133 { 133 {
134 octave_idx_type len = length (); 134 octave_idx_type len = numel ();
135 octave_idx_type nr_insert = len; 135 octave_idx_type nr_insert = len;
136 FloatColumnVector retval (len + a.length ()); 136 FloatColumnVector retval (len + a.numel ());
137 retval.insert (*this, 0); 137 retval.insert (*this, 0);
138 retval.insert (a, nr_insert); 138 retval.insert (a, nr_insert);
139 return retval; 139 return retval;
140 } 140 }
141 141
199 FloatColumnVector retval; 199 FloatColumnVector retval;
200 200
201 octave_idx_type nr = m.rows (); 201 octave_idx_type nr = m.rows ();
202 octave_idx_type nc = m.cols (); 202 octave_idx_type nc = m.cols ();
203 203
204 octave_idx_type a_len = a.length (); 204 octave_idx_type a_len = a.numel ();
205 205
206 if (nc != a_len) 206 if (nc != a_len)
207 gripe_nonconformant ("operator *", nr, nc, a_len, 1); 207 gripe_nonconformant ("operator *", nr, nc, a_len, 1);
208 else 208 else
209 { 209 {
236 FloatColumnVector retval; 236 FloatColumnVector retval;
237 237
238 octave_idx_type nr = m.rows (); 238 octave_idx_type nr = m.rows ();
239 octave_idx_type nc = m.cols (); 239 octave_idx_type nc = m.cols ();
240 240
241 octave_idx_type a_len = a.length (); 241 octave_idx_type a_len = a.numel ();
242 242
243 if (nc != a_len) 243 if (nc != a_len)
244 gripe_nonconformant ("operator *", nr, nc, a_len, 1); 244 gripe_nonconformant ("operator *", nr, nc, a_len, 1);
245 else 245 else
246 { 246 {
264 // other operations 264 // other operations
265 265
266 float 266 float
267 FloatColumnVector::min (void) const 267 FloatColumnVector::min (void) const
268 { 268 {
269 octave_idx_type len = length (); 269 octave_idx_type len = numel ();
270 if (len == 0) 270 if (len == 0)
271 return 0.0; 271 return 0.0;
272 272
273 float res = elem (0); 273 float res = elem (0);
274 274
280 } 280 }
281 281
282 float 282 float
283 FloatColumnVector::max (void) const 283 FloatColumnVector::max (void) const
284 { 284 {
285 octave_idx_type len = length (); 285 octave_idx_type len = numel ();
286 if (len == 0) 286 if (len == 0)
287 return 0.0; 287 return 0.0;
288 288
289 float res = elem (0); 289 float res = elem (0);
290 290
297 297
298 std::ostream& 298 std::ostream&
299 operator << (std::ostream& os, const FloatColumnVector& a) 299 operator << (std::ostream& os, const FloatColumnVector& a)
300 { 300 {
301 // int field_width = os.precision () + 7; 301 // int field_width = os.precision () + 7;
302 for (octave_idx_type i = 0; i < a.length (); i++) 302 for (octave_idx_type i = 0; i < a.numel (); i++)
303 os << /* setw (field_width) << */ a.elem (i) << "\n"; 303 os << /* setw (field_width) << */ a.elem (i) << "\n";
304 return os; 304 return os;
305 } 305 }
306 306
307 std::istream& 307 std::istream&
308 operator >> (std::istream& is, FloatColumnVector& a) 308 operator >> (std::istream& is, FloatColumnVector& a)
309 { 309 {
310 octave_idx_type len = a.length (); 310 octave_idx_type len = a.numel ();
311 311
312 if (len > 0) 312 if (len > 0)
313 { 313 {
314 float tmp; 314 float tmp;
315 for (octave_idx_type i = 0; i < len; i++) 315 for (octave_idx_type i = 0; i < len; i++)