add_torows: Fast addition of vector to each row of matrix

View source: R/RcppExports.R

add_torowsR Documentation

Fast addition of vector to each row of matrix

Description

Fast addition of vector to each row of a matrix. This corresponds to t(t(x) + v)

Usage

add_torows(x, v)

Arguments

x

A matrix with dimensions n*k.

v

A vector of length k.

Value

A matrix of dimension n*k where v is added to each row of x

Author(s)

Claus Ekstrom <claus@rprimer.dk>

Examples


A <- matrix(1:12, ncol=3)
B <- c(1, 2, 3)

add_torows(A, B)


MESS documentation built on Aug. 21, 2023, 1:05 a.m.

Related to add_torows in MESS...