Skip to content

Commit 5bf9f11

Browse files
committed
fixed indenting, updated version number
1 parent 9825bef commit 5bf9f11

File tree

5 files changed

+656
-657
lines changed

5 files changed

+656
-657
lines changed

QuEST/QuEST.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,19 +1950,19 @@ void QuESTSeedRandomDefault(){
19501950
// init MT random number generator with three keys -- time, pid and a hash of hostname
19511951
// for the MPI version, it is ok that all procs will get the same seed as random numbers will only be
19521952
// used by the master process
1953-
1953+
19541954
struct timeval tv;
19551955
gettimeofday(&tv, NULL);
19561956

19571957
double time_in_mill =
1958-
(tv.tv_sec) * 1000 + (tv.tv_usec) / 1000 ; // convert tv_sec & tv_usec to millisecond
1959-
1958+
(tv.tv_sec) * 1000 + (tv.tv_usec) / 1000 ; // convert tv_sec & tv_usec to millisecond
1959+
19601960
unsigned long int pid = getpid();
19611961
unsigned long int msecs = (unsigned long int) time_in_mill;
19621962
char hostName[MAXHOSTNAMELEN+1];
19631963
gethostname(hostName, sizeof(hostName));
19641964
unsigned long int hostNameInt = hashString(hostName);
1965-
1965+
19661966
printf("hostname: %s %lu %lu %lu\n", hostName, hostNameInt, pid, msecs);
19671967

19681968
unsigned long int key[3];

QuEST/QuEST_internal.h

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@ extern const char* errorCodes[];
1919
void compactUnitaryLocal (MultiQubit multiQubit, const int targetQubit, Complex alpha, Complex beta);
2020

2121
void compactUnitaryDistributed (MultiQubit multiQubit, const int targetQubit,
22-
Complex rot1, Complex rot2,
23-
ComplexArray stateVecUp,
24-
ComplexArray stateVecLo,
25-
ComplexArray stateVecOut);
22+
Complex rot1, Complex rot2,
23+
ComplexArray stateVecUp,
24+
ComplexArray stateVecLo,
25+
ComplexArray stateVecOut);
2626

2727
void unitaryLocal(MultiQubit multiQubit, const int targetQubit, ComplexMatrix2 u);
2828

2929
void unitaryDistributed (MultiQubit multiQubit, const int targetQubit,
30-
Complex rot1, Complex rot2,
31-
ComplexArray stateVecUp,
32-
ComplexArray stateVecLo,
33-
ComplexArray stateVecOut);
30+
Complex rot1, Complex rot2,
31+
ComplexArray stateVecUp,
32+
ComplexArray stateVecLo,
33+
ComplexArray stateVecOut);
3434

3535
void controlledCompactUnitaryLocal (MultiQubit multiQubit, const int controlQubit, const int targetQubit,
36-
Complex alpha, Complex beta);
36+
Complex alpha, Complex beta);
3737

3838
void controlledCompactUnitaryDistributed (MultiQubit multiQubit, const int controlQubit, const int targetQubit,
39-
Complex rot1, Complex rot2,
40-
ComplexArray stateVecUp,
41-
ComplexArray stateVecLo,
42-
ComplexArray stateVecOut);
39+
Complex rot1, Complex rot2,
40+
ComplexArray stateVecUp,
41+
ComplexArray stateVecLo,
42+
ComplexArray stateVecOut);
4343

4444
void controlledUnitaryLocal(MultiQubit multiQubit, const int controlQubit, const int targetQubit, ComplexMatrix2 u);
4545

@@ -50,7 +50,7 @@ void controlledUnitaryDistributed (MultiQubit multiQubit, const int controlQubit
5050
ComplexArray stateVecOut);
5151

5252
void multiControlledUnitaryLocal(MultiQubit multiQubit, const int targetQubit,
53-
long long int mask, ComplexMatrix2 u);
53+
long long int mask, ComplexMatrix2 u);
5454

5555
void multiControlledUnitaryDistributed (MultiQubit multiQubit,
5656
const int targetQubit,
@@ -63,22 +63,22 @@ void multiControlledUnitaryDistributed (MultiQubit multiQubit,
6363
void sigmaXLocal(MultiQubit multiQubit, const int targetQubit);
6464

6565
void sigmaXDistributed (MultiQubit multiQubit, const int targetQubit,
66-
ComplexArray stateVecIn,
67-
ComplexArray stateVecOut);
66+
ComplexArray stateVecIn,
67+
ComplexArray stateVecOut);
6868

6969
void sigmaYLocal(MultiQubit multiQubit, const int targetQubit);
7070

7171
void sigmaYDistributed(MultiQubit multiQubit, const int targetQubit,
72-
ComplexArray stateVecIn,
73-
ComplexArray stateVecOut,
74-
int updateUpper);
72+
ComplexArray stateVecIn,
73+
ComplexArray stateVecOut,
74+
int updateUpper);
7575

7676
void hadamardLocal (MultiQubit multiQubit, const int targetQubit);
7777

7878
void hadamardDistributed (MultiQubit multiQubit, const int targetQubit,
79-
ComplexArray stateVecUp,
80-
ComplexArray stateVecLo,
81-
ComplexArray stateVecOut, int updateUpper);
79+
ComplexArray stateVecUp,
80+
ComplexArray stateVecLo,
81+
ComplexArray stateVecOut, int updateUpper);
8282

