plonski@aero.aero.org (Mike Plonski) (09/01/90)
What is the most efficient way to multiply every col in a 2D array (ncol x nrow) by a vector of length (ncol). Example: input array vector output array a11 a12 a13 b1 a11b1 a12b1 a13b1 a21 a22 a23 b2 a21b2 a22b2 a23b2 I currently do this by looping over the cols: FOR i=0,ncol-1 DO c(i,*) = a(i,*) * b Is there a more efficient way (w.r.t. computational speed) to do this? I know I could replicate the column vector into a matrix (b # identity row) and then do a ptwise matrix multiply, but my matrices can be very large (1M elements) and I occasionally run out of swap space. I don't know if that would run any faster anyway. ------------------------------------------------------------------------------- . . .__. The opinions expressed herein are soley |\./| !__! Michael Plonski those of the author and do not represent | | | "plonski@aero.org" those of The Aerospace Corporation. _______________________________________________________________________________