-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.c
55 lines (42 loc) · 1.14 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// main.c
// QuBOX
//
// Created by Simon Devitt on 2/8/19.
// Copyright © 2019 Simon Devitt. All rights reserved.
//
#include <stdlib.h>
#include <time.h>
#include "stdio.h"
#include <math.h>
#include "Simulator/sim.h"
#include "Simulator/norm.h"
#include <string.h>
//#include <stdint.h>
int main(){
int i,j,k,N, qubit;
ds_Register reg;
FILE *out=fopen("out.dat","w");
clock_t start, end;
double cpu_time_used;
for(i=1; i<=30; i++){
printf("Qubits = %d\n", i);
for(j=1; j<=100; j++){
start = clock();
ds_initialize_simulator(0);
reg = ds_create_register(i, 0, 0);
ds_set_state(reg, 0, 1, 0);
for(k=0; k<j; k++){
ds_yrot(reg,rand() % i,ds_Pi*ds_uniform(),0);
}
ds_destroy_register(reg);
end = clock();
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
fprintf(out, "%d, %d, %f\n", i, j, cpu_time_used);
}
}
fclose(out);
return 0;
}
;
/*-----------------------end-------------------------------*/