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_4454ef8dc77845499e803fff94af1758
Constant Chebyshev FM
cluster_04bd8e3379ec4812b5f3d6a855cb0946
Constant Fourier FM
7d23bbe57ef94dceb3f265402df58f4e
0
5152b66a611a40499330bcaf178963c5
RX(phi)
7d23bbe57ef94dceb3f265402df58f4e--5152b66a611a40499330bcaf178963c5
3660ecbd772a4efd8b4e3d3b21c04e97
1
1cb3d3634caf4034a2359c3f0ad71b74
RX(acos(phi))
5152b66a611a40499330bcaf178963c5--1cb3d3634caf4034a2359c3f0ad71b74
5c030ddd00dc49128d027d17f1776bb0
1cb3d3634caf4034a2359c3f0ad71b74--5c030ddd00dc49128d027d17f1776bb0
6d046a50bf12448498a799e3fe1c3168
b8cae9cc2e634a97a869c1f02d73e512
RX(phi)
3660ecbd772a4efd8b4e3d3b21c04e97--b8cae9cc2e634a97a869c1f02d73e512
46ef491e1aa241e59dbb6575763aa607
2
0e792b8429ef4005ab524e8dc5d6799b
RX(acos(phi))
b8cae9cc2e634a97a869c1f02d73e512--0e792b8429ef4005ab524e8dc5d6799b
0e792b8429ef4005ab524e8dc5d6799b--6d046a50bf12448498a799e3fe1c3168
b9db0502cf0a4cd1ad79a3d19973dac6
28af32addf3e49e1b21d3486477ab53d
RX(phi)
46ef491e1aa241e59dbb6575763aa607--28af32addf3e49e1b21d3486477ab53d
8363b2cc04be4c869c57e3cc66724f39
RX(acos(phi))
28af32addf3e49e1b21d3486477ab53d--8363b2cc04be4c869c57e3cc66724f39
8363b2cc04be4c869c57e3cc66724f39--b9db0502cf0a4cd1ad79a3d19973dac6
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_0e9681e928bf47e09ae8bc6c1abec1e1
Constant <function custom_fn at 0x7fa954f16830> FM
cluster_3fe08f5a83c740e0aed087f0e968048d
Constant asin FM
524a1f3817dd412d8316e5df14f052d8
0
99a7e0bed2114ede87399a09beab0d91
RX(asin(phi))
524a1f3817dd412d8316e5df14f052d8--99a7e0bed2114ede87399a09beab0d91
eb36456f60cd4ab7b96e2e2c2d584e2b
1
d7eef59b148c46e5a06c0b31e3aecb77
RX(phi**2 + asin(phi))
99a7e0bed2114ede87399a09beab0d91--d7eef59b148c46e5a06c0b31e3aecb77
2cb5611f276d46a7ac1335196c0545cb
d7eef59b148c46e5a06c0b31e3aecb77--2cb5611f276d46a7ac1335196c0545cb
b86cbf1338384654a5bb136b0b34eace
b15c588c12cc4d0f96512dfb4e40c7ac
RX(asin(phi))
eb36456f60cd4ab7b96e2e2c2d584e2b--b15c588c12cc4d0f96512dfb4e40c7ac
79813c5cf0ba4550aa7170c83ef34a9f
2
e16acc9326684a5c940bbd4cc523faaf
RX(phi**2 + asin(phi))
b15c588c12cc4d0f96512dfb4e40c7ac--e16acc9326684a5c940bbd4cc523faaf
e16acc9326684a5c940bbd4cc523faaf--b86cbf1338384654a5bb136b0b34eace
4ecb9fb7065d479db4ec680547636131
2fdb5db4bc854e09986a3310e49aed5d
RX(asin(phi))
79813c5cf0ba4550aa7170c83ef34a9f--2fdb5db4bc854e09986a3310e49aed5d
9f985f95ff7d4e96a5879a301304d1cb
RX(phi**2 + asin(phi))
2fdb5db4bc854e09986a3310e49aed5d--9f985f95ff7d4e96a5879a301304d1cb
9f985f95ff7d4e96a5879a301304d1cb--4ecb9fb7065d479db4ec680547636131
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_c153c739bb524b4aaa0fea723c13953f
Exponential Fourier FM
cluster_f9c4db9801664854bd376a5ca0311506
Constant Fourier FM
cluster_0be380cadd1c4dee812ec85cf06ad8e5
Tower Fourier FM
263316e5a68a44da974da4b08ada9bd2
0
d27b9a0d9baa4326ba1853399e952a75
RX(phi)
263316e5a68a44da974da4b08ada9bd2--d27b9a0d9baa4326ba1853399e952a75
0330f3f84171466a8330aa71b08de1d1
1
8eb1134ba78b47c097213e9866dce073
RX(1.0*phi)
d27b9a0d9baa4326ba1853399e952a75--8eb1134ba78b47c097213e9866dce073
4a596fcb51c64509bbe0c2af2db72f9d
RX(1.0*phi)
8eb1134ba78b47c097213e9866dce073--4a596fcb51c64509bbe0c2af2db72f9d
efb672785a5643de92a22a063e5e1c09
4a596fcb51c64509bbe0c2af2db72f9d--efb672785a5643de92a22a063e5e1c09
32e7ca467b4a40b99073f890e7169af5
3d381c41e7dc4a1f8a98b54362016c59
RX(phi)
0330f3f84171466a8330aa71b08de1d1--3d381c41e7dc4a1f8a98b54362016c59
99df3ef30e4b4486863922302cdfbffb
2
6b42f0dc40984cd78084fef3f2fda243
RX(2.0*phi)
3d381c41e7dc4a1f8a98b54362016c59--6b42f0dc40984cd78084fef3f2fda243
8b490f6f7feb497aa92dc01f84f5d0d4
RX(2.0*phi)
6b42f0dc40984cd78084fef3f2fda243--8b490f6f7feb497aa92dc01f84f5d0d4
8b490f6f7feb497aa92dc01f84f5d0d4--32e7ca467b4a40b99073f890e7169af5
36f3350ce48a4d85bd3c83d7709404f7
71a5ac20d3c2425ebc2569ccb082e1ad
RX(phi)
99df3ef30e4b4486863922302cdfbffb--71a5ac20d3c2425ebc2569ccb082e1ad
90f40d8ff3b046f59d07525f03812d8d
3
3a734b708c2f4bb295621b0ea2bbed3c
RX(3.0*phi)
71a5ac20d3c2425ebc2569ccb082e1ad--3a734b708c2f4bb295621b0ea2bbed3c
18306d4246f84b459f8e250f5a24ff9e
RX(4.0*phi)
3a734b708c2f4bb295621b0ea2bbed3c--18306d4246f84b459f8e250f5a24ff9e
18306d4246f84b459f8e250f5a24ff9e--36f3350ce48a4d85bd3c83d7709404f7
19db9ec9e20a459f9194ba90ca4e5a85
dcb5b9ec799d44f79b6cc85f2bfb9467
RX(phi)
90f40d8ff3b046f59d07525f03812d8d--dcb5b9ec799d44f79b6cc85f2bfb9467
ab5153256aa544c1af45dbb0b4e2c4a9
4
f59c31d18ca149dca226d6432ea31b35
RX(4.0*phi)
dcb5b9ec799d44f79b6cc85f2bfb9467--f59c31d18ca149dca226d6432ea31b35
43c4cf5c5bed42f0a6d7bd12e42d2139
RX(8.0*phi)
f59c31d18ca149dca226d6432ea31b35--43c4cf5c5bed42f0a6d7bd12e42d2139
43c4cf5c5bed42f0a6d7bd12e42d2139--19db9ec9e20a459f9194ba90ca4e5a85
0d82bbba431d42d8a186ae818f8a1aa0
9742ab72acd240eaa3319f1e0c333ca6
RX(phi)
ab5153256aa544c1af45dbb0b4e2c4a9--9742ab72acd240eaa3319f1e0c333ca6
0a0ecc14f0a94a04863f7b6acc268eb9
RX(5.0*phi)
9742ab72acd240eaa3319f1e0c333ca6--0a0ecc14f0a94a04863f7b6acc268eb9
ea6dd38d35c041ad9f8beae55c56a5c3
RX(16.0*phi)
0a0ecc14f0a94a04863f7b6acc268eb9--ea6dd38d35c041ad9f8beae55c56a5c3
ea6dd38d35c041ad9f8beae55c56a5c3--0d82bbba431d42d8a186ae818f8a1aa0
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
7f01ca2dd405446581010b5799431a2d
0
94b2e1cdc8734869a8695460b8fc4d7f
RX(1.0*acos(phi))
7f01ca2dd405446581010b5799431a2d--94b2e1cdc8734869a8695460b8fc4d7f
78c085e29c0c4cc98b77d83201590517
1
1534668f10a4430e88cdbc02905a09cb
94b2e1cdc8734869a8695460b8fc4d7f--1534668f10a4430e88cdbc02905a09cb
5dbe2af114b64b99b3ce2d6f4ba551d2
475d4fc6c728446a848625d0fdd113b4
RX(1.414*acos(phi))
78c085e29c0c4cc98b77d83201590517--475d4fc6c728446a848625d0fdd113b4
5e9ce05af54a4dc7b9e37f4113e35aa7
2
475d4fc6c728446a848625d0fdd113b4--5dbe2af114b64b99b3ce2d6f4ba551d2
c5587d3f0a4d4fd9bdd9bfed69472b1c
479095b5d3ee43eeb9611fba40d28983
RX(1.732*acos(phi))
5e9ce05af54a4dc7b9e37f4113e35aa7--479095b5d3ee43eeb9611fba40d28983
3f15f40af8c546b5bf332b89bf910df8
3
479095b5d3ee43eeb9611fba40d28983--c5587d3f0a4d4fd9bdd9bfed69472b1c
6615b7a5b28643dbadcbcb3b5c2c98fd
3922c6a4bb8c44d98062ad2568965ba5
RX(2.0*acos(phi))
3f15f40af8c546b5bf332b89bf910df8--3922c6a4bb8c44d98062ad2568965ba5
3fcab86190724059bb59bd72f7e4ec90
4
3922c6a4bb8c44d98062ad2568965ba5--6615b7a5b28643dbadcbcb3b5c2c98fd
c8dd8ae643fe43908810a7ccc4420099
d2400a58ef974d839a62251b6dac4e3e
RX(2.236*acos(phi))
3fcab86190724059bb59bd72f7e4ec90--d2400a58ef974d839a62251b6dac4e3e
d2400a58ef974d839a62251b6dac4e3e--c8dd8ae643fe43908810a7ccc4420099
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
8aaeb593703e47a397539ff937e3d37e
0
a6755e8ea6cd471591dd7f6d0b95dc1f
RX(1.0*phi*w₀)
8aaeb593703e47a397539ff937e3d37e--a6755e8ea6cd471591dd7f6d0b95dc1f
d01378fd90df46388634dba8ded61f12
1
7af2a8ba838447f5998841c538795a0c
a6755e8ea6cd471591dd7f6d0b95dc1f--7af2a8ba838447f5998841c538795a0c
18ca5d373ee942bdb096c29a035d0b41
0a2e0d0fb5fe4d16b10702977268e7b2
RX(2.0*phi*w₁)
d01378fd90df46388634dba8ded61f12--0a2e0d0fb5fe4d16b10702977268e7b2
46b775aa66fc4151925c9661b2ed63ae
2
0a2e0d0fb5fe4d16b10702977268e7b2--18ca5d373ee942bdb096c29a035d0b41
e0c19dc46c6b4913a8ca2a5dead0576b
9285e233c3f8421d90114477531854d1
RX(4.0*phi*w₂)
46b775aa66fc4151925c9661b2ed63ae--9285e233c3f8421d90114477531854d1
738155124c11495aa736e0b05166d7b1
3
9285e233c3f8421d90114477531854d1--e0c19dc46c6b4913a8ca2a5dead0576b
13f0b0c8f5e143cba2663390760a33a1
d803746ff964480b86c7ef88349352b7
RX(8.0*phi*w₃)
738155124c11495aa736e0b05166d7b1--d803746ff964480b86c7ef88349352b7
6a10f1451b40490f9725438e8306ce22
4
d803746ff964480b86c7ef88349352b7--13f0b0c8f5e143cba2663390760a33a1
2b731b4fc4484000b27d53fe4944ad35
f9c3033273314e60bcfa28fd2522e8c6
RX(16.0*phi*w₄)
6a10f1451b40490f9725438e8306ce22--f9c3033273314e60bcfa28fd2522e8c6
f9c3033273314e60bcfa28fd2522e8c6--2b731b4fc4484000b27d53fe4944ad35
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
e68a7ba419354edea4e81e2ac5378314
0
f8b1ca483e6847b7b2f1f758eabe5240
RY(80.0*acos(w₄*(0.667*x + 1.667)))
e68a7ba419354edea4e81e2ac5378314--f8b1ca483e6847b7b2f1f758eabe5240
6fea77a1fa374f8297511509494df398
1
dba5be6b644d469fbcfceef3549eb0e1
f8b1ca483e6847b7b2f1f758eabe5240--dba5be6b644d469fbcfceef3549eb0e1
4a5f3b37b7ed408bb0b37566809d3dde
46adb0723dea41018811b652178f961a
RY(40.0*acos(w₃*(0.667*x + 1.667)))
6fea77a1fa374f8297511509494df398--46adb0723dea41018811b652178f961a
092564e6966540599c2a87a7cb8fb051
2
46adb0723dea41018811b652178f961a--4a5f3b37b7ed408bb0b37566809d3dde
c5a1a88221a448958ae3100dad33cdac
55ac376e69424703a071c1ea2c0a0aea
RY(20.0*acos(w₂*(0.667*x + 1.667)))
092564e6966540599c2a87a7cb8fb051--55ac376e69424703a071c1ea2c0a0aea
f20bf7491abf4bc098f713d7f01e7236
3
55ac376e69424703a071c1ea2c0a0aea--c5a1a88221a448958ae3100dad33cdac
837c8e3e97284046966cfe6c58c1019f
f2045b4801914b38b9d1d4a4aa5dd211
RY(10.0*acos(w₁*(0.667*x + 1.667)))
f20bf7491abf4bc098f713d7f01e7236--f2045b4801914b38b9d1d4a4aa5dd211
e9855185b08c42929e17e4778aecec43
4
f2045b4801914b38b9d1d4a4aa5dd211--837c8e3e97284046966cfe6c58c1019f
a7b30bbd3610486b87b08d385bd9042f
e15ac38a3d434c868954b316a5432d0f
RY(5.0*acos(w₀*(0.667*x + 1.667)))
e9855185b08c42929e17e4778aecec43--e15ac38a3d434c868954b316a5432d0f
e15ac38a3d434c868954b316a5432d0f--a7b30bbd3610486b87b08d385bd9042f
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
a8ff77ee245c418da69a1ba31323848c
0
2d2b87dcafcc42b7a4e43d60aa36480f
RX(theta₀)
a8ff77ee245c418da69a1ba31323848c--2d2b87dcafcc42b7a4e43d60aa36480f
318b4440da5b466a97def5423122267d
1
edbe21ecafbe40ada477f4ba473234c5
RY(theta₃)
2d2b87dcafcc42b7a4e43d60aa36480f--edbe21ecafbe40ada477f4ba473234c5
a0fbf6dad66043a58b42cffa8d07b0f5
RX(theta₆)
edbe21ecafbe40ada477f4ba473234c5--a0fbf6dad66043a58b42cffa8d07b0f5
bba7152eb24f4edd87333b8c7c3e3af3
a0fbf6dad66043a58b42cffa8d07b0f5--bba7152eb24f4edd87333b8c7c3e3af3
197b1186c68248e0a4588b2ef449e5de
bba7152eb24f4edd87333b8c7c3e3af3--197b1186c68248e0a4588b2ef449e5de
9c0ee943221e48b68e7d99277bd81bc9
RX(theta₉)
197b1186c68248e0a4588b2ef449e5de--9c0ee943221e48b68e7d99277bd81bc9
a59b90fa90574dfa81680489d0795dc1
RY(theta₁₂)
9c0ee943221e48b68e7d99277bd81bc9--a59b90fa90574dfa81680489d0795dc1
d4f162c2041b42f6b910530d0cf35dd7
RX(theta₁₅)
a59b90fa90574dfa81680489d0795dc1--d4f162c2041b42f6b910530d0cf35dd7
fd7dd95bf74d49c58adf7b8eab6c46f3
d4f162c2041b42f6b910530d0cf35dd7--fd7dd95bf74d49c58adf7b8eab6c46f3
b54724e4058a4dafb5c5c17a8a1bdcea
fd7dd95bf74d49c58adf7b8eab6c46f3--b54724e4058a4dafb5c5c17a8a1bdcea
95d79a1d2a814bd1b078df49705fddfa
b54724e4058a4dafb5c5c17a8a1bdcea--95d79a1d2a814bd1b078df49705fddfa
490f1c2ed82c4b0aafafa608799feba8
f3b85f33f0444d5c8373a4e567f80438
RX(theta₁)
318b4440da5b466a97def5423122267d--f3b85f33f0444d5c8373a4e567f80438
7df3302107e742d7a0eb5dfeec9d21cd
2
ef619a14c555493ab3e0b2b96052a328
RY(theta₄)
f3b85f33f0444d5c8373a4e567f80438--ef619a14c555493ab3e0b2b96052a328
317b51ec12894f778525206112983b06
RX(theta₇)
ef619a14c555493ab3e0b2b96052a328--317b51ec12894f778525206112983b06
b3db79419fd7483aa8bc0472b8397951
X
317b51ec12894f778525206112983b06--b3db79419fd7483aa8bc0472b8397951
b3db79419fd7483aa8bc0472b8397951--bba7152eb24f4edd87333b8c7c3e3af3
bf5f091e6bf84e5384d682b91cd763b1
b3db79419fd7483aa8bc0472b8397951--bf5f091e6bf84e5384d682b91cd763b1
eff46b027fe845c28ce8c83ce5cbf167
RX(theta₁₀)
bf5f091e6bf84e5384d682b91cd763b1--eff46b027fe845c28ce8c83ce5cbf167
1e42c8ba5028451dbcaf53a506b82901
RY(theta₁₃)
eff46b027fe845c28ce8c83ce5cbf167--1e42c8ba5028451dbcaf53a506b82901
e26e9735045b45ad8b49e28ccfa517e2
RX(theta₁₆)
1e42c8ba5028451dbcaf53a506b82901--e26e9735045b45ad8b49e28ccfa517e2
9b5804612f90448e8072c647fef02b19
X
e26e9735045b45ad8b49e28ccfa517e2--9b5804612f90448e8072c647fef02b19
9b5804612f90448e8072c647fef02b19--fd7dd95bf74d49c58adf7b8eab6c46f3
f85272f491aa4e559539aa138a0e898a
9b5804612f90448e8072c647fef02b19--f85272f491aa4e559539aa138a0e898a
f85272f491aa4e559539aa138a0e898a--490f1c2ed82c4b0aafafa608799feba8
57dac60086b144028f1ee0f50280005c
ae9722cc45e3452ba734339c0c37690d
RX(theta₂)
7df3302107e742d7a0eb5dfeec9d21cd--ae9722cc45e3452ba734339c0c37690d
a459cf70f1ed408d8d0baafb18f1990d
RY(theta₅)
ae9722cc45e3452ba734339c0c37690d--a459cf70f1ed408d8d0baafb18f1990d
bc756bf5d7fb4ae68a5e49827cc4fc9f
RX(theta₈)
a459cf70f1ed408d8d0baafb18f1990d--bc756bf5d7fb4ae68a5e49827cc4fc9f
b1940aff14184f44a898f741d1639fbb
bc756bf5d7fb4ae68a5e49827cc4fc9f--b1940aff14184f44a898f741d1639fbb
a922601d658c45b4b47155b99cb92140
X
b1940aff14184f44a898f741d1639fbb--a922601d658c45b4b47155b99cb92140
a922601d658c45b4b47155b99cb92140--bf5f091e6bf84e5384d682b91cd763b1
e6ca2429caf443cb9d841ec8b19edfaf
RX(theta₁₁)
a922601d658c45b4b47155b99cb92140--e6ca2429caf443cb9d841ec8b19edfaf
add7ef7a50c243038e08fa7c24e1687c
RY(theta₁₄)
e6ca2429caf443cb9d841ec8b19edfaf--add7ef7a50c243038e08fa7c24e1687c
bfc40850a1634c33a2c4c2785e026063
RX(theta₁₇)
add7ef7a50c243038e08fa7c24e1687c--bfc40850a1634c33a2c4c2785e026063
d958e2c6cf704321bc2dec882592337f
bfc40850a1634c33a2c4c2785e026063--d958e2c6cf704321bc2dec882592337f
e26a471b824743cba35476ea229e3dbe
X
d958e2c6cf704321bc2dec882592337f--e26a471b824743cba35476ea229e3dbe
e26a471b824743cba35476ea229e3dbe--f85272f491aa4e559539aa138a0e898a
e26a471b824743cba35476ea229e3dbe--57dac60086b144028f1ee0f50280005c
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
e5ed790361b14ba59eca8d533dfbe189
0
5391ec96ce8f4f339a78bf687f8ba318
RX(phi₀)
e5ed790361b14ba59eca8d533dfbe189--5391ec96ce8f4f339a78bf687f8ba318
52eec22b446d49859d28b418a90fe8d4
1
962f5177466a4c309ad1952abd5efd63
RY(phi₃)
5391ec96ce8f4f339a78bf687f8ba318--962f5177466a4c309ad1952abd5efd63
013ff87f3e9e4b0d8b9f78fd8ee612af
RX(phi₆)
962f5177466a4c309ad1952abd5efd63--013ff87f3e9e4b0d8b9f78fd8ee612af
efa76ae94ca841f7b80debab3a4cb230
013ff87f3e9e4b0d8b9f78fd8ee612af--efa76ae94ca841f7b80debab3a4cb230
daf8c0d70d9a4487bb40b11f8960cbc2
efa76ae94ca841f7b80debab3a4cb230--daf8c0d70d9a4487bb40b11f8960cbc2
5ffd4c8a93224931a279bbfdf7c7c174
RX(phi₉)
daf8c0d70d9a4487bb40b11f8960cbc2--5ffd4c8a93224931a279bbfdf7c7c174
3e5e90d33e1e4560b16ea2d422f2db5e
RY(phi₁₂)
5ffd4c8a93224931a279bbfdf7c7c174--3e5e90d33e1e4560b16ea2d422f2db5e
f62f37e235fb40c483239f6f12086e9a
RX(phi₁₅)
3e5e90d33e1e4560b16ea2d422f2db5e--f62f37e235fb40c483239f6f12086e9a
94ac54ac17194f9a9b7ee2b70b581cb7
f62f37e235fb40c483239f6f12086e9a--94ac54ac17194f9a9b7ee2b70b581cb7
8c0bb75cbd414b64aac546682481bd41
94ac54ac17194f9a9b7ee2b70b581cb7--8c0bb75cbd414b64aac546682481bd41
eba0e0055181498a9ac2ddcbbf2fce8b
8c0bb75cbd414b64aac546682481bd41--eba0e0055181498a9ac2ddcbbf2fce8b
65f0ebceab6643338c36ef422836a943
21fb94191eab4dee991d3f5bbb5c0057
RX(phi₁)
52eec22b446d49859d28b418a90fe8d4--21fb94191eab4dee991d3f5bbb5c0057
2fb53c6af23d4104b255eaca97314b91
2
a460183a0f264ee8bed9bd47467c629c
RY(phi₄)
21fb94191eab4dee991d3f5bbb5c0057--a460183a0f264ee8bed9bd47467c629c
862d92358b414390991ba3c488932981
RX(phi₇)
a460183a0f264ee8bed9bd47467c629c--862d92358b414390991ba3c488932981
69ffa63286ac4480bdd1bc9419708660
PHASE(phi_ent₀)
862d92358b414390991ba3c488932981--69ffa63286ac4480bdd1bc9419708660
69ffa63286ac4480bdd1bc9419708660--efa76ae94ca841f7b80debab3a4cb230
f4ef21df704a4fa2a6de59dae91ae8c0
69ffa63286ac4480bdd1bc9419708660--f4ef21df704a4fa2a6de59dae91ae8c0
dba686cc4b3048eabbf2a25c4dadecee
RX(phi₁₀)
f4ef21df704a4fa2a6de59dae91ae8c0--dba686cc4b3048eabbf2a25c4dadecee
55badf7f668d42fbb6650031bd683b3c
RY(phi₁₃)
dba686cc4b3048eabbf2a25c4dadecee--55badf7f668d42fbb6650031bd683b3c
5a215f3876c84db193230a1f6f9b83f1
RX(phi₁₆)
55badf7f668d42fbb6650031bd683b3c--5a215f3876c84db193230a1f6f9b83f1
3985a4ff55d149569ad6feed07713a8c
PHASE(phi_ent₂)
5a215f3876c84db193230a1f6f9b83f1--3985a4ff55d149569ad6feed07713a8c
3985a4ff55d149569ad6feed07713a8c--94ac54ac17194f9a9b7ee2b70b581cb7
42acb722ab41439aaedc38d47265fe6f
3985a4ff55d149569ad6feed07713a8c--42acb722ab41439aaedc38d47265fe6f
42acb722ab41439aaedc38d47265fe6f--65f0ebceab6643338c36ef422836a943
e8df9a7bf0704ba992e654bd6663ac07
2745b10214f049b3bc7fd41771a42056
RX(phi₂)
2fb53c6af23d4104b255eaca97314b91--2745b10214f049b3bc7fd41771a42056
b4cd1844f0fd414d9648175cb1f33b59
RY(phi₅)
2745b10214f049b3bc7fd41771a42056--b4cd1844f0fd414d9648175cb1f33b59
faa0e6d982aa46f0a7ec12aab5261b65
RX(phi₈)
b4cd1844f0fd414d9648175cb1f33b59--faa0e6d982aa46f0a7ec12aab5261b65
f4c61afb27004b4ea366810581f0446e
faa0e6d982aa46f0a7ec12aab5261b65--f4c61afb27004b4ea366810581f0446e
92a7cf1110a84a86b3ef2c16d0af661b
PHASE(phi_ent₁)
f4c61afb27004b4ea366810581f0446e--92a7cf1110a84a86b3ef2c16d0af661b
92a7cf1110a84a86b3ef2c16d0af661b--f4ef21df704a4fa2a6de59dae91ae8c0
42bcf4a2c21d4b3ca3efbc76bd89a4fd
RX(phi₁₁)
92a7cf1110a84a86b3ef2c16d0af661b--42bcf4a2c21d4b3ca3efbc76bd89a4fd
f5e28eeaad4948a98c35be8299be5f73
RY(phi₁₄)
42bcf4a2c21d4b3ca3efbc76bd89a4fd--f5e28eeaad4948a98c35be8299be5f73
0c66f831bdde4ee3a478f5b14c3ae88d
RX(phi₁₇)
f5e28eeaad4948a98c35be8299be5f73--0c66f831bdde4ee3a478f5b14c3ae88d
4e84fb13448e46d7a469239e25912659
0c66f831bdde4ee3a478f5b14c3ae88d--4e84fb13448e46d7a469239e25912659
cc1d2814dd2f4af1a0b5b3dd57a034c1
PHASE(phi_ent₃)
4e84fb13448e46d7a469239e25912659--cc1d2814dd2f4af1a0b5b3dd57a034c1
cc1d2814dd2f4af1a0b5b3dd57a034c1--42acb722ab41439aaedc38d47265fe6f
cc1d2814dd2f4af1a0b5b3dd57a034c1--e8df9a7bf0704ba992e654bd6663ac07
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_b577d253bbf643ec9a71634ed2185dde
cluster_c8dcdc58890743469d81c2f0778b28dd
f6143935504547588dbf701969ea9ad2
0
dec42caeb7bd4aa0ba59d5f2d7f932f1
RX(theta₀)
f6143935504547588dbf701969ea9ad2--dec42caeb7bd4aa0ba59d5f2d7f932f1
17418e39e0c141e883e593ebd2b5d156
1
56b5266602624011b631e8bdc4b6aa66
RY(theta₃)
dec42caeb7bd4aa0ba59d5f2d7f932f1--56b5266602624011b631e8bdc4b6aa66
58da3eecac964060b688cce63526c8a8
RX(theta₆)
56b5266602624011b631e8bdc4b6aa66--58da3eecac964060b688cce63526c8a8
ef4174d5dd5c4b6aa143498b48c88322
HamEvo
58da3eecac964060b688cce63526c8a8--ef4174d5dd5c4b6aa143498b48c88322
1fd4ee041d1f4ff2a2c216b3363f8331
RX(theta₉)
ef4174d5dd5c4b6aa143498b48c88322--1fd4ee041d1f4ff2a2c216b3363f8331
30da36f6004847248f0fe2cd4569446d
RY(theta₁₂)
1fd4ee041d1f4ff2a2c216b3363f8331--30da36f6004847248f0fe2cd4569446d
69946795a85749a4876755bfc54b68a8
RX(theta₁₅)
30da36f6004847248f0fe2cd4569446d--69946795a85749a4876755bfc54b68a8
e9a7252384c2443b99b1e9d3ccaef775
HamEvo
69946795a85749a4876755bfc54b68a8--e9a7252384c2443b99b1e9d3ccaef775
555a03bada964357859bf76db0e92e12
e9a7252384c2443b99b1e9d3ccaef775--555a03bada964357859bf76db0e92e12
fe468f6817534be4821eacda662b8b5e
2bd8ee1e8cbc4d09bc9a428b959537d1
RX(theta₁)
17418e39e0c141e883e593ebd2b5d156--2bd8ee1e8cbc4d09bc9a428b959537d1
5c48044448d1435fb6d5d98eb7d0bc5c
2
f127a0ee4f4e48d3aee3937e81ffb66a
RY(theta₄)
2bd8ee1e8cbc4d09bc9a428b959537d1--f127a0ee4f4e48d3aee3937e81ffb66a
40c174c4a5da4e10b33ec5f4114c7e65
RX(theta₇)
f127a0ee4f4e48d3aee3937e81ffb66a--40c174c4a5da4e10b33ec5f4114c7e65
b8551884e4a34fef8593aa7f42dffd14
t = theta_t₀
40c174c4a5da4e10b33ec5f4114c7e65--b8551884e4a34fef8593aa7f42dffd14
3d2549fdf3224fa18dc0a6a8d53e0e7f
RX(theta₁₀)
b8551884e4a34fef8593aa7f42dffd14--3d2549fdf3224fa18dc0a6a8d53e0e7f
e32fa891120e4c4aa7563c83f51b5e87
RY(theta₁₃)
3d2549fdf3224fa18dc0a6a8d53e0e7f--e32fa891120e4c4aa7563c83f51b5e87
ae630cba2c3d4bcd9fd8420fc62454ac
RX(theta₁₆)
e32fa891120e4c4aa7563c83f51b5e87--ae630cba2c3d4bcd9fd8420fc62454ac
36ff49f9fa8e42bd9596eb50efb02406
t = theta_t₁
ae630cba2c3d4bcd9fd8420fc62454ac--36ff49f9fa8e42bd9596eb50efb02406
36ff49f9fa8e42bd9596eb50efb02406--fe468f6817534be4821eacda662b8b5e
a92ca220fc0e4e298785cb38a651a4c3
60875cb343844c51bab97bfd305c494b
RX(theta₂)
5c48044448d1435fb6d5d98eb7d0bc5c--60875cb343844c51bab97bfd305c494b
8d3e12ace5cb4f0e862ed43d26eac309
RY(theta₅)
60875cb343844c51bab97bfd305c494b--8d3e12ace5cb4f0e862ed43d26eac309
770b3d5f8caf4500915b1ff7642aaac5
RX(theta₈)
8d3e12ace5cb4f0e862ed43d26eac309--770b3d5f8caf4500915b1ff7642aaac5
51ae3d2933494b6b8de94d51e4f6f064
770b3d5f8caf4500915b1ff7642aaac5--51ae3d2933494b6b8de94d51e4f6f064
143ed4663875455589e3a81303542d51
RX(theta₁₁)
51ae3d2933494b6b8de94d51e4f6f064--143ed4663875455589e3a81303542d51
d6c258cce981412c9da6893d3db85429
RY(theta₁₄)
143ed4663875455589e3a81303542d51--d6c258cce981412c9da6893d3db85429
ba5667155bd64238a4105eba793ce2f6
RX(theta₁₇)
d6c258cce981412c9da6893d3db85429--ba5667155bd64238a4105eba793ce2f6
fcffab4e82034725a1893cc4b9935f8d
ba5667155bd64238a4105eba793ce2f6--fcffab4e82034725a1893cc4b9935f8d
fcffab4e82034725a1893cc4b9935f8d--a92ca220fc0e4e298785cb38a651a4c3
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_7f6e32d5acd047febef1b22f240de3d6
cluster_5b880de44fb9458fa23a0681cf5baac7
a7fb4f6e20d64e649b130b0a643bee64
0
4e2a6903031440658bdd69e28f99a35f
RX(theta₀)
a7fb4f6e20d64e649b130b0a643bee64--4e2a6903031440658bdd69e28f99a35f
78a732770c3f42f493fa7b612c95c868
1
6994c2801f44437e9a2ba2db5a4848a0
RY(theta₆)
4e2a6903031440658bdd69e28f99a35f--6994c2801f44437e9a2ba2db5a4848a0
2247cc46f3b744318603e09d21c383ec
RX(theta₁₂)
6994c2801f44437e9a2ba2db5a4848a0--2247cc46f3b744318603e09d21c383ec
79e828a42ac24084adf6a6f848d9ccdf
2247cc46f3b744318603e09d21c383ec--79e828a42ac24084adf6a6f848d9ccdf
aa151588d35b42f083c5d936cba74cd7
RX(theta₁₈)
79e828a42ac24084adf6a6f848d9ccdf--aa151588d35b42f083c5d936cba74cd7
6cbe9c3af10b49faafc97968115aad1f
RY(theta₂₄)
aa151588d35b42f083c5d936cba74cd7--6cbe9c3af10b49faafc97968115aad1f
d0f58727fd1c43c89799811c32bcf34d
RX(theta₃₀)
6cbe9c3af10b49faafc97968115aad1f--d0f58727fd1c43c89799811c32bcf34d
92f082cde4a44da0a71efc1d1303219d
d0f58727fd1c43c89799811c32bcf34d--92f082cde4a44da0a71efc1d1303219d
384020b0a1fe4fe0807a070712a702ea
92f082cde4a44da0a71efc1d1303219d--384020b0a1fe4fe0807a070712a702ea
ba88b751b0154b9896616cdf640edffa
2089d8ec3e4845a49c4bd2c527e78031
RX(theta₁)
78a732770c3f42f493fa7b612c95c868--2089d8ec3e4845a49c4bd2c527e78031
4e731de3673146c1a8ab45ece66fe6c5
2
4517918f8612400aa3fcf935665008bd
RY(theta₇)
2089d8ec3e4845a49c4bd2c527e78031--4517918f8612400aa3fcf935665008bd
af91566646754497abee09af9ea4ac50
RX(theta₁₃)
4517918f8612400aa3fcf935665008bd--af91566646754497abee09af9ea4ac50
cc17d74547c04036ab56dbce47620b71
af91566646754497abee09af9ea4ac50--cc17d74547c04036ab56dbce47620b71
cbd8e5a0167d4e7dad5f9dd0d494d544
RX(theta₁₉)
cc17d74547c04036ab56dbce47620b71--cbd8e5a0167d4e7dad5f9dd0d494d544
74f402f7cc4a498c95bcc727e3a193da
RY(theta₂₅)
cbd8e5a0167d4e7dad5f9dd0d494d544--74f402f7cc4a498c95bcc727e3a193da
ba0110977d6140f1bf14be42f219f9cc
RX(theta₃₁)
74f402f7cc4a498c95bcc727e3a193da--ba0110977d6140f1bf14be42f219f9cc
b2cedd249d51471ebdf4b0d98ac2fb2f
ba0110977d6140f1bf14be42f219f9cc--b2cedd249d51471ebdf4b0d98ac2fb2f
b2cedd249d51471ebdf4b0d98ac2fb2f--ba88b751b0154b9896616cdf640edffa
8cd31db18e20449f9e4c43d21fa61c66
f6d0830ba3404b9194dec9260347024e
RX(theta₂)
4e731de3673146c1a8ab45ece66fe6c5--f6d0830ba3404b9194dec9260347024e
84fa87efef2344798607d34ec485e0f7
3
e3de53075ae84e8e861822012c8c5834
RY(theta₈)
f6d0830ba3404b9194dec9260347024e--e3de53075ae84e8e861822012c8c5834
3866e00bf1bd423b845acf0f20b28cfd
RX(theta₁₄)
e3de53075ae84e8e861822012c8c5834--3866e00bf1bd423b845acf0f20b28cfd
afd584d312d5491286008de27cc4e628
HamEvo
3866e00bf1bd423b845acf0f20b28cfd--afd584d312d5491286008de27cc4e628
0824c75b80044126a07de5027943ff9d
RX(theta₂₀)
afd584d312d5491286008de27cc4e628--0824c75b80044126a07de5027943ff9d
02c6d29cf2e34065966a81afdf483f4f
RY(theta₂₆)
0824c75b80044126a07de5027943ff9d--02c6d29cf2e34065966a81afdf483f4f
6c6fdb7a019e442e95def5797e9c8282
RX(theta₃₂)
02c6d29cf2e34065966a81afdf483f4f--6c6fdb7a019e442e95def5797e9c8282
a33022fbbc3b4d77b3cfff961d542357
HamEvo
6c6fdb7a019e442e95def5797e9c8282--a33022fbbc3b4d77b3cfff961d542357
a33022fbbc3b4d77b3cfff961d542357--8cd31db18e20449f9e4c43d21fa61c66
89f9e8c3ccc64a1ab0bf113f63297707
bf7b25256b05403fb9f2097ac27cb6cd
RX(theta₃)
84fa87efef2344798607d34ec485e0f7--bf7b25256b05403fb9f2097ac27cb6cd
31173321e484464e96d2ddf0fea6bbf0
4
98703cc337394c6392d2eec418ba2a8b
RY(theta₉)
bf7b25256b05403fb9f2097ac27cb6cd--98703cc337394c6392d2eec418ba2a8b
fa10d3f3a2684a28ab23ed170ef0f6f2
RX(theta₁₅)
98703cc337394c6392d2eec418ba2a8b--fa10d3f3a2684a28ab23ed170ef0f6f2
6d7d2983b9ae47a7a4e5d4595aabd98a
t = theta_t₀
fa10d3f3a2684a28ab23ed170ef0f6f2--6d7d2983b9ae47a7a4e5d4595aabd98a
6df1f282610e453aac7ea70f1c027caf
RX(theta₂₁)
6d7d2983b9ae47a7a4e5d4595aabd98a--6df1f282610e453aac7ea70f1c027caf
73257b879d104ab7aaea80d515f6f1bd
RY(theta₂₇)
6df1f282610e453aac7ea70f1c027caf--73257b879d104ab7aaea80d515f6f1bd
5094d75a64e24621ac646635a3e7acfd
RX(theta₃₃)
73257b879d104ab7aaea80d515f6f1bd--5094d75a64e24621ac646635a3e7acfd
0165283c3dad4ef19f52165e7c0d9ed9
t = theta_t₁
5094d75a64e24621ac646635a3e7acfd--0165283c3dad4ef19f52165e7c0d9ed9
0165283c3dad4ef19f52165e7c0d9ed9--89f9e8c3ccc64a1ab0bf113f63297707
47c8ddfcad024e2985b1f3d6c88fce93
0ee2a682c2e84bd8ba39cb62f07fdaa2
RX(theta₄)
31173321e484464e96d2ddf0fea6bbf0--0ee2a682c2e84bd8ba39cb62f07fdaa2
90a00f61f99149a9b5783f103ae74825
5
21cf6e40cd9a4deea5be7b969934bb46
RY(theta₁₀)
0ee2a682c2e84bd8ba39cb62f07fdaa2--21cf6e40cd9a4deea5be7b969934bb46
0cf7c2f8a7804affbe0cb69bd42d535e
RX(theta₁₆)
21cf6e40cd9a4deea5be7b969934bb46--0cf7c2f8a7804affbe0cb69bd42d535e
c69784d3f92041ad9c1a9beb7614c4ee
0cf7c2f8a7804affbe0cb69bd42d535e--c69784d3f92041ad9c1a9beb7614c4ee
be96c0aa53b84711b597c1c9c7f8ced1
RX(theta₂₂)
c69784d3f92041ad9c1a9beb7614c4ee--be96c0aa53b84711b597c1c9c7f8ced1
b7adbb7ba721460d8394c648b538b54a
RY(theta₂₈)
be96c0aa53b84711b597c1c9c7f8ced1--b7adbb7ba721460d8394c648b538b54a
7ab163730caa442899208bbe9c8a1b13
RX(theta₃₄)
b7adbb7ba721460d8394c648b538b54a--7ab163730caa442899208bbe9c8a1b13
dd97e342917a44fab525076a2bcda58e
7ab163730caa442899208bbe9c8a1b13--dd97e342917a44fab525076a2bcda58e
dd97e342917a44fab525076a2bcda58e--47c8ddfcad024e2985b1f3d6c88fce93
e12c935df8474608998f7be656c860b9
7a7f1bf956a64ce4b63ae9f7b0644ab4
RX(theta₅)
90a00f61f99149a9b5783f103ae74825--7a7f1bf956a64ce4b63ae9f7b0644ab4
bfae6443a7194e84a5ea4b51af19ac4f
RY(theta₁₁)
7a7f1bf956a64ce4b63ae9f7b0644ab4--bfae6443a7194e84a5ea4b51af19ac4f
4c1e539cd51f406e950718e4f606abae
RX(theta₁₇)
bfae6443a7194e84a5ea4b51af19ac4f--4c1e539cd51f406e950718e4f606abae
aed286004c3d4be1bcd35e2f09987295
4c1e539cd51f406e950718e4f606abae--aed286004c3d4be1bcd35e2f09987295
3371465ab48d4d1fae56341cad6c33b2
RX(theta₂₃)
aed286004c3d4be1bcd35e2f09987295--3371465ab48d4d1fae56341cad6c33b2
0211856877624b65ae14be027f440dd5
RY(theta₂₉)
3371465ab48d4d1fae56341cad6c33b2--0211856877624b65ae14be027f440dd5
de13ab85bd004b6db7cab9c2d7b38aa5
RX(theta₃₅)
0211856877624b65ae14be027f440dd5--de13ab85bd004b6db7cab9c2d7b38aa5
a8e3ab71879548cdb43f32aabf5c082a
de13ab85bd004b6db7cab9c2d7b38aa5--a8e3ab71879548cdb43f32aabf5c082a
a8e3ab71879548cdb43f32aabf5c082a--e12c935df8474608998f7be656c860b9
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_e3c40d530f2f4e1eacf60cbdcdac724f
BPMA-1
cluster_cbdef1fc23584dbc8cf3758b2ae05ddd
BPMA-0
829cf086140e47d7b8d9b5bdd7a36703
0
488ef4627db24af38c73a516e16ef9ce
RX(iia_α₀₀)
829cf086140e47d7b8d9b5bdd7a36703--488ef4627db24af38c73a516e16ef9ce
ad771da64fc648f8839a7d0d9b130513
1
ee1b31f4668a4110943989ddceb83ca6
RY(iia_α₀₃)
488ef4627db24af38c73a516e16ef9ce--ee1b31f4668a4110943989ddceb83ca6
81db5e3e0ed84a698b7bb064c036d35c
ee1b31f4668a4110943989ddceb83ca6--81db5e3e0ed84a698b7bb064c036d35c
41d6a304df904f35b6a127d58d9f828a
81db5e3e0ed84a698b7bb064c036d35c--41d6a304df904f35b6a127d58d9f828a
97e5178301c04983bcb78ff4a17fdef4
RX(iia_γ₀₀)
41d6a304df904f35b6a127d58d9f828a--97e5178301c04983bcb78ff4a17fdef4
145d7e8f6d6747fdb8852115e611989d
97e5178301c04983bcb78ff4a17fdef4--145d7e8f6d6747fdb8852115e611989d
2d193c7221af4043922f5eee090d67c3
145d7e8f6d6747fdb8852115e611989d--2d193c7221af4043922f5eee090d67c3
fcdca2806d634b1e8abdbc0e64b3d22a
RY(iia_β₀₃)
2d193c7221af4043922f5eee090d67c3--fcdca2806d634b1e8abdbc0e64b3d22a
9387a53f1a924a93a502bf2d35ed1ff8
RX(iia_β₀₀)
fcdca2806d634b1e8abdbc0e64b3d22a--9387a53f1a924a93a502bf2d35ed1ff8
9b00172f08834aeeb2e1ce52077022fa
RX(iia_α₁₀)
9387a53f1a924a93a502bf2d35ed1ff8--9b00172f08834aeeb2e1ce52077022fa
00395da9557240248b98d059f35f8e76
RY(iia_α₁₃)
9b00172f08834aeeb2e1ce52077022fa--00395da9557240248b98d059f35f8e76
ce47d2709339479d85d4949154ce6b75
00395da9557240248b98d059f35f8e76--ce47d2709339479d85d4949154ce6b75
19c7585444d94c61be51be843601d696
ce47d2709339479d85d4949154ce6b75--19c7585444d94c61be51be843601d696
8a8067bb010240e499395096f0accf03
RX(iia_γ₁₀)
19c7585444d94c61be51be843601d696--8a8067bb010240e499395096f0accf03
7b5e8aa58179436aa71e8c9761eacc4a
8a8067bb010240e499395096f0accf03--7b5e8aa58179436aa71e8c9761eacc4a
534aaabdb0144d18a293f3ec144e60d0
7b5e8aa58179436aa71e8c9761eacc4a--534aaabdb0144d18a293f3ec144e60d0
548d93fc0b864be792f2a2bb81bd882a
RY(iia_β₁₃)
534aaabdb0144d18a293f3ec144e60d0--548d93fc0b864be792f2a2bb81bd882a
3e6c66f29899415eb07efa4b8d4b8442
RX(iia_β₁₀)
548d93fc0b864be792f2a2bb81bd882a--3e6c66f29899415eb07efa4b8d4b8442
0f634c9a5ffc4abb9e88394b744ac73a
3e6c66f29899415eb07efa4b8d4b8442--0f634c9a5ffc4abb9e88394b744ac73a
ec8fbdbc46794162a471f535c2c53712
0d00a07023cc4b92ae12b3c5bb7a0c80
RX(iia_α₀₁)
ad771da64fc648f8839a7d0d9b130513--0d00a07023cc4b92ae12b3c5bb7a0c80
f721fcf3bf9c441ebc7222c1ba5d90da
2
70e77343ca3243dca78ce6b6e18cbfe8
RY(iia_α₀₄)
0d00a07023cc4b92ae12b3c5bb7a0c80--70e77343ca3243dca78ce6b6e18cbfe8
1f94073363d746778436784779a877ff
X
70e77343ca3243dca78ce6b6e18cbfe8--1f94073363d746778436784779a877ff
1f94073363d746778436784779a877ff--81db5e3e0ed84a698b7bb064c036d35c
52a83f734c244fccb4e8bfe4ccd3d2d6
1f94073363d746778436784779a877ff--52a83f734c244fccb4e8bfe4ccd3d2d6
8d48717d18ec49c8b42f8d221afaad74
RX(iia_γ₀₁)
52a83f734c244fccb4e8bfe4ccd3d2d6--8d48717d18ec49c8b42f8d221afaad74
1ec7ae408a6e4b7095b843edc43bf21c
8d48717d18ec49c8b42f8d221afaad74--1ec7ae408a6e4b7095b843edc43bf21c
ee940fb9a7d64e268806a1bf2c055075
X
1ec7ae408a6e4b7095b843edc43bf21c--ee940fb9a7d64e268806a1bf2c055075
ee940fb9a7d64e268806a1bf2c055075--2d193c7221af4043922f5eee090d67c3
12169dd4e7e944b78cbcf5c2ccafbe7d
RY(iia_β₀₄)
ee940fb9a7d64e268806a1bf2c055075--12169dd4e7e944b78cbcf5c2ccafbe7d
c44c74f0720d40dda938fc01376df476
RX(iia_β₀₁)
12169dd4e7e944b78cbcf5c2ccafbe7d--c44c74f0720d40dda938fc01376df476
e27b2c4c97c64b1cb64175b9795f6862
RX(iia_α₁₁)
c44c74f0720d40dda938fc01376df476--e27b2c4c97c64b1cb64175b9795f6862
2c6e26de88d64902ade48d8154444398
RY(iia_α₁₄)
e27b2c4c97c64b1cb64175b9795f6862--2c6e26de88d64902ade48d8154444398
e3c1aa9ca34e494eb13ae14a254e0b3e
X
2c6e26de88d64902ade48d8154444398--e3c1aa9ca34e494eb13ae14a254e0b3e
e3c1aa9ca34e494eb13ae14a254e0b3e--ce47d2709339479d85d4949154ce6b75
45ffc5667a2a4121aae9186399da069a
e3c1aa9ca34e494eb13ae14a254e0b3e--45ffc5667a2a4121aae9186399da069a
a3b215e0ac6f4fa9b3e12f2ec3c60eda
RX(iia_γ₁₁)
45ffc5667a2a4121aae9186399da069a--a3b215e0ac6f4fa9b3e12f2ec3c60eda
a98713dbeb7f44aa9020c6e1329db3dc
a3b215e0ac6f4fa9b3e12f2ec3c60eda--a98713dbeb7f44aa9020c6e1329db3dc
1fc11cda0198459a8eeb6d0646faae99
X
a98713dbeb7f44aa9020c6e1329db3dc--1fc11cda0198459a8eeb6d0646faae99
1fc11cda0198459a8eeb6d0646faae99--534aaabdb0144d18a293f3ec144e60d0
e98166c7c422464b916abd34955cfcb1
RY(iia_β₁₄)
1fc11cda0198459a8eeb6d0646faae99--e98166c7c422464b916abd34955cfcb1
762610adb71442c48cd33d266b5b5031
RX(iia_β₁₁)
e98166c7c422464b916abd34955cfcb1--762610adb71442c48cd33d266b5b5031
762610adb71442c48cd33d266b5b5031--ec8fbdbc46794162a471f535c2c53712
109a2af0aea6468c9f5dd173b77c9eb9
655dae052ed44badaa9c1aa7d8061991
RX(iia_α₀₂)
f721fcf3bf9c441ebc7222c1ba5d90da--655dae052ed44badaa9c1aa7d8061991
fee8b9b7fb2a426f8dbd2fb90a42a661
RY(iia_α₀₅)
655dae052ed44badaa9c1aa7d8061991--fee8b9b7fb2a426f8dbd2fb90a42a661
7b8e0a4db18543d88f2860eeafbb479d
fee8b9b7fb2a426f8dbd2fb90a42a661--7b8e0a4db18543d88f2860eeafbb479d
7631b6092c114951b89a25439a8fde38
X
7b8e0a4db18543d88f2860eeafbb479d--7631b6092c114951b89a25439a8fde38
7631b6092c114951b89a25439a8fde38--52a83f734c244fccb4e8bfe4ccd3d2d6
858e7bab767d432dab7ce8ef681b323b
RX(iia_γ₀₂)
7631b6092c114951b89a25439a8fde38--858e7bab767d432dab7ce8ef681b323b
f3d11ed16fde48e8b402807976a51ba2
X
858e7bab767d432dab7ce8ef681b323b--f3d11ed16fde48e8b402807976a51ba2
f3d11ed16fde48e8b402807976a51ba2--1ec7ae408a6e4b7095b843edc43bf21c
1eeaeb9a83cd4390998c5e0999ee3c23
f3d11ed16fde48e8b402807976a51ba2--1eeaeb9a83cd4390998c5e0999ee3c23
27b9d090fef349e69709473fa688dfab
RY(iia_β₀₅)
1eeaeb9a83cd4390998c5e0999ee3c23--27b9d090fef349e69709473fa688dfab
1a26196bf1a24cad8a96717356b5c381
RX(iia_β₀₂)
27b9d090fef349e69709473fa688dfab--1a26196bf1a24cad8a96717356b5c381
9559b4db1c07405aa81d1630d32c0654
RX(iia_α₁₂)
1a26196bf1a24cad8a96717356b5c381--9559b4db1c07405aa81d1630d32c0654
907bd379992c4120a01740b4af1fe127
RY(iia_α₁₅)
9559b4db1c07405aa81d1630d32c0654--907bd379992c4120a01740b4af1fe127
764469715e134e798fcaf388ef07db26
907bd379992c4120a01740b4af1fe127--764469715e134e798fcaf388ef07db26
e7af98d94bed46ac9dcf50b5cd09c145
X
764469715e134e798fcaf388ef07db26--e7af98d94bed46ac9dcf50b5cd09c145
e7af98d94bed46ac9dcf50b5cd09c145--45ffc5667a2a4121aae9186399da069a
d7bdc47557604cbc976692f18bdb912c
RX(iia_γ₁₂)
e7af98d94bed46ac9dcf50b5cd09c145--d7bdc47557604cbc976692f18bdb912c
2155e666d37a4c71806b98980faab016
X
d7bdc47557604cbc976692f18bdb912c--2155e666d37a4c71806b98980faab016
2155e666d37a4c71806b98980faab016--a98713dbeb7f44aa9020c6e1329db3dc
a7116071624a4810bf386ef69dd6a777
2155e666d37a4c71806b98980faab016--a7116071624a4810bf386ef69dd6a777
e5e0c14c6009497d95de3c947ce03560
RY(iia_β₁₅)
a7116071624a4810bf386ef69dd6a777--e5e0c14c6009497d95de3c947ce03560
23567b6066e14988a7b3fd54a6dd33a8
RX(iia_β₁₂)
e5e0c14c6009497d95de3c947ce03560--23567b6066e14988a7b3fd54a6dd33a8
23567b6066e14988a7b3fd54a6dd33a8--109a2af0aea6468c9f5dd173b77c9eb9