SCM

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 868 - (view) (download) (as text)

1 : bates 638 \name{pMatrix-class}
2 :     \docType{class}
3 :     \alias{pMatrix-class}
4 :     \alias{\%*\%,matrix,pMatrix-method}
5 :     \alias{\%*\%,pMatrix,matrix-method}
6 : maechler 657 \alias{\%*\%,pMatrix,pMatrix-method}
7 : bates 654 \alias{\%*\%,dgeMatrix,pMatrix-method}
8 :     \alias{\%*\%,pMatrix,dgeMatrix-method}
9 : bates 638 \alias{coerce,integer,pMatrix-method}
10 :     \alias{coerce,pMatrix,matrix-method}
11 : maechler 868 \alias{coerce,pMatrix,lgTMatrix-method}
12 : bates 638 \alias{solve,pMatrix,missing-method}
13 :     \alias{t,pMatrix-method}
14 :     \title{Permutation matrices}
15 :     \description{The \code{"pMatrix"} class is the class of permutation
16 : maechler 659 matrices, stored as 1-based integer permutation vectors.}
17 : bates 638 \section{Objects from the Class}{
18 :     Objects can be created by calls of the form \code{new("pMatrix", ...)}
19 : maechler 659 or by coercion from an integer permutation vector, see below.
20 : bates 638 }
21 :     \section{Slots}{
22 :     \describe{
23 :     \item{\code{perm}:}{An integer, 1-based permutation vector, i.e.
24 :     an integer vector of length \code{Dim[1]} whose elements form a
25 :     permutation of \code{1:Dim[1]}.}
26 :     \item{\code{Dim}:}{Object of class \code{"integer"}. The dimensions
27 :     of the matrix which must be a two-element vector of equal,
28 :     non-negative integers.}
29 :     \item{\code{Dimnames}:}{list of length two; each component
30 :     containing NULL or a \code{\link{character}} vector length
31 :     equal the corresponding \code{Dim} element.}
32 :     }
33 :     }
34 :     \section{Extends}{
35 : maechler 659 Class \code{"Matrix"}, directly.
36 : bates 638 }
37 :     \section{Methods}{
38 :     \describe{
39 : maechler 657 \item{\%*\%}{\code{signature(x = "matrix", y = "pMatrix")} and other
40 :     signatures (use \code{showMethods("\%*\%", class="pMatrix")}): ... }
41 : maechler 659 \item{coerce}{\code{signature(from = "integer", to = "pMatrix")}:
42 :     This is enables typical \code{"pmatrix"} construction, given
43 :     a permutation vector of \code{1:n}, see the first example.}
44 : bates 638 \item{coerce}{\code{signature(from = "pMatrix", to = "matrix")}: ... }
45 : maechler 868 \item{coerce}{\code{signature(from = "pMatrix", to = "lgTMatrix")}:
46 :     coercion to sparse logical matrix of class \code{\link{lgTMatrix-class}}.}
47 : bates 638 \item{solve}{\code{signature(a = "pMatrix", b = "missing")}: return
48 :     the inverse permutation matrix.}
49 :     \item{t}{\code{signature(x = "pMatrix")}: return the transpose of
50 :     the permuation matrix (which is also the inverse of the
51 :     permutation matrix).}
52 :     }
53 :     }
54 :     %\seealso{}
55 :     \examples{
56 :     (pm1 <- as(as.integer(c(2,3,1)), "pMatrix"))
57 : maechler 659 t(pm1) # is the same as
58 : bates 638 solve(pm1)
59 : maechler 659 pm1 \%*\% t(pm1) # check that the transpose is the inverse
60 :     stopifnot(identical(diag(3), as(pm1 \%*\% t(pm1), "matrix")))
61 : bates 638 (mm <- round(array(rnorm(3 * 3), c(3, 3)), 2))
62 : bates 650 mm \%*\% pm1
63 :     pm1 \%*\% mm
64 : maechler 659 try(as(as.integer(c(3,3,1)), "pMatrix"))# Error: not a permutation
65 : maechler 868
66 :     as(pm1, "lgTMatrix")
67 : bates 638 }
68 :     \keyword{classes}
69 : maechler 868

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