mirror of
https://github.com/triqs/dft_tools
synced 2024-12-24 13:23:37 +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:
parent
5b8113b46a
commit
59b969dbd3
@ -46,7 +46,7 @@ However, you can always use e.g. `matrix_view` from a array of rank 2 :
|
||||
//M + A; // --> ERROR. Rejected by the compiler.
|
||||
M + make_matrix_view(A); //--> OK.
|
||||
}
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Making such a view is very cheap, it only copies the index systems. Nevertheless
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user