20 #ifndef bempp_armadillo_helpers_hpp
21 #define bempp_armadillo_helpers_hpp
23 #include "../common/common.hpp"
26 #include "../common/armadillo_fwd.hpp"
27 #include <dune/common/fvector.hh>
30 template<
typename M,
typename T,
int size>
31 bool _armadillo_fieldvector_compare(
const M& x,
const Dune::FieldVector<T, size>& y)
35 for (
int i = 0; i < size; ++i)
41 template<
typename M,
typename T,
int rows,
int cols>
42 bool _armadillo_fieldmatrix_compare(
const M& x,
const Dune::FieldMatrix<T, rows, cols>& y)
44 if (x.n_rows != rows || x.n_cols != cols)
46 for (
int j = 0; j < cols; ++j)
47 for (
int i = 0; i < rows; ++i)
48 if (x(i,j) != y[i][j])
53 template <
typename T,
int size>
54 bool operator==(
const arma::Col<T>& x,
const Dune::FieldVector<T, size>& y)
56 return _armadillo_fieldvector_compare(x, y);
59 template <
typename T,
int size>
60 bool operator==(
const Dune::FieldVector<T, size>& x,
const arma::Col<T>& y)
62 return _armadillo_fieldvector_compare(y, x);
65 template <
typename T,
int size>
66 bool operator==(
const arma::subview_col<T>& x,
const Dune::FieldVector<T, size>& y)
68 return _armadillo_fieldvector_compare(x, y);
71 template <
typename T,
int size>
72 bool operator==(
const Dune::FieldVector<T, size>& x,
const arma::subview_col<T>& y)
74 return _armadillo_fieldvector_compare(y, x);
77 template <
typename T,
int rows,
int cols>
78 bool operator==(
const arma::Mat<T>& x,
const Dune::FieldMatrix<T, rows, cols>& y)
80 return _armadillo_fieldmatrix_compare(x, y);
83 template <
typename T,
int rows,
int cols>
84 bool operator==(
const Dune::FieldMatrix<T, rows, cols>& x,
const arma::Mat<T>& y)
86 return _armadillo_fieldmatrix_compare(y, x);
100 template <
typename T,
int size>
101 bool operator==(const ::arma::Col<T>& x, const ::Dune::FieldVector<T, size>& y)
103 return ::operator==(x, y);
106 template <
typename T,
int size>
107 bool operator==(const ::Dune::FieldVector<T, size>& x, const ::arma::Col<T>& y)
109 return ::operator==(x, y);
112 template <
typename T,
int size>
113 bool operator==(
const arma::subview_col<T>& x,
const Dune::FieldVector<T, size>& y)
115 return ::operator==(x, y);
118 template <
typename T,
int size>
119 bool operator==(
const Dune::FieldVector<T, size>& x,
const arma::subview_col<T>& y)
121 return ::operator==(x, y);
124 template <
typename T,
int rows,
int cols>
125 bool operator==(
const arma::Mat<T>& x,
const Dune::FieldMatrix<T, rows, cols>& y)
127 return ::operator==(x, y);
130 template <
typename T,
int rows,
int cols>
131 bool operator==(
const Dune::FieldMatrix<T, rows, cols>& x,
const arma::Mat<T>& y)
133 return ::operator==(x, y);