multd: Multiply a matrix by a diagonal matrix

View source: R/matrix_mult.R

multdR Documentation

Multiply a matrix by a diagonal matrix

Description

Fast multiplication of a matrix by a diagonal matrix, taking advantage of the properties of diagonal matrices.

Usage

multd(matrix1, matrix2)

Arguments

matrix1

An ordinary matrix.

matrix2

A diagonal matrix.

Details

multd() will turn matrix2 into a vector and multiply it horizontally by every row in matrix1. This saves precious computing time.\ The number of columns of matrix1 must be equal to the rows and columns of diagonal matrix2.

Value

The product of matrix1 and matrix2.

See Also

dmult().

Examples

wio <- make_wio("wiodtest")
multd(wio$B, wio$E)

exvatools documentation built on Sept. 17, 2024, 1:07 a.m.