Good day

I have the following data matrix

```
1 1 0 0 1 
2 0 0 1 1 
1 1 0 0 1 
2 1 2 2 0

```

I would like to double the columns according to the following conditions

```
Condition 1   if $i == 0, replace with 1 1 (i.e. in 2 columns)
Condition 2   if  $i == 1, replace with 1 2
Condition 3    if  $i == 2, replace with 2 2

```

So the expected output for the example, would be

```
1 2  1 2  1 1 1 1 1 2 
2 2  1 1  1 1 1 2 1 2 
1 2  1 2  1 1 1 1 1 2 
2 2  1 2  2 2 2 2 1 1

```

I usually use R and Octave matrices but the current matrix in quiet large after a while R get out of memory and it takes long.