qadence.draw
example plots
Mostly for quick, manual checking of correct plotting output.
from qadence import X , Y , kron
from qadence.draw import display
b = kron ( X ( 0 ), Y ( 1 ))
%3
975e9fb630194f998c7e303e03fcd4f7
0
98b66c154b78454eae8b261dd1a0d6d5
X
975e9fb630194f998c7e303e03fcd4f7--98b66c154b78454eae8b261dd1a0d6d5
623e4a962864440191a1f5b297b5ebd8
1
e9417827a7d846379322ea339e4de98d
98b66c154b78454eae8b261dd1a0d6d5--e9417827a7d846379322ea339e4de98d
1c251abf488040268a1ba82129744503
a85c88709452494686c6be2851f2f354
Y
623e4a962864440191a1f5b297b5ebd8--a85c88709452494686c6be2851f2f354
a85c88709452494686c6be2851f2f354--1c251abf488040268a1ba82129744503
from qadence import X , Y , chain
from qadence.draw import display
b = chain ( X ( 0 ), Y ( 0 ))
%3
d2456767f7524ce79acf6aeb72dd31d9
0
5da963bad738465f9e751aae846ad876
X
d2456767f7524ce79acf6aeb72dd31d9--5da963bad738465f9e751aae846ad876
643466d3a1ea4dcaae7fa5b65e204d7c
Y
5da963bad738465f9e751aae846ad876--643466d3a1ea4dcaae7fa5b65e204d7c
4254a6cb3fe04bdf88f9f3667b36919f
643466d3a1ea4dcaae7fa5b65e204d7c--4254a6cb3fe04bdf88f9f3667b36919f
from qadence import X , Y , chain
from qadence.draw import display
b = chain ( X ( 0 ), Y ( 1 ))
%3
0a6879c2056d4911888b7fa42bcc4e1b
0
acc3324157c84351866928ecb9bcb534
X
0a6879c2056d4911888b7fa42bcc4e1b--acc3324157c84351866928ecb9bcb534
7a892da641da499fb3e41ff9a5635589
1
94e3f8900160442681857c9e18644987
acc3324157c84351866928ecb9bcb534--94e3f8900160442681857c9e18644987
82a3aac0625a4cf19cd03a7e9b332491
94e3f8900160442681857c9e18644987--82a3aac0625a4cf19cd03a7e9b332491
f236344ab56542c499ee9fa616170c1e
c639a8202a5448ad809f596d1e3aa428
7a892da641da499fb3e41ff9a5635589--c639a8202a5448ad809f596d1e3aa428
3122c24bb5b64cd8bf6d6e80c8c44cd4
Y
c639a8202a5448ad809f596d1e3aa428--3122c24bb5b64cd8bf6d6e80c8c44cd4
3122c24bb5b64cd8bf6d6e80c8c44cd4--f236344ab56542c499ee9fa616170c1e
from qadence import X , Y , add
from qadence.draw import display
b = add ( X ( 0 ), Y ( 1 ), X ( 2 ))
%3
cluster_cce40fe5f60f439a8acbb966edbd05dc
cbf3fc2cd0f543a388eb505255daf482
0
ae0c843482fb420fad1491ff82b8eeff
cbf3fc2cd0f543a388eb505255daf482--ae0c843482fb420fad1491ff82b8eeff
102ea05d1088459baa1f94513d9356f1
1
9f015b0b108545f7a0a1a6756ee7479a
ae0c843482fb420fad1491ff82b8eeff--9f015b0b108545f7a0a1a6756ee7479a
7c93267e44024b13a86af71814f21a4f
4ab4194972824cf09b618e6ea91d8f42
AddBlock
102ea05d1088459baa1f94513d9356f1--4ab4194972824cf09b618e6ea91d8f42
c0508a4f7a134272b48dcc8b4c5eb907
2
4ab4194972824cf09b618e6ea91d8f42--7c93267e44024b13a86af71814f21a4f
616c51dde1c44d9daec29b14a6d5ed97
2b10b05f67b141198bd8a0262a9baecc
c0508a4f7a134272b48dcc8b4c5eb907--2b10b05f67b141198bd8a0262a9baecc
2b10b05f67b141198bd8a0262a9baecc--616c51dde1c44d9daec29b14a6d5ed97
from qadence import CNOT , RX , HamEvo , X , Y , Z , chain , kron
rx = kron ( RX ( 3 , 0.5 ), RX ( 2 , "x" ))
rx . tag = "rx"
gen = chain ( Z ( i ) for i in range ( 4 ))
# `chain` puts things in sequence
block = chain (
kron ( X ( 0 ), Y ( 1 ), rx ),
CNOT ( 2 , 3 ),
HamEvo ( gen , 10 )
)
%3
cluster_a2966e43b8a942408458b4595ac714f0
cluster_704dfddf502741a6b65254ad08785a4f
rx
0eb2fa1850fa46f099383748ce69807e
0
748ad1037ecd486d9209f9fe9aaabeb6
X
0eb2fa1850fa46f099383748ce69807e--748ad1037ecd486d9209f9fe9aaabeb6
7673c5251ae74306a62771b04ab43df5
1
2e1eafca55c4427e9d22c3a3c07399b9
748ad1037ecd486d9209f9fe9aaabeb6--2e1eafca55c4427e9d22c3a3c07399b9
3e6872d33e65449fb6618d5665af3e30
2e1eafca55c4427e9d22c3a3c07399b9--3e6872d33e65449fb6618d5665af3e30
2dfb840bfee746e1b8eda020cd5f6801
3e6872d33e65449fb6618d5665af3e30--2dfb840bfee746e1b8eda020cd5f6801
39578fc2d89146289f09a1df5cc70a34
eab4ae98eed9442bbfb35abc576f465d
Y
7673c5251ae74306a62771b04ab43df5--eab4ae98eed9442bbfb35abc576f465d
44fbab3a0d6f42988398bfa263aaf362
2
880cf2d60e9b4d6d9cc090a4a4c1cd7a
eab4ae98eed9442bbfb35abc576f465d--880cf2d60e9b4d6d9cc090a4a4c1cd7a
c779a69785974b168825fd2588aa7816
HamEvo
880cf2d60e9b4d6d9cc090a4a4c1cd7a--c779a69785974b168825fd2588aa7816
c779a69785974b168825fd2588aa7816--39578fc2d89146289f09a1df5cc70a34
0755ad5eaa3e4752a1b8214b29a54dbf
79ad6aa0870843b894ecc360c3ceedab
RX(x)
44fbab3a0d6f42988398bfa263aaf362--79ad6aa0870843b894ecc360c3ceedab
a3eaaf77ee854b8391af1e425fba92e1
3
4fe46a1cb0074e7682decc4ea903182e
79ad6aa0870843b894ecc360c3ceedab--4fe46a1cb0074e7682decc4ea903182e
1b53c123e4264fb4b8619302fdca3fd5
t = 10
4fe46a1cb0074e7682decc4ea903182e--1b53c123e4264fb4b8619302fdca3fd5
1b53c123e4264fb4b8619302fdca3fd5--0755ad5eaa3e4752a1b8214b29a54dbf
88a4932813e64ad3998d818a3f1562f2
8dfad00c678f43909dfe8ed9afefed04
RX(0.5)
a3eaaf77ee854b8391af1e425fba92e1--8dfad00c678f43909dfe8ed9afefed04
5ee6932cb2514513ac43885d39e7ee2a
X
8dfad00c678f43909dfe8ed9afefed04--5ee6932cb2514513ac43885d39e7ee2a
5ee6932cb2514513ac43885d39e7ee2a--4fe46a1cb0074e7682decc4ea903182e
cfc9e5e165be4555bd8f3cdf53dec92f
5ee6932cb2514513ac43885d39e7ee2a--cfc9e5e165be4555bd8f3cdf53dec92f
cfc9e5e165be4555bd8f3cdf53dec92f--88a4932813e64ad3998d818a3f1562f2
from qadence import feature_map , hea , chain
block = chain ( feature_map ( 4 , reupload_scaling = "Tower" ), hea ( 4 , 2 ))
%3
cluster_2fdf06a6c26740d2998487ca88f5faa8
HEA
cluster_c9520587f8e743ab93ef44ed6022370b
Tower Fourier FM
12c54c7cc9924afa82f52d03b2469a6e
0
b7242a4b5dca4d9ca7a384b3279d7c2b
RX(1.0*phi)
12c54c7cc9924afa82f52d03b2469a6e--b7242a4b5dca4d9ca7a384b3279d7c2b
4fdb147bc96a4a23b2ae9ecc1b668067
1
dedbb4bfce4b4092b1b259f5bbd47652
RX(theta₀)
b7242a4b5dca4d9ca7a384b3279d7c2b--dedbb4bfce4b4092b1b259f5bbd47652
163d4aa45e164104b754c6b473906eaa
RY(theta₄)
dedbb4bfce4b4092b1b259f5bbd47652--163d4aa45e164104b754c6b473906eaa
1eea000439694ce0ad154b380c1fb88f
RX(theta₈)
163d4aa45e164104b754c6b473906eaa--1eea000439694ce0ad154b380c1fb88f
cbebf1ca79da4ff196caf68d61151ea1
1eea000439694ce0ad154b380c1fb88f--cbebf1ca79da4ff196caf68d61151ea1
e438877a7ae6451086d4ef7d3cc9cb77
cbebf1ca79da4ff196caf68d61151ea1--e438877a7ae6451086d4ef7d3cc9cb77
fb95f07cf80c4c4099190dcf3d762852
RX(theta₁₂)
e438877a7ae6451086d4ef7d3cc9cb77--fb95f07cf80c4c4099190dcf3d762852
5b535624eadb493393fc957167682766
RY(theta₁₆)
fb95f07cf80c4c4099190dcf3d762852--5b535624eadb493393fc957167682766
4d00a26d3422455388d6958721b3c394
RX(theta₂₀)
5b535624eadb493393fc957167682766--4d00a26d3422455388d6958721b3c394
f2577348972a428abc7712ca05a8661d
4d00a26d3422455388d6958721b3c394--f2577348972a428abc7712ca05a8661d
80f812d332ab4f099b9adc93b6c29b70
f2577348972a428abc7712ca05a8661d--80f812d332ab4f099b9adc93b6c29b70
5df393af961f4191ae9b61ed54bcea8b
80f812d332ab4f099b9adc93b6c29b70--5df393af961f4191ae9b61ed54bcea8b
bc0538e4aeca43ca8fd19e9acc6f714d
606a7bbe7baa4c5a82b82c69deadc3d0
RX(2.0*phi)
4fdb147bc96a4a23b2ae9ecc1b668067--606a7bbe7baa4c5a82b82c69deadc3d0
bf719c49338646c59e614569e4dcfd08
2
9f481faacea642839068cc9db7a2d082
RX(theta₁)
606a7bbe7baa4c5a82b82c69deadc3d0--9f481faacea642839068cc9db7a2d082
fcbff30ba5f84052ab4befe1581c095b
RY(theta₅)
9f481faacea642839068cc9db7a2d082--fcbff30ba5f84052ab4befe1581c095b
9e24324b439d48358150b417a3ef3bd1
RX(theta₉)
fcbff30ba5f84052ab4befe1581c095b--9e24324b439d48358150b417a3ef3bd1
f11cb107c4ec4cd99f662d9d4877764b
X
9e24324b439d48358150b417a3ef3bd1--f11cb107c4ec4cd99f662d9d4877764b
f11cb107c4ec4cd99f662d9d4877764b--cbebf1ca79da4ff196caf68d61151ea1
ff4f4820257a448ab7e9abaf3068b7d3
f11cb107c4ec4cd99f662d9d4877764b--ff4f4820257a448ab7e9abaf3068b7d3
4dcf72a2b24943b692fd7544edcee576
RX(theta₁₃)
ff4f4820257a448ab7e9abaf3068b7d3--4dcf72a2b24943b692fd7544edcee576
e2fd79e110df4ba99457bcc05a01d61b
RY(theta₁₇)
4dcf72a2b24943b692fd7544edcee576--e2fd79e110df4ba99457bcc05a01d61b
cf9d26d653e24bf6b66d1c673d25af0f
RX(theta₂₁)
e2fd79e110df4ba99457bcc05a01d61b--cf9d26d653e24bf6b66d1c673d25af0f
97c7cdc345d8485f94e6608e43a514cc
X
cf9d26d653e24bf6b66d1c673d25af0f--97c7cdc345d8485f94e6608e43a514cc
97c7cdc345d8485f94e6608e43a514cc--f2577348972a428abc7712ca05a8661d
7150e7ec41444addb2ab532646b5b2f8
97c7cdc345d8485f94e6608e43a514cc--7150e7ec41444addb2ab532646b5b2f8
7150e7ec41444addb2ab532646b5b2f8--bc0538e4aeca43ca8fd19e9acc6f714d
e68a60b0fff04d979c0f8735730fcff5
08561f0088774556bdf9cdcee9d9a5a5
RX(3.0*phi)
bf719c49338646c59e614569e4dcfd08--08561f0088774556bdf9cdcee9d9a5a5
aa39f78ddad04639ac5d27b01e2f17c4
3
6e7af41136974e45a99fee411f44881a
RX(theta₂)
08561f0088774556bdf9cdcee9d9a5a5--6e7af41136974e45a99fee411f44881a
8f89d2afea904a4693dc77e3807ce0c2
RY(theta₆)
6e7af41136974e45a99fee411f44881a--8f89d2afea904a4693dc77e3807ce0c2
716d544c43284c5284a59d489eb7f4fd
RX(theta₁₀)
8f89d2afea904a4693dc77e3807ce0c2--716d544c43284c5284a59d489eb7f4fd
b4be06f1bab54e379b7eb31dcd07c8f8
716d544c43284c5284a59d489eb7f4fd--b4be06f1bab54e379b7eb31dcd07c8f8
ae8c33d98aed49b6969beefbe94c5ff3
X
b4be06f1bab54e379b7eb31dcd07c8f8--ae8c33d98aed49b6969beefbe94c5ff3
ae8c33d98aed49b6969beefbe94c5ff3--ff4f4820257a448ab7e9abaf3068b7d3
cf540057831b43948955f6be00ef6958
RX(theta₁₄)
ae8c33d98aed49b6969beefbe94c5ff3--cf540057831b43948955f6be00ef6958
dad802c2beb1447b8eefd0506ff58ae9
RY(theta₁₈)
cf540057831b43948955f6be00ef6958--dad802c2beb1447b8eefd0506ff58ae9
3f558ce6c9e44e49b7a9f08e3ce68115
RX(theta₂₂)
dad802c2beb1447b8eefd0506ff58ae9--3f558ce6c9e44e49b7a9f08e3ce68115
9fca6fbf9aed4f8083c24075746ddcd1
3f558ce6c9e44e49b7a9f08e3ce68115--9fca6fbf9aed4f8083c24075746ddcd1
bda31928fd294aafa41ba5171e75ab6f
X
9fca6fbf9aed4f8083c24075746ddcd1--bda31928fd294aafa41ba5171e75ab6f
bda31928fd294aafa41ba5171e75ab6f--7150e7ec41444addb2ab532646b5b2f8
bda31928fd294aafa41ba5171e75ab6f--e68a60b0fff04d979c0f8735730fcff5
ddb41e3727eb4773b47207c19c01d00c
caac9a11cc364775b66fa79d52e18e81
RX(4.0*phi)
aa39f78ddad04639ac5d27b01e2f17c4--caac9a11cc364775b66fa79d52e18e81
f2458854fa92413ca9ca8896e8b426ab
RX(theta₃)
caac9a11cc364775b66fa79d52e18e81--f2458854fa92413ca9ca8896e8b426ab
d729737b25f343da96f1104658df3378
RY(theta₇)
f2458854fa92413ca9ca8896e8b426ab--d729737b25f343da96f1104658df3378
5ba3e36c631648e89c2b02bcad217f15
RX(theta₁₁)
d729737b25f343da96f1104658df3378--5ba3e36c631648e89c2b02bcad217f15
2b60034df5c14da2b21b83b83a1a6d24
X
5ba3e36c631648e89c2b02bcad217f15--2b60034df5c14da2b21b83b83a1a6d24
2b60034df5c14da2b21b83b83a1a6d24--b4be06f1bab54e379b7eb31dcd07c8f8
a455df58ef3a4fe5bc11de151a126078
2b60034df5c14da2b21b83b83a1a6d24--a455df58ef3a4fe5bc11de151a126078
04d4545b85914cf8a10d833b7b4eff6d
RX(theta₁₅)
a455df58ef3a4fe5bc11de151a126078--04d4545b85914cf8a10d833b7b4eff6d
4dccf2106f9644108ae46f389fbfd589
RY(theta₁₉)
04d4545b85914cf8a10d833b7b4eff6d--4dccf2106f9644108ae46f389fbfd589
c58c37f3a7c84ad7b2d13eb2a8c0b71d
RX(theta₂₃)
4dccf2106f9644108ae46f389fbfd589--c58c37f3a7c84ad7b2d13eb2a8c0b71d
9ff9ff21930240b2b46666f84be40d36
X
c58c37f3a7c84ad7b2d13eb2a8c0b71d--9ff9ff21930240b2b46666f84be40d36
9ff9ff21930240b2b46666f84be40d36--9fca6fbf9aed4f8083c24075746ddcd1
682b5105d3d749378aa5782295c3bed3
9ff9ff21930240b2b46666f84be40d36--682b5105d3d749378aa5782295c3bed3
682b5105d3d749378aa5782295c3bed3--ddb41e3727eb4773b47207c19c01d00c
from qadence import QuantumModel , QuantumCircuit , total_magnetization , hea
model = QuantumModel ( QuantumCircuit ( 3 , hea ( 3 , 2 )), total_magnetization ( 3 ))
%3
cluster_4e0663b43c4a4ec0b256c53bd797d2b9
Obs.
cluster_0d5e7a7584324c9f84e1d0c0c7d6fcff
cluster_e4cbe1910fc54fdd9c833003d9963693
HEA
dabc0005d13342e98222a270444521c8
0
7977ce72819d44c5afef68d7c1a5b2fe
RX(theta₀)
dabc0005d13342e98222a270444521c8--7977ce72819d44c5afef68d7c1a5b2fe
3e3fcf87965642e1ad41d1d7ddb48efb
1
3c65dbd053c54bb49d640c1ea84bb5d6
RY(theta₃)
7977ce72819d44c5afef68d7c1a5b2fe--3c65dbd053c54bb49d640c1ea84bb5d6
fe3d285468b8437099372c2fd7ab1311
RX(theta₆)
3c65dbd053c54bb49d640c1ea84bb5d6--fe3d285468b8437099372c2fd7ab1311
8788fc2763684e91b8e09037cbdeae6c
fe3d285468b8437099372c2fd7ab1311--8788fc2763684e91b8e09037cbdeae6c
edd74cfc812e4f3282cac5d8cd7ddc56
8788fc2763684e91b8e09037cbdeae6c--edd74cfc812e4f3282cac5d8cd7ddc56
18ede7ad4da34aeb8afac30406dd83e7
RX(theta₉)
edd74cfc812e4f3282cac5d8cd7ddc56--18ede7ad4da34aeb8afac30406dd83e7
6941e32a8eba4de7940b4180ee782a9a
RY(theta₁₂)
18ede7ad4da34aeb8afac30406dd83e7--6941e32a8eba4de7940b4180ee782a9a
bcce54d01eaa45cf8c6e61aaf4235355
RX(theta₁₅)
6941e32a8eba4de7940b4180ee782a9a--bcce54d01eaa45cf8c6e61aaf4235355
ac1937421fc34946be57f47579aa3020
bcce54d01eaa45cf8c6e61aaf4235355--ac1937421fc34946be57f47579aa3020
8dfef556c02d4b82bd5c485b36eade3f
ac1937421fc34946be57f47579aa3020--8dfef556c02d4b82bd5c485b36eade3f
eb99520f6aa442279145160333f36a10
8dfef556c02d4b82bd5c485b36eade3f--eb99520f6aa442279145160333f36a10
5a54d2ba1f874cc5bf06f9be30e0c0ed
eb99520f6aa442279145160333f36a10--5a54d2ba1f874cc5bf06f9be30e0c0ed
dc9cbd1fa90a41268fa09dea88729811
5c1aa502a705461d974f69160a7a6e2e
RX(theta₁)
3e3fcf87965642e1ad41d1d7ddb48efb--5c1aa502a705461d974f69160a7a6e2e
5a2d5239626a4679a23e7911cbd0dda6
2
d52c13aeb1d54a49bfc42b9f19665e17
RY(theta₄)
5c1aa502a705461d974f69160a7a6e2e--d52c13aeb1d54a49bfc42b9f19665e17
750fb2159cfb427499f272fd2a577304
RX(theta₇)
d52c13aeb1d54a49bfc42b9f19665e17--750fb2159cfb427499f272fd2a577304
e7affec99cbf46aab6e86519f91240fd
X
750fb2159cfb427499f272fd2a577304--e7affec99cbf46aab6e86519f91240fd
e7affec99cbf46aab6e86519f91240fd--8788fc2763684e91b8e09037cbdeae6c
4aa5ba43a58d4f18a434236feb3c5937
e7affec99cbf46aab6e86519f91240fd--4aa5ba43a58d4f18a434236feb3c5937
bc891fffcb034f21a93143e904479640
RX(theta₁₀)
4aa5ba43a58d4f18a434236feb3c5937--bc891fffcb034f21a93143e904479640
50e64a25a6ea41948b99720b577caeee
RY(theta₁₃)
bc891fffcb034f21a93143e904479640--50e64a25a6ea41948b99720b577caeee
2c21980e9aed4b8abe2d9e676ba69eec
RX(theta₁₆)
50e64a25a6ea41948b99720b577caeee--2c21980e9aed4b8abe2d9e676ba69eec
52cc7ef0492147a1b7b912b2966b6ed3
X
2c21980e9aed4b8abe2d9e676ba69eec--52cc7ef0492147a1b7b912b2966b6ed3
52cc7ef0492147a1b7b912b2966b6ed3--ac1937421fc34946be57f47579aa3020
484f7e8ba41c4fb68f2ab19659ece007
52cc7ef0492147a1b7b912b2966b6ed3--484f7e8ba41c4fb68f2ab19659ece007
4ff51ece704449ba8fdf2b480e7f53c0
AddBlock
484f7e8ba41c4fb68f2ab19659ece007--4ff51ece704449ba8fdf2b480e7f53c0
4ff51ece704449ba8fdf2b480e7f53c0--dc9cbd1fa90a41268fa09dea88729811
d869d3442fe747a39bdb5c52e88cb279
bf2c4684b8f54b69b33344fd013f85c7
RX(theta₂)
5a2d5239626a4679a23e7911cbd0dda6--bf2c4684b8f54b69b33344fd013f85c7
1684e4d4c19747f3a496bd506cc22671
RY(theta₅)
bf2c4684b8f54b69b33344fd013f85c7--1684e4d4c19747f3a496bd506cc22671
c73ae50ff7494a6b889b79f0909ddc1b
RX(theta₈)
1684e4d4c19747f3a496bd506cc22671--c73ae50ff7494a6b889b79f0909ddc1b
e11c43b156ee4aa6912fc2c5536ac875
c73ae50ff7494a6b889b79f0909ddc1b--e11c43b156ee4aa6912fc2c5536ac875
213803f050444b7ebbaea2f4d2cd7988
X
e11c43b156ee4aa6912fc2c5536ac875--213803f050444b7ebbaea2f4d2cd7988
213803f050444b7ebbaea2f4d2cd7988--4aa5ba43a58d4f18a434236feb3c5937
3f7176915e39489a8cab88623b3512c2
RX(theta₁₁)
213803f050444b7ebbaea2f4d2cd7988--3f7176915e39489a8cab88623b3512c2
537e4468889f471598ffc5e16ed3425c
RY(theta₁₄)
3f7176915e39489a8cab88623b3512c2--537e4468889f471598ffc5e16ed3425c
151bb920ce6548dcb044dde695aea9f8
RX(theta₁₇)
537e4468889f471598ffc5e16ed3425c--151bb920ce6548dcb044dde695aea9f8
8babd87fc8824205bc016412ee110c37
151bb920ce6548dcb044dde695aea9f8--8babd87fc8824205bc016412ee110c37
6d55d4c195dd4cf2b69d65477011c827
X
8babd87fc8824205bc016412ee110c37--6d55d4c195dd4cf2b69d65477011c827
6d55d4c195dd4cf2b69d65477011c827--484f7e8ba41c4fb68f2ab19659ece007
5d4af627eb1b4c81a143972988628954
6d55d4c195dd4cf2b69d65477011c827--5d4af627eb1b4c81a143972988628954
5d4af627eb1b4c81a143972988628954--d869d3442fe747a39bdb5c52e88cb279
from qadence import *
b = chain ( SWAP ( 0 , 1 ), SWAP ( 0 , 3 ))
%3
b09b4b65e72448e888a4d40e734a7c61
0
2d3014272ae240ddb8ac8da00900264a
b09b4b65e72448e888a4d40e734a7c61--2d3014272ae240ddb8ac8da00900264a
1e9ee163ea6148ad9717bd05a3b82e78
1
87d37d7bdc6a49b2bfa323327471caa2
95ad3b7c52df46a1acfdb3b1654703c5
2d3014272ae240ddb8ac8da00900264a--95ad3b7c52df46a1acfdb3b1654703c5
954eaccec63b4fb78d107deda9fb4a0e
87d37d7bdc6a49b2bfa323327471caa2--954eaccec63b4fb78d107deda9fb4a0e
596cd67f7bbd46fc82df6be325264d79
61b720c3c7094ac88851498c7c24b062
954eaccec63b4fb78d107deda9fb4a0e--61b720c3c7094ac88851498c7c24b062
0715c0cbe8d94ee883ff1e6aa61b8555
596cd67f7bbd46fc82df6be325264d79--0715c0cbe8d94ee883ff1e6aa61b8555
b977962fa7d543168641394bc56c4c89
c4edb60a8bc74ee7a57af2e68b51e76f
1e9ee163ea6148ad9717bd05a3b82e78--c4edb60a8bc74ee7a57af2e68b51e76f
f358e7e57bf544b88312c25a0faabbb2
2
c4edb60a8bc74ee7a57af2e68b51e76f--87d37d7bdc6a49b2bfa323327471caa2
32f3e2dc93314e259bf266180b75db30
95ad3b7c52df46a1acfdb3b1654703c5--32f3e2dc93314e259bf266180b75db30
d97b6afdfe1e4a35abfb8cc8738e70b7
32f3e2dc93314e259bf266180b75db30--d97b6afdfe1e4a35abfb8cc8738e70b7
d97b6afdfe1e4a35abfb8cc8738e70b7--b977962fa7d543168641394bc56c4c89
9276ab86a80b4d5f847826c96c7418db
614ba9591a35444b87cc4b885c132d6d
f358e7e57bf544b88312c25a0faabbb2--614ba9591a35444b87cc4b885c132d6d
286e26dab4604b5fb0a721933ae17214
3
fdd1393d4f2a4606a79474dc00ef2300
614ba9591a35444b87cc4b885c132d6d--fdd1393d4f2a4606a79474dc00ef2300
bb46b4941159482f860a8c5cc0f6d6cd
fdd1393d4f2a4606a79474dc00ef2300--bb46b4941159482f860a8c5cc0f6d6cd
ccea621380a54f3ba2165c4c852b67ad
bb46b4941159482f860a8c5cc0f6d6cd--ccea621380a54f3ba2165c4c852b67ad
ccea621380a54f3ba2165c4c852b67ad--9276ab86a80b4d5f847826c96c7418db
a536aed4b3ea464aab719beeff704201
35b33061e1e0456a86b400b88879a193
286e26dab4604b5fb0a721933ae17214--35b33061e1e0456a86b400b88879a193
80644202bd95406388e5de2d93b50028
35b33061e1e0456a86b400b88879a193--80644202bd95406388e5de2d93b50028
46488dffb04947b2a2c344b2f3eea823
80644202bd95406388e5de2d93b50028--46488dffb04947b2a2c344b2f3eea823
46488dffb04947b2a2c344b2f3eea823--596cd67f7bbd46fc82df6be325264d79
61b720c3c7094ac88851498c7c24b062--a536aed4b3ea464aab719beeff704201
from qadence import *
b = chain ( CPHASE ( 0 , 1 , 0.5 ), CPHASE ( 0 , 2 , 0.5 ), CPHASE ( 0 , 3 , 0.5 ))
%3
29bfa083a45c4ba18ba4dfe10125ec8e
0
5c5f1092a6664020b5db1eed1c8076ed
29bfa083a45c4ba18ba4dfe10125ec8e--5c5f1092a6664020b5db1eed1c8076ed
bfb0c073e944497dae5710e44a0c2c37
1
061bdc8665024be18a8af3ab37e74225
5c5f1092a6664020b5db1eed1c8076ed--061bdc8665024be18a8af3ab37e74225
459325817e6d4bba8a6855ba18df8310
061bdc8665024be18a8af3ab37e74225--459325817e6d4bba8a6855ba18df8310
f71acefe480145b089fc5b43988f58ad
459325817e6d4bba8a6855ba18df8310--f71acefe480145b089fc5b43988f58ad
89f7830b4a804cc699defcb8e6c60ada
d1d127a9609946c1bda425f66f662589
PHASE(0.5)
bfb0c073e944497dae5710e44a0c2c37--d1d127a9609946c1bda425f66f662589
433ff64d02014124ac47a16d9964a432
2
d1d127a9609946c1bda425f66f662589--5c5f1092a6664020b5db1eed1c8076ed
78e0f1d575f94e90bc953b0fecb986f3
d1d127a9609946c1bda425f66f662589--78e0f1d575f94e90bc953b0fecb986f3
daabcb97bb754cdda39547e6625fc258
78e0f1d575f94e90bc953b0fecb986f3--daabcb97bb754cdda39547e6625fc258
daabcb97bb754cdda39547e6625fc258--89f7830b4a804cc699defcb8e6c60ada
07423a99c38a4e8b9eb2ea97f88048be
f2de79490561430a987a4b30cfae11de
433ff64d02014124ac47a16d9964a432--f2de79490561430a987a4b30cfae11de
8b8b1beab46c4f2f9ab18c1376b01a3a
3
d5bb6c91bb1041c88a4f1bdd71ccdd88
PHASE(0.5)
f2de79490561430a987a4b30cfae11de--d5bb6c91bb1041c88a4f1bdd71ccdd88
d5bb6c91bb1041c88a4f1bdd71ccdd88--061bdc8665024be18a8af3ab37e74225
7b2db619f8cf48dda5d7ef9a8d23b50d
d5bb6c91bb1041c88a4f1bdd71ccdd88--7b2db619f8cf48dda5d7ef9a8d23b50d
7b2db619f8cf48dda5d7ef9a8d23b50d--07423a99c38a4e8b9eb2ea97f88048be
5a692d2d48ca45e7a974fe1ebd0deebc
f5581d0d92634bed9a95068258ff1fde
8b8b1beab46c4f2f9ab18c1376b01a3a--f5581d0d92634bed9a95068258ff1fde
22e154255b284efe91054954e13f3f29
f5581d0d92634bed9a95068258ff1fde--22e154255b284efe91054954e13f3f29
c1eef41fb2d24f47ab5d772fd9cf5de9
PHASE(0.5)
22e154255b284efe91054954e13f3f29--c1eef41fb2d24f47ab5d772fd9cf5de9
c1eef41fb2d24f47ab5d772fd9cf5de9--459325817e6d4bba8a6855ba18df8310
c1eef41fb2d24f47ab5d772fd9cf5de9--5a692d2d48ca45e7a974fe1ebd0deebc
Developer documentation
This section contains examples in pure graphviz that can be used to understand roughly what is done
in the actual drawing backend.
import graphviz
font_name = "Sans-Serif"
font_size = "8"
graph_attr = {
"rankdir" : "LR" , # LR = left to right, TB = top to bottom
"nodesep" : "0.1" , # In inches, tells distance between nodes without edges
"compound" : "true" , # Needed to draw properly edges in hamevo when content is hidden
"splines" : "false" , # Needed to draw control gates vertical lines one over the other
} # These are the default values for graphs
node_attr = {
"shape" : "box" , # 'box' for normal nodes, 'point' for control gates or 'plaintext' for starting nodes (the qubit label).
"style" : "rounded" , # Unfortunately we can't specify the radius of the rounded, at least for this version
"fontname" : font_name ,
"fontsize" : font_size ,
"width" : "0.1" , # In inches, it doesn't get tinier than the label font.
"height" : "0.1" # In inches, it doesn't get tinier than the label font.
} # These are the defaults values that can be overridden at node declaration.
default_cluster_attr = {
"fontname" : font_name ,
"fontsize" : font_size ,
"labelloc" : "b" , # location of cluster label. b as bottom, t as top
"style" : "rounded"
} # These are the defaults values that can be overridden at sub graph declaration
hamevo_cluster_attr = {
"label" : "HamEvo(t=10)"
}
hamevo_cluster_attr . update ( default_cluster_attr )
h = graphviz . Graph ( graph_attr = graph_attr , node_attr = node_attr )
h . node ( "Hello World!" )
h
# Define graph
h = graphviz . Graph ( node_attr = node_attr , graph_attr = graph_attr )
# Add start and end nodes
for i in range ( 4 ):
h . node ( f 's { i } ' , shape = "plaintext" , label = f ' { i } ' , group = f " { i } " )
h . node ( f 'e { i } ' , style = 'invis' , group = f " { i } " )
# Add nodes
h . node ( 'X' , group = "0" )
h . node ( 'Y' , group = "1" )
# Add hamevo and its nodes
hamevo = graphviz . Graph ( name = 'cluster_hamevo' , graph_attr = hamevo_cluster_attr )
for i in range ( 4 ):
hamevo . node ( f 'z { i } ' , shape = "box" , style = "invis" , label = f ' { i } ' , group = f " { i } " )
h . subgraph ( hamevo )
# Add rx gates cluster and its nodes
cluster_attr = { "label" : "RX gates" }
cluster_attr . update ( default_cluster_attr )
cluster = graphviz . Graph ( name = "cluster_0" , graph_attr = cluster_attr )
cluster . node ( 'RX(x)' , group = "2" )
cluster . node ( 'RX(0.5)' , group = "3" )
h . subgraph ( cluster )
h . node ( 'cnot0' , label = '' , shape = 'point' , width = '0.1' , group = '0' )
h . node ( 'cnot1' , label = 'X' , group = '1' )
h . node ( 'cnot2' , label = '' , shape = 'point' , width = '0.1' , group = '2' )
h . node ( 'cnot3' , label = '' , shape = 'point' , width = '0.1' , group = '3' )
# Add edges
h . edge ( 's0' , 'X' )
h . edge ( 'X' , 'cnot0' )
h . edge ( 'cnot0' , 'z0' , lhead = 'cluster_hamevo' )
h . edge ( 'z0' , 'e0' , ltail = 'cluster_hamevo' )
h . edge ( 's1' , 'Y' )
h . edge ( 'Y' , 'cnot1' )
h . edge ( 'cnot1' , 'z1' , lhead = 'cluster_hamevo' )
h . edge ( 'z1' , 'e1' , ltail = 'cluster_hamevo' )
h . edge ( 's2' , 'RX(x)' )
h . edge ( 'RX(x)' , 'cnot2' )
h . edge ( 'cnot2' , 'z2' , lhead = 'cluster_hamevo' )
h . edge ( 'z2' , 'e2' , ltail = 'cluster_hamevo' )
h . edge ( 's3' , 'RX(0.5)' )
h . edge ( 'RX(0.5)' , 'cnot3' )
h . edge ( 'cnot3' , 'z3' , lhead = 'cluster_hamevo' )
h . edge ( 'z3' , 'e3' , ltail = 'cluster_hamevo' )
h . edge ( 'cnot1' , 'cnot0' , constraint = 'false' ) # constraint: false is needed to draw vertical edges
h . edge ( 'cnot1' , 'cnot2' , constraint = 'false' ) # constraint: false is needed to draw vertical edges
h . edge ( 'cnot1' , 'cnot3' , constraint = 'false' ) # constraint: false is needed to draw vertical edges
h
Example of cluster of clusters
# Define graph
h = graphviz . Graph ( node_attr = node_attr , graph_attr = graph_attr )
# Define start and end nodes
for i in range ( 4 ):
h . node ( f 's { i } ' , shape = "plaintext" , label = f ' { i } ' , group = f " { i } " )
h . node ( f 'e { i } ' , style = 'invis' , group = f " { i } " )
# Define outer cluster
cluster_attr = { "label" : "Outer cluster" }
cluster_attr . update ( default_cluster_attr )
outer_cluster = graphviz . Graph ( name = "cluster_outer" , graph_attr = cluster_attr )
# Define inner cluster 1 and its nodes
cluster_attr = { "label" : "Inner cluster 1" }
cluster_attr . update ( default_cluster_attr )
inner1_cluster = graphviz . Graph ( name = "cluster_inner1" , graph_attr = cluster_attr )
inner1_cluster . node ( "a0" , group = "0" )
inner1_cluster . node ( "a1" , group = "1" )
outer_cluster . subgraph ( inner1_cluster )
# Define inner cluster 2 and its nodes
cluster_attr = { "label" : "Inner cluster 2" }
cluster_attr . update ( default_cluster_attr )
inner2_cluster = graphviz . Graph ( name = "cluster_inner2" , graph_attr = cluster_attr )
inner2_cluster . node ( "a2" , group = "2" )
inner2_cluster . node ( "a3" , group = "3" )
outer_cluster . subgraph ( inner2_cluster )
# This has to be done here, after inner clusters definitions
h . subgraph ( outer_cluster )
# Define more nodes
for i in range ( 4 ):
h . node ( f "b { i } " , group = f " { i } " )
for i in range ( 4 ):
h . edge ( f 's { i } ' , f 'a { i } ' )
h . edge ( f 'a { i } ' , f 'b { i } ' )
h . edge ( f 'b { i } ' , f 'e { i } ' )
h