SCM

SCM Repository

[matrix] Diff of /pkg/man/pMatrix-class.Rd
ViewVC logotype

Diff of /pkg/man/pMatrix-class.Rd

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 658, Thu Mar 17 17:52:06 2005 UTC revision 659, Thu Mar 17 17:53:10 2005 UTC
# Line 12  Line 12 
12  \alias{t,pMatrix-method}  \alias{t,pMatrix-method}
13  \title{Permutation matrices}  \title{Permutation matrices}
14  \description{The \code{"pMatrix"} class is the class of permutation  \description{The \code{"pMatrix"} class is the class of permutation
15    matrices stored as 1-based integer permutation vectors.}    matrices, stored as 1-based integer permutation vectors.}
16  \section{Objects from the Class}{  \section{Objects from the Class}{
17    Objects can be created by calls of the form \code{new("pMatrix", ...)}    Objects can be created by calls of the form \code{new("pMatrix", ...)}
18    or by coercion from an integer permutation vector.    or by coercion from an integer permutation vector, see below.
19  }  }
20  \section{Slots}{  \section{Slots}{
21    \describe{    \describe{
# Line 37  Line 37 
37    \describe{    \describe{
38      \item{\%*\%}{\code{signature(x = "matrix", y = "pMatrix")} and other      \item{\%*\%}{\code{signature(x = "matrix", y = "pMatrix")} and other
39        signatures (use \code{showMethods("\%*\%", class="pMatrix")}): ... }        signatures (use \code{showMethods("\%*\%", class="pMatrix")}): ... }
40      \item{coerce}{\code{signature(from = "integer", to = "pMatrix")}: ... }      \item{coerce}{\code{signature(from = "integer", to = "pMatrix")}:
41          This is enables typical \code{"pmatrix"} construction, given
42          a permutation vector of \code{1:n}, see the first example.}
43      \item{coerce}{\code{signature(from = "pMatrix", to = "matrix")}: ... }      \item{coerce}{\code{signature(from = "pMatrix", to = "matrix")}: ... }
44      \item{solve}{\code{signature(a = "pMatrix", b = "missing")}: return      \item{solve}{\code{signature(a = "pMatrix", b = "missing")}: return
45        the inverse permutation matrix.}        the inverse permutation matrix.}
# Line 49  Line 51 
51  %\seealso{}  %\seealso{}
52  \examples{  \examples{
53  (pm1 <- as(as.integer(c(2,3,1)), "pMatrix"))  (pm1 <- as(as.integer(c(2,3,1)), "pMatrix"))
54  t(pm1)  t(pm1) # is the same as
55  solve(pm1)  solve(pm1)
56  pm1 \%*\% as(t(pm1), "matrix")   # check that the transpose is the inverse  pm1 \%*\% t(pm1) # check that the transpose is the inverse
57    stopifnot(identical(diag(3), as(pm1 \%*\% t(pm1), "matrix")))
58  (mm <- round(array(rnorm(3 * 3), c(3, 3)), 2))  (mm <- round(array(rnorm(3 * 3), c(3, 3)), 2))
59  mm \%*\% pm1  mm \%*\% pm1
60  pm1 \%*\% mm  pm1 \%*\% mm
61  try(as(as.integer(c(3,3,1)), "pMatrix"))  try(as(as.integer(c(3,3,1)), "pMatrix"))# Error: not a permutation
62  }  }
63  \keyword{classes}  \keyword{classes}

Legend:
Removed from v.658  
changed lines
  Added in v.659

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge