Skip to content

Commit

Permalink
More fixes to get it to compile.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed May 21, 2024
1 parent af644cb commit db2ba1b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions tests/src/IntegratedBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ TEST_P(IntegratedBuilderBasicTest, SimpleCombine) {
// Checking the ranked values.
std::vector<int> offsets(nlabels);
auto wrk = matrices[r]->dense_column();
std::vector<double> buffer(matrices[r]->ncol());
std::vector<double> buffer(matrices[r]->nrow());

for (size_t s = 0; s < nsamples; ++s) {
int lab = labels[r][s];
Expand Down Expand Up @@ -289,7 +289,7 @@ TEST_P(IntegratedBuilderMoreTest, IntersectedCombine) {
// Checking rankings for consistency with the availabilities.
std::vector<int> offsets(nlabels);
auto wrk = matrices[r]->dense_column();
std::vector<double> buffer(matrices[r]->ncol());
std::vector<double> buffer(matrices[r]->nrow());

for (size_t s = 0; s < nsamples; ++s) {
int lab = labels[r][s];
Expand Down
18 changes: 9 additions & 9 deletions tests/src/fine_tune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ TEST(FineTuneTest, Basic) {

// Check early exit conditions.
{
std::vector<double> buffer(refs->ncol());
std::vector<double> buffer(ngenes);
auto vec = refs->dense_column()->fetch(0, buffer.data()); // doesn't really matter what we pick here.
auto ranked = fill_ranks(refs->ncol(), vec);
auto ranked = fill_ranks(ngenes, vec);

std::vector<double> scores { 0.2, 0.5, 0.1 };
auto output = ft.run(ranked, references, markers, scores, 0.8, 0.05);
Expand All @@ -105,9 +105,9 @@ TEST(FineTuneTest, Basic) {
// Check edge case when there is only a single label,
// based on the length of 'scores'.
{
std::vector<double> buffer(refs->ncol());
std::vector<double> buffer(ngenes);
auto vec = refs->dense_column()->fetch(1, buffer.data()); // doesn't really matter which one we pick.
auto ranked = fill_ranks(refs->ncol(), vec);
auto ranked = fill_ranks(ngenes, vec);

std::vector<double> scores { 0.5 };
auto output = ft.run(ranked, references, markers, scores, 0.8, 0.05);
Expand All @@ -119,10 +119,10 @@ TEST(FineTuneTest, Basic) {
// is identical to one of the references. We set the quantile to 1 to
// guarantee a score of 1 from a correlation of 1.
auto wrk = refs->dense_column();
std::vector<double> buffer(refs->ncol());
std::vector<double> buffer(ngenes);
for (size_t r = 0; r < nrefs; ++r) {
auto vec = wrk->fetch(r, buffer.data());
auto ranked = fill_ranks(refs->ncol(), buffer.data());
auto ranked = fill_ranks(ngenes, vec);

// Setting the template parameter test = true to force it to do
// calculations; otherwise it would exit early with the top score.
Expand Down Expand Up @@ -168,7 +168,7 @@ TEST(FineTuneTest, Comparison) {
);

auto wrk = mat->dense_column(subset);
std::vector<double> buffer(refs->ncol());
std::vector<double> buffer(subset.size());
for (size_t c = 0; c < mat->ncol(); ++c) {
auto vec = wrk->fetch(c, buffer.data());
auto ranked = fill_ranks(refs->ncol(), vec);
Expand Down Expand Up @@ -224,10 +224,10 @@ TEST(FineTuneTest, Diagonal) {
singlepp::FineTuner ft;

auto wrk = refs->dense_column();
std::vector<double> buffer(refs->ncol());
std::vector<double> buffer(ngenes);
for (size_t r = 0; r < nrefs; ++r) {
auto vec = wrk->fetch(r, buffer.data());
auto ranked = fill_ranks(refs->ncol(), vec);
auto ranked = fill_ranks(ngenes, vec);
std::vector<double> scores { 0.49, 0.5, 0.48 };
auto output = ft.run<true>(ranked, references, markers, scores, 1, 0.05);

Expand Down
4 changes: 2 additions & 2 deletions tests/src/naive_method.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ template<class RefMatrix>
double naive_score(const std::vector<double>& scaled_test, const std::vector<int>& in_label, const RefMatrix& refs, const std::vector<int>& subset, double quantile) {
std::vector<double> correlations;
auto wrk = refs->dense_column(subset);
std::vector<double> buffer(refs->nrow());
std::vector<double> buffer(subset.size());

for (auto l : in_label) {
auto col = wrk->fetch(l, buffer.data());
Expand All @@ -37,7 +37,7 @@ auto naive_method(size_t nlabels, const Labels& labels, const RefMatrix& refs, c

auto by_labels = split_by_label(nlabels, labels);
auto wrk = mat->dense_column(subset);
std::vector<typename Matrix::element_type::value_type> buffer(mat->nrow());
std::vector<double> buffer(subset.size());

for (size_t c = 0; c < mat->ncol(); ++c) {
auto col = wrk->fetch(c, buffer.data());
Expand Down

0 comments on commit db2ba1b

Please sign in to comment.