SecreC 2 language  2.8.0 (2023.09)
Language and standard library reference
Functions

Functions

template<domain D :shared3p >
D uint kl_strLevenshtein (D xor_uint8[[1]] s, D xor_uint8[[1]] t)
 

Detailed Description

Function for finding the edit distance of two input strings.

Note
D - shared3p protection domain
Supported types - xor_uint8
this is the classic dynamic programming implementation of Levenshtein distance that's simply tuned to minimize the number of the "min" syscalls. Naive approach would invoke "min" O(n*m) times for strings of length n and m. The following implementation invokes the syscall O(n+m) times by computing the table diagonal at a time.
Parameters
s,t- input string vectors of supported type
Returns
returns the edit distance of the two input strings
Leakage
None

Function Documentation

◆ kl_strLevenshtein()

D uint kl_strLevenshtein ( D xor_uint8[[1]]  s,
D xor_uint8[[1]]  t 
)