Qrack  9.0
General classical-emulating-quantum development framework
Public Member Functions | Public Attributes | List of all members
Qrack::QCircuitGate Struct Reference

#include <qcircuit.hpp>

Public Member Functions

 QCircuitGate ()
 Identity gate constructor. More...
 
 QCircuitGate (bitLenInt q1, bitLenInt q2)
 Swap gate constructor More...
 
 QCircuitGate (bitLenInt trgt, const complex matrix[])
 Single-qubit gate constructor. More...
 
 QCircuitGate (bitLenInt trgt, const complex matrix[], const std::set< bitLenInt > &ctrls, bitCapInt perm)
 Controlled gate constructor. More...
 
 QCircuitGate (bitLenInt trgt, const std::map< bitCapInt, std::shared_ptr< complex >> &pylds, const std::set< bitLenInt > &ctrls)
 Uniformly controlled gate constructor (that only accepts control qubits is ascending order) More...
 
QCircuitGatePtr Clone ()
 
bool CanCombine (QCircuitGatePtr other, bool clifford=false)
 Can I combine myself with gate other? More...
 
void Clear ()
 Set this gate to the identity operator. More...
 
void AddControl (bitLenInt c)
 Add control qubit. More...
 
bool CanRemoveControl (bitLenInt c)
 Check if a control qubit can be removed. More...
 
void RemoveControl (bitLenInt c)
 Remove control qubit. More...
 
bool TryRemoveControl (bitLenInt c)
 Check if I can remove control, and do so, if possible. More...
 
void Combine (QCircuitGatePtr other)
 Combine myself with gate other More...
 
bool TryCombine (QCircuitGatePtr other, bool clifford=false)
 Check if I can combine with gate other, and do so, if possible. More...
 
bool IsIdentity ()
 Am I an identity gate? More...
 
bool IsPhase ()
 Am I a phase gate? More...
 
bool IsInvert ()
 Am I a Pauli X plus a phase gate? More...
 
bool IsPhaseInvert ()
 Am I a combination of "phase" and "invert" payloads? More...
 
bool IsCnot ()
 Am I a CNOT gate? More...
 
bool IsClifford ()
 Am I a Clifford gate? More...
 
bool CanPass (QCircuitGatePtr other)
 Do I commute with gate other? More...
 
std::unique_ptr< complex[]> MakeUniformlyControlledPayload ()
 To run as a uniformly controlled gate, generate my payload array. More...
 
std::vector< bitLenIntGetControlsVector ()
 Convert my set of qubit indices to a vector. More...
 
void PostSelectControl (bitLenInt c, bool eigen)
 Erase a control index, if it exists, (via post selection). More...
 

Public Attributes

bitLenInt target
 
std::map< bitCapInt, std::shared_ptr< complex > > payloads
 
std::set< bitLenIntcontrols
 

Constructor & Destructor Documentation

◆ QCircuitGate() [1/5]

Qrack::QCircuitGate::QCircuitGate ( )
inline

Identity gate constructor.

◆ QCircuitGate() [2/5]

Qrack::QCircuitGate::QCircuitGate ( bitLenInt  q1,
bitLenInt  q2 
)
inline

Swap gate constructor

◆ QCircuitGate() [3/5]

Qrack::QCircuitGate::QCircuitGate ( bitLenInt  trgt,
const complex  matrix[] 
)
inline

Single-qubit gate constructor.

◆ QCircuitGate() [4/5]

Qrack::QCircuitGate::QCircuitGate ( bitLenInt  trgt,
const complex  matrix[],
const std::set< bitLenInt > &  ctrls,
bitCapInt  perm 
)
inline

Controlled gate constructor.

◆ QCircuitGate() [5/5]

Qrack::QCircuitGate::QCircuitGate ( bitLenInt  trgt,
const std::map< bitCapInt, std::shared_ptr< complex >> &  pylds,
const std::set< bitLenInt > &  ctrls 
)
inline

Uniformly controlled gate constructor (that only accepts control qubits is ascending order)

Member Function Documentation

◆ AddControl()

void Qrack::QCircuitGate::AddControl ( bitLenInt  c)
inline

Add control qubit.

◆ CanCombine()

bool Qrack::QCircuitGate::CanCombine ( QCircuitGatePtr  other,
bool  clifford = false 
)
inline

Can I combine myself with gate other?

◆ CanPass()

bool Qrack::QCircuitGate::CanPass ( QCircuitGatePtr  other)
inline

Do I commute with gate other?

◆ CanRemoveControl()

bool Qrack::QCircuitGate::CanRemoveControl ( bitLenInt  c)
inline

Check if a control qubit can be removed.

◆ Clear()

void Qrack::QCircuitGate::Clear ( )
inline

Set this gate to the identity operator.

◆ Clone()

QCircuitGatePtr Qrack::QCircuitGate::Clone ( )
inline

◆ Combine()

void Qrack::QCircuitGate::Combine ( QCircuitGatePtr  other)
inline

Combine myself with gate other

◆ GetControlsVector()

std::vector<bitLenInt> Qrack::QCircuitGate::GetControlsVector ( )
inline

Convert my set of qubit indices to a vector.

◆ IsClifford()

bool Qrack::QCircuitGate::IsClifford ( )
inline

Am I a Clifford gate?

◆ IsCnot()

bool Qrack::QCircuitGate::IsCnot ( )
inline

Am I a CNOT gate?

◆ IsIdentity()

bool Qrack::QCircuitGate::IsIdentity ( )
inline

Am I an identity gate?

◆ IsInvert()

bool Qrack::QCircuitGate::IsInvert ( )
inline

Am I a Pauli X plus a phase gate?

◆ IsPhase()

bool Qrack::QCircuitGate::IsPhase ( )
inline

Am I a phase gate?

◆ IsPhaseInvert()

bool Qrack::QCircuitGate::IsPhaseInvert ( )
inline

Am I a combination of "phase" and "invert" payloads?

◆ MakeUniformlyControlledPayload()

std::unique_ptr<complex[]> Qrack::QCircuitGate::MakeUniformlyControlledPayload ( )
inline

To run as a uniformly controlled gate, generate my payload array.

◆ PostSelectControl()

void Qrack::QCircuitGate::PostSelectControl ( bitLenInt  c,
bool  eigen 
)
inline

Erase a control index, if it exists, (via post selection).

◆ RemoveControl()

void Qrack::QCircuitGate::RemoveControl ( bitLenInt  c)
inline

Remove control qubit.

◆ TryCombine()

bool Qrack::QCircuitGate::TryCombine ( QCircuitGatePtr  other,
bool  clifford = false 
)
inline

Check if I can combine with gate other, and do so, if possible.

◆ TryRemoveControl()

bool Qrack::QCircuitGate::TryRemoveControl ( bitLenInt  c)
inline

Check if I can remove control, and do so, if possible.

Member Data Documentation

◆ controls

std::set<bitLenInt> Qrack::QCircuitGate::controls

◆ payloads

std::map<bitCapInt, std::shared_ptr<complex> > Qrack::QCircuitGate::payloads

◆ target

bitLenInt Qrack::QCircuitGate::target

The documentation for this struct was generated from the following file: