import numpy as np
from math import sqrt
#define 0, 1, +, - state
zero = np.array([[1],[0]])
one = np.array([[0],[1]])
plus = np.array([[1/sqrt(2)],[1/sqrt(2)]])
minus = np.array([[1/sqrt(2)],[ -1/sqrt(2)]])

#define H operation
H = np.array([[1/sqrt(2), 1/sqrt(2)], [1/sqrt(2), -1/sqrt(2)]])

np.matmul(H,zero) #=plus

np.matmul(H, one) #=minus

np.matmul(H, plus) #=zero

np.matmul(H, minus) #=one

