merge with special_matrix branch