Amazonian
Amazonian

Reputation: 462

what does %*%+ mean in matrix operations?

I read a piece of code somewhere where the following operation is performed between matrices x and y

x %*% + y

I know that %*% means matrix multiplication but what does %*% + mean? I tried it out in R and I get the same results for both.

Upvotes: 7

Views: 378

Answers (1)

mt1022
mt1022

Reputation: 17319

Based on precedence of operators, unary minus and plus (+, -) are evaluated before %any% (including %*%). Therefore, x %*% + y is the same as x %*% (+y) (which is equal to x %*% y).

Upvotes: 7

Related Questions