Kronecker(克罗内克)积 如果A是一个 m × n 的矩阵,而B是一个 p × q 的矩阵,克罗内克积A×B则是一个 mp × nq 的分块矩阵.
在R中使用kronecker来计算两个矩阵的克罗内克积. 例如
> x <- matrix(1:10,2,5)> x[,1] [,2] [,3] [,4] [,5][1,] 1 3 5 7 9[2,] 2 4 6 8 10> kronecker(x,x)[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14][1,] 1 3 5 7 9 3 9 15 21 275 15 25 35[2,] 2 4 6 8 10 6 12 18 24 30 10 20 30 40[3,] 2 6 10 14 18 4 12 20 28 366 18 30 42[4,] 4 8 12 16 20 8 16 24 32 40 12 24 36 48[,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25][1,] 457 21 35 49 639 27 45 63 81[2,] 50 14 28 42 56 70 18 36 54 72 90[3,] 548 24 40 56 72 10 30 50 70 90[4,] 60 16 32 48 64 80 20 40 60 80 100x与t(x)的kronecker积.> kronecker(x,t(x))[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10][1,] 1 2 3 6 5 10 7 14 9 18[2,] 3 4 9 12 15 20 21 28 27 36[3,] 5 6 15 18 25 30 35 42 45 54[4,] 7 8 21 24 35 40 49 56 63 72[5,] 9 10 27 30 45 50 63 70 81 90[6,] 2 4 4 8 6 12 8 16 10 20[7,] 6 8 12 16 18 24 24 32 30 40[8,] 10 12 20 24 30 36 40 48 50 60[9,] 14 16 28 32 42 48 56 64 70 80[10,] 18 20 36 40 54 60 72 80 90 100
[参考]1./wiki/%E5%85%8B%E7%BD%97%E5%86%85%E5%85%8B%E7%A7%AF 2.> help(kronecker)
kronecker package:base R DocumentationKronecker Products on ArraysDescription:Computes the generalised kronecker product of two arrays, ‘X’ and‘Y’.Usage:kronecker(X, Y, FUN = "*", make.dimnames = FALSE, ...)X %x% YArguments:X: A vector or array.Y: A vector or array.FUN: a function; it may be a quoted string.make.dimnames: Provide dimnames that are the product of the dimnames of‘X’ and ‘Y’....: optional arguments to be passed to ‘FUN’.Details:If ‘X’ and ‘Y’ do not have the same number of dimensions, thesmaller array is padded with dimensions of size one. The returnedarray comprises submatrices constructed by taking ‘X’ one term ata time and expanding that term as ‘FUN(x, Y, ...)’.‘%x%’ is an alias for ‘kronecker’ (where ‘FUN’ is hardwired to‘"*"’).Value:An array ‘A’ with dimensions ‘dim(X) * dim(Y)’.Author(s):Jonathan RougierReferences:Shayle R. Searle (1982) _Matrix Algebra Useful for Statistics._John Wiley and Sons.See Also:‘outer’, on which ‘kronecker’ is built and ‘%*%’ for usual matrixmultiplication.Examples:# simple scalar multiplication( M <- matrix(1:6, ncol = 2) )kronecker(4, M)# Block diagonal matrix:kronecker(diag(1, 3), M)# ask for dimnamesfred <- matrix(1:12, 3, 4, dimnames = list(LETTERS[1:3], LETTERS[4:7]))bill <- c("happy" = 100, "sad" = 1000)kronecker(fred, bill, make.dimnames = TRUE)bill <- outer(bill, c("cat" = 3, "dog" = 4))kronecker(fred, bill, make.dimnames = TRUE)
如果觉得《矩阵Kronecker(克罗内克)积》对你有帮助,请点赞、收藏,并留下你的观点哦!