With some good help from the author of AMGCL, the code got a lot faster!