diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a74288..6f45d04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,9 +15,10 @@ if(TATAMI_STATS_FETCH_EXTERN) add_subdirectory(extern) else() find_package(tatami_tatami 3.0.0 CONFIG REQUIRED) + find_package(ltla_subpar 0.3.0 CONFIG REQUIRED) endif() -target_link_libraries(tatami_stats INTERFACE tatami::tatami) +target_link_libraries(tatami_stats INTERFACE tatami::tatami ltla::subpar) include(GNUInstallDirs) target_include_directories(tatami_stats INTERFACE diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in index 1fd297e..cb5c884 100644 --- a/cmake/Config.cmake.in +++ b/cmake/Config.cmake.in @@ -2,5 +2,6 @@ include(CMakeFindDependencyMacro) find_dependency(tatami_tatami 3.0.0 CONFIG REQUIRED) +find_dependency(ltla_subpar 0.3.0 CONFIG REQUIRED) include("${CMAKE_CURRENT_LIST_DIR}/tatami_tatami_statsTargets.cmake") diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index a937b67..c172b5b 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -3,8 +3,14 @@ include(FetchContent) FetchContent_Declare( tatami GIT_REPOSITORY https://github.com/tatami-inc/tatami - GIT_TAG master # ^v3.0.0 + GIT_TAG master # ^3.0.0 ) -FetchContent_MakeAvailable(tatami) +FetchContent_Declare( + subpar + GIT_REPOSITORY https://github.com/LTLA/subpar + GIT_TAG master # ^0.3.0 +) +FetchContent_MakeAvailable(tatami) +FetchContent_MakeAvailable(subpar) diff --git a/include/tatami_stats/counts.hpp b/include/tatami_stats/counts.hpp index 4a72751..34e687f 100644 --- a/include/tatami_stats/counts.hpp +++ b/include/tatami_stats/counts.hpp @@ -86,6 +86,7 @@ void apply(bool row, const tatami::Matrix* p, Output_* output, i } } else { + num_threads = subpar::sanitize_num_workers(num_threads, otherdim); // provides some protection against silly num_threads iputs. std::vector threaded_output_ptrs(num_threads, output); std::vector > threaded_output(num_threads - 1); for (int t = 1; t < num_threads; ++t) {