21 void gaussSeidelSweep(
const gsSparseMatrix<T> & A, gsMatrix<T>& x,
const gsMatrix<T>& f)
23 GISMO_ASSERT( A.rows() == x.rows() && x.rows() == f.rows() && A.cols() == A.rows() && x.cols() == f.cols(),
24 "Dimensions do not match.");
26 GISMO_ASSERT( f.cols() == 1,
"This operator is only implemented for a single right-hand side." );
29 for (
index_t i = 0; i < A.outerSize(); ++i)
34 for (
typename gsSparseMatrix<T>::InnerIterator it(A,i); it; ++it)
36 sum += it.value() * x( it.index() );
41 x(i) += (f(i) - sum) / diag;
46 void reverseGaussSeidelSweep(
const gsSparseMatrix<T> & A, gsMatrix<T>& x,
const gsMatrix<T>& f)
48 GISMO_ASSERT( A.rows() == x.rows() && x.rows() == f.rows() && A.cols() == A.rows() && x.cols() == f.cols(),
49 "Dimensions do not match.");
51 GISMO_ASSERT( f.cols() == 1,
"This operator is only implemented for a single right-hand side." );
54 for (
index_t i = A.outerSize() - 1; i >= 0; --i)
59 for (
typename gsSparseMatrix<T>::InnerIterator it(A,i); it; ++it)
61 sum += it.value() * x( it.index() );
66 x(i) += (f(i) - sum) / diag;
#define index_t
Definition: gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89