-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- refactor public/implementation types into separate headers
- throw on overflow of distance integer type - use uint8 type for distance counts
- Loading branch information
Showing
12 changed files
with
83 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef _HAMMING_TYPES_HH | ||
#define _HAMMING_TYPES_HH | ||
|
||
#include<array> | ||
#include<cstdint> | ||
#include<string> | ||
#include<vector> | ||
|
||
namespace hamming { | ||
|
||
using DistIntType = uint8_t; | ||
|
||
struct DataSet | ||
{ | ||
DataSet(std::vector<std::string>&, bool clear_input_data = false); | ||
DataSet(const std::string&); | ||
void dump(const std::string&); | ||
int operator[](const std::array<std::size_t, 2>&) const; | ||
|
||
std::size_t nsamples; | ||
std::vector<DistIntType> result; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "distance_avx512.hh" | ||
#include "hamming_impl.hh" | ||
#include <immintrin.h> | ||
|
||
namespace hamming { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "distance_sse2.hh" | ||
#include "hamming_impl.hh" | ||
#include <immintrin.h> | ||
|
||
namespace hamming { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef _HAMMING_IMPL_TYPES_HH | ||
#define _HAMMING_IMPL_TYPES_HH | ||
|
||
#include<array> | ||
#include<cstdint> | ||
|
||
namespace hamming { | ||
|
||
// 4-bit representation of gene: | ||
using GeneBlock = std::uint8_t; | ||
using SparseData = std::vector<std::size_t>; | ||
constexpr std::size_t n_bits_per_gene{4}; | ||
constexpr GeneBlock mask_gene0{0x0f}; | ||
constexpr GeneBlock mask_gene1{0xf0}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters