Commit ac4eec83 authored by ehebrard's avatar ehebrard
Browse files

resize 0

parent ce67cc91
...@@ -105,7 +105,7 @@ int main(int argc, char *argv[]) { ...@@ -105,7 +105,7 @@ int main(int argc, char *argv[]) {
DistanceGraph<int> G(S2); DistanceGraph<int> G(S2);
cout << G << endl; cout << G << endl;
G.FloydWarshall(); G.FloydWarshall();
// cout << G << endl; // cout << G << endl;
......
...@@ -162,31 +162,35 @@ SparseDistanceGraph<T>::SparseDistanceGraph(Schedule<T> &s) ...@@ -162,31 +162,35 @@ SparseDistanceGraph<T>::SparseDistanceGraph(Schedule<T> &s)
template <typename T> void SparseDistanceGraph<T>::initialise() { template <typename T> void SparseDistanceGraph<T>::initialise() {
auto n{sched.numEvent()}; auto n{sched.numEvent()};
if(n > 0) {
predecessor.resize(n); predecessor.resize(n);
successor.resize(n); successor.resize(n);
for (auto v : sched.variables) { for (auto v : sched.variables) {
assert(v->from >= 0 and v->from < n); assert(v->from >= 0 and v->from < n);
assert(v->to >= 0 and v->to < n); assert(v->to >= 0 and v->to < n);
successor[v->from].push_back( successor[v->from].push_back(
{v, static_cast<int>(predecessor[v->to].size())}); {v, static_cast<int>(predecessor[v->to].size())});
predecessor[v->to].push_back( predecessor[v->to].push_back(
{v, static_cast<int>(successor[v->from].size())}); {v, static_cast<int>(successor[v->from].size())});
} }
vertices.reserve(n); vertices.reserve(n);
vertices.fill(); vertices.fill();
representant.resize(n); representant.resize(n);
tail.resize(n); tail.resize(n);
next.resize(n); next.resize(n);
prev.resize(n); prev.resize(n);
for (auto i = 0; i < n; ++i) { for (auto i = 0; i < n; ++i) {
representant[i] = tail[i] = next[i] = prev[i] = i; representant[i] = tail[i] = next[i] = prev[i] = i;
} }
}
// dbuffer.resize(n, -INFTY); // dbuffer.resize(n, -INFTY);
} }
......
Supports Markdown
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