电路图#

基于Matplotlib的量子电路绘图。

待办事项:

  • 优化大电路的打印。

  • 让它和单扇门一起工作。

  • 更好地检查电路的形式,以确保它是多个门。

  • 获取多目标门标绘。

  • 绘制初始和最终状态。

  • 获取要绘制的测量值。可能需要重新考虑衡量作为一个关卡问题。

  • 得到规模和规模,以更好的方式处理。

  • 写一些测试/例子!

class sympy.physics.quantum.circuitplot.CircuitPlot(c, nqubits, **kwargs)[源代码]#

用于管理电路图的类。

control_line(gate_idx, min_wire, max_wire)[源代码]#

画一条垂直控制线。

control_point(gate_idx, wire_idx)[源代码]#

画一个控制点。

not_point(gate_idx, wire_idx)[源代码]#

画一个非门作为中间加正中的圆。

one_qubit_box(t, gate_idx, wire_idx)[源代码]#

绘制一个单量子比特门的方框。

swap_point(gate_idx, wire_idx)[源代码]#

画一个交换点作为十字。

two_qubit_box(t, gate_idx, wire_idx)[源代码]#

Draw a box for a two qubit gate. Does not work yet.

update(kwargs)[源代码]#

将kwargs加载到实例dict中。

sympy.physics.quantum.circuitplot.CreateCGate(name, latexname=None)[源代码]#

使用词法闭包来生成受控门。

class sympy.physics.quantum.circuitplot.Mx(*args, **kwargs)[源代码]#

x测量门模型。

这是电路图而不是门.py因为这不是一个真正的大门,它只是画了一个。

class sympy.physics.quantum.circuitplot.Mz(*args, **kwargs)[源代码]#

z测量门模型。

这是电路图而不是门.py因为这不是一个真正的大门,它只是画了一个。

sympy.physics.quantum.circuitplot.circuit_plot(c, nqubits, **kwargs)[源代码]#

用nkbits绘制电路图。

参数:

c :电路

要绘制的电路。应该是Gate实例的产物。

纳比特 :内景

The number of qubits to include in the circuit. Must be at least as big as the largest min_qubits of the gates.

sympy.physics.quantum.circuitplot.labeller(n, symbol='q')[源代码]#

量子电路导线的自动生成标签。

参数:

n :内景

number of qubits in the circuit.

符号 :字符串

所有门标签前面的字符串。E、 g.“q_0”、“q_1”等。

>>> from sympy.physics.quantum.circuitplot import labeller

>>> labeller(2)

[['q_1', 'q_0']]

>>> labeller(3,'j')

[['j_2', 'j_1', 'j_0']]