# SCM Repository

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

# Diff of /pkg/man/band.Rd

revision 1330, Fri Jul 21 08:28:18 2006 UTC revision 1331, Sat Jul 22 17:59:53 2006 UTC
# Line 6  Line 6
6  \alias{band,CsparseMatrix-method}  \alias{band,CsparseMatrix-method}
7  \alias{tril,CsparseMatrix-method}  \alias{tril,CsparseMatrix-method}
8  \alias{triu,CsparseMatrix-method}  \alias{triu,CsparseMatrix-method}
9    \alias{tril,dsCMatrix-method}
10    \alias{tril,lsCMatrix-method}
11    \alias{triu,dsCMatrix-method}
12    \alias{triu,lsCMatrix-method}
13    %
14  \alias{band}  \alias{band}
15  \alias{tril}  \alias{tril}
16  \alias{triu}  \alias{triu}
# Line 34  Line 39
39  }  }
40  \value{  \value{
41    An object of an appropriate matrix class.  The class of the value of    An object of an appropriate matrix class.  The class of the value of
42    \code{tril} or \code{triu} inherits from \code{\linkS4class{triangularMatrix}}.    \code{tril} or \code{triu} inherits from
44  }  }
45  \section{Methods}{  \section{Methods}{
46    \describe{    \describe{
# Line 43  Line 49
49    }    }
50  }  }
51  \examples{  \examples{
52   ## A random sparce "incidence" matrix :  ## A random sparse matrix :
53    set.seed(7)
54   m <- matrix(0, 5, 5)   m <- matrix(0, 5, 5)
55   set.seed(12)  m[sample(length(m), size = 14)] <- rep(1:9, length=14)
m[runif(10, 0, length(m))] <- 1
56   (mm <- as(m, "dgCMatrix"))   (mm <- as(m, "dgCMatrix"))
57
58   tril(mm)        # lower triangle   tril(mm)        # lower triangle
59  tril(mm, -1)   # strict lower triangle  tril(mm, -1)   # strict lower triangle
60  triu(mm, 1)    # strict upper triangle  triu(mm, 1)    # strict upper triangle
61  band(mm, -1, 1) # general band  band(mm, -1, 2) # general band
62    \dontshow{ ## this uses special methods
63    (x.x <- crossprod(mm))
64    tril(x.x)
65    xx <- tril(x.x) + triu(x.x, 1) ## the same as x.x (but stored differently):
66    stopifnot(identical(triu(x.x), t(tril(x.x))),
67              identical(x.x, t(as(xx, "dsCMatrix"))))
68    }
69  }  }
70  \keyword{methods}  \keyword{methods}
71  \keyword{algebra}  \keyword{algebra}

Legend:
 Removed from v.1330 changed lines Added in v.1331