Template Class QubitManager¶
Defined in File LightningQubitManager.hpp
Class Documentation¶
-
template<typename ProgramQubitID = QubitIdType, typename DeviceQubitID = size_t>
class QubitManager¶ Class to maintain a mapping from qubit IDs between the Catalyst runtime (i.e. the program) and the device internals. Generally, program qubits always receive new IDs upon allocation and never reuse the same ID. This is done for safety to detect any use-after-free or other anomalies.
Qubit Manager
Additionally, the class maintains a collection of qubits that are inactive (i.e. have been freed) but whose memory is not physically released to the OS. This mechanism is an optimization to allow efficient reuse of simulator resources.
Public Functions
-
QubitManager() = default¶
-
~QubitManager() = default¶
-
QubitManager(const QubitManager&) = delete¶
-
QubitManager &operator=(const QubitManager&) = delete¶
-
QubitManager(QubitManager&&) = delete¶
-
QubitManager &operator=(QubitManager&&) = delete¶
-
inline auto getNumQubits() const -> size_t¶
-
inline auto isValidQubitId(ProgramQubitID program_id) const -> bool¶
-
inline auto isValidQubitId(const std::vector<ProgramQubitID> &program_ids) const -> bool¶
-
inline auto getDeviceId(ProgramQubitID program_id) const -> DeviceQubitID¶
-
inline auto getDeviceId(const std::vector<ProgramQubitID> &program_ids) const -> std::vector<DeviceQubitID>¶
-
inline auto getProgramId(DeviceQubitID device_id) const -> ProgramQubitID¶
-
inline auto getProgramId(const std::vector<DeviceQubitID> &device_ids) const -> std::vector<ProgramQubitID>¶
-
inline auto getAllQubitIds() -> std::vector<ProgramQubitID> const¶
-
inline auto popFreeQubit() -> std::optional<DeviceQubitID>¶
-
inline auto Allocate(DeviceQubitID device_id) -> ProgramQubitID¶
-
inline auto AllocateRange(DeviceQubitID start_device_id, size_t num_qubits) -> std::vector<ProgramQubitID>¶
-
inline void Release(ProgramQubitID program_id)¶
-
inline void ReleaseAll()¶
-
QubitManager() = default¶
api/classCatalyst_1_1Runtime_1_1Simulator_1_1QubitManager
Download Python script
Download Notebook
View on GitHub