Optimised algebra

The test bugreport_1370 breaks if it's compiled with high optimisation (this is what the test is actually about). Besides that, everything seems to work fine now.