https://github.com/cran/pracma
Raw File
Tip revision: 392ae21a013fb3f518e8f9eb8efb458a55a2eca2 authored by HwB on 09 April 2011, 00:00:00 UTC
version 0.3-0
Tip revision: 392ae21
perms.Rd
\name{perms}
\alias{perms}
\title{
Generate Permutations
}
\description{
Generates all permutations of a vector \code{a}.
}
\usage{
perms(a)
}
\arguments{
  \item{a}{numeric vector of some length \code{n}}
}
\details{
  If \code{a} is a vector of length \code{n}, generate all permutations
  of the elements in \code{a} as a matrix of size \code{n! x n} where
  each row represents one permutation.

  A matrix will be expanded as vector.
}
\value{
  matrix of permutations of the elements of \code{a}
}
\note{
Not feasible for \code{length(a) > 10}.
}
\seealso{
\code{\link{randperm}}
}
\examples{
perms(6)
perms(1:6)
perms(c(1, exp(1), pi))
}
\keyword{ arith }
back to top