Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: How to speed up this calculation?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37212] Re: How to speed up this calculation?
  • From: "Steve Luttrell" <luttrell at _removemefirst_westmal.demon.co.uk>
  • Date: Thu, 17 Oct 2002 00:08:30 -0400 (EDT)
  • References: <aokc15$agm$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Oops! I didn't read the question properly. I hope I have got it right this
time.

Union[Map[Sort, pairs]] does what you want.

--
Steve Luttrell
West Malvern, UK

"Cheng Liu" <cliu at lanl.gov> wrote in message
news:aokc15$agm$1 at smc.vnet.net...
> Dear group,
>
>          I have the following question regarding a lengthy calculation
> using Mathematica:
>
> For given w points in x direction and h points in y direction, I can
> construct all the points using
>
>          h=10; w=8;
>          points=Flatten[Transpose[Outer[List,Range[w],Range[h]]],1]
>
> Next, I need to find all the possible pairs of point including points
> themselves, i.e., pair AA.  I can use
>
>          pairs=Outer[List,points,points,1]
>
> Then, I have to clear those pairs that repeat themselves, i.e., pair AB
and
> pair BA.  Also, when w and h are of the order of 1000s, the computation
> takes a very long time.  Is there a better way of doing the second part of
> the computation?  Thanks in advance.
>
> Sincerely
>
> Cheng
>
>
> ====================================================
> Cheng Liu, Ph.D.
> MST-8, Structure/Property Relations
> Materials Science and Technology Division
> Los Alamos National Laboratory
> Los Alamos, New Mexico 87545
>
> Phone: 505-665-6892 (office), 505-667-9950 (lab)
> Fax:   505-667-8021
> email: cliu at lanl.gov
> ====================================================
>
>




  • Prev by Date: Re: How to speed up this calculation?
  • Next by Date: Re: Boole Function
  • Previous by thread: Re: How to speed up this calculation?
  • Next by thread: RE: How to speed up this calculation?