Skip to content

Commit

Permalink
Fixes for lost template parameters in tatami functions/classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed May 21, 2024
1 parent c57c380 commit 47c4f73
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 166 deletions.
48 changes: 24 additions & 24 deletions tests/src/counts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ TEST(ComputingDimCounts, RowNaNCounts) {
}
}

auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> ref(NR);
for (size_t r = 0; r < NR; ++r) {
Expand Down Expand Up @@ -60,10 +60,10 @@ TEST(ComputingDimCounts, ColumNaNCount) {
}
}

auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> ref(NC);
for (size_t c = 0; c < NC; ++c) {
Expand Down Expand Up @@ -96,10 +96,10 @@ TEST(ComputingDimCounts, RowZeroCounts) {
size_t NR = 99, NC = 152;
auto dump = tatami_test::simulate_sparse_vector<double>(NR * NC, 0.1);

auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> ref(NR);
for (size_t r = 0; r < NR; ++r) {
Expand Down Expand Up @@ -135,10 +135,10 @@ TEST(ComputingDimVariances, RowZeroCountsWithNan) {
dump[r * NC] = std::numeric_limits<double>::quiet_NaN();
}

auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> ref(NR);
for (size_t r = 0; r < NR; ++r) {
Expand All @@ -157,10 +157,10 @@ TEST(ComputingDimCounts, ColumnZeroCounts) {
size_t NR = 79, NC = 62;
auto dump = tatami_test::simulate_sparse_vector<double>(NR * NC, 0.1);

auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> ref(NC);
for (size_t c = 0; c < NC; ++c) {
Expand Down Expand Up @@ -196,10 +196,10 @@ TEST(ComputingDimVariances, ColumnZeroCountsWithNan) {
dump[c] = std::numeric_limits<double>::quiet_NaN();
}

auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::unique_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, dump));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> ref(NC);
for (size_t c = 0; c < NC; ++c) {
Expand Down
40 changes: 20 additions & 20 deletions tests/src/grouped_medians.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ TEST(GroupedMedians, ByRow) {
// one side of zero, otherwise the structural zeros will dominate the
// median; in this case, we choose all-negative values.
auto simulated = tatami_test::simulate_sparse_vector<double>(NR * NC, 0.5, -10, -2);
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> cgroups(NC);
int ngroup = 3;
Expand Down Expand Up @@ -67,10 +67,10 @@ TEST(GroupedMedians, ByRowWithNan) {
simulated[r * NC + (r % NC)] = std::numeric_limits<double>::quiet_NaN();
}

auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> cgroups(NC);
int ngroup = 3;
Expand Down Expand Up @@ -101,10 +101,10 @@ TEST(GroupedMedians, ByColumn) {

// See above for why we use a density of 0.5. This time, we use all-positive values.
auto simulated = tatami_test::simulate_sparse_vector<double>(NR * NC, 0.5, 0.1, 2);
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> rgroups(NR);
int ngroup = 7;
Expand Down Expand Up @@ -149,10 +149,10 @@ TEST(GroupedMedians, ByColumnWithNan) {
simulated[(c % NR) * NC + c] = std::numeric_limits<double>::quiet_NaN();
}

auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> rgroups(NR);
int ngroup = 7;
Expand Down Expand Up @@ -200,10 +200,10 @@ TEST(GroupedMedians, DirtyOutputs) {

// See above for why we use a density of 0.5.
auto simulated = tatami_test::simulate_sparse_vector<double>(NR * NC, 0.5, -3, -0.5);
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

int ngroup = 5;
std::vector<int> grouping;
Expand Down
40 changes: 20 additions & 20 deletions tests/src/grouped_sums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ TEST(GroupedSums, ByRow) {
size_t NR = 99, NC = 155;

auto simulated = tatami_test::simulate_sparse_vector<double>(NR * NC, 0.2);
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> cgroups(NC);
int ngroup = 3;
Expand Down Expand Up @@ -64,10 +64,10 @@ TEST(GroupedSums, ByRowWithNan) {
simulated[r * NC + (r % NC)] = std::numeric_limits<double>::quiet_NaN();
}

auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> cgroups(NC);
int ngroup = 3;
Expand Down Expand Up @@ -97,10 +97,10 @@ TEST(GroupedSums, ByColumn) {
size_t NR = 56, NC = 179;

auto simulated = tatami_test::simulate_sparse_vector<double>(NR * NC, 0.25);
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> rgroups(NR);
int ngroup = 7;
Expand Down Expand Up @@ -145,10 +145,10 @@ TEST(GroupedSums, ByColumnWithNan) {
simulated[(c % NR) * NC + c] = std::numeric_limits<double>::quiet_NaN();
}

auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

std::vector<int> rgroups(NR);
int ngroup = 7;
Expand Down Expand Up @@ -195,10 +195,10 @@ TEST(GroupedSums, DirtyOutputs) {
size_t NR = 56, NC = 179;

auto simulated = tatami_test::simulate_sparse_vector<double>(NR * NC, 0.3);
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense<false>(dense_row.get());
auto sparse_row = tatami::convert_to_compressed_sparse<true>(dense_row.get());
auto sparse_column = tatami::convert_to_compressed_sparse<false>(dense_row.get());
auto dense_row = std::shared_ptr<tatami::NumericMatrix>(new tatami::DenseRowMatrix<double, int>(NR, NC, std::move(simulated)));
auto dense_column = tatami::convert_to_dense(dense_row.get(), false);
auto sparse_row = tatami::convert_to_compressed_sparse(dense_row.get(), true);
auto sparse_column = tatami::convert_to_compressed_sparse(dense_row.get(), false);

int ngroup = 5;
std::vector<int> grouping;
Expand Down
Loading

0 comments on commit 47c4f73

Please sign in to comment.