Skip to content

bloqade.analog.emulate.ir.state_vector.StateVector

← Module overview

classStateVectorsource

bloqade.analog.emulate.ir.state_vector.StateVector

class StateVector(data: NDArray, space: Space)

Parameters

NameTypeDescription
dataNDArray
spaceSpace

Attributes

NameTypeDescription
dataNDArray
spaceSpace

methodlocal_tracesource

bloqade.analog.emulate.ir.state_vector.StateVector.local_trace

Signature
def local_trace(matrix: np.ndarray, site_index: Union[int, Tuple[int, int]]) -> complex

return trace of an operator over the StateVector.

Parameters

NameTypeDescription
matrixnp.ndarraySquare matrix representing operator in the local hilbert space.
site_indexUnion[int, Tuple[int, int]]sites to apply one body operator to.

Returns

complexcomplex: the trace of the operator over the state-vector.

Raises

TypeDescription
ValueErrorError is raised when the dimension of `operator` is not
ValueErrorError is raised when the `site` argument is out of bounds.
source

methodsamplesource

bloqade.analog.emulate.ir.state_vector.StateVector.sample

def sample(shots: int, project_hyperfine: bool = True) -> NDArray

Sample the state vector and return bitstrings.

Parameters

NameTypeDefaultDescription
shotsintrequired
project_hyperfineboolTrue

Returns

NDArray

source

methodnormalizesource

bloqade.analog.emulate.ir.state_vector.StateVector.normalize

def normalize() -> None

Normalize the state vector.

source

methodnormsource

bloqade.analog.emulate.ir.state_vector.StateVector.norm

def norm() -> float

Return the norm of the state vector.

Returns

float

source