@@ -764,18 +764,18 @@ def eval(self, operator_mode, input_circuit, backend, execute_config={}, qjob_co
764
764
765
765
# If the statevector is already a vector, skip the evaluation from quantum simulator.
766
766
767
- if backend .startswith ('local' ):
768
- self .MAX_CIRCUITS_PER_JOB = sys .maxsize
769
-
770
767
if isinstance (input_circuit , np .ndarray ):
771
768
avg = self ._eval_directly (input_circuit )
772
769
std_dev = 0.0
773
- elif "statevector" in backend :
774
- execute_config ['shots' ] = 1
775
- avg = self ._eval_with_statevector (operator_mode , input_circuit , backend , execute_config )
776
- std_dev = 0.0
777
770
else :
778
- avg , std_dev = self ._eval_multiple_shots (operator_mode , input_circuit , backend , execute_config , qjob_config )
771
+ if backend .startswith ('local' ):
772
+ self .MAX_CIRCUITS_PER_JOB = sys .maxsize
773
+ if "statevector" in backend :
774
+ execute_config ['shots' ] = 1
775
+ avg = self ._eval_with_statevector (operator_mode , input_circuit , backend , execute_config )
776
+ std_dev = 0.0
777
+ else :
778
+ avg , std_dev = self ._eval_multiple_shots (operator_mode , input_circuit , backend , execute_config , qjob_config )
779
779
return avg , std_dev
780
780
781
781
def convert (self , input_format , output_format , force = False ):
@@ -1498,14 +1498,14 @@ def kernel_F2(matrix_in):
1498
1498
def find_Z2_symmetries (self ):
1499
1499
"""
1500
1500
Finds Z2 Pauli-type symmetries of an Operator
1501
-
1501
+
1502
1502
Returns:
1503
- [Pauli]: the list of Pauli objects representing the Z2 symmetries
1503
+ [Pauli]: the list of Pauli objects representing the Z2 symmetries
1504
1504
[Pauli]: the list of single - qubit Pauli objects to construct the Cliffors operators
1505
1505
[Operators]: the list of Clifford unitaries to block diagonalize Operator
1506
1506
[int]: the list of support of the single-qubit Pauli objects used to build the clifford operators
1507
1507
"""
1508
-
1508
+
1509
1509
Pauli_symmetries = []
1510
1510
sq_paulis = []
1511
1511
cliffords = []
@@ -1539,7 +1539,7 @@ def find_Z2_symmetries(self):
1539
1539
stacked_symmetries [row , col + symm_shape [1 ] // 2 ] == 0 ) or
1540
1540
(stacked_symmetries [row , col ] == 1 and
1541
1541
stacked_symmetries [row , col + symm_shape [1 ] // 2 ] == 1 )):
1542
- sq_paulis .append (Pauli (np .zeros (symm_shape [1 ] // 2 ),
1542
+ sq_paulis .append (Pauli (np .zeros (symm_shape [1 ] // 2 ),
1543
1543
np .zeros (symm_shape [1 ] // 2 )))
1544
1544
sq_paulis [row ].v [col ] = 0
1545
1545
sq_paulis [row ].w [col ] = 1
@@ -1563,18 +1563,18 @@ def find_Z2_symmetries(self):
1563
1563
sq_list .append (col )
1564
1564
break
1565
1565
1566
- # case symmetries other than one at (row) have Y or I on col qubit
1567
- Y_or_I = True
1566
+ # case symmetries other than one at (row) have Y or I on col qubit
1567
+ Y_or_I = True
1568
1568
for symm_idx in range (symm_shape [0 ] - 1 ):
1569
1569
if not ( (stacked_symm_del [symm_idx , col ] == 1 and
1570
1570
stacked_symm_del [symm_idx , col + symm_shape [1 ] // 2 ] == 1 )
1571
1571
or (stacked_symm_del [symm_idx , col ] == 0 and
1572
1572
stacked_symm_del [symm_idx , col + symm_shape [1 ] // 2 ] == 0 ) ):
1573
1573
Y_or_I = False
1574
1574
if Y_or_I == True :
1575
- if ( (stacked_symmetries [row , col ] == 0 and
1575
+ if ( (stacked_symmetries [row , col ] == 0 and
1576
1576
stacked_symmetries [row , col + symm_shape [1 ] // 2 ] == 1 ) or
1577
- (stacked_symmetries [row , col ] == 1 and
1577
+ (stacked_symmetries [row , col ] == 1 and
1578
1578
stacked_symmetries [row , col + symm_shape [1 ] // 2 ] == 0 ) ):
1579
1579
sq_paulis .append (Pauli (np .zeros (symm_shape [1 ] // 2 ), np .zeros (symm_shape [1 ] // 2 )))
1580
1580
sq_paulis [row ].v [col ] = 1
@@ -1590,9 +1590,9 @@ def find_Z2_symmetries(self):
1590
1590
@staticmethod
1591
1591
def qubit_tapering (operator , cliffords , sq_list , tapering_values ):
1592
1592
"""
1593
- Builds an Operator which has a number of qubits tapered off,
1593
+ Builds an Operator which has a number of qubits tapered off,
1594
1594
based on a block-diagonal Operator built using a list of cliffords.
1595
- The block-diagonal subspace is an input parameter, set through the list
1595
+ The block-diagonal subspace is an input parameter, set through the list
1596
1596
tapering_values, which takes values +/- 1.
1597
1597
1598
1598
Args:
@@ -1615,11 +1615,11 @@ def qubit_tapering(operator, cliffords, sq_list, tapering_values):
1615
1615
qubit list and tapering values' )
1616
1616
1617
1617
for clifford in cliffords :
1618
- operator = clifford * operator * clifford
1618
+ operator = clifford * operator * clifford
1619
1619
1620
1620
operator_out = Operator (paulis = [])
1621
1621
n = len (operator .paulis [0 ][1 ].v )
1622
- for pauli_term in operator .paulis :
1622
+ for pauli_term in operator .paulis :
1623
1623
coeff_out = pauli_term [0 ]
1624
1624
for qubit_idx , qubit in enumerate (sq_list ):
1625
1625
if not (pauli_term [1 ].v [qubit ] == 0 and pauli_term [1 ].w [qubit ] == 0 ):
@@ -1633,7 +1633,7 @@ def qubit_tapering(operator, cliffords, sq_list, tapering_values):
1633
1633
pauli_term_out = [coeff_out , Pauli (np .array (v_temp ), np .array (w_temp ))]
1634
1634
operator_out += Operator (paulis = [pauli_term_out ])
1635
1635
1636
- return operator_out
1636
+ return operator_out
1637
1637
1638
1638
def zeros_coeff_elimination (self ):
1639
1639
"""
0 commit comments