2#include <isce3/core/TypeTraits.h>
3#include <isce3/except/Error.h>
6namespace isce3 {
namespace focus {
8template<
typename KernelType>
10getPresumWeights(
const KernelType& acorr,
11 const Eigen::Ref<const Eigen::VectorXd>& xin,
double xout,
15 using KT =
typename KernelType::value_type;
16 static_assert(not isce3::is_complex<KT>());
19 if (offset ==
nullptr) {
20 throw isce3::except::InvalidArgument(
21 ISCE_SRCINFO(),
"no storage provided for index offset");
25 const double hw = 0.5 * acorr.width();
26 const auto xend = xin.data() + xin.size();
27 auto first = std::lower_bound(xin.data(), xend, xout - hw);
28 auto last = std::upper_bound(first, xend, xout + hw);
31 const long offset_ = std::distance(xin.data(), first);
34 auto n = std::distance(first, last);
35 using Mat = Eigen::Matrix<KT, Eigen::Dynamic, Eigen::Dynamic>;
36 using Vec = Eigen::Matrix<KT, Eigen::Dynamic, 1>;
41 for (
int i = 0; i < n; ++i) {
42 const auto xi = xin[offset_ + i];
43 for (
int j = i; j < n; ++j) {
44 const auto xj = xin[offset_ + j];
46 g(j, i) = acorr(xj - xi);
48 r(i) = acorr(xout - xi);
53 Vec w = g.ldlt().solve(r);
61template<
typename KernelType>
63getPresumWeights(
const KernelType& acorr,
64 const std::vector<double>& xin,
double xout,
67 Eigen::Map<const Eigen::VectorXd> xmap(xin.data(), xin.size());
68 return getPresumWeights(acorr, xmap, xout, offset);
base interpolator is an abstract base class
Definition BinarySearchFunc.cpp:5