Mercurial > hg > octave-nkf
comparison liboctave/array/Array-util.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 |
---|---|
421 } | 421 } |
422 | 422 |
423 dim_vector | 423 dim_vector |
424 zero_dims_inquire (const Array<idx_vector>& ia, const dim_vector& rhdv) | 424 zero_dims_inquire (const Array<idx_vector>& ia, const dim_vector& rhdv) |
425 { | 425 { |
426 int ial = ia.length (), rhdvl = rhdv.length (); | 426 int ial = ia.length (); |
427 int rhdvl = rhdv.length (); | |
427 dim_vector rdv = dim_vector::alloc (ial); | 428 dim_vector rdv = dim_vector::alloc (ial); |
428 bool *scalar = new bool [ial], *colon = new bool [ial]; | 429 bool *scalar = new bool [ial]; |
430 bool *colon = new bool [ial]; | |
429 // Mark scalars and colons, count non-scalar indices. | 431 // Mark scalars and colons, count non-scalar indices. |
430 int nonsc = 0; | 432 int nonsc = 0; |
431 bool all_colons = true; | 433 bool all_colons = true; |
432 for (int i = 0; i < ial; i++) | 434 for (int i = 0; i < ial; i++) |
433 { | 435 { |
477 | 479 |
478 dim_vector | 480 dim_vector |
479 zero_dims_inquire (const idx_vector& i, const idx_vector& j, | 481 zero_dims_inquire (const idx_vector& i, const idx_vector& j, |
480 const dim_vector& rhdv) | 482 const dim_vector& rhdv) |
481 { | 483 { |
482 bool icol = i.is_colon (), jcol = j.is_colon (); | 484 bool icol = i.is_colon (); |
485 bool jcol = j.is_colon (); | |
483 dim_vector rdv; | 486 dim_vector rdv; |
484 if (icol && jcol && rhdv.length () == 2) | 487 if (icol && jcol && rhdv.length () == 2) |
485 { | 488 { |
486 rdv(0) = rhdv(0); | 489 rdv(0) = rhdv(0); |
487 rdv(1) = rhdv(1); | 490 rdv(1) = rhdv(1); |
561 retval = idx_vector (idx); | 564 retval = idx_vector (idx); |
562 } | 565 } |
563 else if (all_ranges && clen != 0) | 566 else if (all_ranges && clen != 0) |
564 { | 567 { |
565 // All ranges case - the result is a range. | 568 // All ranges case - the result is a range. |
566 octave_idx_type start = 0, step = 0; | 569 octave_idx_type start = 0; |
570 octave_idx_type step = 0; | |
567 for (octave_idx_type i = len - 1; i >= 0; i--) | 571 for (octave_idx_type i = len - 1; i >= 0; i--) |
568 { | 572 { |
569 octave_idx_type xstart = idxa(i)(0), xstep = idxa(i)(1) - xstart; | 573 octave_idx_type xstart = idxa(i)(0); |
574 octave_idx_type xstep = idxa(i)(1) - xstart; | |
570 start = start * dvx(i) + xstart; | 575 start = start * dvx(i) + xstart; |
571 step = step * dvx(i) + xstep; | 576 step = step * dvx(i) + xstep; |
572 } | 577 } |
573 retval = idx_vector::make_range (start, step, clen); | 578 retval = idx_vector::make_range (start, step, clen); |
574 } | 579 } |
595 } | 600 } |
596 | 601 |
597 Array<idx_vector> | 602 Array<idx_vector> |
598 ind2sub (const dim_vector& dv, const idx_vector& idx) | 603 ind2sub (const dim_vector& dv, const idx_vector& idx) |
599 { | 604 { |
600 octave_idx_type len = idx.length (0), n = dv.length (); | 605 octave_idx_type len = idx.length (0); |
606 octave_idx_type n = dv.length (); | |
601 Array<idx_vector> retval (dim_vector (n, 1)); | 607 Array<idx_vector> retval (dim_vector (n, 1)); |
602 octave_idx_type numel = dv.numel (); | 608 octave_idx_type numel = dv.numel (); |
603 | 609 |
604 if (idx.extent (numel) > numel) | 610 if (idx.extent (numel) > numel) |
605 current_liboctave_error_handler ("ind2sub: index out of range"); | 611 current_liboctave_error_handler ("ind2sub: index out of range"); |