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

Home » Public Forums » archive » Re: Reducing an array.
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: Reducing an array. [message #32271] Tue, 01 October 2002 07:25 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
MKatz843@onebox.com (M. Katz) writes:

> In order to perform an OR on 64 bits stored in an array, could you do
> something like this:
>
> a = [0,0,0,1,0,1,0,1,1]
> b = total(a) GT 0
>
> Then, if any of the elements of a are non-zero, b will be TRUE, or 1.
> At least I hope that's what you meant by OR.
>
> Likewise AND would be
>
> c = total(a) EQ n_elements(a)

The original poster was asking for a BITWISE "and" operation, not a
logical "and" operation. He was interested in all the bits of the
result, not just whether any bit was set.

Incidentally, "M"'s formulation is pretty much exactly what I use in
my routine CMAPPLY, which applies selected operations, like AND and
OR, to arrays.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: mpeg and powerpoint
Next Topic: Re: Looking for more ideas on code ...

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

Current Time: Sun Oct 12 06:13:13 PDT 2025

Total time taken to generate the page: 0.40210 seconds