|
10 | 10 | # See the License for the specific language governing permissions and |
11 | 11 | # limitations under the License. |
12 | 12 | """This module provides functions to interface with scipy.sparse.""" |
| 13 | + |
13 | 14 | import itertools |
14 | 15 | from functools import reduce |
15 | 16 | import warnings |
@@ -119,7 +120,7 @@ def jordan_wigner_sparse(fermion_operator, n_qubits=None): |
119 | 120 | # Extract triplets from sparse_term. |
120 | 121 | sparse_matrix = sparse_matrix.tocoo(copy=False) |
121 | 122 | values_list.append(sparse_matrix.data) |
122 | | - (row, column) = sparse_matrix.nonzero() |
| 123 | + row, column = sparse_matrix.nonzero() |
123 | 124 | row_list.append(row) |
124 | 125 | column_list.append(column) |
125 | 126 |
|
@@ -179,7 +180,7 @@ def qubit_operator_sparse(qubit_operator, n_qubits=None): |
179 | 180 | # Extract triplets from sparse_term. |
180 | 181 | sparse_matrix = kronecker_operators(sparse_operators) |
181 | 182 | values_list.append(sparse_matrix.tocoo(copy=False).data) |
182 | | - (column, row) = sparse_matrix.nonzero() |
| 183 | + column, row = sparse_matrix.nonzero() |
183 | 184 | column_list.append(column) |
184 | 185 | row_list.append(row) |
185 | 186 |
|
@@ -1230,7 +1231,7 @@ def boson_operator_sparse(operator, trunc, hbar=1.0): |
1230 | 1231 |
|
1231 | 1232 | # Extract triplets from sparse_term. |
1232 | 1233 | values_list.append(term_operator.tocoo(copy=False).data) |
1233 | | - (row, column) = term_operator.nonzero() |
| 1234 | + row, column = term_operator.nonzero() |
1234 | 1235 | column_list.append(column) |
1235 | 1236 | row_list.append(row) |
1236 | 1237 |
|
|
0 commit comments