Re: Malfunction of Position or where am I wrong?

*To*: mathgroup at smc.vnet.net*Subject*: [mg24566] Re: Malfunction of Position or where am I wrong?*From*: "Mark Reeve" <msreeve at earthlink.net>*Date*: Tue, 25 Jul 2000 00:56:02 -0400 (EDT)*References*: <8jtf2c$ijp@smc.vnet.net> <8l3dsg$kdb@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Actually, let me correct myself and say that the problem appears to be when the function IS compiled, not when it isn't. By default Mathematica compiles for over 100 elements and that's where the problem seems to lie. -Mark Mark Reeve <msreeve at earthlink.net> wrote in message news:8l3dsg$kdb at smc.vnet.net... > 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 > > > > > >