%d*%-methods {fields}R Documentation

Multiplying diagonal matrices in Package 'fields'


Recognizes a left vector as the elements of a diagonal matrix and does the right multiplication efficiently (this is not rocket science!). This method is used in the internal functions of Krig to make the code more readable. It avoids having a branch in the source code to handle the diagonal or nondiagonal cases. Note that this operator is not symmetric: a vector in the left argument is interpreted as a diagonal matrix and a vector in the right argument is kept as a column vector.


x = "matrix", y = "matrix"
computes x%*%y
x = "matrix", y = "numeric"
computes x%*% diag(y)
x = "numeric", y = "matrix"
computes diag( x)%*% y
x = "numeric", y = "numeric"
computes diag(x)%*% y, the diagonal matrix x multiplied by a vector.

[Package fields version 3.3.1 Index]