Spaces:
Configuration error
Configuration error
File size: 267 Bytes
0733d48 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import numpy as np
def ket(a, b):
return np.array([a, b])
def tensor(a, b):
return np.kron(a, b)
def hadamard():
return np.array([[1, 1], [1, -1]]) / np.sqrt(2)
def cnot():
return np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])
|