\HeaderA{isSymmetric}{Test if a Matrix or other Object is Symmetric}{isSymmetric}
\methaliasA{isSymmetric.matrix}{isSymmetric}{isSymmetric.matrix}
\keyword{array}{isSymmetric}
\keyword{utilities}{isSymmetric}
\begin{Description}\relax
Generic function to test if \code{object} is symmetric or not.
Currently only a matrix method is implemented.
\end{Description}
\begin{Usage}
\begin{verbatim}
isSymmetric(object, ...)
## S3 method for class 'matrix':
isSymmetric(object, tol = 100 * .Machine$double.eps, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] any \R{} object; a \code{\LinkA{matrix}{matrix}} for the matrix method.
\item[\code{tol}] numeric scalar >= 0.  Smaller differences are not
considered, see \code{\LinkA{all.equal.numeric}{all.equal.numeric}}.
\item[\code{...}] further arguments passed to methods; the matrix method
passes these to \code{\LinkA{all.equal}{all.equal}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The \code{\LinkA{matrix}{matrix}} method is used inside \code{\LinkA{eigen}{eigen}} by
default to test symmetry of matrices ``up to rounding error'', using
\code{\LinkA{all.equal}{all.equal}}.  It might not be appropriate in all
situations.
\end{Details}
\begin{Value}
logical indicating if \code{object} is symmetric or not.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{eigen}{eigen}} which calls \code{isSymmetric} when its
\code{symmetric} argument is missing, as per default.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
isSymmetric(D3 <- diag(3)) # -> TRUE

D3[2,1] <- 1e-100
D3
isSymmetric(D3) # TRUE
isSymmetric(D3, tol = 0) # FALSE for zero-tolerance
\end{ExampleCode}
\end{Examples}

