qulacsvis.visualization.latex module
- class qulacsvis.visualization.latex.LatexSourceGenerator(circuit: qulacsvis.models.circuit.CircuitData)[source]
Bases:
object
Generate latex source from CircuitData
- Parameters
circuit (CircuitData) – A quantum circuit to be drawn.
- _circuit_data
The data of the quantum circuit.
- Type
- _circuit
A matrix containing strings converted from CircuitData for Qcircuit. Each element and its position corresponds to one of GateData. Quantum circuit only, input values are not contained.
- Type
numpy.ndarray
- _head
The head of the latex source containing preamble.
- Type
str
- _tail
The tail of the latex source.
- Type
str
Examples
>>> from qulacs import QuantumCircuit >>> from qulacsvis.qulacs.circuit import to_model >>> from qulacsvis.visualization import LatexSourceGenerator >>> >>> circuit = QuantumCircuit(3) >>> circuit.add_X_gate(0) >>> circuit.add_Y_gate(1) >>> circuit.add_Z_gate(2) >>> >>> generator = LatexSourceGenerator(to_model(circuit)) >>> latex_source = generator.generate() >>> print(latex_source)