澳洲计算机IT 编程assignment 代写
100%原创包过,高质量代写&免费提供Turnitin报告--24小时客服QQ&微信:273427
澳洲计算机IT 编程assignment 代写
Header file:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <malloc.h>
#include "q2_header.h"
void DFT(double *x, double *y,int N)
{
double **CNI;
CNI=makeCNI(N);
complexMatrixVectorMultiply(CNI,y,N,N,x);
}
void FastDFT(double *x,double *y,double *w,double *Wp,int N,int skip);
FastDFT file:
void FastDFT(double *x,double *y,double *w,double *Wp,int N,int skip)
{
int i,j;
if (N==1)
{
memcpy(x,y,2*sizeof(double));
}
else if (N % 2 && N!=1)
{
DFT(x,y,N);
}
else
{
/*place xe and xo in w,from head to tail.*/
for (i=0;i<N;i=i+2)
{
memcpy(w+i,x+2*i,2*sizeof(double));
}
for (i=0;i<N;i=i+2)
{
memcpy(w+(i+N),x+(2*i+2),2*sizeof(double));
}
FastDFT(w,y,x,Wp,N/2,skip*2);//the even half of y, i.e., ye
FastDFT(w+N,y+N,x+N,Wp,N/2,skip*2);//the odd half of y, i.e., yo
memcpy(w,y,sizeof(double)*2*N);//copy the value of ye,yo into w.
for(j=0;j<N;j+=2)
{
double temp[2]={0,0};
double times[2]={N,0};
complexMultiply(&Wp[2*N-j],&w[j+N],&temp);
complexMultiply(&temp,×,&temp);
complexAdd(&w[j],&temp,&y[j]);
complexMultiply(&Wp[N-j],&w[j+N],&temp);
complexMultiply(&temp,×,&temp);
complexAdd(&w[j],&temp,&y[j+N]);
}
}
}
澳洲计算机IT 编程assignment 代写
F
+C2=2, F*
C2=2, F
+R2=8, F*
R2=8
If F
+CN, F*
CN,F
+RN,F*
RN are known, then
F
+C2N=2*F
+CN+2*N,
F*
C2N=2*F*
CN+2*N,
F
+R2N=2*F
+RN+8*N,
F*
R2N=2*F*
RN+8*N
The values of these 4 numbers from N=2 up to N=2
20 could be calculated using Excel, and the results are represented as below:
Since F
+C2N=2*F
+CN+2*N, it is clear that F
+C2N=2N*F
+C1+2*N*log
22N,
and since F
+C1=0, F
+C2N=2*N*log
22N,
Hence, F
+CN=N*log
2N.
Similarly, it could be proved that F*
CN=N*log
2N, F
+RN=4*N*log
2N, and F*
RN=4*N*log
2N.
澳洲计算机IT 编程assignment 代写
According to some tests, the FastDFS function is twice as fast as a direct matrix-vector multiply when N is 2, as shown below:
The FastDFS function is twice as fast as a direct matrix-vector multiply when N is 16, as shown below: