Skip to content

Commit a68adbb

Browse files
authored
Use math instead of numpy functions for angle calculations in PrepareUniformSuperposition (#1734)
numpy functions don't work when `n` is large. math functions continue to work.
1 parent 252639d commit a68adbb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

qualtran/bloqs/state_preparation/prepare_uniform_superposition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def decompose_from_registers(
123123
return
124124

125125
ancilla = context.qubit_manager.qalloc(1)
126-
theta = np.arccos(1 - (2 ** np.floor(np.log2(l))) / l)
126+
theta = acos(1 - (2 ** floor(log2(l))) / l)
127127
yield LessThanConstant(logL, l).on_registers(x=logL_qubits, target=ancilla)
128128
yield cirq.Rz(rads=theta)(*ancilla)
129129
yield LessThanConstant(logL, l).on_registers(x=logL_qubits, target=ancilla) ** -1 # type: ignore[operator]

0 commit comments

Comments
 (0)