R/crossprod.R

Defines functions tcrossprod crossprod

Documented in crossprod tcrossprod

#' Cross-product of large sparse matrices
#'
#' Compute the (transposed) cross-product of large sparse matrices using the same
#' infrastructure as [simil()] and [dist()].
#' @inheritParams simil
#' @param min_prod the minimum product to be recorded.
#' @return a [Matrix::Matrix] object
#' @export
crossprod <- function(x, y = NULL, min_prod = NULL, sparse = TRUE, digits = 14) {

    if (is.null(min_prod))
        min_prod <- -Inf
    proxy(x, y, margin = 2, method = "product", min_proxy = min_prod,
          sparse = sparse, digits = digits)
}

#' @rdname crossprod
#' @export
tcrossprod <- function(x, y = NULL, min_prod = NULL, sparse = TRUE, digits = 14) {

    if (is.null(min_prod))
        min_prod <- -Inf
    proxy(x, y, margin = 1, method = "product", min_proxy = min_prod,
          sparse = sparse, digits = digits)
}

Try the proxyC package in your browser

Any scripts or data that you put into this service are public.

proxyC documentation built on Oct. 30, 2026, 9:08 a.m.