fix bug in linear registration
revise matrix.hpp