Skip to content

Commit

Permalink
Templating fix to handle non-int Index_ types.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Dec 21, 2024
1 parent 5f07906 commit c491ae7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.14)

project(scran_variances
VERSION 0.1.3
VERSION 0.1.4
DESCRIPTION "Model per-gene variances in single-cell expression"
LANGUAGES CXX)

Expand Down
12 changes: 6 additions & 6 deletions include/scran_variances/model_gene_variances.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void compute_variances_dense_column(

tatami::parallelize([&](int thread, Index_ start, Index_ length) -> void {
std::vector<Value_> buffer(length);
auto ext = tatami::consecutive_extractor<false>(&mat, false, 0, NC, start, length);
auto ext = tatami::consecutive_extractor<false>(&mat, false, static_cast<Index_>(0), NC, start, length);

std::vector<tatami_stats::LocalOutputBuffer<Stat_> > local_var_output;
local_var_output.reserve(nblocks);
Expand Down Expand Up @@ -344,7 +344,7 @@ void compute_variances_sparse_column(
std::vector<Index_> ibuffer(length);
tatami::Options opt;
opt.sparse_ordered_index = false;
auto ext = tatami::consecutive_extractor<true>(&mat, false, 0, NC, start, length, opt);
auto ext = tatami::consecutive_extractor<true>(&mat, false, static_cast<Index_>(0), NC, start, length, opt);

std::vector<tatami_stats::LocalOutputBuffer<Stat_> > local_var_output;
local_var_output.reserve(nblocks);
Expand Down Expand Up @@ -505,19 +505,19 @@ void model_gene_variances_blocked(
tmp_weights.reserve(nblocks);

internal::compute_average(NR, buffers.per_block, block_size, block_weight,
/* min_size = */ 1, // skip blocks without enough cells to compute the mean.
/* min_size = */ static_cast<Index_>(1), // skip blocks without enough cells to compute the mean.
[](const auto& x) -> Stat_* { return x.means; }, tmp_pointers, tmp_weights, ave_means);

internal::compute_average(NR, buffers.per_block, block_size, block_weight,
/* min_size = */ 2, // skip blocks without enough cells to compute the variance.
/* min_size = */ static_cast<Index_>(2), // skip blocks without enough cells to compute the variance.
[](const auto& x) -> Stat_* { return x.variances; }, tmp_pointers, tmp_weights, ave_variances);

internal::compute_average(NR, buffers.per_block, block_size, block_weight,
/* min_size = */ 2, // ditto.
/* min_size = */ static_cast<Index_>(2), // ditto.
[](const auto& x) -> Stat_* { return x.fitted; }, tmp_pointers, tmp_weights, ave_fitted);

internal::compute_average(NR, buffers.per_block, block_size, block_weight,
/* min_size = */ 2, // ditto.
/* min_size = */ static_cast<Index_>(2), // ditto.
[](const auto& x) -> Stat_* { return x.residuals; }, tmp_pointers, tmp_weights, ave_residuals);
}
}
Expand Down

0 comments on commit c491ae7

Please sign in to comment.