25 template <
class Mat2x2Type>
28 std::complex<double> delta = U(0,0)*U(1,1) - U(0,1)*U(1,0);
29 std::complex<double> tau = U(0,0) + U(1,1);
30 std::complex<double> s = sqrt(delta);
31 std::complex<double> t = sqrt(tau + 2.0*s);
36 std::complex<double> scale_factor(1.,0.);
38 V(0,0) *= scale_factor;
39 V(0,1) *= scale_factor;
40 V(1,0) *= scale_factor;
41 V(1,1) *= scale_factor;
53 template <
class Mat2x2Type>
55 Mat2x2Type Uadjoint(U);
56 std::complex<double>
tmp;
58 Uadjoint(0,1) = Uadjoint(1,0);
60 Uadjoint(0,0) = std::conj(Uadjoint(0,0));
61 Uadjoint(0,1) = std::conj(Uadjoint(0,1));
62 Uadjoint(1,0) = std::conj(Uadjoint(1,0));
63 Uadjoint(1,1) = std::conj(Uadjoint(1,1));
const Mat2x2Type matrixSqrt(const Mat2x2Type &U)
Calculates the unitary matrix square root (U == VV, where V is returned)
Mat2x2Type adjointMatrix(const Mat2x2Type &U)
Function to calculate the adjoint of an input matrix.