Mercurial > octave-nkf
comparison libinterp/corefcn/cellfun.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 | 4f45eaf83908 |
children | 610c74748518 |
comparison
equal
deleted
inserted
replaced
20266:83792dd9bcc1 | 20267:a9574e3c6e9e |
---|---|
1712 do_num2cell_helper (const dim_vector& dv, | 1712 do_num2cell_helper (const dim_vector& dv, |
1713 const Array<int>& dimv, | 1713 const Array<int>& dimv, |
1714 dim_vector& celldv, dim_vector& arraydv, | 1714 dim_vector& celldv, dim_vector& arraydv, |
1715 Array<int>& perm) | 1715 Array<int>& perm) |
1716 { | 1716 { |
1717 int dvl = dimv.length (); | 1717 int dvl = dimv.numel (); |
1718 int maxd = dv.length (); | 1718 int maxd = dv.length (); |
1719 celldv = dv; | 1719 celldv = dv; |
1720 for (int i = 0; i < dvl; i++) | 1720 for (int i = 0; i < dvl; i++) |
1721 maxd = std::max (maxd, dimv(i)); | 1721 maxd = std::max (maxd, dimv(i)); |
1722 if (maxd > dv.length ()) | 1722 if (maxd > dv.length ()) |
1979 const Array<octave_idx_type> *d, int nd) | 1979 const Array<octave_idx_type> *d, int nd) |
1980 { | 1980 { |
1981 for (int i = 0; i < nd; i++) | 1981 for (int i = 0; i < nd; i++) |
1982 { | 1982 { |
1983 octave_idx_type s = 0; | 1983 octave_idx_type s = 0; |
1984 for (octave_idx_type j = 0; j < d[i].length (); j++) | 1984 for (octave_idx_type j = 0; j < d[i].numel (); j++) |
1985 s += d[i](j); | 1985 s += d[i](j); |
1986 | 1986 |
1987 octave_idx_type r = i < dv.length () ? dv(i) : 1; | 1987 octave_idx_type r = i < dv.length () ? dv(i) : 1; |
1988 | 1988 |
1989 if (s != r) | 1989 if (s != r) |
2029 assert (a.ndims () == 2); | 2029 assert (a.ndims () == 2); |
2030 | 2030 |
2031 if (mat2cell_mismatch (a.dims (), d, nd)) | 2031 if (mat2cell_mismatch (a.dims (), d, nd)) |
2032 return retval; | 2032 return retval; |
2033 | 2033 |
2034 octave_idx_type nridx = d[0].length (); | 2034 octave_idx_type nridx = d[0].numel (); |
2035 octave_idx_type ncidx = nd == 1 ? 1 : d[1].length (); | 2035 octave_idx_type ncidx = nd == 1 ? 1 : d[1].numel (); |
2036 retval.clear (nridx, ncidx); | 2036 retval.clear (nridx, ncidx); |
2037 | 2037 |
2038 int ivec = -1; | 2038 int ivec = -1; |
2039 if (a.rows () > 1 && a.cols () == 1 && ncidx == 1) | 2039 if (a.rows () > 1 && a.cols () == 1 && ncidx == 1) |
2040 ivec = 0; | 2040 ivec = 0; |
2090 dim_vector rdv = dim_vector::alloc (nd); | 2090 dim_vector rdv = dim_vector::alloc (nd); |
2091 OCTAVE_LOCAL_BUFFER (octave_idx_type, nidx, nd); | 2091 OCTAVE_LOCAL_BUFFER (octave_idx_type, nidx, nd); |
2092 octave_idx_type idxtot = 0; | 2092 octave_idx_type idxtot = 0; |
2093 for (int i = 0; i < nd; i++) | 2093 for (int i = 0; i < nd; i++) |
2094 { | 2094 { |
2095 rdv(i) = nidx[i] = d[i].length (); | 2095 rdv(i) = nidx[i] = d[i].numel (); |
2096 idxtot += nidx[i]; | 2096 idxtot += nidx[i]; |
2097 } | 2097 } |
2098 | 2098 |
2099 retval.clear (rdv); | 2099 retval.clear (rdv); |
2100 | 2100 |
2154 dim_vector rdv = dim_vector::alloc (nd); | 2154 dim_vector rdv = dim_vector::alloc (nd); |
2155 OCTAVE_LOCAL_BUFFER (octave_idx_type, nidx, nd); | 2155 OCTAVE_LOCAL_BUFFER (octave_idx_type, nidx, nd); |
2156 octave_idx_type idxtot = 0; | 2156 octave_idx_type idxtot = 0; |
2157 for (int i = 0; i < nd; i++) | 2157 for (int i = 0; i < nd; i++) |
2158 { | 2158 { |
2159 rdv(i) = nidx[i] = d[i].length (); | 2159 rdv(i) = nidx[i] = d[i].numel (); |
2160 idxtot += nidx[i]; | 2160 idxtot += nidx[i]; |
2161 } | 2161 } |
2162 | 2162 |
2163 retval.clear (rdv); | 2163 retval.clear (rdv); |
2164 | 2164 |
2337 do_cellslices_nda (const NDA& array, | 2337 do_cellslices_nda (const NDA& array, |
2338 const Array<octave_idx_type>& lb, | 2338 const Array<octave_idx_type>& lb, |
2339 const Array<octave_idx_type>& ub, | 2339 const Array<octave_idx_type>& ub, |
2340 int dim = -1) | 2340 int dim = -1) |
2341 { | 2341 { |
2342 octave_idx_type n = lb.length (); | 2342 octave_idx_type n = lb.numel (); |
2343 Cell retval (1, n); | 2343 Cell retval (1, n); |
2344 if (array.is_vector () && (dim == -1 | 2344 if (array.is_vector () && (dim == -1 |
2345 || (dim == 0 && array.columns () == 1) | 2345 || (dim == 0 && array.columns () == 1) |
2346 || (dim == 1 && array.rows () == 1))) | 2346 || (dim == 1 && array.rows () == 1))) |
2347 { | 2347 { |
2407 error ("cellslices: DIM must be a valid dimension"); | 2407 error ("cellslices: DIM must be a valid dimension"); |
2408 } | 2408 } |
2409 | 2409 |
2410 if (! error_state) | 2410 if (! error_state) |
2411 { | 2411 { |
2412 if (lb.length () != ub.length ()) | 2412 if (lb.numel () != ub.numel ()) |
2413 error ("cellslices: the lengths of LB and UB must match"); | 2413 error ("cellslices: the lengths of LB and UB must match"); |
2414 else | 2414 else |
2415 { | 2415 { |
2416 Cell retcell; | 2416 Cell retcell; |
2417 if (! x.is_sparse_type () && x.is_matrix_type ()) | 2417 if (! x.is_sparse_type () && x.is_matrix_type ()) |
2470 } | 2470 } |
2471 } | 2471 } |
2472 else | 2472 else |
2473 { | 2473 { |
2474 // generic code. | 2474 // generic code. |
2475 octave_idx_type n = lb.length (); | 2475 octave_idx_type n = lb.numel (); |
2476 retcell = Cell (1, n); | 2476 retcell = Cell (1, n); |
2477 const dim_vector dv = x.dims (); | 2477 const dim_vector dv = x.dims (); |
2478 int ndims = dv.length (); | 2478 int ndims = dv.length (); |
2479 if (dim < 0) | 2479 if (dim < 0) |
2480 dim = dv.first_non_singleton (); | 2480 dim = dv.first_non_singleton (); |