/************************************************* 実験プログラム (permutation capability評価) *************************************************/ #include<stdio.h> #include<math.h> int main() { double N, p_omega, p_benes, l; FILE *fp1, *fp2; fp1 = fopen("o_permutation.txt", "w"); fp2 = fopen("b_permutation.txt", "w");; for(N=2; N<=pow(2,10); N=N*2){ l = log(N)/log(2); p_omega = pow(2,(int)(l/2+0.5)); p_benes = 2; printf("N=%.0lf : OmegaP.C=%.0lf, BenesP.C=%.0lf\n", N, p_omega, p_benes); fprintf(fp1, "%lf %lf\n", N, p_omega); fprintf(fp2, "%lf %lf\n", N, p_benes); } fclose(fp1); fclose(fp2); return 0; } /************************************************* 結果 N=2 : OmegaP.C=2, BenesP.C=2 N=4 : OmegaP.C=2, BenesP.C=2 N=8 : OmegaP.C=4, BenesP.C=2 N=16 : OmegaP.C=4, BenesP.C=2 N=32 : OmegaP.C=8, BenesP.C=2 N=64 : OmegaP.C=8, BenesP.C=2 N=128 : OmegaP.C=16, BenesP.C=2 N=256 : OmegaP.C=16, BenesP.C=2 N=512 : OmegaP.C=32, BenesP.C=2 N=1024 : OmegaP.C=32, BenesP.C=2 *************************************************/
/************************************************* 実験プログラム (ハードウェアコスト評価) *************************************************/ #include<stdio.h> #include<math.h> int main() { double N, h_omega, h_benes, l; FILE *fp1, *fp2; fp1 = fopen("o_hard.txt", "w"); fp2 = fopen("b_hard.txt", "w");; for(N=2; N<=pow(2,10); N=N*2){ l = log(N)/log(2); h_omega = N/2 * l; h_benes = N/2 * (2*l-1); printf("N=%.0lf : OmegaHard=%.0lf, BenesHard=%.0lf\n", N, h_omega, h_benes); fprintf(fp1, "%lf %lf\n", N, h_omega); fprintf(fp2, "%lf %lf\n", N, h_benes); } fclose(fp1); fclose(fp2); return 0; } /************************************************* 結果 N=2 : OmegaHard=1, BenesHard=1 N=4 : OmegaHard=4, BenesHard=6 N=8 : OmegaHard=12, BenesHard=20 N=16 : OmegaHard=32, BenesHard=56 N=32 : OmegaHard=80, BenesHard=144 N=64 : OmegaHard=192, BenesHard=352 N=128 : OmegaHard=448, BenesHard=832 N=256 : OmegaHard=1024, BenesHard=1920 N=512 : OmegaHard=2304, BenesHard=4352 N=1024 : OmegaHard=5120, BenesHard=9728 *************************************************/