Functions for binary search of sorted Eigen Arrays.
More...
#include <tuple>
#include <vector>
#include <Eigen/Dense>
Go to the source code of this file.
|
namespace | isce3 |
| base interpolator is an abstract base class
|
|
|
Eigen::Index | isce3::antenna::detail::bisect_left (const Eigen::Ref< const Eigen::ArrayXd > &x, double x0) |
| Python-like bisect_left for an array sorted in ascending order.
|
|
Eigen::Index | isce3::antenna::detail::bisect_right (const Eigen::Ref< const Eigen::ArrayXd > &x, double x0) |
| Python-like bisect_right for sorted array.
|
|
Eigen::Index | isce3::antenna::detail::locate_nearest (const Eigen::Ref< const Eigen::ArrayXd > &x, double x0) |
| Locate the nearest neighbor to a value x0 in a sorted array x via binary search.
|
|
ArrayXui | isce3::antenna::detail::locate_nearest (const Eigen::Ref< const Eigen::ArrayXd > &x, const Eigen::Ref< const Eigen::ArrayXd > &x0) |
| Locate the nearest neighbor to an array of values, x0, in a sorted array x via binary search.
|
|
tuple4i_t | isce3::antenna::detail::intersect_nearest (const Eigen::Ref< const Eigen::ArrayXd > &x1, const Eigen::Ref< const Eigen::ArrayXd > &x2) |
| Intersect two sorted arrays x1 and x2 arrays to find the indices [first,last] for approximate overlap portion defined in terms of their nearest start/end values.
|
|
Functions for binary search of sorted Eigen Arrays.
◆ tuple4i_t
using isce3::antenna::detail::tuple4i_t |
Initial value:
std::tuple<Eigen::Index, Eigen::Index, Eigen::Index, Eigen::Index>
◆ bisect_left()
Eigen::Index isce3::antenna::detail::bisect_left |
( |
const Eigen::Ref< const Eigen::ArrayXd > & | x, |
|
|
double | x0 ) |
Python-like bisect_left for an array sorted in ascending order.
- Parameters
-
[in] | x | is a sorted array to be searched |
[in] | x0 | is the value to search for |
- Returns
- first index to the array "x" where x[idx] >= x0
- Note
- The output will be limited to [0, x.size - 1] for out of range value.
◆ bisect_right()
Eigen::Index isce3::antenna::detail::bisect_right |
( |
const Eigen::Ref< const Eigen::ArrayXd > & | x, |
|
|
double | x0 ) |
Python-like bisect_right for sorted array.
- Parameters
-
[in] | x | is a sorted array to be searched |
[in] | x0 | is the value to search for |
- Returns
- index to the array "x" where x[idx] > x0
- Note
- The output will be limited to [0, x.size - 1] for out of range value.
◆ intersect_nearest()
tuple4i_t isce3::antenna::detail::intersect_nearest |
( |
const Eigen::Ref< const Eigen::ArrayXd > & | x1, |
|
|
const Eigen::Ref< const Eigen::ArrayXd > & | x2 ) |
Intersect two sorted arrays x1 and x2 arrays to find the indices [first,last] for approximate overlap portion defined in terms of their nearest start/end values.
- Parameters
-
[in] | x1 | is a sorted array |
[in] | x2 | is a sorted array |
- Returns
- first index to array "x1"
-
last index (inclusive) to array "x1"
-
first index to array "x2"
-
last index (inclusive) to array "x2"
◆ locate_nearest() [1/2]
ArrayXui isce3::antenna::detail::locate_nearest |
( |
const Eigen::Ref< const Eigen::ArrayXd > & | x, |
|
|
const Eigen::Ref< const Eigen::ArrayXd > & | x0 ) |
Locate the nearest neighbor to an array of values, x0, in a sorted array x via binary search.
- Parameters
-
[in] | x | is a sorted array to be searched |
[in] | x0 | is the array of values to search for in "x" |
- Returns
- Array of indices to the array "x" with the same size as that of x0.
- Note
- The indices will all be limited to within [0, x.size - 1].
◆ locate_nearest() [2/2]
Eigen::Index isce3::antenna::detail::locate_nearest |
( |
const Eigen::Ref< const Eigen::ArrayXd > & | x, |
|
|
double | x0 ) |
Locate the nearest neighbor to a value x0 in a sorted array x via binary search.
- Parameters
-
[in] | x | is a sorted array to be searched |
[in] | x0 | is the value to search for in "x" |
- Returns
- index to the array "x" where abs(x[idx] - x0) is min.
- Note
- The output will be limited to [0, x.size - 1] for out of range value.
1.13.2.