1#ifndef GSDECON_BLOCKED_HPP
2#define GSDECON_BLOCKED_HPP
48template<
typename Value_,
typename Index_,
typename Block_,
typename Float_>
50 if (internal::check_edge_cases(matrix, options.
rank, output)) {
67 static_assert(!Eigen::MatrixXd::IsRowMajor);
68 const double* cptr = res.center.data();
69 size_t nfeat = res.center.cols();
70 size_t nblocks = res.center.rows();
71 std::vector<double> block_means(nblocks);
73 for (
size_t f = 0; f < nfeat; ++f, cptr += nblocks) {
77 for (
size_t b = 0; b < nblocks; ++b) {
78 block_means[b] += cptr[b];
82 for (
auto& b : block_means) {
86 size_t ncells = res.components.cols();
90 for (
size_t c = 0; c < ncells; ++c) {
91 output.
scores[c] = block_means[block[c]];
93 internal::process_output(res.rotation, res.components, options.
scale, res.scale, output);
114template<
typename Float_ =
double,
typename Value_,
typename Index_,
typename Block_>
Classes for storing the results.
virtual Index_ ncol() const=0
virtual Index_ nrow() const=0
Gene set scoring with gsdecon.
Definition blocked.hpp:21
void compute_blocked(const tatami::Matrix< Value_, Index_ > &matrix, const Block_ *block, const Options &options, const Buffers< Float_ > &output)
Definition blocked.hpp:49
void blocked_pca(const tatami::Matrix< Value_, Index_ > &mat, const Block_ *block, const BlockedPcaOptions &options, BlockedPcaResults< EigenMatrix_, EigenVector_ > &output)
Buffers for the results of compute() and compute_blocked().
Definition Results.hpp:18
Float_ * scores
Definition Results.hpp:23
Float_ * weights
Definition Results.hpp:29
Options for compute() and compute_blocked().
Definition Options.hpp:17
bool realize_matrix
Definition Options.hpp:61
int rank
Definition Options.hpp:31
scran_blocks::WeightPolicy block_weight_policy
Definition Options.hpp:42
scran_blocks::VariableWeightParameters variable_block_weight_parameters
Definition Options.hpp:48
int num_threads
Definition Options.hpp:55
irlba::Options irlba_options
Definition Options.hpp:66
bool scale
Definition Options.hpp:37
Results of compute() and compute_blocked().
Definition Results.hpp:37
std::vector< double > scores
Definition Results.hpp:42
std::vector< double > weights
Definition Results.hpp:49
scran_blocks::VariableWeightParameters variable_block_weight_parameters
irlba::Options irlba_options
scran_blocks::WeightPolicy block_weight_policy