//说明运行环境Visual C++6.0
#inc lude"stdio.h"int table_a[6]={1,2,3,4,5,6};//原数组A-给定int table_b[6]={6,2,3,6,4,2};//原数组B-给定void My_Convo lut ion(int *Tab_A,int *Tab_B)
{int temp=0;int i=0;int j=0;int k=0;int Length_A,Length_B;//数组A和数组B的长度int ALL_L ength;//卷积后的总长度uns igned int Temp_A[10000]={0};//此空间要足够大要满足卷积后的总长度uns igned int Conv_out[10000]={0};//用于存放输出结果的数组
Length_A=sizeof(table_a)/sizeof(unsigned int);//求数组A的长度
Length_B=sizeof(table_b)/sizeof(unsigned int);//求数组B的长度printf("The length of table A is%d\n",Length_A);//打印A的长度printf("The length of table B is%d\n",Length_B);//打印B的长度
ALL_Length=Length_A+Length_B-1;//卷积后的总长度printf("The length of the convolution result is%d\n",ALL_Length);//打印卷积结果长度for(i=0; i
{
Temp_A[i]+=Tab_A[i];
}printf("The convolution result is \n:");//输出提示 “卷积结果如下 ”
卷积桃核心算法部分//for(i=0; i
{for(k=i,j=0;k>=0;k--,j++)
{temp+=Temp_A[k]*Tab_B[j];
}
Conv_out[i]=temp;temp=0;pr intf("%d\n",Conv_out[i]);
}
}void main()
{
My_Convo lution(table_a,table_b);
}