MathGroup Archive 2005

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

Search the Archive

Re: Tilting at Windmills?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62130] Re: Tilting at Windmills?
  • From: lucb at ea.com
  • Date: Sat, 12 Nov 2005 03:31:43 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Matt, would this do what you want in a simpler way?

[[Expression:|||
test = Range[5]
|||]]

the list is first duplicated to have 4 lists using Table. Then the elements are re-arranged using Transpose and flatten.
Then we remove the first 3 and the last 3 and finally Partition it like you wnat.

[[Expression:|||
Partition[Drop[Drop[Flatten[Transpose[Table[test, {4}]]], 3], -3], 2]
|||]]

on this server it seems to go fast

[[Expression:|||
Timing[result = Partition[Drop[Drop[Flatten[Transpose[Table[ Range[200000], {4}]]], 3], -3], 2];]
|||]]

I hope this helps,

Luc

P.S: and Phil was faster than me at answering this...

Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=5930#p5930
Posted through http://www.mathematica-users.org [[postId=5930]]



  • Prev by Date: Re: Re: 'Good' or 'Proper' Mathematica coding habits question
  • Next by Date: Re: Integrate problem?
  • Previous by thread: Re: Tilting at Windmills?
  • Next by thread: Re: Tilting at Windmills?