logo

Common circuit_aUb of type Qcircuit

from the theory of proveit.physics.quantum.circuits

In [1]:
import proveit
# Automation is not needed when only building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import the special expression
from proveit.physics.quantum.circuits import circuit_aUb
In [2]:
# check that the built expression is the same as the stored expression
assert circuit_aUb == stored_expr
assert circuit_aUb._style_id == stored_expr._style_id
print("Passed sanity check: circuit_aUb matches stored_expr")
Passed sanity check: circuit_aUb matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{a} & \gate{\begin{array}{c} \uparrow \\U_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\U_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\U_{m} \\ \downarrow\end{array}} & \qout{b}
} \end{array}
In [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
spacingchange the spacing of a circuit using the format '@C=1em @R=.7em' where C is the column spacing and R is the row spacing@C=1em @R=.7em@C=1em @R=.7em
In [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4, 5
3ExprTuple6
4ExprRangelambda_map: 7
start_index: 32
end_index: 8
5ExprTuple9
6ExprRangelambda_map: 10
start_index: 32
end_index: 33
7Lambdaparameter: 31
body: 11
8Variable
9ExprRangelambda_map: 12
start_index: 32
end_index: 33
10Lambdaparameter: 31
body: 13
11IndexedVarvariable: 14
index: 31
12Lambdaparameter: 31
body: 16
13Operationoperator: 18
operands: 17
14Variable
15ExprTuple31
16Operationoperator: 18
operands: 19
17NamedExprselement: 20
targets: 22
18Literal
19NamedExprselement: 21
targets: 22
20Operationoperator: 23
operands: 24
21Operationoperator: 25
operands: 26
22Operationoperator: 27
operands: 28
23Literal
24NamedExprsstate: 29
part: 31
25Literal
26NamedExprsstate: 30
part: 31
27Literal
28ExprTuple32, 33
29Variable
30Variable
31Variable
32Literal
33Variable