Skip to content

Commit 842806e

Browse files
committed
Update test
1 parent e3da760 commit 842806e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

q_test.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,11 +1065,16 @@ func Example_ecc() {
10651065
qsim.CNOT(q0, q1)
10661066
qsim.CNOT(q0, q2)
10671067

1068+
fmt.Println("q0(encoded):")
1069+
for _, s := range qsim.State(q0, []q.Qubit{q1, q2}) {
1070+
fmt.Println(s)
1071+
}
1072+
10681073
// error: first qubit is flipped
10691074
qsim.X(q0)
10701075

10711076
fmt.Println("q0(flipped):")
1072-
for _, s := range qsim.State(q0) {
1077+
for _, s := range qsim.State(q0, []q.Qubit{q1, q2}) {
10731078
fmt.Println(s)
10741079
}
10751080

@@ -1095,20 +1100,23 @@ func Example_ecc() {
10951100
qsim.CNOT(q0, q1)
10961101

10971102
fmt.Println("q0(corrected):")
1098-
for _, s := range qsim.State(q0) {
1103+
for _, s := range qsim.State(q0, []q.Qubit{q1, q2}, []q.Qubit{q3, q4}) {
10991104
fmt.Println(s)
11001105
}
11011106

11021107
// Output:
11031108
// q0:
11041109
// [0][ 0]( 0.4472 0.0000i): 0.2000
11051110
// [1][ 1]( 0.8944 0.0000i): 0.8000
1111+
// q0(encoded):
1112+
// [0 00][ 0 0]( 0.4472 0.0000i): 0.2000
1113+
// [1 11][ 1 3]( 0.8944 0.0000i): 0.8000
11061114
// q0(flipped):
1107-
// [0][ 0]( 0.8944 0.0000i): 0.8000
1108-
// [1][ 1]( 0.4472 0.0000i): 0.2000
1115+
// [0 11][ 0 3]( 0.8944 0.0000i): 0.8000
1116+
// [1 00][ 1 0]( 0.4472 0.0000i): 0.2000
11091117
// q0(corrected):
1110-
// [0][ 0]( 0.4472 0.0000i): 0.2000
1111-
// [1][ 1]( 0.8944 0.0000i): 0.8000
1118+
// [0 00 10][ 0 0 2]( 0.4472 0.0000i): 0.2000
1119+
// [1 00 10][ 1 0 2]( 0.8944 0.0000i): 0.8000
11121120
}
11131121

11141122
func Example_any() {

0 commit comments

Comments
 (0)