helpful toArray setArray for Matrix