diag_matrix_multiply | R Documentation |
Performs the matrix multiplication ADB, where D is diagonal (and A and B are not necessarily diagonal).
diag_matrix_multiply(A, D, B)
A |
a matrix |
D |
a diagonal matrix, represented as a numeric vector |
B |
a matrix |
the matrix product ADB.
## Not run:
B <- matrix(sample(0:1, size = 12, TRUE), ncol = 3)
D <- c(2, 3, 4, 5)
A <- t(B)
all.equal(A %*% diag(D) %*% B, diag_matrix_multiply(A, D, B))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.