Skip to content

addaleax/levenshtein-sse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

levenshtein-sse

Build Status

Really, really fast Levenshtein distance in C++, header-only implementation.

Usage

#include "levenshtein-sse.hpp"
using levenshteinSSE::levenshtein;
template<typename Iterator1, typename Iterator2>
std::size_t levenshtein(Iterator1 a, Iterator1 aEnd, Iterator2 b, Iterator2 bEnd);

Compute the Levenshtein distances of [a, aEnd) and [b, bEnd). Both types of iterators need to be bidirectional, e.g. fulfill the requirements of BidirectionalIterator, but may just be pointers.

For pointers to types where SIMD instructions make sense, these are used when available.

template<typename Container1, typename Container2>
std::size_t levenshtein(const Container1& a, const Container2& b);

Compute the Levenshtein distances of a and b. Both containers need to support bidirectional start and end iterators (via std::begin() and std::end()).

If both containers provide .data() and .size(), these are used to get pointers to the start and past-end elements. This holds true for std::string, std::vector, std::array and possibly more, but if you want to use this with custom container types, bear in mind that this also means that the available memory area needs to be contiguous.

License

MIT

About

SIMD-enabled Levenshtein distance in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published