You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
throw(ArgumentError(lazy"""The argument you have provided for good_state is not a logical state within the codespace. Expected a pure $n - qubit stabilizer state (i.e. $n independent stabilizer generators on $n qubits), but good_state has only $r independent stabilizer generators."""))
136
+
end
137
+
returnnew(gs, indices)
138
+
end
132
139
end
133
140
134
141
#TODO this one needs more testing
135
142
functionapplywstatus!(s::AbstractQCState, v::VerifyOp) #XXX It assumes the other qubits are measured or traced out
136
143
#TODO QuantumClifford should implement some submatrix comparison
137
-
r,n =size(v.good_state)
138
-
if(r!=n)
139
-
throw(ArgumentError("""The argument you have provided for good_state is not a logical state within the codespace. Expected a pure $n - qubit stabilizer state (i.e. $n independent stabilizer generators on $n qubits), but good_state has only $r independent stabilizer generators."""))
140
-
end
141
-
canonicalize_rref!(quantumstate(s),v.indices) # Document why rref is used
Copy file name to clipboardExpand all lines: test/test_noisycircuits.jl
+15-6Lines changed: 15 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -333,15 +333,11 @@
333
333
334
334
@testset"VerifyOp"begin
335
335
using QuantumClifford.ECC: Steane7, parity_checks, naive_encoding_circuit
336
+
using QuantumClifford: tensor
336
337
@testset"Stabilizer passed as good_state is not a logical state"begin
337
338
good_state =parity_checks(Steane7()) #passing in a code instead of a state within codespace
338
-
verify =VerifyOp(good_state, 1:7)
339
-
reg =Register(one(MixedDestabilizer,7),6) #dummy register to pass into applywstatus!
340
-
339
+
@test_throws ArgumentError VerifyOp(good_state, 1:7) #should throw an error since good_state isn't a logical state i.e. has only 6 stabilizer generators
341
340
342
-
@test_throws ArgumentError applywstatus!(reg, verify) #should throw an error since good_state isn't a logical state
343
-
344
-
345
341
end
346
342
347
343
@testset"Accepts pure good_state argument"begin
@@ -358,6 +354,19 @@
358
354
_, status =applywstatus!(reg, verify)
359
355
@test status == true_success_stat
360
356
end
357
+
358
+
@testset"handles sub-tableau with ancillas correctly "begin
359
+
s =S"+ XXX__
360
+
+ ZZ___
361
+
+ Z_Z__
362
+
- ZZ_Z_
363
+
- _ZZ_Z"
364
+
good_state =S"XXX ZZI IZZ"
365
+
verify =VerifyOp(good_state, 1:3)
366
+
_, status =applywstatus!(s, verify)
367
+
@test status == true_success_stat #this test would have given a false_success_stat in the previous implementation of applywstatus! for VerifyOp
0 commit comments