|
Maestro 0.2.5
Unified interface for quantum circuit simulation
|
The state class that stores the classical state of a quantum circuit execution. More...
#include <Operations.h>
Collaboration diagram for Circuits::OperationState:Public Member Functions | |
| OperationState (const OperationState &other) | |
| Construct a new Operation State object. | |
| OperationState (const std::vector< bool > &b) | |
| Construct a new Operation State object. | |
| OperationState (OperationState &&other) noexcept | |
| Construct a new Operation State object. | |
| OperationState (size_t numBits=0) | |
| Construct a new Operation State object. | |
| OperationState (std::vector< bool > &&b) | |
| Construct a new Operation State object. | |
| void | AllocateBits (size_t numBits) |
| Allocate more bits. | |
| void | Clear () |
| Clear the classical state. | |
| const std::vector< bool > & | GetAllBits () const |
| Get the classical bits. | |
| std::vector< bool > | GetAllBitsCopy () const |
| Get the classical bits. | |
| bool | GetBit (size_t index) const |
| Get the classical bit at the specified index. | |
| std::vector< bool > | GetBits (const std::vector< size_t > &indices) const |
| Get the classical bits at the specified indices. | |
| size_t | GetNumBits () const |
| Get the number of classical bits. | |
| OperationState & | operator= (const OperationState &other) |
| Assign the bits. | |
| OperationState & | operator= (const std::vector< bool > &b) |
| Assign the bits. | |
| OperationState & | operator= (OperationState &&other) noexcept |
| Assign the bits. | |
| OperationState & | operator= (std::vector< bool > &&b) |
| Assign the bits. | |
| void | Remap (const std::unordered_map< Types::qubit_t, Types::qubit_t > &mapping, bool ignoreNotMapped=false, size_t newSize=0) |
| Convert the state using the provided mapping. | |
| void | RemapWithVector (const std::vector< Types::qubit_t > &mapping, bool ignoreNotMapped=false, size_t newSize=0) |
| Convert the state using the provided mapping. | |
| void | Reset (bool value=false) |
| Set the classical bits with the specified value. | |
| void | SetBit (size_t index, bool value=true) |
| Set the classical bit at the specified index. | |
| void | SetResults (const std::vector< size_t > &indices, size_t results) |
| Set the classical bits at the specified indices. | |
| void | SetResultsInOrder (const std::vector< bool > &results) |
| Set the classical bits. | |
| void | Swap (OperationState &results) |
| Set results. | |
The state class that stores the classical state of a quantum circuit execution.
Contains the classical state (such as measurement results and classical values for conditions) of a quantum circuit execution.
Definition at line 63 of file Operations.h.
|
inline |
Construct a new Operation State object.
Pass the number of bits to allocate. If not specified, the default is 0, they can be allocated later.
| numBits | The number of bits to allocate. |
Definition at line 72 of file Operations.h.
References AllocateBits().
|
inline |
Construct a new Operation State object.
Copy constructor.
| other | The OperationState object to copy. |
Definition at line 81 of file Operations.h.
|
inlinenoexcept |
Construct a new Operation State object.
Move constructor.
| other | The OperationState object to move. |
Definition at line 90 of file Operations.h.
|
inline |
Construct a new Operation State object.
Construct a new Operation State object with the specified bits.
| bits | The bits to set. |
Definition at line 99 of file Operations.h.
|
inline |
Construct a new Operation State object.
Construct a new Operation State object with the specified bits.
| bits | The bits to set. |
Definition at line 107 of file Operations.h.
|
inline |
Allocate more bits.
Allocate more bits, the number of classical bits is increased by the number of bits specified.
| numBits | The number of bits to suplementary allocate. |
Definition at line 160 of file Operations.h.
Referenced by OperationState(), Network::SimpleDisconnectedNetwork< Time, Controller >::CreateSimulator(), Network::ExecuteJob< Time >::DoWork(), Network::ExecuteJob< Time >::DoWorkNoLock(), and Estimators::SimulatorsEstimatorInterface< Time >::ExecuteUpToMeasurements().
|
inline |
Clear the classical state.
Clear the classical state, the number of allocated bits is reset to 0.
Definition at line 169 of file Operations.h.
Referenced by Network::SimpleDisconnectedNetwork< Time, Controller >::CreateSimulator(), Network::SimpleDisconnectedNetwork< Time, Controller >::RepeatedExecute(), and Network::SimpleDisconnectedNetwork< Time, Controller >::RepeatedExecuteOnHost().
|
inline |
Get the classical bits.
Get the values of the classical bits.
Definition at line 214 of file Operations.h.
Referenced by Network::SimpleDisconnectedNetwork< Time, Controller >::ConvertBackResults(), Network::ExecuteJob< Time >::DoWork(), and Network::ExecuteJob< Time >::DoWorkNoLock().
|
inline |
Get the classical bits.
Get the values of the classical bits.
Definition at line 222 of file Operations.h.
|
inline |
Get the classical bit at the specified index.
Get the value of the classical bit at the specified index.
| index | The index of the bit to get. |
Definition at line 186 of file Operations.h.
|
inline |
Get the classical bits at the specified indices.
Get the values of the classical bits at the specified indices.
| indices | The indices of the bits to get. |
Definition at line 199 of file Operations.h.
Referenced by Circuits::EqualCondition::IsConditionMet().
|
inline |
Get the number of classical bits.
Get the number of allocated classical bits.
Definition at line 177 of file Operations.h.
|
inline |
Assign the bits.
Assign the bits.
| other | The OperationState object to copy. |
Definition at line 115 of file Operations.h.
|
inline |
Assign the bits.
Assign the bits.
| bits | The bits to set. |
Definition at line 137 of file Operations.h.
|
inlinenoexcept |
Assign the bits.
Assign the bits.
| other | The OperationState object to move. |
Definition at line 126 of file Operations.h.
|
inline |
Assign the bits.
Assign the bits.
| bits | The bits to set. |
Definition at line 148 of file Operations.h.
|
inline |
Convert the state using the provided mapping.
Set the values of the classical bits.
| mapping | The mapping of the bits. |
| ignoreNotMapped | If true, the bits that are not in the mapping are ignored. The size of the state will be the size of the mapping. |
| newSize | The new size of the state. If zero, the size of the state is used. Ignored if ignoreNotMapped is true. |
| offset | The offset to add to the remapping. |
Definition at line 297 of file Operations.h.
Referenced by Network::SimpleDisconnectedNetwork< Time, Controller >::ConvertBackResults(), and Network::SimpleDisconnectedNetwork< Time, Controller >::ConvertBackState().
|
inline |
Convert the state using the provided mapping.
Set the values of the classical bits.
| mapping | The mapping of the bits. |
| ignoreNotMapped | If true, the bits that are not in the mapping are ignored. The size of the state will be the size of the mapping. |
| newSize | The new size of the state. If zero, the size of the state is used. Ignored if ignoreNotMapped is true. |
| offset | The offset to add to the remapping. |
Definition at line 327 of file Operations.h.
|
inline |
Set the classical bits with the specified value.
Set the values of the classical bits with the specified value. If not specified, the default value is false.
| value | The value assigned to the classical bits. |
Definition at line 244 of file Operations.h.
Referenced by Network::ExecuteJob< Time >::DoWork(), Network::ExecuteJob< Time >::DoWorkNoLock(), Circuits::Circuit< Time >::Execute(), and Circuits::Circuit< Time >::ExecuteMeasurements().
|
inline |
Set the classical bit at the specified index.
Set the value of the classical bit at the specified index.
| index | The index of the bit to set. |
| value | The value to set the bit to. |
Definition at line 231 of file Operations.h.
Referenced by Circuits::Random< Time >::Execute(), and Circuits::MeasurementOperation< Time >::SetStateFromSample().
|
inline |
Set the classical bits at the specified indices.
Set the values of the classical bits at the specified indices to the values specified in results. Each bit in results specifies a value.
| indices | The indices of the bits to set. |
| results | The value that contains the values for the bits. |
Definition at line 268 of file Operations.h.
|
inline |
Set the classical bits.
Set the values of the classical bits to the values specified in results. Each bit in results specifies a value.
| results | A vector of bools that contains the values for the bits. |
Definition at line 253 of file Operations.h.
Referenced by Network::SimpleDisconnectedNetwork< Time, Controller >::Execute(), Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteExpectations(), Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteOnHost(), Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteOnHostAmplitudes(), Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteOnHostExpectations(), and Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteOnHostProjectOnZero().
|
inline |
Set results.
Set the values of the classical bits. Destroys the source, it's implemented for increasing performance.
| results | The new values. |
Definition at line 283 of file Operations.h.