# How to get the value of Hadamard matrix given its column and row index?

Given a Hadamard matrix $H\in R^{n\times n}$, then how to get the value of $H_{ij}$ via a math function like $f(i,j)$?
I think that it looks as follows: Let $n=2^k$ and write the indices (from $0$ to $2^{k}-1$) in binary form: $i=i_0+2i_1+ ... 2^{k-1} i_{k-1}$ and $j=j_0+2j_1+ ... 2^{k-1} j_{k-1}$. Then $$f(i,j)=\left( -1 \right)^{i_0j_0 + ... + i_{k-1}j_{k-1}}$$