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)
63 startQubitId(startQubitId),
65 startClassicalBitId(startClassicalBitId),
66 numClassicalBits(numClassicalBits) {}
74 size_t GetId()
const override {
return id; }
94 if (std::numeric_limits<size_t>::max() == entangledQubitId)
return 0;
117 return qubitId >= startQubitId && qubitId < startQubitId + numQubits;
138 return (cbitId >= startClassicalBitId &&
139 cbitId < startClassicalBitId + numClassicalBits) ||
140 cbitId == entangledQubitMeasurementBit;
154 return qubitId == entangledQubitId;
175 std::vector<size_t> res(numQubits);
177 std::iota(res.begin(), res.end(), startQubitId);
194 return {entangledQubitId};
204 std::vector<size_t> res(numClassicalBits);
206 std::iota(res.begin(), res.end(), startClassicalBitId);
221 if (std::numeric_limits<size_t>::max() == entangledQubitMeasurementBit)
224 return {entangledQubitMeasurementBit};
240 const std::vector<uint8_t> &packet)
override {
256 const std::vector<uint8_t> &packet)
override {
303 entangledQubitMeasurementBit = id;
309 size_t startQubitId =
311 size_t numQubits = 0;
313 size_t startClassicalBitId =
315 size_t numClassicalBits =
318 size_t entangledQubitId =
319 std::numeric_limits<size_t>::max();
321 size_t entangledQubitMeasurementBit =
322 std::numeric_limits<size_t>::max();
The simple host implementation.
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.