@Test
public void testFlattenMatrixByColumns() {

    double[][] matrixContents = {
            {1, 2, 3},
            {4, 5, 6},
    };
    double[] flattenedMatrixContents = {
            1, 4, 2, 5, 3, 6,
    };
    RealMatrix matrix = new BlockRealMatrix(matrixContents);
    RealVector vectorizedMatrix = AlgebraUtils.flattenMatrixByColumns(matrix);
    assertEquals(new ArrayRealVector(flattenedMatrixContents), vectorizedMatrix);
}