Calculate expanded X-tilde matrix for alpha in C++