initializeCpp | R Documentation |
Initialize a tatami matrix object in C++ memory space from an abstract numeric R matrix. This object simply references the R memory space and avoids making any copies of its own, so it can be cheaply re-created when needed inside each function.
initializeCpp(x, ...)
x |
A matrix-like object, typically from the Matrix or DelayedArray packages.
Alternatively, an external pointer from a previous call to |
... |
Further arguments used by specific methods, such as:
Fields should generally be prefixed by the matrix type, to avoid conflicts with arguments from other packages.
For example, |
Do not attempt to serialize the return value; it contains a pointer to external memory, and will not be valid after a save/load cycle.
Users should not be exposed to the returned pointers; rather, developers should call initialize
at the start to obtain a C++ object for further processing.
As mentioned before, this initialization process is very cheap so there is no downside from just recreating the object within each function body.
An external pointer to a C++ object containing a tatami matrix.
# Mocking up a count matrix:
x <- Matrix::rsparsematrix(1000, 100, 0.1)
y <- round(abs(x))
stuff <- initializeCpp(y)
stuff
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.