@@ -107,12 +107,6 @@ def test_draw_sentence():
107
107
return Alice @ loves @ Bob >> Cup (n , n .r ) @ Id (s ) @ Cup (n .l , n )
108
108
109
109
110
- @draw_and_compare ('bell-state.png' , draw = Circuit .draw , aspect = 'equal' )
111
- def test_draw_bell_state ():
112
- from discopy .quantum import qubit , H , sqrt , Bra , Ket , Id , CX
113
- return sqrt (2 ) >> Ket (0 , 0 ) >> H @ qubit >> CX >> Bra (0 ) @ qubit
114
-
115
-
116
110
@draw_and_compare ('bialgebra.png' , draw = quantum .zx .Sum .draw , aspect = 'equal' )
117
111
def test_draw_bialgebra ():
118
112
from discopy .quantum .zx import Z , X , Id , SWAP
@@ -153,52 +147,6 @@ def test_copy_to_tikz():
153
147
return copy_x @ copy_y >> Id (x ) @ Swap (x , y ) @ Id (y )
154
148
155
149
156
- @tikz_and_compare ("snake-equation.tikz" , draw = draw_equation ,
157
- textpad = (.2 , .2 ), textpad_words = (0 , .25 ))
158
- def test_snake_equation_to_tikz ():
159
- x = Ty ('x' )
160
- return Id (x .r ).transpose (left = True ), Id (x ), Id (x .l ).transpose ()
161
-
162
-
163
- @tikz_and_compare ("who-ansatz.tikz" ,
164
- draw = draw_equation , symbol = "$\\ mapsto$" )
165
- def test_who_ansatz_to_tikz ():
166
- from discopy .grammar .pregroup import Ty , Cup , Cap , Word , Id , Box
167
- s , n = Ty ('s' ), Ty ('n' )
168
- who = Word ('who' , n .r @ n @ s .l @ n )
169
- who_ansatz = Cap (n .r , n )\
170
- >> Id (n .r ) @ Box ('copy' , n , n @ n )\
171
- >> Id (n .r @ n ) @ Cap (s , s .l ) @ Id (n )\
172
- >> Id (n .r ) @ Box ('update' , n @ s , n ) @ Id (s .l @ n )
173
- return who , who_ansatz
174
-
175
-
176
- @tikz_and_compare ('bialgebra.tikz' , draw = draw_equation , use_tikzstyles = True )
177
- def test_tikz_bialgebra_law ():
178
- from discopy .quantum .zx import Z , X , Id , SWAP
179
- source = X (2 , 1 ) >> Z (1 , 2 )
180
- target = Z (1 , 2 ) @ Z (1 , 2 ) >> Id (1 ) @ SWAP @ Id (1 ) >> X (2 , 1 ) @ X (2 , 1 )
181
- return source , target
182
-
183
-
184
- @tikz_and_compare ('bell-state.tikz' , aspect = 'equal' , use_tikzstyles = True )
185
- def test_tikz_bell_state ():
186
- from discopy .quantum import qubit , H , sqrt , Bra , Ket , Id , CX
187
- H .draw_as_spider , H .color , H .drawing_name = True , "yellow" , ""
188
- return sqrt (2 ) >> Ket (0 , 0 ) >> H @ qubit >> CX >> Bra (0 ) @ qubit
189
-
190
-
191
- @tikz_and_compare ('crack-eggs.tikz' )
192
- def test_tikz_eggs ():
193
- def merge (x ):
194
- box = Box ('merge' , x @ x , x , draw_as_spider = True )
195
- return box
196
-
197
- egg , white , yolk = Ty ('egg' ), Ty ('white' ), Ty ('yolk' )
198
- crack = Box ('crack' , egg , white @ yolk )
199
- return crack @ crack \
200
- >> Id (white ) @ Swap (yolk , white ) @ Id (yolk )\
201
- >> merge (white ) @ merge (yolk )
202
150
203
151
204
152
def test_Node_repr ():
@@ -237,19 +185,3 @@ def diagram(wire):
237
185
@draw_and_compare ('empty_diagram.png' )
238
186
def test_empty_diagram ():
239
187
return Id ()
240
-
241
-
242
- @draw_and_compare ('long-controlled.png' , draw_type_labels = False , tol = 5 )
243
- def test_draw_long_controlled ():
244
- from discopy .quantum import Controlled , CZ , CX
245
- return (
246
- Controlled (CX .l , distance = 3 )
247
- >> Controlled (Controlled (CZ .l , distance = 2 ), distance = - 1 ))
248
-
249
-
250
- @tikz_and_compare ('long-controlled.tikz' , draw_type_labels = False )
251
- def test_tikz_long_controlled ():
252
- from discopy .quantum import Controlled , CZ , CX
253
- return (
254
- Controlled (CX .l , distance = 3 )
255
- >> Controlled (Controlled (CZ .l , distance = 2 ), distance = - 1 ))
0 commit comments