-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] shape, shape_iterator and view::kmer_hash #946
Conversation
Codecov Report
@@ Coverage Diff @@
## master #946 +/- ##
==========================================
- Coverage 96.86% 96.85% -0.01%
==========================================
Files 217 218 +1
Lines 8664 8746 +82
==========================================
+ Hits 8392 8471 +79
- Misses 272 275 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do the performance tests say?
*/ | ||
template <typename... t> | ||
//!\cond | ||
requires sizeof...(t) >= 2 && sizeof...(t) <= 32 && (std::Integral<t> && ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requires sizeof...(t) >= 2 && sizeof...(t) <= 32 && (std::Integral<t> && ...) | |
requires sizeof...(t) >= 2 && sizeof...(t) <= 32 && (std::Same<t, bool> && ...) |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but using shape s{1, 0, 1, 1} deduces the type to int
, hence the check fails. I could do ImplicitlyConvertibleTo but nearly everything is convertible to bool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I see.. well then it is fine I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then please add an assert that every value is either 1 or 0!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively or additionally you might want to add support for initialising from a binary literal, e.g. 0b1101
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, the binary literal thing will conflict with the length constructor....
Edit: It's not really bp/s what I'm measuring, but it's comparable within one test case (e.g. all gapped ones are comparable with the other gapped ones)/
|
39cdbef
to
50cc5aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing: We usually out all public members first and then all private members. You have something like public, private, public in the shape_iterator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general the shape iterator will go into a view right?
Then it should probably inherit from inherited_iterator_base
? I think this will e.g. already take care that your iterator is comparable to the inherited iterator (you tempplate argument)
I'll have a look at the |
ad567cf
to
bf97b33
Compare
I didn't know where to put the old
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever need the shape oterator without the view?
/*!\brief Move the iterator to a given position and return the corresponding hash value. | ||
* \attention This function is only avaible if it_t models std::RandomAccessIterator. | ||
*/ | ||
value_type operator[](std::make_unsigned_t<difference_type> const n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value_type operator[](std::make_unsigned_t<difference_type> const n) | |
value_type operator[](size_type const n) |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably yes, but it depends on the passed iterator type; so I'd leave it as is?
c0fc1e5
to
0beae3a
Compare
623aa02
to
fb16fe6
Compare
c455d8c
to
95ab0c2
Compare
@h-2 I switched to the |
a27c9bb
to
c46cdbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are getting there!
|
||
// --------------------------------------------------------------------------------------------------------------------- | ||
// kmer_hash_fn (adaptor definition) | ||
// --------------------------------------------------------------------------------------------------------------------- | ||
|
||
//![adaptor_def] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved?
using iterator = shape_iterator<urng_t>; | ||
//!\brief The const_iterator type of this view. | ||
using const_iterator = shape_iterator<urng_t const>; | ||
//!\} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong indention
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you use these at all? You have return type auto below...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto begin()
{
return iterator{...};
}
I changed it to
iterator begin()
{
return {...};
}
|
||
// --------------------------------------------------------------------------------------------------------------------- | ||
// kmer_hash_fn (adaptor definition) | ||
// --------------------------------------------------------------------------------------------------------------------- | ||
|
||
//![adaptor_def] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The place where this is included, reads :
This is the full proto-adaptor, first look at the second member function: it handles range and argument input and returns a range (in other cases this would delegate to the view's constructor if you have your own view type declared).
This needs to be adapted, or not?
ecae70e
to
d14b87e
Compare
Supersedes #922