summaryrefslogtreecommitdiff
path: root/python_src/xpxp_to_xxpp.py
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2024-11-19 13:40:38 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2024-11-19 13:40:38 -0500
commit984d56b4d94bf298a197f1567834451acf49cab9 (patch)
treefc545b26d7997106a77f0353aa61062f5b77e098 /python_src/xpxp_to_xxpp.py
parent268050742bfd920490d90152686178ffba1f6a85 (diff)
downloadmatlab_strawberryfields-0.1.tar.gz
matlab_strawberryfields-0.1.zip
dir renamev0.1
Diffstat (limited to 'python_src/xpxp_to_xxpp.py')
-rw-r--r--python_src/xpxp_to_xxpp.py26
1 files changed, 0 insertions, 26 deletions
diff --git a/python_src/xpxp_to_xxpp.py b/python_src/xpxp_to_xxpp.py
deleted file mode 100644
index 01d0bf2..0000000
--- a/python_src/xpxp_to_xxpp.py
+++ /dev/null
@@ -1,26 +0,0 @@
-
-def xpxp_to_xxpp(S):
- """Permutes the entries of the input from xpxp ordering to xxpp ordering.
-
- Args:
- S (array): input even dimensional square matrix or vector
-
- Returns:
- (array): permuted matrix or vector
- """
- shape = S.shape
- n = shape[0]
-
- if n % 2 != 0:
- raise ValueError("The input array is not even-dimensional")
-
- n = n // 2
- ind = np.arange(2 * n).reshape(-1, 2).T.flatten()
-
- if len(shape) == 2:
- if shape[0] != shape[1]:
- raise ValueError("The input matrix is not square")
- return S[:, ind][ind]
-
- return S[ind]
-