@@ -307,7 +307,7 @@ def get_monomial(self) -> PauliStringMonomial:
307
307
def compute_coefficients_diagonal_case (
308
308
m : list [bool ],
309
309
current_node : DiagPauliNode ,
310
- diag_elements : npt .NDArray [np .float64 ],
310
+ diag_elements : npt .NDArray [np .float32 ],
311
311
monomial_list : list [PauliStringMonomial ],
312
312
):
313
313
"""Computes coefficients for the current node in the pauli tree based on the
@@ -356,7 +356,7 @@ def update_tree_diagonal_case(current_node: DiagPauliNode, m: list[bool]):
356
356
def generate_and_explore_node_diagonal_case (
357
357
m : list [bool ],
358
358
current_node : DiagPauliNode ,
359
- diag_elements : npt .NDArray [np .float64 ],
359
+ diag_elements : npt .NDArray [np .float32 ],
360
360
n : int ,
361
361
monomials : list [PauliStringMonomial ],
362
362
progression : Optional [list [int ]] = None ,
@@ -404,7 +404,7 @@ def generate_and_explore_node_diagonal_case(
404
404
405
405
@typechecked
406
406
def decompose_diagonal_observable_ptdr (
407
- diag_elements : list [Real ] | npt .NDArray [np .float64 ], print_progression : bool = False
407
+ diag_elements : list [Real ] | npt .NDArray [np .float32 ], print_progression : bool = False
408
408
) -> PauliString :
409
409
"""Decomposes a diagonal observable into a Pauli string representation.
410
410
@@ -480,7 +480,7 @@ def generate_hadamard(n: int) -> npt.NDArray[np.int8]:
480
480
481
481
482
482
def compute_coefficients_walsh (
483
- H_matrix : npt .NDArray [np .int8 ], diagonal_elements : npt .NDArray [np .float64 ]
483
+ H_matrix : npt .NDArray [np .int8 ], diagonal_elements : npt .NDArray [np .float32 ]
484
484
) -> list [float ]:
485
485
"""Computes the coefficients using the Walsh-Hadamard transform.
486
486
@@ -505,7 +505,7 @@ def compute_coefficients_walsh(
505
505
506
506
@typechecked
507
507
def decompose_diagonal_observable_walsh_hadamard (
508
- diag_elements : list [Real ] | npt .NDArray [np .float64 ],
508
+ diag_elements : list [Real ] | npt .NDArray [np .float32 ],
509
509
) -> PauliString :
510
510
"""Decomposes the observable represented by the diagonal elements into a
511
511
Pauli string using the Walsh-Hadamard transform.
@@ -535,7 +535,7 @@ def decompose_diagonal_observable_walsh_hadamard(
535
535
if TYPE_CHECKING :
536
536
assert isinstance (m , PauliStringMonomial )
537
537
if c != 0.0 :
538
- m .coef = c
538
+ m .coef = c . real
539
539
final_monomials .append (m )
540
540
541
541
return PauliString (final_monomials )
0 commit comments