Made HamBuilder a template over the tensor type.