[R] Meaning of Inner Product (%*%) Between Slot and Vector

Gundala Viswanath gundalav at gmail.com
Mon Jan 26 13:04:13 CET 2009


Dear all,

I have the following object and vector:

> print(alpha)
Slot "ra":
 [1] 0.994704478 0.002647761 0.000882587 0.000882587 0.000882587 0.989459074
 [7] 0.005270463 0.002635231 0.002635231 0.994717023 0.005282977 1.000000000
[13] 1.000000000

Slot "ja":
 [1] 1 5 2 3 4 2 1 3 4 3 3 4 5

Slot "ia":
[1]  1  6 10 12 13 14

Slot "dimension":
[1] 5 5

> print(p)
[1] 0.4 0.2 0.2 0.2 0.2

Now what I don't understand is, after performing inner product
it gives this:

> print(alpha %*% p)

          [,1]
[1,] 0.3989409
[2,] 0.2010541
[3,] 0.2000000
[4,] 0.2000000
[5,] 0.2000000


My questions are:
1. How does %*% work in the above example?
2. Is there a more understandable (naive) way to implement such
   product in this context?

- Gundala Viswanath
Jakarta - Indonesia




More information about the R-help mailing list