System.arraycopy(row, 0, gauss[0], 0, row.length);
}
// 3. create leading 1
if(!gauss[0][firstCol].equals(RationalNumber.ONE)) {
final RationalNumber inverse = gauss[0][firstCol].multiplicativeInverse();
for(int col = 0; col < gauss[0].length; col++) {
gauss[0][col] = gauss[0][col].times(inverse);
}
}
// 4. eliminate values unequal to zero below leading 1
for(int row = 1; row < gauss.length; row++) {
final RationalNumber multiplier = gauss[row][firstCol].copy();
// if(multiplier != 0.0)
if(!multiplier.equals(RationalNumber.ZERO)) {
for(int col = firstCol; col < gauss[row].length; col++) {
final RationalNumber subtrahent = gauss[0][col].times(multiplier);
gauss[row][col] = gauss[row][col].minus(subtrahent);
}
}
}