|
tatami_r
R bindings to tatami matrices
|
tatami bindings for arbitrary R matrices. More...
Classes | |
| class | UnknownMatrix |
| Unknown matrix-like object in R. More... | |
| struct | UnknownMatrixOptions |
Options for data extraction from an UnknownMatrix. More... | |
Functions | |
| manticore::Executor & | executor () |
| void | set_executor (manticore::Executor *ptr) |
| template<class Function_ , class Index_ > | |
| void | parallelize (const Function_ fun, const Index_ ntasks, int nthreads) |
| template<class Function_ > | |
| void | parse_SVT_SparseMatrix (const Rcpp::RObject &matrix, const Function_ fun) |
tatami bindings for arbitrary R matrices.
|
inline |
Retrieve a global manticore::Executor object for all tatami_r applications. This function is only available if TATAMI_R_PARALLELIZE_UNKNOWN is defined.
manticore::Executor. If set_executor() was called with a non-NULL pointer, the provided instance will be used; otherwise, a default instance will be instantiated. | void tatami_r::parallelize | ( | const Function_ | fun, |
| const Index_ | ntasks, | ||
| int | nthreads ) |
| Function_ | Function to be executed. |
| Index_ | Integer type for the task indices. |
| fun | Function to run in each thread. This is a lambda that should accept three arguments:
|
| ntasks | Number of tasks to be executed. |
| nthreads | Number of threads to parallelize over. |
This function is a drop-in replacement for tatami::parallelize(). The series of integers from [0, ntasks) is split into nthreads contiguous ranges. Each range is used as input to a call to fun within a thread created by the standard <thread> library. Serialization can be achieved via <mutex> in most cases, or manticore::Executor::run() if the task must be performed on the main thread (see executor()).
This function is only available if TATAMI_R_PARALLELIZE_UNKNOWN is defined.
| void tatami_r::parse_SVT_SparseMatrix | ( | const Rcpp::RObject & | matrix, |
| const Function_ | fun ) |
Parse the contents of a SVT_SparseMatrix from the DelayedArray package. This accounts for different versions of the class definition, different types of the values, and the presence of lacunar leaf nodes.
| Function_ | Function to be applied at each leaf node. |
| matrix | The SVT_SparseMatrix object. |
| fun | Function to apply to each leaf node, accepting four arguments:
fun may not be called for all c - if leaf nodes do not contain any data, they will be skipped. |
|
inline |
Set a global manticore::Executor object for all tatami_r applications. This function is only available if TATAMI_R_PARALLELIZE_UNKNOWN is defined. Calling this function is occasionally necessary if executor() resolves to different instances of a manticore::Executor across different libraries.
| Pointer | to a global manticore::Executor, or NULL to unset this pointer. |