1#ifndef TATAMI_MAKE_DELAYED_SUBSET_HPP
2#define TATAMI_MAKE_DELAYED_SUBSET_HPP
39template<
typename Value_,
typename Index_,
class SubsetStorage_>
41 const auto nsub = subset.size();
42 typedef I<
decltype(nsub)> Subset;
44 bool is_unsorted =
false;
45 for (Subset i = 1; i < nsub; ++i) {
46 if (subset[i] < subset[i-1]) {
53 bool has_duplicates =
false;
54 for (Subset i = 1; i < nsub; ++i) {
55 if (subset[i] == subset[i-1]) {
56 has_duplicates =
true;
61 if (!has_duplicates) {
62 bool consecutive =
true;
63 for (Subset i = 1; i < nsub; ++i) {
64 if (subset[i] > subset[i-1] + 1) {
71 const auto start = (nsub ? subset[0] : 0);
72 return std::shared_ptr<Matrix<Value_, Index_> >(
76 return std::shared_ptr<Matrix<Value_, Index_> >(
81 return std::shared_ptr<Matrix<Value_, Index_> >(
87 bool has_duplicates =
false;
89 for (Subset i = 0; i < nsub; ++i) {
90 auto& found = accumulated[subset[i]];
92 has_duplicates =
true;
99 if (!has_duplicates) {
100 return std::shared_ptr<Matrix<Value_, Index_> >(
104 return std::shared_ptr<Matrix<Value_, Index_> >(
113template<
typename Value_,
typename Index_,
class SubsetStorage_>
114std::shared_ptr<Matrix<Value_, Index_> >
make_DelayedSubset(std::shared_ptr<Matrix<Value_, Index_> > matrix, SubsetStorage_ subset,
const bool by_row) {
125template<
int margin_,
typename Value_,
typename Index_,
class SubsetStorage_>
126std::shared_ptr<Matrix<Value_, Index_> >
make_DelayedSubset(std::shared_ptr<
const Matrix<Value_, Index_> > matrix, SubsetStorage_ subset) {
130template<
int margin_,
typename Value_,
typename Index_,
class SubsetStorage_>
131std::shared_ptr<Matrix<Value_, Index_> >
make_DelayedSubset(std::shared_ptr<Matrix<Value_, Index_> > matrix, SubsetStorage_ subset) {
Defines a tatami-compatible array view.
Delayed subsetting to a single contiguous block.
Delayed subsetting with sorted and unique row/column indices.
Delayed subsetting with sorted row/column indices.
Delayed subsetting by unique row/column indices.
Delayed subsetting by rows or columns.
Delayed subsetting to a contiguous block.
Definition DelayedSubsetBlock.hpp:241
Delayed subsetting of a matrix with sorted, unique indices.
Definition DelayedSubsetSortedUnique.hpp:164
Delayed subsetting of a matrix with sorted indices.
Definition DelayedSubsetSorted.hpp:413
Delayed subsetting of a matrix with unique indices.
Definition DelayedSubsetUnique.hpp:298
Delayed subsetting of a matrix with general indices.
Definition DelayedSubset.hpp:438
Virtual class for a matrix.
Definition Matrix.hpp:59
Copy data from one buffer to another.
Flexible representations for matrix data.
Definition Extractor.hpp:15
Container_ create_container_of_Index_size(const Index_ x, Args_ &&... args)
Definition Index_to_container.hpp:73
std::shared_ptr< Matrix< Value_, Index_ > > make_DelayedSubset(std::shared_ptr< const Matrix< Value_, Index_ > > matrix, SubsetStorage_ subset, const bool by_row)
Definition make_DelayedSubset.hpp:40