# R program to illustrate# tcrossprod function# Initializing a matrix with# 2 rows and 2 columns
x <- matrix(1:4,2,2)# Getting the matrix representation
x
# Calling the tcrossprod() function
tcrossprod(x)
R
输出
[,1][,2][1,]13[2,]24[,1][,2][1,]1014[2,]1420
R
例2 :
# R program to illustrate# tcrossprod function# Initializing a matrix with# 3 rows and 3 columns
x <- matrix(1:9,3,3)# Getting the matrix representation
x
# Calling the tcrossprod() function
tcrossprod(x)