function X = swapRow(X,r1,r2)
% X is a matrix or vector.
% Its r1 and r2 rows are swapped and returned in X.
% K. Ming Leung, 02/22/04

Temp = X(r1,:);
X(r1,:) = X(r2,:);
X(r2,:) = Temp;
