crossprod {base} | R Documentation

## Matrix Crossproduct

### Description

Given matrices `x` and `y` as arguments, `crossprod` returns their matrix cross-product. This is formally equivalent to, but faster than, the call `t(x) %*% y`.

### Usage

    crossprod(x, y = NULL)

### Arguments

`x, y` | matrices: `y = NULL` is taken to be the same matrix as `x`.

### See Also

`%*%` and outer product `%o%`.

### Examples

    (z <- crossprod(1:4))    # = sum(1 + 2^2 + 3^2 + 4^2)
    drop(z)                  # scalar

[Package Contents]