Learn R Programming

grpnet (version 0.5)

row.kronecker: 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)

Value

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

Arguments

X

matrix of dimension \(n \times p\)

Y

matrix of dimension \(n \times q\)

Author

Nathaniel E. Helwig <helwig@umn.edu>

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)

See Also

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

See kronecker for the regular kronecker product

Examples

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

Run the code above in your browser using DataLab