Class qb_visitor

Inheritance Relationships

Base Type

  • public xacc::quantum::AllGateVisitor

Class Documentation

class qb_visitor : public xacc::quantum::AllGateVisitor

Visitor functions for gates and measurement.

void visit(Identity&) override

Identity (no-op)

void visit(Rx&) override

Rotation about x axis.

void visit(Ry&) override

Rotation about y axis.

void visit(CZ&) override

Controlled Z gate.

void visit(Rz&) override

Rotation about z axis.

void visit(Hadamard&) override

Hadamard gate.

void visit(CNOT&) override

Controlled NOT gate.

void visit(S&) override

S gate.

void visit(Sdg&) override

Inverse S gate.

void visit(T&) override

T gate.

void visit(Tdg&) override

Inverse T gate.

void visit(X&) override

Pauli X gate.

void visit(Y&) override

Pauli Y gate.

void visit(Z&) override

Pauli Z date.

void visit(CPhase&) override

Controlled phase gate.

void visit(Swap&) override

Swap the values of two qubits.

void visit(U&) override

General 1-qubit unitary.

void visit(Measure&) override

Measure a single qubit.

Public Functions

inline qb_visitor(const int nQubits, const bool cut_angles = true)

Constructor.

inline virtual ~qb_visitor()

Destructor.

virtual const std::string name() const

Return name of the visitor.

virtual const std::string description() const

Return description of the visitor.

double norm(const double&)

Normalise angles to the interval (-pi,pi].

std::string getXasmString()

Return the finished qpu OpenQasm kernel.

std::shared_ptr<xacc::CompositeInstruction> getTranspiledIR() const

Retrieved the IR tree in the basis gate set.

Protected Attributes

int nQubits_

Number of qubits.

unsigned int classicalBitCounter_ = 0

Number of classical bit registers to which measurements have been assigned.

std::map<unsigned int, unsigned int> qubitToClassicalBitIndex_

Map from qubit indices to assigned classical readout bit indices.

nlohmann::json sequence_

JSON for sequence of gates (XASM format)

const double pi = xacc::constants::pi

No point reinventing the circle is there?

bool restrict_angles_to_pmpi_

Restrict native gate rotation angles to (-pi,pi].