38namespace BayesicSpace {
42 struct DiffElementPair;
44 class SimilarityMatrix;
77 void chunkedAppend(std::vector<uint64_t> &source, std::vector<uint64_t> &target);
127 [[gnu::warn_unused_result]] static
size_t elementSize() noexcept {
return sizeof(uint64_t);};
132 [[gnu::warn_unused_result]]
size_t objectSize() const noexcept {
139 [[gnu::warn_unused_result]]
size_t nElements() const noexcept {
return matrix_.size();};
168 void save(
const std::string &outFileName,
const size_t &nThreads,
const std::string &locusNameFile =
"")
const;
176 std::vector<uint64_t> matrix_;
184 static const std::array<float, 256> floatLookUp_;
190 static const std::array<const char*, 256> stringLookUp_;
192 static const uint64_t maxIdxBitfield_;
197 static const uint32_t maxRowColValue_;
199 static const uint64_t valueMask_;
201 static const uint64_t maxValueIdx_;
203 static const uint64_t valueSize_;
215 [[gnu::warn_unused_result]]
static std::string stringify_(std::vector<uint64_t>::const_iterator start, std::vector<uint64_t>::const_iterator end,
216 const std::vector<std::string> &locusNames);
Similarity matrix.
Definition similarityMatrix.hpp:94
size_t objectSize() const noexcept
Object size in bytes.
Definition similarityMatrix.hpp:132
static size_t elementSize() noexcept
Matrix element size.
Definition similarityMatrix.hpp:127
void merge(SimilarityMatrix &toMerge)
Merge two matrices.
size_t nElements() const noexcept
Number of elements in the matrix.
Definition similarityMatrix.hpp:139
void insert(const RowColIdx &rowColPair, const JaccardPair &jaccardCounts)
Insert a value (updating the index)
SimilarityMatrix() noexcept=default
Default constructor.
void save(const std::string &outFileName, const size_t &nThreads, const std::string &locusNameFile="") const
Save to file.
void chunkedAppend(std::vector< uint64_t > &source, std::vector< uint64_t > &target)
Append one vector to another by chunks.
RowColIdx recoverRCindexes(const uint64_t &vecIdx) noexcept
Recover row and column indexes.
Full vectorized index and similarity value.
Definition similarityMatrix.hpp:54
uint8_t quantSimilarity
Quantized similarity value.
Definition similarityMatrix.hpp:58
uint64_t fullIdx
Full index of a vectorized triangular matrix.
Definition similarityMatrix.hpp:56
Pair of integers to calculate Jaccard similarity.
Definition similarityMatrix.hpp:61
uint64_t nUnion
Union size.
Definition similarityMatrix.hpp:65
uint64_t nIntersect
Intersection size.
Definition similarityMatrix.hpp:63
Row and column index pair.
Definition similarityMatrix.hpp:47
uint32_t jCol
Column index.
Definition similarityMatrix.hpp:51
uint32_t iRow
Row index.
Definition similarityMatrix.hpp:49