% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/similarity.R
\name{cosine_similarity}
\alias{cosine_similarity}
\title{Compute cosine similarity}
\usage{
cosine_similarity(x, y = NULL)
}
\arguments{
\item{x}{Numeric matrix whose rows are observations.}

\item{y}{Optional numeric matrix with the same columns as \code{x}. When omitted,
computes all pairwise similarities among rows of \code{x}.}
}
\value{
A numeric similarity matrix. Similarities involving zero vectors
are returned as \code{NA}.
}
\description{
Compute cosine similarity
}
\examples{
x <- rbind(a = c(1, 1, 0), b = c(1, 0, 0), c = c(0, 0, 1))
cosine_similarity(x)
}
