added matrix structure with gauss elimination