Skip to content
Prev 77178 / 398502 Next

matrix calculation?

Hi,
  I am wondering if anybody has a simpler solution to
calculate the
following:
a b
[1,] 1 4
[2,] 2 3
[3,] 3 2
[4,] 4 5
[,1] [,2] [,3] [,4]
a    1    2    3    4
b    4    3    2    5
[1] 17 13 13 41

I only want to calculate the product of the row of the
first matrix and
the corresponding column of the second matrix (instead
of other
columns). However, what I did was to multiply these
two and then extract
the diagonal components. Is there a simpler way to do
this in R? (ma and pa may not be the same matrix.)

Thanks!


	
		
______________________________________________________ 

Donate to the Hurricane Katrina relief effort.