isSymmetric.Rd 1.51 KB
 Radford Neal committed May 18, 2013 1 2 % File src/library/base/man/isSymmetric.Rd % Part of the R package, http://www.R-project.org  Radford Neal committed Aug 26, 2016 3 % Copyright 1995-2009 R Core Team  Radford Neal committed May 18, 2013 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 % Distributed under GPL 2 or later \name{isSymmetric} \alias{isSymmetric} \alias{isSymmetric.matrix} \title{Test if a Matrix or other Object is Symmetric} \description{ Generic function to test if \code{object} is symmetric or not. Currently only a matrix method is implemented. } \usage{ isSymmetric(object, \dots) \method{isSymmetric}{matrix}(object, tol = 100 * .Machine\$double.eps, \dots) } \arguments{ \item{object}{any \R object; a \code{\link{matrix}} for the matrix method.} \item{tol}{numeric scalar >= 0. Smaller differences are not considered, see \code{\link{all.equal.numeric}}.} \item{\dots}{further arguments passed to methods; the matrix method passes these to \code{\link{all.equal}}.} } \value{ logical indicating if \code{object} is symmetric or not. } \details{ The \code{\link{matrix}} method is used inside \code{\link{eigen}} by default to test symmetry of matrices \emph{up to rounding error}, using \code{\link{all.equal}}. It might not be appropriate in all situations. Note that a matrix is only symmetric if its \code{rownames} and \code{colnames} are identical. } \seealso{\code{\link{eigen}} which calls \code{isSymmetric} when its \code{symmetric} argument is missing. } \examples{ isSymmetric(D3 <- diag(3)) # -> TRUE D3[2,1] <- 1e-100 D3 isSymmetric(D3) # TRUE isSymmetric(D3, tol = 0) # FALSE for zero-tolerance } \keyword{array} \keyword{utilities}