Quantum++
v1.2
A modern C++11 quantum computing library
|
Quantum circuit engine, executes qpp::QCircuit. More...
#include <classes/circuits.h>
Public Member Functions | |
QEngine (const QCircuit &qc) | |
Constructs a quantum engine out of a quantum circuit. More... | |
QEngine (const QEngine &)=default | |
Default copy constructor. More... | |
QEngine & | operator= (const QEngine &)=default |
Default copy assignment operator. More... | |
QEngine (QCircuit &&)=delete | |
Disables rvalue QCircuit. More... | |
virtual | ~QEngine ()=default |
Default virtual destructor. More... | |
ket | get_psi () const |
Underlying quantum state. More... | |
ket & | get_ref_psi () |
Reference to the underlying quantum state. More... | |
std::vector< idx > | get_dits () const |
Vector with the values of the underlying classical dits. More... | |
idx | get_dit (idx i) const |
Value of the classical dit at position i. More... | |
std::vector< double > | get_probs () const |
Vector of underlying measurement outcome probabilities. More... | |
bool | get_measured (idx i) const |
Check whether qudit i was already measured. More... | |
std::vector< idx > | get_measured () const |
Vector of already measured qudit indexes. More... | |
std::vector< idx > | get_not_measured () const |
Vector of non-measured qudit indexes. More... | |
const QCircuit & | get_circuit () const noexcept |
Quantum circuit. More... | |
QEngine & | set_dit (idx i, idx value) |
Sets the classical dit at position i. More... | |
void | reset () |
Resets the engine. More... | |
void | execute (const QCircuit::iterator::value_type &elem) |
Executes one step in the quantum circuit. More... | |
void | execute (const QCircuit::iterator &it) |
Executes one step in the quantum circuit. More... | |
std::string | to_JSON (bool enclosed_in_curly_brackets=true) const override |
qpp::IJOSN::to_JSON() override More... | |
![]() | |
IDisplay ()=default | |
Default constructor. More... | |
IDisplay (const IDisplay &)=default | |
Default copy constructor. More... | |
IDisplay (IDisplay &&)=default | |
Default move constructor. More... | |
IDisplay & | operator= (const IDisplay &)=default |
Default copy assignment operator. More... | |
IDisplay & | operator= (IDisplay &&)=default |
Default move assignment operator. More... | |
virtual | ~IDisplay ()=default |
Default virtual destructor. More... | |
![]() | |
IJSON ()=default | |
Default constructor. More... | |
IJSON (const IJSON &)=default | |
Default copy constructor. More... | |
IJSON (IJSON &&)=default | |
Default move constructor. More... | |
IJSON & | operator= (const IJSON &)=default |
Default copy assignment operator. More... | |
IJSON & | operator= (IJSON &&)=default |
Default move assignment operator. More... | |
virtual | ~IJSON ()=default |
Default virtual destructor. More... | |
Protected Member Functions | |
void | set_measured_ (idx i) |
Marks qudit i as measured then re-label accordingly the remaining non-measured qudits. More... | |
std::vector< idx > | get_relative_pos_ (std::vector< idx > v) |
Giving a vector V of non-measured qudits, get their relative position with respect to the measured qudits. More... | |
Protected Attributes | |
const QCircuit * | qc_ |
pointer to constant quantum circuit More... | |
ket | psi_ |
state vector More... | |
std::vector< idx > | dits_ |
classical dits More... | |
std::vector< double > | probs_ |
measurement probabilities More... | |
std::vector< idx > | subsys_ |
Private Member Functions | |
std::ostream & | display (std::ostream &os) const override |
qpp::IDisplay::display() override More... | |
Quantum circuit engine, executes qpp::QCircuit.
|
inlineexplicit |
Constructs a quantum engine out of a quantum circuit.
qc | Quantum circuit |
|
default |
Default copy constructor.
|
virtualdefault |
Default virtual destructor.
|
inlineoverrideprivatevirtual |
qpp::IDisplay::display() override
Writes to the output stream a textual representation of the state of the engine
os | Output stream passed by reference |
Implements qpp::IDisplay.
|
inline |
Executes one step in the quantum circuit.
elem | Step to be executed |
|
inline |
Executes one step in the quantum circuit.
it | Iterator to the step to be executed |
|
inlinenoexcept |
Quantum circuit.
Value of the classical dit at position i.
i | Classical dit index |
|
inline |
Vector with the values of the underlying classical dits.
|
inline |
Check whether qudit i was already measured.
i | Qudit index |
|
inline |
Vector of already measured qudit indexes.
|
inline |
Vector of non-measured qudit indexes.
|
inline |
Vector of underlying measurement outcome probabilities.
|
inline |
Underlying quantum state.
|
inline |
Reference to the underlying quantum state.
Giving a vector V of non-measured qudits, get their relative position with respect to the measured qudits.
v |
Default copy assignment operator.
|
inline |
Resets the engine.
Re-initializes everything to zero and sets the initial state to
Sets the classical dit at position i.
i | Classical dit index |
value | Classical dit value |
|
inlineprotected |
Marks qudit i as measured then re-label accordingly the remaining non-measured qudits.
i | Qudit index |
|
inlineoverridevirtual |
qpp::IJOSN::to_JSON() override
Displays the state of the engine in JSON format
enclosed_in_curly_brackets | If true, encloses the result in curly brackets |
Implements qpp::IJSON.
|
protected |
classical dits
|
protected |
measurement probabilities
|
protected |
state vector
|
protected |
pointer to constant quantum circuit
|
protected |
keeps track of the measured subsystems, relabel them after measurements