MathGroup Archive 2000

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

Search the Archive

Re: Malfunction of Position or where am I wrong?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24466] Re: Malfunction of Position or where am I wrong?
  • From: "Mark Reeve" <msreeve at earthlink.net>
  • Date: Wed, 19 Jul 2000 01:21:44 -0400 (EDT)
  • References: <8jtf2c$ijp@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Shoot, looks like a bug -- but one which you can get around.  The problem
appears to occur when you are mapping Position over 100+ elements.  That is,
in your code below, parsimtst is a {595,2,3} array.  This forces Map to not
compile its arguments because of the default SystemOption setting in
Mathematica:

In[87]:=
Developer`SystemOptions["MapCompileLength"]

Out[87]=
"MapCompileLength" -> 100

So when you Map something over this length it won't compile the function and
you get garbage:

In[101]:=
Last[Position[fullranktst, #] & /@ parsimtst]

Out[101]=
{{83902180, 35}}

And not only garbage but variable garbage -- try it a few times! However, if
you change MapCompileLength to 600:

In[88]:=
Developer`SetSystemOptions["MapCompileLength" -> 600]

Out[88]=
"MapCompileLength" -> 600

then everything works just fine:

In[90]:=
Last[Position[fullranktst, #] & /@ parsimtst]

Out[90]=
{{34, 35}}

which is correct.  Does anyone at Wolfram know why not compiling the Mapping
function gets the wrong answers here?

-Mark


Wen-Feng Hsiao <d8442803 at student.nsysu.edu.tw> wrote in message
news:8jtf2c$ijp at smc.vnet.net...
> Dear listers,
>
> I try to use Position to obtain the positions for a lower or upper
> triangular elements of a matrix. The codes below do not work correctly.
>
> << DiscreteMath`Combinatorica`
> tst = Table[Range[i + 70, i + 72] , {i, 35}];
> (fullranktst = Outer[List, tst, tst, 1, 1]) // Dimensions
> (parsimtst = KSubsets[tst, 2]) // Dimensions
> Position[fullranktst, #] & /@ parsimtst
>
> However, when I modify the last line to inspect the first three elements:
>
> Position[fullranktst, #] & /@ parsimtst[[{1, 2, 3}]]
>
> , it outputs the correct answer. Why? Where am I missing?
>
> Wen-Feng
>
>



  • Prev by Date: Re: Plotting Surfaces from data
  • Next by Date: Re: Plotting Surfaces from data
  • Previous by thread: Malfunction of Position or where am I wrong?
  • Next by thread: Re: Malfunction of Position or where am I wrong?