求教各位大神,如何用c++ builder 2010 实现 一组数据的一维线性插值

求教各位大神,怎么用c++ builder 2010 实现 一组数据的一维线性插值?
最好能写出代码,各位帮帮忙呀
------解决方案--------------------
[code=c][//---------------------------------------------------------------------------

#ifndef linera_interpolationH
#define linera_interpolationH
//---------------------------------------------------------------------------
#include <vector>


typedef struct{
double dbl_x;
double dbl_y;
}DataPoint;


class LinearInter
{
public:

/* 传递原始数据数组 */
void InputData(const DataPoint* pDataPoint, unsigned int n);

/* 传递单一数据对象 */
void InputData(const DataPoint& dataPoint);

/* 删除单一数据对象 */
bool DeleteData(const DataPoint& dataPoint);
bool DeleteData(unsigned n);

/* 给定x值,计算出y值 */
const DataPoint OutputData(const double x) const;
DataPoint* OutputData(const double* x_array, unsigned int n, DataPoint* pDataPoint) const;

/* 清空原始数据成员 */
void ClearData();

/* 返回当前原始数据大小 */
unsigned int GetRowDataSize() const;

/* 返回当前原始数据,数组可变 */
DataPoint* GetRowData(unsigned int n, DataPoint* pDataPoint) const;

public:
LinearInter();
~LinearInter();

private:
void Interpolate();                   // 计算插值

private:
std::vector<DataPoint> m_DataList;    // 存储原始数据
double    m_Slope;       //
double    m_Constant;    // y = k*x + c

};

#endif/code]