SCM

SCM Repository

[matrix] Diff of /pkg/man/lsparseMatrix-classes.Rd
ViewVC logotype

Diff of /pkg/man/lsparseMatrix-classes.Rd

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

revision 1547, Mon Sep 11 14:49:39 2006 UTC revision 1548, Mon Sep 11 22:13:07 2006 UTC
# Line 40  Line 40 
40  \alias{coerce,matrix,lgTMatrix-method}  \alias{coerce,matrix,lgTMatrix-method}
41  \alias{coerce,matrix,ltCMatrix-method}  \alias{coerce,matrix,ltCMatrix-method}
42  %  %
43    \alias{coerce,lsparseMatrix,matrix-method}
44  \alias{coerce,ltTMatrix,dtTMatrix-method}  \alias{coerce,ltTMatrix,dtTMatrix-method}
45  \alias{coerce,ltTMatrix,lgTMatrix-method}  \alias{coerce,ltTMatrix,lgTMatrix-method}
46  \alias{coerce,ltTMatrix,matrix-method}  \alias{coerce,ltTMatrix,matrix-method}
# Line 91  Line 92 
92  }  }
93  \section{Slots}{  \section{Slots}{
94    \describe{    \describe{
95        \item{\code{x}:}{Object of class \code{"logical"}, i.e., either
96          \code{TRUE}, \code{\link{NA}}, or \code{FALSE}.}
97      \item{\code{uplo}:}{Object of class \code{"character"}. Must be      \item{\code{uplo}:}{Object of class \code{"character"}. Must be
98        either "U", for upper triangular, and "L", for lower        either "U", for upper triangular, and "L", for lower
99        triangular. Present in the triangular and symmetric classes but not        triangular. Present in the triangular and symmetric classes but not
# Line 130  Line 133 
133    the class \code{\linkS4class{dgCMatrix}}    the class \code{\linkS4class{dgCMatrix}}
134  }  }
135  \examples{  \examples{
136  m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL))  str(m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL)))
137  (dm <- as(m, "dgCMatrix"))# no dimnames for sparse here  (lm <- (m > 1)) # lgC
138  (lm <- as(dm, "lgCMatrix"))  stopifnot(is(lm,"lsparseMatrix"))
 str(lm) # no 'x' slot  
139  !lm     # no longer sparse  !lm     # no longer sparse
140    %% FIXME:  m <= 1   -- not-yet-implemented
141    
142  data(KNex)  data(KNex)
143  lmm <- as(KNex $ mm, "lgCMatrix")  str(mmG.1 <- (KNex $ mm) > 0.1)# "lgC..."
144  xlx <- crossprod(lmm)  ## from logical to nz_pattern -- okay when there are no NA's :
145  image(xlx, main=paste("crossprod(lmm) : Sparse", class(xlx)))  %%?%% %% FIXME:  has never NAs when run interactively, but has in R CMD check ???
146    %%?%% if(any(is.na(mmG.1@x))) {
147    %%?%%   table(mmG.1@x, exclude=NULL)
148    %%?%% } else  {
149    %%?%% nmG.1 <- as(mmG.1, "nMatrix")
150    %%?%% ## from logical to "double"
151    %%?%% if(FALSE) { ## NOT YET AVAILABLE%% FIXME -- want some way of "coercion"
152    %%?%%   dmG.1 <- mmG.1 + 0
153    %%?%%   dmG.1 <- as(mmG.1, "dMatrix")
154    %%?%%   dmG.1 <- as(mmG.1, "dMatrix")
155    %%?%% }
156    %%?%% class(xnx <- crossprod(nmG.1))# "nsC.."
157    %%?%% class(xlx <- crossprod(mmG.1))# "dsC.." : numeric
158    %%?%% %% FIXME: 'xlx@x' is garbage
159    %%?%% %% TODO: compare xlx & xnx
160    %%?%% stopifnot(isSymmetric(xlx), isSymmetric(xnx))
161    %%?%% } # end {else}
162  }  }
163  \keyword{classes}  \keyword{classes}
164  \keyword{algebra}  \keyword{algebra}

Legend:
Removed from v.1547  
changed lines
  Added in v.1548

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge