This is not correct. The discrete form of the Heaviside step function has
the value 1 for x == 0.

Yeah,  I was looking at it and wondering if I'd misremembered the definition.  Assuming you're implementing the discrete Heaviside function, H[0] = 1 as Sturla notes.