Groups | Search | Server Info | Login | Register
Groups > comp.soft-sys.math.mathematica > #16813
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Speed of Join and Append. Was Re: Simple list question |
| Date | 2014-04-16 07:40 +0000 |
| Message-ID | <lilc4r$qlb$1@smc.vnet.net> (permalink) |
| References | <lii7fe$ije$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
On 4/14/2014 8:02 PM, Bill Rowe wrote:
> On 4/14/14 at 5:28 AM, stevebg@roadrunner.com (Ste[hen Gray) wrote:
>
>> pcin = 2;
>> pcex = 3; (*pcin and pcex can have various small values *)
>>
>> coin = Table[{10 RandomReal[], 10 RandomReal[]}, {pcin}]
>> coex = Table[{3 RandomReal[], 3 RandomReal[]}, {pcex}]
>> cobo = Append[coin, coex]
>> pcin = 2;
>> pcex = 3; (*pcin and pcex can have various small values *)
>>
>> coin = Table[{10 RandomReal[], 10 RandomReal[]}, {pcin}]
>> coex = Table[{3 RandomReal[], 3 RandomReal[]}, {pcex}]
>> cobo = Append[coin, coex]
>
> <snip>
>
>> What I want is a series of x,y coordinates with no extra nesting:
>
> Instead of Append, use Join, i.e.
>
> cobo = Join[coin, coex]
>
> In fact, Append is something to generally avoid using
> particularly for large arrays due to the computing resources
> used. It will require more memory and is slower. Won't matter
> for small arrays like this. But for large arrays, Append is very
> much a problem and better replaced with other commands such as Join.
>
>
You are, I think, confusing the conventional implementation of lists,
append and cons from Lisp, and the peculiar implementation in
Mathematica of Append and Join.
I expect that in Mathematica they are equally wasteful, because
lists are represented by arrays and must be copied whether to
join or append.
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar
Re: Simple list question Bill Rowe <readnews@sbcglobal.net> - 2014-04-15 03:02 +0000 Speed of Join and Append. Was Re: Simple list question Richard Fateman <fateman@cs.berkeley.edu> - 2014-04-16 07:40 +0000
csiph-web