Set an element
void set(Body bi, Body bj, bool value) { int i = bi.index; int j = bj.index; if (j > i) { final temp = j; j = i; i = temp; } matrix[((i * (i + 1) >> 1)) + j - 1] = value ? 1 : 0; }