Higher-order function factory that creates coo_ functions with automatic dispatch to handle single matrices, lists of matrices, and tibbles.
Arguments
- impl_fn
Function. The implementation function that operates on a single matrix (nx2). Should accept
xas first argument and...for additional args.- fn_name
Character. Optional name for debugging (not used functionally).
- sync_ldk
Logical. If TRUE, function is landmark-aware and will sync landmark columns automatically. Default is FALSE.
Details
The returned function automatically:
Applies impl_fn to single matrices and returns the result
Applies impl_fn to each element of a list and returns a list
Applies impl_fn to specified columns of a tibble and returns the modified tibble
Applies
xyclass to each single matrixApplies
cooclass to list and list-columns (ie when tibbles are passed)
When sync_ldk = TRUE, the dispatcher automatically handles landmark columns:
Looks for a column named
colname_ldk(e.g.,coo_ldkforcoocolumn)Or uses
.ldk_colargument if providedPasses landmarks to implementation function
Updates landmarks based on coordinate changes
When sync_ldk = FALSE, the implementation function should return just a matrix,
not a list with coo and ldk elements.
Additional arguments are passed through via ...
