% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matching_distance.R
\name{compute_distance_matrix}
\alias{compute_distance_matrix}
\title{Compute pairwise distance matrix}
\usage{
compute_distance_matrix(
  left_mat,
  right_mat,
  distance = "euclidean",
  sigma = NULL
)
}
\arguments{
\item{left_mat}{Numeric matrix of left units (rows = units, cols = variables).}

\item{right_mat}{Numeric matrix of right units (rows = units, cols = variables).}

\item{distance}{Character string specifying distance metric, or a function.}

\item{sigma}{Optional covariance matrix for Mahalanobis distance. If \code{NULL}
(default), the pooled within-group covariance is estimated from \code{left_mat}
and \code{right_mat}: \eqn{\Sigma = ((n_L-1)\,S_L + (n_R-1)\,S_R) / (n_L+n_R-2)}.
This matches the convention used by \code{optmatch::match_on()} for
treated/control Mahalanobis matching. If either group has fewer than two
rows, falls back to the overall-sample covariance of the two groups
stacked together.}
}
\value{
Numeric matrix of pairwise distances (n_left x n_right).
}
\description{
Compute pairwise distance matrix
}
\keyword{internal}
