[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a vector of indices of the largest elements in a vector not exceeding the elements of some other vector
- Subject: Re: a vector of indices of the largest elements in a vector not exceeding the elements of some other vector
- From: Reimar Bauer <r.bauer(at)fz-juelich.de>
- Date: Fri, 13 Jul 2001 09:18:14 +0200
- Newsgroups: comp.lang.idl-pvwave
- Organization: Forschungszentrum Juelich GmbH
- References: <eb6d3332.0107121005.52873301@posting.google.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:25682
Derek Hullinger wrote:
>
> I have two vectors of different sizes (say, A and B):
>
> A contains floating point values that increase with index
> B contains floating point values
>
> I'd like to create a third vector, C (which would be the same size as
> B) such that:
>
> The nth element in C contains the index of the largest element in A
> that does not exceed the nth element in B.
>
> **
>
> For example:
>
> if
>
> A=[10,20,30,40]
> B=[12,37]
>
> then
>
> C=[0,2],
>
> because the 0th element in A is the largest value in A that does not
> exceed 12, and the 2nd element in A is the largest value in A that
> does not exceed 37.
>
> **
>
> I have found a way to do this if B is a single floating point value
> (not a vector of values):
>
> temp=max(A<B,C)
>
> but I haven't been able to find a way to do this with a vector B. Any
> ideas?
for some reasons value_locate is the best solution but sometimes not
another routine of our library may be useful.
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_work/rb_lib/find_indices_by_window.pro
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_html/dbase/download/find_indices_by_window.tar.gz
The difference to value_locate is that your are able to define a window.
We are using this routine by the time synchronisation for means.
regards
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
==================================================================
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.html
http://www.fz-juelich.de/zb/text/publikation/juel3786.html
==================================================================
read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html