adding pivoting
pivoting fix
fixing bug in matrix.c