Helper functions for qiskit

hierarqcal.qiskit.qiskit_helper.get_circuit_qiskit(hierq, symbols=None, barriers=True)

The main helper function for qiskit, it takes a qcnn(hierarqcal.core.Qcnn) object that describes the cicruit architecture and builds a qiskit.QuantumCircuit object with the correct function mappings and symbols.

If the qubits are provided as ints then the qubit will be named "q0" and "q1", otherwise the qubits are assumed to be strings.

Parameters

qcnn (hierarqcal.core.Qcnn) – Qcnn object that describes the circuit architecture, consists of a sequence of motifs (hierarqcal.Qmotif)

Returns

Tuple containing:
  • circuit (qiskit.QuantumCircuit): QuantumCircuit object

  • symbols (tuple(Parameter)): Tuple of symbols (rotation angles) as a Qiskit Parameter object.

Return type

(tuple)

hierarqcal.qiskit.qiskit_helper.get_qiskit_circuit_from_instructions(qunitary)

Takes qunitary whose function attribute is a string, converts the string into a function, and returns the updated qunitary class.

Parameters

`qunitary (hierarcqal.core.Qunitary)

Returns

qunitary (hierarcqal.core.Qunitary)

hierarqcal.qiskit.qiskit_helper.get_qiskit_default_unitary(layer)