def plot_deep(self): from sympy.physics.quantum.circuitplot import CircuitPlot circuit, labels = self.get_circuit_deep(), self.get_labels() circ = CircuitPlot(circuit, len(labels), labels=labels, inits=self.inits)
def get_figure(self): from sympy.physics.quantum.circuitplot import CircuitPlot circuit, labels = self.get_circuit(), self.get_labels() circ = CircuitPlot(circuit, len(labels), labels=labels, inits=self.inits) return circ._figure
def test_cnot(): """Test a simple cnot circuit. Right now this only makes sure the code doesn't raise an exception, and some simple properties """ if not mpl: skip("matplotlib not installed") else: from sympy.physics.quantum.circuitplot import CircuitPlot c = CircuitPlot(CNOT(1, 0), 2, labels=labeller(2)) assert c.ngates == 2 assert c.nqubits == 2 assert c.labels == ['q_1', 'q_0'] c = CircuitPlot(CNOT(1, 0), 2) assert c.ngates == 2 assert c.nqubits == 2 assert c.labels == []
def test_ex1(): if not mpl: skip("matplotlib not installed") else: from sympy.physics.quantum.circuitplot import CircuitPlot c = CircuitPlot(CNOT(1, 0) * H(1), 2, labels=labeller(2)) assert c.ngates == 2 assert c.nqubits == 2 assert c.labels == ['q_1', 'q_0']
def test_ex4(): if not mpl: skip("matplotlib not installed") else: from sympy.physics.quantum.circuitplot import CircuitPlot c = CircuitPlot(SWAP(0,2)*H(0)* CGate((0,),S(1)) *H(1)*CGate((0,),T(2))\ *CGate((1,),S(2))*H(2),3,labels=labeller(3,'j')) assert c.ngates == 7 assert c.nqubits == 3 assert c.labels == ['j_2', 'j_1', 'j_0']
def plot(self): #from sympy.physics.quantum.circuitplot import CircuitPlot circuit, labels = self.get_circuit(), self.get_labels() print(circuit) CircuitPlot(circuit, len(labels), labels=labels, inits=self.inits)