Unrolling outer matrix to vector