ravel 2d arrays to 1d arrays