* Performs out-place transposition.
* Matrix @p B should be appropriately sized.
*
+ * @note for complex number types, conjugate transpose will be performed.
+ *
* @note If deal.II is configured with Intel-MKL, `mkl_?omatcopy` will be used,
* otherwise transposition is done element by element.
*/
const types::blas_int m = B.m();
const types::blas_int n = B.n();
#ifdef DEAL_II_LAPACK_WITH_MKL
- mkl_omatcopy('C', 'T', n, m, 1., &A.values[0], n, &B.values[0], m);
+ const number one = 1.;
+ mkl_omatcopy('C', 'C', n, m, one, &A.values[0], n, &B.values[0], m);
#else
for (types::blas_int i = 0; i < m; ++i)
for (types::blas_int j = 0; j < n; ++j)
- B(i, j) = A(j, i);
+ B(i, j) = numbers::NumberTraits<number>::conjugate(A(j, i));
#endif
}
#include "../tests.h"
#include "create_matrix.h"
+template <typename T>
+std::string
+to_string(const T &t)
+{
+ std::ostringstream s;
+ s << t;
+ return s.str();
+}
+
template <typename NumberType>
void
test(const unsigned int n = 3, const unsigned int k = 6)
for (unsigned int i = 0; i < A.m(); ++i)
for (unsigned int j = 0; j < A.n(); ++j)
{
- const auto &at = At(j, i);
- const auto &a = A(i, j);
+ const auto at = At(j, i);
+ const auto a = numbers::NumberTraits<NumberType>::conjugate(A(i, j));
AssertThrow(at == a,
- ExcMessage(std::to_string(a) + "!=" + std::to_string(at) +
- " for (" + std::to_string(i) + "," +
- std::to_string(j) + ")"));
+ ExcMessage(to_string(a) + "!=" + to_string(at) + " for (" +
+ std::to_string(i) + "," + std::to_string(j) +
+ ")"));
}
deallog << "OK" << std::endl;
test<double>(11, 27);
test<double>(15, 4);
test<double>(10, 10);
+
+ test<std::complex<double>>(11, 27);
+ test<std::complex<double>>(15, 4);
+ test<std::complex<double>>(10, 10);
}