8383

8484
void phaseGateLocal(MultiQubit multiQubit, const int targetQubit, enum phaseGateType type);
@@ -88,14 +88,14 @@ void phaseGateDistributed(MultiQubit multiQubit, const int targetQubit, enum pha
8888
void controlledNotLocal(MultiQubit multiQubit, const int controlQubit, const int targetQubit);
8989

9090
void controlledNotDistributed (MultiQubit multiQubit, const int controlQubit, const int targetQubit,
91-
ComplexArray stateVecIn,
92-
ComplexArray stateVecOut);
91+
ComplexArray stateVecIn,
92+
ComplexArray stateVecOut);
9393

9494
REAL findProbabilityOfZeroLocal (MultiQubit multiQubit,
95-
const int measureQubit);
95+
const int measureQubit);
9696

9797
REAL findProbabilityOfZeroDistributed (MultiQubit multiQubit,
98-
const int measureQubit);
98+
const int measureQubit);
9999

100100
void collapseToOutcomeLocal(MultiQubit multiQubit, int measureQubit, REAL totalProbability, int outcome);
101101

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
## Versions
44

5-
QuEST is currently in prerelease and may be unstable.
65

7-
Latest version: [0.11.1](https://github.com/aniabrown/QuEST/releases/tag/v0.11.1)
6+
Latest version: [1.0.0](https://github.com/aniabrown/QuEST/releases/tag/v1.0.0)
87

98
Please report errors or feedback to anna.brown@oerc.ox.ac.uk
109

examples/bernsteinVaziraniCircuit.c

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -11,67 +11,67 @@
1111

1212
int main (int narg, char** varg) {
1313

14-
15-
/*
16-
* PREPARE QuEST
17-
*/
18-
19-
// model parameters
20-
int numQubits = 9;
21-
int secretNum = pow(2,4) + 1;
22-
23-
// prepare QuEST
24-
QuESTEnv env;
25-
initQuESTEnv(&env);
26-
27-
// create register; let zeroth qubit be ancilla
28-
MultiQubit multiQubit;
29-
createMultiQubit(&multiQubit, numQubits, env);
30-
initStateZero(&multiQubit);
31-
32-
33-
/*
34-
* APPLY ALGORITHM
35-
*/
36-
37-
// NOT the ancilla
38-
sigmaX(multiQubit, 0);
39-
40-
// CNOT secretNum bits with ancilla
41-
int bits = secretNum;
42-
int bit;
43-
for (int qb=1; qb < numQubits; qb++) {
44-
bit = bits % 2;
45-
bits /= 2;
46-
if (bit)
47-
controlledNot(multiQubit, 0, qb);
48-
}
49-
50-
51-
/*
52-
* VERIFY FINAL STATE
53-
*/
54-
55-
// calculate prob of solution state
56-
double successProb = 1.0;
57-
bits = secretNum;
58-
for (int qb=1; qb < numQubits; qb++) {
59-
bit = bits % 2;
60-
bits /= 2;
61-
successProb *= findProbabilityOfOutcome(
62-
multiQubit, qb, bit);
63-
}
64-
65-
printf("solution reached with probability ");
66-
printf("%f", successProb);
67-
printf("\n");
68-
69-
70-
/*
71-
* FREE MEMORY
72-
*/
73-
74-
destroyMultiQubit(multiQubit, env);
75-
closeQuESTEnv(env);
76-
return 0;
14+
15+
/*
16+
* PREPARE QuEST
17+
*/
18+
19+
// model parameters
20+
int numQubits = 9;
21+
int secretNum = pow(2,4) + 1;
22+
23+
// prepare QuEST
24+
QuESTEnv env;
25+
initQuESTEnv(&env);
26+
27+
// create register; let zeroth qubit be ancilla
28+
MultiQubit multiQubit;
29+
createMultiQubit(&multiQubit, numQubits, env);
30+
initStateZero(&multiQubit);
31+
32+
33+
/*
34+
* APPLY ALGORITHM
35+
*/
36+
37+
// NOT the ancilla
38+
sigmaX(multiQubit, 0);
39+
40+
// CNOT secretNum bits with ancilla
41+
int bits = secretNum;
42+
int bit;
43+
for (int qb=1; qb < numQubits; qb++) {
44+
bit = bits % 2;
45+
bits /= 2;
46+
if (bit)
47+
controlledNot(multiQubit, 0, qb);
48+
}
49+
50+
51+
/*
52+
* VERIFY FINAL STATE
53+
*/
54+
55+
// calculate prob of solution state
56+
double successProb = 1.0;
57+
bits = secretNum;
58+
for (int qb=1; qb < numQubits; qb++) {
59+
bit = bits % 2;
60+
bits /= 2;
61+
successProb *= findProbabilityOfOutcome(
62+
multiQubit, qb, bit);
63+
}
64+
65+
printf("solution reached with probability ");
66+
printf("%f", successProb);
67+
printf("\n");
68+
69+
70+
/*
71+
* FREE MEMORY
72+
*/
73+
74+
destroyMultiQubit(multiQubit, env);
75+
closeQuESTEnv(env);
76+
return 0;
7777
}

0 commit comments

Comments
 (0)