Q: Bilinear interpolation is an extension of the well known linear interpolation scheme to functions of two variables. Could you please provide the math behind so that how implementing it on CPU and GPU will be clearer?
A: Sure. Assume that the original function T(x, y) is sampled at the Cartesian regular grid of points (i, j) with 0 <= i < M1, 0 <= j < M2 and i and j integers.
For each value of y, you can first use `0 <= a < 1` to represent an arbitrary point i + a comprised ...

More
# Interpolation

# 1D linear interpolation in CUDA

In this post, we present the full implementation of 1D linear interpolation using CUDA.
You will see that the code performs the 1D linear interpolation in four different ways:
• CPU;
• GPU;
• GPU using tex1Dfetch;
• GPU using tex1D filtering.
The code uses one of the last features of CUDA 6.0 and of latest CUDA cards, namely, unified memory (cudaMallocManaged).
// includes, system
#include <cstdlib>
#include <conio.h>
#include <math.h>
#include <fstream>
#i...

More
# Lagrange polynomials for interpolation

Linear interpolation consists of approximating a function [latex size="1"]f(x)[/latex] as:
[latex size="1"]f(x)=sum_{i=1}^{N}a_i phi_i(x);;;;;;;;;;;(1)[/latex]
where the [latex size="1"]a_i[/latex]'s are the interpolation coefficients and the [latex size="1"]phi_i[/latex]'s are prefixed interpolation functions.
Lagrange interpolation, which is one of the simplest and mostly employed interpolation methods, consists of finding the interpolation coefficients as the solution of the linear system
[...

More
# CUDA – 1D Linear Interpolation with Global Memory, Texture Memory or Texture Filtering

M is the length of input sampling points assumed to be taken with unit sampling step between -M/2 and M/2 and N is the length of the output sampling points, non-uniformly spaced again in the interval -M/2 ... M/2.
Version using Global Memory
In a "Kernels_Interpolation.cu" file
extern "C" void linear_interpolation_function_GPU(float2* result_d, float2* data_d, float* x_in_d, float* x_out_d, int M, int N){
float* result_d_temp = (float*)result_d;
float* data_d_temp = (float*)data_d;
di...

More