isce3 0.25.0
Loading...
Searching...
No Matches
BinarySearchFunc.h File Reference

Functions for binary search of sorted Eigen Arrays. More...

#include <tuple>
#include <vector>
#include <Eigen/Dense>

Go to the source code of this file.

Namespaces

namespace  isce3
 base interpolator is an abstract base class
 

Typedefs

using isce3::antenna::detail::tuple4i_t
 
using isce3::antenna::detail::ArrayXui = Eigen::Array<Eigen::Index, Eigen::Dynamic, 1>
 

Functions

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.
 

Detailed Description

Functions for binary search of sorted Eigen Arrays.

Typedef Documentation

◆ tuple4i_t

using isce3::antenna::detail::tuple4i_t
Initial value:
std::tuple<Eigen::Index, Eigen::Index, Eigen::Index, Eigen::Index>

Function Documentation

◆ 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]xis a sorted array to be searched
[in]x0is 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]xis a sorted array to be searched
[in]x0is 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]x1is a sorted array
[in]x2is 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]xis a sorted array to be searched
[in]x0is 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]xis a sorted array to be searched
[in]x0is 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.

Generated for ISCE3.0 by doxygen 1.13.2.