Typesetting math: 100%
Chemical Data Processing Library C++ API - Version 1.3.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
CDPL::Descr::HammingDistance Class Reference

Functor class for calculating the Hamming Distance [WHAM, CITB] between bitsets. More...

#include <SimilarityFunctors.hpp>

Public Member Functions

std::size_t operator() (const Util::BitSet &bs1, const Util::BitSet &bs2) const
 Calculates the Hamming Distance [WHAM, CITB] between the bitsets bs1 and bs2. More...
 

Detailed Description

Functor class for calculating the Hamming Distance [WHAM, CITB] between bitsets.

Member Function Documentation

◆ operator()()

std::size_t CDPL::Descr::HammingDistance::operator() ( const Util::BitSet bs1,
const Util::BitSet bs2 
) const
inline

Calculates the Hamming Distance [WHAM, CITB] between the bitsets bs1 and bs2.

The Hamming Distance is calculated by:

where is the number of bits that are set in the first bitset but not in the second bitset and is the number of bits that are set in the second bitset but not in the first one.

If the specified bitsets bs1 and bs2 are of different size, missing bits at the end of the smaller bitset are assumed to be zero.

Parameters
bs1The first bitset.
bs2The second bitset.
Returns
The calculated distance.

The documentation for this class was generated from the following file: