Re: efficient matrix multiplication [message #3813] |
Sat, 18 March 1995 00:47  |
goyette
Messages: 2 Registered: March 1995
|
Junior Member |
|
|
In article <D5LsIF.417@rockyd.rockefeller.edu>,
orbach@rockvax.rockefeller.edu (Darren Orbach) wrote:
> Here's the question: In order to extract the inner products from this
> big array, I've been looping over the z-variable and doing a "total()"
> operation: for i = 0, 99 do output(i)=total(productarray(*,*,i)).
> This process seems highly inefficient, and since I'm doing this
> hundreds of times every time I need the series of inner products,
> I'm looking for a better method. Is there a function analogous to
> total(), which can be directed to act over a specified dimension without
> looping over every element of that dimension? If it's at all relevant,
> I'm using PV-WAVE Advantage 5.0.
I think that the funtion, total, can do this. A second parameter in total
indicates a dimension to sum over --- i.e., total(z,1) sums over the first
dimension. So you could replace the loop with two lines:
output = total(productarray,1)
output = total(output,2)
or if you prefer 1 line, output = total(total(productarray,1),2)
Good luck!
-John G.
goyette@nwu.edu
|
|
|
Re: efficient matrix multiplication [message #3814 is a reply to message #3813] |
Sat, 18 March 1995 16:41  |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <D5LsIF.417@rockyd.rockefeller.edu>, orbach@rockvax.rockefeller.edu (Darren Orbach) writes:
> Greetings all.
>
>
> Here's the question: In order to extract the inner products from this
> big array, I've been looping over the z-variable and doing a "total()"
> operation: for i = 0, 99 do output(i)=total(productarray(*,*,i)).
> This process seems highly inefficient, and since I'm doing this
> hundreds of times every time I need the series of inner products,
> I'm looking for a better method. Is there a function analogous to
> total(), which can be directed to act over a specified dimension without
> looping over every element of that dimension? If it's at all relevant,
> I'm using PV-WAVE Advantage 5.0.
IDL's TOTAL routine can now do exactly what you want, i.e. total over one of
the dimensions.
result = total(array, dimension)
I don't know if PV-WAVE has this feature.
____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
|
|
|