Changeset 2727 for trunk/src/BisectionLocator.cpp
- Timestamp:
- 01/11/13 18:48:37 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/BisectionLocator.cpp
r2720 r2727 12 12 #include <assert.h> 13 13 14 #include <casa/Arrays/Vector.h>15 #include <casa/Arrays/ArrayIO.h>16 #include <casa/Exceptions/Error.h>17 18 14 #include "BisectionLocator.h" 19 20 using namespace casa;21 15 22 16 namespace asap { … … 39 33 else if (x > x_[n_-1]) 40 34 return n_; 35 36 unsigned int jl = 0; 37 unsigned int ju = n_; 38 unsigned int jm; 39 while (ju - jl > 1) { 40 jm = (ju + jl) >> 1; 41 if (x > x_[jm]) 42 jl = jm; 43 else 44 ju = jm; 45 } 46 return ju; 41 47 } 42 48 else { 43 if (x > x_[0])49 if (x >= x_[0]) 44 50 return 0; 45 else if (x < =x_[n_-1])51 else if (x < x_[n_-1]) 46 52 return n_; 53 54 unsigned int jl = 0; 55 unsigned int ju = n_; 56 unsigned int jm; 57 while (ju - jl > 1) { 58 jm = (ju + jl) >> 1; 59 if (x < x_[jm]) 60 jl = jm; 61 else 62 ju = jm; 63 } 64 return ju; 47 65 } 48 unsigned int jl = 0;49 unsigned int ju = n_;50 unsigned int jm;51 52 while (ju - jl > 1) {53 jm = (ju + jl) >> 1;54 if ((x >= x_[jm]) == ascending)55 jl = jm;56 else57 ju = jm;58 }59 return ju;60 66 } 61 67
Note: See TracChangeset
for help on using the changeset viewer.