1#ifndef GSDECON_COMPUTE_HPP
2#define GSDECON_COMPUTE_HPP
9#include "scran_pca/scran_pca.hpp"
10#include "sanisizer/sanisizer.hpp"
11#include "quickstats/quickstats.hpp"
47template<
typename Value_,
typename Index_,
typename Float_>
49 if (check_edge_cases(matrix, options.
rank, output)) {
55 scran_pca::SimplePcaOptions sopt;
56 sopt.number = options.
rank;
57 sopt.scale = options.
scale;
61 const auto res = scran_pca::simple_pca(matrix, sopt);
63 quickstats::PairwiseSumWorkspace<Float_> pswrk;
64 quickstats::PairwiseSumOptions psopt;
65 const Float_ shift = quickstats::pairwise_sum(res.center.size(), res.center.data(), pswrk, psopt) / matrix.
nrow();
66 std::fill_n(output.
scores, matrix.
ncol(), shift);
68 process_output(res.rotation, res.components, options.
scale, res.scale, output);
86template<
typename Float_ =
double,
typename Value_,
typename Index_>
90#ifdef SCRAN_QC_TEST_INIT
95#ifdef SCRAN_QC_TEST_INIT
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
irlba::Metrics compute(const tatami::Matrix< Value_, Index_ > &matrix, const Options &options, const Buffers< Float_ > &output)
Definition compute.hpp:48
Buffers for the results of compute() and compute_blocked().
Definition Results.hpp:20
Float_ * scores
Definition Results.hpp:25
Float_ * weights
Definition Results.hpp:31
Options for compute() and compute_blocked().
Definition Options.hpp:18
bool realize_matrix
Definition Options.hpp:64
int rank
Definition Options.hpp:34
irlba::Options< Eigen::VectorXd > irlba_options
Definition Options.hpp:69
int num_threads
Definition Options.hpp:58
bool scale
Definition Options.hpp:41
Results of compute() and compute_blocked().
Definition Results.hpp:39
std::vector< Float_ > weights
Definition Results.hpp:51
std::vector< Float_ > scores
Definition Results.hpp:44
irlba::Metrics metrics
Definition Results.hpp:56