For some fixed $\bar{L}\in \mathbb N$, consider a set grid of points $$(i_1\;2^{−L_1},\ i_2\;2^{−L_2})$$ with $L_1,L_2 \in \mathcal L\equiv\{1,\dots,\bar{L}\}$, $i_1 \in \mathcal I(L_1)$, and $i_2 \in \mathcal I(L_2)$ where $$\mathcal I(L)\equiv\{i\in\mathbb N,\ 1\le i\le2^L-1,\ i \text{ odd}\}.$$
I want to find an explicit bijection between the set of indices of these grid points, i.e. $\mathcal L \times \mathcal L \times \mathcal I(L_1) \times\mathcal I(L_2)$, and $\mathbb N$.
This is a problem I ran into while trying to code an efficient way to interpolate hierarchical linear basis functions. So far I have, unfortunately, not made any advancements worth mentioning.
$\def\peq{\mathrel{\phantom{=}}{}}$Here it is assumed that $\overline{L}$ is a predetermined number. There are two bijections:\begin{align*} f_1(i_1 2^{-L_1}, i_2 2^{-L_2}) &= (2^{\overline{L}} - 1)(2^{L_1 - 1} - 1) + 2^{L_1 - 1}(2^{L_2 - 1} - 1) + 2^{L_2 - 1}\frac{i_1 - 1}{2} + \frac{i_2 - 1}{2},\\ f_2(i_1 2^{-L_1}, i_2 2^{-L_2}) &= (2^{\overline{L}} - 1)(2^{L_1 - 1} - 1) + (2^{\overline{L}} - 1) \frac{i_1 - 1}{2} + (2^{L_2 - 1} - 1) + \frac{i_2 - 1}{2}. \end{align*} The basic idea for constructing $f_1$ and $f_2$ is to sort grid points by $L_1, L_2, i_1, i_2$ or by $L_1, i_1, L_2, i_2$. The verification uses the same idea.
For $n$ dimensions, the grid points are$$ \left\{ \left( \frac{i_1}{2^{L_1}}, \cdots, \frac{i_n}{2^{L_n}} \right) \,\middle|\, 1 \leqslant L_k \leqslant L,\ 1 \leqslant i_k \leqslant 2^{L_k} - 1,\ i_k \text{ odd} \right\}, $$ and\begin{align*} f_1\left( \frac{i_1}{2^{L_1}}, \cdots, \frac{i_n}{2^{L_n}} \right) &= \sum_{k = 1}^n (2^{L_k - 1} - 1) (2^L - 1)^{n - k} \prod_{j = 1}^{k - 1} 2^{L_j - 1} + \sum_{k = 1}^n \frac{i_k - 1}{2} \prod_{j = k + 1}^n 2^{L_j - 1}\\ f_2\left( \frac{i_1}{2^{L_1}}, \cdots, \frac{i_n}{2^{L_n}} \right) &= \sum_{k = 1}^n \left(2^{L_k - 1} - 1 + \frac{i_k - 1}{2} \right) (2^L - 1)^{n - k}. \end{align*}