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__psi_m
In [2]:
# check that the built expression is the same as the stored expression
assert circuit__u_Akl_v__psi_m == stored_expr
assert circuit__u_Akl_v__psi_m._style_id == stored_expr._style_id
print("Passed sanity check: circuit__u_Akl_v__psi_m matches stored_expr")
Passed sanity check: circuit__u_Akl_v__psi_m 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} \\
\qin{\lvert \psi \rangle} & { /^{m} } \qw & { /^{m} } \qw & \gate{\cdots} & { /^{m} } \qw & \qout{\lvert \psi \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, 7
4ExprRangelambda_map: 8
start_index: 63
end_index: 9
5ExprTuple10, 11
6ExprRangelambda_map: 12
start_index: 63
end_index: 64
7ExprRangelambda_map: 13
start_index: 63
end_index: 65
8Lambdaparameter: 53
body: 15
9Variable
10ExprRangelambda_map: 16
start_index: 63
end_index: 64
11ExprRangelambda_map: 17
start_index: 63
end_index: 65
12Lambdaparameter: 57
body: 18
13Lambdaparameter: 57
body: 19
14ExprTuple53
15ExprTuple20, 21
16Lambdaparameter: 57
body: 22
17Lambdaparameter: 57
body: 23
18Operationoperator: 29
operands: 24
19Operationoperator: 29
operands: 25
20ExprRangelambda_map: 26
start_index: 63
end_index: 64
21ExprRangelambda_map: 27
start_index: 63
end_index: 65
22Operationoperator: 29
operands: 28
23Operationoperator: 29
operands: 30
24NamedExprselement: 31
targets: 37
25NamedExprselement: 32
targets: 39
26Lambdaparameter: 57
body: 33
27Lambdaparameter: 57
body: 35
28NamedExprselement: 36
targets: 37
29Literal
30NamedExprselement: 38
targets: 39
31Operationoperator: 41
operands: 40
32Operationoperator: 41
operands: 49
33IndexedVarvariable: 42
indices: 43
34ExprTuple57
35Operationoperator: 44
operands: 45
36Operationoperator: 48
operands: 46
37Operationoperator: 50
operands: 47
38Operationoperator: 48
operands: 49
39Operationoperator: 50
operands: 51
40NamedExprsstate: 52
part: 57
41Literal
42Variable
43ExprTuple53, 57
44Literal
45NamedExprsoperation: 54
46NamedExprsstate: 55
part: 57
47ExprTuple63, 64
48Literal
49NamedExprsstate: 56
part: 57
50Literal
51ExprTuple58, 59
52Variable
53Variable
54Literal
55Variable
56Variable
57Variable
58Operationoperator: 61
operands: 60
59Operationoperator: 61
operands: 62
60ExprTuple64, 63
61Literal
62ExprTuple64, 65
63Literal
64Variable
65Variable