1#ifndef GSDECON_COMPUTE_HPP
2#define GSDECON_COMPUTE_HPP
9#include "scran_pca/scran_pca.hpp"
10#include "sanisizer/sanisizer.hpp"
44template<
typename Value_,
typename Index_,
typename Float_>
46 if (internal::check_edge_cases(matrix, options.
rank, output)) {
50 scran_pca::SimplePcaOptions sopt;
51 sopt.number = options.
rank;
52 sopt.scale = options.
scale;
56 const auto res = scran_pca::simple_pca(matrix, sopt);
58 const Float_ shift = std::accumulate(res.center.begin(), res.center.end(),
static_cast<Float_
>(0)) / matrix.
nrow();
59 std::fill_n(output.
scores, matrix.
ncol(), shift);
60 internal::process_output(res.rotation, res.components, options.
scale, res.scale, output);
76template<
typename Float_ =
double,
typename Value_,
typename Index_>
80#ifdef SCRAN_QC_TEST_INIT
85#ifdef SCRAN_QC_TEST_INIT
94 compute(matrix, options, buffers);
Options for the gsdecon algorithm.
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(const tatami::Matrix< Value_, Index_ > &matrix, const Options &options, const Buffers< Float_ > &output)
Definition compute.hpp:45
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:63
int rank
Definition Options.hpp:33
int num_threads
Definition Options.hpp:57
irlba::Options irlba_options
Definition Options.hpp:68
bool scale
Definition Options.hpp:40
Results of compute() and compute_blocked().
Definition Results.hpp:37
std::vector< Float_ > weights
Definition Results.hpp:49
std::vector< Float_ > scores
Definition Results.hpp:42