#include <base/exceptions.h>
#include <base/subscriptor.h>
+#include <vector>
// forward declarations
template<typename number> class Vector;
const unsigned int j=0);
+ /**
+ * Fill with permutation of another matrix.
+ *
+ * The matrix @p{src} is copied
+ * into the target. The two
+ * permutation @p{p_r} and
+ * @p{p_c} operate in a way, such
+ * that @{result(i,j) =
+ * src(p_r[i], p_c[j])}.
+ *
+ * The vectors may also be a
+ * selection from a larger set of
+ * integers, if the matrix
+ * @p{src} is bigger. It is also
+ * possible to duplicate rows or
+ * columns by this method.
+ */
+ template<typename number2>
+ void fill_permutation (const FullMatrix<number2> &src,
+ const std::vector<unsigned int>& p_rows,
+ const std::vector<unsigned int>& p_cols);
+
+
/**
* Fill matrix with an array of numbers.
* The array is arranged line by line. No
}
+template <typename number>
+template <typename number2>
+void FullMatrix<number>::fill_permutation (const FullMatrix<number2> &src,
+ const std::vector<unsigned int>& p_rows,
+ const std::vector<unsigned int>& p_cols)
+{
+ Assert (p_rows.size() == dim_image,
+ ExcDimensionMismatch (p_rows.size(), dim_image));
+ Assert (p_cols.size() == dim_range,
+ ExcDimensionMismatch (p_cols.size(), dim_range));
+
+ for (unsigned int i=0;i<dim_image;++i)
+ for (unsigned int j=0;j<dim_range;++j)
+ el(i,j) = src(p_rows[i], p_cols[j]);
+}
+
+
+
template <typename number>
template <typename number2>
void FullMatrix<number>::fill (const number2* entries)