Mercurial > hg > octave-nkf
comparison liboctave/array/dColVector.cc @ 20442: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
20441:83792dd9bcc1 | 20442:a9574e3c6e9e |
---|---|
53 // Column Vector class. | 53 // Column Vector class. |
54 | 54 |
55 bool | 55 bool |
56 ColumnVector::operator == (const ColumnVector& a) const | 56 ColumnVector::operator == (const ColumnVector& a) const |
57 { | 57 { |
58 octave_idx_type len = length (); | 58 octave_idx_type len = numel (); |
59 if (len != a.length ()) | 59 if (len != a.numel ()) |
60 return 0; | 60 return 0; |
61 return mx_inline_equal (len, data (), a.data ()); | 61 return mx_inline_equal (len, data (), a.data ()); |
62 } | 62 } |
63 | 63 |
64 bool | 64 bool |
68 } | 68 } |
69 | 69 |
70 ColumnVector& | 70 ColumnVector& |
71 ColumnVector::insert (const ColumnVector& a, octave_idx_type r) | 71 ColumnVector::insert (const ColumnVector& a, octave_idx_type r) |
72 { | 72 { |
73 octave_idx_type a_len = a.length (); | 73 octave_idx_type a_len = a.numel (); |
74 | 74 |
75 if (r < 0 || r + a_len > length ()) | 75 if (r < 0 || r + a_len > numel ()) |
76 { | 76 { |
77 (*current_liboctave_error_handler) ("range error for insert"); | 77 (*current_liboctave_error_handler) ("range error for insert"); |
78 return *this; | 78 return *this; |
79 } | 79 } |
80 | 80 |
90 } | 90 } |
91 | 91 |
92 ColumnVector& | 92 ColumnVector& |
93 ColumnVector::fill (double val) | 93 ColumnVector::fill (double val) |
94 { | 94 { |
95 octave_idx_type len = length (); | 95 octave_idx_type len = numel (); |
96 | 96 |
97 if (len > 0) | 97 if (len > 0) |
98 { | 98 { |
99 make_unique (); | 99 make_unique (); |
100 | 100 |
106 } | 106 } |
107 | 107 |
108 ColumnVector& | 108 ColumnVector& |
109 ColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2) | 109 ColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2) |
110 { | 110 { |
111 octave_idx_type len = length (); | 111 octave_idx_type len = numel (); |
112 | 112 |
113 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) | 113 if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) |
114 { | 114 { |
115 (*current_liboctave_error_handler) ("range error for fill"); | 115 (*current_liboctave_error_handler) ("range error for fill"); |
116 return *this; | 116 return *this; |
130 } | 130 } |
131 | 131 |
132 ColumnVector | 132 ColumnVector |
133 ColumnVector::stack (const ColumnVector& a) const | 133 ColumnVector::stack (const ColumnVector& a) const |
134 { | 134 { |
135 octave_idx_type len = length (); | 135 octave_idx_type len = numel (); |
136 octave_idx_type nr_insert = len; | 136 octave_idx_type nr_insert = len; |
137 ColumnVector retval (len + a.length ()); | 137 ColumnVector retval (len + a.numel ()); |
138 retval.insert (*this, 0); | 138 retval.insert (*this, 0); |
139 retval.insert (a, nr_insert); | 139 retval.insert (a, nr_insert); |
140 return retval; | 140 return retval; |
141 } | 141 } |
142 | 142 |
200 ColumnVector retval; | 200 ColumnVector retval; |
201 | 201 |
202 octave_idx_type nr = m.rows (); | 202 octave_idx_type nr = m.rows (); |
203 octave_idx_type nc = m.cols (); | 203 octave_idx_type nc = m.cols (); |
204 | 204 |
205 octave_idx_type a_len = a.length (); | 205 octave_idx_type a_len = a.numel (); |
206 | 206 |
207 if (nc != a_len) | 207 if (nc != a_len) |
208 gripe_nonconformant ("operator *", nr, nc, a_len, 1); | 208 gripe_nonconformant ("operator *", nr, nc, a_len, 1); |
209 else | 209 else |
210 { | 210 { |
237 ColumnVector retval; | 237 ColumnVector retval; |
238 | 238 |
239 octave_idx_type nr = m.rows (); | 239 octave_idx_type nr = m.rows (); |
240 octave_idx_type nc = m.cols (); | 240 octave_idx_type nc = m.cols (); |
241 | 241 |
242 octave_idx_type a_len = a.length (); | 242 octave_idx_type a_len = a.numel (); |
243 | 243 |
244 if (nc != a_len) | 244 if (nc != a_len) |
245 gripe_nonconformant ("operator *", nr, nc, a_len, 1); | 245 gripe_nonconformant ("operator *", nr, nc, a_len, 1); |
246 else | 246 else |
247 { | 247 { |
265 // other operations | 265 // other operations |
266 | 266 |
267 double | 267 double |
268 ColumnVector::min (void) const | 268 ColumnVector::min (void) const |
269 { | 269 { |
270 octave_idx_type len = length (); | 270 octave_idx_type len = numel (); |
271 if (len == 0) | 271 if (len == 0) |
272 return 0.0; | 272 return 0.0; |
273 | 273 |
274 double res = elem (0); | 274 double res = elem (0); |
275 | 275 |
281 } | 281 } |
282 | 282 |
283 double | 283 double |
284 ColumnVector::max (void) const | 284 ColumnVector::max (void) const |
285 { | 285 { |
286 octave_idx_type len = length (); | 286 octave_idx_type len = numel (); |
287 if (len == 0) | 287 if (len == 0) |
288 return 0.0; | 288 return 0.0; |
289 | 289 |
290 double res = elem (0); | 290 double res = elem (0); |
291 | 291 |
298 | 298 |
299 std::ostream& | 299 std::ostream& |
300 operator << (std::ostream& os, const ColumnVector& a) | 300 operator << (std::ostream& os, const ColumnVector& a) |
301 { | 301 { |
302 // int field_width = os.precision () + 7; | 302 // int field_width = os.precision () + 7; |
303 for (octave_idx_type i = 0; i < a.length (); i++) | 303 for (octave_idx_type i = 0; i < a.numel (); i++) |
304 os << /* setw (field_width) << */ a.elem (i) << "\n"; | 304 os << /* setw (field_width) << */ a.elem (i) << "\n"; |
305 return os; | 305 return os; |
306 } | 306 } |
307 | 307 |
308 std::istream& | 308 std::istream& |
309 operator >> (std::istream& is, ColumnVector& a) | 309 operator >> (std::istream& is, ColumnVector& a) |
310 { | 310 { |
311 octave_idx_type len = a.length (); | 311 octave_idx_type len = a.numel (); |
312 | 312 |
313 if (len > 0) | 313 if (len > 0) |
314 { | 314 { |
315 double tmp; | 315 double tmp; |
316 for (octave_idx_type i = 0; i < len; i++) | 316 for (octave_idx_type i = 0; i < len; i++) |