blob: 61e5a1109998052073bc273514fb7d47dac21628 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
//
// Copyright 2016 Ettus Research
//
// SPDX-License-Identifier: GPL-3.0
//
#ifndef INCLUDED_UHD_INTERPOLATION_HPP
#define INCLUDED_UHD_INTERPOLATION_HPP
#include <uhd/exception.hpp>
#include <boost/format.hpp>
#include <map>
#include <cmath>
namespace uhd {
namespace cal {
template<typename in_type, typename out_type>
struct interp
{
public:
typedef std::vector<in_type> args_t;
typedef std::map<args_t, out_type> container_t;
/*!
* Nearest neighbor interpolation given a mapping: R^n -> R
*
* 1) search for the nearest point in R^n
* 2) find the nearest output scalars in R
*
* \param data input data container
* \param args input data point
* \returns interpolated output value
*/
const out_type nn_interp(container_t &data, const args_t &args);
/*!
* Bilinear interpolation given a mapping: R^2 -> R
*
* 1) search for 4 surrounding points in R^2
* 2) find the output scalars in R
* 3) solve the system of equations given our input mappings
*
* \param data input data container
* \param args input data point
* \returns interpolated output value
*/
const out_type bl_interp(container_t &data, const args_t &args);
private:
/*!
* Calculate the distance between two points
*/
static in_type calc_dist(const args_t &a, const args_t &b);
};
} // namespace cal
} // namespace uhd
#endif /* INCLUDED_UHD_INTERPOLATION_HPP */
|