请教一个插值问题
一本书中的例子,我想借用,可是编译出来总是出错,错误是error C2664: 'slgq' : cannot convert parameter 3 from 'double [11][11]' to 'double []',请高手给我指点。#include "math.h"
#include "stdio.h"
main()
{
extern double slgq(double x[],double y[],double z[],int n,int m,double u,double v);
int i,j;
double u,v,w;
static double x[11],y[11],z[11][11];
for (i=0;i<=10;i++)
{
x[i]=0.1*i;y[i]=x[i];
}
for(i=0;i<=10;i++)
for(j=0;j<=10;j++)
z[i][j]=exp(-(x[i]-y[j]));
printf("\n");
u=0.35;v=0.65;
w=slgq(x,y,z,11,11,u,v);
printf("x=%7.3f, y=%7.3f, z(x,y)=%e\n",u,v,w);
printf("\n");
}
double slgq(double x[],double y[],double z[],int n,int m,double u,double v)
{
int ip,ipp,i,j,l,iq,iqq,k;
double h,w,b[10];
if (u<=x[0]) {ip=1;ipp=4;}
else if(u>=x[n-1]) {ip=n-3;ipp=n;}
else
{
i=l;j=n;
while (((i-j)!=1)&&((i-j)!=-1))
{
l=(i+j)/2;
if (u<x[l-1]) j=1;
else i=l;
}
ip=i-3;ipp=i+4;
}
if (ip<1) ip=1;
if (ipp>n) ipp=n;
if (v<=y[0]) {iq=1;iqq=m;}
else if (v>=y[m-1]) {iq=m-3;iqq=m;}
else
{
i=l;j=m;
while (((i-j)!=1)&&((i-j)!=-1))
{
l=(i+j)/2;
if (v<y[l-1]) j=1;
else i=1;
}
iq=i-3;iqq=i+4;
}
if(iq<1) iq=1;
if(iqq>m) iqq=m;
for(i=ip-1;i<=ipp-1;i++)
{
b[i-ip+1]=0.0;
for(j=iq-1;j=iqq-1;j++)
{
h=z[m*i+j];
for (k=iq-1;k<=iqq-1;k++)
if(k!=j) h=h*(v-y[k])/(y[j]-y[k]);
b[i-ip+1]=b[i-ip+1]+h;
}
}
w=0.0;
for(i=ip-1;i<=ipp-1;i++)
{
h=b[i-ip+1];
for (j=ip-1;j<=ipp-1;j++)
if (j!=1) h=h*(u-x[j])/(x[i]-x[j]);
w=w+h;
}
return(w);
}