Bembel
Unroll.hpp
1 // This file is part of Bembel, the higher order C++ boundary element library.
2 //
3 // Copyright (C) 2022 see <http://www.bembel.eu>
4 //
5 // It was written as part of a cooperation of J. Doelz, H. Harbrecht, S. Kurz,
6 // M. Multerer, S. Schoeps, and F. Wolf at Technische Universitaet Darmstadt,
7 // Universitaet Basel, and Universita della Svizzera italiana, Lugano. This
8 // source code is subject to the GNU General Public License version 3 and
9 // provided WITHOUT ANY WARRANTY, see <http://www.bembel.eu> for further
10 // information.
11 #ifndef BEMBEL_SRC_SPLINE_UNROLL_HPP_
12 #define BEMBEL_SRC_SPLINE_UNROLL_HPP_
13 
14 namespace Bembel {
15 namespace Spl {
16 
21 // Unrolls a matrix into a vector. Y-Dir first.
22 template <typename T>
23 inline Eigen::Matrix<T, -1, 1> Unroll(
24  const Eigen::Matrix<T, -1, -1> &input_matrix) noexcept {
25  const int nx = input_matrix.cols();
26  const int ny = input_matrix.rows();
27  // std::cout << "unroll\n";
28  Eigen::Matrix<T, -1, 1> out(nx * ny, 1);
29  for (int i = 0; i < nx; i++) {
30  for (int j = 0; j < ny; j++) out(i * ny + j) = input_matrix(j, i);
31  }
32  return out;
33 }
34 } // namespace Spl
35 } // namespace Bembel
36 #endif // BEMBEL_SRC_SPLINE_UNROLL_HPP_
Eigen::Matrix< T, -1, 1 > Unroll(const Eigen::Matrix< T, -1, -1 > &input_matrix) noexcept
Tiny helper functions.
Definition: Unroll.hpp:23
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14