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:
assert(e != Edge());
size_t r = b[get_source(e, g)];
auto& r_elist = _egroups[r];
insert_edge(std::make_tuple(e, true), r_elist, weight,
_epos[e].first);
insert_edge(std::make_tuple(e, true), r_elist, weight, _epos[e].first);
size_t s = b[get_target(e, g)];
auto& s_elist = _egroups[s];
insert_edge(std::make_tuple(e, false), s_elist, weight,
_epos[e].second);
insert_edge(std::make_tuple(e, false), s_elist, weight, _epos[e].second);
}
template <class Edge, class EV>
......@@ -183,15 +181,17 @@ public:
{
if (pos >= elist.size() || elist[pos] != e)
return;
if (get<1>(elist.back()))
_epos[get<0>(elist.back())].first = pos;
auto& back = elist.back();
if (get<1>(back))
_epos[get<0>(back)].first = pos;
else
_epos[get<0>(elist.back())].second = pos;
if (get<1>(elist[pos]))
_epos[get<0>(elist[pos])].first = numeric_limits<size_t>::max();
_epos[get<0>(back)].second = pos;
auto& epos = elist[pos];
if (get<1>(epos))
_epos[get<0>(epos)].first = numeric_limits<size_t>::max();
else
_epos[get<0>(elist[pos])].second = numeric_limits<size_t>::max();
elist[pos] = elist.back();
_epos[get<0>(epos)].second = numeric_limits<size_t>::max();
epos = back;
elist.pop_back();
if (elist.empty())
......@@ -203,10 +203,11 @@ public:
{
if (pos >= elist.size() || elist[pos] != e)
return;
if (get<1>(elist[pos]))
_epos[get<0>(elist[pos])].first = numeric_limits<size_t>::max();
auto& epos = elist[pos];
if (get<1>(epos))
_epos[get<0>(epos)].first = numeric_limits<size_t>::max();
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);
if (elist.empty())
......
......@@ -219,7 +219,7 @@ public:
}
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)
{
auto& f = get_field(s, t);
......@@ -307,7 +307,7 @@ struct is_loop_nop
template <bool Remove, bool Add, class Vertex, class Graph, class Vprop,
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,
Eprop& eweights, MEntries& m_entries, Efilt&& efilt,
IL&& is_loop, Eprops&... eprops)
......@@ -420,6 +420,7 @@ void modify_entries(Vertex v, Vertex r, Vertex nr, Vprop& _b, Graph& g,
// after the move
template <class Graph, class Vertex, class VProp, class Eprop,
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,
Eprop& eweights, size_t B, MEntries& m_entries,
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,
// operation on a set of entries
template <class MEntries, class EMat, class OP>
inline __attribute__((always_inline))
void entries_op(MEntries& m_entries, EMat& emat, OP&& op)
{
const auto& entries = m_entries.get_entries();
......@@ -468,6 +470,7 @@ void entries_op(MEntries& m_entries, EMat& emat, OP&& op)
// operation on a set of entries, with edge covariates
template <class MEntries, class EMat, class OP>
inline __attribute__((always_inline))
void wentries_op(MEntries& m_entries, EMat& emat, OP&& op)
{
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