Basic matrix solver