Given a vector w=(w[1],...,w[p]) and an n by n by p array A,
is there a way, which avoids looping, to compute the sum
of products (= an n by n matrix)
w[1]*A[,,1] + ... + w[p]*A[,,p] ?
It would be sufficient to have a way to get a new array B containing
the products w[j]*A[,,j], since then apply(B,c(1,2),sum) would give
me what I want.
Thanks in advance.
--
--------------------------------------------------------------------
| |
| Professor Douglas P. Wiens | Office: (403) 492-4406 |
| Statistics Centre | Dept.: (403) 492-3396 |
| Department of Mathematical Sciences | FAX: (403) 492-6826 |
| University of Alberta | e-mail: |
| Edmonton, Alberta | doug.wiens@ualberta.ca |
| CANADA T6G 2G1 | wiens@stat.ualberta.ca |
| |
| http://www.stat.ualberta.ca |
--------------------------------------------------------------------
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|