Skip to content

Instantly share code, notes, and snippets.

@kumanna
Created January 19, 2024 07:29
Show Gist options
  • Save kumanna/f47105ee5b69ad41ea4c3b248397592b to your computer and use it in GitHub Desktop.
Save kumanna/f47105ee5b69ad41ea4c3b248397592b to your computer and use it in GitHub Desktop.
import numpy as np
import itertools
VECSIZE = 6
M = np.eye(6)
for r in range(6):
print(f"FOR r = {r}:")
for pair in [i for i in itertools.product(range(1, VECSIZE + 1), range(1, VECSIZE + 1)) if i[0] != r and i[1] != r and i[0] < i[1]]:
print(pair)
e1 = np.zeros(VECSIZE, dtype='int')
e1[pair[0] - 1] = 1
e2 = np.zeros(VECSIZE, dtype='int')
e2[pair[1] - 1] = 1
v = e1 - e2
print(f"R{pair[0]}{pair[1]} = {v @ M @ v}")
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment