Quantum machine learning constructors
Besides the arbitrary Hamiltonian constructors , Qadence also provides a complete set of
program constructors useful for digital-analog quantum machine learning programs.
Feature maps
The feature_map
function can easily create several types of data-encoding blocks. The
two main types of feature maps use a Fourier basis or a Chebyshev basis.
from qadence import feature_map , BasisSet , chain
from qadence.draw import display
n_qubits = 3
fourier_fm = feature_map ( n_qubits , fm_type = BasisSet . FOURIER )
chebyshev_fm = feature_map ( n_qubits , fm_type = BasisSet . CHEBYSHEV )
block = chain ( fourier_fm , chebyshev_fm )
%3
cluster_6a134cb710ee487ba279524251bf7602
Constant Chebyshev FM
cluster_a028901617f74e8590f999f0f8e96f8a
Constant Fourier FM
1c8e455ae9a54a6b84a0e5d550f18787
0
2633034f0e1541009ac491fe1717b0e8
RX(phi)
1c8e455ae9a54a6b84a0e5d550f18787--2633034f0e1541009ac491fe1717b0e8
63574fade2ec42b884159487536f7ab5
1
33c16cb95b3e4d5680622d2c40ee3581
RX(acos(phi))
2633034f0e1541009ac491fe1717b0e8--33c16cb95b3e4d5680622d2c40ee3581
cecbed3b57074c3e8b0ae5fb2b0da814
33c16cb95b3e4d5680622d2c40ee3581--cecbed3b57074c3e8b0ae5fb2b0da814
7905c0d74bcf47f2b3230aebced1e82b
8060565625b842f19536c760b3259380
RX(phi)
63574fade2ec42b884159487536f7ab5--8060565625b842f19536c760b3259380
0f996d40d4c643f0bffa9efd824fa5a4
2
c0c87fdcd5a2473391c9777f659e0f34
RX(acos(phi))
8060565625b842f19536c760b3259380--c0c87fdcd5a2473391c9777f659e0f34
c0c87fdcd5a2473391c9777f659e0f34--7905c0d74bcf47f2b3230aebced1e82b
b520af244d904dc7bd6cce6325b6e3b4
8751ff96a69945c7b78f3e9039ba6adb
RX(phi)
0f996d40d4c643f0bffa9efd824fa5a4--8751ff96a69945c7b78f3e9039ba6adb
c62aa0de01574518a98c3849bf68c0a1
RX(acos(phi))
8751ff96a69945c7b78f3e9039ba6adb--c62aa0de01574518a98c3849bf68c0a1
c62aa0de01574518a98c3849bf68c0a1--b520af244d904dc7bd6cce6325b6e3b4
A custom encoding function can also be passed with sympy
from sympy import asin , Function
n_qubits = 3
# Using a pre-defined sympy Function
custom_fm_0 = feature_map ( n_qubits , fm_type = asin )
# Creating a custom function
def custom_fn ( x ):
return asin ( x ) + x ** 2
custom_fm_1 = feature_map ( n_qubits , fm_type = custom_fn )
block = chain ( custom_fm_0 , custom_fm_1 )
%3
cluster_63c008f4f4dc4b6baa350697dccb08da
Constant <function custom_fn at 0x7ff68cf2d2d0> FM
cluster_a44cd658e4ab49889e244df04ea87bf3
Constant asin FM
0f35e0dad2bd49ba91d0df52662d12f6
0
611686d5611c4c8daff6d61725dde9a8
RX(asin(phi))
0f35e0dad2bd49ba91d0df52662d12f6--611686d5611c4c8daff6d61725dde9a8
beaeb5efc9a14a93bcb67b63cc75efd6
1
340a954443ee49ee9a2eddd95da7926e
RX(phi**2 + asin(phi))
611686d5611c4c8daff6d61725dde9a8--340a954443ee49ee9a2eddd95da7926e
9ab97f5afaa649aa8d9174d65a98e6d7
340a954443ee49ee9a2eddd95da7926e--9ab97f5afaa649aa8d9174d65a98e6d7
52faab2c4a5144fc9ebc2c21dc46e814
5214b82139f8453f9a3dcf71946804ab
RX(asin(phi))
beaeb5efc9a14a93bcb67b63cc75efd6--5214b82139f8453f9a3dcf71946804ab
5378f7ecebd542b09bc41497f20e98d9
2
095db3a02007470f8ca4f43f0ed6bebe
RX(phi**2 + asin(phi))
5214b82139f8453f9a3dcf71946804ab--095db3a02007470f8ca4f43f0ed6bebe
095db3a02007470f8ca4f43f0ed6bebe--52faab2c4a5144fc9ebc2c21dc46e814
744d918e7c844326be53e1ed8fc6dcb9
b9914b4e632b466eb747f6dc80127999
RX(asin(phi))
5378f7ecebd542b09bc41497f20e98d9--b9914b4e632b466eb747f6dc80127999
1ea93b9a91c14f0bb3d5a9cf68b0a876
RX(phi**2 + asin(phi))
b9914b4e632b466eb747f6dc80127999--1ea93b9a91c14f0bb3d5a9cf68b0a876
1ea93b9a91c14f0bb3d5a9cf68b0a876--744d918e7c844326be53e1ed8fc6dcb9
Furthermore, the reupload_scaling
argument can be used to change the scaling applied to each qubit
in the support of the feature map. The default scalings can be chosen from the ReuploadScaling
enumeration.
from qadence import ReuploadScaling
from qadence.draw import display
n_qubits = 5
# Default constant value
fm_constant = feature_map ( n_qubits , fm_type = BasisSet . FOURIER , reupload_scaling = ReuploadScaling . CONSTANT )
# Linearly increasing scaling
fm_tower = feature_map ( n_qubits , fm_type = BasisSet . FOURIER , reupload_scaling = ReuploadScaling . TOWER )
# Exponentially increasing scaling
fm_exp = feature_map ( n_qubits , fm_type = BasisSet . FOURIER , reupload_scaling = ReuploadScaling . EXP )
block = chain ( fm_constant , fm_tower , fm_exp )
%3
cluster_3f02496ed5b44761adf27e923ee694bf
Exponential Fourier FM
cluster_f50b035e8a4b43f19f910a8fb9626f8d
Constant Fourier FM
cluster_085c0bb164f84b568dc5dc66b5ca2be5
Tower Fourier FM
dc8ff6cf5c284ada952cefaa54ab5a23
0
6a0bfce5a99e4f83beab12aab8a40b44
RX(phi)
dc8ff6cf5c284ada952cefaa54ab5a23--6a0bfce5a99e4f83beab12aab8a40b44
96a6f769c1d84699b03bcab799d7303f
1
c138042f956f49f899bd7ec3623f95a0
RX(1.0*phi)
6a0bfce5a99e4f83beab12aab8a40b44--c138042f956f49f899bd7ec3623f95a0
d332c96ba9144ab191b4309fb0cc34bf
RX(1.0*phi)
c138042f956f49f899bd7ec3623f95a0--d332c96ba9144ab191b4309fb0cc34bf
401eccac92034794ae17f5fc2c4b81e9
d332c96ba9144ab191b4309fb0cc34bf--401eccac92034794ae17f5fc2c4b81e9
929f40ec38f84b4986948370b20c7c13
3af2a028b6954f40b34cb833e32c9fe4
RX(phi)
96a6f769c1d84699b03bcab799d7303f--3af2a028b6954f40b34cb833e32c9fe4
dcb371c6f74b4278b53ae6440679d710
2
f940cab0d12840b5919a900e87057e0b
RX(2.0*phi)
3af2a028b6954f40b34cb833e32c9fe4--f940cab0d12840b5919a900e87057e0b
1f976737a5984533bd1153ab22d267cb
RX(2.0*phi)
f940cab0d12840b5919a900e87057e0b--1f976737a5984533bd1153ab22d267cb
1f976737a5984533bd1153ab22d267cb--929f40ec38f84b4986948370b20c7c13
c220b70b918f43d48a30ad1c6e374ddf
a3ff01ad0ce44891a98de3807a485bc8
RX(phi)
dcb371c6f74b4278b53ae6440679d710--a3ff01ad0ce44891a98de3807a485bc8
acb46e2396c7402aac1e8e81860b93f2
3
348b0fabbed54ecb98abd26b2396bc9e
RX(3.0*phi)
a3ff01ad0ce44891a98de3807a485bc8--348b0fabbed54ecb98abd26b2396bc9e
34d08175743247da829eb9e24983bc80
RX(4.0*phi)
348b0fabbed54ecb98abd26b2396bc9e--34d08175743247da829eb9e24983bc80
34d08175743247da829eb9e24983bc80--c220b70b918f43d48a30ad1c6e374ddf
3616e8a1d812447d93d7e7236d1515d7
4083ef74555444d4b4b8bf2eae12e0ac
RX(phi)
acb46e2396c7402aac1e8e81860b93f2--4083ef74555444d4b4b8bf2eae12e0ac
53d5f91e2c034a4bb8b0d860d84f168a
4
fb94164474a440ab953a197dbf4b87f8
RX(4.0*phi)
4083ef74555444d4b4b8bf2eae12e0ac--fb94164474a440ab953a197dbf4b87f8
d8d84672530843c9bd37dae4f541e589
RX(8.0*phi)
fb94164474a440ab953a197dbf4b87f8--d8d84672530843c9bd37dae4f541e589
d8d84672530843c9bd37dae4f541e589--3616e8a1d812447d93d7e7236d1515d7
8aafb686ff5b46e98a0944d5f351ebf0
1bfd5fb3f11a4f7d83a62c33b3ce088b
RX(phi)
53d5f91e2c034a4bb8b0d860d84f168a--1bfd5fb3f11a4f7d83a62c33b3ce088b
7867c05a8e624ba6b6f2389f50144fe3
RX(5.0*phi)
1bfd5fb3f11a4f7d83a62c33b3ce088b--7867c05a8e624ba6b6f2389f50144fe3
6bfea22467524a47945942cd7dfc3a4b
RX(16.0*phi)
7867c05a8e624ba6b6f2389f50144fe3--6bfea22467524a47945942cd7dfc3a4b
6bfea22467524a47945942cd7dfc3a4b--8aafb686ff5b46e98a0944d5f351ebf0
A custom scaling can also be defined with a function with an int
input and int
or float
output.
n_qubits = 5
def custom_scaling ( i : int ) -> int | float :
"""Sqrt(i+1)"""
return ( i + 1 ) ** ( 0.5 )
# Custom scaling function
fm_custom = feature_map ( n_qubits , fm_type = BasisSet . CHEBYSHEV , reupload_scaling = custom_scaling )
%3
b3b7347dbaaa4260824649d607d276c7
0
3cb3d5858dc9425ebed67d80df7e3529
RX(1.0*acos(phi))
b3b7347dbaaa4260824649d607d276c7--3cb3d5858dc9425ebed67d80df7e3529
653fcb6a588742dbb98499d0eb9ebe77
1
170a2189168d4402b8f032877e4417f9
3cb3d5858dc9425ebed67d80df7e3529--170a2189168d4402b8f032877e4417f9
abcf17598e45422495b5e768a9c3d8e2
7926aafff72f44c8840c1c825a9ea512
RX(1.414*acos(phi))
653fcb6a588742dbb98499d0eb9ebe77--7926aafff72f44c8840c1c825a9ea512
4be3b283734243b48b36593e9004c44c
2
7926aafff72f44c8840c1c825a9ea512--abcf17598e45422495b5e768a9c3d8e2
0c53550031ce48979f736475d01fd68e
decf6f923b834957b890bb680b06700c
RX(1.732*acos(phi))
4be3b283734243b48b36593e9004c44c--decf6f923b834957b890bb680b06700c
c561b344d09a4b84b1f2ab1bdaaa2454
3
decf6f923b834957b890bb680b06700c--0c53550031ce48979f736475d01fd68e
00d4963d82d747e98f18882ed15fbeaf
d9402ee605944cc5ab36160febda8695
RX(2.0*acos(phi))
c561b344d09a4b84b1f2ab1bdaaa2454--d9402ee605944cc5ab36160febda8695
40072a6b66984c3fa6c7978913f0bfa6
4
d9402ee605944cc5ab36160febda8695--00d4963d82d747e98f18882ed15fbeaf
349f488d88fd4f81a4c0534a420dbf76
d198d999cb904519ad78ba4338254661
RX(2.236*acos(phi))
40072a6b66984c3fa6c7978913f0bfa6--d198d999cb904519ad78ba4338254661
d198d999cb904519ad78ba4338254661--349f488d88fd4f81a4c0534a420dbf76
To add a trainable parameter that multiplies the feature parameter inside the encoding function,
simply pass a param_prefix
string:
n_qubits = 5
fm_trainable = feature_map (
n_qubits ,
fm_type = BasisSet . FOURIER ,
reupload_scaling = ReuploadScaling . EXP ,
param_prefix = "w" ,
)
%3
16d11b3f9ba44710b30a3b92d9499b1d
0
5716117c0a5d4ad8838224a532f32343
RX(1.0*phi*w₀)
16d11b3f9ba44710b30a3b92d9499b1d--5716117c0a5d4ad8838224a532f32343
c08f966c5ef1475f9d8eb8f4de827ed8
1
e37bf366758a4e4783edc61c4e29aed1
5716117c0a5d4ad8838224a532f32343--e37bf366758a4e4783edc61c4e29aed1
4c4301d4549840f284aaad97e719acb0
567406ef686f49538d5c95e0b0e212cb
RX(2.0*phi*w₁)
c08f966c5ef1475f9d8eb8f4de827ed8--567406ef686f49538d5c95e0b0e212cb
dfdfadd8ce29436aa7b809cb830899be
2
567406ef686f49538d5c95e0b0e212cb--4c4301d4549840f284aaad97e719acb0
0ef6b7c093b84d7e88b5328f4de6d0de
cd65f944bbad441ead363f5284a4b411
RX(4.0*phi*w₂)
dfdfadd8ce29436aa7b809cb830899be--cd65f944bbad441ead363f5284a4b411
875c075e43b6495faa6f809485b263ab
3
cd65f944bbad441ead363f5284a4b411--0ef6b7c093b84d7e88b5328f4de6d0de
cdc48b359bd149788cc8beb14bd54f46
6a69e2e26ebd4fa284296a9cef7f575f
RX(8.0*phi*w₃)
875c075e43b6495faa6f809485b263ab--6a69e2e26ebd4fa284296a9cef7f575f
26940fe1764a44c3b7e95e03f352a7d5
4
6a69e2e26ebd4fa284296a9cef7f575f--cdc48b359bd149788cc8beb14bd54f46
987ad2c242424e94b57e03eeafd87d4e
4c51f45ca3a548a996d98325e2ab93b0
RX(16.0*phi*w₄)
26940fe1764a44c3b7e95e03f352a7d5--4c51f45ca3a548a996d98325e2ab93b0
4c51f45ca3a548a996d98325e2ab93b0--987ad2c242424e94b57e03eeafd87d4e
Note that for the Fourier feature map, the encoding function is simply \(f(x)=x\) . For other cases, like the Chebyshev acos()
encoding,
the trainable parameter may cause the feature value to be outside the domain of the encoding function. This will eventually be fixed
by adding range constraints to trainable parameters in Qadence.
A full description of the remaining arguments can be found in the feature_map
API reference . We provide an example below.
from qadence import RY
n_qubits = 5
# Custom scaling function
fm_full = feature_map (
n_qubits = n_qubits ,
support = tuple ( reversed ( range ( n_qubits ))), # Reverse the qubit support to run the scaling from bottom to top
param = "x" , # Change the name of the parameter
op = RY , # Change the rotation gate between RX, RY, RZ or PHASE
fm_type = BasisSet . CHEBYSHEV ,
reupload_scaling = ReuploadScaling . EXP ,
feature_range = ( - 1.0 , 2.0 ), # Range from which the input data comes from
target_range = ( 1.0 , 3.0 ), # Range the encoder assumes as the natural range
multiplier = 5.0 , # Extra multiplier, which can also be a Parameter
param_prefix = "w" , # Add trainable parameters
)
%3
1b579d8758934d5daffa78cbc8ce0269
0
5e5e9b3e7a064353aa83c1e5568e95d8
RY(80.0*acos(w₄*(0.667*x + 1.667)))
1b579d8758934d5daffa78cbc8ce0269--5e5e9b3e7a064353aa83c1e5568e95d8
f3ddf797190c4496b51695e0f0cd42bf
1
c48c2f7d3aeb410d9b601d01280c9e89
5e5e9b3e7a064353aa83c1e5568e95d8--c48c2f7d3aeb410d9b601d01280c9e89
fc4af4822ed641f381346a2a40203f9a
77191e0811d742ce88a80157c0bde67d
RY(40.0*acos(w₃*(0.667*x + 1.667)))
f3ddf797190c4496b51695e0f0cd42bf--77191e0811d742ce88a80157c0bde67d
288c6c1b243e466ea6a827dcd2a992fa
2
77191e0811d742ce88a80157c0bde67d--fc4af4822ed641f381346a2a40203f9a
7d6ea084dba849b78a15c16c5ef8775d
e2d22ecfdbf04ba9ab55db80835918e0
RY(20.0*acos(w₂*(0.667*x + 1.667)))
288c6c1b243e466ea6a827dcd2a992fa--e2d22ecfdbf04ba9ab55db80835918e0
4f4f4e86effe47b29877768373c902ee
3
e2d22ecfdbf04ba9ab55db80835918e0--7d6ea084dba849b78a15c16c5ef8775d
73c8b28fc1894733a5692f9d8b1b3c2b
91659c6ae84c40bb8e34e00dd2d330df
RY(10.0*acos(w₁*(0.667*x + 1.667)))
4f4f4e86effe47b29877768373c902ee--91659c6ae84c40bb8e34e00dd2d330df
9026542a81e6433480c485e16d03b138
4
91659c6ae84c40bb8e34e00dd2d330df--73c8b28fc1894733a5692f9d8b1b3c2b
e6fb1950386b4767b975c082da417848
797c6c1e575546329a345d489065432f
RY(5.0*acos(w₀*(0.667*x + 1.667)))
9026542a81e6433480c485e16d03b138--797c6c1e575546329a345d489065432f
797c6c1e575546329a345d489065432f--e6fb1950386b4767b975c082da417848
Hardware-efficient ansatz
Ansatze blocks for quantum machine-learning are typically built following the Hardware-Efficient Ansatz formalism (HEA).
Both fully digital and digital-analog HEAs can easily be built with the hea
function. By default,
the digital version is returned:
from qadence import hea
from qadence.draw import display
n_qubits = 3
depth = 2
ansatz = hea ( n_qubits , depth )
%3
ddaf5be77bc04009861dfb1bdfe620ef
0
1d9c9c4f1246443999d9120e4371bfb0
RX(theta₀)
ddaf5be77bc04009861dfb1bdfe620ef--1d9c9c4f1246443999d9120e4371bfb0
8f22b5028f0646d1965b600e3cb95443
1
d366ed4f939b43adbd8b9442f29f87e6
RY(theta₃)
1d9c9c4f1246443999d9120e4371bfb0--d366ed4f939b43adbd8b9442f29f87e6
e095c5cbb8d84030b33c31d3d40a85a0
RX(theta₆)
d366ed4f939b43adbd8b9442f29f87e6--e095c5cbb8d84030b33c31d3d40a85a0
c73498d6bee54c409ae2449b4667c0db
e095c5cbb8d84030b33c31d3d40a85a0--c73498d6bee54c409ae2449b4667c0db
eea8e1029f664740a3547b88842f47a3
c73498d6bee54c409ae2449b4667c0db--eea8e1029f664740a3547b88842f47a3
b69249e327fa46b7b006e0dd19a0af56
RX(theta₉)
eea8e1029f664740a3547b88842f47a3--b69249e327fa46b7b006e0dd19a0af56
cc3bb53eff4846c4a0f9c4e32d8563f0
RY(theta₁₂)
b69249e327fa46b7b006e0dd19a0af56--cc3bb53eff4846c4a0f9c4e32d8563f0
2853735665f94225b96df01ae43ed8d1
RX(theta₁₅)
cc3bb53eff4846c4a0f9c4e32d8563f0--2853735665f94225b96df01ae43ed8d1
0619d0ce20b14b5ca8a93b170ac5e8f3
2853735665f94225b96df01ae43ed8d1--0619d0ce20b14b5ca8a93b170ac5e8f3
9a262f8dff444ae3b15f919ba63df6ef
0619d0ce20b14b5ca8a93b170ac5e8f3--9a262f8dff444ae3b15f919ba63df6ef
9612ff0a1e6748e2859125ae5f4ff000
9a262f8dff444ae3b15f919ba63df6ef--9612ff0a1e6748e2859125ae5f4ff000
ce945c84eeb345f393c5e403a3ccd4f5
994b44fb94d345b6b34c33503c149c36
RX(theta₁)
8f22b5028f0646d1965b600e3cb95443--994b44fb94d345b6b34c33503c149c36
c04a2e5f58c74591b14bdf9c5dafc969
2
73086a27854e4dcb88d03c0ba174cea7
RY(theta₄)
994b44fb94d345b6b34c33503c149c36--73086a27854e4dcb88d03c0ba174cea7
ee2d1be7062c4d0399bc4184ea90b538
RX(theta₇)
73086a27854e4dcb88d03c0ba174cea7--ee2d1be7062c4d0399bc4184ea90b538
6f8efaf908924c88bb12e3499aba8f7f
X
ee2d1be7062c4d0399bc4184ea90b538--6f8efaf908924c88bb12e3499aba8f7f
6f8efaf908924c88bb12e3499aba8f7f--c73498d6bee54c409ae2449b4667c0db
66577e425d1047cfb7a4de8984aacb98
6f8efaf908924c88bb12e3499aba8f7f--66577e425d1047cfb7a4de8984aacb98
1dda3297ae47457d8f2f7a87cec28cdf
RX(theta₁₀)
66577e425d1047cfb7a4de8984aacb98--1dda3297ae47457d8f2f7a87cec28cdf
b3499f154d47411eab1f699694a8005c
RY(theta₁₃)
1dda3297ae47457d8f2f7a87cec28cdf--b3499f154d47411eab1f699694a8005c
ca21d9a4acdf4128a866df4bd0f84de3
RX(theta₁₆)
b3499f154d47411eab1f699694a8005c--ca21d9a4acdf4128a866df4bd0f84de3
8d5dc3ac65d6492eb91043ac254e0a77
X
ca21d9a4acdf4128a866df4bd0f84de3--8d5dc3ac65d6492eb91043ac254e0a77
8d5dc3ac65d6492eb91043ac254e0a77--0619d0ce20b14b5ca8a93b170ac5e8f3
a8641e36135a4e5eafe37e62cb1457a7
8d5dc3ac65d6492eb91043ac254e0a77--a8641e36135a4e5eafe37e62cb1457a7
a8641e36135a4e5eafe37e62cb1457a7--ce945c84eeb345f393c5e403a3ccd4f5
e57b885bb42b469d9e8977f479f219c6
8e00ed9e5ddf43b7af4f834591579631
RX(theta₂)
c04a2e5f58c74591b14bdf9c5dafc969--8e00ed9e5ddf43b7af4f834591579631
8d8441fe8c2043d7aa667b22197bf80b
RY(theta₅)
8e00ed9e5ddf43b7af4f834591579631--8d8441fe8c2043d7aa667b22197bf80b
5e80923e99c042f68bf92171b91226b1
RX(theta₈)
8d8441fe8c2043d7aa667b22197bf80b--5e80923e99c042f68bf92171b91226b1
67b322ea51bb42e1bf2ad7ac99a709bb
5e80923e99c042f68bf92171b91226b1--67b322ea51bb42e1bf2ad7ac99a709bb
4a2e917203e5461794798d4703d39064
X
67b322ea51bb42e1bf2ad7ac99a709bb--4a2e917203e5461794798d4703d39064
4a2e917203e5461794798d4703d39064--66577e425d1047cfb7a4de8984aacb98
00761ee12aeb47409aa84ea76c998154
RX(theta₁₁)
4a2e917203e5461794798d4703d39064--00761ee12aeb47409aa84ea76c998154
ba2084260ad1413eb5509da87fe6208a
RY(theta₁₄)
00761ee12aeb47409aa84ea76c998154--ba2084260ad1413eb5509da87fe6208a
cc331158ed5347719073079ccc2d6a54
RX(theta₁₇)
ba2084260ad1413eb5509da87fe6208a--cc331158ed5347719073079ccc2d6a54
48aef4ce96074985a292254a2e2b03c4
cc331158ed5347719073079ccc2d6a54--48aef4ce96074985a292254a2e2b03c4
9e9d015001574e70801225e15867f10d
X
48aef4ce96074985a292254a2e2b03c4--9e9d015001574e70801225e15867f10d
9e9d015001574e70801225e15867f10d--a8641e36135a4e5eafe37e62cb1457a7
9e9d015001574e70801225e15867f10d--e57b885bb42b469d9e8977f479f219c6
As seen above, the rotation layers are automatically parameterized, and the prefix "theta"
can be changed with the param_prefix
argument.
Furthermore, both the single-qubit rotations and the two-qubit entangler can be customized with the operations
and entangler
argument. The operations can be passed as a list of single-qubit rotations, while the entangler should be either CNOT
, CZ
, CRX
, CRY
, CRZ
or CPHASE
.
from qadence import RX , RY , CPHASE
ansatz = hea (
n_qubits = n_qubits ,
depth = depth ,
param_prefix = "phi" ,
operations = [ RX , RY , RX ],
entangler = CPHASE
)
%3
eedfc9ab343447758ce860777071343b
0
59cc92870e5a45adb9d72e1e7a4a66bf
RX(phi₀)
eedfc9ab343447758ce860777071343b--59cc92870e5a45adb9d72e1e7a4a66bf
39789ffb69ae4dd1bb59a0ee04a62fd1
1
241e45a5dd9d42c3b16f182645aa4f1c
RY(phi₃)
59cc92870e5a45adb9d72e1e7a4a66bf--241e45a5dd9d42c3b16f182645aa4f1c
149ea507197448c588aa8d51795c6a2b
RX(phi₆)
241e45a5dd9d42c3b16f182645aa4f1c--149ea507197448c588aa8d51795c6a2b
9b846e9a38cc408ba5a71af27e09d3a8
149ea507197448c588aa8d51795c6a2b--9b846e9a38cc408ba5a71af27e09d3a8
cb0f1f67ec0e44688e8e005c5b39f811
9b846e9a38cc408ba5a71af27e09d3a8--cb0f1f67ec0e44688e8e005c5b39f811
dd443f5c90224e09a9c529cdf9a5ea8d
RX(phi₉)
cb0f1f67ec0e44688e8e005c5b39f811--dd443f5c90224e09a9c529cdf9a5ea8d
96fdc2c11c704f49b116daefa126732f
RY(phi₁₂)
dd443f5c90224e09a9c529cdf9a5ea8d--96fdc2c11c704f49b116daefa126732f
d2dc347c350f4eb3986a7b02321d68e3
RX(phi₁₅)
96fdc2c11c704f49b116daefa126732f--d2dc347c350f4eb3986a7b02321d68e3
ccbf0c83b1344c6783516751e6a425a6
d2dc347c350f4eb3986a7b02321d68e3--ccbf0c83b1344c6783516751e6a425a6
242a87227f47468a959d6ebcbb8ff3cb
ccbf0c83b1344c6783516751e6a425a6--242a87227f47468a959d6ebcbb8ff3cb
81f6e22a2af747168f7ea37b346da75a
242a87227f47468a959d6ebcbb8ff3cb--81f6e22a2af747168f7ea37b346da75a
184cab9637e74c9a98d64df7bfaecff1
5c054cb634334db88f4039ceeac00eba
RX(phi₁)
39789ffb69ae4dd1bb59a0ee04a62fd1--5c054cb634334db88f4039ceeac00eba
485f27d0c77843a0b9bbf09e9199a0c8
2
3a8960730a7a45cf9ef3e01ff8b82ccf
RY(phi₄)
5c054cb634334db88f4039ceeac00eba--3a8960730a7a45cf9ef3e01ff8b82ccf
9786f8cc9ad04ef5bf3ee1c9ed9ee619
RX(phi₇)
3a8960730a7a45cf9ef3e01ff8b82ccf--9786f8cc9ad04ef5bf3ee1c9ed9ee619
fcb7351b0cf645788434c247c15e4fad
PHASE(phi_ent₀)
9786f8cc9ad04ef5bf3ee1c9ed9ee619--fcb7351b0cf645788434c247c15e4fad
fcb7351b0cf645788434c247c15e4fad--9b846e9a38cc408ba5a71af27e09d3a8
c850d25019b541e598c67bd1014434b2
fcb7351b0cf645788434c247c15e4fad--c850d25019b541e598c67bd1014434b2
05b5e0086b934f27ae92b7cb139f1cf6
RX(phi₁₀)
c850d25019b541e598c67bd1014434b2--05b5e0086b934f27ae92b7cb139f1cf6
0f4e6d8ee67742e9a52b4f9cdddfcfee
RY(phi₁₃)
05b5e0086b934f27ae92b7cb139f1cf6--0f4e6d8ee67742e9a52b4f9cdddfcfee
5c781f060d114263b7e125bc8dc27db1
RX(phi₁₆)
0f4e6d8ee67742e9a52b4f9cdddfcfee--5c781f060d114263b7e125bc8dc27db1
65c4ed44fdbe4170b9f5ef5ab6edfb6c
PHASE(phi_ent₂)
5c781f060d114263b7e125bc8dc27db1--65c4ed44fdbe4170b9f5ef5ab6edfb6c
65c4ed44fdbe4170b9f5ef5ab6edfb6c--ccbf0c83b1344c6783516751e6a425a6
2b3ee9cbf8ff4d4f95bcbb0aee2246d1
65c4ed44fdbe4170b9f5ef5ab6edfb6c--2b3ee9cbf8ff4d4f95bcbb0aee2246d1
2b3ee9cbf8ff4d4f95bcbb0aee2246d1--184cab9637e74c9a98d64df7bfaecff1
62325038dd134641a421886719490db3
7d5351980ae6411eb0d696fb14bfe91f
RX(phi₂)
485f27d0c77843a0b9bbf09e9199a0c8--7d5351980ae6411eb0d696fb14bfe91f
9c558fd621874df9b71c59f9a79787f3
RY(phi₅)
7d5351980ae6411eb0d696fb14bfe91f--9c558fd621874df9b71c59f9a79787f3
ea0c5cd726f74ba4a975182712c9f292
RX(phi₈)
9c558fd621874df9b71c59f9a79787f3--ea0c5cd726f74ba4a975182712c9f292
d4e6caf864784c098ce71b346895c8df
ea0c5cd726f74ba4a975182712c9f292--d4e6caf864784c098ce71b346895c8df
4ac9f19264474a5d9ac43b9859adf32a
PHASE(phi_ent₁)
d4e6caf864784c098ce71b346895c8df--4ac9f19264474a5d9ac43b9859adf32a
4ac9f19264474a5d9ac43b9859adf32a--c850d25019b541e598c67bd1014434b2
d354970a5ba944db91feabcd98cc83c4
RX(phi₁₁)
4ac9f19264474a5d9ac43b9859adf32a--d354970a5ba944db91feabcd98cc83c4
28864a36be924ffeb8a20687cefd3240
RY(phi₁₄)
d354970a5ba944db91feabcd98cc83c4--28864a36be924ffeb8a20687cefd3240
e23a8305ead74fd4b8844d96f1dc4aeb
RX(phi₁₇)
28864a36be924ffeb8a20687cefd3240--e23a8305ead74fd4b8844d96f1dc4aeb
879c13fddc7c4a309f460bc304c2716e
e23a8305ead74fd4b8844d96f1dc4aeb--879c13fddc7c4a309f460bc304c2716e
64f3b239e0ab4d1dbe64d217b31897ce
PHASE(phi_ent₃)
879c13fddc7c4a309f460bc304c2716e--64f3b239e0ab4d1dbe64d217b31897ce
64f3b239e0ab4d1dbe64d217b31897ce--2b3ee9cbf8ff4d4f95bcbb0aee2246d1
64f3b239e0ab4d1dbe64d217b31897ce--62325038dd134641a421886719490db3
Having a truly hardware-efficient ansatz means that the entangling operation can be chosen according to each device's native interactions. Besides digital operations, in Qadence it is also possible to build digital-analog HEAs with the entanglement produced by the natural evolution of a set of interacting qubits, as natively implemented in neutral atom devices. As with other digital-analog functions, this can be controlled with the strategy
argument which can be chosen from the Strategy
enum type. Currently, only Strategy.DIGITAL
and Strategy.SDAQC
are available. By default, calling strategy = Strategy.SDAQC
will use a global entangling Hamiltonian with Ising-like \(NN\) interactions and constant interaction strength,
from qadence import Strategy
ansatz = hea (
n_qubits ,
depth = depth ,
strategy = Strategy . SDAQC
)
%3
cluster_0638ecaebe86441db0fbdd9975971f38
cluster_41bee70a26454bb2a2c9e8f911bda772
cdee2bfcedb24b83a9b3a097c8e26352
0
08bc5c6ae2444e02bc22143885e10328
RX(theta₀)
cdee2bfcedb24b83a9b3a097c8e26352--08bc5c6ae2444e02bc22143885e10328
54b450088c274a5e88b94ee656c1786b
1
203321cc7cd646ccb384ca5c3e2e0184
RY(theta₃)
08bc5c6ae2444e02bc22143885e10328--203321cc7cd646ccb384ca5c3e2e0184
f476d407b935444683b6c194b956d6c5
RX(theta₆)
203321cc7cd646ccb384ca5c3e2e0184--f476d407b935444683b6c194b956d6c5
f04023dbe5154a489ac0b6195c97c9e4
HamEvo
f476d407b935444683b6c194b956d6c5--f04023dbe5154a489ac0b6195c97c9e4
2bd6b08713ee4f029426beaaeae41255
RX(theta₉)
f04023dbe5154a489ac0b6195c97c9e4--2bd6b08713ee4f029426beaaeae41255
7634f27410c44911af8bfd92531848ab
RY(theta₁₂)
2bd6b08713ee4f029426beaaeae41255--7634f27410c44911af8bfd92531848ab
005743362fc84cc8b8fc80aca6e6411b
RX(theta₁₅)
7634f27410c44911af8bfd92531848ab--005743362fc84cc8b8fc80aca6e6411b
1db2a4ac885b42e982314bb881bf5424
HamEvo
005743362fc84cc8b8fc80aca6e6411b--1db2a4ac885b42e982314bb881bf5424
9540c74c229a4719af239c548549058b
1db2a4ac885b42e982314bb881bf5424--9540c74c229a4719af239c548549058b
2d6d529fef074f769d29469822babc73
20d1617789364ae98c33d01e0f2fa874
RX(theta₁)
54b450088c274a5e88b94ee656c1786b--20d1617789364ae98c33d01e0f2fa874
2268632be5ae4d629c431295ed833ac5
2
6ba1734d261d4a3484bf016cec5f11c1
RY(theta₄)
20d1617789364ae98c33d01e0f2fa874--6ba1734d261d4a3484bf016cec5f11c1
c9e9e61ea0874015a05ae0ed718afc6b
RX(theta₇)
6ba1734d261d4a3484bf016cec5f11c1--c9e9e61ea0874015a05ae0ed718afc6b
01327b3ea9674607ba5cb11ed3f01a49
t = theta_t₀
c9e9e61ea0874015a05ae0ed718afc6b--01327b3ea9674607ba5cb11ed3f01a49
ba73de472fe644b6882d8667f908f728
RX(theta₁₀)
01327b3ea9674607ba5cb11ed3f01a49--ba73de472fe644b6882d8667f908f728
a62e07c93a7b4dce83b8083326b416f2
RY(theta₁₃)
ba73de472fe644b6882d8667f908f728--a62e07c93a7b4dce83b8083326b416f2
0b7da8cfece44691ad6761ba004ec5c7
RX(theta₁₆)
a62e07c93a7b4dce83b8083326b416f2--0b7da8cfece44691ad6761ba004ec5c7
64032b14267c4e11882e0cba306b1735
t = theta_t₁
0b7da8cfece44691ad6761ba004ec5c7--64032b14267c4e11882e0cba306b1735
64032b14267c4e11882e0cba306b1735--2d6d529fef074f769d29469822babc73
eb7310d069e742cfbd592561b008f681
6f46874f28f640449841667eb7ef9f00
RX(theta₂)
2268632be5ae4d629c431295ed833ac5--6f46874f28f640449841667eb7ef9f00
ab4ac54d785841b6bfe906db8042a88a
RY(theta₅)
6f46874f28f640449841667eb7ef9f00--ab4ac54d785841b6bfe906db8042a88a
16f42a7cda994dcea93e110b92ac480c
RX(theta₈)
ab4ac54d785841b6bfe906db8042a88a--16f42a7cda994dcea93e110b92ac480c
daa0a9d946f846a3bf238a50e01c693e
16f42a7cda994dcea93e110b92ac480c--daa0a9d946f846a3bf238a50e01c693e
279e73da630449f089da2ea4356bcebf
RX(theta₁₁)
daa0a9d946f846a3bf238a50e01c693e--279e73da630449f089da2ea4356bcebf
3b0eaa2de4d04c62a7af26261e11adbf
RY(theta₁₄)
279e73da630449f089da2ea4356bcebf--3b0eaa2de4d04c62a7af26261e11adbf
ec3205bbfc9148c49268dc5540cd59e8
RX(theta₁₇)
3b0eaa2de4d04c62a7af26261e11adbf--ec3205bbfc9148c49268dc5540cd59e8
a77ebb3f5cb34c2b87312f4008c63659
ec3205bbfc9148c49268dc5540cd59e8--a77ebb3f5cb34c2b87312f4008c63659
a77ebb3f5cb34c2b87312f4008c63659--eb7310d069e742cfbd592561b008f681
Note that, by default, only the time-parameter is automatically parameterized when building a digital-analog HEA. However, as described in the Hamiltonians tutorial , arbitrary interaction Hamiltonians can be easily built with the hamiltonian_factory
function, with both customized or fully parameterized interactions, and these can be directly passed as the entangler
for a customizable digital-analog HEA.
from qadence import hamiltonian_factory , Interaction , N , Register , hea
# Build a parameterized neutral-atom Hamiltonian following a honeycomb_lattice:
register = Register . honeycomb_lattice ( 1 , 1 )
entangler = hamiltonian_factory (
register ,
interaction = Interaction . NN ,
detuning = N ,
interaction_strength = "e" ,
detuning_strength = "n"
)
# Build a fully parameterized Digital-Analog HEA:
n_qubits = register . n_qubits
depth = 2
ansatz = hea (
n_qubits = register . n_qubits ,
depth = depth ,
operations = [ RX , RY , RX ],
entangler = entangler ,
strategy = Strategy . SDAQC
)
%3
cluster_e1fe65a595fe44b9af5b0f38bd455a9e
cluster_dce8bf0022344083b6b7bb4de2da795a
7a04da0d3560421cb5d3eacbfb2fc868
0
f6cd661fc257472790711bdc5b336be5
RX(theta₀)
7a04da0d3560421cb5d3eacbfb2fc868--f6cd661fc257472790711bdc5b336be5
0a638cd024de4de78fb38dc189b09665
1
47b8bce5fe4c4d1d8269e75e49041ccd
RY(theta₆)
f6cd661fc257472790711bdc5b336be5--47b8bce5fe4c4d1d8269e75e49041ccd
031c8aaa578d4657a8c9ab3b3ed245cf
RX(theta₁₂)
47b8bce5fe4c4d1d8269e75e49041ccd--031c8aaa578d4657a8c9ab3b3ed245cf
96a82ead5c71444d944037b623210da9
031c8aaa578d4657a8c9ab3b3ed245cf--96a82ead5c71444d944037b623210da9
f71cc887d9c642d192b674765bfccdd9
RX(theta₁₈)
96a82ead5c71444d944037b623210da9--f71cc887d9c642d192b674765bfccdd9
11c97d7d92aa47a8b3d348179e8c7938
RY(theta₂₄)
f71cc887d9c642d192b674765bfccdd9--11c97d7d92aa47a8b3d348179e8c7938
30e1ce47e8854377926c5c527de2fa67
RX(theta₃₀)
11c97d7d92aa47a8b3d348179e8c7938--30e1ce47e8854377926c5c527de2fa67
7f050069726047d482bc9aa8f66df64b
30e1ce47e8854377926c5c527de2fa67--7f050069726047d482bc9aa8f66df64b
efe932eff9c24272a6804311908fb87d
7f050069726047d482bc9aa8f66df64b--efe932eff9c24272a6804311908fb87d
b5fd698bc8b6460a943ef64d4e0e993f
ffb4b420d99242579074cf5aaf4a5326
RX(theta₁)
0a638cd024de4de78fb38dc189b09665--ffb4b420d99242579074cf5aaf4a5326
ec4f7cb126cf4f848cffb74b0d8ac8bf
2
ae48824272c148abbdfbab778702dd3c
RY(theta₇)
ffb4b420d99242579074cf5aaf4a5326--ae48824272c148abbdfbab778702dd3c
52d7a4e7fd3e4fab97ede12831d1746c
RX(theta₁₃)
ae48824272c148abbdfbab778702dd3c--52d7a4e7fd3e4fab97ede12831d1746c
c6dc7712be324c9c8c9b809ec8ebf014
52d7a4e7fd3e4fab97ede12831d1746c--c6dc7712be324c9c8c9b809ec8ebf014
abc5e0036fab44a9a67ef1a2d1e0d550
RX(theta₁₉)
c6dc7712be324c9c8c9b809ec8ebf014--abc5e0036fab44a9a67ef1a2d1e0d550
d3e944e8cdd648d3bcffd04358f5e01f
RY(theta₂₅)
abc5e0036fab44a9a67ef1a2d1e0d550--d3e944e8cdd648d3bcffd04358f5e01f
26523355b59a434a8a152fadbe5739a3
RX(theta₃₁)
d3e944e8cdd648d3bcffd04358f5e01f--26523355b59a434a8a152fadbe5739a3
17db26f61bca4404bf8c7b2680806664
26523355b59a434a8a152fadbe5739a3--17db26f61bca4404bf8c7b2680806664
17db26f61bca4404bf8c7b2680806664--b5fd698bc8b6460a943ef64d4e0e993f
96b2f6a31e2d4b008f87a62da10cee67
de39c3f8055247749ef606f49aadc0d5
RX(theta₂)
ec4f7cb126cf4f848cffb74b0d8ac8bf--de39c3f8055247749ef606f49aadc0d5
f14b7d17ce4748bda6668667d23ac49a
3
d44ab211fdae4ac7b59c0847e8565009
RY(theta₈)
de39c3f8055247749ef606f49aadc0d5--d44ab211fdae4ac7b59c0847e8565009
8f289a985f0f4ceeb2c06b2b505fca6b
RX(theta₁₄)
d44ab211fdae4ac7b59c0847e8565009--8f289a985f0f4ceeb2c06b2b505fca6b
fd8f4bf17f28478a8cd304e7996b3ba0
HamEvo
8f289a985f0f4ceeb2c06b2b505fca6b--fd8f4bf17f28478a8cd304e7996b3ba0
f4cc8d1d760348cd8cf695eab188f104
RX(theta₂₀)
fd8f4bf17f28478a8cd304e7996b3ba0--f4cc8d1d760348cd8cf695eab188f104
416258dc5fb64ba3ab6db5b2a862a0bb
RY(theta₂₆)
f4cc8d1d760348cd8cf695eab188f104--416258dc5fb64ba3ab6db5b2a862a0bb
7ce6b51b54c142249dbe5262a37479aa
RX(theta₃₂)
416258dc5fb64ba3ab6db5b2a862a0bb--7ce6b51b54c142249dbe5262a37479aa
33b432e8845d475ca9779a6d0770b61d
HamEvo
7ce6b51b54c142249dbe5262a37479aa--33b432e8845d475ca9779a6d0770b61d
33b432e8845d475ca9779a6d0770b61d--96b2f6a31e2d4b008f87a62da10cee67
ca03e30b37334136b393c34a587d012a
5aa8ccc46ee042ee98936aef3c541e8f
RX(theta₃)
f14b7d17ce4748bda6668667d23ac49a--5aa8ccc46ee042ee98936aef3c541e8f
65aa35c4258f4450b8491b516048c290
4
f102eb372cce40b49f19f1d18b9a4be7
RY(theta₉)
5aa8ccc46ee042ee98936aef3c541e8f--f102eb372cce40b49f19f1d18b9a4be7
c7490aca8cbb4fc8a62dcc85f3afc643
RX(theta₁₅)
f102eb372cce40b49f19f1d18b9a4be7--c7490aca8cbb4fc8a62dcc85f3afc643
34ebd62b1a274a1691a4fdbae83523e6
t = theta_t₀
c7490aca8cbb4fc8a62dcc85f3afc643--34ebd62b1a274a1691a4fdbae83523e6
1354974f97c54e6a93c7ea84c7d4b4ea
RX(theta₂₁)
34ebd62b1a274a1691a4fdbae83523e6--1354974f97c54e6a93c7ea84c7d4b4ea
926ff6978f694eec87073cd8f86d03c9
RY(theta₂₇)
1354974f97c54e6a93c7ea84c7d4b4ea--926ff6978f694eec87073cd8f86d03c9
625ee4d2e85c4d64b53e2c5c2d706631
RX(theta₃₃)
926ff6978f694eec87073cd8f86d03c9--625ee4d2e85c4d64b53e2c5c2d706631
cc5a3c8254a94d52a6bd06c3d7f969e4
t = theta_t₁
625ee4d2e85c4d64b53e2c5c2d706631--cc5a3c8254a94d52a6bd06c3d7f969e4
cc5a3c8254a94d52a6bd06c3d7f969e4--ca03e30b37334136b393c34a587d012a
b0133ac3ed02461d8090e363cc3bff4a
4c0c5b2bbe224609a1ec6a2626875401
RX(theta₄)
65aa35c4258f4450b8491b516048c290--4c0c5b2bbe224609a1ec6a2626875401
5f09cf5f185b4187b85573f710d583c0
5
1434088d6a6c4ee09d55578ccb7b3537
RY(theta₁₀)
4c0c5b2bbe224609a1ec6a2626875401--1434088d6a6c4ee09d55578ccb7b3537
6f6b3a4368584f16971c46c0eb1ad016
RX(theta₁₆)
1434088d6a6c4ee09d55578ccb7b3537--6f6b3a4368584f16971c46c0eb1ad016
cf551b29e6494c5bb3ea2b59c3b50b31
6f6b3a4368584f16971c46c0eb1ad016--cf551b29e6494c5bb3ea2b59c3b50b31
8e9c6bf6a53e4be5a424330571e0987c
RX(theta₂₂)
cf551b29e6494c5bb3ea2b59c3b50b31--8e9c6bf6a53e4be5a424330571e0987c
89213a1758454ceb86cd1f88f7574d7e
RY(theta₂₈)
8e9c6bf6a53e4be5a424330571e0987c--89213a1758454ceb86cd1f88f7574d7e
3919200136d449d389b564772b47703e
RX(theta₃₄)
89213a1758454ceb86cd1f88f7574d7e--3919200136d449d389b564772b47703e
05d1ab69545347468d3cfd206bcd43b4
3919200136d449d389b564772b47703e--05d1ab69545347468d3cfd206bcd43b4
05d1ab69545347468d3cfd206bcd43b4--b0133ac3ed02461d8090e363cc3bff4a
7880d47414ce4f5aa32166e9c1fd12ab
9739ab33dc5b4ea59cf9286c4bd033bb
RX(theta₅)
5f09cf5f185b4187b85573f710d583c0--9739ab33dc5b4ea59cf9286c4bd033bb
d4f04eaea3364d75969fc7b2fe9a17ba
RY(theta₁₁)
9739ab33dc5b4ea59cf9286c4bd033bb--d4f04eaea3364d75969fc7b2fe9a17ba
888b23af1d534143a04cf3b445961d23
RX(theta₁₇)
d4f04eaea3364d75969fc7b2fe9a17ba--888b23af1d534143a04cf3b445961d23
fc0cd4833dc244af895c74c416de0d67
888b23af1d534143a04cf3b445961d23--fc0cd4833dc244af895c74c416de0d67
791e311a5bec4fd2b97d01b07c81bebc
RX(theta₂₃)
fc0cd4833dc244af895c74c416de0d67--791e311a5bec4fd2b97d01b07c81bebc
efed9b3ed746400e9bee2999b0f2d23e
RY(theta₂₉)
791e311a5bec4fd2b97d01b07c81bebc--efed9b3ed746400e9bee2999b0f2d23e
b8282c3a21e44fc7b9fb907ab7deb753
RX(theta₃₅)
efed9b3ed746400e9bee2999b0f2d23e--b8282c3a21e44fc7b9fb907ab7deb753
c98ee6e2e023489ca9e4bb11cbd78ebc
b8282c3a21e44fc7b9fb907ab7deb753--c98ee6e2e023489ca9e4bb11cbd78ebc
c98ee6e2e023489ca9e4bb11cbd78ebc--7880d47414ce4f5aa32166e9c1fd12ab
Identity-initialized ansatz
It is widely known that parametrized quantum circuits are characterized by barren plateaus, where the gradient becomes exponentially small in the number of qubits. Here we include one of many techniques that have been proposed in recent years to mitigate this effect and facilitate QNN
s training: Grant et al. showed that initializing the weights of a QNN
so that each block of the circuit evaluates to identity reduces the effect of barren plateaus in the initial stage of training. In a similar fashion to hea
, such circuit can be created via calling the associated function, identity_initialized_ansatz
:
from qadence.constructors import identity_initialized_ansatz
from qadence.draw import display
n_qubits = 3
depth = 2
ansatz = identity_initialized_ansatz ( n_qubits , depth )
%3
cluster_852e89757a7747a48576182244d91aaf
BPMA-1
cluster_d026cb234b7d406cb6ecff015689dcf2
BPMA-0
1a6b675202ca4f1ebfc5bc4ff331068f
0
b970171d51ee4a018f9d93de5a4f6630
RX(iia_α₀₀)
1a6b675202ca4f1ebfc5bc4ff331068f--b970171d51ee4a018f9d93de5a4f6630
0ad05a2f813a48e7b578209cb6b0b77d
1
7bedb481787444a2a85ca90ff12ee744
RY(iia_α₀₃)
b970171d51ee4a018f9d93de5a4f6630--7bedb481787444a2a85ca90ff12ee744
9771882292b848da86f7d39b76f04b06
7bedb481787444a2a85ca90ff12ee744--9771882292b848da86f7d39b76f04b06
a00a118bb7fc4ec388e3bd6c5e7191ef
9771882292b848da86f7d39b76f04b06--a00a118bb7fc4ec388e3bd6c5e7191ef
c2f5f8efbc2f49b9bf4265586a44c831
RX(iia_γ₀₀)
a00a118bb7fc4ec388e3bd6c5e7191ef--c2f5f8efbc2f49b9bf4265586a44c831
08c2015cf0fa4c1f89229818e4d8ef72
c2f5f8efbc2f49b9bf4265586a44c831--08c2015cf0fa4c1f89229818e4d8ef72
111da714880141edb452bd5b97a11397
08c2015cf0fa4c1f89229818e4d8ef72--111da714880141edb452bd5b97a11397
313020e9ed394f8b81bf720909b88791
RY(iia_β₀₃)
111da714880141edb452bd5b97a11397--313020e9ed394f8b81bf720909b88791
e722e2838dea4a2c9b59cc725e0a4496
RX(iia_β₀₀)
313020e9ed394f8b81bf720909b88791--e722e2838dea4a2c9b59cc725e0a4496
be2ba75f7d1e4cd789bbaa32406c4774
RX(iia_α₁₀)
e722e2838dea4a2c9b59cc725e0a4496--be2ba75f7d1e4cd789bbaa32406c4774
31068f077e7f4c3b9e642797ede39491
RY(iia_α₁₃)
be2ba75f7d1e4cd789bbaa32406c4774--31068f077e7f4c3b9e642797ede39491
29717a447ab7489cb9ab913d8cc94bdd
31068f077e7f4c3b9e642797ede39491--29717a447ab7489cb9ab913d8cc94bdd
04cb8a6349db4b3e9c11ce0cdc19080a
29717a447ab7489cb9ab913d8cc94bdd--04cb8a6349db4b3e9c11ce0cdc19080a
d44b5d1412a54b91952ca15cd55716cf
RX(iia_γ₁₀)
04cb8a6349db4b3e9c11ce0cdc19080a--d44b5d1412a54b91952ca15cd55716cf
8527e751777f499da06d331ee4c92b1f
d44b5d1412a54b91952ca15cd55716cf--8527e751777f499da06d331ee4c92b1f
363d657b913c4807a278c20a53ecd011
8527e751777f499da06d331ee4c92b1f--363d657b913c4807a278c20a53ecd011
e8ff7b474b9c4cabb5e7b972e9c1050b
RY(iia_β₁₃)
363d657b913c4807a278c20a53ecd011--e8ff7b474b9c4cabb5e7b972e9c1050b
47e075d1e1c24e209ff34ac73bf40053
RX(iia_β₁₀)
e8ff7b474b9c4cabb5e7b972e9c1050b--47e075d1e1c24e209ff34ac73bf40053
6e8fad243aac454eaae5baf37b1045bb
47e075d1e1c24e209ff34ac73bf40053--6e8fad243aac454eaae5baf37b1045bb
00f04de2701347db950f4464e2360586
0aa1a70dc24d452d947000318eaa9295
RX(iia_α₀₁)
0ad05a2f813a48e7b578209cb6b0b77d--0aa1a70dc24d452d947000318eaa9295
40dee5de10ef4ea283e93ebb6e726dec
2
0336bdc3f8b64cd5ae16fa5c36bd858c
RY(iia_α₀₄)
0aa1a70dc24d452d947000318eaa9295--0336bdc3f8b64cd5ae16fa5c36bd858c
7775682991d0406486d8c9e71c0aae1c
X
0336bdc3f8b64cd5ae16fa5c36bd858c--7775682991d0406486d8c9e71c0aae1c
7775682991d0406486d8c9e71c0aae1c--9771882292b848da86f7d39b76f04b06
9d0fc939b83345d1a77c04cf81009f8f
7775682991d0406486d8c9e71c0aae1c--9d0fc939b83345d1a77c04cf81009f8f
593565c74eb949889d9906904cd7b07e
RX(iia_γ₀₁)
9d0fc939b83345d1a77c04cf81009f8f--593565c74eb949889d9906904cd7b07e
04e182282d224723b2d61f23d4744922
593565c74eb949889d9906904cd7b07e--04e182282d224723b2d61f23d4744922
af191b442ff043e0828838590de324f4
X
04e182282d224723b2d61f23d4744922--af191b442ff043e0828838590de324f4
af191b442ff043e0828838590de324f4--111da714880141edb452bd5b97a11397
24bb85edaca949f183ddda3f3d6329cd
RY(iia_β₀₄)
af191b442ff043e0828838590de324f4--24bb85edaca949f183ddda3f3d6329cd
d641320e23fb406b8fe3c2a7b3a91ab5
RX(iia_β₀₁)
24bb85edaca949f183ddda3f3d6329cd--d641320e23fb406b8fe3c2a7b3a91ab5
d1233b5455a14072947e14aa7335d9e5
RX(iia_α₁₁)
d641320e23fb406b8fe3c2a7b3a91ab5--d1233b5455a14072947e14aa7335d9e5
3967a723b4014bc6b4645425a48a8ce8
RY(iia_α₁₄)
d1233b5455a14072947e14aa7335d9e5--3967a723b4014bc6b4645425a48a8ce8
5b1eeff9600644a59d4501381cf39d1f
X
3967a723b4014bc6b4645425a48a8ce8--5b1eeff9600644a59d4501381cf39d1f
5b1eeff9600644a59d4501381cf39d1f--29717a447ab7489cb9ab913d8cc94bdd
5a49b8f29d9a4acbaded51eddb10a0eb
5b1eeff9600644a59d4501381cf39d1f--5a49b8f29d9a4acbaded51eddb10a0eb
814bd51208a4474d93d9cd774ed09ef2
RX(iia_γ₁₁)
5a49b8f29d9a4acbaded51eddb10a0eb--814bd51208a4474d93d9cd774ed09ef2
bfc4acd88de640469e4ab8359221317d
814bd51208a4474d93d9cd774ed09ef2--bfc4acd88de640469e4ab8359221317d
6cfb86b506234c0eae2dc3bbd7a65db5
X
bfc4acd88de640469e4ab8359221317d--6cfb86b506234c0eae2dc3bbd7a65db5
6cfb86b506234c0eae2dc3bbd7a65db5--363d657b913c4807a278c20a53ecd011
6b70def4d2dc46eab940daf74dfdfcf6
RY(iia_β₁₄)
6cfb86b506234c0eae2dc3bbd7a65db5--6b70def4d2dc46eab940daf74dfdfcf6
5e6422d18f1747d39f8f4620ec65397b
RX(iia_β₁₁)
6b70def4d2dc46eab940daf74dfdfcf6--5e6422d18f1747d39f8f4620ec65397b
5e6422d18f1747d39f8f4620ec65397b--00f04de2701347db950f4464e2360586
f2b533863dcf4b348e4dc4ba94f3c6cb
a0d9aa350e03477d8fff53ffe82ee538
RX(iia_α₀₂)
40dee5de10ef4ea283e93ebb6e726dec--a0d9aa350e03477d8fff53ffe82ee538
3f8a28ee9f8042109c2cbf1ed848fd29
RY(iia_α₀₅)
a0d9aa350e03477d8fff53ffe82ee538--3f8a28ee9f8042109c2cbf1ed848fd29
ab089d25e08c44d8876ac2b9ec63d389
3f8a28ee9f8042109c2cbf1ed848fd29--ab089d25e08c44d8876ac2b9ec63d389
8924202c38104acdbb6936faa6c285f3
X
ab089d25e08c44d8876ac2b9ec63d389--8924202c38104acdbb6936faa6c285f3
8924202c38104acdbb6936faa6c285f3--9d0fc939b83345d1a77c04cf81009f8f
0ffa34dd1e2448dba9a9d2b801f94746
RX(iia_γ₀₂)
8924202c38104acdbb6936faa6c285f3--0ffa34dd1e2448dba9a9d2b801f94746
1c0b32c814814784912d4a98e4bb5d7c
X
0ffa34dd1e2448dba9a9d2b801f94746--1c0b32c814814784912d4a98e4bb5d7c
1c0b32c814814784912d4a98e4bb5d7c--04e182282d224723b2d61f23d4744922
207b22e1b8104d148714e3d44b34168c
1c0b32c814814784912d4a98e4bb5d7c--207b22e1b8104d148714e3d44b34168c
dc9983787b4c40059efa6b410ef54f4f
RY(iia_β₀₅)
207b22e1b8104d148714e3d44b34168c--dc9983787b4c40059efa6b410ef54f4f
8d1fe33a35114d1d9df89f1c0ee948c8
RX(iia_β₀₂)
dc9983787b4c40059efa6b410ef54f4f--8d1fe33a35114d1d9df89f1c0ee948c8
4a2100ee23364a049efb71f76fbf491d
RX(iia_α₁₂)
8d1fe33a35114d1d9df89f1c0ee948c8--4a2100ee23364a049efb71f76fbf491d
1b4c5c902b5f47dfb5b0f3bf91be3b58
RY(iia_α₁₅)
4a2100ee23364a049efb71f76fbf491d--1b4c5c902b5f47dfb5b0f3bf91be3b58
d98a2bb8bc0041d0ba01cdf231c73ffc
1b4c5c902b5f47dfb5b0f3bf91be3b58--d98a2bb8bc0041d0ba01cdf231c73ffc
763d25db0437404ea582811b2a6e19b4
X
d98a2bb8bc0041d0ba01cdf231c73ffc--763d25db0437404ea582811b2a6e19b4
763d25db0437404ea582811b2a6e19b4--5a49b8f29d9a4acbaded51eddb10a0eb
1a15d3845aaf4f4f84b7fbd23f00b55e
RX(iia_γ₁₂)
763d25db0437404ea582811b2a6e19b4--1a15d3845aaf4f4f84b7fbd23f00b55e
b2b3f8288fc64b35bb25a3b5b4a45e35
X
1a15d3845aaf4f4f84b7fbd23f00b55e--b2b3f8288fc64b35bb25a3b5b4a45e35
b2b3f8288fc64b35bb25a3b5b4a45e35--bfc4acd88de640469e4ab8359221317d
f56541de02f04c43a0efe278dbcda85f
b2b3f8288fc64b35bb25a3b5b4a45e35--f56541de02f04c43a0efe278dbcda85f
087e4db6b7f247929101dec5e0a09a3e
RY(iia_β₁₅)
f56541de02f04c43a0efe278dbcda85f--087e4db6b7f247929101dec5e0a09a3e
cf0a01c38ca747409e11cf79b6d6d215
RX(iia_β₁₂)
087e4db6b7f247929101dec5e0a09a3e--cf0a01c38ca747409e11cf79b6d6d215
cf0a01c38ca747409e11cf79b6d6d215--f2b533863dcf4b348e4dc4ba94f3c6cb