rStats.js v1.3.0
    Preparing search index...

    Function tcrossprod

    • Matrix cross-product x %*% t(y), or x %*% t(x) when y is omitted. Equivalent to R's tcrossprod().

      A vector argument is treated as a one-column matrix.

      Parameters

      • x: VectorOrMatrix

        A matrix (array of rows) or a vector.

      • Optionaly: VectorOrMatrix

        A matrix or a vector with the same number of columns as x. Defaults to x.

      Returns number[][]

      The product as an array of rows (nrow(x) x nrow(y)).

      tcrossprod([[1, 2], [3, 4]]); // [[5, 11], [11, 25]]