Algorithms for manipulating real matrices