Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

diagv

Matrix product with a diagonal matrix


Description

Computes faster the product of a diagonal matrix times a full matrix.

Usage

diagv(v, M)

Arguments

v

A numeric vector specifying the elements on the diagonal of a matrix.

M

A numeric matrix compatible with the product D_v M.

Details

Computes N = D_v M where D_v is diagonal avoiding the diag operator.

Value

A matrix N.

See Also

Examples

v <- 1:1000
M <- matrix(runif(3000), 1000, 3)
dim(diagv(v, M))

ggm

Graphical Markov Models with Mixed Graphs

v2.5
GPL-2
Authors
Giovanni M. Marchetti, Mathias Drton, Kayvan Sadeghi
Initial release
2020-02-014

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.