Migrated AMG to multiple contexts.

Also improved efficiency a little while doing so.
Reduced vector instantiation overhead by using clear() instead of copying from std::vector<>

vector_assign() has an optional third boolean flag which indicated whether the value
should be assigned to the whole buffer rather than the whole vector (only of interest if internal_size() > size())