Displaying 1 result from an estimated 1 matches for "matrixref".
Did you mean:
matrixres
2010 Jul 25
0
Redefine NROW and NCOL to be compatible with nrow and ncol for S3 classes with own dim function?
...ficient, if a
lot of functions manipulate the matrix). This can be done by wrapping
the matrix in an environment and writing approbriate methods for dim,
"[", etc.
Here an example of some of its code
# An example class that wraps a Matrix in an environment to allow pass
by reference
MatrixRef = function(mat) {
m = new.env(parent=emptyenv())
assign("mat",mat,envir=m)
class(m) = c("MatrixRef","environment")
m
}
dim.MatrixRef = function(x) dim(get("mat",envir=x))
# ... define other functions like "[", "[<-", "...