From: miha-q <> Date: Mon, 18 Sep 2023 02:43:02 +0000 (-0400) Subject: Sun Sep 17 10:43:02 PM EDT 2023 X-Git-Url: http://www.foleosoft.com/?a=commitdiff_plain;h=1e0805043c2898afdbb2d20ceeb932a92e51e104;p=QAnsel.git Sun Sep 17 10:43:02 PM EDT 2023 --- diff --git a/bin/QAnsel b/bin/QAnsel index baa3cc7..82b3bc7 100755 Binary files a/bin/QAnsel and b/bin/QAnsel differ diff --git a/examples/belltest/classic.sh b/examples/belltest/classic.sh new file mode 100644 index 0000000..2b72f35 --- /dev/null +++ b/examples/belltest/classic.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +function classic { +../../bin/QAnsel << HERE +qreg q[2]; +creg c[2]; + +h q[0]; +h q[1]; +measure q[0] -> c[0]; +measure q[1] -> c[1]; +x q[0]; +if(c[1]==1) x q[1]; +print c; + +//Player X rules +if(c[0]==1) x q[0]; + +//Player Y rules +x q[1]; + +//Results +measure q[0] -> c[0]; +measure q[1] -> c[1]; +print c; + +HERE +} + +function quantum { +../../bin/QAnsel << HERE +qreg q[2]; +creg c[2]; + +h q[0]; +h q[1]; +measure q[0] -> c[0]; +measure q[1] -> c[1]; +print c; +reset q[0]; +reset q[1]; + +h q[0]; +cx q[0], q[1]; + +if(c[0]==1) ry(pi/2) q[0]; +if(c[0]==1) rz(pi) q[0]; + +if(c[1]==0) ry(pi/4) q[1]; +if(c[1]==0) rz(pi) q[1]; + +if(c[1]==1) ry(-pi/4) q[1]; +if(c[1]==1) rz(pi) q[1]; + +measure q[0] -> c[0]; +measure q[1] -> c[1]; +print c; + +HERE +} + +function test +{ + if [ "$1" == "00 00" ] + then + echo 1 + elif [ "$1" == "00 11" ] + then + echo 1 + elif [ "$1" == "01 00" ] + then + echo 1 + elif [ "$1" == "01 11" ] + then + echo 1 + elif [ "$1" == "10 00" ] + then + echo 1 + elif [ "$1" == "10 11" ] + then + echo 1 + elif [ "$1" == "11 10" ] + then + echo 1 + elif [ "$1" == "11 01" ] + then + echo 1 + else + echo 0 + fi +} + +trials=1000 +cwins=0 +qwins=0 +for i in $(seq 1 $trials) +do + clear + echo "$(( (100 * i) / trials ))%" + + trial=$(classic | xargs) + results=$(test "$trial") + cwins=$((cwins+results)) + + trial=$(quantum | xargs) + results=$(test "$trial") + qwins=$((qwins+results)) + +done +clear + +echo "Classical Strategy: $cwins points" +echo "Quantum Strategy: $qwins points" diff --git a/examples/big.qsm b/examples/big.qsm new file mode 100644 index 0000000..583730e --- /dev/null +++ b/examples/big.qsm @@ -0,0 +1,52 @@ +qreg q[2]; +creg c[2]; + +h q[0]; +cx q[0], q[1]; + +//00 +h q[0]; +cx q[0], q[1]; + +ry(pi/4) q[1]; +rz(pi) q[1]; + +sample; +reset; + +//01 +h q[0]; +cx q[0], q[1]; + +ry(pi/2) q[0]; +rz(pi) q[0]; + +ry(pi/4) q[1]; +rz(pi) q[1]; + +sample; +reset; + +//10 +h q[0]; +cx q[0], q[1]; + +ry(-pi/4) q[1]; +rz(pi) q[1]; + +sample; +reset; + +//11 +h q[0]; +cx q[0], q[1]; + +ry(pi/2) q[0]; +rz(pi) q[0]; + +ry(-pi/4) q[1]; +rz(pi) q[1]; + +sample; +reset; + diff --git a/examples/teleportation.qsm b/examples/teleportation.qsm index c9fac7d..c17d924 100644 --- a/examples/teleportation.qsm +++ b/examples/teleportation.qsm @@ -2,7 +2,7 @@ qreg q[3]; creg c[2]; //qubit to teleport -u(1,2,3) q[0]; +u(1.6,1.6,1.6) q[0]; print q[0]; //show qubit to teleport //shared entangled qubit @@ -20,9 +20,12 @@ measure q[0] -> c[0]; measure q[1] -> c[1]; //rotate based on measurement results -if(c==2) x q[2]; if(c==1) z q[2]; +if(c==2) x q[2]; if(c==3) x q[2]; if(c==3) z q[2]; -print q[2]; //show teleported qubit \ No newline at end of file +//show teleported qubit +reset q[0]; +reset q[1]; +print q[2]; \ No newline at end of file diff --git a/log b/log new file mode 100644 index 0000000..37c580e --- /dev/null +++ b/log @@ -0,0 +1,2168 @@ +0;204 +204;408 +408;612 +612;816 +816;1020 +1020;1224 +1224;1428 +1428;1632 +1632;1836 +1836;2040 +2040;2244 +2244;2448 +2448;2652 +2652;2856 +2856;3060 +3060;3264 +3264;3468 +3468;3672 +3876;4096 +3672;3876 +1836;2040 +1632;1836 +1428;1632 +2244;2448 +2040;2244 +816;1020 +204;408 +0;204 +3264;3468 +2856;3060 +1224;1428 +2448;2652 +3060;3264 +2652;2856 +408;612 +612;816 +1020;1224 +3672;3876 +3876;4096 +3468;3672 +0;204 +204;408 +408;612 +612;816 +816;1020 +1020;1224 +1224;1428 +1428;1632 +1632;1836 +1836;2040 +2040;2244 +2244;2448 +2448;2652 +2652;2856 +2856;3060 +3060;3264 +3264;3468 +3468;3672 +3672;3876 +3876;4096 +1836;2040 +1428;1632 +1632;1836 +0;204 +612;816 +2244;2448 +2448;2652 +408;612 +3672;3876 +3060;3264 +204;408 +2652;2856 +3264;3468 +816;1020 +3468;3672 +2040;2244 +2856;3060 +1224;1428 +1020;1224 +3876;4096 +0;204 +204;408 +408;612 +612;816 +816;1020 +1020;1224 +1224;1428 +1428;1632 +1632;1836 +1836;2040 +2040;2244 +2244;2448 +2448;2652 +2652;2856 +2856;3060 +3060;3264 +3264;3468 +3468;3672 +3672;3876 +3876;4096 +2040;2244 +1836;2040 +1632;1836 +2244;2448 +408;612 +1428;1632 +2652;2856 +816;1020 +204;408 +2448;2652 +3060;3264 +2856;3060 +3468;3672 +1224;1428 +1020;1224 +3264;3468 +3876;4096 +612;816 +0;204 +3672;3876 +00000000000: 12% +00000000001: 0% +00000000010: 12% +00000000011: 0% +00000000100: 12% +00000000101: 0% +00000000110: 12% +00000000111: 0% +00000001000: 12% +00000001001: 0% +00000001010: 12% +00000001011: 0% +00000001100: 12% +00000001101: 0% +00000001110: 12% +00000001111: 0% +00000010000: 0% +00000010001: 0% +00000010010: 0% +00000010011: 0% +00000010100: 0% +00000010101: 0% +00000010110: 0% +00000010111: 0% +00000011000: 0% +00000011001: 0% +00000011010: 0% +00000011011: 0% +00000011100: 0% +00000011101: 0% +00000011110: 0% +00000011111: 0% +00000100000: 0% +00000100001: 0% +00000100010: 0% +00000100011: 0% +00000100100: 0% +00000100101: 0% +00000100110: 0% +00000100111: 0% +00000101000: 0% +00000101001: 0% +00000101010: 0% +00000101011: 0% +00000101100: 0% +00000101101: 0% +00000101110: 0% +00000101111: 0% +00000110000: 0% +00000110001: 0% +00000110010: 0% +00000110011: 0% +00000110100: 0% +00000110101: 0% +00000110110: 0% +00000110111: 0% +00000111000: 0% +00000111001: 0% +00000111010: 0% +00000111011: 0% +00000111100: 0% +00000111101: 0% +00000111110: 0% +00000111111: 0% +00001000000: 0% +00001000001: 0% +00001000010: 0% +00001000011: 0% +00001000100: 0% +00001000101: 0% +00001000110: 0% +00001000111: 0% +00001001000: 0% +00001001001: 0% +00001001010: 0% +00001001011: 0% +00001001100: 0% +00001001101: 0% +00001001110: 0% +00001001111: 0% +00001010000: 0% +00001010001: 0% +00001010010: 0% +00001010011: 0% +00001010100: 0% +00001010101: 0% +00001010110: 0% +00001010111: 0% +00001011000: 0% +00001011001: 0% +00001011010: 0% +00001011011: 0% +00001011100: 0% +00001011101: 0% +00001011110: 0% +00001011111: 0% +00001100000: 0% +00001100001: 0% +00001100010: 0% +00001100011: 0% +00001100100: 0% +00001100101: 0% +00001100110: 0% +00001100111: 0% +00001101000: 0% +00001101001: 0% +00001101010: 0% +00001101011: 0% +00001101100: 0% +00001101101: 0% +00001101110: 0% +00001101111: 0% +00001110000: 0% +00001110001: 0% +00001110010: 0% +00001110011: 0% +00001110100: 0% +00001110101: 0% +00001110110: 0% +00001110111: 0% +00001111000: 0% +00001111001: 0% +00001111010: 0% +00001111011: 0% +00001111100: 0% +00001111101: 0% +00001111110: 0% +00001111111: 0% +00010000000: 0% +00010000001: 0% +00010000010: 0% +00010000011: 0% +00010000100: 0% +00010000101: 0% +00010000110: 0% +00010000111: 0% +00010001000: 0% +00010001001: 0% +00010001010: 0% +00010001011: 0% +00010001100: 0% +00010001101: 0% +00010001110: 0% +00010001111: 0% +00010010000: 0% +00010010001: 0% +00010010010: 0% +00010010011: 0% +00010010100: 0% +00010010101: 0% +00010010110: 0% +00010010111: 0% +00010011000: 0% +00010011001: 0% +00010011010: 0% +00010011011: 0% +00010011100: 0% +00010011101: 0% +00010011110: 0% +00010011111: 0% +00010100000: 0% +00010100001: 0% +00010100010: 0% +00010100011: 0% +00010100100: 0% +00010100101: 0% +00010100110: 0% +00010100111: 0% +00010101000: 0% +00010101001: 0% +00010101010: 0% +00010101011: 0% +00010101100: 0% +00010101101: 0% +00010101110: 0% +00010101111: 0% +00010110000: 0% +00010110001: 0% +00010110010: 0% +00010110011: 0% +00010110100: 0% +00010110101: 0% +00010110110: 0% +00010110111: 0% +00010111000: 0% +00010111001: 0% +00010111010: 0% +00010111011: 0% +00010111100: 0% +00010111101: 0% +00010111110: 0% +00010111111: 0% +00011000000: 0% +00011000001: 0% +00011000010: 0% +00011000011: 0% +00011000100: 0% +00011000101: 0% +00011000110: 0% +00011000111: 0% +00011001000: 0% +00011001001: 0% +00011001010: 0% +00011001011: 0% +00011001100: 0% +00011001101: 0% +00011001110: 0% +00011001111: 0% +00011010000: 0% +00011010001: 0% +00011010010: 0% +00011010011: 0% +00011010100: 0% +00011010101: 0% +00011010110: 0% +00011010111: 0% +00011011000: 0% +00011011001: 0% +00011011010: 0% +00011011011: 0% +00011011100: 0% +00011011101: 0% +00011011110: 0% +00011011111: 0% +00011100000: 0% +00011100001: 0% +00011100010: 0% +00011100011: 0% +00011100100: 0% +00011100101: 0% +00011100110: 0% +00011100111: 0% +00011101000: 0% +00011101001: 0% +00011101010: 0% +00011101011: 0% +00011101100: 0% +00011101101: 0% +00011101110: 0% +00011101111: 0% +00011110000: 0% +00011110001: 0% +00011110010: 0% +00011110011: 0% +00011110100: 0% +00011110101: 0% +00011110110: 0% +00011110111: 0% +00011111000: 0% +00011111001: 0% +00011111010: 0% +00011111011: 0% +00011111100: 0% +00011111101: 0% +00011111110: 0% +00011111111: 0% +00100000000: 0% +00100000001: 0% +00100000010: 0% +00100000011: 0% +00100000100: 0% +00100000101: 0% +00100000110: 0% +00100000111: 0% +00100001000: 0% +00100001001: 0% +00100001010: 0% +00100001011: 0% +00100001100: 0% +00100001101: 0% +00100001110: 0% +00100001111: 0% +00100010000: 0% +00100010001: 0% +00100010010: 0% +00100010011: 0% +00100010100: 0% +00100010101: 0% +00100010110: 0% +00100010111: 0% +00100011000: 0% +00100011001: 0% +00100011010: 0% +00100011011: 0% +00100011100: 0% +00100011101: 0% +00100011110: 0% +00100011111: 0% +00100100000: 0% +00100100001: 0% +00100100010: 0% +00100100011: 0% +00100100100: 0% +00100100101: 0% +00100100110: 0% +00100100111: 0% +00100101000: 0% +00100101001: 0% +00100101010: 0% +00100101011: 0% +00100101100: 0% +00100101101: 0% +00100101110: 0% +00100101111: 0% +00100110000: 0% +00100110001: 0% +00100110010: 0% +00100110011: 0% +00100110100: 0% +00100110101: 0% +00100110110: 0% +00100110111: 0% +00100111000: 0% +00100111001: 0% +00100111010: 0% +00100111011: 0% +00100111100: 0% +00100111101: 0% +00100111110: 0% +00100111111: 0% +00101000000: 0% +00101000001: 0% +00101000010: 0% +00101000011: 0% +00101000100: 0% +00101000101: 0% +00101000110: 0% +00101000111: 0% +00101001000: 0% +00101001001: 0% +00101001010: 0% +00101001011: 0% +00101001100: 0% +00101001101: 0% +00101001110: 0% +00101001111: 0% +00101010000: 0% +00101010001: 0% +00101010010: 0% +00101010011: 0% +00101010100: 0% +00101010101: 0% +00101010110: 0% +00101010111: 0% +00101011000: 0% +00101011001: 0% +00101011010: 0% +00101011011: 0% +00101011100: 0% +00101011101: 0% +00101011110: 0% +00101011111: 0% +00101100000: 0% +00101100001: 0% +00101100010: 0% +00101100011: 0% +00101100100: 0% +00101100101: 0% +00101100110: 0% +00101100111: 0% +00101101000: 0% +00101101001: 0% +00101101010: 0% +00101101011: 0% +00101101100: 0% +00101101101: 0% +00101101110: 0% +00101101111: 0% +00101110000: 0% +00101110001: 0% +00101110010: 0% +00101110011: 0% +00101110100: 0% +00101110101: 0% +00101110110: 0% +00101110111: 0% +00101111000: 0% +00101111001: 0% +00101111010: 0% +00101111011: 0% +00101111100: 0% +00101111101: 0% +00101111110: 0% +00101111111: 0% +00110000000: 0% +00110000001: 0% +00110000010: 0% +00110000011: 0% +00110000100: 0% +00110000101: 0% +00110000110: 0% +00110000111: 0% +00110001000: 0% +00110001001: 0% +00110001010: 0% +00110001011: 0% +00110001100: 0% +00110001101: 0% +00110001110: 0% +00110001111: 0% +00110010000: 0% +00110010001: 0% +00110010010: 0% +00110010011: 0% +00110010100: 0% +00110010101: 0% +00110010110: 0% +00110010111: 0% +00110011000: 0% +00110011001: 0% +00110011010: 0% +00110011011: 0% +00110011100: 0% +00110011101: 0% +00110011110: 0% +00110011111: 0% +00110100000: 0% +00110100001: 0% +00110100010: 0% +00110100011: 0% +00110100100: 0% +00110100101: 0% +00110100110: 0% +00110100111: 0% +00110101000: 0% +00110101001: 0% +00110101010: 0% +00110101011: 0% +00110101100: 0% +00110101101: 0% +00110101110: 0% +00110101111: 0% +00110110000: 0% +00110110001: 0% +00110110010: 0% +00110110011: 0% +00110110100: 0% +00110110101: 0% +00110110110: 0% +00110110111: 0% +00110111000: 0% +00110111001: 0% +00110111010: 0% +00110111011: 0% +00110111100: 0% +00110111101: 0% +00110111110: 0% +00110111111: 0% +00111000000: 0% +00111000001: 0% +00111000010: 0% +00111000011: 0% +00111000100: 0% +00111000101: 0% +00111000110: 0% +00111000111: 0% +00111001000: 0% +00111001001: 0% +00111001010: 0% +00111001011: 0% +00111001100: 0% +00111001101: 0% +00111001110: 0% +00111001111: 0% +00111010000: 0% +00111010001: 0% +00111010010: 0% +00111010011: 0% +00111010100: 0% +00111010101: 0% +00111010110: 0% +00111010111: 0% +00111011000: 0% +00111011001: 0% +00111011010: 0% +00111011011: 0% +00111011100: 0% +00111011101: 0% +00111011110: 0% +00111011111: 0% +00111100000: 0% +00111100001: 0% +00111100010: 0% +00111100011: 0% +00111100100: 0% +00111100101: 0% +00111100110: 0% +00111100111: 0% +00111101000: 0% +00111101001: 0% +00111101010: 0% +00111101011: 0% +00111101100: 0% +00111101101: 0% +00111101110: 0% +00111101111: 0% +00111110000: 0% +00111110001: 0% +00111110010: 0% +00111110011: 0% +00111110100: 0% +00111110101: 0% +00111110110: 0% +00111110111: 0% +00111111000: 0% +00111111001: 0% +00111111010: 0% +00111111011: 0% +00111111100: 0% +00111111101: 0% +00111111110: 0% +00111111111: 0% +01000000000: 0% +01000000001: 0% +01000000010: 0% +01000000011: 0% +01000000100: 0% +01000000101: 0% +01000000110: 0% +01000000111: 0% +01000001000: 0% +01000001001: 0% +01000001010: 0% +01000001011: 0% +01000001100: 0% +01000001101: 0% +01000001110: 0% +01000001111: 0% +01000010000: 0% +01000010001: 0% +01000010010: 0% +01000010011: 0% +01000010100: 0% +01000010101: 0% +01000010110: 0% +01000010111: 0% +01000011000: 0% +01000011001: 0% +01000011010: 0% +01000011011: 0% +01000011100: 0% +01000011101: 0% +01000011110: 0% +01000011111: 0% +01000100000: 0% +01000100001: 0% +01000100010: 0% +01000100011: 0% +01000100100: 0% +01000100101: 0% +01000100110: 0% +01000100111: 0% +01000101000: 0% +01000101001: 0% +01000101010: 0% +01000101011: 0% +01000101100: 0% +01000101101: 0% +01000101110: 0% +01000101111: 0% +01000110000: 0% +01000110001: 0% +01000110010: 0% +01000110011: 0% +01000110100: 0% +01000110101: 0% +01000110110: 0% +01000110111: 0% +01000111000: 0% +01000111001: 0% +01000111010: 0% +01000111011: 0% +01000111100: 0% +01000111101: 0% +01000111110: 0% +01000111111: 0% +01001000000: 0% +01001000001: 0% +01001000010: 0% +01001000011: 0% +01001000100: 0% +01001000101: 0% +01001000110: 0% +01001000111: 0% +01001001000: 0% +01001001001: 0% +01001001010: 0% +01001001011: 0% +01001001100: 0% +01001001101: 0% +01001001110: 0% +01001001111: 0% +01001010000: 0% +01001010001: 0% +01001010010: 0% +01001010011: 0% +01001010100: 0% +01001010101: 0% +01001010110: 0% +01001010111: 0% +01001011000: 0% +01001011001: 0% +01001011010: 0% +01001011011: 0% +01001011100: 0% +01001011101: 0% +01001011110: 0% +01001011111: 0% +01001100000: 0% +01001100001: 0% +01001100010: 0% +01001100011: 0% +01001100100: 0% +01001100101: 0% +01001100110: 0% +01001100111: 0% +01001101000: 0% +01001101001: 0% +01001101010: 0% +01001101011: 0% +01001101100: 0% +01001101101: 0% +01001101110: 0% +01001101111: 0% +01001110000: 0% +01001110001: 0% +01001110010: 0% +01001110011: 0% +01001110100: 0% +01001110101: 0% +01001110110: 0% +01001110111: 0% +01001111000: 0% +01001111001: 0% +01001111010: 0% +01001111011: 0% +01001111100: 0% +01001111101: 0% +01001111110: 0% +01001111111: 0% +01010000000: 0% +01010000001: 0% +01010000010: 0% +01010000011: 0% +01010000100: 0% +01010000101: 0% +01010000110: 0% +01010000111: 0% +01010001000: 0% +01010001001: 0% +01010001010: 0% +01010001011: 0% +01010001100: 0% +01010001101: 0% +01010001110: 0% +01010001111: 0% +01010010000: 0% +01010010001: 0% +01010010010: 0% +01010010011: 0% +01010010100: 0% +01010010101: 0% +01010010110: 0% +01010010111: 0% +01010011000: 0% +01010011001: 0% +01010011010: 0% +01010011011: 0% +01010011100: 0% +01010011101: 0% +01010011110: 0% +01010011111: 0% +01010100000: 0% +01010100001: 0% +01010100010: 0% +01010100011: 0% +01010100100: 0% +01010100101: 0% +01010100110: 0% +01010100111: 0% +01010101000: 0% +01010101001: 0% +01010101010: 0% +01010101011: 0% +01010101100: 0% +01010101101: 0% +01010101110: 0% +01010101111: 0% +01010110000: 0% +01010110001: 0% +01010110010: 0% +01010110011: 0% +01010110100: 0% +01010110101: 0% +01010110110: 0% +01010110111: 0% +01010111000: 0% +01010111001: 0% +01010111010: 0% +01010111011: 0% +01010111100: 0% +01010111101: 0% +01010111110: 0% +01010111111: 0% +01011000000: 0% +01011000001: 0% +01011000010: 0% +01011000011: 0% +01011000100: 0% +01011000101: 0% +01011000110: 0% +01011000111: 0% +01011001000: 0% +01011001001: 0% +01011001010: 0% +01011001011: 0% +01011001100: 0% +01011001101: 0% +01011001110: 0% +01011001111: 0% +01011010000: 0% +01011010001: 0% +01011010010: 0% +01011010011: 0% +01011010100: 0% +01011010101: 0% +01011010110: 0% +01011010111: 0% +01011011000: 0% +01011011001: 0% +01011011010: 0% +01011011011: 0% +01011011100: 0% +01011011101: 0% +01011011110: 0% +01011011111: 0% +01011100000: 0% +01011100001: 0% +01011100010: 0% +01011100011: 0% +01011100100: 0% +01011100101: 0% +01011100110: 0% +01011100111: 0% +01011101000: 0% +01011101001: 0% +01011101010: 0% +01011101011: 0% +01011101100: 0% +01011101101: 0% +01011101110: 0% +01011101111: 0% +01011110000: 0% +01011110001: 0% +01011110010: 0% +01011110011: 0% +01011110100: 0% +01011110101: 0% +01011110110: 0% +01011110111: 0% +01011111000: 0% +01011111001: 0% +01011111010: 0% +01011111011: 0% +01011111100: 0% +01011111101: 0% +01011111110: 0% +01011111111: 0% +01100000000: 0% +01100000001: 0% +01100000010: 0% +01100000011: 0% +01100000100: 0% +01100000101: 0% +01100000110: 0% +01100000111: 0% +01100001000: 0% +01100001001: 0% +01100001010: 0% +01100001011: 0% +01100001100: 0% +01100001101: 0% +01100001110: 0% +01100001111: 0% +01100010000: 0% +01100010001: 0% +01100010010: 0% +01100010011: 0% +01100010100: 0% +01100010101: 0% +01100010110: 0% +01100010111: 0% +01100011000: 0% +01100011001: 0% +01100011010: 0% +01100011011: 0% +01100011100: 0% +01100011101: 0% +01100011110: 0% +01100011111: 0% +01100100000: 0% +01100100001: 0% +01100100010: 0% +01100100011: 0% +01100100100: 0% +01100100101: 0% +01100100110: 0% +01100100111: 0% +01100101000: 0% +01100101001: 0% +01100101010: 0% +01100101011: 0% +01100101100: 0% +01100101101: 0% +01100101110: 0% +01100101111: 0% +01100110000: 0% +01100110001: 0% +01100110010: 0% +01100110011: 0% +01100110100: 0% +01100110101: 0% +01100110110: 0% +01100110111: 0% +01100111000: 0% +01100111001: 0% +01100111010: 0% +01100111011: 0% +01100111100: 0% +01100111101: 0% +01100111110: 0% +01100111111: 0% +01101000000: 0% +01101000001: 0% +01101000010: 0% +01101000011: 0% +01101000100: 0% +01101000101: 0% +01101000110: 0% +01101000111: 0% +01101001000: 0% +01101001001: 0% +01101001010: 0% +01101001011: 0% +01101001100: 0% +01101001101: 0% +01101001110: 0% +01101001111: 0% +01101010000: 0% +01101010001: 0% +01101010010: 0% +01101010011: 0% +01101010100: 0% +01101010101: 0% +01101010110: 0% +01101010111: 0% +01101011000: 0% +01101011001: 0% +01101011010: 0% +01101011011: 0% +01101011100: 0% +01101011101: 0% +01101011110: 0% +01101011111: 0% +01101100000: 0% +01101100001: 0% +01101100010: 0% +01101100011: 0% +01101100100: 0% +01101100101: 0% +01101100110: 0% +01101100111: 0% +01101101000: 0% +01101101001: 0% +01101101010: 0% +01101101011: 0% +01101101100: 0% +01101101101: 0% +01101101110: 0% +01101101111: 0% +01101110000: 0% +01101110001: 0% +01101110010: 0% +01101110011: 0% +01101110100: 0% +01101110101: 0% +01101110110: 0% +01101110111: 0% +01101111000: 0% +01101111001: 0% +01101111010: 0% +01101111011: 0% +01101111100: 0% +01101111101: 0% +01101111110: 0% +01101111111: 0% +01110000000: 0% +01110000001: 0% +01110000010: 0% +01110000011: 0% +01110000100: 0% +01110000101: 0% +01110000110: 0% +01110000111: 0% +01110001000: 0% +01110001001: 0% +01110001010: 0% +01110001011: 0% +01110001100: 0% +01110001101: 0% +01110001110: 0% +01110001111: 0% +01110010000: 0% +01110010001: 0% +01110010010: 0% +01110010011: 0% +01110010100: 0% +01110010101: 0% +01110010110: 0% +01110010111: 0% +01110011000: 0% +01110011001: 0% +01110011010: 0% +01110011011: 0% +01110011100: 0% +01110011101: 0% +01110011110: 0% +01110011111: 0% +01110100000: 0% +01110100001: 0% +01110100010: 0% +01110100011: 0% +01110100100: 0% +01110100101: 0% +01110100110: 0% +01110100111: 0% +01110101000: 0% +01110101001: 0% +01110101010: 0% +01110101011: 0% +01110101100: 0% +01110101101: 0% +01110101110: 0% +01110101111: 0% +01110110000: 0% +01110110001: 0% +01110110010: 0% +01110110011: 0% +01110110100: 0% +01110110101: 0% +01110110110: 0% +01110110111: 0% +01110111000: 0% +01110111001: 0% +01110111010: 0% +01110111011: 0% +01110111100: 0% +01110111101: 0% +01110111110: 0% +01110111111: 0% +01111000000: 0% +01111000001: 0% +01111000010: 0% +01111000011: 0% +01111000100: 0% +01111000101: 0% +01111000110: 0% +01111000111: 0% +01111001000: 0% +01111001001: 0% +01111001010: 0% +01111001011: 0% +01111001100: 0% +01111001101: 0% +01111001110: 0% +01111001111: 0% +01111010000: 0% +01111010001: 0% +01111010010: 0% +01111010011: 0% +01111010100: 0% +01111010101: 0% +01111010110: 0% +01111010111: 0% +01111011000: 0% +01111011001: 0% +01111011010: 0% +01111011011: 0% +01111011100: 0% +01111011101: 0% +01111011110: 0% +01111011111: 0% +01111100000: 0% +01111100001: 0% +01111100010: 0% +01111100011: 0% +01111100100: 0% +01111100101: 0% +01111100110: 0% +01111100111: 0% +01111101000: 0% +01111101001: 0% +01111101010: 0% +01111101011: 0% +01111101100: 0% +01111101101: 0% +01111101110: 0% +01111101111: 0% +01111110000: 0% +01111110001: 0% +01111110010: 0% +01111110011: 0% +01111110100: 0% +01111110101: 0% +01111110110: 0% +01111110111: 0% +01111111000: 0% +01111111001: 0% +01111111010: 0% +01111111011: 0% +01111111100: 0% +01111111101: 0% +01111111110: 0% +01111111111: 0% +10000000000: 0% +10000000001: 0% +10000000010: 0% +10000000011: 0% +10000000100: 0% +10000000101: 0% +10000000110: 0% +10000000111: 0% +10000001000: 0% +10000001001: 0% +10000001010: 0% +10000001011: 0% +10000001100: 0% +10000001101: 0% +10000001110: 0% +10000001111: 0% +10000010000: 0% +10000010001: 0% +10000010010: 0% +10000010011: 0% +10000010100: 0% +10000010101: 0% +10000010110: 0% +10000010111: 0% +10000011000: 0% +10000011001: 0% +10000011010: 0% +10000011011: 0% +10000011100: 0% +10000011101: 0% +10000011110: 0% +10000011111: 0% +10000100000: 0% +10000100001: 0% +10000100010: 0% +10000100011: 0% +10000100100: 0% +10000100101: 0% +10000100110: 0% +10000100111: 0% +10000101000: 0% +10000101001: 0% +10000101010: 0% +10000101011: 0% +10000101100: 0% +10000101101: 0% +10000101110: 0% +10000101111: 0% +10000110000: 0% +10000110001: 0% +10000110010: 0% +10000110011: 0% +10000110100: 0% +10000110101: 0% +10000110110: 0% +10000110111: 0% +10000111000: 0% +10000111001: 0% +10000111010: 0% +10000111011: 0% +10000111100: 0% +10000111101: 0% +10000111110: 0% +10000111111: 0% +10001000000: 0% +10001000001: 0% +10001000010: 0% +10001000011: 0% +10001000100: 0% +10001000101: 0% +10001000110: 0% +10001000111: 0% +10001001000: 0% +10001001001: 0% +10001001010: 0% +10001001011: 0% +10001001100: 0% +10001001101: 0% +10001001110: 0% +10001001111: 0% +10001010000: 0% +10001010001: 0% +10001010010: 0% +10001010011: 0% +10001010100: 0% +10001010101: 0% +10001010110: 0% +10001010111: 0% +10001011000: 0% +10001011001: 0% +10001011010: 0% +10001011011: 0% +10001011100: 0% +10001011101: 0% +10001011110: 0% +10001011111: 0% +10001100000: 0% +10001100001: 0% +10001100010: 0% +10001100011: 0% +10001100100: 0% +10001100101: 0% +10001100110: 0% +10001100111: 0% +10001101000: 0% +10001101001: 0% +10001101010: 0% +10001101011: 0% +10001101100: 0% +10001101101: 0% +10001101110: 0% +10001101111: 0% +10001110000: 0% +10001110001: 0% +10001110010: 0% +10001110011: 0% +10001110100: 0% +10001110101: 0% +10001110110: 0% +10001110111: 0% +10001111000: 0% +10001111001: 0% +10001111010: 0% +10001111011: 0% +10001111100: 0% +10001111101: 0% +10001111110: 0% +10001111111: 0% +10010000000: 0% +10010000001: 0% +10010000010: 0% +10010000011: 0% +10010000100: 0% +10010000101: 0% +10010000110: 0% +10010000111: 0% +10010001000: 0% +10010001001: 0% +10010001010: 0% +10010001011: 0% +10010001100: 0% +10010001101: 0% +10010001110: 0% +10010001111: 0% +10010010000: 0% +10010010001: 0% +10010010010: 0% +10010010011: 0% +10010010100: 0% +10010010101: 0% +10010010110: 0% +10010010111: 0% +10010011000: 0% +10010011001: 0% +10010011010: 0% +10010011011: 0% +10010011100: 0% +10010011101: 0% +10010011110: 0% +10010011111: 0% +10010100000: 0% +10010100001: 0% +10010100010: 0% +10010100011: 0% +10010100100: 0% +10010100101: 0% +10010100110: 0% +10010100111: 0% +10010101000: 0% +10010101001: 0% +10010101010: 0% +10010101011: 0% +10010101100: 0% +10010101101: 0% +10010101110: 0% +10010101111: 0% +10010110000: 0% +10010110001: 0% +10010110010: 0% +10010110011: 0% +10010110100: 0% +10010110101: 0% +10010110110: 0% +10010110111: 0% +10010111000: 0% +10010111001: 0% +10010111010: 0% +10010111011: 0% +10010111100: 0% +10010111101: 0% +10010111110: 0% +10010111111: 0% +10011000000: 0% +10011000001: 0% +10011000010: 0% +10011000011: 0% +10011000100: 0% +10011000101: 0% +10011000110: 0% +10011000111: 0% +10011001000: 0% +10011001001: 0% +10011001010: 0% +10011001011: 0% +10011001100: 0% +10011001101: 0% +10011001110: 0% +10011001111: 0% +10011010000: 0% +10011010001: 0% +10011010010: 0% +10011010011: 0% +10011010100: 0% +10011010101: 0% +10011010110: 0% +10011010111: 0% +10011011000: 0% +10011011001: 0% +10011011010: 0% +10011011011: 0% +10011011100: 0% +10011011101: 0% +10011011110: 0% +10011011111: 0% +10011100000: 0% +10011100001: 0% +10011100010: 0% +10011100011: 0% +10011100100: 0% +10011100101: 0% +10011100110: 0% +10011100111: 0% +10011101000: 0% +10011101001: 0% +10011101010: 0% +10011101011: 0% +10011101100: 0% +10011101101: 0% +10011101110: 0% +10011101111: 0% +10011110000: 0% +10011110001: 0% +10011110010: 0% +10011110011: 0% +10011110100: 0% +10011110101: 0% +10011110110: 0% +10011110111: 0% +10011111000: 0% +10011111001: 0% +10011111010: 0% +10011111011: 0% +10011111100: 0% +10011111101: 0% +10011111110: 0% +10011111111: 0% +10100000000: 0% +10100000001: 0% +10100000010: 0% +10100000011: 0% +10100000100: 0% +10100000101: 0% +10100000110: 0% +10100000111: 0% +10100001000: 0% +10100001001: 0% +10100001010: 0% +10100001011: 0% +10100001100: 0% +10100001101: 0% +10100001110: 0% +10100001111: 0% +10100010000: 0% +10100010001: 0% +10100010010: 0% +10100010011: 0% +10100010100: 0% +10100010101: 0% +10100010110: 0% +10100010111: 0% +10100011000: 0% +10100011001: 0% +10100011010: 0% +10100011011: 0% +10100011100: 0% +10100011101: 0% +10100011110: 0% +10100011111: 0% +10100100000: 0% +10100100001: 0% +10100100010: 0% +10100100011: 0% +10100100100: 0% +10100100101: 0% +10100100110: 0% +10100100111: 0% +10100101000: 0% +10100101001: 0% +10100101010: 0% +10100101011: 0% +10100101100: 0% +10100101101: 0% +10100101110: 0% +10100101111: 0% +10100110000: 0% +10100110001: 0% +10100110010: 0% +10100110011: 0% +10100110100: 0% +10100110101: 0% +10100110110: 0% +10100110111: 0% +10100111000: 0% +10100111001: 0% +10100111010: 0% +10100111011: 0% +10100111100: 0% +10100111101: 0% +10100111110: 0% +10100111111: 0% +10101000000: 0% +10101000001: 0% +10101000010: 0% +10101000011: 0% +10101000100: 0% +10101000101: 0% +10101000110: 0% +10101000111: 0% +10101001000: 0% +10101001001: 0% +10101001010: 0% +10101001011: 0% +10101001100: 0% +10101001101: 0% +10101001110: 0% +10101001111: 0% +10101010000: 0% +10101010001: 0% +10101010010: 0% +10101010011: 0% +10101010100: 0% +10101010101: 0% +10101010110: 0% +10101010111: 0% +10101011000: 0% +10101011001: 0% +10101011010: 0% +10101011011: 0% +10101011100: 0% +10101011101: 0% +10101011110: 0% +10101011111: 0% +10101100000: 0% +10101100001: 0% +10101100010: 0% +10101100011: 0% +10101100100: 0% +10101100101: 0% +10101100110: 0% +10101100111: 0% +10101101000: 0% +10101101001: 0% +10101101010: 0% +10101101011: 0% +10101101100: 0% +10101101101: 0% +10101101110: 0% +10101101111: 0% +10101110000: 0% +10101110001: 0% +10101110010: 0% +10101110011: 0% +10101110100: 0% +10101110101: 0% +10101110110: 0% +10101110111: 0% +10101111000: 0% +10101111001: 0% +10101111010: 0% +10101111011: 0% +10101111100: 0% +10101111101: 0% +10101111110: 0% +10101111111: 0% +10110000000: 0% +10110000001: 0% +10110000010: 0% +10110000011: 0% +10110000100: 0% +10110000101: 0% +10110000110: 0% +10110000111: 0% +10110001000: 0% +10110001001: 0% +10110001010: 0% +10110001011: 0% +10110001100: 0% +10110001101: 0% +10110001110: 0% +10110001111: 0% +10110010000: 0% +10110010001: 0% +10110010010: 0% +10110010011: 0% +10110010100: 0% +10110010101: 0% +10110010110: 0% +10110010111: 0% +10110011000: 0% +10110011001: 0% +10110011010: 0% +10110011011: 0% +10110011100: 0% +10110011101: 0% +10110011110: 0% +10110011111: 0% +10110100000: 0% +10110100001: 0% +10110100010: 0% +10110100011: 0% +10110100100: 0% +10110100101: 0% +10110100110: 0% +10110100111: 0% +10110101000: 0% +10110101001: 0% +10110101010: 0% +10110101011: 0% +10110101100: 0% +10110101101: 0% +10110101110: 0% +10110101111: 0% +10110110000: 0% +10110110001: 0% +10110110010: 0% +10110110011: 0% +10110110100: 0% +10110110101: 0% +10110110110: 0% +10110110111: 0% +10110111000: 0% +10110111001: 0% +10110111010: 0% +10110111011: 0% +10110111100: 0% +10110111101: 0% +10110111110: 0% +10110111111: 0% +10111000000: 0% +10111000001: 0% +10111000010: 0% +10111000011: 0% +10111000100: 0% +10111000101: 0% +10111000110: 0% +10111000111: 0% +10111001000: 0% +10111001001: 0% +10111001010: 0% +10111001011: 0% +10111001100: 0% +10111001101: 0% +10111001110: 0% +10111001111: 0% +10111010000: 0% +10111010001: 0% +10111010010: 0% +10111010011: 0% +10111010100: 0% +10111010101: 0% +10111010110: 0% +10111010111: 0% +10111011000: 0% +10111011001: 0% +10111011010: 0% +10111011011: 0% +10111011100: 0% +10111011101: 0% +10111011110: 0% +10111011111: 0% +10111100000: 0% +10111100001: 0% +10111100010: 0% +10111100011: 0% +10111100100: 0% +10111100101: 0% +10111100110: 0% +10111100111: 0% +10111101000: 0% +10111101001: 0% +10111101010: 0% +10111101011: 0% +10111101100: 0% +10111101101: 0% +10111101110: 0% +10111101111: 0% +10111110000: 0% +10111110001: 0% +10111110010: 0% +10111110011: 0% +10111110100: 0% +10111110101: 0% +10111110110: 0% +10111110111: 0% +10111111000: 0% +10111111001: 0% +10111111010: 0% +10111111011: 0% +10111111100: 0% +10111111101: 0% +10111111110: 0% +10111111111: 0% +11000000000: 0% +11000000001: 0% +11000000010: 0% +11000000011: 0% +11000000100: 0% +11000000101: 0% +11000000110: 0% +11000000111: 0% +11000001000: 0% +11000001001: 0% +11000001010: 0% +11000001011: 0% +11000001100: 0% +11000001101: 0% +11000001110: 0% +11000001111: 0% +11000010000: 0% +11000010001: 0% +11000010010: 0% +11000010011: 0% +11000010100: 0% +11000010101: 0% +11000010110: 0% +11000010111: 0% +11000011000: 0% +11000011001: 0% +11000011010: 0% +11000011011: 0% +11000011100: 0% +11000011101: 0% +11000011110: 0% +11000011111: 0% +11000100000: 0% +11000100001: 0% +11000100010: 0% +11000100011: 0% +11000100100: 0% +11000100101: 0% +11000100110: 0% +11000100111: 0% +11000101000: 0% +11000101001: 0% +11000101010: 0% +11000101011: 0% +11000101100: 0% +11000101101: 0% +11000101110: 0% +11000101111: 0% +11000110000: 0% +11000110001: 0% +11000110010: 0% +11000110011: 0% +11000110100: 0% +11000110101: 0% +11000110110: 0% +11000110111: 0% +11000111000: 0% +11000111001: 0% +11000111010: 0% +11000111011: 0% +11000111100: 0% +11000111101: 0% +11000111110: 0% +11000111111: 0% +11001000000: 0% +11001000001: 0% +11001000010: 0% +11001000011: 0% +11001000100: 0% +11001000101: 0% +11001000110: 0% +11001000111: 0% +11001001000: 0% +11001001001: 0% +11001001010: 0% +11001001011: 0% +11001001100: 0% +11001001101: 0% +11001001110: 0% +11001001111: 0% +11001010000: 0% +11001010001: 0% +11001010010: 0% +11001010011: 0% +11001010100: 0% +11001010101: 0% +11001010110: 0% +11001010111: 0% +11001011000: 0% +11001011001: 0% +11001011010: 0% +11001011011: 0% +11001011100: 0% +11001011101: 0% +11001011110: 0% +11001011111: 0% +11001100000: 0% +11001100001: 0% +11001100010: 0% +11001100011: 0% +11001100100: 0% +11001100101: 0% +11001100110: 0% +11001100111: 0% +11001101000: 0% +11001101001: 0% +11001101010: 0% +11001101011: 0% +11001101100: 0% +11001101101: 0% +11001101110: 0% +11001101111: 0% +11001110000: 0% +11001110001: 0% +11001110010: 0% +11001110011: 0% +11001110100: 0% +11001110101: 0% +11001110110: 0% +11001110111: 0% +11001111000: 0% +11001111001: 0% +11001111010: 0% +11001111011: 0% +11001111100: 0% +11001111101: 0% +11001111110: 0% +11001111111: 0% +11010000000: 0% +11010000001: 0% +11010000010: 0% +11010000011: 0% +11010000100: 0% +11010000101: 0% +11010000110: 0% +11010000111: 0% +11010001000: 0% +11010001001: 0% +11010001010: 0% +11010001011: 0% +11010001100: 0% +11010001101: 0% +11010001110: 0% +11010001111: 0% +11010010000: 0% +11010010001: 0% +11010010010: 0% +11010010011: 0% +11010010100: 0% +11010010101: 0% +11010010110: 0% +11010010111: 0% +11010011000: 0% +11010011001: 0% +11010011010: 0% +11010011011: 0% +11010011100: 0% +11010011101: 0% +11010011110: 0% +11010011111: 0% +11010100000: 0% +11010100001: 0% +11010100010: 0% +11010100011: 0% +11010100100: 0% +11010100101: 0% +11010100110: 0% +11010100111: 0% +11010101000: 0% +11010101001: 0% +11010101010: 0% +11010101011: 0% +11010101100: 0% +11010101101: 0% +11010101110: 0% +11010101111: 0% +11010110000: 0% +11010110001: 0% +11010110010: 0% +11010110011: 0% +11010110100: 0% +11010110101: 0% +11010110110: 0% +11010110111: 0% +11010111000: 0% +11010111001: 0% +11010111010: 0% +11010111011: 0% +11010111100: 0% +11010111101: 0% +11010111110: 0% +11010111111: 0% +11011000000: 0% +11011000001: 0% +11011000010: 0% +11011000011: 0% +11011000100: 0% +11011000101: 0% +11011000110: 0% +11011000111: 0% +11011001000: 0% +11011001001: 0% +11011001010: 0% +11011001011: 0% +11011001100: 0% +11011001101: 0% +11011001110: 0% +11011001111: 0% +11011010000: 0% +11011010001: 0% +11011010010: 0% +11011010011: 0% +11011010100: 0% +11011010101: 0% +11011010110: 0% +11011010111: 0% +11011011000: 0% +11011011001: 0% +11011011010: 0% +11011011011: 0% +11011011100: 0% +11011011101: 0% +11011011110: 0% +11011011111: 0% +11011100000: 0% +11011100001: 0% +11011100010: 0% +11011100011: 0% +11011100100: 0% +11011100101: 0% +11011100110: 0% +11011100111: 0% +11011101000: 0% +11011101001: 0% +11011101010: 0% +11011101011: 0% +11011101100: 0% +11011101101: 0% +11011101110: 0% +11011101111: 0% +11011110000: 0% +11011110001: 0% +11011110010: 0% +11011110011: 0% +11011110100: 0% +11011110101: 0% +11011110110: 0% +11011110111: 0% +11011111000: 0% +11011111001: 0% +11011111010: 0% +11011111011: 0% +11011111100: 0% +11011111101: 0% +11011111110: 0% +11011111111: 0% +11100000000: 0% +11100000001: 0% +11100000010: 0% +11100000011: 0% +11100000100: 0% +11100000101: 0% +11100000110: 0% +11100000111: 0% +11100001000: 0% +11100001001: 0% +11100001010: 0% +11100001011: 0% +11100001100: 0% +11100001101: 0% +11100001110: 0% +11100001111: 0% +11100010000: 0% +11100010001: 0% +11100010010: 0% +11100010011: 0% +11100010100: 0% +11100010101: 0% +11100010110: 0% +11100010111: 0% +11100011000: 0% +11100011001: 0% +11100011010: 0% +11100011011: 0% +11100011100: 0% +11100011101: 0% +11100011110: 0% +11100011111: 0% +11100100000: 0% +11100100001: 0% +11100100010: 0% +11100100011: 0% +11100100100: 0% +11100100101: 0% +11100100110: 0% +11100100111: 0% +11100101000: 0% +11100101001: 0% +11100101010: 0% +11100101011: 0% +11100101100: 0% +11100101101: 0% +11100101110: 0% +11100101111: 0% +11100110000: 0% +11100110001: 0% +11100110010: 0% +11100110011: 0% +11100110100: 0% +11100110101: 0% +11100110110: 0% +11100110111: 0% +11100111000: 0% +11100111001: 0% +11100111010: 0% +11100111011: 0% +11100111100: 0% +11100111101: 0% +11100111110: 0% +11100111111: 0% +11101000000: 0% +11101000001: 0% +11101000010: 0% +11101000011: 0% +11101000100: 0% +11101000101: 0% +11101000110: 0% +11101000111: 0% +11101001000: 0% +11101001001: 0% +11101001010: 0% +11101001011: 0% +11101001100: 0% +11101001101: 0% +11101001110: 0% +11101001111: 0% +11101010000: 0% +11101010001: 0% +11101010010: 0% +11101010011: 0% +11101010100: 0% +11101010101: 0% +11101010110: 0% +11101010111: 0% +11101011000: 0% +11101011001: 0% +11101011010: 0% +11101011011: 0% +11101011100: 0% +11101011101: 0% +11101011110: 0% +11101011111: 0% +11101100000: 0% +11101100001: 0% +11101100010: 0% +11101100011: 0% +11101100100: 0% +11101100101: 0% +11101100110: 0% +11101100111: 0% +11101101000: 0% +11101101001: 0% +11101101010: 0% +11101101011: 0% +11101101100: 0% +11101101101: 0% +11101101110: 0% +11101101111: 0% +11101110000: 0% +11101110001: 0% +11101110010: 0% +11101110011: 0% +11101110100: 0% +11101110101: 0% +11101110110: 0% +11101110111: 0% +11101111000: 0% +11101111001: 0% +11101111010: 0% +11101111011: 0% +11101111100: 0% +11101111101: 0% +11101111110: 0% +11101111111: 0% +11110000000: 0% +11110000001: 0% +11110000010: 0% +11110000011: 0% +11110000100: 0% +11110000101: 0% +11110000110: 0% +11110000111: 0% +11110001000: 0% +11110001001: 0% +11110001010: 0% +11110001011: 0% +11110001100: 0% +11110001101: 0% +11110001110: 0% +11110001111: 0% +11110010000: 0% +11110010001: 0% +11110010010: 0% +11110010011: 0% +11110010100: 0% +11110010101: 0% +11110010110: 0% +11110010111: 0% +11110011000: 0% +11110011001: 0% +11110011010: 0% +11110011011: 0% +11110011100: 0% +11110011101: 0% +11110011110: 0% +11110011111: 0% +11110100000: 0% +11110100001: 0% +11110100010: 0% +11110100011: 0% +11110100100: 0% +11110100101: 0% +11110100110: 0% +11110100111: 0% +11110101000: 0% +11110101001: 0% +11110101010: 0% +11110101011: 0% +11110101100: 0% +11110101101: 0% +11110101110: 0% +11110101111: 0% +11110110000: 0% +11110110001: 0% +11110110010: 0% +11110110011: 0% +11110110100: 0% +11110110101: 0% +11110110110: 0% +11110110111: 0% +11110111000: 0% +11110111001: 0% +11110111010: 0% +11110111011: 0% +11110111100: 0% +11110111101: 0% +11110111110: 0% +11110111111: 0% +11111000000: 0% +11111000001: 0% +11111000010: 0% +11111000011: 0% +11111000100: 0% +11111000101: 0% +11111000110: 0% +11111000111: 0% +11111001000: 0% +11111001001: 0% +11111001010: 0% +11111001011: 0% +11111001100: 0% +11111001101: 0% +11111001110: 0% +11111001111: 0% +11111010000: 0% +11111010001: 0% +11111010010: 0% +11111010011: 0% +11111010100: 0% +11111010101: 0% +11111010110: 0% +11111010111: 0% +11111011000: 0% +11111011001: 0% +11111011010: 0% +11111011011: 0% +11111011100: 0% +11111011101: 0% +11111011110: 0% +11111011111: 0% +11111100000: 0% +11111100001: 0% +11111100010: 0% +11111100011: 0% +11111100100: 0% +11111100101: 0% +11111100110: 0% +11111100111: 0% +11111101000: 0% +11111101001: 0% +11111101010: 0% +11111101011: 0% +11111101100: 0% +11111101101: 0% +11111101110: 0% +11111101111: 0% +11111110000: 0% +11111110001: 0% +11111110010: 0% +11111110011: 0% +11111110100: 0% +11111110101: 0% +11111110110: 0% +11111110111: 0% +11111111000: 0% +11111111001: 0% +11111111010: 0% +11111111011: 0% +11111111100: 0% +11111111101: 0% +11111111110: 0% +11111111111: 0% diff --git a/po b/po new file mode 100644 index 0000000..4bd0fbc --- /dev/null +++ b/po @@ -0,0 +1,2048 @@ +00000000000: 12% +00000000001: 0% +00000000010: 12% +00000000011: 0% +00000000100: 12% +00000000101: 0% +00000000110: 12% +00000000111: 0% +00000001000: 12% +00000001001: 0% +00000001010: 12% +00000001011: 0% +00000001100: 12% +00000001101: 0% +00000001110: 12% +00000001111: 0% +00000010000: 0% +00000010001: 0% +00000010010: 0% +00000010011: 0% +00000010100: 0% +00000010101: 0% +00000010110: 0% +00000010111: 0% +00000011000: 0% +00000011001: 0% +00000011010: 0% +00000011011: 0% +00000011100: 0% +00000011101: 0% +00000011110: 0% +00000011111: 0% +00000100000: 0% +00000100001: 0% +00000100010: 0% +00000100011: 0% +00000100100: 0% +00000100101: 0% +00000100110: 0% +00000100111: 0% +00000101000: 0% +00000101001: 0% +00000101010: 0% +00000101011: 0% +00000101100: 0% +00000101101: 0% +00000101110: 0% +00000101111: 0% +00000110000: 0% +00000110001: 0% +00000110010: 0% +00000110011: 0% +00000110100: 0% +00000110101: 0% +00000110110: 0% +00000110111: 0% +00000111000: 0% +00000111001: 0% +00000111010: 0% +00000111011: 0% +00000111100: 0% +00000111101: 0% +00000111110: 0% +00000111111: 0% +00001000000: 0% +00001000001: 0% +00001000010: 0% +00001000011: 0% +00001000100: 0% +00001000101: 0% +00001000110: 0% +00001000111: 0% +00001001000: 0% +00001001001: 0% +00001001010: 0% +00001001011: 0% +00001001100: 0% +00001001101: 0% +00001001110: 0% +00001001111: 0% +00001010000: 0% +00001010001: 0% +00001010010: 0% +00001010011: 0% +00001010100: 0% +00001010101: 0% +00001010110: 0% +00001010111: 0% +00001011000: 0% +00001011001: 0% +00001011010: 0% +00001011011: 0% +00001011100: 0% +00001011101: 0% +00001011110: 0% +00001011111: 0% +00001100000: 0% +00001100001: 0% +00001100010: 0% +00001100011: 0% +00001100100: 0% +00001100101: 0% +00001100110: 0% +00001100111: 0% +00001101000: 0% +00001101001: 0% +00001101010: 0% +00001101011: 0% +00001101100: 0% +00001101101: 0% +00001101110: 0% +00001101111: 0% +00001110000: 0% +00001110001: 0% +00001110010: 0% +00001110011: 0% +00001110100: 0% +00001110101: 0% +00001110110: 0% +00001110111: 0% +00001111000: 0% +00001111001: 0% +00001111010: 0% +00001111011: 0% +00001111100: 0% +00001111101: 0% +00001111110: 0% +00001111111: 0% +00010000000: 0% +00010000001: 0% +00010000010: 0% +00010000011: 0% +00010000100: 0% +00010000101: 0% +00010000110: 0% +00010000111: 0% +00010001000: 0% +00010001001: 0% +00010001010: 0% +00010001011: 0% +00010001100: 0% +00010001101: 0% +00010001110: 0% +00010001111: 0% +00010010000: 0% +00010010001: 0% +00010010010: 0% +00010010011: 0% +00010010100: 0% +00010010101: 0% +00010010110: 0% +00010010111: 0% +00010011000: 0% +00010011001: 0% +00010011010: 0% +00010011011: 0% +00010011100: 0% +00010011101: 0% +00010011110: 0% +00010011111: 0% +00010100000: 0% +00010100001: 0% +00010100010: 0% +00010100011: 0% +00010100100: 0% +00010100101: 0% +00010100110: 0% +00010100111: 0% +00010101000: 0% +00010101001: 0% +00010101010: 0% +00010101011: 0% +00010101100: 0% +00010101101: 0% +00010101110: 0% +00010101111: 0% +00010110000: 0% +00010110001: 0% +00010110010: 0% +00010110011: 0% +00010110100: 0% +00010110101: 0% +00010110110: 0% +00010110111: 0% +00010111000: 0% +00010111001: 0% +00010111010: 0% +00010111011: 0% +00010111100: 0% +00010111101: 0% +00010111110: 0% +00010111111: 0% +00011000000: 0% +00011000001: 0% +00011000010: 0% +00011000011: 0% +00011000100: 0% +00011000101: 0% +00011000110: 0% +00011000111: 0% +00011001000: 0% +00011001001: 0% +00011001010: 0% +00011001011: 0% +00011001100: 0% +00011001101: 0% +00011001110: 0% +00011001111: 0% +00011010000: 0% +00011010001: 0% +00011010010: 0% +00011010011: 0% +00011010100: 0% +00011010101: 0% +00011010110: 0% +00011010111: 0% +00011011000: 0% +00011011001: 0% +00011011010: 0% +00011011011: 0% +00011011100: 0% +00011011101: 0% +00011011110: 0% +00011011111: 0% +00011100000: 0% +00011100001: 0% +00011100010: 0% +00011100011: 0% +00011100100: 0% +00011100101: 0% +00011100110: 0% +00011100111: 0% +00011101000: 0% +00011101001: 0% +00011101010: 0% +00011101011: 0% +00011101100: 0% +00011101101: 0% +00011101110: 0% +00011101111: 0% +00011110000: 0% +00011110001: 0% +00011110010: 0% +00011110011: 0% +00011110100: 0% +00011110101: 0% +00011110110: 0% +00011110111: 0% +00011111000: 0% +00011111001: 0% +00011111010: 0% +00011111011: 0% +00011111100: 0% +00011111101: 0% +00011111110: 0% +00011111111: 0% +00100000000: 0% +00100000001: 0% +00100000010: 0% +00100000011: 0% +00100000100: 0% +00100000101: 0% +00100000110: 0% +00100000111: 0% +00100001000: 0% +00100001001: 0% +00100001010: 0% +00100001011: 0% +00100001100: 0% +00100001101: 0% +00100001110: 0% +00100001111: 0% +00100010000: 0% +00100010001: 0% +00100010010: 0% +00100010011: 0% +00100010100: 0% +00100010101: 0% +00100010110: 0% +00100010111: 0% +00100011000: 0% +00100011001: 0% +00100011010: 0% +00100011011: 0% +00100011100: 0% +00100011101: 0% +00100011110: 0% +00100011111: 0% +00100100000: 0% +00100100001: 0% +00100100010: 0% +00100100011: 0% +00100100100: 0% +00100100101: 0% +00100100110: 0% +00100100111: 0% +00100101000: 0% +00100101001: 0% +00100101010: 0% +00100101011: 0% +00100101100: 0% +00100101101: 0% +00100101110: 0% +00100101111: 0% +00100110000: 0% +00100110001: 0% +00100110010: 0% +00100110011: 0% +00100110100: 0% +00100110101: 0% +00100110110: 0% +00100110111: 0% +00100111000: 0% +00100111001: 0% +00100111010: 0% +00100111011: 0% +00100111100: 0% +00100111101: 0% +00100111110: 0% +00100111111: 0% +00101000000: 0% +00101000001: 0% +00101000010: 0% +00101000011: 0% +00101000100: 0% +00101000101: 0% +00101000110: 0% +00101000111: 0% +00101001000: 0% +00101001001: 0% +00101001010: 0% +00101001011: 0% +00101001100: 0% +00101001101: 0% +00101001110: 0% +00101001111: 0% +00101010000: 0% +00101010001: 0% +00101010010: 0% +00101010011: 0% +00101010100: 0% +00101010101: 0% +00101010110: 0% +00101010111: 0% +00101011000: 0% +00101011001: 0% +00101011010: 0% +00101011011: 0% +00101011100: 0% +00101011101: 0% +00101011110: 0% +00101011111: 0% +00101100000: 0% +00101100001: 0% +00101100010: 0% +00101100011: 0% +00101100100: 0% +00101100101: 0% +00101100110: 0% +00101100111: 0% +00101101000: 0% +00101101001: 0% +00101101010: 0% +00101101011: 0% +00101101100: 0% +00101101101: 0% +00101101110: 0% +00101101111: 0% +00101110000: 0% +00101110001: 0% +00101110010: 0% +00101110011: 0% +00101110100: 0% +00101110101: 0% +00101110110: 0% +00101110111: 0% +00101111000: 0% +00101111001: 0% +00101111010: 0% +00101111011: 0% +00101111100: 0% +00101111101: 0% +00101111110: 0% +00101111111: 0% +00110000000: 0% +00110000001: 0% +00110000010: 0% +00110000011: 0% +00110000100: 0% +00110000101: 0% +00110000110: 0% +00110000111: 0% +00110001000: 0% +00110001001: 0% +00110001010: 0% +00110001011: 0% +00110001100: 0% +00110001101: 0% +00110001110: 0% +00110001111: 0% +00110010000: 0% +00110010001: 0% +00110010010: 0% +00110010011: 0% +00110010100: 0% +00110010101: 0% +00110010110: 0% +00110010111: 0% +00110011000: 0% +00110011001: 0% +00110011010: 0% +00110011011: 0% +00110011100: 0% +00110011101: 0% +00110011110: 0% +00110011111: 0% +00110100000: 0% +00110100001: 0% +00110100010: 0% +00110100011: 0% +00110100100: 0% +00110100101: 0% +00110100110: 0% +00110100111: 0% +00110101000: 0% +00110101001: 0% +00110101010: 0% +00110101011: 0% +00110101100: 0% +00110101101: 0% +00110101110: 0% +00110101111: 0% +00110110000: 0% +00110110001: 0% +00110110010: 0% +00110110011: 0% +00110110100: 0% +00110110101: 0% +00110110110: 0% +00110110111: 0% +00110111000: 0% +00110111001: 0% +00110111010: 0% +00110111011: 0% +00110111100: 0% +00110111101: 0% +00110111110: 0% +00110111111: 0% +00111000000: 0% +00111000001: 0% +00111000010: 0% +00111000011: 0% +00111000100: 0% +00111000101: 0% +00111000110: 0% +00111000111: 0% +00111001000: 0% +00111001001: 0% +00111001010: 0% +00111001011: 0% +00111001100: 0% +00111001101: 0% +00111001110: 0% +00111001111: 0% +00111010000: 0% +00111010001: 0% +00111010010: 0% +00111010011: 0% +00111010100: 0% +00111010101: 0% +00111010110: 0% +00111010111: 0% +00111011000: 0% +00111011001: 0% +00111011010: 0% +00111011011: 0% +00111011100: 0% +00111011101: 0% +00111011110: 0% +00111011111: 0% +00111100000: 0% +00111100001: 0% +00111100010: 0% +00111100011: 0% +00111100100: 0% +00111100101: 0% +00111100110: 0% +00111100111: 0% +00111101000: 0% +00111101001: 0% +00111101010: 0% +00111101011: 0% +00111101100: 0% +00111101101: 0% +00111101110: 0% +00111101111: 0% +00111110000: 0% +00111110001: 0% +00111110010: 0% +00111110011: 0% +00111110100: 0% +00111110101: 0% +00111110110: 0% +00111110111: 0% +00111111000: 0% +00111111001: 0% +00111111010: 0% +00111111011: 0% +00111111100: 0% +00111111101: 0% +00111111110: 0% +00111111111: 0% +01000000000: 0% +01000000001: 0% +01000000010: 0% +01000000011: 0% +01000000100: 0% +01000000101: 0% +01000000110: 0% +01000000111: 0% +01000001000: 0% +01000001001: 0% +01000001010: 0% +01000001011: 0% +01000001100: 0% +01000001101: 0% +01000001110: 0% +01000001111: 0% +01000010000: 0% +01000010001: 0% +01000010010: 0% +01000010011: 0% +01000010100: 0% +01000010101: 0% +01000010110: 0% +01000010111: 0% +01000011000: 0% +01000011001: 0% +01000011010: 0% +01000011011: 0% +01000011100: 0% +01000011101: 0% +01000011110: 0% +01000011111: 0% +01000100000: 0% +01000100001: 0% +01000100010: 0% +01000100011: 0% +01000100100: 0% +01000100101: 0% +01000100110: 0% +01000100111: 0% +01000101000: 0% +01000101001: 0% +01000101010: 0% +01000101011: 0% +01000101100: 0% +01000101101: 0% +01000101110: 0% +01000101111: 0% +01000110000: 0% +01000110001: 0% +01000110010: 0% +01000110011: 0% +01000110100: 0% +01000110101: 0% +01000110110: 0% +01000110111: 0% +01000111000: 0% +01000111001: 0% +01000111010: 0% +01000111011: 0% +01000111100: 0% +01000111101: 0% +01000111110: 0% +01000111111: 0% +01001000000: 0% +01001000001: 0% +01001000010: 0% +01001000011: 0% +01001000100: 0% +01001000101: 0% +01001000110: 0% +01001000111: 0% +01001001000: 0% +01001001001: 0% +01001001010: 0% +01001001011: 0% +01001001100: 0% +01001001101: 0% +01001001110: 0% +01001001111: 0% +01001010000: 0% +01001010001: 0% +01001010010: 0% +01001010011: 0% +01001010100: 0% +01001010101: 0% +01001010110: 0% +01001010111: 0% +01001011000: 0% +01001011001: 0% +01001011010: 0% +01001011011: 0% +01001011100: 0% +01001011101: 0% +01001011110: 0% +01001011111: 0% +01001100000: 0% +01001100001: 0% +01001100010: 0% +01001100011: 0% +01001100100: 0% +01001100101: 0% +01001100110: 0% +01001100111: 0% +01001101000: 0% +01001101001: 0% +01001101010: 0% +01001101011: 0% +01001101100: 0% +01001101101: 0% +01001101110: 0% +01001101111: 0% +01001110000: 0% +01001110001: 0% +01001110010: 0% +01001110011: 0% +01001110100: 0% +01001110101: 0% +01001110110: 0% +01001110111: 0% +01001111000: 0% +01001111001: 0% +01001111010: 0% +01001111011: 0% +01001111100: 0% +01001111101: 0% +01001111110: 0% +01001111111: 0% +01010000000: 0% +01010000001: 0% +01010000010: 0% +01010000011: 0% +01010000100: 0% +01010000101: 0% +01010000110: 0% +01010000111: 0% +01010001000: 0% +01010001001: 0% +01010001010: 0% +01010001011: 0% +01010001100: 0% +01010001101: 0% +01010001110: 0% +01010001111: 0% +01010010000: 0% +01010010001: 0% +01010010010: 0% +01010010011: 0% +01010010100: 0% +01010010101: 0% +01010010110: 0% +01010010111: 0% +01010011000: 0% +01010011001: 0% +01010011010: 0% +01010011011: 0% +01010011100: 0% +01010011101: 0% +01010011110: 0% +01010011111: 0% +01010100000: 0% +01010100001: 0% +01010100010: 0% +01010100011: 0% +01010100100: 0% +01010100101: 0% +01010100110: 0% +01010100111: 0% +01010101000: 0% +01010101001: 0% +01010101010: 0% +01010101011: 0% +01010101100: 0% +01010101101: 0% +01010101110: 0% +01010101111: 0% +01010110000: 0% +01010110001: 0% +01010110010: 0% +01010110011: 0% +01010110100: 0% +01010110101: 0% +01010110110: 0% +01010110111: 0% +01010111000: 0% +01010111001: 0% +01010111010: 0% +01010111011: 0% +01010111100: 0% +01010111101: 0% +01010111110: 0% +01010111111: 0% +01011000000: 0% +01011000001: 0% +01011000010: 0% +01011000011: 0% +01011000100: 0% +01011000101: 0% +01011000110: 0% +01011000111: 0% +01011001000: 0% +01011001001: 0% +01011001010: 0% +01011001011: 0% +01011001100: 0% +01011001101: 0% +01011001110: 0% +01011001111: 0% +01011010000: 0% +01011010001: 0% +01011010010: 0% +01011010011: 0% +01011010100: 0% +01011010101: 0% +01011010110: 0% +01011010111: 0% +01011011000: 0% +01011011001: 0% +01011011010: 0% +01011011011: 0% +01011011100: 0% +01011011101: 0% +01011011110: 0% +01011011111: 0% +01011100000: 0% +01011100001: 0% +01011100010: 0% +01011100011: 0% +01011100100: 0% +01011100101: 0% +01011100110: 0% +01011100111: 0% +01011101000: 0% +01011101001: 0% +01011101010: 0% +01011101011: 0% +01011101100: 0% +01011101101: 0% +01011101110: 0% +01011101111: 0% +01011110000: 0% +01011110001: 0% +01011110010: 0% +01011110011: 0% +01011110100: 0% +01011110101: 0% +01011110110: 0% +01011110111: 0% +01011111000: 0% +01011111001: 0% +01011111010: 0% +01011111011: 0% +01011111100: 0% +01011111101: 0% +01011111110: 0% +01011111111: 0% +01100000000: 0% +01100000001: 0% +01100000010: 0% +01100000011: 0% +01100000100: 0% +01100000101: 0% +01100000110: 0% +01100000111: 0% +01100001000: 0% +01100001001: 0% +01100001010: 0% +01100001011: 0% +01100001100: 0% +01100001101: 0% +01100001110: 0% +01100001111: 0% +01100010000: 0% +01100010001: 0% +01100010010: 0% +01100010011: 0% +01100010100: 0% +01100010101: 0% +01100010110: 0% +01100010111: 0% +01100011000: 0% +01100011001: 0% +01100011010: 0% +01100011011: 0% +01100011100: 0% +01100011101: 0% +01100011110: 0% +01100011111: 0% +01100100000: 0% +01100100001: 0% +01100100010: 0% +01100100011: 0% +01100100100: 0% +01100100101: 0% +01100100110: 0% +01100100111: 0% +01100101000: 0% +01100101001: 0% +01100101010: 0% +01100101011: 0% +01100101100: 0% +01100101101: 0% +01100101110: 0% +01100101111: 0% +01100110000: 0% +01100110001: 0% +01100110010: 0% +01100110011: 0% +01100110100: 0% +01100110101: 0% +01100110110: 0% +01100110111: 0% +01100111000: 0% +01100111001: 0% +01100111010: 0% +01100111011: 0% +01100111100: 0% +01100111101: 0% +01100111110: 0% +01100111111: 0% +01101000000: 0% +01101000001: 0% +01101000010: 0% +01101000011: 0% +01101000100: 0% +01101000101: 0% +01101000110: 0% +01101000111: 0% +01101001000: 0% +01101001001: 0% +01101001010: 0% +01101001011: 0% +01101001100: 0% +01101001101: 0% +01101001110: 0% +01101001111: 0% +01101010000: 0% +01101010001: 0% +01101010010: 0% +01101010011: 0% +01101010100: 0% +01101010101: 0% +01101010110: 0% +01101010111: 0% +01101011000: 0% +01101011001: 0% +01101011010: 0% +01101011011: 0% +01101011100: 0% +01101011101: 0% +01101011110: 0% +01101011111: 0% +01101100000: 0% +01101100001: 0% +01101100010: 0% +01101100011: 0% +01101100100: 0% +01101100101: 0% +01101100110: 0% +01101100111: 0% +01101101000: 0% +01101101001: 0% +01101101010: 0% +01101101011: 0% +01101101100: 0% +01101101101: 0% +01101101110: 0% +01101101111: 0% +01101110000: 0% +01101110001: 0% +01101110010: 0% +01101110011: 0% +01101110100: 0% +01101110101: 0% +01101110110: 0% +01101110111: 0% +01101111000: 0% +01101111001: 0% +01101111010: 0% +01101111011: 0% +01101111100: 0% +01101111101: 0% +01101111110: 0% +01101111111: 0% +01110000000: 0% +01110000001: 0% +01110000010: 0% +01110000011: 0% +01110000100: 0% +01110000101: 0% +01110000110: 0% +01110000111: 0% +01110001000: 0% +01110001001: 0% +01110001010: 0% +01110001011: 0% +01110001100: 0% +01110001101: 0% +01110001110: 0% +01110001111: 0% +01110010000: 0% +01110010001: 0% +01110010010: 0% +01110010011: 0% +01110010100: 0% +01110010101: 0% +01110010110: 0% +01110010111: 0% +01110011000: 0% +01110011001: 0% +01110011010: 0% +01110011011: 0% +01110011100: 0% +01110011101: 0% +01110011110: 0% +01110011111: 0% +01110100000: 0% +01110100001: 0% +01110100010: 0% +01110100011: 0% +01110100100: 0% +01110100101: 0% +01110100110: 0% +01110100111: 0% +01110101000: 0% +01110101001: 0% +01110101010: 0% +01110101011: 0% +01110101100: 0% +01110101101: 0% +01110101110: 0% +01110101111: 0% +01110110000: 0% +01110110001: 0% +01110110010: 0% +01110110011: 0% +01110110100: 0% +01110110101: 0% +01110110110: 0% +01110110111: 0% +01110111000: 0% +01110111001: 0% +01110111010: 0% +01110111011: 0% +01110111100: 0% +01110111101: 0% +01110111110: 0% +01110111111: 0% +01111000000: 0% +01111000001: 0% +01111000010: 0% +01111000011: 0% +01111000100: 0% +01111000101: 0% +01111000110: 0% +01111000111: 0% +01111001000: 0% +01111001001: 0% +01111001010: 0% +01111001011: 0% +01111001100: 0% +01111001101: 0% +01111001110: 0% +01111001111: 0% +01111010000: 0% +01111010001: 0% +01111010010: 0% +01111010011: 0% +01111010100: 0% +01111010101: 0% +01111010110: 0% +01111010111: 0% +01111011000: 0% +01111011001: 0% +01111011010: 0% +01111011011: 0% +01111011100: 0% +01111011101: 0% +01111011110: 0% +01111011111: 0% +01111100000: 0% +01111100001: 0% +01111100010: 0% +01111100011: 0% +01111100100: 0% +01111100101: 0% +01111100110: 0% +01111100111: 0% +01111101000: 0% +01111101001: 0% +01111101010: 0% +01111101011: 0% +01111101100: 0% +01111101101: 0% +01111101110: 0% +01111101111: 0% +01111110000: 0% +01111110001: 0% +01111110010: 0% +01111110011: 0% +01111110100: 0% +01111110101: 0% +01111110110: 0% +01111110111: 0% +01111111000: 0% +01111111001: 0% +01111111010: 0% +01111111011: 0% +01111111100: 0% +01111111101: 0% +01111111110: 0% +01111111111: 0% +10000000000: 0% +10000000001: 0% +10000000010: 0% +10000000011: 0% +10000000100: 0% +10000000101: 0% +10000000110: 0% +10000000111: 0% +10000001000: 0% +10000001001: 0% +10000001010: 0% +10000001011: 0% +10000001100: 0% +10000001101: 0% +10000001110: 0% +10000001111: 0% +10000010000: 0% +10000010001: 0% +10000010010: 0% +10000010011: 0% +10000010100: 0% +10000010101: 0% +10000010110: 0% +10000010111: 0% +10000011000: 0% +10000011001: 0% +10000011010: 0% +10000011011: 0% +10000011100: 0% +10000011101: 0% +10000011110: 0% +10000011111: 0% +10000100000: 0% +10000100001: 0% +10000100010: 0% +10000100011: 0% +10000100100: 0% +10000100101: 0% +10000100110: 0% +10000100111: 0% +10000101000: 0% +10000101001: 0% +10000101010: 0% +10000101011: 0% +10000101100: 0% +10000101101: 0% +10000101110: 0% +10000101111: 0% +10000110000: 0% +10000110001: 0% +10000110010: 0% +10000110011: 0% +10000110100: 0% +10000110101: 0% +10000110110: 0% +10000110111: 0% +10000111000: 0% +10000111001: 0% +10000111010: 0% +10000111011: 0% +10000111100: 0% +10000111101: 0% +10000111110: 0% +10000111111: 0% +10001000000: 0% +10001000001: 0% +10001000010: 0% +10001000011: 0% +10001000100: 0% +10001000101: 0% +10001000110: 0% +10001000111: 0% +10001001000: 0% +10001001001: 0% +10001001010: 0% +10001001011: 0% +10001001100: 0% +10001001101: 0% +10001001110: 0% +10001001111: 0% +10001010000: 0% +10001010001: 0% +10001010010: 0% +10001010011: 0% +10001010100: 0% +10001010101: 0% +10001010110: 0% +10001010111: 0% +10001011000: 0% +10001011001: 0% +10001011010: 0% +10001011011: 0% +10001011100: 0% +10001011101: 0% +10001011110: 0% +10001011111: 0% +10001100000: 0% +10001100001: 0% +10001100010: 0% +10001100011: 0% +10001100100: 0% +10001100101: 0% +10001100110: 0% +10001100111: 0% +10001101000: 0% +10001101001: 0% +10001101010: 0% +10001101011: 0% +10001101100: 0% +10001101101: 0% +10001101110: 0% +10001101111: 0% +10001110000: 0% +10001110001: 0% +10001110010: 0% +10001110011: 0% +10001110100: 0% +10001110101: 0% +10001110110: 0% +10001110111: 0% +10001111000: 0% +10001111001: 0% +10001111010: 0% +10001111011: 0% +10001111100: 0% +10001111101: 0% +10001111110: 0% +10001111111: 0% +10010000000: 0% +10010000001: 0% +10010000010: 0% +10010000011: 0% +10010000100: 0% +10010000101: 0% +10010000110: 0% +10010000111: 0% +10010001000: 0% +10010001001: 0% +10010001010: 0% +10010001011: 0% +10010001100: 0% +10010001101: 0% +10010001110: 0% +10010001111: 0% +10010010000: 0% +10010010001: 0% +10010010010: 0% +10010010011: 0% +10010010100: 0% +10010010101: 0% +10010010110: 0% +10010010111: 0% +10010011000: 0% +10010011001: 0% +10010011010: 0% +10010011011: 0% +10010011100: 0% +10010011101: 0% +10010011110: 0% +10010011111: 0% +10010100000: 0% +10010100001: 0% +10010100010: 0% +10010100011: 0% +10010100100: 0% +10010100101: 0% +10010100110: 0% +10010100111: 0% +10010101000: 0% +10010101001: 0% +10010101010: 0% +10010101011: 0% +10010101100: 0% +10010101101: 0% +10010101110: 0% +10010101111: 0% +10010110000: 0% +10010110001: 0% +10010110010: 0% +10010110011: 0% +10010110100: 0% +10010110101: 0% +10010110110: 0% +10010110111: 0% +10010111000: 0% +10010111001: 0% +10010111010: 0% +10010111011: 0% +10010111100: 0% +10010111101: 0% +10010111110: 0% +10010111111: 0% +10011000000: 0% +10011000001: 0% +10011000010: 0% +10011000011: 0% +10011000100: 0% +10011000101: 0% +10011000110: 0% +10011000111: 0% +10011001000: 0% +10011001001: 0% +10011001010: 0% +10011001011: 0% +10011001100: 0% +10011001101: 0% +10011001110: 0% +10011001111: 0% +10011010000: 0% +10011010001: 0% +10011010010: 0% +10011010011: 0% +10011010100: 0% +10011010101: 0% +10011010110: 0% +10011010111: 0% +10011011000: 0% +10011011001: 0% +10011011010: 0% +10011011011: 0% +10011011100: 0% +10011011101: 0% +10011011110: 0% +10011011111: 0% +10011100000: 0% +10011100001: 0% +10011100010: 0% +10011100011: 0% +10011100100: 0% +10011100101: 0% +10011100110: 0% +10011100111: 0% +10011101000: 0% +10011101001: 0% +10011101010: 0% +10011101011: 0% +10011101100: 0% +10011101101: 0% +10011101110: 0% +10011101111: 0% +10011110000: 0% +10011110001: 0% +10011110010: 0% +10011110011: 0% +10011110100: 0% +10011110101: 0% +10011110110: 0% +10011110111: 0% +10011111000: 0% +10011111001: 0% +10011111010: 0% +10011111011: 0% +10011111100: 0% +10011111101: 0% +10011111110: 0% +10011111111: 0% +10100000000: 0% +10100000001: 0% +10100000010: 0% +10100000011: 0% +10100000100: 0% +10100000101: 0% +10100000110: 0% +10100000111: 0% +10100001000: 0% +10100001001: 0% +10100001010: 0% +10100001011: 0% +10100001100: 0% +10100001101: 0% +10100001110: 0% +10100001111: 0% +10100010000: 0% +10100010001: 0% +10100010010: 0% +10100010011: 0% +10100010100: 0% +10100010101: 0% +10100010110: 0% +10100010111: 0% +10100011000: 0% +10100011001: 0% +10100011010: 0% +10100011011: 0% +10100011100: 0% +10100011101: 0% +10100011110: 0% +10100011111: 0% +10100100000: 0% +10100100001: 0% +10100100010: 0% +10100100011: 0% +10100100100: 0% +10100100101: 0% +10100100110: 0% +10100100111: 0% +10100101000: 0% +10100101001: 0% +10100101010: 0% +10100101011: 0% +10100101100: 0% +10100101101: 0% +10100101110: 0% +10100101111: 0% +10100110000: 0% +10100110001: 0% +10100110010: 0% +10100110011: 0% +10100110100: 0% +10100110101: 0% +10100110110: 0% +10100110111: 0% +10100111000: 0% +10100111001: 0% +10100111010: 0% +10100111011: 0% +10100111100: 0% +10100111101: 0% +10100111110: 0% +10100111111: 0% +10101000000: 0% +10101000001: 0% +10101000010: 0% +10101000011: 0% +10101000100: 0% +10101000101: 0% +10101000110: 0% +10101000111: 0% +10101001000: 0% +10101001001: 0% +10101001010: 0% +10101001011: 0% +10101001100: 0% +10101001101: 0% +10101001110: 0% +10101001111: 0% +10101010000: 0% +10101010001: 0% +10101010010: 0% +10101010011: 0% +10101010100: 0% +10101010101: 0% +10101010110: 0% +10101010111: 0% +10101011000: 0% +10101011001: 0% +10101011010: 0% +10101011011: 0% +10101011100: 0% +10101011101: 0% +10101011110: 0% +10101011111: 0% +10101100000: 0% +10101100001: 0% +10101100010: 0% +10101100011: 0% +10101100100: 0% +10101100101: 0% +10101100110: 0% +10101100111: 0% +10101101000: 0% +10101101001: 0% +10101101010: 0% +10101101011: 0% +10101101100: 0% +10101101101: 0% +10101101110: 0% +10101101111: 0% +10101110000: 0% +10101110001: 0% +10101110010: 0% +10101110011: 0% +10101110100: 0% +10101110101: 0% +10101110110: 0% +10101110111: 0% +10101111000: 0% +10101111001: 0% +10101111010: 0% +10101111011: 0% +10101111100: 0% +10101111101: 0% +10101111110: 0% +10101111111: 0% +10110000000: 0% +10110000001: 0% +10110000010: 0% +10110000011: 0% +10110000100: 0% +10110000101: 0% +10110000110: 0% +10110000111: 0% +10110001000: 0% +10110001001: 0% +10110001010: 0% +10110001011: 0% +10110001100: 0% +10110001101: 0% +10110001110: 0% +10110001111: 0% +10110010000: 0% +10110010001: 0% +10110010010: 0% +10110010011: 0% +10110010100: 0% +10110010101: 0% +10110010110: 0% +10110010111: 0% +10110011000: 0% +10110011001: 0% +10110011010: 0% +10110011011: 0% +10110011100: 0% +10110011101: 0% +10110011110: 0% +10110011111: 0% +10110100000: 0% +10110100001: 0% +10110100010: 0% +10110100011: 0% +10110100100: 0% +10110100101: 0% +10110100110: 0% +10110100111: 0% +10110101000: 0% +10110101001: 0% +10110101010: 0% +10110101011: 0% +10110101100: 0% +10110101101: 0% +10110101110: 0% +10110101111: 0% +10110110000: 0% +10110110001: 0% +10110110010: 0% +10110110011: 0% +10110110100: 0% +10110110101: 0% +10110110110: 0% +10110110111: 0% +10110111000: 0% +10110111001: 0% +10110111010: 0% +10110111011: 0% +10110111100: 0% +10110111101: 0% +10110111110: 0% +10110111111: 0% +10111000000: 0% +10111000001: 0% +10111000010: 0% +10111000011: 0% +10111000100: 0% +10111000101: 0% +10111000110: 0% +10111000111: 0% +10111001000: 0% +10111001001: 0% +10111001010: 0% +10111001011: 0% +10111001100: 0% +10111001101: 0% +10111001110: 0% +10111001111: 0% +10111010000: 0% +10111010001: 0% +10111010010: 0% +10111010011: 0% +10111010100: 0% +10111010101: 0% +10111010110: 0% +10111010111: 0% +10111011000: 0% +10111011001: 0% +10111011010: 0% +10111011011: 0% +10111011100: 0% +10111011101: 0% +10111011110: 0% +10111011111: 0% +10111100000: 0% +10111100001: 0% +10111100010: 0% +10111100011: 0% +10111100100: 0% +10111100101: 0% +10111100110: 0% +10111100111: 0% +10111101000: 0% +10111101001: 0% +10111101010: 0% +10111101011: 0% +10111101100: 0% +10111101101: 0% +10111101110: 0% +10111101111: 0% +10111110000: 0% +10111110001: 0% +10111110010: 0% +10111110011: 0% +10111110100: 0% +10111110101: 0% +10111110110: 0% +10111110111: 0% +10111111000: 0% +10111111001: 0% +10111111010: 0% +10111111011: 0% +10111111100: 0% +10111111101: 0% +10111111110: 0% +10111111111: 0% +11000000000: 0% +11000000001: 0% +11000000010: 0% +11000000011: 0% +11000000100: 0% +11000000101: 0% +11000000110: 0% +11000000111: 0% +11000001000: 0% +11000001001: 0% +11000001010: 0% +11000001011: 0% +11000001100: 0% +11000001101: 0% +11000001110: 0% +11000001111: 0% +11000010000: 0% +11000010001: 0% +11000010010: 0% +11000010011: 0% +11000010100: 0% +11000010101: 0% +11000010110: 0% +11000010111: 0% +11000011000: 0% +11000011001: 0% +11000011010: 0% +11000011011: 0% +11000011100: 0% +11000011101: 0% +11000011110: 0% +11000011111: 0% +11000100000: 0% +11000100001: 0% +11000100010: 0% +11000100011: 0% +11000100100: 0% +11000100101: 0% +11000100110: 0% +11000100111: 0% +11000101000: 0% +11000101001: 0% +11000101010: 0% +11000101011: 0% +11000101100: 0% +11000101101: 0% +11000101110: 0% +11000101111: 0% +11000110000: 0% +11000110001: 0% +11000110010: 0% +11000110011: 0% +11000110100: 0% +11000110101: 0% +11000110110: 0% +11000110111: 0% +11000111000: 0% +11000111001: 0% +11000111010: 0% +11000111011: 0% +11000111100: 0% +11000111101: 0% +11000111110: 0% +11000111111: 0% +11001000000: 0% +11001000001: 0% +11001000010: 0% +11001000011: 0% +11001000100: 0% +11001000101: 0% +11001000110: 0% +11001000111: 0% +11001001000: 0% +11001001001: 0% +11001001010: 0% +11001001011: 0% +11001001100: 0% +11001001101: 0% +11001001110: 0% +11001001111: 0% +11001010000: 0% +11001010001: 0% +11001010010: 0% +11001010011: 0% +11001010100: 0% +11001010101: 0% +11001010110: 0% +11001010111: 0% +11001011000: 0% +11001011001: 0% +11001011010: 0% +11001011011: 0% +11001011100: 0% +11001011101: 0% +11001011110: 0% +11001011111: 0% +11001100000: 0% +11001100001: 0% +11001100010: 0% +11001100011: 0% +11001100100: 0% +11001100101: 0% +11001100110: 0% +11001100111: 0% +11001101000: 0% +11001101001: 0% +11001101010: 0% +11001101011: 0% +11001101100: 0% +11001101101: 0% +11001101110: 0% +11001101111: 0% +11001110000: 0% +11001110001: 0% +11001110010: 0% +11001110011: 0% +11001110100: 0% +11001110101: 0% +11001110110: 0% +11001110111: 0% +11001111000: 0% +11001111001: 0% +11001111010: 0% +11001111011: 0% +11001111100: 0% +11001111101: 0% +11001111110: 0% +11001111111: 0% +11010000000: 0% +11010000001: 0% +11010000010: 0% +11010000011: 0% +11010000100: 0% +11010000101: 0% +11010000110: 0% +11010000111: 0% +11010001000: 0% +11010001001: 0% +11010001010: 0% +11010001011: 0% +11010001100: 0% +11010001101: 0% +11010001110: 0% +11010001111: 0% +11010010000: 0% +11010010001: 0% +11010010010: 0% +11010010011: 0% +11010010100: 0% +11010010101: 0% +11010010110: 0% +11010010111: 0% +11010011000: 0% +11010011001: 0% +11010011010: 0% +11010011011: 0% +11010011100: 0% +11010011101: 0% +11010011110: 0% +11010011111: 0% +11010100000: 0% +11010100001: 0% +11010100010: 0% +11010100011: 0% +11010100100: 0% +11010100101: 0% +11010100110: 0% +11010100111: 0% +11010101000: 0% +11010101001: 0% +11010101010: 0% +11010101011: 0% +11010101100: 0% +11010101101: 0% +11010101110: 0% +11010101111: 0% +11010110000: 0% +11010110001: 0% +11010110010: 0% +11010110011: 0% +11010110100: 0% +11010110101: 0% +11010110110: 0% +11010110111: 0% +11010111000: 0% +11010111001: 0% +11010111010: 0% +11010111011: 0% +11010111100: 0% +11010111101: 0% +11010111110: 0% +11010111111: 0% +11011000000: 0% +11011000001: 0% +11011000010: 0% +11011000011: 0% +11011000100: 0% +11011000101: 0% +11011000110: 0% +11011000111: 0% +11011001000: 0% +11011001001: 0% +11011001010: 0% +11011001011: 0% +11011001100: 0% +11011001101: 0% +11011001110: 0% +11011001111: 0% +11011010000: 0% +11011010001: 0% +11011010010: 0% +11011010011: 0% +11011010100: 0% +11011010101: 0% +11011010110: 0% +11011010111: 0% +11011011000: 0% +11011011001: 0% +11011011010: 0% +11011011011: 0% +11011011100: 0% +11011011101: 0% +11011011110: 0% +11011011111: 0% +11011100000: 0% +11011100001: 0% +11011100010: 0% +11011100011: 0% +11011100100: 0% +11011100101: 0% +11011100110: 0% +11011100111: 0% +11011101000: 0% +11011101001: 0% +11011101010: 0% +11011101011: 0% +11011101100: 0% +11011101101: 0% +11011101110: 0% +11011101111: 0% +11011110000: 0% +11011110001: 0% +11011110010: 0% +11011110011: 0% +11011110100: 0% +11011110101: 0% +11011110110: 0% +11011110111: 0% +11011111000: 0% +11011111001: 0% +11011111010: 0% +11011111011: 0% +11011111100: 0% +11011111101: 0% +11011111110: 0% +11011111111: 0% +11100000000: 0% +11100000001: 0% +11100000010: 0% +11100000011: 0% +11100000100: 0% +11100000101: 0% +11100000110: 0% +11100000111: 0% +11100001000: 0% +11100001001: 0% +11100001010: 0% +11100001011: 0% +11100001100: 0% +11100001101: 0% +11100001110: 0% +11100001111: 0% +11100010000: 0% +11100010001: 0% +11100010010: 0% +11100010011: 0% +11100010100: 0% +11100010101: 0% +11100010110: 0% +11100010111: 0% +11100011000: 0% +11100011001: 0% +11100011010: 0% +11100011011: 0% +11100011100: 0% +11100011101: 0% +11100011110: 0% +11100011111: 0% +11100100000: 0% +11100100001: 0% +11100100010: 0% +11100100011: 0% +11100100100: 0% +11100100101: 0% +11100100110: 0% +11100100111: 0% +11100101000: 0% +11100101001: 0% +11100101010: 0% +11100101011: 0% +11100101100: 0% +11100101101: 0% +11100101110: 0% +11100101111: 0% +11100110000: 0% +11100110001: 0% +11100110010: 0% +11100110011: 0% +11100110100: 0% +11100110101: 0% +11100110110: 0% +11100110111: 0% +11100111000: 0% +11100111001: 0% +11100111010: 0% +11100111011: 0% +11100111100: 0% +11100111101: 0% +11100111110: 0% +11100111111: 0% +11101000000: 0% +11101000001: 0% +11101000010: 0% +11101000011: 0% +11101000100: 0% +11101000101: 0% +11101000110: 0% +11101000111: 0% +11101001000: 0% +11101001001: 0% +11101001010: 0% +11101001011: 0% +11101001100: 0% +11101001101: 0% +11101001110: 0% +11101001111: 0% +11101010000: 0% +11101010001: 0% +11101010010: 0% +11101010011: 0% +11101010100: 0% +11101010101: 0% +11101010110: 0% +11101010111: 0% +11101011000: 0% +11101011001: 0% +11101011010: 0% +11101011011: 0% +11101011100: 0% +11101011101: 0% +11101011110: 0% +11101011111: 0% +11101100000: 0% +11101100001: 0% +11101100010: 0% +11101100011: 0% +11101100100: 0% +11101100101: 0% +11101100110: 0% +11101100111: 0% +11101101000: 0% +11101101001: 0% +11101101010: 0% +11101101011: 0% +11101101100: 0% +11101101101: 0% +11101101110: 0% +11101101111: 0% +11101110000: 0% +11101110001: 0% +11101110010: 0% +11101110011: 0% +11101110100: 0% +11101110101: 0% +11101110110: 0% +11101110111: 0% +11101111000: 0% +11101111001: 0% +11101111010: 0% +11101111011: 0% +11101111100: 0% +11101111101: 0% +11101111110: 0% +11101111111: 0% +11110000000: 0% +11110000001: 0% +11110000010: 0% +11110000011: 0% +11110000100: 0% +11110000101: 0% +11110000110: 0% +11110000111: 0% +11110001000: 0% +11110001001: 0% +11110001010: 0% +11110001011: 0% +11110001100: 0% +11110001101: 0% +11110001110: 0% +11110001111: 0% +11110010000: 0% +11110010001: 0% +11110010010: 0% +11110010011: 0% +11110010100: 0% +11110010101: 0% +11110010110: 0% +11110010111: 0% +11110011000: 0% +11110011001: 0% +11110011010: 0% +11110011011: 0% +11110011100: 0% +11110011101: 0% +11110011110: 0% +11110011111: 0% +11110100000: 0% +11110100001: 0% +11110100010: 0% +11110100011: 0% +11110100100: 0% +11110100101: 0% +11110100110: 0% +11110100111: 0% +11110101000: 0% +11110101001: 0% +11110101010: 0% +11110101011: 0% +11110101100: 0% +11110101101: 0% +11110101110: 0% +11110101111: 0% +11110110000: 0% +11110110001: 0% +11110110010: 0% +11110110011: 0% +11110110100: 0% +11110110101: 0% +11110110110: 0% +11110110111: 0% +11110111000: 0% +11110111001: 0% +11110111010: 0% +11110111011: 0% +11110111100: 0% +11110111101: 0% +11110111110: 0% +11110111111: 0% +11111000000: 0% +11111000001: 0% +11111000010: 0% +11111000011: 0% +11111000100: 0% +11111000101: 0% +11111000110: 0% +11111000111: 0% +11111001000: 0% +11111001001: 0% +11111001010: 0% +11111001011: 0% +11111001100: 0% +11111001101: 0% +11111001110: 0% +11111001111: 0% +11111010000: 0% +11111010001: 0% +11111010010: 0% +11111010011: 0% +11111010100: 0% +11111010101: 0% +11111010110: 0% +11111010111: 0% +11111011000: 0% +11111011001: 0% +11111011010: 0% +11111011011: 0% +11111011100: 0% +11111011101: 0% +11111011110: 0% +11111011111: 0% +11111100000: 0% +11111100001: 0% +11111100010: 0% +11111100011: 0% +11111100100: 0% +11111100101: 0% +11111100110: 0% +11111100111: 0% +11111101000: 0% +11111101001: 0% +11111101010: 0% +11111101011: 0% +11111101100: 0% +11111101101: 0% +11111101110: 0% +11111101111: 0% +11111110000: 0% +11111110001: 0% +11111110010: 0% +11111110011: 0% +11111110100: 0% +11111110101: 0% +11111110110: 0% +11111110111: 0% +11111111000: 0% +11111111001: 0% +11111111010: 0% +11111111011: 0% +11111111100: 0% +11111111101: 0% +11111111110: 0% +11111111111: 0% diff --git a/src/QAnsel.c b/src/QAnsel.c index 716d0e1..af46dd8 100644 --- a/src/QAnsel.c +++ b/src/QAnsel.c @@ -45,12 +45,13 @@ double qansel_rand() { num = (num << 8) | block[i]; } + free(block); return ((double)num) / ((double)UINT32_MAX); } void qansel_cnot(cpx_mtx_t* stateVector, uint8_t qubitCount, uint8_t bitA, uint8_t bitB) { - uint32_t retLen = (uint8_t)pow(2, qubitCount); + uint32_t retLen = (uint32_t)pow(2, qubitCount); cpx_mtx_t ret; cpx_mtx_init(&ret, 1, retLen); cpx_t n; @@ -71,7 +72,7 @@ void qansel_cnot(cpx_mtx_t* stateVector, uint8_t qubitCount, uint8_t bitA, uint8 void qansel_swap(cpx_mtx_t* stateVector, uint8_t qubitCount, uint8_t bitA, uint8_t bitB) { - uint32_t retLen = (uint8_t)pow(2, qubitCount); + uint32_t retLen = (uint32_t)pow(2, qubitCount); cpx_mtx_t ret; cpx_mtx_init(&ret, 1, retLen); cpx_t n; @@ -93,7 +94,7 @@ void qansel_swap(cpx_mtx_t* stateVector, uint8_t qubitCount, uint8_t bitA, uint8 void qansel_fredkin(cpx_mtx_t* stateVector, uint8_t qubitCount, uint8_t bitA, uint8_t bitB, uint8_t bitC) { - uint32_t retLen = (uint8_t)pow(2, qubitCount); + uint32_t retLen = (uint32_t)pow(2, qubitCount); cpx_mtx_t ret; cpx_mtx_init(&ret, 1, retLen); cpx_t n; @@ -117,7 +118,7 @@ void qansel_fredkin(cpx_mtx_t* stateVector, uint8_t qubitCount, uint8_t bitA, ui void qansel_toffoli(cpx_mtx_t* stateVector, uint8_t qubitCount, uint8_t bitA, uint8_t bitB, uint8_t bitC) { - uint32_t retLen = (uint8_t)pow(2, qubitCount); + uint32_t retLen = (uint32_t)pow(2, qubitCount); cpx_mtx_t ret; cpx_mtx_init(&ret, 1, retLen); cpx_t n; @@ -193,7 +194,6 @@ void qansel_instruction(cpx_mtx_t* stateVector, uint8_t qubitCount, QInstr* inst for (uint8_t i = 1; i < qubitCount; i++) { - cpx_mtx_init(&tmp, filter.rows * 2, filter.cols * 2); if (qubit == i) { gate.ptr = gate_ptr; @@ -202,7 +202,17 @@ void qansel_instruction(cpx_mtx_t* stateVector, uint8_t qubitCount, QInstr* inst { gate.ptr = Identity; } - cpx_mtx_knk(&tmp, &filter, &gate); + + tmp.rows = filter.rows * gate.rows; + tmp.cols = filter.cols * gate.cols; + tmp.ptr = malloc((tmp.rows * 2) * (tmp.cols * 2) * sizeof(double)); + cpx_ncpx_knk_mt + ( + tmp.ptr, tmp.rows, tmp.cols, + filter.ptr, filter.rows, filter.cols, + gate.ptr, gate.rows, gate.cols + ); + free(filter.ptr); filter.ptr = tmp.ptr; filter.rows = tmp.rows; @@ -210,14 +220,17 @@ void qansel_instruction(cpx_mtx_t* stateVector, uint8_t qubitCount, QInstr* inst } cpx_mtx_init(&tmp, stateVector->rows, stateVector->cols); - cpx_mtx_mul(&tmp, stateVector, &filter); + cpx_ncpx_mmul_mt + ( + tmp.ptr, stateVector->ptr, filter.ptr, + stateVector->rows * 2, filter.cols * 2, stateVector->cols * 2 + ); free(stateVector->ptr); stateVector->ptr = tmp.ptr; free(filter.ptr); if (instr->n[0] == 'u') free(gate_ptr); } - uint8_t qansel_measure(cpx_mtx_t* stateVector, uint8_t qubitCount, uint8_t qubit) { uint32_t qubitCountPow2 = (uint32_t)pow(2, qubitCount); @@ -396,7 +409,7 @@ void qansel_run(uint8_t qubitCount, uint8_t bitCount, QInstr* instr, uint32_t in } printf("%.00f%%\n", prob * 100.0); } - else if (strcmp(instr[i].n, "reset") == 0) + else if (strcmp(instr[i].n, "reset_all") == 0) { cpx_mtx_set2(&stateVector, 0, 0, 1, 0); for (uint32_t j = 1; j < qubitCountPow2; j++) @@ -408,6 +421,20 @@ void qansel_run(uint8_t qubitCount, uint8_t bitCount, QInstr* instr, uint32_t in bitVector[j] = 0; } } + else if (strcmp(instr[i].n, "resetq") == 0) + { + uint8_t bit = qansel_measure(&stateVector, qubitCount, instr[i].q0); + if (bit) + { + instr[i].n[0] = 'x'; + instr[i].n[1] = 0; + qansel_instruction(&stateVector, qubitCount, instr + i); + } + } + else if (strcmp(instr[i].n, "resetc") == 0) + { + bitVector[instr[i].q0] = 0; + } else { qansel_instruction(&stateVector, qubitCount, instr + i); @@ -420,7 +447,7 @@ void qansel_run(uint8_t qubitCount, uint8_t bitCount, QInstr* instr, uint32_t in cpx_mtx_free(&stateVector); } -void main() +void main(int argc, char** argv) { char** lines = malloc(0); uint32_t* lineIDs = malloc(0); @@ -454,9 +481,16 @@ void main() else if (comment || (c == ' ' && skipSpaces)) {} else if (c != '\n' && c != '\t' && c != ';' && (c != ')' || inGate)) { + if (commentM == 1) + { + text = realloc(text, textLen + 1); + text[textLen++] = '/'; + commentM = 0; + } skipSpaces = 0; if (c >= 'A' && c <= 'Z') c += 'a' - 'A'; if (c == 'u') inGate = 1; + if (c == 'r') inGate = 1; text = realloc(text, textLen + 1); text[textLen++] = c; pc = c; @@ -487,7 +521,7 @@ void main() if (strlen(text) > 0) { free(text); - fprintf(stderr, "QAnsel: Invalid trailing text.\n"); + fprintf(stderr, "QAnsel: Invalid trailing text"); exit(1); } free(text); @@ -548,13 +582,13 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Instruction before initialization.\n"); + fprintf(stderr, "QAnsel: Instruction before initialization"); errFound = 1; break; } if (q0 < 0 || q0 >= qubitCount) { - fprintf(stderr, "QAnsel: Invalid index "); + fprintf(stderr, "QAnsel: Invalid index"); errFound = 1; break; } @@ -567,25 +601,141 @@ void main() instr[instrLen++].arg2 = a2; } else if + ( + memcmp("rx(", lines[i], 3) == 0 + || memcmp("ry(", lines[i], 3) == 0 + || memcmp("rz(", lines[i], 3) == 0 + ) + { + double angle; + char ty; + if (sscanf(lines[i], "r%c(%f/%f) q[%i]", &ty, &a0, &a1, &q0) == 4) + { + angle = a0 / a1; + } + else if (sscanf(lines[i], "r%c(%f/%fpi) q[%i]", &ty, &a0, &a1, &q0) == 4) + { + angle = a0 / (a1 * M_PI); + } + else if (sscanf(lines[i], "r%c(%f/pi) q[%i]", &ty, &a0, &q0) == 3) + { + angle = a0 / M_PI; + } + else if (sscanf(lines[i], "r%c(%f/-pi) q[%i]", &ty, &a0, &q0) == 3) + { + angle = a0 / -M_PI; + } + else if (sscanf(lines[i], "r%c(%fpi/%f) q[%i]", &ty, &a0, &a1, &q0) == 4) + { + angle = (a0 * M_PI) / a1; + } + else if (sscanf(lines[i], "r%c(pi/%f) q[%i]", &ty, &a0, &q0) == 3) + { + angle = M_PI / a0; + } + else if (sscanf(lines[i], "r%c(-pi/%f) q[%i]", &ty, &a0, &q0) == 3) + { + angle = -M_PI / a0; + } + else if (sscanf(lines[i], "r%c(%fpi/%fpi) q[%i]", &ty, &a0, &a1, &q0) == 4) + { + angle = (a0 * M_PI) / (a1 * M_PI); + } + else if (sscanf(lines[i], "r%c(pi/pi) q[%i]", &ty, &q0) == 2) + { + angle = 1; + } + else if (sscanf(lines[i], "r%c(-pi/pi) q[%i]", &ty, &q0) == 2) + { + angle = -1; + } + else if (sscanf(lines[i], "r%c(pi/-pi) q[%i]", &ty, &q0) == 2) + { + angle = -1; + } + else if (sscanf(lines[i], "r%c(-pi/-pi) q[%i]", &ty, &q0) == 2) + { + angle = 1; + } + else if (sscanf(lines[i], "r%c(%fpi) q[%i]", &ty, &a0, &q0) == 3) + { + angle = a0 * M_PI; + } + else if (sscanf(lines[i], "r%c(pi) q[%i]", &ty, &q0) == 2) + { + angle = M_PI; + } + else if (sscanf(lines[i], "r%c(-pi) q[%i]", &ty, &q0) == 2) + { + angle = -M_PI; + } + else if (sscanf(lines[i], "r%c(%f) q[%i]", &ty, &a0, &q0) == 2) + { + angle = a0; + } + else + { + fprintf(stderr, "QAnsel: Syntax error"); + errFound = 1; + break; + } + if (qubitCount == 0xFF) + { + fprintf(stderr, "QAnsel: Instruction before initialization"); + errFound = 1; + break; + } + if (q0 < 0 || q0 >= qubitCount) + { + fprintf(stderr, "QAnsel: Invalid index"); + errFound = 1; + break; + } + + instr = realloc(instr, (instrLen + 1) * sizeof(QInstr)); + instr[instrLen].n[0] = 'u'; + instr[instrLen].n[1] = 0; + instr[instrLen].q0 = q0; + switch (ty) + { + case 'x': + instr[instrLen].arg0 = M_PI / 2; + instr[instrLen].arg1 = -M_PI / 2; + instr[instrLen].arg2 = angle - (M_PI / 2); + break; + case 'y': + instr[instrLen].arg0 = angle; + instr[instrLen].arg1 = 0; + instr[instrLen].arg2 = 0; + break; + case 'z': + instr[instrLen].arg0 = 0; + instr[instrLen].arg1 = 0; + instr[instrLen].arg2 = angle; + break; + } + instrLen++; + } + else if ( sscanf(lines[i], "h q[%i]", &q0) == 1 || sscanf(lines[i], "x q[%i]", &q0) == 1 || sscanf(lines[i], "y q[%i]", &q0) == 1 || sscanf(lines[i], "z q[%i]", &q0) == 1 || sscanf(lines[i], "t q[%i]", &q0) == 1 - || sscanf(lines[i], "z q[%i]", &q0) == 1 + || sscanf(lines[i], "s q[%i]", &q0) == 1 ) { g = lines[i][0]; if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Instruction before initialization.\n"); + fprintf(stderr, "QAnsel: Instruction before initialization"); errFound = 1; break; } if (q0 < 0 || q0 >= qubitCount) { - fprintf(stderr, "QAnsel: Invalid index "); + fprintf(stderr, "QAnsel: Invalid index"); errFound = 1; break; } @@ -598,7 +748,7 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Instruction before initialization.\n"); + fprintf(stderr, "QAnsel: Instruction before initialization"); errFound = 1; break; } @@ -617,7 +767,7 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Instruction before initialization.\n"); + fprintf(stderr, "QAnsel: Instruction before initialization"); errFound = 1; break; } @@ -640,13 +790,13 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Instruction before initialization.\n"); + fprintf(stderr, "QAnsel: Instruction before initialization"); errFound = 1; break; } if (qubitCount < 3) { - fprintf(stderr, "QAnsel: Three qubit gate used with insufficient qubits initialized.\n"); + fprintf(stderr, "QAnsel: Three qubit gate used with insufficient qubits initialized"); errFound = 1; break; } @@ -670,13 +820,13 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Instruction before initialization.\n"); + fprintf(stderr, "QAnsel: Instruction before initialization"); errFound = 1; break; } if (qubitCount < 3) { - fprintf(stderr, "QAnsel: Three qubit gate used with insufficient qubits initialized.\n"); + fprintf(stderr, "QAnsel: Three qubit gate used with insufficient qubits initialized"); errFound = 1; break; } @@ -696,7 +846,7 @@ void main() { if (bitCount == 0xFF) { - fprintf(stderr, "QAnsel: Measure instruction used before bit initialization.\n"); + fprintf(stderr, "QAnsel: Measure instruction used before bit initialization"); errFound = 1; break; } @@ -715,7 +865,7 @@ void main() { if (bitCount == 0xFF) { - fprintf(stderr, "QAnsel: If instruction used before bit initialization.\n"); + fprintf(stderr, "QAnsel: If instruction used before bit initialization"); errFound = 1; break; } @@ -733,7 +883,7 @@ void main() { if (bitCount == 0xFF) { - fprintf(stderr, "QAnsel: If instruction used before bit initialization.\n"); + fprintf(stderr, "QAnsel: If instruction used before bit initialization"); errFound = 1; break; } @@ -752,7 +902,7 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Qubit instruction used before initialization.\n"); + fprintf(stderr, "QAnsel: Qubit instruction used before initialization"); errFound = 1; break; } @@ -764,7 +914,7 @@ void main() { if (bitCount == 0xFF) { - fprintf(stderr, "QAnsel: Bit instruction used before initialization.\n"); + fprintf(stderr, "QAnsel: Bit instruction used before initialization"); errFound = 1; break; } @@ -776,7 +926,7 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Qubit instruction used before initialization.\n"); + fprintf(stderr, "QAnsel: Qubit instruction used before initialization"); errFound = 1; break; } @@ -794,7 +944,7 @@ void main() { if (bitCount == 0xFF) { - fprintf(stderr, "QAnsel: Bit instruction used before initialization.\n"); + fprintf(stderr, "QAnsel: Bit instruction used before initialization"); errFound = 1; break; } @@ -812,7 +962,7 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Qubit instruction used before initialization.\n"); + fprintf(stderr, "QAnsel: Qubit instruction used before initialization"); errFound = 1; break; } @@ -824,7 +974,7 @@ void main() { if (qubitCount == 0xFF) { - fprintf(stderr, "QAnsel: Qubit instruction used before initialization.\n"); + fprintf(stderr, "QAnsel: Qubit instruction used before initialization"); errFound = 1; break; } @@ -838,18 +988,78 @@ void main() strcpy(instr[instrLen].n, "sample"); instr[instrLen++].q0 = q0; } - else if (strcmp(lines[i], "reset") == 0) + else if (sscanf(lines[i], "reset q[%i]", &q0) == 1) { - if (qubitCount == 0xFF || bitCount == 0xFF) + if (qubitCount == 0xFF) + { + fprintf(stderr, "QAnsel: Qubit instruction used before initialization"); + errFound = 1; + break; + } + if (q0 >= qubitCount || q0 < 0) + { + fprintf(stderr, "QAnsel: Invalid index"); + errFound = 1; + break; + } + instr = realloc(instr, (instrLen + 1) * sizeof(QInstr)); + strcpy(instr[instrLen].n, "resetq"); + instr[instrLen++].q0 = q0; + } + else if (sscanf(lines[i], "reset c[%i]", &q0) == 1) + { + if (bitCount == 0xFF) + { + fprintf(stderr, "QAnsel: Bit instruction used before initialization"); + errFound = 1; + break; + } + if (q0 >= bitCount || q0 < 0) { - fprintf(stderr, "QAnsel: Instruction used before initialization.\n"); + fprintf(stderr, "QAnsel: Invalid index"); errFound = 1; break; } instr = realloc(instr, (instrLen + 1) * sizeof(QInstr)); - strcpy(instr[instrLen].n, "reset"); + strcpy(instr[instrLen].n, "resetc"); + instr[instrLen++].q0 = q0; + } + else if (strcmp(lines[i], "reset") == 0) + { + instr = realloc(instr, (instrLen + 1) * sizeof(QInstr)); + strcpy(instr[instrLen].n, "reset_all"); instrLen++; } + else if (strcmp(lines[i], "barrier q") == 0) + { + if (qubitCount == 0xFF) + { + fprintf(stderr, "QAnsel: Qubit instruction used before initialization"); + errFound = 1; + break; + } + //do nothing as there are currently no + // optimizations that this instruction + // would prevent + } + else if (sscanf(lines[i], "barrier q[%i]", &q0) == 1) + { + if (qubitCount == 0xFF || bitCount == 0xFF) + { + fprintf(stderr, "QAnsel: Instruction used before initialization"); + errFound = 1; + break; + } + if (q0 >= qubitCount || q0 < 0) + { + fprintf(stderr, "QAnsel: Invalid index"); + errFound = 1; + break; + } + //do nothing as there are currently no + // optimizations that this instruction + // would prevent + } else { fprintf(stderr, "QAnsel: Syntax error"); @@ -869,7 +1079,17 @@ void main() exit(1); } - qansel_run(qubitCount, bitCount, instr, instrLen, 0); + if (argc == 2) + { + if (strcmp(argv[1], "-d") == 0) + { + qansel_run(qubitCount, bitCount, instr, instrLen, 1); + } + } + else + { + qansel_run(qubitCount, bitCount, instr, instrLen, 0); + } free(instr); free(lineIDs); } diff --git a/src/complex.c b/src/complex.c index e9736c4..c5346b7 100644 --- a/src/complex.c +++ b/src/complex.c @@ -3,6 +3,9 @@ #include #include #include +#include +#include +#include "cores.c" typedef struct { @@ -96,6 +99,110 @@ void cpx_ncpx_mmul(double* ptrR, double* ptrA, double* ptrB, size_t rowsA, size_ } } +typedef struct +{ + size_t ID; + size_t Threads; + size_t Last; + size_t Loops; + size_t Continue; + size_t BlockSize; + double* ptrR; + double* ptrA; + double* ptrB; + size_t rowsA; + size_t colsB; + size_t shared; +} cpx_mul_shared; + +void* cpx_ncpx_mmul_mtc(void *context) +{ + cpx_mul_shared* data = (cpx_mul_shared*)context; + double* ptrR = data->ptrR; + double* ptrA = data->ptrA; + double* ptrB = data->ptrB; + size_t rowsA = data->rowsA; + size_t colsB = data->colsB; + size_t shared = data->shared; + + size_t colsA = data->shared; + size_t rowsB = data->shared; + size_t rowsR = data->rowsA; + size_t colsR = data->colsB; + + for (size_t rowR = 0; rowR < rowsR; rowR++) + { + size_t a = data->ID * data->BlockSize; + size_t b = (data->ID + 1) * data->BlockSize; + if (data->ID == data->Last) b += data->Continue; + + //printf("%i;%i\n", a, b); + + for (size_t colR = a; colR < b; colR++) + { + size_t posR = colR + rowR * colsR; + size_t rowA = rowR; + size_t colB = colR; + ptrR[posR] = 0; + for (size_t i = 0; i < data->shared; i++) + { + size_t posA = i + rowA * colsA; + size_t posB = colB + i * colsB; + data->ptrR[posR] += data->ptrA[posA] * data->ptrB[posB]; + } + } + } +} + +void cpx_ncpx_mmul_mt(double* ptrR, double* ptrA, double* ptrB, size_t rowsA, size_t colsB, size_t shared) +{ + cpx_mul_shared share; + share.Threads = get_core_count(); + share.ptrR = ptrR; + share.ptrA = ptrA; + share.ptrB = ptrB; + share.rowsA = rowsA; + share.colsB = colsB; + share.shared = shared; + if (colsB <= share.Threads) + { + share.Threads = colsB; + } + share.BlockSize = (size_t)floor(((double)colsB) / ((double)share.Threads)); + share.Loops = (size_t)floor(((double)colsB) / ((double)share.BlockSize)); + share.Last = share.Loops - 1; + share.Continue = (size_t)(((double)colsB) - ((double)share.Loops) * ((double)share.BlockSize)); + + pthread_t threads[share.Loops]; + cpx_mul_shared contexts[share.Loops]; + for (size_t i = 0; i < share.Loops; i++) + { + pthread_t tid; + threads[i] = tid; + memcpy(contexts + i, &share, sizeof(cpx_mul_shared)); + contexts[i].ID = i; + } + + for (size_t i = 0; i < share.Loops; i++) + { + if (pthread_create(threads + i, NULL, &cpx_ncpx_mmul_mtc, contexts + i)) + { + fprintf(stderr, "QAnsel: Thread error. (1)\n"); + exit(1); + } + } + + for (uint32_t i = 0; i < share.Loops; i++) + { + pthread_t tid; + tid = threads[i]; + if (pthread_join(tid, NULL)) + { + fprintf(stderr, "QAnsel: Thread error. (2)\n"); + } + } +} + //non-complex kronecker product void cpx_ncpx_mknk(double* ptrR, double* ptrA, double* ptrB, size_t rowsA, size_t colsA, size_t rowsB, size_t colsB) { @@ -162,8 +269,12 @@ void cpx_mtx_get(cpx_mtx_t* m, size_t row, size_t col, cpx_t* n) row *= 2; col *= 2; size_t cols = m->cols * 2; + + //printf("qqq\n"); n->real = m->ptr[(col + 1) + (row + 1) * cols]; + //printf("ppp\n"); n->imaginary = m->ptr[col + (row + 1) * cols]; + //printf("ggg\n"); } double cpx_mtx_get_real(cpx_mtx_t* m, size_t row, size_t col) @@ -206,7 +317,136 @@ void cpx_mtx_free(cpx_mtx_t* m) m->cols = 0; } -void cpx_mtx_knk2 +typedef struct +{ + size_t ID; + size_t Threads; + size_t Last; + size_t Loops; + size_t Continue; + size_t BlockSize; + double* ptrR; + size_t rowsR; + size_t colsR; + double* ptrA; + size_t rowsA; + size_t colsA; + double* ptrB; + size_t rowsB; + size_t colsB; +} cpx_knk_shared; + +void* cpx_ncpx_knk_mtc(void *context) +{ + cpx_knk_shared* data = (cpx_knk_shared*)context; + double* ptrR = data->ptrR; + size_t rowsR = data->rowsR; + size_t colsR = data->colsR; + double* ptrA = data->ptrA; + size_t rowsA = data->rowsA; + size_t colsA = data->colsA; + double* ptrB = data->ptrB; + size_t rowsB = data->rowsB; + size_t colsB = data->colsB; + + for (size_t rowR = 0; rowR < rowsR; rowR++) + { + size_t a = data->ID * data->BlockSize; + size_t b = (data->ID + 1) * data->BlockSize; + if (data->ID == data->Last) b += data->Continue; + for (size_t colR = a; colR < b; colR++) + { + size_t rowA = rowR / rowsB; + size_t colA = colR / colsB; + size_t rowB = rowR % rowsB; + size_t colB = colR % colsB; + + double r1 = ptrA[((colA * 2) + 1) + ((rowA * 2) + 1) * (colsA * 2)]; + double i1 = ptrA[(colA * 2) + ((rowA * 2) + 1) * (colsA * 2)]; + double r2 = ptrB[((colB * 2) + 1) + ((rowB * 2) + 1) * (colsB * 2)]; + double i2 = ptrB[(colB * 2) + ((rowB * 2) + 1) * (colsB * 2)]; + + double first = r1 * r2; //real + double outer = r1 * i2; //imaginary + double inner = i1 * r2; //imaginary + double last = -(i1 * i2); //real + r1 = first + last; + i1 = outer + inner; + + ptrR[(colR * 2) + (rowR * 2) * (colsR * 2)] = r1; + ptrR[((colR * 2) + 1) + (rowR * 2) * (colsR * 2)] = -i1; + ptrR[(colR * 2) + ((rowR * 2) + 1) * (colsR * 2)] = i1; + ptrR[((colR * 2) + 1) + ((rowR * 2) + 1) * (colsR * 2)] = r1; + + } + } +} + +void cpx_ncpx_knk_mt +( + double* ptrR, + size_t rowsR, + size_t colsR, + double* ptrA, + size_t rowsA, + size_t colsA, + double* ptrB, + size_t rowsB, + size_t colsB +) +{ + cpx_knk_shared share; + share.Threads = get_core_count(); + share.ptrR = ptrR; + share.rowsR = rowsR; + share.colsR = colsR; + share.ptrA = ptrA; + share.rowsA = rowsA; + share.colsA = colsA; + share.ptrB = ptrB; + share.rowsB = rowsB; + share.colsB = colsB; + + if (colsR <= share.Threads) + { + share.Threads = colsR; + } + share.BlockSize = (size_t)floor(((double)colsR) / ((double)share.Threads)); + share.Loops = (size_t)floor(((double)colsR) / ((double)share.BlockSize)); + share.Last = share.Loops - 1; + share.Continue = (size_t)(((double)colsR) - ((double)share.Loops) * ((double)share.BlockSize)); + + pthread_t threads[share.Loops]; + cpx_knk_shared contexts[share.Loops]; + for (size_t i = 0; i < share.Loops; i++) + { + pthread_t tid; + threads[i] = tid; + memcpy(contexts + i, &share, sizeof(cpx_knk_shared)); + contexts[i].ID = i; + } + + for (size_t i = 0; i < share.Loops; i++) + { + if (pthread_create(threads + i, NULL, &cpx_ncpx_knk_mtc, contexts + i)) + { + fprintf(stderr, "QAnsel: Thread error. (1)\n"); + exit(1); + } + } + + for (uint32_t i = 0; i < share.Loops; i++) + { + pthread_t tid; + tid = threads[i]; + if (pthread_join(tid, NULL)) + { + fprintf(stderr, "QAnsel: Thread error. (2)\n"); + } + } +} + +void cpx_ncpx_knk ( double* ptrR, size_t rowsR, @@ -257,7 +497,6 @@ void cpx_mtx_knk(cpx_mtx_t* r, cpx_mtx_t* a, cpx_mtx_t* b) size_t colsB = b->cols; size_t rowsR = rowsA * rowsB; size_t colsR = colsA * colsB; - cpx_mtx_init(r, rowsR, colsR); for (size_t rowR = 0; rowR < rowsR; rowR++) { for (size_t colR = 0; colR < colsR; colR++) @@ -277,20 +516,6 @@ void cpx_mtx_knk(cpx_mtx_t* r, cpx_mtx_t* a, cpx_mtx_t* b) } } - -void cpx_mtx_(cpx_mtx_t* m) -{ - for (size_t r = 0; r < m->rows * 2; r++) - { - for (size_t c = 0; c < m->cols * 2; c++) - { - if (c > 0) printf(", "); - printf("%f", m->ptr[c + r * m->cols * 2]); - } - printf("\n"); - } -} - void cpx_mtx_print(cpx_mtx_t* m) { for (size_t r = 0; r < m->rows; r++) diff --git a/src/cores.c b/src/cores.c new file mode 100644 index 0000000..4320e71 --- /dev/null +++ b/src/cores.c @@ -0,0 +1,53 @@ +#include + +#if defined(_WIN32) || defined(_WIN64) +#include +#elif defined(__linux__) +#include +#elif defined(__APPLE__) +#include +#endif + +int ___get_core_count() +{ + #if defined(_WIN32) || defined(_WIN64) + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + return sysinfo.dwNumberOfProcessors; + #elif defined(__linux__) + return sysconf(_SC_NPROCESSORS_ONLN); + #elif defined(__APPLE__) + int nm[2]; + size_t len = 4; + uint32_t count; + + nm[0] = CTL_HW; + nm[1] = HW_AVAILCPU; + sysctl(nm, 2, &count, &len, NULL, 0); + + if(count < 1) { + nm[1] = HW_NCPU; + sysctl(nm, 2, &count, &len, NULL, 0); + if(count < 1) { + count = 1; + } + } + return count; + #else + return -1; // Unknown platform + #endif +} + +int get_core_count() +{ + static int coreCount = -1; + if (coreCount == -1) + { + coreCount = ___get_core_count(); + if (coreCount == -1) + { + coreCount = 1; + } + } + return coreCount; +} \ No newline at end of file diff --git a/src/display.c b/src/display.c index 02ff639..1862610 100644 --- a/src/display.c +++ b/src/display.c @@ -20,6 +20,11 @@ void DrawThickLine(SDL_Renderer* renderer, int x1, int y1, int x2, int y2, int t } } +void display_wait(uint32_t i) +{ + SDL_Delay(i); +} + void display(cpx_mtx_t* stateVector, uint8_t qubitCount) { uint32_t qubitCountPow2 = (uint32_t)pow(2, qubitCount); @@ -29,6 +34,7 @@ void display(cpx_mtx_t* stateVector, uint8_t qubitCount) static SDL_Renderer* renderer = NULL; int SCREEN_WIDTH = 640 * 2; int SCREEN_HEIGHT = 480; + int SCREEN_HALF = SCREEN_HEIGHT / 2; if (stateVector == NULL) { @@ -47,7 +53,7 @@ void display(cpx_mtx_t* stateVector, uint8_t qubitCount) } window = SDL_CreateWindow ( - "D", + "QAnsel", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, @@ -73,7 +79,7 @@ void display(cpx_mtx_t* stateVector, uint8_t qubitCount) double p0 = 0; double i0 = 0; - for (int i = -20; i < SCREEN_WIDTH; i++) + for (int i = 0; i < SCREEN_WIDTH; i++) { double p1 = 0; double i1 = 0; @@ -81,8 +87,8 @@ void display(cpx_mtx_t* stateVector, uint8_t qubitCount) { cpx_t n; cpx_mtx_get(stateVector, 0, j - 1, &n); - p1 += (sin(i * ((2 * M_PI) / (SCREEN_WIDTH / j))) * (SCREEN_HEIGHT / 4)) * (n.real * n.real) * (n.real < 0 ? -1 : 1); - i1 += (cos(i * ((2 * M_PI) / (SCREEN_WIDTH / j))) * (SCREEN_HEIGHT / 4)) * (n.imaginary * n.imaginary) * (n.imaginary < 0 ? -1 : 1); + p1 += (sin(i * ((2 * M_PI) / (SCREEN_WIDTH / j))) * (SCREEN_HEIGHT / 4)) * pow(n.real, 2) * (n.real < 0 ? -1 : 1); + i1 += (cos(i * ((2 * M_PI) / (SCREEN_WIDTH / j))) * (SCREEN_HEIGHT / 4)) * pow(n.imaginary, 2) * (n.imaginary < 0 ? -1 : 1); } int x0 = i - 1; @@ -90,27 +96,29 @@ void display(cpx_mtx_t* stateVector, uint8_t qubitCount) int x1 = i; int y1 = p1; - x0 += i0 / 4; - y0 += i0 / 2; - x1 += i1 / 4; - y1 += i1 / 2; - y0 += SCREEN_HEIGHT / 2; y1 += SCREEN_HEIGHT / 2; - if ( (i0 + i1) / 2 < 0) + if (i > 0) { - SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); - DrawThickLine(renderer, x0, SCREEN_HEIGHT / 2, x1, SCREEN_HEIGHT / 2, 5); SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0x00); DrawThickLine(renderer, x0, y0, x1, y1, 5); + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0x00); + DrawThickLine(renderer, x0, SCREEN_HALF, x1, SCREEN_HALF, 5); } - else + + y0 = i0; + y1 = i1; + + y0 += SCREEN_HEIGHT / 2; + y1 += SCREEN_HEIGHT / 2; + + if (i > 0) { + SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0x00, 0x00); DrawThickLine(renderer, x0, y0, x1, y1, 5); - SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); - DrawThickLine(renderer, x0, SCREEN_HEIGHT / 2, x1, SCREEN_HEIGHT / 2, 5); - SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0x00); + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0x00); + DrawThickLine(renderer, x0, SCREEN_HALF, x1, SCREEN_HALF, 5); } p0 = p1; i0 = i1; diff --git a/src/gates.c b/src/gates.c index 347a72e..bca311d 100644 --- a/src/gates.c +++ b/src/gates.c @@ -52,7 +52,7 @@ double PhaseS[] = 0, 1, 0, 0, 0, 0, 0,-1, - 0, 0, 0, 0 + 0, 0, 1, 0 }; // 1/sqrt(2) + 1/sqrt(2)i