nor.cpp running a ket represents a qubit, stored as a vector of two complex numbers logical zero = |0> = ket0 = vec[0] = (1,0) vec[1] = (0,0) logical one = |1> = ket1 = vec[0] = (0,0) vec[1] = (1,0) kets are combined with tensor=outer product paulix gate in basic one ket not gate ccnot operator three input, three output the first two kets are the control test nor, inputs a, b, |1>, outputs ketc for all 4 cases of a, b, |0> and |1> nor a=0, b=0 ccnot ketab0 = vec[0] = (0,0) vec[1] = (0,0) vec[2] = (0,0) vec[3] = (0,0) vec[4] = (0,0) vec[5] = (0,0) vec[6] = (0,0) vec[7] = (1,0) ketc=|1> nor a=0, b=1 ccnot ketab0 = vec[0] = (0,0) vec[1] = (0,0) vec[2] = (0,0) vec[3] = (0,0) vec[4] = (1,0) vec[5] = (0,0) vec[6] = (0,0) vec[7] = (0,0) ketc=|0> nor a=1, b=0 ccnot ketab0 = vec[0] = (0,0) vec[1] = (0,0) vec[2] = (1,0) vec[3] = (0,0) vec[4] = (0,0) vec[5] = (0,0) vec[6] = (0,0) vec[7] = (0,0) ketc=|0> nor a=1, b=1 ccnot ketab0 = vec[0] = (1,0) vec[1] = (0,0) vec[2] = (0,0) vec[3] = (0,0) vec[4] = (0,0) vec[5] = (0,0) vec[6] = (0,0) vec[7] = (0,0) ketc=|0> circuit diagram for quantum nor a --x--.---X-- a | b --x--.---X-- b | |0> -----X------ nor = not(a or b) truth table output inputs | output a b | nor = not(a or b) ---------|------ |0> |0> | |1> |0> |1> | |0> |1> |0> | |0> |1> |1> | |0> nor.cpp finished