int main() { int i; /* define some data space */ vsip_cvview_d* dataComplex; vsip_cvview_d* dataComplexQuotient; vsip_init((void *)0); dataComplex = vsip_cvcreate_d(L, VSIP_MEM_NONE); dataComplexQuotient = vsip_cvcreate_d(L, VSIP_MEM_NONE); /* put some complex data in dataComplex */ for(i = 0; i < L; i++) vsip_cvput_d(dataComplex,i, vsip_cmplx_d((double)(i * i),(double)(i+1))); /*divide dataComplex by some denom and print the input and output */ vsip_cvrsdiv_d(dataComplex,denom,dataComplexQuotient); for(i=0; i<L; i++) printf("(%7.4f + %7.4fi) / %7.4f) = (%7.4f + %7.4fi)\n", vsip_real_d(vsip_cvget_d(dataComplex,i)), vsip_imag_d(vsip_cvget_d(dataComplex,i)), denom, vsip_real_d(vsip_cvget_d(dataComplexQuotient,i)), vsip_imag_d(vsip_cvget_d(dataComplexQuotient,i))); vsip_cblockdestroy_d(vsip_cvdestroy_d(dataComplex)); vsip_cblockdestroy_d(vsip_cvdestroy_d(dataComplexQuotient)); vsip_finalize((void *)0); return 0; }
int main() { int i; vsip_cvview_d* dataEuler; vsip_vview_d* data; vsip_init((void *)0); dataEuler = vsip_cvcreate_d(L, VSIP_MEM_NONE); data = vsip_vcreate_d(L, VSIP_MEM_NONE); /* Make up some data */ /* Compute a ramp from zero to 2pi */ vsip_vramp_d(0.0, (2.0 * PI / (double) (L - 1)), data); /* Compute Euler */ vsip_veuler_d(data,dataEuler); /* Now print out data and dataEuler */ for(i=0; i < L; i++) { printf(" %7.4f => (%7.4f, %7.4f)\n",vsip_vget_d(data,i), vsip_real_d(vsip_cvget_d(dataEuler,i)), vsip_imag_d(vsip_cvget_d(dataEuler,i))); } /* Destroy the vector views and any associated blocks */ vsip_blockdestroy_d(vsip_vdestroy_d(data)); vsip_cblockdestroy_d(vsip_cvdestroy_d(dataEuler)); vsip_finalize((void *)0); return 0; }
int main() { int i; /* define some vectors */ vsip_vview_d* dataReOne; vsip_vview_d* dataReTwo; vsip_vview_d* dataReQuotient; vsip_cvview_d* dataComplex; vsip_cvview_d* dataComplexQuotient; vsip_init((void *)0); dataReOne = vsip_vcreate_d(L, VSIP_MEM_NONE); dataReTwo = vsip_vcreate_d(L, VSIP_MEM_NONE); dataReQuotient = vsip_vcreate_d(L, VSIP_MEM_NONE); dataComplex = vsip_cvcreate_d(L, VSIP_MEM_NONE); dataComplexQuotient = vsip_cvcreate_d(L, VSIP_MEM_NONE); /* make up some data */ vsip_vramp_d(1,1,dataReOne); vsip_vfill_d(2,dataReTwo); vsip_vcmplx_d(dataReTwo,dataReOne,dataComplex); /*divide one by two and print the input and output */ vsip_vdiv_d(dataReOne,dataReTwo,dataReQuotient); for(i=0; i<L; i++) printf("%7.4f / %7.4f = %7.4f\n", vsip_vget_d(dataReOne,i), vsip_vget_d(dataReTwo,i), vsip_vget_d(dataReQuotient,i)); printf("\n"); /*divide one by complex and print the input and output */ vsip_rcvdiv_d(dataReOne,dataComplex,dataComplexQuotient); for(i=0; i<L; i++) printf("%7.4f / (%7.4f + %7.4fi) = (%7.4f + %7.4fi)\n", vsip_vget_d(dataReOne,i), vsip_real_d(vsip_cvget_d(dataComplex,i)), vsip_imag_d(vsip_cvget_d(dataComplex,i)), vsip_real_d(vsip_cvget_d(dataComplexQuotient,i)), vsip_imag_d(vsip_cvget_d(dataComplexQuotient,i))); /* destroy created objects */ vsip_blockdestroy_d(vsip_vdestroy_d(dataReOne)); vsip_blockdestroy_d(vsip_vdestroy_d(dataReTwo)); vsip_blockdestroy_d(vsip_vdestroy_d(dataReQuotient)); vsip_cblockdestroy_d(vsip_cvdestroy_d(dataComplex)); vsip_cblockdestroy_d(vsip_cvdestroy_d(dataComplexQuotient)); vsip_finalize((void *)0); return 0; }
int main (){ vsip_init((void*)0); { int i; vsip_cblock_d* blockOut = vsip_cblockcreate_d(2 * L, 0); vsip_cvview_d* vectorOut = vsip_cvbind_d(blockOut,0,2,L); vsip_cvview_d* vectorIn = vsip_cvcreate_d(L,0); vsip_vview_d* realIn = vsip_vrealview_d(vectorIn); vsip_vview_d* imagIn = vsip_vimagview_d(vectorIn); vsip_fft_d* fftplan = vsip_ccfftop_create_d(L,1,-1,0,0); vsip_fft_d* fftplanI = vsip_ccfftop_create_d(L,(double)1/L,1,0,0); char inputdata[L][20]; /* put some data in realIn*/ vsip_vramp_d(0, 2 * PI * F, realIn); vsip_vcos_d(realIn,realIn); /* print realIn */ for(i=0; i<L; i++) sprintf(inputdata[i],"%2d input-> %7.3f",i, vsip_vget_d(realIn,i)); /*make sure imagIn is full of zeros*/ vsip_vfill_d(0,imagIn); /*find the fft*/ vsip_ccfftop_d(fftplan,vectorIn,vectorOut); /*invert the fft*/ vsip_ccfftop_d(fftplanI,vectorOut,vectorIn); /*print it */ for(i=0; i<L; i++) printf("%s fft -> (%7.3f, %7.3f) ifft -> (%7.3f, %7.3f)\n", inputdata[i], vsip_real_d(vsip_cvget_d(vectorOut,i)), vsip_imag_d(vsip_cvget_d(vectorOut,i)), vsip_real_d(vsip_cvget_d(vectorIn,i)), vsip_imag_d(vsip_cvget_d(vectorIn,i))); { vsip_vdestroy_d(imagIn); vsip_vdestroy_d(realIn); vsip_cblockdestroy_d(vsip_cvdestroy_d(vectorIn)); vsip_cblockdestroy_d(vsip_cvdestroy_d(vectorOut)); vsip_fft_destroy_d(fftplan); vsip_fft_destroy_d(fftplanI); } } vsip_finalize((void*)0);return 0; }
int main (){vsip_init((void*)0); { int i; vsip_cvview_d* vector = vsip_cvcreate_d(L,0); vsip_vview_d* realIn = vsip_vrealview_d(vector); vsip_vview_d* imagIn = vsip_vimagview_d(vector); vsip_fft_d* fftplan = vsip_ccfftip_create_d(L,1,-1,0,0); vsip_fft_d* fftplanI = vsip_ccfftip_create_d(L,(double)1/L,1,0,0); char printDataOne[L][20], printDataTwo[L][30]; /* put some data in realIn*/ vsip_vramp_d(0, 2 * VU_PI * F, realIn); vsip_vcos_d(realIn,realIn); /* print realIn */ for(i=0; i<L; i++){ sprintf(printDataOne[i],"%2d input -> %7.4f",i, vsip_vget_d(realIn,i)); } /*make sure imagIn is full of zeros*/ vsip_vfill_d(0,imagIn); /*find the fft*/ vsip_ccfftip_d(fftplan,vector); for(i=0; i<L; i++){ sprintf(printDataTwo[i]," fft -> (%7.3f, %7.3f)", vsip_real_d(vsip_cvget_d(vector,i)), vsip_imag_d(vsip_cvget_d(vector,i))); } /*invert the fft*/ vsip_ccfftip_d(fftplanI,vector); /*print it */ for(i=0; i<L; i++){ printf("%s %s ifft -> (%7.3f, %7.3f)\n", printDataOne[i], printDataTwo[i], vsip_real_d(vsip_cvget_d(vector,i)), vsip_imag_d(vsip_cvget_d(vector,i))); } { vsip_vdestroy_d((void*)imagIn); vsip_vdestroy_d((void*)realIn); vsip_cblockdestroy_d(vsip_cvdestroy_d((void*)vector)); vsip_fft_destroy_d((void*)fftplan); vsip_fft_destroy_d((void*)fftplanI); } } vsip_finalize((void*)0);return 0; }
void (vsip_cvalldestroy_d)( vsip_cvview_d* v) { /* vector view destructor*/ vsip_cblockdestroy_d(vsip_cvdestroy_d(v)); }