##// END OF EJS Templates
Updating sympy notebook examples.
Updating sympy notebook examples.

File last commit:

r4336:b2aa21fc
r4336:b2aa21fc
Show More
gate_rules.ipynb
1 line | 1.4 KiB | text/plain | TextLexer
Brian Granger
Updating sympy notebook examples.
r4336 {"cells":[{"cell_type":"text","text":"<h1>Gate rules and circuit simplification</h1>"},{"code":"%load_ext sympyprinting","cell_type":"code","prompt_number":1},{"code":"from sympy import sqrt, symbols, Rational\nfrom sympy import expand, Eq, Symbol, simplify, exp, sin\nfrom sympy.physics.quantum import *\nfrom sympy.physics.quantum.qubit import *\nfrom sympy.physics.quantum.gate import *\nfrom sympy.physics.quantum.grover import *\nfrom sympy.physics.quantum.qft import QFT, IQFT, Fourier\nfrom sympy.physics.quantum.circuitplot import circuit_plot\nfrom sympy.physics.quantum.gaterules import *","cell_type":"code","prompt_number":2},{"code":"h0 = match_gate_rules(H(0))\nfor rule in h0:\n display(Eq(H(0),rule))","cell_type":"code","prompt_number":5},{"code":"z0 = match_gate_rules(Z(0))\nfor rule in z0:\n display(Eq(Z(0),rule))","cell_type":"code","prompt_number":7},{"code":"x0 = match_gate_rules(X(0))\nfor rule in x0:\n display(Eq(X(0),rule))","cell_type":"code","prompt_number":9},{"code":"circuit_plot(CNOT(1,0), nqubits=2)\n","cell_type":"code","prompt_number":10},{"code":"c10 = match_gate_rules(CNOT(1,0))","cell_type":"code","prompt_number":12},{"code":"circuit_plot(c10[8], nqubits=2)","cell_type":"code","prompt_number":13},{"code":"%notebook save gate_rules.ipynb","cell_type":"code","prompt_number":16},{"code":"","cell_type":"code","prompt_number":25}]}