% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/S3_algebra.R
\name{tcrossprod}
\alias{tcrossprod}
\alias{tcrossprod.HDF5Matrix}
\title{Transposed cross product of HDF5Matrix objects}
\usage{
tcrossprod(x, y = NULL, ...)

\method{tcrossprod}{HDF5Matrix}(x, y = NULL, outgroup = NULL, outdataset = NULL, ...)
}
\arguments{
\item{x}{An \code{HDF5Matrix} object.}

\item{y}{An \code{HDF5Matrix} object, or \code{NULL} (default) to
compute \code{x \%*\% t(x)}.}

\item{...}{Ignored.}

\item{outgroup}{Character or \code{NULL}. HDF5 group where the result is
stored. Default \code{"OUTPUT"}.}

\item{outdataset}{Character or \code{NULL}. Dataset name for the result.
Default \code{"tCrossProd_x"} (single matrix) or
\code{"tCrossProd_x_x_y"} (two matrices).}
}
\value{
Result of the cross product.

A new \code{HDF5Matrix} pointing to the result dataset.
}
\description{
S3 generic for \code{tcrossprod()}. Dispatches to
\code{\link{tcrossprod.HDF5Matrix}} for \code{HDF5Matrix} objects,
and to \code{base::tcrossprod()} for all others.
}
\details{
Computes \eqn{x \times t(y)} (or \eqn{x \times t(x)} when \code{y = NULL}).
Uses the dedicated BigDataStatMeth block-wise transposed cross-product
algorithm, which is more efficient than explicitly computing \code{x \%*\% t(y)}.

\strong{Performance settings:}

This method uses global options set via \code{\link{hdf5matrix_options}}.

\strong{Symmetric optimization:}

When \code{y = NULL} or \code{y} refers to the same dataset as \code{x},
the symmetric optimisation is applied automatically, providing significant speedup.
}
\examples{
\donttest{
fn <- tempfile(fileext = ".h5")
X <- hdf5_create_matrix(fn, "INPUT/X", data = matrix(rnorm(60), 6, 10))
Y <- hdf5_create_matrix(fn, "INPUT/Y", data = matrix(rnorm(60), 6, 10))

# t(X) \%*\% X  → stored in OUTPUT/CrossProd_X
C1 <- tcrossprod(X)
dim(C1)

# t(X) \%*\% Y  → stored in OUTPUT/CrossProd_X_x_Y
C2 <- tcrossprod(X, Y)

# Custom output location
C3 <- tcrossprod(X, outgroup = "RESULTS", outdataset = "my_tcrossprod")

hdf5_close_all()
unlink(fn)
}

}
\seealso{
\code{\link{hdf5matrix_options}} for global performance settings
}
