diff --git a/src/common.hpp b/src/common.hpp index b7f4c4b95264f0f71100e934ee61e5d00d4e7596..394b2f215d12e38f3e277cde3933a96873ad0e6b 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -11,4 +11,14 @@ typedef CppAD::AD<double> ADDouble; typedef std::complex<ADDouble> ADComplex; +ADComplex adcomplex(const ADComplex& cpx) +{ + return {cpx}; +} + +ADComplex adcomplex(const std::complex<double>& cpx) +{ + return {cpx}; +} + #endif diff --git a/src/main.cpp b/src/main.cpp index c361b4e1050fce9c9ee605f32d554fdddb2fe8e5..1a79aada404fc0a2b9fc55abd1770dd664423090 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ #include "array.hpp" #include "action.hpp" +using namespace std::complex_literals; template <typename Scalar> void dump(Array<Scalar,3> Q) @@ -34,7 +35,9 @@ int main() //auto mat = Q.to_matrix(); auto mat = Q.to_fixed_matrix<2,2>(); - mat = mat * mat * mat; + mat = mat * mat * mat * adcomplex(1j); + + mat(0,0) = mat(1,1) = mat.trace(); dump(Q0); std::cout << mat << std::endl;