DelayedSubassign objects
DelayedSubassign-class.RdNOTE: This man page is about DelayedArray internals and is provided for developers and advanced users only.
The DelayedSubassign class provides a formal representation of a delayed multi-dimensional single bracket subassignment. It is a concrete subclass of the DelayedUnaryIsoOp virtual class, which itself is a subclass of the DelayedUnaryOp virtual class, which itself is a subclass of the DelayedOp virtual class:
DelayedOp
^
|
DelayedUnaryOp
^
|
DelayedUnaryIsoOp
^
|
DelayedSubassign
DelayedSubassign objects are used inside a DelayedArray object to represent the delayed multi-dimensional single bracket subassignments carried by the object. They're never exposed to the end user and are not intended to be manipulated directly.
Usage
# S4 method for class 'DelayedSubassign'
is_noop(x)
# S4 method for class 'DelayedSubassign'
summary(object, ...)
## ~ ~ ~ Seed contract ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
## DelayedSubassign objects inherit the default dim()
## and dimnames() methods defined for DelayedUnaryIsoOp
## derivatives, but overwite their extract_array() method.
# S4 method for class 'DelayedSubassign'
extract_array(x, index)
## ~ ~ ~ Propagation of sparsity ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
# S4 method for class 'DelayedSubassign'
is_sparse(x)
# S4 method for class 'DelayedSubassign'
extract_sparse_array(x, index)Arguments
- x, object
A DelayedSubassign object.
- index
See
?extract_arrayin the S4Arrays package for a description of theindexargument.- ...
Not used.
See also
DelayedOp objects.
showtreeto visualize the nodes and access the leaves in the tree of delayed operations carried by a DelayedArray object.extract_array in the S4Arrays package.
extract_sparse_arrayin the SparseArray package.
Examples
## DelayedSubassign extends DelayedUnaryIsoOp, which extends
## DelayedUnaryOp, which extends DelayedOp:
extends("DelayedSubassign")
#> [1] "DelayedSubassign" "DelayedUnaryIsoOp" "DelayedUnaryOp"
#> [4] "DelayedOp" "Array"
## ---------------------------------------------------------------------
## BASIC EXAMPLE
## ---------------------------------------------------------------------
m0 <- matrix(1:30, ncol=5)
M2 <- M1 <- M0 <- DelayedArray(m0)
showtree(M0)
#> 6x5 integer: DelayedMatrix object
#> └─ 6x5 integer: [seed] matrix object
M1[2:5, 5:4] <- 100
showtree(M1)
#> 6x5 double: DelayedMatrix object
#> └─ 6x5 double: Subassign
#> └─ 6x5 integer: [seed] matrix object
class(M1@seed) # a DelayedSubassign object
#> [1] "DelayedSubassign"
#> attr(,"package")
#> [1] "DelayedArray"
M2[2:5, 5:4] <- matrix(101:108, ncol=2)
showtree(M2)
#> 6x5 integer: DelayedMatrix object
#> └─ 6x5 integer: Subassign
#> ├─ 6x5 integer: [seed] matrix object
#> └─ right value: 4x2 integer: [seed] matrix object
class(M2@seed) # a DelayedSubassign object
#> [1] "DelayedSubassign"
#> attr(,"package")
#> [1] "DelayedArray"
## ---------------------------------------------------------------------
## PROPAGATION OF SPARSITY
## ---------------------------------------------------------------------
## DelayedSubassign objects don't propagate sparsity at the moment, that
## is, is_sparse() always returns FALSE on them.
## ---------------------------------------------------------------------
## SANITY CHECKS
## ---------------------------------------------------------------------
stopifnot(class(M1@seed) == "DelayedSubassign")
stopifnot(class(M2@seed) == "DelayedSubassign")