Problem
The goal is to take a set of $n$ linear partitions $\left\{p_{k}\right\}_{k=1}^{n}$ and create a hypercubic partition:
$$ \mathbf{P}=p_{1}\times p_{2}\times \cdots\times p_{n} $$
Each partition $p$ has a know length $m_{k}$, ${k=1,n}$.
In practice $n>10^{6}$.
Example:
Input
Let $n=4$ and the partition set consists of $p_1=(x_1,\dots,x_{m_1})$, $p_2=(y_1, \dots, y_{m_2})$, $P_3=(z_1,\dots,z_{m_3})$, and $p_4=(t_1,\dots,t_{m_4})$.
Output
The $\prod_{k=1}^{n}m_{k} \times n$ array containing the vertices of the hypercubic mesh: $$ \bf{A} = \left[ \begin{array}{cc} % x_1 & y_1 & z_1 & t_1 \\ % x_1 & y_1 & z_1 & t_2 \\ % x_1 & y_1 & z_1 & \vdots \\ % x_1 & y_1 & z_1 & t_{m_{4}} \\ % x_1 & y_1 & z_2 & t_1 \\ % x_1 & y_1 & z_2 & \vdots \\ % x_1 & y_1 & z_2 & t_{m_{4}} \\ % \vdots & \vdots & \vdots & \vdots \\ % x_{m_{1}} & y_{m_{2}} & z_{m_{3}} & t_{m_{4}} \\ % \end{array} \right] $$