22#ifndef _SIMPLE_HOST_H_
23#define _SIMPLE_HOST_H_
43template <
typename Time = Types::time_type>
60 SimpleHost(
size_t hostId,
size_t startQubitId,
size_t numQubits,
61 size_t startClassicalBitId,
size_t numClassicalBits)
62 : id(hostId), startQubitId(startQubitId), numQubits(numQubits),
63 startClassicalBitId(startClassicalBitId),
64 numClassicalBits(numClassicalBits) {}
72 size_t GetId()
const override {
return id; }
92 if (std::numeric_limits<size_t>::max() == entangledQubitId)
116 return qubitId >= startQubitId && qubitId < startQubitId + numQubits;
137 return (cbitId >= startClassicalBitId &&
138 cbitId < startClassicalBitId + numClassicalBits) ||
139 cbitId == entangledQubitMeasurementBit;
154 return qubitId == entangledQubitId;
175 std::vector<size_t> res(numQubits);
177 std::iota(res.begin(), res.end(), startQubitId);
195 return {entangledQubitId};
205 std::vector<size_t> res(numClassicalBits);
207 std::iota(res.begin(), res.end(), startClassicalBitId);
222 if (std::numeric_limits<size_t>::max() == entangledQubitMeasurementBit)
225 return {entangledQubitMeasurementBit};
241 const std::vector<uint8_t> &packet)
override {
257 const std::vector<uint8_t> &packet)
override {
304 entangledQubitMeasurementBit = id;
310 size_t startQubitId =
312 size_t numQubits = 0;
314 size_t startClassicalBitId =
316 size_t numClassicalBits =
319 size_t entangledQubitId =
320 std::numeric_limits<size_t>::max();
322 size_t entangledQubitMeasurementBit =
323 std::numeric_limits<size_t>::max();
size_t GetNumClassicalBits() const override
Get the number of classical bits.
bool AreQubitsOnSameHost(size_t qubitId1, size_t qubitId2) const override
Check if two qubits are in the same host.
size_t GetId() const override
Get the host id.
void SetEntangledQubitMeasurementBit(size_t id)
Set the id of the classical bit used for measurement of the qubit used for entanglement between hosts...
size_t GetNumNetworkEntangledQubits() const override
Get the number of network entangled qubits.
bool SendPacketToHost(size_t hostId, const std::vector< uint8_t > &packet) override
Send a packet to a host.
bool IsEntangledQubitOnHost(size_t qubitId) const override
Check if a qubit used for entanglement between hosts is in the host.
bool RecvPacketFromHost(size_t hostId, const std::vector< uint8_t > &packet) override
Receive a packet from a host.
size_t GetStartClassicalBitId() const override
Get the id of the first classical bit assigned to the host.
bool AreCbitsOnSameHost(size_t cbitId1, size_t cbitId2) const override
Check if two classical bits are in the same host.
SimpleHost(size_t hostId, size_t startQubitId, size_t numQubits, size_t startClassicalBitId, size_t numClassicalBits)
The constructor.
std::vector< size_t > GetEntangledQubitMeasurementBitIds() const override
Get the ids of the classical bits used for measurement of the qubits used for entanglement between ho...
std::vector< size_t > GetNetworkEntangledQubitsIds() const override
Get the ids of the qubits used for entanglement between hosts in the host.
size_t GetStartQubitId() const override
Get the id of the first qubit assigned to the host.
bool IsQubitOnHost(size_t qubitId) const override
Check if a qubit is in the host.
bool IsClassicalBitOnHost(size_t cbitId) const override
Check if a classical bit is in the host.
std::vector< size_t > GetQubitsIds() const override
Get the ids of the qubits in the host.
void SetEntangledQubitId(size_t id)
Set the id of the qubit used for entanglement between hosts.
size_t GetNumQubits() const override
Get the number of qubits.
std::vector< size_t > GetClassicalBitsIds() const override
Get the ids of the classical bits in the host.