LinkedMatrix {LinkedMatrix} | R Documentation |
Create an Empty, Prespecified LinkedMatrix Object
Description
This function creates an empty LinkedMatrix
object of a certain
size, a certain number of nodes, and certain types of nodes.
Usage
LinkedMatrix(nrow, ncol, nNodes, linkedBy, nodeInitializer, ...)
Arguments
nrow |
The number of rows of the whole matrix. |
ncol |
The number of columns of the whole matrix. |
nNodes |
The number of nodes. |
linkedBy |
Whether the matrix is linked by |
nodeInitializer |
The name of a function or a function |
... |
Additional arguments passed into the |
Value
A ColumnLinkedMatrix
object if linkedBy
is columns
or
a RowLinkedMatrix
object if linkedBy
is rows
.
See Also
ColumnLinkedMatrix
and RowLinkedMatrix
to
create ColumnLinkedMatrix
and RowLinkedMatrix
objects from a
list of matrix-like objects.
Examples
# Create an empty 15x10 RowLinkedMatrix with 3 matrix nodes
m1 <- LinkedMatrix(nrow = 15, ncol = 10, nNodes = 3, linkedBy = "rows",
nodeInitializer = "matrixNodeInitializer")
dim(m1)
nNodes(m1)
all(sapply(m1, inherits, "matrix"))
# Create an empty 15x10 RowLinkedMatrix with 3 ff nodes
m2 <- LinkedMatrix(nrow = 15, ncol = 10, nNodes = 3, linkedBy = "rows",
nodeInitializer = "ffNodeInitializer", vmode = "byte")
dim(m2)
nNodes(m2)
all(sapply(m2, inherits, "ff_matrix"))
# Create an empty 15x10 RowLinkedMatrix with 3 big.matrix nodes
m3 <- LinkedMatrix(nrow = 15, ncol = 10, nNodes = 3, linkedBy = "rows",
nodeInitializer = function(nodeIndex, nrow, ncol, ...) {
bigmemory::big.matrix(nrow = nrow, ncol = ncol)
})
dim(m3)
nNodes(m3)
all(sapply(m3, inherits, "big.matrix"))