Commit 8477c7ef authored by Tiago Peixoto's avatar Tiago Peixoto

blockmodel: small tweaks to egroups and forced inlining

parent a7496657
Pipeline #530 failed with stage
in 388 minutes and 9 seconds
...@@ -136,13 +136,11 @@ public: ...@@ -136,13 +136,11 @@ public:
assert(e != Edge()); assert(e != Edge());
size_t r = b[get_source(e, g)]; size_t r = b[get_source(e, g)];
auto& r_elist = _egroups[r]; auto& r_elist = _egroups[r];
insert_edge(std::make_tuple(e, true), r_elist, weight, insert_edge(std::make_tuple(e, true), r_elist, weight, _epos[e].first);
_epos[e].first);
size_t s = b[get_target(e, g)]; size_t s = b[get_target(e, g)];
auto& s_elist = _egroups[s]; auto& s_elist = _egroups[s];
insert_edge(std::make_tuple(e, false), s_elist, weight, insert_edge(std::make_tuple(e, false), s_elist, weight, _epos[e].second);
_epos[e].second);
} }
template <class Edge, class EV> template <class Edge, class EV>
...@@ -183,15 +181,17 @@ public: ...@@ -183,15 +181,17 @@ public:
{ {
if (pos >= elist.size() || elist[pos] != e) if (pos >= elist.size() || elist[pos] != e)
return; return;
if (get<1>(elist.back())) auto& back = elist.back();
_epos[get<0>(elist.back())].first = pos; if (get<1>(back))
_epos[get<0>(back)].first = pos;
else else
_epos[get<0>(elist.back())].second = pos; _epos[get<0>(back)].second = pos;
if (get<1>(elist[pos])) auto& epos = elist[pos];
_epos[get<0>(elist[pos])].first = numeric_limits<size_t>::max(); if (get<1>(epos))
_epos[get<0>(epos)].first = numeric_limits<size_t>::max();
else else
_epos[get<0>(elist[pos])].second = numeric_limits<size_t>::max(); _epos[get<0>(epos)].second = numeric_limits<size_t>::max();
elist[pos] = elist.back(); epos = back;
elist.pop_back(); elist.pop_back();
if (elist.empty()) if (elist.empty())
...@@ -203,10 +203,11 @@ public: ...@@ -203,10 +203,11 @@ public:
{ {
if (pos >= elist.size() || elist[pos] != e) if (pos >= elist.size() || elist[pos] != e)
return; return;
if (get<1>(elist[pos])) auto& epos = elist[pos];
_epos[get<0>(elist[pos])].first = numeric_limits<size_t>::max(); if (get<1>(epos))
_epos[get<0>(epos)].first = numeric_limits<size_t>::max();
else else
_epos[get<0>(elist[pos])].second = numeric_limits<size_t>::max(); _epos[get<0>(epos)].second = numeric_limits<size_t>::max();
elist.remove(pos); elist.remove(pos);
if (elist.empty()) if (elist.empty())
......
...@@ -219,7 +219,7 @@ public: ...@@ -219,7 +219,7 @@ public:
} }
template <bool Add, class... DVals> template <bool Add, class... DVals>
__attribute__((flatten)) inline __attribute__((always_inline)) __attribute__((flatten))
void insert_delta(size_t s, size_t t, int d, DVals&&... delta) void insert_delta(size_t s, size_t t, int d, DVals&&... delta)
{ {
auto& f = get_field(s, t); auto& f = get_field(s, t);
...@@ -307,7 +307,7 @@ struct is_loop_nop ...@@ -307,7 +307,7 @@ struct is_loop_nop
template <bool Remove, bool Add, class Vertex, class Graph, class Vprop, template <bool Remove, bool Add, class Vertex, class Graph, class Vprop,
class Eprop, class MEntries, class Efilt, class IL, class... Eprops> class Eprop, class MEntries, class Efilt, class IL, class... Eprops>
__attribute__((flatten)) inline __attribute__((always_inline)) __attribute__((flatten))
void modify_entries(Vertex v, Vertex r, Vertex nr, Vprop& _b, Graph& g, void modify_entries(Vertex v, Vertex r, Vertex nr, Vprop& _b, Graph& g,
Eprop& eweights, MEntries& m_entries, Efilt&& efilt, Eprop& eweights, MEntries& m_entries, Efilt&& efilt,
IL&& is_loop, Eprops&... eprops) IL&& is_loop, Eprops&... eprops)
...@@ -420,6 +420,7 @@ void modify_entries(Vertex v, Vertex r, Vertex nr, Vprop& _b, Graph& g, ...@@ -420,6 +420,7 @@ void modify_entries(Vertex v, Vertex r, Vertex nr, Vprop& _b, Graph& g,
// after the move // after the move
template <class Graph, class Vertex, class VProp, class Eprop, template <class Graph, class Vertex, class VProp, class Eprop,
class MEntries, class EFilt, class IL, class... Eprops> class MEntries, class EFilt, class IL, class... Eprops>
inline __attribute__((always_inline))
void move_entries(Vertex v, size_t r, size_t nr, VProp& _b, Graph& g, void move_entries(Vertex v, size_t r, size_t nr, VProp& _b, Graph& g,
Eprop& eweights, size_t B, MEntries& m_entries, Eprop& eweights, size_t B, MEntries& m_entries,
EFilt&& efilt, IL&& is_loop, Eprops&... eprops) EFilt&& efilt, IL&& is_loop, Eprops&... eprops)
...@@ -451,6 +452,7 @@ void move_entries(Vertex v, size_t r, size_t nr, VProp& _b, Graph& g, ...@@ -451,6 +452,7 @@ void move_entries(Vertex v, size_t r, size_t nr, VProp& _b, Graph& g,
// operation on a set of entries // operation on a set of entries
template <class MEntries, class EMat, class OP> template <class MEntries, class EMat, class OP>
inline __attribute__((always_inline))
void entries_op(MEntries& m_entries, EMat& emat, OP&& op) void entries_op(MEntries& m_entries, EMat& emat, OP&& op)
{ {
const auto& entries = m_entries.get_entries(); const auto& entries = m_entries.get_entries();
...@@ -468,6 +470,7 @@ void entries_op(MEntries& m_entries, EMat& emat, OP&& op) ...@@ -468,6 +470,7 @@ void entries_op(MEntries& m_entries, EMat& emat, OP&& op)
// operation on a set of entries, with edge covariates // operation on a set of entries, with edge covariates
template <class MEntries, class EMat, class OP> template <class MEntries, class EMat, class OP>
inline __attribute__((always_inline))
void wentries_op(MEntries& m_entries, EMat& emat, OP&& op) void wentries_op(MEntries& m_entries, EMat& emat, OP&& op)
{ {
const auto& entries = m_entries.get_entries(); const auto& entries = m_entries.get_entries();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment