Skip to content

Commit f577145

Browse files
authored
Add binary literal example to methods of SimulatesAmplitudes class (quantumlib#5818)
1 parent fb34de4 commit f577145

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cirq/sim/simulator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ def compute_amplitudes(
156156
bitstrings: The bitstrings whose amplitudes are desired, input
157157
as an integer array where each integer is formed from measured
158158
qubit values according to `qubit_order` from most to least
159-
significant qubit, i.e. in big-endian ordering.
159+
significant qubit, i.e. in big-endian ordering. If inputting
160+
a binary literal add the prefix 0b or 0B.
161+
For example: 0010 can be input as 0b0010, 0B0010, 2, 0x2, etc.
160162
param_resolver: Parameters to run with the program.
161163
qubit_order: Determines the canonical ordering of the qubits. This
162164
is often used in specifying the initial state, i.e. the
@@ -214,7 +216,9 @@ def compute_amplitudes_sweep_iter(
214216
bitstrings: The bitstrings whose amplitudes are desired, input
215217
as an integer array where each integer is formed from measured
216218
qubit values according to `qubit_order` from most to least
217-
significant qubit, i.e. in big-endian ordering.
219+
significant qubit, i.e. in big-endian ordering. If inputting
220+
a binary literal add the prefix 0b or 0B.
221+
For example: 0010 can be input as 0b0010, 0B0010, 2, 0x2, etc.
218222
params: Parameters to run with the program.
219223
qubit_order: Determines the canonical ordering of the qubits. This
220224
is often used in specifying the initial state, i.e. the

0 commit comments

Comments
 (0)