symDMatrix-class: A Matrix-Like Class to Represent a Symmetric Matrix...

Description Details See Also Examples

Description

A symDMatrix is a symmetric matrix partitioned into file-backed blocks. This approach allows for very large symmetric matrices, commonly found for example when computing genetic relationship matrices on large cohorts. A symDMatrix object behaves similarly to a regular matrix by implementing key methods such as [, dim, and dimnames.

Details

The symDMatrix class is a RowLinkedMatrix that nests multiple ColumnLinkedMatrix objects containing blocks of type ff_matrix. Because the matrix is symmetric, only the diagonal and upper-triangular blocks need to be stored, but for more efficient queries, the lower-triangular blocks are virtual transposes of their diagonal counterparts.

See Also

symDMatrix to create a symDMatrix object from scratch, or preferably, as.symDMatrix to create a symDMatrix object from other objects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Get the path to the example symmetric matrix
path <- system.file("extdata", "G.RData", package = "symDMatrix")

# Load the example symDMatrix object (G)
load.symDMatrix(path, readonly = TRUE)

# Get the dimensions
dim(G)

# Get the row names
rownames(G)

# Get the column names
colnames(G)

# Extract the diagonal
diag(G)

# Extract rows and columns
G[1, ]
G[1:3, ]
G["per0_per0", ]
G[c("per0_per0", "per1_per1", "per2_per2"), ]

QuantGen/symDMatrix documentation built on Aug. 7, 2020, 10:17 p.m.