Advertisement
Guest User

hadamardNANI.py

a guest
Nov 21st, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. from numpy import ones, any, eye
  2. from random import randint
  3.  
  4. def attemptHadamard(mat):
  5. mat[randint(0, 667)][randint(0, 667)] *= -1
  6. if checkHadamard(mat):
  7. print('Success!\n', mat)
  8. return True
  9. else:
  10. return False
  11.  
  12. def checkHadamard(mat):
  13. return not (mat.transpose() @ mat - 668 * eye(668)).any()
  14.  
  15. mat = ones([668, 668])
  16.  
  17. while not attemptHadamard(mat):
  18. pass
  19.  
  20. while True:
  21. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement