template <int N, typename T>
T
fixed_power (const T t);
+
+ /**
+ * Given a permutation vector (i.e. a
+ * vector $p_0\ldots p_{N-1}$ where each
+ * $p_i\in [0,N)$ and $p_i\neq p_j$ for
+ * $i\neq j$), produce the reverse
+ * permutation $q_i=N-1-p_i$.
+ */
+ std::vector<unsigned int>
+ reverse_permutation (const std::vector<unsigned int> &permutation);
+
+ /**
+ * Given a permutation vector (i.e. a
+ * vector $p_0\ldots p_{N-1}$ where each
+ * $p_i\in [0,N)$ and $p_i\neq p_j$ for
+ * $i\neq j$), produce the inverse
+ * permutation $q_0\ldots q_{N-1}$ so that
+ * $q_{p_i}=p_{q_i}=i$.
+ */
+ std::vector<unsigned int>
+ invert_permutation (const std::vector<unsigned int> &permutation);
/**
* A namespace for utility functions that
+ std::vector<unsigned int>
+ reverse_permutation (const std::vector<unsigned int> &permutation)
+ {
+ const unsigned int n = permutation.size();
+
+ std::vector<unsigned int> out (n);
+ for (unsigned int i=0; i<n; ++i)
+ out[i] = n - 1 - permutation[i];
+
+ return out;
+ }
+
+
+
+ std::vector<unsigned int>
+ invert_permutation (const std::vector<unsigned int> &permutation)
+ {
+ const unsigned int n = permutation.size();
+
+ std::vector<unsigned int> out (n, numbers::invalid_unsigned_int);
+
+ for (unsigned int i=0; i<n; ++i)
+ {
+ Assert (permutation[i] < n, ExcIndexRange (permutation[i], 0, n));
+ out[permutation[i]] = i;
+ }
+
+ // check that we have actually reached
+ // all indices
+ for (unsigned int i=0; i<n; ++i)
+ Assert (out[i] != numbers::invalid_unsigned_int,
+ ExcMessage ("The given input permutation had duplicate entries!"));
+
+ return out;
+ }
+
+
+
+
namespace System
{
#if defined(__linux__)
<h3>base</h3>
<ol>
+ <li>
+ <p>
+ New: The Utilities::reverse_permutation and Utilities::invert_permutation
+ compute the reverse and inverse of a given permutation of indices.
+ <br>
+ (WB 2008/10/31)
+ </p>
+
<li>
<p>
Fixed: The PolynomialsRaviartThomas class had a bug that led to random
<h3>deal.II</h3>
<ol>
+ <li>
+ <p>
+ Fixed: The DoFRenumbering::Cuthill_McKee algorithm had a bug when applied
+ to MGDoFHandler objects and if the <code>reverse</code> flag was set. This
+ should now be fixed.
+ <br>
+ (WB 2008/10/31)
+ </p>
+
<li>
<p>
New: MatrixTools::apply_boundary_values() also for PETScWrappers::MPI::BlockSparseMatrix.