Precised Hardy inequalities on $\mathbb{R}^{d}$ and on the Heisenberg group ${\bf H}^d$