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

Home » Public Forums » archive » How to test for a vector/matrix of constants?
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
How to test for a vector/matrix of constants? [message #51776] Wed, 06 December 2006 10:21 Go to next message
Mirko is currently offline  Mirko
Messages: 20
Registered: April 1999
Junior Member
How can I quickly check if a vector/matrix is full of constants (all
elements equal)?
For example if a vector contained:
[2.38,2.38,2.38,...,2.38]
I want it flagged as a "constant" vector.

I can think of finding differences between successive elements, and
check for non-zero elements.

Any faster options?

Thanks,

Mirko
Re: How to test for a vector/matrix of constants? [message #51835 is a reply to message #51776] Wed, 06 December 2006 20:58 Go to previous message
mmeron is currently offline  mmeron
Messages: 44
Registered: October 2003
Member
In article <1165429305.471782.64190@n67g2000cwd.googlegroups.com>, "Mirko" <mvukovic@nycap.rr.com> writes:
> How can I quickly check if a vector/matrix is full of constants (all
> elements equal)?
> For example if a vector contained:
> [2.38,2.38,2.38,...,2.38]
> I want it flagged as a "constant" vector.
>
> I can think of finding differences between successive elements, and
> check for non-zero elements.
>
> Any faster options?
>
Differences are quite fast enough since you can do it as vector
operation. Only, I wouldn't check for non-zero but for larger than
specified, user defined, "delta". So, you would do something along
the lines of

... if max(abs(vec[1:*] - vec)) gt delta then...

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Logarithmic Binning with Histogram function?
Next Topic: false color display

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

Current Time: Sat Oct 11 09:17:32 PDT 2025

Total time taken to generate the page: 0.00937 seconds