24 inline LUT2d(
const T& ref_value = T{0});
25 inline LUT2d(isce3::core::dataInterpMethod method);
26 LUT2d(
double xstart,
double ystart,
double dx,
double dy,
28 isce3::core::dataInterpMethod method = isce3::core::BILINEAR_METHOD,
29 bool boundsError =
true);
30 LUT2d(
const std::valarray<double> & xcoord,
31 const std::valarray<double> & ycoord,
33 isce3::core::dataInterpMethod method = isce3::core::BILINEAR_METHOD,
34 bool boundsError =
true);
37 inline LUT2d(
const LUT2d<T> & lut);
40 inline LUT2d & operator=(
const LUT2d<T> & lut);
44 void setFromData(
const std::valarray<double> & xcoord,
45 const std::valarray<double> & ycoord,
49 isce3::core::dataInterpMethod interpMethod()
const;
52 void interpMethod(isce3::core::dataInterpMethod method);
55 inline double xStart()
const {
return _xstart; }
57 inline double yStart()
const {
return _ystart; }
59 inline double xEnd()
const {
return xStart() + (width() - 1) * xSpacing(); }
61 inline double yEnd()
const {
return yStart() + (length() - 1) * ySpacing(); }
63 inline double xSpacing()
const {
return _dx; }
65 inline double ySpacing()
const {
return _dy; }
67 inline size_t length()
const {
return _data.length(); }
69 inline size_t width()
const {
return _data.width(); }
76 inline T refValue()
const {
return _refValue; }
78 inline void refValue(
const T& val) { _refValue = val; }
80 inline bool haveData()
const {
return _haveData; }
82 inline bool boundsError()
const {
return _boundsError; }
87 inline void boundsError(
bool flag) { _boundsError = flag; }
90 T
eval(
const double y,
const double x)
const;
92 Eigen::Matrix<T, Eigen::Dynamic, 1>
93 eval(
double y,
const Eigen::Ref<const Eigen::VectorXd>& x)
const;
103 return (x >= xStart()) and (x <= xEnd()) and
104 (y >= yStart()) and (y <= yEnd());
109 bool _haveData, _boundsError;
112 double _xstart, _ystart, _dx, _dy;
122 void _setInterpolator(dataInterpMethod method);
129 template <typename U = T, std::enable_if_t<!std::is_compound<U>::value,
int> = 0>
132 bool equal = _data.
width() == other.width();
133 equal *= _data.
length() == other.length();
137 equal *= isce3::core::compareFloatingPoint(_xstart, other.xStart());
138 equal *= isce3::core::compareFloatingPoint(_ystart, other.yStart());
139 equal *= isce3::core::compareFloatingPoint(_dx, other.xSpacing());
140 equal *= isce3::core::compareFloatingPoint(_dy, other.ySpacing());
146 for (
size_t i = 0; i < _data.
length(); ++i) {
147 for (
size_t j = 0; j < _data.
width(); ++j) {
148 equal *= isce3::core::compareFloatingPoint(_data(i,j), otherMat(i,j));
155 template <typename U = T, std::enable_if_t<std::is_compound<U>::value,
int> = 0>
156 inline bool operator==(
const isce3::core::LUT2d<T> & other)
const {
158 bool equal = _data.width() == other.width();
159 equal *= _data.length() == other.length();
163 equal *= isce3::core::compareFloatingPoint(_xstart, other.xStart());
164 equal *= isce3::core::compareFloatingPoint(_ystart, other.yStart());
165 equal *= isce3::core::compareFloatingPoint(_dx, other.xSpacing());
166 equal *= isce3::core::compareFloatingPoint(_dy, other.ySpacing());
171 const isce3::core::Matrix<T> & otherMat = other.data();
172 for (
size_t i = 0; i < _data.length(); ++i) {
173 for (
size_t j = 0; j < _data.width(); ++j) {
174 equal *= isce3::core::compareComplex(_data(i,j), otherMat(i,j));