]> foleosoft.com Git - QAnsel.git/commitdiff
Sun Feb 11 08:40:19 PM EST 2024
authormiha-q <>
Mon, 12 Feb 2024 01:40:19 +0000 (20:40 -0500)
committermiha-q <>
Mon, 12 Feb 2024 01:40:19 +0000 (20:40 -0500)
examples/bb84.txt
examples/bellstate.txt
examples/belltest_c.txt
examples/belltest_q.txt
examples/decoherence.txt
examples/hidden_variable.txt
examples/swaptest.txt
src/QAnsel.c

index a283806a9412b40dd2d088c5e100af028e909421..60a44b3d6658fb14fc3e66dd7f8b02ff98c603b1 100644 (file)
@@ -15,7 +15,7 @@ h q[1];
 //The first should now be random noise
 //  while the second unmeasured one
 //  should be 0
-sample;
+born;
 
 //In a full BB84 Alice would randomly
 //  apply the gate or not apply the
index d10fea4fadc003d7d1b68979678a9401add5d677..31fe104887737fdb2871ecc2b6c34dd16149771d 100644 (file)
@@ -2,4 +2,4 @@
 qreg q[2];
 h q[0];
 cx q[0], q[1];
-sample;
+born;
index e80d1da30bd88e7fc58e8b68136b87bc60fb7f8a..fd0282f78d096e7e100a51a678ef08852ac4c2ee 100644 (file)
@@ -57,4 +57,4 @@ measure q[1] -> c[1];
 measure q[1] -> c[2];
 measure q[1] -> c[3];
 
-fullsample;
\ No newline at end of file
+sample;
\ No newline at end of file
index e0a862dc73e7bc7efd78f6233893c636cff7c17b..f8695695b91449b965e69dbd8ca896306b5ccb70 100644 (file)
@@ -67,4 +67,4 @@ measure q[1] -> c[1];
 measure q[1] -> c[2];
 measure q[1] -> c[3];
 
-fullsample;
\ No newline at end of file
+sample;
\ No newline at end of file
index d5b10d7b20c7bca0489c4a012f405e817348d0c8..97e74a5770dcef9e96802d164dd078d05e9a4d33 100644 (file)
@@ -10,4 +10,4 @@ measure q[0] -> c[1];
 h q[0];
 measure q[0] -> c[0];
 reset c[1];
-fullsample;
+sample;
index c857d6fd80d720e7cb266f85869f8398981cb3ee..747d5121a02d7f4fb2e01d1ab2ff71e75662e2a0 100644 (file)
@@ -1,21 +1,21 @@
 qreg q[1];
 creg c[4];
 
-hiddenvar 12.34;
+hvar 12.34;
 h q[0]; measure q[0] -> c[0];
 h q[0]; measure q[0] -> c[1];
 h q[0]; measure q[0] -> c[2];
 h q[0]; measure q[0] -> c[3];
 print c;
 
-truerand;
+rand;
 h q[0]; measure q[0] -> c[0];
 h q[0]; measure q[0] -> c[1];
 h q[0]; measure q[0] -> c[2];
 h q[0]; measure q[0] -> c[3];
 print c;
 
-hiddenvar 43.21;
+hvar 43.21;
 h q[0]; measure q[0] -> c[0];
 h q[0]; measure q[0] -> c[1];
 h q[0]; measure q[0] -> c[2];
index 19454e0500a08b353c04f05bc4610aa2295efc91..7a2503872dd2007acadc0065410a6a3479041f63 100644 (file)
@@ -6,4 +6,4 @@ h q[0];
 cswap q[0], q[1], q[2];
 h q[0];
 
-sample q[0];
+born q[0];
index 456f9f76a50db34300040b0323b92f939da28a1f..dcd889e8677d964e740891900a875159d16b5020 100644 (file)
@@ -419,7 +419,7 @@ void qansel_run(uint8_t qubitCount, uint8_t bitCount, QInstr* instr, uint8_t* re
                        }
                        cpx_mtx_free(&tmp);
                }
