linear interpolation array c++

Sat Jul 04, 2015 1:13 pm

linear interpolation array c++ similar to the linspace function of Matlab.
cpp code
std::vector<double> ClassName::linspace(double a, double b, size_t N) {
double h = (b - a) / static_cast<double>(N-1);
vector<double> xs(N);
vector<double>::iterator x;
double val;
for (x = xs.begin(), val = a; x != xs.end(); ++x, val += h)
*x = val;
return xs;
}




  Related Posts  to : linear interpolation array c++
 AES -S-BOX Linear Algorithm implementation-substitution box     -  
 Variable interpolation     -  
 Nearest neighbor interpolation in C++     -  
 Array difference for associate array     -  
 compare an array with another array?     -  
 Add elements to the end of an array     -  
 Get array chunk     -  
 XML Document into an Array in php     -  
 Array sort     -  
 Average of an array. Please help     -