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

Home » Public Forums » archive » Re: Complementary set.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Complementary set. [message #12935] Thu, 24 September 1998 00:00 Go to previous message
David Kastrup is currently offline  David Kastrup
Messages: 33
Registered: February 1998
Member
Imanol Echave <ccaeccai@sc.ehu.es> writes:

> Hi people:
>
> I want to eliminate certain elements from an array. I've the index of the
> elements to be erased, and I want to obtain the "complementary" index (with the
> elements to maintain) to do new_array=array[index]. I can do this with a FOR
> loop, but... �is it a better way?

Assume that the array size is in sz, and the indices in ind. Assume
that ind is non-empty. Then

invind = replicate(1,sz)
invind[ind] = 0
invind=where(invind)

does the trick in O(n) time.


--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f�r Neuroinformatik, Universit�tsstr. 150, 44780 Bochum, Germany
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Source Code: A min/max compound widget
Next Topic: Re: colorcoding for emacs

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

Current Time: Mon Oct 27 15:22:49 PDT 2025

Total time taken to generate the page: 0.03281 seconds