-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed repeating patters as well as cleaned up some whitespaces
- Loading branch information
1 parent
80d8f09
commit 07d17ad
Showing
46 changed files
with
157 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
test_bloch_orthogonality_001 ← { | ||
correct_answer ← 0 | ||
result ← (0 #.quapl.sng.bloch(○1)) +.× (0 #.quapl.sng.bloch(○0)) | ||
result ← #.quapl._r_ result | ||
test_bloch_orthogonality_001 ← { | ||
correct_answer ← 0 | ||
result ← (0 #.quapl.sng.bloch(○1)) +.× (0 #.quapl.sng.bloch(○0)) | ||
result ← #.quapl._r_ result | ||
|
||
'cross product of 2 opposing vectors should be 0'⊢correct_answer Assert result: | ||
'' | ||
} | ||
'cross product of 2 opposing vectors should be 0'⊢correct_answer Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ test_dagger_001 ← { | |
|
||
'Taking the dagger to an arbitrary matrix'⊢ correct_result Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
test_gates_G_unitary_001 ← { | ||
test_gates_G_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.G 2 | ||
|
||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.G 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_gates_P_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.P 2 | ||
test_gates_P_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.P 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_gates_Rx_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.Rx 2 | ||
test_gates_Rx_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.Rx 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_gates_Ry_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.Ry 2 | ||
test_gates_Ry_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.Ry 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
test_gates_Rz_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.Rz 2 | ||
test_gates_Rz_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.Rz 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
|
||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_gates_XX_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.XX 2 | ||
test_gates_XX_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.XX 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
test_gates_XY_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.XY 2 | ||
test_gates_XY_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.XY 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
test_gates_YY_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.YY 2 | ||
test_gates_YY_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.YY 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_gates_ZZ_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.ZZ 2 | ||
test_gates_ZZ_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.ZZ 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_gates_aSWAP_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.aSWAP 2 | ||
test_gates_aSWAP_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) #.quapl.gates.aSWAP 2 | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_gates_gCTR_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) (1 #.quapl.gates.gCTR (2 2 ⍴ 0 1 1 0)) | ||
test_gates_gCTR_unitary_001 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) (1 #.quapl.gates.gCTR (2 2 ⍴ 0 1 1 0)) | ||
|
||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_gates_gCTR_unitary_002 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) (5 #.quapl.gates.gCTR (2 2 ⍴ 0 1 1 0)) | ||
test_gates_gCTR_unitary_002 ← { | ||
correct_result ← 1 | ||
result ← (⌹≡⍉∘+) (5 #.quapl.gates.gCTR (2 2 ⍴ 0 1 1 0)) | ||
|
||
'If 0, it means the generated matrix is not unitary. Testing with multiple qubits'⊢ correct_result Assert result: | ||
'' | ||
} | ||
'If 0, it means the generated matrix is not unitary. Testing with multiple qubits'⊢ correct_result Assert result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,4 @@ test_kpr_basic_001 ← { | |
|
||
'Basic arbitrary values matrices to test kpr'⊢ correct_result Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
test_kpr_basic_003 ← { | ||
correct_result ← 4 1 ⍴ (1÷(2*0.5)) 0 (1÷(2*0.5)) 0 | ||
a ← 2 1 ⍴ (1÷(2*0.5)) (1÷(2*0.5)) | ||
sqrt ← 0.5*0.5 | ||
correct_result ← 4 1 ⍴ sqrt 0 sqrt 0 | ||
a ← 2 1 ⍴ sqrt sqrt | ||
b ← #.quapl.sng.q0 | ||
result ← a #.quapl.mlt.kpr b | ||
|
||
'Testing 2 separate |0> qubits'⊢ correct_result Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
test_kpr_basic_004 ← { | ||
sqrt ← 0.5*0.5 | ||
correct_result ← 4 1 ⍴ 0.5 0.5 0.5 0.5 | ||
a ← 2 1 ⍴ (1÷(2*0.5)) (1÷(2*0.5)) | ||
b ← 2 1 ⍴ (1÷(2*0.5)) (1÷(2*0.5)) | ||
result ← a #.quapl.mlt.kpr b | ||
a ← 2 1 ⍴ sqrt sqrt | ||
result ← a #.quapl.mlt.kpr a | ||
|
||
'Testing 2 separate |0> qubits'⊢ correct_result Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,4 @@ test_measure_001 ← { | |
|
||
'Testing an equal superposition with 3 qubits' ⊢ 0 Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,4 @@ test_measure_002 ← { | |
|
||
'Testing an imbalanced superposition with 3 qubits' ⊢ 0 Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
test_qx_orthogonality_001 ← { | ||
correct_answer ← 0 | ||
result ← ((⍉#.quapl.sng.qx 0 1)+.×(#.quapl.sng.qx 1 0)) | ||
test_qx_orthogonality_001 ← { | ||
correct_answer ← 0 | ||
result ← ((⍉#.quapl.sng.qx 0 1)+.×(#.quapl.sng.qx 1 0)) | ||
|
||
'If the basis is orthogonal, the result should be 0'⊢ ⊃correct_answer Assert ⊃result: | ||
'' | ||
} | ||
'If the basis is orthogonal, the result should be 0'⊢ ⊃correct_answer Assert ⊃result: | ||
'' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
test_qx_value_001 ← { | ||
correct_value ← 2 1 ⍴ ((1÷(2*0.5)) (1÷(2*0.5))) | ||
result ← #.quapl.sng.qx 5 5 | ||
test_qx_value_001 ← { | ||
sqrt ← 0.5*0.5 | ||
correct_value ← 2 1 ⍴ sqrt sqrt | ||
result ← #.quapl.sng.qx 5 5 | ||
|
||
'A vector state with equal numbers should give you the state 1/sqrt(2) 1/sqrt(2)'⊢ correct_value Assert result: | ||
'' | ||
} | ||
'A vector state with equal numbers should give you the state 1/sqrt(2) 1/sqrt(2)'⊢ correct_value Assert result: | ||
'' | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
test_stage_003 ← { | ||
correct_result ← 8 1 ⍴ (0.5 0 0.5 0 0 0 0 0)*0.5 | ||
sqrt ← 0.5*0.5 | ||
correct_result ← 8 1 ⍴ sqrt 0 sqrt 0 0 0 0 0 | ||
vs ← 8 1 ⍴ 1 0 0 0 0 0 0 0 | ||
result ← ((1)(⊂#.quapl.gates.H)) #.quapl.circuit.stage vs | ||
|
||
'The end vector state is not an equal superposition' ⊢ correct_result Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ test_stage_004 ← { | |
|
||
'starts with qubit 3 & 1 in 1 and apply CNOT from 3 to 1' ⊢ correct_result Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,4 @@ test_subregister_001 ← { | |
|
||
'Getting the correct subregister'⊢correct_result Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,4 @@ test_subregister_002 ← { | |
|
||
'Getting the correct subregister'⊢correct_result Assert result: | ||
'' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
test_thread_001 ← { | ||
correct_result ← 8 1 ⍴ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
a ← 2 1 ⍴ 1 0 | ||
b ← 2 1 ⍴ 1 0 | ||
c ← 2 1 ⍴ 1 0 | ||
result ← #.quapl.circuit.thread (a b c) | ||
result ← #.quapl.circuit.thread (a a a) | ||
|
||
'Threading different vector states should give you the combined one on top'⊢correct_result Assert result: | ||
'' | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.