comparison liboctave/numeric/CollocWt.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 4197fc428c7d
children
comparison
equal deleted inserted replaced
20264:5dfaaaae784f 20265:e914b5399c67
173 173
174 if (i == 1) 174 if (i == 1)
175 dif2[i] = (ab + ap + z1) / z / z / (z + 1.0); 175 dif2[i] = (ab + ap + z1) / z / z / (z + 1.0);
176 else 176 else
177 { 177 {
178 z = z * z; 178 z *= z;
179 double y = z1 * (ab + z1); 179 double y = z1 * (ab + z1);
180 y = y * (ap + y); 180 y *= (ap + y);
181 dif2[i] = y / z / (z - 1.0); 181 dif2[i] = y / z / (z - 1.0);
182 } 182 }
183 } 183 }
184 } 184 }
185 185
216 double z = xn / xn1; 216 double z = xn / xn1;
217 217
218 if (i != 0) 218 if (i != 0)
219 { 219 {
220 for (octave_idx_type j = 1; j <= i; j++) 220 for (octave_idx_type j = 1; j <= i; j++)
221 zc = zc - z / (x - root[j-1]); 221 zc -= z / (x - root[j-1]);
222 } 222 }
223 223
224 z = z / zc; 224 z /= zc;
225 x = x - z; 225 x -= z;
226 226
227 // Famous last words: 100 iterations should be more than 227 // Famous last words: 100 iterations should be more than
228 // enough in all cases. 228 // enough in all cases.
229 229
230 if (++k > 100 || xisnan (z)) 230 if (++k > 100 || xisnan (z))
233 if (std::abs (z) <= 100 * std::numeric_limits<double>::epsilon ()) 233 if (std::abs (z) <= 100 * std::numeric_limits<double>::epsilon ())
234 done = true; 234 done = true;
235 } 235 }
236 236
237 root[i] = x; 237 root[i] = x;
238 x = x + sqrt (std::numeric_limits<double>::epsilon ()); 238 x += sqrt (std::numeric_limits<double>::epsilon ());
239 } 239 }
240 240
241 // Add interpolation points at x = 0 and/or x = 1. 241 // Add interpolation points at x = 0 and/or x = 1.
242 242
243 if (n0 != 0) 243 if (n0 != 0)
360 if (n1 == 0) 360 if (n1 == 0)
361 ax = ax / (1.0 - x) / (1.0 - x); 361 ax = ax / (1.0 - x) / (1.0 - x);
362 362
363 vect[j] = ax / (dif1[j] * dif1[j]); 363 vect[j] = ax / (dif1[j] * dif1[j]);
364 364
365 y = y + vect[j]; 365 y += vect[j];
366 } 366 }
367 367
368 for (octave_idx_type j = 0; j < nt; j++) 368 for (octave_idx_type j = 0; j < nt; j++)
369 vect[j] = vect[j] / y; 369 vect[j] = vect[j] / y;
370 } 370 }