22#ifndef _SIMPLE_HOST_H_
23#define _SIMPLE_HOST_H_
61 SimpleHost(
size_t hostId,
size_t startQubitId,
size_t numQubits,
size_t startClassicalBitId,
size_t numClassicalBits)
62 : id(hostId), startQubitId(startQubitId), numQubits(numQubits), startClassicalBitId(startClassicalBitId), numClassicalBits(numClassicalBits)
99 if (std::numeric_limits<size_t>::max() == entangledQubitId)
115 return numClassicalBits;
127 return qubitId >= startQubitId && qubitId < startQubitId + numQubits;
150 return (cbitId >= startClassicalBitId && cbitId < startClassicalBitId + numClassicalBits) || cbitId == entangledQubitMeasurementBit;
166 return qubitId == entangledQubitId;
189 std::vector<size_t> res(numQubits);
191 std::iota(res.begin(), res.end(), startQubitId);
210 return {entangledQubitId};
221 std::vector<size_t> res(numClassicalBits);
223 std::iota(res.begin(), res.end(), startClassicalBitId);
239 if (std::numeric_limits<size_t>::max() == entangledQubitMeasurementBit)
242 return {entangledQubitMeasurementBit};
301 return startClassicalBitId;
315 entangledQubitId = id;
331 entangledQubitMeasurementBit = id;
337 size_t startQubitId = 0;
338 size_t numQubits = 0;
340 size_t startClassicalBitId = 0;
341 size_t numClassicalBits = 0;
343 size_t entangledQubitId = std::numeric_limits<size_t>::max();
345 size_t entangledQubitMeasurementBit = 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.