https://wikimass.com/cpp/matrix-transpose