-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96f5c5f
commit 2dec8e5
Showing
1 changed file
with
34 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# "Fival encoding" | ||
# https://arxiv.org/abs/hep-th/9409150 adopts a definition of a "maximally-entangled" state | ||
# that relies on two qudits with the same (but otherwise arbitrary) dimensional cardinality. | ||
# If padded with 0-amplitude entries so that the new dimensionality of the modified state | ||
# has a cardinality that factors as only first powers of unique prime numbers, then the | ||
# Schmidt rank becomes 1, and the state appears separable in the "Fival encoding." | ||
|
||
import sys | ||
import numpy as np | ||
|
||
from pyqrack import QrackSimulator | ||
|
||
|
||
def main(): | ||
qsim = QrackSimulator(2) | ||
qsim.h(0) | ||
qsim.h(1) | ||
qsim.mcz([0], 1) | ||
qsim.h(1) | ||
|
||
ket = qsim.out_ket() + [0, 0] | ||
print(ket) | ||
|
||
r = np.reshape(ket, (2, 3)) | ||
U, S, Vh = np.linalg.svd(r) | ||
ket1 = U[:, [0]] | ||
ket2 = Vh[:, [0]] | ||
|
||
print("2 by 3:") | ||
print(np.kron(ket1, ket2)) | ||
print(S) | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |