Skip to content

bloqade.pyqrack.device.QuantumState

← Module overview

classQuantumStatesource

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 QuantumState

This 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

NameTypeDescription
eigenvalues1d np.ndarrayThe non-zero eigenvalues of the density matrix.
eigenvectors2d np.ndarrayThe corresponding eigenvectors of the density matrix, where eigenvectors[:,i] is the i-th eigenvector.

methodcanonicalizesource

bloqade.pyqrack.device.QuantumState.canonicalize

def canonicalize(tol: float = 1e-12) -> QuantumState

Parameters

NameTypeDefaultDescription
tolfloat1e-12

Returns

QuantumState

source

propertydensesource

bloqade.pyqrack.device.QuantumState.dense

dense: np.ndarray[tuple[int, int], np.complexfloating]
source

methodexpectsource

bloqade.pyqrack.device.QuantumState.expect

def expect(operator: Any) -> float

Parameters

NameTypeDescription
operatorAny

Returns

float

source

methodprobabilitysource

bloqade.pyqrack.device.QuantumState.probability

def probability() -> np.ndarray[tuple[int], np.floating]

Returns

np.ndarray[tuple[int], np.floating]

source

methodvon_neumann_entropysource

bloqade.pyqrack.device.QuantumState.von_neumann_entropy

def von_neumann_entropy() -> float

Returns

float

source

propertyqubit_basissource

bloqade.pyqrack.device.QuantumState.qubit_basis

qubit_basis: list[PyQrackQubit]
source

methodreduced_density_matrixsource

bloqade.pyqrack.device.QuantumState.reduced_density_matrix

Signature
def reduced_density_matrix(qubits: list[PyQrackQubit], tol: float = 1e-12) -> QuantumState

Parameters

NameTypeDefaultDescription
qubitslist[PyQrackQubit]required
tolfloat1e-12

Returns

QuantumState

source

methodoverlapsource

bloqade.pyqrack.device.QuantumState.overlap

def overlap(other: QuantumState) -> complex

Parameters

NameTypeDescription
otherQuantumState

Returns

complex

source