-
Notifications
You must be signed in to change notification settings - Fork 82
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
[MISC] Add alphabet type template to fm_index #1222
Conversation
I am against |
template<Semialphabet alph_t, text_layout text_layout_mode, detail::SdslIndex sdsl_index_type_ = default_sdsl_index_type>
fm_index{}; Then? (cerealising in will then be But the question with how to deprecate still remains. (probably. If just But we can discuss tomorrow. |
Yes! We have so many things now that are changing, I don't think it's feasible to provide deprecation-marked update-paths at this point. |
9a989c1
to
97fda61
Compare
@h-2 Like this? |
7af20e3
to
2b72bb9
Compare
04abc72
to
9f4d21f
Compare
9f4d21f
to
0c63c4d
Compare
Codecov Report
@@ Coverage Diff @@
## master #1222 +/- ##
=========================================
Coverage ? 96.83%
=========================================
Files ? 217
Lines ? 8654
Branches ? 0
=========================================
Hits ? 8380
Misses ? 274
Partials ? 0
Continue to review full report at Codecov.
|
9f27fd2
to
f10e821
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 small change and I'll approve
f10e821
to
9b63a02
Compare
9b63a02
to
0bc3afb
Compare
CHANGELOG.md
Outdated
|
||
* **Changed class signature of (bi_)fm_index:** | ||
All code that relies on automatic template deduction will be unaffected. In case you specified the template parameters | ||
of an `seqan3::fm_index` or `seqan3::bi_fm_index` you will need to add the alphabet type as first parameter and pass a |
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.
of an `seqan3::fm_index` or `seqan3::bi_fm_index` you will need to add the alphabet type as first parameter and pass a | |
of a `seqan3::fm_index` or `seqan3::bi_fm_index` you will need to add the alphabet type as first parameter and pass a |
@@ -153,7 +143,7 @@ class bi_fm_index | |||
template <std::ranges::Range text_t> | |||
bi_fm_index(text_t && text) |
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.
You should now enforce that the text_t's alphabet type is convertible to the alpahbet type of the index, or not?
//!\endcond | ||
//!\cond | ||
requires text_layout_mode == text_layout::single | ||
//!\endcond | ||
void construct(text_t && text) |
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.
make this private or move into constructor
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.
also document this in the changelog
@@ -406,14 +408,16 @@ class bi_fm_index_cursor | |||
* No-throw guarantee. | |||
*/ | |||
template <Alphabet char_t> | |||
//!\cond | |||
requires ImplicitlyConvertibleTo<char_t, typename index_t::char_type> |
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 should use std::Convertible
instead of "ImplicitlyConvertibleTo"
@@ -271,10 +252,10 @@ class fm_index | |||
* No guarantee. \if DEV \todo Ensure strong exception guarantee. \endif | |||
*/ | |||
template <std::ranges::Range text_t> | |||
//!\cond | |||
requires text_layout_mode == text_layout::single | |||
//!\endcond | |||
void construct(text_t && text) |
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.
same comments as above (make private, constrain alphabet)
@@ -505,10 +485,25 @@ class fm_index | |||
text_begin_ss.set_vector(&text_begin); | |||
archive(text_begin_rs); | |||
text_begin_rs.set_vector(&text_begin); | |||
|
|||
auto sigma = alphabet_size<alphabet_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.
above it is marked constexpr...
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.
[sic]
if (sigma != alphabet_size<alphabet_t>) | ||
{ | ||
throw std::logic_error{"The fm_index was built over an alphabet of size " + std::to_string(sigma) + | ||
" but it is being read into a fm_index with an alphabet of size " + |
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 it is being read into a fm_index with an alphabet of size " + | |
" but it is being read into an fm_index with an alphabet of size " + |
{ | ||
throw std::logic_error{std::string{"The fm_index was built over a "} + | ||
(tmp ? "text collection" : "single text") + | ||
" but it is being read into a fm_index expecting a " + |
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 it is being read into a fm_index expecting a " + | |
" but it is being read into an fm_index expecting a " + |
@@ -268,10 +262,12 @@ class fm_index_cursor | |||
* No-throw guarantee. | |||
*/ | |||
template <Alphabet char_t> | |||
//!\cond | |||
requires ImplicitlyConvertibleTo<char_t, typename index_t::char_type> |
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.
See above. Also I don't think you even need to require alphabet. Convertbility is all you need,
0bc3afb
to
83029f8
Compare
83029f8
to
6a06dfe
Compare
@@ -267,11 +261,13 @@ class fm_index_cursor | |||
* | |||
* No-throw guarantee. | |||
*/ | |||
template <Alphabet char_t> | |||
template <typename char_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.
template <typename char_t> | |
template <std::ConvertibleTo<typename index_t::char_type> char_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.
We usually prefer doing statis_asserts, no?
6a06dfe
to
179d26b
Compare
Partially reverts #1042