comparison liboctave/util/oct-sort.cc @ 18084:8e056300994b

Follow coding convention of defining and initializing only 1 variable per line in liboctave. * liboctave/array/Array-b.cc, liboctave/array/Array-util.cc, liboctave/array/Array.cc, liboctave/array/CDiagMatrix.cc, liboctave/array/CMatrix.cc, liboctave/array/CSparse.cc, liboctave/array/MDiagArray2.cc, liboctave/array/MatrixType.cc, liboctave/array/PermMatrix.cc, liboctave/array/Sparse.cc, liboctave/array/Sparse.h, liboctave/array/boolSparse.cc, liboctave/array/dDiagMatrix.cc, liboctave/array/dMatrix.cc, liboctave/array/dSparse.cc, liboctave/array/dim-vector.cc, liboctave/array/fCDiagMatrix.cc, liboctave/array/fCMatrix.cc, liboctave/array/fDiagMatrix.cc, liboctave/array/fMatrix.cc, liboctave/array/idx-vector.cc, liboctave/array/idx-vector.h, liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxQR.cc, liboctave/numeric/base-qr.cc, liboctave/numeric/bsxfun-defs.cc, liboctave/numeric/bsxfun.h, liboctave/numeric/dbleLU.cc, liboctave/numeric/dbleQR.cc, liboctave/numeric/fCmplxLU.cc, liboctave/numeric/fCmplxQR.cc, liboctave/numeric/floatLU.cc, liboctave/numeric/floatQR.cc, liboctave/numeric/lo-specfun.cc, liboctave/numeric/oct-convn.cc, liboctave/numeric/oct-norm.cc, liboctave/numeric/sparse-dmsolve.cc, liboctave/operators/mx-inlines.cc, liboctave/operators/mx-op-defs.h, liboctave/util/caseless-str.h, liboctave/util/kpse.cc, liboctave/util/lo-utils.cc, liboctave/util/oct-binmap.h, liboctave/util/oct-cmplx.h, liboctave/util/oct-inttypes.cc, liboctave/util/oct-inttypes.h, liboctave/util/oct-sort.cc: Follow coding convention of defining and initializing only 1 variable per line in liboctave.
author Rik <rik@octave.org>
date Wed, 04 Dec 2013 22:13:18 -0800
parents 49a5a4be04a1
children 4197fc428c7d
comparison
equal deleted inserted replaced
18083:938f01339043 18084:8e056300994b
156 ++start; 156 ++start;
157 157
158 for (; start < nel; ++start) 158 for (; start < nel; ++start)
159 { 159 {
160 /* set l to where *start belongs */ 160 /* set l to where *start belongs */
161 octave_idx_type l = 0, r = start; 161 octave_idx_type l = 0;
162 octave_idx_type r = start;
162 T pivot = data[start]; 163 T pivot = data[start];
163 /* Invariants: 164 /* Invariants:
164 * pivot >= all in [lo, l). 165 * pivot >= all in [lo, l).
165 * pivot < all in [r, start). 166 * pivot < all in [r, start).
166 * The second is vacuously true at the start. 167 * The second is vacuously true at the start.
200 ++start; 201 ++start;
201 202
202 for (; start < nel; ++start) 203 for (; start < nel; ++start)
203 { 204 {
204 /* set l to where *start belongs */ 205 /* set l to where *start belongs */
205 octave_idx_type l = 0, r = start; 206 octave_idx_type l = 0;
207 octave_idx_type r = start;
206 T pivot = data[start]; 208 T pivot = data[start];
207 /* Invariants: 209 /* Invariants:
208 * pivot >= all in [lo, l). 210 * pivot >= all in [lo, l).
209 * pivot < all in [r, start). 211 * pivot < all in [r, start).
210 * The second is vacuously true at the start. 212 * The second is vacuously true at the start.
1692 runs.pop (); 1694 runs.pop ();
1693 if (lo < lastrow) 1695 if (lo < lastrow)
1694 { 1696 {
1695 // Not the final column. 1697 // Not the final column.
1696 assert (n > 1); 1698 assert (n > 1);
1697 const T *hi = lo + n, *lst = lo; 1699 const T *hi = lo + n;
1700 const T *lst = lo;
1698 for (lo++; lo < hi; lo++) 1701 for (lo++; lo < hi; lo++)
1699 { 1702 {
1700 if (comp (*lst, *lo)) 1703 if (comp (*lst, *lo))
1701 { 1704 {
1702 if (lo > lst + 1) 1705 if (lo > lst + 1)
1754 template <class T> template <class Comp> 1757 template <class T> template <class Comp>
1755 octave_idx_type 1758 octave_idx_type
1756 octave_sort<T>::lookup (const T *data, octave_idx_type nel, 1759 octave_sort<T>::lookup (const T *data, octave_idx_type nel,
1757 const T& value, Comp comp) 1760 const T& value, Comp comp)
1758 { 1761 {
1759 octave_idx_type lo = 0, hi = nel; 1762 octave_idx_type lo = 0;
1763 octave_idx_type hi = nel;
1760 1764
1761 while (lo < hi) 1765 while (lo < hi)
1762 { 1766 {
1763 octave_idx_type mid = lo + ((hi-lo) >> 1); 1767 octave_idx_type mid = lo + ((hi-lo) >> 1);
1764 if (comp (value, data[mid])) 1768 if (comp (value, data[mid]))
1832 const T *values, octave_idx_type nvalues, 1836 const T *values, octave_idx_type nvalues,
1833 octave_idx_type *idx, bool rev, Comp comp) 1837 octave_idx_type *idx, bool rev, Comp comp)
1834 { 1838 {
1835 if (rev) 1839 if (rev)
1836 { 1840 {
1837 octave_idx_type i = 0, j = nvalues - 1; 1841 octave_idx_type i = 0;
1842 octave_idx_type j = nvalues - 1;
1838 1843
1839 if (nvalues > 0 && nel > 0) 1844 if (nvalues > 0 && nel > 0)
1840 { 1845 {
1841 while (true) 1846 while (true)
1842 { 1847 {
1854 for (; j >= 0; j--) 1859 for (; j >= 0; j--)
1855 idx[j] = i; 1860 idx[j] = i;
1856 } 1861 }
1857 else 1862 else
1858 { 1863 {
1859 octave_idx_type i = 0, j = 0; 1864 octave_idx_type i = 0;
1865 octave_idx_type j = 0;
1860 1866
1861 if (nvalues > 0 && nel > 0) 1867 if (nvalues > 0 && nel > 0)
1862 { 1868 {
1863 while (true) 1869 while (true)
1864 { 1870 {