File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -396,7 +396,7 @@ def sub_state_vector(
396
396
keep_indices : List [int ],
397
397
* ,
398
398
default : np .ndarray = RaiseValueErrorIfNotProvided ,
399
- atol : Union [int , float ] = 1e-8 ,
399
+ atol : Union [int , float ] = 1e-6 ,
400
400
) -> np .ndarray :
401
401
r"""Attempts to factor a state vector into two parts and return one of them.
402
402
Original file line number Diff line number Diff line change @@ -609,3 +609,22 @@ def test_to_special():
609
609
su = cirq .to_special (u )
610
610
assert not cirq .is_special_unitary (u )
611
611
assert cirq .is_special_unitary (su )
612
+
613
+
614
+ def test_default_tolerance ():
615
+ a , b = cirq .LineQubit .range (2 )
616
+ final_state_vector = (
617
+ cirq .Simulator ()
618
+ .simulate (
619
+ cirq .Circuit (
620
+ cirq .H (a ),
621
+ cirq .H (b ),
622
+ cirq .CZ (a , b ),
623
+ cirq .measure (a ),
624
+ )
625
+ )
626
+ .final_state_vector .reshape ((2 , 2 ))
627
+ )
628
+ # Here, we do NOT specify the default tolerance. It is merely to check that the default value
629
+ # is reasonable.
630
+ cirq .sub_state_vector (final_state_vector , [0 ])
You can’t perform that action at this time.
0 commit comments