function E = EM1(n,i,k) % EM1 elementary matrix of type I. % % EM1(n,i,k) is an n-by-n matrix that permutes % (interchanges) the i-th and k-th row any n-by-m % matrix A (when multiplying A on the left). % % Matt Kawski 7-10-99 % http://math.la.asu.edu/~kawski % kawski@asu.edu % E = eye(n); if ( i > n ) disp('First index exceeds matrix dimension') elseif ( i > n ) disp('Second index exceeds matrix dimension') else E(i,i) = 0; E(i,k) = 1; E(k,i) = 1; E(k,k) = 0; end