SCM

SCM Repository

[matrix] Diff of /pkg/man/tcrossprod.Rd
ViewVC logotype

Diff of /pkg/man/tcrossprod.Rd

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

revision 330, Fri Nov 12 21:02:51 2004 UTC revision 976, Fri Oct 7 20:18:29 2005 UTC
# Line 1  Line 1 
1  \name{tcrossprod}  \name{tcrossprod}
2  \docType{methods}  \docType{methods}
3  \alias{tcrossprod-methods}  \alias{tcrossprod-methods}
4  \alias{tcrossprod,cscMatrix-method}  \alias{tcrossprod,dgCMatrix-method}
5    \alias{tcrossprod,dgTMatrix-method}
6    \alias{tcrossprod,matrix-method}
7    \alias{tcrossprod,numeric-method}
8    % more \alias{tcrossprod,...}es in *-class*.Rd files
9  \alias{tcrossprod}  \alias{tcrossprod}
10  \title{Cross-product of transpose}  \title{Cross-product of transpose}
11  \description{  \description{
# Line 17  Line 21 
21  }  }
22  \details{  \details{
23    For some classes in the \code{Matrix} package, such as the    For some classes in the \code{Matrix} package, such as the
24    \code{\link{cscMatrix-class}}, it is much faster to calculate the    \code{\link{dgCMatrix-class}}, it is much faster to calculate the
25    cross-product of the transpose directly instead of calculating the    cross-product of the transpose directly instead of calculating the
26    transpose first and then its cross-product.    transpose first and then its cross-product.
27  }  }
# Line 26  Line 30 
30  }  }
31  \section{Methods}{  \section{Methods}{
32    \describe{    \describe{
33      \item{x = "cscMatrix"}{method for compressed, sparse,      \item{x = "dgCMatrix"}{method for compressed, sparse,
34        column-oriented matrices.}        column-oriented matrices.}
35    }    }
36  }  }
37  \seealso{\code{\link[base]{crossprod}}}  \seealso{\code{\link[base]{crossprod}}}
38  %\examples{}  \examples{
39     ## A random sparce "incidence" matrix :
40     m <- matrix(0, 400, 500)
41     set.seed(12)
42     m[runif(314, 0, length(m))] <- 1
43     mm <- as(m, "dgCMatrix")
44     object.size(m) / object.size(mm) # smaller by a factor of 242.88
45    
46     ## tcrossprod() is very fast:
47     system.time(tCmm <- tcrossprod(mm))# 0   (PIII, 933 MHz)
48     system.time(cm <- crossprod(t(m))) # 0.16
49     system.time(cm. <- tcrossprod(m))  # 0.02
50    
51     stopifnot(identical(cm, as(tCmm, "matrix")))
52    
53     ## show sparse sub matrix
54     tCmm[1:16, 1:30]
55    }
56  \keyword{methods}  \keyword{methods}
57  \keyword{algebra}  \keyword{algebra}

Legend:
Removed from v.330  
changed lines
  Added in v.976

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