Skip to content

Commit

Permalink
the float_tresh value is now used by more parts of the simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
positr0nium committed Feb 13, 2024
1 parent 6f2f999 commit f0125d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/qrisp/default_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ def run(self, qc, shots, token = ""):


def_backend = DefaultBackend()
# def_backend = BackendClient()
# def_backend = BackendClient()
# raise
2 changes: 1 addition & 1 deletion src/qrisp/simulator/bi_array_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def coo_sparse_matrix_mult_jitted(A_row, A_col, A_data, B_row, B_col, B_data, A_

for i in range(res.shape[0]):
for j in range(res.shape[1]):
if np.abs(res[i,j]) > 1E-10:
if np.abs(res[i,j]) > float_tresh:
# if res[i,j] != 0:
new_row.append(A_row[unique_marker_a[i]])
new_col.append(B_col[unique_marker_b[j]])
Expand Down
5 changes: 1 addition & 4 deletions src/qrisp/simulator/tensor_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ def apply_matrix(self, matrix, qubits):
import numpy as np

if matrix.size >= 2**6:
if matrix.dtype == np.complex64:
matrix = matrix * (np.abs(matrix) > 1e-7)
if matrix.dtype == np.complex128:
matrix = matrix * (np.abs(matrix) > 1e-15)
matrix = matrix * (np.abs(matrix) > float_tresh)

# Convert matrix to BiArray
matrix = DenseBiArray(matrix)
Expand Down

0 comments on commit f0125d3

Please sign in to comment.