Main Page | Report Page

 

 

  Computers Forum Index » Computer Languages (IDL-PVWAVE) » array operators - vector processing relevant

Author Message
Neil
Posted: Sun Oct 03, 2004 11:39 pm
 
Does anyone know if there is an array operator that can be used to
multiply to 1D vectors together that results in a final 1D vector that
holds all multiplicative combinations of the individual vector
components?

For example, array A of length m, and array B of length n would result
in a vector C of length m x N. Of course i can use array operators #
or ## to create a 2D array from the individual 1D arrays and then
unfold it back into a 1 D array. However, it would be convenient to
have a straight routine for this.

This would be useful for array address, where you want to replace
nested do loops with vector processing, where you would use such a
routine to calculate the indices to enable fast array addressing.

many thanks,
Neil
 
Craig Markwardt
Posted: Sun Oct 03, 2004 11:53 pm
 
nasalmon@onetel.net.uk (Neil) writes:
Quote:
Does anyone know if there is an array operator that can be used to
multiply to 1D vectors together that results in a final 1D vector that
holds all multiplicative combinations of the individual vector
components?

For example, array A of length m, and array B of length n would result
in a vector C of length m x N. Of course i can use array operators #
or ## to create a 2D array from the individual 1D arrays and then
unfold it back into a 1 D array. However, it would be convenient to
have a straight routine for this.

Hmm, but since you can do
C = REFORM(A # B, M*N)
that doesn't seem like too much of a burden. I never know which
operator, # or ##, is going to work though.

Craig

--
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------
 
 
Page 1 of 1    
All times are GMT
The time now is Wed May 16, 2012 10:21 pm