Skip to content

Instantly share code, notes, and snippets.

@kumanna
Created February 22, 2024 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kumanna/269e42b8e281b8c75b22ad3b316e4aff to your computer and use it in GitHub Desktop.
Save kumanna/269e42b8e281b8c75b22ad3b316e4aff to your computer and use it in GitHub Desktop.
import numpy as np
M = 4;
N = 4;
W = np.exp(1j * 2 * np.pi * np.outer(np.arange(M*N), np.arange(M*N)) / N / M) / np.sqrt(N * M);
Nt = 3;
Nr = 2;
## In the slide 39 of this:
## https://ecse.monash.edu/staff/eviterbo/OTFS-VTC18/Tutorial_ICC2019___OTFS_modulation.pdf
## Assume that s is MNN_t cross 1
## H = [. -> each entry becomes Nr x Nt matrix]
## -> H size is MNN_r x MNN_t
L = 1
H_1 = np.array([[1, 2, 3], [-3, 4, 2]]);
P = np.zeros((M*N, M*N), dtype='complex');
P[0,-1] = 1;
P[1:,:(M*N-1)] = np.eye(15);
D = np.diag(np.exp(1j * 2 * np.pi * 1 * np.arange(M*N)/(M*N)));
## We will construct P_mimo which is a MNNr x MNNr matrix
P_mimo = np.kron(P, np.eye(Nr));
H_1_mimo = np.kron(np.eye(M*N), H_1);
D_mimo = np.kron(D, np.eye(Nt));
## Sanity check:
print(np.max(np.max(np.abs(H_1_mimo - np.kron(W.conj().T, np.eye(Nr)) @ H_1_mimo @ np.kron(W, np.eye(Nt))))))
H_1_rect_eff = np.kron(W, np.eye(Nr)) @ P_mimo @ np.kron(W.conj().T, np.eye(Nr)) @ H_1_mimo @ np.kron(W, np.eye(Nt)) @ D_mimo @ np.kron(W.conj().T, np.eye(Nt))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment