Skip to content
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] Use correct comparison. #3188

Closed
wants to merge 1 commit into from
Closed

Conversation

MitraDarja
Copy link
Contributor

I think, we need to use "<=" as we use everywhere else ´std::less_equal´, but I could not think about an easy example where we could test the difference.

The second change I added because I am running with minions in that static assert and as I implemented the minimiser and don't really know why the statis assert is there to begin with, I was hoping, we could just delete it? :)

@vercel
Copy link

vercel bot commented Aug 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
seqan3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 17, 2023 1:52pm

@seqan-actions seqan-actions added lint [INTERNAL] signal for linting and removed lint [INTERNAL] signal for linting labels Aug 17, 2023
@eseiler
Copy link
Member

eseiler commented Aug 17, 2023

The <= would cause a new minimiser to be reported, even though the value didn't change:

#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/core/debug_stream.hpp>
#include <seqan3/search/views/kmer_hash.hpp>
#include <seqan3/search/views/minimiser.hpp>

using namespace seqan3::literals;

int main()
{
    std::vector<seqan3::dna4> text{"AAAAAAAAAAAAAAA"_dna4};

    auto hashes = text | seqan3::views::kmer_hash(seqan3::shape{seqan3::ungapped{3}});
    auto minimiser = hashes | seqan3::views::minimiser(4);
    seqan3::debug_stream << minimiser << '\n';
    // with <= [0,0,0,0,0,0,0,0,0,0]
    // with <  [0,0,0]
}

The static assert would help with

#include <seqan3/core/debug_stream.hpp>
#include <seqan3/search/views/minimiser.hpp>

int main()
{
    auto minimiser = std::vector<uint64_t>(10) | seqan3::views::minimiser(3);
    seqan3::debug_stream << minimiser << '\n';
}

Though starting with a new STL version, this is allowed (GCC12 and above).
GCC11 would currently work without the static_assert, because we are missing a std::forward, i.e. std::forward<urng1_t>(urange1)

return minimiser_view{urange1, window_size};

To make it then work with GCC11, we would need to replace viewable_range and views::all with the equivalents from contrib/std, which would provide the new implementation for GCC<12.

@MitraDarja MitraDarja closed this Aug 24, 2023
@eseiler eseiler removed their request for review October 9, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants