% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/check_one_hot_matrix.R
\name{check_one_hot_matrix}
\alias{check_one_hot_matrix}
\alias{assert_one_hot_matrix}
\alias{test_one_hot_matrix}
\title{Check one-hot matrix}
\usage{
check_one_hot_matrix(
  x,
  nrows = NULL,
  ncols = NULL,
  tolerance = sqrt(.Machine$double.eps)
)

assert_one_hot_matrix(
  x,
  nrows = NULL,
  ncols = NULL,
  tolerance = sqrt(.Machine$double.eps),
  .var.name = checkmate::vname(x),
  add = NULL
)

test_one_hot_matrix(
  x,
  nrows = NULL,
  ncols = NULL,
  tolerance = sqrt(.Machine$double.eps)
)
}
\arguments{
\item{x}{[\code{any}]\cr
Object to check.}

\item{nrows}{[\code{integer(1)}]\cr
Exact number of rows.}

\item{ncols}{[\code{integer(1)}]\cr
Exact number of columns.}

\item{tolerance}{[\code{numeric(1)}]\cr
A non-negative tolerance value.}

\item{.var.name}{[\code{character(1)}]\cr
Name of the checked object to print in assertions. Defaults to
the heuristic implemented in \code{\link[checkmate]{vname}}.}

\item{add}{[\code{AssertCollection}]\cr
Collection to store assertion messages. See \code{\link[checkmate]{AssertCollection}}.}
}
\value{
Same as documented in \code{\link[checkmate]{check_matrix}}.
}
\description{
These functions check whether the input is a one-hot matrix, i.e., a
\code{numeric} matrix where each row contains exactly one entry equal to \code{1} and
all other entries equal to \code{0}.
}
\examples{
x <- matrix(c(
  1, 0, 0, 0,
  0, 1, 0, 0,
  0, 0, 0, 0
), nrow = 3, byrow = TRUE)

check_one_hot_matrix(x)
test_one_hot_matrix(x)
\dontrun{
assert_one_hot_matrix(x)
}
}
\seealso{
Other matrix helpers: 
\code{\link{check_correlation_matrix}()},
\code{\link{check_covariance_matrix}()},
\code{\link{check_transition_probability_matrix}()},
\code{\link{cov_to_chol}()},
\code{\link{diff_cov}()},
\code{\link{insert_matrix_column}()},
\code{\link{matrix_diagonal_indices}()},
\code{\link{matrix_indices}()},
\code{\link{sample_correlation_matrix}()},
\code{\link{sample_covariance_matrix}()},
\code{\link{sample_transition_probability_matrix}()},
\code{\link{stationary_distribution}()}
}
\concept{matrix helpers}
\keyword{validation}
