[PATCH NNGT] Maintenance: C++ tuple hash/equal functions, doc
Export this patch
From: Tanguy Fardet <tanguyfardet@protonmail.com>
---
.build.yml | 7 +++++++
doc/_templates/base.html | 5 +++--
nngt/generation/func_connect.h | 15 +++++++++------
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/.build.yml b/.build.yml
index 0a2c4fb..94b9437 100644
--- a/.build.yml
+++ b/.build.yml
@@ -4,6 +4,7 @@ sources:
secrets:
- ceb490c3-68b4-41f7-9aa9-eb2e4b91d424
- 0b249c79-8eaf-4b82-b1d1-f3c38c7eae4b
+ - 3a7c042a-24d8-4f53-b75c-f061f7517b65
tasks:
- check: |
mv .coveralls.yml NNGT/.coveralls.yml || true
@@ -37,3 +38,9 @@ tasks:
coverage combine
GIT_BRANCH=$(git show -s --pretty=%D HEAD | tr -s ', /' '\n' | grep -v HEAD | sed -n 2p)
CI_NAME=$BUILD_SUBMITTER CI_BUILD_NUMBER=$JOB_ID CI_BUILD_URL=$JOB_URL CI_BRANCH=$GIT_BRANCH coveralls || true
+ - doc: |
+ GIT_BRANCH=$(git show -s --pretty=%D HEAD | tr -s ', /' '\n' | grep -v HEAD | sed -n 2p)
+ set +x
+ . ~/.rtd_nngt
+ if [ "$GIT_BRANCH" == "main" ]; then curl -X POST -d "branches=main" -d "token=$rtd_nngt_token" https://readthedocs.org/api/v2/webhook/nngt/214030/; fi
+ set -x
diff --git a/doc/_templates/base.html b/doc/_templates/base.html
index 59dc79b..255875c 100644
--- a/doc/_templates/base.html
+++ b/doc/_templates/base.html
@@ -1,5 +1,6 @@
{% extends "!base.html" %}
{% block site_meta %}
- <meta name="keywords" content="nngt, network, graph, topology, complex networks, networkx, igraph, graph-tool, neuron, neuronal, python, nest" />
- <meta name="description" content="Documentation for the python module NNGT, aimed at generating and analyzing complex graphs, with specific additions for GIS and to describe neuronal networks plus interface them with simulators." />
+ <meta charset="utf-8">
+ <meta name="keywords" content="nngt, network, graph, topology, complex networks, networkx, igraph, graph-tool, neuron, neuronal, python, nest">
+ <meta name="description" content="Documentation for the python module NNGT, aimed at generating and analyzing complex graphs, with specific additions for GIS and to describe neuronal networks plus interface them with simulators.">
{% endblock %}
diff --git a/nngt/generation/func_connect.h b/nngt/generation/func_connect.h
index e7731de..96b80f2 100644
--- a/nngt/generation/func_connect.h
+++ b/nngt/generation/func_connect.h
@@ -22,15 +22,18 @@ namespace generation {
typedef std::tuple<size_t, size_t> edge_t;
-struct key_hash : public std::unary_function<edge_t, std::size_t>
+struct key_hash
{
- std::size_t operator()(const edge_t& k) const
- {
- return std::get<0>(k) ^ std::get<1>(k);
- }
+ std::size_t operator()(const edge_t& k) const
+ {
+ std::size_t h1 = std::hash<size_t>{}(std::get<0>(k));
+ std::size_t h2 = std::hash<size_t>{}(std::get<1>(k));
+
+ return h1 ^ (h2 + 0x9e3779b9 + (h1 << 6) + (h1 >> 2));
+ }
};
-struct key_equal : public std::binary_function<edge_t, edge_t, bool>
+struct key_equal
{
bool operator()(const edge_t& v0, const edge_t& v1) const
{
--
2.34.4
NNGT/patches/.build.yml: SUCCESS in 24m13s
[Maintenance: C++ tuple hash/equal functions, doc][0] from [~tfardet][1]
[0]: https://lists.sr.ht/~tfardet/nngt-developers/patches/35658
[1]: mailto:tanguyfardet@protonmail.com
✓ #852285 SUCCESS NNGT/patches/.build.yml https://builds.sr.ht/~tfardet/job/852285