add conversion from matrix to array