// The Elementary Row Operations in Scilab
A = [1 2 3; 4 5 6; 7 8 9]
// Swap rows 1 and 3, need a temp
// Shorthand r1<->r2
temp = A(1,:) // row 1
A(1,:) = A(3,:); // row 1 has been replaced with row 3
A(3,:) = temp
// Multply row 2 by 7
// Shorthand r2 *= 7
A(2,:) = 7* A(2,:)
// Multiply row 1 by -2 and add to row 3
// Shorthand r3 += -2r1
A(3,:) = A(3,:) - 2* A(1,:)

// Example problem
B = [2 -2 4; 2 0 -2; -2 -4 14]
// Multiply row 1 by 1/2
// r1 *= 1/2
B(1,:) = B(1,:)/2
// Add -2 times row 1 to row 2
// r2 += -2r1
B(2,:) = B(2,:) - 2 *B(1,:)
// Add 2 times row 1 to row 3
// r3 += 2r1
B(3,:) = B(3,:) + 2 *B(1,:)
// Multiply row 2 by 1/2
// r2 *= 1/2
B(2,:) = B(2,:)/2
// Add 6 times row 2 to row 3
// r3 += 6r2
B(3,:) = B(3,:) + 6 *B(2,:)
// B is now in Row Echelon Form

// Continuing
// Add 1 time row 2 to row 1
// r1 += r2
B(1,:) = B(1,:) + B(2,:)
// B is now in Reduce Row Echelon Form

