MathGroup Archive 2002

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

Search the Archive

Finding Maxima in tensors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34625] Finding Maxima in tensors
  • From: "Johannes Ludsteck" <johannes.ludsteck at wiwi.uni-regensburg.de>
  • Date: Thu, 30 May 2002 02:55:06 -0400 (EDT)
  • Organization: Universitaet Regensburg
  • Sender: owner-wri-mathgroup at wolfram.com

I have a rank 4 tensor p and a matrix z. My task is
to find the maxima of the vectors
p[a,b,All,d] + z[[a]]
for all a,b, and d (a,b, and d are simply indices)
and collect them in a rank 3 tensor.

Here is my implementation:

opt[p_,z_]:=Block[{a,b,d,dima,dimb,dimc,dimd},
	  {dima,dimb,dimc,dimd}=Dimensions[p];
      Table[
		Max[MapThread[Plus,
			{p[[a,b,All,d]],z[[a]]}]],
		{a,dima},{b,dimb},{d,dimd}]]

(Of course, the dimensions of p and z do match, i.e.
Dimensions[p][[{1,3}]]==Dimensions[z].)

The implemtation works but seems to be awkward.
Since I have to apply the maximum search for tensors of
even higher rank and opt[...] is evaluated some thousand times,
a more concise implementation would help.
I feel that the problem should have a shorter and simpler
Mathematica code representation, but I cannot find it.

Any suggestions?

Best regards,
	Johannes Ludsteck 



<><><><><><><><><><><><>
Johannes Ludsteck
Economics Department
University of Regensburg
Universitaetsstrasse 31
93053 Regensburg
Phone +49/0941/943-2741


  • Prev by Date: RE: two fonts in Plot
  • Next by Date: Re: j instead of I
  • Previous by thread: RE: Font problems with Mathematica 4.1 and Windows
  • Next by thread: Re: Finding Maxima in tensors