<ol>
<li> <p>
- Changed: The <code class="class">Vector</code> and
+ New: There is now a function
+ <code class="member">FullMatrix::precondition_Jacobi</code>. The
+ <code class="class">PreconditionJacobi</code> class is
+ therefore now also applicable with the full matrix class.
+ <br>
+ (WB 2001/08/11)
+ </p>
+
+ <li> <p>
+ New: The <code class="class">Vector</code> and
<code class="class">BlockVector</code> classes can now be
initialized using a new constructor that takes two iterators
that denote a range of elements which are to be copied.
*/
void invert (const FullMatrix<number> &M);
+ /**
+ * Apply the Jacobi
+ * preconditioner, which
+ * multiplies every element of
+ * the @p{src} vector by the
+ * inverse of the respective
+ * diagonal element and
+ * multiplies the result with the
+ * damping factor @p{omega}.
+ */
+ template <typename somenumber>
+ void precondition_Jacobi (Vector<somenumber> &dst,
+ const Vector<somenumber> &src,
+ const number omega = 1.) const;
+
/**
* $A(i,1-n)+=s*A(j,1-n)$.
* Simple addition of rows of this
}
default:
+ // if no inversion is
+ // hardcoded, fall back
+ // to use the
+ // Gauss-Jordan algorithm
*this = M;
gauss_jordan();
};
};
+template <typename number>
+template <typename somenumber>
+void
+FullMatrix<number>::precondition_Jacobi (Vector<somenumber> &dst,
+ const Vector<somenumber> &src,
+ const number om) const
+{
+ Assert (m() == n(), ExcNotQuadratic());
+ Assert (dst.size() == n(), ExcDimensionMismatch (dst.size(), n()));
+ Assert (src.size() == n(), ExcDimensionMismatch (src.size(), n()));
+
+ const unsigned int n = src.size();
+ somenumber *dst_ptr = dst.begin();
+ const somenumber *src_ptr = src.begin();
+
+ for (unsigned int i=0; i<n; ++i, ++dst_ptr, ++src_ptr)
+ *dst_ptr = om * *src_ptr / el(i,i);
+};
+
+
+
template <typename number>
void
FullMatrix<number>::print_formatted (std::ostream &out,
template void FullMatrix<TYPEMAT>::householder(Vector<TYPEVEC>&);
template double FullMatrix<TYPEMAT>::least_squares(Vector<TYPEVEC>&, Vector<TYPEVEC>&);
+template
+void FullMatrix<TYPEMAT>::precondition_Jacobi (Vector<TYPEVEC> &,
+ const Vector<TYPEVEC> &,
+ const TYPEMAT) const;
+
+
#undef TYPEVEC
#define TYPEVEC float
template void FullMatrix<TYPEMAT>::householder(Vector<TYPEVEC>&);
template double FullMatrix<TYPEMAT>::least_squares(Vector<TYPEVEC>&, Vector<TYPEVEC>&);
+template
+void FullMatrix<TYPEMAT>::precondition_Jacobi (Vector<TYPEVEC> &,
+ const Vector<TYPEVEC> &,
+ const TYPEMAT) const;
+
#undef TYPERES
#define TYPERES float
template void FullMatrix<TYPEMAT>::backward(Vector<TYPEVEC>&, const Vector<TYPEVEC>&) const;
template void FullMatrix<TYPEMAT>::householder(Vector<TYPEVEC>&);
template double FullMatrix<TYPEMAT>::least_squares(Vector<TYPEVEC>&, Vector<TYPEVEC>&);
+template
+void FullMatrix<TYPEMAT>::precondition_Jacobi (Vector<TYPEVEC> &,
+ const Vector<TYPEVEC> &,
+ const TYPEMAT) const;
#undef TYPEVEC
#define TYPEVEC float
template void FullMatrix<TYPEMAT>::backward(Vector<TYPEVEC>&, const Vector<TYPEVEC>&) const;
template void FullMatrix<TYPEMAT>::householder(Vector<TYPEVEC>&);
template double FullMatrix<TYPEMAT>::least_squares(Vector<TYPEVEC>&, Vector<TYPEVEC>&);
+template
+void FullMatrix<TYPEMAT>::precondition_Jacobi (Vector<TYPEVEC> &,
+ const Vector<TYPEVEC> &,
+ const TYPEMAT) const;
#undef TYPERES