comparison liboctave/array/Array-util.cc @ 20265:e914b5399c67

Use in-place operators in C++ code where possible. * libgui/src/dialog.cc, libgui/src/m-editor/file-editor-tab.cc, libgui/src/main-window.cc, libinterp/corefcn/bsxfun.cc, libinterp/corefcn/filter.cc, libinterp/corefcn/mgorth.cc, libinterp/corefcn/oct-stream.cc, libinterp/corefcn/pr-output.cc, liboctave/array/Array-util.cc, liboctave/array/dim-vector.h, liboctave/numeric/CollocWt.cc, liboctave/numeric/eigs-base.cc, liboctave/numeric/lo-specfun.cc: Use in-place operators in C++ code where possible.
author Rik <rik@octave.org>
date Mon, 25 May 2015 22:02:15 -0700
parents b2100e1659ac
children a9574e3c6e9e
comparison
equal deleted inserted replaced
20264:5dfaaaae784f 20265:e914b5399c67
558 else if (clen == 1) 558 else if (clen == 1)
559 { 559 {
560 // All scalars case - the result is a scalar. 560 // All scalars case - the result is a scalar.
561 octave_idx_type idx = idxa(len-1)(0); 561 octave_idx_type idx = idxa(len-1)(0);
562 for (octave_idx_type i = len - 2; i >= 0; i--) 562 for (octave_idx_type i = len - 2; i >= 0; i--)
563 idx = idx * dvx(i) + idxa(i)(0); 563 idx = dvx(i) * idx + idxa(i)(0);
564 retval = idx_vector (idx); 564 retval = idx_vector (idx);
565 } 565 }
566 else if (all_ranges && clen != 0) 566 else if (all_ranges && clen != 0)
567 { 567 {
568 // All ranges case - the result is a range. 568 // All ranges case - the result is a range.
570 octave_idx_type step = 0; 570 octave_idx_type step = 0;
571 for (octave_idx_type i = len - 1; i >= 0; i--) 571 for (octave_idx_type i = len - 1; i >= 0; i--)
572 { 572 {
573 octave_idx_type xstart = idxa(i)(0); 573 octave_idx_type xstart = idxa(i)(0);
574 octave_idx_type xstep = idxa(i)(1) - xstart; 574 octave_idx_type xstep = idxa(i)(1) - xstart;
575 start = start * dvx(i) + xstart; 575 start = dvx(i) * start + xstart;
576 step = step * dvx(i) + xstep; 576 step = dvx(i) * step + xstep;
577 } 577 }
578 retval = idx_vector::make_range (start, step, clen); 578 retval = idx_vector::make_range (start, step, clen);
579 } 579 }
580 else 580 else
581 { 581 {