SCM Repository

[matrix] View of /pkg/Matrix/man/symmpart.Rd
ViewVC logotype

View of /pkg/Matrix/man/symmpart.Rd

Parent Directory Parent Directory | Revision Log Revision Log

Revision 3020 - (download) (as text) (annotate)
Tue Oct 14 16:14:02 2014 UTC (4 years, 4 months ago) by mmaechler
File size: 2445 byte(s)
dimnames(), notably names(dimnames()) -- primarily in connection with symmpart(), skewpart() and forceSymmetric()
\title{Symmetric Part and Skew(symmetric) Part of a Matrix}
%% Hmm, want the generic and methods all in this file ...
%% \docType{methods}
  \code{symmpart(x)} computes the symmetric part \code{(x + t(x))/2} and
  \code{skewpart(x)} the
  skew symmetric part \code{(x - t(x))/2} of a square matrix \code{x},
  more efficiently for specific Matrix classes.

  Note that \code{x == symmpart(x) + skewpart(x)} for all square
  matrices -- apart from extraneous \code{\link{NA}} values in the RHS.
  \item{x}{a \emph{square} matrix; either \dQuote{traditional} of class
    \code{"matrix"}, or typically, inheriting from the
    \code{\linkS4class{Matrix}} class.}
  These are generic functions with several methods for different matrix
  classes, use e.g., \code{\link{showMethods}(symmpart)} to see them.

  If the row and column names differ, the result will use the column
  names unless they are (partly) \code{NULL} where the row names are
  non-\code{NULL} (see also the examples).
  \code{symmpart()} returns a symmetric matrix, inheriting from
  \code{\linkS4class{symmetricMatrix}} iff \code{x} inherited from

  \code{skewpart()} returns a skew-symmetric matrix,
  typically of the same class as \code{x} (or the closest
  \dQuote{general} one, see \code{\linkS4class{generalMatrix}}).
m <- Matrix(1:4, 2,2)

stopifnot(all(m == symmpart(m) + skewpart(m)))

dn <- dimnames(m) <- list(row = c("r1", "r2"), col = c("var.1", "var.2"))
stopifnot(all(m == symmpart(m) + skewpart(m)))
colnames(m) <- NULL
stopifnot(all(m == symmpart(m) + skewpart(m)))
dimnames(m) <- unname(dn)
stopifnot(all(m == symmpart(m) + skewpart(m)))

## investigate the current methods:
showMethods(skewpart, include = TRUE)
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge