]> foleosoft.com Git - QAnsel.git/commitdiff
Sun Feb 11 07:58:55 PM EST 2024
authormiha-q <>
Mon, 12 Feb 2024 00:58:55 +0000 (19:58 -0500)
committermiha-q <>
Mon, 12 Feb 2024 00:58:55 +0000 (19:58 -0500)
src/QAnsel.c

index e59b1c718ee8466705c0710b00c7471a8728f1f6..456f9f76a50db34300040b0323b92f939da28a1f 100644 (file)
@@ -1250,7 +1250,8 @@ void process(int argc, char** argv)
 
                uint8_t* dat = malloc(instrLen * sizeof(QInstr));
                memcpy(dat, instr, instrLen * sizeof(QInstr));
-               for (uint32_t i = 0; i < 100; i++)
+               uint32_t shots = 100;
+               for (uint32_t i = 0; i < shots; i++)
                {
                        qansel_run(qubitCount, bitCount, instr, bitVect, instrLen, doDisplay);
                        memcpy(instr, dat, instrLen * sizeof(QInstr));
@@ -1270,7 +1271,7 @@ void process(int argc, char** argv)
                                putchar('0' + (tmp >> (bitCount - 1) & 1));
                                tmp <<= 1;
                        }
-                       printf(": %.00f%%\n", (double)stats[i] / (double)10);
+                       printf(": %.00f%%\n", ((double)stats[i] / (double)shots) * (double)100);
                }
        }
        else