#include <stdio.h> #include <numeric.h> #define N 2 /* data array size */ #define M 3 /* response array size */ int main() { array double u[N] = {1, 3}; array double v[M] = {1, 2, 5}; array double complex r[M-1],p[M-1]; array double r1[M-1],p1[M-1]; array double k[1]; residue(u,v,r,p,k); printf("coef. of u=%f\n",u); printf("coef. of v=%f\n",v); printf("coef. of r=%f\n",r); printf("coef. of p=%f\n",p); printf("coef. of k=%f\n",k); printf("\n r1, p1 pass by real data, but the result are complex data.\n"); residue(u,v,r1,p1,k); printf("coef. of r=%f\n",r1); printf("coef. of p=%f\n",p1); }
coef. of u=1.000000 3.000000 coef. of v=1.000000 2.000000 5.000000 coef. of r=complex(0.500000,0.500000) complex(0.500000,-0.500000) coef. of p=complex(-1.000000,-2.000000) complex(-1.000000,2.000000) coef. of k=0.000000 r1, p1 pass by real data, but the result are complex data. coef. of r=NaN NaN coef. of p=NaN NaN