Skip to content

Commit

Permalink
Finished the conversion of the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed May 17, 2024
1 parent 122339e commit d09423e
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 271 deletions.
3 changes: 2 additions & 1 deletion include/tatami/subset/DelayedSubsetBlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class AcrossDense : public DenseExtractor<oracle_, Value_, Index_> {
};

template<bool oracle_, typename Value_, typename Index_>
struct AcrossSparse : public SparseExtractor<oracle_, Value_, Index_> {
class AcrossSparse : public SparseExtractor<oracle_, Value_, Index_> {
public:
template<typename ... Args_>
AcrossSparse(const Matrix<Value_, Index_>* matrix, Index_ subset_start, bool row, MaybeOracle<oracle_, Index_> oracle, Args_&& ... args) : my_shift(subset_start) {
if constexpr(oracle_) {
Expand Down
19 changes: 11 additions & 8 deletions include/tatami/subset/DelayedSubsetSorted.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ DenseParallelResults<Index_> format_dense_parallel(const SubsetStorage_& indices
}

template<bool oracle_, typename Value_, typename Index_>
class ParallelDense : DenseExtractor<oracle_, Value_, Index_> {
class ParallelDense : public DenseExtractor<oracle_, Value_, Index_> {
public:
template<class SubsetStorage_>
ParallelDense(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, const Options& opt) {
Expand Down Expand Up @@ -201,7 +201,7 @@ class ParallelSparseCore {
}

my_ext = new_extractor<true, oracle_>(matrix, row, std::move(oracle), std::move(processed.collapsed), opt);
my_expansion = std::move(processed.my_expansion);
my_expansion = std::move(processed.expansion);
}

template<class ToIndex_>
Expand Down Expand Up @@ -278,10 +278,11 @@ class ParallelFullSparse : public SparseExtractor<oracle_, Value_, Index_> {
};

template<bool oracle_, typename Value_, typename Index_>
struct ParallelBlockSparse : public SparseExtractor<oracle_, Value_, Index_>, public ParallelSparseBase<oracle_, Value_, Index_> {
class ParallelBlockSparse : public SparseExtractor<oracle_, Value_, Index_> {
public:
template<class SubsetStorage_>
ParallelBlockSparse(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, Index_ block_start, Index_ block_length, const Options& opt) :
my_core(matrix, subset, block_length, row, std::move(oracle), opt, [&](Index_ i) -> Index_ { return i + block_start; });
my_core(matrix, subset, block_length, row, std::move(oracle), opt, [&](Index_ i) -> Index_ { return i + block_start; }),
my_block_start(block_start)
{}

Expand All @@ -295,10 +296,11 @@ struct ParallelBlockSparse : public SparseExtractor<oracle_, Value_, Index_>, pu
};

template<bool oracle_, typename Value_, typename Index_>
struct ParallelIndexSparse : public SparseExtractor<oracle_, Value_, Index_>, public ParallelSparseBase<oracle_, Value_, Index_> {
class ParallelIndexSparse : public SparseExtractor<oracle_, Value_, Index_> {
public:
template<class SubsetStorage_>
ParallelIndexSparse(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, VectorPtr<Index_> sub_ptr, const Options& opt) :
core(matrix, subset, indices->size(), row, std::move(oracle), opt, [&](Index_ i) -> Index_ { return indices_ptr->operator[](i); });
ParallelIndexSparse(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, VectorPtr<Index_> indices_ptr, const Options& opt) :
my_core(matrix, subset, indices_ptr->size(), row, std::move(oracle), opt, [&](Index_ i) -> Index_ { return indices_ptr->operator[](i); }),
my_indices_ptr(std::move(indices_ptr))
{}

Expand All @@ -308,6 +310,7 @@ struct ParallelIndexSparse : public SparseExtractor<oracle_, Value_, Index_>, pu
}

private:
ParallelSparseCore<oracle_, Value_, Index_> my_core;
VectorPtr<Index_> my_indices_ptr;
};

Expand Down Expand Up @@ -339,7 +342,7 @@ class DelayedSubsetSorted : public Matrix<Value_, Index_> {
* @param check Whether to check `idx` for sorted values.
*/
DelayedSubsetSorted(std::shared_ptr<const Matrix<Value_, Index_> > matrix, SubsetStorage_ subset, bool row, bool check = true) :
my_matrix(std::move(matrix)), my_subset(std::move(subset)), by_row(row)
my_matrix(std::move(matrix)), my_subset(std::move(subset)), my_row(row)
{
if (check) {
for (Index_ i = 1, end = my_subset.size(); i < end; ++i) {
Expand Down
Loading

0 comments on commit d09423e

Please sign in to comment.