void reinit (const SparsityPattern &sparsity);
/**
- * Perform the incomplete LU factorization
- * of the given matrix.
+ * Perform the incomplete LU
+ * factorization of the given
+ * matrix.
*
- * Note that the sparsity structures of
- * the decomposition and the matrix passed
- * to this function need not be equal,
- * but that the pattern used by this
- * matrix needs to contain all elements
- * used by the matrix to be decomposed.
- * Fill-in is thus allowed.
+ * Note that the sparsity
+ * structures of the
+ * decomposition and the matrix
+ * passed to this function need
+ * not be equal, but that the
+ * pattern used by this matrix
+ * needs to contain all elements
+ * used by the matrix to be
+ * decomposed. Fill-in is thus
+ * allowed.
*/
template <typename somenumber>
void decompose (const SparseMatrix<somenumber> &matrix,
const Vector<somenumber> &src) const;
/**
- * Same as @p{apply_decomposition}, format for LAC.
+ * Same as
+ * @p{apply_decomposition},
+ * format for LAC.
*/
template <typename somenumber>
void vmult (Vector<somenumber> &dst,
// columns are sorted within each
// row correctly, but excluding
// the main diagonal entry
- bool left_of_diagonal = true;
+ const int global_index_ki = sparsity(*col_ptr,row);
+
+ if (global_index_ki != -1)
+ diag_element(row) -= global_entry(global_index_ik) *
+ global_entry(global_index_ki);
+
for (const unsigned int * j = col_ptr+1;
j<&column_numbers[rowstart_indices[row+1]];
++j)
// row linearly. I just didn't
// have the time to figure out
// the details.
-
- // check whether we have just
- // traversed the diagonal
- //
- // note that j should never point
- // to the diagonal itself!
- if (left_of_diagonal && (*j > row))
- {
- Assert (*j != row, ExcInternalError());
-
- left_of_diagonal = false;
- // a[i,i] -= a[i,k]*a[k,i]
- const int global_index_ki = sparsity(*col_ptr,row);
-
- if (global_index_ki != -1)
- diag_element(row) -= global_entry(global_index_ik) *
- global_entry(global_index_ki);
-
- };
-
const int global_index_ij = j - &column_numbers[0],
global_index_kj = sparsity(*col_ptr,*j);
if ((global_index_ij != -1) &&
};
};
+ // Here the very last diagonal
+ // element still has to be inverted
+ // because the for-loop doesn't do
+ // it...
+ diag_element(m()-1)=1./diag_element(m()-1);
+
/*
OLD CODE, rather crude first implementation with an algorithm taken
from 'W. Hackbusch, G. Wittum: Incomplete Decompositions (ILU)-