MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Padding arrays with reversed elements

Hi all, a recently posted question on "creating a toroidal data structure"
and the the responses have inspired me to post the following similar but
harder problem. I am interested in "reflected" padding of multidimensional
arrays. Here is an example in 1D:

{a,b,c,d} -> {a,b,c,d,d,c,b,a,a,b,c,d,d,c, etc}

also the padding should be possible on the left or right or both and of
course, the length is an argument. I have a complicated looking solution
using PadRight, Fold, Partition and would love to see some ideas leading to
a possibly simpler solution.

Thanks, Mariusz

  • Prev by Date: Re: List operation
  • Next by Date: Re: How do I Plot a B-Spline Surface and model a vase
  • Previous by thread: Re: Reservoir models in mathematica
  • Next by thread: RE: Padding arrays with reversed elements