logo
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__u_Akl_v
In [2]:
# check that the built expression is the same as the stored expression
assert circuit__u_Akl_v == stored_expr
assert circuit__u_Akl_v._style_id == stored_expr._style_id
print("Passed sanity check: circuit__u_Akl_v matches stored_expr")
Passed sanity check: circuit__u_Akl_v 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{
\multiqin{3}{\lvert u \rangle} & \gate{A_{1, 1}} \qwx[1] & \gate{A_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{k, 1}} \qwx[1] & \multiqout{3}{\lvert v \rangle} \\
\ghostqin{\lvert u \rangle} & \gate{A_{1, 2}} \qwx[1] & \gate{A_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{k, 2}} \qwx[1] & \ghostqout{\lvert v \rangle} \\
\ghostqin{\lvert u \rangle} & \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \ghostqout{\lvert v \rangle} \\
\ghostqin{\lvert u \rangle} & \gate{A_{1, l}} & \gate{A_{2, l}} & \gate{\cdots} & \gate{A_{k, l}} & \ghostqout{\lvert v \rangle}
} \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: 38
end_index: 8
5ExprTuple9
6ExprRangelambda_map: 10
start_index: 38
end_index: 39
7Lambdaparameter: 35
body: 12
8Variable
9ExprRangelambda_map: 13
start_index: 38
end_index: 39
10Lambdaparameter: 37
body: 14
11ExprTuple35
12ExprTuple15
13Lambdaparameter: 37
body: 16
14Operationoperator: 19
operands: 17
15ExprRangelambda_map: 18
start_index: 38
end_index: 39
16Operationoperator: 19
operands: 20
17NamedExprselement: 21
targets: 25
18Lambdaparameter: 37
body: 23
19Literal
20NamedExprselement: 24
targets: 25
21Operationoperator: 26
operands: 27
22ExprTuple37
23IndexedVarvariable: 28
indices: 29
24Operationoperator: 30
operands: 31
25Operationoperator: 32
operands: 33
26Literal
27NamedExprsstate: 34
part: 37
28Variable
29ExprTuple35, 37
30Literal
31NamedExprsstate: 36
part: 37
32Literal
33ExprTuple38, 39
34Variable
35Variable
36Variable
37Variable
38Literal
39Variable