Matrix cross-product t(x) %*% y, or t(x) %*% x when y is omitted. Equivalent to R's crossprod().
t(x) %*% y
t(x) %*% x
y
crossprod()
A vector argument is treated as a one-column matrix.
A matrix (array of rows) or a vector.
Optional
A matrix or a vector with the same number of rows as x. Defaults to x.
x
The product as an array of rows (ncol(x) x ncol(y)).
ncol(x)
ncol(y)
crossprod([[1, 2], [3, 4]]); // [[10, 14], [14, 20]]crossprod([[1, 2], [3, 4]], [1, 1]); // [[4], [6]] Copy
crossprod([[1, 2], [3, 4]]); // [[10, 14], [14, 20]]crossprod([[1, 2], [3, 4]], [1, 1]); // [[4], [6]]
Matrix cross-product
t(x) %*% y, ort(x) %*% xwhenyis omitted. Equivalent to R'scrossprod().A vector argument is treated as a one-column matrix.