row.kronecker function

Row-Wise Kronecker Product

Row-Wise Kronecker Product

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

row.kronecker(X, Y)

Arguments

  • X: matrix of dimension n×pn \times p
  • Y: matrix of dimension n×qn \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)

Returns

Matrix of dimension n×pqn \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)
  • Maintainer: Nathaniel E. Helwig
  • License: GPL (>= 2)
  • Last published: 2025-03-28

Useful links