Imagine I have a data structure like so

[
 [1 0 8]
 [6 3 5]
 [3 0 5]
 [2 4 2]
]

I want to convert it into the following piddle

[
 [1 1 1 1 1 0 0 0 0 0 8 8 8 8 8]
 [1 1 1 1 1 0 0 0 0 0 8 8 8 8 8]
 [1 1 1 1 1 0 0 0 0 0 8 8 8 8 8]
 [1 1 1 1 1 0 0 0 0 0 8 8 8 8 8]
 [1 1 1 1 1 0 0 0 0 0 8 8 8 8 8]
 [6 6 6 6 6 3 3 3 3 3 5 5 5 5 5]
 [6 6 6 6 6 3 3 3 3 3 5 5 5 5 5]
 [6 6 6 6 6 3 3 3 3 3 5 5 5 5 5]
 [6 6 6 6 6 3 3 3 3 3 5 5 5 5 5]
 [6 6 6 6 6 3 3 3 3 3 5 5 5 5 5]
 [3 3 3 3 3 0 0 0 0 0 5 5 5 5 5]
 [3 3 3 3 3 0 0 0 0 0 5 5 5 5 5]
 [3 3 3 3 3 0 0 0 0 0 5 5 5 5 5]
 [3 3 3 3 3 0 0 0 0 0 5 5 5 5 5]
 [3 3 3 3 3 0 0 0 0 0 5 5 5 5 5]
 [2 2 2 2 2 4 4 4 4 4 2 2 2 2 2]
 [2 2 2 2 2 4 4 4 4 4 2 2 2 2 2]
 [2 2 2 2 2 4 4 4 4 4 2 2 2 2 2]
 [2 2 2 2 2 4 4 4 4 4 2 2 2 2 2]
 [2 2 2 2 2 4 4 4 4 4 2 2 2 2 2]
]

more generically, given a 2d array and 'n', I want each element in
each array to repeat 'n' times, both in rows and in columns. So, 'n'
in the example shown above is 5. How can I accomplish the above? For
now, I am doing a traditional loop within loop kinda thing. It works,
but it feels to be very un-pdl like.

-- 
Puneet Kishor

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to