MathGroup Archive 2000

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

Search the Archive

Re: Re: Rearranging a tensor

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22459] Re: [mg22515] Re: Rearranging a tensor
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Wed, 8 Mar 2000 02:21:56 -0500 (EST)
  • References: <89icvm$n7d@smc.vnet.net> <200003040727.CAA10368@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

All the good methods appear to be taken. Here is one that is amusing
instead. It relies on the fact that the TableForm of c "looks like" what
we ultimately want to produce.

In[34]:= d = ToString[TableForm[c]];

In[35]:= e = FixedPoint[StringReplace[#, "\n\n"->"\n"]&, d];

In[36]:= f = StringReplace[e, {"\n" -> "},{", " "->","}];

In[37]:= g = FixedPoint[StringReplace[#, ",,"->","]&, f];

In[38]:= h = ToExpression[StringJoin["{{", g, "}}"]]

Out[38]= {{1, 1, 1, 2, 2, 2}, {1, 1, 1, 2, 2, 2}, {1, 1, 1, 2, 2, 2}, 
 
>    {3, 3, 3, 4, 4, 4}, {3, 3, 3, 4, 4, 4}, {3, 3, 3, 4, 4, 4}}


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: rearranging equations
  • Next by Date: Re: assume an integer
  • Previous by thread: Re: Rearranging a tensor
  • Next by thread: Re: Rearranging a tensor