3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 05:43:40 +01:00

arrays: fix mapped_function (conj overload)

- conj overload should return complex, as in standard.
- changed the test output for mapped_function.
- fixed make_matrix_view and example in doc.
This commit is contained in:
Olivier Parcollet 2013-12-30 18:06:36 +01:00
parent 5b8113b46a
commit 59b969dbd3
4 changed files with 11 additions and 14 deletions

View File

@ -43,9 +43,9 @@
[[2.71828,7.38906]
[20.0855,54.5982]]
(make_matrix(conj(A))) --->
[[1,3,5]
[2,4,6]
[3,5,7]]
[[(1,0),(3,0),(5,0)]
[(2,0),(4,0),(6,0)]
[(3,0),(5,0),(7,0)]]
(A) --->
[[1,3,5]
[2,4,6]
@ -91,9 +91,9 @@
[[2.71828,7.38906]
[20.0855,54.5982]]
(make_matrix(conj(A))) --->
[[1,3,5]
[2,4,6]
[3,5,7]]
[[(1,0),(3,0),(5,0)]
[(2,0),(4,0),(6,0)]
[(3,0),(5,0),(7,0)]]
(A) --->
[[1,3,5]
[2,4,6]

View File

@ -27,9 +27,9 @@ namespace triqs { namespace arrays {
// not for libc++ (already defined)
#if !defined(_LIBCPP_VERSION)
// complex conjugation for integers
inline int conj(int x) { return x; }
inline long conj(long x) { return x; }
inline long long conj(long long x) { return x; }
inline std::complex<double> conj(int x) { return x; }
inline std::complex<double> conj(long x) { return x; }
inline std::complex<double> conj(long long x) { return x; }
inline std::complex<double> conj(double x) { return x; }
#endif

View File

@ -208,18 +208,15 @@ namespace triqs { namespace arrays {
#undef _IMPL_MATRIX_COMMON
#undef IMPL_TYPE
/*
template<typename ArrayType>
matrix_view<typename ArrayType::value_type, ArrayType::opt_flags, ArrayType::traversal_order>
make_matrix_view(ArrayType const & a) {
static_assert(ArrayType::rank ==2, "make_matrix_view only works for array of rank 2");
return a;
}
*/
template<typename ArrayType>
matrix<typename ArrayType::value_type> //, ArrayType::opt_flags, ArrayType::traversal_order>
matrix<typename ArrayType::value_type>
make_matrix(ArrayType const & a) {
static_assert(ArrayType::domain_type::rank ==2, "make_matrix only works for array of rank 2");
return a;