comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Sorting (big) int array: Eliminate for loop
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Sorting (big) int array: Eliminate for loop [message #68062] Mon, 21 September 2009 07:46
Luds is currently offline  Luds
Messages: 7
Registered: September 2009
Junior Member
Hi,
I'm trying to eliminate a for loop form one of my codes, but can't
seem to get around it (though I must be able to, with the histogram
function, or something of the sort)... I was hoping to get some advice
from the (semi-)pros.

Here's what I want to do:
I have two arrays, A & B. Both are sparse and contain non-contiguous
integers. Both are 1-dimensional and have the same number of elements.
Array B contains all the same values as array A, but in a random
order. I want to find the elements with which I can subscript array B
so that it returns A (i.e. I want B(elements)=A).

Trivially I get what I want with

For K = 0L, Narray - 1L do elements[K] = where(B eq A[K])

The arrays contain 10's of millions of elements, so memory is an
issue.... but clearly a For loop is WAY to slow and I'm crazy for even
considering it as an option.

Does anyone have any advice on this?

Thanks 10's of millions!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Breakpoints Missing in IDL 7.1?
Next Topic: Change in reading DICOM files in 7.1

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:35:09 PDT 2025

Total time taken to generate the page: 0.00399 seconds