File: Design-issues.R

package info (click to toggle)
rmatrix 1.7-4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,096 kB
  • sloc: ansic: 97,203; makefile: 280; sh: 165
file content (59 lines) | stat: -rw-r--r-- 1,635 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
### R code from vignette source 'Design-issues.Rnw'

###################################################
### code chunk number 1: preliminaries
###################################################
options(width=75)
library(utils) # for R_DEFAULT_PACKAGES=NULL
library(Matrix)


###################################################
### code chunk number 2: dgC-ex
###################################################
getClass("dgCMatrix")


###################################################
### code chunk number 3: dgC-ex
###################################################
getClass("ntTMatrix")


###################################################
### code chunk number 4: diag-class
###################################################
(D4 <- Diagonal(4, 10*(1:4)))
str(D4)
diag(D4)


###################################################
### code chunk number 5: diag-2
###################################################
diag(D4) <- diag(D4) + 1:4
D4


###################################################
### code chunk number 6: unit-diag
###################################################
str(I3 <- Diagonal(3)) ## empty 'x' slot

getClass("diagonalMatrix") ## extending "sparseMatrix"


###################################################
### code chunk number 7: Matrix-ex
###################################################
(M <- spMatrix(4,4, i=1:4, j=c(3:1,4), x=c(4,1,4,8))) # dgTMatrix
m <- as(M, "matrix")
(M. <- Matrix(m)) # dsCMatrix (i.e. *symmetric*)


###################################################
### code chunk number 8: sessionInfo
###################################################
toLatex(sessionInfo())