bloqade.pyqrack.device.QuantumState
classQuantumState¶source
bloqade.pyqrack.device.QuantumState
Bases: NamedTuple
A representation of a quantum state as a density matrix, where the density matrix is rho = sum_i eigenvalues[i] |eigenvectors[:,i]><eigenvectors[:,i]|.
class QuantumStateThis representation is efficient for low-rank density matrices by only storing the non-zero eigenvalues and corresponding eigenvectors of the density matrix. For example, a pure state has only one non-zero eigenvalue equal to 1.0.
Endianness and qubit ordering of the state vector is consistent with Cirq, where eigenvectors[0,0] corresponds to the amplitude of the |00..000> element of the zeroth eigenvector; eigenvectors[1,0] corresponds to the amplitude of the |00..001> element of the zeroth eigenvector; eigenvectors[3,0] corresponds to the amplitude of the |00..011> element of the zeroth eigenvector; eigenvectors[-1,0] corresponds to the amplitude of the |11..111> element of the zeroth eigenvector. A flip of the LAST bit |00..000><00..001| corresponds to applying a PauliX gate to the FIRST qubit. A flip of the FIRST bit |00..000><10..000| corresponds to applying a PauliX gate to the LAST qubit.
Methods: Not Implemented, pending https://github.com/QuEraComputing/bloqade-circuit/issues/447
Attributes
| Name | Type | Description |
|---|---|---|
eigenvalues | 1d np.ndarray | The non-zero eigenvalues of the density matrix. |
eigenvectors | 2d np.ndarray | The corresponding eigenvectors of the density matrix, where eigenvectors[:,i] is the i-th eigenvector. |
methodcanonicalize¶source
bloqade.pyqrack.device.QuantumState.canonicalize
def canonicalize(tol: float = 1e-12) -> QuantumStateParameters
| Name | Type | Default | Description |
|---|---|---|---|
tol | float | 1e-12 |
Returns
QuantumState
propertydense¶source
bloqade.pyqrack.device.QuantumState.dense
dense: np.ndarray[tuple[int, int], np.complexfloating]methodexpect¶source
bloqade.pyqrack.device.QuantumState.expect
methodprobability¶source
bloqade.pyqrack.device.QuantumState.probability
def probability() -> np.ndarray[tuple[int], np.floating]Returns
np.ndarray[tuple[int], np.floating]
methodvon_neumann_entropy¶source
bloqade.pyqrack.device.QuantumState.von_neumann_entropy
propertyqubit_basis¶source
bloqade.pyqrack.device.QuantumState.qubit_basis
qubit_basis: list[PyQrackQubit]methodreduced_density_matrix¶source
bloqade.pyqrack.device.QuantumState.reduced_density_matrix
Signature
def reduced_density_matrix(qubits: list[PyQrackQubit], tol: float = 1e-12) -> QuantumStateParameters
| Name | Type | Default | Description |
|---|---|---|---|
qubits | list[PyQrackQubit] | required | |
tol | float | 1e-12 |
Returns
QuantumState
methodoverlap¶source
bloqade.pyqrack.device.QuantumState.overlap
def overlap(other: QuantumState) -> complexParameters
| Name | Type | Description |
|---|---|---|
other | QuantumState |
Returns
complex