NumpyStatevectorQuantumState¶
Bases: BaseQuantumState
NumpyStatevectorQuantumState ¶
NumpyStatevectorQuantumState(state: NumpyStatevectorLike, qubit_labels: Sequence[QubitTypes] | None = None, seed: int | None = None, kraus_sampling: str | None = None, contraction: str | None = None, d: int | Sequence[int] = 2) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
NumpyStatevectorLike
|
A representation of the underlying state. If an integer is passed, an all-0 state with that number of qubits is passed |
required |
qubit_labels
|
Sequence[QubitTypes] | None
|
Optional qubit labels. If not provided, the default range of ints is used. |
None
|
seed
|
int | None
|
Optional RNG seed. If not provided, default NumPy RNG behavior applies. |
None
|
kraus_sampling
|
str | None
|
Kraus sampling mode; see |
None
|
contraction
|
str | None
|
Operator contraction mode; see |
None
|
Attributes¶
| Name | Type | Value | Doc |
|---|---|---|---|
contraction |
str |
unset | Operator contraction mode; see CONTRACTION_MODES. |
d |
list[int] |
unset | List of dimensions of each subsystem (e.g. 2 for qubits, 3 for qutrits). |
input_reps |
list[type[ |
read-only property | Gate and instrument rep classes this state can take as input. |
kraus_sampling |
str |
unset | Kraus sampling mode; see KRAUS_SAMPLING_MODES. |
name |
str |
'NumPy Statevector' |
Name of state backend |
qubit_labels |
list[QubitTypes] |
unset | Qubit labels. |
seed |
int | None |
unset | RNG seed; None indicates default NumPy behavior. |
state |
numpy.ndarray |
read-only property | Get the underlying quantum state vector. |
apply_reps ¶
apply_reps(reps: Sequence[OperationRep]) -> tuple[NumpyStatevectorQuantumState, OutcomeDict]
Apply the reps to the state in-place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reps
|
Sequence[OperationRep]
|
See |
required |
Returns:
| Type | Description |
|---|---|
(BaseQuantumState, OutcomeDict)
|
A copy of the state with reps applied, and dictionary of outcomes. Outcomes can be empty if no measurements were performed. |
Apply the reps to the state in-place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reps
|
Sequence[OperationRep]
|
Operator representations to apply |
required |
Returns:
| Type | Description |
|---|---|
OutcomeDict
|
Dictionary of outcomes. Can be empty if no measurements were performed. |
Deep-copy a state object.
Returns:
| Type | Description |
|---|---|
Copied state
|
|
decode¶
Inherited static method from Serializable.decode().
display¶
Inherited method from Displayable.display().
dump¶
Inherited method from Serializable.dump().
encode¶
Inherited static method from Serializable.encode().
load¶
Inherited class method from Serializable.load().
print_bitstring_amplitudes ¶
print_bitstring_amplitudes()
Print the amplitudes of all bitstrings in the quantum state.
This method prints the qubit labels and then iterates through all possible bitstrings, displaying those with amplitudes greater than a threshold (1e-6).
read¶
Inherited class method from Serializable.read().
Reset the RNG seed.
serialize_function¶
Inherited static method from Serializable.serialize_function().
write¶
Inherited method from Serializable.write().