Mercurial > octave-nkf
comparison liboctave/array/dim-vector.h @ 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 | f638a61af5a8 |
children | a3bf35bd5b44 |
comparison
equal
deleted
inserted
replaced
20264:5dfaaaae784f | 20265:e914b5399c67 |
---|---|
456 | 456 |
457 octave_idx_type compute_index (const octave_idx_type *idx) const | 457 octave_idx_type compute_index (const octave_idx_type *idx) const |
458 { | 458 { |
459 octave_idx_type k = 0; | 459 octave_idx_type k = 0; |
460 for (int i = length () - 1; i >= 0; i--) | 460 for (int i = length () - 1; i >= 0; i--) |
461 k = k * rep[i] + idx[i]; | 461 k = rep[i] * k + idx[i]; |
462 | 462 |
463 return k; | 463 return k; |
464 } | 464 } |
465 | 465 |
466 //! Ditto, but the tuple may be incomplete (nidx < length ()). | 466 //! Ditto, but the tuple may be incomplete (nidx < length ()). |
467 | 467 |
468 octave_idx_type compute_index (const octave_idx_type *idx, int nidx) const | 468 octave_idx_type compute_index (const octave_idx_type *idx, int nidx) const |
469 { | 469 { |
470 octave_idx_type k = 0; | 470 octave_idx_type k = 0; |
471 for (int i = nidx - 1; i >= 0; i--) | 471 for (int i = nidx - 1; i >= 0; i--) |
472 k = k * rep[i] + idx[i]; | 472 k = rep[i] * k + idx[i]; |
473 | 473 |
474 return k; | 474 return k; |
475 } | 475 } |
476 | 476 |
477 /*/! | 477 /*/! |