cd3 / libinterpolate Goto Github PK
View Code? Open in Web Editor NEWA C++ library for interpolation.
License: MIT License
A C++ library for interpolation.
License: MIT License
Hi, I am trying to do fast/realtime trilinear interpolation for LUT transformations. How can I use this library in CUDA for this purpose?
The function like "scipy.ndimage.interpolation.zoom" which implemented the spline interpolation
can just easily give a scale factor to zoom in or out the original array
How can I implement this with your excellent jobs ?
Thanks !
Hello! First of all, thank you for the work done!
here is a code example:
std::vector<double> lon;
std::vector<double> lat;
//0
lat.push_back(-39.363024);
lon.push_back(52.872388);
//1
lat.push_back(-37.615071); // maximum lat
lon.push_back(119.453522);
//2
lat.push_back(-75.928);
lon.push_back(119.754988);
//3
lat.push_back(-75.93703); // minimum lat
lon.push_back(119.689077);
//4
lat.push_back(-69.968429);
lon.push_back(76.1259);
//5
lat.push_back(-58.196226);
lon.push_back(59.691912);
//6
lat.push_back(-44.978186);
lon.push_back(53.709062);
//7
lat.push_back(-39.363024);
lon.push_back(52.872388);
_1D::CubicSplineInterpolator<double> interp;
interp.setData(lat, lon);
double minLat = -75.93703;
double maxLat = -37.615071;
std::vector<double> lon2;
std::vector<double> lat2;
// now I want to go from the minimum lat value to the maximum and generate new lon lat pairs
for (auto m(minLat); m < maxLat; m+=0.5) {
double valLon = interp(m);
if (valLon == 0) {
std::cout << " 0 " << std::endl; // in every step :(
}
else {
lon2.push_back(valLon);
lat2.push_back(m);
}
}
std::cout << "new lat size: " << lat2.size() << " | new lon size: " << lon2.size() << std::endl;
I have a polygon that doesn't have many points and because of this it has sharp edges, I need to make it smoother.
But for some reason I always get 0 when interpolating.
Dear,
I wanted to use the 2D cubic interpolation, and came across an issue regarding the output. The input vectors x and y in my example, are formed by the array of doubles [0 1 2 3 4]. When applying the BicubicInterpolator with [xi yi] = [2.5 2.5], I get an aswer of 5.9375, while I expected 6.25. E.g. the BilinearInterpolator provides the correct answer. I added an attachement with the code I used to test the 2D interpolators.
2D_Example.txt
Kind regards,
Laurent Keersmaekers
I am trying to use bilinear interpolation for inpainting a part of an image.
vector<double> ztrain;
for (int i = 0; i < img.rows; i++) {
for (int j = 0; j < img.cols; j++) {
if (img.at<Vec3b>(i, j)[channel] != 0) {
xtrain.push_back(j);
ytrain.push_back(i);
ztrain.push_back(img.at<Vec3b>(i, j)[channel]);
}
else {
xinter.push_back(j);
yinter.push_back(i);
}
}
}
_2D::BilinearInterpolator<double> interp =
_2D::BilinearInterpolator<double>(xtrain.size(), xtrain.data(), ytrain.data(), ztrain.data());
vector<double> zans;
for (int i = 0; i < xinter.size(); i++) {
double res = interp(xinter[i], yinter[i]);
img.at<Vec3b>(yinter[i], xinter[i])[channel] = res;
}
It doesn't do anything. Debugger showed me it happens because y
is outside of the Y
s boundaries in BilinearInterpolator<Real>::operator()( Real x, Real y )
. And these boundaries are between 0 and 0((*Y)(0)
and (*Y)(Y->size()-1)
)
xData
, yData
, zData
are the same size and correct.
How to fix it?
I upgraded to Ubuntu 21.10 and I started getting this error. A little googling and found the folllowing:
MINSIGSTKSZ is redefined to sysconf(_SC_MINSIGSTKSZ) starting from glibc 2.34
I changed it to just set it to 32768 as a work-around; but this of course isn't a "correct" fix.
The linear and cubic spline interpolators can interpolate float
and double
data, but the monotonic interpolator fails to compile.
_1D::MonotonicInterpolator<float> interp;
std::vector<float> x,y;
interp.setData(x,y);
gives a long error about type mismatches.
Hello,
Trying to use libInterpolate with msvc c++20 standard on Windows and getting tons of erros like these. Am I doing anything wrong?
Is the library supposed to work on windows/msvc ?
Thanks
------ Build All started: Project: FinEngLech, Configuration: x64-Debug ------
[1/3] Building CXX object CMakeFiles\YieldCurveTest.dir\src\YieldCurve.cpp.obj
FAILED: CMakeFiles/YieldCurveTest.dir/src/YieldCurve.cpp.obj
"C:\PROGRA~1\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.30.30705\bin\Hostx64\x64\cl.exe" /nologo /TP -DFMT_LOCALE -DFMT_SHARED -IC:\Users\suhasghorp\source\repos\FinEngLech\extern -IC:\Users\suhasghorp\source\repos\FinEngLech\include -IC:\vcpkg\installed\x64-windows\include -IC:\eigen-3.4.0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /std:c++latest -std:c++20 /showIncludes /FoCMakeFiles\YieldCurveTest.dir\src\YieldCurve.cpp.obj /FdCMakeFiles\YieldCurveTest.dir\ /FS -c C:\Users\suhasghorp\source\repos\FinEngLech\src\YieldCurve.cpp
C:\Users\suhasghorp\source\repos\FinEngLech\out\build\x64-Debug\cl : Command line warning D9025: overriding '/std:c++latest' with '/std:c++20'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\InterpolatorBase.hpp(223): warning C4068: unknown pragma 'parallel'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(146): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(146): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(146): note: error recovery skipped: '( ( identifier'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(146): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(146): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(146): note: error recovery skipped: ') >'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(146): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(146): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(146): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(146): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(146): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(147): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(147): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(147): note: error recovery skipped: '( ( identifier'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(147): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(147): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(147): note: error recovery skipped: ') <'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(147): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(147): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_1D\CubicSplineInterpolator.hpp(147): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(147): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_1D/CubicSplineInterpolator.hpp(147): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(149): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(149): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(149): note: error recovery skipped: '( ( identifier . . . constant'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(149): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(149): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(149): note: error recovery skipped: ') >'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(149): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(149): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(149): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(149): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(149): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(150): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(150): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(150): note: error recovery skipped: '( ( identifier . . . constant'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(150): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(150): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(150): note: error recovery skipped: ') <'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(150): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(150): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(150): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(150): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(150): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(163): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(163): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(163): note: error recovery skipped: '( ( identifier'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(163): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(163): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(163): note: error recovery skipped: ') >'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(163): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(163): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(163): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(163): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(163): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(164): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(164): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(164): note: error recovery skipped: '( ( identifier . . . constant'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(164): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(164): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(164): note: error recovery skipped: ') <'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(164): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(164): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(164): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(164): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(164): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(179): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(179): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(179): note: error recovery skipped: '( ( identifier . . . constant'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(179): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(179): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(179): note: error recovery skipped: ') >'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(179): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(179): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(179): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(179): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(179): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(180): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(180): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(180): note: error recovery skipped: '( ( identifier . . . constant'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(180): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(180): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(180): note: error recovery skipped: ') <'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(180): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(180): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(180): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(180): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(180): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(193): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(193): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(193): note: error recovery skipped: '( ( identifier'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(193): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(193): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(193): note: error recovery skipped: ') >'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(193): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(193): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(193): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(193): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(193): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(194): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(194): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(194): note: error recovery skipped: '( ( identifier . . . constant'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(194): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(194): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(194): note: error recovery skipped: ') <'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(194): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(194): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(194): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(194): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(194): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(208): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(208): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(208): note: error recovery skipped: '( ( identifier . . . constant'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(208): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(208): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(208): note: error recovery skipped: ') >'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(208): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(208): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(208): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(208): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(208): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(209): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(209): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(209): note: error recovery skipped: '( ( identifier . . . constant'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(209): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(209): error C3878: syntax error: unexpected token ')' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(209): note: error recovery skipped: ') <'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(209): note: error recovery skipped: ') ?'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(209): error C2760: syntax error: ':' was unexpected here; expected ';'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(209): error C3878: syntax error: unexpected token ':' following 'expression_statement'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(209): note: error recovery skipped: ':'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate./Interpolators/_2D/BicubicInterpolator.hpp(209): note: error recovery skipped: ')'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(210): error C2589: '(': illegal token on right side of '::'
C:\Users\suhasghorp\source\repos\FinEngLech\extern\libInterpolate\Interpolators_2D\BicubicInterpolator.hpp(210): error C3878: syntax error: unexpected token '(' following 'expression'
I have noticed poor performance while trying to interpolate thousands of values form a function with thousands of points. I suspect that the issue is with finding the points that should be used for interpolation. There has been no effort to optimize this step.
I believe other libraries, such as GSL, store the previously used index and use it as a starting point for the next call, which can speed up calls when you interpolate to several x values in order. However, this would require the interpolators to carry around more internal state, and I'm not sure what that would be for calling an interpolator from multiple threads.
Perhaps an optional argument(s) that allowed the caller to restrict the range or even provide a function that would do the search would be better.
Here is what I did (possible that I need a newer version of Boost or some other issue; I tried various --std=cc++ options to no avail).
git clone https://github.com/CD3/libInterpolate.git
cd libInterpolate
git checkout 2.5
mkdir build2.5
cd build2.5
cmake -DCMAKE_CXX_FLAGS=-std=c++14 -DBUILD_TESTS=OFF ..
make
cd ..
git checkout 2.6
mkdir build2.6
cd build2.6
cmake -DCMAKE_CXX_FLAGS=-std=c++14 -DBUILD_TESTS=OFF ..
make
Currently, the interpolators only support default construction. The data to interpolate is set with the setData()
method. It would be useful, especially when runtime binding with std::function
, to allow the interpolators be constructed with the data.
The library fails to compile on Windows and MacOS in conan-center's CI. Need to figure out why and fix.
`➜ cmake --build . --target install
[ 3%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/AnyInterpolator.cpp.o
[ 7%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/Constructors.cpp.o
[ 11%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/CubicSplineInterpolatorTests.cpp.o
[ 15%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/InterpolatorBaseTests.cpp.o
[ 19%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/LinearInterpolatorTests.cpp.o
[ 23%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/MonotonicInterpolatorTests.cpp.o
[ 26%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/Performance.cpp.o
[ 30%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/RuntimePolymorphism.cpp.o
[ 34%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/1D/Semantics.cpp.o
[ 38%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/AnyInterpolator.cpp.o
[ 42%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/BicubicInterpolatorTests.cpp.o
[ 46%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/BilinearInterpolatorTests.cpp.o
[ 50%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/Constructors.cpp.o
[ 53%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/InterpolatorBaseTests.cpp.o
[ 57%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/LinearDelaunayTriangleInterpolator.cpp.o
[ 61%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/Performance.cpp.o
[ 65%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/RuntimePolymorphism.cpp.o
[ 69%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/Semantics.cpp.o
[ 73%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/ThinPlateSplineInterpolatorTests.cpp.o
[ 76%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/2D/TriangleInterpolatorBaseTests.cpp.o
[ 80%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/Bugs/MonotonicInterpolatorWithFloat.cpp.o
[ 84%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/Devel.cpp.o
[ 88%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/Examples.cpp.o
[ 92%] Building CXX object testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/UtilsTests.cpp.o
/Users/dutsov_c/Documents/Year-2022/libInterpolate/testing/CatchTests/UtilsTests.cpp:287:38: error: 'iterator<std::forward_iterator_tag, double>' is deprecated [-Werror,-Wdeprecated-declarations]
struct StridedIterator : public std::iterator<std::forward_iterator_tag, T> {
^
/.../libInterpolate/testing/CatchTests/UtilsTests.cpp:409:27: note: in instantiation of template class 'StridedIterator' requested here
StridedIterator begin(v.data(),2);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__iterator/iterator.h:27:29: note: 'iterator<std::forward_iterator_tag, double>' has been explicitly marked deprecated here
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__config:1066:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__config:1043:48: note: expanded from macro '_LIBCPP_DEPRECATED'
^
1 error generated.
make[2]: *** [testing/CMakeFiles/libInterpolate_CatchTests.dir/CatchTests/UtilsTests.cpp.o] Error 1
make[1]: *** [testing/CMakeFiles/libInterpolate_CatchTests.dir/all] Error 2
make: *** [all] Error 2`
I rarely use OSX, but if needed I can provide you with more info
The 2D interpolators currently take a vector of x, y and z values for each data points. However, 2 of the 3 interpolators that are implemented require data to be on a regular grid, so the x and y coordinates are repeated.
Should add support for passing a vector of x coordinates, a vector of y coordinates, and a vector of z coordinates. in this case, Nx*Ny must equal Nz, and we would assume that the z values are given in order of increasing y first (like gnuplot).
The bilinear and bicubic 2D interpolators require the input data to be on a regular grid, like gnuplot. This isn't made clear.
Thanks for this library!
Code contains multiple trailing spaces. This means that an edition with an IDE configured to remove trailing spaces modifies lot of files...
Are you interested in a pull request that removes all trailing spaces ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.