-               else if (strcmp(instr[i].n, "sample_all") == 0)
+               else if (strcmp(instr[i].n, "born_all") == 0)
                {
                        for (uint32_t j = 0; j < qubitCountPow2; j++)
                        {
@@ -434,7 +434,7 @@ void qansel_run(uint8_t qubitCount, uint8_t bitCount, QInstr* instr, uint8_t* re
                                printf(": %.00f%%\n", cpx_magsqr(&n) * 100);
                        }
                }
-               else if (strcmp(instr[i].n, "sample") == 0)
+               else if (strcmp(instr[i].n, "born") == 0)
                {
                        double prob = 0;
                        for (uint32_t j = 0; j < qubitCountPow2; j++)
@@ -448,7 +448,7 @@ void qansel_run(uint8_t qubitCount, uint8_t bitCount, QInstr* instr, uint8_t* re
                        }
                        printf("%.00f%%\n", prob * 100.0);
                }
-               else if (strcmp(instr[i].n, "hiddenvar") == 0)
+               else if (strcmp(instr[i].n, "hvar") == 0)
                {
                        HIDDEN_VARIABLE = 1;
                        float tmp1 = (float)instr[i].arg0;
@@ -456,7 +456,7 @@ void qansel_run(uint8_t qubitCount, uint8_t bitCount, QInstr* instr, uint8_t* re
                        memcpy(&tmp2, &tmp1, sizeof(uint32_t));
                        srand(tmp2);
                }
-               else if (strcmp(instr[i].n, "truerand") == 0)
+               else if (strcmp(instr[i].n, "rand") == 0)
                {
                        HIDDEN_VARIABLE = 0;
                }
@@ -1052,7 +1052,7 @@ void process(int argc, char** argv)
                        strcpy(instr[instrLen].n, "printc");
                        instr[instrLen++].q0 = q0;
                }
-               else if (strcmp(lines[i], "sample") == 0 || strcmp(lines[i], "sample q") == 0)
+               else if (strcmp(lines[i], "born") == 0 || strcmp(lines[i], "born q") == 0)
                {
                        if (qubitCount == 0xFF)
                        {
@@ -1061,10 +1061,10 @@ void process(int argc, char** argv)
                                break;
                        }
                        instr = realloc(instr, (instrLen + 1) * sizeof(QInstr));
-                       strcpy(instr[instrLen].n, "sample_all");
+                       strcpy(instr[instrLen].n, "born_all");
                        instrLen++;
                }
-               else if (sscanf(lines[i], "sample q[%i]", &q0) == 1)
+               else if (sscanf(lines[i], "born q[%i]", &q0) == 1)
                {
                        if (qubitCount == 0xFF)
                        {
@@ -1079,7 +1079,7 @@ void process(int argc, char** argv)
                                break;
                        }
                        instr = realloc(instr, (instrLen + 1) * sizeof(QInstr));
-                       strcpy(instr[instrLen].n, "sample");
+                       strcpy(instr[instrLen].n, "born");
                        instr[instrLen++].q0 = q0; 
                }
                else if (sscanf(lines[i], "reset q[%i]", &q0) == 1)
@@ -1154,29 +1154,29 @@ void process(int argc, char** argv)
                        //  optimizations that this instruction
                        //  would prevent
                }
-               else if (sscanf(lines[i], "hiddenvar %f", &a0) == 1)
+               else if (sscanf(lines[i], "hvar %f", &a0) == 1)
                {
                        instr = realloc(instr, (instrLen + 1) * sizeof(QInstr));
-                       strcpy(instr[instrLen].n, "hiddenvar");
+                       strcpy(instr[instrLen].n, "hvar");
                        instr[instrLen++].arg0 = a0; 
                }
-               else if (strcmp(lines[i], "truerand") == 0)
+               else if (strcmp(lines[i], "rand") == 0)
                {
                        instr = realloc(instr, (instrLen + 1) * sizeof(QInstr));
-                       strcpy(instr[instrLen].n, "truerand");
+                       strcpy(instr[instrLen].n, "rand");
                        instrLen++;
                }
-               else if (strcmp(lines[i], "fullsample") == 0)
+               else if (strcmp(lines[i], "sample") == 0)
                {
                        if (i != linesLen - 1)
                        {
-                               fprintf(stderr, "QAnsel: fullsample should be used at the end of the program.");
+                               fprintf(stderr, "QAnsel: Sampling should be performed at the end of the program.");
                                errFound = 1;
                                break;
                        }
                        if (bitCount == 0xFF)
                        {
-                               fprintf(stderr, "QAnsel: fullsample cannot be used without initializing classical bits.");
+                               fprintf(stderr, "QAnsel: Sampling cannot be used without initializing classical bits.");
                                errFound = 1;
                                break;
                        }