Template Class QubitRegister

Inheritance Relationships

Derived Types

Class Documentation

template<class Type = ComplexDP>
class QubitRegister

Subclassed by NoisyQureg< Type >, QubitRegisterMetric< Type >

Public Types

using value_type = Type
typedef extract_value_type<Type>::value_type BaseType

Public Functions

QubitRegister()
QubitRegister(std::size_t num_qubits, std::string style = "", std::size_t base_index = 0, std::size_t tmp_spacesize_ = 0)
QubitRegister(const QubitRegister &in)
QubitRegister(std::size_t num_qubits, Type *state, std::size_t tmp_spacesize_ = 0)
~QubitRegister()
void AllocateAdditionalQubit()
void Allocate(std::size_t new_num_qubits, std::size_t tmp_spacesize_)
void Initialize(std::size_t new_num_qubits, std::size_t tmp_spacesize_)
void Initialize(std::string style, std::size_t base_index)
Type &operator[](std::size_t index)
Type &operator[](std::size_t index) const
Type GetGlobalAmplitude(std::size_t index) const
std::size_t LocalSize() const
std::size_t GlobalSize() const
void Resize(std::size_t new_num_amplitudes)
std::size_t size() const
std::size_t NumQubits() const
Type *TmpSpace() const
size_t TmpSize() const
bool check_bit(std::size_t variable, std::size_t position) const
std::size_t set_bit(std::size_t variable, std::size_t position) const
std::size_t clear_bit(std::size_t variable, std::size_t position) const
void EnableStatistics()
void GetStatistics()
void DisableStatistics()
void ResetStatistics()
void Permute(std::vector<std::size_t> permutation_new_vec)
bool Apply1QubitGate_helper(unsigned qubit, TM2x2<Type> const &m, std::size_t sstate_ind, std::size_t estate_ind)
void Apply1QubitGate(unsigned qubit, TM2x2<Type> const &m)
bool ApplyControlled1QubitGate_helper(unsigned control_qubit, unsigned target_qubit, TM2x2<Type> const &m, std::size_t sind, std::size_t eind)
void ApplyControlled1QubitGate(unsigned control_qubit, unsigned target_qubit, TM2x2<Type> const &m)
bool ApplySwap_helper(unsigned qubit1, unsigned qubit2, TM2x2<Type> const &m)
void ApplySwap(unsigned qubit1, unsigned qubit2)
void ApplyISwap(unsigned qubit1, unsigned qubit2)
void Apply4thRootISwap(unsigned qubit1, unsigned qubit2)
void ApplySqrtISwap(unsigned qubit1, unsigned qubit2)
void ApplyISwapRotation(unsigned qubit1, unsigned qubit2, TM2x2<Type> const &m)
void Swap(unsigned b1, unsigned b2)
void ApplyDiagSimp(unsigned qubit1, unsigned qubit2, TM4x4<Type> const &m)
void ApplyDiag(unsigned qubit1, unsigned qubit2, TM4x4<Type> const &m)
void ApplyDiagControl(unsigned qubit1, unsigned qubit2, TM4x4<Type> const &m)
void ApplyDiagGeneral(unsigned qubit1, unsigned qubit2, TM4x4<Type> const &m)
void Apply2QubitGate(unsigned const qubit_high, unsigned const qubit_low, TM4x4<Type> const &m)
void ApplyRotationX(unsigned const qubit, BaseType theta)
void ApplyRotationY(unsigned const qubit, BaseType theta)
void ApplyRotationZ(unsigned const qubit, BaseType theta)
void ApplyPauliX(unsigned const qubit)
void ApplyPauliY(unsigned const qubit)
void ApplyPauliZ(unsigned const qubit)
void ApplyPauliSqrtX(unsigned const qubit)
void ApplyPauliSqrtY(unsigned const qubit)
void ApplyPauliSqrtZ(unsigned const qubit)
void ApplyT(unsigned const qubit)
void ApplyToffoli(unsigned const qubit1, unsigned const qubit2, unsigned const qubit3)
void ApplyHadamard(unsigned const qubit)
void ApplyCRotationX(unsigned const control_qubit, unsigned const target_qubit, BaseType theta)
void ApplyCRotationY(unsigned const control_qubit, unsigned const target_qubit, BaseType theta)
void ApplyCRotationZ(unsigned const control_qubit, unsigned const target_qubit, BaseType theta)
void ApplyCPauliX(unsigned const control_qubit, unsigned const target_qubit)
void ApplyCPauliY(unsigned const control_qubit, unsigned const target_qubit)
void ApplyCPauliZ(unsigned const control_qubit, unsigned const target_qubit)
void ApplyCPauliSqrtZ(unsigned const control_qubit, unsigned const target_qubit)
void ApplyCHadamard(unsigned const control_qubit, unsigned const target_qubit)
void ApplyCPhaseRotation(unsigned const qubit, unsigned const qubit2, BaseType theta)
void TurnOnFusion(unsigned log2llc = 20)
void TurnOffFusion()
bool IsFusionEnabled()
void ApplyFusedGates()
void TurnOnSpecialize()
void TurnOffSpecialize()
bool GetClassicalValue(unsigned qubit, BaseType tolerance = 1.e-13) const
bool IsClassicalBit(unsigned qubit, BaseType tolerance = 1.e-13) const
void CollapseQubit(unsigned qubit, bool value)
BaseType GetProbability(unsigned qubit)
BaseType ExpectationValueX(unsigned const qubit, BaseType coeff = 1.)
BaseType ExpectationValueY(unsigned const qubit, BaseType coeff = 1.)
BaseType ExpectationValueZ(unsigned const qubit, BaseType coeff = 1.)
BaseType ExpectationValueXX(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValueXY(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValueXZ(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValueYX(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValueYY(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValueYZ(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValueZX(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValueZY(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValueZZ(unsigned const qubit, unsigned const qubit2, BaseType coeff = 1.)
BaseType ExpectationValue(std::vector<unsigned> &qubits, std::vector<unsigned> &observables, BaseType coeff = 1.)
BaseType GetT1()
BaseType GetT2()
BaseType GetTphi()
void SetNoiseTimescales(BaseType T1, BaseType T2)
void ApplyNoiseGate(const unsigned qubit, const BaseType duration)
bool operator==(const QubitRegister &rhs)
BaseType MaxAbsDiff(QubitRegister &x, Type sfactor = Type(1.0, 0.))
BaseType MaxL2NormDiff(QubitRegister &x)
void dumpbin(std::string fn)
double Entropy()
std::vector<double> GoogleStats()
void Normalize()
BaseType ComputeNorm()
Type ComputeOverlap(QubitRegister<Type> &psi)
void Print(std::string x, std::vector<std::size_t> qbits = {})
double HP_Distrpair(unsigned pos, TM2x2<Type> const &m)
double HP_Distrpair(unsigned control, unsigned qubit, TM2x2<Type> const &m)
qhipster::RandomNumberGenerator<BaseType> *GetRngPtr()
void ResetRngPtr()
void SetRngPtr(qhipster::RandomNumberGenerator<BaseType> *rng_ptr)
void SetSeedRngPtr(std::size_t seed)

Public Members

std::size_t num_qubits
std::vector<Type, qhipster::AlignedAllocator<Type, 256>> state_storage
Type *state
Permutation *permutation
Timer *timer
GateCounter *gate_counter
std::size_t llc_watermarkbit
bool imported_state
bool specialize
bool fusion
unsigned log2llc
std::vector<std::tuple<std::string, TM2x2<Type>, unsigned, unsigned>> fwindow

Public Static Functions

void SetDoPrintExtraInfo(bool value)