% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/kernels.R
\name{shard_crossprod}
\alias{shard_crossprod}
\title{Parallel crossprod() using shard views + output buffers}
\usage{
shard_crossprod(
  X,
  Y,
  workers = NULL,
  block_x = "auto",
  block_y = "auto",
  backing = c("mmap", "shm"),
  materialize = c("auto", "never", "always"),
  materialize_max_bytes = 512 * 1024^2,
  diagnostics = TRUE
)
}
\arguments{
\item{X, Y}{Double matrices with the same number of rows.}

\item{workers}{Number of worker processes.}

\item{block_x, block_y}{Tile sizes over \code{ncol(X)} and \code{ncol(Y)}. Use \code{"auto"}
(default) to autotune on the current machine.}

\item{backing}{Backing for shared inputs and output buffer (\code{"mmap"} or \code{"shm"}).}

\item{materialize}{Whether to return the result as a standard R matrix:
\code{"never"} (return buffer handle), \code{"always"}, or \code{"auto"} (materialize if
estimated output size is below \code{materialize_max_bytes}).}

\item{materialize_max_bytes}{Threshold for \code{"auto"} materialization.}

\item{diagnostics}{Whether to collect shard_map diagnostics.}
}
\value{
A list with:
\itemize{
\item \code{buffer}: shard_buffer for the result (p x v)
\item \code{value}: materialized matrix if requested, otherwise NULL
\item \code{run}: the underlying shard_result from shard_map
\item \code{tile}: chosen tile sizes
}
}
\description{
Computes \code{crossprod(X, Y)} (i.e. \code{t(X) \%*\% Y}) using:
\itemize{
\item shared/mmap-backed inputs (one copy),
\item block views (no slice materialization),
\item BLAS-3 dgemm in each tile,
\item an explicit shared output buffer (no gather/bind spikes).
}
}
\details{
This is intended as an ergonomic entry point for the "wow" path: users
shouldn't have to manually call \code{share()}, \code{view_block()}, \code{buffer()},
\code{tiles2d()}, and \code{shard_map()} for common patterns.
}
\examples{
\donttest{
X <- matrix(rnorm(2000), 100, 20)
Y <- matrix(rnorm(2000), 100, 20)
res <- shard_crossprod(X, Y, block_x = 50, block_y = 10, workers = 2)
pool_stop()
res$value
}
}
