Esempio n. 1
0
 public void toReducedRowEchelonForm() {
   InvertibleBinaryOperation<T> addition = ring.addition();
   InvertibleBinaryOperation<T> multiplication =
       (InvertibleBinaryOperation<T>) ring.multiplication();
   toRowEchelonForm();
   int j = 0;
   for (int i = 0; i < m; i++) {
     while (j < n) {
       T aij = get(i, j);
       if (!aij.equals(zero)) {
         aij = multiplication.inverse(aij);
         for (int k = j + 1; k < n; k++) {
           T aik = multiplication.op(get(i, k), aij);
           set(i, k, aik);
           for (int l = 0; l < i; l++)
             set(
                 l,
                 k,
                 addition.op(get(l, k), addition.inverse(multiplication.op(aik, get(l, j)))));
         }
         set(i, j, one);
         for (int l = 0; l < i; l++) set(l, j, zero);
         j++;
         break;
       }
       j++;
     }
   }
 }
Esempio n. 2
0
 public Matrix<T> getRowEchelonForm() {
   Matrix<T> rowEchelonForm = copy();
   rowEchelonForm.toRowEchelonForm();
   return rowEchelonForm;
 }