Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/__dsearchn__.cc @ 10154:40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Jan 2010 17:33:41 -0500 |
parents | 2c279308f6ab |
children | fd0a3ac60b0e |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/__dsearchn__.cc Wed Jan 20 17:24:23 2010 -0500 +++ b/src/DLD-FUNCTIONS/__dsearchn__.cc Wed Jan 20 17:33:41 2010 -0500 @@ -35,7 +35,7 @@ #include "oct-obj.h" DEFUN_DLD (__dsearchn__, args, , - "-*- texinfo -*-\n\ + "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{idx}, @var{d}] =} dsearch (@var{x}, @var{xi})\n\ Undocumented internal function.\n\ @end deftypefn") @@ -55,17 +55,17 @@ if (! error_state) { if (x.rows() != xi.rows() || x.columns() < 1) - error ("__dsearch__: dimensional mismatch"); + error ("__dsearch__: dimensional mismatch"); else - { - octave_idx_type n = x.rows(); - octave_idx_type nx = x.columns(); - octave_idx_type nxi = xi.columns(); + { + octave_idx_type n = x.rows(); + octave_idx_type nx = x.columns(); + octave_idx_type nxi = xi.columns(); - ColumnVector idx (nxi); - double *pidx = idx.fortran_vec (); - ColumnVector dist (nxi); - double *pdist = dist.fortran_vec (); + ColumnVector idx (nxi); + double *pidx = idx.fortran_vec (); + ColumnVector dist (nxi); + double *pdist = dist.fortran_vec (); #define DIST(dd, y, yi, m) \ dd = 0.; \ @@ -76,34 +76,34 @@ } \ dd = sqrt (dd); - const double *pxi = xi.fortran_vec (); - for (octave_idx_type i = 0; i < nxi; i++) - { - double d0; - const double *px = x.fortran_vec (); - DIST(d0, px, pxi, n); - *pidx = 1.; - for (octave_idx_type j = 1; j < nx; j++) - { - px += n; - double d; - DIST (d, px, pxi, n); - if (d < d0) - { - d0 = d; - *pidx = static_cast<double>(j + 1); - } - OCTAVE_QUIT; - } + const double *pxi = xi.fortran_vec (); + for (octave_idx_type i = 0; i < nxi; i++) + { + double d0; + const double *px = x.fortran_vec (); + DIST(d0, px, pxi, n); + *pidx = 1.; + for (octave_idx_type j = 1; j < nx; j++) + { + px += n; + double d; + DIST (d, px, pxi, n); + if (d < d0) + { + d0 = d; + *pidx = static_cast<double>(j + 1); + } + OCTAVE_QUIT; + } - *pdist++ = d0; - pidx++; - pxi += n; - } + *pdist++ = d0; + pidx++; + pxi += n; + } - retval(1) = dist; - retval(0) = idx; - } + retval(1) = dist; + retval(0) = idx; + } } return retval;