From 321d8132c4309fb84012547880db8c7430c3d622 Mon Sep 17 00:00:00 2001 From: Abd Errahmane Kiouche <abd-errahmane.kiouche@etu.univ-lyon1.fr> Date: Fri, 15 Dec 2023 10:39:43 +0000 Subject: [PATCH] Upload New File --- (p,t)_sparsification/hash.h | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 (p,t)_sparsification/hash.h diff --git a/(p,t)_sparsification/hash.h b/(p,t)_sparsification/hash.h new file mode 100644 index 0000000..3394fd2 --- /dev/null +++ b/(p,t)_sparsification/hash.h @@ -0,0 +1,43 @@ +// +// Created by Kiouche on 1/20/2020. +// + +#ifndef P_K_COMPRESSION_HASH_H +#define P_K_COMPRESSION_HASH_H + + + + +#include <string> +#include <vector> + +namespace std { + + +/* Combination hash from Boost */ + template <class T> + inline void hash_combine(size_t& seed, const T& v) + { + hash<T> hasher; + seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + + template<typename S, typename T> struct hash<pair<S, T>> +{ + inline size_t operator()(const pair<S, T>& v) const + { + size_t seed = 0; + hash_combine(seed, v.first); + hash_combine(seed, v.second); + return seed; + } + +}; +/* End combination hash from Boost */ + + + +} + + +#endif //P_K_COMPRESSION_HASH_H -- GitLab