triqs.operators.util.hamiltonians.make_operator_real

triqs.operators.util.hamiltonians.make_operator_real(H, tol=0)[source]

Return the real part of an operator, checking that its imaginary part is below tolerance.

Parameters:
HOperator

The operator to be converted.

tolfloat, optional

Tolerance on the magnitude of the imaginary part of every coefficient. An exception is raised if any coefficient has an imaginary part larger than tol.

Returns:
Operator

The real part of \(\hat{H}\).