From 2dec8e54f79649aaf6bc4bc4be50956890bb32d9 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 27 Oct 2024 19:18:50 -0400 Subject: [PATCH] Fival encoding --- fival_encoding.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 fival_encoding.py diff --git a/fival_encoding.py b/fival_encoding.py new file mode 100644 index 0000000..5569002 --- /dev/null +++ b/fival_encoding.py @@ -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())