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

Home » Public Forums » archive » faster then where possible?
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: faster then where possible? [message #66460 is a reply to message #66276] Fri, 08 May 2009 04:58 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On May 7, 11:06 am, rog...@googlemail.com wrote:
> Hi,
> i'm searching for some alternative approaches to compute the following
> "much" faster:
>
> -> matrix1 has m columns and n rows, matrix2 has 2 columns and n rows
> -> the values in matrix2 are NOT in matrix1, but within the min-max-
> range of matrix1
>
> szm1=size(matrix1,/dimensions)
> szm2=size(matrix2,/dimensions)
> index={ind:ptr_new()}
> indices=replicate(index,szm2[1])
>
> for j=0ull,szm1[1] do begin
>    helpindex= where(matrix1[*,j] ge matrix2[0,j] and matrix1[*,j] le
> matrix2[1,j],c)
>    if c gt 0 then begin
>          indices[j]    = ptr_new(uintarr(c))
>          (*indices)[j]=helpindex
>     endif else continue
> endfor
>
> It seems to be a typical Nearest-Neighbor-Problem, but all alternative
> approaches I tried were always slower. Maybe someone here has a good
> idea?
>
> Thank you and best regards
>
> Christian

I don't suppose the data in the rows of matrix1 are sorted? If so, you
could use VALUE_LOCATE to figure out the bounds.

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL 7.1 True color postscript
Next Topic: Re: What is the advantage for IDL to run in background?

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

Current Time: Sat Oct 11 04:59:49 PDT 2025

Total time taken to generate the page: 1.36297 seconds