row.kronecker: Row-Wise Kronecker Product

View source: R/row.kronecker.R

row.kroneckerR Documentation

Row-Wise Kronecker Product

Description

Calculates the row-wise Kronecker product between two matrices with the same number of rows.

Usage

row.kronecker(X, Y)

Arguments

X

matrix of dimension n \times p

Y

matrix of dimension n \times q

Details

Given X of dimension c(n, p) and Y of dimension c(n, q), this function returns

cbind(x[,1] * Y, x[,2] * Y, ..., x[,p] * Y)

which is a matrix of dimension c(n, p*q)

Value

Matrix of dimension n \times pq where each row contains the Kronecker product between the corresponding rows of X and Y.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

See Also

Used by the rk.model.matrix to construct basis functions for interaction terms

See kronecker for the regular kronecker product

Examples

X <- matrix(c(1, 1, 2, 2), nrow = 2, ncol = 2)
Y <- matrix(1:6, nrow = 2, ncol = 3)
row.kronecker(X, Y)

grpnet documentation built on Oct. 12, 2024, 1:07 a.m.

Related to row.kronecker in grpnet...