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

Home » Public Forums » archive » 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
Reducing an array. [message #32280] Mon, 30 September 2002 15:23 Go to previous message
Joe[3] is currently offline  Joe[3]
Messages: 2
Registered: September 2002
Junior Member
Hi- I'm somewhat new to IDL and was wondering what the most effiecient way
is to 'OR' all the elements of an array together resulting in a scalar
value. I'm hoping IDL has a built-in way of doing this rather than using a
FOR-LOOP. Similar to how IDL has the TOTAL function which sums all the
elements of an array together. I've used other languagues which allow you
to 'reduce' arrays to a scalar using an arbitrary function (i.e. Python's
reduce function).

What I am doing is taking a lot of integer data which is either 0's or 1's
and compressing it into the bits of 64-bit unsigned integers. Here is a bit
of sample code:

data = [1,0,0,0,1,1,1,0,1,0,1,0,0, ... , 0, 1, 0, 1] ; bunch of data, assume
# of elements is multiple of 64
shifts = reverse(indgen(n_elements(data))) MOD 64
compressed_data = ishft(data,shifts)
; here is where I want to take the compressed_data array and make it into a
; bunch (n_elements(data)/64, to be exact) of unsigned 64-bit integers by
OR'ing
; every 64 elements of compressed data togeter

Thanks for any help,
Joe
[Message index]
 
Read Message
Read Message
Previous Topic: mpeg next question
Next Topic: gif again

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

Current Time: Thu Oct 09 19:57:48 PDT 2025

Total time taken to generate the page: 0.55610 seconds