home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / sci / math / symbolic / 2038 < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.5 KB  |  36 lines

  1. Newsgroups: sci.math.symbolic
  2. Path: sparky!uunet!sun-barr!decwrl!access.usask.ca!kakwa.ucs.ualberta.ca!news
  3. From: manuel@space.ualberta.ca  (John Manuel)
  4. Subject: I need help with slow Mma code
  5. Message-ID: <1992Jul21.225045.203@kakwa.ucs.ualberta.ca>
  6. Sender: news@kakwa.ucs.ualberta.ca
  7. Nntp-Posting-Host: deimos.space.ualberta.ca
  8. Reply-To: manuel@space.ualberta.ca  (John Manuel)
  9. Organization: University Of Alberta, Edmonton Canada
  10. Date: Tue, 21 Jul 1992 22:50:45 GMT
  11. Lines: 23
  12.  
  13. I've got a particularly slow section of Mma code which I've GOT to speed up.  
  14. Here's the offending section:
  15.  
  16. xyz = Select[xyz, ((MemberQ[xSubSampleA, #[[1,1]]]
  17.                     &&
  18.                     MemberQ[ySubSampleA, #[[1,2]]])
  19.                    ||
  20.                    (MemberQ[xSubSampleB, #[[1,1]]]
  21.                     &&
  22.                     MemberQ[ySubSampleB, #[[1,2]]])) &];
  23.  
  24. xyz is a 20,000 X 2 X 2 array of real numbers and the SubSample arrays are  
  25. each <100 elements in length and are also composed of real numbers. The code  
  26. extracts a subset of values from xyz (usually about 1,000 elements of the  
  27. 20,000) for later processing, but does so quite slowly (~4 minutes in 2.0 on  
  28. a NeXT).
  29.  
  30. Does anyone know of a more efficient, but still concise, way to do this?
  31.  
  32. --
  33. John R. Manuel                 Department of Physics, University of Alberta
  34. manuel@space.ualberta.ca                 Edmonton, Alberta, CANADA, T6G 2J1
  35. Office: (403) 492-2526          (NeXTMail OK)           Fax: (403) 492-0714
  36.