Mercurial > octave
diff liboctave/array/Array.cc @ 17769:49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
* liboctave/array/Array-C.cc, liboctave/array/Array-b.cc,
liboctave/array/Array-ch.cc, liboctave/array/Array-d.cc,
liboctave/array/Array-f.cc, liboctave/array/Array-fC.cc,
liboctave/array/Array-util.cc, liboctave/array/Array-util.h,
liboctave/array/Array.cc, liboctave/array/Array.h, liboctave/array/Array3.h,
liboctave/array/CColVector.cc, liboctave/array/CColVector.h,
liboctave/array/CDiagMatrix.cc, liboctave/array/CDiagMatrix.h,
liboctave/array/CMatrix.cc, liboctave/array/CMatrix.h,
liboctave/array/CNDArray.cc, liboctave/array/CNDArray.h,
liboctave/array/CRowVector.cc, liboctave/array/CRowVector.h,
liboctave/array/CSparse.cc, liboctave/array/CSparse.h,
liboctave/array/DiagArray2.h, liboctave/array/MArray.cc,
liboctave/array/MArray.h, liboctave/array/MDiagArray2.cc,
liboctave/array/MDiagArray2.h, liboctave/array/MSparse.cc,
liboctave/array/MSparse.h, liboctave/array/MatrixType.cc,
liboctave/array/MatrixType.h, liboctave/array/PermMatrix.h,
liboctave/array/Range.cc, liboctave/array/Range.h, liboctave/array/Sparse.cc,
liboctave/array/Sparse.h, liboctave/array/boolMatrix.cc,
liboctave/array/boolMatrix.h, liboctave/array/boolNDArray.cc,
liboctave/array/boolNDArray.h, liboctave/array/boolSparse.cc,
liboctave/array/boolSparse.h, liboctave/array/chMatrix.cc,
liboctave/array/chMatrix.h, liboctave/array/chNDArray.cc,
liboctave/array/chNDArray.h, liboctave/array/dColVector.h,
liboctave/array/dDiagMatrix.cc, liboctave/array/dDiagMatrix.h,
liboctave/array/dMatrix.cc, liboctave/array/dMatrix.h,
liboctave/array/dNDArray.cc, liboctave/array/dNDArray.h,
liboctave/array/dRowVector.h, liboctave/array/dSparse.cc,
liboctave/array/dSparse.h, liboctave/array/dim-vector.cc,
liboctave/array/dim-vector.h, liboctave/array/fCColVector.cc,
liboctave/array/fCColVector.h, liboctave/array/fCDiagMatrix.cc,
liboctave/array/fCDiagMatrix.h, liboctave/array/fCMatrix.cc,
liboctave/array/fCMatrix.h, liboctave/array/fCNDArray.cc,
liboctave/array/fCNDArray.h, liboctave/array/fCRowVector.cc,
liboctave/array/fCRowVector.h, liboctave/array/fColVector.h,
liboctave/array/fDiagMatrix.cc, liboctave/array/fDiagMatrix.h,
liboctave/array/fMatrix.cc, liboctave/array/fMatrix.h,
liboctave/array/fNDArray.cc, liboctave/array/fNDArray.h,
liboctave/array/fRowVector.h, liboctave/array/idx-vector.cc,
liboctave/array/idx-vector.h, liboctave/array/intNDArray.cc,
liboctave/array/intNDArray.h, liboctave/cruft/misc/blaswrap.c,
liboctave/cruft/misc/quit.cc, liboctave/numeric/CmplxCHOL.cc,
liboctave/numeric/CmplxCHOL.h, liboctave/numeric/CmplxGEPBAL.cc,
liboctave/numeric/CmplxGEPBAL.h, liboctave/numeric/CmplxHESS.h,
liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxLU.h,
liboctave/numeric/CmplxQR.cc, liboctave/numeric/CmplxQRP.cc,
liboctave/numeric/CmplxQRP.h, liboctave/numeric/CmplxSCHUR.h,
liboctave/numeric/CmplxSVD.cc, liboctave/numeric/CmplxSVD.h,
liboctave/numeric/CollocWt.h, liboctave/numeric/DAE.h,
liboctave/numeric/DAEFunc.h, liboctave/numeric/DAERT.h,
liboctave/numeric/DAERTFunc.h, liboctave/numeric/DASPK.cc,
liboctave/numeric/DASRT.cc, liboctave/numeric/DASRT.h,
liboctave/numeric/DASSL.cc, liboctave/numeric/DET.h, liboctave/numeric/EIG.cc,
liboctave/numeric/EIG.h, liboctave/numeric/LSODE.cc, liboctave/numeric/ODE.h,
liboctave/numeric/ODEFunc.h, liboctave/numeric/ODES.h,
liboctave/numeric/ODESFunc.h, liboctave/numeric/Quad.cc,
liboctave/numeric/Quad.h, liboctave/numeric/SparseCmplxCHOL.h,
liboctave/numeric/SparseCmplxLU.cc, liboctave/numeric/SparseCmplxLU.h,
liboctave/numeric/SparseCmplxQR.cc, liboctave/numeric/SparseCmplxQR.h,
liboctave/numeric/SparseQR.cc, liboctave/numeric/SparseQR.h,
liboctave/numeric/SparsedbleCHOL.h, liboctave/numeric/SparsedbleLU.cc,
liboctave/numeric/SparsedbleLU.h, liboctave/numeric/base-aepbal.h,
liboctave/numeric/base-dae.h, liboctave/numeric/base-de.h,
liboctave/numeric/base-lu.cc, liboctave/numeric/base-lu.h,
liboctave/numeric/base-min.h, liboctave/numeric/base-qr.h,
liboctave/numeric/bsxfun.h, liboctave/numeric/dbleCHOL.cc,
liboctave/numeric/dbleCHOL.h, liboctave/numeric/dbleGEPBAL.h,
liboctave/numeric/dbleHESS.h, liboctave/numeric/dbleLU.cc,
liboctave/numeric/dbleLU.h, liboctave/numeric/dbleQR.cc,
liboctave/numeric/dbleQRP.cc, liboctave/numeric/dbleQRP.h,
liboctave/numeric/dbleSCHUR.cc, liboctave/numeric/dbleSCHUR.h,
liboctave/numeric/dbleSVD.cc, liboctave/numeric/dbleSVD.h,
liboctave/numeric/eigs-base.cc, liboctave/numeric/fCmplxAEPBAL.cc,
liboctave/numeric/fCmplxAEPBAL.h, liboctave/numeric/fCmplxCHOL.cc,
liboctave/numeric/fCmplxCHOL.h, liboctave/numeric/fCmplxGEPBAL.cc,
liboctave/numeric/fCmplxGEPBAL.h, liboctave/numeric/fCmplxHESS.h,
liboctave/numeric/fCmplxLU.cc, liboctave/numeric/fCmplxLU.h,
liboctave/numeric/fCmplxQR.cc, liboctave/numeric/fCmplxQR.h,
liboctave/numeric/fCmplxQRP.cc, liboctave/numeric/fCmplxQRP.h,
liboctave/numeric/fCmplxSCHUR.cc, liboctave/numeric/fCmplxSCHUR.h,
liboctave/numeric/fCmplxSVD.h, liboctave/numeric/fEIG.cc,
liboctave/numeric/fEIG.h, liboctave/numeric/floatCHOL.cc,
liboctave/numeric/floatCHOL.h, liboctave/numeric/floatGEPBAL.cc,
liboctave/numeric/floatGEPBAL.h, liboctave/numeric/floatHESS.h,
liboctave/numeric/floatLU.cc, liboctave/numeric/floatLU.h,
liboctave/numeric/floatQR.cc, liboctave/numeric/floatQRP.cc,
liboctave/numeric/floatQRP.h, liboctave/numeric/floatSCHUR.cc,
liboctave/numeric/floatSCHUR.h, liboctave/numeric/floatSVD.cc,
liboctave/numeric/floatSVD.h, liboctave/numeric/lo-mappers.cc,
liboctave/numeric/lo-mappers.h, liboctave/numeric/lo-specfun.cc,
liboctave/numeric/lo-specfun.h, liboctave/numeric/oct-convn.cc,
liboctave/numeric/oct-fftw.cc, liboctave/numeric/oct-fftw.h,
liboctave/numeric/oct-norm.cc, liboctave/numeric/oct-rand.cc,
liboctave/numeric/oct-rand.h, liboctave/numeric/randgamma.c,
liboctave/numeric/randgamma.h, liboctave/numeric/randmtzig.c,
liboctave/numeric/randpoisson.c, liboctave/numeric/randpoisson.h,
liboctave/numeric/sparse-base-chol.h, liboctave/numeric/sparse-base-lu.h,
liboctave/numeric/sparse-dmsolve.cc, liboctave/operators/Sparse-diag-op-defs.h,
liboctave/operators/Sparse-op-defs.h, liboctave/operators/mx-inlines.cc,
liboctave/system/dir-ops.h, liboctave/system/file-ops.cc,
liboctave/system/file-stat.cc, liboctave/system/file-stat.h,
liboctave/system/lo-sysdep.cc, liboctave/system/lo-sysdep.h,
liboctave/system/mach-info.cc, liboctave/system/mach-info.h,
liboctave/system/oct-env.cc, liboctave/system/oct-group.cc,
liboctave/system/oct-syscalls.cc, liboctave/system/oct-syscalls.h,
liboctave/system/oct-time.h, liboctave/system/tempname.c,
liboctave/util/action-container.h, liboctave/util/base-list.h,
liboctave/util/cmd-edit.cc, liboctave/util/cmd-edit.h,
liboctave/util/cmd-hist.cc, liboctave/util/cmd-hist.h,
liboctave/util/data-conv.cc, liboctave/util/data-conv.h,
liboctave/util/kpse.cc, liboctave/util/lo-array-gripes.cc,
liboctave/util/lo-cieee.c, liboctave/util/lo-regexp.cc,
liboctave/util/lo-utils.cc, liboctave/util/oct-alloc.cc,
liboctave/util/oct-base64.cc, liboctave/util/oct-binmap.h,
liboctave/util/oct-cmplx.h, liboctave/util/oct-glob.cc,
liboctave/util/oct-inttypes.cc, liboctave/util/oct-inttypes.h,
liboctave/util/oct-locbuf.cc, liboctave/util/oct-locbuf.h,
liboctave/util/oct-mem.h, liboctave/util/oct-mutex.cc,
liboctave/util/oct-refcount.h, liboctave/util/oct-shlib.cc,
liboctave/util/oct-shlib.h, liboctave/util/oct-sort.cc,
liboctave/util/oct-sort.h, liboctave/util/pathsearch.cc,
liboctave/util/pathsearch.h, liboctave/util/sparse-util.cc,
liboctave/util/str-vec.cc, liboctave/util/str-vec.h,
liboctave/util/unwind-prot.h, liboctave/util/url-transfer.cc,
liboctave/util/url-transfer.h: Use GNU style coding conventions.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 26 Oct 2013 18:57:05 -0700 |
parents | d63878346099 |
children | 8e056300994b 446c46af4b42 |
line wrap: on
line diff
--- a/liboctave/array/Array.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array.cc Sat Oct 26 18:57:05 2013 -0700 @@ -171,7 +171,8 @@ template <class T> octave_idx_type -Array<T>::compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k) const +Array<T>::compute_index (octave_idx_type i, octave_idx_type j, + octave_idx_type k) const { return ::compute_index (i, j, k, dimensions); } @@ -239,7 +240,8 @@ template <class T> typename Array<T>::crefT -Array<T>::checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const +Array<T>::checkelem (octave_idx_type i, octave_idx_type j, + octave_idx_type k) const { return elem (compute_index (i, j, k)); } @@ -308,39 +310,39 @@ : n (dv.length ()), top (0), dim (new octave_idx_type [2*n]), stride (dim + n), use_blk (false) - { - assert (n == perm.length ()); - - // Get cumulative dimensions. - OCTAVE_LOCAL_BUFFER (octave_idx_type, cdim, n+1); - cdim[0] = 1; - for (int i = 1; i < n+1; i++) cdim[i] = cdim[i-1] * dv(i-1); - - // Setup the permuted strides. - for (int k = 0; k < n; k++) - { - int kk = perm(k); - dim[k] = dv(kk); - stride[k] = cdim[kk]; - } - - // Reduce contiguous runs. - for (int k = 1; k < n; k++) - { - if (stride[k] == stride[top]*dim[top]) - dim[top] *= dim[k]; - else - { - top++; - dim[top] = dim[k]; - stride[top] = stride[k]; - } - } - - // Determine whether we can use block transposes. - use_blk = top >= 1 && stride[1] == 1 && stride[0] == dim[1]; - - } + { + assert (n == perm.length ()); + + // Get cumulative dimensions. + OCTAVE_LOCAL_BUFFER (octave_idx_type, cdim, n+1); + cdim[0] = 1; + for (int i = 1; i < n+1; i++) cdim[i] = cdim[i-1] * dv(i-1); + + // Setup the permuted strides. + for (int k = 0; k < n; k++) + { + int kk = perm(k); + dim[k] = dv(kk); + stride[k] = cdim[kk]; + } + + // Reduce contiguous runs. + for (int k = 1; k < n; k++) + { + if (stride[k] == stride[top]*dim[top]) + dim[top] *= dim[k]; + else + { + top++; + dim[top] = dim[k]; + stride[top] = stride[k]; + } + } + + // Determine whether we can use block transposes. + use_blk = top >= 1 && stride[1] == 1 && stride[0] == dim[1]; + + } ~rec_permute_helper (void) { delete [] dim; } @@ -348,74 +350,74 @@ template <class T> static T * blk_trans (const T *src, T *dest, octave_idx_type nr, octave_idx_type nc) - { - static const octave_idx_type m = 8; - OCTAVE_LOCAL_BUFFER (T, blk, m*m); - for (octave_idx_type kr = 0; kr < nr; kr += m) - for (octave_idx_type kc = 0; kc < nc; kc += m) - { - octave_idx_type lr = std::min (m, nr - kr); - octave_idx_type lc = std::min (m, nc - kc); - if (lr == m && lc == m) - { - const T *ss = src + kc * nr + kr; - for (octave_idx_type j = 0; j < m; j++) - for (octave_idx_type i = 0; i < m; i++) - blk[j*m+i] = ss[j*nr + i]; - T *dd = dest + kr * nc + kc; - for (octave_idx_type j = 0; j < m; j++) - for (octave_idx_type i = 0; i < m; i++) - dd[j*nc+i] = blk[i*m+j]; - } - else - { - const T *ss = src + kc * nr + kr; - for (octave_idx_type j = 0; j < lc; j++) - for (octave_idx_type i = 0; i < lr; i++) - blk[j*m+i] = ss[j*nr + i]; - T *dd = dest + kr * nc + kc; - for (octave_idx_type j = 0; j < lr; j++) - for (octave_idx_type i = 0; i < lc; i++) - dd[j*nc+i] = blk[i*m+j]; - } - } - - return dest + nr*nc; - } + { + static const octave_idx_type m = 8; + OCTAVE_LOCAL_BUFFER (T, blk, m*m); + for (octave_idx_type kr = 0; kr < nr; kr += m) + for (octave_idx_type kc = 0; kc < nc; kc += m) + { + octave_idx_type lr = std::min (m, nr - kr); + octave_idx_type lc = std::min (m, nc - kc); + if (lr == m && lc == m) + { + const T *ss = src + kc * nr + kr; + for (octave_idx_type j = 0; j < m; j++) + for (octave_idx_type i = 0; i < m; i++) + blk[j*m+i] = ss[j*nr + i]; + T *dd = dest + kr * nc + kc; + for (octave_idx_type j = 0; j < m; j++) + for (octave_idx_type i = 0; i < m; i++) + dd[j*nc+i] = blk[i*m+j]; + } + else + { + const T *ss = src + kc * nr + kr; + for (octave_idx_type j = 0; j < lc; j++) + for (octave_idx_type i = 0; i < lr; i++) + blk[j*m+i] = ss[j*nr + i]; + T *dd = dest + kr * nc + kc; + for (octave_idx_type j = 0; j < lr; j++) + for (octave_idx_type i = 0; i < lc; i++) + dd[j*nc+i] = blk[i*m+j]; + } + } + + return dest + nr*nc; + } private: // Recursive N-d generalized transpose template <class T> T *do_permute (const T *src, T *dest, int lev) const - { - if (lev == 0) - { - octave_idx_type step = stride[0], len = dim[0]; - if (step == 1) - { - copy_or_memcpy (len, src, dest); - dest += len; - } - else - { - for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) - dest[i] = src[j]; - - dest += len; - } - } - else if (use_blk && lev == 1) - dest = blk_trans (src, dest, dim[1], dim[0]); - else - { - octave_idx_type step = stride[lev], len = dim[lev]; - for (octave_idx_type i = 0, j = 0; i < len; i++, j+= step) - dest = do_permute (src + i * step, dest, lev-1); - } - - return dest; - } + { + if (lev == 0) + { + octave_idx_type step = stride[0], len = dim[0]; + if (step == 1) + { + copy_or_memcpy (len, src, dest); + dest += len; + } + else + { + for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) + dest[i] = src[j]; + + dest += len; + } + } + else if (use_blk && lev == 1) + dest = blk_trans (src, dest, dim[1], dim[0]); + else + { + octave_idx_type step = stride[lev], len = dim[lev]; + for (octave_idx_type i = 0, j = 0; i < len; i++, j+= step) + dest = do_permute (src + i * step, dest, lev-1); + } + + return dest; + } // No copying! @@ -528,31 +530,31 @@ rec_index_helper (const dim_vector& dv, const Array<idx_vector>& ia) : n (ia.length ()), top (0), dim (new octave_idx_type [2*n]), cdim (dim + n), idx (new idx_vector [n]) - { - assert (n > 0 && (dv.length () == std::max (n, 2))); - - dim[0] = dv(0); - cdim[0] = 1; - idx[0] = ia(0); - - for (int i = 1; i < n; i++) - { - // Try reduction... - if (idx[top].maybe_reduce (dim[top], ia(i), dv(i))) - { - // Reduction successful, fold dimensions. - dim[top] *= dv(i); - } - else - { - // Unsuccessful, store index & cumulative dim. - top++; - idx[top] = ia(i); - dim[top] = dv(i); - cdim[top] = cdim[top-1] * dim[top-1]; - } - } - } + { + assert (n > 0 && (dv.length () == std::max (n, 2))); + + dim[0] = dv(0); + cdim[0] = 1; + idx[0] = ia(0); + + for (int i = 1; i < n; i++) + { + // Try reduction... + if (idx[top].maybe_reduce (dim[top], ia(i), dv(i))) + { + // Reduction successful, fold dimensions. + dim[top] *= dv(i); + } + else + { + // Unsuccessful, store index & cumulative dim. + top++; + idx[top] = ia(i); + dim[top] = dv(i); + cdim[top] = cdim[top-1] * dim[top-1]; + } + } + } ~rec_index_helper (void) { delete [] idx; delete [] dim; } @@ -561,48 +563,48 @@ // Recursive N-d indexing template <class T> T *do_index (const T *src, T *dest, int lev) const - { - if (lev == 0) - dest += idx[0].index (src, dim[0], dest); - else - { - octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; - for (octave_idx_type i = 0; i < nn; i++) - dest = do_index (src + d*idx[lev].xelem (i), dest, lev-1); - } - - return dest; - } + { + if (lev == 0) + dest += idx[0].index (src, dim[0], dest); + else + { + octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; + for (octave_idx_type i = 0; i < nn; i++) + dest = do_index (src + d*idx[lev].xelem (i), dest, lev-1); + } + + return dest; + } // Recursive N-d indexed assignment template <class T> const T *do_assign (const T *src, T *dest, int lev) const - { - if (lev == 0) - src += idx[0].assign (src, dim[0], dest); - else - { - octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; - for (octave_idx_type i = 0; i < nn; i++) - src = do_assign (src, dest + d*idx[lev].xelem (i), lev-1); - } - - return src; - } + { + if (lev == 0) + src += idx[0].assign (src, dim[0], dest); + else + { + octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; + for (octave_idx_type i = 0; i < nn; i++) + src = do_assign (src, dest + d*idx[lev].xelem (i), lev-1); + } + + return src; + } // Recursive N-d indexed assignment template <class T> void do_fill (const T& val, T *dest, int lev) const - { - if (lev == 0) - idx[0].fill (val, dim[0], dest); - else - { - octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; - for (octave_idx_type i = 0; i < nn; i++) - do_fill (val, dest + d*idx[lev].xelem (i), lev-1); - } - } + { + if (lev == 0) + idx[0].fill (val, dim[0], dest); + else + { + octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; + for (octave_idx_type i = 0; i < nn; i++) + do_fill (val, dest + d*idx[lev].xelem (i), lev-1); + } + } // No copying! @@ -622,10 +624,10 @@ void fill (const T& val, T *dest) const { do_fill (val, dest, top); } bool is_cont_range (octave_idx_type& l, - octave_idx_type& u) const - { - return top == 0 && idx[0].is_cont_range (dim[0], l, u); - } + octave_idx_type& u) const + { + return top == 0 && idx[0].is_cont_range (dim[0], l, u); + } }; // Helper class for multi-d recursive resizing @@ -641,27 +643,27 @@ public: rec_resize_helper (const dim_vector& ndv, const dim_vector& odv) : cext (0), sext (0), dext (0), n (0) - { - int l = ndv.length (); - assert (odv.length () == l); - octave_idx_type ld = 1; - int i = 0; - for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i); - n = l - i; - cext = new octave_idx_type [3*n]; - // Trick to avoid three allocations - sext = cext + n; - dext = sext + n; - - octave_idx_type sld = ld, dld = ld; - for (int j = 0; j < n; j++) - { - cext[j] = std::min (ndv(i+j), odv(i+j)); - sext[j] = sld *= odv(i+j); - dext[j] = dld *= ndv(i+j); - } - cext[0] *= ld; - } + { + int l = ndv.length (); + assert (odv.length () == l); + octave_idx_type ld = 1; + int i = 0; + for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i); + n = l - i; + cext = new octave_idx_type [3*n]; + // Trick to avoid three allocations + sext = cext + n; + dext = sext + n; + + octave_idx_type sld = ld, dld = ld; + for (int j = 0; j < n; j++) + { + cext[j] = std::min (ndv(i+j), odv(i+j)); + sext[j] = sld *= odv(i+j); + dext[j] = dld *= ndv(i+j); + } + cext[0] *= ld; + } ~rec_resize_helper (void) { delete [] cext; } @@ -670,21 +672,21 @@ // recursive resizing template <class T> void do_resize_fill (const T* src, T *dest, const T& rfv, int lev) const - { - if (lev == 0) - { - copy_or_memcpy (cext[0], src, dest); - fill_or_memset (dext[0] - cext[0], rfv, dest + cext[0]); - } - else - { - octave_idx_type sd = sext[lev-1], dd = dext[lev-1], k; - for (k = 0; k < cext[lev]; k++) - do_resize_fill (src + k * sd, dest + k * dd, rfv, lev - 1); - - fill_or_memset (dext[lev] - k * dd, rfv, dest + k * dd); - } - } + { + if (lev == 0) + { + copy_or_memcpy (cext[0], src, dest); + fill_or_memset (dext[0] - cext[0], rfv, dest + cext[0]); + } + else + { + octave_idx_type sd = sext[lev-1], dd = dext[lev-1], k; + for (k = 0; k < cext[lev]; k++) + do_resize_fill (src + k * sd, dest + k * dd, rfv, lev - 1); + + fill_or_memset (dext[lev] - k * dd, rfv, dest + k * dd); + } + } // No copying! @@ -696,7 +698,7 @@ template <class T> void resize_fill (const T* src, T *dest, const T& rfv) const - { do_resize_fill (src, dest, rfv, n-1); } + { do_resize_fill (src, dest, rfv, n-1); } }; template <class T> @@ -716,11 +718,11 @@ if (i.extent (n) != n) gripe_index_out_of_range (1, 1, i.extent (n), n); // throws - // FIXME -- this is the only place where orig_dimensions are used. + // FIXME: this is the only place where orig_dimensions are used. dim_vector rd = i.orig_dimensions (); octave_idx_type il = i.length (n); - // FIXME -- this is for Matlab compatibility. Matlab 2007 given + // FIXME: this is for Matlab compatibility. Matlab 2007 given // // b = ones (3,1) // @@ -796,7 +798,7 @@ retval = Array<T> (*this, dim_vector (il, jl), l, u); else { - // Don't use resize here to avoid useless initialization for POD types. + // Don't use resize to avoid useless initialization for POD types. retval = Array<T> (dim_vector (il, jl)); ii.index (data (), n, retval.fortran_vec ()); @@ -804,7 +806,7 @@ } else { - // Don't use resize here to avoid useless initialization for POD types. + // Don't use resize to avoid useless initialization for POD types. retval = Array<T> (dim_vector (il, jl)); const T* src = data (); @@ -868,7 +870,7 @@ retval = Array<T> (*this, rdv, l, u); else { - // Don't use resize here to avoid useless initialization for POD types. + // Don't use resize to avoid useless initialization for POD types. retval = Array<T> (rdv); // Do it. @@ -913,7 +915,7 @@ else if (columns () == 1) dv = dim_vector (n, 1); else - invalid = true; + invalid = true; if (invalid) gripe_invalid_resize (); @@ -931,7 +933,8 @@ else if (n == nx + 1 && nx > 0) { // Stack "push" operation. - if (rep->count == 1 && slice_data + slice_len < rep->data + rep->len) + if (rep->count == 1 + && slice_data + slice_len < rep->data + rep->len) { slice_data[slice_len++] = rfv; dimensions = dv; @@ -2162,7 +2165,8 @@ lsort.set_compare (mode); - // This determines the split ratio between the O(M*log2(N)) and O(M+N) algorithms. + // This determines the split ratio between the O(M*log2(N)) and O(M+N) + // algorithms. static const double ratio = 1.0; sortmode vmode = UNSORTED; @@ -2232,7 +2236,7 @@ octave_idx_type k = 0, l = nel - 1; for (; k < n; k++) { - for (;l >= 0 && src[l] == zero; l--) ; + for (; l >= 0 && src[l] == zero; l--) ; if (l >= 0) retval(k) = l--; else @@ -2249,7 +2253,7 @@ octave_idx_type k = 0, l = 0; for (; k < n; k++) { - for (;l != nel && src[l] == zero; l++) ; + for (; l != nel && src[l] == zero; l++) ; if (l != nel) retval(k) = l++; else @@ -2401,7 +2405,7 @@ } if (ku == ns) - lsort.nth_element (buf, ns, lo, up); + lsort.nth_element (buf, ns, lo, up); else if (mode == ASCENDING) lsort.nth_element (buf, ku, lo, std::min (ku, up)); else @@ -2477,7 +2481,7 @@ \ template <> Array<T> \ Array<T>::nth_element (const idx_vector&, int) const { return Array<T> (); } \ - + template <class T> Array<T>