|
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_ > | |
| int | parallelize (const Function_ fun, const Index_ tasks, int threads) |
| 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. | int tatami_r::parallelize | ( | const Function_ | fun, |
| const Index_ | tasks, | ||
| int | threads ) |
| 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:
|
| tasks | Number of tasks to be executed. This should be non-negative. |
| threads | Number of threads to parallelize over. This should be positive. |
This function is a drop-in replacement for tatami::parallelize(). The series of integers from [0, tasks) is deterministically split into K non-overlapping non-empty contiguous ranges where K <= threads. Each range is passed to fun for parallel execution with 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.
K) that were actually used. K is guaranteed to be no greater than threads (or 1, if the latter is not positive). fun() will have been called once for each of the thread IDs [0, ..., K - 1]. | 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. |