Mercurial > hg > octave-nkf
diff liboctave/numeric/CollocWt.cc @ 20440: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 | 4197fc428c7d |
children |
line wrap: on
line diff
--- a/liboctave/numeric/CollocWt.cc +++ b/liboctave/numeric/CollocWt.cc @@ -175,9 +175,9 @@ dif2[i] = (ab + ap + z1) / z / z / (z + 1.0); else { - z = z * z; + z *= z; double y = z1 * (ab + z1); - y = y * (ap + y); + y *= (ap + y); dif2[i] = y / z / (z - 1.0); } } @@ -218,11 +218,11 @@ if (i != 0) { for (octave_idx_type j = 1; j <= i; j++) - zc = zc - z / (x - root[j-1]); + zc -= z / (x - root[j-1]); } - z = z / zc; - x = x - z; + z /= zc; + x -= z; // Famous last words: 100 iterations should be more than // enough in all cases. @@ -235,7 +235,7 @@ } root[i] = x; - x = x + sqrt (std::numeric_limits<double>::epsilon ()); + x += sqrt (std::numeric_limits<double>::epsilon ()); } // Add interpolation points at x = 0 and/or x = 1. @@ -362,7 +362,7 @@ vect[j] = ax / (dif1[j] * dif1[j]); - y = y + vect[j]; + y += vect[j]; } for (octave_idx_type j = 0; j < nt; j++)