Open PeteHaitch opened 6 years ago
Another option might be to obtain the BACKEND
implicitly from options()
, after some setBackEnd()
command; in case it is too unwieldy/non-general to ask that all methods include a BACKEND=
in their definition. I think we have this already in DelayedArray::setRealizationBackend
?
I think we have that or something close to it for DelayedArray, but I'm also thinking about how to support other on-disk array-like structures, such as matter, which don't use the whole DelayedArray framework.
Broadly, there are two types of operations performed by these matrix summarisations:
To take two examples from matrixStats:
val <- colMedians(x)
results inlength(val) == ncol(x)
val <- colCummaxs(x)
results indim(val) == dim(x)
Particularly for matrix-to-matrix ops where the input is a disk-backed object, it may be desirable to be able to specify that the result should be realised on disk (or via some other backend) instead of as an ordinary matrix.
I see two options for the 'contract' of the generic and methods:
colCummaxs,DelayedMatrix-method
might gain aBACKEND
argument to specify what sort of object should be returned (with some sort of sensible default based on the class of the input).I favour (2), although its flexibility makes for a somewhat 'loose' contract between the input and output.