# SCM Repository

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

# Diff of /pkg/man/tcrossprod.Rd

revision 492, Thu Feb 3 14:24:03 2005 UTC revision 976, Fri Oct 7 20:18:29 2005 UTC
# Line 3  Line 3
3  \alias{tcrossprod-methods}  \alias{tcrossprod-methods}
4  \alias{tcrossprod,dgCMatrix-method}  \alias{tcrossprod,dgCMatrix-method}
5  \alias{tcrossprod,dgTMatrix-method}  \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 32  Line 35
35    }    }
36  }  }
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.492 changed lines Added in v.976