Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

crossprod

Matrix Crossproduct


Description

Compute the matrix cross-product of a sparse and a dense or sparse matrix.

Usage

tcrossprod_simple_triplet_matrix(x, y = NULL)
##
crossprod_simple_triplet_matrix(x, y = NULL)
matprod_simple_triplet_matrix(x, y)

Arguments

x, y

a matrix in simple_triplet_matrix-form and/or a dense matrix, where one must be of the form indicated by the suffix.

Details

Function tcrossprod_simple_triplet_matrix implements fast computation of x %*% t(x) and x %*% t(y) (tcrossprod). The remaining functions are (optimized) wrappers.

Value

A double matrix, with appropriate dimnames taken from x and y.

Note

The computation is delegated to tcrossprod if y (or x if y == NULL) contains any of the special values NA, NaN, or Inf.

Author(s)

Christian Buchta

See Also

crossprod for dense-on-dense computations.

Examples

## 
x <- matrix(c(1, 0, 0, 2, 1, 0), nrow = 3)
x
s <- as.simple_triplet_matrix(x)
tcrossprod_simple_triplet_matrix(s, x)
##
tcrossprod_simple_triplet_matrix(s)
##
tcrossprod_simple_triplet_matrix(s[1L, ], s[2:3, ])

slam

Sparse Lightweight Arrays and Matrices

v0.1-48
GPL-2
Authors
Kurt Hornik [aut, cre] (<https://orcid.org/0000-0003-4198-9911>), David Meyer [aut], Christian Buchta [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.