       Re: Joining List of Lists

• To: mathgroup at smc.vnet.net
• Subject: [mg64391] Re: [mg64360] Joining List of Lists
• From: János <janos.lobb at yale.edu>
• Date: Wed, 15 Feb 2006 03:32:04 -0500 (EST)
• References: <200602140631.BAA05224@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```What is loc02[] and loc01[] ?  In general how do you define
locxx[[yy] ?  What range of values do you have in idx and data ?

János
On Feb 14, 2006, at 1:31 AM, Benedetto Bongiorno wrote:

> To All,
>
> In the folowing routine, I am trying to combine two tables of lists of
> lists, that are not of equal size, by
> the intersection index of a common column of both tables.
> The routine works but it runs for hours. The bottleneck is the join
> routine using For.
> How can I use Map or MapThread to speed up the process?
>
> Thank you.
>
> Ben Bongiorno
>
>
> "Create Index"
> "Create an Index of equivalents"
>
> Dimensions[idx]
> {175371,4}
>
> Dimensions[data]
> {314791,13}
>
> aa = idx[[All,loc02[]]];
> bb = data[[All,loc01[]]];
> indx = Intersection[aa,bb];
>
> Dimensions[indx]
> {16267}
>
> "Select the rows with matching field"
>
> ans01 = Select[idx, MemberQ[indx, #[[loc02[]]]]&];
> ans02 = Select[data, MemberQ[indx,#[[loc01[]]]]&];
>
> Dimensions[ans01]
> {16267,4}
>
> Dimensions[ans02]
> {314791,13}
>
> "Join "
>
> descripData={};
>
> n=Length[ans02]+1;
>
> For[i=1,i<n,i++,
>     nn=Length[ans01]+1;
>     For[j=1,j<nn,j++,
>       If[ans02[[i,loc01[]]]==ans01[[j,loc02[]]],
>         AppendTo[descripData,RowJoin[{ans02[[i]]},{ans01[[j]]}]]]]];
>
> Dimensions[descripData]
> {314791,1,17}
>
> descripData=Flatten[descripData,1];
> Dimensions[descripData]
> {314791,17}

```

• Prev by Date: Re: mathematica problems with nautilus
• Next by Date: Re: Polygons
• Previous by thread: Joining List of Lists
• Next by thread: Re: Joining List of Lists